@rebuy/rebuy 3.15.0 → 3.16.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/index.cjs +27 -25
- package/dist/index.mjs +27 -25
- package/dist/schema/checkout-and-beyond/constants.cjs +30 -1
- package/dist/schema/checkout-and-beyond/constants.mjs +30 -1
- package/dist/schema/checkout-and-beyond/index.cjs +27 -25
- package/dist/schema/checkout-and-beyond/index.mjs +27 -25
- package/dist/schema/widget-data.cjs +27 -25
- package/dist/schema/widget-data.mjs +27 -25
- package/dist/schema/widgets/checkout-and-beyond/common.d.ts +32 -0
- package/dist/schema/widgets/checkout-and-beyond/constants.d.ts +2 -26
- package/dist/schema/widgets/checkout-and-beyond/icons.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/image.d.ts +2 -2
- package/dist/schema/widgets/checkout-and-beyond/root.d.ts +2 -1
- package/dist/server/index.cjs +50 -26
- package/dist/server/index.mjs +50 -26
- package/dist/transforms/index.cjs +44 -25
- package/dist/transforms/index.d.ts +2 -0
- package/dist/transforms/index.mjs +44 -25
- package/dist/transforms/placeholderV1/convertPlaceholderToV2.d.ts +10 -0
- package/dist/transforms/placeholderV1/types.d.ts +20 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1790,6 +1790,33 @@ var variantSelectors = ["menu", "radio", "button"];
|
|
|
1790
1790
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
1791
1791
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
1792
1792
|
var VerticalAlignment = freezeEnum(verticalAlignments);
|
|
1793
|
+
var widgetTypes = [
|
|
1794
|
+
"bundle_builder",
|
|
1795
|
+
"cart",
|
|
1796
|
+
"cart_subscription",
|
|
1797
|
+
"dynamic_bundle",
|
|
1798
|
+
"gift_with_purchase",
|
|
1799
|
+
/** An A/B experiment's stand-in element (admin-api `createPlaceholder`); converts to an EMPTY tree. */
|
|
1800
|
+
"placeholder",
|
|
1801
|
+
"pre_purchase",
|
|
1802
|
+
"product",
|
|
1803
|
+
"product_addon",
|
|
1804
|
+
"product_upsell",
|
|
1805
|
+
"recharge_checkout",
|
|
1806
|
+
"recharge_customer_portal",
|
|
1807
|
+
"recharge_post_purchase",
|
|
1808
|
+
"shopify_checkout",
|
|
1809
|
+
"shopify_checkout_extension",
|
|
1810
|
+
"shopify_post_purchase",
|
|
1811
|
+
"shopify_post_purchase_extension",
|
|
1812
|
+
"switch_to_subscription",
|
|
1813
|
+
"ui_extension_ad",
|
|
1814
|
+
"ui_extension_button",
|
|
1815
|
+
"ui_extension_content_block",
|
|
1816
|
+
"ui_extension_line_item_editor",
|
|
1817
|
+
"ui_extension_progress_bar"
|
|
1818
|
+
];
|
|
1819
|
+
var WidgetType = freezeEnum(widgetTypes);
|
|
1793
1820
|
|
|
1794
1821
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
1795
1822
|
var DEFAULT_ENDPOINTS = [
|
|
@@ -1840,31 +1867,6 @@ var targetAreas = {
|
|
|
1840
1867
|
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
1841
1868
|
]
|
|
1842
1869
|
};
|
|
1843
|
-
var widgetTypes = [
|
|
1844
|
-
"bundle_builder",
|
|
1845
|
-
"cart",
|
|
1846
|
-
"cart_subscription",
|
|
1847
|
-
"dynamic_bundle",
|
|
1848
|
-
"gift_with_purchase",
|
|
1849
|
-
"pre_purchase",
|
|
1850
|
-
"product",
|
|
1851
|
-
"product_addon",
|
|
1852
|
-
"product_upsell",
|
|
1853
|
-
"recharge_checkout",
|
|
1854
|
-
"recharge_customer_portal",
|
|
1855
|
-
"recharge_post_purchase",
|
|
1856
|
-
"shopify_checkout",
|
|
1857
|
-
"shopify_checkout_extension",
|
|
1858
|
-
"shopify_post_purchase",
|
|
1859
|
-
"shopify_post_purchase_extension",
|
|
1860
|
-
"switch_to_subscription",
|
|
1861
|
-
"ui_extension_ad",
|
|
1862
|
-
"ui_extension_button",
|
|
1863
|
-
"ui_extension_content_block",
|
|
1864
|
-
"ui_extension_line_item_editor",
|
|
1865
|
-
"ui_extension_progress_bar"
|
|
1866
|
-
];
|
|
1867
|
-
var WidgetType = freezeEnum(widgetTypes);
|
|
1868
1870
|
|
|
1869
1871
|
// src/schema/widgets/checkoutExtension.ts
|
|
1870
1872
|
var import_zod9 = require("zod");
|
package/dist/index.mjs
CHANGED
|
@@ -1504,6 +1504,33 @@ var variantSelectors = ["menu", "radio", "button"];
|
|
|
1504
1504
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
1505
1505
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
1506
1506
|
var VerticalAlignment = freezeEnum(verticalAlignments);
|
|
1507
|
+
var widgetTypes = [
|
|
1508
|
+
"bundle_builder",
|
|
1509
|
+
"cart",
|
|
1510
|
+
"cart_subscription",
|
|
1511
|
+
"dynamic_bundle",
|
|
1512
|
+
"gift_with_purchase",
|
|
1513
|
+
/** An A/B experiment's stand-in element (admin-api `createPlaceholder`); converts to an EMPTY tree. */
|
|
1514
|
+
"placeholder",
|
|
1515
|
+
"pre_purchase",
|
|
1516
|
+
"product",
|
|
1517
|
+
"product_addon",
|
|
1518
|
+
"product_upsell",
|
|
1519
|
+
"recharge_checkout",
|
|
1520
|
+
"recharge_customer_portal",
|
|
1521
|
+
"recharge_post_purchase",
|
|
1522
|
+
"shopify_checkout",
|
|
1523
|
+
"shopify_checkout_extension",
|
|
1524
|
+
"shopify_post_purchase",
|
|
1525
|
+
"shopify_post_purchase_extension",
|
|
1526
|
+
"switch_to_subscription",
|
|
1527
|
+
"ui_extension_ad",
|
|
1528
|
+
"ui_extension_button",
|
|
1529
|
+
"ui_extension_content_block",
|
|
1530
|
+
"ui_extension_line_item_editor",
|
|
1531
|
+
"ui_extension_progress_bar"
|
|
1532
|
+
];
|
|
1533
|
+
var WidgetType = freezeEnum(widgetTypes);
|
|
1507
1534
|
|
|
1508
1535
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
1509
1536
|
var DEFAULT_ENDPOINTS = [
|
|
@@ -1554,31 +1581,6 @@ var targetAreas = {
|
|
|
1554
1581
|
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
1555
1582
|
]
|
|
1556
1583
|
};
|
|
1557
|
-
var widgetTypes = [
|
|
1558
|
-
"bundle_builder",
|
|
1559
|
-
"cart",
|
|
1560
|
-
"cart_subscription",
|
|
1561
|
-
"dynamic_bundle",
|
|
1562
|
-
"gift_with_purchase",
|
|
1563
|
-
"pre_purchase",
|
|
1564
|
-
"product",
|
|
1565
|
-
"product_addon",
|
|
1566
|
-
"product_upsell",
|
|
1567
|
-
"recharge_checkout",
|
|
1568
|
-
"recharge_customer_portal",
|
|
1569
|
-
"recharge_post_purchase",
|
|
1570
|
-
"shopify_checkout",
|
|
1571
|
-
"shopify_checkout_extension",
|
|
1572
|
-
"shopify_post_purchase",
|
|
1573
|
-
"shopify_post_purchase_extension",
|
|
1574
|
-
"switch_to_subscription",
|
|
1575
|
-
"ui_extension_ad",
|
|
1576
|
-
"ui_extension_button",
|
|
1577
|
-
"ui_extension_content_block",
|
|
1578
|
-
"ui_extension_line_item_editor",
|
|
1579
|
-
"ui_extension_progress_bar"
|
|
1580
|
-
];
|
|
1581
|
-
var WidgetType = freezeEnum(widgetTypes);
|
|
1582
1584
|
|
|
1583
1585
|
// src/schema/widgets/checkoutExtension.ts
|
|
1584
1586
|
import { z as z9 } from "zod";
|
|
@@ -55,6 +55,7 @@ __export(common_exports, {
|
|
|
55
55
|
VariantMode: () => VariantMode,
|
|
56
56
|
VariantSelector: () => VariantSelector,
|
|
57
57
|
VerticalAlignment: () => VerticalAlignment,
|
|
58
|
+
WidgetType: () => WidgetType,
|
|
58
59
|
bannerColors: () => bannerColors,
|
|
59
60
|
borderRadii: () => borderRadii,
|
|
60
61
|
borderStyles: () => borderStyles,
|
|
@@ -91,7 +92,8 @@ __export(common_exports, {
|
|
|
91
92
|
variableTypes: () => variableTypes,
|
|
92
93
|
variantModes: () => variantModes,
|
|
93
94
|
variantSelectors: () => variantSelectors,
|
|
94
|
-
verticalAlignments: () => verticalAlignments
|
|
95
|
+
verticalAlignments: () => verticalAlignments,
|
|
96
|
+
widgetTypes: () => widgetTypes
|
|
95
97
|
});
|
|
96
98
|
module.exports = __toCommonJS(common_exports);
|
|
97
99
|
var freezeEnum = (values) => Object.freeze(Object.fromEntries(values.map((v) => [v, v])));
|
|
@@ -264,3 +266,30 @@ var variantSelectors = ["menu", "radio", "button"];
|
|
|
264
266
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
265
267
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
266
268
|
var VerticalAlignment = freezeEnum(verticalAlignments);
|
|
269
|
+
var widgetTypes = [
|
|
270
|
+
"bundle_builder",
|
|
271
|
+
"cart",
|
|
272
|
+
"cart_subscription",
|
|
273
|
+
"dynamic_bundle",
|
|
274
|
+
"gift_with_purchase",
|
|
275
|
+
/** An A/B experiment's stand-in element (admin-api `createPlaceholder`); converts to an EMPTY tree. */
|
|
276
|
+
"placeholder",
|
|
277
|
+
"pre_purchase",
|
|
278
|
+
"product",
|
|
279
|
+
"product_addon",
|
|
280
|
+
"product_upsell",
|
|
281
|
+
"recharge_checkout",
|
|
282
|
+
"recharge_customer_portal",
|
|
283
|
+
"recharge_post_purchase",
|
|
284
|
+
"shopify_checkout",
|
|
285
|
+
"shopify_checkout_extension",
|
|
286
|
+
"shopify_post_purchase",
|
|
287
|
+
"shopify_post_purchase_extension",
|
|
288
|
+
"switch_to_subscription",
|
|
289
|
+
"ui_extension_ad",
|
|
290
|
+
"ui_extension_button",
|
|
291
|
+
"ui_extension_content_block",
|
|
292
|
+
"ui_extension_line_item_editor",
|
|
293
|
+
"ui_extension_progress_bar"
|
|
294
|
+
];
|
|
295
|
+
var WidgetType = freezeEnum(widgetTypes);
|
|
@@ -169,6 +169,33 @@ var variantSelectors = ["menu", "radio", "button"];
|
|
|
169
169
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
170
170
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
171
171
|
var VerticalAlignment = freezeEnum(verticalAlignments);
|
|
172
|
+
var widgetTypes = [
|
|
173
|
+
"bundle_builder",
|
|
174
|
+
"cart",
|
|
175
|
+
"cart_subscription",
|
|
176
|
+
"dynamic_bundle",
|
|
177
|
+
"gift_with_purchase",
|
|
178
|
+
/** An A/B experiment's stand-in element (admin-api `createPlaceholder`); converts to an EMPTY tree. */
|
|
179
|
+
"placeholder",
|
|
180
|
+
"pre_purchase",
|
|
181
|
+
"product",
|
|
182
|
+
"product_addon",
|
|
183
|
+
"product_upsell",
|
|
184
|
+
"recharge_checkout",
|
|
185
|
+
"recharge_customer_portal",
|
|
186
|
+
"recharge_post_purchase",
|
|
187
|
+
"shopify_checkout",
|
|
188
|
+
"shopify_checkout_extension",
|
|
189
|
+
"shopify_post_purchase",
|
|
190
|
+
"shopify_post_purchase_extension",
|
|
191
|
+
"switch_to_subscription",
|
|
192
|
+
"ui_extension_ad",
|
|
193
|
+
"ui_extension_button",
|
|
194
|
+
"ui_extension_content_block",
|
|
195
|
+
"ui_extension_line_item_editor",
|
|
196
|
+
"ui_extension_progress_bar"
|
|
197
|
+
];
|
|
198
|
+
var WidgetType = freezeEnum(widgetTypes);
|
|
172
199
|
export {
|
|
173
200
|
BannerColor,
|
|
174
201
|
BorderRadius,
|
|
@@ -205,6 +232,7 @@ export {
|
|
|
205
232
|
VariantMode,
|
|
206
233
|
VariantSelector,
|
|
207
234
|
VerticalAlignment,
|
|
235
|
+
WidgetType,
|
|
208
236
|
bannerColors,
|
|
209
237
|
borderRadii,
|
|
210
238
|
borderStyles,
|
|
@@ -241,5 +269,6 @@ export {
|
|
|
241
269
|
variableTypes,
|
|
242
270
|
variantModes,
|
|
243
271
|
variantSelectors,
|
|
244
|
-
verticalAlignments
|
|
272
|
+
verticalAlignments,
|
|
273
|
+
widgetTypes
|
|
245
274
|
};
|
|
@@ -369,6 +369,33 @@ var variantSelectors = ["menu", "radio", "button"];
|
|
|
369
369
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
370
370
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
371
371
|
var VerticalAlignment = freezeEnum(verticalAlignments);
|
|
372
|
+
var widgetTypes = [
|
|
373
|
+
"bundle_builder",
|
|
374
|
+
"cart",
|
|
375
|
+
"cart_subscription",
|
|
376
|
+
"dynamic_bundle",
|
|
377
|
+
"gift_with_purchase",
|
|
378
|
+
/** An A/B experiment's stand-in element (admin-api `createPlaceholder`); converts to an EMPTY tree. */
|
|
379
|
+
"placeholder",
|
|
380
|
+
"pre_purchase",
|
|
381
|
+
"product",
|
|
382
|
+
"product_addon",
|
|
383
|
+
"product_upsell",
|
|
384
|
+
"recharge_checkout",
|
|
385
|
+
"recharge_customer_portal",
|
|
386
|
+
"recharge_post_purchase",
|
|
387
|
+
"shopify_checkout",
|
|
388
|
+
"shopify_checkout_extension",
|
|
389
|
+
"shopify_post_purchase",
|
|
390
|
+
"shopify_post_purchase_extension",
|
|
391
|
+
"switch_to_subscription",
|
|
392
|
+
"ui_extension_ad",
|
|
393
|
+
"ui_extension_button",
|
|
394
|
+
"ui_extension_content_block",
|
|
395
|
+
"ui_extension_line_item_editor",
|
|
396
|
+
"ui_extension_progress_bar"
|
|
397
|
+
];
|
|
398
|
+
var WidgetType = freezeEnum(widgetTypes);
|
|
372
399
|
|
|
373
400
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
374
401
|
var import_uuid12 = require("uuid");
|
|
@@ -954,31 +981,6 @@ var targetAreas = {
|
|
|
954
981
|
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
955
982
|
]
|
|
956
983
|
};
|
|
957
|
-
var widgetTypes = [
|
|
958
|
-
"bundle_builder",
|
|
959
|
-
"cart",
|
|
960
|
-
"cart_subscription",
|
|
961
|
-
"dynamic_bundle",
|
|
962
|
-
"gift_with_purchase",
|
|
963
|
-
"pre_purchase",
|
|
964
|
-
"product",
|
|
965
|
-
"product_addon",
|
|
966
|
-
"product_upsell",
|
|
967
|
-
"recharge_checkout",
|
|
968
|
-
"recharge_customer_portal",
|
|
969
|
-
"recharge_post_purchase",
|
|
970
|
-
"shopify_checkout",
|
|
971
|
-
"shopify_checkout_extension",
|
|
972
|
-
"shopify_post_purchase",
|
|
973
|
-
"shopify_post_purchase_extension",
|
|
974
|
-
"switch_to_subscription",
|
|
975
|
-
"ui_extension_ad",
|
|
976
|
-
"ui_extension_button",
|
|
977
|
-
"ui_extension_content_block",
|
|
978
|
-
"ui_extension_line_item_editor",
|
|
979
|
-
"ui_extension_progress_bar"
|
|
980
|
-
];
|
|
981
|
-
var WidgetType = freezeEnum(widgetTypes);
|
|
982
984
|
|
|
983
985
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
984
986
|
var CABDiscount = import_zod6.z.object({
|
|
@@ -172,6 +172,33 @@ var variantSelectors = ["menu", "radio", "button"];
|
|
|
172
172
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
173
173
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
174
174
|
var VerticalAlignment = freezeEnum(verticalAlignments);
|
|
175
|
+
var widgetTypes = [
|
|
176
|
+
"bundle_builder",
|
|
177
|
+
"cart",
|
|
178
|
+
"cart_subscription",
|
|
179
|
+
"dynamic_bundle",
|
|
180
|
+
"gift_with_purchase",
|
|
181
|
+
/** An A/B experiment's stand-in element (admin-api `createPlaceholder`); converts to an EMPTY tree. */
|
|
182
|
+
"placeholder",
|
|
183
|
+
"pre_purchase",
|
|
184
|
+
"product",
|
|
185
|
+
"product_addon",
|
|
186
|
+
"product_upsell",
|
|
187
|
+
"recharge_checkout",
|
|
188
|
+
"recharge_customer_portal",
|
|
189
|
+
"recharge_post_purchase",
|
|
190
|
+
"shopify_checkout",
|
|
191
|
+
"shopify_checkout_extension",
|
|
192
|
+
"shopify_post_purchase",
|
|
193
|
+
"shopify_post_purchase_extension",
|
|
194
|
+
"switch_to_subscription",
|
|
195
|
+
"ui_extension_ad",
|
|
196
|
+
"ui_extension_button",
|
|
197
|
+
"ui_extension_content_block",
|
|
198
|
+
"ui_extension_line_item_editor",
|
|
199
|
+
"ui_extension_progress_bar"
|
|
200
|
+
];
|
|
201
|
+
var WidgetType = freezeEnum(widgetTypes);
|
|
175
202
|
|
|
176
203
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
177
204
|
import { v7 as uuidv712 } from "uuid";
|
|
@@ -757,31 +784,6 @@ var targetAreas = {
|
|
|
757
784
|
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
758
785
|
]
|
|
759
786
|
};
|
|
760
|
-
var widgetTypes = [
|
|
761
|
-
"bundle_builder",
|
|
762
|
-
"cart",
|
|
763
|
-
"cart_subscription",
|
|
764
|
-
"dynamic_bundle",
|
|
765
|
-
"gift_with_purchase",
|
|
766
|
-
"pre_purchase",
|
|
767
|
-
"product",
|
|
768
|
-
"product_addon",
|
|
769
|
-
"product_upsell",
|
|
770
|
-
"recharge_checkout",
|
|
771
|
-
"recharge_customer_portal",
|
|
772
|
-
"recharge_post_purchase",
|
|
773
|
-
"shopify_checkout",
|
|
774
|
-
"shopify_checkout_extension",
|
|
775
|
-
"shopify_post_purchase",
|
|
776
|
-
"shopify_post_purchase_extension",
|
|
777
|
-
"switch_to_subscription",
|
|
778
|
-
"ui_extension_ad",
|
|
779
|
-
"ui_extension_button",
|
|
780
|
-
"ui_extension_content_block",
|
|
781
|
-
"ui_extension_line_item_editor",
|
|
782
|
-
"ui_extension_progress_bar"
|
|
783
|
-
];
|
|
784
|
-
var WidgetType = freezeEnum(widgetTypes);
|
|
785
787
|
|
|
786
788
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
787
789
|
var CABDiscount = z6.object({
|
|
@@ -200,6 +200,33 @@ var variantSelectors = ["menu", "radio", "button"];
|
|
|
200
200
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
201
201
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
202
202
|
var VerticalAlignment = freezeEnum(verticalAlignments);
|
|
203
|
+
var widgetTypes = [
|
|
204
|
+
"bundle_builder",
|
|
205
|
+
"cart",
|
|
206
|
+
"cart_subscription",
|
|
207
|
+
"dynamic_bundle",
|
|
208
|
+
"gift_with_purchase",
|
|
209
|
+
/** An A/B experiment's stand-in element (admin-api `createPlaceholder`); converts to an EMPTY tree. */
|
|
210
|
+
"placeholder",
|
|
211
|
+
"pre_purchase",
|
|
212
|
+
"product",
|
|
213
|
+
"product_addon",
|
|
214
|
+
"product_upsell",
|
|
215
|
+
"recharge_checkout",
|
|
216
|
+
"recharge_customer_portal",
|
|
217
|
+
"recharge_post_purchase",
|
|
218
|
+
"shopify_checkout",
|
|
219
|
+
"shopify_checkout_extension",
|
|
220
|
+
"shopify_post_purchase",
|
|
221
|
+
"shopify_post_purchase_extension",
|
|
222
|
+
"switch_to_subscription",
|
|
223
|
+
"ui_extension_ad",
|
|
224
|
+
"ui_extension_button",
|
|
225
|
+
"ui_extension_content_block",
|
|
226
|
+
"ui_extension_line_item_editor",
|
|
227
|
+
"ui_extension_progress_bar"
|
|
228
|
+
];
|
|
229
|
+
var WidgetType = freezeEnum(widgetTypes);
|
|
203
230
|
|
|
204
231
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
205
232
|
var DEFAULT_ENDPOINTS = [
|
|
@@ -250,31 +277,6 @@ var targetAreas = {
|
|
|
250
277
|
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
251
278
|
]
|
|
252
279
|
};
|
|
253
|
-
var widgetTypes = [
|
|
254
|
-
"bundle_builder",
|
|
255
|
-
"cart",
|
|
256
|
-
"cart_subscription",
|
|
257
|
-
"dynamic_bundle",
|
|
258
|
-
"gift_with_purchase",
|
|
259
|
-
"pre_purchase",
|
|
260
|
-
"product",
|
|
261
|
-
"product_addon",
|
|
262
|
-
"product_upsell",
|
|
263
|
-
"recharge_checkout",
|
|
264
|
-
"recharge_customer_portal",
|
|
265
|
-
"recharge_post_purchase",
|
|
266
|
-
"shopify_checkout",
|
|
267
|
-
"shopify_checkout_extension",
|
|
268
|
-
"shopify_post_purchase",
|
|
269
|
-
"shopify_post_purchase_extension",
|
|
270
|
-
"switch_to_subscription",
|
|
271
|
-
"ui_extension_ad",
|
|
272
|
-
"ui_extension_button",
|
|
273
|
-
"ui_extension_content_block",
|
|
274
|
-
"ui_extension_line_item_editor",
|
|
275
|
-
"ui_extension_progress_bar"
|
|
276
|
-
];
|
|
277
|
-
var WidgetType = freezeEnum(widgetTypes);
|
|
278
280
|
|
|
279
281
|
// src/schema/widgets/checkoutExtension.ts
|
|
280
282
|
var import_zod2 = require("zod");
|
|
@@ -175,6 +175,33 @@ var variantSelectors = ["menu", "radio", "button"];
|
|
|
175
175
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
176
176
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
177
177
|
var VerticalAlignment = freezeEnum(verticalAlignments);
|
|
178
|
+
var widgetTypes = [
|
|
179
|
+
"bundle_builder",
|
|
180
|
+
"cart",
|
|
181
|
+
"cart_subscription",
|
|
182
|
+
"dynamic_bundle",
|
|
183
|
+
"gift_with_purchase",
|
|
184
|
+
/** An A/B experiment's stand-in element (admin-api `createPlaceholder`); converts to an EMPTY tree. */
|
|
185
|
+
"placeholder",
|
|
186
|
+
"pre_purchase",
|
|
187
|
+
"product",
|
|
188
|
+
"product_addon",
|
|
189
|
+
"product_upsell",
|
|
190
|
+
"recharge_checkout",
|
|
191
|
+
"recharge_customer_portal",
|
|
192
|
+
"recharge_post_purchase",
|
|
193
|
+
"shopify_checkout",
|
|
194
|
+
"shopify_checkout_extension",
|
|
195
|
+
"shopify_post_purchase",
|
|
196
|
+
"shopify_post_purchase_extension",
|
|
197
|
+
"switch_to_subscription",
|
|
198
|
+
"ui_extension_ad",
|
|
199
|
+
"ui_extension_button",
|
|
200
|
+
"ui_extension_content_block",
|
|
201
|
+
"ui_extension_line_item_editor",
|
|
202
|
+
"ui_extension_progress_bar"
|
|
203
|
+
];
|
|
204
|
+
var WidgetType = freezeEnum(widgetTypes);
|
|
178
205
|
|
|
179
206
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
180
207
|
var DEFAULT_ENDPOINTS = [
|
|
@@ -225,31 +252,6 @@ var targetAreas = {
|
|
|
225
252
|
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
226
253
|
]
|
|
227
254
|
};
|
|
228
|
-
var widgetTypes = [
|
|
229
|
-
"bundle_builder",
|
|
230
|
-
"cart",
|
|
231
|
-
"cart_subscription",
|
|
232
|
-
"dynamic_bundle",
|
|
233
|
-
"gift_with_purchase",
|
|
234
|
-
"pre_purchase",
|
|
235
|
-
"product",
|
|
236
|
-
"product_addon",
|
|
237
|
-
"product_upsell",
|
|
238
|
-
"recharge_checkout",
|
|
239
|
-
"recharge_customer_portal",
|
|
240
|
-
"recharge_post_purchase",
|
|
241
|
-
"shopify_checkout",
|
|
242
|
-
"shopify_checkout_extension",
|
|
243
|
-
"shopify_post_purchase",
|
|
244
|
-
"shopify_post_purchase_extension",
|
|
245
|
-
"switch_to_subscription",
|
|
246
|
-
"ui_extension_ad",
|
|
247
|
-
"ui_extension_button",
|
|
248
|
-
"ui_extension_content_block",
|
|
249
|
-
"ui_extension_line_item_editor",
|
|
250
|
-
"ui_extension_progress_bar"
|
|
251
|
-
];
|
|
252
|
-
var WidgetType = freezeEnum(widgetTypes);
|
|
253
255
|
|
|
254
256
|
// src/schema/widgets/checkoutExtension.ts
|
|
255
257
|
import { z as z2 } from "zod";
|
|
@@ -358,3 +358,35 @@ export declare const VerticalAlignment: {
|
|
|
358
358
|
readonly bottom: "bottom";
|
|
359
359
|
};
|
|
360
360
|
export type VerticalAlignment = (typeof verticalAlignments)[number];
|
|
361
|
+
/**
|
|
362
|
+
* Every widget type a CAB root tree may declare (`CABRootSection.type`). Public (this file backs the
|
|
363
|
+
* `schema/checkout-and-beyond/constants` subpath) so the extension's root gates can read the enum, not
|
|
364
|
+
* string literals.
|
|
365
|
+
*/
|
|
366
|
+
export declare const widgetTypes: readonly ["bundle_builder", "cart", "cart_subscription", "dynamic_bundle", "gift_with_purchase", "placeholder", "pre_purchase", "product", "product_addon", "product_upsell", "recharge_checkout", "recharge_customer_portal", "recharge_post_purchase", "shopify_checkout", "shopify_checkout_extension", "shopify_post_purchase", "shopify_post_purchase_extension", "switch_to_subscription", "ui_extension_ad", "ui_extension_button", "ui_extension_content_block", "ui_extension_line_item_editor", "ui_extension_progress_bar"];
|
|
367
|
+
export declare const WidgetType: {
|
|
368
|
+
readonly product: "product";
|
|
369
|
+
readonly placeholder: "placeholder";
|
|
370
|
+
readonly bundle_builder: "bundle_builder";
|
|
371
|
+
readonly cart: "cart";
|
|
372
|
+
readonly cart_subscription: "cart_subscription";
|
|
373
|
+
readonly dynamic_bundle: "dynamic_bundle";
|
|
374
|
+
readonly gift_with_purchase: "gift_with_purchase";
|
|
375
|
+
readonly pre_purchase: "pre_purchase";
|
|
376
|
+
readonly product_addon: "product_addon";
|
|
377
|
+
readonly product_upsell: "product_upsell";
|
|
378
|
+
readonly recharge_checkout: "recharge_checkout";
|
|
379
|
+
readonly recharge_customer_portal: "recharge_customer_portal";
|
|
380
|
+
readonly recharge_post_purchase: "recharge_post_purchase";
|
|
381
|
+
readonly shopify_checkout: "shopify_checkout";
|
|
382
|
+
readonly shopify_checkout_extension: "shopify_checkout_extension";
|
|
383
|
+
readonly shopify_post_purchase: "shopify_post_purchase";
|
|
384
|
+
readonly shopify_post_purchase_extension: "shopify_post_purchase_extension";
|
|
385
|
+
readonly switch_to_subscription: "switch_to_subscription";
|
|
386
|
+
readonly ui_extension_ad: "ui_extension_ad";
|
|
387
|
+
readonly ui_extension_button: "ui_extension_button";
|
|
388
|
+
readonly ui_extension_content_block: "ui_extension_content_block";
|
|
389
|
+
readonly ui_extension_line_item_editor: "ui_extension_line_item_editor";
|
|
390
|
+
readonly ui_extension_progress_bar: "ui_extension_progress_bar";
|
|
391
|
+
};
|
|
392
|
+
export type WidgetType = (typeof widgetTypes)[number];
|
|
@@ -110,29 +110,5 @@ export declare const targetAreas: {
|
|
|
110
110
|
width: string;
|
|
111
111
|
}[];
|
|
112
112
|
};
|
|
113
|
-
|
|
114
|
-
export
|
|
115
|
-
readonly product: "product";
|
|
116
|
-
readonly cart: "cart";
|
|
117
|
-
readonly bundle_builder: "bundle_builder";
|
|
118
|
-
readonly cart_subscription: "cart_subscription";
|
|
119
|
-
readonly dynamic_bundle: "dynamic_bundle";
|
|
120
|
-
readonly gift_with_purchase: "gift_with_purchase";
|
|
121
|
-
readonly pre_purchase: "pre_purchase";
|
|
122
|
-
readonly product_addon: "product_addon";
|
|
123
|
-
readonly product_upsell: "product_upsell";
|
|
124
|
-
readonly recharge_checkout: "recharge_checkout";
|
|
125
|
-
readonly recharge_customer_portal: "recharge_customer_portal";
|
|
126
|
-
readonly recharge_post_purchase: "recharge_post_purchase";
|
|
127
|
-
readonly shopify_checkout: "shopify_checkout";
|
|
128
|
-
readonly shopify_checkout_extension: "shopify_checkout_extension";
|
|
129
|
-
readonly shopify_post_purchase: "shopify_post_purchase";
|
|
130
|
-
readonly shopify_post_purchase_extension: "shopify_post_purchase_extension";
|
|
131
|
-
readonly switch_to_subscription: "switch_to_subscription";
|
|
132
|
-
readonly ui_extension_ad: "ui_extension_ad";
|
|
133
|
-
readonly ui_extension_button: "ui_extension_button";
|
|
134
|
-
readonly ui_extension_content_block: "ui_extension_content_block";
|
|
135
|
-
readonly ui_extension_line_item_editor: "ui_extension_line_item_editor";
|
|
136
|
-
readonly ui_extension_progress_bar: "ui_extension_progress_bar";
|
|
137
|
-
};
|
|
138
|
-
export type WidgetType = (typeof widgetTypes)[number];
|
|
113
|
+
/** `widgetTypes`/`WidgetType` live in `common.ts` (the public `constants` subpath surface); re-exported here for the barrel's existing importers. */
|
|
114
|
+
export { WidgetType, widgetTypes } from './common';
|
|
@@ -23,6 +23,7 @@ export declare const IconName: {
|
|
|
23
23
|
readonly info: "info";
|
|
24
24
|
readonly grid: "grid";
|
|
25
25
|
readonly menu: "menu";
|
|
26
|
+
readonly cart: "cart";
|
|
26
27
|
readonly "alert-circle": "alert-circle";
|
|
27
28
|
readonly "alert-triangle": "alert-triangle";
|
|
28
29
|
readonly "alert-triangle-filled": "alert-triangle-filled";
|
|
@@ -36,7 +37,6 @@ export declare const IconName: {
|
|
|
36
37
|
readonly calendar: "calendar";
|
|
37
38
|
readonly camera: "camera";
|
|
38
39
|
readonly "caret-down": "caret-down";
|
|
39
|
-
readonly cart: "cart";
|
|
40
40
|
readonly "cash-dollar": "cash-dollar";
|
|
41
41
|
readonly categories: "categories";
|
|
42
42
|
readonly "check-circle": "check-circle";
|
|
@@ -97,6 +97,7 @@ export declare const CABImageSectionFields: z.ZodObject<{
|
|
|
97
97
|
info: "info";
|
|
98
98
|
grid: "grid";
|
|
99
99
|
menu: "menu";
|
|
100
|
+
cart: "cart";
|
|
100
101
|
"alert-circle": "alert-circle";
|
|
101
102
|
"alert-triangle": "alert-triangle";
|
|
102
103
|
"alert-triangle-filled": "alert-triangle-filled";
|
|
@@ -110,7 +111,6 @@ export declare const CABImageSectionFields: z.ZodObject<{
|
|
|
110
111
|
calendar: "calendar";
|
|
111
112
|
camera: "camera";
|
|
112
113
|
"caret-down": "caret-down";
|
|
113
|
-
cart: "cart";
|
|
114
114
|
"cash-dollar": "cash-dollar";
|
|
115
115
|
categories: "categories";
|
|
116
116
|
"check-circle": "check-circle";
|
|
@@ -445,6 +445,7 @@ export declare const CABImageSection: z.ZodObject<{
|
|
|
445
445
|
info: "info";
|
|
446
446
|
grid: "grid";
|
|
447
447
|
menu: "menu";
|
|
448
|
+
cart: "cart";
|
|
448
449
|
"alert-circle": "alert-circle";
|
|
449
450
|
"alert-triangle": "alert-triangle";
|
|
450
451
|
"alert-triangle-filled": "alert-triangle-filled";
|
|
@@ -458,7 +459,6 @@ export declare const CABImageSection: z.ZodObject<{
|
|
|
458
459
|
calendar: "calendar";
|
|
459
460
|
camera: "camera";
|
|
460
461
|
"caret-down": "caret-down";
|
|
461
|
-
cart: "cart";
|
|
462
462
|
"cash-dollar": "cash-dollar";
|
|
463
463
|
categories: "categories";
|
|
464
464
|
"check-circle": "check-circle";
|
|
@@ -378,8 +378,9 @@ export declare const CABRootSection: z.ZodObject<{
|
|
|
378
378
|
} | null | undefined>>;
|
|
379
379
|
type: z.ZodDefault<z.ZodEnum<{
|
|
380
380
|
product: "product";
|
|
381
|
-
|
|
381
|
+
placeholder: "placeholder";
|
|
382
382
|
bundle_builder: "bundle_builder";
|
|
383
|
+
cart: "cart";
|
|
383
384
|
cart_subscription: "cart_subscription";
|
|
384
385
|
dynamic_bundle: "dynamic_bundle";
|
|
385
386
|
gift_with_purchase: "gift_with_purchase";
|
package/dist/server/index.cjs
CHANGED
|
@@ -801,6 +801,33 @@ var variantSelectors = ["menu", "radio", "button"];
|
|
|
801
801
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
802
802
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
803
803
|
var VerticalAlignment = freezeEnum(verticalAlignments);
|
|
804
|
+
var widgetTypes = [
|
|
805
|
+
"bundle_builder",
|
|
806
|
+
"cart",
|
|
807
|
+
"cart_subscription",
|
|
808
|
+
"dynamic_bundle",
|
|
809
|
+
"gift_with_purchase",
|
|
810
|
+
/** An A/B experiment's stand-in element (admin-api `createPlaceholder`); converts to an EMPTY tree. */
|
|
811
|
+
"placeholder",
|
|
812
|
+
"pre_purchase",
|
|
813
|
+
"product",
|
|
814
|
+
"product_addon",
|
|
815
|
+
"product_upsell",
|
|
816
|
+
"recharge_checkout",
|
|
817
|
+
"recharge_customer_portal",
|
|
818
|
+
"recharge_post_purchase",
|
|
819
|
+
"shopify_checkout",
|
|
820
|
+
"shopify_checkout_extension",
|
|
821
|
+
"shopify_post_purchase",
|
|
822
|
+
"shopify_post_purchase_extension",
|
|
823
|
+
"switch_to_subscription",
|
|
824
|
+
"ui_extension_ad",
|
|
825
|
+
"ui_extension_button",
|
|
826
|
+
"ui_extension_content_block",
|
|
827
|
+
"ui_extension_line_item_editor",
|
|
828
|
+
"ui_extension_progress_bar"
|
|
829
|
+
];
|
|
830
|
+
var WidgetType = freezeEnum(widgetTypes);
|
|
804
831
|
|
|
805
832
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
806
833
|
var iconNames = [
|
|
@@ -1367,31 +1394,6 @@ var targetAreas = {
|
|
|
1367
1394
|
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
1368
1395
|
]
|
|
1369
1396
|
};
|
|
1370
|
-
var widgetTypes = [
|
|
1371
|
-
"bundle_builder",
|
|
1372
|
-
"cart",
|
|
1373
|
-
"cart_subscription",
|
|
1374
|
-
"dynamic_bundle",
|
|
1375
|
-
"gift_with_purchase",
|
|
1376
|
-
"pre_purchase",
|
|
1377
|
-
"product",
|
|
1378
|
-
"product_addon",
|
|
1379
|
-
"product_upsell",
|
|
1380
|
-
"recharge_checkout",
|
|
1381
|
-
"recharge_customer_portal",
|
|
1382
|
-
"recharge_post_purchase",
|
|
1383
|
-
"shopify_checkout",
|
|
1384
|
-
"shopify_checkout_extension",
|
|
1385
|
-
"shopify_post_purchase",
|
|
1386
|
-
"shopify_post_purchase_extension",
|
|
1387
|
-
"switch_to_subscription",
|
|
1388
|
-
"ui_extension_ad",
|
|
1389
|
-
"ui_extension_button",
|
|
1390
|
-
"ui_extension_content_block",
|
|
1391
|
-
"ui_extension_line_item_editor",
|
|
1392
|
-
"ui_extension_progress_bar"
|
|
1393
|
-
];
|
|
1394
|
-
var WidgetType = freezeEnum(widgetTypes);
|
|
1395
1397
|
|
|
1396
1398
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
1397
1399
|
var CABDiscount = import_zod13.z.object({
|
|
@@ -3039,6 +3041,21 @@ var isOfferV1 = (data) => {
|
|
|
3039
3041
|
return data.type === SHOPIFY_CHECKOUT_EXTENSION;
|
|
3040
3042
|
};
|
|
3041
3043
|
|
|
3044
|
+
// src/transforms/placeholderV1/convertPlaceholderToV2.ts
|
|
3045
|
+
var convertPlaceholderToV2 = ({ id, settings }) => CABRootSection.parse({
|
|
3046
|
+
previewMode: settings.previewMode,
|
|
3047
|
+
sections: [],
|
|
3048
|
+
sectionType: "layout",
|
|
3049
|
+
// CABTracking's schema fallbacks fill missing or null fields and the missing object; malformed values throw.
|
|
3050
|
+
tracking: settings.tracking,
|
|
3051
|
+
type: WidgetType.placeholder,
|
|
3052
|
+
version: 2,
|
|
3053
|
+
widgetId: id
|
|
3054
|
+
});
|
|
3055
|
+
|
|
3056
|
+
// src/transforms/placeholderV1/types.ts
|
|
3057
|
+
var isPlaceholderV1 = (data) => !!data && typeof data === "object" && data.type === WidgetType.placeholder;
|
|
3058
|
+
|
|
3042
3059
|
// src/transforms/offerV1/offerCard.ts
|
|
3043
3060
|
var borderToken = (tokens, value) => value !== void 0 && tokens.includes(value) ? value : "base";
|
|
3044
3061
|
var GRID_CARD_IMAGE_PX = 120;
|
|
@@ -4258,6 +4275,7 @@ var dispatchWidgetTransform = (id, normalized, report) => {
|
|
|
4258
4275
|
if (isContentBlockV1(normalized)) return convertContentBlockToV2({ id, settings: normalized });
|
|
4259
4276
|
if (isLineItemEditorV1(normalized)) return convertLineItemEditorToV2({ id, settings: normalized });
|
|
4260
4277
|
if (isMonetizeV1(normalized)) return convertMonetizeToV2({ id, settings: normalized });
|
|
4278
|
+
if (isPlaceholderV1(normalized)) return convertPlaceholderToV2({ id, settings: normalized });
|
|
4261
4279
|
if (isOfferV1(normalized)) return convertOfferToV2({ id, name: normalized.name, settings: normalized });
|
|
4262
4280
|
return normalized;
|
|
4263
4281
|
};
|
|
@@ -4493,6 +4511,11 @@ var TAXONOMY = {
|
|
|
4493
4511
|
}
|
|
4494
4512
|
};
|
|
4495
4513
|
var isKnownEvent = (name) => name in TAXONOMY;
|
|
4514
|
+
var toEngineEventTime = (sentAt) => {
|
|
4515
|
+
if (!sentAt) return void 0;
|
|
4516
|
+
const ms = Date.parse(sentAt);
|
|
4517
|
+
return Number.isFinite(ms) ? String(ms) : void 0;
|
|
4518
|
+
};
|
|
4496
4519
|
var translateAnalyticsEvent = (event, input) => {
|
|
4497
4520
|
if (!isKnownEvent(event.name)) return null;
|
|
4498
4521
|
const taxonomy = TAXONOMY[event.name];
|
|
@@ -4501,13 +4524,14 @@ var translateAnalyticsEvent = (event, input) => {
|
|
|
4501
4524
|
const tags = taxonomy.buildTags?.(properties);
|
|
4502
4525
|
const definedNounId = taxonomy.buildDefinedNounId?.(properties);
|
|
4503
4526
|
const widgetId = taxonomy.buildWidgetId?.(properties, input) ?? input.widgetId;
|
|
4527
|
+
const eventTime = toEngineEventTime(event.sentAt);
|
|
4504
4528
|
return {
|
|
4505
4529
|
noun: taxonomy.noun,
|
|
4506
4530
|
subject: taxonomy.subject,
|
|
4507
4531
|
uuid: input.visitorId,
|
|
4508
4532
|
verb: taxonomy.verb,
|
|
4509
4533
|
// Aggregate by checkout identity (Rebuy cart token + Shopify checkout token); else the visitor id (React parity).
|
|
4510
|
-
...
|
|
4534
|
+
...eventTime !== void 0 && { event_time: eventTime },
|
|
4511
4535
|
...input.cartToken && { cart_token: input.cartToken },
|
|
4512
4536
|
...input.checkoutToken && { shopify_checkout_token: input.checkoutToken },
|
|
4513
4537
|
...!input.cartToken && !input.checkoutToken && { aggregator: input.visitorId },
|
package/dist/server/index.mjs
CHANGED
|
@@ -753,6 +753,33 @@ var variantSelectors = ["menu", "radio", "button"];
|
|
|
753
753
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
754
754
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
755
755
|
var VerticalAlignment = freezeEnum(verticalAlignments);
|
|
756
|
+
var widgetTypes = [
|
|
757
|
+
"bundle_builder",
|
|
758
|
+
"cart",
|
|
759
|
+
"cart_subscription",
|
|
760
|
+
"dynamic_bundle",
|
|
761
|
+
"gift_with_purchase",
|
|
762
|
+
/** An A/B experiment's stand-in element (admin-api `createPlaceholder`); converts to an EMPTY tree. */
|
|
763
|
+
"placeholder",
|
|
764
|
+
"pre_purchase",
|
|
765
|
+
"product",
|
|
766
|
+
"product_addon",
|
|
767
|
+
"product_upsell",
|
|
768
|
+
"recharge_checkout",
|
|
769
|
+
"recharge_customer_portal",
|
|
770
|
+
"recharge_post_purchase",
|
|
771
|
+
"shopify_checkout",
|
|
772
|
+
"shopify_checkout_extension",
|
|
773
|
+
"shopify_post_purchase",
|
|
774
|
+
"shopify_post_purchase_extension",
|
|
775
|
+
"switch_to_subscription",
|
|
776
|
+
"ui_extension_ad",
|
|
777
|
+
"ui_extension_button",
|
|
778
|
+
"ui_extension_content_block",
|
|
779
|
+
"ui_extension_line_item_editor",
|
|
780
|
+
"ui_extension_progress_bar"
|
|
781
|
+
];
|
|
782
|
+
var WidgetType = freezeEnum(widgetTypes);
|
|
756
783
|
|
|
757
784
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
758
785
|
var iconNames = [
|
|
@@ -1319,31 +1346,6 @@ var targetAreas = {
|
|
|
1319
1346
|
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
1320
1347
|
]
|
|
1321
1348
|
};
|
|
1322
|
-
var widgetTypes = [
|
|
1323
|
-
"bundle_builder",
|
|
1324
|
-
"cart",
|
|
1325
|
-
"cart_subscription",
|
|
1326
|
-
"dynamic_bundle",
|
|
1327
|
-
"gift_with_purchase",
|
|
1328
|
-
"pre_purchase",
|
|
1329
|
-
"product",
|
|
1330
|
-
"product_addon",
|
|
1331
|
-
"product_upsell",
|
|
1332
|
-
"recharge_checkout",
|
|
1333
|
-
"recharge_customer_portal",
|
|
1334
|
-
"recharge_post_purchase",
|
|
1335
|
-
"shopify_checkout",
|
|
1336
|
-
"shopify_checkout_extension",
|
|
1337
|
-
"shopify_post_purchase",
|
|
1338
|
-
"shopify_post_purchase_extension",
|
|
1339
|
-
"switch_to_subscription",
|
|
1340
|
-
"ui_extension_ad",
|
|
1341
|
-
"ui_extension_button",
|
|
1342
|
-
"ui_extension_content_block",
|
|
1343
|
-
"ui_extension_line_item_editor",
|
|
1344
|
-
"ui_extension_progress_bar"
|
|
1345
|
-
];
|
|
1346
|
-
var WidgetType = freezeEnum(widgetTypes);
|
|
1347
1349
|
|
|
1348
1350
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
1349
1351
|
var CABDiscount = z13.object({
|
|
@@ -2991,6 +2993,21 @@ var isOfferV1 = (data) => {
|
|
|
2991
2993
|
return data.type === SHOPIFY_CHECKOUT_EXTENSION;
|
|
2992
2994
|
};
|
|
2993
2995
|
|
|
2996
|
+
// src/transforms/placeholderV1/convertPlaceholderToV2.ts
|
|
2997
|
+
var convertPlaceholderToV2 = ({ id, settings }) => CABRootSection.parse({
|
|
2998
|
+
previewMode: settings.previewMode,
|
|
2999
|
+
sections: [],
|
|
3000
|
+
sectionType: "layout",
|
|
3001
|
+
// CABTracking's schema fallbacks fill missing or null fields and the missing object; malformed values throw.
|
|
3002
|
+
tracking: settings.tracking,
|
|
3003
|
+
type: WidgetType.placeholder,
|
|
3004
|
+
version: 2,
|
|
3005
|
+
widgetId: id
|
|
3006
|
+
});
|
|
3007
|
+
|
|
3008
|
+
// src/transforms/placeholderV1/types.ts
|
|
3009
|
+
var isPlaceholderV1 = (data) => !!data && typeof data === "object" && data.type === WidgetType.placeholder;
|
|
3010
|
+
|
|
2994
3011
|
// src/transforms/offerV1/offerCard.ts
|
|
2995
3012
|
var borderToken = (tokens, value) => value !== void 0 && tokens.includes(value) ? value : "base";
|
|
2996
3013
|
var GRID_CARD_IMAGE_PX = 120;
|
|
@@ -4210,6 +4227,7 @@ var dispatchWidgetTransform = (id, normalized, report) => {
|
|
|
4210
4227
|
if (isContentBlockV1(normalized)) return convertContentBlockToV2({ id, settings: normalized });
|
|
4211
4228
|
if (isLineItemEditorV1(normalized)) return convertLineItemEditorToV2({ id, settings: normalized });
|
|
4212
4229
|
if (isMonetizeV1(normalized)) return convertMonetizeToV2({ id, settings: normalized });
|
|
4230
|
+
if (isPlaceholderV1(normalized)) return convertPlaceholderToV2({ id, settings: normalized });
|
|
4213
4231
|
if (isOfferV1(normalized)) return convertOfferToV2({ id, name: normalized.name, settings: normalized });
|
|
4214
4232
|
return normalized;
|
|
4215
4233
|
};
|
|
@@ -4445,6 +4463,11 @@ var TAXONOMY = {
|
|
|
4445
4463
|
}
|
|
4446
4464
|
};
|
|
4447
4465
|
var isKnownEvent = (name) => name in TAXONOMY;
|
|
4466
|
+
var toEngineEventTime = (sentAt) => {
|
|
4467
|
+
if (!sentAt) return void 0;
|
|
4468
|
+
const ms = Date.parse(sentAt);
|
|
4469
|
+
return Number.isFinite(ms) ? String(ms) : void 0;
|
|
4470
|
+
};
|
|
4448
4471
|
var translateAnalyticsEvent = (event, input) => {
|
|
4449
4472
|
if (!isKnownEvent(event.name)) return null;
|
|
4450
4473
|
const taxonomy = TAXONOMY[event.name];
|
|
@@ -4453,13 +4476,14 @@ var translateAnalyticsEvent = (event, input) => {
|
|
|
4453
4476
|
const tags = taxonomy.buildTags?.(properties);
|
|
4454
4477
|
const definedNounId = taxonomy.buildDefinedNounId?.(properties);
|
|
4455
4478
|
const widgetId = taxonomy.buildWidgetId?.(properties, input) ?? input.widgetId;
|
|
4479
|
+
const eventTime = toEngineEventTime(event.sentAt);
|
|
4456
4480
|
return {
|
|
4457
4481
|
noun: taxonomy.noun,
|
|
4458
4482
|
subject: taxonomy.subject,
|
|
4459
4483
|
uuid: input.visitorId,
|
|
4460
4484
|
verb: taxonomy.verb,
|
|
4461
4485
|
// Aggregate by checkout identity (Rebuy cart token + Shopify checkout token); else the visitor id (React parity).
|
|
4462
|
-
...
|
|
4486
|
+
...eventTime !== void 0 && { event_time: eventTime },
|
|
4463
4487
|
...input.cartToken && { cart_token: input.cartToken },
|
|
4464
4488
|
...input.checkoutToken && { shopify_checkout_token: input.checkoutToken },
|
|
4465
4489
|
...!input.cartToken && !input.checkoutToken && { aggregator: input.visitorId },
|
|
@@ -35,6 +35,7 @@ __export(transforms_exports, {
|
|
|
35
35
|
convertMonetizeToV2: () => convertMonetizeToV2,
|
|
36
36
|
convertNumericObjects: () => convertNumericObjects,
|
|
37
37
|
convertOfferToV2: () => convertOfferToV2,
|
|
38
|
+
convertPlaceholderToV2: () => convertPlaceholderToV2,
|
|
38
39
|
convertProgressBarToV2: () => convertProgressBarToV2,
|
|
39
40
|
convertSmartCartProgressBarToV2: () => convertSmartCartProgressBarToV2,
|
|
40
41
|
convertTextToTiptapParagraph: () => convertTextToTiptapParagraph,
|
|
@@ -47,6 +48,7 @@ __export(transforms_exports, {
|
|
|
47
48
|
isLineItemEditorV1: () => isLineItemEditorV1,
|
|
48
49
|
isMonetizeV1: () => isMonetizeV1,
|
|
49
50
|
isOfferV1: () => isOfferV1,
|
|
51
|
+
isPlaceholderV1: () => isPlaceholderV1,
|
|
50
52
|
isProgressBarV1: () => isProgressBarV1,
|
|
51
53
|
normalizeTextContent: () => normalizeTextContent,
|
|
52
54
|
normalizeTokens: () => normalizeTokens,
|
|
@@ -224,6 +226,33 @@ var variantSelectors = ["menu", "radio", "button"];
|
|
|
224
226
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
225
227
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
226
228
|
var VerticalAlignment = freezeEnum(verticalAlignments);
|
|
229
|
+
var widgetTypes = [
|
|
230
|
+
"bundle_builder",
|
|
231
|
+
"cart",
|
|
232
|
+
"cart_subscription",
|
|
233
|
+
"dynamic_bundle",
|
|
234
|
+
"gift_with_purchase",
|
|
235
|
+
/** An A/B experiment's stand-in element (admin-api `createPlaceholder`); converts to an EMPTY tree. */
|
|
236
|
+
"placeholder",
|
|
237
|
+
"pre_purchase",
|
|
238
|
+
"product",
|
|
239
|
+
"product_addon",
|
|
240
|
+
"product_upsell",
|
|
241
|
+
"recharge_checkout",
|
|
242
|
+
"recharge_customer_portal",
|
|
243
|
+
"recharge_post_purchase",
|
|
244
|
+
"shopify_checkout",
|
|
245
|
+
"shopify_checkout_extension",
|
|
246
|
+
"shopify_post_purchase",
|
|
247
|
+
"shopify_post_purchase_extension",
|
|
248
|
+
"switch_to_subscription",
|
|
249
|
+
"ui_extension_ad",
|
|
250
|
+
"ui_extension_button",
|
|
251
|
+
"ui_extension_content_block",
|
|
252
|
+
"ui_extension_line_item_editor",
|
|
253
|
+
"ui_extension_progress_bar"
|
|
254
|
+
];
|
|
255
|
+
var WidgetType = freezeEnum(widgetTypes);
|
|
227
256
|
|
|
228
257
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
229
258
|
var iconNames = [
|
|
@@ -790,31 +819,6 @@ var targetAreas = {
|
|
|
790
819
|
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
791
820
|
]
|
|
792
821
|
};
|
|
793
|
-
var widgetTypes = [
|
|
794
|
-
"bundle_builder",
|
|
795
|
-
"cart",
|
|
796
|
-
"cart_subscription",
|
|
797
|
-
"dynamic_bundle",
|
|
798
|
-
"gift_with_purchase",
|
|
799
|
-
"pre_purchase",
|
|
800
|
-
"product",
|
|
801
|
-
"product_addon",
|
|
802
|
-
"product_upsell",
|
|
803
|
-
"recharge_checkout",
|
|
804
|
-
"recharge_customer_portal",
|
|
805
|
-
"recharge_post_purchase",
|
|
806
|
-
"shopify_checkout",
|
|
807
|
-
"shopify_checkout_extension",
|
|
808
|
-
"shopify_post_purchase",
|
|
809
|
-
"shopify_post_purchase_extension",
|
|
810
|
-
"switch_to_subscription",
|
|
811
|
-
"ui_extension_ad",
|
|
812
|
-
"ui_extension_button",
|
|
813
|
-
"ui_extension_content_block",
|
|
814
|
-
"ui_extension_line_item_editor",
|
|
815
|
-
"ui_extension_progress_bar"
|
|
816
|
-
];
|
|
817
|
-
var WidgetType = freezeEnum(widgetTypes);
|
|
818
822
|
|
|
819
823
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
820
824
|
var CABDiscount = import_zod7.z.object({
|
|
@@ -2893,6 +2897,21 @@ var buildOfferTemplate = ({ location, name } = {}) => CABRootSection.parse({
|
|
|
2893
2897
|
type: SHOPIFY_CHECKOUT_EXTENSION
|
|
2894
2898
|
});
|
|
2895
2899
|
|
|
2900
|
+
// src/transforms/placeholderV1/convertPlaceholderToV2.ts
|
|
2901
|
+
var convertPlaceholderToV2 = ({ id, settings }) => CABRootSection.parse({
|
|
2902
|
+
previewMode: settings.previewMode,
|
|
2903
|
+
sections: [],
|
|
2904
|
+
sectionType: "layout",
|
|
2905
|
+
// CABTracking's schema fallbacks fill missing or null fields and the missing object; malformed values throw.
|
|
2906
|
+
tracking: settings.tracking,
|
|
2907
|
+
type: WidgetType.placeholder,
|
|
2908
|
+
version: 2,
|
|
2909
|
+
widgetId: id
|
|
2910
|
+
});
|
|
2911
|
+
|
|
2912
|
+
// src/transforms/placeholderV1/types.ts
|
|
2913
|
+
var isPlaceholderV1 = (data) => !!data && typeof data === "object" && data.type === WidgetType.placeholder;
|
|
2914
|
+
|
|
2896
2915
|
// src/transforms/offerV1/offerCard.ts
|
|
2897
2916
|
var borderToken = (tokens, value) => value !== void 0 && tokens.includes(value) ? value : "base";
|
|
2898
2917
|
var GRID_CARD_IMAGE_PX = 120;
|
|
@@ -15,6 +15,8 @@ export { normalizeTextContent } from '../transforms/normalizeTextContent';
|
|
|
15
15
|
export { normalizeTokens } from '../transforms/normalizeTokens';
|
|
16
16
|
export { resolveExperiment, type ActiveExperiment, type ResolvedExperiment, } from '../transforms/experiments/resolveExperiment';
|
|
17
17
|
export { buildOfferTemplate, type BuildOfferTemplateInput } from '../transforms/offerV1/buildOfferTemplate';
|
|
18
|
+
export { convertPlaceholderToV2 } from '../transforms/placeholderV1/convertPlaceholderToV2';
|
|
19
|
+
export { isPlaceholderV1, type V1PlaceholderConvertInput } from '../transforms/placeholderV1/types';
|
|
18
20
|
export { convertOfferToV2 } from '../transforms/offerV1/convertOfferToV2';
|
|
19
21
|
export { buildOfferCard } from '../transforms/offerV1/offerCard';
|
|
20
22
|
export { isOfferV1, SHOPIFY_CHECKOUT_EXTENSION, type V1OfferConvertInput, type V1OfferSettings, } from '../transforms/offerV1/types';
|
|
@@ -167,6 +167,33 @@ var variantSelectors = ["menu", "radio", "button"];
|
|
|
167
167
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
168
168
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
169
169
|
var VerticalAlignment = freezeEnum(verticalAlignments);
|
|
170
|
+
var widgetTypes = [
|
|
171
|
+
"bundle_builder",
|
|
172
|
+
"cart",
|
|
173
|
+
"cart_subscription",
|
|
174
|
+
"dynamic_bundle",
|
|
175
|
+
"gift_with_purchase",
|
|
176
|
+
/** An A/B experiment's stand-in element (admin-api `createPlaceholder`); converts to an EMPTY tree. */
|
|
177
|
+
"placeholder",
|
|
178
|
+
"pre_purchase",
|
|
179
|
+
"product",
|
|
180
|
+
"product_addon",
|
|
181
|
+
"product_upsell",
|
|
182
|
+
"recharge_checkout",
|
|
183
|
+
"recharge_customer_portal",
|
|
184
|
+
"recharge_post_purchase",
|
|
185
|
+
"shopify_checkout",
|
|
186
|
+
"shopify_checkout_extension",
|
|
187
|
+
"shopify_post_purchase",
|
|
188
|
+
"shopify_post_purchase_extension",
|
|
189
|
+
"switch_to_subscription",
|
|
190
|
+
"ui_extension_ad",
|
|
191
|
+
"ui_extension_button",
|
|
192
|
+
"ui_extension_content_block",
|
|
193
|
+
"ui_extension_line_item_editor",
|
|
194
|
+
"ui_extension_progress_bar"
|
|
195
|
+
];
|
|
196
|
+
var WidgetType = freezeEnum(widgetTypes);
|
|
170
197
|
|
|
171
198
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
172
199
|
var iconNames = [
|
|
@@ -733,31 +760,6 @@ var targetAreas = {
|
|
|
733
760
|
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
734
761
|
]
|
|
735
762
|
};
|
|
736
|
-
var widgetTypes = [
|
|
737
|
-
"bundle_builder",
|
|
738
|
-
"cart",
|
|
739
|
-
"cart_subscription",
|
|
740
|
-
"dynamic_bundle",
|
|
741
|
-
"gift_with_purchase",
|
|
742
|
-
"pre_purchase",
|
|
743
|
-
"product",
|
|
744
|
-
"product_addon",
|
|
745
|
-
"product_upsell",
|
|
746
|
-
"recharge_checkout",
|
|
747
|
-
"recharge_customer_portal",
|
|
748
|
-
"recharge_post_purchase",
|
|
749
|
-
"shopify_checkout",
|
|
750
|
-
"shopify_checkout_extension",
|
|
751
|
-
"shopify_post_purchase",
|
|
752
|
-
"shopify_post_purchase_extension",
|
|
753
|
-
"switch_to_subscription",
|
|
754
|
-
"ui_extension_ad",
|
|
755
|
-
"ui_extension_button",
|
|
756
|
-
"ui_extension_content_block",
|
|
757
|
-
"ui_extension_line_item_editor",
|
|
758
|
-
"ui_extension_progress_bar"
|
|
759
|
-
];
|
|
760
|
-
var WidgetType = freezeEnum(widgetTypes);
|
|
761
763
|
|
|
762
764
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
763
765
|
var CABDiscount = z7.object({
|
|
@@ -2836,6 +2838,21 @@ var buildOfferTemplate = ({ location, name } = {}) => CABRootSection.parse({
|
|
|
2836
2838
|
type: SHOPIFY_CHECKOUT_EXTENSION
|
|
2837
2839
|
});
|
|
2838
2840
|
|
|
2841
|
+
// src/transforms/placeholderV1/convertPlaceholderToV2.ts
|
|
2842
|
+
var convertPlaceholderToV2 = ({ id, settings }) => CABRootSection.parse({
|
|
2843
|
+
previewMode: settings.previewMode,
|
|
2844
|
+
sections: [],
|
|
2845
|
+
sectionType: "layout",
|
|
2846
|
+
// CABTracking's schema fallbacks fill missing or null fields and the missing object; malformed values throw.
|
|
2847
|
+
tracking: settings.tracking,
|
|
2848
|
+
type: WidgetType.placeholder,
|
|
2849
|
+
version: 2,
|
|
2850
|
+
widgetId: id
|
|
2851
|
+
});
|
|
2852
|
+
|
|
2853
|
+
// src/transforms/placeholderV1/types.ts
|
|
2854
|
+
var isPlaceholderV1 = (data) => !!data && typeof data === "object" && data.type === WidgetType.placeholder;
|
|
2855
|
+
|
|
2839
2856
|
// src/transforms/offerV1/offerCard.ts
|
|
2840
2857
|
var borderToken = (tokens, value) => value !== void 0 && tokens.includes(value) ? value : "base";
|
|
2841
2858
|
var GRID_CARD_IMAGE_PX = 120;
|
|
@@ -3634,6 +3651,7 @@ export {
|
|
|
3634
3651
|
convertMonetizeToV2,
|
|
3635
3652
|
convertNumericObjects,
|
|
3636
3653
|
convertOfferToV2,
|
|
3654
|
+
convertPlaceholderToV2,
|
|
3637
3655
|
convertProgressBarToV2,
|
|
3638
3656
|
convertSmartCartProgressBarToV2,
|
|
3639
3657
|
convertTextToTiptapParagraph,
|
|
@@ -3646,6 +3664,7 @@ export {
|
|
|
3646
3664
|
isLineItemEditorV1,
|
|
3647
3665
|
isMonetizeV1,
|
|
3648
3666
|
isOfferV1,
|
|
3667
|
+
isPlaceholderV1,
|
|
3649
3668
|
isProgressBarV1,
|
|
3650
3669
|
normalizeTextContent,
|
|
3651
3670
|
normalizeTokens,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CABRootSection } from '../../schema/widgets/checkout-and-beyond';
|
|
2
|
+
import { type V1PlaceholderConvertInput } from '../../transforms/placeholderV1/types';
|
|
3
|
+
/**
|
|
4
|
+
* An A/B placeholder as an EMPTY `placeholder`-typed CAB tree. Before this the placeholder fell through
|
|
5
|
+
* the dispatcher as raw legacy JSON, which rebuy-api's `/cab/sections` turns into a 404 — so the checkout
|
|
6
|
+
* editor told merchants their experiment id was "invalid" (React showed an informational A/B banner
|
|
7
|
+
* instead). A typed empty tree lets the extension render the same banner in the editor and nothing for a
|
|
8
|
+
* buyer, while a running experiment keeps resolving to the variant tree before this converter is reached.
|
|
9
|
+
*/
|
|
10
|
+
export declare const convertPlaceholderToV2: ({ id, settings }: V1PlaceholderConvertInput) => CABRootSection;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type CABTracking } from '../../schema/widgets/checkout-and-beyond';
|
|
2
|
+
import { WidgetType } from '../../schema/widgets/checkout-and-beyond/constants';
|
|
3
|
+
/**
|
|
4
|
+
* An A/B experiment's placeholder widget. The admin creates a `Widget`/`CheckoutOffer` experiment with a
|
|
5
|
+
* stand-in element whose stored settings are just `{ type: 'placeholder' }` (admin-api
|
|
6
|
+
* `ABTesting::createPlaceholder`); the merchant puts THAT id in the checkout block, and while the
|
|
7
|
+
* experiment runs the proxy swaps in the sticky variant's tree. When no experiment targets the id (draft,
|
|
8
|
+
* paused, or the visitor id is missing) the placeholder's own settings come back — this is their shape.
|
|
9
|
+
* No `version` discriminator: the engine never stamps one on a placeholder.
|
|
10
|
+
*/
|
|
11
|
+
export type V1PlaceholderConvertInput = {
|
|
12
|
+
id: number;
|
|
13
|
+
settings: {
|
|
14
|
+
previewMode?: boolean | null;
|
|
15
|
+
tracking?: CABTracking | null;
|
|
16
|
+
type: typeof WidgetType.placeholder;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
/** Identifies an A/B placeholder payload by `type` alone (placeholders carry no `version`). */
|
|
20
|
+
export declare const isPlaceholderV1: (data: unknown) => data is V1PlaceholderConvertInput["settings"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebuy/rebuy",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.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.",
|