@cronos-labs/ui 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,7 +42,14 @@ export function Footer({ brandWordmarkSrc, columns, content, forceDocumentNaviga
42
42
  };
43
43
  const renderLegalLink = (link) => {
44
44
  if (link.isCookiePreferences) {
45
- return (_jsx(FooterLegalButton, { id: "ot-sdk-btn", className: "ot-sdk-show-settings", type: "button", onClick: onOpenCookiePreferences, children: link.label }));
45
+ // Deliberately not OneTrust's `#ot-sdk-btn.ot-sdk-show-settings` hook:
46
+ // the SDK rewrites any element carrying it with the label configured in
47
+ // the OneTrust admin ("Cookies Settings"), replacing the localized copy
48
+ // and, on the Astro sites, changing the server-rendered text before the
49
+ // island hydrates — React then throws a hydration error and re-renders
50
+ // the whole tree on the client. `onOpenCookiePreferences` already opens
51
+ // the preference centre through the OneTrust API directly.
52
+ return (_jsx(FooterLegalButton, { type: "button", onClick: onOpenCookiePreferences, children: link.label }));
46
53
  }
47
54
  if (link.disabled) {
48
55
  return _jsx(FooterLegalText, { "aria-disabled": "true", children: link.label });
@@ -19,7 +19,12 @@ export const FooterContainer = styled.div `
19
19
  margin: 0 auto;
20
20
 
21
21
  ${({ theme }) => theme.mediaQueries.lg} {
22
- width: min(calc(100% - (2 * ${({ theme }) => theme.layout.pagePaddingInlineWide})), 1209px);
22
+ /* The same shell as HeaderShell: the landing wide width with 80px
23
+ gutters. It was 1209px, 13px wider than the header it sits under. */
24
+ width: min(
25
+ calc(100% - (2 * ${({ theme }) => theme.layout.pagePaddingInlineWide})),
26
+ ${({ theme }) => theme.layout.landingWideWidth}
27
+ );
23
28
  margin: 0 auto;
24
29
  }
25
30
  `;
@@ -222,6 +227,10 @@ export const FooterLegalLink = styled.a `
222
227
  line-height: 1.3333;
223
228
  }
224
229
  `;
230
+ // The `!important`s below date from when this button carried OneTrust's
231
+ // `#ot-sdk-btn.ot-sdk-show-settings` hook and had to beat the SDK's own
232
+ // button styles. The hook is gone (see Footer/index.tsx); they are kept for
233
+ // now so this change stays limited to the label/hydration fix.
225
234
  export const FooterLegalButton = styled.button `
226
235
  display: inline !important;
227
236
  min-width: 0 !important;
@@ -93,6 +93,16 @@ export const HeaderShell = styled.header `
93
93
  calc(100% - (2 * ${({ theme }) => theme.layout.pagePaddingInline})),
94
94
  ${({ theme }) => theme.layout.landingWideWidth}
95
95
  );
96
+
97
+ ${({ theme }) => theme.mediaQueries.lg} {
98
+ /* The same 80px gutter the footer and every page shell use from 1024px;
99
+ with only the 16px gutter the header sat 64px further out than the
100
+ content beneath it between 1024px and 1276px. */
101
+ width: min(
102
+ calc(100% - (2 * ${({ theme }) => theme.layout.pagePaddingInlineWide})),
103
+ ${({ theme }) => theme.layout.landingWideWidth}
104
+ );
105
+ }
96
106
  margin: 0 auto;
97
107
  display: grid;
98
108
  grid-template-columns: 1fr auto;
@@ -0,0 +1,32 @@
1
+ export declare enum CronosEnvironment {
2
+ Staging = "staging",
3
+ Prod = "prod"
4
+ }
5
+ export interface CronosUrls {
6
+ cronos: string;
7
+ bridge: string;
8
+ launch: string;
9
+ }
10
+ /**
11
+ * Narrows a raw `VITE_ENVIRONMENT` value to a known environment.
12
+ *
13
+ * Staging is the fallback, not prod: an unset variable means a local dev
14
+ * server or a misconfigured preview, and pointing those at production
15
+ * traffic is the more expensive mistake. Production deploys set the
16
+ * variable explicitly.
17
+ *
18
+ * @param value Raw environment variable value, of unknown shape.
19
+ * @returns The matching environment, or staging when the value is unrecognised.
20
+ */
21
+ export declare const resolveCronosEnvironment: (value: unknown) => CronosEnvironment;
22
+ /**
23
+ * Resolves the origins of the three Cronos web apps for an environment.
24
+ *
25
+ * The apps link to each other across origins, so these have to move as a
26
+ * set — a staging build linking to a production sibling is the failure this
27
+ * prevents. Origins carry no trailing slash; callers append their own path.
28
+ *
29
+ * @param environment The environment the app is running in.
30
+ * @returns The sibling app origins for that environment.
31
+ */
32
+ export declare const resolveCronosUrls: (environment: CronosEnvironment) => CronosUrls;
@@ -0,0 +1,38 @@
1
+ export var CronosEnvironment;
2
+ (function (CronosEnvironment) {
3
+ CronosEnvironment["Staging"] = "staging";
4
+ CronosEnvironment["Prod"] = "prod";
5
+ })(CronosEnvironment || (CronosEnvironment = {}));
6
+ const PROD_URLS = {
7
+ cronos: 'https://cronos.com',
8
+ bridge: 'https://bridge.cronos.com',
9
+ launch: 'https://launch.cronos.com',
10
+ };
11
+ const STAGING_URLS = {
12
+ cronos: 'https://psta-cronos-landingpage-webui.crorc.co',
13
+ bridge: 'https://psta-cronos-bridge-webui.crorc.co',
14
+ launch: 'https://psta-cronos-launch-webui.crorc.co',
15
+ };
16
+ /**
17
+ * Narrows a raw `VITE_ENVIRONMENT` value to a known environment.
18
+ *
19
+ * Staging is the fallback, not prod: an unset variable means a local dev
20
+ * server or a misconfigured preview, and pointing those at production
21
+ * traffic is the more expensive mistake. Production deploys set the
22
+ * variable explicitly.
23
+ *
24
+ * @param value Raw environment variable value, of unknown shape.
25
+ * @returns The matching environment, or staging when the value is unrecognised.
26
+ */
27
+ export const resolveCronosEnvironment = (value) => value === CronosEnvironment.Prod ? CronosEnvironment.Prod : CronosEnvironment.Staging;
28
+ /**
29
+ * Resolves the origins of the three Cronos web apps for an environment.
30
+ *
31
+ * The apps link to each other across origins, so these have to move as a
32
+ * set — a staging build linking to a production sibling is the failure this
33
+ * prevents. Origins carry no trailing slash; callers append their own path.
34
+ *
35
+ * @param environment The environment the app is running in.
36
+ * @returns The sibling app origins for that environment.
37
+ */
38
+ export const resolveCronosUrls = (environment) => environment === CronosEnvironment.Prod ? PROD_URLS : STAGING_URLS;
package/dist/index.d.ts CHANGED
@@ -34,3 +34,5 @@ export { resetAutocompleteFillMarkersAfterInput } from './waitlist/autocompleteF
34
34
  export { clearWaitlistAttribution, getWaitlistBrowserContext } from './waitlist/attribution.js';
35
35
  export { cardSurface, cardHoverSurface, wellSurface } from './surfaces.js';
36
36
  export { Button, type ButtonProps, type ButtonVariant } from './Button/index.js';
37
+ export { CronosEnvironment, resolveCronosEnvironment, resolveCronosUrls } from './environment.js';
38
+ export type { CronosUrls } from './environment.js';
package/dist/index.js CHANGED
@@ -27,3 +27,4 @@ export { resetAutocompleteFillMarkersAfterInput } from './waitlist/autocompleteF
27
27
  export { clearWaitlistAttribution, getWaitlistBrowserContext } from './waitlist/attribution.js';
28
28
  export { cardSurface, cardHoverSurface, wellSurface } from './surfaces.js';
29
29
  export { Button } from './Button/index.js';
30
+ export { CronosEnvironment, resolveCronosEnvironment, resolveCronosUrls } from './environment.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cronos-labs/ui",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "Shared Header, Footer, Seo, locale and theme primitives for Cronos web properties.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",