@gamaro.io/core-types 1.0.1 → 1.1.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.
package/README.md CHANGED
@@ -19,12 +19,13 @@ API and wants the same Zod schemas the official widget uses.
19
19
  ## Installation
20
20
 
21
21
  ```bash
22
- npm install @gamaro.io/core-types zod
22
+ npm install @gamaro.io/core-types
23
23
  # or
24
- pnpm add @gamaro.io/core-types zod
24
+ pnpm add @gamaro.io/core-types
25
25
  ```
26
26
 
27
- `zod` is a peer dependency: schemas are runtime-validatable.
27
+ `zod` is a direct dependency (pinned `4.6.5`, installed automatically): schemas
28
+ are runtime-validatable out of the box.
28
29
 
29
30
  ## Scope (ADR-006)
30
31
 
@@ -34,16 +35,17 @@ B2B qualification, scoring rules, …) stay in the workspace that owns the domai
34
35
 
35
36
  ## Public exports
36
37
 
37
- | Module | Contents |
38
- | ----------------------- | ------------------------------------------------------------------------ |
39
- | `theme` | `ThemeConfig`, hex-color constraints, default palette |
40
- | `theme-resolver` | Merges host-side theme with server-side theme; returns the final config |
41
- | `viewport` | Viewport bucket helpers (`mobile` / `tablet` / `desktop`) + breakpoints |
42
- | `widget-config` | `WidgetConfig` — the public contract of `createWidget(config)` |
43
- | `widget-runtime-config` | Internal runtime view of the resolved widget config (after server merge) |
44
- | `application-config` | Server-side Agent metadata (vertical, allowed origins, identity) |
45
- | `postmessage` | Discriminated unions for `window.postMessage` host ↔ iframe protocol |
46
- | `geo` | Lightweight geo primitives (`LatLng`, `BoundingBox`) |
38
+ | Module | Contents |
39
+ | ----------------------- | -------------------------------------------------------------------------------- |
40
+ | `theme` | `ThemeConfig`, hex-color constraints, default palette |
41
+ | `theme-resolver` | Merges host-side theme with server-side theme; returns the final config |
42
+ | `viewport` | Viewport bucket helpers (`mobile` / `tablet` / `desktop`) + breakpoints |
43
+ | `widget-config` | `WidgetConfig` — the public contract of `createWidget(config)` |
44
+ | `widget-runtime-config` | Internal runtime view of the resolved widget config (after server merge) |
45
+ | `application-config` | Server-side Agent metadata (vertical, allowed origins, identity) |
46
+ | `postmessage` | Discriminated unions for `window.postMessage` host ↔ iframe protocol |
47
+ | `geo` | Lightweight geo primitives (`LatLng`, `BoundingBox`) |
48
+ | `motion` | Motion tokens (`MOTION_DURATIONS`, `MOTION_EASINGS`, `MOTION_STAGGER`) — ADR-018 |
47
49
 
48
50
  ```typescript
49
51
  import type {
@@ -66,18 +68,19 @@ Some helpers are exposed on a **dedicated subpath**, deliberately kept out of
66
68
  the barrel above so they carry no `zod` dependency (import them directly, not
67
69
  from the package root):
68
70
 
69
- | Subpath | Contents |
70
- | ---------- | ----------------------------------------------------------------------------- |
71
- | `/session` | `getSessionCookieName`, `isValidSessionId` — pure session cookie / id helpers |
71
+ | Subpath | Contents |
72
+ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
73
+ | `/session` | `getApplicationSessionCookieName` (App-scoped, #3577), `getSessionCookieName` (legacy per-vertical, `@deprecated`), `isValidSessionId` — pure session cookie / id helpers |
74
+ | `/motion` | Motion tokens — also re-exported from the root barrel (ADR-018) |
72
75
 
73
76
  ```typescript
74
77
  import {
75
- getSessionCookieName,
78
+ getApplicationSessionCookieName,
76
79
  isValidSessionId,
77
80
  } from "@gamaro.io/core-types/session";
