@rebuy/rebuy 3.40.0 → 3.41.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.
- package/README.md +1 -1
- package/dist/cab/index.cjs +9 -0
- package/dist/cab/index.d.ts +1 -0
- package/dist/cab/index.mjs +9 -0
- package/dist/cab/resolveVariables.d.ts +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Node `^22.14.0 || ^24.10.0 || ^26.0.0` for development; the published artifacts
|
|
|
17
17
|
| Subpath | Contents |
|
|
18
18
|
| --- | --- |
|
|
19
19
|
| `@rebuy/rebuy` | Root barrel: schemas, client helpers, utilities |
|
|
20
|
-
| `@rebuy/rebuy/cab` | zod-free CAB renderer helpers shared by every renderer (`contentText`, `tiptapPlainText`, `tiptapRuns`, `asLayout`, `idFromGid`, `toCents`, `decoratedOrderId`, `reviewStars`, `utf8ByteLength`) |
|
|
20
|
+
| `@rebuy/rebuy/cab` | zod-free CAB renderer helpers shared by every renderer (`contentText`, `tiptapPlainText`, `tiptapRuns`, `asLayout`, `idFromGid`, `toCents`, `decoratedOrderId`, `reviewStars`, `utf8ByteLength`, `interpolateAndSanitize`, `resolveVariables`) |
|
|
21
21
|
| `@rebuy/rebuy/client` | `RebuyClient` API client |
|
|
22
22
|
| `@rebuy/rebuy/gwp` | Gift-with-purchase validation helpers |
|
|
23
23
|
| `@rebuy/rebuy/pricing` | Variant pricing/discount forecast (`priceVariant`, `currencyDecimals`) |
|
package/dist/cab/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ __export(cab_exports, {
|
|
|
26
26
|
idFromGid: () => idFromGid,
|
|
27
27
|
interpolateAndSanitize: () => interpolateAndSanitize,
|
|
28
28
|
isTiptapDoc: () => isTiptapDoc,
|
|
29
|
+
resolveVariables: () => resolveVariables,
|
|
29
30
|
reviewStars: () => reviewStars,
|
|
30
31
|
selectLanguage: () => selectLanguage,
|
|
31
32
|
tiptapPlainText: () => tiptapPlainText,
|
|
@@ -96,6 +97,14 @@ var decoratedOrderId = (orderId) => orderId?.match(/\/Order(?:Identity)?\/(\d+)$
|
|
|
96
97
|
// src/cab/gid.ts
|
|
97
98
|
var idFromGid = (gid) => gid.slice(gid.lastIndexOf("/") + 1);
|
|
98
99
|
|
|
100
|
+
// src/cab/resolveVariables.ts
|
|
101
|
+
var resolveVariables = (bag, against) => Object.fromEntries(
|
|
102
|
+
Object.entries(bag).map(([key, value]) => [
|
|
103
|
+
key,
|
|
104
|
+
typeof value === "string" ? interpolateAndSanitize(value, against) : value
|
|
105
|
+
])
|
|
106
|
+
);
|
|
107
|
+
|
|
99
108
|
// src/cab/reviewStars.ts
|
|
100
109
|
var STAR_WIDTH = 120;
|
|
101
110
|
var STAR_PATH = "M43 41C62 0 58 0 77 41c45 6 45 1 11 33 8 46 12 41-28 21-40 20-36 25-28-21C-2 42-2 47 43 41Z";
|
package/dist/cab/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from '../cab/contentText';
|
|
|
3
3
|
export * from '../cab/decoratedOrderId';
|
|
4
4
|
export * from '../cab/gid';
|
|
5
5
|
export * from '../cab/interpolateAndSanitize';
|
|
6
|
+
export * from '../cab/resolveVariables';
|
|
6
7
|
export * from '../cab/reviewStars';
|
|
7
8
|
export * from '../cab/selectLanguage';
|
|
8
9
|
export * from '../cab/tiptapPlain';
|
package/dist/cab/index.mjs
CHANGED
|
@@ -59,6 +59,14 @@ var decoratedOrderId = (orderId) => orderId?.match(/\/Order(?:Identity)?\/(\d+)$
|
|
|
59
59
|
// src/cab/gid.ts
|
|
60
60
|
var idFromGid = (gid) => gid.slice(gid.lastIndexOf("/") + 1);
|
|
61
61
|
|
|
62
|
+
// src/cab/resolveVariables.ts
|
|
63
|
+
var resolveVariables = (bag, against) => Object.fromEntries(
|
|
64
|
+
Object.entries(bag).map(([key, value]) => [
|
|
65
|
+
key,
|
|
66
|
+
typeof value === "string" ? interpolateAndSanitize(value, against) : value
|
|
67
|
+
])
|
|
68
|
+
);
|
|
69
|
+
|
|
62
70
|
// src/cab/reviewStars.ts
|
|
63
71
|
var STAR_WIDTH = 120;
|
|
64
72
|
var STAR_PATH = "M43 41C62 0 58 0 77 41c45 6 45 1 11 33 8 46 12 41-28 21-40 20-36 25-28-21C-2 42-2 47 43 41Z";
|
|
@@ -185,6 +193,7 @@ export {
|
|
|
185
193
|
idFromGid,
|
|
186
194
|
interpolateAndSanitize,
|
|
187
195
|
isTiptapDoc,
|
|
196
|
+
resolveVariables,
|
|
188
197
|
reviewStars,
|
|
189
198
|
selectLanguage,
|
|
190
199
|
tiptapPlainText,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Variables } from '../cab/interpolateAndSanitize';
|
|
2
|
+
/**
|
|
3
|
+
* ONE bounded interpolation pass over a bag's string values against `against`, so a token VALUE can itself
|
|
4
|
+
* carry tokens from a lower layer — `Hi {{firstName}}` as a declared header default or a data-source
|
|
5
|
+
* override (legacy replaced the placeholder inside the merged string). Deliberately not resolve-until-
|
|
6
|
+
* stable: a self-referential `{{title}}` stays literal, and tokens `against` doesn't know (a product token
|
|
7
|
+
* resolved later at the card merge) pass through intact. Non-strings are returned as-is.
|
|
8
|
+
*/
|
|
9
|
+
export declare const resolveVariables: (bag: Variables, against?: Variables) => Variables;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebuy/rebuy",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.41.0",
|
|
4
4
|
"description": "Shared zod schemas, legacy-to-CAB widget transforms, and server orchestrators for Rebuy's Shopify consumers (rebuy-api, admin-nextjs, rebuy-shopify-extensions)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Rebuy, Inc.",
|