@rebuy/rebuy 3.29.1 → 3.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/index.cjs +1536 -1343
- package/dist/index.mjs +1533 -1340
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/postPurchaseProductCollectionView.d.ts +8 -0
- package/dist/schema/postPurchaseProductDisplay.d.ts +59 -0
- package/dist/schema/postPurchaseProductGallery.d.ts +11 -0
- package/dist/schema/postPurchaseProductSettings.d.ts +117 -0
- package/dist/schema/postPurchaseProductSource.d.ts +65 -0
- package/dist/schema/postPurchaseVariantCatalog.d.ts +41 -0
- package/dist/schema/postPurchaseVariantDefault.d.ts +36 -0
- package/dist/schema/shopConfig.d.ts +2 -2
- package/dist/schema/userConfig.d.ts +2 -2
- package/dist/schema/widgetData.d.ts +2 -2
- package/dist/schema/widgets/checkout-and-beyond/banner.d.ts +29 -29
- package/dist/schema/widgets/checkout-and-beyond/carousel.d.ts +29 -29
- package/dist/schema/widgets/checkout-and-beyond/cartLine.d.ts +29 -29
- package/dist/schema/widgets/checkout-and-beyond/common.d.ts +5 -5
- package/dist/schema/widgets/checkout-and-beyond/offers.d.ts +29 -29
- package/dist/schema/widgets/checkout-and-beyond/progressBar.d.ts +29 -29
- package/dist/schema/widgets/checkout-and-beyond/root.d.ts +1 -1
- package/dist/schema/widgets/contentBlock.d.ts +4 -4
- package/dist/schema/widgets/post-purchase-offer/constants.d.ts +4 -4
- package/dist/schema/widgets/post-purchase-offer/postPurchaseBlocks.d.ts +2 -2
- package/dist/schema/widgets/post-purchase-offer/postPurchaseOffer.d.ts +2 -2
- package/dist/schema/widgets/post-purchase-offer/postPurchaseSettings.d.ts +2 -2
- package/dist/schema/widgets/post-purchase-offer/postPurchaseWidget.d.ts +2 -2
- package/dist/server/__fixtures__/postPurchaseProduct.d.ts +137 -0
- package/dist/server/__fixtures__/postPurchaseVariantDefaults.d.ts +26 -0
- package/dist/server/__fixtures__/postPurchaseVariants.d.ts +47 -0
- package/dist/server/matchPostPurchaseVariantDefault.d.ts +17 -0
- package/dist/server/normalizePostPurchaseCollection.d.ts +250 -0
- package/dist/server/normalizePostPurchaseProduct.d.ts +202 -0
- package/dist/server/postPurchasePrimaryImage.d.ts +6 -0
- package/dist/server/postPurchaseProductDisplay.d.ts +41 -0
- package/dist/server/postPurchaseProductEligibility.d.ts +8 -0
- package/dist/server/postPurchaseProductGallery.d.ts +5 -0
- package/dist/server/postPurchaseVariantAvailable.d.ts +12 -0
- package/dist/server/postPurchaseVariantCatalog.d.ts +3 -0
- package/dist/server/projectPostPurchaseProduct.d.ts +127 -0
- package/dist/server/resolvePostPurchaseVariantDefault.d.ts +10 -0
- package/dist/transforms/postPurchase/imageContentSettings.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -133,10 +133,19 @@ __export(src_exports, {
|
|
|
133
133
|
POST_PURCHASE_SKIP_LIMIT: () => POST_PURCHASE_SKIP_LIMIT,
|
|
134
134
|
PayButtonBlock: () => PayButtonBlock,
|
|
135
135
|
PopoverPosition: () => PopoverPosition,
|
|
136
|
+
PostPurchaseAmount: () => PostPurchaseAmount,
|
|
136
137
|
PostPurchaseAppIdSchema: () => PostPurchaseAppIdSchema,
|
|
137
138
|
PostPurchaseBlock: () => PostPurchaseBlock,
|
|
139
|
+
PostPurchaseExcludedProductIds: () => PostPurchaseExcludedProductIds,
|
|
138
140
|
PostPurchaseOffer: () => PostPurchaseOffer,
|
|
141
|
+
PostPurchaseOrderAttributes: () => PostPurchaseOrderAttributes,
|
|
139
142
|
PostPurchaseOrderIdSchema: () => PostPurchaseOrderIdSchema,
|
|
143
|
+
PostPurchasePrimaryImageSource: () => PostPurchasePrimaryImageSource,
|
|
144
|
+
PostPurchaseProductDisplay: () => PostPurchaseProductDisplay,
|
|
145
|
+
PostPurchaseProductGallery: () => PostPurchaseProductGallery,
|
|
146
|
+
PostPurchaseProductId: () => PostPurchaseProductId,
|
|
147
|
+
PostPurchaseProductSettings: () => PostPurchaseProductSettings,
|
|
148
|
+
PostPurchaseProductSource: () => PostPurchaseProductSource,
|
|
140
149
|
PostPurchaseSettings: () => PostPurchaseSettings,
|
|
141
150
|
PostPurchaseShadowReportFields: () => PostPurchaseShadowReportFields,
|
|
142
151
|
PostPurchaseShadowReportSchema: () => PostPurchaseShadowReportSchema,
|
|
@@ -144,6 +153,13 @@ __export(src_exports, {
|
|
|
144
153
|
PostPurchaseSkipReasonSchema: () => PostPurchaseSkipReasonSchema,
|
|
145
154
|
PostPurchaseSkipTraceSchema: () => PostPurchaseSkipTraceSchema,
|
|
146
155
|
PostPurchaseTimestampSchema: () => PostPurchaseTimestampSchema,
|
|
156
|
+
PostPurchaseVariantCatalog: () => PostPurchaseVariantCatalog,
|
|
157
|
+
PostPurchaseVariantDefaultProduct: () => PostPurchaseVariantDefaultProduct,
|
|
158
|
+
PostPurchaseVariantDefaultSettings: () => PostPurchaseVariantDefaultSettings,
|
|
159
|
+
PostPurchaseVariantId: () => PostPurchaseVariantId,
|
|
160
|
+
PostPurchaseVariantOption: () => PostPurchaseVariantOption,
|
|
161
|
+
PostPurchaseVariantSelector: () => PostPurchaseVariantSelector,
|
|
162
|
+
PostPurchaseVariantValues: () => PostPurchaseVariantValues,
|
|
147
163
|
PostPurchaseWidget: () => PostPurchaseWidget,
|
|
148
164
|
PostPurchaseWidgetLinkedFlow: () => PostPurchaseWidgetLinkedFlow,
|
|
149
165
|
Product: () => Product,
|
|
@@ -367,8 +383,8 @@ function getIdFromGraphUrl(graphId, objectType) {
|
|
|
367
383
|
}
|
|
368
384
|
return id;
|
|
369
385
|
}
|
|
370
|
-
function variantAvailable(
|
|
371
|
-
return !(
|
|
386
|
+
function variantAvailable(variant2) {
|
|
387
|
+
return !(variant2.inventory_management && variant2.inventory_policy === "deny" && variant2.inventory_quantity <= 0);
|
|
372
388
|
}
|
|
373
389
|
function firstAvailableVariant(product) {
|
|
374
390
|
let selectedVariant = product.variants[0];
|
|
@@ -402,7 +418,7 @@ function convertProductToStorefrontFormat(product) {
|
|
|
402
418
|
const minVariantCompareAtPrice = variantMinMaxPriceObject(product, "compare_at_price", "min");
|
|
403
419
|
const maxVariantCompareAtPrice = variantMinMaxPriceObject(product, "compare_at_price", "max");
|
|
404
420
|
const selectedOptions = selectedVariantOptions(product, defaultVariant);
|
|
405
|
-
const variants = product.variants.map((
|
|
421
|
+
const variants = product.variants.map((variant2) => convertVariantToStorefrontFormat(product, variant2));
|
|
406
422
|
return {
|
|
407
423
|
collections: null,
|
|
408
424
|
compareAtPriceRange: {
|
|
@@ -445,15 +461,15 @@ function convertToNodes(arr) {
|
|
|
445
461
|
]
|
|
446
462
|
};
|
|
447
463
|
}
|
|
448
|
-
function convertVariantToStorefrontFormat(product,
|
|
449
|
-
const selectedOptions = selectedVariantOptions(product,
|
|
450
|
-
const image = productImageObject(product,
|
|
464
|
+
function convertVariantToStorefrontFormat(product, variant2) {
|
|
465
|
+
const selectedOptions = selectedVariantOptions(product, variant2);
|
|
466
|
+
const image = productImageObject(product, variant2.image_id);
|
|
451
467
|
return {
|
|
452
|
-
availableForSale: variantAvailable(
|
|
453
|
-
compareAtPriceV2: variantPriceObject(
|
|
454
|
-
id: `gid://shopify/ProductVariant/${
|
|
468
|
+
availableForSale: variantAvailable(variant2),
|
|
469
|
+
compareAtPriceV2: variantPriceObject(variant2, "compare_at_price"),
|
|
470
|
+
id: `gid://shopify/ProductVariant/${variant2.id}`,
|
|
455
471
|
image,
|
|
456
|
-
priceV2: variantPriceObject(
|
|
472
|
+
priceV2: variantPriceObject(variant2, "price"),
|
|
457
473
|
product: {
|
|
458
474
|
handle: product.handle,
|
|
459
475
|
id: product.id,
|
|
@@ -461,8 +477,8 @@ function convertVariantToStorefrontFormat(product, variant) {
|
|
|
461
477
|
vendor: product.vendor
|
|
462
478
|
},
|
|
463
479
|
selectedOptions: [selectedOptions],
|
|
464
|
-
sku:
|
|
465
|
-
title:
|
|
480
|
+
sku: variant2.sku,
|
|
481
|
+
title: variant2.title
|
|
466
482
|
};
|
|
467
483
|
}
|
|
468
484
|
function variantMinMaxPriceObject(product, key = "price", operator = "min") {
|
|
@@ -479,25 +495,25 @@ function variantMinMaxPriceObject(product, key = "price", operator = "min") {
|
|
|
479
495
|
}
|
|
480
496
|
return priceObject;
|
|
481
497
|
}
|
|
482
|
-
function variantPriceObject(
|
|
483
|
-
if (
|
|
498
|
+
function variantPriceObject(variant2, key = "price") {
|
|
499
|
+
if (variant2[key] != null) {
|
|
484
500
|
return {
|
|
485
|
-
amount:
|
|
501
|
+
amount: variant2[key],
|
|
486
502
|
currencyCode: "USD"
|
|
487
503
|
};
|
|
488
504
|
}
|
|
489
505
|
return null;
|
|
490
506
|
}
|
|
491
|
-
function selectedVariantOptions(product,
|
|
507
|
+
function selectedVariantOptions(product, variant2) {
|
|
492
508
|
const selectedOptions = {};
|
|
493
|
-
if (
|
|
494
|
-
selectedOptions[product.options[0].name] =
|
|
509
|
+
if (variant2.option1 != null) {
|
|
510
|
+
selectedOptions[product.options[0].name] = variant2.option1;
|
|
495
511
|
}
|
|
496
|
-
if (
|
|
497
|
-
selectedOptions[product.options[1].name] =
|
|
512
|
+
if (variant2.option2 != null) {
|
|
513
|
+
selectedOptions[product.options[1].name] = variant2.option2;
|
|
498
514
|
}
|
|
499
|
-
if (
|
|
500
|
-
selectedOptions[product.options[2].name] =
|
|
515
|
+
if (variant2.option3 != null) {
|
|
516
|
+
selectedOptions[product.options[2].name] = variant2.option3;
|
|
501
517
|
}
|
|
502
518
|
return selectedOptions;
|
|
503
519
|
}
|
|
@@ -542,16 +558,16 @@ function utmObjectFromString(str) {
|
|
|
542
558
|
}
|
|
543
559
|
return Object.keys(matches).length > 0 ? matches : null;
|
|
544
560
|
}
|
|
545
|
-
function amountToCents(
|
|
561
|
+
function amountToCents(amount2) {
|
|
546
562
|
let normalizedAmount = 0;
|
|
547
|
-
if (typeof
|
|
548
|
-
if (
|
|
549
|
-
normalizedAmount = Math.round(parseFloat(
|
|
563
|
+
if (typeof amount2 === "string") {
|
|
564
|
+
if (amount2.indexOf(".") !== -1) {
|
|
565
|
+
normalizedAmount = Math.round(parseFloat(amount2) * 100);
|
|
550
566
|
} else {
|
|
551
|
-
normalizedAmount = parseInt(
|
|
567
|
+
normalizedAmount = parseInt(amount2, 10);
|
|
552
568
|
}
|
|
553
|
-
} else if (typeof
|
|
554
|
-
normalizedAmount = Math.round(
|
|
569
|
+
} else if (typeof amount2 === "number") {
|
|
570
|
+
normalizedAmount = Math.round(amount2 * 100);
|
|
555
571
|
}
|
|
556
572
|
if (isNaN(normalizedAmount)) {
|
|
557
573
|
normalizedAmount = 0;
|
|
@@ -619,10 +635,10 @@ var stagingDomains = [
|
|
|
619
635
|
"dash-ext-hoke.myshopify.com",
|
|
620
636
|
"rebuy-checkout-e2e-staging.myshopify.com"
|
|
621
637
|
];
|
|
622
|
-
var makeCall = async (key, method, path, data, origin,
|
|
638
|
+
var makeCall = async (key, method, path, data, origin, options2 = {}) => {
|
|
623
639
|
const url = `${origin}${path}`;
|
|
624
640
|
const requestUrl = new URL(url);
|
|
625
|
-
const fetchOptions =
|
|
641
|
+
const fetchOptions = options2?.fetch ?? {};
|
|
626
642
|
const requestData = {};
|
|
627
643
|
if (typeof data == "object" && data != null) {
|
|
628
644
|
Object.assign(requestData, data);
|
|
@@ -651,7 +667,7 @@ var makeCall = async (key, method, path, data, origin, options = {}) => {
|
|
|
651
667
|
return response;
|
|
652
668
|
};
|
|
653
669
|
var Api = class {
|
|
654
|
-
constructor(
|
|
670
|
+
constructor(options2) {
|
|
655
671
|
this.config = {
|
|
656
672
|
/**
|
|
657
673
|
* @deprecated Use `staticDomain` (same host) — `cdnDomain` remains only for legacy callers and goes away in the next major.
|
|
@@ -665,10 +681,10 @@ var Api = class {
|
|
|
665
681
|
shop: null,
|
|
666
682
|
staticDomain: "https://cdn.rebuyengine.com"
|
|
667
683
|
};
|
|
668
|
-
if (typeof
|
|
669
|
-
this.config.key =
|
|
670
|
-
} else if (typeof
|
|
671
|
-
Object.assign(this.config,
|
|
684
|
+
if (typeof options2 == "string") {
|
|
685
|
+
this.config.key = options2;
|
|
686
|
+
} else if (typeof options2 == "object" && options2 != null) {
|
|
687
|
+
Object.assign(this.config, options2);
|
|
672
688
|
}
|
|
673
689
|
for (const domain of stagingDomains) {
|
|
674
690
|
if (typeof location === "object" && location?.host?.includes(domain)) {
|
|
@@ -681,23 +697,23 @@ var Api = class {
|
|
|
681
697
|
}
|
|
682
698
|
}
|
|
683
699
|
}
|
|
684
|
-
async callEvent(method, path, data,
|
|
685
|
-
return await makeCall(this.config.key, method, path, data, this.config.eventDomain,
|
|
700
|
+
async callEvent(method, path, data, options2) {
|
|
701
|
+
return await makeCall(this.config.key, method, path, data, this.config.eventDomain, options2);
|
|
686
702
|
}
|
|
687
|
-
async callShield(method, path, data,
|
|
688
|
-
return await makeCall(this.config.key, method, path, data, this.config.shieldDomain,
|
|
703
|
+
async callShield(method, path, data, options2) {
|
|
704
|
+
return await makeCall(this.config.key, method, path, data, this.config.shieldDomain, options2);
|
|
689
705
|
}
|
|
690
|
-
async callStatic(method, path, data,
|
|
691
|
-
return await makeCall(this.config.key, method, path, data, this.config.staticDomain,
|
|
706
|
+
async callStatic(method, path, data, options2) {
|
|
707
|
+
return await makeCall(this.config.key, method, path, data, this.config.staticDomain, options2);
|
|
692
708
|
}
|
|
693
|
-
async callGeo(method, path, data,
|
|
694
|
-
return await makeCall(this.config.key, method, path, data, this.config.geoDomain,
|
|
709
|
+
async callGeo(method, path, data, options2) {
|
|
710
|
+
return await makeCall(this.config.key, method, path, data, this.config.geoDomain, options2);
|
|
695
711
|
}
|
|
696
|
-
async callCdn(method, path, data,
|
|
697
|
-
return await makeCall(this.config.key, method, path, data, this.config.cdnDomain,
|
|
712
|
+
async callCdn(method, path, data, options2) {
|
|
713
|
+
return await makeCall(this.config.key, method, path, data, this.config.cdnDomain, options2);
|
|
698
714
|
}
|
|
699
|
-
async callApi(method, path, data,
|
|
700
|
-
return await makeCall(this.config.key, method, path, data, this.config.domain,
|
|
715
|
+
async callApi(method, path, data, options2) {
|
|
716
|
+
return await makeCall(this.config.key, method, path, data, this.config.domain, options2);
|
|
701
717
|
}
|
|
702
718
|
};
|
|
703
719
|
var api_default = Api;
|
|
@@ -949,16 +965,16 @@ var trackEvent = async (config2, eventData) => {
|
|
|
949
965
|
}
|
|
950
966
|
return await config2.api.callEvent("POST", "/api/v1/analytics/event", eventData);
|
|
951
967
|
};
|
|
952
|
-
var makeShieldCall = async (config2, endpoint, params, format,
|
|
953
|
-
return await makeCall2(config2, endpoint, params, format, { ...
|
|
968
|
+
var makeShieldCall = async (config2, endpoint, params, format, options2 = {}) => {
|
|
969
|
+
return await makeCall2(config2, endpoint, params, format, { ...options2, shield: true });
|
|
954
970
|
};
|
|
955
|
-
var makeStaticCall = async (config2, endpoint, params, format,
|
|
956
|
-
return await makeCall2(config2, endpoint, params, format, { ...
|
|
971
|
+
var makeStaticCall = async (config2, endpoint, params, format, options2 = {}) => {
|
|
972
|
+
return await makeCall2(config2, endpoint, params, format, { ...options2, static: true });
|
|
957
973
|
};
|
|
958
|
-
var makeCDNCall = async (config2, endpoint, params, format,
|
|
959
|
-
return await makeCall2(config2, endpoint, params, format, { ...
|
|
974
|
+
var makeCDNCall = async (config2, endpoint, params, format, options2 = {}) => {
|
|
975
|
+
return await makeCall2(config2, endpoint, params, format, { ...options2, cdn: true });
|
|
960
976
|
};
|
|
961
|
-
var makeCall2 = async (config2, endpoint, params, format,
|
|
977
|
+
var makeCall2 = async (config2, endpoint, params, format, options2 = {}) => {
|
|
962
978
|
const query = {};
|
|
963
979
|
if (config2.defaultParameters != null) {
|
|
964
980
|
Object.assign(query, config2.defaultParameters);
|
|
@@ -969,15 +985,15 @@ var makeCall2 = async (config2, endpoint, params, format, options = {}) => {
|
|
|
969
985
|
if (typeof params == "object" && params != null) {
|
|
970
986
|
Object.assign(query, params);
|
|
971
987
|
}
|
|
972
|
-
if (typeof
|
|
973
|
-
console.warn("Unsupported fetch options provided.",
|
|
974
|
-
|
|
988
|
+
if (typeof options2 != "object" || options2 == null) {
|
|
989
|
+
console.warn("Unsupported fetch options provided.", options2);
|
|
990
|
+
options2 = {};
|
|
975
991
|
}
|
|
976
992
|
if (config2.identity && config2.identity.visitorId()) {
|
|
977
993
|
query.uuid = config2.identity.visitorId();
|
|
978
994
|
}
|
|
979
|
-
const source =
|
|
980
|
-
const response = await config2.api[source]("GET", endpoint, query,
|
|
995
|
+
const source = options2.cdn ? "callCdn" : options2.shield ? "callShield" : options2.static ? "callStatic" : "callApi";
|
|
996
|
+
const response = await config2.api[source]("GET", endpoint, query, options2);
|
|
981
997
|
if (response.data && format === "storefront") {
|
|
982
998
|
for (let i = 0; i < response.data.length; i++) {
|
|
983
999
|
response.data[i] = convertProductToStorefrontFormat(response.data[i]);
|
|
@@ -1017,20 +1033,20 @@ var RebuyClient = class {
|
|
|
1017
1033
|
this.config.contextParameters = contextParameters;
|
|
1018
1034
|
}
|
|
1019
1035
|
}
|
|
1020
|
-
async getData(endpoint, params,
|
|
1021
|
-
return await makeCall2(this.config, endpoint, params, null,
|
|
1036
|
+
async getData(endpoint, params, options2 = {}) {
|
|
1037
|
+
return await makeCall2(this.config, endpoint, params, null, options2);
|
|
1022
1038
|
}
|
|
1023
|
-
async getDataFromCDN(endpoint, params,
|
|
1024
|
-
return await makeCDNCall(this.config, endpoint, params, null,
|
|
1039
|
+
async getDataFromCDN(endpoint, params, options2 = {}) {
|
|
1040
|
+
return await makeCDNCall(this.config, endpoint, params, null, options2);
|
|
1025
1041
|
}
|
|
1026
|
-
async getShieldedAsset(endpoint, params,
|
|
1027
|
-
return await makeShieldCall(this.config, endpoint, params, null,
|
|
1042
|
+
async getShieldedAsset(endpoint, params, options2 = {}) {
|
|
1043
|
+
return await makeShieldCall(this.config, endpoint, params, null, options2);
|
|
1028
1044
|
}
|
|
1029
|
-
async getStaticAsset(endpoint, params,
|
|
1030
|
-
return await makeStaticCall(this.config, endpoint, params, null,
|
|
1045
|
+
async getStaticAsset(endpoint, params, options2 = {}) {
|
|
1046
|
+
return await makeStaticCall(this.config, endpoint, params, null, options2);
|
|
1031
1047
|
}
|
|
1032
|
-
async getStorefrontData(endpoint, params,
|
|
1033
|
-
return await makeCall2(this.config, endpoint, params, "storefront",
|
|
1048
|
+
async getStorefrontData(endpoint, params, options2 = {}) {
|
|
1049
|
+
return await makeCall2(this.config, endpoint, params, "storefront", options2);
|
|
1034
1050
|
}
|
|
1035
1051
|
async trackProductViewed(data) {
|
|
1036
1052
|
const requiredKeys = ["shopify_product_id", "shopify_product_handle"];
|
|
@@ -1644,207 +1660,120 @@ var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
|
1644
1660
|
}
|
|
1645
1661
|
);
|
|
1646
1662
|
|
|
1647
|
-
// src/schema/
|
|
1663
|
+
// src/schema/postPurchaseProductCollectionView.ts
|
|
1664
|
+
var import_zod12 = require("zod");
|
|
1665
|
+
|
|
1666
|
+
// src/schema/postPurchaseProductSource.ts
|
|
1648
1667
|
var import_zod11 = require("zod");
|
|
1649
|
-
var
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1668
|
+
var PostPurchaseAmount = import_zod11.z.string().regex(/^\d+(?:\.\d+)?$/).refine((value) => Number.isFinite(Number(value)));
|
|
1669
|
+
var PostPurchaseProductId = import_zod11.z.number().int().positive();
|
|
1670
|
+
var PostPurchaseVariantId = import_zod11.z.number().int().positive();
|
|
1671
|
+
var ProductBase = OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
|
|
1672
|
+
description: OfferProduct.shape.description.nullable(),
|
|
1673
|
+
id: PostPurchaseProductId
|
|
1654
1674
|
});
|
|
1655
|
-
var
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1675
|
+
var SourceVariant = OfferProduct.shape.variants.element.pick({ id: true, title: true }).extend({
|
|
1676
|
+
compareAtPrice: PostPurchaseAmount.nullable(),
|
|
1677
|
+
id: PostPurchaseVariantId,
|
|
1678
|
+
imageId: import_zod11.z.number().int().nonnegative().nullish(),
|
|
1679
|
+
inventoryManagement: import_zod11.z.string().nullable(),
|
|
1680
|
+
inventoryPolicy: import_zod11.z.string(),
|
|
1681
|
+
inventoryQuantity: import_zod11.z.number(),
|
|
1682
|
+
option1: import_zod11.z.unknown().optional(),
|
|
1683
|
+
option2: import_zod11.z.unknown().optional(),
|
|
1684
|
+
option3: import_zod11.z.unknown().optional(),
|
|
1685
|
+
price: PostPurchaseAmount,
|
|
1686
|
+
productId: PostPurchaseProductId,
|
|
1687
|
+
sellingPlanAllocations: import_zod11.z.unknown().optional()
|
|
1667
1688
|
});
|
|
1668
|
-
var
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1689
|
+
var Product2 = ProductBase.extend({
|
|
1690
|
+
images: import_zod11.z.array(
|
|
1691
|
+
import_zod11.z.object({ alt: import_zod11.z.string().optional().catch(void 0), id: import_zod11.z.number().int().positive(), src: import_zod11.z.string() })
|
|
1692
|
+
).nullish(),
|
|
1693
|
+
metadata: import_zod11.z.object({
|
|
1694
|
+
productQuantity: import_zod11.z.union([
|
|
1695
|
+
import_zod11.z.number().int().positive(),
|
|
1696
|
+
import_zod11.z.string().regex(/^[1-9]\d*$/).transform(Number)
|
|
1697
|
+
]).optional()
|
|
1698
|
+
}).optional(),
|
|
1699
|
+
metafields: import_zod11.z.unknown().optional(),
|
|
1700
|
+
options: import_zod11.z.unknown().optional(),
|
|
1701
|
+
productGroupVariants: import_zod11.z.array(import_zod11.z.unknown()).default([]),
|
|
1702
|
+
selectedVariant: import_zod11.z.unknown().optional(),
|
|
1703
|
+
sellingPlanGroups: import_zod11.z.array(
|
|
1704
|
+
OfferProduct.shape.sellingPlanGroups.unwrap().element.extend({
|
|
1705
|
+
discountAmount: import_zod11.z.unknown().optional(),
|
|
1706
|
+
discountType: import_zod11.z.unknown().optional(),
|
|
1707
|
+
id: import_zod11.z.unknown().optional(),
|
|
1708
|
+
sellingPlans: import_zod11.z.unknown().optional()
|
|
1709
|
+
})
|
|
1710
|
+
).optional(),
|
|
1711
|
+
variants: import_zod11.z.array(SourceVariant)
|
|
1682
1712
|
});
|
|
1683
|
-
var
|
|
1684
|
-
data:
|
|
1685
|
-
|
|
1686
|
-
serverNow: PostPurchaseTimestampSchema,
|
|
1687
|
-
session: ReadySessionTimingSchema,
|
|
1688
|
-
workflowPhase: import_zod12.z.literal("start")
|
|
1689
|
-
}),
|
|
1690
|
-
successful: import_zod12.z.literal(true)
|
|
1713
|
+
var PostPurchaseProductSource = import_zod11.z.object({
|
|
1714
|
+
data: import_zod11.z.array(Product2),
|
|
1715
|
+
metadata: import_zod11.z.object({ widget: import_zod11.z.record(import_zod11.z.string(), import_zod11.z.unknown()).default({}) }).default({ widget: {} })
|
|
1691
1716
|
});
|
|
1692
1717
|
|
|
1693
|
-
// src/schema/
|
|
1694
|
-
var
|
|
1695
|
-
var SessionClosureSchema = import_zod13.z.object({ closedAt: PostPurchaseTimestampSchema, status: import_zod13.z.literal("closed") });
|
|
1696
|
-
var SessionCloseRequestSchema = DecideRequestSchema.strict();
|
|
1697
|
-
var SessionCloseResponseSchema = import_zod13.z.object({ data: SessionClosureSchema, successful: import_zod13.z.literal(true) });
|
|
1698
|
-
|
|
1699
|
-
// src/schema/postPurchaseShadow.ts
|
|
1700
|
-
var import_zod14 = require("zod");
|
|
1701
|
-
var PostPurchaseShadowSelectionSchema = import_zod14.z.discriminatedUnion("verdict", [
|
|
1702
|
-
import_zod14.z.object({ entry: DecisionEntrySchema, verdict: import_zod14.z.literal("render") }),
|
|
1703
|
-
import_zod14.z.object({ verdict: import_zod14.z.literal("skip") })
|
|
1704
|
-
]);
|
|
1705
|
-
var PostPurchaseShadowReportFields = import_zod14.z.object({
|
|
1706
|
-
differences: import_zod14.z.array(import_zod14.z.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
|
|
1707
|
-
message: "differences must not contain duplicate entries"
|
|
1708
|
-
}),
|
|
1709
|
-
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
1710
|
-
phase: import_zod14.z.literal("shouldRender"),
|
|
1711
|
-
sampleId: import_zod14.z.string(),
|
|
1712
|
-
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
1713
|
-
status: import_zod14.z.enum(["match", "diverged", "incomplete"]),
|
|
1714
|
-
targetingFlowIds: import_zod14.z.array(import_zod14.z.number().int().positive()),
|
|
1715
|
-
workflowPhase: import_zod14.z.literal("decide")
|
|
1716
|
-
});
|
|
1717
|
-
var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
1718
|
-
(report) => report.status !== "match" || report.differences.length === 0,
|
|
1719
|
-
{ message: "status 'match' requires an empty differences array", path: ["status"] }
|
|
1720
|
-
).refine((report) => report.status !== "diverged" || report.differences.length > 0, {
|
|
1721
|
-
message: "status 'diverged' requires a non-empty differences array",
|
|
1722
|
-
path: ["status"]
|
|
1723
|
-
}).refine((report) => report.status !== "diverged" || report.serverSelection !== void 0, {
|
|
1724
|
-
message: "status 'diverged' requires a serverSelection to diverge from",
|
|
1725
|
-
path: ["status"]
|
|
1726
|
-
});
|
|
1718
|
+
// src/schema/postPurchaseProductCollectionView.ts
|
|
1719
|
+
var PostPurchaseExcludedProductIds = import_zod12.z.array(PostPurchaseProductId).default([]);
|
|
1727
1720
|
|
|
1728
|
-
// src/schema/
|
|
1729
|
-
var
|
|
1730
|
-
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
1731
|
-
var PostPurchaseSkipTraceSchema = import_zod15.z.array(
|
|
1732
|
-
import_zod15.z.object({
|
|
1733
|
-
entry: DecisionEntrySchema,
|
|
1734
|
-
reason: PostPurchaseSkipReasonSchema
|
|
1735
|
-
})
|
|
1736
|
-
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
1721
|
+
// src/schema/postPurchaseProductDisplay.ts
|
|
1722
|
+
var import_zod21 = require("zod");
|
|
1737
1723
|
|
|
1738
|
-
// src/schema/
|
|
1739
|
-
var
|
|
1740
|
-
var
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
elementId: import_zod16.z.coerce.number(),
|
|
1748
|
-
id: import_zod16.z.coerce.number(),
|
|
1749
|
-
javascriptInput: import_zod16.z.string().nullish(),
|
|
1750
|
-
traffic: import_zod16.z.coerce.number()
|
|
1751
|
-
})
|
|
1752
|
-
),
|
|
1753
|
-
id: import_zod16.z.coerce.number(),
|
|
1754
|
-
name: import_zod16.z.string(),
|
|
1755
|
-
pageTarget: import_zod16.z.string().nullable(),
|
|
1756
|
-
pageTargetUrl: import_zod16.z.string().nullable(),
|
|
1757
|
-
placeholderId: import_zod16.z.coerce.number().nullable(),
|
|
1758
|
-
type: import_zod16.z.string()
|
|
1759
|
-
})
|
|
1760
|
-
),
|
|
1761
|
-
activePackages: import_zod16.z.array(
|
|
1762
|
-
import_zod16.z.object({
|
|
1763
|
-
cancelledAt: import_zod16.z.string().nullable(),
|
|
1764
|
-
id: import_zod16.z.number(),
|
|
1765
|
-
installedAt: import_zod16.z.string().nullable(),
|
|
1766
|
-
isActive: import_zod16.z.boolean(),
|
|
1767
|
-
isBillable: import_zod16.z.boolean(),
|
|
1768
|
-
packageId: import_zod16.z.number(),
|
|
1769
|
-
packageName: import_zod16.z.string(),
|
|
1770
|
-
shortName: import_zod16.z.string(),
|
|
1771
|
-
trialDays: import_zod16.z.number(),
|
|
1772
|
-
uninstalledAt: import_zod16.z.string().nullable()
|
|
1724
|
+
// src/schema/postPurchaseProductGallery.ts
|
|
1725
|
+
var import_zod13 = require("zod");
|
|
1726
|
+
var PostPurchaseProductGallery = import_zod13.z.object({
|
|
1727
|
+
images: import_zod13.z.array(
|
|
1728
|
+
import_zod13.z.object({
|
|
1729
|
+
description: import_zod13.z.string(),
|
|
1730
|
+
id: import_zod13.z.number().int().positive(),
|
|
1731
|
+
source: import_zod13.z.string(),
|
|
1732
|
+
thumbnail: import_zod13.z.string()
|
|
1773
1733
|
})
|
|
1774
1734
|
),
|
|
1775
|
-
|
|
1776
|
-
billingVersion: import_zod16.z.string().nullable(),
|
|
1777
|
-
cacheKey: import_zod16.z.coerce.number(),
|
|
1778
|
-
carousel: import_zod16.z.enum(["flickity", "splide"]),
|
|
1779
|
-
currency: import_zod16.z.string(),
|
|
1780
|
-
currencySymbol: import_zod16.z.string(),
|
|
1781
|
-
domain: import_zod16.z.string(),
|
|
1782
|
-
enabledJquery: import_zod16.z.boolean(),
|
|
1783
|
-
enabledPresentmentCurrencies: import_zod16.z.array(import_zod16.z.string()),
|
|
1784
|
-
hasSmartCollectionsEnabled: import_zod16.z.boolean(),
|
|
1785
|
-
hasSmartSearchEnabled: import_zod16.z.boolean(),
|
|
1786
|
-
id: import_zod16.z.coerce.number(),
|
|
1787
|
-
integrations: import_zod16.z.record(
|
|
1788
|
-
import_zod16.z.enum([
|
|
1789
|
-
"attentive",
|
|
1790
|
-
"judgeme",
|
|
1791
|
-
"junip",
|
|
1792
|
-
"klaviyo",
|
|
1793
|
-
"loox",
|
|
1794
|
-
"okendo",
|
|
1795
|
-
"opinew",
|
|
1796
|
-
"recharge",
|
|
1797
|
-
"reviewsio",
|
|
1798
|
-
"stamped",
|
|
1799
|
-
"yotpo"
|
|
1800
|
-
]),
|
|
1801
|
-
import_zod16.z.union([import_zod16.z.boolean(), import_zod16.z.unknown()])
|
|
1802
|
-
),
|
|
1803
|
-
markets: import_zod16.z.object({
|
|
1804
|
-
enabled: import_zod16.z.boolean()
|
|
1805
|
-
}),
|
|
1806
|
-
monetize: import_zod16.z.object({
|
|
1807
|
-
publisherKey: import_zod16.z.string().nullable()
|
|
1808
|
-
}).nullish(),
|
|
1809
|
-
moneyFormat: import_zod16.z.string(),
|
|
1810
|
-
myshopifyDomain: import_zod16.z.string(),
|
|
1811
|
-
primaryLocale: import_zod16.z.string(),
|
|
1812
|
-
productGroupsEnabled: import_zod16.z.enum(["no", "yes"]).transform((value) => value === "yes"),
|
|
1813
|
-
rechargeCustomDomain: import_zod16.z.string().nullable(),
|
|
1814
|
-
sellingPlansEnabled: import_zod16.z.boolean(),
|
|
1815
|
-
shopId: import_zod16.z.number(),
|
|
1816
|
-
shopifySellingPlansEnabled: import_zod16.z.boolean(),
|
|
1817
|
-
shopName: import_zod16.z.string(),
|
|
1818
|
-
storefrontAccessToken: import_zod16.z.string().nullable(),
|
|
1819
|
-
useRebuyIcons: import_zod16.z.boolean()
|
|
1735
|
+
selectedImageId: import_zod13.z.number().int().positive().optional()
|
|
1820
1736
|
});
|
|
1821
1737
|
|
|
1822
|
-
// src/schema/
|
|
1823
|
-
var
|
|
1824
|
-
var UserConfig = import_zod17.z.object({
|
|
1825
|
-
shop: ShopConfig,
|
|
1826
|
-
/**
|
|
1827
|
-
* `.catch(undefined)` is the safety bar: smart-cart shape drift can NEVER fail `fetchUserConfig`,
|
|
1828
|
-
* which resolves the apiKey for every offers/monetize/analytics/gift request.
|
|
1829
|
-
*/
|
|
1830
|
-
smartCart: SmartCartConfig.nullish().catch(void 0),
|
|
1831
|
-
smartFlows: import_zod17.z.array(import_zod17.z.unknown())
|
|
1832
|
-
});
|
|
1738
|
+
// src/schema/widgets/post-purchase-offer/postPurchaseSettings.ts
|
|
1739
|
+
var import_zod20 = require("zod");
|
|
1833
1740
|
|
|
1834
|
-
// src/schema/
|
|
1835
|
-
var
|
|
1741
|
+
// src/schema/widgets/post-purchase-offer/common.ts
|
|
1742
|
+
var import_compat = require("es-toolkit/compat");
|
|
1743
|
+
var import_zod14 = require("zod");
|
|
1744
|
+
var strictNumber = import_zod14.z.union([
|
|
1745
|
+
import_zod14.z.number(),
|
|
1746
|
+
import_zod14.z.string().transform((value) => (0, import_compat.toNumber)((0, import_compat.replace)((0, import_compat.toString)(value), /[^0-9.]/g, "")) || 0),
|
|
1747
|
+
import_zod14.z.unknown().transform(() => 0)
|
|
1748
|
+
]);
|
|
1836
1749
|
|
|
1837
|
-
// src/schema/widgets/
|
|
1838
|
-
var
|
|
1839
|
-
var
|
|
1840
|
-
|
|
1841
|
-
|
|
1750
|
+
// src/schema/widgets/post-purchase-offer/constants.ts
|
|
1751
|
+
var import_zod15 = require("zod");
|
|
1752
|
+
var blockTypes = [
|
|
1753
|
+
"callout_banner",
|
|
1754
|
+
"image",
|
|
1755
|
+
"image_content",
|
|
1756
|
+
"pay_button",
|
|
1757
|
+
"product_information",
|
|
1758
|
+
"separator",
|
|
1759
|
+
"text",
|
|
1760
|
+
"timer"
|
|
1761
|
+
];
|
|
1762
|
+
var blockType = import_zod15.z.enum(blockTypes);
|
|
1763
|
+
var BlockType = blockType.enum;
|
|
1842
1764
|
|
|
1843
|
-
// src/schema/widgets/
|
|
1844
|
-
var
|
|
1765
|
+
// src/schema/widgets/post-purchase-offer/postPurchaseBlocks.ts
|
|
1766
|
+
var import_compat4 = require("es-toolkit/compat");
|
|
1767
|
+
var import_uuid3 = require("uuid");
|
|
1768
|
+
var import_zod19 = require("zod");
|
|
1769
|
+
|
|
1770
|
+
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
1771
|
+
var import_compat3 = require("es-toolkit/compat");
|
|
1772
|
+
var import_uuid2 = require("uuid");
|
|
1773
|
+
var import_zod18 = require("zod");
|
|
1845
1774
|
|
|
1846
1775
|
// src/schema/widgets/checkout-and-beyond/common.ts
|
|
1847
|
-
var freezeEnum = (
|
|
1776
|
+
var freezeEnum = (values2) => Object.freeze(Object.fromEntries(values2.map((v) => [v, v])));
|
|
1848
1777
|
var bannerColors = ["info", "success", "warning", "critical"];
|
|
1849
1778
|
var BannerColor = freezeEnum(bannerColors);
|
|
1850
1779
|
var borderRadii = ["none", "small", "base", "large", "fullyRounded"];
|
|
@@ -2049,82 +1978,6 @@ var widgetTypes = [
|
|
|
2049
1978
|
];
|
|
2050
1979
|
var WidgetType = freezeEnum(widgetTypes);
|
|
2051
1980
|
|
|
2052
|
-
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
2053
|
-
var DEFAULT_ENDPOINTS = [
|
|
2054
|
-
{ label: "Recommended (AI)", value: "/products/recommended" },
|
|
2055
|
-
{ label: "Top Sellers", value: "/products/top_sellers" },
|
|
2056
|
-
{ label: "Buy It Again", value: "/products/purchased" },
|
|
2057
|
-
{ label: "Recently Viewed", value: "/products/viewed" },
|
|
2058
|
-
{ label: "Products Search", value: "/products/search" },
|
|
2059
|
-
{ label: "Collection Products", value: "/products/collections" },
|
|
2060
|
-
{ label: "Similar Products (AI)", value: "/products/similar_products" }
|
|
2061
|
-
];
|
|
2062
|
-
var STATIC_ENDPOINTS = [
|
|
2063
|
-
{ label: "Recommended (AI)", value: "/products/recommended" },
|
|
2064
|
-
{ label: "Top Sellers", value: "/products/top_sellers" },
|
|
2065
|
-
{ label: "Trending Products", value: "/products/trending_products" },
|
|
2066
|
-
{ label: "Buy It Again", value: "/products/purchased" },
|
|
2067
|
-
{ label: "Collection Products", value: "/products/collections" },
|
|
2068
|
-
{ label: "Recently Viewed", value: "/products/viewed" },
|
|
2069
|
-
{ label: "Static Products", value: "/products/static" },
|
|
2070
|
-
{ label: "Products Search", value: "/products/search" },
|
|
2071
|
-
{ label: "Similar Products (AI)", value: "/products/similar_products" }
|
|
2072
|
-
];
|
|
2073
|
-
var COMBINED_ENDPOINTS = (0, import_es_toolkit.uniqBy)([...DEFAULT_ENDPOINTS, ...STATIC_ENDPOINTS], (item) => item.value);
|
|
2074
|
-
var targetAreas = {
|
|
2075
|
-
[EditorMode.checkoutExtension]: [
|
|
2076
|
-
{ icon: "splitscreen_top", label: "Header Area", width: "984px" },
|
|
2077
|
-
{ icon: "splitscreen_left", label: "Main Column", width: "503px" },
|
|
2078
|
-
{ icon: "splitscreen_right", label: "Summary Column", width: "404px" }
|
|
2079
|
-
],
|
|
2080
|
-
[EditorMode.postPurchaseOffer]: null,
|
|
2081
|
-
[EditorMode.thankYouPage]: [
|
|
2082
|
-
{ icon: "splitscreen_top", label: "Header Area", width: "984px" },
|
|
2083
|
-
{ icon: "splitscreen_left", label: "Main Column", width: "503px" },
|
|
2084
|
-
{ icon: "splitscreen_right", label: "Summary Column", width: "404px" }
|
|
2085
|
-
],
|
|
2086
|
-
[EditorMode.orderStatusPage]: [
|
|
2087
|
-
// { fill: true, flip: 'vertical', icon: 'bottom_navigation', label: 'Announcement Bar' },
|
|
2088
|
-
{ icon: "splitscreen_top", label: "Header Area", width: "1124px" },
|
|
2089
|
-
{ fill: true, icon: "view_column_2", label: "Main Area", width: "646px" },
|
|
2090
|
-
{ icon: "splitscreen_bottom", label: "Footer Area", width: "1124px" }
|
|
2091
|
-
],
|
|
2092
|
-
[EditorMode.ordersIndexPage]: [
|
|
2093
|
-
// { fill: true, flip: 'vertical', icon: 'bottom_navigation', label: 'Announcement Bar' },
|
|
2094
|
-
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
2095
|
-
],
|
|
2096
|
-
[EditorMode.customerProfilePage]: [
|
|
2097
|
-
// { fill: true, flip: 'vertical', icon: 'bottom_navigation', label: 'Announcement Bar' },
|
|
2098
|
-
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
2099
|
-
]
|
|
2100
|
-
};
|
|
2101
|
-
|
|
2102
|
-
// src/schema/widgets/checkoutExtension.ts
|
|
2103
|
-
var import_zod19 = require("zod");
|
|
2104
|
-
var CheckoutExtension = import_zod19.z.looseObject({
|
|
2105
|
-
type: import_zod19.z.literal(WidgetType.shopify_checkout_extension).default(WidgetType.shopify_checkout_extension)
|
|
2106
|
-
});
|
|
2107
|
-
|
|
2108
|
-
// src/schema/widgets/contentBlock.ts
|
|
2109
|
-
var import_zod42 = require("zod");
|
|
2110
|
-
|
|
2111
|
-
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
2112
|
-
var import_zod41 = require("zod");
|
|
2113
|
-
|
|
2114
|
-
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
2115
|
-
var import_uuid14 = require("uuid");
|
|
2116
|
-
var import_zod40 = require("zod");
|
|
2117
|
-
|
|
2118
|
-
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
2119
|
-
var import_zod39 = require("zod");
|
|
2120
|
-
|
|
2121
|
-
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
2122
|
-
var import_zod20 = require("zod");
|
|
2123
|
-
|
|
2124
|
-
// src/schema/widgets/checkout-and-beyond/utils.ts
|
|
2125
|
-
var import_es_toolkit3 = require("es-toolkit");
|
|
2126
|
-
var import_compat = require("es-toolkit/compat");
|
|
2127
|
-
|
|
2128
1981
|
// src/schema/widgets/checkout-and-beyond/regex.ts
|
|
2129
1982
|
var ARRAY_INDEX_STRING = /^(0|[1-9]\d*)$/;
|
|
2130
1983
|
var DYNAMIC_TOKEN_REGEX = /^\{\{\s*[A-Za-z]+\s*\}\}$/;
|
|
@@ -2133,8 +1986,12 @@ var HEX_COLOR_REGEX = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
|
2133
1986
|
var ROOT_RELATIVE_PATH_REGEX = /^\/(?!\/)/;
|
|
2134
1987
|
var HTML_TAGS_REGEX = /<\/?[a-zA-Z][^>]*>/g;
|
|
2135
1988
|
|
|
2136
|
-
// src/
|
|
1989
|
+
// src/schema/widgets/checkout-and-beyond/utils.ts
|
|
2137
1990
|
var import_es_toolkit2 = require("es-toolkit");
|
|
1991
|
+
var import_compat2 = require("es-toolkit/compat");
|
|
1992
|
+
|
|
1993
|
+
// src/transforms/convertNumericObjects.ts
|
|
1994
|
+
var import_es_toolkit = require("es-toolkit");
|
|
2138
1995
|
var ARRAY_INDEX_STRING2 = /^(?:0|[1-9]\d*)$/;
|
|
2139
1996
|
var hasOnlyNumericKeys = (input, requireCompleteRun) => {
|
|
2140
1997
|
const keys = Object.keys(input);
|
|
@@ -2147,7 +2004,7 @@ var hasOnlyNumericKeys = (input, requireCompleteRun) => {
|
|
|
2147
2004
|
var numericObjectToArray = (input) => Object.entries(input).sort(([a], [b]) => Number(a) - Number(b)).map(([, value]) => value);
|
|
2148
2005
|
var convert = (input, requireCompleteRun) => {
|
|
2149
2006
|
if (Array.isArray(input)) return input.map((item) => convert(item, requireCompleteRun));
|
|
2150
|
-
if ((0,
|
|
2007
|
+
if ((0, import_es_toolkit.isPlainObject)(input)) {
|
|
2151
2008
|
if (hasOnlyNumericKeys(input, requireCompleteRun)) {
|
|
2152
2009
|
return numericObjectToArray(input).map((item) => convert(item, requireCompleteRun));
|
|
2153
2010
|
}
|
|
@@ -2170,9 +2027,9 @@ var isHTML = (html = "") => {
|
|
|
2170
2027
|
return html.search(HTML_TAGS_REGEX) !== -1;
|
|
2171
2028
|
};
|
|
2172
2029
|
var hasHTMLInDoc = (doc) => doc.content.some(({ content = [] }) => content.some(({ text }) => isHTML(text)));
|
|
2173
|
-
var checkForHTML = (input) => !((0,
|
|
2030
|
+
var checkForHTML = (input) => !((0, import_compat2.isString)(input) && isHTML(input) || (0, import_es_toolkit2.isPlainObject)(input) && hasHTMLInDoc(input));
|
|
2174
2031
|
var NO_HTML = { message: "HTML is not supported" };
|
|
2175
|
-
var isSectionType = (sectionType) => (section) => (0,
|
|
2032
|
+
var isSectionType = (sectionType) => (section) => (0, import_compat2.get)(section, "sectionType") === sectionType;
|
|
2176
2033
|
var isBannerType = isSectionType(SectionType.banner);
|
|
2177
2034
|
var isButtonType = isSectionType(SectionType.button);
|
|
2178
2035
|
var isCarouselType = isSectionType(SectionType.carousel);
|
|
@@ -2185,7 +2042,7 @@ var isImageType = isSectionType(SectionType.image);
|
|
|
2185
2042
|
var isLayoutType = isSectionType(SectionType.layout);
|
|
2186
2043
|
var isMonetizeType = isSectionType(SectionType.monetize);
|
|
2187
2044
|
var isOffersType = isSectionType(SectionType.offers);
|
|
2188
|
-
var isOverlayType = (section) => isLayoutType(section) && (0,
|
|
2045
|
+
var isOverlayType = (section) => isLayoutType(section) && (0, import_compat2.get)(section, "buttonField") === ButtonField.overlayContent;
|
|
2189
2046
|
var isProductType = isSectionType(SectionType.product);
|
|
2190
2047
|
var isProductsType = isSectionType(SectionType.products);
|
|
2191
2048
|
var isProgressBarType = isSectionType(
|
|
@@ -2196,129 +2053,11 @@ var isReviewsType = isSectionType(SectionType.reviews);
|
|
|
2196
2053
|
var isTextType = isSectionType(SectionType.text);
|
|
2197
2054
|
var isVariantsType = isSectionType(SectionType.variants);
|
|
2198
2055
|
|
|
2199
|
-
// src/schema/widgets/checkout-and-beyond/
|
|
2200
|
-
var
|
|
2201
|
-
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
2202
|
-
buttonField: import_zod20.z.enum(buttonFields).optional(),
|
|
2203
|
-
color: import_zod20.z.enum(bannerColors).default("info"),
|
|
2204
|
-
dismissible: import_zod20.z.boolean().default(true),
|
|
2205
|
-
/**
|
|
2206
|
-
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
2207
|
-
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
2208
|
-
*
|
|
2209
|
-
* Merchant-composed buyer-facing plain text, so it rejects HTML at the boundary the same way
|
|
2210
|
-
* `CABImageSection.altText` and `CABTextSection.content` do (the unchecked localized records elsewhere —
|
|
2211
|
-
* `progressBar`'s gift labels, `reviews`' plurals — are converter/constant-sourced, not merchant input).
|
|
2212
|
-
*
|
|
2213
|
-
* The refinement is a last-resort ASSERTION, not the normalization boundary: `normalizeTextContent` only
|
|
2214
|
-
* rewrites `sectionType: 'text'` nodes' `content`, so nothing strips markup or canonicalizes `{token}`
|
|
2215
|
-
* here. A producer must strip upstream the way `composeOffer` does for `altText`. Get it wrong and
|
|
2216
|
-
* `salvageSections` stubs the whole banner (children included) with a drift report — degraded, reported,
|
|
2217
|
-
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
2218
|
-
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
2219
|
-
*/
|
|
2220
|
-
heading: import_zod20.z.record(import_zod20.z.string(), import_zod20.z.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
2221
|
-
sectionType: import_zod20.z.literal(SectionType.banner).default(SectionType.banner)
|
|
2222
|
-
})
|
|
2223
|
-
);
|
|
2224
|
-
|
|
2225
|
-
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
2226
|
-
var import_uuid4 = require("uuid");
|
|
2227
|
-
var import_zod25 = require("zod");
|
|
2228
|
-
|
|
2229
|
-
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
2230
|
-
var import_uuid2 = require("uuid");
|
|
2231
|
-
var import_zod23 = require("zod");
|
|
2232
|
-
|
|
2233
|
-
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
2234
|
-
var iconNames = [
|
|
2235
|
-
"alert-circle",
|
|
2236
|
-
"alert-triangle",
|
|
2237
|
-
"alert-triangle-filled",
|
|
2238
|
-
"arrow-down",
|
|
2239
|
-
"arrow-left",
|
|
2240
|
-
"arrow-right",
|
|
2241
|
-
"arrow-up",
|
|
2242
|
-
"arrow-up-right",
|
|
2243
|
-
"bag",
|
|
2244
|
-
"bullet",
|
|
2245
|
-
"calendar",
|
|
2246
|
-
"camera",
|
|
2247
|
-
"caret-down",
|
|
2248
|
-
"cart",
|
|
2249
|
-
"cash-dollar",
|
|
2250
|
-
"categories",
|
|
2251
|
-
"check",
|
|
2252
|
-
"check-circle",
|
|
2253
|
-
"check-circle-filled",
|
|
2254
|
-
"chevron-down",
|
|
2255
|
-
"chevron-left",
|
|
2256
|
-
"chevron-right",
|
|
2257
|
-
"chevron-up",
|
|
2258
|
-
"circle",
|
|
2259
|
-
"clipboard",
|
|
2260
|
-
"clock",
|
|
2261
|
-
"credit-card",
|
|
2262
|
-
"delete",
|
|
2263
|
-
"delivered",
|
|
2264
|
-
"delivery",
|
|
2265
|
-
"disabled",
|
|
2266
|
-
"discount",
|
|
2267
|
-
"edit",
|
|
2268
|
-
"email",
|
|
2269
|
-
"empty",
|
|
2270
|
-
"external",
|
|
2271
|
-
"filter",
|
|
2272
|
-
"geolocation",
|
|
2273
|
-
"gift-card",
|
|
2274
|
-
"globe",
|
|
2275
|
-
"grid",
|
|
2276
|
-
"image",
|
|
2277
|
-
"info",
|
|
2278
|
-
"info-filled",
|
|
2279
|
-
"list-bulleted",
|
|
2280
|
-
"location",
|
|
2281
|
-
"lock",
|
|
2282
|
-
"map",
|
|
2283
|
-
"menu",
|
|
2284
|
-
"menu-horizontal",
|
|
2285
|
-
"menu-vertical",
|
|
2286
|
-
"minus",
|
|
2287
|
-
"mobile",
|
|
2288
|
-
"note",
|
|
2289
|
-
"order",
|
|
2290
|
-
"organization",
|
|
2291
|
-
"plus",
|
|
2292
|
-
"profile",
|
|
2293
|
-
"question-circle",
|
|
2294
|
-
"question-circle-filled",
|
|
2295
|
-
"reorder",
|
|
2296
|
-
"reset",
|
|
2297
|
-
"return",
|
|
2298
|
-
"savings",
|
|
2299
|
-
"search",
|
|
2300
|
-
"settings",
|
|
2301
|
-
"star",
|
|
2302
|
-
"star-filled",
|
|
2303
|
-
"star-half",
|
|
2304
|
-
"store",
|
|
2305
|
-
"truck",
|
|
2306
|
-
"upload",
|
|
2307
|
-
"x",
|
|
2308
|
-
"x-circle",
|
|
2309
|
-
"x-circle-filled"
|
|
2310
|
-
];
|
|
2311
|
-
var IconName = freezeEnum(iconNames);
|
|
2312
|
-
var iconSizes = ["base", "large", "large-100", "small", "small-100", "small-200"];
|
|
2313
|
-
var IconSize = freezeEnum(iconSizes);
|
|
2314
|
-
var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "warning"];
|
|
2315
|
-
var IconTone = freezeEnum(iconTones);
|
|
2316
|
-
|
|
2317
|
-
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
2318
|
-
var import_zod22 = require("zod");
|
|
2056
|
+
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
2057
|
+
var import_zod17 = require("zod");
|
|
2319
2058
|
|
|
2320
2059
|
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
2321
|
-
var
|
|
2060
|
+
var import_zod16 = require("zod");
|
|
2322
2061
|
var ruleTypes = [
|
|
2323
2062
|
"cart",
|
|
2324
2063
|
"cart_count",
|
|
@@ -2337,7 +2076,7 @@ var ruleTypes = [
|
|
|
2337
2076
|
"product_type",
|
|
2338
2077
|
"product_vendor"
|
|
2339
2078
|
];
|
|
2340
|
-
var ruleType =
|
|
2079
|
+
var ruleType = import_zod16.z.enum(ruleTypes);
|
|
2341
2080
|
var RuleType = ruleType.enum;
|
|
2342
2081
|
var ruleOperators = [
|
|
2343
2082
|
"after",
|
|
@@ -2352,256 +2091,182 @@ var ruleOperators = [
|
|
|
2352
2091
|
"greater_than",
|
|
2353
2092
|
"less_than"
|
|
2354
2093
|
];
|
|
2355
|
-
var ruleOperator =
|
|
2094
|
+
var ruleOperator = import_zod16.z.enum(ruleOperators);
|
|
2356
2095
|
var RuleOperator = ruleOperator.enum;
|
|
2357
|
-
var RuleCondition =
|
|
2358
|
-
operator:
|
|
2359
|
-
products:
|
|
2360
|
-
type:
|
|
2361
|
-
value:
|
|
2362
|
-
});
|
|
2363
|
-
var RuleLogicBlock =
|
|
2364
|
-
rules:
|
|
2365
|
-
});
|
|
2366
|
-
var CABRulesetEntry =
|
|
2367
|
-
exitIfMatched:
|
|
2368
|
-
logic:
|
|
2369
|
-
output:
|
|
2370
|
-
|
|
2371
|
-
key:
|
|
2372
|
-
type:
|
|
2373
|
-
value:
|
|
2096
|
+
var RuleCondition = import_zod16.z.object({
|
|
2097
|
+
operator: import_zod16.z.enum(ruleOperators).default(RuleOperator.anything),
|
|
2098
|
+
products: import_zod16.z.union([import_zod16.z.array(import_zod16.z.unknown()), import_zod16.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
2099
|
+
type: import_zod16.z.enum(ruleTypes).default(RuleType.cart_subtotal),
|
|
2100
|
+
value: import_zod16.z.coerce.string().default("")
|
|
2101
|
+
});
|
|
2102
|
+
var RuleLogicBlock = import_zod16.z.object({
|
|
2103
|
+
rules: import_zod16.z.array(RuleCondition).default(() => [])
|
|
2104
|
+
});
|
|
2105
|
+
var CABRulesetEntry = import_zod16.z.object({
|
|
2106
|
+
exitIfMatched: import_zod16.z.boolean().default(true),
|
|
2107
|
+
logic: import_zod16.z.array(RuleLogicBlock).default(() => []),
|
|
2108
|
+
output: import_zod16.z.array(
|
|
2109
|
+
import_zod16.z.object({
|
|
2110
|
+
key: import_zod16.z.string().default("should_show"),
|
|
2111
|
+
type: import_zod16.z.literal("data_json").default("data_json"),
|
|
2112
|
+
value: import_zod16.z.string().default("true")
|
|
2374
2113
|
})
|
|
2375
2114
|
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
2376
2115
|
});
|
|
2377
|
-
var CABRuleset =
|
|
2116
|
+
var CABRuleset = import_zod16.z.union([import_zod16.z.array(CABRulesetEntry), import_zod16.z.strictObject({}).transform(() => [])]).default(() => []);
|
|
2378
2117
|
|
|
2379
2118
|
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
2380
|
-
var variableEffect =
|
|
2381
|
-
var CABVariableSeed =
|
|
2382
|
-
dataSourceId:
|
|
2119
|
+
var variableEffect = import_zod17.z.enum(variableEffects);
|
|
2120
|
+
var CABVariableSeed = import_zod17.z.object({
|
|
2121
|
+
dataSourceId: import_zod17.z.number().nullable().default(null),
|
|
2383
2122
|
ruleset: CABRuleset
|
|
2384
2123
|
});
|
|
2385
|
-
var CABBooleanVariable =
|
|
2124
|
+
var CABBooleanVariable = import_zod17.z.object({
|
|
2386
2125
|
/**
|
|
2387
2126
|
* Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
|
|
2388
2127
|
* from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
|
|
2389
2128
|
* below; a cross-field default has no `.default()` spelling. An explicit value always wins.
|
|
2390
2129
|
*/
|
|
2391
|
-
defaultValue:
|
|
2392
|
-
name:
|
|
2130
|
+
defaultValue: import_zod17.z.boolean().optional(),
|
|
2131
|
+
name: import_zod17.z.string().min(1),
|
|
2393
2132
|
seed: CABVariableSeed.optional(),
|
|
2394
2133
|
/** Defaulted so every stored declaration (all boolean before `text` existed) parses unchanged. */
|
|
2395
|
-
type:
|
|
2134
|
+
type: import_zod17.z.literal(VariableType.boolean).default(VariableType.boolean)
|
|
2396
2135
|
});
|
|
2397
|
-
var CABTextVariable =
|
|
2398
|
-
defaultValue:
|
|
2399
|
-
name:
|
|
2400
|
-
seed:
|
|
2401
|
-
type:
|
|
2136
|
+
var CABTextVariable = import_zod17.z.object({
|
|
2137
|
+
defaultValue: import_zod17.z.string(),
|
|
2138
|
+
name: import_zod17.z.string().min(1),
|
|
2139
|
+
seed: import_zod17.z.never().optional(),
|
|
2140
|
+
type: import_zod17.z.literal(VariableType.text)
|
|
2402
2141
|
});
|
|
2403
|
-
var CABNumberVariable =
|
|
2404
|
-
defaultValue:
|
|
2405
|
-
name:
|
|
2406
|
-
seed:
|
|
2407
|
-
type:
|
|
2142
|
+
var CABNumberVariable = import_zod17.z.object({
|
|
2143
|
+
defaultValue: import_zod17.z.number(),
|
|
2144
|
+
name: import_zod17.z.string().min(1),
|
|
2145
|
+
seed: import_zod17.z.never().optional(),
|
|
2146
|
+
type: import_zod17.z.literal(VariableType.number)
|
|
2408
2147
|
});
|
|
2409
|
-
var CABVariable =
|
|
2148
|
+
var CABVariable = import_zod17.z.union([CABTextVariable, CABNumberVariable, CABBooleanVariable]).transform(
|
|
2410
2149
|
(variable) => variable.type === VariableType.boolean ? { ...variable, defaultValue: variable.defaultValue ?? variable.seed === void 0 } : variable
|
|
2411
2150
|
);
|
|
2412
|
-
var CABVariableEffect =
|
|
2151
|
+
var CABVariableEffect = import_zod17.z.object({
|
|
2413
2152
|
effect: variableEffect.default(VariableEffect.toggle),
|
|
2414
|
-
variable:
|
|
2153
|
+
variable: import_zod17.z.string().min(1)
|
|
2415
2154
|
});
|
|
2416
|
-
var CABVisibility =
|
|
2417
|
-
variable:
|
|
2418
|
-
visibleWhen:
|
|
2155
|
+
var CABVisibility = import_zod17.z.object({
|
|
2156
|
+
variable: import_zod17.z.string().min(1),
|
|
2157
|
+
visibleWhen: import_zod17.z.boolean().default(true)
|
|
2419
2158
|
});
|
|
2420
|
-
var contentOperator =
|
|
2421
|
-
var resultCountOperator =
|
|
2422
|
-
var resultTagOperator =
|
|
2423
|
-
var mutatorEvent =
|
|
2424
|
-
var CABContentTrigger =
|
|
2159
|
+
var contentOperator = import_zod17.z.enum(contentOperators);
|
|
2160
|
+
var resultCountOperator = import_zod17.z.enum(resultCountOperators);
|
|
2161
|
+
var resultTagOperator = import_zod17.z.enum(resultTagOperators);
|
|
2162
|
+
var mutatorEvent = import_zod17.z.enum(mutatorEvents);
|
|
2163
|
+
var CABContentTrigger = import_zod17.z.object({
|
|
2425
2164
|
operator: contentOperator.default(ContentOperator.is_empty),
|
|
2426
|
-
type:
|
|
2165
|
+
type: import_zod17.z.literal("content")
|
|
2427
2166
|
});
|
|
2428
|
-
var CABResultCountTrigger =
|
|
2167
|
+
var CABResultCountTrigger = import_zod17.z.object({
|
|
2429
2168
|
operator: resultCountOperator.default(ResultCountOperator.equals),
|
|
2430
|
-
type:
|
|
2431
|
-
value:
|
|
2169
|
+
type: import_zod17.z.literal("result_count"),
|
|
2170
|
+
value: import_zod17.z.number().default(0)
|
|
2432
2171
|
});
|
|
2433
|
-
var CABResultTagTrigger =
|
|
2172
|
+
var CABResultTagTrigger = import_zod17.z.object({
|
|
2434
2173
|
operator: resultTagOperator.default(ResultTagOperator.contains),
|
|
2435
|
-
type:
|
|
2436
|
-
value:
|
|
2174
|
+
type: import_zod17.z.literal("result_tag"),
|
|
2175
|
+
value: import_zod17.z.string().min(1)
|
|
2437
2176
|
});
|
|
2438
|
-
var CABEventTrigger =
|
|
2177
|
+
var CABEventTrigger = import_zod17.z.object({
|
|
2439
2178
|
event: mutatorEvent,
|
|
2440
|
-
type:
|
|
2179
|
+
type: import_zod17.z.literal("event")
|
|
2441
2180
|
});
|
|
2442
|
-
var CABVariableTrigger =
|
|
2181
|
+
var CABVariableTrigger = import_zod17.z.discriminatedUnion("type", [
|
|
2443
2182
|
CABContentTrigger,
|
|
2444
2183
|
CABEventTrigger,
|
|
2445
2184
|
CABResultCountTrigger,
|
|
2446
2185
|
CABResultTagTrigger
|
|
2447
2186
|
]);
|
|
2448
|
-
var CABVariableMutator =
|
|
2187
|
+
var CABVariableMutator = import_zod17.z.object({
|
|
2449
2188
|
effect: variableEffect.default(VariableEffect.set_false),
|
|
2450
|
-
variable:
|
|
2189
|
+
variable: import_zod17.z.string().min(1),
|
|
2451
2190
|
when: CABVariableTrigger
|
|
2452
2191
|
});
|
|
2453
2192
|
var CABVariableFields = {
|
|
2454
|
-
mutators:
|
|
2455
|
-
variables:
|
|
2193
|
+
mutators: import_zod17.z.array(CABVariableMutator).optional(),
|
|
2194
|
+
variables: import_zod17.z.array(CABVariable).refine((variables) => new Set(variables.map(({ name }) => name)).size === variables.length, {
|
|
2456
2195
|
message: "variable names must be unique within a section"
|
|
2457
2196
|
}).optional(),
|
|
2458
2197
|
visibility: CABVisibility.optional()
|
|
2459
2198
|
};
|
|
2460
2199
|
|
|
2461
|
-
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
2462
|
-
var CABImageSectionFields = import_zod23.z.object({
|
|
2463
|
-
...CABVariableFields,
|
|
2464
|
-
altText: import_zod23.z.string().refine(checkForHTML, NO_HTML).default(""),
|
|
2465
|
-
/**
|
|
2466
|
-
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
2467
|
-
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
2468
|
-
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
2469
|
-
*/
|
|
2470
|
-
aspectRatio: import_zod23.z.number().positive().nullable().default(null),
|
|
2471
|
-
border: import_zod23.z.lazy(() => CABBorder),
|
|
2472
|
-
buttonField: import_zod23.z.enum(buttonFields).optional(),
|
|
2473
|
-
/**
|
|
2474
|
-
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
2475
|
-
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
2476
|
-
* implementation — they were never significant to rendering (`icons`, plural, is NOT deprecated, just one of
|
|
2477
|
-
* those inert legacy tags); `icon` is the first value that means anything.
|
|
2478
|
-
*
|
|
2479
|
-
* INVARIANT, encoded by the `.superRefine` below (a refined object IS a valid `z.discriminatedUnion` member
|
|
2480
|
-
* in zod 4 — see `CABTextSection`): `category: 'icon'` ⇒ `source` is an icon name or `''` (icon not yet
|
|
2481
|
-
* chosen); any other category ⇒ `source` is NOT a bare icon name, so it stays a URL/token/`''`.
|
|
2482
|
-
*
|
|
2483
|
-
* Encoded rather than left to the renderer because `source` is ONE union with no category gate, so widening
|
|
2484
|
-
* it with `iconNames` also widened what a STORED payload may contain: 14 of the names are plain English
|
|
2485
|
-
* words (`image`, `x`, `search`, `note`, `order`, `globe`, …), and a legacy `source: 'image'` used to fail
|
|
2486
|
-
* parse — which `salvageSections` turns into a null-rendering stub PLUS a drift report. Ungated it would
|
|
2487
|
-
* instead parse and reach the renderer as `<img src="image">`: a broken image, silently, where the old
|
|
2488
|
-
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
2489
|
-
* the risky half.
|
|
2490
|
-
*/
|
|
2491
|
-
category: import_zod23.z.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
2492
|
-
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
2493
|
-
iconSize: import_zod23.z.enum(iconSizes).nullable().default(null),
|
|
2494
|
-
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
2495
|
-
iconTone: import_zod23.z.enum(iconTones).nullable().default(null),
|
|
2496
|
-
name: import_zod23.z.string().optional(),
|
|
2497
|
-
naturalHeight: import_zod23.z.number().default(0),
|
|
2498
|
-
naturalWidth: import_zod23.z.number().default(0),
|
|
2499
|
-
/**
|
|
2500
|
-
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
2501
|
-
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
2502
|
-
*/
|
|
2503
|
-
objectFit: import_zod23.z.enum(objectFits).default(ObjectFit.contain),
|
|
2504
|
-
sectionId: import_zod23.z.uuid().default(() => (0, import_uuid2.v7)()),
|
|
2505
|
-
sectionType: import_zod23.z.literal(SectionType.image).default(SectionType.image),
|
|
2506
|
-
/**
|
|
2507
|
-
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
2508
|
-
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
2509
|
-
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
2510
|
-
* server-chosen tier icon actually needs it.
|
|
2511
|
-
*/
|
|
2512
|
-
source: import_zod23.z.union([import_zod23.z.url(), import_zod23.z.literal(""), import_zod23.z.string().regex(DYNAMIC_TOKEN_REGEX), import_zod23.z.enum(iconNames)]).default(""),
|
|
2513
|
-
width: import_zod23.z.number().default(100)
|
|
2514
|
-
});
|
|
2515
|
-
var iconNameSet = new Set(iconNames);
|
|
2516
|
-
var isIconName = (source) => iconNameSet.has(source);
|
|
2517
|
-
var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, ctx) => {
|
|
2518
|
-
if (category === "icon" && source !== "" && !isIconName(source))
|
|
2519
|
-
ctx.addIssue({
|
|
2520
|
-
code: "custom",
|
|
2521
|
-
message: "icon-mode source must be an icon name",
|
|
2522
|
-
path: ["source"]
|
|
2523
|
-
});
|
|
2524
|
-
if (category !== "icon" && isIconName(source))
|
|
2525
|
-
ctx.addIssue({
|
|
2526
|
-
code: "custom",
|
|
2527
|
-
message: "source must be a URL or dynamic token unless category is `icon`",
|
|
2528
|
-
path: ["source"]
|
|
2529
|
-
});
|
|
2530
|
-
});
|
|
2531
|
-
|
|
2532
2200
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
2533
|
-
var
|
|
2534
|
-
var
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
import_zod24.z.literal("#"),
|
|
2549
|
-
import_zod24.z.string().regex(DYNAMIC_TOKEN_REGEX),
|
|
2550
|
-
import_zod24.z.string().regex(ROOT_RELATIVE_PATH_REGEX)
|
|
2201
|
+
var enumOrOmit = (...vals) => import_zod18.z.string().transform((val) => vals.includes(val) ? val : void 0).optional();
|
|
2202
|
+
var TiptapText = import_zod18.z.object({
|
|
2203
|
+
marks: import_zod18.z.union([
|
|
2204
|
+
import_zod18.z.array(
|
|
2205
|
+
import_zod18.z.discriminatedUnion("type", [
|
|
2206
|
+
import_zod18.z.object({ type: import_zod18.z.literal("bold") }),
|
|
2207
|
+
import_zod18.z.object({ type: import_zod18.z.literal("italic") }),
|
|
2208
|
+
import_zod18.z.object({
|
|
2209
|
+
attrs: import_zod18.z.object({
|
|
2210
|
+
class: import_zod18.z.string().nullable(),
|
|
2211
|
+
href: import_zod18.z.union([
|
|
2212
|
+
import_zod18.z.url(),
|
|
2213
|
+
import_zod18.z.literal("#"),
|
|
2214
|
+
import_zod18.z.string().regex(DYNAMIC_TOKEN_REGEX),
|
|
2215
|
+
import_zod18.z.string().regex(ROOT_RELATIVE_PATH_REGEX)
|
|
2551
2216
|
]),
|
|
2552
|
-
rel:
|
|
2553
|
-
target:
|
|
2217
|
+
rel: import_zod18.z.string().default("noopener noreferrer nofollow"),
|
|
2218
|
+
target: import_zod18.z.string().default("_blank")
|
|
2554
2219
|
}),
|
|
2555
|
-
type:
|
|
2220
|
+
type: import_zod18.z.literal("link")
|
|
2556
2221
|
}),
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
attrs:
|
|
2222
|
+
import_zod18.z.object({ type: import_zod18.z.literal("strike") }),
|
|
2223
|
+
import_zod18.z.object({
|
|
2224
|
+
attrs: import_zod18.z.object({
|
|
2560
2225
|
color: enumOrOmit(...textColorNames).default(TextColorName.base),
|
|
2561
2226
|
fontSize: enumOrOmit(...textSizeNames).default(TextSizeName.base)
|
|
2562
2227
|
}),
|
|
2563
|
-
type:
|
|
2228
|
+
type: import_zod18.z.literal("textStyle")
|
|
2564
2229
|
})
|
|
2565
2230
|
])
|
|
2566
2231
|
),
|
|
2567
|
-
|
|
2232
|
+
import_zod18.z.strictObject({}).transform(() => [])
|
|
2568
2233
|
]).optional(),
|
|
2569
|
-
text:
|
|
2570
|
-
type:
|
|
2234
|
+
text: import_zod18.z.string().default(""),
|
|
2235
|
+
type: import_zod18.z.literal("text").default("text")
|
|
2571
2236
|
});
|
|
2572
|
-
var TiptapParagraph =
|
|
2573
|
-
attrs:
|
|
2237
|
+
var TiptapParagraph = import_zod18.z.object({
|
|
2238
|
+
attrs: import_zod18.z.object({
|
|
2574
2239
|
textAlign: enumOrOmit(...textAlignments)
|
|
2575
2240
|
}).default({ textAlign: TextAlignment.start }),
|
|
2576
|
-
content:
|
|
2577
|
-
type:
|
|
2241
|
+
content: import_zod18.z.union([import_zod18.z.array(TiptapText), import_zod18.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
2242
|
+
type: import_zod18.z.literal("paragraph").default("paragraph")
|
|
2578
2243
|
});
|
|
2579
|
-
var TiptapDocument =
|
|
2580
|
-
attrs:
|
|
2244
|
+
var TiptapDocument = import_zod18.z.object({
|
|
2245
|
+
attrs: import_zod18.z.object({
|
|
2581
2246
|
blockSpacing: enumOrOmit(...spacings)
|
|
2582
2247
|
}).default({ blockSpacing: Spacing.base }),
|
|
2583
|
-
content:
|
|
2584
|
-
type:
|
|
2248
|
+
content: import_zod18.z.union([import_zod18.z.array(TiptapParagraph), import_zod18.z.strictObject({}).transform(() => [])]).default(() => [TiptapParagraph.parse({})]),
|
|
2249
|
+
type: import_zod18.z.literal("doc").default("doc")
|
|
2585
2250
|
});
|
|
2586
|
-
var CABTextTier =
|
|
2587
|
-
threshold:
|
|
2588
|
-
thresholds:
|
|
2589
|
-
tierId:
|
|
2590
|
-
tierType:
|
|
2251
|
+
var CABTextTier = import_zod18.z.object({
|
|
2252
|
+
threshold: import_zod18.z.number().int().nonnegative(),
|
|
2253
|
+
thresholds: import_zod18.z.record(import_zod18.z.string(), import_zod18.z.number().int().nonnegative()).default(() => ({})),
|
|
2254
|
+
tierId: import_zod18.z.string().optional(),
|
|
2255
|
+
tierType: import_zod18.z.enum(progressTierTypes).default(ProgressTierType.shipping)
|
|
2591
2256
|
});
|
|
2592
|
-
var CABTextSection =
|
|
2257
|
+
var CABTextSection = import_zod18.z.object({
|
|
2593
2258
|
...CABVariableFields,
|
|
2594
|
-
buttonField:
|
|
2595
|
-
content:
|
|
2596
|
-
name:
|
|
2597
|
-
optionId:
|
|
2598
|
-
sectionId:
|
|
2599
|
-
sectionType:
|
|
2259
|
+
buttonField: import_zod18.z.enum(buttonFields).optional(),
|
|
2260
|
+
content: import_zod18.z.record(import_zod18.z.string(), import_zod18.z.union([import_zod18.z.string(), TiptapDocument]).refine(checkForHTML, NO_HTML).optional()).default({ en: TiptapDocument.parse({}) }).optional(),
|
|
2261
|
+
name: import_zod18.z.string().optional(),
|
|
2262
|
+
optionId: import_zod18.z.number().optional(),
|
|
2263
|
+
sectionId: import_zod18.z.uuid().default(() => (0, import_uuid2.v7)()),
|
|
2264
|
+
sectionType: import_zod18.z.literal(SectionType.text).default(SectionType.text),
|
|
2600
2265
|
tier: CABTextTier.optional()
|
|
2601
2266
|
}).superRefine(({ buttonField, content }, ctx) => {
|
|
2602
2267
|
if (buttonField === ButtonField.destinationUrl && content) {
|
|
2603
|
-
(0,
|
|
2604
|
-
if (value && (0,
|
|
2268
|
+
(0, import_compat3.forEach)(content, (value, lang) => {
|
|
2269
|
+
if (value && (0, import_compat3.isString)(value)) {
|
|
2605
2270
|
if (DYNAMIC_TOKEN_REGEX.test(value)) return;
|
|
2606
2271
|
try {
|
|
2607
2272
|
new URL(value);
|
|
@@ -2614,39 +2279,921 @@ var CABTextSection = import_zod24.z.object({
|
|
|
2614
2279
|
}
|
|
2615
2280
|
}
|
|
2616
2281
|
});
|
|
2617
|
-
}
|
|
2282
|
+
}
|
|
2283
|
+
});
|
|
2284
|
+
|
|
2285
|
+
// src/schema/widgets/post-purchase-offer/postPurchaseBlocks.ts
|
|
2286
|
+
var TextAlignment2 = import_zod19.z.union([import_zod19.z.enum(["leading", "center", "trailing"]), import_zod19.z.unknown().transform(() => "leading")]);
|
|
2287
|
+
var TextSize = import_zod19.z.union([
|
|
2288
|
+
import_zod19.z.enum(["xsmall", "small", "base", "default", "medium", "large", "xlarge"]),
|
|
2289
|
+
import_zod19.z.unknown().transform(() => "medium")
|
|
2290
|
+
]);
|
|
2291
|
+
var CalloutBannerBlock = import_zod19.z.object({
|
|
2292
|
+
id: import_zod19.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2293
|
+
name: import_zod19.z.string().optional(),
|
|
2294
|
+
settings: import_zod19.z.object({
|
|
2295
|
+
superTitle: import_zod19.z.union([import_zod19.z.string(), TiptapDocument]).default(() => "Limited-time Offer"),
|
|
2296
|
+
title: import_zod19.z.union([import_zod19.z.string(), TiptapDocument]).default(() => "Add this customer favorite to your order")
|
|
2297
|
+
}),
|
|
2298
|
+
styles: import_zod19.z.object({
|
|
2299
|
+
superTitleEmphasized: import_zod19.z.boolean().default(false),
|
|
2300
|
+
superTitleSize: TextSize.default("large"),
|
|
2301
|
+
textAlignment: TextAlignment2.default("center"),
|
|
2302
|
+
titleEmphasized: import_zod19.z.boolean().default(true),
|
|
2303
|
+
titleSize: TextSize.default("large")
|
|
2304
|
+
}),
|
|
2305
|
+
type: import_zod19.z.literal(BlockType.callout_banner).default(BlockType.callout_banner)
|
|
2306
|
+
});
|
|
2307
|
+
var ImageBlock = import_zod19.z.object({
|
|
2308
|
+
id: import_zod19.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2309
|
+
name: import_zod19.z.string().optional(),
|
|
2310
|
+
settings: import_zod19.z.union([
|
|
2311
|
+
import_zod19.z.object({
|
|
2312
|
+
/** This isn't used in the post-purchase offer widget */
|
|
2313
|
+
alt: import_zod19.z.string().optional().default(""),
|
|
2314
|
+
image: import_zod19.z.union([import_zod19.z.literal(""), import_zod19.z.url()]).default(""),
|
|
2315
|
+
imageSize: import_zod19.z.number().default(20),
|
|
2316
|
+
imageType: import_zod19.z.enum(["URL", "UPLOAD"]).default("URL")
|
|
2317
|
+
}),
|
|
2318
|
+
import_zod19.z.array(import_zod19.z.never()).transform(() => ({}))
|
|
2319
|
+
]),
|
|
2320
|
+
type: import_zod19.z.literal(BlockType.image).default(BlockType.image)
|
|
2321
|
+
});
|
|
2322
|
+
var ImageContentBlock = import_zod19.z.object({
|
|
2323
|
+
id: import_zod19.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2324
|
+
name: import_zod19.z.string().optional(),
|
|
2325
|
+
settings: import_zod19.z.object({
|
|
2326
|
+
alt: import_zod19.z.string().optional().default(""),
|
|
2327
|
+
description: import_zod19.z.union([import_zod19.z.string(), TiptapDocument, import_zod19.z.null()]).default(
|
|
2328
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
|
2329
|
+
),
|
|
2330
|
+
descriptionSize: TextSize.default("medium"),
|
|
2331
|
+
horizontalAlignment: TextAlignment2.default("leading"),
|
|
2332
|
+
image: import_zod19.z.union([import_zod19.z.literal(""), import_zod19.z.url()]).default(""),
|
|
2333
|
+
imagePlacement: import_zod19.z.enum(["bottom", "left", "right", "top"]).optional().default("left"),
|
|
2334
|
+
imageSize: import_zod19.z.number().default(20),
|
|
2335
|
+
superTitle: import_zod19.z.union([import_zod19.z.string(), TiptapDocument]).default("Lorem Ipsum!"),
|
|
2336
|
+
superTitleSize: TextSize.default("medium"),
|
|
2337
|
+
/** This isn't configurable in the admin-nextjs editor */
|
|
2338
|
+
swapContent: import_zod19.z.boolean().optional().default(false),
|
|
2339
|
+
title: import_zod19.z.union([import_zod19.z.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet"),
|
|
2340
|
+
titleSize: TextSize.default("medium")
|
|
2341
|
+
}),
|
|
2342
|
+
type: import_zod19.z.literal(BlockType.image_content).default(BlockType.image_content)
|
|
2343
|
+
});
|
|
2344
|
+
var PayButtonBlock = import_zod19.z.object({
|
|
2345
|
+
id: import_zod19.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2346
|
+
name: import_zod19.z.string().optional(),
|
|
2347
|
+
settings: import_zod19.z.union([
|
|
2348
|
+
import_zod19.z.object({
|
|
2349
|
+
label: import_zod19.z.string().default("Pay Now")
|
|
2350
|
+
}),
|
|
2351
|
+
import_zod19.z.array(import_zod19.z.never()).transform(() => ({
|
|
2352
|
+
label: "Pay Now"
|
|
2353
|
+
}))
|
|
2354
|
+
]),
|
|
2355
|
+
styles: import_zod19.z.union([
|
|
2356
|
+
import_zod19.z.object({
|
|
2357
|
+
buttonWidth: import_zod19.z.number().min(10).max(100).default(50)
|
|
2358
|
+
}),
|
|
2359
|
+
import_zod19.z.array(import_zod19.z.never()).transform(() => ({
|
|
2360
|
+
buttonWidth: 50
|
|
2361
|
+
}))
|
|
2362
|
+
]),
|
|
2363
|
+
type: import_zod19.z.literal(BlockType.pay_button).default(BlockType.pay_button)
|
|
2364
|
+
});
|
|
2365
|
+
var ProductInformationBlock = import_zod19.z.object({
|
|
2366
|
+
/** This isn't configurable in the admin-nextjs editor */
|
|
2367
|
+
hideProductImage: import_zod19.z.boolean().optional().default(false),
|
|
2368
|
+
id: import_zod19.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2369
|
+
name: import_zod19.z.string().optional(),
|
|
2370
|
+
type: import_zod19.z.literal(BlockType.product_information).default(BlockType.product_information)
|
|
2371
|
+
});
|
|
2372
|
+
var SeparatorBlock = import_zod19.z.object({
|
|
2373
|
+
id: import_zod19.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2374
|
+
name: import_zod19.z.string().optional(),
|
|
2375
|
+
type: import_zod19.z.literal(BlockType.separator).default(BlockType.separator)
|
|
2376
|
+
});
|
|
2377
|
+
var TextBlock = import_zod19.z.object({
|
|
2378
|
+
id: import_zod19.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2379
|
+
name: import_zod19.z.string().optional(),
|
|
2380
|
+
settings: import_zod19.z.object({
|
|
2381
|
+
description: import_zod19.z.union([import_zod19.z.string(), TiptapDocument]).optional().default(
|
|
2382
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
|
2383
|
+
),
|
|
2384
|
+
/** This isn't used in the post-purchase offer widget */
|
|
2385
|
+
descriptionSize: TextSize.default("medium"),
|
|
2386
|
+
horizontalAlignment: TextAlignment2.default("leading"),
|
|
2387
|
+
superTitle: import_zod19.z.union([import_zod19.z.string(), TiptapDocument]).default("Super Title"),
|
|
2388
|
+
/** This isn't used in the post-purchase offer widget */
|
|
2389
|
+
superTitleSize: TextSize.default("medium"),
|
|
2390
|
+
title: import_zod19.z.union([import_zod19.z.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet."),
|
|
2391
|
+
/** This isn't used in the post-purchase offer widget */
|
|
2392
|
+
titleSize: TextSize.default("medium")
|
|
2393
|
+
}),
|
|
2394
|
+
type: import_zod19.z.literal(BlockType.text).default(BlockType.text)
|
|
2395
|
+
});
|
|
2396
|
+
var TimerBlock = import_zod19.z.object({
|
|
2397
|
+
id: import_zod19.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2398
|
+
name: import_zod19.z.string().optional(),
|
|
2399
|
+
settings: import_zod19.z.object({
|
|
2400
|
+
durationMinutes: import_zod19.z.number().min(0).default(10),
|
|
2401
|
+
durationSeconds: import_zod19.z.union([import_zod19.z.number().min(0), import_zod19.z.unknown().transform(() => 0)]).default(0),
|
|
2402
|
+
endOffer: import_zod19.z.boolean().default(true),
|
|
2403
|
+
title: import_zod19.z.union([import_zod19.z.string(), TiptapDocument]).default("Hurry \u2014 your special offer ends in:")
|
|
2404
|
+
}),
|
|
2405
|
+
styles: import_zod19.z.object({
|
|
2406
|
+
textAlignment: TextAlignment2.default("center"),
|
|
2407
|
+
timerBackgroundColor: import_zod19.z.enum(["info", "warning", "success", "critical"]).default("warning"),
|
|
2408
|
+
timerEmphasized: import_zod19.z.union([import_zod19.z.boolean(), import_zod19.z.unknown().transform(() => true)]).default(true),
|
|
2409
|
+
timerSize: TextSize.default("medium"),
|
|
2410
|
+
timerWidth: import_zod19.z.number().min(10).max(100).optional().default(100),
|
|
2411
|
+
titleEmphasized: import_zod19.z.union([import_zod19.z.boolean(), import_zod19.z.unknown().transform(() => true)]).default(false),
|
|
2412
|
+
titleSize: TextSize.default("medium")
|
|
2413
|
+
}),
|
|
2414
|
+
type: import_zod19.z.literal(BlockType.timer).default(BlockType.timer)
|
|
2415
|
+
});
|
|
2416
|
+
var PostPurchaseBlock = import_zod19.z.discriminatedUnion("type", [
|
|
2417
|
+
CalloutBannerBlock,
|
|
2418
|
+
ImageBlock,
|
|
2419
|
+
ImageContentBlock,
|
|
2420
|
+
PayButtonBlock,
|
|
2421
|
+
ProductInformationBlock,
|
|
2422
|
+
SeparatorBlock,
|
|
2423
|
+
TextBlock,
|
|
2424
|
+
TimerBlock
|
|
2425
|
+
]);
|
|
2426
|
+
var isCalloutBannerBlock = (block) => (0, import_compat4.isEqual)((0, import_compat4.get)(block, "type"), BlockType.callout_banner);
|
|
2427
|
+
var isImageBlock = (block) => (0, import_compat4.isEqual)((0, import_compat4.get)(block, "type"), BlockType.image);
|
|
2428
|
+
var isImageContentBlock = (block) => (0, import_compat4.isEqual)((0, import_compat4.get)(block, "type"), BlockType.image_content);
|
|
2429
|
+
var isPayButtonBlock = (block) => (0, import_compat4.isEqual)((0, import_compat4.get)(block, "type"), BlockType.pay_button);
|
|
2430
|
+
var isProductInformationBlock = (block) => (0, import_compat4.isEqual)((0, import_compat4.get)(block, "type"), BlockType.product_information);
|
|
2431
|
+
var isSeparatorBlock = (block) => (0, import_compat4.isEqual)((0, import_compat4.get)(block, "type"), BlockType.separator);
|
|
2432
|
+
var isTextBlock = (block) => (0, import_compat4.isEqual)((0, import_compat4.get)(block, "type"), BlockType.text);
|
|
2433
|
+
var isTimerBlock = (block) => (0, import_compat4.isEqual)((0, import_compat4.get)(block, "type"), BlockType.timer);
|
|
2434
|
+
|
|
2435
|
+
// src/schema/widgets/post-purchase-offer/postPurchaseSettings.ts
|
|
2436
|
+
var PostPurchaseSettings = import_zod20.z.object({
|
|
2437
|
+
advance: import_zod20.z.object({ removePartialOrder: import_zod20.z.boolean().default(true) }).optional().default(() => ({ removePartialOrder: true })),
|
|
2438
|
+
blocks: import_zod20.z.union([import_zod20.z.array(PostPurchaseBlock), import_zod20.z.unknown().transform(() => [])]).default(() => [
|
|
2439
|
+
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.timer }),
|
|
2440
|
+
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.callout_banner }),
|
|
2441
|
+
PostPurchaseBlock.parse({ type: BlockType.product_information })
|
|
2442
|
+
]),
|
|
2443
|
+
columnLayout: import_zod20.z.boolean().optional(),
|
|
2444
|
+
discount: import_zod20.z.object({
|
|
2445
|
+
amount: strictNumber.default(30),
|
|
2446
|
+
shouldShowSavingText: import_zod20.z.boolean().optional().default(true),
|
|
2447
|
+
type: import_zod20.z.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
2448
|
+
}),
|
|
2449
|
+
discountedFrom: import_zod20.z.enum(["price", "compare_at_price"]).optional().default("price"),
|
|
2450
|
+
endpoint: import_zod20.z.string().optional(),
|
|
2451
|
+
integrations: import_zod20.z.object({
|
|
2452
|
+
judgeme: import_zod20.z.boolean().default(false),
|
|
2453
|
+
junip: import_zod20.z.boolean().optional().default(false),
|
|
2454
|
+
klaviyo: import_zod20.z.boolean().default(false),
|
|
2455
|
+
loox: import_zod20.z.boolean().default(false),
|
|
2456
|
+
okendo: import_zod20.z.boolean().default(false),
|
|
2457
|
+
opinew: import_zod20.z.boolean().optional().default(false),
|
|
2458
|
+
reviewsio: import_zod20.z.boolean().optional().default(false),
|
|
2459
|
+
stamped: import_zod20.z.boolean().default(false),
|
|
2460
|
+
yotpo: import_zod20.z.boolean().default(false)
|
|
2461
|
+
}),
|
|
2462
|
+
key: import_zod20.z.string().optional(),
|
|
2463
|
+
language: import_zod20.z.object({
|
|
2464
|
+
description: import_zod20.z.union([import_zod20.z.string(), import_zod20.z.unknown().transform(() => "")]).default(""),
|
|
2465
|
+
descriptionEnabled: import_zod20.z.boolean().optional().default(false),
|
|
2466
|
+
descriptionRte: import_zod20.z.object({
|
|
2467
|
+
content: import_zod20.z.array(import_zod20.z.unknown()),
|
|
2468
|
+
type: import_zod20.z.string()
|
|
2469
|
+
}).optional(),
|
|
2470
|
+
descriptionSpacing: import_zod20.z.enum(["none", "xtight", "tight", "default", "loose", "xloose"]).optional(),
|
|
2471
|
+
displayCtaPrice: import_zod20.z.boolean().default(true),
|
|
2472
|
+
global: import_zod20.z.object({
|
|
2473
|
+
declineAll: import_zod20.z.string().optional().default("Decline All"),
|
|
2474
|
+
declineThisOffer: import_zod20.z.string().default("Decline this offer"),
|
|
2475
|
+
free: import_zod20.z.string().optional().default("Free"),
|
|
2476
|
+
notAvailable: import_zod20.z.string().optional().default("Not available"),
|
|
2477
|
+
payNow: import_zod20.z.string().default("Pay Now"),
|
|
2478
|
+
payNowUpgradeToSubscription: import_zod20.z.string().optional().default("Upgrade to Subscription"),
|
|
2479
|
+
quantity: import_zod20.z.string().default("Quantity"),
|
|
2480
|
+
/** This isn't configurable in the admin-nextjs editor */
|
|
2481
|
+
recurringShipping: import_zod20.z.string().optional().default("Recurring shipping"),
|
|
2482
|
+
recurringSubtotal: import_zod20.z.string().default("Recurring subtotal"),
|
|
2483
|
+
reviewsPlural: import_zod20.z.string().optional().default("Reviews"),
|
|
2484
|
+
reviewsSingular: import_zod20.z.string().optional().default("Review"),
|
|
2485
|
+
save: import_zod20.z.union([import_zod20.z.string(), import_zod20.z.unknown().transform(() => "Save")]).optional().default("Save"),
|
|
2486
|
+
shipping: import_zod20.z.string().default("Shipping"),
|
|
2487
|
+
subscriptionOption: import_zod20.z.string().optional().default("Subscribe and Save"),
|
|
2488
|
+
subtotal: import_zod20.z.string().default("Subtotal"),
|
|
2489
|
+
taxes: import_zod20.z.string().default("Taxes"),
|
|
2490
|
+
total: import_zod20.z.string().default("Total")
|
|
2491
|
+
}).optional().default(() => ({
|
|
2492
|
+
declineAll: "Decline All",
|
|
2493
|
+
declineThisOffer: "Decline this offer",
|
|
2494
|
+
free: "Free",
|
|
2495
|
+
notAvailable: "Not available",
|
|
2496
|
+
payNow: "Pay Now",
|
|
2497
|
+
payNowUpgradeToSubscription: "Upgrade to Subscription",
|
|
2498
|
+
quantity: "Quantity",
|
|
2499
|
+
/** This isn't configurable in the admin-nextjs editor */
|
|
2500
|
+
recurringShipping: "Recurring shipping",
|
|
2501
|
+
recurringSubtotal: "Recurring subtotal",
|
|
2502
|
+
reviewsPlural: "Reviews",
|
|
2503
|
+
reviewsSingular: "Review",
|
|
2504
|
+
save: "Save",
|
|
2505
|
+
shipping: "Shipping",
|
|
2506
|
+
subscriptionOption: "Subscribe and Save",
|
|
2507
|
+
subtotal: "Subtotal",
|
|
2508
|
+
taxes: "Taxes",
|
|
2509
|
+
total: "Total"
|
|
2510
|
+
})),
|
|
2511
|
+
globalTranslation: import_zod20.z.string().optional().default("english")
|
|
2512
|
+
}),
|
|
2513
|
+
metafields: import_zod20.z.boolean().default(false),
|
|
2514
|
+
/** This isn't configurable in the admin-nextjs editor */
|
|
2515
|
+
offer: import_zod20.z.object({
|
|
2516
|
+
count: import_zod20.z.number().default(1)
|
|
2517
|
+
}),
|
|
2518
|
+
offersLayout: import_zod20.z.object({
|
|
2519
|
+
itemsPerPage: import_zod20.z.number().optional(),
|
|
2520
|
+
type: import_zod20.z.enum(["list", "grid", "carousel"]).default("list")
|
|
2521
|
+
}).optional().default({
|
|
2522
|
+
type: "list"
|
|
2523
|
+
}),
|
|
2524
|
+
/** This isn't configurable in the admin-nextjs editor */
|
|
2525
|
+
previewMode: import_zod20.z.boolean().default(false),
|
|
2526
|
+
productLimit: import_zod20.z.number().optional().default(1),
|
|
2527
|
+
productOptions: import_zod20.z.object({
|
|
2528
|
+
/** This isn't configurable in the admin-nextjs editor */
|
|
2529
|
+
hideOutOfStockVariants: import_zod20.z.boolean().optional().default(false),
|
|
2530
|
+
matchVariant: import_zod20.z.boolean().optional().default(true),
|
|
2531
|
+
showDeclineAll: import_zod20.z.enum(["above", "below", "both", "none"]).optional(),
|
|
2532
|
+
showShipping: import_zod20.z.boolean().optional().default(true),
|
|
2533
|
+
showSubtotal: import_zod20.z.boolean().optional().default(true),
|
|
2534
|
+
showTaxes: import_zod20.z.boolean().optional().default(true),
|
|
2535
|
+
showTotal: import_zod20.z.boolean().optional().default(true),
|
|
2536
|
+
showVariantSelectors: import_zod20.z.boolean().optional().default(true),
|
|
2537
|
+
variantSelectorDisplayMode: import_zod20.z.enum(["separate", "single"]).optional().default("separate")
|
|
2538
|
+
}),
|
|
2539
|
+
productType: import_zod20.z.union([import_zod20.z.enum(["one-time", "subscription", "both"]), import_zod20.z.literal("").transform(() => "one-time")]).default("one-time"),
|
|
2540
|
+
productTypeSelector: import_zod20.z.enum(["dropdown", "radio"]).optional().default("radio"),
|
|
2541
|
+
quantityInputs: import_zod20.z.object({
|
|
2542
|
+
defaultQuantity: import_zod20.z.union([import_zod20.z.number(), import_zod20.z.null().transform(() => 1)]).default(1),
|
|
2543
|
+
enabled: import_zod20.z.boolean().default(true),
|
|
2544
|
+
maxValue: import_zod20.z.union([import_zod20.z.number(), import_zod20.z.null().transform(() => 15)]).default(15),
|
|
2545
|
+
minValue: import_zod20.z.union([import_zod20.z.number().min(0), import_zod20.z.unknown().transform(() => 0)]).default(1)
|
|
2546
|
+
}),
|
|
2547
|
+
shipping: import_zod20.z.object({
|
|
2548
|
+
amount: strictNumber.default(10),
|
|
2549
|
+
/** This isn't configurable in the admin-nextjs editor */
|
|
2550
|
+
enabled: import_zod20.z.boolean().default(true),
|
|
2551
|
+
title: import_zod20.z.string().optional().default("Shipping Fees"),
|
|
2552
|
+
type: import_zod20.z.enum(["free", "fixed_amount"]).default("free")
|
|
2553
|
+
}),
|
|
2554
|
+
styles: import_zod20.z.object({
|
|
2555
|
+
starColor: import_zod20.z.string().optional().default("#fadb14"),
|
|
2556
|
+
starSize: import_zod20.z.union([import_zod20.z.enum(["small", "medium", "large"]), import_zod20.z.unknown().transform(() => "large")]).optional().default("large"),
|
|
2557
|
+
starStrokeColor: import_zod20.z.string().optional().default("#fadb14"),
|
|
2558
|
+
strokeWidth: import_zod20.z.string().optional().default("1")
|
|
2559
|
+
}).optional(),
|
|
2560
|
+
subImages: import_zod20.z.number().nullish().default(8),
|
|
2561
|
+
subscription: import_zod20.z.object({
|
|
2562
|
+
discount: import_zod20.z.object({
|
|
2563
|
+
amount: strictNumber.default(30),
|
|
2564
|
+
shouldShowSavingText: import_zod20.z.boolean().optional().default(true),
|
|
2565
|
+
type: import_zod20.z.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
2566
|
+
}),
|
|
2567
|
+
shipping: import_zod20.z.object({
|
|
2568
|
+
amount: strictNumber.default(1),
|
|
2569
|
+
/** This isn't configurable in the admin-nextjs editor */
|
|
2570
|
+
enabled: import_zod20.z.boolean().default(true),
|
|
2571
|
+
/** This isn't configurable in the admin-nextjs editor */
|
|
2572
|
+
recurringAmount: strictNumber.default(2),
|
|
2573
|
+
shippingTitle: import_zod20.z.string().default("Shipping Fees"),
|
|
2574
|
+
type: import_zod20.z.enum(["free", "fixed_amount"]).default("free")
|
|
2575
|
+
})
|
|
2576
|
+
}).optional().default({
|
|
2577
|
+
discount: {
|
|
2578
|
+
amount: 30,
|
|
2579
|
+
shouldShowSavingText: true,
|
|
2580
|
+
type: "none"
|
|
2581
|
+
},
|
|
2582
|
+
shipping: {
|
|
2583
|
+
amount: 1,
|
|
2584
|
+
/** This isn't configurable in the admin-nextjs editor */
|
|
2585
|
+
enabled: true,
|
|
2586
|
+
/** This isn't configurable in the admin-nextjs editor */
|
|
2587
|
+
recurringAmount: 2,
|
|
2588
|
+
shippingTitle: "Shipping Fees",
|
|
2589
|
+
type: "free"
|
|
2590
|
+
}
|
|
2591
|
+
}),
|
|
2592
|
+
subscriptionIsDefault: import_zod20.z.boolean().optional(),
|
|
2593
|
+
/** This isn't configurable in the admin-nextjs editor */
|
|
2594
|
+
template: import_zod20.z.string().optional().default(""),
|
|
2595
|
+
type: import_zod20.z.literal("shopify_post_purchase_extension").default("shopify_post_purchase_extension"),
|
|
2596
|
+
upgradeToSubscription: import_zod20.z.object({
|
|
2597
|
+
acceptButtonText: import_zod20.z.string().optional().default("Upgrade"),
|
|
2598
|
+
allow: import_zod20.z.boolean().optional().default(false),
|
|
2599
|
+
emailRefundNotice: import_zod20.z.boolean().optional().default(false),
|
|
2600
|
+
errorBannerText: import_zod20.z.string().optional().default("This subscription cannot be added - limit one per order")
|
|
2601
|
+
}).optional().default(() => ({
|
|
2602
|
+
acceptButtonText: "Upgrade",
|
|
2603
|
+
allow: false,
|
|
2604
|
+
emailRefundNotice: false,
|
|
2605
|
+
errorBannerText: "This subscription cannot be added - limit one per order"
|
|
2606
|
+
}))
|
|
2607
|
+
});
|
|
2608
|
+
|
|
2609
|
+
// src/schema/postPurchaseProductDisplay.ts
|
|
2610
|
+
var language = PostPurchaseSettings.shape.language;
|
|
2611
|
+
var PostPurchasePrimaryImageSource = import_zod21.z.string().default(
|
|
2612
|
+
"https://cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c.gif"
|
|
2613
|
+
);
|
|
2614
|
+
var PostPurchaseProductDisplay = import_zod21.z.object({
|
|
2615
|
+
discountedFrom: PostPurchaseSettings.shape.discountedFrom,
|
|
2616
|
+
gallery: PostPurchaseProductGallery.optional(),
|
|
2617
|
+
language: language.pick({
|
|
2618
|
+
description: true,
|
|
2619
|
+
descriptionEnabled: true,
|
|
2620
|
+
descriptionRte: true,
|
|
2621
|
+
descriptionSpacing: true
|
|
2622
|
+
}),
|
|
2623
|
+
primaryImage: import_zod21.z.object({ description: import_zod21.z.string(), source: import_zod21.z.string() }),
|
|
2624
|
+
productOptions: PostPurchaseSettings.shape.productOptions.pick({
|
|
2625
|
+
showDeclineAll: true,
|
|
2626
|
+
showShipping: true,
|
|
2627
|
+
showSubtotal: true,
|
|
2628
|
+
showTaxes: true,
|
|
2629
|
+
showTotal: true,
|
|
2630
|
+
showVariantSelectors: true
|
|
2631
|
+
}),
|
|
2632
|
+
responseDescription: language.shape.description,
|
|
2633
|
+
shouldShowSavingText: PostPurchaseSettings.shape.discount.shape.shouldShowSavingText
|
|
2634
|
+
});
|
|
2635
|
+
|
|
2636
|
+
// src/schema/postPurchaseProductSettings.ts
|
|
2637
|
+
var import_zod22 = require("zod");
|
|
2638
|
+
var amount = import_zod22.z.union([import_zod22.z.number().nonnegative(), PostPurchaseAmount.transform(Number)]);
|
|
2639
|
+
var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
2640
|
+
discountedFrom: true,
|
|
2641
|
+
language: true,
|
|
2642
|
+
productLimit: true,
|
|
2643
|
+
productOptions: true,
|
|
2644
|
+
productType: true,
|
|
2645
|
+
productTypeSelector: true,
|
|
2646
|
+
quantityInputs: true,
|
|
2647
|
+
subscriptionIsDefault: true,
|
|
2648
|
+
upgradeToSubscription: true
|
|
2649
|
+
}).extend({
|
|
2650
|
+
advance: import_zod22.z.unknown().default({}),
|
|
2651
|
+
blocks: import_zod22.z.array(import_zod22.z.unknown()).optional(),
|
|
2652
|
+
discount: PostPurchaseSettings.shape.discount.extend({ amount: amount.default(30) }),
|
|
2653
|
+
integrations: import_zod22.z.unknown().default({}),
|
|
2654
|
+
shipping: PostPurchaseSettings.shape.shipping.extend({ amount: amount.default(10) }),
|
|
2655
|
+
styles: import_zod22.z.unknown().default({}),
|
|
2656
|
+
subImages: PostPurchaseSettings.shape.subImages.catch(null),
|
|
2657
|
+
subscription: import_zod22.z.unknown().default(PostPurchaseSettings.shape.subscription.parse(void 0))
|
|
2658
|
+
});
|
|
2659
|
+
|
|
2660
|
+
// src/schema/postPurchaseSelection.ts
|
|
2661
|
+
var import_zod23 = require("zod");
|
|
2662
|
+
var SelectionClaimsSchema = DecideRequestSchema.extend({
|
|
2663
|
+
appId: PostPurchaseAppIdSchema,
|
|
2664
|
+
entry: DecisionEntrySchema,
|
|
2665
|
+
iss: import_zod23.z.literal("rebuy-api"),
|
|
2666
|
+
purpose: import_zod23.z.literal("post-purchase-selection")
|
|
2667
|
+
});
|
|
2668
|
+
var SessionStartRequestSchema = DecideRequestSchema.extend({
|
|
2669
|
+
selectionToken: import_zod23.z.string().min(1).max(8192).optional()
|
|
2670
|
+
}).strict();
|
|
2671
|
+
|
|
2672
|
+
// src/schema/postPurchaseSession.ts
|
|
2673
|
+
var import_zod24 = require("zod");
|
|
2674
|
+
var SessionIdentitySchema = DecideRequestSchema.extend({ appId: PostPurchaseAppIdSchema });
|
|
2675
|
+
var SessionOrderTimingSchema = import_zod24.z.object({
|
|
2676
|
+
nativeDeadline: PostPurchaseTimestampSchema,
|
|
2677
|
+
orderCreatedAt: PostPurchaseTimestampSchema,
|
|
2678
|
+
orderId: PostPurchaseOrderIdSchema,
|
|
2679
|
+
timingSource: import_zod24.z.literal("shopify-order-created-at")
|
|
2680
|
+
});
|
|
2681
|
+
var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
2682
|
+
deadline: PostPurchaseTimestampSchema,
|
|
2683
|
+
entry: DecisionEntrySchema,
|
|
2684
|
+
policySnapshot: SessionPolicySchema,
|
|
2685
|
+
startedAt: PostPurchaseTimestampSchema
|
|
2686
|
+
}).refine((session) => session.orderCreatedAt <= session.startedAt, {
|
|
2687
|
+
message: "startedAt must not precede orderCreatedAt",
|
|
2688
|
+
path: ["startedAt"]
|
|
2689
|
+
}).refine((session) => session.startedAt <= session.deadline, {
|
|
2690
|
+
message: "deadline must not precede startedAt",
|
|
2691
|
+
path: ["deadline"]
|
|
2692
|
+
}).refine((session) => session.deadline <= session.nativeDeadline, {
|
|
2693
|
+
message: "deadline must not exceed nativeDeadline",
|
|
2694
|
+
path: ["deadline"]
|
|
2695
|
+
});
|
|
2696
|
+
var SessionStartResponseSchema = import_zod24.z.object({
|
|
2697
|
+
data: import_zod24.z.object({
|
|
2698
|
+
phase: import_zod24.z.literal("render"),
|
|
2699
|
+
serverNow: PostPurchaseTimestampSchema,
|
|
2700
|
+
session: ReadySessionTimingSchema,
|
|
2701
|
+
workflowPhase: import_zod24.z.literal("start")
|
|
2702
|
+
}),
|
|
2703
|
+
successful: import_zod24.z.literal(true)
|
|
2704
|
+
});
|
|
2705
|
+
|
|
2706
|
+
// src/schema/postPurchaseSessionClose.ts
|
|
2707
|
+
var import_zod25 = require("zod");
|
|
2708
|
+
var SessionClosureSchema = import_zod25.z.object({ closedAt: PostPurchaseTimestampSchema, status: import_zod25.z.literal("closed") });
|
|
2709
|
+
var SessionCloseRequestSchema = DecideRequestSchema.strict();
|
|
2710
|
+
var SessionCloseResponseSchema = import_zod25.z.object({ data: SessionClosureSchema, successful: import_zod25.z.literal(true) });
|
|
2711
|
+
|
|
2712
|
+
// src/schema/postPurchaseShadow.ts
|
|
2713
|
+
var import_zod26 = require("zod");
|
|
2714
|
+
var PostPurchaseShadowSelectionSchema = import_zod26.z.discriminatedUnion("verdict", [
|
|
2715
|
+
import_zod26.z.object({ entry: DecisionEntrySchema, verdict: import_zod26.z.literal("render") }),
|
|
2716
|
+
import_zod26.z.object({ verdict: import_zod26.z.literal("skip") })
|
|
2717
|
+
]);
|
|
2718
|
+
var PostPurchaseShadowReportFields = import_zod26.z.object({
|
|
2719
|
+
differences: import_zod26.z.array(import_zod26.z.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
|
|
2720
|
+
message: "differences must not contain duplicate entries"
|
|
2721
|
+
}),
|
|
2722
|
+
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
2723
|
+
phase: import_zod26.z.literal("shouldRender"),
|
|
2724
|
+
sampleId: import_zod26.z.string(),
|
|
2725
|
+
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
2726
|
+
status: import_zod26.z.enum(["match", "diverged", "incomplete"]),
|
|
2727
|
+
targetingFlowIds: import_zod26.z.array(import_zod26.z.number().int().positive()),
|
|
2728
|
+
workflowPhase: import_zod26.z.literal("decide")
|
|
2729
|
+
});
|
|
2730
|
+
var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
2731
|
+
(report) => report.status !== "match" || report.differences.length === 0,
|
|
2732
|
+
{ message: "status 'match' requires an empty differences array", path: ["status"] }
|
|
2733
|
+
).refine((report) => report.status !== "diverged" || report.differences.length > 0, {
|
|
2734
|
+
message: "status 'diverged' requires a non-empty differences array",
|
|
2735
|
+
path: ["status"]
|
|
2736
|
+
}).refine((report) => report.status !== "diverged" || report.serverSelection !== void 0, {
|
|
2737
|
+
message: "status 'diverged' requires a serverSelection to diverge from",
|
|
2738
|
+
path: ["status"]
|
|
2739
|
+
});
|
|
2740
|
+
|
|
2741
|
+
// src/schema/postPurchaseSkipTrace.ts
|
|
2742
|
+
var import_zod27 = require("zod");
|
|
2743
|
+
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
2744
|
+
var PostPurchaseSkipTraceSchema = import_zod27.z.array(
|
|
2745
|
+
import_zod27.z.object({
|
|
2746
|
+
entry: DecisionEntrySchema,
|
|
2747
|
+
reason: PostPurchaseSkipReasonSchema
|
|
2748
|
+
})
|
|
2749
|
+
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
2750
|
+
|
|
2751
|
+
// src/schema/postPurchaseVariantCatalog.ts
|
|
2752
|
+
var import_zod28 = require("zod");
|
|
2753
|
+
var PostPurchaseVariantSelector = import_zod28.z.object({ variantId: PostPurchaseVariantId }).strict();
|
|
2754
|
+
var PostPurchaseVariantOption = OfferProduct.shape.options.element.extend({
|
|
2755
|
+
id: import_zod28.z.number().int().positive(),
|
|
2756
|
+
position: import_zod28.z.number().int().min(1).max(3)
|
|
2757
|
+
});
|
|
2758
|
+
var PostPurchaseVariantValues = OfferProduct.shape.variants.element.pick({
|
|
2759
|
+
option1: true,
|
|
2760
|
+
option2: true,
|
|
2761
|
+
option3: true
|
|
2762
|
+
});
|
|
2763
|
+
var PostPurchaseVariantCatalog = import_zod28.z.object({
|
|
2764
|
+
displayMode: PostPurchaseSettings.shape.productOptions.shape.variantSelectorDisplayMode,
|
|
2765
|
+
options: import_zod28.z.array(PostPurchaseVariantOption),
|
|
2766
|
+
productId: PostPurchaseProductId,
|
|
2767
|
+
showSelectors: PostPurchaseSettings.shape.productOptions.shape.showVariantSelectors,
|
|
2768
|
+
variants: import_zod28.z.array(
|
|
2769
|
+
PostPurchaseVariantValues.partial().extend({
|
|
2770
|
+
available: import_zod28.z.boolean(),
|
|
2771
|
+
id: PostPurchaseVariantId,
|
|
2772
|
+
imageId: import_zod28.z.number().int().nonnegative().nullish(),
|
|
2773
|
+
title: OfferProduct.shape.variants.element.shape.title
|
|
2774
|
+
})
|
|
2775
|
+
)
|
|
2776
|
+
});
|
|
2777
|
+
|
|
2778
|
+
// src/schema/postPurchaseVariantDefault.ts
|
|
2779
|
+
var import_zod29 = require("zod");
|
|
2780
|
+
var values = PostPurchaseVariantValues.partial().extend({
|
|
2781
|
+
option1: PostPurchaseVariantValues.shape.option1.nullish()
|
|
2782
|
+
});
|
|
2783
|
+
var variant = values.extend({
|
|
2784
|
+
id: PostPurchaseVariantId,
|
|
2785
|
+
inventoryManagement: import_zod29.z.string().nullable(),
|
|
2786
|
+
inventoryPolicy: import_zod29.z.string(),
|
|
2787
|
+
inventoryQuantity: import_zod29.z.number()
|
|
2788
|
+
});
|
|
2789
|
+
var options = import_zod29.z.array(PostPurchaseVariantOption.pick({ name: true, values: true }));
|
|
2790
|
+
var PostPurchaseVariantDefaultProduct = import_zod29.z.object({
|
|
2791
|
+
id: PostPurchaseProductId,
|
|
2792
|
+
options,
|
|
2793
|
+
selectedVariant: variant.optional(),
|
|
2794
|
+
variants: import_zod29.z.array(variant)
|
|
2795
|
+
});
|
|
2796
|
+
var PostPurchaseVariantDefaultSettings = PostPurchaseSettings.shape.productOptions.pick({
|
|
2797
|
+
hideOutOfStockVariants: true,
|
|
2798
|
+
matchVariant: true
|
|
2799
|
+
});
|
|
2800
|
+
var PostPurchaseOrderAttributes = import_zod29.z.record(import_zod29.z.string(), import_zod29.z.array(import_zod29.z.string())).default({});
|
|
2801
|
+
|
|
2802
|
+
// src/schema/shopConfig.ts
|
|
2803
|
+
var import_zod30 = require("zod");
|
|
2804
|
+
var ShopConfig = import_zod30.z.object({
|
|
2805
|
+
activeExperiments: import_zod30.z.array(
|
|
2806
|
+
import_zod30.z.object({
|
|
2807
|
+
data: import_zod30.z.array(
|
|
2808
|
+
import_zod30.z.object({
|
|
2809
|
+
aliasName: import_zod30.z.string(),
|
|
2810
|
+
cssInput: import_zod30.z.string().nullish(),
|
|
2811
|
+
elementId: import_zod30.z.coerce.number(),
|
|
2812
|
+
id: import_zod30.z.coerce.number(),
|
|
2813
|
+
javascriptInput: import_zod30.z.string().nullish(),
|
|
2814
|
+
traffic: import_zod30.z.coerce.number()
|
|
2815
|
+
})
|
|
2816
|
+
),
|
|
2817
|
+
id: import_zod30.z.coerce.number(),
|
|
2818
|
+
name: import_zod30.z.string(),
|
|
2819
|
+
pageTarget: import_zod30.z.string().nullable(),
|
|
2820
|
+
pageTargetUrl: import_zod30.z.string().nullable(),
|
|
2821
|
+
placeholderId: import_zod30.z.coerce.number().nullable(),
|
|
2822
|
+
type: import_zod30.z.string()
|
|
2823
|
+
})
|
|
2824
|
+
),
|
|
2825
|
+
activePackages: import_zod30.z.array(
|
|
2826
|
+
import_zod30.z.object({
|
|
2827
|
+
cancelledAt: import_zod30.z.string().nullable(),
|
|
2828
|
+
id: import_zod30.z.number(),
|
|
2829
|
+
installedAt: import_zod30.z.string().nullable(),
|
|
2830
|
+
isActive: import_zod30.z.boolean(),
|
|
2831
|
+
isBillable: import_zod30.z.boolean(),
|
|
2832
|
+
packageId: import_zod30.z.number(),
|
|
2833
|
+
packageName: import_zod30.z.string(),
|
|
2834
|
+
shortName: import_zod30.z.string(),
|
|
2835
|
+
trialDays: import_zod30.z.number(),
|
|
2836
|
+
uninstalledAt: import_zod30.z.string().nullable()
|
|
2837
|
+
})
|
|
2838
|
+
),
|
|
2839
|
+
apiKey: import_zod30.z.string(),
|
|
2840
|
+
billingVersion: import_zod30.z.string().nullable(),
|
|
2841
|
+
cacheKey: import_zod30.z.coerce.number(),
|
|
2842
|
+
carousel: import_zod30.z.enum(["flickity", "splide"]),
|
|
2843
|
+
currency: import_zod30.z.string(),
|
|
2844
|
+
currencySymbol: import_zod30.z.string(),
|
|
2845
|
+
domain: import_zod30.z.string(),
|
|
2846
|
+
enabledJquery: import_zod30.z.boolean(),
|
|
2847
|
+
enabledPresentmentCurrencies: import_zod30.z.array(import_zod30.z.string()),
|
|
2848
|
+
hasSmartCollectionsEnabled: import_zod30.z.boolean(),
|
|
2849
|
+
hasSmartSearchEnabled: import_zod30.z.boolean(),
|
|
2850
|
+
id: import_zod30.z.coerce.number(),
|
|
2851
|
+
integrations: import_zod30.z.record(
|
|
2852
|
+
import_zod30.z.enum([
|
|
2853
|
+
"attentive",
|
|
2854
|
+
"judgeme",
|
|
2855
|
+
"junip",
|
|
2856
|
+
"klaviyo",
|
|
2857
|
+
"loox",
|
|
2858
|
+
"okendo",
|
|
2859
|
+
"opinew",
|
|
2860
|
+
"recharge",
|
|
2861
|
+
"reviewsio",
|
|
2862
|
+
"stamped",
|
|
2863
|
+
"yotpo"
|
|
2864
|
+
]),
|
|
2865
|
+
import_zod30.z.union([import_zod30.z.boolean(), import_zod30.z.unknown()])
|
|
2866
|
+
),
|
|
2867
|
+
markets: import_zod30.z.object({
|
|
2868
|
+
enabled: import_zod30.z.boolean()
|
|
2869
|
+
}),
|
|
2870
|
+
monetize: import_zod30.z.object({
|
|
2871
|
+
publisherKey: import_zod30.z.string().nullable()
|
|
2872
|
+
}).nullish(),
|
|
2873
|
+
moneyFormat: import_zod30.z.string(),
|
|
2874
|
+
myshopifyDomain: import_zod30.z.string(),
|
|
2875
|
+
primaryLocale: import_zod30.z.string(),
|
|
2876
|
+
productGroupsEnabled: import_zod30.z.enum(["no", "yes"]).transform((value) => value === "yes"),
|
|
2877
|
+
rechargeCustomDomain: import_zod30.z.string().nullable(),
|
|
2878
|
+
sellingPlansEnabled: import_zod30.z.boolean(),
|
|
2879
|
+
shopId: import_zod30.z.number(),
|
|
2880
|
+
shopifySellingPlansEnabled: import_zod30.z.boolean(),
|
|
2881
|
+
shopName: import_zod30.z.string(),
|
|
2882
|
+
storefrontAccessToken: import_zod30.z.string().nullable(),
|
|
2883
|
+
useRebuyIcons: import_zod30.z.boolean()
|
|
2884
|
+
});
|
|
2885
|
+
|
|
2886
|
+
// src/schema/userConfig.ts
|
|
2887
|
+
var import_zod31 = require("zod");
|
|
2888
|
+
var UserConfig = import_zod31.z.object({
|
|
2889
|
+
shop: ShopConfig,
|
|
2890
|
+
/**
|
|
2891
|
+
* `.catch(undefined)` is the safety bar: smart-cart shape drift can NEVER fail `fetchUserConfig`,
|
|
2892
|
+
* which resolves the apiKey for every offers/monetize/analytics/gift request.
|
|
2893
|
+
*/
|
|
2894
|
+
smartCart: SmartCartConfig.nullish().catch(void 0),
|
|
2895
|
+
smartFlows: import_zod31.z.array(import_zod31.z.unknown())
|
|
2896
|
+
});
|
|
2897
|
+
|
|
2898
|
+
// src/schema/widgetData.ts
|
|
2899
|
+
var import_zod59 = require("zod");
|
|
2900
|
+
|
|
2901
|
+
// src/schema/widgets/abTestingPlaceholder.ts
|
|
2902
|
+
var import_zod32 = require("zod");
|
|
2903
|
+
var ABTestingPlaceholder = import_zod32.z.looseObject({
|
|
2904
|
+
type: import_zod32.z.literal("placeholder")
|
|
2905
|
+
});
|
|
2906
|
+
|
|
2907
|
+
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
2908
|
+
var import_es_toolkit3 = require("es-toolkit");
|
|
2909
|
+
var DEFAULT_ENDPOINTS = [
|
|
2910
|
+
{ label: "Recommended (AI)", value: "/products/recommended" },
|
|
2911
|
+
{ label: "Top Sellers", value: "/products/top_sellers" },
|
|
2912
|
+
{ label: "Buy It Again", value: "/products/purchased" },
|
|
2913
|
+
{ label: "Recently Viewed", value: "/products/viewed" },
|
|
2914
|
+
{ label: "Products Search", value: "/products/search" },
|
|
2915
|
+
{ label: "Collection Products", value: "/products/collections" },
|
|
2916
|
+
{ label: "Similar Products (AI)", value: "/products/similar_products" }
|
|
2917
|
+
];
|
|
2918
|
+
var STATIC_ENDPOINTS = [
|
|
2919
|
+
{ label: "Recommended (AI)", value: "/products/recommended" },
|
|
2920
|
+
{ label: "Top Sellers", value: "/products/top_sellers" },
|
|
2921
|
+
{ label: "Trending Products", value: "/products/trending_products" },
|
|
2922
|
+
{ label: "Buy It Again", value: "/products/purchased" },
|
|
2923
|
+
{ label: "Collection Products", value: "/products/collections" },
|
|
2924
|
+
{ label: "Recently Viewed", value: "/products/viewed" },
|
|
2925
|
+
{ label: "Static Products", value: "/products/static" },
|
|
2926
|
+
{ label: "Products Search", value: "/products/search" },
|
|
2927
|
+
{ label: "Similar Products (AI)", value: "/products/similar_products" }
|
|
2928
|
+
];
|
|
2929
|
+
var COMBINED_ENDPOINTS = (0, import_es_toolkit3.uniqBy)([...DEFAULT_ENDPOINTS, ...STATIC_ENDPOINTS], (item) => item.value);
|
|
2930
|
+
var targetAreas = {
|
|
2931
|
+
[EditorMode.checkoutExtension]: [
|
|
2932
|
+
{ icon: "splitscreen_top", label: "Header Area", width: "984px" },
|
|
2933
|
+
{ icon: "splitscreen_left", label: "Main Column", width: "503px" },
|
|
2934
|
+
{ icon: "splitscreen_right", label: "Summary Column", width: "404px" }
|
|
2935
|
+
],
|
|
2936
|
+
[EditorMode.postPurchaseOffer]: null,
|
|
2937
|
+
[EditorMode.thankYouPage]: [
|
|
2938
|
+
{ icon: "splitscreen_top", label: "Header Area", width: "984px" },
|
|
2939
|
+
{ icon: "splitscreen_left", label: "Main Column", width: "503px" },
|
|
2940
|
+
{ icon: "splitscreen_right", label: "Summary Column", width: "404px" }
|
|
2941
|
+
],
|
|
2942
|
+
[EditorMode.orderStatusPage]: [
|
|
2943
|
+
// { fill: true, flip: 'vertical', icon: 'bottom_navigation', label: 'Announcement Bar' },
|
|
2944
|
+
{ icon: "splitscreen_top", label: "Header Area", width: "1124px" },
|
|
2945
|
+
{ fill: true, icon: "view_column_2", label: "Main Area", width: "646px" },
|
|
2946
|
+
{ icon: "splitscreen_bottom", label: "Footer Area", width: "1124px" }
|
|
2947
|
+
],
|
|
2948
|
+
[EditorMode.ordersIndexPage]: [
|
|
2949
|
+
// { fill: true, flip: 'vertical', icon: 'bottom_navigation', label: 'Announcement Bar' },
|
|
2950
|
+
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
2951
|
+
],
|
|
2952
|
+
[EditorMode.customerProfilePage]: [
|
|
2953
|
+
// { fill: true, flip: 'vertical', icon: 'bottom_navigation', label: 'Announcement Bar' },
|
|
2954
|
+
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
2955
|
+
]
|
|
2956
|
+
};
|
|
2957
|
+
|
|
2958
|
+
// src/schema/widgets/checkoutExtension.ts
|
|
2959
|
+
var import_zod33 = require("zod");
|
|
2960
|
+
var CheckoutExtension = import_zod33.z.looseObject({
|
|
2961
|
+
type: import_zod33.z.literal(WidgetType.shopify_checkout_extension).default(WidgetType.shopify_checkout_extension)
|
|
2962
|
+
});
|
|
2963
|
+
|
|
2964
|
+
// src/schema/widgets/contentBlock.ts
|
|
2965
|
+
var import_zod53 = require("zod");
|
|
2966
|
+
|
|
2967
|
+
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
2968
|
+
var import_zod52 = require("zod");
|
|
2969
|
+
|
|
2970
|
+
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
2971
|
+
var import_uuid15 = require("uuid");
|
|
2972
|
+
var import_zod51 = require("zod");
|
|
2973
|
+
|
|
2974
|
+
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
2975
|
+
var import_zod50 = require("zod");
|
|
2976
|
+
|
|
2977
|
+
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
2978
|
+
var import_zod34 = require("zod");
|
|
2979
|
+
var CABBannerSection = import_zod34.z.lazy(
|
|
2980
|
+
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
2981
|
+
buttonField: import_zod34.z.enum(buttonFields).optional(),
|
|
2982
|
+
color: import_zod34.z.enum(bannerColors).default("info"),
|
|
2983
|
+
dismissible: import_zod34.z.boolean().default(true),
|
|
2984
|
+
/**
|
|
2985
|
+
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
2986
|
+
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
2987
|
+
*
|
|
2988
|
+
* Merchant-composed buyer-facing plain text, so it rejects HTML at the boundary the same way
|
|
2989
|
+
* `CABImageSection.altText` and `CABTextSection.content` do (the unchecked localized records elsewhere —
|
|
2990
|
+
* `progressBar`'s gift labels, `reviews`' plurals — are converter/constant-sourced, not merchant input).
|
|
2991
|
+
*
|
|
2992
|
+
* The refinement is a last-resort ASSERTION, not the normalization boundary: `normalizeTextContent` only
|
|
2993
|
+
* rewrites `sectionType: 'text'` nodes' `content`, so nothing strips markup or canonicalizes `{token}`
|
|
2994
|
+
* here. A producer must strip upstream the way `composeOffer` does for `altText`. Get it wrong and
|
|
2995
|
+
* `salvageSections` stubs the whole banner (children included) with a drift report — degraded, reported,
|
|
2996
|
+
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
2997
|
+
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
2998
|
+
*/
|
|
2999
|
+
heading: import_zod34.z.record(import_zod34.z.string(), import_zod34.z.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
3000
|
+
sectionType: import_zod34.z.literal(SectionType.banner).default(SectionType.banner)
|
|
3001
|
+
})
|
|
3002
|
+
);
|
|
3003
|
+
|
|
3004
|
+
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
3005
|
+
var import_uuid5 = require("uuid");
|
|
3006
|
+
var import_zod36 = require("zod");
|
|
3007
|
+
|
|
3008
|
+
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
3009
|
+
var import_uuid4 = require("uuid");
|
|
3010
|
+
var import_zod35 = require("zod");
|
|
3011
|
+
|
|
3012
|
+
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
3013
|
+
var iconNames = [
|
|
3014
|
+
"alert-circle",
|
|
3015
|
+
"alert-triangle",
|
|
3016
|
+
"alert-triangle-filled",
|
|
3017
|
+
"arrow-down",
|
|
3018
|
+
"arrow-left",
|
|
3019
|
+
"arrow-right",
|
|
3020
|
+
"arrow-up",
|
|
3021
|
+
"arrow-up-right",
|
|
3022
|
+
"bag",
|
|
3023
|
+
"bullet",
|
|
3024
|
+
"calendar",
|
|
3025
|
+
"camera",
|
|
3026
|
+
"caret-down",
|
|
3027
|
+
"cart",
|
|
3028
|
+
"cash-dollar",
|
|
3029
|
+
"categories",
|
|
3030
|
+
"check",
|
|
3031
|
+
"check-circle",
|
|
3032
|
+
"check-circle-filled",
|
|
3033
|
+
"chevron-down",
|
|
3034
|
+
"chevron-left",
|
|
3035
|
+
"chevron-right",
|
|
3036
|
+
"chevron-up",
|
|
3037
|
+
"circle",
|
|
3038
|
+
"clipboard",
|
|
3039
|
+
"clock",
|
|
3040
|
+
"credit-card",
|
|
3041
|
+
"delete",
|
|
3042
|
+
"delivered",
|
|
3043
|
+
"delivery",
|
|
3044
|
+
"disabled",
|
|
3045
|
+
"discount",
|
|
3046
|
+
"edit",
|
|
3047
|
+
"email",
|
|
3048
|
+
"empty",
|
|
3049
|
+
"external",
|
|
3050
|
+
"filter",
|
|
3051
|
+
"geolocation",
|
|
3052
|
+
"gift-card",
|
|
3053
|
+
"globe",
|
|
3054
|
+
"grid",
|
|
3055
|
+
"image",
|
|
3056
|
+
"info",
|
|
3057
|
+
"info-filled",
|
|
3058
|
+
"list-bulleted",
|
|
3059
|
+
"location",
|
|
3060
|
+
"lock",
|
|
3061
|
+
"map",
|
|
3062
|
+
"menu",
|
|
3063
|
+
"menu-horizontal",
|
|
3064
|
+
"menu-vertical",
|
|
3065
|
+
"minus",
|
|
3066
|
+
"mobile",
|
|
3067
|
+
"note",
|
|
3068
|
+
"order",
|
|
3069
|
+
"organization",
|
|
3070
|
+
"plus",
|
|
3071
|
+
"profile",
|
|
3072
|
+
"question-circle",
|
|
3073
|
+
"question-circle-filled",
|
|
3074
|
+
"reorder",
|
|
3075
|
+
"reset",
|
|
3076
|
+
"return",
|
|
3077
|
+
"savings",
|
|
3078
|
+
"search",
|
|
3079
|
+
"settings",
|
|
3080
|
+
"star",
|
|
3081
|
+
"star-filled",
|
|
3082
|
+
"star-half",
|
|
3083
|
+
"store",
|
|
3084
|
+
"truck",
|
|
3085
|
+
"upload",
|
|
3086
|
+
"x",
|
|
3087
|
+
"x-circle",
|
|
3088
|
+
"x-circle-filled"
|
|
3089
|
+
];
|
|
3090
|
+
var IconName = freezeEnum(iconNames);
|
|
3091
|
+
var iconSizes = ["base", "large", "large-100", "small", "small-100", "small-200"];
|
|
3092
|
+
var IconSize = freezeEnum(iconSizes);
|
|
3093
|
+
var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "warning"];
|
|
3094
|
+
var IconTone = freezeEnum(iconTones);
|
|
3095
|
+
|
|
3096
|
+
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
3097
|
+
var CABImageSectionFields = import_zod35.z.object({
|
|
3098
|
+
...CABVariableFields,
|
|
3099
|
+
altText: import_zod35.z.string().refine(checkForHTML, NO_HTML).default(""),
|
|
3100
|
+
/**
|
|
3101
|
+
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
3102
|
+
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
3103
|
+
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
3104
|
+
*/
|
|
3105
|
+
aspectRatio: import_zod35.z.number().positive().nullable().default(null),
|
|
3106
|
+
border: import_zod35.z.lazy(() => CABBorder),
|
|
3107
|
+
buttonField: import_zod35.z.enum(buttonFields).optional(),
|
|
3108
|
+
/**
|
|
3109
|
+
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
3110
|
+
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
3111
|
+
* implementation — they were never significant to rendering (`icons`, plural, is NOT deprecated, just one of
|
|
3112
|
+
* those inert legacy tags); `icon` is the first value that means anything.
|
|
3113
|
+
*
|
|
3114
|
+
* INVARIANT, encoded by the `.superRefine` below (a refined object IS a valid `z.discriminatedUnion` member
|
|
3115
|
+
* in zod 4 — see `CABTextSection`): `category: 'icon'` ⇒ `source` is an icon name or `''` (icon not yet
|
|
3116
|
+
* chosen); any other category ⇒ `source` is NOT a bare icon name, so it stays a URL/token/`''`.
|
|
3117
|
+
*
|
|
3118
|
+
* Encoded rather than left to the renderer because `source` is ONE union with no category gate, so widening
|
|
3119
|
+
* it with `iconNames` also widened what a STORED payload may contain: 14 of the names are plain English
|
|
3120
|
+
* words (`image`, `x`, `search`, `note`, `order`, `globe`, …), and a legacy `source: 'image'` used to fail
|
|
3121
|
+
* parse — which `salvageSections` turns into a null-rendering stub PLUS a drift report. Ungated it would
|
|
3122
|
+
* instead parse and reach the renderer as `<img src="image">`: a broken image, silently, where the old
|
|
3123
|
+
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
3124
|
+
* the risky half.
|
|
3125
|
+
*/
|
|
3126
|
+
category: import_zod35.z.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
3127
|
+
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
3128
|
+
iconSize: import_zod35.z.enum(iconSizes).nullable().default(null),
|
|
3129
|
+
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
3130
|
+
iconTone: import_zod35.z.enum(iconTones).nullable().default(null),
|
|
3131
|
+
name: import_zod35.z.string().optional(),
|
|
3132
|
+
naturalHeight: import_zod35.z.number().default(0),
|
|
3133
|
+
naturalWidth: import_zod35.z.number().default(0),
|
|
3134
|
+
/**
|
|
3135
|
+
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
3136
|
+
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
3137
|
+
*/
|
|
3138
|
+
objectFit: import_zod35.z.enum(objectFits).default(ObjectFit.contain),
|
|
3139
|
+
sectionId: import_zod35.z.uuid().default(() => (0, import_uuid4.v7)()),
|
|
3140
|
+
sectionType: import_zod35.z.literal(SectionType.image).default(SectionType.image),
|
|
3141
|
+
/**
|
|
3142
|
+
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
3143
|
+
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
3144
|
+
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
3145
|
+
* server-chosen tier icon actually needs it.
|
|
3146
|
+
*/
|
|
3147
|
+
source: import_zod35.z.union([import_zod35.z.url(), import_zod35.z.literal(""), import_zod35.z.string().regex(DYNAMIC_TOKEN_REGEX), import_zod35.z.enum(iconNames)]).default(""),
|
|
3148
|
+
width: import_zod35.z.number().default(100)
|
|
3149
|
+
});
|
|
3150
|
+
var iconNameSet = new Set(iconNames);
|
|
3151
|
+
var isIconName = (source) => iconNameSet.has(source);
|
|
3152
|
+
var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, ctx) => {
|
|
3153
|
+
if (category === "icon" && source !== "" && !isIconName(source))
|
|
3154
|
+
ctx.addIssue({
|
|
3155
|
+
code: "custom",
|
|
3156
|
+
message: "icon-mode source must be an icon name",
|
|
3157
|
+
path: ["source"]
|
|
3158
|
+
});
|
|
3159
|
+
if (category !== "icon" && isIconName(source))
|
|
3160
|
+
ctx.addIssue({
|
|
3161
|
+
code: "custom",
|
|
3162
|
+
message: "source must be a URL or dynamic token unless category is `icon`",
|
|
3163
|
+
path: ["source"]
|
|
3164
|
+
});
|
|
2618
3165
|
});
|
|
2619
3166
|
|
|
2620
3167
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
2621
|
-
var CABButtonContent =
|
|
2622
|
-
() =>
|
|
3168
|
+
var CABButtonContent = import_zod36.z.lazy(
|
|
3169
|
+
() => import_zod36.z.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
2623
3170
|
);
|
|
2624
|
-
var CABButtonSection =
|
|
3171
|
+
var CABButtonSection = import_zod36.z.object({
|
|
2625
3172
|
...CABVariableFields,
|
|
2626
|
-
action:
|
|
2627
|
-
buttonStyle:
|
|
2628
|
-
custom:
|
|
2629
|
-
color:
|
|
2630
|
-
height:
|
|
2631
|
-
width:
|
|
3173
|
+
action: import_zod36.z.union([import_zod36.z.literal(""), import_zod36.z.enum(buttonActions)]).default(""),
|
|
3174
|
+
buttonStyle: import_zod36.z.enum(buttonStyles).default(ButtonStyle.primary),
|
|
3175
|
+
custom: import_zod36.z.object({
|
|
3176
|
+
color: import_zod36.z.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
3177
|
+
height: import_zod36.z.number().default(52),
|
|
3178
|
+
width: import_zod36.z.number().default(300)
|
|
2632
3179
|
}).default({
|
|
2633
3180
|
color: "#005bd3",
|
|
2634
3181
|
height: 52,
|
|
2635
3182
|
width: 300
|
|
2636
3183
|
}),
|
|
2637
|
-
disableDowngrade:
|
|
2638
|
-
name:
|
|
2639
|
-
optionId:
|
|
2640
|
-
popover:
|
|
2641
|
-
alignment:
|
|
2642
|
-
position:
|
|
3184
|
+
disableDowngrade: import_zod36.z.boolean().default(false),
|
|
3185
|
+
name: import_zod36.z.string().optional(),
|
|
3186
|
+
optionId: import_zod36.z.number().optional(),
|
|
3187
|
+
popover: import_zod36.z.object({
|
|
3188
|
+
alignment: import_zod36.z.enum(textAlignments).default(TextAlignment.center),
|
|
3189
|
+
position: import_zod36.z.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
2643
3190
|
}).optional().default(() => ({
|
|
2644
3191
|
alignment: TextAlignment.center,
|
|
2645
3192
|
position: PopoverPosition.blockStart
|
|
2646
3193
|
})),
|
|
2647
|
-
sectionId:
|
|
2648
|
-
sections:
|
|
2649
|
-
sectionType:
|
|
3194
|
+
sectionId: import_zod36.z.uuid().default(() => (0, import_uuid5.v7)()),
|
|
3195
|
+
sections: import_zod36.z.union([import_zod36.z.array(CABButtonContent), import_zod36.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3196
|
+
sectionType: import_zod36.z.literal(SectionType.button).default(SectionType.button),
|
|
2650
3197
|
/**
|
|
2651
3198
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
2652
3199
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -2661,91 +3208,91 @@ var CABButtonSection = import_zod25.z.object({
|
|
|
2661
3208
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
2662
3209
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
2663
3210
|
*/
|
|
2664
|
-
tier:
|
|
3211
|
+
tier: import_zod36.z.object({ tierId: import_zod36.z.string().min(1) }).optional(),
|
|
2665
3212
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
2666
|
-
trackingUrl:
|
|
3213
|
+
trackingUrl: import_zod36.z.string().optional(),
|
|
2667
3214
|
/**
|
|
2668
3215
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
2669
3216
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
2670
3217
|
*/
|
|
2671
|
-
variableEffects:
|
|
3218
|
+
variableEffects: import_zod36.z.array(CABVariableEffect).optional()
|
|
2672
3219
|
});
|
|
2673
3220
|
|
|
2674
3221
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
2675
|
-
var
|
|
3222
|
+
var import_zod41 = require("zod");
|
|
2676
3223
|
|
|
2677
3224
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
2678
|
-
var
|
|
3225
|
+
var import_zod40 = require("zod");
|
|
2679
3226
|
|
|
2680
3227
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
2681
|
-
var
|
|
2682
|
-
var
|
|
2683
|
-
var CABDiscount =
|
|
2684
|
-
amount:
|
|
2685
|
-
discountedBy:
|
|
2686
|
-
discountedFrom:
|
|
2687
|
-
type:
|
|
2688
|
-
});
|
|
2689
|
-
var CABIntegrations =
|
|
2690
|
-
judgeme:
|
|
2691
|
-
junip:
|
|
2692
|
-
klaviyo:
|
|
2693
|
-
loox:
|
|
2694
|
-
okendo:
|
|
2695
|
-
opinew:
|
|
2696
|
-
reviewsio:
|
|
2697
|
-
stamped:
|
|
2698
|
-
yotpo:
|
|
2699
|
-
});
|
|
2700
|
-
var CABDataSourceSection =
|
|
2701
|
-
dataSourceId:
|
|
2702
|
-
dataSourcePath:
|
|
3228
|
+
var import_uuid6 = require("uuid");
|
|
3229
|
+
var import_zod37 = require("zod");
|
|
3230
|
+
var CABDiscount = import_zod37.z.object({
|
|
3231
|
+
amount: import_zod37.z.union([import_zod37.z.number(), import_zod37.z.string()]).catch(0),
|
|
3232
|
+
discountedBy: import_zod37.z.string().optional(),
|
|
3233
|
+
discountedFrom: import_zod37.z.enum(discountSources).optional().catch(void 0),
|
|
3234
|
+
type: import_zod37.z.enum(discountTypes).catch("none")
|
|
3235
|
+
});
|
|
3236
|
+
var CABIntegrations = import_zod37.z.object({
|
|
3237
|
+
judgeme: import_zod37.z.boolean().default(false),
|
|
3238
|
+
junip: import_zod37.z.boolean().default(false),
|
|
3239
|
+
klaviyo: import_zod37.z.boolean().default(false),
|
|
3240
|
+
loox: import_zod37.z.boolean().default(false),
|
|
3241
|
+
okendo: import_zod37.z.boolean().default(false),
|
|
3242
|
+
opinew: import_zod37.z.boolean().default(false),
|
|
3243
|
+
reviewsio: import_zod37.z.boolean().default(false),
|
|
3244
|
+
stamped: import_zod37.z.boolean().default(false),
|
|
3245
|
+
yotpo: import_zod37.z.boolean().default(false)
|
|
3246
|
+
});
|
|
3247
|
+
var CABDataSourceSection = import_zod37.z.object({
|
|
3248
|
+
dataSourceId: import_zod37.z.number().nullable().default(null),
|
|
3249
|
+
dataSourcePath: import_zod37.z.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
2703
3250
|
discount: CABDiscount.optional(),
|
|
2704
3251
|
integrations: CABIntegrations.optional(),
|
|
2705
|
-
limit:
|
|
2706
|
-
matchVariant:
|
|
2707
|
-
matchVariantOutOfStock:
|
|
2708
|
-
name:
|
|
2709
|
-
productType:
|
|
2710
|
-
sectionId:
|
|
2711
|
-
sectionType:
|
|
3252
|
+
limit: import_zod37.z.number().default(1),
|
|
3253
|
+
matchVariant: import_zod37.z.boolean().default(false),
|
|
3254
|
+
matchVariantOutOfStock: import_zod37.z.boolean().default(false),
|
|
3255
|
+
name: import_zod37.z.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
3256
|
+
productType: import_zod37.z.enum(productTypes).optional(),
|
|
3257
|
+
sectionId: import_zod37.z.uuid().default(() => (0, import_uuid6.v7)()),
|
|
3258
|
+
sectionType: import_zod37.z.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
2712
3259
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
2713
|
-
subscriptionIsDefault:
|
|
2714
|
-
treatAsGwp:
|
|
3260
|
+
subscriptionIsDefault: import_zod37.z.boolean().default(false),
|
|
3261
|
+
treatAsGwp: import_zod37.z.boolean().default(false)
|
|
2715
3262
|
});
|
|
2716
3263
|
|
|
2717
3264
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
2718
|
-
var
|
|
2719
|
-
var
|
|
3265
|
+
var import_uuid8 = require("uuid");
|
|
3266
|
+
var import_zod39 = require("zod");
|
|
2720
3267
|
|
|
2721
3268
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
2722
|
-
var
|
|
2723
|
-
var
|
|
2724
|
-
var CABVariantContent =
|
|
2725
|
-
() =>
|
|
3269
|
+
var import_uuid7 = require("uuid");
|
|
3270
|
+
var import_zod38 = require("zod");
|
|
3271
|
+
var CABVariantContent = import_zod38.z.lazy(
|
|
3272
|
+
() => import_zod38.z.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
2726
3273
|
);
|
|
2727
|
-
var CABProductSection =
|
|
3274
|
+
var CABProductSection = import_zod38.z.object({
|
|
2728
3275
|
...CABVariableFields,
|
|
2729
|
-
name:
|
|
2730
|
-
productId:
|
|
2731
|
-
sectionId:
|
|
2732
|
-
sections:
|
|
2733
|
-
sectionType:
|
|
2734
|
-
selectors:
|
|
2735
|
-
variantMode:
|
|
3276
|
+
name: import_zod38.z.string().optional(),
|
|
3277
|
+
productId: import_zod38.z.number().nullable().default(null),
|
|
3278
|
+
sectionId: import_zod38.z.uuid().default(() => (0, import_uuid7.v7)()),
|
|
3279
|
+
sections: import_zod38.z.union([import_zod38.z.array(CABVariantContent), import_zod38.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3280
|
+
sectionType: import_zod38.z.literal(SectionType.product).default(SectionType.product),
|
|
3281
|
+
selectors: import_zod38.z.record(import_zod38.z.string(), import_zod38.z.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
3282
|
+
variantMode: import_zod38.z.enum(variantModes).default(VariantMode.multiple)
|
|
2736
3283
|
});
|
|
2737
3284
|
|
|
2738
3285
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
2739
|
-
var CABProductsSection =
|
|
3286
|
+
var CABProductsSection = import_zod39.z.object({
|
|
2740
3287
|
...CABVariableFields,
|
|
2741
|
-
name:
|
|
2742
|
-
sectionId:
|
|
2743
|
-
sections:
|
|
2744
|
-
sectionType:
|
|
3288
|
+
name: import_zod39.z.string().optional(),
|
|
3289
|
+
sectionId: import_zod39.z.uuid().default(() => (0, import_uuid8.v7)()),
|
|
3290
|
+
sections: import_zod39.z.union([import_zod39.z.array(import_zod39.z.lazy(() => CABProductSection)), import_zod39.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3291
|
+
sectionType: import_zod39.z.literal(SectionType.products).default(SectionType.products)
|
|
2745
3292
|
});
|
|
2746
3293
|
|
|
2747
3294
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
2748
|
-
var CABOffersSection =
|
|
3295
|
+
var CABOffersSection = import_zod40.z.lazy(
|
|
2749
3296
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
2750
3297
|
/**
|
|
2751
3298
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -2753,8 +3300,8 @@ var CABOffersSection = import_zod29.z.lazy(
|
|
|
2753
3300
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
2754
3301
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
2755
3302
|
*/
|
|
2756
|
-
divider:
|
|
2757
|
-
sections:
|
|
3303
|
+
divider: import_zod40.z.boolean().optional(),
|
|
3304
|
+
sections: import_zod40.z.union([import_zod40.z.array(import_zod40.z.lazy(() => CABSection)), import_zod40.z.strictObject({}).transform(() => [])]).default(() => [
|
|
2758
3305
|
CABBannerSection.parse({
|
|
2759
3306
|
buttonField: "undoAddToOrder",
|
|
2760
3307
|
color: "success",
|
|
@@ -2768,77 +3315,77 @@ var CABOffersSection = import_zod29.z.lazy(
|
|
|
2768
3315
|
CABDataSourceSection.parse({}),
|
|
2769
3316
|
CABProductsSection.parse({})
|
|
2770
3317
|
]),
|
|
2771
|
-
sectionType:
|
|
3318
|
+
sectionType: import_zod40.z.literal(SectionType.offers).default(SectionType.offers)
|
|
2772
3319
|
})
|
|
2773
3320
|
);
|
|
2774
3321
|
|
|
2775
3322
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
2776
|
-
var CABCarouselSection =
|
|
3323
|
+
var CABCarouselSection = import_zod41.z.lazy(
|
|
2777
3324
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
2778
|
-
autoAdvanceInterval:
|
|
2779
|
-
itemsAtOnce:
|
|
3325
|
+
autoAdvanceInterval: import_zod41.z.number().default(0),
|
|
3326
|
+
itemsAtOnce: import_zod41.z.number().min(1).default(1),
|
|
2780
3327
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
2781
|
-
offersDirection:
|
|
2782
|
-
sections:
|
|
2783
|
-
sectionType:
|
|
3328
|
+
offersDirection: import_zod41.z.enum(offersDirections).default("vertical"),
|
|
3329
|
+
sections: import_zod41.z.union([import_zod41.z.array(import_zod41.z.lazy(() => CABSection)), import_zod41.z.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
3330
|
+
sectionType: import_zod41.z.literal(SectionType.carousel).default(SectionType.carousel)
|
|
2784
3331
|
})
|
|
2785
3332
|
);
|
|
2786
3333
|
|
|
2787
3334
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
2788
|
-
var
|
|
2789
|
-
var CABCartLineSection =
|
|
3335
|
+
var import_zod42 = require("zod");
|
|
3336
|
+
var CABCartLineSection = import_zod42.z.lazy(
|
|
2790
3337
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
2791
|
-
sections:
|
|
2792
|
-
sectionType:
|
|
3338
|
+
sections: import_zod42.z.union([import_zod42.z.array(import_zod42.z.lazy(() => CABSection)), import_zod42.z.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
3339
|
+
sectionType: import_zod42.z.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
2793
3340
|
})
|
|
2794
3341
|
);
|
|
2795
3342
|
|
|
2796
3343
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
2797
|
-
var
|
|
2798
|
-
var
|
|
2799
|
-
var CABDiscountSection =
|
|
3344
|
+
var import_uuid9 = require("uuid");
|
|
3345
|
+
var import_zod43 = require("zod");
|
|
3346
|
+
var CABDiscountSection = import_zod43.z.object({
|
|
2800
3347
|
...CABVariableFields,
|
|
2801
|
-
amount:
|
|
2802
|
-
discountedBy:
|
|
2803
|
-
discountedFrom:
|
|
2804
|
-
message:
|
|
2805
|
-
name:
|
|
2806
|
-
quantity:
|
|
2807
|
-
sectionId:
|
|
2808
|
-
sectionType:
|
|
2809
|
-
type:
|
|
3348
|
+
amount: import_zod43.z.union([import_zod43.z.number(), import_zod43.z.string()]).catch(0),
|
|
3349
|
+
discountedBy: import_zod43.z.string().optional(),
|
|
3350
|
+
discountedFrom: import_zod43.z.enum(discountSources).optional().catch(void 0),
|
|
3351
|
+
message: import_zod43.z.string().optional(),
|
|
3352
|
+
name: import_zod43.z.string().optional(),
|
|
3353
|
+
quantity: import_zod43.z.number().default(1),
|
|
3354
|
+
sectionId: import_zod43.z.uuid().default(() => (0, import_uuid9.v7)()),
|
|
3355
|
+
sectionType: import_zod43.z.literal(SectionType.discount).default(SectionType.discount),
|
|
3356
|
+
type: import_zod43.z.enum(discountTypes).catch("none")
|
|
2810
3357
|
});
|
|
2811
3358
|
|
|
2812
3359
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
2813
|
-
var
|
|
2814
|
-
var
|
|
2815
|
-
var CABMonetizeAds =
|
|
2816
|
-
requestId:
|
|
3360
|
+
var import_uuid10 = require("uuid");
|
|
3361
|
+
var import_zod44 = require("zod");
|
|
3362
|
+
var CABMonetizeAds = import_zod44.z.object({
|
|
3363
|
+
requestId: import_zod44.z.string().optional(),
|
|
2817
3364
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
2818
|
-
testing:
|
|
3365
|
+
testing: import_zod44.z.boolean().default(false)
|
|
2819
3366
|
});
|
|
2820
|
-
var CABMonetizeSection =
|
|
3367
|
+
var CABMonetizeSection = import_zod44.z.object({
|
|
2821
3368
|
...CABVariableFields,
|
|
2822
3369
|
ads: CABMonetizeAds.optional(),
|
|
2823
|
-
name:
|
|
3370
|
+
name: import_zod44.z.string().optional(),
|
|
2824
3371
|
/**
|
|
2825
3372
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
2826
3373
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
2827
3374
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
2828
3375
|
*/
|
|
2829
|
-
offers:
|
|
3376
|
+
offers: import_zod44.z.array(import_zod44.z.lazy(() => CABSection)).optional(),
|
|
2830
3377
|
/** Privacy Policy footer href (the widget's `privacy_policy_url` setting); read server-side for hydration, relayed by the client only on the legacy `/cab/monetize` fallback. */
|
|
2831
|
-
privacyPolicyUrl:
|
|
2832
|
-
sectionId:
|
|
2833
|
-
sectionType:
|
|
3378
|
+
privacyPolicyUrl: import_zod44.z.string().optional(),
|
|
3379
|
+
sectionId: import_zod44.z.uuid().default(() => (0, import_uuid10.v7)()),
|
|
3380
|
+
sectionType: import_zod44.z.literal(SectionType.monetize).default(SectionType.monetize),
|
|
2834
3381
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
2835
|
-
subVertical:
|
|
3382
|
+
subVertical: import_zod44.z.string().optional(),
|
|
2836
3383
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
2837
|
-
vertical:
|
|
3384
|
+
vertical: import_zod44.z.string().optional()
|
|
2838
3385
|
});
|
|
2839
3386
|
|
|
2840
3387
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
2841
|
-
var
|
|
3388
|
+
var import_zod45 = require("zod");
|
|
2842
3389
|
|
|
2843
3390
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
2844
3391
|
var GIFT_LABELS = {
|
|
@@ -2957,34 +3504,34 @@ var GIFT_LABELS = {
|
|
|
2957
3504
|
};
|
|
2958
3505
|
|
|
2959
3506
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
2960
|
-
var CABProgressTierExclusion =
|
|
2961
|
-
collectionIds:
|
|
2962
|
-
productIds:
|
|
2963
|
-
tags:
|
|
2964
|
-
type:
|
|
3507
|
+
var CABProgressTierExclusion = import_zod45.z.object({
|
|
3508
|
+
collectionIds: import_zod45.z.array(import_zod45.z.number().int().positive()).default(() => []),
|
|
3509
|
+
productIds: import_zod45.z.array(import_zod45.z.number().int().positive()).default(() => []),
|
|
3510
|
+
tags: import_zod45.z.array(import_zod45.z.string().min(1)).default(() => []),
|
|
3511
|
+
type: import_zod45.z.enum(progressTierExclusionTypes)
|
|
2965
3512
|
});
|
|
2966
|
-
var CABProgressTier =
|
|
3513
|
+
var CABProgressTier = import_zod45.z.object({
|
|
2967
3514
|
/**
|
|
2968
3515
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
2969
3516
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
2970
3517
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
2971
3518
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
2972
3519
|
*/
|
|
2973
|
-
discount:
|
|
3520
|
+
discount: import_zod45.z.object({ amount: import_zod45.z.number().nonnegative(), type: import_zod45.z.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
2974
3521
|
/**
|
|
2975
3522
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
2976
3523
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
2977
3524
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
2978
3525
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
2979
3526
|
*/
|
|
2980
|
-
exclusions:
|
|
3527
|
+
exclusions: import_zod45.z.array(CABProgressTierExclusion).default(() => []),
|
|
2981
3528
|
/**
|
|
2982
3529
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
2983
3530
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
2984
3531
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
2985
3532
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
2986
3533
|
*/
|
|
2987
|
-
filterOosVariants:
|
|
3534
|
+
filterOosVariants: import_zod45.z.boolean().default(false),
|
|
2988
3535
|
/**
|
|
2989
3536
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
2990
3537
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -2992,10 +3539,10 @@ var CABProgressTier = import_zod34.z.object({
|
|
|
2992
3539
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
2993
3540
|
* tree is complete.
|
|
2994
3541
|
*/
|
|
2995
|
-
gift:
|
|
2996
|
-
productId:
|
|
2997
|
-
title:
|
|
2998
|
-
variantIds:
|
|
3542
|
+
gift: import_zod45.z.object({
|
|
3543
|
+
productId: import_zod45.z.number().int().positive(),
|
|
3544
|
+
title: import_zod45.z.string().optional(),
|
|
3545
|
+
variantIds: import_zod45.z.array(import_zod45.z.number().int().positive()).default(() => [])
|
|
2999
3546
|
}).optional(),
|
|
3000
3547
|
/**
|
|
3001
3548
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -3015,7 +3562,7 @@ var CABProgressTier = import_zod34.z.object({
|
|
|
3015
3562
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
3016
3563
|
* React's size rather than the old hardcoded 20.
|
|
3017
3564
|
*/
|
|
3018
|
-
iconSizePx:
|
|
3565
|
+
iconSizePx: import_zod45.z.number().int().min(1).max(64).default(18),
|
|
3019
3566
|
/**
|
|
3020
3567
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
3021
3568
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -3025,35 +3572,35 @@ var CABProgressTier = import_zod34.z.object({
|
|
|
3025
3572
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
3026
3573
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
3027
3574
|
*/
|
|
3028
|
-
label:
|
|
3575
|
+
label: import_zod45.z.record(import_zod45.z.string(), import_zod45.z.string()).optional(),
|
|
3029
3576
|
/**
|
|
3030
3577
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
3031
3578
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
3032
3579
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
3033
3580
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
3034
3581
|
*/
|
|
3035
|
-
productTierImage:
|
|
3582
|
+
productTierImage: import_zod45.z.boolean().default(false),
|
|
3036
3583
|
/**
|
|
3037
3584
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
3038
3585
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
3039
3586
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
3040
3587
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
3041
3588
|
*/
|
|
3042
|
-
threshold:
|
|
3589
|
+
threshold: import_zod45.z.number().int().nonnegative(),
|
|
3043
3590
|
/**
|
|
3044
3591
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
3045
3592
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
3046
3593
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
3047
3594
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
3048
3595
|
*/
|
|
3049
|
-
thresholds:
|
|
3596
|
+
thresholds: import_zod45.z.record(import_zod45.z.string(), import_zod45.z.number().int().nonnegative()).default(() => ({})),
|
|
3050
3597
|
/**
|
|
3051
3598
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
3052
3599
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
3053
3600
|
* shipping bar (single unlabeled tier, no gift).
|
|
3054
3601
|
*/
|
|
3055
|
-
tierId:
|
|
3056
|
-
tierType:
|
|
3602
|
+
tierId: import_zod45.z.string().optional(),
|
|
3603
|
+
tierType: import_zod45.z.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
3057
3604
|
/**
|
|
3058
3605
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
3059
3606
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -3064,9 +3611,9 @@ var CABProgressTier = import_zod34.z.object({
|
|
|
3064
3611
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
3065
3612
|
* template text supplies grammatically-neutral wording around the token.
|
|
3066
3613
|
*/
|
|
3067
|
-
unit:
|
|
3614
|
+
unit: import_zod45.z.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
3068
3615
|
});
|
|
3069
|
-
var CABProgressBarSection =
|
|
3616
|
+
var CABProgressBarSection = import_zod45.z.lazy(
|
|
3070
3617
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
3071
3618
|
/**
|
|
3072
3619
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -3075,35 +3622,35 @@ var CABProgressBarSection = import_zod34.z.lazy(
|
|
|
3075
3622
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
3076
3623
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
3077
3624
|
*/
|
|
3078
|
-
barId:
|
|
3625
|
+
barId: import_zod45.z.string().optional(),
|
|
3079
3626
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
3080
|
-
countryCodes:
|
|
3627
|
+
countryCodes: import_zod45.z.array(import_zod45.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3081
3628
|
/**
|
|
3082
3629
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
3083
3630
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
3084
3631
|
*/
|
|
3085
|
-
excludeCountryCodes:
|
|
3632
|
+
excludeCountryCodes: import_zod45.z.array(import_zod45.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3086
3633
|
/**
|
|
3087
3634
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
3088
3635
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
3089
3636
|
* adds the cart's discount allocations back to the live subtotal.
|
|
3090
3637
|
*/
|
|
3091
|
-
excludeDiscountInSubtotal:
|
|
3638
|
+
excludeDiscountInSubtotal: import_zod45.z.boolean().default(false),
|
|
3092
3639
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
3093
|
-
excludedVariantIds:
|
|
3640
|
+
excludedVariantIds: import_zod45.z.array(import_zod45.z.number().int().positive()).default(() => []),
|
|
3094
3641
|
/**
|
|
3095
3642
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
3096
3643
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
3097
3644
|
*/
|
|
3098
|
-
freeShippingOnSubscription:
|
|
3645
|
+
freeShippingOnSubscription: import_zod45.z.boolean().default(false),
|
|
3099
3646
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
3100
|
-
giftAreaTitle:
|
|
3647
|
+
giftAreaTitle: import_zod45.z.record(import_zod45.z.string(), import_zod45.z.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
3101
3648
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
3102
|
-
giftLabels:
|
|
3103
|
-
addGift:
|
|
3104
|
-
remove:
|
|
3105
|
-
selectOptions:
|
|
3106
|
-
yourGift:
|
|
3649
|
+
giftLabels: import_zod45.z.object({
|
|
3650
|
+
addGift: import_zod45.z.record(import_zod45.z.string(), import_zod45.z.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
3651
|
+
remove: import_zod45.z.record(import_zod45.z.string(), import_zod45.z.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
3652
|
+
selectOptions: import_zod45.z.record(import_zod45.z.string(), import_zod45.z.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
3653
|
+
yourGift: import_zod45.z.record(import_zod45.z.string(), import_zod45.z.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
3107
3654
|
}).default(() => ({
|
|
3108
3655
|
addGift: { ...GIFT_LABELS.addGift },
|
|
3109
3656
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -3111,38 +3658,38 @@ var CABProgressBarSection = import_zod34.z.lazy(
|
|
|
3111
3658
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
3112
3659
|
})),
|
|
3113
3660
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
3114
|
-
name:
|
|
3661
|
+
name: import_zod45.z.string().default("Order progress"),
|
|
3115
3662
|
/**
|
|
3116
3663
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
3117
3664
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
3118
3665
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
3119
3666
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
3120
3667
|
*/
|
|
3121
|
-
progressColor:
|
|
3122
|
-
sectionType:
|
|
3668
|
+
progressColor: import_zod45.z.string().optional(),
|
|
3669
|
+
sectionType: import_zod45.z.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
3123
3670
|
/**
|
|
3124
3671
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
3125
3672
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
3126
3673
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
3127
3674
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
3128
3675
|
*/
|
|
3129
|
-
tiers:
|
|
3676
|
+
tiers: import_zod45.z.union([import_zod45.z.array(CABProgressTier), import_zod45.z.strictObject({}).transform(() => [])]).default(() => [])
|
|
3130
3677
|
})
|
|
3131
3678
|
);
|
|
3132
3679
|
|
|
3133
3680
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
3134
|
-
var
|
|
3135
|
-
var
|
|
3136
|
-
var CABQuantitySection =
|
|
3681
|
+
var import_uuid11 = require("uuid");
|
|
3682
|
+
var import_zod46 = require("zod");
|
|
3683
|
+
var CABQuantitySection = import_zod46.z.object({
|
|
3137
3684
|
...CABVariableFields,
|
|
3138
|
-
errorMessages:
|
|
3139
|
-
|
|
3140
|
-
|
|
3685
|
+
errorMessages: import_zod46.z.record(
|
|
3686
|
+
import_zod46.z.string(),
|
|
3687
|
+
import_zod46.z.object({
|
|
3141
3688
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
3142
|
-
increment:
|
|
3143
|
-
max:
|
|
3144
|
-
min:
|
|
3145
|
-
neg:
|
|
3689
|
+
increment: import_zod46.z.string().optional(),
|
|
3690
|
+
max: import_zod46.z.string().optional(),
|
|
3691
|
+
min: import_zod46.z.string().optional(),
|
|
3692
|
+
neg: import_zod46.z.string().optional()
|
|
3146
3693
|
})
|
|
3147
3694
|
).default({
|
|
3148
3695
|
en: {
|
|
@@ -3152,18 +3699,18 @@ var CABQuantitySection = import_zod35.z.object({
|
|
|
3152
3699
|
neg: "Quantity cannot be negative"
|
|
3153
3700
|
}
|
|
3154
3701
|
}),
|
|
3155
|
-
inputType:
|
|
3156
|
-
max:
|
|
3157
|
-
min:
|
|
3702
|
+
inputType: import_zod46.z.enum(quantityInputs).default(QuantityInput.select),
|
|
3703
|
+
max: import_zod46.z.number().min(1).max(100).default(10),
|
|
3704
|
+
min: import_zod46.z.number().min(1).default(1),
|
|
3158
3705
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
3159
|
-
name:
|
|
3160
|
-
sectionId:
|
|
3161
|
-
sectionType:
|
|
3706
|
+
name: import_zod46.z.string().default("Quantity"),
|
|
3707
|
+
sectionId: import_zod46.z.uuid().default(() => (0, import_uuid11.v7)()),
|
|
3708
|
+
sectionType: import_zod46.z.literal(SectionType.quantity).default(SectionType.quantity)
|
|
3162
3709
|
});
|
|
3163
3710
|
|
|
3164
3711
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3165
|
-
var
|
|
3166
|
-
var
|
|
3712
|
+
var import_uuid12 = require("uuid");
|
|
3713
|
+
var import_zod47 = require("zod");
|
|
3167
3714
|
|
|
3168
3715
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
3169
3716
|
var REVIEW_LABELS = {
|
|
@@ -3226,68 +3773,68 @@ var REVIEW_LABELS = {
|
|
|
3226
3773
|
};
|
|
3227
3774
|
|
|
3228
3775
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3229
|
-
var CABReviewsSection =
|
|
3776
|
+
var CABReviewsSection = import_zod47.z.object({
|
|
3230
3777
|
...CABVariableFields,
|
|
3231
|
-
color:
|
|
3778
|
+
color: import_zod47.z.string().default("#fadb14"),
|
|
3232
3779
|
/**
|
|
3233
3780
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
3234
3781
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
3235
3782
|
* or merchant work.
|
|
3236
3783
|
*/
|
|
3237
|
-
countLabels:
|
|
3238
|
-
one:
|
|
3239
|
-
other:
|
|
3784
|
+
countLabels: import_zod47.z.object({
|
|
3785
|
+
one: import_zod47.z.record(import_zod47.z.string(), import_zod47.z.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
3786
|
+
other: import_zod47.z.record(import_zod47.z.string(), import_zod47.z.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
3240
3787
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
3241
|
-
name:
|
|
3242
|
-
sectionId:
|
|
3243
|
-
sectionType:
|
|
3244
|
-
size:
|
|
3788
|
+
name: import_zod47.z.string().optional(),
|
|
3789
|
+
sectionId: import_zod47.z.uuid().default(() => (0, import_uuid12.v7)()),
|
|
3790
|
+
sectionType: import_zod47.z.literal(SectionType.reviews).default(SectionType.reviews),
|
|
3791
|
+
size: import_zod47.z.enum(reviewsSizes).default(ReviewsSize.default),
|
|
3245
3792
|
/**
|
|
3246
3793
|
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
3247
3794
|
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
3248
3795
|
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
3249
3796
|
* the whole reviews section.
|
|
3250
3797
|
*/
|
|
3251
|
-
strokeColor:
|
|
3798
|
+
strokeColor: import_zod47.z.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
3252
3799
|
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
3253
|
-
strokeWidth:
|
|
3800
|
+
strokeWidth: import_zod47.z.number().nonnegative().default(0)
|
|
3254
3801
|
});
|
|
3255
3802
|
|
|
3256
3803
|
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
3257
|
-
var
|
|
3258
|
-
var
|
|
3259
|
-
var CABSeparatorSection =
|
|
3804
|
+
var import_uuid13 = require("uuid");
|
|
3805
|
+
var import_zod48 = require("zod");
|
|
3806
|
+
var CABSeparatorSection = import_zod48.z.object({
|
|
3260
3807
|
...CABVariableFields,
|
|
3261
|
-
sectionId:
|
|
3262
|
-
sectionType:
|
|
3808
|
+
sectionId: import_zod48.z.uuid().default(() => (0, import_uuid13.v7)()),
|
|
3809
|
+
sectionType: import_zod48.z.literal(SectionType.separator).default(SectionType.separator)
|
|
3263
3810
|
});
|
|
3264
3811
|
|
|
3265
3812
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
3266
|
-
var
|
|
3267
|
-
var
|
|
3268
|
-
var
|
|
3269
|
-
var CABVariantsSection =
|
|
3813
|
+
var import_compat5 = require("es-toolkit/compat");
|
|
3814
|
+
var import_uuid14 = require("uuid");
|
|
3815
|
+
var import_zod49 = require("zod");
|
|
3816
|
+
var CABVariantsSection = import_zod49.z.object({
|
|
3270
3817
|
...CABVariableFields,
|
|
3271
|
-
hideOutOfStockVariants:
|
|
3272
|
-
name:
|
|
3273
|
-
sectionId:
|
|
3274
|
-
sectionType:
|
|
3275
|
-
selector:
|
|
3276
|
-
variantMode:
|
|
3818
|
+
hideOutOfStockVariants: import_zod49.z.boolean().default(false),
|
|
3819
|
+
name: import_zod49.z.string().optional(),
|
|
3820
|
+
sectionId: import_zod49.z.uuid().default(() => (0, import_uuid14.v7)()),
|
|
3821
|
+
sectionType: import_zod49.z.literal(SectionType.variants).default(SectionType.variants),
|
|
3822
|
+
selector: import_zod49.z.enum((0, import_compat5.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
3823
|
+
variantMode: import_zod49.z.enum(variantModes).default(VariantMode.multiple)
|
|
3277
3824
|
});
|
|
3278
3825
|
|
|
3279
3826
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
3280
|
-
var CABBorder =
|
|
3281
|
-
radius:
|
|
3282
|
-
style:
|
|
3283
|
-
width:
|
|
3827
|
+
var CABBorder = import_zod50.z.object({
|
|
3828
|
+
radius: import_zod50.z.enum(borderRadii).default(BorderRadius.base),
|
|
3829
|
+
style: import_zod50.z.enum(borderStyles).default(BorderStyle.none),
|
|
3830
|
+
width: import_zod50.z.enum(borderWidths).default(BorderWidth.base)
|
|
3284
3831
|
}).default({
|
|
3285
3832
|
radius: BorderRadius.base,
|
|
3286
3833
|
style: BorderStyle.none,
|
|
3287
3834
|
width: BorderWidth.base
|
|
3288
3835
|
});
|
|
3289
|
-
var CABSection =
|
|
3290
|
-
() =>
|
|
3836
|
+
var CABSection = import_zod50.z.lazy(
|
|
3837
|
+
() => import_zod50.z.discriminatedUnion("sectionType", [
|
|
3291
3838
|
CABBannerSection,
|
|
3292
3839
|
CABButtonSection,
|
|
3293
3840
|
CABCarouselSection,
|
|
@@ -3310,41 +3857,41 @@ var CABSection = import_zod39.z.lazy(
|
|
|
3310
3857
|
);
|
|
3311
3858
|
|
|
3312
3859
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
3313
|
-
var GridItem =
|
|
3314
|
-
var CABLayoutWrapping =
|
|
3315
|
-
breakAt:
|
|
3316
|
-
maxPerLine:
|
|
3860
|
+
var GridItem = import_zod51.z.union([import_zod51.z.literal("auto"), import_zod51.z.literal("fill"), import_zod51.z.string().regex(/^\d+%$/), import_zod51.z.number()]);
|
|
3861
|
+
var CABLayoutWrapping = import_zod51.z.object({
|
|
3862
|
+
breakAt: import_zod51.z.number().positive(),
|
|
3863
|
+
maxPerLine: import_zod51.z.number().int().positive()
|
|
3317
3864
|
});
|
|
3318
|
-
var CABLayoutSection =
|
|
3865
|
+
var CABLayoutSection = import_zod51.z.object({
|
|
3319
3866
|
...CABVariableFields,
|
|
3320
|
-
alignment:
|
|
3321
|
-
horizontal:
|
|
3322
|
-
vertical:
|
|
3867
|
+
alignment: import_zod51.z.object({
|
|
3868
|
+
horizontal: import_zod51.z.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
3869
|
+
vertical: import_zod51.z.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
3323
3870
|
}).default({
|
|
3324
3871
|
horizontal: HorizontalAlignment.start,
|
|
3325
3872
|
vertical: VerticalAlignment.top
|
|
3326
3873
|
}),
|
|
3327
|
-
border:
|
|
3328
|
-
buttonField:
|
|
3329
|
-
direction:
|
|
3874
|
+
border: import_zod51.z.lazy(() => CABBorder),
|
|
3875
|
+
buttonField: import_zod51.z.enum(buttonFields).optional(),
|
|
3876
|
+
direction: import_zod51.z.enum(directions).default(Direction.rows),
|
|
3330
3877
|
/**
|
|
3331
3878
|
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
3332
3879
|
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
3333
3880
|
*/
|
|
3334
|
-
frame:
|
|
3335
|
-
grid:
|
|
3336
|
-
columns:
|
|
3337
|
-
rows:
|
|
3881
|
+
frame: import_zod51.z.enum(layoutFrames).optional(),
|
|
3882
|
+
grid: import_zod51.z.object({
|
|
3883
|
+
columns: import_zod51.z.union([import_zod51.z.array(GridItem), import_zod51.z.undefined()]).default(() => ["auto"]),
|
|
3884
|
+
rows: import_zod51.z.union([import_zod51.z.array(GridItem), import_zod51.z.undefined()]).default(() => ["auto"])
|
|
3338
3885
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
3339
|
-
name:
|
|
3340
|
-
padding:
|
|
3341
|
-
sectionId:
|
|
3342
|
-
sections:
|
|
3343
|
-
sectionType:
|
|
3344
|
-
spacing:
|
|
3886
|
+
name: import_zod51.z.string().optional(),
|
|
3887
|
+
padding: import_zod51.z.enum(spacings).default(Spacing.none),
|
|
3888
|
+
sectionId: import_zod51.z.uuid().default(() => (0, import_uuid15.v7)()),
|
|
3889
|
+
sections: import_zod51.z.union([import_zod51.z.array(import_zod51.z.lazy(() => CABSection)), import_zod51.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3890
|
+
sectionType: import_zod51.z.literal(SectionType.layout).default(SectionType.layout),
|
|
3891
|
+
spacing: import_zod51.z.enum(spacings).default(Spacing.base),
|
|
3345
3892
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
3346
|
-
viewUrl:
|
|
3347
|
-
width:
|
|
3893
|
+
viewUrl: import_zod51.z.string().optional(),
|
|
3894
|
+
width: import_zod51.z.number().default(100),
|
|
3348
3895
|
wrapping: CABLayoutWrapping.optional()
|
|
3349
3896
|
});
|
|
3350
3897
|
|
|
@@ -3366,8 +3913,8 @@ var UI_LABELS = {
|
|
|
3366
3913
|
};
|
|
3367
3914
|
|
|
3368
3915
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
3369
|
-
var localized = (fallback) =>
|
|
3370
|
-
var CABUILabels =
|
|
3916
|
+
var localized = (fallback) => import_zod52.z.record(import_zod52.z.string(), import_zod52.z.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
3917
|
+
var CABUILabels = import_zod52.z.object({
|
|
3371
3918
|
currentPage: localized(UI_LABELS.currentPage),
|
|
3372
3919
|
guest: localized(UI_LABELS.guest),
|
|
3373
3920
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -3392,154 +3939,154 @@ var CABUILabels = import_zod41.z.object({
|
|
|
3392
3939
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
3393
3940
|
updating: { ...UI_LABELS.updating }
|
|
3394
3941
|
}));
|
|
3395
|
-
var TargetArea =
|
|
3396
|
-
fill:
|
|
3397
|
-
flip:
|
|
3398
|
-
icon:
|
|
3399
|
-
label:
|
|
3400
|
-
width:
|
|
3942
|
+
var TargetArea = import_zod52.z.object({
|
|
3943
|
+
fill: import_zod52.z.boolean().optional(),
|
|
3944
|
+
flip: import_zod52.z.enum(["both", "horizontal", "vertical"]).optional(),
|
|
3945
|
+
icon: import_zod52.z.string(),
|
|
3946
|
+
label: import_zod52.z.string(),
|
|
3947
|
+
width: import_zod52.z.string()
|
|
3401
3948
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
3402
|
-
var CABTracking =
|
|
3403
|
-
enableAttribution:
|
|
3404
|
-
enableSource:
|
|
3405
|
-
enableWidget:
|
|
3949
|
+
var CABTracking = import_zod52.z.object({
|
|
3950
|
+
enableAttribution: import_zod52.z.boolean().nullish().transform((value) => value ?? true),
|
|
3951
|
+
enableSource: import_zod52.z.boolean().nullish().transform((value) => value ?? true),
|
|
3952
|
+
enableWidget: import_zod52.z.boolean().nullish().transform((value) => value ?? true)
|
|
3406
3953
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
3407
|
-
var CABExperiment =
|
|
3408
|
-
elementId:
|
|
3409
|
-
experimentId:
|
|
3410
|
-
experimentType:
|
|
3411
|
-
selectedId:
|
|
3954
|
+
var CABExperiment = import_zod52.z.object({
|
|
3955
|
+
elementId: import_zod52.z.number(),
|
|
3956
|
+
experimentId: import_zod52.z.number(),
|
|
3957
|
+
experimentType: import_zod52.z.string(),
|
|
3958
|
+
selectedId: import_zod52.z.number()
|
|
3412
3959
|
});
|
|
3413
3960
|
var CABRootSection = CABLayoutSection.extend({
|
|
3414
|
-
editorMode:
|
|
3961
|
+
editorMode: import_zod52.z.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
3415
3962
|
experiment: CABExperiment.optional(),
|
|
3416
3963
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
3417
3964
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
3418
|
-
previewMode:
|
|
3419
|
-
storeId:
|
|
3965
|
+
previewMode: import_zod52.z.boolean().nullish().transform((value) => value ?? false),
|
|
3966
|
+
storeId: import_zod52.z.number().nullable().default(null),
|
|
3420
3967
|
targetArea: TargetArea.nullable(),
|
|
3421
3968
|
tracking: CABTracking,
|
|
3422
|
-
type:
|
|
3969
|
+
type: import_zod52.z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
3423
3970
|
uiLabels: CABUILabels,
|
|
3424
|
-
version:
|
|
3425
|
-
widgetId:
|
|
3971
|
+
version: import_zod52.z.literal(2).default(2),
|
|
3972
|
+
widgetId: import_zod52.z.number().nullable().default(null)
|
|
3426
3973
|
});
|
|
3427
3974
|
|
|
3428
3975
|
// src/schema/widgets/contentBlock.ts
|
|
3429
|
-
var ContentBlockV1 =
|
|
3430
|
-
blockSpacing:
|
|
3431
|
-
imageBlocks:
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
altText:
|
|
3435
|
-
description:
|
|
3436
|
-
id:
|
|
3437
|
-
imagePlacement:
|
|
3438
|
-
imageSize:
|
|
3439
|
-
imageUrl:
|
|
3440
|
-
textAlignment:
|
|
3976
|
+
var ContentBlockV1 = import_zod53.z.object({
|
|
3977
|
+
blockSpacing: import_zod53.z.enum(spacings).optional(),
|
|
3978
|
+
imageBlocks: import_zod53.z.union([
|
|
3979
|
+
import_zod53.z.array(
|
|
3980
|
+
import_zod53.z.object({
|
|
3981
|
+
altText: import_zod53.z.string().nullable(),
|
|
3982
|
+
description: import_zod53.z.string().nullable(),
|
|
3983
|
+
id: import_zod53.z.uuid(),
|
|
3984
|
+
imagePlacement: import_zod53.z.enum(["top", "right", "bottom", "left"]),
|
|
3985
|
+
imageSize: import_zod53.z.number(),
|
|
3986
|
+
imageUrl: import_zod53.z.url(),
|
|
3987
|
+
textAlignment: import_zod53.z.enum(["left", "center", "right"]),
|
|
3441
3988
|
/** Inline scale only: an image caption can never be a block-level heading. */
|
|
3442
|
-
textSize:
|
|
3989
|
+
textSize: import_zod53.z.enum(inlineTextSizeNames)
|
|
3443
3990
|
})
|
|
3444
3991
|
),
|
|
3445
|
-
|
|
3992
|
+
import_zod53.z.strictObject({}).transform(() => [])
|
|
3446
3993
|
]).optional(),
|
|
3447
|
-
imageLayout:
|
|
3448
|
-
language:
|
|
3449
|
-
description:
|
|
3450
|
-
superTitle:
|
|
3451
|
-
title:
|
|
3994
|
+
imageLayout: import_zod53.z.enum(["row", "column"]).optional(),
|
|
3995
|
+
language: import_zod53.z.object({
|
|
3996
|
+
description: import_zod53.z.string(),
|
|
3997
|
+
superTitle: import_zod53.z.string(),
|
|
3998
|
+
title: import_zod53.z.string()
|
|
3452
3999
|
}),
|
|
3453
|
-
previewMode:
|
|
3454
|
-
type:
|
|
3455
|
-
version:
|
|
4000
|
+
previewMode: import_zod53.z.boolean(),
|
|
4001
|
+
type: import_zod53.z.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block),
|
|
4002
|
+
version: import_zod53.z.literal(1)
|
|
3456
4003
|
});
|
|
3457
|
-
var ContentBlock =
|
|
4004
|
+
var ContentBlock = import_zod53.z.discriminatedUnion("version", [
|
|
3458
4005
|
ContentBlockV1,
|
|
3459
4006
|
CABRootSection.extend({
|
|
3460
|
-
type:
|
|
4007
|
+
type: import_zod53.z.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block)
|
|
3461
4008
|
})
|
|
3462
4009
|
]);
|
|
3463
4010
|
|
|
3464
4011
|
// src/schema/widgets/giftWithPurchase.ts
|
|
3465
|
-
var
|
|
3466
|
-
var GiftWithPurchase =
|
|
3467
|
-
type:
|
|
4012
|
+
var import_zod54 = require("zod");
|
|
4013
|
+
var GiftWithPurchase = import_zod54.z.looseObject({
|
|
4014
|
+
type: import_zod54.z.literal(WidgetType.gift_with_purchase).default(WidgetType.gift_with_purchase)
|
|
3468
4015
|
});
|
|
3469
4016
|
|
|
3470
4017
|
// src/schema/widgets/lineItemEditor.ts
|
|
3471
|
-
var
|
|
3472
|
-
var LineItemEditorSwitchLanguageV1 =
|
|
3473
|
-
downgradeToOneTimeLabel:
|
|
4018
|
+
var import_zod55 = require("zod");
|
|
4019
|
+
var LineItemEditorSwitchLanguageV1 = import_zod55.z.object({
|
|
4020
|
+
downgradeToOneTimeLabel: import_zod55.z.string().optional(),
|
|
3474
4021
|
/** Frequency-option template (`{{frequency}}`/`{{interval}}`) for the plan select. */
|
|
3475
|
-
subscriptionOptionLabel:
|
|
3476
|
-
upgradeToSubscriptionLabel:
|
|
3477
|
-
upgradeToSubscriptionWithoutDiscountLabel:
|
|
4022
|
+
subscriptionOptionLabel: import_zod55.z.string().optional(),
|
|
4023
|
+
upgradeToSubscriptionLabel: import_zod55.z.string().optional(),
|
|
4024
|
+
upgradeToSubscriptionWithoutDiscountLabel: import_zod55.z.string().optional()
|
|
3478
4025
|
});
|
|
3479
|
-
var LineItemEditorV1 =
|
|
4026
|
+
var LineItemEditorV1 = import_zod55.z.object({
|
|
3480
4027
|
/** Legacy `getStyles` button style; the converter carries a valid kind, defaulting to `plain`. */
|
|
3481
|
-
button:
|
|
3482
|
-
previewMode:
|
|
3483
|
-
switchToSubscription:
|
|
3484
|
-
disableDowngrade:
|
|
4028
|
+
button: import_zod55.z.object({ kind: import_zod55.z.enum(["plain", "primary", "secondary"]).optional() }).optional(),
|
|
4029
|
+
previewMode: import_zod55.z.boolean().optional(),
|
|
4030
|
+
switchToSubscription: import_zod55.z.object({
|
|
4031
|
+
disableDowngrade: import_zod55.z.boolean().optional(),
|
|
3485
4032
|
language: LineItemEditorSwitchLanguageV1.optional()
|
|
3486
4033
|
}).optional(),
|
|
3487
|
-
switchToSubscriptionEnabled:
|
|
3488
|
-
tracking:
|
|
3489
|
-
enableAttribution:
|
|
3490
|
-
enableSource:
|
|
3491
|
-
enableWidget:
|
|
4034
|
+
switchToSubscriptionEnabled: import_zod55.z.boolean().optional(),
|
|
4035
|
+
tracking: import_zod55.z.object({
|
|
4036
|
+
enableAttribution: import_zod55.z.boolean().optional(),
|
|
4037
|
+
enableSource: import_zod55.z.boolean().optional(),
|
|
4038
|
+
enableWidget: import_zod55.z.boolean().optional()
|
|
3492
4039
|
}).optional(),
|
|
3493
|
-
type:
|
|
3494
|
-
version:
|
|
4040
|
+
type: import_zod55.z.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor),
|
|
4041
|
+
version: import_zod55.z.literal(1)
|
|
3495
4042
|
});
|
|
3496
|
-
var LineItemEditor =
|
|
4043
|
+
var LineItemEditor = import_zod55.z.discriminatedUnion("version", [
|
|
3497
4044
|
LineItemEditorV1,
|
|
3498
4045
|
CABRootSection.extend({
|
|
3499
|
-
type:
|
|
4046
|
+
type: import_zod55.z.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor)
|
|
3500
4047
|
})
|
|
3501
4048
|
]);
|
|
3502
4049
|
|
|
3503
4050
|
// src/schema/widgets/progressBar.ts
|
|
3504
|
-
var
|
|
3505
|
-
var ProgressBar =
|
|
3506
|
-
type:
|
|
4051
|
+
var import_zod56 = require("zod");
|
|
4052
|
+
var ProgressBar = import_zod56.z.looseObject({
|
|
4053
|
+
type: import_zod56.z.literal(WidgetType.ui_extension_progress_bar).default(WidgetType.ui_extension_progress_bar)
|
|
3507
4054
|
});
|
|
3508
4055
|
|
|
3509
4056
|
// src/schema/widgets/rebuyButton.ts
|
|
3510
|
-
var
|
|
3511
|
-
var RebuyButtonV1 =
|
|
3512
|
-
type:
|
|
3513
|
-
version:
|
|
4057
|
+
var import_zod57 = require("zod");
|
|
4058
|
+
var RebuyButtonV1 = import_zod57.z.looseObject({
|
|
4059
|
+
type: import_zod57.z.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button),
|
|
4060
|
+
version: import_zod57.z.literal(1)
|
|
3514
4061
|
});
|
|
3515
|
-
var RebuyButton =
|
|
4062
|
+
var RebuyButton = import_zod57.z.discriminatedUnion("version", [
|
|
3516
4063
|
RebuyButtonV1,
|
|
3517
4064
|
CABRootSection.extend({
|
|
3518
|
-
type:
|
|
4065
|
+
type: import_zod57.z.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button)
|
|
3519
4066
|
})
|
|
3520
4067
|
]);
|
|
3521
4068
|
|
|
3522
4069
|
// src/schema/widgets/rebuyMonetize.ts
|
|
3523
|
-
var
|
|
3524
|
-
var RebuyMonetize =
|
|
3525
|
-
type:
|
|
4070
|
+
var import_zod58 = require("zod");
|
|
4071
|
+
var RebuyMonetize = import_zod58.z.looseObject({
|
|
4072
|
+
type: import_zod58.z.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad)
|
|
3526
4073
|
});
|
|
3527
|
-
var RebuyMonetizeV1 =
|
|
3528
|
-
name:
|
|
3529
|
-
previewMode:
|
|
4074
|
+
var RebuyMonetizeV1 = import_zod58.z.object({
|
|
4075
|
+
name: import_zod58.z.string().nullable().optional(),
|
|
4076
|
+
previewMode: import_zod58.z.boolean().optional(),
|
|
3530
4077
|
/** Privacy Policy footer href → the marker section's `privacyPolicyUrl`. */
|
|
3531
|
-
privacyPolicyUrl:
|
|
4078
|
+
privacyPolicyUrl: import_zod58.z.string().nullable().optional(),
|
|
3532
4079
|
/** Ads-taxonomy sub-vertical id — one of the admin Monetize editor's two configurables. */
|
|
3533
|
-
subVertical:
|
|
3534
|
-
tracking:
|
|
3535
|
-
enableAttribution:
|
|
3536
|
-
enableSource:
|
|
3537
|
-
enableWidget:
|
|
4080
|
+
subVertical: import_zod58.z.string().nullable().optional(),
|
|
4081
|
+
tracking: import_zod58.z.object({
|
|
4082
|
+
enableAttribution: import_zod58.z.boolean().optional(),
|
|
4083
|
+
enableSource: import_zod58.z.boolean().optional(),
|
|
4084
|
+
enableWidget: import_zod58.z.boolean().optional()
|
|
3538
4085
|
}).optional(),
|
|
3539
|
-
type:
|
|
3540
|
-
version:
|
|
4086
|
+
type: import_zod58.z.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad),
|
|
4087
|
+
version: import_zod58.z.literal(1),
|
|
3541
4088
|
/** Ads-taxonomy vertical id — one of the admin Monetize editor's two configurables. */
|
|
3542
|
-
vertical:
|
|
4089
|
+
vertical: import_zod58.z.string().nullable().optional()
|
|
3543
4090
|
});
|
|
3544
4091
|
|
|
3545
4092
|
// src/schema/widgetData.ts
|
|
@@ -3553,7 +4100,7 @@ var extensionWidgetTypes = [
|
|
|
3553
4100
|
WidgetType.ui_extension_line_item_editor,
|
|
3554
4101
|
WidgetType.ui_extension_progress_bar
|
|
3555
4102
|
];
|
|
3556
|
-
var WidgetData =
|
|
4103
|
+
var WidgetData = import_zod59.z.discriminatedUnion("type", [
|
|
3557
4104
|
ABTestingPlaceholder,
|
|
3558
4105
|
CheckoutExtension,
|
|
3559
4106
|
ContentBlock,
|
|
@@ -3912,391 +4459,37 @@ var SWITCH_LABELS = {
|
|
|
3912
4459
|
}
|
|
3913
4460
|
};
|
|
3914
4461
|
|
|
3915
|
-
// src/schema/widgets/post-purchase-offer/common.ts
|
|
3916
|
-
var import_compat4 = require("es-toolkit/compat");
|
|
3917
|
-
var import_zod49 = require("zod");
|
|
3918
|
-
var strictNumber = import_zod49.z.union([
|
|
3919
|
-
import_zod49.z.number(),
|
|
3920
|
-
import_zod49.z.string().transform((value) => (0, import_compat4.toNumber)((0, import_compat4.replace)((0, import_compat4.toString)(value), /[^0-9.]/g, "")) || 0),
|
|
3921
|
-
import_zod49.z.unknown().transform(() => 0)
|
|
3922
|
-
]);
|
|
3923
|
-
|
|
3924
|
-
// src/schema/widgets/post-purchase-offer/constants.ts
|
|
3925
|
-
var import_zod50 = require("zod");
|
|
3926
|
-
var blockTypes = [
|
|
3927
|
-
"callout_banner",
|
|
3928
|
-
"image",
|
|
3929
|
-
"image_content",
|
|
3930
|
-
"pay_button",
|
|
3931
|
-
"product_information",
|
|
3932
|
-
"separator",
|
|
3933
|
-
"text",
|
|
3934
|
-
"timer"
|
|
3935
|
-
];
|
|
3936
|
-
var blockType = import_zod50.z.enum(blockTypes);
|
|
3937
|
-
var BlockType = blockType.enum;
|
|
3938
|
-
|
|
3939
|
-
// src/schema/widgets/post-purchase-offer/postPurchaseBlocks.ts
|
|
3940
|
-
var import_compat5 = require("es-toolkit/compat");
|
|
3941
|
-
var import_uuid15 = require("uuid");
|
|
3942
|
-
var import_zod51 = require("zod");
|
|
3943
|
-
var TextAlignment2 = import_zod51.z.union([import_zod51.z.enum(["leading", "center", "trailing"]), import_zod51.z.unknown().transform(() => "leading")]);
|
|
3944
|
-
var TextSize = import_zod51.z.union([
|
|
3945
|
-
import_zod51.z.enum(["xsmall", "small", "base", "default", "medium", "large", "xlarge"]),
|
|
3946
|
-
import_zod51.z.unknown().transform(() => "medium")
|
|
3947
|
-
]);
|
|
3948
|
-
var CalloutBannerBlock = import_zod51.z.object({
|
|
3949
|
-
id: import_zod51.z.string().optional().default(() => (0, import_uuid15.v4)()),
|
|
3950
|
-
name: import_zod51.z.string().optional(),
|
|
3951
|
-
settings: import_zod51.z.object({
|
|
3952
|
-
superTitle: import_zod51.z.union([import_zod51.z.string(), TiptapDocument]).default(() => "Limited-time Offer"),
|
|
3953
|
-
title: import_zod51.z.union([import_zod51.z.string(), TiptapDocument]).default(() => "Add this customer favorite to your order")
|
|
3954
|
-
}),
|
|
3955
|
-
styles: import_zod51.z.object({
|
|
3956
|
-
superTitleEmphasized: import_zod51.z.boolean().default(false),
|
|
3957
|
-
superTitleSize: TextSize.default("large"),
|
|
3958
|
-
textAlignment: TextAlignment2.default("center"),
|
|
3959
|
-
titleEmphasized: import_zod51.z.boolean().default(true),
|
|
3960
|
-
titleSize: TextSize.default("large")
|
|
3961
|
-
}),
|
|
3962
|
-
type: import_zod51.z.literal(BlockType.callout_banner).default(BlockType.callout_banner)
|
|
3963
|
-
});
|
|
3964
|
-
var ImageBlock = import_zod51.z.object({
|
|
3965
|
-
id: import_zod51.z.string().optional().default(() => (0, import_uuid15.v4)()),
|
|
3966
|
-
name: import_zod51.z.string().optional(),
|
|
3967
|
-
settings: import_zod51.z.union([
|
|
3968
|
-
import_zod51.z.object({
|
|
3969
|
-
/** This isn't used in the post-purchase offer widget */
|
|
3970
|
-
alt: import_zod51.z.string().optional().default(""),
|
|
3971
|
-
image: import_zod51.z.union([import_zod51.z.literal(""), import_zod51.z.url()]).default(""),
|
|
3972
|
-
imageSize: import_zod51.z.number().default(20),
|
|
3973
|
-
imageType: import_zod51.z.enum(["URL", "UPLOAD"]).default("URL")
|
|
3974
|
-
}),
|
|
3975
|
-
import_zod51.z.array(import_zod51.z.never()).transform(() => ({}))
|
|
3976
|
-
]),
|
|
3977
|
-
type: import_zod51.z.literal(BlockType.image).default(BlockType.image)
|
|
3978
|
-
});
|
|
3979
|
-
var ImageContentBlock = import_zod51.z.object({
|
|
3980
|
-
id: import_zod51.z.string().optional().default(() => (0, import_uuid15.v4)()),
|
|
3981
|
-
name: import_zod51.z.string().optional(),
|
|
3982
|
-
settings: import_zod51.z.object({
|
|
3983
|
-
alt: import_zod51.z.string().optional().default(""),
|
|
3984
|
-
description: import_zod51.z.union([import_zod51.z.string(), TiptapDocument, import_zod51.z.null()]).default(
|
|
3985
|
-
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
|
3986
|
-
),
|
|
3987
|
-
descriptionSize: TextSize.default("medium"),
|
|
3988
|
-
horizontalAlignment: TextAlignment2.default("leading"),
|
|
3989
|
-
image: import_zod51.z.union([import_zod51.z.literal(""), import_zod51.z.url()]).default(""),
|
|
3990
|
-
imagePlacement: import_zod51.z.enum(["bottom", "left", "right", "top"]).optional().default("left"),
|
|
3991
|
-
imageSize: import_zod51.z.number().default(20),
|
|
3992
|
-
superTitle: import_zod51.z.union([import_zod51.z.string(), TiptapDocument]).default("Lorem Ipsum!"),
|
|
3993
|
-
superTitleSize: TextSize.default("medium"),
|
|
3994
|
-
/** This isn't configurable in the admin-nextjs editor */
|
|
3995
|
-
swapContent: import_zod51.z.boolean().optional().default(false),
|
|
3996
|
-
title: import_zod51.z.union([import_zod51.z.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet"),
|
|
3997
|
-
titleSize: TextSize.default("medium")
|
|
3998
|
-
}),
|
|
3999
|
-
type: import_zod51.z.literal(BlockType.image_content).default(BlockType.image_content)
|
|
4000
|
-
});
|
|
4001
|
-
var PayButtonBlock = import_zod51.z.object({
|
|
4002
|
-
id: import_zod51.z.string().optional().default(() => (0, import_uuid15.v4)()),
|
|
4003
|
-
name: import_zod51.z.string().optional(),
|
|
4004
|
-
settings: import_zod51.z.union([
|
|
4005
|
-
import_zod51.z.object({
|
|
4006
|
-
label: import_zod51.z.string().default("Pay Now")
|
|
4007
|
-
}),
|
|
4008
|
-
import_zod51.z.array(import_zod51.z.never()).transform(() => ({
|
|
4009
|
-
label: "Pay Now"
|
|
4010
|
-
}))
|
|
4011
|
-
]),
|
|
4012
|
-
styles: import_zod51.z.union([
|
|
4013
|
-
import_zod51.z.object({
|
|
4014
|
-
buttonWidth: import_zod51.z.number().min(10).max(100).default(50)
|
|
4015
|
-
}),
|
|
4016
|
-
import_zod51.z.array(import_zod51.z.never()).transform(() => ({
|
|
4017
|
-
buttonWidth: 50
|
|
4018
|
-
}))
|
|
4019
|
-
]),
|
|
4020
|
-
type: import_zod51.z.literal(BlockType.pay_button).default(BlockType.pay_button)
|
|
4021
|
-
});
|
|
4022
|
-
var ProductInformationBlock = import_zod51.z.object({
|
|
4023
|
-
/** This isn't configurable in the admin-nextjs editor */
|
|
4024
|
-
hideProductImage: import_zod51.z.boolean().optional().default(false),
|
|
4025
|
-
id: import_zod51.z.string().optional().default(() => (0, import_uuid15.v4)()),
|
|
4026
|
-
name: import_zod51.z.string().optional(),
|
|
4027
|
-
type: import_zod51.z.literal(BlockType.product_information).default(BlockType.product_information)
|
|
4028
|
-
});
|
|
4029
|
-
var SeparatorBlock = import_zod51.z.object({
|
|
4030
|
-
id: import_zod51.z.string().optional().default(() => (0, import_uuid15.v4)()),
|
|
4031
|
-
name: import_zod51.z.string().optional(),
|
|
4032
|
-
type: import_zod51.z.literal(BlockType.separator).default(BlockType.separator)
|
|
4033
|
-
});
|
|
4034
|
-
var TextBlock = import_zod51.z.object({
|
|
4035
|
-
id: import_zod51.z.string().optional().default(() => (0, import_uuid15.v4)()),
|
|
4036
|
-
name: import_zod51.z.string().optional(),
|
|
4037
|
-
settings: import_zod51.z.object({
|
|
4038
|
-
description: import_zod51.z.union([import_zod51.z.string(), TiptapDocument]).optional().default(
|
|
4039
|
-
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
|
4040
|
-
),
|
|
4041
|
-
/** This isn't used in the post-purchase offer widget */
|
|
4042
|
-
descriptionSize: TextSize.default("medium"),
|
|
4043
|
-
horizontalAlignment: TextAlignment2.default("leading"),
|
|
4044
|
-
superTitle: import_zod51.z.union([import_zod51.z.string(), TiptapDocument]).default("Super Title"),
|
|
4045
|
-
/** This isn't used in the post-purchase offer widget */
|
|
4046
|
-
superTitleSize: TextSize.default("medium"),
|
|
4047
|
-
title: import_zod51.z.union([import_zod51.z.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet."),
|
|
4048
|
-
/** This isn't used in the post-purchase offer widget */
|
|
4049
|
-
titleSize: TextSize.default("medium")
|
|
4050
|
-
}),
|
|
4051
|
-
type: import_zod51.z.literal(BlockType.text).default(BlockType.text)
|
|
4052
|
-
});
|
|
4053
|
-
var TimerBlock = import_zod51.z.object({
|
|
4054
|
-
id: import_zod51.z.string().optional().default(() => (0, import_uuid15.v4)()),
|
|
4055
|
-
name: import_zod51.z.string().optional(),
|
|
4056
|
-
settings: import_zod51.z.object({
|
|
4057
|
-
durationMinutes: import_zod51.z.number().min(0).default(10),
|
|
4058
|
-
durationSeconds: import_zod51.z.union([import_zod51.z.number().min(0), import_zod51.z.unknown().transform(() => 0)]).default(0),
|
|
4059
|
-
endOffer: import_zod51.z.boolean().default(true),
|
|
4060
|
-
title: import_zod51.z.union([import_zod51.z.string(), TiptapDocument]).default("Hurry \u2014 your special offer ends in:")
|
|
4061
|
-
}),
|
|
4062
|
-
styles: import_zod51.z.object({
|
|
4063
|
-
textAlignment: TextAlignment2.default("center"),
|
|
4064
|
-
timerBackgroundColor: import_zod51.z.enum(["info", "warning", "success", "critical"]).default("warning"),
|
|
4065
|
-
timerEmphasized: import_zod51.z.union([import_zod51.z.boolean(), import_zod51.z.unknown().transform(() => true)]).default(true),
|
|
4066
|
-
timerSize: TextSize.default("medium"),
|
|
4067
|
-
timerWidth: import_zod51.z.number().min(10).max(100).optional().default(100),
|
|
4068
|
-
titleEmphasized: import_zod51.z.union([import_zod51.z.boolean(), import_zod51.z.unknown().transform(() => true)]).default(false),
|
|
4069
|
-
titleSize: TextSize.default("medium")
|
|
4070
|
-
}),
|
|
4071
|
-
type: import_zod51.z.literal(BlockType.timer).default(BlockType.timer)
|
|
4072
|
-
});
|
|
4073
|
-
var PostPurchaseBlock = import_zod51.z.discriminatedUnion("type", [
|
|
4074
|
-
CalloutBannerBlock,
|
|
4075
|
-
ImageBlock,
|
|
4076
|
-
ImageContentBlock,
|
|
4077
|
-
PayButtonBlock,
|
|
4078
|
-
ProductInformationBlock,
|
|
4079
|
-
SeparatorBlock,
|
|
4080
|
-
TextBlock,
|
|
4081
|
-
TimerBlock
|
|
4082
|
-
]);
|
|
4083
|
-
var isCalloutBannerBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.callout_banner);
|
|
4084
|
-
var isImageBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.image);
|
|
4085
|
-
var isImageContentBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.image_content);
|
|
4086
|
-
var isPayButtonBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.pay_button);
|
|
4087
|
-
var isProductInformationBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.product_information);
|
|
4088
|
-
var isSeparatorBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.separator);
|
|
4089
|
-
var isTextBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.text);
|
|
4090
|
-
var isTimerBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.timer);
|
|
4091
|
-
|
|
4092
4462
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
4093
|
-
var
|
|
4463
|
+
var import_zod61 = require("zod");
|
|
4094
4464
|
|
|
4095
4465
|
// src/schema/widgets/post-purchase-offer/postPurchaseWidget.ts
|
|
4096
|
-
var
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
var PostPurchaseSettings = import_zod52.z.object({
|
|
4101
|
-
advance: import_zod52.z.object({ removePartialOrder: import_zod52.z.boolean().default(true) }).optional().default(() => ({ removePartialOrder: true })),
|
|
4102
|
-
blocks: import_zod52.z.union([import_zod52.z.array(PostPurchaseBlock), import_zod52.z.unknown().transform(() => [])]).default(() => [
|
|
4103
|
-
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.timer }),
|
|
4104
|
-
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.callout_banner }),
|
|
4105
|
-
PostPurchaseBlock.parse({ type: BlockType.product_information })
|
|
4106
|
-
]),
|
|
4107
|
-
columnLayout: import_zod52.z.boolean().optional(),
|
|
4108
|
-
discount: import_zod52.z.object({
|
|
4109
|
-
amount: strictNumber.default(30),
|
|
4110
|
-
shouldShowSavingText: import_zod52.z.boolean().optional().default(true),
|
|
4111
|
-
type: import_zod52.z.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
4112
|
-
}),
|
|
4113
|
-
discountedFrom: import_zod52.z.enum(["price", "compare_at_price"]).optional().default("price"),
|
|
4114
|
-
endpoint: import_zod52.z.string().optional(),
|
|
4115
|
-
integrations: import_zod52.z.object({
|
|
4116
|
-
judgeme: import_zod52.z.boolean().default(false),
|
|
4117
|
-
junip: import_zod52.z.boolean().optional().default(false),
|
|
4118
|
-
klaviyo: import_zod52.z.boolean().default(false),
|
|
4119
|
-
loox: import_zod52.z.boolean().default(false),
|
|
4120
|
-
okendo: import_zod52.z.boolean().default(false),
|
|
4121
|
-
opinew: import_zod52.z.boolean().optional().default(false),
|
|
4122
|
-
reviewsio: import_zod52.z.boolean().optional().default(false),
|
|
4123
|
-
stamped: import_zod52.z.boolean().default(false),
|
|
4124
|
-
yotpo: import_zod52.z.boolean().default(false)
|
|
4125
|
-
}),
|
|
4126
|
-
key: import_zod52.z.string().optional(),
|
|
4127
|
-
language: import_zod52.z.object({
|
|
4128
|
-
description: import_zod52.z.union([import_zod52.z.string(), import_zod52.z.unknown().transform(() => "")]).default(""),
|
|
4129
|
-
descriptionEnabled: import_zod52.z.boolean().optional().default(false),
|
|
4130
|
-
descriptionRte: import_zod52.z.object({
|
|
4131
|
-
content: import_zod52.z.array(import_zod52.z.unknown()),
|
|
4132
|
-
type: import_zod52.z.string()
|
|
4133
|
-
}).optional(),
|
|
4134
|
-
descriptionSpacing: import_zod52.z.enum(["none", "xtight", "tight", "default", "loose", "xloose"]).optional(),
|
|
4135
|
-
displayCtaPrice: import_zod52.z.boolean().default(true),
|
|
4136
|
-
global: import_zod52.z.object({
|
|
4137
|
-
declineAll: import_zod52.z.string().optional().default("Decline All"),
|
|
4138
|
-
declineThisOffer: import_zod52.z.string().default("Decline this offer"),
|
|
4139
|
-
free: import_zod52.z.string().optional().default("Free"),
|
|
4140
|
-
notAvailable: import_zod52.z.string().optional().default("Not available"),
|
|
4141
|
-
payNow: import_zod52.z.string().default("Pay Now"),
|
|
4142
|
-
payNowUpgradeToSubscription: import_zod52.z.string().optional().default("Upgrade to Subscription"),
|
|
4143
|
-
quantity: import_zod52.z.string().default("Quantity"),
|
|
4144
|
-
/** This isn't configurable in the admin-nextjs editor */
|
|
4145
|
-
recurringShipping: import_zod52.z.string().optional().default("Recurring shipping"),
|
|
4146
|
-
recurringSubtotal: import_zod52.z.string().default("Recurring subtotal"),
|
|
4147
|
-
reviewsPlural: import_zod52.z.string().optional().default("Reviews"),
|
|
4148
|
-
reviewsSingular: import_zod52.z.string().optional().default("Review"),
|
|
4149
|
-
save: import_zod52.z.union([import_zod52.z.string(), import_zod52.z.unknown().transform(() => "Save")]).optional().default("Save"),
|
|
4150
|
-
shipping: import_zod52.z.string().default("Shipping"),
|
|
4151
|
-
subscriptionOption: import_zod52.z.string().optional().default("Subscribe and Save"),
|
|
4152
|
-
subtotal: import_zod52.z.string().default("Subtotal"),
|
|
4153
|
-
taxes: import_zod52.z.string().default("Taxes"),
|
|
4154
|
-
total: import_zod52.z.string().default("Total")
|
|
4155
|
-
}).optional().default(() => ({
|
|
4156
|
-
declineAll: "Decline All",
|
|
4157
|
-
declineThisOffer: "Decline this offer",
|
|
4158
|
-
free: "Free",
|
|
4159
|
-
notAvailable: "Not available",
|
|
4160
|
-
payNow: "Pay Now",
|
|
4161
|
-
payNowUpgradeToSubscription: "Upgrade to Subscription",
|
|
4162
|
-
quantity: "Quantity",
|
|
4163
|
-
/** This isn't configurable in the admin-nextjs editor */
|
|
4164
|
-
recurringShipping: "Recurring shipping",
|
|
4165
|
-
recurringSubtotal: "Recurring subtotal",
|
|
4166
|
-
reviewsPlural: "Reviews",
|
|
4167
|
-
reviewsSingular: "Review",
|
|
4168
|
-
save: "Save",
|
|
4169
|
-
shipping: "Shipping",
|
|
4170
|
-
subscriptionOption: "Subscribe and Save",
|
|
4171
|
-
subtotal: "Subtotal",
|
|
4172
|
-
taxes: "Taxes",
|
|
4173
|
-
total: "Total"
|
|
4174
|
-
})),
|
|
4175
|
-
globalTranslation: import_zod52.z.string().optional().default("english")
|
|
4176
|
-
}),
|
|
4177
|
-
metafields: import_zod52.z.boolean().default(false),
|
|
4178
|
-
/** This isn't configurable in the admin-nextjs editor */
|
|
4179
|
-
offer: import_zod52.z.object({
|
|
4180
|
-
count: import_zod52.z.number().default(1)
|
|
4181
|
-
}),
|
|
4182
|
-
offersLayout: import_zod52.z.object({
|
|
4183
|
-
itemsPerPage: import_zod52.z.number().optional(),
|
|
4184
|
-
type: import_zod52.z.enum(["list", "grid", "carousel"]).default("list")
|
|
4185
|
-
}).optional().default({
|
|
4186
|
-
type: "list"
|
|
4187
|
-
}),
|
|
4188
|
-
/** This isn't configurable in the admin-nextjs editor */
|
|
4189
|
-
previewMode: import_zod52.z.boolean().default(false),
|
|
4190
|
-
productLimit: import_zod52.z.number().optional().default(1),
|
|
4191
|
-
productOptions: import_zod52.z.object({
|
|
4192
|
-
/** This isn't configurable in the admin-nextjs editor */
|
|
4193
|
-
hideOutOfStockVariants: import_zod52.z.boolean().optional().default(false),
|
|
4194
|
-
matchVariant: import_zod52.z.boolean().optional().default(true),
|
|
4195
|
-
showDeclineAll: import_zod52.z.enum(["above", "below", "both", "none"]).optional(),
|
|
4196
|
-
showShipping: import_zod52.z.boolean().optional().default(true),
|
|
4197
|
-
showSubtotal: import_zod52.z.boolean().optional().default(true),
|
|
4198
|
-
showTaxes: import_zod52.z.boolean().optional().default(true),
|
|
4199
|
-
showTotal: import_zod52.z.boolean().optional().default(true),
|
|
4200
|
-
showVariantSelectors: import_zod52.z.boolean().optional().default(true),
|
|
4201
|
-
variantSelectorDisplayMode: import_zod52.z.enum(["separate", "single"]).optional().default("separate")
|
|
4202
|
-
}),
|
|
4203
|
-
productType: import_zod52.z.union([import_zod52.z.enum(["one-time", "subscription", "both"]), import_zod52.z.literal("").transform(() => "one-time")]).default("one-time"),
|
|
4204
|
-
productTypeSelector: import_zod52.z.enum(["dropdown", "radio"]).optional().default("radio"),
|
|
4205
|
-
quantityInputs: import_zod52.z.object({
|
|
4206
|
-
defaultQuantity: import_zod52.z.union([import_zod52.z.number(), import_zod52.z.null().transform(() => 1)]).default(1),
|
|
4207
|
-
enabled: import_zod52.z.boolean().default(true),
|
|
4208
|
-
maxValue: import_zod52.z.union([import_zod52.z.number(), import_zod52.z.null().transform(() => 15)]).default(15),
|
|
4209
|
-
minValue: import_zod52.z.union([import_zod52.z.number().min(0), import_zod52.z.unknown().transform(() => 0)]).default(1)
|
|
4210
|
-
}),
|
|
4211
|
-
shipping: import_zod52.z.object({
|
|
4212
|
-
amount: strictNumber.default(10),
|
|
4213
|
-
/** This isn't configurable in the admin-nextjs editor */
|
|
4214
|
-
enabled: import_zod52.z.boolean().default(true),
|
|
4215
|
-
title: import_zod52.z.string().optional().default("Shipping Fees"),
|
|
4216
|
-
type: import_zod52.z.enum(["free", "fixed_amount"]).default("free")
|
|
4217
|
-
}),
|
|
4218
|
-
styles: import_zod52.z.object({
|
|
4219
|
-
starColor: import_zod52.z.string().optional().default("#fadb14"),
|
|
4220
|
-
starSize: import_zod52.z.union([import_zod52.z.enum(["small", "medium", "large"]), import_zod52.z.unknown().transform(() => "large")]).optional().default("large"),
|
|
4221
|
-
starStrokeColor: import_zod52.z.string().optional().default("#fadb14"),
|
|
4222
|
-
strokeWidth: import_zod52.z.string().optional().default("1")
|
|
4223
|
-
}).optional(),
|
|
4224
|
-
subImages: import_zod52.z.number().nullish().default(8),
|
|
4225
|
-
subscription: import_zod52.z.object({
|
|
4226
|
-
discount: import_zod52.z.object({
|
|
4227
|
-
amount: strictNumber.default(30),
|
|
4228
|
-
shouldShowSavingText: import_zod52.z.boolean().optional().default(true),
|
|
4229
|
-
type: import_zod52.z.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
4230
|
-
}),
|
|
4231
|
-
shipping: import_zod52.z.object({
|
|
4232
|
-
amount: strictNumber.default(1),
|
|
4233
|
-
/** This isn't configurable in the admin-nextjs editor */
|
|
4234
|
-
enabled: import_zod52.z.boolean().default(true),
|
|
4235
|
-
/** This isn't configurable in the admin-nextjs editor */
|
|
4236
|
-
recurringAmount: strictNumber.default(2),
|
|
4237
|
-
shippingTitle: import_zod52.z.string().default("Shipping Fees"),
|
|
4238
|
-
type: import_zod52.z.enum(["free", "fixed_amount"]).default("free")
|
|
4239
|
-
})
|
|
4240
|
-
}).optional().default({
|
|
4241
|
-
discount: {
|
|
4242
|
-
amount: 30,
|
|
4243
|
-
shouldShowSavingText: true,
|
|
4244
|
-
type: "none"
|
|
4245
|
-
},
|
|
4246
|
-
shipping: {
|
|
4247
|
-
amount: 1,
|
|
4248
|
-
/** This isn't configurable in the admin-nextjs editor */
|
|
4249
|
-
enabled: true,
|
|
4250
|
-
/** This isn't configurable in the admin-nextjs editor */
|
|
4251
|
-
recurringAmount: 2,
|
|
4252
|
-
shippingTitle: "Shipping Fees",
|
|
4253
|
-
type: "free"
|
|
4254
|
-
}
|
|
4255
|
-
}),
|
|
4256
|
-
subscriptionIsDefault: import_zod52.z.boolean().optional(),
|
|
4257
|
-
/** This isn't configurable in the admin-nextjs editor */
|
|
4258
|
-
template: import_zod52.z.string().optional().default(""),
|
|
4259
|
-
type: import_zod52.z.literal("shopify_post_purchase_extension").default("shopify_post_purchase_extension"),
|
|
4260
|
-
upgradeToSubscription: import_zod52.z.object({
|
|
4261
|
-
acceptButtonText: import_zod52.z.string().optional().default("Upgrade"),
|
|
4262
|
-
allow: import_zod52.z.boolean().optional().default(false),
|
|
4263
|
-
emailRefundNotice: import_zod52.z.boolean().optional().default(false),
|
|
4264
|
-
errorBannerText: import_zod52.z.string().optional().default("This subscription cannot be added - limit one per order")
|
|
4265
|
-
}).optional().default(() => ({
|
|
4266
|
-
acceptButtonText: "Upgrade",
|
|
4267
|
-
allow: false,
|
|
4268
|
-
emailRefundNotice: false,
|
|
4269
|
-
errorBannerText: "This subscription cannot be added - limit one per order"
|
|
4270
|
-
}))
|
|
4466
|
+
var import_zod60 = require("zod");
|
|
4467
|
+
var PostPurchaseWidgetLinkedFlow = import_zod60.z.object({
|
|
4468
|
+
id: import_zod60.z.number(),
|
|
4469
|
+
name: import_zod60.z.string()
|
|
4271
4470
|
});
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
})
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
id: import_zod53.z.number().default(0),
|
|
4283
|
-
lastViewed: import_zod53.z.iso.datetime({ offset: true }).nullish(),
|
|
4284
|
-
linkedCustomEndpointId: import_zod53.z.number().nullish(),
|
|
4285
|
-
linkedFlows: import_zod53.z.array(PostPurchaseWidgetLinkedFlow).optional(),
|
|
4286
|
-
name: import_zod53.z.string().default(""),
|
|
4287
|
-
owner: import_zod53.z.number().nullish(),
|
|
4471
|
+
var PostPurchaseWidget = import_zod60.z.object({
|
|
4472
|
+
classification: import_zod60.z.literal("post_purchase_offer_page").default("post_purchase_offer_page"),
|
|
4473
|
+
createdAtTime: import_zod60.z.iso.datetime({ offset: true }).optional(),
|
|
4474
|
+
customEndpointName: import_zod60.z.string().nullish(),
|
|
4475
|
+
id: import_zod60.z.number().default(0),
|
|
4476
|
+
lastViewed: import_zod60.z.iso.datetime({ offset: true }).nullish(),
|
|
4477
|
+
linkedCustomEndpointId: import_zod60.z.number().nullish(),
|
|
4478
|
+
linkedFlows: import_zod60.z.array(PostPurchaseWidgetLinkedFlow).optional(),
|
|
4479
|
+
name: import_zod60.z.string().default(""),
|
|
4480
|
+
owner: import_zod60.z.number().nullish(),
|
|
4288
4481
|
settings: PostPurchaseSettings
|
|
4289
4482
|
});
|
|
4290
4483
|
|
|
4291
4484
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
4292
|
-
var PostPurchaseOffer =
|
|
4293
|
-
|
|
4294
|
-
errors:
|
|
4295
|
-
message:
|
|
4296
|
-
successful:
|
|
4485
|
+
var PostPurchaseOffer = import_zod61.z.discriminatedUnion("successful", [
|
|
4486
|
+
import_zod61.z.strictObject({
|
|
4487
|
+
errors: import_zod61.z.array(import_zod61.z.object({ message: import_zod61.z.string() })),
|
|
4488
|
+
message: import_zod61.z.string(),
|
|
4489
|
+
successful: import_zod61.z.literal(false)
|
|
4297
4490
|
}),
|
|
4298
|
-
|
|
4299
|
-
successful:
|
|
4491
|
+
import_zod61.z.strictObject({
|
|
4492
|
+
successful: import_zod61.z.literal(true),
|
|
4300
4493
|
widget: PostPurchaseWidget
|
|
4301
4494
|
})
|
|
4302
4495
|
]);
|
|
@@ -5015,7 +5208,7 @@ var buildQuantity = (settings) => {
|
|
|
5015
5208
|
};
|
|
5016
5209
|
var buildSubscriptionButton = (settings) => {
|
|
5017
5210
|
if (settings.productType !== "both" && settings.productType !== "subscription") return [];
|
|
5018
|
-
const
|
|
5211
|
+
const language2 = settings.language;
|
|
5019
5212
|
const slot = (buttonField, override) => ({
|
|
5020
5213
|
buttonField,
|
|
5021
5214
|
content: localizedContent(SWITCH_LABELS[buttonField], override, SWITCH_LABEL_TOKENS),
|
|
@@ -5029,9 +5222,9 @@ var buildSubscriptionButton = (settings) => {
|
|
|
5029
5222
|
...settings.productType === "subscription" && { disableDowngrade: true },
|
|
5030
5223
|
sections: [
|
|
5031
5224
|
slot("subscriptionOption", void 0),
|
|
5032
|
-
slot("switchToOneTimePurchase",
|
|
5033
|
-
slot("switchToSubscriptionNoDiscount",
|
|
5034
|
-
slot("switchToSubscriptionWithDiscount",
|
|
5225
|
+
slot("switchToOneTimePurchase", language2?.cartSwitchToOnetime),
|
|
5226
|
+
slot("switchToSubscriptionNoDiscount", language2?.upgradeToSubscription),
|
|
5227
|
+
slot("switchToSubscriptionWithDiscount", language2?.upgradeToSubscription)
|
|
5035
5228
|
],
|
|
5036
5229
|
sectionType: "button"
|
|
5037
5230
|
}
|
|
@@ -5144,9 +5337,9 @@ var buildCarouselNav = () => ({
|
|
|
5144
5337
|
sectionType: "layout"
|
|
5145
5338
|
});
|
|
5146
5339
|
var HEADER_FIELDS = ["superTitle", "title", "description"];
|
|
5147
|
-
var sanitizedHeader = (
|
|
5340
|
+
var sanitizedHeader = (language2) => Object.fromEntries(
|
|
5148
5341
|
HEADER_FIELDS.flatMap((field) => {
|
|
5149
|
-
const value =
|
|
5342
|
+
const value = language2?.[field];
|
|
5150
5343
|
const sanitized = value ? stripContentBlockHtml(normalizeTokens(value)) : "";
|
|
5151
5344
|
return sanitized ? [[field, sanitized]] : [];
|
|
5152
5345
|
})
|
|
@@ -5243,7 +5436,7 @@ var coerceIntegrations = (integrations) => Object.fromEntries(
|
|
|
5243
5436
|
return [key, value];
|
|
5244
5437
|
})
|
|
5245
5438
|
);
|
|
5246
|
-
var buildBanner = (
|
|
5439
|
+
var buildBanner = (language2) => language2?.successBannerEnabled ? [
|
|
5247
5440
|
{
|
|
5248
5441
|
/**
|
|
5249
5442
|
* The banner-level tag is the extraction/routing key on BOTH renderers (React CAB's
|
|
@@ -5256,7 +5449,7 @@ var buildBanner = (language) => language?.successBannerEnabled ? [
|
|
|
5256
5449
|
dismissible: true,
|
|
5257
5450
|
sections: [
|
|
5258
5451
|
{
|
|
5259
|
-
content: bannerMessageContent(
|
|
5452
|
+
content: bannerMessageContent(language2.successBannerMessageRte),
|
|
5260
5453
|
sectionType: "text"
|
|
5261
5454
|
},
|
|
5262
5455
|
{
|