Skip to content

Commit

Permalink
Works?
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-matt-hillsdon committed Mar 12, 2024
1 parent a4586c5 commit f9245e2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"crelt": "^1.0.5",
"dapjs": "2.2.0",
"dompurify": "^2.3.3",
"events": "^3.3.0",
"file-saver": "^2.0.5",
"framer-motion": "^10.2.4",
"lodash.debounce": "^4.0.8",
Expand Down
8 changes: 4 additions & 4 deletions src/deployment/default/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: MIT
*/
import { createContext } from "react";
import { CookieConsent, DeploymentConfig } from "..";
import { CookieConsent, DeploymentConfigFactory } from "..";
import { NullLogging } from "./logging";
import theme from "./theme";

Expand All @@ -16,7 +16,7 @@ const stubConsentContext = createContext<CookieConsent | undefined>(
stubConsentValue
);

const defaultDeployment: DeploymentConfig = {
const defaultDeploymentFactory: DeploymentConfigFactory = () => ({
chakraTheme: theme,
logging: new NullLogging(),
compliance: {
Expand All @@ -28,6 +28,6 @@ const defaultDeployment: DeploymentConfig = {
consentContext: stubConsentContext,
manageCookies: undefined,
},
};
});

export default defaultDeployment;
export default defaultDeploymentFactory;
9 changes: 7 additions & 2 deletions src/deployment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
import { ReactNode, useContext } from "react";
import { Logging } from "../logging/logging";

export type DeploymentConfigFactory = (
env: Record<string, string>
) => DeploymentConfig;

// This is configured via a vite alias, defaulting to ./default
import { default as d } from "theme-package";
export const deployment: DeploymentConfig = d;
import { default as df } from "theme-package";
const deploymentFactory: DeploymentConfigFactory = df;
export const deployment = deploymentFactory(import.meta.env);

export interface CookieConsent {
analytics: boolean;
Expand Down

0 comments on commit f9245e2

Please sign in to comment.