@rebuy/rebuy 3.32.0 → 3.33.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 +1138 -923
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1138 -923
- package/dist/pricing/postPurchaseSubscriptionDisplay.d.ts +5 -0
- package/dist/schema/index.d.ts +8 -0
- package/dist/schema/postPurchaseChoice.d.ts +25 -0
- package/dist/schema/postPurchaseDiscount.d.ts +22 -0
- package/dist/schema/postPurchasePlanAdjustment.d.ts +11 -0
- package/dist/schema/postPurchasePlanCatalog.d.ts +42 -0
- package/dist/schema/postPurchaseProduct.d.ts +260 -0
- package/dist/schema/postPurchaseProductSettings.d.ts +1 -1
- package/dist/schema/postPurchaseProductSource.d.ts +2 -2
- package/dist/schema/postPurchaseSubscription.d.ts +21 -0
- package/dist/schema/postPurchaseSubscriptionDisplay.d.ts +10 -0
- package/dist/schema/postPurchaseSubscriptionProduct.d.ts +224 -0
- package/dist/schema/postPurchaseSubscriptionSettings.d.ts +22 -0
- package/dist/schema/widgets/checkout-and-beyond/banner.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/carousel.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/cartLine.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/common.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/dataSource.d.ts +2 -2
- package/dist/schema/widgets/checkout-and-beyond/discount.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/icons.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/image.d.ts +2 -2
- package/dist/schema/widgets/checkout-and-beyond/offers.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/progressBar.d.ts +1 -1
- 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__/postPurchaseLegacyPlans.d.ts +35 -0
- package/dist/server/__fixtures__/postPurchaseSubscription.d.ts +75 -0
- package/dist/server/index.cjs +802 -118
- package/dist/server/index.d.ts +3 -1
- package/dist/server/index.mjs +802 -118
- package/dist/server/normalizePostPurchaseCollection.d.ts +16 -16
- package/dist/server/normalizePostPurchaseProduct.d.ts +9 -9
- package/dist/server/postPurchaseLegacyPlans.d.ts +3 -0
- package/dist/server/postPurchaseModernPlans.d.ts +7 -0
- package/dist/server/postPurchasePlanAdjustment.d.ts +3 -0
- package/dist/server/postPurchasePlanCatalog.d.ts +5 -0
- package/dist/server/postPurchaseSubscriptionEligibility.d.ts +5 -0
- package/dist/server/prepareNormalizedSubscription.d.ts +11 -0
- package/dist/server/preparePostPurchaseSubscription.d.ts +102 -0
- package/dist/server/projectPostPurchaseProduct.d.ts +7 -7
- package/dist/server/requestSchemas.d.ts +1 -1
- package/dist/server/selectPostPurchaseChoice.d.ts +43 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1252,161 +1252,60 @@ var OfferProduct = z5.object({
|
|
|
1252
1252
|
variants: z5.array(OfferProductVariant).min(1)
|
|
1253
1253
|
});
|
|
1254
1254
|
|
|
1255
|
-
// src/schema/
|
|
1256
|
-
import { z as
|
|
1257
|
-
var PostPurchaseSkipReasonSchema = z6.enum(["empty", "no-eligible-subscription"]);
|
|
1258
|
-
|
|
1259
|
-
// src/schema/postPurchaseExitPolicy.ts
|
|
1260
|
-
import { z as z7 } from "zod";
|
|
1261
|
-
var EXIT_DELAY_MAX_MS = 60 * 60 * 1e3;
|
|
1262
|
-
var ExitPolicySchema = z7.discriminatedUnion("status", [
|
|
1263
|
-
z7.strictObject({ status: z7.literal("unavailable") }),
|
|
1264
|
-
z7.strictObject({
|
|
1265
|
-
delayMs: z7.number().int().nonnegative().max(EXIT_DELAY_MAX_MS),
|
|
1266
|
-
source: z7.enum(["admitted", "selected-flow"]),
|
|
1267
|
-
status: z7.literal("available")
|
|
1268
|
-
})
|
|
1269
|
-
]);
|
|
1255
|
+
// src/schema/postPurchaseChoice.ts
|
|
1256
|
+
import { z as z16 } from "zod";
|
|
1270
1257
|
|
|
1271
|
-
// src/schema/
|
|
1258
|
+
// src/schema/postPurchasePlanCatalog.ts
|
|
1272
1259
|
import { z as z8 } from "zod";
|
|
1273
|
-
var POST_PURCHASE_ID_MAX = 128;
|
|
1274
|
-
var PostPurchaseTimestampSchema = z8.number().int().nonnegative();
|
|
1275
|
-
var PostPurchaseOrderIdSchema = z8.string().regex(/^gid:\/\/shopify\/Order\/[1-9]\d*$/);
|
|
1276
|
-
var ShopifyDomainSchema = z8.string().max(POST_PURCHASE_ID_MAX).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?\.myshopify\.com$/);
|
|
1277
|
-
var DecideRequestSchema = z8.object({
|
|
1278
|
-
checkoutToken: z8.string().min(1).max(POST_PURCHASE_ID_MAX),
|
|
1279
|
-
shop: ShopifyDomainSchema
|
|
1280
|
-
});
|
|
1281
|
-
var PostPurchaseAppIdSchema = z8.string().min(1).max(POST_PURCHASE_ID_MAX);
|
|
1282
|
-
var DecisionEntrySchema = z8.object({
|
|
1283
|
-
blockId: z8.number().int().positive(),
|
|
1284
|
-
blockIndex: z8.string(),
|
|
1285
|
-
blockParentIndex: z8.string(),
|
|
1286
|
-
flowId: z8.number().int().positive(),
|
|
1287
|
-
sectionId: z8.number().int().positive(),
|
|
1288
|
-
widgetId: z8.number().int().positive(),
|
|
1289
|
-
widgetTraffic: z8.number().min(0).max(100)
|
|
1290
|
-
});
|
|
1291
|
-
|
|
1292
|
-
// src/schema/postPurchaseOrderDecision.ts
|
|
1293
|
-
import { z as z9 } from "zod";
|
|
1294
|
-
var OrderDecisionSchema = z9.discriminatedUnion("owner", [
|
|
1295
|
-
z9.object({ owner: z9.literal("session"), sessionId: z9.string().regex(/^[a-f0-9]{64}$/) }),
|
|
1296
|
-
z9.object({ owner: z9.literal("release"), sessionId: z9.null() })
|
|
1297
|
-
]);
|
|
1298
|
-
|
|
1299
|
-
// src/schema/postPurchasePolicy.ts
|
|
1300
|
-
import { z as z10 } from "zod";
|
|
1301
|
-
var HoldSettingSchema = z10.discriminatedUnion("enabled", [
|
|
1302
|
-
z10.object({ durationMinutes: z10.number().int().min(1).max(60), enabled: z10.literal(true) }),
|
|
1303
|
-
z10.object({ durationMinutes: z10.null(), enabled: z10.literal(false) })
|
|
1304
|
-
]);
|
|
1305
|
-
var TimingSettingsSchema = z10.object({ flowHold: HoldSettingSchema, shopHold: HoldSettingSchema });
|
|
1306
|
-
var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
1307
|
-
durationMinutes: z10.number().int().min(1).max(60).nullable(),
|
|
1308
|
-
source: z10.enum(["shop", "flow", "native"])
|
|
1309
|
-
}).refine(
|
|
1310
|
-
(policy) => {
|
|
1311
|
-
const expectedSource = policy.shopHold.enabled ? "shop" : policy.flowHold.enabled ? "flow" : "native";
|
|
1312
|
-
const expectedDuration = expectedSource === "shop" ? policy.shopHold.durationMinutes : expectedSource === "flow" ? policy.flowHold.durationMinutes : null;
|
|
1313
|
-
return policy.source === expectedSource && policy.durationMinutes === expectedDuration;
|
|
1314
|
-
},
|
|
1315
|
-
{
|
|
1316
|
-
message: "source and durationMinutes must reflect the shop-over-flow-over-native precedence",
|
|
1317
|
-
path: ["source"]
|
|
1318
|
-
}
|
|
1319
|
-
);
|
|
1320
1260
|
|
|
1321
|
-
// src/schema/
|
|
1322
|
-
import { z as
|
|
1261
|
+
// src/schema/postPurchasePlanAdjustment.ts
|
|
1262
|
+
import { z as z7 } from "zod";
|
|
1323
1263
|
|
|
1324
|
-
// src/schema/
|
|
1325
|
-
import { z as
|
|
1326
|
-
var
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
description: OfferProduct.shape.description.nullable(),
|
|
1331
|
-
id: PostPurchaseProductId
|
|
1332
|
-
});
|
|
1333
|
-
var SourceVariant = OfferProduct.shape.variants.element.pick({ id: true, title: true }).extend({
|
|
1334
|
-
compareAtPrice: PostPurchaseAmount.nullable(),
|
|
1335
|
-
id: PostPurchaseVariantId,
|
|
1336
|
-
imageId: z11.number().int().nonnegative().nullish(),
|
|
1337
|
-
inventoryManagement: z11.string().nullable(),
|
|
1338
|
-
inventoryPolicy: z11.string(),
|
|
1339
|
-
inventoryQuantity: z11.number(),
|
|
1340
|
-
option1: z11.unknown().optional(),
|
|
1341
|
-
option2: z11.unknown().optional(),
|
|
1342
|
-
option3: z11.unknown().optional(),
|
|
1343
|
-
price: PostPurchaseAmount,
|
|
1344
|
-
productId: PostPurchaseProductId,
|
|
1345
|
-
sellingPlanAllocations: z11.unknown().optional()
|
|
1346
|
-
});
|
|
1347
|
-
var Product2 = ProductBase.extend({
|
|
1348
|
-
images: z11.array(
|
|
1349
|
-
z11.object({ alt: z11.string().optional().catch(void 0), id: z11.number().int().positive(), src: z11.string() })
|
|
1350
|
-
).nullish(),
|
|
1351
|
-
metadata: z11.object({
|
|
1352
|
-
productQuantity: z11.union([
|
|
1353
|
-
z11.number().int().positive(),
|
|
1354
|
-
z11.string().regex(/^[1-9]\d*$/).transform(Number)
|
|
1355
|
-
]).optional()
|
|
1356
|
-
}).optional(),
|
|
1357
|
-
metafields: z11.unknown().optional(),
|
|
1358
|
-
options: z11.unknown().optional(),
|
|
1359
|
-
productGroupVariants: z11.array(z11.unknown()).default([]),
|
|
1360
|
-
selectedVariant: z11.unknown().optional(),
|
|
1361
|
-
sellingPlanGroups: z11.array(
|
|
1362
|
-
OfferProduct.shape.sellingPlanGroups.unwrap().element.extend({
|
|
1363
|
-
discountAmount: z11.unknown().optional(),
|
|
1364
|
-
discountType: z11.unknown().optional(),
|
|
1365
|
-
id: z11.unknown().optional(),
|
|
1366
|
-
sellingPlans: z11.unknown().optional()
|
|
1367
|
-
})
|
|
1368
|
-
).optional(),
|
|
1369
|
-
variants: z11.array(SourceVariant)
|
|
1370
|
-
});
|
|
1371
|
-
var PostPurchaseProductSource = z11.object({
|
|
1372
|
-
data: z11.array(Product2),
|
|
1373
|
-
metadata: z11.object({ widget: z11.record(z11.string(), z11.unknown()).default({}) }).default({ widget: {} })
|
|
1264
|
+
// src/schema/postPurchaseDiscount.ts
|
|
1265
|
+
import { z as z6 } from "zod";
|
|
1266
|
+
var Discount = z6.object({
|
|
1267
|
+
amount: z6.number().nonnegative(),
|
|
1268
|
+
title: z6.string(),
|
|
1269
|
+
type: z6.enum(["none", "fixed_amount", "percentage"])
|
|
1374
1270
|
});
|
|
1271
|
+
var validPostPurchaseDiscount = (discount) => discount.type !== "percentage" || discount.amount <= 100;
|
|
1272
|
+
var PostPurchaseDiscount = Discount.refine(validPostPurchaseDiscount);
|
|
1375
1273
|
|
|
1376
|
-
// src/schema/
|
|
1377
|
-
var
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1274
|
+
// src/schema/postPurchasePlanAdjustment.ts
|
|
1275
|
+
var PostPurchasePlanAdjustment = z7.object({
|
|
1276
|
+
amount: PostPurchaseDiscount.shape.amount,
|
|
1277
|
+
type: z7.enum(["percentage", "fixed_amount", "price"])
|
|
1278
|
+
}).refine(({ amount: amount2, type }) => type === "price" || validPostPurchaseDiscount({ amount: amount2, type }));
|
|
1381
1279
|
|
|
1382
|
-
// src/schema/
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
),
|
|
1393
|
-
|
|
1280
|
+
// src/schema/postPurchasePlanCatalog.ts
|
|
1281
|
+
var PostPurchasePlanOption = z8.object({
|
|
1282
|
+
adjustment: PostPurchasePlanAdjustment.optional(),
|
|
1283
|
+
id: z8.number().int().positive(),
|
|
1284
|
+
intervalFrequency: z8.string().regex(/^[1-9]\d*$/).optional(),
|
|
1285
|
+
intervalLabel: z8.string().min(1),
|
|
1286
|
+
name: z8.string().min(1)
|
|
1287
|
+
});
|
|
1288
|
+
var PostPurchasePlanCatalog = z8.object({
|
|
1289
|
+
plans: z8.array(PostPurchasePlanOption),
|
|
1290
|
+
productId: z8.number().int().positive(),
|
|
1291
|
+
requiresSellingPlan: z8.boolean(),
|
|
1292
|
+
variantId: z8.number().int().positive()
|
|
1394
1293
|
});
|
|
1395
1294
|
|
|
1396
1295
|
// src/schema/widgets/post-purchase-offer/postPurchaseSettings.ts
|
|
1397
|
-
import { z as
|
|
1296
|
+
import { z as z15 } from "zod";
|
|
1398
1297
|
|
|
1399
1298
|
// src/schema/widgets/post-purchase-offer/common.ts
|
|
1400
1299
|
import { replace, toNumber, toString } from "es-toolkit/compat";
|
|
1401
|
-
import { z as
|
|
1402
|
-
var strictNumber =
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1300
|
+
import { z as z9 } from "zod";
|
|
1301
|
+
var strictNumber = z9.union([
|
|
1302
|
+
z9.number(),
|
|
1303
|
+
z9.string().transform((value) => toNumber(replace(toString(value), /[^0-9.]/g, "")) || 0),
|
|
1304
|
+
z9.unknown().transform(() => 0)
|
|
1406
1305
|
]);
|
|
1407
1306
|
|
|
1408
1307
|
// src/schema/widgets/post-purchase-offer/constants.ts
|
|
1409
|
-
import { z as
|
|
1308
|
+
import { z as z10 } from "zod";
|
|
1410
1309
|
var blockTypes = [
|
|
1411
1310
|
"callout_banner",
|
|
1412
1311
|
"image",
|
|
@@ -1417,18 +1316,18 @@ var blockTypes = [
|
|
|
1417
1316
|
"text",
|
|
1418
1317
|
"timer"
|
|
1419
1318
|
];
|
|
1420
|
-
var blockType =
|
|
1319
|
+
var blockType = z10.enum(blockTypes);
|
|
1421
1320
|
var BlockType = blockType.enum;
|
|
1422
1321
|
|
|
1423
1322
|
// src/schema/widgets/post-purchase-offer/postPurchaseBlocks.ts
|
|
1424
1323
|
import { get as get3, isEqual } from "es-toolkit/compat";
|
|
1425
1324
|
import { v4 as uuidv42 } from "uuid";
|
|
1426
|
-
import { z as
|
|
1325
|
+
import { z as z14 } from "zod";
|
|
1427
1326
|
|
|
1428
1327
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
1429
1328
|
import { forEach, isString as isString2 } from "es-toolkit/compat";
|
|
1430
1329
|
import { v7 as uuidv7 } from "uuid";
|
|
1431
|
-
import { z as
|
|
1330
|
+
import { z as z13 } from "zod";
|
|
1432
1331
|
|
|
1433
1332
|
// src/schema/widgets/checkout-and-beyond/common.ts
|
|
1434
1333
|
var freezeEnum = (values2) => Object.freeze(Object.fromEntries(values2.map((v) => [v, v])));
|
|
@@ -1712,10 +1611,10 @@ var isTextType = isSectionType(SectionType.text);
|
|
|
1712
1611
|
var isVariantsType = isSectionType(SectionType.variants);
|
|
1713
1612
|
|
|
1714
1613
|
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
1715
|
-
import { z as
|
|
1614
|
+
import { z as z12 } from "zod";
|
|
1716
1615
|
|
|
1717
1616
|
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
1718
|
-
import { z as
|
|
1617
|
+
import { z as z11 } from "zod";
|
|
1719
1618
|
var ruleTypes = [
|
|
1720
1619
|
"cart",
|
|
1721
1620
|
"cart_count",
|
|
@@ -1734,7 +1633,7 @@ var ruleTypes = [
|
|
|
1734
1633
|
"product_type",
|
|
1735
1634
|
"product_vendor"
|
|
1736
1635
|
];
|
|
1737
|
-
var ruleType =
|
|
1636
|
+
var ruleType = z11.enum(ruleTypes);
|
|
1738
1637
|
var RuleType = ruleType.enum;
|
|
1739
1638
|
var ruleOperators = [
|
|
1740
1639
|
"after",
|
|
@@ -1749,177 +1648,177 @@ var ruleOperators = [
|
|
|
1749
1648
|
"greater_than",
|
|
1750
1649
|
"less_than"
|
|
1751
1650
|
];
|
|
1752
|
-
var ruleOperator =
|
|
1651
|
+
var ruleOperator = z11.enum(ruleOperators);
|
|
1753
1652
|
var RuleOperator = ruleOperator.enum;
|
|
1754
|
-
var RuleCondition =
|
|
1755
|
-
operator:
|
|
1756
|
-
products:
|
|
1757
|
-
type:
|
|
1758
|
-
value:
|
|
1759
|
-
});
|
|
1760
|
-
var RuleLogicBlock =
|
|
1761
|
-
rules:
|
|
1762
|
-
});
|
|
1763
|
-
var CABRulesetEntry =
|
|
1764
|
-
exitIfMatched:
|
|
1765
|
-
logic:
|
|
1766
|
-
output:
|
|
1767
|
-
|
|
1768
|
-
key:
|
|
1769
|
-
type:
|
|
1770
|
-
value:
|
|
1653
|
+
var RuleCondition = z11.object({
|
|
1654
|
+
operator: z11.enum(ruleOperators).default(RuleOperator.anything),
|
|
1655
|
+
products: z11.union([z11.array(z11.unknown()), z11.strictObject({}).transform(() => [])]).default(() => []),
|
|
1656
|
+
type: z11.enum(ruleTypes).default(RuleType.cart_subtotal),
|
|
1657
|
+
value: z11.coerce.string().default("")
|
|
1658
|
+
});
|
|
1659
|
+
var RuleLogicBlock = z11.object({
|
|
1660
|
+
rules: z11.array(RuleCondition).default(() => [])
|
|
1661
|
+
});
|
|
1662
|
+
var CABRulesetEntry = z11.object({
|
|
1663
|
+
exitIfMatched: z11.boolean().default(true),
|
|
1664
|
+
logic: z11.array(RuleLogicBlock).default(() => []),
|
|
1665
|
+
output: z11.array(
|
|
1666
|
+
z11.object({
|
|
1667
|
+
key: z11.string().default("should_show"),
|
|
1668
|
+
type: z11.literal("data_json").default("data_json"),
|
|
1669
|
+
value: z11.string().default("true")
|
|
1771
1670
|
})
|
|
1772
1671
|
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
1773
1672
|
});
|
|
1774
|
-
var CABRuleset =
|
|
1673
|
+
var CABRuleset = z11.union([z11.array(CABRulesetEntry), z11.strictObject({}).transform(() => [])]).default(() => []);
|
|
1775
1674
|
|
|
1776
1675
|
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
1777
|
-
var variableEffect =
|
|
1778
|
-
var CABVariableSeed =
|
|
1779
|
-
dataSourceId:
|
|
1676
|
+
var variableEffect = z12.enum(variableEffects);
|
|
1677
|
+
var CABVariableSeed = z12.object({
|
|
1678
|
+
dataSourceId: z12.number().nullable().default(null),
|
|
1780
1679
|
ruleset: CABRuleset
|
|
1781
1680
|
});
|
|
1782
|
-
var CABBooleanVariable =
|
|
1681
|
+
var CABBooleanVariable = z12.object({
|
|
1783
1682
|
/**
|
|
1784
1683
|
* Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
|
|
1785
1684
|
* from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
|
|
1786
1685
|
* below; a cross-field default has no `.default()` spelling. An explicit value always wins.
|
|
1787
1686
|
*/
|
|
1788
|
-
defaultValue:
|
|
1789
|
-
name:
|
|
1687
|
+
defaultValue: z12.boolean().optional(),
|
|
1688
|
+
name: z12.string().min(1),
|
|
1790
1689
|
seed: CABVariableSeed.optional(),
|
|
1791
1690
|
/** Defaulted so every stored declaration (all boolean before `text` existed) parses unchanged. */
|
|
1792
|
-
type:
|
|
1691
|
+
type: z12.literal(VariableType.boolean).default(VariableType.boolean)
|
|
1793
1692
|
});
|
|
1794
|
-
var CABTextVariable =
|
|
1795
|
-
defaultValue:
|
|
1796
|
-
name:
|
|
1797
|
-
seed:
|
|
1798
|
-
type:
|
|
1693
|
+
var CABTextVariable = z12.object({
|
|
1694
|
+
defaultValue: z12.string(),
|
|
1695
|
+
name: z12.string().min(1),
|
|
1696
|
+
seed: z12.never().optional(),
|
|
1697
|
+
type: z12.literal(VariableType.text)
|
|
1799
1698
|
});
|
|
1800
|
-
var CABNumberVariable =
|
|
1801
|
-
defaultValue:
|
|
1802
|
-
name:
|
|
1803
|
-
seed:
|
|
1804
|
-
type:
|
|
1699
|
+
var CABNumberVariable = z12.object({
|
|
1700
|
+
defaultValue: z12.number(),
|
|
1701
|
+
name: z12.string().min(1),
|
|
1702
|
+
seed: z12.never().optional(),
|
|
1703
|
+
type: z12.literal(VariableType.number)
|
|
1805
1704
|
});
|
|
1806
|
-
var CABVariable =
|
|
1705
|
+
var CABVariable = z12.union([CABTextVariable, CABNumberVariable, CABBooleanVariable]).transform(
|
|
1807
1706
|
(variable) => variable.type === VariableType.boolean ? { ...variable, defaultValue: variable.defaultValue ?? variable.seed === void 0 } : variable
|
|
1808
1707
|
);
|
|
1809
|
-
var CABVariableEffect =
|
|
1708
|
+
var CABVariableEffect = z12.object({
|
|
1810
1709
|
effect: variableEffect.default(VariableEffect.toggle),
|
|
1811
|
-
variable:
|
|
1710
|
+
variable: z12.string().min(1)
|
|
1812
1711
|
});
|
|
1813
|
-
var CABVisibility =
|
|
1814
|
-
variable:
|
|
1815
|
-
visibleWhen:
|
|
1712
|
+
var CABVisibility = z12.object({
|
|
1713
|
+
variable: z12.string().min(1),
|
|
1714
|
+
visibleWhen: z12.boolean().default(true)
|
|
1816
1715
|
});
|
|
1817
|
-
var contentOperator =
|
|
1818
|
-
var resultCountOperator =
|
|
1819
|
-
var resultTagOperator =
|
|
1820
|
-
var mutatorEvent =
|
|
1821
|
-
var CABContentTrigger =
|
|
1716
|
+
var contentOperator = z12.enum(contentOperators);
|
|
1717
|
+
var resultCountOperator = z12.enum(resultCountOperators);
|
|
1718
|
+
var resultTagOperator = z12.enum(resultTagOperators);
|
|
1719
|
+
var mutatorEvent = z12.enum(mutatorEvents);
|
|
1720
|
+
var CABContentTrigger = z12.object({
|
|
1822
1721
|
operator: contentOperator.default(ContentOperator.is_empty),
|
|
1823
|
-
type:
|
|
1722
|
+
type: z12.literal("content")
|
|
1824
1723
|
});
|
|
1825
|
-
var CABResultCountTrigger =
|
|
1724
|
+
var CABResultCountTrigger = z12.object({
|
|
1826
1725
|
operator: resultCountOperator.default(ResultCountOperator.equals),
|
|
1827
|
-
type:
|
|
1828
|
-
value:
|
|
1726
|
+
type: z12.literal("result_count"),
|
|
1727
|
+
value: z12.number().default(0)
|
|
1829
1728
|
});
|
|
1830
|
-
var CABResultTagTrigger =
|
|
1729
|
+
var CABResultTagTrigger = z12.object({
|
|
1831
1730
|
operator: resultTagOperator.default(ResultTagOperator.contains),
|
|
1832
|
-
type:
|
|
1833
|
-
value:
|
|
1731
|
+
type: z12.literal("result_tag"),
|
|
1732
|
+
value: z12.string().min(1)
|
|
1834
1733
|
});
|
|
1835
|
-
var CABEventTrigger =
|
|
1734
|
+
var CABEventTrigger = z12.object({
|
|
1836
1735
|
event: mutatorEvent,
|
|
1837
|
-
type:
|
|
1736
|
+
type: z12.literal("event")
|
|
1838
1737
|
});
|
|
1839
|
-
var CABVariableTrigger =
|
|
1738
|
+
var CABVariableTrigger = z12.discriminatedUnion("type", [
|
|
1840
1739
|
CABContentTrigger,
|
|
1841
1740
|
CABEventTrigger,
|
|
1842
1741
|
CABResultCountTrigger,
|
|
1843
1742
|
CABResultTagTrigger
|
|
1844
1743
|
]);
|
|
1845
|
-
var CABVariableMutator =
|
|
1744
|
+
var CABVariableMutator = z12.object({
|
|
1846
1745
|
effect: variableEffect.default(VariableEffect.set_false),
|
|
1847
|
-
variable:
|
|
1746
|
+
variable: z12.string().min(1),
|
|
1848
1747
|
when: CABVariableTrigger
|
|
1849
1748
|
});
|
|
1850
1749
|
var CABVariableFields = {
|
|
1851
|
-
mutators:
|
|
1852
|
-
variables:
|
|
1750
|
+
mutators: z12.array(CABVariableMutator).optional(),
|
|
1751
|
+
variables: z12.array(CABVariable).refine((variables) => new Set(variables.map(({ name }) => name)).size === variables.length, {
|
|
1853
1752
|
message: "variable names must be unique within a section"
|
|
1854
1753
|
}).optional(),
|
|
1855
1754
|
visibility: CABVisibility.optional()
|
|
1856
1755
|
};
|
|
1857
1756
|
|
|
1858
1757
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
1859
|
-
var enumOrOmit = (...vals) =>
|
|
1860
|
-
var TiptapText =
|
|
1861
|
-
marks:
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
attrs:
|
|
1868
|
-
class:
|
|
1869
|
-
href:
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1758
|
+
var enumOrOmit = (...vals) => z13.string().transform((val) => vals.includes(val) ? val : void 0).optional();
|
|
1759
|
+
var TiptapText = z13.object({
|
|
1760
|
+
marks: z13.union([
|
|
1761
|
+
z13.array(
|
|
1762
|
+
z13.discriminatedUnion("type", [
|
|
1763
|
+
z13.object({ type: z13.literal("bold") }),
|
|
1764
|
+
z13.object({ type: z13.literal("italic") }),
|
|
1765
|
+
z13.object({
|
|
1766
|
+
attrs: z13.object({
|
|
1767
|
+
class: z13.string().nullable(),
|
|
1768
|
+
href: z13.union([
|
|
1769
|
+
z13.url(),
|
|
1770
|
+
z13.literal("#"),
|
|
1771
|
+
z13.string().regex(DYNAMIC_TOKEN_REGEX),
|
|
1772
|
+
z13.string().regex(ROOT_RELATIVE_PATH_REGEX)
|
|
1874
1773
|
]),
|
|
1875
|
-
rel:
|
|
1876
|
-
target:
|
|
1774
|
+
rel: z13.string().default("noopener noreferrer nofollow"),
|
|
1775
|
+
target: z13.string().default("_blank")
|
|
1877
1776
|
}),
|
|
1878
|
-
type:
|
|
1777
|
+
type: z13.literal("link")
|
|
1879
1778
|
}),
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
attrs:
|
|
1779
|
+
z13.object({ type: z13.literal("strike") }),
|
|
1780
|
+
z13.object({
|
|
1781
|
+
attrs: z13.object({
|
|
1883
1782
|
color: enumOrOmit(...textColorNames).default(TextColorName.base),
|
|
1884
1783
|
fontSize: enumOrOmit(...textSizeNames).default(TextSizeName.base)
|
|
1885
1784
|
}),
|
|
1886
|
-
type:
|
|
1785
|
+
type: z13.literal("textStyle")
|
|
1887
1786
|
})
|
|
1888
1787
|
])
|
|
1889
1788
|
),
|
|
1890
|
-
|
|
1789
|
+
z13.strictObject({}).transform(() => [])
|
|
1891
1790
|
]).optional(),
|
|
1892
|
-
text:
|
|
1893
|
-
type:
|
|
1791
|
+
text: z13.string().default(""),
|
|
1792
|
+
type: z13.literal("text").default("text")
|
|
1894
1793
|
});
|
|
1895
|
-
var TiptapParagraph =
|
|
1896
|
-
attrs:
|
|
1794
|
+
var TiptapParagraph = z13.object({
|
|
1795
|
+
attrs: z13.object({
|
|
1897
1796
|
textAlign: enumOrOmit(...textAlignments)
|
|
1898
1797
|
}).default({ textAlign: TextAlignment.start }),
|
|
1899
|
-
content:
|
|
1900
|
-
type:
|
|
1798
|
+
content: z13.union([z13.array(TiptapText), z13.strictObject({}).transform(() => [])]).default(() => []),
|
|
1799
|
+
type: z13.literal("paragraph").default("paragraph")
|
|
1901
1800
|
});
|
|
1902
|
-
var TiptapDocument =
|
|
1903
|
-
attrs:
|
|
1801
|
+
var TiptapDocument = z13.object({
|
|
1802
|
+
attrs: z13.object({
|
|
1904
1803
|
blockSpacing: enumOrOmit(...spacings)
|
|
1905
1804
|
}).default({ blockSpacing: Spacing.base }),
|
|
1906
|
-
content:
|
|
1907
|
-
type:
|
|
1805
|
+
content: z13.union([z13.array(TiptapParagraph), z13.strictObject({}).transform(() => [])]).default(() => [TiptapParagraph.parse({})]),
|
|
1806
|
+
type: z13.literal("doc").default("doc")
|
|
1908
1807
|
});
|
|
1909
|
-
var CABTextTier =
|
|
1910
|
-
threshold:
|
|
1911
|
-
thresholds:
|
|
1912
|
-
tierId:
|
|
1913
|
-
tierType:
|
|
1808
|
+
var CABTextTier = z13.object({
|
|
1809
|
+
threshold: z13.number().int().nonnegative(),
|
|
1810
|
+
thresholds: z13.record(z13.string(), z13.number().int().nonnegative()).default(() => ({})),
|
|
1811
|
+
tierId: z13.string().optional(),
|
|
1812
|
+
tierType: z13.enum(progressTierTypes).default(ProgressTierType.shipping)
|
|
1914
1813
|
});
|
|
1915
|
-
var CABTextSection =
|
|
1814
|
+
var CABTextSection = z13.object({
|
|
1916
1815
|
...CABVariableFields,
|
|
1917
|
-
buttonField:
|
|
1918
|
-
content:
|
|
1919
|
-
name:
|
|
1920
|
-
optionId:
|
|
1921
|
-
sectionId:
|
|
1922
|
-
sectionType:
|
|
1816
|
+
buttonField: z13.enum(buttonFields).optional(),
|
|
1817
|
+
content: z13.record(z13.string(), z13.union([z13.string(), TiptapDocument]).refine(checkForHTML, NO_HTML).optional()).default({ en: TiptapDocument.parse({}) }).optional(),
|
|
1818
|
+
name: z13.string().optional(),
|
|
1819
|
+
optionId: z13.number().optional(),
|
|
1820
|
+
sectionId: z13.uuid().default(() => uuidv7()),
|
|
1821
|
+
sectionType: z13.literal(SectionType.text).default(SectionType.text),
|
|
1923
1822
|
tier: CABTextTier.optional()
|
|
1924
1823
|
}).superRefine(({ buttonField, content }, ctx) => {
|
|
1925
1824
|
if (buttonField === ButtonField.destinationUrl && content) {
|
|
@@ -1941,137 +1840,137 @@ var CABTextSection = z18.object({
|
|
|
1941
1840
|
});
|
|
1942
1841
|
|
|
1943
1842
|
// src/schema/widgets/post-purchase-offer/postPurchaseBlocks.ts
|
|
1944
|
-
var TextAlignment2 =
|
|
1945
|
-
var TextSize =
|
|
1946
|
-
|
|
1947
|
-
|
|
1843
|
+
var TextAlignment2 = z14.union([z14.enum(["leading", "center", "trailing"]), z14.unknown().transform(() => "leading")]);
|
|
1844
|
+
var TextSize = z14.union([
|
|
1845
|
+
z14.enum(["xsmall", "small", "base", "default", "medium", "large", "xlarge"]),
|
|
1846
|
+
z14.unknown().transform(() => "medium")
|
|
1948
1847
|
]);
|
|
1949
|
-
var CalloutBannerBlock =
|
|
1950
|
-
id:
|
|
1951
|
-
name:
|
|
1952
|
-
settings:
|
|
1953
|
-
superTitle:
|
|
1954
|
-
title:
|
|
1848
|
+
var CalloutBannerBlock = z14.object({
|
|
1849
|
+
id: z14.string().optional().default(() => uuidv42()),
|
|
1850
|
+
name: z14.string().optional(),
|
|
1851
|
+
settings: z14.object({
|
|
1852
|
+
superTitle: z14.union([z14.string(), TiptapDocument]).default(() => "Limited-time Offer"),
|
|
1853
|
+
title: z14.union([z14.string(), TiptapDocument]).default(() => "Add this customer favorite to your order")
|
|
1955
1854
|
}),
|
|
1956
|
-
styles:
|
|
1957
|
-
superTitleEmphasized:
|
|
1855
|
+
styles: z14.object({
|
|
1856
|
+
superTitleEmphasized: z14.boolean().default(false),
|
|
1958
1857
|
superTitleSize: TextSize.default("large"),
|
|
1959
1858
|
textAlignment: TextAlignment2.default("center"),
|
|
1960
|
-
titleEmphasized:
|
|
1859
|
+
titleEmphasized: z14.boolean().default(true),
|
|
1961
1860
|
titleSize: TextSize.default("large")
|
|
1962
1861
|
}),
|
|
1963
|
-
type:
|
|
1862
|
+
type: z14.literal(BlockType.callout_banner).default(BlockType.callout_banner)
|
|
1964
1863
|
});
|
|
1965
|
-
var ImageBlock =
|
|
1966
|
-
id:
|
|
1967
|
-
name:
|
|
1968
|
-
settings:
|
|
1969
|
-
|
|
1864
|
+
var ImageBlock = z14.object({
|
|
1865
|
+
id: z14.string().optional().default(() => uuidv42()),
|
|
1866
|
+
name: z14.string().optional(),
|
|
1867
|
+
settings: z14.union([
|
|
1868
|
+
z14.object({
|
|
1970
1869
|
/** This isn't used in the post-purchase offer widget */
|
|
1971
|
-
alt:
|
|
1972
|
-
image:
|
|
1973
|
-
imageSize:
|
|
1974
|
-
imageType:
|
|
1870
|
+
alt: z14.string().optional().default(""),
|
|
1871
|
+
image: z14.union([z14.literal(""), z14.url()]).default(""),
|
|
1872
|
+
imageSize: z14.number().default(20),
|
|
1873
|
+
imageType: z14.enum(["URL", "UPLOAD"]).default("URL")
|
|
1975
1874
|
}),
|
|
1976
|
-
|
|
1875
|
+
z14.array(z14.never()).transform(() => ({}))
|
|
1977
1876
|
]),
|
|
1978
|
-
type:
|
|
1979
|
-
});
|
|
1980
|
-
var ImageContentBlock =
|
|
1981
|
-
id:
|
|
1982
|
-
name:
|
|
1983
|
-
settings:
|
|
1984
|
-
alt:
|
|
1985
|
-
description:
|
|
1877
|
+
type: z14.literal(BlockType.image).default(BlockType.image)
|
|
1878
|
+
});
|
|
1879
|
+
var ImageContentBlock = z14.object({
|
|
1880
|
+
id: z14.string().optional().default(() => uuidv42()),
|
|
1881
|
+
name: z14.string().optional(),
|
|
1882
|
+
settings: z14.object({
|
|
1883
|
+
alt: z14.string().optional().default(""),
|
|
1884
|
+
description: z14.union([z14.string(), TiptapDocument, z14.null()]).default(
|
|
1986
1885
|
"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."
|
|
1987
1886
|
),
|
|
1988
1887
|
descriptionSize: TextSize.default("medium"),
|
|
1989
1888
|
horizontalAlignment: TextAlignment2.default("leading"),
|
|
1990
|
-
image:
|
|
1991
|
-
imagePlacement:
|
|
1992
|
-
imageSize:
|
|
1993
|
-
superTitle:
|
|
1889
|
+
image: z14.union([z14.literal(""), z14.url()]).default(""),
|
|
1890
|
+
imagePlacement: z14.enum(["bottom", "left", "right", "top"]).optional().default("left"),
|
|
1891
|
+
imageSize: z14.number().default(20),
|
|
1892
|
+
superTitle: z14.union([z14.string(), TiptapDocument]).default("Lorem Ipsum!"),
|
|
1994
1893
|
superTitleSize: TextSize.default("medium"),
|
|
1995
1894
|
/** This isn't configurable in the admin-nextjs editor */
|
|
1996
|
-
swapContent:
|
|
1997
|
-
title:
|
|
1895
|
+
swapContent: z14.boolean().optional().default(false),
|
|
1896
|
+
title: z14.union([z14.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet"),
|
|
1998
1897
|
titleSize: TextSize.default("medium")
|
|
1999
1898
|
}),
|
|
2000
|
-
type:
|
|
2001
|
-
});
|
|
2002
|
-
var PayButtonBlock =
|
|
2003
|
-
id:
|
|
2004
|
-
name:
|
|
2005
|
-
settings:
|
|
2006
|
-
|
|
2007
|
-
label:
|
|
1899
|
+
type: z14.literal(BlockType.image_content).default(BlockType.image_content)
|
|
1900
|
+
});
|
|
1901
|
+
var PayButtonBlock = z14.object({
|
|
1902
|
+
id: z14.string().optional().default(() => uuidv42()),
|
|
1903
|
+
name: z14.string().optional(),
|
|
1904
|
+
settings: z14.union([
|
|
1905
|
+
z14.object({
|
|
1906
|
+
label: z14.string().default("Pay Now")
|
|
2008
1907
|
}),
|
|
2009
|
-
|
|
1908
|
+
z14.array(z14.never()).transform(() => ({
|
|
2010
1909
|
label: "Pay Now"
|
|
2011
1910
|
}))
|
|
2012
1911
|
]),
|
|
2013
|
-
styles:
|
|
2014
|
-
|
|
2015
|
-
buttonWidth:
|
|
1912
|
+
styles: z14.union([
|
|
1913
|
+
z14.object({
|
|
1914
|
+
buttonWidth: z14.number().min(10).max(100).default(50)
|
|
2016
1915
|
}),
|
|
2017
|
-
|
|
1916
|
+
z14.array(z14.never()).transform(() => ({
|
|
2018
1917
|
buttonWidth: 50
|
|
2019
1918
|
}))
|
|
2020
1919
|
]),
|
|
2021
|
-
type:
|
|
1920
|
+
type: z14.literal(BlockType.pay_button).default(BlockType.pay_button)
|
|
2022
1921
|
});
|
|
2023
|
-
var ProductInformationBlock =
|
|
1922
|
+
var ProductInformationBlock = z14.object({
|
|
2024
1923
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2025
|
-
hideProductImage:
|
|
2026
|
-
id:
|
|
2027
|
-
name:
|
|
2028
|
-
type:
|
|
2029
|
-
});
|
|
2030
|
-
var SeparatorBlock =
|
|
2031
|
-
id:
|
|
2032
|
-
name:
|
|
2033
|
-
type:
|
|
2034
|
-
});
|
|
2035
|
-
var TextBlock =
|
|
2036
|
-
id:
|
|
2037
|
-
name:
|
|
2038
|
-
settings:
|
|
2039
|
-
description:
|
|
1924
|
+
hideProductImage: z14.boolean().optional().default(false),
|
|
1925
|
+
id: z14.string().optional().default(() => uuidv42()),
|
|
1926
|
+
name: z14.string().optional(),
|
|
1927
|
+
type: z14.literal(BlockType.product_information).default(BlockType.product_information)
|
|
1928
|
+
});
|
|
1929
|
+
var SeparatorBlock = z14.object({
|
|
1930
|
+
id: z14.string().optional().default(() => uuidv42()),
|
|
1931
|
+
name: z14.string().optional(),
|
|
1932
|
+
type: z14.literal(BlockType.separator).default(BlockType.separator)
|
|
1933
|
+
});
|
|
1934
|
+
var TextBlock = z14.object({
|
|
1935
|
+
id: z14.string().optional().default(() => uuidv42()),
|
|
1936
|
+
name: z14.string().optional(),
|
|
1937
|
+
settings: z14.object({
|
|
1938
|
+
description: z14.union([z14.string(), TiptapDocument]).optional().default(
|
|
2040
1939
|
"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."
|
|
2041
1940
|
),
|
|
2042
1941
|
/** This isn't used in the post-purchase offer widget */
|
|
2043
1942
|
descriptionSize: TextSize.default("medium"),
|
|
2044
1943
|
horizontalAlignment: TextAlignment2.default("leading"),
|
|
2045
|
-
superTitle:
|
|
1944
|
+
superTitle: z14.union([z14.string(), TiptapDocument]).default("Super Title"),
|
|
2046
1945
|
/** This isn't used in the post-purchase offer widget */
|
|
2047
1946
|
superTitleSize: TextSize.default("medium"),
|
|
2048
|
-
title:
|
|
1947
|
+
title: z14.union([z14.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet."),
|
|
2049
1948
|
/** This isn't used in the post-purchase offer widget */
|
|
2050
1949
|
titleSize: TextSize.default("medium")
|
|
2051
1950
|
}),
|
|
2052
|
-
type:
|
|
2053
|
-
});
|
|
2054
|
-
var TimerBlock =
|
|
2055
|
-
id:
|
|
2056
|
-
name:
|
|
2057
|
-
settings:
|
|
2058
|
-
durationMinutes:
|
|
2059
|
-
durationSeconds:
|
|
2060
|
-
endOffer:
|
|
2061
|
-
title:
|
|
1951
|
+
type: z14.literal(BlockType.text).default(BlockType.text)
|
|
1952
|
+
});
|
|
1953
|
+
var TimerBlock = z14.object({
|
|
1954
|
+
id: z14.string().optional().default(() => uuidv42()),
|
|
1955
|
+
name: z14.string().optional(),
|
|
1956
|
+
settings: z14.object({
|
|
1957
|
+
durationMinutes: z14.number().min(0).default(10),
|
|
1958
|
+
durationSeconds: z14.union([z14.number().min(0), z14.unknown().transform(() => 0)]).default(0),
|
|
1959
|
+
endOffer: z14.boolean().default(true),
|
|
1960
|
+
title: z14.union([z14.string(), TiptapDocument]).default("Hurry \u2014 your special offer ends in:")
|
|
2062
1961
|
}),
|
|
2063
|
-
styles:
|
|
1962
|
+
styles: z14.object({
|
|
2064
1963
|
textAlignment: TextAlignment2.default("center"),
|
|
2065
|
-
timerBackgroundColor:
|
|
2066
|
-
timerEmphasized:
|
|
1964
|
+
timerBackgroundColor: z14.enum(["info", "warning", "success", "critical"]).default("warning"),
|
|
1965
|
+
timerEmphasized: z14.union([z14.boolean(), z14.unknown().transform(() => true)]).default(true),
|
|
2067
1966
|
timerSize: TextSize.default("medium"),
|
|
2068
|
-
timerWidth:
|
|
2069
|
-
titleEmphasized:
|
|
1967
|
+
timerWidth: z14.number().min(10).max(100).optional().default(100),
|
|
1968
|
+
titleEmphasized: z14.union([z14.boolean(), z14.unknown().transform(() => true)]).default(false),
|
|
2070
1969
|
titleSize: TextSize.default("medium")
|
|
2071
1970
|
}),
|
|
2072
|
-
type:
|
|
1971
|
+
type: z14.literal(BlockType.timer).default(BlockType.timer)
|
|
2073
1972
|
});
|
|
2074
|
-
var PostPurchaseBlock =
|
|
1973
|
+
var PostPurchaseBlock = z14.discriminatedUnion("type", [
|
|
2075
1974
|
CalloutBannerBlock,
|
|
2076
1975
|
ImageBlock,
|
|
2077
1976
|
ImageContentBlock,
|
|
@@ -2091,61 +1990,61 @@ var isTextBlock = (block) => isEqual(get3(block, "type"), BlockType.text);
|
|
|
2091
1990
|
var isTimerBlock = (block) => isEqual(get3(block, "type"), BlockType.timer);
|
|
2092
1991
|
|
|
2093
1992
|
// src/schema/widgets/post-purchase-offer/postPurchaseSettings.ts
|
|
2094
|
-
var PostPurchaseSettings =
|
|
2095
|
-
advance:
|
|
2096
|
-
blocks:
|
|
1993
|
+
var PostPurchaseSettings = z15.object({
|
|
1994
|
+
advance: z15.object({ removePartialOrder: z15.boolean().default(true) }).optional().default(() => ({ removePartialOrder: true })),
|
|
1995
|
+
blocks: z15.union([z15.array(PostPurchaseBlock), z15.unknown().transform(() => [])]).default(() => [
|
|
2097
1996
|
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.timer }),
|
|
2098
1997
|
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.callout_banner }),
|
|
2099
1998
|
PostPurchaseBlock.parse({ type: BlockType.product_information })
|
|
2100
1999
|
]),
|
|
2101
|
-
columnLayout:
|
|
2102
|
-
discount:
|
|
2000
|
+
columnLayout: z15.boolean().optional(),
|
|
2001
|
+
discount: z15.object({
|
|
2103
2002
|
amount: strictNumber.default(30),
|
|
2104
|
-
shouldShowSavingText:
|
|
2105
|
-
type:
|
|
2003
|
+
shouldShowSavingText: z15.boolean().optional().default(true),
|
|
2004
|
+
type: z15.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
2106
2005
|
}),
|
|
2107
|
-
discountedFrom:
|
|
2108
|
-
endpoint:
|
|
2109
|
-
integrations:
|
|
2110
|
-
judgeme:
|
|
2111
|
-
junip:
|
|
2112
|
-
klaviyo:
|
|
2113
|
-
loox:
|
|
2114
|
-
okendo:
|
|
2115
|
-
opinew:
|
|
2116
|
-
reviewsio:
|
|
2117
|
-
stamped:
|
|
2118
|
-
yotpo:
|
|
2006
|
+
discountedFrom: z15.enum(["price", "compare_at_price"]).optional().default("price"),
|
|
2007
|
+
endpoint: z15.string().optional(),
|
|
2008
|
+
integrations: z15.object({
|
|
2009
|
+
judgeme: z15.boolean().default(false),
|
|
2010
|
+
junip: z15.boolean().optional().default(false),
|
|
2011
|
+
klaviyo: z15.boolean().default(false),
|
|
2012
|
+
loox: z15.boolean().default(false),
|
|
2013
|
+
okendo: z15.boolean().default(false),
|
|
2014
|
+
opinew: z15.boolean().optional().default(false),
|
|
2015
|
+
reviewsio: z15.boolean().optional().default(false),
|
|
2016
|
+
stamped: z15.boolean().default(false),
|
|
2017
|
+
yotpo: z15.boolean().default(false)
|
|
2119
2018
|
}),
|
|
2120
|
-
key:
|
|
2121
|
-
language:
|
|
2122
|
-
description:
|
|
2123
|
-
descriptionEnabled:
|
|
2124
|
-
descriptionRte:
|
|
2125
|
-
content:
|
|
2126
|
-
type:
|
|
2019
|
+
key: z15.string().optional(),
|
|
2020
|
+
language: z15.object({
|
|
2021
|
+
description: z15.union([z15.string(), z15.unknown().transform(() => "")]).default(""),
|
|
2022
|
+
descriptionEnabled: z15.boolean().optional().default(false),
|
|
2023
|
+
descriptionRte: z15.object({
|
|
2024
|
+
content: z15.array(z15.unknown()),
|
|
2025
|
+
type: z15.string()
|
|
2127
2026
|
}).optional(),
|
|
2128
|
-
descriptionSpacing:
|
|
2129
|
-
displayCtaPrice:
|
|
2130
|
-
global:
|
|
2131
|
-
declineAll:
|
|
2132
|
-
declineThisOffer:
|
|
2133
|
-
free:
|
|
2134
|
-
notAvailable:
|
|
2135
|
-
payNow:
|
|
2136
|
-
payNowUpgradeToSubscription:
|
|
2137
|
-
quantity:
|
|
2027
|
+
descriptionSpacing: z15.enum(["none", "xtight", "tight", "default", "loose", "xloose"]).optional(),
|
|
2028
|
+
displayCtaPrice: z15.boolean().default(true),
|
|
2029
|
+
global: z15.object({
|
|
2030
|
+
declineAll: z15.string().optional().default("Decline All"),
|
|
2031
|
+
declineThisOffer: z15.string().default("Decline this offer"),
|
|
2032
|
+
free: z15.string().optional().default("Free"),
|
|
2033
|
+
notAvailable: z15.string().optional().default("Not available"),
|
|
2034
|
+
payNow: z15.string().default("Pay Now"),
|
|
2035
|
+
payNowUpgradeToSubscription: z15.string().optional().default("Upgrade to Subscription"),
|
|
2036
|
+
quantity: z15.string().default("Quantity"),
|
|
2138
2037
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2139
|
-
recurringShipping:
|
|
2140
|
-
recurringSubtotal:
|
|
2141
|
-
reviewsPlural:
|
|
2142
|
-
reviewsSingular:
|
|
2143
|
-
save:
|
|
2144
|
-
shipping:
|
|
2145
|
-
subscriptionOption:
|
|
2146
|
-
subtotal:
|
|
2147
|
-
taxes:
|
|
2148
|
-
total:
|
|
2038
|
+
recurringShipping: z15.string().optional().default("Recurring shipping"),
|
|
2039
|
+
recurringSubtotal: z15.string().default("Recurring subtotal"),
|
|
2040
|
+
reviewsPlural: z15.string().optional().default("Reviews"),
|
|
2041
|
+
reviewsSingular: z15.string().optional().default("Review"),
|
|
2042
|
+
save: z15.union([z15.string(), z15.unknown().transform(() => "Save")]).optional().default("Save"),
|
|
2043
|
+
shipping: z15.string().default("Shipping"),
|
|
2044
|
+
subscriptionOption: z15.string().optional().default("Subscribe and Save"),
|
|
2045
|
+
subtotal: z15.string().default("Subtotal"),
|
|
2046
|
+
taxes: z15.string().default("Taxes"),
|
|
2047
|
+
total: z15.string().default("Total")
|
|
2149
2048
|
}).optional().default(() => ({
|
|
2150
2049
|
declineAll: "Decline All",
|
|
2151
2050
|
declineThisOffer: "Decline this offer",
|
|
@@ -2166,70 +2065,70 @@ var PostPurchaseSettings = z20.object({
|
|
|
2166
2065
|
taxes: "Taxes",
|
|
2167
2066
|
total: "Total"
|
|
2168
2067
|
})),
|
|
2169
|
-
globalTranslation:
|
|
2068
|
+
globalTranslation: z15.string().optional().default("english")
|
|
2170
2069
|
}),
|
|
2171
|
-
metafields:
|
|
2070
|
+
metafields: z15.boolean().default(false),
|
|
2172
2071
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2173
|
-
offer:
|
|
2174
|
-
count:
|
|
2072
|
+
offer: z15.object({
|
|
2073
|
+
count: z15.number().default(1)
|
|
2175
2074
|
}),
|
|
2176
|
-
offersLayout:
|
|
2177
|
-
itemsPerPage:
|
|
2178
|
-
type:
|
|
2075
|
+
offersLayout: z15.object({
|
|
2076
|
+
itemsPerPage: z15.number().optional(),
|
|
2077
|
+
type: z15.enum(["list", "grid", "carousel"]).default("list")
|
|
2179
2078
|
}).optional().default({
|
|
2180
2079
|
type: "list"
|
|
2181
2080
|
}),
|
|
2182
2081
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2183
|
-
previewMode:
|
|
2184
|
-
productLimit:
|
|
2185
|
-
productOptions:
|
|
2082
|
+
previewMode: z15.boolean().default(false),
|
|
2083
|
+
productLimit: z15.number().optional().default(1),
|
|
2084
|
+
productOptions: z15.object({
|
|
2186
2085
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2187
|
-
hideOutOfStockVariants:
|
|
2188
|
-
matchVariant:
|
|
2189
|
-
showDeclineAll:
|
|
2190
|
-
showShipping:
|
|
2191
|
-
showSubtotal:
|
|
2192
|
-
showTaxes:
|
|
2193
|
-
showTotal:
|
|
2194
|
-
showVariantSelectors:
|
|
2195
|
-
variantSelectorDisplayMode:
|
|
2086
|
+
hideOutOfStockVariants: z15.boolean().optional().default(false),
|
|
2087
|
+
matchVariant: z15.boolean().optional().default(true),
|
|
2088
|
+
showDeclineAll: z15.enum(["above", "below", "both", "none"]).optional(),
|
|
2089
|
+
showShipping: z15.boolean().optional().default(true),
|
|
2090
|
+
showSubtotal: z15.boolean().optional().default(true),
|
|
2091
|
+
showTaxes: z15.boolean().optional().default(true),
|
|
2092
|
+
showTotal: z15.boolean().optional().default(true),
|
|
2093
|
+
showVariantSelectors: z15.boolean().optional().default(true),
|
|
2094
|
+
variantSelectorDisplayMode: z15.enum(["separate", "single"]).optional().default("separate")
|
|
2196
2095
|
}),
|
|
2197
|
-
productType:
|
|
2198
|
-
productTypeSelector:
|
|
2199
|
-
quantityInputs:
|
|
2200
|
-
defaultQuantity:
|
|
2201
|
-
enabled:
|
|
2202
|
-
maxValue:
|
|
2203
|
-
minValue:
|
|
2096
|
+
productType: z15.union([z15.enum(["one-time", "subscription", "both"]), z15.literal("").transform(() => "one-time")]).default("one-time"),
|
|
2097
|
+
productTypeSelector: z15.enum(["dropdown", "radio"]).optional().default("radio"),
|
|
2098
|
+
quantityInputs: z15.object({
|
|
2099
|
+
defaultQuantity: z15.union([z15.number(), z15.null().transform(() => 1)]).default(1),
|
|
2100
|
+
enabled: z15.boolean().default(true),
|
|
2101
|
+
maxValue: z15.union([z15.number(), z15.null().transform(() => 15)]).default(15),
|
|
2102
|
+
minValue: z15.union([z15.number().min(0), z15.unknown().transform(() => 0)]).default(1)
|
|
2204
2103
|
}),
|
|
2205
|
-
shipping:
|
|
2104
|
+
shipping: z15.object({
|
|
2206
2105
|
amount: strictNumber.default(10),
|
|
2207
2106
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2208
|
-
enabled:
|
|
2209
|
-
title:
|
|
2210
|
-
type:
|
|
2107
|
+
enabled: z15.boolean().default(true),
|
|
2108
|
+
title: z15.string().optional().default("Shipping Fees"),
|
|
2109
|
+
type: z15.enum(["free", "fixed_amount"]).default("free")
|
|
2211
2110
|
}),
|
|
2212
|
-
styles:
|
|
2213
|
-
starColor:
|
|
2214
|
-
starSize:
|
|
2215
|
-
starStrokeColor:
|
|
2216
|
-
strokeWidth:
|
|
2111
|
+
styles: z15.object({
|
|
2112
|
+
starColor: z15.string().optional().default("#fadb14"),
|
|
2113
|
+
starSize: z15.union([z15.enum(["small", "medium", "large"]), z15.unknown().transform(() => "large")]).optional().default("large"),
|
|
2114
|
+
starStrokeColor: z15.string().optional().default("#fadb14"),
|
|
2115
|
+
strokeWidth: z15.string().optional().default("1")
|
|
2217
2116
|
}).optional(),
|
|
2218
|
-
subImages:
|
|
2219
|
-
subscription:
|
|
2220
|
-
discount:
|
|
2117
|
+
subImages: z15.number().nullish().default(8),
|
|
2118
|
+
subscription: z15.object({
|
|
2119
|
+
discount: z15.object({
|
|
2221
2120
|
amount: strictNumber.default(30),
|
|
2222
|
-
shouldShowSavingText:
|
|
2223
|
-
type:
|
|
2121
|
+
shouldShowSavingText: z15.boolean().optional().default(true),
|
|
2122
|
+
type: z15.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
2224
2123
|
}),
|
|
2225
|
-
shipping:
|
|
2124
|
+
shipping: z15.object({
|
|
2226
2125
|
amount: strictNumber.default(1),
|
|
2227
2126
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2228
|
-
enabled:
|
|
2127
|
+
enabled: z15.boolean().default(true),
|
|
2229
2128
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2230
2129
|
recurringAmount: strictNumber.default(2),
|
|
2231
|
-
shippingTitle:
|
|
2232
|
-
type:
|
|
2130
|
+
shippingTitle: z15.string().default("Shipping Fees"),
|
|
2131
|
+
type: z15.enum(["free", "fixed_amount"]).default("free")
|
|
2233
2132
|
})
|
|
2234
2133
|
}).optional().default({
|
|
2235
2134
|
discount: {
|
|
@@ -2247,15 +2146,15 @@ var PostPurchaseSettings = z20.object({
|
|
|
2247
2146
|
type: "free"
|
|
2248
2147
|
}
|
|
2249
2148
|
}),
|
|
2250
|
-
subscriptionIsDefault:
|
|
2149
|
+
subscriptionIsDefault: z15.boolean().optional(),
|
|
2251
2150
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2252
|
-
template:
|
|
2253
|
-
type:
|
|
2254
|
-
upgradeToSubscription:
|
|
2255
|
-
acceptButtonText:
|
|
2256
|
-
allow:
|
|
2257
|
-
emailRefundNotice:
|
|
2258
|
-
errorBannerText:
|
|
2151
|
+
template: z15.string().optional().default(""),
|
|
2152
|
+
type: z15.literal("shopify_post_purchase_extension").default("shopify_post_purchase_extension"),
|
|
2153
|
+
upgradeToSubscription: z15.object({
|
|
2154
|
+
acceptButtonText: z15.string().optional().default("Upgrade"),
|
|
2155
|
+
allow: z15.boolean().optional().default(false),
|
|
2156
|
+
emailRefundNotice: z15.boolean().optional().default(false),
|
|
2157
|
+
errorBannerText: z15.string().optional().default("This subscription cannot be added - limit one per order")
|
|
2259
2158
|
}).optional().default(() => ({
|
|
2260
2159
|
acceptButtonText: "Upgrade",
|
|
2261
2160
|
allow: false,
|
|
@@ -2264,12 +2163,109 @@ var PostPurchaseSettings = z20.object({
|
|
|
2264
2163
|
}))
|
|
2265
2164
|
});
|
|
2266
2165
|
|
|
2166
|
+
// src/schema/postPurchaseChoice.ts
|
|
2167
|
+
var PostPurchaseChoice = z16.discriminatedUnion("mode", [
|
|
2168
|
+
z16.object({ mode: z16.literal("one-time") }).strict(),
|
|
2169
|
+
z16.object({ mode: z16.literal("subscription"), sellingPlanId: PostPurchasePlanOption.shape.id }).strict()
|
|
2170
|
+
]);
|
|
2171
|
+
var PostPurchaseOptions = z16.object({
|
|
2172
|
+
defaultChoice: PostPurchaseChoice,
|
|
2173
|
+
modes: z16.array(z16.enum(["one-time", "subscription"])).min(1).max(2),
|
|
2174
|
+
selector: PostPurchaseSettings.shape.productTypeSelector
|
|
2175
|
+
});
|
|
2176
|
+
|
|
2177
|
+
// src/schema/postPurchaseEligibility.ts
|
|
2178
|
+
import { z as z17 } from "zod";
|
|
2179
|
+
var PostPurchaseSkipReasonSchema = z17.enum(["empty", "no-eligible-subscription"]);
|
|
2180
|
+
|
|
2181
|
+
// src/schema/postPurchaseExitPolicy.ts
|
|
2182
|
+
import { z as z18 } from "zod";
|
|
2183
|
+
var EXIT_DELAY_MAX_MS = 60 * 60 * 1e3;
|
|
2184
|
+
var ExitPolicySchema = z18.discriminatedUnion("status", [
|
|
2185
|
+
z18.strictObject({ status: z18.literal("unavailable") }),
|
|
2186
|
+
z18.strictObject({
|
|
2187
|
+
delayMs: z18.number().int().nonnegative().max(EXIT_DELAY_MAX_MS),
|
|
2188
|
+
source: z18.enum(["admitted", "selected-flow"]),
|
|
2189
|
+
status: z18.literal("available")
|
|
2190
|
+
})
|
|
2191
|
+
]);
|
|
2192
|
+
|
|
2193
|
+
// src/schema/postPurchaseIdentity.ts
|
|
2194
|
+
import { z as z19 } from "zod";
|
|
2195
|
+
var POST_PURCHASE_ID_MAX = 128;
|
|
2196
|
+
var PostPurchaseTimestampSchema = z19.number().int().nonnegative();
|
|
2197
|
+
var PostPurchaseOrderIdSchema = z19.string().regex(/^gid:\/\/shopify\/Order\/[1-9]\d*$/);
|
|
2198
|
+
var ShopifyDomainSchema = z19.string().max(POST_PURCHASE_ID_MAX).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?\.myshopify\.com$/);
|
|
2199
|
+
var DecideRequestSchema = z19.object({
|
|
2200
|
+
checkoutToken: z19.string().min(1).max(POST_PURCHASE_ID_MAX),
|
|
2201
|
+
shop: ShopifyDomainSchema
|
|
2202
|
+
});
|
|
2203
|
+
var PostPurchaseAppIdSchema = z19.string().min(1).max(POST_PURCHASE_ID_MAX);
|
|
2204
|
+
var DecisionEntrySchema = z19.object({
|
|
2205
|
+
blockId: z19.number().int().positive(),
|
|
2206
|
+
blockIndex: z19.string(),
|
|
2207
|
+
blockParentIndex: z19.string(),
|
|
2208
|
+
flowId: z19.number().int().positive(),
|
|
2209
|
+
sectionId: z19.number().int().positive(),
|
|
2210
|
+
widgetId: z19.number().int().positive(),
|
|
2211
|
+
widgetTraffic: z19.number().min(0).max(100)
|
|
2212
|
+
});
|
|
2213
|
+
|
|
2214
|
+
// src/schema/postPurchaseOrderDecision.ts
|
|
2215
|
+
import { z as z20 } from "zod";
|
|
2216
|
+
var OrderDecisionSchema = z20.discriminatedUnion("owner", [
|
|
2217
|
+
z20.object({ owner: z20.literal("session"), sessionId: z20.string().regex(/^[a-f0-9]{64}$/) }),
|
|
2218
|
+
z20.object({ owner: z20.literal("release"), sessionId: z20.null() })
|
|
2219
|
+
]);
|
|
2220
|
+
|
|
2221
|
+
// src/schema/postPurchasePolicy.ts
|
|
2222
|
+
import { z as z21 } from "zod";
|
|
2223
|
+
var HoldSettingSchema = z21.discriminatedUnion("enabled", [
|
|
2224
|
+
z21.object({ durationMinutes: z21.number().int().min(1).max(60), enabled: z21.literal(true) }),
|
|
2225
|
+
z21.object({ durationMinutes: z21.null(), enabled: z21.literal(false) })
|
|
2226
|
+
]);
|
|
2227
|
+
var TimingSettingsSchema = z21.object({ flowHold: HoldSettingSchema, shopHold: HoldSettingSchema });
|
|
2228
|
+
var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
2229
|
+
durationMinutes: z21.number().int().min(1).max(60).nullable(),
|
|
2230
|
+
source: z21.enum(["shop", "flow", "native"])
|
|
2231
|
+
}).refine(
|
|
2232
|
+
(policy) => {
|
|
2233
|
+
const expectedSource = policy.shopHold.enabled ? "shop" : policy.flowHold.enabled ? "flow" : "native";
|
|
2234
|
+
const expectedDuration = expectedSource === "shop" ? policy.shopHold.durationMinutes : expectedSource === "flow" ? policy.flowHold.durationMinutes : null;
|
|
2235
|
+
return policy.source === expectedSource && policy.durationMinutes === expectedDuration;
|
|
2236
|
+
},
|
|
2237
|
+
{
|
|
2238
|
+
message: "source and durationMinutes must reflect the shop-over-flow-over-native precedence",
|
|
2239
|
+
path: ["source"]
|
|
2240
|
+
}
|
|
2241
|
+
);
|
|
2242
|
+
|
|
2243
|
+
// src/schema/postPurchaseProduct.ts
|
|
2244
|
+
import { z as z26 } from "zod";
|
|
2245
|
+
|
|
2246
|
+
// src/schema/postPurchaseProductDisplay.ts
|
|
2247
|
+
import { z as z23 } from "zod";
|
|
2248
|
+
|
|
2249
|
+
// src/schema/postPurchaseProductGallery.ts
|
|
2250
|
+
import { z as z22 } from "zod";
|
|
2251
|
+
var PostPurchaseProductGallery = z22.object({
|
|
2252
|
+
images: z22.array(
|
|
2253
|
+
z22.object({
|
|
2254
|
+
description: z22.string(),
|
|
2255
|
+
id: z22.number().int().positive(),
|
|
2256
|
+
source: z22.string(),
|
|
2257
|
+
thumbnail: z22.string()
|
|
2258
|
+
})
|
|
2259
|
+
),
|
|
2260
|
+
selectedImageId: z22.number().int().positive().optional()
|
|
2261
|
+
});
|
|
2262
|
+
|
|
2267
2263
|
// src/schema/postPurchaseProductDisplay.ts
|
|
2268
2264
|
var language = PostPurchaseSettings.shape.language;
|
|
2269
|
-
var PostPurchasePrimaryImageSource =
|
|
2265
|
+
var PostPurchasePrimaryImageSource = z23.string().default(
|
|
2270
2266
|
"https://cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c.gif"
|
|
2271
2267
|
);
|
|
2272
|
-
var PostPurchaseProductDisplay =
|
|
2268
|
+
var PostPurchaseProductDisplay = z23.object({
|
|
2273
2269
|
discountedFrom: PostPurchaseSettings.shape.discountedFrom,
|
|
2274
2270
|
gallery: PostPurchaseProductGallery.optional(),
|
|
2275
2271
|
language: language.pick({
|
|
@@ -2278,7 +2274,7 @@ var PostPurchaseProductDisplay = z21.object({
|
|
|
2278
2274
|
descriptionRte: true,
|
|
2279
2275
|
descriptionSpacing: true
|
|
2280
2276
|
}),
|
|
2281
|
-
primaryImage:
|
|
2277
|
+
primaryImage: z23.object({ description: z23.string(), source: z23.string() }),
|
|
2282
2278
|
productOptions: PostPurchaseSettings.shape.productOptions.pick({
|
|
2283
2279
|
showDeclineAll: true,
|
|
2284
2280
|
showShipping: true,
|
|
@@ -2291,9 +2287,126 @@ var PostPurchaseProductDisplay = z21.object({
|
|
|
2291
2287
|
shouldShowSavingText: PostPurchaseSettings.shape.discount.shape.shouldShowSavingText
|
|
2292
2288
|
});
|
|
2293
2289
|
|
|
2290
|
+
// src/schema/postPurchaseProductSource.ts
|
|
2291
|
+
import { z as z24 } from "zod";
|
|
2292
|
+
var PostPurchaseAmount = z24.string().regex(/^\d+(?:\.\d+)?$/).refine((value) => Number.isFinite(Number(value)));
|
|
2293
|
+
var PostPurchaseProductId = z24.number().int().positive();
|
|
2294
|
+
var PostPurchaseVariantId = z24.number().int().positive();
|
|
2295
|
+
var ProductBase = OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
|
|
2296
|
+
description: OfferProduct.shape.description.nullable(),
|
|
2297
|
+
id: PostPurchaseProductId
|
|
2298
|
+
});
|
|
2299
|
+
var SourceVariant = OfferProduct.shape.variants.element.pick({ id: true, title: true }).extend({
|
|
2300
|
+
compareAtPrice: PostPurchaseAmount.nullable(),
|
|
2301
|
+
id: PostPurchaseVariantId,
|
|
2302
|
+
imageId: z24.number().int().nonnegative().nullish(),
|
|
2303
|
+
inventoryManagement: z24.string().nullable(),
|
|
2304
|
+
inventoryPolicy: z24.string(),
|
|
2305
|
+
inventoryQuantity: z24.number(),
|
|
2306
|
+
option1: z24.unknown().optional(),
|
|
2307
|
+
option2: z24.unknown().optional(),
|
|
2308
|
+
option3: z24.unknown().optional(),
|
|
2309
|
+
price: PostPurchaseAmount,
|
|
2310
|
+
productId: PostPurchaseProductId,
|
|
2311
|
+
sellingPlanAllocations: z24.unknown().optional()
|
|
2312
|
+
});
|
|
2313
|
+
var Product2 = ProductBase.extend({
|
|
2314
|
+
images: z24.array(
|
|
2315
|
+
z24.object({ alt: z24.string().optional().catch(void 0), id: z24.number().int().positive(), src: z24.string() })
|
|
2316
|
+
).nullish(),
|
|
2317
|
+
metadata: z24.object({
|
|
2318
|
+
productQuantity: z24.union([
|
|
2319
|
+
z24.number().int().positive(),
|
|
2320
|
+
z24.string().regex(/^[1-9]\d*$/).transform(Number)
|
|
2321
|
+
]).optional()
|
|
2322
|
+
}).optional(),
|
|
2323
|
+
metafields: z24.unknown().optional(),
|
|
2324
|
+
options: z24.unknown().optional(),
|
|
2325
|
+
productGroupVariants: z24.array(z24.unknown()).default([]),
|
|
2326
|
+
selectedVariant: z24.unknown().optional(),
|
|
2327
|
+
sellingPlanGroups: z24.array(
|
|
2328
|
+
OfferProduct.shape.sellingPlanGroups.unwrap().element.extend({
|
|
2329
|
+
discountAmount: z24.unknown().optional(),
|
|
2330
|
+
discountType: z24.unknown().optional(),
|
|
2331
|
+
id: z24.unknown().optional(),
|
|
2332
|
+
requiresSellingPlan: z24.boolean().default(false),
|
|
2333
|
+
sellingPlans: z24.unknown().optional()
|
|
2334
|
+
})
|
|
2335
|
+
).default([]),
|
|
2336
|
+
variants: z24.array(SourceVariant)
|
|
2337
|
+
});
|
|
2338
|
+
var PostPurchaseProductSource = z24.object({
|
|
2339
|
+
data: z24.array(Product2),
|
|
2340
|
+
metadata: z24.object({ widget: z24.record(z24.string(), z24.unknown()).default({}) }).default({ widget: {} })
|
|
2341
|
+
});
|
|
2342
|
+
|
|
2343
|
+
// src/schema/postPurchaseSubscription.ts
|
|
2344
|
+
import { z as z25 } from "zod";
|
|
2345
|
+
var PostPurchaseSubscriptionTerms = z25.object({
|
|
2346
|
+
adjustment: PostPurchasePlanAdjustment.optional(),
|
|
2347
|
+
initialShippingPrice: z25.number().nonnegative(),
|
|
2348
|
+
intervalLabel: z25.string().min(1),
|
|
2349
|
+
name: z25.string().min(1),
|
|
2350
|
+
recurringShippingPrice: z25.number().nonnegative(),
|
|
2351
|
+
shippingOption: z25.object({ presentmentTitle: z25.string(), title: z25.string() })
|
|
2352
|
+
});
|
|
2353
|
+
|
|
2354
|
+
// src/schema/postPurchaseProduct.ts
|
|
2355
|
+
var global = PostPurchaseSettings.shape.language.shape.global.unwrap().unwrap().shape;
|
|
2356
|
+
var PostPurchaseVariant = OfferProduct.shape.variants.element.pick({ id: true, title: true }).extend({
|
|
2357
|
+
compareAtPrice: PostPurchaseAmount.nullable(),
|
|
2358
|
+
id: PostPurchaseVariantId,
|
|
2359
|
+
price: PostPurchaseAmount
|
|
2360
|
+
});
|
|
2361
|
+
var PreparedPostPurchaseProduct = z26.object({
|
|
2362
|
+
display: PostPurchaseProductDisplay,
|
|
2363
|
+
labels: z26.object({
|
|
2364
|
+
declineAll: global.declineAll,
|
|
2365
|
+
free: z26.string(),
|
|
2366
|
+
payNow: z26.string(),
|
|
2367
|
+
quantity: z26.string(),
|
|
2368
|
+
recurringShipping: global.recurringShipping,
|
|
2369
|
+
recurringSubtotal: global.recurringSubtotal,
|
|
2370
|
+
save: z26.string(),
|
|
2371
|
+
shipping: z26.string(),
|
|
2372
|
+
subtotal: z26.string(),
|
|
2373
|
+
taxes: z26.string(),
|
|
2374
|
+
total: z26.string()
|
|
2375
|
+
}),
|
|
2376
|
+
product: OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
|
|
2377
|
+
description: OfferProduct.shape.description.nullable(),
|
|
2378
|
+
id: PostPurchaseProductId,
|
|
2379
|
+
variant: PostPurchaseVariant
|
|
2380
|
+
}),
|
|
2381
|
+
selection: z26.object({
|
|
2382
|
+
productId: PostPurchaseProductId,
|
|
2383
|
+
quantity: z26.number().int().positive(),
|
|
2384
|
+
sellingPlanId: z26.number().int().positive().optional(),
|
|
2385
|
+
variantId: PostPurchaseVariantId
|
|
2386
|
+
}),
|
|
2387
|
+
status: z26.literal("prepared"),
|
|
2388
|
+
terms: z26.object({
|
|
2389
|
+
discount: PostPurchaseDiscount,
|
|
2390
|
+
shipping: z26.object({
|
|
2391
|
+
amount: z26.number().nonnegative(),
|
|
2392
|
+
title: z26.string(),
|
|
2393
|
+
type: z26.enum(["free", "fixed_amount"])
|
|
2394
|
+
}),
|
|
2395
|
+
subscription: PostPurchaseSubscriptionTerms.optional()
|
|
2396
|
+
})
|
|
2397
|
+
});
|
|
2398
|
+
var PostPurchasePreparation = z26.discriminatedUnion("status", [
|
|
2399
|
+
PreparedPostPurchaseProduct,
|
|
2400
|
+
z26.object({ reason: z26.string(), status: z26.literal("unsupported") })
|
|
2401
|
+
]);
|
|
2402
|
+
|
|
2403
|
+
// src/schema/postPurchaseProductCollectionView.ts
|
|
2404
|
+
import { z as z27 } from "zod";
|
|
2405
|
+
var PostPurchaseExcludedProductIds = z27.array(PostPurchaseProductId).default([]);
|
|
2406
|
+
|
|
2294
2407
|
// src/schema/postPurchaseProductSettings.ts
|
|
2295
|
-
import { z as
|
|
2296
|
-
var amount =
|
|
2408
|
+
import { z as z28 } from "zod";
|
|
2409
|
+
var amount = z28.union([z28.number().nonnegative(), PostPurchaseAmount.transform(Number)]);
|
|
2297
2410
|
var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
2298
2411
|
discountedFrom: true,
|
|
2299
2412
|
language: true,
|
|
@@ -2305,36 +2418,36 @@ var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
|
2305
2418
|
subscriptionIsDefault: true,
|
|
2306
2419
|
upgradeToSubscription: true
|
|
2307
2420
|
}).extend({
|
|
2308
|
-
advance:
|
|
2309
|
-
blocks:
|
|
2421
|
+
advance: z28.unknown().default({}),
|
|
2422
|
+
blocks: z28.array(z28.unknown()).optional(),
|
|
2310
2423
|
discount: PostPurchaseSettings.shape.discount.extend({ amount: amount.default(30) }),
|
|
2311
|
-
integrations:
|
|
2424
|
+
integrations: z28.unknown().default({}),
|
|
2312
2425
|
shipping: PostPurchaseSettings.shape.shipping.extend({ amount: amount.default(10) }),
|
|
2313
|
-
styles:
|
|
2426
|
+
styles: z28.unknown().default({}),
|
|
2314
2427
|
subImages: PostPurchaseSettings.shape.subImages.catch(null),
|
|
2315
|
-
subscription:
|
|
2428
|
+
subscription: z28.unknown().default(PostPurchaseSettings.shape.subscription.parse(void 0))
|
|
2316
2429
|
});
|
|
2317
2430
|
|
|
2318
2431
|
// src/schema/postPurchaseSelection.ts
|
|
2319
|
-
import { z as
|
|
2432
|
+
import { z as z29 } from "zod";
|
|
2320
2433
|
var SelectionClaimsSchema = DecideRequestSchema.extend({
|
|
2321
2434
|
appId: PostPurchaseAppIdSchema,
|
|
2322
2435
|
entry: DecisionEntrySchema,
|
|
2323
|
-
iss:
|
|
2324
|
-
purpose:
|
|
2436
|
+
iss: z29.literal("rebuy-api"),
|
|
2437
|
+
purpose: z29.literal("post-purchase-selection")
|
|
2325
2438
|
});
|
|
2326
2439
|
var SessionStartRequestSchema = DecideRequestSchema.extend({
|
|
2327
|
-
selectionToken:
|
|
2440
|
+
selectionToken: z29.string().min(1).max(8192).optional()
|
|
2328
2441
|
}).strict();
|
|
2329
2442
|
|
|
2330
2443
|
// src/schema/postPurchaseSession.ts
|
|
2331
|
-
import { z as
|
|
2444
|
+
import { z as z30 } from "zod";
|
|
2332
2445
|
var SessionIdentitySchema = DecideRequestSchema.extend({ appId: PostPurchaseAppIdSchema });
|
|
2333
|
-
var SessionOrderTimingSchema =
|
|
2446
|
+
var SessionOrderTimingSchema = z30.object({
|
|
2334
2447
|
nativeDeadline: PostPurchaseTimestampSchema,
|
|
2335
2448
|
orderCreatedAt: PostPurchaseTimestampSchema,
|
|
2336
2449
|
orderId: PostPurchaseOrderIdSchema,
|
|
2337
|
-
timingSource:
|
|
2450
|
+
timingSource: z30.literal("shopify-order-created-at")
|
|
2338
2451
|
});
|
|
2339
2452
|
var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
2340
2453
|
deadline: PostPurchaseTimestampSchema,
|
|
@@ -2351,39 +2464,39 @@ var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
|
2351
2464
|
message: "deadline must not exceed nativeDeadline",
|
|
2352
2465
|
path: ["deadline"]
|
|
2353
2466
|
});
|
|
2354
|
-
var SessionStartResponseSchema =
|
|
2355
|
-
data:
|
|
2356
|
-
phase:
|
|
2467
|
+
var SessionStartResponseSchema = z30.object({
|
|
2468
|
+
data: z30.object({
|
|
2469
|
+
phase: z30.literal("render"),
|
|
2357
2470
|
serverNow: PostPurchaseTimestampSchema,
|
|
2358
2471
|
session: ReadySessionTimingSchema,
|
|
2359
|
-
workflowPhase:
|
|
2472
|
+
workflowPhase: z30.literal("start")
|
|
2360
2473
|
}),
|
|
2361
|
-
successful:
|
|
2474
|
+
successful: z30.literal(true)
|
|
2362
2475
|
});
|
|
2363
2476
|
|
|
2364
2477
|
// src/schema/postPurchaseSessionClose.ts
|
|
2365
|
-
import { z as
|
|
2366
|
-
var SessionClosureSchema =
|
|
2478
|
+
import { z as z31 } from "zod";
|
|
2479
|
+
var SessionClosureSchema = z31.object({ closedAt: PostPurchaseTimestampSchema, status: z31.literal("closed") });
|
|
2367
2480
|
var SessionCloseRequestSchema = DecideRequestSchema.strict();
|
|
2368
|
-
var SessionCloseResponseSchema =
|
|
2481
|
+
var SessionCloseResponseSchema = z31.object({ data: SessionClosureSchema, successful: z31.literal(true) });
|
|
2369
2482
|
|
|
2370
2483
|
// src/schema/postPurchaseShadow.ts
|
|
2371
|
-
import { z as
|
|
2372
|
-
var PostPurchaseShadowSelectionSchema =
|
|
2373
|
-
|
|
2374
|
-
|
|
2484
|
+
import { z as z32 } from "zod";
|
|
2485
|
+
var PostPurchaseShadowSelectionSchema = z32.discriminatedUnion("verdict", [
|
|
2486
|
+
z32.object({ entry: DecisionEntrySchema, verdict: z32.literal("render") }),
|
|
2487
|
+
z32.object({ verdict: z32.literal("skip") })
|
|
2375
2488
|
]);
|
|
2376
|
-
var PostPurchaseShadowReportFields =
|
|
2377
|
-
differences:
|
|
2489
|
+
var PostPurchaseShadowReportFields = z32.object({
|
|
2490
|
+
differences: z32.array(z32.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
|
|
2378
2491
|
message: "differences must not contain duplicate entries"
|
|
2379
2492
|
}),
|
|
2380
2493
|
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
2381
|
-
phase:
|
|
2382
|
-
sampleId:
|
|
2494
|
+
phase: z32.literal("shouldRender"),
|
|
2495
|
+
sampleId: z32.string(),
|
|
2383
2496
|
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
2384
|
-
status:
|
|
2385
|
-
targetingFlowIds:
|
|
2386
|
-
workflowPhase:
|
|
2497
|
+
status: z32.enum(["match", "diverged", "incomplete"]),
|
|
2498
|
+
targetingFlowIds: z32.array(z32.number().int().positive()),
|
|
2499
|
+
workflowPhase: z32.literal("decide")
|
|
2387
2500
|
});
|
|
2388
2501
|
var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
2389
2502
|
(report) => report.status !== "match" || report.differences.length === 0,
|
|
@@ -2397,117 +2510,143 @@ var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
|
2397
2510
|
});
|
|
2398
2511
|
|
|
2399
2512
|
// src/schema/postPurchaseSkipTrace.ts
|
|
2400
|
-
import { z as
|
|
2513
|
+
import { z as z33 } from "zod";
|
|
2401
2514
|
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
2402
|
-
var PostPurchaseSkipTraceSchema =
|
|
2403
|
-
|
|
2515
|
+
var PostPurchaseSkipTraceSchema = z33.array(
|
|
2516
|
+
z33.object({
|
|
2404
2517
|
entry: DecisionEntrySchema,
|
|
2405
2518
|
reason: PostPurchaseSkipReasonSchema
|
|
2406
2519
|
})
|
|
2407
2520
|
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
2408
2521
|
|
|
2522
|
+
// src/schema/postPurchaseSubscriptionDisplay.ts
|
|
2523
|
+
import { z as z34 } from "zod";
|
|
2524
|
+
var Minor = z34.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
2525
|
+
var PostPurchaseSubscriptionDisplay = z34.object({
|
|
2526
|
+
comparisonMinor: Minor,
|
|
2527
|
+
currencyCode: z34.string().regex(/^[A-Z]{3}$/),
|
|
2528
|
+
priceMinor: Minor,
|
|
2529
|
+
savingMinor: Minor,
|
|
2530
|
+
savingPercent: z34.number().int().min(0).max(100)
|
|
2531
|
+
});
|
|
2532
|
+
|
|
2533
|
+
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
2534
|
+
import { z as z35 } from "zod";
|
|
2535
|
+
var PreparedPostPurchaseSubscription = PreparedPostPurchaseProduct.extend({
|
|
2536
|
+
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: z35.number().int().positive() }),
|
|
2537
|
+
terms: PreparedPostPurchaseProduct.shape.terms.extend({
|
|
2538
|
+
subscription: PostPurchaseSubscriptionTerms
|
|
2539
|
+
}).refine(
|
|
2540
|
+
({ discount, shipping, subscription }) => (discount.type !== "none" || discount.amount === 0) && shipping.amount === subscription.initialShippingPrice && shipping.amount === subscription.recurringShippingPrice && (shipping.type !== "free" || shipping.amount === 0)
|
|
2541
|
+
)
|
|
2542
|
+
});
|
|
2543
|
+
var readPostPurchaseSubscription = (prepared) => {
|
|
2544
|
+
if (prepared.selection.sellingPlanId === void 0 && prepared.terms.subscription === void 0) return void 0;
|
|
2545
|
+
return PreparedPostPurchaseSubscription.parse(prepared);
|
|
2546
|
+
};
|
|
2547
|
+
|
|
2409
2548
|
// src/schema/postPurchaseVariantCatalog.ts
|
|
2410
|
-
import { z as
|
|
2411
|
-
var PostPurchaseVariantSelector =
|
|
2549
|
+
import { z as z36 } from "zod";
|
|
2550
|
+
var PostPurchaseVariantSelector = z36.object({ variantId: PostPurchaseVariantId }).strict();
|
|
2412
2551
|
var PostPurchaseVariantOption = OfferProduct.shape.options.element.extend({
|
|
2413
|
-
id:
|
|
2414
|
-
position:
|
|
2552
|
+
id: z36.number().int().positive(),
|
|
2553
|
+
position: z36.number().int().min(1).max(3)
|
|
2415
2554
|
});
|
|
2416
2555
|
var PostPurchaseVariantValues = OfferProduct.shape.variants.element.pick({
|
|
2417
2556
|
option1: true,
|
|
2418
2557
|
option2: true,
|
|
2419
2558
|
option3: true
|
|
2420
2559
|
});
|
|
2421
|
-
var PostPurchaseVariantCatalog =
|
|
2560
|
+
var PostPurchaseVariantCatalog = z36.object({
|
|
2422
2561
|
displayMode: PostPurchaseSettings.shape.productOptions.shape.variantSelectorDisplayMode,
|
|
2423
|
-
options:
|
|
2562
|
+
options: z36.array(PostPurchaseVariantOption),
|
|
2424
2563
|
productId: PostPurchaseProductId,
|
|
2425
2564
|
showSelectors: PostPurchaseSettings.shape.productOptions.shape.showVariantSelectors,
|
|
2426
|
-
variants:
|
|
2565
|
+
variants: z36.array(
|
|
2427
2566
|
PostPurchaseVariantValues.partial().extend({
|
|
2428
|
-
available:
|
|
2567
|
+
available: z36.boolean(),
|
|
2429
2568
|
id: PostPurchaseVariantId,
|
|
2430
|
-
imageId:
|
|
2569
|
+
imageId: z36.number().int().nonnegative().nullish(),
|
|
2431
2570
|
title: OfferProduct.shape.variants.element.shape.title
|
|
2432
2571
|
})
|
|
2433
2572
|
)
|
|
2434
2573
|
});
|
|
2435
2574
|
|
|
2436
2575
|
// src/schema/postPurchaseVariantDefault.ts
|
|
2437
|
-
import { z as
|
|
2576
|
+
import { z as z37 } from "zod";
|
|
2438
2577
|
var values = PostPurchaseVariantValues.partial().extend({
|
|
2439
2578
|
option1: PostPurchaseVariantValues.shape.option1.nullish()
|
|
2440
2579
|
});
|
|
2441
2580
|
var variant = values.extend({
|
|
2442
2581
|
id: PostPurchaseVariantId,
|
|
2443
|
-
inventoryManagement:
|
|
2444
|
-
inventoryPolicy:
|
|
2445
|
-
inventoryQuantity:
|
|
2582
|
+
inventoryManagement: z37.string().nullable(),
|
|
2583
|
+
inventoryPolicy: z37.string(),
|
|
2584
|
+
inventoryQuantity: z37.number()
|
|
2446
2585
|
});
|
|
2447
|
-
var options =
|
|
2448
|
-
var PostPurchaseVariantDefaultProduct =
|
|
2586
|
+
var options = z37.array(PostPurchaseVariantOption.pick({ name: true, values: true }));
|
|
2587
|
+
var PostPurchaseVariantDefaultProduct = z37.object({
|
|
2449
2588
|
id: PostPurchaseProductId,
|
|
2450
2589
|
options,
|
|
2451
2590
|
selectedVariant: variant.optional(),
|
|
2452
|
-
variants:
|
|
2591
|
+
variants: z37.array(variant)
|
|
2453
2592
|
});
|
|
2454
2593
|
var PostPurchaseVariantDefaultSettings = PostPurchaseSettings.shape.productOptions.pick({
|
|
2455
2594
|
hideOutOfStockVariants: true,
|
|
2456
2595
|
matchVariant: true
|
|
2457
2596
|
});
|
|
2458
|
-
var PostPurchaseOrderAttributes =
|
|
2597
|
+
var PostPurchaseOrderAttributes = z37.record(z37.string(), z37.array(z37.string())).default({});
|
|
2459
2598
|
|
|
2460
2599
|
// src/schema/shopConfig.ts
|
|
2461
|
-
import { z as
|
|
2462
|
-
var ShopConfig =
|
|
2463
|
-
activeExperiments:
|
|
2464
|
-
|
|
2465
|
-
data:
|
|
2466
|
-
|
|
2467
|
-
aliasName:
|
|
2468
|
-
cssInput:
|
|
2469
|
-
elementId:
|
|
2470
|
-
id:
|
|
2471
|
-
javascriptInput:
|
|
2472
|
-
traffic:
|
|
2600
|
+
import { z as z38 } from "zod";
|
|
2601
|
+
var ShopConfig = z38.object({
|
|
2602
|
+
activeExperiments: z38.array(
|
|
2603
|
+
z38.object({
|
|
2604
|
+
data: z38.array(
|
|
2605
|
+
z38.object({
|
|
2606
|
+
aliasName: z38.string(),
|
|
2607
|
+
cssInput: z38.string().nullish(),
|
|
2608
|
+
elementId: z38.coerce.number(),
|
|
2609
|
+
id: z38.coerce.number(),
|
|
2610
|
+
javascriptInput: z38.string().nullish(),
|
|
2611
|
+
traffic: z38.coerce.number()
|
|
2473
2612
|
})
|
|
2474
2613
|
),
|
|
2475
|
-
id:
|
|
2476
|
-
name:
|
|
2477
|
-
pageTarget:
|
|
2478
|
-
pageTargetUrl:
|
|
2479
|
-
placeholderId:
|
|
2480
|
-
type:
|
|
2614
|
+
id: z38.coerce.number(),
|
|
2615
|
+
name: z38.string(),
|
|
2616
|
+
pageTarget: z38.string().nullable(),
|
|
2617
|
+
pageTargetUrl: z38.string().nullable(),
|
|
2618
|
+
placeholderId: z38.coerce.number().nullable(),
|
|
2619
|
+
type: z38.string()
|
|
2481
2620
|
})
|
|
2482
2621
|
),
|
|
2483
|
-
activePackages:
|
|
2484
|
-
|
|
2485
|
-
cancelledAt:
|
|
2486
|
-
id:
|
|
2487
|
-
installedAt:
|
|
2488
|
-
isActive:
|
|
2489
|
-
isBillable:
|
|
2490
|
-
packageId:
|
|
2491
|
-
packageName:
|
|
2492
|
-
shortName:
|
|
2493
|
-
trialDays:
|
|
2494
|
-
uninstalledAt:
|
|
2622
|
+
activePackages: z38.array(
|
|
2623
|
+
z38.object({
|
|
2624
|
+
cancelledAt: z38.string().nullable(),
|
|
2625
|
+
id: z38.number(),
|
|
2626
|
+
installedAt: z38.string().nullable(),
|
|
2627
|
+
isActive: z38.boolean(),
|
|
2628
|
+
isBillable: z38.boolean(),
|
|
2629
|
+
packageId: z38.number(),
|
|
2630
|
+
packageName: z38.string(),
|
|
2631
|
+
shortName: z38.string(),
|
|
2632
|
+
trialDays: z38.number(),
|
|
2633
|
+
uninstalledAt: z38.string().nullable()
|
|
2495
2634
|
})
|
|
2496
2635
|
),
|
|
2497
|
-
apiKey:
|
|
2498
|
-
billingVersion:
|
|
2499
|
-
cacheKey:
|
|
2500
|
-
carousel:
|
|
2501
|
-
currency:
|
|
2502
|
-
currencySymbol:
|
|
2503
|
-
domain:
|
|
2504
|
-
enabledJquery:
|
|
2505
|
-
enabledPresentmentCurrencies:
|
|
2506
|
-
hasSmartCollectionsEnabled:
|
|
2507
|
-
hasSmartSearchEnabled:
|
|
2508
|
-
id:
|
|
2509
|
-
integrations:
|
|
2510
|
-
|
|
2636
|
+
apiKey: z38.string(),
|
|
2637
|
+
billingVersion: z38.string().nullable(),
|
|
2638
|
+
cacheKey: z38.coerce.number(),
|
|
2639
|
+
carousel: z38.enum(["flickity", "splide"]),
|
|
2640
|
+
currency: z38.string(),
|
|
2641
|
+
currencySymbol: z38.string(),
|
|
2642
|
+
domain: z38.string(),
|
|
2643
|
+
enabledJquery: z38.boolean(),
|
|
2644
|
+
enabledPresentmentCurrencies: z38.array(z38.string()),
|
|
2645
|
+
hasSmartCollectionsEnabled: z38.boolean(),
|
|
2646
|
+
hasSmartSearchEnabled: z38.boolean(),
|
|
2647
|
+
id: z38.coerce.number(),
|
|
2648
|
+
integrations: z38.record(
|
|
2649
|
+
z38.enum([
|
|
2511
2650
|
"attentive",
|
|
2512
2651
|
"judgeme",
|
|
2513
2652
|
"junip",
|
|
@@ -2520,46 +2659,46 @@ var ShopConfig = z30.object({
|
|
|
2520
2659
|
"stamped",
|
|
2521
2660
|
"yotpo"
|
|
2522
2661
|
]),
|
|
2523
|
-
|
|
2662
|
+
z38.union([z38.boolean(), z38.unknown()])
|
|
2524
2663
|
),
|
|
2525
|
-
markets:
|
|
2526
|
-
enabled:
|
|
2664
|
+
markets: z38.object({
|
|
2665
|
+
enabled: z38.boolean()
|
|
2527
2666
|
}),
|
|
2528
|
-
monetize:
|
|
2529
|
-
publisherKey:
|
|
2667
|
+
monetize: z38.object({
|
|
2668
|
+
publisherKey: z38.string().nullable()
|
|
2530
2669
|
}).nullish(),
|
|
2531
|
-
moneyFormat:
|
|
2532
|
-
myshopifyDomain:
|
|
2533
|
-
primaryLocale:
|
|
2534
|
-
productGroupsEnabled:
|
|
2535
|
-
rechargeCustomDomain:
|
|
2536
|
-
sellingPlansEnabled:
|
|
2537
|
-
shopId:
|
|
2538
|
-
shopifySellingPlansEnabled:
|
|
2539
|
-
shopName:
|
|
2540
|
-
storefrontAccessToken:
|
|
2541
|
-
useRebuyIcons:
|
|
2670
|
+
moneyFormat: z38.string(),
|
|
2671
|
+
myshopifyDomain: z38.string(),
|
|
2672
|
+
primaryLocale: z38.string(),
|
|
2673
|
+
productGroupsEnabled: z38.enum(["no", "yes"]).transform((value) => value === "yes"),
|
|
2674
|
+
rechargeCustomDomain: z38.string().nullable(),
|
|
2675
|
+
sellingPlansEnabled: z38.boolean(),
|
|
2676
|
+
shopId: z38.number(),
|
|
2677
|
+
shopifySellingPlansEnabled: z38.boolean(),
|
|
2678
|
+
shopName: z38.string(),
|
|
2679
|
+
storefrontAccessToken: z38.string().nullable(),
|
|
2680
|
+
useRebuyIcons: z38.boolean()
|
|
2542
2681
|
});
|
|
2543
2682
|
|
|
2544
2683
|
// src/schema/userConfig.ts
|
|
2545
|
-
import { z as
|
|
2546
|
-
var UserConfig =
|
|
2684
|
+
import { z as z39 } from "zod";
|
|
2685
|
+
var UserConfig = z39.object({
|
|
2547
2686
|
shop: ShopConfig,
|
|
2548
2687
|
/**
|
|
2549
2688
|
* `.catch(undefined)` is the safety bar: smart-cart shape drift can NEVER fail `fetchUserConfig`,
|
|
2550
2689
|
* which resolves the apiKey for every offers/monetize/analytics/gift request.
|
|
2551
2690
|
*/
|
|
2552
2691
|
smartCart: SmartCartConfig.nullish().catch(void 0),
|
|
2553
|
-
smartFlows:
|
|
2692
|
+
smartFlows: z39.array(z39.unknown())
|
|
2554
2693
|
});
|
|
2555
2694
|
|
|
2556
2695
|
// src/schema/widgetData.ts
|
|
2557
|
-
import { z as
|
|
2696
|
+
import { z as z67 } from "zod";
|
|
2558
2697
|
|
|
2559
2698
|
// src/schema/widgets/abTestingPlaceholder.ts
|
|
2560
|
-
import { z as
|
|
2561
|
-
var ABTestingPlaceholder =
|
|
2562
|
-
type:
|
|
2699
|
+
import { z as z40 } from "zod";
|
|
2700
|
+
var ABTestingPlaceholder = z40.looseObject({
|
|
2701
|
+
type: z40.literal("placeholder")
|
|
2563
2702
|
});
|
|
2564
2703
|
|
|
2565
2704
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
@@ -2614,31 +2753,31 @@ var targetAreas = {
|
|
|
2614
2753
|
};
|
|
2615
2754
|
|
|
2616
2755
|
// src/schema/widgets/checkoutExtension.ts
|
|
2617
|
-
import { z as
|
|
2618
|
-
var CheckoutExtension =
|
|
2619
|
-
type:
|
|
2756
|
+
import { z as z41 } from "zod";
|
|
2757
|
+
var CheckoutExtension = z41.looseObject({
|
|
2758
|
+
type: z41.literal(WidgetType.shopify_checkout_extension).default(WidgetType.shopify_checkout_extension)
|
|
2620
2759
|
});
|
|
2621
2760
|
|
|
2622
2761
|
// src/schema/widgets/contentBlock.ts
|
|
2623
|
-
import { z as
|
|
2762
|
+
import { z as z61 } from "zod";
|
|
2624
2763
|
|
|
2625
2764
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
2626
|
-
import { z as
|
|
2765
|
+
import { z as z60 } from "zod";
|
|
2627
2766
|
|
|
2628
2767
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
2629
2768
|
import { v7 as uuidv713 } from "uuid";
|
|
2630
|
-
import { z as
|
|
2769
|
+
import { z as z59 } from "zod";
|
|
2631
2770
|
|
|
2632
2771
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
2633
|
-
import { z as
|
|
2772
|
+
import { z as z58 } from "zod";
|
|
2634
2773
|
|
|
2635
2774
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
2636
|
-
import { z as
|
|
2637
|
-
var CABBannerSection =
|
|
2775
|
+
import { z as z42 } from "zod";
|
|
2776
|
+
var CABBannerSection = z42.lazy(
|
|
2638
2777
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
2639
|
-
buttonField:
|
|
2640
|
-
color:
|
|
2641
|
-
dismissible:
|
|
2778
|
+
buttonField: z42.enum(buttonFields).optional(),
|
|
2779
|
+
color: z42.enum(bannerColors).default("info"),
|
|
2780
|
+
dismissible: z42.boolean().default(true),
|
|
2642
2781
|
/**
|
|
2643
2782
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
2644
2783
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -2654,18 +2793,18 @@ var CABBannerSection = z34.lazy(
|
|
|
2654
2793
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
2655
2794
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
2656
2795
|
*/
|
|
2657
|
-
heading:
|
|
2658
|
-
sectionType:
|
|
2796
|
+
heading: z42.record(z42.string(), z42.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
2797
|
+
sectionType: z42.literal(SectionType.banner).default(SectionType.banner)
|
|
2659
2798
|
})
|
|
2660
2799
|
);
|
|
2661
2800
|
|
|
2662
2801
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
2663
2802
|
import { v7 as uuidv73 } from "uuid";
|
|
2664
|
-
import { z as
|
|
2803
|
+
import { z as z44 } from "zod";
|
|
2665
2804
|
|
|
2666
2805
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
2667
2806
|
import { v7 as uuidv72 } from "uuid";
|
|
2668
|
-
import { z as
|
|
2807
|
+
import { z as z43 } from "zod";
|
|
2669
2808
|
|
|
2670
2809
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
2671
2810
|
var iconNames = [
|
|
@@ -2752,17 +2891,17 @@ var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "wa
|
|
|
2752
2891
|
var IconTone = freezeEnum(iconTones);
|
|
2753
2892
|
|
|
2754
2893
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
2755
|
-
var CABImageSectionFields =
|
|
2894
|
+
var CABImageSectionFields = z43.object({
|
|
2756
2895
|
...CABVariableFields,
|
|
2757
|
-
altText:
|
|
2896
|
+
altText: z43.string().refine(checkForHTML, NO_HTML).default(""),
|
|
2758
2897
|
/**
|
|
2759
2898
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
2760
2899
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
2761
2900
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
2762
2901
|
*/
|
|
2763
|
-
aspectRatio:
|
|
2764
|
-
border:
|
|
2765
|
-
buttonField:
|
|
2902
|
+
aspectRatio: z43.number().positive().nullable().default(null),
|
|
2903
|
+
border: z43.lazy(() => CABBorder),
|
|
2904
|
+
buttonField: z43.enum(buttonFields).optional(),
|
|
2766
2905
|
/**
|
|
2767
2906
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
2768
2907
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -2781,29 +2920,29 @@ var CABImageSectionFields = z35.object({
|
|
|
2781
2920
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
2782
2921
|
* the risky half.
|
|
2783
2922
|
*/
|
|
2784
|
-
category:
|
|
2923
|
+
category: z43.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
2785
2924
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
2786
|
-
iconSize:
|
|
2925
|
+
iconSize: z43.enum(iconSizes).nullable().default(null),
|
|
2787
2926
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
2788
|
-
iconTone:
|
|
2789
|
-
name:
|
|
2790
|
-
naturalHeight:
|
|
2791
|
-
naturalWidth:
|
|
2927
|
+
iconTone: z43.enum(iconTones).nullable().default(null),
|
|
2928
|
+
name: z43.string().optional(),
|
|
2929
|
+
naturalHeight: z43.number().default(0),
|
|
2930
|
+
naturalWidth: z43.number().default(0),
|
|
2792
2931
|
/**
|
|
2793
2932
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
2794
2933
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
2795
2934
|
*/
|
|
2796
|
-
objectFit:
|
|
2797
|
-
sectionId:
|
|
2798
|
-
sectionType:
|
|
2935
|
+
objectFit: z43.enum(objectFits).default(ObjectFit.contain),
|
|
2936
|
+
sectionId: z43.uuid().default(() => uuidv72()),
|
|
2937
|
+
sectionType: z43.literal(SectionType.image).default(SectionType.image),
|
|
2799
2938
|
/**
|
|
2800
2939
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
2801
2940
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
2802
2941
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
2803
2942
|
* server-chosen tier icon actually needs it.
|
|
2804
2943
|
*/
|
|
2805
|
-
source:
|
|
2806
|
-
width:
|
|
2944
|
+
source: z43.union([z43.url(), z43.literal(""), z43.string().regex(DYNAMIC_TOKEN_REGEX), z43.enum(iconNames)]).default(""),
|
|
2945
|
+
width: z43.number().default(100)
|
|
2807
2946
|
});
|
|
2808
2947
|
var iconNameSet = new Set(iconNames);
|
|
2809
2948
|
var isIconName = (source) => iconNameSet.has(source);
|
|
@@ -2823,35 +2962,35 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, c
|
|
|
2823
2962
|
});
|
|
2824
2963
|
|
|
2825
2964
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
2826
|
-
var CABButtonContent =
|
|
2827
|
-
() =>
|
|
2965
|
+
var CABButtonContent = z44.lazy(
|
|
2966
|
+
() => z44.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
2828
2967
|
);
|
|
2829
|
-
var CABButtonSection =
|
|
2968
|
+
var CABButtonSection = z44.object({
|
|
2830
2969
|
...CABVariableFields,
|
|
2831
|
-
action:
|
|
2832
|
-
buttonStyle:
|
|
2833
|
-
custom:
|
|
2834
|
-
color:
|
|
2835
|
-
height:
|
|
2836
|
-
width:
|
|
2970
|
+
action: z44.union([z44.literal(""), z44.enum(buttonActions)]).default(""),
|
|
2971
|
+
buttonStyle: z44.enum(buttonStyles).default(ButtonStyle.primary),
|
|
2972
|
+
custom: z44.object({
|
|
2973
|
+
color: z44.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
2974
|
+
height: z44.number().default(52),
|
|
2975
|
+
width: z44.number().default(300)
|
|
2837
2976
|
}).default({
|
|
2838
2977
|
color: "#005bd3",
|
|
2839
2978
|
height: 52,
|
|
2840
2979
|
width: 300
|
|
2841
2980
|
}),
|
|
2842
|
-
disableDowngrade:
|
|
2843
|
-
name:
|
|
2844
|
-
optionId:
|
|
2845
|
-
popover:
|
|
2846
|
-
alignment:
|
|
2847
|
-
position:
|
|
2981
|
+
disableDowngrade: z44.boolean().default(false),
|
|
2982
|
+
name: z44.string().optional(),
|
|
2983
|
+
optionId: z44.number().optional(),
|
|
2984
|
+
popover: z44.object({
|
|
2985
|
+
alignment: z44.enum(textAlignments).default(TextAlignment.center),
|
|
2986
|
+
position: z44.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
2848
2987
|
}).optional().default(() => ({
|
|
2849
2988
|
alignment: TextAlignment.center,
|
|
2850
2989
|
position: PopoverPosition.blockStart
|
|
2851
2990
|
})),
|
|
2852
|
-
sectionId:
|
|
2853
|
-
sections:
|
|
2854
|
-
sectionType:
|
|
2991
|
+
sectionId: z44.uuid().default(() => uuidv73()),
|
|
2992
|
+
sections: z44.union([z44.array(CABButtonContent), z44.strictObject({}).transform(() => [])]).default(() => []),
|
|
2993
|
+
sectionType: z44.literal(SectionType.button).default(SectionType.button),
|
|
2855
2994
|
/**
|
|
2856
2995
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
2857
2996
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -2866,91 +3005,91 @@ var CABButtonSection = z36.object({
|
|
|
2866
3005
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
2867
3006
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
2868
3007
|
*/
|
|
2869
|
-
tier:
|
|
3008
|
+
tier: z44.object({ tierId: z44.string().min(1) }).optional(),
|
|
2870
3009
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
2871
|
-
trackingUrl:
|
|
3010
|
+
trackingUrl: z44.string().optional(),
|
|
2872
3011
|
/**
|
|
2873
3012
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
2874
3013
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
2875
3014
|
*/
|
|
2876
|
-
variableEffects:
|
|
3015
|
+
variableEffects: z44.array(CABVariableEffect).optional()
|
|
2877
3016
|
});
|
|
2878
3017
|
|
|
2879
3018
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
2880
|
-
import { z as
|
|
3019
|
+
import { z as z49 } from "zod";
|
|
2881
3020
|
|
|
2882
3021
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
2883
|
-
import { z as
|
|
3022
|
+
import { z as z48 } from "zod";
|
|
2884
3023
|
|
|
2885
3024
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
2886
3025
|
import { v7 as uuidv74 } from "uuid";
|
|
2887
|
-
import { z as
|
|
2888
|
-
var CABDiscount =
|
|
2889
|
-
amount:
|
|
2890
|
-
discountedBy:
|
|
2891
|
-
discountedFrom:
|
|
2892
|
-
type:
|
|
2893
|
-
});
|
|
2894
|
-
var CABIntegrations =
|
|
2895
|
-
judgeme:
|
|
2896
|
-
junip:
|
|
2897
|
-
klaviyo:
|
|
2898
|
-
loox:
|
|
2899
|
-
okendo:
|
|
2900
|
-
opinew:
|
|
2901
|
-
reviewsio:
|
|
2902
|
-
stamped:
|
|
2903
|
-
yotpo:
|
|
2904
|
-
});
|
|
2905
|
-
var CABDataSourceSection =
|
|
2906
|
-
dataSourceId:
|
|
2907
|
-
dataSourcePath:
|
|
3026
|
+
import { z as z45 } from "zod";
|
|
3027
|
+
var CABDiscount = z45.object({
|
|
3028
|
+
amount: z45.union([z45.number(), z45.string()]).catch(0),
|
|
3029
|
+
discountedBy: z45.string().optional(),
|
|
3030
|
+
discountedFrom: z45.enum(discountSources).optional().catch(void 0),
|
|
3031
|
+
type: z45.enum(discountTypes).catch("none")
|
|
3032
|
+
});
|
|
3033
|
+
var CABIntegrations = z45.object({
|
|
3034
|
+
judgeme: z45.boolean().default(false),
|
|
3035
|
+
junip: z45.boolean().default(false),
|
|
3036
|
+
klaviyo: z45.boolean().default(false),
|
|
3037
|
+
loox: z45.boolean().default(false),
|
|
3038
|
+
okendo: z45.boolean().default(false),
|
|
3039
|
+
opinew: z45.boolean().default(false),
|
|
3040
|
+
reviewsio: z45.boolean().default(false),
|
|
3041
|
+
stamped: z45.boolean().default(false),
|
|
3042
|
+
yotpo: z45.boolean().default(false)
|
|
3043
|
+
});
|
|
3044
|
+
var CABDataSourceSection = z45.object({
|
|
3045
|
+
dataSourceId: z45.number().nullable().default(null),
|
|
3046
|
+
dataSourcePath: z45.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
2908
3047
|
discount: CABDiscount.optional(),
|
|
2909
3048
|
integrations: CABIntegrations.optional(),
|
|
2910
|
-
limit:
|
|
2911
|
-
matchVariant:
|
|
2912
|
-
matchVariantOutOfStock:
|
|
2913
|
-
name:
|
|
2914
|
-
productType:
|
|
2915
|
-
sectionId:
|
|
2916
|
-
sectionType:
|
|
3049
|
+
limit: z45.number().default(1),
|
|
3050
|
+
matchVariant: z45.boolean().default(false),
|
|
3051
|
+
matchVariantOutOfStock: z45.boolean().default(false),
|
|
3052
|
+
name: z45.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
3053
|
+
productType: z45.enum(productTypes).optional(),
|
|
3054
|
+
sectionId: z45.uuid().default(() => uuidv74()),
|
|
3055
|
+
sectionType: z45.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
2917
3056
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
2918
|
-
subscriptionIsDefault:
|
|
2919
|
-
treatAsGwp:
|
|
3057
|
+
subscriptionIsDefault: z45.boolean().default(false),
|
|
3058
|
+
treatAsGwp: z45.boolean().default(false)
|
|
2920
3059
|
});
|
|
2921
3060
|
|
|
2922
3061
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
2923
3062
|
import { v7 as uuidv76 } from "uuid";
|
|
2924
|
-
import { z as
|
|
3063
|
+
import { z as z47 } from "zod";
|
|
2925
3064
|
|
|
2926
3065
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
2927
3066
|
import { v7 as uuidv75 } from "uuid";
|
|
2928
|
-
import { z as
|
|
2929
|
-
var CABVariantContent =
|
|
2930
|
-
() =>
|
|
3067
|
+
import { z as z46 } from "zod";
|
|
3068
|
+
var CABVariantContent = z46.lazy(
|
|
3069
|
+
() => z46.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
2931
3070
|
);
|
|
2932
|
-
var CABProductSection =
|
|
3071
|
+
var CABProductSection = z46.object({
|
|
2933
3072
|
...CABVariableFields,
|
|
2934
|
-
name:
|
|
2935
|
-
productId:
|
|
2936
|
-
sectionId:
|
|
2937
|
-
sections:
|
|
2938
|
-
sectionType:
|
|
2939
|
-
selectors:
|
|
2940
|
-
variantMode:
|
|
3073
|
+
name: z46.string().optional(),
|
|
3074
|
+
productId: z46.number().nullable().default(null),
|
|
3075
|
+
sectionId: z46.uuid().default(() => uuidv75()),
|
|
3076
|
+
sections: z46.union([z46.array(CABVariantContent), z46.strictObject({}).transform(() => [])]).default(() => []),
|
|
3077
|
+
sectionType: z46.literal(SectionType.product).default(SectionType.product),
|
|
3078
|
+
selectors: z46.record(z46.string(), z46.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
3079
|
+
variantMode: z46.enum(variantModes).default(VariantMode.multiple)
|
|
2941
3080
|
});
|
|
2942
3081
|
|
|
2943
3082
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
2944
|
-
var CABProductsSection =
|
|
3083
|
+
var CABProductsSection = z47.object({
|
|
2945
3084
|
...CABVariableFields,
|
|
2946
|
-
name:
|
|
2947
|
-
sectionId:
|
|
2948
|
-
sections:
|
|
2949
|
-
sectionType:
|
|
3085
|
+
name: z47.string().optional(),
|
|
3086
|
+
sectionId: z47.uuid().default(() => uuidv76()),
|
|
3087
|
+
sections: z47.union([z47.array(z47.lazy(() => CABProductSection)), z47.strictObject({}).transform(() => [])]).default(() => []),
|
|
3088
|
+
sectionType: z47.literal(SectionType.products).default(SectionType.products)
|
|
2950
3089
|
});
|
|
2951
3090
|
|
|
2952
3091
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
2953
|
-
var CABOffersSection =
|
|
3092
|
+
var CABOffersSection = z48.lazy(
|
|
2954
3093
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
2955
3094
|
/**
|
|
2956
3095
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -2958,8 +3097,8 @@ var CABOffersSection = z40.lazy(
|
|
|
2958
3097
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
2959
3098
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
2960
3099
|
*/
|
|
2961
|
-
divider:
|
|
2962
|
-
sections:
|
|
3100
|
+
divider: z48.boolean().optional(),
|
|
3101
|
+
sections: z48.union([z48.array(z48.lazy(() => CABSection)), z48.strictObject({}).transform(() => [])]).default(() => [
|
|
2963
3102
|
CABBannerSection.parse({
|
|
2964
3103
|
buttonField: "undoAddToOrder",
|
|
2965
3104
|
color: "success",
|
|
@@ -2973,77 +3112,77 @@ var CABOffersSection = z40.lazy(
|
|
|
2973
3112
|
CABDataSourceSection.parse({}),
|
|
2974
3113
|
CABProductsSection.parse({})
|
|
2975
3114
|
]),
|
|
2976
|
-
sectionType:
|
|
3115
|
+
sectionType: z48.literal(SectionType.offers).default(SectionType.offers)
|
|
2977
3116
|
})
|
|
2978
3117
|
);
|
|
2979
3118
|
|
|
2980
3119
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
2981
|
-
var CABCarouselSection =
|
|
3120
|
+
var CABCarouselSection = z49.lazy(
|
|
2982
3121
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
2983
|
-
autoAdvanceInterval:
|
|
2984
|
-
itemsAtOnce:
|
|
3122
|
+
autoAdvanceInterval: z49.number().default(0),
|
|
3123
|
+
itemsAtOnce: z49.number().min(1).default(1),
|
|
2985
3124
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
2986
|
-
offersDirection:
|
|
2987
|
-
sections:
|
|
2988
|
-
sectionType:
|
|
3125
|
+
offersDirection: z49.enum(offersDirections).default("vertical"),
|
|
3126
|
+
sections: z49.union([z49.array(z49.lazy(() => CABSection)), z49.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
3127
|
+
sectionType: z49.literal(SectionType.carousel).default(SectionType.carousel)
|
|
2989
3128
|
})
|
|
2990
3129
|
);
|
|
2991
3130
|
|
|
2992
3131
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
2993
|
-
import { z as
|
|
2994
|
-
var CABCartLineSection =
|
|
3132
|
+
import { z as z50 } from "zod";
|
|
3133
|
+
var CABCartLineSection = z50.lazy(
|
|
2995
3134
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
2996
|
-
sections:
|
|
2997
|
-
sectionType:
|
|
3135
|
+
sections: z50.union([z50.array(z50.lazy(() => CABSection)), z50.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
3136
|
+
sectionType: z50.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
2998
3137
|
})
|
|
2999
3138
|
);
|
|
3000
3139
|
|
|
3001
3140
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
3002
3141
|
import { v7 as uuidv77 } from "uuid";
|
|
3003
|
-
import { z as
|
|
3004
|
-
var CABDiscountSection =
|
|
3142
|
+
import { z as z51 } from "zod";
|
|
3143
|
+
var CABDiscountSection = z51.object({
|
|
3005
3144
|
...CABVariableFields,
|
|
3006
|
-
amount:
|
|
3007
|
-
discountedBy:
|
|
3008
|
-
discountedFrom:
|
|
3009
|
-
message:
|
|
3010
|
-
name:
|
|
3011
|
-
quantity:
|
|
3012
|
-
sectionId:
|
|
3013
|
-
sectionType:
|
|
3014
|
-
type:
|
|
3145
|
+
amount: z51.union([z51.number(), z51.string()]).catch(0),
|
|
3146
|
+
discountedBy: z51.string().optional(),
|
|
3147
|
+
discountedFrom: z51.enum(discountSources).optional().catch(void 0),
|
|
3148
|
+
message: z51.string().optional(),
|
|
3149
|
+
name: z51.string().optional(),
|
|
3150
|
+
quantity: z51.number().default(1),
|
|
3151
|
+
sectionId: z51.uuid().default(() => uuidv77()),
|
|
3152
|
+
sectionType: z51.literal(SectionType.discount).default(SectionType.discount),
|
|
3153
|
+
type: z51.enum(discountTypes).catch("none")
|
|
3015
3154
|
});
|
|
3016
3155
|
|
|
3017
3156
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
3018
3157
|
import { v7 as uuidv78 } from "uuid";
|
|
3019
|
-
import { z as
|
|
3020
|
-
var CABMonetizeAds =
|
|
3021
|
-
requestId:
|
|
3158
|
+
import { z as z52 } from "zod";
|
|
3159
|
+
var CABMonetizeAds = z52.object({
|
|
3160
|
+
requestId: z52.string().optional(),
|
|
3022
3161
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
3023
|
-
testing:
|
|
3162
|
+
testing: z52.boolean().default(false)
|
|
3024
3163
|
});
|
|
3025
|
-
var CABMonetizeSection =
|
|
3164
|
+
var CABMonetizeSection = z52.object({
|
|
3026
3165
|
...CABVariableFields,
|
|
3027
3166
|
ads: CABMonetizeAds.optional(),
|
|
3028
|
-
name:
|
|
3167
|
+
name: z52.string().optional(),
|
|
3029
3168
|
/**
|
|
3030
3169
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
3031
3170
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
3032
3171
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
3033
3172
|
*/
|
|
3034
|
-
offers:
|
|
3173
|
+
offers: z52.array(z52.lazy(() => CABSection)).optional(),
|
|
3035
3174
|
/** 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. */
|
|
3036
|
-
privacyPolicyUrl:
|
|
3037
|
-
sectionId:
|
|
3038
|
-
sectionType:
|
|
3175
|
+
privacyPolicyUrl: z52.string().optional(),
|
|
3176
|
+
sectionId: z52.uuid().default(() => uuidv78()),
|
|
3177
|
+
sectionType: z52.literal(SectionType.monetize).default(SectionType.monetize),
|
|
3039
3178
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
3040
|
-
subVertical:
|
|
3179
|
+
subVertical: z52.string().optional(),
|
|
3041
3180
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
3042
|
-
vertical:
|
|
3181
|
+
vertical: z52.string().optional()
|
|
3043
3182
|
});
|
|
3044
3183
|
|
|
3045
3184
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3046
|
-
import { z as
|
|
3185
|
+
import { z as z53 } from "zod";
|
|
3047
3186
|
|
|
3048
3187
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
3049
3188
|
var GIFT_LABELS = {
|
|
@@ -3162,34 +3301,34 @@ var GIFT_LABELS = {
|
|
|
3162
3301
|
};
|
|
3163
3302
|
|
|
3164
3303
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3165
|
-
var CABProgressTierExclusion =
|
|
3166
|
-
collectionIds:
|
|
3167
|
-
productIds:
|
|
3168
|
-
tags:
|
|
3169
|
-
type:
|
|
3304
|
+
var CABProgressTierExclusion = z53.object({
|
|
3305
|
+
collectionIds: z53.array(z53.number().int().positive()).default(() => []),
|
|
3306
|
+
productIds: z53.array(z53.number().int().positive()).default(() => []),
|
|
3307
|
+
tags: z53.array(z53.string().min(1)).default(() => []),
|
|
3308
|
+
type: z53.enum(progressTierExclusionTypes)
|
|
3170
3309
|
});
|
|
3171
|
-
var CABProgressTier =
|
|
3310
|
+
var CABProgressTier = z53.object({
|
|
3172
3311
|
/**
|
|
3173
3312
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
3174
3313
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
3175
3314
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
3176
3315
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
3177
3316
|
*/
|
|
3178
|
-
discount:
|
|
3317
|
+
discount: z53.object({ amount: z53.number().nonnegative(), type: z53.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
3179
3318
|
/**
|
|
3180
3319
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
3181
3320
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
3182
3321
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
3183
3322
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
3184
3323
|
*/
|
|
3185
|
-
exclusions:
|
|
3324
|
+
exclusions: z53.array(CABProgressTierExclusion).default(() => []),
|
|
3186
3325
|
/**
|
|
3187
3326
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
3188
3327
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
3189
3328
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
3190
3329
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
3191
3330
|
*/
|
|
3192
|
-
filterOosVariants:
|
|
3331
|
+
filterOosVariants: z53.boolean().default(false),
|
|
3193
3332
|
/**
|
|
3194
3333
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
3195
3334
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -3197,10 +3336,10 @@ var CABProgressTier = z45.object({
|
|
|
3197
3336
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
3198
3337
|
* tree is complete.
|
|
3199
3338
|
*/
|
|
3200
|
-
gift:
|
|
3201
|
-
productId:
|
|
3202
|
-
title:
|
|
3203
|
-
variantIds:
|
|
3339
|
+
gift: z53.object({
|
|
3340
|
+
productId: z53.number().int().positive(),
|
|
3341
|
+
title: z53.string().optional(),
|
|
3342
|
+
variantIds: z53.array(z53.number().int().positive()).default(() => [])
|
|
3204
3343
|
}).optional(),
|
|
3205
3344
|
/**
|
|
3206
3345
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -3220,7 +3359,7 @@ var CABProgressTier = z45.object({
|
|
|
3220
3359
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
3221
3360
|
* React's size rather than the old hardcoded 20.
|
|
3222
3361
|
*/
|
|
3223
|
-
iconSizePx:
|
|
3362
|
+
iconSizePx: z53.number().int().min(1).max(64).default(18),
|
|
3224
3363
|
/**
|
|
3225
3364
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
3226
3365
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -3230,35 +3369,35 @@ var CABProgressTier = z45.object({
|
|
|
3230
3369
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
3231
3370
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
3232
3371
|
*/
|
|
3233
|
-
label:
|
|
3372
|
+
label: z53.record(z53.string(), z53.string()).optional(),
|
|
3234
3373
|
/**
|
|
3235
3374
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
3236
3375
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
3237
3376
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
3238
3377
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
3239
3378
|
*/
|
|
3240
|
-
productTierImage:
|
|
3379
|
+
productTierImage: z53.boolean().default(false),
|
|
3241
3380
|
/**
|
|
3242
3381
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
3243
3382
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
3244
3383
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
3245
3384
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
3246
3385
|
*/
|
|
3247
|
-
threshold:
|
|
3386
|
+
threshold: z53.number().int().nonnegative(),
|
|
3248
3387
|
/**
|
|
3249
3388
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
3250
3389
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
3251
3390
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
3252
3391
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
3253
3392
|
*/
|
|
3254
|
-
thresholds:
|
|
3393
|
+
thresholds: z53.record(z53.string(), z53.number().int().nonnegative()).default(() => ({})),
|
|
3255
3394
|
/**
|
|
3256
3395
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
3257
3396
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
3258
3397
|
* shipping bar (single unlabeled tier, no gift).
|
|
3259
3398
|
*/
|
|
3260
|
-
tierId:
|
|
3261
|
-
tierType:
|
|
3399
|
+
tierId: z53.string().optional(),
|
|
3400
|
+
tierType: z53.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
3262
3401
|
/**
|
|
3263
3402
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
3264
3403
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -3269,9 +3408,9 @@ var CABProgressTier = z45.object({
|
|
|
3269
3408
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
3270
3409
|
* template text supplies grammatically-neutral wording around the token.
|
|
3271
3410
|
*/
|
|
3272
|
-
unit:
|
|
3411
|
+
unit: z53.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
3273
3412
|
});
|
|
3274
|
-
var CABProgressBarSection =
|
|
3413
|
+
var CABProgressBarSection = z53.lazy(
|
|
3275
3414
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
3276
3415
|
/**
|
|
3277
3416
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -3280,35 +3419,35 @@ var CABProgressBarSection = z45.lazy(
|
|
|
3280
3419
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
3281
3420
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
3282
3421
|
*/
|
|
3283
|
-
barId:
|
|
3422
|
+
barId: z53.string().optional(),
|
|
3284
3423
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
3285
|
-
countryCodes:
|
|
3424
|
+
countryCodes: z53.array(z53.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3286
3425
|
/**
|
|
3287
3426
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
3288
3427
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
3289
3428
|
*/
|
|
3290
|
-
excludeCountryCodes:
|
|
3429
|
+
excludeCountryCodes: z53.array(z53.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3291
3430
|
/**
|
|
3292
3431
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
3293
3432
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
3294
3433
|
* adds the cart's discount allocations back to the live subtotal.
|
|
3295
3434
|
*/
|
|
3296
|
-
excludeDiscountInSubtotal:
|
|
3435
|
+
excludeDiscountInSubtotal: z53.boolean().default(false),
|
|
3297
3436
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
3298
|
-
excludedVariantIds:
|
|
3437
|
+
excludedVariantIds: z53.array(z53.number().int().positive()).default(() => []),
|
|
3299
3438
|
/**
|
|
3300
3439
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
3301
3440
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
3302
3441
|
*/
|
|
3303
|
-
freeShippingOnSubscription:
|
|
3442
|
+
freeShippingOnSubscription: z53.boolean().default(false),
|
|
3304
3443
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
3305
|
-
giftAreaTitle:
|
|
3444
|
+
giftAreaTitle: z53.record(z53.string(), z53.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
3306
3445
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
3307
|
-
giftLabels:
|
|
3308
|
-
addGift:
|
|
3309
|
-
remove:
|
|
3310
|
-
selectOptions:
|
|
3311
|
-
yourGift:
|
|
3446
|
+
giftLabels: z53.object({
|
|
3447
|
+
addGift: z53.record(z53.string(), z53.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
3448
|
+
remove: z53.record(z53.string(), z53.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
3449
|
+
selectOptions: z53.record(z53.string(), z53.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
3450
|
+
yourGift: z53.record(z53.string(), z53.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
3312
3451
|
}).default(() => ({
|
|
3313
3452
|
addGift: { ...GIFT_LABELS.addGift },
|
|
3314
3453
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -3316,38 +3455,38 @@ var CABProgressBarSection = z45.lazy(
|
|
|
3316
3455
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
3317
3456
|
})),
|
|
3318
3457
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
3319
|
-
name:
|
|
3458
|
+
name: z53.string().default("Order progress"),
|
|
3320
3459
|
/**
|
|
3321
3460
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
3322
3461
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
3323
3462
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
3324
3463
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
3325
3464
|
*/
|
|
3326
|
-
progressColor:
|
|
3327
|
-
sectionType:
|
|
3465
|
+
progressColor: z53.string().optional(),
|
|
3466
|
+
sectionType: z53.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
3328
3467
|
/**
|
|
3329
3468
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
3330
3469
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
3331
3470
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
3332
3471
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
3333
3472
|
*/
|
|
3334
|
-
tiers:
|
|
3473
|
+
tiers: z53.union([z53.array(CABProgressTier), z53.strictObject({}).transform(() => [])]).default(() => [])
|
|
3335
3474
|
})
|
|
3336
3475
|
);
|
|
3337
3476
|
|
|
3338
3477
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
3339
3478
|
import { v7 as uuidv79 } from "uuid";
|
|
3340
|
-
import { z as
|
|
3341
|
-
var CABQuantitySection =
|
|
3479
|
+
import { z as z54 } from "zod";
|
|
3480
|
+
var CABQuantitySection = z54.object({
|
|
3342
3481
|
...CABVariableFields,
|
|
3343
|
-
errorMessages:
|
|
3344
|
-
|
|
3345
|
-
|
|
3482
|
+
errorMessages: z54.record(
|
|
3483
|
+
z54.string(),
|
|
3484
|
+
z54.object({
|
|
3346
3485
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
3347
|
-
increment:
|
|
3348
|
-
max:
|
|
3349
|
-
min:
|
|
3350
|
-
neg:
|
|
3486
|
+
increment: z54.string().optional(),
|
|
3487
|
+
max: z54.string().optional(),
|
|
3488
|
+
min: z54.string().optional(),
|
|
3489
|
+
neg: z54.string().optional()
|
|
3351
3490
|
})
|
|
3352
3491
|
).default({
|
|
3353
3492
|
en: {
|
|
@@ -3357,18 +3496,18 @@ var CABQuantitySection = z46.object({
|
|
|
3357
3496
|
neg: "Quantity cannot be negative"
|
|
3358
3497
|
}
|
|
3359
3498
|
}),
|
|
3360
|
-
inputType:
|
|
3361
|
-
max:
|
|
3362
|
-
min:
|
|
3499
|
+
inputType: z54.enum(quantityInputs).default(QuantityInput.select),
|
|
3500
|
+
max: z54.number().min(1).max(100).default(10),
|
|
3501
|
+
min: z54.number().min(1).default(1),
|
|
3363
3502
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
3364
|
-
name:
|
|
3365
|
-
sectionId:
|
|
3366
|
-
sectionType:
|
|
3503
|
+
name: z54.string().default("Quantity"),
|
|
3504
|
+
sectionId: z54.uuid().default(() => uuidv79()),
|
|
3505
|
+
sectionType: z54.literal(SectionType.quantity).default(SectionType.quantity)
|
|
3367
3506
|
});
|
|
3368
3507
|
|
|
3369
3508
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3370
3509
|
import { v7 as uuidv710 } from "uuid";
|
|
3371
|
-
import { z as
|
|
3510
|
+
import { z as z55 } from "zod";
|
|
3372
3511
|
|
|
3373
3512
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
3374
3513
|
var REVIEW_LABELS = {
|
|
@@ -3431,68 +3570,68 @@ var REVIEW_LABELS = {
|
|
|
3431
3570
|
};
|
|
3432
3571
|
|
|
3433
3572
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3434
|
-
var CABReviewsSection =
|
|
3573
|
+
var CABReviewsSection = z55.object({
|
|
3435
3574
|
...CABVariableFields,
|
|
3436
|
-
color:
|
|
3575
|
+
color: z55.string().default("#fadb14"),
|
|
3437
3576
|
/**
|
|
3438
3577
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
3439
3578
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
3440
3579
|
* or merchant work.
|
|
3441
3580
|
*/
|
|
3442
|
-
countLabels:
|
|
3443
|
-
one:
|
|
3444
|
-
other:
|
|
3581
|
+
countLabels: z55.object({
|
|
3582
|
+
one: z55.record(z55.string(), z55.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
3583
|
+
other: z55.record(z55.string(), z55.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
3445
3584
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
3446
|
-
name:
|
|
3447
|
-
sectionId:
|
|
3448
|
-
sectionType:
|
|
3449
|
-
size:
|
|
3585
|
+
name: z55.string().optional(),
|
|
3586
|
+
sectionId: z55.uuid().default(() => uuidv710()),
|
|
3587
|
+
sectionType: z55.literal(SectionType.reviews).default(SectionType.reviews),
|
|
3588
|
+
size: z55.enum(reviewsSizes).default(ReviewsSize.default),
|
|
3450
3589
|
/**
|
|
3451
3590
|
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
3452
3591
|
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
3453
3592
|
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
3454
3593
|
* the whole reviews section.
|
|
3455
3594
|
*/
|
|
3456
|
-
strokeColor:
|
|
3595
|
+
strokeColor: z55.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
3457
3596
|
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
3458
|
-
strokeWidth:
|
|
3597
|
+
strokeWidth: z55.number().nonnegative().default(0)
|
|
3459
3598
|
});
|
|
3460
3599
|
|
|
3461
3600
|
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
3462
3601
|
import { v7 as uuidv711 } from "uuid";
|
|
3463
|
-
import { z as
|
|
3464
|
-
var CABSeparatorSection =
|
|
3602
|
+
import { z as z56 } from "zod";
|
|
3603
|
+
var CABSeparatorSection = z56.object({
|
|
3465
3604
|
...CABVariableFields,
|
|
3466
|
-
sectionId:
|
|
3467
|
-
sectionType:
|
|
3605
|
+
sectionId: z56.uuid().default(() => uuidv711()),
|
|
3606
|
+
sectionType: z56.literal(SectionType.separator).default(SectionType.separator)
|
|
3468
3607
|
});
|
|
3469
3608
|
|
|
3470
3609
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
3471
3610
|
import { slice } from "es-toolkit/compat";
|
|
3472
3611
|
import { v7 as uuidv712 } from "uuid";
|
|
3473
|
-
import { z as
|
|
3474
|
-
var CABVariantsSection =
|
|
3612
|
+
import { z as z57 } from "zod";
|
|
3613
|
+
var CABVariantsSection = z57.object({
|
|
3475
3614
|
...CABVariableFields,
|
|
3476
|
-
hideOutOfStockVariants:
|
|
3477
|
-
name:
|
|
3478
|
-
sectionId:
|
|
3479
|
-
sectionType:
|
|
3480
|
-
selector:
|
|
3481
|
-
variantMode:
|
|
3615
|
+
hideOutOfStockVariants: z57.boolean().default(false),
|
|
3616
|
+
name: z57.string().optional(),
|
|
3617
|
+
sectionId: z57.uuid().default(() => uuidv712()),
|
|
3618
|
+
sectionType: z57.literal(SectionType.variants).default(SectionType.variants),
|
|
3619
|
+
selector: z57.enum(slice(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
3620
|
+
variantMode: z57.enum(variantModes).default(VariantMode.multiple)
|
|
3482
3621
|
});
|
|
3483
3622
|
|
|
3484
3623
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
3485
|
-
var CABBorder =
|
|
3486
|
-
radius:
|
|
3487
|
-
style:
|
|
3488
|
-
width:
|
|
3624
|
+
var CABBorder = z58.object({
|
|
3625
|
+
radius: z58.enum(borderRadii).default(BorderRadius.base),
|
|
3626
|
+
style: z58.enum(borderStyles).default(BorderStyle.none),
|
|
3627
|
+
width: z58.enum(borderWidths).default(BorderWidth.base)
|
|
3489
3628
|
}).default({
|
|
3490
3629
|
radius: BorderRadius.base,
|
|
3491
3630
|
style: BorderStyle.none,
|
|
3492
3631
|
width: BorderWidth.base
|
|
3493
3632
|
});
|
|
3494
|
-
var CABSection =
|
|
3495
|
-
() =>
|
|
3633
|
+
var CABSection = z58.lazy(
|
|
3634
|
+
() => z58.discriminatedUnion("sectionType", [
|
|
3496
3635
|
CABBannerSection,
|
|
3497
3636
|
CABButtonSection,
|
|
3498
3637
|
CABCarouselSection,
|
|
@@ -3515,41 +3654,41 @@ var CABSection = z50.lazy(
|
|
|
3515
3654
|
);
|
|
3516
3655
|
|
|
3517
3656
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
3518
|
-
var GridItem =
|
|
3519
|
-
var CABLayoutWrapping =
|
|
3520
|
-
breakAt:
|
|
3521
|
-
maxPerLine:
|
|
3657
|
+
var GridItem = z59.union([z59.literal("auto"), z59.literal("fill"), z59.string().regex(/^\d+%$/), z59.number()]);
|
|
3658
|
+
var CABLayoutWrapping = z59.object({
|
|
3659
|
+
breakAt: z59.number().positive(),
|
|
3660
|
+
maxPerLine: z59.number().int().positive()
|
|
3522
3661
|
});
|
|
3523
|
-
var CABLayoutSection =
|
|
3662
|
+
var CABLayoutSection = z59.object({
|
|
3524
3663
|
...CABVariableFields,
|
|
3525
|
-
alignment:
|
|
3526
|
-
horizontal:
|
|
3527
|
-
vertical:
|
|
3664
|
+
alignment: z59.object({
|
|
3665
|
+
horizontal: z59.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
3666
|
+
vertical: z59.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
3528
3667
|
}).default({
|
|
3529
3668
|
horizontal: HorizontalAlignment.start,
|
|
3530
3669
|
vertical: VerticalAlignment.top
|
|
3531
3670
|
}),
|
|
3532
|
-
border:
|
|
3533
|
-
buttonField:
|
|
3534
|
-
direction:
|
|
3671
|
+
border: z59.lazy(() => CABBorder),
|
|
3672
|
+
buttonField: z59.enum(buttonFields).optional(),
|
|
3673
|
+
direction: z59.enum(directions).default(Direction.rows),
|
|
3535
3674
|
/**
|
|
3536
3675
|
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
3537
3676
|
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
3538
3677
|
*/
|
|
3539
|
-
frame:
|
|
3540
|
-
grid:
|
|
3541
|
-
columns:
|
|
3542
|
-
rows:
|
|
3678
|
+
frame: z59.enum(layoutFrames).optional(),
|
|
3679
|
+
grid: z59.object({
|
|
3680
|
+
columns: z59.union([z59.array(GridItem), z59.undefined()]).default(() => ["auto"]),
|
|
3681
|
+
rows: z59.union([z59.array(GridItem), z59.undefined()]).default(() => ["auto"])
|
|
3543
3682
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
3544
|
-
name:
|
|
3545
|
-
padding:
|
|
3546
|
-
sectionId:
|
|
3547
|
-
sections:
|
|
3548
|
-
sectionType:
|
|
3549
|
-
spacing:
|
|
3683
|
+
name: z59.string().optional(),
|
|
3684
|
+
padding: z59.enum(spacings).default(Spacing.none),
|
|
3685
|
+
sectionId: z59.uuid().default(() => uuidv713()),
|
|
3686
|
+
sections: z59.union([z59.array(z59.lazy(() => CABSection)), z59.strictObject({}).transform(() => [])]).default(() => []),
|
|
3687
|
+
sectionType: z59.literal(SectionType.layout).default(SectionType.layout),
|
|
3688
|
+
spacing: z59.enum(spacings).default(Spacing.base),
|
|
3550
3689
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
3551
|
-
viewUrl:
|
|
3552
|
-
width:
|
|
3690
|
+
viewUrl: z59.string().optional(),
|
|
3691
|
+
width: z59.number().default(100),
|
|
3553
3692
|
wrapping: CABLayoutWrapping.optional()
|
|
3554
3693
|
});
|
|
3555
3694
|
|
|
@@ -3571,8 +3710,8 @@ var UI_LABELS = {
|
|
|
3571
3710
|
};
|
|
3572
3711
|
|
|
3573
3712
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
3574
|
-
var localized = (fallback) =>
|
|
3575
|
-
var CABUILabels =
|
|
3713
|
+
var localized = (fallback) => z60.record(z60.string(), z60.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
3714
|
+
var CABUILabels = z60.object({
|
|
3576
3715
|
currentPage: localized(UI_LABELS.currentPage),
|
|
3577
3716
|
guest: localized(UI_LABELS.guest),
|
|
3578
3717
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -3597,154 +3736,154 @@ var CABUILabels = z52.object({
|
|
|
3597
3736
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
3598
3737
|
updating: { ...UI_LABELS.updating }
|
|
3599
3738
|
}));
|
|
3600
|
-
var TargetArea =
|
|
3601
|
-
fill:
|
|
3602
|
-
flip:
|
|
3603
|
-
icon:
|
|
3604
|
-
label:
|
|
3605
|
-
width:
|
|
3739
|
+
var TargetArea = z60.object({
|
|
3740
|
+
fill: z60.boolean().optional(),
|
|
3741
|
+
flip: z60.enum(["both", "horizontal", "vertical"]).optional(),
|
|
3742
|
+
icon: z60.string(),
|
|
3743
|
+
label: z60.string(),
|
|
3744
|
+
width: z60.string()
|
|
3606
3745
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
3607
|
-
var CABTracking =
|
|
3608
|
-
enableAttribution:
|
|
3609
|
-
enableSource:
|
|
3610
|
-
enableWidget:
|
|
3746
|
+
var CABTracking = z60.object({
|
|
3747
|
+
enableAttribution: z60.boolean().nullish().transform((value) => value ?? true),
|
|
3748
|
+
enableSource: z60.boolean().nullish().transform((value) => value ?? true),
|
|
3749
|
+
enableWidget: z60.boolean().nullish().transform((value) => value ?? true)
|
|
3611
3750
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
3612
|
-
var CABExperiment =
|
|
3613
|
-
elementId:
|
|
3614
|
-
experimentId:
|
|
3615
|
-
experimentType:
|
|
3616
|
-
selectedId:
|
|
3751
|
+
var CABExperiment = z60.object({
|
|
3752
|
+
elementId: z60.number(),
|
|
3753
|
+
experimentId: z60.number(),
|
|
3754
|
+
experimentType: z60.string(),
|
|
3755
|
+
selectedId: z60.number()
|
|
3617
3756
|
});
|
|
3618
3757
|
var CABRootSection = CABLayoutSection.extend({
|
|
3619
|
-
editorMode:
|
|
3758
|
+
editorMode: z60.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
3620
3759
|
experiment: CABExperiment.optional(),
|
|
3621
3760
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
3622
3761
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
3623
|
-
previewMode:
|
|
3624
|
-
storeId:
|
|
3762
|
+
previewMode: z60.boolean().nullish().transform((value) => value ?? false),
|
|
3763
|
+
storeId: z60.number().nullable().default(null),
|
|
3625
3764
|
targetArea: TargetArea.nullable(),
|
|
3626
3765
|
tracking: CABTracking,
|
|
3627
|
-
type:
|
|
3766
|
+
type: z60.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
3628
3767
|
uiLabels: CABUILabels,
|
|
3629
|
-
version:
|
|
3630
|
-
widgetId:
|
|
3768
|
+
version: z60.literal(2).default(2),
|
|
3769
|
+
widgetId: z60.number().nullable().default(null)
|
|
3631
3770
|
});
|
|
3632
3771
|
|
|
3633
3772
|
// src/schema/widgets/contentBlock.ts
|
|
3634
|
-
var ContentBlockV1 =
|
|
3635
|
-
blockSpacing:
|
|
3636
|
-
imageBlocks:
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
altText:
|
|
3640
|
-
description:
|
|
3641
|
-
id:
|
|
3642
|
-
imagePlacement:
|
|
3643
|
-
imageSize:
|
|
3644
|
-
imageUrl:
|
|
3645
|
-
textAlignment:
|
|
3773
|
+
var ContentBlockV1 = z61.object({
|
|
3774
|
+
blockSpacing: z61.enum(spacings).optional(),
|
|
3775
|
+
imageBlocks: z61.union([
|
|
3776
|
+
z61.array(
|
|
3777
|
+
z61.object({
|
|
3778
|
+
altText: z61.string().nullable(),
|
|
3779
|
+
description: z61.string().nullable(),
|
|
3780
|
+
id: z61.uuid(),
|
|
3781
|
+
imagePlacement: z61.enum(["top", "right", "bottom", "left"]),
|
|
3782
|
+
imageSize: z61.number(),
|
|
3783
|
+
imageUrl: z61.url(),
|
|
3784
|
+
textAlignment: z61.enum(["left", "center", "right"]),
|
|
3646
3785
|
/** Inline scale only: an image caption can never be a block-level heading. */
|
|
3647
|
-
textSize:
|
|
3786
|
+
textSize: z61.enum(inlineTextSizeNames)
|
|
3648
3787
|
})
|
|
3649
3788
|
),
|
|
3650
|
-
|
|
3789
|
+
z61.strictObject({}).transform(() => [])
|
|
3651
3790
|
]).optional(),
|
|
3652
|
-
imageLayout:
|
|
3653
|
-
language:
|
|
3654
|
-
description:
|
|
3655
|
-
superTitle:
|
|
3656
|
-
title:
|
|
3791
|
+
imageLayout: z61.enum(["row", "column"]).optional(),
|
|
3792
|
+
language: z61.object({
|
|
3793
|
+
description: z61.string(),
|
|
3794
|
+
superTitle: z61.string(),
|
|
3795
|
+
title: z61.string()
|
|
3657
3796
|
}),
|
|
3658
|
-
previewMode:
|
|
3659
|
-
type:
|
|
3660
|
-
version:
|
|
3797
|
+
previewMode: z61.boolean(),
|
|
3798
|
+
type: z61.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block),
|
|
3799
|
+
version: z61.literal(1)
|
|
3661
3800
|
});
|
|
3662
|
-
var ContentBlock =
|
|
3801
|
+
var ContentBlock = z61.discriminatedUnion("version", [
|
|
3663
3802
|
ContentBlockV1,
|
|
3664
3803
|
CABRootSection.extend({
|
|
3665
|
-
type:
|
|
3804
|
+
type: z61.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block)
|
|
3666
3805
|
})
|
|
3667
3806
|
]);
|
|
3668
3807
|
|
|
3669
3808
|
// src/schema/widgets/giftWithPurchase.ts
|
|
3670
|
-
import { z as
|
|
3671
|
-
var GiftWithPurchase =
|
|
3672
|
-
type:
|
|
3809
|
+
import { z as z62 } from "zod";
|
|
3810
|
+
var GiftWithPurchase = z62.looseObject({
|
|
3811
|
+
type: z62.literal(WidgetType.gift_with_purchase).default(WidgetType.gift_with_purchase)
|
|
3673
3812
|
});
|
|
3674
3813
|
|
|
3675
3814
|
// src/schema/widgets/lineItemEditor.ts
|
|
3676
|
-
import { z as
|
|
3677
|
-
var LineItemEditorSwitchLanguageV1 =
|
|
3678
|
-
downgradeToOneTimeLabel:
|
|
3815
|
+
import { z as z63 } from "zod";
|
|
3816
|
+
var LineItemEditorSwitchLanguageV1 = z63.object({
|
|
3817
|
+
downgradeToOneTimeLabel: z63.string().optional(),
|
|
3679
3818
|
/** Frequency-option template (`{{frequency}}`/`{{interval}}`) for the plan select. */
|
|
3680
|
-
subscriptionOptionLabel:
|
|
3681
|
-
upgradeToSubscriptionLabel:
|
|
3682
|
-
upgradeToSubscriptionWithoutDiscountLabel:
|
|
3819
|
+
subscriptionOptionLabel: z63.string().optional(),
|
|
3820
|
+
upgradeToSubscriptionLabel: z63.string().optional(),
|
|
3821
|
+
upgradeToSubscriptionWithoutDiscountLabel: z63.string().optional()
|
|
3683
3822
|
});
|
|
3684
|
-
var LineItemEditorV1 =
|
|
3823
|
+
var LineItemEditorV1 = z63.object({
|
|
3685
3824
|
/** Legacy `getStyles` button style; the converter carries a valid kind, defaulting to `plain`. */
|
|
3686
|
-
button:
|
|
3687
|
-
previewMode:
|
|
3688
|
-
switchToSubscription:
|
|
3689
|
-
disableDowngrade:
|
|
3825
|
+
button: z63.object({ kind: z63.enum(["plain", "primary", "secondary"]).optional() }).optional(),
|
|
3826
|
+
previewMode: z63.boolean().optional(),
|
|
3827
|
+
switchToSubscription: z63.object({
|
|
3828
|
+
disableDowngrade: z63.boolean().optional(),
|
|
3690
3829
|
language: LineItemEditorSwitchLanguageV1.optional()
|
|
3691
3830
|
}).optional(),
|
|
3692
|
-
switchToSubscriptionEnabled:
|
|
3693
|
-
tracking:
|
|
3694
|
-
enableAttribution:
|
|
3695
|
-
enableSource:
|
|
3696
|
-
enableWidget:
|
|
3831
|
+
switchToSubscriptionEnabled: z63.boolean().optional(),
|
|
3832
|
+
tracking: z63.object({
|
|
3833
|
+
enableAttribution: z63.boolean().optional(),
|
|
3834
|
+
enableSource: z63.boolean().optional(),
|
|
3835
|
+
enableWidget: z63.boolean().optional()
|
|
3697
3836
|
}).optional(),
|
|
3698
|
-
type:
|
|
3699
|
-
version:
|
|
3837
|
+
type: z63.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor),
|
|
3838
|
+
version: z63.literal(1)
|
|
3700
3839
|
});
|
|
3701
|
-
var LineItemEditor =
|
|
3840
|
+
var LineItemEditor = z63.discriminatedUnion("version", [
|
|
3702
3841
|
LineItemEditorV1,
|
|
3703
3842
|
CABRootSection.extend({
|
|
3704
|
-
type:
|
|
3843
|
+
type: z63.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor)
|
|
3705
3844
|
})
|
|
3706
3845
|
]);
|
|
3707
3846
|
|
|
3708
3847
|
// src/schema/widgets/progressBar.ts
|
|
3709
|
-
import { z as
|
|
3710
|
-
var ProgressBar =
|
|
3711
|
-
type:
|
|
3848
|
+
import { z as z64 } from "zod";
|
|
3849
|
+
var ProgressBar = z64.looseObject({
|
|
3850
|
+
type: z64.literal(WidgetType.ui_extension_progress_bar).default(WidgetType.ui_extension_progress_bar)
|
|
3712
3851
|
});
|
|
3713
3852
|
|
|
3714
3853
|
// src/schema/widgets/rebuyButton.ts
|
|
3715
|
-
import { z as
|
|
3716
|
-
var RebuyButtonV1 =
|
|
3717
|
-
type:
|
|
3718
|
-
version:
|
|
3854
|
+
import { z as z65 } from "zod";
|
|
3855
|
+
var RebuyButtonV1 = z65.looseObject({
|
|
3856
|
+
type: z65.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button),
|
|
3857
|
+
version: z65.literal(1)
|
|
3719
3858
|
});
|
|
3720
|
-
var RebuyButton =
|
|
3859
|
+
var RebuyButton = z65.discriminatedUnion("version", [
|
|
3721
3860
|
RebuyButtonV1,
|
|
3722
3861
|
CABRootSection.extend({
|
|
3723
|
-
type:
|
|
3862
|
+
type: z65.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button)
|
|
3724
3863
|
})
|
|
3725
3864
|
]);
|
|
3726
3865
|
|
|
3727
3866
|
// src/schema/widgets/rebuyMonetize.ts
|
|
3728
|
-
import { z as
|
|
3729
|
-
var RebuyMonetize =
|
|
3730
|
-
type:
|
|
3867
|
+
import { z as z66 } from "zod";
|
|
3868
|
+
var RebuyMonetize = z66.looseObject({
|
|
3869
|
+
type: z66.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad)
|
|
3731
3870
|
});
|
|
3732
|
-
var RebuyMonetizeV1 =
|
|
3733
|
-
name:
|
|
3734
|
-
previewMode:
|
|
3871
|
+
var RebuyMonetizeV1 = z66.object({
|
|
3872
|
+
name: z66.string().nullable().optional(),
|
|
3873
|
+
previewMode: z66.boolean().optional(),
|
|
3735
3874
|
/** Privacy Policy footer href → the marker section's `privacyPolicyUrl`. */
|
|
3736
|
-
privacyPolicyUrl:
|
|
3875
|
+
privacyPolicyUrl: z66.string().nullable().optional(),
|
|
3737
3876
|
/** Ads-taxonomy sub-vertical id — one of the admin Monetize editor's two configurables. */
|
|
3738
|
-
subVertical:
|
|
3739
|
-
tracking:
|
|
3740
|
-
enableAttribution:
|
|
3741
|
-
enableSource:
|
|
3742
|
-
enableWidget:
|
|
3877
|
+
subVertical: z66.string().nullable().optional(),
|
|
3878
|
+
tracking: z66.object({
|
|
3879
|
+
enableAttribution: z66.boolean().optional(),
|
|
3880
|
+
enableSource: z66.boolean().optional(),
|
|
3881
|
+
enableWidget: z66.boolean().optional()
|
|
3743
3882
|
}).optional(),
|
|
3744
|
-
type:
|
|
3745
|
-
version:
|
|
3883
|
+
type: z66.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad),
|
|
3884
|
+
version: z66.literal(1),
|
|
3746
3885
|
/** Ads-taxonomy vertical id — one of the admin Monetize editor's two configurables. */
|
|
3747
|
-
vertical:
|
|
3886
|
+
vertical: z66.string().nullable().optional()
|
|
3748
3887
|
});
|
|
3749
3888
|
|
|
3750
3889
|
// src/schema/widgetData.ts
|
|
@@ -3758,7 +3897,7 @@ var extensionWidgetTypes = [
|
|
|
3758
3897
|
WidgetType.ui_extension_line_item_editor,
|
|
3759
3898
|
WidgetType.ui_extension_progress_bar
|
|
3760
3899
|
];
|
|
3761
|
-
var WidgetData =
|
|
3900
|
+
var WidgetData = z67.discriminatedUnion("type", [
|
|
3762
3901
|
ABTestingPlaceholder,
|
|
3763
3902
|
CheckoutExtension,
|
|
3764
3903
|
ContentBlock,
|
|
@@ -4118,36 +4257,36 @@ var SWITCH_LABELS = {
|
|
|
4118
4257
|
};
|
|
4119
4258
|
|
|
4120
4259
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
4121
|
-
import { z as
|
|
4260
|
+
import { z as z69 } from "zod";
|
|
4122
4261
|
|
|
4123
4262
|
// src/schema/widgets/post-purchase-offer/postPurchaseWidget.ts
|
|
4124
|
-
import { z as
|
|
4125
|
-
var PostPurchaseWidgetLinkedFlow =
|
|
4126
|
-
id:
|
|
4127
|
-
name:
|
|
4128
|
-
});
|
|
4129
|
-
var PostPurchaseWidget =
|
|
4130
|
-
classification:
|
|
4131
|
-
createdAtTime:
|
|
4132
|
-
customEndpointName:
|
|
4133
|
-
id:
|
|
4134
|
-
lastViewed:
|
|
4135
|
-
linkedCustomEndpointId:
|
|
4136
|
-
linkedFlows:
|
|
4137
|
-
name:
|
|
4138
|
-
owner:
|
|
4263
|
+
import { z as z68 } from "zod";
|
|
4264
|
+
var PostPurchaseWidgetLinkedFlow = z68.object({
|
|
4265
|
+
id: z68.number(),
|
|
4266
|
+
name: z68.string()
|
|
4267
|
+
});
|
|
4268
|
+
var PostPurchaseWidget = z68.object({
|
|
4269
|
+
classification: z68.literal("post_purchase_offer_page").default("post_purchase_offer_page"),
|
|
4270
|
+
createdAtTime: z68.iso.datetime({ offset: true }).optional(),
|
|
4271
|
+
customEndpointName: z68.string().nullish(),
|
|
4272
|
+
id: z68.number().default(0),
|
|
4273
|
+
lastViewed: z68.iso.datetime({ offset: true }).nullish(),
|
|
4274
|
+
linkedCustomEndpointId: z68.number().nullish(),
|
|
4275
|
+
linkedFlows: z68.array(PostPurchaseWidgetLinkedFlow).optional(),
|
|
4276
|
+
name: z68.string().default(""),
|
|
4277
|
+
owner: z68.number().nullish(),
|
|
4139
4278
|
settings: PostPurchaseSettings
|
|
4140
4279
|
});
|
|
4141
4280
|
|
|
4142
4281
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
4143
|
-
var PostPurchaseOffer =
|
|
4144
|
-
|
|
4145
|
-
errors:
|
|
4146
|
-
message:
|
|
4147
|
-
successful:
|
|
4282
|
+
var PostPurchaseOffer = z69.discriminatedUnion("successful", [
|
|
4283
|
+
z69.strictObject({
|
|
4284
|
+
errors: z69.array(z69.object({ message: z69.string() })),
|
|
4285
|
+
message: z69.string(),
|
|
4286
|
+
successful: z69.literal(false)
|
|
4148
4287
|
}),
|
|
4149
|
-
|
|
4150
|
-
successful:
|
|
4288
|
+
z69.strictObject({
|
|
4289
|
+
successful: z69.literal(true),
|
|
4151
4290
|
widget: PostPurchaseWidget
|
|
4152
4291
|
})
|
|
4153
4292
|
]);
|
|
@@ -5221,6 +5360,68 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
5221
5360
|
widgetId: id
|
|
5222
5361
|
});
|
|
5223
5362
|
};
|
|
5363
|
+
|
|
5364
|
+
// src/pricing/amountToCents.ts
|
|
5365
|
+
var round = (value, precision = 0) => {
|
|
5366
|
+
const factor = 10 ** precision;
|
|
5367
|
+
return Math.round(value * factor) / factor;
|
|
5368
|
+
};
|
|
5369
|
+
var amountToCents2 = (amount2, decimals = 2) => {
|
|
5370
|
+
const value = Number(amount2);
|
|
5371
|
+
return Number.isFinite(value) ? round(round(value, decimals) * 10 ** decimals) : 0;
|
|
5372
|
+
};
|
|
5373
|
+
|
|
5374
|
+
// src/pricing/currencyDecimals.ts
|
|
5375
|
+
var MINOR_UNIT_OVERRIDES = {
|
|
5376
|
+
IQD: 3
|
|
5377
|
+
};
|
|
5378
|
+
var CACHE = /* @__PURE__ */ new Map();
|
|
5379
|
+
var currencyDecimals = (currencyCode) => {
|
|
5380
|
+
if (!currencyCode) return 2;
|
|
5381
|
+
const code = currencyCode.toUpperCase();
|
|
5382
|
+
const override = MINOR_UNIT_OVERRIDES[code];
|
|
5383
|
+
if (override !== void 0) return override;
|
|
5384
|
+
const cached = CACHE.get(code);
|
|
5385
|
+
if (cached !== void 0) return cached;
|
|
5386
|
+
let decimals = 2;
|
|
5387
|
+
try {
|
|
5388
|
+
const { maximumFractionDigits } = new Intl.NumberFormat("en", {
|
|
5389
|
+
currency: code,
|
|
5390
|
+
style: "currency"
|
|
5391
|
+
}).resolvedOptions();
|
|
5392
|
+
decimals = maximumFractionDigits ?? 2;
|
|
5393
|
+
} catch {
|
|
5394
|
+
decimals = 2;
|
|
5395
|
+
}
|
|
5396
|
+
CACHE.set(code, decimals);
|
|
5397
|
+
return decimals;
|
|
5398
|
+
};
|
|
5399
|
+
|
|
5400
|
+
// src/pricing/postPurchaseSubscriptionDisplay.ts
|
|
5401
|
+
var postPurchaseSubscriptionDisplay = (prepared, currencyCode) => {
|
|
5402
|
+
const subscription = readPostPurchaseSubscription(prepared);
|
|
5403
|
+
if (!subscription) return void 0;
|
|
5404
|
+
const decimals = currencyDecimals(currencyCode);
|
|
5405
|
+
const variant2 = subscription.product.variant;
|
|
5406
|
+
const regular = amountToCents2(variant2.price, decimals);
|
|
5407
|
+
const compareAt = amountToCents2(variant2.compareAtPrice, decimals);
|
|
5408
|
+
const comparisonMinor = subscription.display.discountedFrom === "compare_at_price" && compareAt > regular ? compareAt : regular;
|
|
5409
|
+
const adjustment = subscription.terms.subscription.adjustment;
|
|
5410
|
+
const reduce = (price, discount) => {
|
|
5411
|
+
const reduction = discount.type === "percentage" ? Math.round(price * discount.amount / 100) : discount.type === "fixed_amount" ? amountToCents2(discount.amount, decimals) : 0;
|
|
5412
|
+
return Math.max(0, price - reduction);
|
|
5413
|
+
};
|
|
5414
|
+
const planPrice = adjustment?.type === "price" ? amountToCents2(adjustment.amount, decimals) : adjustment ? reduce(regular, { amount: adjustment.amount, type: adjustment.type }) : regular;
|
|
5415
|
+
const priceMinor = reduce(planPrice, subscription.terms.discount);
|
|
5416
|
+
const savingMinor = Math.max(0, comparisonMinor - priceMinor);
|
|
5417
|
+
return PostPurchaseSubscriptionDisplay.parse({
|
|
5418
|
+
comparisonMinor,
|
|
5419
|
+
currencyCode,
|
|
5420
|
+
priceMinor,
|
|
5421
|
+
savingMinor,
|
|
5422
|
+
savingPercent: comparisonMinor ? Math.round(savingMinor / comparisonMinor * 100) : 0
|
|
5423
|
+
});
|
|
5424
|
+
};
|
|
5224
5425
|
export {
|
|
5225
5426
|
ABTestingPlaceholder,
|
|
5226
5427
|
ARRAY_INDEX_STRING,
|
|
@@ -5338,10 +5539,17 @@ export {
|
|
|
5338
5539
|
PostPurchaseAmount,
|
|
5339
5540
|
PostPurchaseAppIdSchema,
|
|
5340
5541
|
PostPurchaseBlock,
|
|
5542
|
+
PostPurchaseChoice,
|
|
5543
|
+
PostPurchaseDiscount,
|
|
5341
5544
|
PostPurchaseExcludedProductIds,
|
|
5342
5545
|
PostPurchaseOffer,
|
|
5546
|
+
PostPurchaseOptions,
|
|
5343
5547
|
PostPurchaseOrderAttributes,
|
|
5344
5548
|
PostPurchaseOrderIdSchema,
|
|
5549
|
+
PostPurchasePlanAdjustment,
|
|
5550
|
+
PostPurchasePlanCatalog,
|
|
5551
|
+
PostPurchasePlanOption,
|
|
5552
|
+
PostPurchasePreparation,
|
|
5345
5553
|
PostPurchasePrimaryImageSource,
|
|
5346
5554
|
PostPurchaseProductDisplay,
|
|
5347
5555
|
PostPurchaseProductGallery,
|
|
@@ -5354,7 +5562,10 @@ export {
|
|
|
5354
5562
|
PostPurchaseShadowSelectionSchema,
|
|
5355
5563
|
PostPurchaseSkipReasonSchema,
|
|
5356
5564
|
PostPurchaseSkipTraceSchema,
|
|
5565
|
+
PostPurchaseSubscriptionDisplay,
|
|
5566
|
+
PostPurchaseSubscriptionTerms,
|
|
5357
5567
|
PostPurchaseTimestampSchema,
|
|
5568
|
+
PostPurchaseVariant,
|
|
5358
5569
|
PostPurchaseVariantCatalog,
|
|
5359
5570
|
PostPurchaseVariantDefaultProduct,
|
|
5360
5571
|
PostPurchaseVariantDefaultSettings,
|
|
@@ -5364,6 +5575,8 @@ export {
|
|
|
5364
5575
|
PostPurchaseVariantValues,
|
|
5365
5576
|
PostPurchaseWidget,
|
|
5366
5577
|
PostPurchaseWidgetLinkedFlow,
|
|
5578
|
+
PreparedPostPurchaseProduct,
|
|
5579
|
+
PreparedPostPurchaseSubscription,
|
|
5367
5580
|
Product,
|
|
5368
5581
|
ProductInformationBlock,
|
|
5369
5582
|
ProductType,
|
|
@@ -5503,6 +5716,7 @@ export {
|
|
|
5503
5716
|
offersDirections,
|
|
5504
5717
|
popoverPositionMap,
|
|
5505
5718
|
popoverPositions,
|
|
5719
|
+
postPurchaseSubscriptionDisplay,
|
|
5506
5720
|
productImageObject,
|
|
5507
5721
|
productTypes,
|
|
5508
5722
|
progressTierExclusionTypes,
|
|
@@ -5530,6 +5744,7 @@ export {
|
|
|
5530
5744
|
textSizeNames,
|
|
5531
5745
|
utmObjectFromString,
|
|
5532
5746
|
uuid,
|
|
5747
|
+
validPostPurchaseDiscount,
|
|
5533
5748
|
variableEffects,
|
|
5534
5749
|
variableTypes,
|
|
5535
5750
|
variantAvailable,
|