@cronos-labs/ui 0.6.0 → 0.7.0

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.
@@ -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.0",
4
4
  "description": "Shared Header, Footer, Seo, locale and theme primitives for Cronos web properties.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",