@rebuy/rebuy 2.30.0-rc.3 → 2.30.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/dist/gwp/types.d.ts +6 -1
- package/dist/gwp/types.d.ts.map +1 -1
- package/dist/index.js +36 -12
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +36 -12
- package/dist/index.mjs.map +2 -2
- package/dist/pricing/computeDisplayPrice.d.ts +8 -1
- package/dist/pricing/computeDisplayPrice.d.ts.map +1 -1
- package/dist/pricing/index.js +7 -4
- package/dist/pricing/index.js.map +2 -2
- package/dist/pricing/index.mjs +7 -4
- package/dist/pricing/index.mjs.map +2 -2
- package/dist/pricing/priceVariant.d.ts +3 -1
- package/dist/pricing/priceVariant.d.ts.map +1 -1
- package/dist/pricing/types.d.ts +5 -0
- package/dist/pricing/types.d.ts.map +1 -1
- package/dist/schema/cabShopConfig.d.ts +22 -20
- package/dist/schema/cabShopConfig.d.ts.map +1 -1
- package/dist/schema/checkout-and-beyond/index.js +18 -11
- package/dist/schema/checkout-and-beyond/index.js.map +2 -2
- package/dist/schema/checkout-and-beyond/index.mjs +18 -11
- package/dist/schema/checkout-and-beyond/index.mjs.map +2 -2
- package/dist/schema/widget-data.js +17 -11
- package/dist/schema/widget-data.js.map +2 -2
- package/dist/schema/widget-data.mjs +17 -11
- package/dist/schema/widget-data.mjs.map +2 -2
- package/dist/schema/widgetData.d.ts +27 -27
- package/dist/schema/widgets/checkout-and-beyond/regex.d.ts +5 -0
- package/dist/schema/widgets/checkout-and-beyond/regex.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/root.d.ts +18 -18
- package/dist/schema/widgets/checkout-and-beyond/root.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/text.d.ts +4 -4
- package/dist/schema/widgets/checkout-and-beyond/text.d.ts.map +1 -1
- package/dist/schema/widgets/contentBlock.d.ts +9 -9
- package/dist/schema/widgets/lineItemEditor.d.ts +9 -9
- package/dist/schema/widgets/post-purchase-offer/postPurchaseBlocks.d.ts +18 -18
- package/dist/schema/widgets/post-purchase-offer/postPurchaseOffer.d.ts +9 -9
- package/dist/schema/widgets/post-purchase-offer/postPurchaseSettings.d.ts +9 -9
- package/dist/schema/widgets/post-purchase-offer/postPurchaseWidget.d.ts +9 -9
- package/dist/schema/widgets/rebuyButton.d.ts +9 -9
- package/dist/server/adsEngine.d.ts +5 -4
- package/dist/server/adsEngine.d.ts.map +1 -1
- package/dist/server/analytics.d.ts +4 -2
- package/dist/server/analytics.d.ts.map +1 -1
- package/dist/server/composeOffer.d.ts +1 -1
- package/dist/server/composeOffer.d.ts.map +1 -1
- package/dist/server/dataSourceResults.d.ts +6 -0
- package/dist/server/dataSourceResults.d.ts.map +1 -1
- package/dist/server/giftValidation.d.ts +6 -0
- package/dist/server/giftValidation.d.ts.map +1 -1
- package/dist/server/index.js +133 -58
- package/dist/server/index.js.map +2 -2
- package/dist/server/index.mjs +133 -58
- package/dist/server/index.mjs.map +2 -2
- package/dist/server/monetizeOffers.d.ts.map +1 -1
- package/dist/server/salvageSections.d.ts.map +1 -1
- package/dist/server/shared.d.ts +2 -0
- package/dist/server/shared.d.ts.map +1 -1
- package/dist/transforms/experiments/resolveExperiment.d.ts.map +1 -1
- package/dist/transforms/htmlToTiptap/isValidHref.d.ts +4 -3
- package/dist/transforms/htmlToTiptap/isValidHref.d.ts.map +1 -1
- package/dist/transforms/index.js +39 -23
- package/dist/transforms/index.js.map +2 -2
- package/dist/transforms/index.mjs +39 -23
- package/dist/transforms/index.mjs.map +2 -2
- package/dist/transforms/progressBarV1/convertProgressBarToV2.d.ts.map +1 -1
- package/dist/transforms/progressBarV1/types.d.ts +8 -2
- package/dist/transforms/progressBarV1/types.d.ts.map +1 -1
- package/dist/transforms/smartCart/convertSmartCartProgressBarToV2.d.ts +3 -1
- package/dist/transforms/smartCart/convertSmartCartProgressBarToV2.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/gwp/types.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/** A gift-with-purchase cart line the client asks the server to validate. */
|
|
2
2
|
export type GwpGift = {
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* The gift line's total in the buyer's MARKET currency, MAJOR units (e.g. `19.99`) — a
|
|
5
|
+
* Function-discounted (free) gift is `0`. Only the zero/non-zero distinction is read
|
|
6
|
+
* (`cost > 0` ⇒ the gift lost its discount), so the exact unit isn't load-bearing; send the
|
|
7
|
+
* Shopify cart-line total as-is.
|
|
8
|
+
*/
|
|
4
9
|
cost: number;
|
|
5
10
|
/** Whether the Shopify Function discount is currently allocated to the line. */
|
|
6
11
|
discounted: boolean;
|
package/dist/gwp/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/gwp/types.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,MAAM,MAAM,OAAO,GAAG;IAClB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/gwp/types.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,MAAM,MAAM,OAAO,GAAG;IAClB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,UAAU,EAAE,OAAO,CAAC;IACpB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IACtB,KAAK,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,EAAE,CAAC;IAC1C,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE;YAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,EAAE,CAAC;CAC/D,CAAC;AAEF,yDAAyD;AACzD,MAAM,MAAM,WAAW,GAAG;IACtB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,cAAc,CAAC,EAAE,WAAW,EAAE,CAAC;CAClC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -110,6 +110,7 @@ __export(src_exports, {
|
|
|
110
110
|
ProgressTierUnit: () => ProgressTierUnit,
|
|
111
111
|
QuantityInput: () => QuantityInput,
|
|
112
112
|
REVIEW_LABELS: () => REVIEW_LABELS,
|
|
113
|
+
ROOT_RELATIVE_PATH_REGEX: () => ROOT_RELATIVE_PATH_REGEX,
|
|
113
114
|
RebuyButton: () => RebuyButton,
|
|
114
115
|
RebuyButtonV1: () => RebuyButtonV1,
|
|
115
116
|
RebuyClient: () => RebuyClient,
|
|
@@ -1066,8 +1067,25 @@ var CabActiveExperiment = import_zod2.z.object({
|
|
|
1066
1067
|
type: import_zod2.z.string()
|
|
1067
1068
|
});
|
|
1068
1069
|
var CabShopConfig = import_zod2.z.object({
|
|
1069
|
-
|
|
1070
|
+
/**
|
|
1071
|
+
* Per-element resilient: parse as `unknown[]` (non-array → `[]`), then keep only the experiments that
|
|
1072
|
+
* validate. A single drifted experiment drops itself instead of `.catch`-ing the WHOLE array to `[]` and
|
|
1073
|
+
* silently disabling every live A/B test fleet-wide.
|
|
1074
|
+
*/
|
|
1075
|
+
activeExperiments: import_zod2.z.array(import_zod2.z.unknown()).catch([]).default([]).transform(
|
|
1076
|
+
(experiments) => experiments.flatMap((experiment) => {
|
|
1077
|
+
const result = CabActiveExperiment.safeParse(experiment);
|
|
1078
|
+
return result.success ? [result.data] : [];
|
|
1079
|
+
})
|
|
1080
|
+
),
|
|
1070
1081
|
apiKey: import_zod2.z.string(),
|
|
1082
|
+
/**
|
|
1083
|
+
* The shop's base-currency ISO code (e.g. `'USD'`). CAB derives the shop minor-unit exponent from it
|
|
1084
|
+
* (`currencyDecimals`) so a Functions-applied fixed discount — whose amount is in shop minor units —
|
|
1085
|
+
* converts to the buyer's currency exactly in a cross-decimal market. `.catch()` like its siblings: a
|
|
1086
|
+
* missing/renamed currency degrades to "unknown" (client falls back to buyer decimals), never a parse fail.
|
|
1087
|
+
*/
|
|
1088
|
+
currency: import_zod2.z.string().optional().catch(void 0),
|
|
1071
1089
|
monetize: import_zod2.z.object({ publisherKey: import_zod2.z.string().nullable() }).nullish().catch(void 0),
|
|
1072
1090
|
shopId: import_zod2.z.number().optional().catch(void 0)
|
|
1073
1091
|
});
|
|
@@ -1800,6 +1818,7 @@ var import_zod12 = require("zod");
|
|
|
1800
1818
|
var ARRAY_INDEX_STRING = /^(0|[1-9]\d*)$/;
|
|
1801
1819
|
var DYNAMIC_TOKEN_REGEX = /^\{\{\s*[A-Za-z]+\s*\}\}$/;
|
|
1802
1820
|
var HEX_COLOR_REGEX = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
1821
|
+
var ROOT_RELATIVE_PATH_REGEX = /^\/(?!\/)/;
|
|
1803
1822
|
var HTML_TAGS_REGEX = /<\/?[a-zA-Z][^>]*>/g;
|
|
1804
1823
|
|
|
1805
1824
|
// src/schema/widgets/checkout-and-beyond/utils.ts
|
|
@@ -1882,7 +1901,12 @@ var TiptapText = import_zod13.z.object({
|
|
|
1882
1901
|
import_zod13.z.object({
|
|
1883
1902
|
attrs: import_zod13.z.object({
|
|
1884
1903
|
class: import_zod13.z.string().nullable(),
|
|
1885
|
-
href: import_zod13.z.union([
|
|
1904
|
+
href: import_zod13.z.union([
|
|
1905
|
+
import_zod13.z.url(),
|
|
1906
|
+
import_zod13.z.literal("#"),
|
|
1907
|
+
import_zod13.z.string().regex(DYNAMIC_TOKEN_REGEX),
|
|
1908
|
+
import_zod13.z.string().regex(ROOT_RELATIVE_PATH_REGEX)
|
|
1909
|
+
]),
|
|
1886
1910
|
rel: import_zod13.z.string().default("noopener noreferrer nofollow"),
|
|
1887
1911
|
target: import_zod13.z.string().default("_blank")
|
|
1888
1912
|
}),
|
|
@@ -2558,17 +2582,17 @@ var UI_LABELS = {
|
|
|
2558
2582
|
};
|
|
2559
2583
|
|
|
2560
2584
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
2561
|
-
var localized = () => import_zod29.z.record(import_zod29.z.string(), import_zod29.z.string());
|
|
2585
|
+
var localized = (fallback) => import_zod29.z.record(import_zod29.z.string(), import_zod29.z.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
2562
2586
|
var CABUILabels = import_zod29.z.object({
|
|
2563
|
-
currentPage: localized(
|
|
2564
|
-
loadingOptions: localized(
|
|
2565
|
-
nextPage: localized(
|
|
2566
|
-
offerDialog: localized(
|
|
2567
|
-
page: localized(
|
|
2568
|
-
previousPage: localized(
|
|
2569
|
-
selected: localized(
|
|
2570
|
-
subscriptionOptions: localized(
|
|
2571
|
-
updating: localized(
|
|
2587
|
+
currentPage: localized(UI_LABELS.currentPage),
|
|
2588
|
+
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
2589
|
+
nextPage: localized(UI_LABELS.nextPage),
|
|
2590
|
+
offerDialog: localized(UI_LABELS.offerDialog),
|
|
2591
|
+
page: localized(UI_LABELS.page),
|
|
2592
|
+
previousPage: localized(UI_LABELS.previousPage),
|
|
2593
|
+
selected: localized(UI_LABELS.selected),
|
|
2594
|
+
subscriptionOptions: localized(UI_LABELS.subscriptionOptions),
|
|
2595
|
+
updating: localized(UI_LABELS.updating)
|
|
2572
2596
|
}).default(() => ({
|
|
2573
2597
|
currentPage: { ...UI_LABELS.currentPage },
|
|
2574
2598
|
loadingOptions: { ...UI_LABELS.loadingOptions },
|