@rebuy/rebuy 3.24.0 → 3.26.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 +779 -712
- package/dist/index.mjs +779 -712
- package/dist/schema/checkout-and-beyond/index.cjs +7 -0
- package/dist/schema/checkout-and-beyond/index.mjs +7 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/postPurchaseEligibility.d.ts +12 -0
- package/dist/schema/postPurchaseIdentity.d.ts +18 -0
- package/dist/schema/postPurchaseShadow.d.ts +69 -0
- package/dist/schema/postPurchaseSkipTrace.d.ts +19 -0
- package/dist/schema/widget-data.cjs +6 -0
- package/dist/schema/widget-data.mjs +6 -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/icons.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/image.d.ts +2 -2
- package/dist/schema/widgets/checkout-and-beyond/monetize.d.ts +15 -0
- 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/server/adsEngine.d.ts +10 -1
- package/dist/server/index.cjs +30 -13
- package/dist/server/index.mjs +30 -13
- package/dist/server/monetizeOffers.d.ts +3 -1
- package/dist/server/requestSchemas.d.ts +1 -1
- package/dist/transforms/index.cjs +6 -0
- package/dist/transforms/index.mjs +6 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1252,57 +1252,107 @@ var OfferProduct = z5.object({
|
|
|
1252
1252
|
variants: z5.array(OfferProductVariant).min(1)
|
|
1253
1253
|
});
|
|
1254
1254
|
|
|
1255
|
-
// src/schema/
|
|
1255
|
+
// src/schema/postPurchaseEligibility.ts
|
|
1256
1256
|
import { z as z6 } from "zod";
|
|
1257
|
-
var
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1257
|
+
var PostPurchaseSkipReason = z6.enum(["empty", "no-eligible-subscription"]);
|
|
1258
|
+
|
|
1259
|
+
// src/schema/postPurchaseIdentity.ts
|
|
1260
|
+
import { z as z7 } from "zod";
|
|
1261
|
+
var PostPurchaseTimestampSchema = z7.number().int().nonnegative();
|
|
1262
|
+
var PostPurchaseOrderIdSchema = z7.string().regex(/^gid:\/\/shopify\/Order\/[1-9]\d*$/);
|
|
1263
|
+
var ShopifyDomainSchema = z7.string().regex(/^[a-z0-9][a-z0-9-]*\.myshopify\.com$/);
|
|
1264
|
+
var DecideRequestSchema = z7.object({
|
|
1265
|
+
checkoutToken: z7.string().min(1).max(256),
|
|
1266
|
+
shop: ShopifyDomainSchema
|
|
1267
|
+
});
|
|
1268
|
+
var DecisionEntrySchema = z7.object({
|
|
1269
|
+
blockId: z7.number().int().positive(),
|
|
1270
|
+
blockIndex: z7.string(),
|
|
1271
|
+
blockParentIndex: z7.string(),
|
|
1272
|
+
flowId: z7.number().int().positive(),
|
|
1273
|
+
sectionId: z7.number().int().positive(),
|
|
1274
|
+
widgetId: z7.number().int().positive(),
|
|
1275
|
+
widgetTraffic: z7.number().min(0).max(100)
|
|
1276
|
+
});
|
|
1277
|
+
|
|
1278
|
+
// src/schema/postPurchaseShadow.ts
|
|
1279
|
+
import { z as z8 } from "zod";
|
|
1280
|
+
var PostPurchaseShadowSelectionSchema = z8.discriminatedUnion("verdict", [
|
|
1281
|
+
z8.object({ entry: DecisionEntrySchema, verdict: z8.literal("render") }),
|
|
1282
|
+
z8.object({ verdict: z8.literal("skip") })
|
|
1283
|
+
]);
|
|
1284
|
+
var PostPurchaseShadowReportSchema = z8.object({
|
|
1285
|
+
differences: z8.array(z8.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])),
|
|
1286
|
+
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
1287
|
+
phase: z8.literal("shouldRender"),
|
|
1288
|
+
sampleId: z8.string(),
|
|
1289
|
+
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
1290
|
+
status: z8.enum(["match", "diverged", "incomplete"]),
|
|
1291
|
+
targetingFlowIds: z8.array(z8.number()),
|
|
1292
|
+
workflowPhase: z8.literal("decide")
|
|
1293
|
+
});
|
|
1294
|
+
|
|
1295
|
+
// src/schema/postPurchaseSkipTrace.ts
|
|
1296
|
+
import { z as z9 } from "zod";
|
|
1297
|
+
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
1298
|
+
var PostPurchaseSkipTrace = z9.array(
|
|
1299
|
+
z9.object({
|
|
1300
|
+
entry: DecisionEntrySchema,
|
|
1301
|
+
reason: PostPurchaseSkipReason
|
|
1302
|
+
})
|
|
1303
|
+
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
1304
|
+
|
|
1305
|
+
// src/schema/shopConfig.ts
|
|
1306
|
+
import { z as z10 } from "zod";
|
|
1307
|
+
var ShopConfig = z10.object({
|
|
1308
|
+
activeExperiments: z10.array(
|
|
1309
|
+
z10.object({
|
|
1310
|
+
data: z10.array(
|
|
1311
|
+
z10.object({
|
|
1312
|
+
aliasName: z10.string(),
|
|
1313
|
+
cssInput: z10.string().nullish(),
|
|
1314
|
+
elementId: z10.coerce.number(),
|
|
1315
|
+
id: z10.coerce.number(),
|
|
1316
|
+
javascriptInput: z10.string().nullish(),
|
|
1317
|
+
traffic: z10.coerce.number()
|
|
1268
1318
|
})
|
|
1269
1319
|
),
|
|
1270
|
-
id:
|
|
1271
|
-
name:
|
|
1272
|
-
pageTarget:
|
|
1273
|
-
pageTargetUrl:
|
|
1274
|
-
placeholderId:
|
|
1275
|
-
type:
|
|
1320
|
+
id: z10.coerce.number(),
|
|
1321
|
+
name: z10.string(),
|
|
1322
|
+
pageTarget: z10.string().nullable(),
|
|
1323
|
+
pageTargetUrl: z10.string().nullable(),
|
|
1324
|
+
placeholderId: z10.coerce.number().nullable(),
|
|
1325
|
+
type: z10.string()
|
|
1276
1326
|
})
|
|
1277
1327
|
),
|
|
1278
|
-
activePackages:
|
|
1279
|
-
|
|
1280
|
-
cancelledAt:
|
|
1281
|
-
id:
|
|
1282
|
-
installedAt:
|
|
1283
|
-
isActive:
|
|
1284
|
-
isBillable:
|
|
1285
|
-
packageId:
|
|
1286
|
-
packageName:
|
|
1287
|
-
shortName:
|
|
1288
|
-
trialDays:
|
|
1289
|
-
uninstalledAt:
|
|
1328
|
+
activePackages: z10.array(
|
|
1329
|
+
z10.object({
|
|
1330
|
+
cancelledAt: z10.string().nullable(),
|
|
1331
|
+
id: z10.number(),
|
|
1332
|
+
installedAt: z10.string().nullable(),
|
|
1333
|
+
isActive: z10.boolean(),
|
|
1334
|
+
isBillable: z10.boolean(),
|
|
1335
|
+
packageId: z10.number(),
|
|
1336
|
+
packageName: z10.string(),
|
|
1337
|
+
shortName: z10.string(),
|
|
1338
|
+
trialDays: z10.number(),
|
|
1339
|
+
uninstalledAt: z10.string().nullable()
|
|
1290
1340
|
})
|
|
1291
1341
|
),
|
|
1292
|
-
apiKey:
|
|
1293
|
-
billingVersion:
|
|
1294
|
-
cacheKey:
|
|
1295
|
-
carousel:
|
|
1296
|
-
currency:
|
|
1297
|
-
currencySymbol:
|
|
1298
|
-
domain:
|
|
1299
|
-
enabledJquery:
|
|
1300
|
-
enabledPresentmentCurrencies:
|
|
1301
|
-
hasSmartCollectionsEnabled:
|
|
1302
|
-
hasSmartSearchEnabled:
|
|
1303
|
-
id:
|
|
1304
|
-
integrations:
|
|
1305
|
-
|
|
1342
|
+
apiKey: z10.string(),
|
|
1343
|
+
billingVersion: z10.string().nullable(),
|
|
1344
|
+
cacheKey: z10.coerce.number(),
|
|
1345
|
+
carousel: z10.enum(["flickity", "splide"]),
|
|
1346
|
+
currency: z10.string(),
|
|
1347
|
+
currencySymbol: z10.string(),
|
|
1348
|
+
domain: z10.string(),
|
|
1349
|
+
enabledJquery: z10.boolean(),
|
|
1350
|
+
enabledPresentmentCurrencies: z10.array(z10.string()),
|
|
1351
|
+
hasSmartCollectionsEnabled: z10.boolean(),
|
|
1352
|
+
hasSmartSearchEnabled: z10.boolean(),
|
|
1353
|
+
id: z10.coerce.number(),
|
|
1354
|
+
integrations: z10.record(
|
|
1355
|
+
z10.enum([
|
|
1306
1356
|
"attentive",
|
|
1307
1357
|
"judgeme",
|
|
1308
1358
|
"junip",
|
|
@@ -1315,46 +1365,46 @@ var ShopConfig = z6.object({
|
|
|
1315
1365
|
"stamped",
|
|
1316
1366
|
"yotpo"
|
|
1317
1367
|
]),
|
|
1318
|
-
|
|
1368
|
+
z10.union([z10.boolean(), z10.unknown()])
|
|
1319
1369
|
),
|
|
1320
|
-
markets:
|
|
1321
|
-
enabled:
|
|
1370
|
+
markets: z10.object({
|
|
1371
|
+
enabled: z10.boolean()
|
|
1322
1372
|
}),
|
|
1323
|
-
monetize:
|
|
1324
|
-
publisherKey:
|
|
1373
|
+
monetize: z10.object({
|
|
1374
|
+
publisherKey: z10.string().nullable()
|
|
1325
1375
|
}).nullish(),
|
|
1326
|
-
moneyFormat:
|
|
1327
|
-
myshopifyDomain:
|
|
1328
|
-
primaryLocale:
|
|
1329
|
-
productGroupsEnabled:
|
|
1330
|
-
rechargeCustomDomain:
|
|
1331
|
-
sellingPlansEnabled:
|
|
1332
|
-
shopId:
|
|
1333
|
-
shopifySellingPlansEnabled:
|
|
1334
|
-
shopName:
|
|
1335
|
-
storefrontAccessToken:
|
|
1336
|
-
useRebuyIcons:
|
|
1376
|
+
moneyFormat: z10.string(),
|
|
1377
|
+
myshopifyDomain: z10.string(),
|
|
1378
|
+
primaryLocale: z10.string(),
|
|
1379
|
+
productGroupsEnabled: z10.enum(["no", "yes"]).transform((value) => value === "yes"),
|
|
1380
|
+
rechargeCustomDomain: z10.string().nullable(),
|
|
1381
|
+
sellingPlansEnabled: z10.boolean(),
|
|
1382
|
+
shopId: z10.number(),
|
|
1383
|
+
shopifySellingPlansEnabled: z10.boolean(),
|
|
1384
|
+
shopName: z10.string(),
|
|
1385
|
+
storefrontAccessToken: z10.string().nullable(),
|
|
1386
|
+
useRebuyIcons: z10.boolean()
|
|
1337
1387
|
});
|
|
1338
1388
|
|
|
1339
1389
|
// src/schema/userConfig.ts
|
|
1340
|
-
import { z as
|
|
1341
|
-
var UserConfig =
|
|
1390
|
+
import { z as z11 } from "zod";
|
|
1391
|
+
var UserConfig = z11.object({
|
|
1342
1392
|
shop: ShopConfig,
|
|
1343
1393
|
/**
|
|
1344
1394
|
* `.catch(undefined)` is the safety bar: smart-cart shape drift can NEVER fail `fetchUserConfig`,
|
|
1345
1395
|
* which resolves the apiKey for every offers/monetize/analytics/gift request.
|
|
1346
1396
|
*/
|
|
1347
1397
|
smartCart: SmartCartConfig.nullish().catch(void 0),
|
|
1348
|
-
smartFlows:
|
|
1398
|
+
smartFlows: z11.array(z11.unknown())
|
|
1349
1399
|
});
|
|
1350
1400
|
|
|
1351
1401
|
// src/schema/widgetData.ts
|
|
1352
|
-
import { z as
|
|
1402
|
+
import { z as z41 } from "zod";
|
|
1353
1403
|
|
|
1354
1404
|
// src/schema/widgets/abTestingPlaceholder.ts
|
|
1355
|
-
import { z as
|
|
1356
|
-
var ABTestingPlaceholder =
|
|
1357
|
-
type:
|
|
1405
|
+
import { z as z12 } from "zod";
|
|
1406
|
+
var ABTestingPlaceholder = z12.looseObject({
|
|
1407
|
+
type: z12.literal("placeholder")
|
|
1358
1408
|
});
|
|
1359
1409
|
|
|
1360
1410
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
@@ -1614,26 +1664,26 @@ var targetAreas = {
|
|
|
1614
1664
|
};
|
|
1615
1665
|
|
|
1616
1666
|
// src/schema/widgets/checkoutExtension.ts
|
|
1617
|
-
import { z as
|
|
1618
|
-
var CheckoutExtension =
|
|
1619
|
-
type:
|
|
1667
|
+
import { z as z13 } from "zod";
|
|
1668
|
+
var CheckoutExtension = z13.looseObject({
|
|
1669
|
+
type: z13.literal(WidgetType.shopify_checkout_extension).default(WidgetType.shopify_checkout_extension)
|
|
1620
1670
|
});
|
|
1621
1671
|
|
|
1622
1672
|
// src/schema/widgets/contentBlock.ts
|
|
1623
|
-
import { z as
|
|
1673
|
+
import { z as z35 } from "zod";
|
|
1624
1674
|
|
|
1625
1675
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1626
|
-
import { z as
|
|
1676
|
+
import { z as z34 } from "zod";
|
|
1627
1677
|
|
|
1628
1678
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
1629
1679
|
import { v7 as uuidv712 } from "uuid";
|
|
1630
|
-
import { z as
|
|
1680
|
+
import { z as z33 } from "zod";
|
|
1631
1681
|
|
|
1632
1682
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
1633
|
-
import { z as
|
|
1683
|
+
import { z as z32 } from "zod";
|
|
1634
1684
|
|
|
1635
1685
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
1636
|
-
import { z as
|
|
1686
|
+
import { z as z14 } from "zod";
|
|
1637
1687
|
|
|
1638
1688
|
// src/schema/widgets/checkout-and-beyond/utils.ts
|
|
1639
1689
|
import { isPlainObject as isPlainObject2 } from "es-toolkit";
|
|
@@ -1711,11 +1761,11 @@ var isTextType = isSectionType(SectionType.text);
|
|
|
1711
1761
|
var isVariantsType = isSectionType(SectionType.variants);
|
|
1712
1762
|
|
|
1713
1763
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
1714
|
-
var CABBannerSection =
|
|
1764
|
+
var CABBannerSection = z14.lazy(
|
|
1715
1765
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
1716
|
-
buttonField:
|
|
1717
|
-
color:
|
|
1718
|
-
dismissible:
|
|
1766
|
+
buttonField: z14.enum(buttonFields).optional(),
|
|
1767
|
+
color: z14.enum(bannerColors).default("info"),
|
|
1768
|
+
dismissible: z14.boolean().default(true),
|
|
1719
1769
|
/**
|
|
1720
1770
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
1721
1771
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -1731,18 +1781,18 @@ var CABBannerSection = z10.lazy(
|
|
|
1731
1781
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
1732
1782
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
1733
1783
|
*/
|
|
1734
|
-
heading:
|
|
1735
|
-
sectionType:
|
|
1784
|
+
heading: z14.record(z14.string(), z14.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
1785
|
+
sectionType: z14.literal(SectionType.banner).default(SectionType.banner)
|
|
1736
1786
|
})
|
|
1737
1787
|
);
|
|
1738
1788
|
|
|
1739
1789
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
1740
1790
|
import { v7 as uuidv73 } from "uuid";
|
|
1741
|
-
import { z as
|
|
1791
|
+
import { z as z19 } from "zod";
|
|
1742
1792
|
|
|
1743
1793
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
1744
1794
|
import { v7 as uuidv7 } from "uuid";
|
|
1745
|
-
import { z as
|
|
1795
|
+
import { z as z17 } from "zod";
|
|
1746
1796
|
|
|
1747
1797
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
1748
1798
|
var iconNames = [
|
|
@@ -1829,10 +1879,10 @@ var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "wa
|
|
|
1829
1879
|
var IconTone = freezeEnum(iconTones);
|
|
1830
1880
|
|
|
1831
1881
|
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
1832
|
-
import { z as
|
|
1882
|
+
import { z as z16 } from "zod";
|
|
1833
1883
|
|
|
1834
1884
|
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
1835
|
-
import { z as
|
|
1885
|
+
import { z as z15 } from "zod";
|
|
1836
1886
|
var ruleTypes = [
|
|
1837
1887
|
"cart",
|
|
1838
1888
|
"cart_count",
|
|
@@ -1851,7 +1901,7 @@ var ruleTypes = [
|
|
|
1851
1901
|
"product_type",
|
|
1852
1902
|
"product_vendor"
|
|
1853
1903
|
];
|
|
1854
|
-
var ruleType =
|
|
1904
|
+
var ruleType = z15.enum(ruleTypes);
|
|
1855
1905
|
var RuleType = ruleType.enum;
|
|
1856
1906
|
var ruleOperators = [
|
|
1857
1907
|
"after",
|
|
@@ -1866,124 +1916,124 @@ var ruleOperators = [
|
|
|
1866
1916
|
"greater_than",
|
|
1867
1917
|
"less_than"
|
|
1868
1918
|
];
|
|
1869
|
-
var ruleOperator =
|
|
1919
|
+
var ruleOperator = z15.enum(ruleOperators);
|
|
1870
1920
|
var RuleOperator = ruleOperator.enum;
|
|
1871
|
-
var RuleCondition =
|
|
1872
|
-
operator:
|
|
1873
|
-
products:
|
|
1874
|
-
type:
|
|
1875
|
-
value:
|
|
1921
|
+
var RuleCondition = z15.object({
|
|
1922
|
+
operator: z15.enum(ruleOperators).default(RuleOperator.anything),
|
|
1923
|
+
products: z15.union([z15.array(z15.unknown()), z15.strictObject({}).transform(() => [])]).default(() => []),
|
|
1924
|
+
type: z15.enum(ruleTypes).default(RuleType.cart_subtotal),
|
|
1925
|
+
value: z15.coerce.string().default("")
|
|
1876
1926
|
});
|
|
1877
|
-
var RuleLogicBlock =
|
|
1878
|
-
rules:
|
|
1927
|
+
var RuleLogicBlock = z15.object({
|
|
1928
|
+
rules: z15.array(RuleCondition).default(() => [])
|
|
1879
1929
|
});
|
|
1880
|
-
var CABRulesetEntry =
|
|
1881
|
-
exitIfMatched:
|
|
1882
|
-
logic:
|
|
1883
|
-
output:
|
|
1884
|
-
|
|
1885
|
-
key:
|
|
1886
|
-
type:
|
|
1887
|
-
value:
|
|
1930
|
+
var CABRulesetEntry = z15.object({
|
|
1931
|
+
exitIfMatched: z15.boolean().default(true),
|
|
1932
|
+
logic: z15.array(RuleLogicBlock).default(() => []),
|
|
1933
|
+
output: z15.array(
|
|
1934
|
+
z15.object({
|
|
1935
|
+
key: z15.string().default("should_show"),
|
|
1936
|
+
type: z15.literal("data_json").default("data_json"),
|
|
1937
|
+
value: z15.string().default("true")
|
|
1888
1938
|
})
|
|
1889
1939
|
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
1890
1940
|
});
|
|
1891
|
-
var CABRuleset =
|
|
1941
|
+
var CABRuleset = z15.union([z15.array(CABRulesetEntry), z15.strictObject({}).transform(() => [])]).default(() => []);
|
|
1892
1942
|
|
|
1893
1943
|
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
1894
|
-
var variableEffect =
|
|
1895
|
-
var CABVariableSeed =
|
|
1896
|
-
dataSourceId:
|
|
1944
|
+
var variableEffect = z16.enum(variableEffects);
|
|
1945
|
+
var CABVariableSeed = z16.object({
|
|
1946
|
+
dataSourceId: z16.number().nullable().default(null),
|
|
1897
1947
|
ruleset: CABRuleset
|
|
1898
1948
|
});
|
|
1899
|
-
var CABBooleanVariable =
|
|
1949
|
+
var CABBooleanVariable = z16.object({
|
|
1900
1950
|
/**
|
|
1901
1951
|
* Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
|
|
1902
1952
|
* from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
|
|
1903
1953
|
* below; a cross-field default has no `.default()` spelling. An explicit value always wins.
|
|
1904
1954
|
*/
|
|
1905
|
-
defaultValue:
|
|
1906
|
-
name:
|
|
1955
|
+
defaultValue: z16.boolean().optional(),
|
|
1956
|
+
name: z16.string().min(1),
|
|
1907
1957
|
seed: CABVariableSeed.optional(),
|
|
1908
1958
|
/** Defaulted so every stored declaration (all boolean before `text` existed) parses unchanged. */
|
|
1909
|
-
type:
|
|
1959
|
+
type: z16.literal(VariableType.boolean).default(VariableType.boolean)
|
|
1910
1960
|
});
|
|
1911
|
-
var CABTextVariable =
|
|
1912
|
-
defaultValue:
|
|
1913
|
-
name:
|
|
1914
|
-
seed:
|
|
1915
|
-
type:
|
|
1961
|
+
var CABTextVariable = z16.object({
|
|
1962
|
+
defaultValue: z16.string(),
|
|
1963
|
+
name: z16.string().min(1),
|
|
1964
|
+
seed: z16.never().optional(),
|
|
1965
|
+
type: z16.literal(VariableType.text)
|
|
1916
1966
|
});
|
|
1917
|
-
var CABNumberVariable =
|
|
1918
|
-
defaultValue:
|
|
1919
|
-
name:
|
|
1920
|
-
seed:
|
|
1921
|
-
type:
|
|
1967
|
+
var CABNumberVariable = z16.object({
|
|
1968
|
+
defaultValue: z16.number(),
|
|
1969
|
+
name: z16.string().min(1),
|
|
1970
|
+
seed: z16.never().optional(),
|
|
1971
|
+
type: z16.literal(VariableType.number)
|
|
1922
1972
|
});
|
|
1923
|
-
var CABVariable =
|
|
1973
|
+
var CABVariable = z16.union([CABTextVariable, CABNumberVariable, CABBooleanVariable]).transform(
|
|
1924
1974
|
(variable) => variable.type === VariableType.boolean ? { ...variable, defaultValue: variable.defaultValue ?? variable.seed === void 0 } : variable
|
|
1925
1975
|
);
|
|
1926
|
-
var CABVariableEffect =
|
|
1976
|
+
var CABVariableEffect = z16.object({
|
|
1927
1977
|
effect: variableEffect.default(VariableEffect.toggle),
|
|
1928
|
-
variable:
|
|
1978
|
+
variable: z16.string().min(1)
|
|
1929
1979
|
});
|
|
1930
|
-
var CABVisibility =
|
|
1931
|
-
variable:
|
|
1932
|
-
visibleWhen:
|
|
1980
|
+
var CABVisibility = z16.object({
|
|
1981
|
+
variable: z16.string().min(1),
|
|
1982
|
+
visibleWhen: z16.boolean().default(true)
|
|
1933
1983
|
});
|
|
1934
|
-
var contentOperator =
|
|
1935
|
-
var resultCountOperator =
|
|
1936
|
-
var resultTagOperator =
|
|
1937
|
-
var mutatorEvent =
|
|
1938
|
-
var CABContentTrigger =
|
|
1984
|
+
var contentOperator = z16.enum(contentOperators);
|
|
1985
|
+
var resultCountOperator = z16.enum(resultCountOperators);
|
|
1986
|
+
var resultTagOperator = z16.enum(resultTagOperators);
|
|
1987
|
+
var mutatorEvent = z16.enum(mutatorEvents);
|
|
1988
|
+
var CABContentTrigger = z16.object({
|
|
1939
1989
|
operator: contentOperator.default(ContentOperator.is_empty),
|
|
1940
|
-
type:
|
|
1990
|
+
type: z16.literal("content")
|
|
1941
1991
|
});
|
|
1942
|
-
var CABResultCountTrigger =
|
|
1992
|
+
var CABResultCountTrigger = z16.object({
|
|
1943
1993
|
operator: resultCountOperator.default(ResultCountOperator.equals),
|
|
1944
|
-
type:
|
|
1945
|
-
value:
|
|
1994
|
+
type: z16.literal("result_count"),
|
|
1995
|
+
value: z16.number().default(0)
|
|
1946
1996
|
});
|
|
1947
|
-
var CABResultTagTrigger =
|
|
1997
|
+
var CABResultTagTrigger = z16.object({
|
|
1948
1998
|
operator: resultTagOperator.default(ResultTagOperator.contains),
|
|
1949
|
-
type:
|
|
1950
|
-
value:
|
|
1999
|
+
type: z16.literal("result_tag"),
|
|
2000
|
+
value: z16.string().min(1)
|
|
1951
2001
|
});
|
|
1952
|
-
var CABEventTrigger =
|
|
2002
|
+
var CABEventTrigger = z16.object({
|
|
1953
2003
|
event: mutatorEvent,
|
|
1954
|
-
type:
|
|
2004
|
+
type: z16.literal("event")
|
|
1955
2005
|
});
|
|
1956
|
-
var CABVariableTrigger =
|
|
2006
|
+
var CABVariableTrigger = z16.discriminatedUnion("type", [
|
|
1957
2007
|
CABContentTrigger,
|
|
1958
2008
|
CABEventTrigger,
|
|
1959
2009
|
CABResultCountTrigger,
|
|
1960
2010
|
CABResultTagTrigger
|
|
1961
2011
|
]);
|
|
1962
|
-
var CABVariableMutator =
|
|
2012
|
+
var CABVariableMutator = z16.object({
|
|
1963
2013
|
effect: variableEffect.default(VariableEffect.set_false),
|
|
1964
|
-
variable:
|
|
2014
|
+
variable: z16.string().min(1),
|
|
1965
2015
|
when: CABVariableTrigger
|
|
1966
2016
|
});
|
|
1967
2017
|
var CABVariableFields = {
|
|
1968
|
-
mutators:
|
|
1969
|
-
variables:
|
|
2018
|
+
mutators: z16.array(CABVariableMutator).optional(),
|
|
2019
|
+
variables: z16.array(CABVariable).refine((variables) => new Set(variables.map(({ name }) => name)).size === variables.length, {
|
|
1970
2020
|
message: "variable names must be unique within a section"
|
|
1971
2021
|
}).optional(),
|
|
1972
2022
|
visibility: CABVisibility.optional()
|
|
1973
2023
|
};
|
|
1974
2024
|
|
|
1975
2025
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
1976
|
-
var CABImageSectionFields =
|
|
2026
|
+
var CABImageSectionFields = z17.object({
|
|
1977
2027
|
...CABVariableFields,
|
|
1978
|
-
altText:
|
|
2028
|
+
altText: z17.string().refine(checkForHTML, NO_HTML).default(""),
|
|
1979
2029
|
/**
|
|
1980
2030
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
1981
2031
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
1982
2032
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
1983
2033
|
*/
|
|
1984
|
-
aspectRatio:
|
|
1985
|
-
border:
|
|
1986
|
-
buttonField:
|
|
2034
|
+
aspectRatio: z17.number().positive().nullable().default(null),
|
|
2035
|
+
border: z17.lazy(() => CABBorder),
|
|
2036
|
+
buttonField: z17.enum(buttonFields).optional(),
|
|
1987
2037
|
/**
|
|
1988
2038
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
1989
2039
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -2002,29 +2052,29 @@ var CABImageSectionFields = z13.object({
|
|
|
2002
2052
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
2003
2053
|
* the risky half.
|
|
2004
2054
|
*/
|
|
2005
|
-
category:
|
|
2055
|
+
category: z17.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
2006
2056
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
2007
|
-
iconSize:
|
|
2057
|
+
iconSize: z17.enum(iconSizes).nullable().default(null),
|
|
2008
2058
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
2009
|
-
iconTone:
|
|
2010
|
-
name:
|
|
2011
|
-
naturalHeight:
|
|
2012
|
-
naturalWidth:
|
|
2059
|
+
iconTone: z17.enum(iconTones).nullable().default(null),
|
|
2060
|
+
name: z17.string().optional(),
|
|
2061
|
+
naturalHeight: z17.number().default(0),
|
|
2062
|
+
naturalWidth: z17.number().default(0),
|
|
2013
2063
|
/**
|
|
2014
2064
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
2015
2065
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
2016
2066
|
*/
|
|
2017
|
-
objectFit:
|
|
2018
|
-
sectionId:
|
|
2019
|
-
sectionType:
|
|
2067
|
+
objectFit: z17.enum(objectFits).default(ObjectFit.contain),
|
|
2068
|
+
sectionId: z17.uuid().default(() => uuidv7()),
|
|
2069
|
+
sectionType: z17.literal(SectionType.image).default(SectionType.image),
|
|
2020
2070
|
/**
|
|
2021
2071
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
2022
2072
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
2023
2073
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
2024
2074
|
* server-chosen tier icon actually needs it.
|
|
2025
2075
|
*/
|
|
2026
|
-
source:
|
|
2027
|
-
width:
|
|
2076
|
+
source: z17.union([z17.url(), z17.literal(""), z17.string().regex(DYNAMIC_TOKEN_REGEX), z17.enum(iconNames)]).default(""),
|
|
2077
|
+
width: z17.number().default(100)
|
|
2028
2078
|
});
|
|
2029
2079
|
var iconNameSet = new Set(iconNames);
|
|
2030
2080
|
var isIconName = (source) => iconNameSet.has(source);
|
|
@@ -2046,71 +2096,71 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, c
|
|
|
2046
2096
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
2047
2097
|
import { forEach, isString as isString2 } from "es-toolkit/compat";
|
|
2048
2098
|
import { v7 as uuidv72 } from "uuid";
|
|
2049
|
-
import { z as
|
|
2050
|
-
var enumOrOmit = (...vals) =>
|
|
2051
|
-
var TiptapText =
|
|
2052
|
-
marks:
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
attrs:
|
|
2059
|
-
class:
|
|
2060
|
-
href:
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2099
|
+
import { z as z18 } from "zod";
|
|
2100
|
+
var enumOrOmit = (...vals) => z18.string().transform((val) => vals.includes(val) ? val : void 0).optional();
|
|
2101
|
+
var TiptapText = z18.object({
|
|
2102
|
+
marks: z18.union([
|
|
2103
|
+
z18.array(
|
|
2104
|
+
z18.discriminatedUnion("type", [
|
|
2105
|
+
z18.object({ type: z18.literal("bold") }),
|
|
2106
|
+
z18.object({ type: z18.literal("italic") }),
|
|
2107
|
+
z18.object({
|
|
2108
|
+
attrs: z18.object({
|
|
2109
|
+
class: z18.string().nullable(),
|
|
2110
|
+
href: z18.union([
|
|
2111
|
+
z18.url(),
|
|
2112
|
+
z18.literal("#"),
|
|
2113
|
+
z18.string().regex(DYNAMIC_TOKEN_REGEX),
|
|
2114
|
+
z18.string().regex(ROOT_RELATIVE_PATH_REGEX)
|
|
2065
2115
|
]),
|
|
2066
|
-
rel:
|
|
2067
|
-
target:
|
|
2116
|
+
rel: z18.string().default("noopener noreferrer nofollow"),
|
|
2117
|
+
target: z18.string().default("_blank")
|
|
2068
2118
|
}),
|
|
2069
|
-
type:
|
|
2119
|
+
type: z18.literal("link")
|
|
2070
2120
|
}),
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
attrs:
|
|
2121
|
+
z18.object({ type: z18.literal("strike") }),
|
|
2122
|
+
z18.object({
|
|
2123
|
+
attrs: z18.object({
|
|
2074
2124
|
color: enumOrOmit(...textColorNames).default(TextColorName.base),
|
|
2075
2125
|
fontSize: enumOrOmit(...textSizeNames).default(TextSizeName.base)
|
|
2076
2126
|
}),
|
|
2077
|
-
type:
|
|
2127
|
+
type: z18.literal("textStyle")
|
|
2078
2128
|
})
|
|
2079
2129
|
])
|
|
2080
2130
|
),
|
|
2081
|
-
|
|
2131
|
+
z18.strictObject({}).transform(() => [])
|
|
2082
2132
|
]).optional(),
|
|
2083
|
-
text:
|
|
2084
|
-
type:
|
|
2133
|
+
text: z18.string().default(""),
|
|
2134
|
+
type: z18.literal("text").default("text")
|
|
2085
2135
|
});
|
|
2086
|
-
var TiptapParagraph =
|
|
2087
|
-
attrs:
|
|
2136
|
+
var TiptapParagraph = z18.object({
|
|
2137
|
+
attrs: z18.object({
|
|
2088
2138
|
textAlign: enumOrOmit(...textAlignments)
|
|
2089
2139
|
}).default({ textAlign: TextAlignment.start }),
|
|
2090
|
-
content:
|
|
2091
|
-
type:
|
|
2140
|
+
content: z18.union([z18.array(TiptapText), z18.strictObject({}).transform(() => [])]).default(() => []),
|
|
2141
|
+
type: z18.literal("paragraph").default("paragraph")
|
|
2092
2142
|
});
|
|
2093
|
-
var TiptapDocument =
|
|
2094
|
-
attrs:
|
|
2143
|
+
var TiptapDocument = z18.object({
|
|
2144
|
+
attrs: z18.object({
|
|
2095
2145
|
blockSpacing: enumOrOmit(...spacings)
|
|
2096
2146
|
}).default({ blockSpacing: Spacing.base }),
|
|
2097
|
-
content:
|
|
2098
|
-
type:
|
|
2147
|
+
content: z18.union([z18.array(TiptapParagraph), z18.strictObject({}).transform(() => [])]).default(() => [TiptapParagraph.parse({})]),
|
|
2148
|
+
type: z18.literal("doc").default("doc")
|
|
2099
2149
|
});
|
|
2100
|
-
var CABTextTier =
|
|
2101
|
-
threshold:
|
|
2102
|
-
thresholds:
|
|
2103
|
-
tierId:
|
|
2104
|
-
tierType:
|
|
2150
|
+
var CABTextTier = z18.object({
|
|
2151
|
+
threshold: z18.number().int().nonnegative(),
|
|
2152
|
+
thresholds: z18.record(z18.string(), z18.number().int().nonnegative()).default(() => ({})),
|
|
2153
|
+
tierId: z18.string().optional(),
|
|
2154
|
+
tierType: z18.enum(progressTierTypes).default(ProgressTierType.shipping)
|
|
2105
2155
|
});
|
|
2106
|
-
var CABTextSection =
|
|
2156
|
+
var CABTextSection = z18.object({
|
|
2107
2157
|
...CABVariableFields,
|
|
2108
|
-
buttonField:
|
|
2109
|
-
content:
|
|
2110
|
-
name:
|
|
2111
|
-
optionId:
|
|
2112
|
-
sectionId:
|
|
2113
|
-
sectionType:
|
|
2158
|
+
buttonField: z18.enum(buttonFields).optional(),
|
|
2159
|
+
content: z18.record(z18.string(), z18.union([z18.string(), TiptapDocument]).refine(checkForHTML, NO_HTML).optional()).default({ en: TiptapDocument.parse({}) }).optional(),
|
|
2160
|
+
name: z18.string().optional(),
|
|
2161
|
+
optionId: z18.number().optional(),
|
|
2162
|
+
sectionId: z18.uuid().default(() => uuidv72()),
|
|
2163
|
+
sectionType: z18.literal(SectionType.text).default(SectionType.text),
|
|
2114
2164
|
tier: CABTextTier.optional()
|
|
2115
2165
|
}).superRefine(({ buttonField, content }, ctx) => {
|
|
2116
2166
|
if (buttonField === ButtonField.destinationUrl && content) {
|
|
@@ -2132,35 +2182,35 @@ var CABTextSection = z14.object({
|
|
|
2132
2182
|
});
|
|
2133
2183
|
|
|
2134
2184
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
2135
|
-
var CABButtonContent =
|
|
2136
|
-
() =>
|
|
2185
|
+
var CABButtonContent = z19.lazy(
|
|
2186
|
+
() => z19.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
2137
2187
|
);
|
|
2138
|
-
var CABButtonSection =
|
|
2188
|
+
var CABButtonSection = z19.object({
|
|
2139
2189
|
...CABVariableFields,
|
|
2140
|
-
action:
|
|
2141
|
-
buttonStyle:
|
|
2142
|
-
custom:
|
|
2143
|
-
color:
|
|
2144
|
-
height:
|
|
2145
|
-
width:
|
|
2190
|
+
action: z19.union([z19.literal(""), z19.enum(buttonActions)]).default(""),
|
|
2191
|
+
buttonStyle: z19.enum(buttonStyles).default(ButtonStyle.primary),
|
|
2192
|
+
custom: z19.object({
|
|
2193
|
+
color: z19.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
2194
|
+
height: z19.number().default(52),
|
|
2195
|
+
width: z19.number().default(300)
|
|
2146
2196
|
}).default({
|
|
2147
2197
|
color: "#005bd3",
|
|
2148
2198
|
height: 52,
|
|
2149
2199
|
width: 300
|
|
2150
2200
|
}),
|
|
2151
|
-
disableDowngrade:
|
|
2152
|
-
name:
|
|
2153
|
-
optionId:
|
|
2154
|
-
popover:
|
|
2155
|
-
alignment:
|
|
2156
|
-
position:
|
|
2201
|
+
disableDowngrade: z19.boolean().default(false),
|
|
2202
|
+
name: z19.string().optional(),
|
|
2203
|
+
optionId: z19.number().optional(),
|
|
2204
|
+
popover: z19.object({
|
|
2205
|
+
alignment: z19.enum(textAlignments).default(TextAlignment.center),
|
|
2206
|
+
position: z19.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
2157
2207
|
}).optional().default(() => ({
|
|
2158
2208
|
alignment: TextAlignment.center,
|
|
2159
2209
|
position: PopoverPosition.blockStart
|
|
2160
2210
|
})),
|
|
2161
|
-
sectionId:
|
|
2162
|
-
sections:
|
|
2163
|
-
sectionType:
|
|
2211
|
+
sectionId: z19.uuid().default(() => uuidv73()),
|
|
2212
|
+
sections: z19.union([z19.array(CABButtonContent), z19.strictObject({}).transform(() => [])]).default(() => []),
|
|
2213
|
+
sectionType: z19.literal(SectionType.button).default(SectionType.button),
|
|
2164
2214
|
/**
|
|
2165
2215
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
2166
2216
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -2175,91 +2225,91 @@ var CABButtonSection = z15.object({
|
|
|
2175
2225
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
2176
2226
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
2177
2227
|
*/
|
|
2178
|
-
tier:
|
|
2228
|
+
tier: z19.object({ tierId: z19.string().min(1) }).optional(),
|
|
2179
2229
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
2180
|
-
trackingUrl:
|
|
2230
|
+
trackingUrl: z19.string().optional(),
|
|
2181
2231
|
/**
|
|
2182
2232
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
2183
2233
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
2184
2234
|
*/
|
|
2185
|
-
variableEffects:
|
|
2235
|
+
variableEffects: z19.array(CABVariableEffect).optional()
|
|
2186
2236
|
});
|
|
2187
2237
|
|
|
2188
2238
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
2189
|
-
import { z as
|
|
2239
|
+
import { z as z24 } from "zod";
|
|
2190
2240
|
|
|
2191
2241
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
2192
|
-
import { z as
|
|
2242
|
+
import { z as z23 } from "zod";
|
|
2193
2243
|
|
|
2194
2244
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
2195
2245
|
import { v7 as uuidv74 } from "uuid";
|
|
2196
|
-
import { z as
|
|
2197
|
-
var CABDiscount =
|
|
2198
|
-
amount:
|
|
2199
|
-
discountedBy:
|
|
2200
|
-
discountedFrom:
|
|
2201
|
-
type:
|
|
2246
|
+
import { z as z20 } from "zod";
|
|
2247
|
+
var CABDiscount = z20.object({
|
|
2248
|
+
amount: z20.union([z20.number(), z20.string()]).catch(0),
|
|
2249
|
+
discountedBy: z20.string().optional(),
|
|
2250
|
+
discountedFrom: z20.enum(discountSources).optional().catch(void 0),
|
|
2251
|
+
type: z20.enum(discountTypes).catch("none")
|
|
2202
2252
|
});
|
|
2203
|
-
var CABIntegrations =
|
|
2204
|
-
judgeme:
|
|
2205
|
-
junip:
|
|
2206
|
-
klaviyo:
|
|
2207
|
-
loox:
|
|
2208
|
-
okendo:
|
|
2209
|
-
opinew:
|
|
2210
|
-
reviewsio:
|
|
2211
|
-
stamped:
|
|
2212
|
-
yotpo:
|
|
2253
|
+
var CABIntegrations = z20.object({
|
|
2254
|
+
judgeme: z20.boolean().default(false),
|
|
2255
|
+
junip: z20.boolean().default(false),
|
|
2256
|
+
klaviyo: z20.boolean().default(false),
|
|
2257
|
+
loox: z20.boolean().default(false),
|
|
2258
|
+
okendo: z20.boolean().default(false),
|
|
2259
|
+
opinew: z20.boolean().default(false),
|
|
2260
|
+
reviewsio: z20.boolean().default(false),
|
|
2261
|
+
stamped: z20.boolean().default(false),
|
|
2262
|
+
yotpo: z20.boolean().default(false)
|
|
2213
2263
|
});
|
|
2214
|
-
var CABDataSourceSection =
|
|
2215
|
-
dataSourceId:
|
|
2216
|
-
dataSourcePath:
|
|
2264
|
+
var CABDataSourceSection = z20.object({
|
|
2265
|
+
dataSourceId: z20.number().nullable().default(null),
|
|
2266
|
+
dataSourcePath: z20.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
2217
2267
|
discount: CABDiscount.optional(),
|
|
2218
2268
|
integrations: CABIntegrations.optional(),
|
|
2219
|
-
limit:
|
|
2220
|
-
matchVariant:
|
|
2221
|
-
matchVariantOutOfStock:
|
|
2222
|
-
name:
|
|
2223
|
-
productType:
|
|
2224
|
-
sectionId:
|
|
2225
|
-
sectionType:
|
|
2269
|
+
limit: z20.number().default(1),
|
|
2270
|
+
matchVariant: z20.boolean().default(false),
|
|
2271
|
+
matchVariantOutOfStock: z20.boolean().default(false),
|
|
2272
|
+
name: z20.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
2273
|
+
productType: z20.enum(productTypes).optional(),
|
|
2274
|
+
sectionId: z20.uuid().default(() => uuidv74()),
|
|
2275
|
+
sectionType: z20.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
2226
2276
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
2227
|
-
subscriptionIsDefault:
|
|
2228
|
-
treatAsGwp:
|
|
2277
|
+
subscriptionIsDefault: z20.boolean().default(false),
|
|
2278
|
+
treatAsGwp: z20.boolean().default(false)
|
|
2229
2279
|
});
|
|
2230
2280
|
|
|
2231
2281
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
2232
2282
|
import { v7 as uuidv76 } from "uuid";
|
|
2233
|
-
import { z as
|
|
2283
|
+
import { z as z22 } from "zod";
|
|
2234
2284
|
|
|
2235
2285
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
2236
2286
|
import { v7 as uuidv75 } from "uuid";
|
|
2237
|
-
import { z as
|
|
2238
|
-
var CABVariantContent =
|
|
2239
|
-
() =>
|
|
2287
|
+
import { z as z21 } from "zod";
|
|
2288
|
+
var CABVariantContent = z21.lazy(
|
|
2289
|
+
() => z21.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
2240
2290
|
);
|
|
2241
|
-
var CABProductSection =
|
|
2291
|
+
var CABProductSection = z21.object({
|
|
2242
2292
|
...CABVariableFields,
|
|
2243
|
-
name:
|
|
2244
|
-
productId:
|
|
2245
|
-
sectionId:
|
|
2246
|
-
sections:
|
|
2247
|
-
sectionType:
|
|
2248
|
-
selectors:
|
|
2249
|
-
variantMode:
|
|
2293
|
+
name: z21.string().optional(),
|
|
2294
|
+
productId: z21.number().nullable().default(null),
|
|
2295
|
+
sectionId: z21.uuid().default(() => uuidv75()),
|
|
2296
|
+
sections: z21.union([z21.array(CABVariantContent), z21.strictObject({}).transform(() => [])]).default(() => []),
|
|
2297
|
+
sectionType: z21.literal(SectionType.product).default(SectionType.product),
|
|
2298
|
+
selectors: z21.record(z21.string(), z21.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
2299
|
+
variantMode: z21.enum(variantModes).default(VariantMode.multiple)
|
|
2250
2300
|
});
|
|
2251
2301
|
|
|
2252
2302
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
2253
|
-
var CABProductsSection =
|
|
2303
|
+
var CABProductsSection = z22.object({
|
|
2254
2304
|
...CABVariableFields,
|
|
2255
|
-
name:
|
|
2256
|
-
sectionId:
|
|
2257
|
-
sections:
|
|
2258
|
-
sectionType:
|
|
2305
|
+
name: z22.string().optional(),
|
|
2306
|
+
sectionId: z22.uuid().default(() => uuidv76()),
|
|
2307
|
+
sections: z22.union([z22.array(z22.lazy(() => CABProductSection)), z22.strictObject({}).transform(() => [])]).default(() => []),
|
|
2308
|
+
sectionType: z22.literal(SectionType.products).default(SectionType.products)
|
|
2259
2309
|
});
|
|
2260
2310
|
|
|
2261
2311
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
2262
|
-
var CABOffersSection =
|
|
2312
|
+
var CABOffersSection = z23.lazy(
|
|
2263
2313
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
2264
2314
|
/**
|
|
2265
2315
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -2267,8 +2317,8 @@ var CABOffersSection = z19.lazy(
|
|
|
2267
2317
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
2268
2318
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
2269
2319
|
*/
|
|
2270
|
-
divider:
|
|
2271
|
-
sections:
|
|
2320
|
+
divider: z23.boolean().optional(),
|
|
2321
|
+
sections: z23.union([z23.array(z23.lazy(() => CABSection)), z23.strictObject({}).transform(() => [])]).default(() => [
|
|
2272
2322
|
CABBannerSection.parse({
|
|
2273
2323
|
buttonField: "undoAddToOrder",
|
|
2274
2324
|
color: "success",
|
|
@@ -2282,71 +2332,77 @@ var CABOffersSection = z19.lazy(
|
|
|
2282
2332
|
CABDataSourceSection.parse({}),
|
|
2283
2333
|
CABProductsSection.parse({})
|
|
2284
2334
|
]),
|
|
2285
|
-
sectionType:
|
|
2335
|
+
sectionType: z23.literal(SectionType.offers).default(SectionType.offers)
|
|
2286
2336
|
})
|
|
2287
2337
|
);
|
|
2288
2338
|
|
|
2289
2339
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
2290
|
-
var CABCarouselSection =
|
|
2340
|
+
var CABCarouselSection = z24.lazy(
|
|
2291
2341
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
2292
|
-
autoAdvanceInterval:
|
|
2293
|
-
itemsAtOnce:
|
|
2342
|
+
autoAdvanceInterval: z24.number().default(0),
|
|
2343
|
+
itemsAtOnce: z24.number().min(1).default(1),
|
|
2294
2344
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
2295
|
-
offersDirection:
|
|
2296
|
-
sections:
|
|
2297
|
-
sectionType:
|
|
2345
|
+
offersDirection: z24.enum(offersDirections).default("vertical"),
|
|
2346
|
+
sections: z24.union([z24.array(z24.lazy(() => CABSection)), z24.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
2347
|
+
sectionType: z24.literal(SectionType.carousel).default(SectionType.carousel)
|
|
2298
2348
|
})
|
|
2299
2349
|
);
|
|
2300
2350
|
|
|
2301
2351
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
2302
|
-
import { z as
|
|
2303
|
-
var CABCartLineSection =
|
|
2352
|
+
import { z as z25 } from "zod";
|
|
2353
|
+
var CABCartLineSection = z25.lazy(
|
|
2304
2354
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
2305
|
-
sections:
|
|
2306
|
-
sectionType:
|
|
2355
|
+
sections: z25.union([z25.array(z25.lazy(() => CABSection)), z25.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
2356
|
+
sectionType: z25.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
2307
2357
|
})
|
|
2308
2358
|
);
|
|
2309
2359
|
|
|
2310
2360
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
2311
2361
|
import { v7 as uuidv77 } from "uuid";
|
|
2312
|
-
import { z as
|
|
2313
|
-
var CABDiscountSection =
|
|
2362
|
+
import { z as z26 } from "zod";
|
|
2363
|
+
var CABDiscountSection = z26.object({
|
|
2314
2364
|
...CABVariableFields,
|
|
2315
|
-
amount:
|
|
2316
|
-
discountedBy:
|
|
2317
|
-
discountedFrom:
|
|
2318
|
-
message:
|
|
2319
|
-
name:
|
|
2320
|
-
quantity:
|
|
2321
|
-
sectionId:
|
|
2322
|
-
sectionType:
|
|
2323
|
-
type:
|
|
2365
|
+
amount: z26.union([z26.number(), z26.string()]).catch(0),
|
|
2366
|
+
discountedBy: z26.string().optional(),
|
|
2367
|
+
discountedFrom: z26.enum(discountSources).optional().catch(void 0),
|
|
2368
|
+
message: z26.string().optional(),
|
|
2369
|
+
name: z26.string().optional(),
|
|
2370
|
+
quantity: z26.number().default(1),
|
|
2371
|
+
sectionId: z26.uuid().default(() => uuidv77()),
|
|
2372
|
+
sectionType: z26.literal(SectionType.discount).default(SectionType.discount),
|
|
2373
|
+
type: z26.enum(discountTypes).catch("none")
|
|
2324
2374
|
});
|
|
2325
2375
|
|
|
2326
2376
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
2327
2377
|
import { v7 as uuidv78 } from "uuid";
|
|
2328
|
-
import { z as
|
|
2329
|
-
var
|
|
2378
|
+
import { z as z27 } from "zod";
|
|
2379
|
+
var CABMonetizeAds = z27.object({
|
|
2380
|
+
requestId: z27.string().optional(),
|
|
2381
|
+
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
2382
|
+
testing: z27.boolean().default(false)
|
|
2383
|
+
});
|
|
2384
|
+
var CABMonetizeSection = z27.object({
|
|
2330
2385
|
...CABVariableFields,
|
|
2331
|
-
|
|
2386
|
+
ads: CABMonetizeAds.optional(),
|
|
2387
|
+
name: z27.string().optional(),
|
|
2332
2388
|
/**
|
|
2333
2389
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
2334
2390
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
2335
2391
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
2336
2392
|
*/
|
|
2337
|
-
offers:
|
|
2393
|
+
offers: z27.array(z27.lazy(() => CABSection)).optional(),
|
|
2338
2394
|
/** 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. */
|
|
2339
|
-
privacyPolicyUrl:
|
|
2340
|
-
sectionId:
|
|
2341
|
-
sectionType:
|
|
2395
|
+
privacyPolicyUrl: z27.string().optional(),
|
|
2396
|
+
sectionId: z27.uuid().default(() => uuidv78()),
|
|
2397
|
+
sectionType: z27.literal(SectionType.monetize).default(SectionType.monetize),
|
|
2342
2398
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
2343
|
-
subVertical:
|
|
2399
|
+
subVertical: z27.string().optional(),
|
|
2344
2400
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
2345
|
-
vertical:
|
|
2401
|
+
vertical: z27.string().optional()
|
|
2346
2402
|
});
|
|
2347
2403
|
|
|
2348
2404
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
2349
|
-
import { z as
|
|
2405
|
+
import { z as z28 } from "zod";
|
|
2350
2406
|
|
|
2351
2407
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
2352
2408
|
var GIFT_LABELS = {
|
|
@@ -2465,34 +2521,34 @@ var GIFT_LABELS = {
|
|
|
2465
2521
|
};
|
|
2466
2522
|
|
|
2467
2523
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
2468
|
-
var CABProgressTierExclusion =
|
|
2469
|
-
collectionIds:
|
|
2470
|
-
productIds:
|
|
2471
|
-
tags:
|
|
2472
|
-
type:
|
|
2524
|
+
var CABProgressTierExclusion = z28.object({
|
|
2525
|
+
collectionIds: z28.array(z28.number().int().positive()).default(() => []),
|
|
2526
|
+
productIds: z28.array(z28.number().int().positive()).default(() => []),
|
|
2527
|
+
tags: z28.array(z28.string().min(1)).default(() => []),
|
|
2528
|
+
type: z28.enum(progressTierExclusionTypes)
|
|
2473
2529
|
});
|
|
2474
|
-
var CABProgressTier =
|
|
2530
|
+
var CABProgressTier = z28.object({
|
|
2475
2531
|
/**
|
|
2476
2532
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
2477
2533
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
2478
2534
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
2479
2535
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
2480
2536
|
*/
|
|
2481
|
-
discount:
|
|
2537
|
+
discount: z28.object({ amount: z28.number().nonnegative(), type: z28.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
2482
2538
|
/**
|
|
2483
2539
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
2484
2540
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
2485
2541
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
2486
2542
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
2487
2543
|
*/
|
|
2488
|
-
exclusions:
|
|
2544
|
+
exclusions: z28.array(CABProgressTierExclusion).default(() => []),
|
|
2489
2545
|
/**
|
|
2490
2546
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
2491
2547
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
2492
2548
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
2493
2549
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
2494
2550
|
*/
|
|
2495
|
-
filterOosVariants:
|
|
2551
|
+
filterOosVariants: z28.boolean().default(false),
|
|
2496
2552
|
/**
|
|
2497
2553
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
2498
2554
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -2500,10 +2556,10 @@ var CABProgressTier = z24.object({
|
|
|
2500
2556
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
2501
2557
|
* tree is complete.
|
|
2502
2558
|
*/
|
|
2503
|
-
gift:
|
|
2504
|
-
productId:
|
|
2505
|
-
title:
|
|
2506
|
-
variantIds:
|
|
2559
|
+
gift: z28.object({
|
|
2560
|
+
productId: z28.number().int().positive(),
|
|
2561
|
+
title: z28.string().optional(),
|
|
2562
|
+
variantIds: z28.array(z28.number().int().positive()).default(() => [])
|
|
2507
2563
|
}).optional(),
|
|
2508
2564
|
/**
|
|
2509
2565
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -2523,7 +2579,7 @@ var CABProgressTier = z24.object({
|
|
|
2523
2579
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
2524
2580
|
* React's size rather than the old hardcoded 20.
|
|
2525
2581
|
*/
|
|
2526
|
-
iconSizePx:
|
|
2582
|
+
iconSizePx: z28.number().int().min(1).max(64).default(18),
|
|
2527
2583
|
/**
|
|
2528
2584
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
2529
2585
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -2533,35 +2589,35 @@ var CABProgressTier = z24.object({
|
|
|
2533
2589
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
2534
2590
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
2535
2591
|
*/
|
|
2536
|
-
label:
|
|
2592
|
+
label: z28.record(z28.string(), z28.string()).optional(),
|
|
2537
2593
|
/**
|
|
2538
2594
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
2539
2595
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
2540
2596
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
2541
2597
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
2542
2598
|
*/
|
|
2543
|
-
productTierImage:
|
|
2599
|
+
productTierImage: z28.boolean().default(false),
|
|
2544
2600
|
/**
|
|
2545
2601
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
2546
2602
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
2547
2603
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
2548
2604
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
2549
2605
|
*/
|
|
2550
|
-
threshold:
|
|
2606
|
+
threshold: z28.number().int().nonnegative(),
|
|
2551
2607
|
/**
|
|
2552
2608
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
2553
2609
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
2554
2610
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
2555
2611
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
2556
2612
|
*/
|
|
2557
|
-
thresholds:
|
|
2613
|
+
thresholds: z28.record(z28.string(), z28.number().int().nonnegative()).default(() => ({})),
|
|
2558
2614
|
/**
|
|
2559
2615
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
2560
2616
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
2561
2617
|
* shipping bar (single unlabeled tier, no gift).
|
|
2562
2618
|
*/
|
|
2563
|
-
tierId:
|
|
2564
|
-
tierType:
|
|
2619
|
+
tierId: z28.string().optional(),
|
|
2620
|
+
tierType: z28.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
2565
2621
|
/**
|
|
2566
2622
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
2567
2623
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -2572,9 +2628,9 @@ var CABProgressTier = z24.object({
|
|
|
2572
2628
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
2573
2629
|
* template text supplies grammatically-neutral wording around the token.
|
|
2574
2630
|
*/
|
|
2575
|
-
unit:
|
|
2631
|
+
unit: z28.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
2576
2632
|
});
|
|
2577
|
-
var CABProgressBarSection =
|
|
2633
|
+
var CABProgressBarSection = z28.lazy(
|
|
2578
2634
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
2579
2635
|
/**
|
|
2580
2636
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -2583,35 +2639,35 @@ var CABProgressBarSection = z24.lazy(
|
|
|
2583
2639
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
2584
2640
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
2585
2641
|
*/
|
|
2586
|
-
barId:
|
|
2642
|
+
barId: z28.string().optional(),
|
|
2587
2643
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
2588
|
-
countryCodes:
|
|
2644
|
+
countryCodes: z28.array(z28.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
2589
2645
|
/**
|
|
2590
2646
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
2591
2647
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
2592
2648
|
*/
|
|
2593
|
-
excludeCountryCodes:
|
|
2649
|
+
excludeCountryCodes: z28.array(z28.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
2594
2650
|
/**
|
|
2595
2651
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
2596
2652
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
2597
2653
|
* adds the cart's discount allocations back to the live subtotal.
|
|
2598
2654
|
*/
|
|
2599
|
-
excludeDiscountInSubtotal:
|
|
2655
|
+
excludeDiscountInSubtotal: z28.boolean().default(false),
|
|
2600
2656
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
2601
|
-
excludedVariantIds:
|
|
2657
|
+
excludedVariantIds: z28.array(z28.number().int().positive()).default(() => []),
|
|
2602
2658
|
/**
|
|
2603
2659
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
2604
2660
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
2605
2661
|
*/
|
|
2606
|
-
freeShippingOnSubscription:
|
|
2662
|
+
freeShippingOnSubscription: z28.boolean().default(false),
|
|
2607
2663
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
2608
|
-
giftAreaTitle:
|
|
2664
|
+
giftAreaTitle: z28.record(z28.string(), z28.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
2609
2665
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
2610
|
-
giftLabels:
|
|
2611
|
-
addGift:
|
|
2612
|
-
remove:
|
|
2613
|
-
selectOptions:
|
|
2614
|
-
yourGift:
|
|
2666
|
+
giftLabels: z28.object({
|
|
2667
|
+
addGift: z28.record(z28.string(), z28.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
2668
|
+
remove: z28.record(z28.string(), z28.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
2669
|
+
selectOptions: z28.record(z28.string(), z28.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
2670
|
+
yourGift: z28.record(z28.string(), z28.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
2615
2671
|
}).default(() => ({
|
|
2616
2672
|
addGift: { ...GIFT_LABELS.addGift },
|
|
2617
2673
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -2619,38 +2675,38 @@ var CABProgressBarSection = z24.lazy(
|
|
|
2619
2675
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
2620
2676
|
})),
|
|
2621
2677
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
2622
|
-
name:
|
|
2678
|
+
name: z28.string().default("Order progress"),
|
|
2623
2679
|
/**
|
|
2624
2680
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
2625
2681
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
2626
2682
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
2627
2683
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
2628
2684
|
*/
|
|
2629
|
-
progressColor:
|
|
2630
|
-
sectionType:
|
|
2685
|
+
progressColor: z28.string().optional(),
|
|
2686
|
+
sectionType: z28.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
2631
2687
|
/**
|
|
2632
2688
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
2633
2689
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
2634
2690
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
2635
2691
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
2636
2692
|
*/
|
|
2637
|
-
tiers:
|
|
2693
|
+
tiers: z28.union([z28.array(CABProgressTier), z28.strictObject({}).transform(() => [])]).default(() => [])
|
|
2638
2694
|
})
|
|
2639
2695
|
);
|
|
2640
2696
|
|
|
2641
2697
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
2642
2698
|
import { v7 as uuidv79 } from "uuid";
|
|
2643
|
-
import { z as
|
|
2644
|
-
var CABQuantitySection =
|
|
2699
|
+
import { z as z29 } from "zod";
|
|
2700
|
+
var CABQuantitySection = z29.object({
|
|
2645
2701
|
...CABVariableFields,
|
|
2646
|
-
errorMessages:
|
|
2647
|
-
|
|
2648
|
-
|
|
2702
|
+
errorMessages: z29.record(
|
|
2703
|
+
z29.string(),
|
|
2704
|
+
z29.object({
|
|
2649
2705
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
2650
|
-
increment:
|
|
2651
|
-
max:
|
|
2652
|
-
min:
|
|
2653
|
-
neg:
|
|
2706
|
+
increment: z29.string().optional(),
|
|
2707
|
+
max: z29.string().optional(),
|
|
2708
|
+
min: z29.string().optional(),
|
|
2709
|
+
neg: z29.string().optional()
|
|
2654
2710
|
})
|
|
2655
2711
|
).default({
|
|
2656
2712
|
en: {
|
|
@@ -2660,18 +2716,18 @@ var CABQuantitySection = z25.object({
|
|
|
2660
2716
|
neg: "Quantity cannot be negative"
|
|
2661
2717
|
}
|
|
2662
2718
|
}),
|
|
2663
|
-
inputType:
|
|
2664
|
-
max:
|
|
2665
|
-
min:
|
|
2719
|
+
inputType: z29.enum(quantityInputs).default(QuantityInput.select),
|
|
2720
|
+
max: z29.number().min(1).max(100).default(10),
|
|
2721
|
+
min: z29.number().min(1).default(1),
|
|
2666
2722
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
2667
|
-
name:
|
|
2668
|
-
sectionId:
|
|
2669
|
-
sectionType:
|
|
2723
|
+
name: z29.string().default("Quantity"),
|
|
2724
|
+
sectionId: z29.uuid().default(() => uuidv79()),
|
|
2725
|
+
sectionType: z29.literal(SectionType.quantity).default(SectionType.quantity)
|
|
2670
2726
|
});
|
|
2671
2727
|
|
|
2672
2728
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
2673
2729
|
import { v7 as uuidv710 } from "uuid";
|
|
2674
|
-
import { z as
|
|
2730
|
+
import { z as z30 } from "zod";
|
|
2675
2731
|
|
|
2676
2732
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
2677
2733
|
var REVIEW_LABELS = {
|
|
@@ -2734,50 +2790,50 @@ var REVIEW_LABELS = {
|
|
|
2734
2790
|
};
|
|
2735
2791
|
|
|
2736
2792
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
2737
|
-
var CABReviewsSection =
|
|
2793
|
+
var CABReviewsSection = z30.object({
|
|
2738
2794
|
...CABVariableFields,
|
|
2739
|
-
color:
|
|
2795
|
+
color: z30.string().default("#fadb14"),
|
|
2740
2796
|
/**
|
|
2741
2797
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
2742
2798
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
2743
2799
|
* or merchant work.
|
|
2744
2800
|
*/
|
|
2745
|
-
countLabels:
|
|
2746
|
-
one:
|
|
2747
|
-
other:
|
|
2801
|
+
countLabels: z30.object({
|
|
2802
|
+
one: z30.record(z30.string(), z30.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
2803
|
+
other: z30.record(z30.string(), z30.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
2748
2804
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
2749
|
-
name:
|
|
2750
|
-
sectionId:
|
|
2751
|
-
sectionType:
|
|
2752
|
-
size:
|
|
2805
|
+
name: z30.string().optional(),
|
|
2806
|
+
sectionId: z30.uuid().default(() => uuidv710()),
|
|
2807
|
+
sectionType: z30.literal(SectionType.reviews).default(SectionType.reviews),
|
|
2808
|
+
size: z30.enum(reviewsSizes).default(ReviewsSize.default)
|
|
2753
2809
|
});
|
|
2754
2810
|
|
|
2755
2811
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
2756
2812
|
import { slice } from "es-toolkit/compat";
|
|
2757
2813
|
import { v7 as uuidv711 } from "uuid";
|
|
2758
|
-
import { z as
|
|
2759
|
-
var CABVariantsSection =
|
|
2814
|
+
import { z as z31 } from "zod";
|
|
2815
|
+
var CABVariantsSection = z31.object({
|
|
2760
2816
|
...CABVariableFields,
|
|
2761
|
-
hideOutOfStockVariants:
|
|
2762
|
-
name:
|
|
2763
|
-
sectionId:
|
|
2764
|
-
sectionType:
|
|
2765
|
-
selector:
|
|
2766
|
-
variantMode:
|
|
2817
|
+
hideOutOfStockVariants: z31.boolean().default(false),
|
|
2818
|
+
name: z31.string().optional(),
|
|
2819
|
+
sectionId: z31.uuid().default(() => uuidv711()),
|
|
2820
|
+
sectionType: z31.literal(SectionType.variants).default(SectionType.variants),
|
|
2821
|
+
selector: z31.enum(slice(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
2822
|
+
variantMode: z31.enum(variantModes).default(VariantMode.multiple)
|
|
2767
2823
|
});
|
|
2768
2824
|
|
|
2769
2825
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
2770
|
-
var CABBorder =
|
|
2771
|
-
radius:
|
|
2772
|
-
style:
|
|
2773
|
-
width:
|
|
2826
|
+
var CABBorder = z32.object({
|
|
2827
|
+
radius: z32.enum(borderRadii).default(BorderRadius.base),
|
|
2828
|
+
style: z32.enum(borderStyles).default(BorderStyle.none),
|
|
2829
|
+
width: z32.enum(borderWidths).default(BorderWidth.base)
|
|
2774
2830
|
}).default({
|
|
2775
2831
|
radius: BorderRadius.base,
|
|
2776
2832
|
style: BorderStyle.none,
|
|
2777
2833
|
width: BorderWidth.base
|
|
2778
2834
|
});
|
|
2779
|
-
var CABSection =
|
|
2780
|
-
() =>
|
|
2835
|
+
var CABSection = z32.lazy(
|
|
2836
|
+
() => z32.discriminatedUnion("sectionType", [
|
|
2781
2837
|
CABBannerSection,
|
|
2782
2838
|
CABButtonSection,
|
|
2783
2839
|
CABCarouselSection,
|
|
@@ -2799,32 +2855,32 @@ var CABSection = z28.lazy(
|
|
|
2799
2855
|
);
|
|
2800
2856
|
|
|
2801
2857
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
2802
|
-
var GridItem =
|
|
2803
|
-
var CABLayoutSection =
|
|
2858
|
+
var GridItem = z33.union([z33.literal("auto"), z33.literal("fill"), z33.string().regex(/^\d+%$/), z33.number()]);
|
|
2859
|
+
var CABLayoutSection = z33.object({
|
|
2804
2860
|
...CABVariableFields,
|
|
2805
|
-
alignment:
|
|
2806
|
-
horizontal:
|
|
2807
|
-
vertical:
|
|
2861
|
+
alignment: z33.object({
|
|
2862
|
+
horizontal: z33.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
2863
|
+
vertical: z33.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
2808
2864
|
}).default({
|
|
2809
2865
|
horizontal: HorizontalAlignment.start,
|
|
2810
2866
|
vertical: VerticalAlignment.top
|
|
2811
2867
|
}),
|
|
2812
|
-
border:
|
|
2813
|
-
buttonField:
|
|
2814
|
-
direction:
|
|
2815
|
-
grid:
|
|
2816
|
-
columns:
|
|
2817
|
-
rows:
|
|
2868
|
+
border: z33.lazy(() => CABBorder),
|
|
2869
|
+
buttonField: z33.enum(buttonFields).optional(),
|
|
2870
|
+
direction: z33.enum(directions).default(Direction.rows),
|
|
2871
|
+
grid: z33.object({
|
|
2872
|
+
columns: z33.union([z33.array(GridItem), z33.undefined()]).default(() => ["auto"]),
|
|
2873
|
+
rows: z33.union([z33.array(GridItem), z33.undefined()]).default(() => ["auto"])
|
|
2818
2874
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
2819
|
-
name:
|
|
2820
|
-
padding:
|
|
2821
|
-
sectionId:
|
|
2822
|
-
sections:
|
|
2823
|
-
sectionType:
|
|
2824
|
-
spacing:
|
|
2875
|
+
name: z33.string().optional(),
|
|
2876
|
+
padding: z33.enum(spacings).default(Spacing.none),
|
|
2877
|
+
sectionId: z33.uuid().default(() => uuidv712()),
|
|
2878
|
+
sections: z33.union([z33.array(z33.lazy(() => CABSection)), z33.strictObject({}).transform(() => [])]).default(() => []),
|
|
2879
|
+
sectionType: z33.literal(SectionType.layout).default(SectionType.layout),
|
|
2880
|
+
spacing: z33.enum(spacings).default(Spacing.base),
|
|
2825
2881
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
2826
|
-
viewUrl:
|
|
2827
|
-
width:
|
|
2882
|
+
viewUrl: z33.string().optional(),
|
|
2883
|
+
width: z33.number().default(100)
|
|
2828
2884
|
});
|
|
2829
2885
|
|
|
2830
2886
|
// src/schema/widgets/checkout-and-beyond/uiLabels.ts
|
|
@@ -2845,8 +2901,8 @@ var UI_LABELS = {
|
|
|
2845
2901
|
};
|
|
2846
2902
|
|
|
2847
2903
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
2848
|
-
var localized = (fallback) =>
|
|
2849
|
-
var CABUILabels =
|
|
2904
|
+
var localized = (fallback) => z34.record(z34.string(), z34.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
2905
|
+
var CABUILabels = z34.object({
|
|
2850
2906
|
currentPage: localized(UI_LABELS.currentPage),
|
|
2851
2907
|
guest: localized(UI_LABELS.guest),
|
|
2852
2908
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -2871,154 +2927,154 @@ var CABUILabels = z30.object({
|
|
|
2871
2927
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
2872
2928
|
updating: { ...UI_LABELS.updating }
|
|
2873
2929
|
}));
|
|
2874
|
-
var TargetArea =
|
|
2875
|
-
fill:
|
|
2876
|
-
flip:
|
|
2877
|
-
icon:
|
|
2878
|
-
label:
|
|
2879
|
-
width:
|
|
2930
|
+
var TargetArea = z34.object({
|
|
2931
|
+
fill: z34.boolean().optional(),
|
|
2932
|
+
flip: z34.enum(["both", "horizontal", "vertical"]).optional(),
|
|
2933
|
+
icon: z34.string(),
|
|
2934
|
+
label: z34.string(),
|
|
2935
|
+
width: z34.string()
|
|
2880
2936
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
2881
|
-
var CABTracking =
|
|
2882
|
-
enableAttribution:
|
|
2883
|
-
enableSource:
|
|
2884
|
-
enableWidget:
|
|
2937
|
+
var CABTracking = z34.object({
|
|
2938
|
+
enableAttribution: z34.boolean().nullish().transform((value) => value ?? true),
|
|
2939
|
+
enableSource: z34.boolean().nullish().transform((value) => value ?? true),
|
|
2940
|
+
enableWidget: z34.boolean().nullish().transform((value) => value ?? true)
|
|
2885
2941
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
2886
|
-
var CABExperiment =
|
|
2887
|
-
elementId:
|
|
2888
|
-
experimentId:
|
|
2889
|
-
experimentType:
|
|
2890
|
-
selectedId:
|
|
2942
|
+
var CABExperiment = z34.object({
|
|
2943
|
+
elementId: z34.number(),
|
|
2944
|
+
experimentId: z34.number(),
|
|
2945
|
+
experimentType: z34.string(),
|
|
2946
|
+
selectedId: z34.number()
|
|
2891
2947
|
});
|
|
2892
2948
|
var CABRootSection = CABLayoutSection.extend({
|
|
2893
|
-
editorMode:
|
|
2949
|
+
editorMode: z34.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
2894
2950
|
experiment: CABExperiment.optional(),
|
|
2895
2951
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
2896
2952
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
2897
|
-
previewMode:
|
|
2898
|
-
storeId:
|
|
2953
|
+
previewMode: z34.boolean().nullish().transform((value) => value ?? false),
|
|
2954
|
+
storeId: z34.number().nullable().default(null),
|
|
2899
2955
|
targetArea: TargetArea.nullable(),
|
|
2900
2956
|
tracking: CABTracking,
|
|
2901
|
-
type:
|
|
2957
|
+
type: z34.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
2902
2958
|
uiLabels: CABUILabels,
|
|
2903
|
-
version:
|
|
2904
|
-
widgetId:
|
|
2959
|
+
version: z34.literal(2).default(2),
|
|
2960
|
+
widgetId: z34.number().nullable().default(null)
|
|
2905
2961
|
});
|
|
2906
2962
|
|
|
2907
2963
|
// src/schema/widgets/contentBlock.ts
|
|
2908
|
-
var ContentBlockV1 =
|
|
2909
|
-
blockSpacing:
|
|
2910
|
-
imageBlocks:
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
altText:
|
|
2914
|
-
description:
|
|
2915
|
-
id:
|
|
2916
|
-
imagePlacement:
|
|
2917
|
-
imageSize:
|
|
2918
|
-
imageUrl:
|
|
2919
|
-
textAlignment:
|
|
2964
|
+
var ContentBlockV1 = z35.object({
|
|
2965
|
+
blockSpacing: z35.enum(spacings).optional(),
|
|
2966
|
+
imageBlocks: z35.union([
|
|
2967
|
+
z35.array(
|
|
2968
|
+
z35.object({
|
|
2969
|
+
altText: z35.string().nullable(),
|
|
2970
|
+
description: z35.string().nullable(),
|
|
2971
|
+
id: z35.uuid(),
|
|
2972
|
+
imagePlacement: z35.enum(["top", "right", "bottom", "left"]),
|
|
2973
|
+
imageSize: z35.number(),
|
|
2974
|
+
imageUrl: z35.url(),
|
|
2975
|
+
textAlignment: z35.enum(["left", "center", "right"]),
|
|
2920
2976
|
/** Inline scale only: an image caption can never be a block-level heading. */
|
|
2921
|
-
textSize:
|
|
2977
|
+
textSize: z35.enum(inlineTextSizeNames)
|
|
2922
2978
|
})
|
|
2923
2979
|
),
|
|
2924
|
-
|
|
2980
|
+
z35.strictObject({}).transform(() => [])
|
|
2925
2981
|
]).optional(),
|
|
2926
|
-
imageLayout:
|
|
2927
|
-
language:
|
|
2928
|
-
description:
|
|
2929
|
-
superTitle:
|
|
2930
|
-
title:
|
|
2982
|
+
imageLayout: z35.enum(["row", "column"]).optional(),
|
|
2983
|
+
language: z35.object({
|
|
2984
|
+
description: z35.string(),
|
|
2985
|
+
superTitle: z35.string(),
|
|
2986
|
+
title: z35.string()
|
|
2931
2987
|
}),
|
|
2932
|
-
previewMode:
|
|
2933
|
-
type:
|
|
2934
|
-
version:
|
|
2988
|
+
previewMode: z35.boolean(),
|
|
2989
|
+
type: z35.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block),
|
|
2990
|
+
version: z35.literal(1)
|
|
2935
2991
|
});
|
|
2936
|
-
var ContentBlock =
|
|
2992
|
+
var ContentBlock = z35.discriminatedUnion("version", [
|
|
2937
2993
|
ContentBlockV1,
|
|
2938
2994
|
CABRootSection.extend({
|
|
2939
|
-
type:
|
|
2995
|
+
type: z35.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block)
|
|
2940
2996
|
})
|
|
2941
2997
|
]);
|
|
2942
2998
|
|
|
2943
2999
|
// src/schema/widgets/giftWithPurchase.ts
|
|
2944
|
-
import { z as
|
|
2945
|
-
var GiftWithPurchase =
|
|
2946
|
-
type:
|
|
3000
|
+
import { z as z36 } from "zod";
|
|
3001
|
+
var GiftWithPurchase = z36.looseObject({
|
|
3002
|
+
type: z36.literal(WidgetType.gift_with_purchase).default(WidgetType.gift_with_purchase)
|
|
2947
3003
|
});
|
|
2948
3004
|
|
|
2949
3005
|
// src/schema/widgets/lineItemEditor.ts
|
|
2950
|
-
import { z as
|
|
2951
|
-
var LineItemEditorSwitchLanguageV1 =
|
|
2952
|
-
downgradeToOneTimeLabel:
|
|
3006
|
+
import { z as z37 } from "zod";
|
|
3007
|
+
var LineItemEditorSwitchLanguageV1 = z37.object({
|
|
3008
|
+
downgradeToOneTimeLabel: z37.string().optional(),
|
|
2953
3009
|
/** Frequency-option template (`{{frequency}}`/`{{interval}}`) for the plan select. */
|
|
2954
|
-
subscriptionOptionLabel:
|
|
2955
|
-
upgradeToSubscriptionLabel:
|
|
2956
|
-
upgradeToSubscriptionWithoutDiscountLabel:
|
|
3010
|
+
subscriptionOptionLabel: z37.string().optional(),
|
|
3011
|
+
upgradeToSubscriptionLabel: z37.string().optional(),
|
|
3012
|
+
upgradeToSubscriptionWithoutDiscountLabel: z37.string().optional()
|
|
2957
3013
|
});
|
|
2958
|
-
var LineItemEditorV1 =
|
|
3014
|
+
var LineItemEditorV1 = z37.object({
|
|
2959
3015
|
/** Legacy `getStyles` button style; the converter carries a valid kind, defaulting to `plain`. */
|
|
2960
|
-
button:
|
|
2961
|
-
previewMode:
|
|
2962
|
-
switchToSubscription:
|
|
2963
|
-
disableDowngrade:
|
|
3016
|
+
button: z37.object({ kind: z37.enum(["plain", "primary", "secondary"]).optional() }).optional(),
|
|
3017
|
+
previewMode: z37.boolean().optional(),
|
|
3018
|
+
switchToSubscription: z37.object({
|
|
3019
|
+
disableDowngrade: z37.boolean().optional(),
|
|
2964
3020
|
language: LineItemEditorSwitchLanguageV1.optional()
|
|
2965
3021
|
}).optional(),
|
|
2966
|
-
switchToSubscriptionEnabled:
|
|
2967
|
-
tracking:
|
|
2968
|
-
enableAttribution:
|
|
2969
|
-
enableSource:
|
|
2970
|
-
enableWidget:
|
|
3022
|
+
switchToSubscriptionEnabled: z37.boolean().optional(),
|
|
3023
|
+
tracking: z37.object({
|
|
3024
|
+
enableAttribution: z37.boolean().optional(),
|
|
3025
|
+
enableSource: z37.boolean().optional(),
|
|
3026
|
+
enableWidget: z37.boolean().optional()
|
|
2971
3027
|
}).optional(),
|
|
2972
|
-
type:
|
|
2973
|
-
version:
|
|
3028
|
+
type: z37.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor),
|
|
3029
|
+
version: z37.literal(1)
|
|
2974
3030
|
});
|
|
2975
|
-
var LineItemEditor =
|
|
3031
|
+
var LineItemEditor = z37.discriminatedUnion("version", [
|
|
2976
3032
|
LineItemEditorV1,
|
|
2977
3033
|
CABRootSection.extend({
|
|
2978
|
-
type:
|
|
3034
|
+
type: z37.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor)
|
|
2979
3035
|
})
|
|
2980
3036
|
]);
|
|
2981
3037
|
|
|
2982
3038
|
// src/schema/widgets/progressBar.ts
|
|
2983
|
-
import { z as
|
|
2984
|
-
var ProgressBar =
|
|
2985
|
-
type:
|
|
3039
|
+
import { z as z38 } from "zod";
|
|
3040
|
+
var ProgressBar = z38.looseObject({
|
|
3041
|
+
type: z38.literal(WidgetType.ui_extension_progress_bar).default(WidgetType.ui_extension_progress_bar)
|
|
2986
3042
|
});
|
|
2987
3043
|
|
|
2988
3044
|
// src/schema/widgets/rebuyButton.ts
|
|
2989
|
-
import { z as
|
|
2990
|
-
var RebuyButtonV1 =
|
|
2991
|
-
type:
|
|
2992
|
-
version:
|
|
3045
|
+
import { z as z39 } from "zod";
|
|
3046
|
+
var RebuyButtonV1 = z39.looseObject({
|
|
3047
|
+
type: z39.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button),
|
|
3048
|
+
version: z39.literal(1)
|
|
2993
3049
|
});
|
|
2994
|
-
var RebuyButton =
|
|
3050
|
+
var RebuyButton = z39.discriminatedUnion("version", [
|
|
2995
3051
|
RebuyButtonV1,
|
|
2996
3052
|
CABRootSection.extend({
|
|
2997
|
-
type:
|
|
3053
|
+
type: z39.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button)
|
|
2998
3054
|
})
|
|
2999
3055
|
]);
|
|
3000
3056
|
|
|
3001
3057
|
// src/schema/widgets/rebuyMonetize.ts
|
|
3002
|
-
import { z as
|
|
3003
|
-
var RebuyMonetize =
|
|
3004
|
-
type:
|
|
3058
|
+
import { z as z40 } from "zod";
|
|
3059
|
+
var RebuyMonetize = z40.looseObject({
|
|
3060
|
+
type: z40.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad)
|
|
3005
3061
|
});
|
|
3006
|
-
var RebuyMonetizeV1 =
|
|
3007
|
-
name:
|
|
3008
|
-
previewMode:
|
|
3062
|
+
var RebuyMonetizeV1 = z40.object({
|
|
3063
|
+
name: z40.string().nullable().optional(),
|
|
3064
|
+
previewMode: z40.boolean().optional(),
|
|
3009
3065
|
/** Privacy Policy footer href → the marker section's `privacyPolicyUrl`. */
|
|
3010
|
-
privacyPolicyUrl:
|
|
3066
|
+
privacyPolicyUrl: z40.string().nullable().optional(),
|
|
3011
3067
|
/** Ads-taxonomy sub-vertical id — one of the admin Monetize editor's two configurables. */
|
|
3012
|
-
subVertical:
|
|
3013
|
-
tracking:
|
|
3014
|
-
enableAttribution:
|
|
3015
|
-
enableSource:
|
|
3016
|
-
enableWidget:
|
|
3068
|
+
subVertical: z40.string().nullable().optional(),
|
|
3069
|
+
tracking: z40.object({
|
|
3070
|
+
enableAttribution: z40.boolean().optional(),
|
|
3071
|
+
enableSource: z40.boolean().optional(),
|
|
3072
|
+
enableWidget: z40.boolean().optional()
|
|
3017
3073
|
}).optional(),
|
|
3018
|
-
type:
|
|
3019
|
-
version:
|
|
3074
|
+
type: z40.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad),
|
|
3075
|
+
version: z40.literal(1),
|
|
3020
3076
|
/** Ads-taxonomy vertical id — one of the admin Monetize editor's two configurables. */
|
|
3021
|
-
vertical:
|
|
3077
|
+
vertical: z40.string().nullable().optional()
|
|
3022
3078
|
});
|
|
3023
3079
|
|
|
3024
3080
|
// src/schema/widgetData.ts
|
|
@@ -3032,7 +3088,7 @@ var extensionWidgetTypes = [
|
|
|
3032
3088
|
WidgetType.ui_extension_line_item_editor,
|
|
3033
3089
|
WidgetType.ui_extension_progress_bar
|
|
3034
3090
|
];
|
|
3035
|
-
var WidgetData =
|
|
3091
|
+
var WidgetData = z41.discriminatedUnion("type", [
|
|
3036
3092
|
ABTestingPlaceholder,
|
|
3037
3093
|
CheckoutExtension,
|
|
3038
3094
|
ContentBlock,
|
|
@@ -3393,15 +3449,15 @@ var SWITCH_LABELS = {
|
|
|
3393
3449
|
|
|
3394
3450
|
// src/schema/widgets/post-purchase-offer/common.ts
|
|
3395
3451
|
import { replace, toNumber, toString } from "es-toolkit/compat";
|
|
3396
|
-
import { z as
|
|
3397
|
-
var strictNumber =
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3452
|
+
import { z as z42 } from "zod";
|
|
3453
|
+
var strictNumber = z42.union([
|
|
3454
|
+
z42.number(),
|
|
3455
|
+
z42.string().transform((value) => toNumber(replace(toString(value), /[^0-9.]/g, "")) || 0),
|
|
3456
|
+
z42.unknown().transform(() => 0)
|
|
3401
3457
|
]);
|
|
3402
3458
|
|
|
3403
3459
|
// src/schema/widgets/post-purchase-offer/constants.ts
|
|
3404
|
-
import { z as
|
|
3460
|
+
import { z as z43 } from "zod";
|
|
3405
3461
|
var blockTypes = [
|
|
3406
3462
|
"callout_banner",
|
|
3407
3463
|
"image",
|
|
@@ -3412,144 +3468,144 @@ var blockTypes = [
|
|
|
3412
3468
|
"text",
|
|
3413
3469
|
"timer"
|
|
3414
3470
|
];
|
|
3415
|
-
var blockType =
|
|
3471
|
+
var blockType = z43.enum(blockTypes);
|
|
3416
3472
|
var BlockType = blockType.enum;
|
|
3417
3473
|
|
|
3418
3474
|
// src/schema/widgets/post-purchase-offer/postPurchaseBlocks.ts
|
|
3419
3475
|
import { get as get3, isEqual } from "es-toolkit/compat";
|
|
3420
3476
|
import { v4 as uuidv42 } from "uuid";
|
|
3421
|
-
import { z as
|
|
3422
|
-
var TextAlignment2 =
|
|
3423
|
-
var TextSize =
|
|
3424
|
-
|
|
3425
|
-
|
|
3477
|
+
import { z as z44 } from "zod";
|
|
3478
|
+
var TextAlignment2 = z44.union([z44.enum(["leading", "center", "trailing"]), z44.unknown().transform(() => "leading")]);
|
|
3479
|
+
var TextSize = z44.union([
|
|
3480
|
+
z44.enum(["xsmall", "small", "base", "default", "medium", "large", "xlarge"]),
|
|
3481
|
+
z44.unknown().transform(() => "medium")
|
|
3426
3482
|
]);
|
|
3427
|
-
var CalloutBannerBlock =
|
|
3428
|
-
id:
|
|
3429
|
-
name:
|
|
3430
|
-
settings:
|
|
3431
|
-
superTitle:
|
|
3432
|
-
title:
|
|
3483
|
+
var CalloutBannerBlock = z44.object({
|
|
3484
|
+
id: z44.string().optional().default(() => uuidv42()),
|
|
3485
|
+
name: z44.string().optional(),
|
|
3486
|
+
settings: z44.object({
|
|
3487
|
+
superTitle: z44.union([z44.string(), TiptapDocument]).default(() => "Limited-time Offer"),
|
|
3488
|
+
title: z44.union([z44.string(), TiptapDocument]).default(() => "Add this customer favorite to your order")
|
|
3433
3489
|
}),
|
|
3434
|
-
styles:
|
|
3435
|
-
superTitleEmphasized:
|
|
3490
|
+
styles: z44.object({
|
|
3491
|
+
superTitleEmphasized: z44.boolean().default(false),
|
|
3436
3492
|
superTitleSize: TextSize.default("large"),
|
|
3437
3493
|
textAlignment: TextAlignment2.default("center"),
|
|
3438
|
-
titleEmphasized:
|
|
3494
|
+
titleEmphasized: z44.boolean().default(true),
|
|
3439
3495
|
titleSize: TextSize.default("large")
|
|
3440
3496
|
}),
|
|
3441
|
-
type:
|
|
3497
|
+
type: z44.literal(BlockType.callout_banner).default(BlockType.callout_banner)
|
|
3442
3498
|
});
|
|
3443
|
-
var ImageBlock =
|
|
3444
|
-
id:
|
|
3445
|
-
name:
|
|
3446
|
-
settings:
|
|
3447
|
-
|
|
3499
|
+
var ImageBlock = z44.object({
|
|
3500
|
+
id: z44.string().optional().default(() => uuidv42()),
|
|
3501
|
+
name: z44.string().optional(),
|
|
3502
|
+
settings: z44.union([
|
|
3503
|
+
z44.object({
|
|
3448
3504
|
/** This isn't used in the post-purchase offer widget */
|
|
3449
|
-
alt:
|
|
3450
|
-
image:
|
|
3451
|
-
imageSize:
|
|
3452
|
-
imageType:
|
|
3505
|
+
alt: z44.string().optional().default(""),
|
|
3506
|
+
image: z44.union([z44.literal(""), z44.url()]).default(""),
|
|
3507
|
+
imageSize: z44.number().default(20),
|
|
3508
|
+
imageType: z44.enum(["URL", "UPLOAD"]).default("URL")
|
|
3453
3509
|
}),
|
|
3454
|
-
|
|
3510
|
+
z44.array(z44.never()).transform(() => ({}))
|
|
3455
3511
|
]),
|
|
3456
|
-
type:
|
|
3512
|
+
type: z44.literal(BlockType.image).default(BlockType.image)
|
|
3457
3513
|
});
|
|
3458
|
-
var ImageContentBlock =
|
|
3459
|
-
id:
|
|
3460
|
-
name:
|
|
3461
|
-
settings:
|
|
3462
|
-
alt:
|
|
3463
|
-
description:
|
|
3514
|
+
var ImageContentBlock = z44.object({
|
|
3515
|
+
id: z44.string().optional().default(() => uuidv42()),
|
|
3516
|
+
name: z44.string().optional(),
|
|
3517
|
+
settings: z44.object({
|
|
3518
|
+
alt: z44.string().optional().default(""),
|
|
3519
|
+
description: z44.union([z44.string(), TiptapDocument, z44.null()]).default(
|
|
3464
3520
|
"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."
|
|
3465
3521
|
),
|
|
3466
3522
|
descriptionSize: TextSize.default("medium"),
|
|
3467
3523
|
horizontalAlignment: TextAlignment2.default("leading"),
|
|
3468
|
-
image:
|
|
3469
|
-
imagePlacement:
|
|
3470
|
-
imageSize:
|
|
3471
|
-
superTitle:
|
|
3524
|
+
image: z44.union([z44.literal(""), z44.url()]).default(""),
|
|
3525
|
+
imagePlacement: z44.enum(["bottom", "left", "right", "top"]).optional().default("left"),
|
|
3526
|
+
imageSize: z44.number().default(20),
|
|
3527
|
+
superTitle: z44.union([z44.string(), TiptapDocument]).default("Lorem Ipsum!"),
|
|
3472
3528
|
superTitleSize: TextSize.default("medium"),
|
|
3473
3529
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3474
|
-
swapContent:
|
|
3475
|
-
title:
|
|
3530
|
+
swapContent: z44.boolean().optional().default(false),
|
|
3531
|
+
title: z44.union([z44.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet"),
|
|
3476
3532
|
titleSize: TextSize.default("medium")
|
|
3477
3533
|
}),
|
|
3478
|
-
type:
|
|
3534
|
+
type: z44.literal(BlockType.image_content).default(BlockType.image_content)
|
|
3479
3535
|
});
|
|
3480
|
-
var PayButtonBlock =
|
|
3481
|
-
id:
|
|
3482
|
-
name:
|
|
3483
|
-
settings:
|
|
3484
|
-
|
|
3485
|
-
label:
|
|
3536
|
+
var PayButtonBlock = z44.object({
|
|
3537
|
+
id: z44.string().optional().default(() => uuidv42()),
|
|
3538
|
+
name: z44.string().optional(),
|
|
3539
|
+
settings: z44.union([
|
|
3540
|
+
z44.object({
|
|
3541
|
+
label: z44.string().default("Pay Now")
|
|
3486
3542
|
}),
|
|
3487
|
-
|
|
3543
|
+
z44.array(z44.never()).transform(() => ({
|
|
3488
3544
|
label: "Pay Now"
|
|
3489
3545
|
}))
|
|
3490
3546
|
]),
|
|
3491
|
-
styles:
|
|
3492
|
-
|
|
3493
|
-
buttonWidth:
|
|
3547
|
+
styles: z44.union([
|
|
3548
|
+
z44.object({
|
|
3549
|
+
buttonWidth: z44.number().min(10).max(100).default(50)
|
|
3494
3550
|
}),
|
|
3495
|
-
|
|
3551
|
+
z44.array(z44.never()).transform(() => ({
|
|
3496
3552
|
buttonWidth: 50
|
|
3497
3553
|
}))
|
|
3498
3554
|
]),
|
|
3499
|
-
type:
|
|
3555
|
+
type: z44.literal(BlockType.pay_button).default(BlockType.pay_button)
|
|
3500
3556
|
});
|
|
3501
|
-
var ProductInformationBlock =
|
|
3557
|
+
var ProductInformationBlock = z44.object({
|
|
3502
3558
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3503
|
-
hideProductImage:
|
|
3504
|
-
id:
|
|
3505
|
-
name:
|
|
3506
|
-
type:
|
|
3559
|
+
hideProductImage: z44.boolean().optional().default(false),
|
|
3560
|
+
id: z44.string().optional().default(() => uuidv42()),
|
|
3561
|
+
name: z44.string().optional(),
|
|
3562
|
+
type: z44.literal(BlockType.product_information).default(BlockType.product_information)
|
|
3507
3563
|
});
|
|
3508
|
-
var SeparatorBlock =
|
|
3509
|
-
id:
|
|
3510
|
-
name:
|
|
3511
|
-
type:
|
|
3564
|
+
var SeparatorBlock = z44.object({
|
|
3565
|
+
id: z44.string().optional().default(() => uuidv42()),
|
|
3566
|
+
name: z44.string().optional(),
|
|
3567
|
+
type: z44.literal(BlockType.separator).default(BlockType.separator)
|
|
3512
3568
|
});
|
|
3513
|
-
var TextBlock =
|
|
3514
|
-
id:
|
|
3515
|
-
name:
|
|
3516
|
-
settings:
|
|
3517
|
-
description:
|
|
3569
|
+
var TextBlock = z44.object({
|
|
3570
|
+
id: z44.string().optional().default(() => uuidv42()),
|
|
3571
|
+
name: z44.string().optional(),
|
|
3572
|
+
settings: z44.object({
|
|
3573
|
+
description: z44.union([z44.string(), TiptapDocument]).optional().default(
|
|
3518
3574
|
"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."
|
|
3519
3575
|
),
|
|
3520
3576
|
/** This isn't used in the post-purchase offer widget */
|
|
3521
3577
|
descriptionSize: TextSize.default("medium"),
|
|
3522
3578
|
horizontalAlignment: TextAlignment2.default("leading"),
|
|
3523
|
-
superTitle:
|
|
3579
|
+
superTitle: z44.union([z44.string(), TiptapDocument]).default("Super Title"),
|
|
3524
3580
|
/** This isn't used in the post-purchase offer widget */
|
|
3525
3581
|
superTitleSize: TextSize.default("medium"),
|
|
3526
|
-
title:
|
|
3582
|
+
title: z44.union([z44.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet."),
|
|
3527
3583
|
/** This isn't used in the post-purchase offer widget */
|
|
3528
3584
|
titleSize: TextSize.default("medium")
|
|
3529
3585
|
}),
|
|
3530
|
-
type:
|
|
3586
|
+
type: z44.literal(BlockType.text).default(BlockType.text)
|
|
3531
3587
|
});
|
|
3532
|
-
var TimerBlock =
|
|
3533
|
-
id:
|
|
3534
|
-
name:
|
|
3535
|
-
settings:
|
|
3536
|
-
durationMinutes:
|
|
3537
|
-
durationSeconds:
|
|
3538
|
-
endOffer:
|
|
3539
|
-
title:
|
|
3588
|
+
var TimerBlock = z44.object({
|
|
3589
|
+
id: z44.string().optional().default(() => uuidv42()),
|
|
3590
|
+
name: z44.string().optional(),
|
|
3591
|
+
settings: z44.object({
|
|
3592
|
+
durationMinutes: z44.number().min(0).default(10),
|
|
3593
|
+
durationSeconds: z44.union([z44.number().min(0), z44.unknown().transform(() => 0)]).default(0),
|
|
3594
|
+
endOffer: z44.boolean().default(true),
|
|
3595
|
+
title: z44.union([z44.string(), TiptapDocument]).default("Hurry \u2014 your special offer ends in:")
|
|
3540
3596
|
}),
|
|
3541
|
-
styles:
|
|
3597
|
+
styles: z44.object({
|
|
3542
3598
|
textAlignment: TextAlignment2.default("center"),
|
|
3543
|
-
timerBackgroundColor:
|
|
3544
|
-
timerEmphasized:
|
|
3599
|
+
timerBackgroundColor: z44.enum(["info", "warning", "success", "critical"]).default("warning"),
|
|
3600
|
+
timerEmphasized: z44.union([z44.boolean(), z44.unknown().transform(() => true)]).default(true),
|
|
3545
3601
|
timerSize: TextSize.default("medium"),
|
|
3546
|
-
timerWidth:
|
|
3547
|
-
titleEmphasized:
|
|
3602
|
+
timerWidth: z44.number().min(10).max(100).optional().default(100),
|
|
3603
|
+
titleEmphasized: z44.union([z44.boolean(), z44.unknown().transform(() => true)]).default(false),
|
|
3548
3604
|
titleSize: TextSize.default("medium")
|
|
3549
3605
|
}),
|
|
3550
|
-
type:
|
|
3606
|
+
type: z44.literal(BlockType.timer).default(BlockType.timer)
|
|
3551
3607
|
});
|
|
3552
|
-
var PostPurchaseBlock =
|
|
3608
|
+
var PostPurchaseBlock = z44.discriminatedUnion("type", [
|
|
3553
3609
|
CalloutBannerBlock,
|
|
3554
3610
|
ImageBlock,
|
|
3555
3611
|
ImageContentBlock,
|
|
@@ -3569,68 +3625,68 @@ var isTextBlock = (block) => isEqual(get3(block, "type"), BlockType.text);
|
|
|
3569
3625
|
var isTimerBlock = (block) => isEqual(get3(block, "type"), BlockType.timer);
|
|
3570
3626
|
|
|
3571
3627
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
3572
|
-
import { z as
|
|
3628
|
+
import { z as z47 } from "zod";
|
|
3573
3629
|
|
|
3574
3630
|
// src/schema/widgets/post-purchase-offer/postPurchaseWidget.ts
|
|
3575
|
-
import { z as
|
|
3631
|
+
import { z as z46 } from "zod";
|
|
3576
3632
|
|
|
3577
3633
|
// src/schema/widgets/post-purchase-offer/postPurchaseSettings.ts
|
|
3578
|
-
import { z as
|
|
3579
|
-
var PostPurchaseSettings =
|
|
3580
|
-
advance:
|
|
3581
|
-
blocks:
|
|
3634
|
+
import { z as z45 } from "zod";
|
|
3635
|
+
var PostPurchaseSettings = z45.object({
|
|
3636
|
+
advance: z45.object({ removePartialOrder: z45.boolean().default(true) }).optional().default(() => ({ removePartialOrder: true })),
|
|
3637
|
+
blocks: z45.union([z45.array(PostPurchaseBlock), z45.unknown().transform(() => [])]).default(() => [
|
|
3582
3638
|
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.timer }),
|
|
3583
3639
|
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.callout_banner }),
|
|
3584
3640
|
PostPurchaseBlock.parse({ type: BlockType.product_information })
|
|
3585
3641
|
]),
|
|
3586
|
-
columnLayout:
|
|
3587
|
-
discount:
|
|
3642
|
+
columnLayout: z45.boolean().optional(),
|
|
3643
|
+
discount: z45.object({
|
|
3588
3644
|
amount: strictNumber.default(30),
|
|
3589
|
-
shouldShowSavingText:
|
|
3590
|
-
type:
|
|
3645
|
+
shouldShowSavingText: z45.boolean().optional().default(true),
|
|
3646
|
+
type: z45.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
3591
3647
|
}),
|
|
3592
|
-
discountedFrom:
|
|
3593
|
-
endpoint:
|
|
3594
|
-
integrations:
|
|
3595
|
-
judgeme:
|
|
3596
|
-
junip:
|
|
3597
|
-
klaviyo:
|
|
3598
|
-
loox:
|
|
3599
|
-
okendo:
|
|
3600
|
-
opinew:
|
|
3601
|
-
reviewsio:
|
|
3602
|
-
stamped:
|
|
3603
|
-
yotpo:
|
|
3648
|
+
discountedFrom: z45.enum(["price", "compare_at_price"]).optional().default("price"),
|
|
3649
|
+
endpoint: z45.string().optional(),
|
|
3650
|
+
integrations: z45.object({
|
|
3651
|
+
judgeme: z45.boolean().default(false),
|
|
3652
|
+
junip: z45.boolean().optional().default(false),
|
|
3653
|
+
klaviyo: z45.boolean().default(false),
|
|
3654
|
+
loox: z45.boolean().default(false),
|
|
3655
|
+
okendo: z45.boolean().default(false),
|
|
3656
|
+
opinew: z45.boolean().optional().default(false),
|
|
3657
|
+
reviewsio: z45.boolean().optional().default(false),
|
|
3658
|
+
stamped: z45.boolean().default(false),
|
|
3659
|
+
yotpo: z45.boolean().default(false)
|
|
3604
3660
|
}),
|
|
3605
|
-
key:
|
|
3606
|
-
language:
|
|
3607
|
-
description:
|
|
3608
|
-
descriptionEnabled:
|
|
3609
|
-
descriptionRte:
|
|
3610
|
-
content:
|
|
3611
|
-
type:
|
|
3661
|
+
key: z45.string().optional(),
|
|
3662
|
+
language: z45.object({
|
|
3663
|
+
description: z45.union([z45.string(), z45.unknown().transform(() => "")]).default(""),
|
|
3664
|
+
descriptionEnabled: z45.boolean().optional().default(false),
|
|
3665
|
+
descriptionRte: z45.object({
|
|
3666
|
+
content: z45.array(z45.unknown()),
|
|
3667
|
+
type: z45.string()
|
|
3612
3668
|
}).optional(),
|
|
3613
|
-
descriptionSpacing:
|
|
3614
|
-
displayCtaPrice:
|
|
3615
|
-
global:
|
|
3616
|
-
declineAll:
|
|
3617
|
-
declineThisOffer:
|
|
3618
|
-
free:
|
|
3619
|
-
notAvailable:
|
|
3620
|
-
payNow:
|
|
3621
|
-
payNowUpgradeToSubscription:
|
|
3622
|
-
quantity:
|
|
3669
|
+
descriptionSpacing: z45.enum(["none", "xtight", "tight", "default", "loose", "xloose"]).optional(),
|
|
3670
|
+
displayCtaPrice: z45.boolean().default(true),
|
|
3671
|
+
global: z45.object({
|
|
3672
|
+
declineAll: z45.string().optional().default("Decline All"),
|
|
3673
|
+
declineThisOffer: z45.string().default("Decline this offer"),
|
|
3674
|
+
free: z45.string().optional().default("Free"),
|
|
3675
|
+
notAvailable: z45.string().optional().default("Not available"),
|
|
3676
|
+
payNow: z45.string().default("Pay Now"),
|
|
3677
|
+
payNowUpgradeToSubscription: z45.string().optional().default("Upgrade to Subscription"),
|
|
3678
|
+
quantity: z45.string().default("Quantity"),
|
|
3623
3679
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3624
|
-
recurringShipping:
|
|
3625
|
-
recurringSubtotal:
|
|
3626
|
-
reviewsPlural:
|
|
3627
|
-
reviewsSingular:
|
|
3628
|
-
save:
|
|
3629
|
-
shipping:
|
|
3630
|
-
subscriptionOption:
|
|
3631
|
-
subtotal:
|
|
3632
|
-
taxes:
|
|
3633
|
-
total:
|
|
3680
|
+
recurringShipping: z45.string().optional().default("Recurring shipping"),
|
|
3681
|
+
recurringSubtotal: z45.string().default("Recurring subtotal"),
|
|
3682
|
+
reviewsPlural: z45.string().optional().default("Reviews"),
|
|
3683
|
+
reviewsSingular: z45.string().optional().default("Review"),
|
|
3684
|
+
save: z45.union([z45.string(), z45.unknown().transform(() => "Save")]).optional().default("Save"),
|
|
3685
|
+
shipping: z45.string().default("Shipping"),
|
|
3686
|
+
subscriptionOption: z45.string().optional().default("Subscribe and Save"),
|
|
3687
|
+
subtotal: z45.string().default("Subtotal"),
|
|
3688
|
+
taxes: z45.string().default("Taxes"),
|
|
3689
|
+
total: z45.string().default("Total")
|
|
3634
3690
|
}).optional().default(() => ({
|
|
3635
3691
|
declineAll: "Decline All",
|
|
3636
3692
|
declineThisOffer: "Decline this offer",
|
|
@@ -3651,70 +3707,70 @@ var PostPurchaseSettings = z41.object({
|
|
|
3651
3707
|
taxes: "Taxes",
|
|
3652
3708
|
total: "Total"
|
|
3653
3709
|
})),
|
|
3654
|
-
globalTranslation:
|
|
3710
|
+
globalTranslation: z45.string().optional().default("english")
|
|
3655
3711
|
}),
|
|
3656
|
-
metafields:
|
|
3712
|
+
metafields: z45.boolean().default(false),
|
|
3657
3713
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3658
|
-
offer:
|
|
3659
|
-
count:
|
|
3714
|
+
offer: z45.object({
|
|
3715
|
+
count: z45.number().default(1)
|
|
3660
3716
|
}),
|
|
3661
|
-
offersLayout:
|
|
3662
|
-
itemsPerPage:
|
|
3663
|
-
type:
|
|
3717
|
+
offersLayout: z45.object({
|
|
3718
|
+
itemsPerPage: z45.number().optional(),
|
|
3719
|
+
type: z45.enum(["list", "grid", "carousel"]).default("list")
|
|
3664
3720
|
}).optional().default({
|
|
3665
3721
|
type: "list"
|
|
3666
3722
|
}),
|
|
3667
3723
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3668
|
-
previewMode:
|
|
3669
|
-
productLimit:
|
|
3670
|
-
productOptions:
|
|
3724
|
+
previewMode: z45.boolean().default(false),
|
|
3725
|
+
productLimit: z45.number().optional().default(1),
|
|
3726
|
+
productOptions: z45.object({
|
|
3671
3727
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3672
|
-
hideOutOfStockVariants:
|
|
3673
|
-
matchVariant:
|
|
3674
|
-
showDeclineAll:
|
|
3675
|
-
showShipping:
|
|
3676
|
-
showSubtotal:
|
|
3677
|
-
showTaxes:
|
|
3678
|
-
showTotal:
|
|
3679
|
-
showVariantSelectors:
|
|
3680
|
-
variantSelectorDisplayMode:
|
|
3728
|
+
hideOutOfStockVariants: z45.boolean().optional().default(false),
|
|
3729
|
+
matchVariant: z45.boolean().optional().default(true),
|
|
3730
|
+
showDeclineAll: z45.enum(["above", "below", "both", "none"]).optional(),
|
|
3731
|
+
showShipping: z45.boolean().optional().default(true),
|
|
3732
|
+
showSubtotal: z45.boolean().optional().default(true),
|
|
3733
|
+
showTaxes: z45.boolean().optional().default(true),
|
|
3734
|
+
showTotal: z45.boolean().optional().default(true),
|
|
3735
|
+
showVariantSelectors: z45.boolean().optional().default(true),
|
|
3736
|
+
variantSelectorDisplayMode: z45.enum(["separate", "single"]).optional().default("separate")
|
|
3681
3737
|
}),
|
|
3682
|
-
productType:
|
|
3683
|
-
productTypeSelector:
|
|
3684
|
-
quantityInputs:
|
|
3685
|
-
defaultQuantity:
|
|
3686
|
-
enabled:
|
|
3687
|
-
maxValue:
|
|
3688
|
-
minValue:
|
|
3738
|
+
productType: z45.union([z45.enum(["one-time", "subscription", "both"]), z45.literal("").transform(() => "one-time")]).default("one-time"),
|
|
3739
|
+
productTypeSelector: z45.enum(["dropdown", "radio"]).optional().default("radio"),
|
|
3740
|
+
quantityInputs: z45.object({
|
|
3741
|
+
defaultQuantity: z45.union([z45.number(), z45.null().transform(() => 1)]).default(1),
|
|
3742
|
+
enabled: z45.boolean().default(true),
|
|
3743
|
+
maxValue: z45.union([z45.number(), z45.null().transform(() => 15)]).default(15),
|
|
3744
|
+
minValue: z45.union([z45.number().min(0), z45.unknown().transform(() => 0)]).default(1)
|
|
3689
3745
|
}),
|
|
3690
|
-
shipping:
|
|
3746
|
+
shipping: z45.object({
|
|
3691
3747
|
amount: strictNumber.default(10),
|
|
3692
3748
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3693
|
-
enabled:
|
|
3694
|
-
title:
|
|
3695
|
-
type:
|
|
3749
|
+
enabled: z45.boolean().default(true),
|
|
3750
|
+
title: z45.string().optional().default("Shipping Fees"),
|
|
3751
|
+
type: z45.enum(["free", "fixed_amount"]).default("free")
|
|
3696
3752
|
}),
|
|
3697
|
-
styles:
|
|
3698
|
-
starColor:
|
|
3699
|
-
starSize:
|
|
3700
|
-
starStrokeColor:
|
|
3701
|
-
strokeWidth:
|
|
3753
|
+
styles: z45.object({
|
|
3754
|
+
starColor: z45.string().optional().default("#fadb14"),
|
|
3755
|
+
starSize: z45.union([z45.enum(["small", "medium", "large"]), z45.unknown().transform(() => "large")]).optional().default("large"),
|
|
3756
|
+
starStrokeColor: z45.string().optional().default("#fadb14"),
|
|
3757
|
+
strokeWidth: z45.string().optional().default("1")
|
|
3702
3758
|
}).optional(),
|
|
3703
|
-
subImages:
|
|
3704
|
-
subscription:
|
|
3705
|
-
discount:
|
|
3759
|
+
subImages: z45.number().nullish().default(8),
|
|
3760
|
+
subscription: z45.object({
|
|
3761
|
+
discount: z45.object({
|
|
3706
3762
|
amount: strictNumber.default(30),
|
|
3707
|
-
shouldShowSavingText:
|
|
3708
|
-
type:
|
|
3763
|
+
shouldShowSavingText: z45.boolean().optional().default(true),
|
|
3764
|
+
type: z45.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
3709
3765
|
}),
|
|
3710
|
-
shipping:
|
|
3766
|
+
shipping: z45.object({
|
|
3711
3767
|
amount: strictNumber.default(1),
|
|
3712
3768
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3713
|
-
enabled:
|
|
3769
|
+
enabled: z45.boolean().default(true),
|
|
3714
3770
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3715
3771
|
recurringAmount: strictNumber.default(2),
|
|
3716
|
-
shippingTitle:
|
|
3717
|
-
type:
|
|
3772
|
+
shippingTitle: z45.string().default("Shipping Fees"),
|
|
3773
|
+
type: z45.enum(["free", "fixed_amount"]).default("free")
|
|
3718
3774
|
})
|
|
3719
3775
|
}).optional().default({
|
|
3720
3776
|
discount: {
|
|
@@ -3732,15 +3788,15 @@ var PostPurchaseSettings = z41.object({
|
|
|
3732
3788
|
type: "free"
|
|
3733
3789
|
}
|
|
3734
3790
|
}),
|
|
3735
|
-
subscriptionIsDefault:
|
|
3791
|
+
subscriptionIsDefault: z45.boolean().optional(),
|
|
3736
3792
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3737
|
-
template:
|
|
3738
|
-
type:
|
|
3739
|
-
upgradeToSubscription:
|
|
3740
|
-
acceptButtonText:
|
|
3741
|
-
allow:
|
|
3742
|
-
emailRefundNotice:
|
|
3743
|
-
errorBannerText:
|
|
3793
|
+
template: z45.string().optional().default(""),
|
|
3794
|
+
type: z45.literal("shopify_post_purchase_extension").default("shopify_post_purchase_extension"),
|
|
3795
|
+
upgradeToSubscription: z45.object({
|
|
3796
|
+
acceptButtonText: z45.string().optional().default("Upgrade"),
|
|
3797
|
+
allow: z45.boolean().optional().default(false),
|
|
3798
|
+
emailRefundNotice: z45.boolean().optional().default(false),
|
|
3799
|
+
errorBannerText: z45.string().optional().default("This subscription cannot be added - limit one per order")
|
|
3744
3800
|
}).optional().default(() => ({
|
|
3745
3801
|
acceptButtonText: "Upgrade",
|
|
3746
3802
|
allow: false,
|
|
@@ -3750,32 +3806,32 @@ var PostPurchaseSettings = z41.object({
|
|
|
3750
3806
|
});
|
|
3751
3807
|
|
|
3752
3808
|
// src/schema/widgets/post-purchase-offer/postPurchaseWidget.ts
|
|
3753
|
-
var PostPurchaseWidgetLinkedFlow =
|
|
3754
|
-
id:
|
|
3755
|
-
name:
|
|
3809
|
+
var PostPurchaseWidgetLinkedFlow = z46.object({
|
|
3810
|
+
id: z46.number(),
|
|
3811
|
+
name: z46.string()
|
|
3756
3812
|
});
|
|
3757
|
-
var PostPurchaseWidget =
|
|
3758
|
-
classification:
|
|
3759
|
-
createdAtTime:
|
|
3760
|
-
customEndpointName:
|
|
3761
|
-
id:
|
|
3762
|
-
lastViewed:
|
|
3763
|
-
linkedCustomEndpointId:
|
|
3764
|
-
linkedFlows:
|
|
3765
|
-
name:
|
|
3766
|
-
owner:
|
|
3813
|
+
var PostPurchaseWidget = z46.object({
|
|
3814
|
+
classification: z46.literal("post_purchase_offer_page").default("post_purchase_offer_page"),
|
|
3815
|
+
createdAtTime: z46.iso.datetime({ offset: true }).optional(),
|
|
3816
|
+
customEndpointName: z46.string().nullish(),
|
|
3817
|
+
id: z46.number().default(0),
|
|
3818
|
+
lastViewed: z46.iso.datetime({ offset: true }).nullish(),
|
|
3819
|
+
linkedCustomEndpointId: z46.number().nullish(),
|
|
3820
|
+
linkedFlows: z46.array(PostPurchaseWidgetLinkedFlow).optional(),
|
|
3821
|
+
name: z46.string().default(""),
|
|
3822
|
+
owner: z46.number().nullish(),
|
|
3767
3823
|
settings: PostPurchaseSettings
|
|
3768
3824
|
});
|
|
3769
3825
|
|
|
3770
3826
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
3771
|
-
var PostPurchaseOffer =
|
|
3772
|
-
|
|
3773
|
-
errors:
|
|
3774
|
-
message:
|
|
3775
|
-
successful:
|
|
3827
|
+
var PostPurchaseOffer = z47.discriminatedUnion("successful", [
|
|
3828
|
+
z47.strictObject({
|
|
3829
|
+
errors: z47.array(z47.object({ message: z47.string() })),
|
|
3830
|
+
message: z47.string(),
|
|
3831
|
+
successful: z47.literal(false)
|
|
3776
3832
|
}),
|
|
3777
|
-
|
|
3778
|
-
successful:
|
|
3833
|
+
z47.strictObject({
|
|
3834
|
+
successful: z47.literal(true),
|
|
3779
3835
|
widget: PostPurchaseWidget
|
|
3780
3836
|
})
|
|
3781
3837
|
]);
|
|
@@ -4874,6 +4930,7 @@ export {
|
|
|
4874
4930
|
CABImageSectionFields,
|
|
4875
4931
|
CABIntegrations,
|
|
4876
4932
|
CABLayoutSection,
|
|
4933
|
+
CABMonetizeAds,
|
|
4877
4934
|
CABMonetizeSection,
|
|
4878
4935
|
CABNumberVariable,
|
|
4879
4936
|
CABOffersSection,
|
|
@@ -4918,6 +4975,8 @@ export {
|
|
|
4918
4975
|
DESCRIPTION_LABELS,
|
|
4919
4976
|
DYNAMIC_TOKEN_ANYWHERE_REGEX,
|
|
4920
4977
|
DYNAMIC_TOKEN_REGEX,
|
|
4978
|
+
DecideRequestSchema,
|
|
4979
|
+
DecisionEntrySchema,
|
|
4921
4980
|
Direction,
|
|
4922
4981
|
DiscountSource,
|
|
4923
4982
|
DiscountType,
|
|
@@ -4947,11 +5006,18 @@ export {
|
|
|
4947
5006
|
ObjectFit,
|
|
4948
5007
|
OfferProduct,
|
|
4949
5008
|
OffersDirection,
|
|
5009
|
+
POST_PURCHASE_SKIP_LIMIT,
|
|
4950
5010
|
PayButtonBlock,
|
|
4951
5011
|
PopoverPosition,
|
|
4952
5012
|
PostPurchaseBlock,
|
|
4953
5013
|
PostPurchaseOffer,
|
|
5014
|
+
PostPurchaseOrderIdSchema,
|
|
4954
5015
|
PostPurchaseSettings,
|
|
5016
|
+
PostPurchaseShadowReportSchema,
|
|
5017
|
+
PostPurchaseShadowSelectionSchema,
|
|
5018
|
+
PostPurchaseSkipReason,
|
|
5019
|
+
PostPurchaseSkipTrace,
|
|
5020
|
+
PostPurchaseTimestampSchema,
|
|
4955
5021
|
PostPurchaseWidget,
|
|
4956
5022
|
PostPurchaseWidgetLinkedFlow,
|
|
4957
5023
|
Product,
|
|
@@ -4984,6 +5050,7 @@ export {
|
|
|
4984
5050
|
SeparatorBlock,
|
|
4985
5051
|
Session,
|
|
4986
5052
|
ShopConfig,
|
|
5053
|
+
ShopifyDomainSchema,
|
|
4987
5054
|
SmartCartBar,
|
|
4988
5055
|
SmartCartComponent,
|
|
4989
5056
|
SmartCartConfig,
|