78
81
  ```
79
82
 
80
- All schemas are Zod 4 (`zod@^4.2.0`) and infer their TypeScript types via
83
+ All schemas are Zod 4 (`zod@4.6.5`) and infer their TypeScript types via
81
84
  `z.infer<typeof xxxSchema>` — the same `.parse()` / `.safeParse()` API as the
82
85
  widget itself.
83
86
 
package/dist/geo.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Geographic cross-boundary type contracts.
3
3
  *
4
- * Cross-boundary contract shared by the geo package (`@versiq/geo`) and the
4
+ * Cross-boundary contract shared by the geo module and the
5
5
  * app host (`apps/app`). Previously co-located in `apps/app/src/lib/ai/schemas/`
6
6
  * by historical happenstance — directions cardinales are not AI-specific, they
7
7
  * are pure geographic primitives.
package/dist/geo.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Geographic cross-boundary type contracts.
3
3
  *
4
- * Cross-boundary contract shared by the geo package (`@versiq/geo`) and the
4
+ * Cross-boundary contract shared by the geo module and the
5
5
  * app host (`apps/app`). Previously co-located in `apps/app/src/lib/ai/schemas/`
6
6
  * by historical happenstance — directions cardinales are not AI-specific, they
7
7
  * are pure geographic primitives.
package/dist/motion.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Canonical motion tokens for the Versiq widget — the single source of truth
2
+ * Canonical motion tokens for the Gamaro widget — the single source of truth
3
3
  * for animation durations, easing curves and stagger timing across BOTH widget
4
4
  * bundles (the vanilla loader in `packages/widget` and the React embed in
5
5
  * `apps/app/src/app/widget/embed`).
package/dist/motion.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Canonical motion tokens for the Versiq widget — the single source of truth
2
+ * Canonical motion tokens for the Gamaro widget — the single source of truth
3
3
  * for animation durations, easing curves and stagger timing across BOTH widget
4
4
  * bundles (the vanilla loader in `packages/widget` and the React embed in
5
5
  * `apps/app/src/app/widget/embed`).
package/dist/session.d.ts CHANGED
@@ -12,10 +12,24 @@
12
12
  * without dragging Zod in via the barrel `index.ts`.
13
13
  */
14
14
  /**
15
- * Per-vertical session cookie name. Each vertical owns its own cookie to prevent
16
- * profile-schema conflicts. Any character outside `[a-z0-9-]` (case-insensitive)
17
- * is sanitized to `_` (each char maps to one `_`, no collapsing), so
18
- * `real-estate` stays `gamaro_session_real-estate`.
15
+ * Application-scoped session cookie name — the CURRENT derivation (#3577).
16
+ *
17
+ * One cookie per Application: two Applications sharing a domain (and even a
18
+ * vertical) can no longer share a visitor session, which is what makes the
19
+ * profile scoping (`buyer_profiles.application_id`) provable
20
+ * (`apps/app/src/lib/security/session-resolution.ts`). The value is the
21
+ * Application UUID (`AuthContext.applicationId`), globally unique.
22
+ */
23
+ export declare function getApplicationSessionCookieName(applicationId: string): string;
24
+ /**
25
+ * Per-vertical session cookie name — LEGACY (#918 → #3577).
26
+ *
27
+ * Kept ONLY to read, re-emit or purge cookies issued before #3577 (verified
28
+ * hand-off of the visitor profile). Do not use for new cookies. Removal is
29
+ * coupled with the legacy read-path removal in epic #3154 step 3 (bascule).
30
+ *
31
+ * @deprecated Use {@link getApplicationSessionCookieName} for new cookies;
32
+ * this derivation survives only to read legacy cookies during the transition.
19
33
  */
20
34
  export declare function getSessionCookieName(verticalId: string): string;
21
35
  /**
package/dist/session.js CHANGED
@@ -12,14 +12,37 @@
12
12
  * without dragging Zod in via the barrel `index.ts`.
13
13
  */
14
14
  /**
15
- * Per-vertical session cookie name. Each vertical owns its own cookie to prevent
16
- * profile-schema conflicts. Any character outside `[a-z0-9-]` (case-insensitive)
17
- * is sanitized to `_` (each char maps to one `_`, no collapsing), so
18
- * `real-estate` stays `gamaro_session_real-estate`.
15
+ * Any character outside `[a-z0-9-]` (case-insensitive) is sanitized to `_`
16
+ * (each char maps to one `_`, no collapsing), so `real-estate` stays
17
+ * `gamaro_session_real-estate`.
18
+ */
19
+ function sanitizeCookieId(id) {
20
+ return id.replace(/[^a-z0-9-]/gi, "_");
21
+ }
22
+ /**
23
+ * Application-scoped session cookie name — the CURRENT derivation (#3577).
24
+ *
25
+ * One cookie per Application: two Applications sharing a domain (and even a
26
+ * vertical) can no longer share a visitor session, which is what makes the
27
+ * profile scoping (`buyer_profiles.application_id`) provable
28
+ * (`apps/app/src/lib/security/session-resolution.ts`). The value is the
29
+ * Application UUID (`AuthContext.applicationId`), globally unique.
30
+ */
31
+ export function getApplicationSessionCookieName(applicationId) {
32
+ return `gamaro_session_${sanitizeCookieId(applicationId)}`;
33
+ }
34
+ /**
35
+ * Per-vertical session cookie name — LEGACY (#918 → #3577).
36
+ *
37
+ * Kept ONLY to read, re-emit or purge cookies issued before #3577 (verified
38
+ * hand-off of the visitor profile). Do not use for new cookies. Removal is
39
+ * coupled with the legacy read-path removal in epic #3154 step 3 (bascule).
40
+ *
41
+ * @deprecated Use {@link getApplicationSessionCookieName} for new cookies;
42
+ * this derivation survives only to read legacy cookies during the transition.
19
43
  */
20
44
  export function getSessionCookieName(verticalId) {
21
- const sanitized = verticalId.replace(/[^a-z0-9-]/gi, "_");
22
- return `gamaro_session_${sanitized}`;
45
+ return `gamaro_session_${sanitizeCookieId(verticalId)}`;
23
46
  }
24
47
  /**
25
48
  * Validate the UUID shape of a session id. The length pre-check is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamaro.io/core-types",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "description": "Cross-workspace TypeScript contracts and Zod schemas consumed by @gamaro.io/widget. Intended as a peer of the widget SDK.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -58,7 +58,7 @@
58
58
  "zod": "4.6.5"
59
59
  },
60
60
  "devDependencies": {
61
- "@microsoft/api-extractor": "^7.59.2",
61
+ "@microsoft/api-extractor": "^7.59.3",
62
62
  "typescript": "^6.0.3"
63
63
  },
64
64
  "scripts": {