@rebuy/rebuy 3.25.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 +775 -715
- package/dist/index.mjs +775 -715
- 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/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/offers.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/progressBar.d.ts +1 -1
- 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,77 +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 CABMonetizeAds =
|
|
2330
|
-
requestId:
|
|
2378
|
+
import { z as z27 } from "zod";
|
|
2379
|
+
var CABMonetizeAds = z27.object({
|
|
2380
|
+
requestId: z27.string().optional(),
|
|
2331
2381
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
2332
|
-
testing:
|
|
2382
|
+
testing: z27.boolean().default(false)
|
|
2333
2383
|
});
|
|
2334
|
-
var CABMonetizeSection =
|
|
2384
|
+
var CABMonetizeSection = z27.object({
|
|
2335
2385
|
...CABVariableFields,
|
|
2336
2386
|
ads: CABMonetizeAds.optional(),
|
|
2337
|
-
name:
|
|
2387
|
+
name: z27.string().optional(),
|
|
2338
2388
|
/**
|
|
2339
2389
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
2340
2390
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
2341
2391
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
2342
2392
|
*/
|
|
2343
|
-
offers:
|
|
2393
|
+
offers: z27.array(z27.lazy(() => CABSection)).optional(),
|
|
2344
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. */
|
|
2345
|
-
privacyPolicyUrl:
|
|
2346
|
-
sectionId:
|
|
2347
|
-
sectionType:
|
|
2395
|
+
privacyPolicyUrl: z27.string().optional(),
|
|
2396
|
+
sectionId: z27.uuid().default(() => uuidv78()),
|
|
2397
|
+
sectionType: z27.literal(SectionType.monetize).default(SectionType.monetize),
|
|
2348
2398
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
2349
|
-
subVertical:
|
|
2399
|
+
subVertical: z27.string().optional(),
|
|
2350
2400
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
2351
|
-
vertical:
|
|
2401
|
+
vertical: z27.string().optional()
|
|
2352
2402
|
});
|
|
2353
2403
|
|
|
2354
2404
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
2355
|
-
import { z as
|
|
2405
|
+
import { z as z28 } from "zod";
|
|
2356
2406
|
|
|
2357
2407
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
2358
2408
|
var GIFT_LABELS = {
|
|
@@ -2471,34 +2521,34 @@ var GIFT_LABELS = {
|
|
|
2471
2521
|
};
|
|
2472
2522
|
|
|
2473
2523
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
2474
|
-
var CABProgressTierExclusion =
|
|
2475
|
-
collectionIds:
|
|
2476
|
-
productIds:
|
|
2477
|
-
tags:
|
|
2478
|
-
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)
|
|
2479
2529
|
});
|
|
2480
|
-
var CABProgressTier =
|
|
2530
|
+
var CABProgressTier = z28.object({
|
|
2481
2531
|
/**
|
|
2482
2532
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
2483
2533
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
2484
2534
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
2485
2535
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
2486
2536
|
*/
|
|
2487
|
-
discount:
|
|
2537
|
+
discount: z28.object({ amount: z28.number().nonnegative(), type: z28.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
2488
2538
|
/**
|
|
2489
2539
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
2490
2540
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
2491
2541
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
2492
2542
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
2493
2543
|
*/
|
|
2494
|
-
exclusions:
|
|
2544
|
+
exclusions: z28.array(CABProgressTierExclusion).default(() => []),
|
|
2495
2545
|
/**
|
|
2496
2546
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
2497
2547
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
2498
2548
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
2499
2549
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
2500
2550
|
*/
|
|
2501
|
-
filterOosVariants:
|
|
2551
|
+
filterOosVariants: z28.boolean().default(false),
|
|
2502
2552
|
/**
|
|
2503
2553
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
2504
2554
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -2506,10 +2556,10 @@ var CABProgressTier = z24.object({
|
|
|
2506
2556
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
2507
2557
|
* tree is complete.
|
|
2508
2558
|
*/
|
|
2509
|
-
gift:
|
|
2510
|
-
productId:
|
|
2511
|
-
title:
|
|
2512
|
-
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(() => [])
|
|
2513
2563
|
}).optional(),
|
|
2514
2564
|
/**
|
|
2515
2565
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -2529,7 +2579,7 @@ var CABProgressTier = z24.object({
|
|
|
2529
2579
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
2530
2580
|
* React's size rather than the old hardcoded 20.
|
|
2531
2581
|
*/
|
|
2532
|
-
iconSizePx:
|
|
2582
|
+
iconSizePx: z28.number().int().min(1).max(64).default(18),
|
|
2533
2583
|
/**
|
|
2534
2584
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
2535
2585
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -2539,35 +2589,35 @@ var CABProgressTier = z24.object({
|
|
|
2539
2589
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
2540
2590
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
2541
2591
|
*/
|
|
2542
|
-
label:
|
|
2592
|
+
label: z28.record(z28.string(), z28.string()).optional(),
|
|
2543
2593
|
/**
|
|
2544
2594
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
2545
2595
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
2546
2596
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
2547
2597
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
2548
2598
|
*/
|
|
2549
|
-
productTierImage:
|
|
2599
|
+
productTierImage: z28.boolean().default(false),
|
|
2550
2600
|
/**
|
|
2551
2601
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
2552
2602
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
2553
2603
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
2554
2604
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
2555
2605
|
*/
|
|
2556
|
-
threshold:
|
|
2606
|
+
threshold: z28.number().int().nonnegative(),
|
|
2557
2607
|
/**
|
|
2558
2608
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
2559
2609
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
2560
2610
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
2561
2611
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
2562
2612
|
*/
|
|
2563
|
-
thresholds:
|
|
2613
|
+
thresholds: z28.record(z28.string(), z28.number().int().nonnegative()).default(() => ({})),
|
|
2564
2614
|
/**
|
|
2565
2615
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
2566
2616
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
2567
2617
|
* shipping bar (single unlabeled tier, no gift).
|
|
2568
2618
|
*/
|
|
2569
|
-
tierId:
|
|
2570
|
-
tierType:
|
|
2619
|
+
tierId: z28.string().optional(),
|
|
2620
|
+
tierType: z28.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
2571
2621
|
/**
|
|
2572
2622
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
2573
2623
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -2578,9 +2628,9 @@ var CABProgressTier = z24.object({
|
|
|
2578
2628
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
2579
2629
|
* template text supplies grammatically-neutral wording around the token.
|
|
2580
2630
|
*/
|
|
2581
|
-
unit:
|
|
2631
|
+
unit: z28.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
2582
2632
|
});
|
|
2583
|
-
var CABProgressBarSection =
|
|
2633
|
+
var CABProgressBarSection = z28.lazy(
|
|
2584
2634
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
2585
2635
|
/**
|
|
2586
2636
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -2589,35 +2639,35 @@ var CABProgressBarSection = z24.lazy(
|
|
|
2589
2639
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
2590
2640
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
2591
2641
|
*/
|
|
2592
|
-
barId:
|
|
2642
|
+
barId: z28.string().optional(),
|
|
2593
2643
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
2594
|
-
countryCodes:
|
|
2644
|
+
countryCodes: z28.array(z28.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
2595
2645
|
/**
|
|
2596
2646
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
2597
2647
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
2598
2648
|
*/
|
|
2599
|
-
excludeCountryCodes:
|
|
2649
|
+
excludeCountryCodes: z28.array(z28.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
2600
2650
|
/**
|
|
2601
2651
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
2602
2652
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
2603
2653
|
* adds the cart's discount allocations back to the live subtotal.
|
|
2604
2654
|
*/
|
|
2605
|
-
excludeDiscountInSubtotal:
|
|
2655
|
+
excludeDiscountInSubtotal: z28.boolean().default(false),
|
|
2606
2656
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
2607
|
-
excludedVariantIds:
|
|
2657
|
+
excludedVariantIds: z28.array(z28.number().int().positive()).default(() => []),
|
|
2608
2658
|
/**
|
|
2609
2659
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
2610
2660
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
2611
2661
|
*/
|
|
2612
|
-
freeShippingOnSubscription:
|
|
2662
|
+
freeShippingOnSubscription: z28.boolean().default(false),
|
|
2613
2663
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
2614
|
-
giftAreaTitle:
|
|
2664
|
+
giftAreaTitle: z28.record(z28.string(), z28.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
2615
2665
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
2616
|
-
giftLabels:
|
|
2617
|
-
addGift:
|
|
2618
|
-
remove:
|
|
2619
|
-
selectOptions:
|
|
2620
|
-
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 }))
|
|
2621
2671
|
}).default(() => ({
|
|
2622
2672
|
addGift: { ...GIFT_LABELS.addGift },
|
|
2623
2673
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -2625,38 +2675,38 @@ var CABProgressBarSection = z24.lazy(
|
|
|
2625
2675
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
2626
2676
|
})),
|
|
2627
2677
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
2628
|
-
name:
|
|
2678
|
+
name: z28.string().default("Order progress"),
|
|
2629
2679
|
/**
|
|
2630
2680
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
2631
2681
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
2632
2682
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
2633
2683
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
2634
2684
|
*/
|
|
2635
|
-
progressColor:
|
|
2636
|
-
sectionType:
|
|
2685
|
+
progressColor: z28.string().optional(),
|
|
2686
|
+
sectionType: z28.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
2637
2687
|
/**
|
|
2638
2688
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
2639
2689
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
2640
2690
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
2641
2691
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
2642
2692
|
*/
|
|
2643
|
-
tiers:
|
|
2693
|
+
tiers: z28.union([z28.array(CABProgressTier), z28.strictObject({}).transform(() => [])]).default(() => [])
|
|
2644
2694
|
})
|
|
2645
2695
|
);
|
|
2646
2696
|
|
|
2647
2697
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
2648
2698
|
import { v7 as uuidv79 } from "uuid";
|
|
2649
|
-
import { z as
|
|
2650
|
-
var CABQuantitySection =
|
|
2699
|
+
import { z as z29 } from "zod";
|
|
2700
|
+
var CABQuantitySection = z29.object({
|
|
2651
2701
|
...CABVariableFields,
|
|
2652
|
-
errorMessages:
|
|
2653
|
-
|
|
2654
|
-
|
|
2702
|
+
errorMessages: z29.record(
|
|
2703
|
+
z29.string(),
|
|
2704
|
+
z29.object({
|
|
2655
2705
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
2656
|
-
increment:
|
|
2657
|
-
max:
|
|
2658
|
-
min:
|
|
2659
|
-
neg:
|
|
2706
|
+
increment: z29.string().optional(),
|
|
2707
|
+
max: z29.string().optional(),
|
|
2708
|
+
min: z29.string().optional(),
|
|
2709
|
+
neg: z29.string().optional()
|
|
2660
2710
|
})
|
|
2661
2711
|
).default({
|
|
2662
2712
|
en: {
|
|
@@ -2666,18 +2716,18 @@ var CABQuantitySection = z25.object({
|
|
|
2666
2716
|
neg: "Quantity cannot be negative"
|
|
2667
2717
|
}
|
|
2668
2718
|
}),
|
|
2669
|
-
inputType:
|
|
2670
|
-
max:
|
|
2671
|
-
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),
|
|
2672
2722
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
2673
|
-
name:
|
|
2674
|
-
sectionId:
|
|
2675
|
-
sectionType:
|
|
2723
|
+
name: z29.string().default("Quantity"),
|
|
2724
|
+
sectionId: z29.uuid().default(() => uuidv79()),
|
|
2725
|
+
sectionType: z29.literal(SectionType.quantity).default(SectionType.quantity)
|
|
2676
2726
|
});
|
|
2677
2727
|
|
|
2678
2728
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
2679
2729
|
import { v7 as uuidv710 } from "uuid";
|
|
2680
|
-
import { z as
|
|
2730
|
+
import { z as z30 } from "zod";
|
|
2681
2731
|
|
|
2682
2732
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
2683
2733
|
var REVIEW_LABELS = {
|
|
@@ -2740,50 +2790,50 @@ var REVIEW_LABELS = {
|
|
|
2740
2790
|
};
|
|
2741
2791
|
|
|
2742
2792
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
2743
|
-
var CABReviewsSection =
|
|
2793
|
+
var CABReviewsSection = z30.object({
|
|
2744
2794
|
...CABVariableFields,
|
|
2745
|
-
color:
|
|
2795
|
+
color: z30.string().default("#fadb14"),
|
|
2746
2796
|
/**
|
|
2747
2797
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
2748
2798
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
2749
2799
|
* or merchant work.
|
|
2750
2800
|
*/
|
|
2751
|
-
countLabels:
|
|
2752
|
-
one:
|
|
2753
|
-
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 }))
|
|
2754
2804
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
2755
|
-
name:
|
|
2756
|
-
sectionId:
|
|
2757
|
-
sectionType:
|
|
2758
|
-
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)
|
|
2759
2809
|
});
|
|
2760
2810
|
|
|
2761
2811
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
2762
2812
|
import { slice } from "es-toolkit/compat";
|
|
2763
2813
|
import { v7 as uuidv711 } from "uuid";
|
|
2764
|
-
import { z as
|
|
2765
|
-
var CABVariantsSection =
|
|
2814
|
+
import { z as z31 } from "zod";
|
|
2815
|
+
var CABVariantsSection = z31.object({
|
|
2766
2816
|
...CABVariableFields,
|
|
2767
|
-
hideOutOfStockVariants:
|
|
2768
|
-
name:
|
|
2769
|
-
sectionId:
|
|
2770
|
-
sectionType:
|
|
2771
|
-
selector:
|
|
2772
|
-
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)
|
|
2773
2823
|
});
|
|
2774
2824
|
|
|
2775
2825
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
2776
|
-
var CABBorder =
|
|
2777
|
-
radius:
|
|
2778
|
-
style:
|
|
2779
|
-
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)
|
|
2780
2830
|
}).default({
|
|
2781
2831
|
radius: BorderRadius.base,
|
|
2782
2832
|
style: BorderStyle.none,
|
|
2783
2833
|
width: BorderWidth.base
|
|
2784
2834
|
});
|
|
2785
|
-
var CABSection =
|
|
2786
|
-
() =>
|
|
2835
|
+
var CABSection = z32.lazy(
|
|
2836
|
+
() => z32.discriminatedUnion("sectionType", [
|
|
2787
2837
|
CABBannerSection,
|
|
2788
2838
|
CABButtonSection,
|
|
2789
2839
|
CABCarouselSection,
|
|
@@ -2805,32 +2855,32 @@ var CABSection = z28.lazy(
|
|
|
2805
2855
|
);
|
|
2806
2856
|
|
|
2807
2857
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
2808
|
-
var GridItem =
|
|
2809
|
-
var CABLayoutSection =
|
|
2858
|
+
var GridItem = z33.union([z33.literal("auto"), z33.literal("fill"), z33.string().regex(/^\d+%$/), z33.number()]);
|
|
2859
|
+
var CABLayoutSection = z33.object({
|
|
2810
2860
|
...CABVariableFields,
|
|
2811
|
-
alignment:
|
|
2812
|
-
horizontal:
|
|
2813
|
-
vertical:
|
|
2861
|
+
alignment: z33.object({
|
|
2862
|
+
horizontal: z33.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
2863
|
+
vertical: z33.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
2814
2864
|
}).default({
|
|
2815
2865
|
horizontal: HorizontalAlignment.start,
|
|
2816
2866
|
vertical: VerticalAlignment.top
|
|
2817
2867
|
}),
|
|
2818
|
-
border:
|
|
2819
|
-
buttonField:
|
|
2820
|
-
direction:
|
|
2821
|
-
grid:
|
|
2822
|
-
columns:
|
|
2823
|
-
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"])
|
|
2824
2874
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
2825
|
-
name:
|
|
2826
|
-
padding:
|
|
2827
|
-
sectionId:
|
|
2828
|
-
sections:
|
|
2829
|
-
sectionType:
|
|
2830
|
-
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),
|
|
2831
2881
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
2832
|
-
viewUrl:
|
|
2833
|
-
width:
|
|
2882
|
+
viewUrl: z33.string().optional(),
|
|
2883
|
+
width: z33.number().default(100)
|
|
2834
2884
|
});
|
|
2835
2885
|
|
|
2836
2886
|
// src/schema/widgets/checkout-and-beyond/uiLabels.ts
|
|
@@ -2851,8 +2901,8 @@ var UI_LABELS = {
|
|
|
2851
2901
|
};
|
|
2852
2902
|
|
|
2853
2903
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
2854
|
-
var localized = (fallback) =>
|
|
2855
|
-
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({
|
|
2856
2906
|
currentPage: localized(UI_LABELS.currentPage),
|
|
2857
2907
|
guest: localized(UI_LABELS.guest),
|
|
2858
2908
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -2877,154 +2927,154 @@ var CABUILabels = z30.object({
|
|
|
2877
2927
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
2878
2928
|
updating: { ...UI_LABELS.updating }
|
|
2879
2929
|
}));
|
|
2880
|
-
var TargetArea =
|
|
2881
|
-
fill:
|
|
2882
|
-
flip:
|
|
2883
|
-
icon:
|
|
2884
|
-
label:
|
|
2885
|
-
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()
|
|
2886
2936
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
2887
|
-
var CABTracking =
|
|
2888
|
-
enableAttribution:
|
|
2889
|
-
enableSource:
|
|
2890
|
-
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)
|
|
2891
2941
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
2892
|
-
var CABExperiment =
|
|
2893
|
-
elementId:
|
|
2894
|
-
experimentId:
|
|
2895
|
-
experimentType:
|
|
2896
|
-
selectedId:
|
|
2942
|
+
var CABExperiment = z34.object({
|
|
2943
|
+
elementId: z34.number(),
|
|
2944
|
+
experimentId: z34.number(),
|
|
2945
|
+
experimentType: z34.string(),
|
|
2946
|
+
selectedId: z34.number()
|
|
2897
2947
|
});
|
|
2898
2948
|
var CABRootSection = CABLayoutSection.extend({
|
|
2899
|
-
editorMode:
|
|
2949
|
+
editorMode: z34.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
2900
2950
|
experiment: CABExperiment.optional(),
|
|
2901
2951
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
2902
2952
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
2903
|
-
previewMode:
|
|
2904
|
-
storeId:
|
|
2953
|
+
previewMode: z34.boolean().nullish().transform((value) => value ?? false),
|
|
2954
|
+
storeId: z34.number().nullable().default(null),
|
|
2905
2955
|
targetArea: TargetArea.nullable(),
|
|
2906
2956
|
tracking: CABTracking,
|
|
2907
|
-
type:
|
|
2957
|
+
type: z34.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
2908
2958
|
uiLabels: CABUILabels,
|
|
2909
|
-
version:
|
|
2910
|
-
widgetId:
|
|
2959
|
+
version: z34.literal(2).default(2),
|
|
2960
|
+
widgetId: z34.number().nullable().default(null)
|
|
2911
2961
|
});
|
|
2912
2962
|
|
|
2913
2963
|
// src/schema/widgets/contentBlock.ts
|
|
2914
|
-
var ContentBlockV1 =
|
|
2915
|
-
blockSpacing:
|
|
2916
|
-
imageBlocks:
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
altText:
|
|
2920
|
-
description:
|
|
2921
|
-
id:
|
|
2922
|
-
imagePlacement:
|
|
2923
|
-
imageSize:
|
|
2924
|
-
imageUrl:
|
|
2925
|
-
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"]),
|
|
2926
2976
|
/** Inline scale only: an image caption can never be a block-level heading. */
|
|
2927
|
-
textSize:
|
|
2977
|
+
textSize: z35.enum(inlineTextSizeNames)
|
|
2928
2978
|
})
|
|
2929
2979
|
),
|
|
2930
|
-
|
|
2980
|
+
z35.strictObject({}).transform(() => [])
|
|
2931
2981
|
]).optional(),
|
|
2932
|
-
imageLayout:
|
|
2933
|
-
language:
|
|
2934
|
-
description:
|
|
2935
|
-
superTitle:
|
|
2936
|
-
title:
|
|
2982
|
+
imageLayout: z35.enum(["row", "column"]).optional(),
|
|
2983
|
+
language: z35.object({
|
|
2984
|
+
description: z35.string(),
|
|
2985
|
+
superTitle: z35.string(),
|
|
2986
|
+
title: z35.string()
|
|
2937
2987
|
}),
|
|
2938
|
-
previewMode:
|
|
2939
|
-
type:
|
|
2940
|
-
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)
|
|
2941
2991
|
});
|
|
2942
|
-
var ContentBlock =
|
|
2992
|
+
var ContentBlock = z35.discriminatedUnion("version", [
|
|
2943
2993
|
ContentBlockV1,
|
|
2944
2994
|
CABRootSection.extend({
|
|
2945
|
-
type:
|
|
2995
|
+
type: z35.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block)
|
|
2946
2996
|
})
|
|
2947
2997
|
]);
|
|
2948
2998
|
|
|
2949
2999
|
// src/schema/widgets/giftWithPurchase.ts
|
|
2950
|
-
import { z as
|
|
2951
|
-
var GiftWithPurchase =
|
|
2952
|
-
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)
|
|
2953
3003
|
});
|
|
2954
3004
|
|
|
2955
3005
|
// src/schema/widgets/lineItemEditor.ts
|
|
2956
|
-
import { z as
|
|
2957
|
-
var LineItemEditorSwitchLanguageV1 =
|
|
2958
|
-
downgradeToOneTimeLabel:
|
|
3006
|
+
import { z as z37 } from "zod";
|
|
3007
|
+
var LineItemEditorSwitchLanguageV1 = z37.object({
|
|
3008
|
+
downgradeToOneTimeLabel: z37.string().optional(),
|
|
2959
3009
|
/** Frequency-option template (`{{frequency}}`/`{{interval}}`) for the plan select. */
|
|
2960
|
-
subscriptionOptionLabel:
|
|
2961
|
-
upgradeToSubscriptionLabel:
|
|
2962
|
-
upgradeToSubscriptionWithoutDiscountLabel:
|
|
3010
|
+
subscriptionOptionLabel: z37.string().optional(),
|
|
3011
|
+
upgradeToSubscriptionLabel: z37.string().optional(),
|
|
3012
|
+
upgradeToSubscriptionWithoutDiscountLabel: z37.string().optional()
|
|
2963
3013
|
});
|
|
2964
|
-
var LineItemEditorV1 =
|
|
3014
|
+
var LineItemEditorV1 = z37.object({
|
|
2965
3015
|
/** Legacy `getStyles` button style; the converter carries a valid kind, defaulting to `plain`. */
|
|
2966
|
-
button:
|
|
2967
|
-
previewMode:
|
|
2968
|
-
switchToSubscription:
|
|
2969
|
-
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(),
|
|
2970
3020
|
language: LineItemEditorSwitchLanguageV1.optional()
|
|
2971
3021
|
}).optional(),
|
|
2972
|
-
switchToSubscriptionEnabled:
|
|
2973
|
-
tracking:
|
|
2974
|
-
enableAttribution:
|
|
2975
|
-
enableSource:
|
|
2976
|
-
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()
|
|
2977
3027
|
}).optional(),
|
|
2978
|
-
type:
|
|
2979
|
-
version:
|
|
3028
|
+
type: z37.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor),
|
|
3029
|
+
version: z37.literal(1)
|
|
2980
3030
|
});
|
|
2981
|
-
var LineItemEditor =
|
|
3031
|
+
var LineItemEditor = z37.discriminatedUnion("version", [
|
|
2982
3032
|
LineItemEditorV1,
|
|
2983
3033
|
CABRootSection.extend({
|
|
2984
|
-
type:
|
|
3034
|
+
type: z37.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor)
|
|
2985
3035
|
})
|
|
2986
3036
|
]);
|
|
2987
3037
|
|
|
2988
3038
|
// src/schema/widgets/progressBar.ts
|
|
2989
|
-
import { z as
|
|
2990
|
-
var ProgressBar =
|
|
2991
|
-
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)
|
|
2992
3042
|
});
|
|
2993
3043
|
|
|
2994
3044
|
// src/schema/widgets/rebuyButton.ts
|
|
2995
|
-
import { z as
|
|
2996
|
-
var RebuyButtonV1 =
|
|
2997
|
-
type:
|
|
2998
|
-
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)
|
|
2999
3049
|
});
|
|
3000
|
-
var RebuyButton =
|
|
3050
|
+
var RebuyButton = z39.discriminatedUnion("version", [
|
|
3001
3051
|
RebuyButtonV1,
|
|
3002
3052
|
CABRootSection.extend({
|
|
3003
|
-
type:
|
|
3053
|
+
type: z39.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button)
|
|
3004
3054
|
})
|
|
3005
3055
|
]);
|
|
3006
3056
|
|
|
3007
3057
|
// src/schema/widgets/rebuyMonetize.ts
|
|
3008
|
-
import { z as
|
|
3009
|
-
var RebuyMonetize =
|
|
3010
|
-
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)
|
|
3011
3061
|
});
|
|
3012
|
-
var RebuyMonetizeV1 =
|
|
3013
|
-
name:
|
|
3014
|
-
previewMode:
|
|
3062
|
+
var RebuyMonetizeV1 = z40.object({
|
|
3063
|
+
name: z40.string().nullable().optional(),
|
|
3064
|
+
previewMode: z40.boolean().optional(),
|
|
3015
3065
|
/** Privacy Policy footer href → the marker section's `privacyPolicyUrl`. */
|
|
3016
|
-
privacyPolicyUrl:
|
|
3066
|
+
privacyPolicyUrl: z40.string().nullable().optional(),
|
|
3017
3067
|
/** Ads-taxonomy sub-vertical id — one of the admin Monetize editor's two configurables. */
|
|
3018
|
-
subVertical:
|
|
3019
|
-
tracking:
|
|
3020
|
-
enableAttribution:
|
|
3021
|
-
enableSource:
|
|
3022
|
-
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()
|
|
3023
3073
|
}).optional(),
|
|
3024
|
-
type:
|
|
3025
|
-
version:
|
|
3074
|
+
type: z40.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad),
|
|
3075
|
+
version: z40.literal(1),
|
|
3026
3076
|
/** Ads-taxonomy vertical id — one of the admin Monetize editor's two configurables. */
|
|
3027
|
-
vertical:
|
|
3077
|
+
vertical: z40.string().nullable().optional()
|
|
3028
3078
|
});
|
|
3029
3079
|
|
|
3030
3080
|
// src/schema/widgetData.ts
|
|
@@ -3038,7 +3088,7 @@ var extensionWidgetTypes = [
|
|
|
3038
3088
|
WidgetType.ui_extension_line_item_editor,
|
|
3039
3089
|
WidgetType.ui_extension_progress_bar
|
|
3040
3090
|
];
|
|
3041
|
-
var WidgetData =
|
|
3091
|
+
var WidgetData = z41.discriminatedUnion("type", [
|
|
3042
3092
|
ABTestingPlaceholder,
|
|
3043
3093
|
CheckoutExtension,
|
|
3044
3094
|
ContentBlock,
|
|
@@ -3399,15 +3449,15 @@ var SWITCH_LABELS = {
|
|
|
3399
3449
|
|
|
3400
3450
|
// src/schema/widgets/post-purchase-offer/common.ts
|
|
3401
3451
|
import { replace, toNumber, toString } from "es-toolkit/compat";
|
|
3402
|
-
import { z as
|
|
3403
|
-
var strictNumber =
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
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)
|
|
3407
3457
|
]);
|
|
3408
3458
|
|
|
3409
3459
|
// src/schema/widgets/post-purchase-offer/constants.ts
|
|
3410
|
-
import { z as
|
|
3460
|
+
import { z as z43 } from "zod";
|
|
3411
3461
|
var blockTypes = [
|
|
3412
3462
|
"callout_banner",
|
|
3413
3463
|
"image",
|
|
@@ -3418,144 +3468,144 @@ var blockTypes = [
|
|
|
3418
3468
|
"text",
|
|
3419
3469
|
"timer"
|
|
3420
3470
|
];
|
|
3421
|
-
var blockType =
|
|
3471
|
+
var blockType = z43.enum(blockTypes);
|
|
3422
3472
|
var BlockType = blockType.enum;
|
|
3423
3473
|
|
|
3424
3474
|
// src/schema/widgets/post-purchase-offer/postPurchaseBlocks.ts
|
|
3425
3475
|
import { get as get3, isEqual } from "es-toolkit/compat";
|
|
3426
3476
|
import { v4 as uuidv42 } from "uuid";
|
|
3427
|
-
import { z as
|
|
3428
|
-
var TextAlignment2 =
|
|
3429
|
-
var TextSize =
|
|
3430
|
-
|
|
3431
|
-
|
|
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")
|
|
3432
3482
|
]);
|
|
3433
|
-
var CalloutBannerBlock =
|
|
3434
|
-
id:
|
|
3435
|
-
name:
|
|
3436
|
-
settings:
|
|
3437
|
-
superTitle:
|
|
3438
|
-
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")
|
|
3439
3489
|
}),
|
|
3440
|
-
styles:
|
|
3441
|
-
superTitleEmphasized:
|
|
3490
|
+
styles: z44.object({
|
|
3491
|
+
superTitleEmphasized: z44.boolean().default(false),
|
|
3442
3492
|
superTitleSize: TextSize.default("large"),
|
|
3443
3493
|
textAlignment: TextAlignment2.default("center"),
|
|
3444
|
-
titleEmphasized:
|
|
3494
|
+
titleEmphasized: z44.boolean().default(true),
|
|
3445
3495
|
titleSize: TextSize.default("large")
|
|
3446
3496
|
}),
|
|
3447
|
-
type:
|
|
3497
|
+
type: z44.literal(BlockType.callout_banner).default(BlockType.callout_banner)
|
|
3448
3498
|
});
|
|
3449
|
-
var ImageBlock =
|
|
3450
|
-
id:
|
|
3451
|
-
name:
|
|
3452
|
-
settings:
|
|
3453
|
-
|
|
3499
|
+
var ImageBlock = z44.object({
|
|
3500
|
+
id: z44.string().optional().default(() => uuidv42()),
|
|
3501
|
+
name: z44.string().optional(),
|
|
3502
|
+
settings: z44.union([
|
|
3503
|
+
z44.object({
|
|
3454
3504
|
/** This isn't used in the post-purchase offer widget */
|
|
3455
|
-
alt:
|
|
3456
|
-
image:
|
|
3457
|
-
imageSize:
|
|
3458
|
-
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")
|
|
3459
3509
|
}),
|
|
3460
|
-
|
|
3510
|
+
z44.array(z44.never()).transform(() => ({}))
|
|
3461
3511
|
]),
|
|
3462
|
-
type:
|
|
3512
|
+
type: z44.literal(BlockType.image).default(BlockType.image)
|
|
3463
3513
|
});
|
|
3464
|
-
var ImageContentBlock =
|
|
3465
|
-
id:
|
|
3466
|
-
name:
|
|
3467
|
-
settings:
|
|
3468
|
-
alt:
|
|
3469
|
-
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(
|
|
3470
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."
|
|
3471
3521
|
),
|
|
3472
3522
|
descriptionSize: TextSize.default("medium"),
|
|
3473
3523
|
horizontalAlignment: TextAlignment2.default("leading"),
|
|
3474
|
-
image:
|
|
3475
|
-
imagePlacement:
|
|
3476
|
-
imageSize:
|
|
3477
|
-
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!"),
|
|
3478
3528
|
superTitleSize: TextSize.default("medium"),
|
|
3479
3529
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3480
|
-
swapContent:
|
|
3481
|
-
title:
|
|
3530
|
+
swapContent: z44.boolean().optional().default(false),
|
|
3531
|
+
title: z44.union([z44.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet"),
|
|
3482
3532
|
titleSize: TextSize.default("medium")
|
|
3483
3533
|
}),
|
|
3484
|
-
type:
|
|
3534
|
+
type: z44.literal(BlockType.image_content).default(BlockType.image_content)
|
|
3485
3535
|
});
|
|
3486
|
-
var PayButtonBlock =
|
|
3487
|
-
id:
|
|
3488
|
-
name:
|
|
3489
|
-
settings:
|
|
3490
|
-
|
|
3491
|
-
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")
|
|
3492
3542
|
}),
|
|
3493
|
-
|
|
3543
|
+
z44.array(z44.never()).transform(() => ({
|
|
3494
3544
|
label: "Pay Now"
|
|
3495
3545
|
}))
|
|
3496
3546
|
]),
|
|
3497
|
-
styles:
|
|
3498
|
-
|
|
3499
|
-
buttonWidth:
|
|
3547
|
+
styles: z44.union([
|
|
3548
|
+
z44.object({
|
|
3549
|
+
buttonWidth: z44.number().min(10).max(100).default(50)
|
|
3500
3550
|
}),
|
|
3501
|
-
|
|
3551
|
+
z44.array(z44.never()).transform(() => ({
|
|
3502
3552
|
buttonWidth: 50
|
|
3503
3553
|
}))
|
|
3504
3554
|
]),
|
|
3505
|
-
type:
|
|
3555
|
+
type: z44.literal(BlockType.pay_button).default(BlockType.pay_button)
|
|
3506
3556
|
});
|
|
3507
|
-
var ProductInformationBlock =
|
|
3557
|
+
var ProductInformationBlock = z44.object({
|
|
3508
3558
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3509
|
-
hideProductImage:
|
|
3510
|
-
id:
|
|
3511
|
-
name:
|
|
3512
|
-
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)
|
|
3513
3563
|
});
|
|
3514
|
-
var SeparatorBlock =
|
|
3515
|
-
id:
|
|
3516
|
-
name:
|
|
3517
|
-
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)
|
|
3518
3568
|
});
|
|
3519
|
-
var TextBlock =
|
|
3520
|
-
id:
|
|
3521
|
-
name:
|
|
3522
|
-
settings:
|
|
3523
|
-
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(
|
|
3524
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."
|
|
3525
3575
|
),
|
|
3526
3576
|
/** This isn't used in the post-purchase offer widget */
|
|
3527
3577
|
descriptionSize: TextSize.default("medium"),
|
|
3528
3578
|
horizontalAlignment: TextAlignment2.default("leading"),
|
|
3529
|
-
superTitle:
|
|
3579
|
+
superTitle: z44.union([z44.string(), TiptapDocument]).default("Super Title"),
|
|
3530
3580
|
/** This isn't used in the post-purchase offer widget */
|
|
3531
3581
|
superTitleSize: TextSize.default("medium"),
|
|
3532
|
-
title:
|
|
3582
|
+
title: z44.union([z44.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet."),
|
|
3533
3583
|
/** This isn't used in the post-purchase offer widget */
|
|
3534
3584
|
titleSize: TextSize.default("medium")
|
|
3535
3585
|
}),
|
|
3536
|
-
type:
|
|
3586
|
+
type: z44.literal(BlockType.text).default(BlockType.text)
|
|
3537
3587
|
});
|
|
3538
|
-
var TimerBlock =
|
|
3539
|
-
id:
|
|
3540
|
-
name:
|
|
3541
|
-
settings:
|
|
3542
|
-
durationMinutes:
|
|
3543
|
-
durationSeconds:
|
|
3544
|
-
endOffer:
|
|
3545
|
-
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:")
|
|
3546
3596
|
}),
|
|
3547
|
-
styles:
|
|
3597
|
+
styles: z44.object({
|
|
3548
3598
|
textAlignment: TextAlignment2.default("center"),
|
|
3549
|
-
timerBackgroundColor:
|
|
3550
|
-
timerEmphasized:
|
|
3599
|
+
timerBackgroundColor: z44.enum(["info", "warning", "success", "critical"]).default("warning"),
|
|
3600
|
+
timerEmphasized: z44.union([z44.boolean(), z44.unknown().transform(() => true)]).default(true),
|
|
3551
3601
|
timerSize: TextSize.default("medium"),
|
|
3552
|
-
timerWidth:
|
|
3553
|
-
titleEmphasized:
|
|
3602
|
+
timerWidth: z44.number().min(10).max(100).optional().default(100),
|
|
3603
|
+
titleEmphasized: z44.union([z44.boolean(), z44.unknown().transform(() => true)]).default(false),
|
|
3554
3604
|
titleSize: TextSize.default("medium")
|
|
3555
3605
|
}),
|
|
3556
|
-
type:
|
|
3606
|
+
type: z44.literal(BlockType.timer).default(BlockType.timer)
|
|
3557
3607
|
});
|
|
3558
|
-
var PostPurchaseBlock =
|
|
3608
|
+
var PostPurchaseBlock = z44.discriminatedUnion("type", [
|
|
3559
3609
|
CalloutBannerBlock,
|
|
3560
3610
|
ImageBlock,
|
|
3561
3611
|
ImageContentBlock,
|
|
@@ -3575,68 +3625,68 @@ var isTextBlock = (block) => isEqual(get3(block, "type"), BlockType.text);
|
|
|
3575
3625
|
var isTimerBlock = (block) => isEqual(get3(block, "type"), BlockType.timer);
|
|
3576
3626
|
|
|
3577
3627
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
3578
|
-
import { z as
|
|
3628
|
+
import { z as z47 } from "zod";
|
|
3579
3629
|
|
|
3580
3630
|
// src/schema/widgets/post-purchase-offer/postPurchaseWidget.ts
|
|
3581
|
-
import { z as
|
|
3631
|
+
import { z as z46 } from "zod";
|
|
3582
3632
|
|
|
3583
3633
|
// src/schema/widgets/post-purchase-offer/postPurchaseSettings.ts
|
|
3584
|
-
import { z as
|
|
3585
|
-
var PostPurchaseSettings =
|
|
3586
|
-
advance:
|
|
3587
|
-
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(() => [
|
|
3588
3638
|
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.timer }),
|
|
3589
3639
|
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.callout_banner }),
|
|
3590
3640
|
PostPurchaseBlock.parse({ type: BlockType.product_information })
|
|
3591
3641
|
]),
|
|
3592
|
-
columnLayout:
|
|
3593
|
-
discount:
|
|
3642
|
+
columnLayout: z45.boolean().optional(),
|
|
3643
|
+
discount: z45.object({
|
|
3594
3644
|
amount: strictNumber.default(30),
|
|
3595
|
-
shouldShowSavingText:
|
|
3596
|
-
type:
|
|
3645
|
+
shouldShowSavingText: z45.boolean().optional().default(true),
|
|
3646
|
+
type: z45.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
3597
3647
|
}),
|
|
3598
|
-
discountedFrom:
|
|
3599
|
-
endpoint:
|
|
3600
|
-
integrations:
|
|
3601
|
-
judgeme:
|
|
3602
|
-
junip:
|
|
3603
|
-
klaviyo:
|
|
3604
|
-
loox:
|
|
3605
|
-
okendo:
|
|
3606
|
-
opinew:
|
|
3607
|
-
reviewsio:
|
|
3608
|
-
stamped:
|
|
3609
|
-
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)
|
|
3610
3660
|
}),
|
|
3611
|
-
key:
|
|
3612
|
-
language:
|
|
3613
|
-
description:
|
|
3614
|
-
descriptionEnabled:
|
|
3615
|
-
descriptionRte:
|
|
3616
|
-
content:
|
|
3617
|
-
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()
|
|
3618
3668
|
}).optional(),
|
|
3619
|
-
descriptionSpacing:
|
|
3620
|
-
displayCtaPrice:
|
|
3621
|
-
global:
|
|
3622
|
-
declineAll:
|
|
3623
|
-
declineThisOffer:
|
|
3624
|
-
free:
|
|
3625
|
-
notAvailable:
|
|
3626
|
-
payNow:
|
|
3627
|
-
payNowUpgradeToSubscription:
|
|
3628
|
-
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"),
|
|
3629
3679
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3630
|
-
recurringShipping:
|
|
3631
|
-
recurringSubtotal:
|
|
3632
|
-
reviewsPlural:
|
|
3633
|
-
reviewsSingular:
|
|
3634
|
-
save:
|
|
3635
|
-
shipping:
|
|
3636
|
-
subscriptionOption:
|
|
3637
|
-
subtotal:
|
|
3638
|
-
taxes:
|
|
3639
|
-
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")
|
|
3640
3690
|
}).optional().default(() => ({
|
|
3641
3691
|
declineAll: "Decline All",
|
|
3642
3692
|
declineThisOffer: "Decline this offer",
|
|
@@ -3657,70 +3707,70 @@ var PostPurchaseSettings = z41.object({
|
|
|
3657
3707
|
taxes: "Taxes",
|
|
3658
3708
|
total: "Total"
|
|
3659
3709
|
})),
|
|
3660
|
-
globalTranslation:
|
|
3710
|
+
globalTranslation: z45.string().optional().default("english")
|
|
3661
3711
|
}),
|
|
3662
|
-
metafields:
|
|
3712
|
+
metafields: z45.boolean().default(false),
|
|
3663
3713
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3664
|
-
offer:
|
|
3665
|
-
count:
|
|
3714
|
+
offer: z45.object({
|
|
3715
|
+
count: z45.number().default(1)
|
|
3666
3716
|
}),
|
|
3667
|
-
offersLayout:
|
|
3668
|
-
itemsPerPage:
|
|
3669
|
-
type:
|
|
3717
|
+
offersLayout: z45.object({
|
|
3718
|
+
itemsPerPage: z45.number().optional(),
|
|
3719
|
+
type: z45.enum(["list", "grid", "carousel"]).default("list")
|
|
3670
3720
|
}).optional().default({
|
|
3671
3721
|
type: "list"
|
|
3672
3722
|
}),
|
|
3673
3723
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3674
|
-
previewMode:
|
|
3675
|
-
productLimit:
|
|
3676
|
-
productOptions:
|
|
3724
|
+
previewMode: z45.boolean().default(false),
|
|
3725
|
+
productLimit: z45.number().optional().default(1),
|
|
3726
|
+
productOptions: z45.object({
|
|
3677
3727
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3678
|
-
hideOutOfStockVariants:
|
|
3679
|
-
matchVariant:
|
|
3680
|
-
showDeclineAll:
|
|
3681
|
-
showShipping:
|
|
3682
|
-
showSubtotal:
|
|
3683
|
-
showTaxes:
|
|
3684
|
-
showTotal:
|
|
3685
|
-
showVariantSelectors:
|
|
3686
|
-
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")
|
|
3687
3737
|
}),
|
|
3688
|
-
productType:
|
|
3689
|
-
productTypeSelector:
|
|
3690
|
-
quantityInputs:
|
|
3691
|
-
defaultQuantity:
|
|
3692
|
-
enabled:
|
|
3693
|
-
maxValue:
|
|
3694
|
-
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)
|
|
3695
3745
|
}),
|
|
3696
|
-
shipping:
|
|
3746
|
+
shipping: z45.object({
|
|
3697
3747
|
amount: strictNumber.default(10),
|
|
3698
3748
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3699
|
-
enabled:
|
|
3700
|
-
title:
|
|
3701
|
-
type:
|
|
3749
|
+
enabled: z45.boolean().default(true),
|
|
3750
|
+
title: z45.string().optional().default("Shipping Fees"),
|
|
3751
|
+
type: z45.enum(["free", "fixed_amount"]).default("free")
|
|
3702
3752
|
}),
|
|
3703
|
-
styles:
|
|
3704
|
-
starColor:
|
|
3705
|
-
starSize:
|
|
3706
|
-
starStrokeColor:
|
|
3707
|
-
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")
|
|
3708
3758
|
}).optional(),
|
|
3709
|
-
subImages:
|
|
3710
|
-
subscription:
|
|
3711
|
-
discount:
|
|
3759
|
+
subImages: z45.number().nullish().default(8),
|
|
3760
|
+
subscription: z45.object({
|
|
3761
|
+
discount: z45.object({
|
|
3712
3762
|
amount: strictNumber.default(30),
|
|
3713
|
-
shouldShowSavingText:
|
|
3714
|
-
type:
|
|
3763
|
+
shouldShowSavingText: z45.boolean().optional().default(true),
|
|
3764
|
+
type: z45.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
3715
3765
|
}),
|
|
3716
|
-
shipping:
|
|
3766
|
+
shipping: z45.object({
|
|
3717
3767
|
amount: strictNumber.default(1),
|
|
3718
3768
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3719
|
-
enabled:
|
|
3769
|
+
enabled: z45.boolean().default(true),
|
|
3720
3770
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3721
3771
|
recurringAmount: strictNumber.default(2),
|
|
3722
|
-
shippingTitle:
|
|
3723
|
-
type:
|
|
3772
|
+
shippingTitle: z45.string().default("Shipping Fees"),
|
|
3773
|
+
type: z45.enum(["free", "fixed_amount"]).default("free")
|
|
3724
3774
|
})
|
|
3725
3775
|
}).optional().default({
|
|
3726
3776
|
discount: {
|
|
@@ -3738,15 +3788,15 @@ var PostPurchaseSettings = z41.object({
|
|
|
3738
3788
|
type: "free"
|
|
3739
3789
|
}
|
|
3740
3790
|
}),
|
|
3741
|
-
subscriptionIsDefault:
|
|
3791
|
+
subscriptionIsDefault: z45.boolean().optional(),
|
|
3742
3792
|
/** This isn't configurable in the admin-nextjs editor */
|
|
3743
|
-
template:
|
|
3744
|
-
type:
|
|
3745
|
-
upgradeToSubscription:
|
|
3746
|
-
acceptButtonText:
|
|
3747
|
-
allow:
|
|
3748
|
-
emailRefundNotice:
|
|
3749
|
-
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")
|
|
3750
3800
|
}).optional().default(() => ({
|
|
3751
3801
|
acceptButtonText: "Upgrade",
|
|
3752
3802
|
allow: false,
|
|
@@ -3756,32 +3806,32 @@ var PostPurchaseSettings = z41.object({
|
|
|
3756
3806
|
});
|
|
3757
3807
|
|
|
3758
3808
|
// src/schema/widgets/post-purchase-offer/postPurchaseWidget.ts
|
|
3759
|
-
var PostPurchaseWidgetLinkedFlow =
|
|
3760
|
-
id:
|
|
3761
|
-
name:
|
|
3809
|
+
var PostPurchaseWidgetLinkedFlow = z46.object({
|
|
3810
|
+
id: z46.number(),
|
|
3811
|
+
name: z46.string()
|
|
3762
3812
|
});
|
|
3763
|
-
var PostPurchaseWidget =
|
|
3764
|
-
classification:
|
|
3765
|
-
createdAtTime:
|
|
3766
|
-
customEndpointName:
|
|
3767
|
-
id:
|
|
3768
|
-
lastViewed:
|
|
3769
|
-
linkedCustomEndpointId:
|
|
3770
|
-
linkedFlows:
|
|
3771
|
-
name:
|
|
3772
|
-
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(),
|
|
3773
3823
|
settings: PostPurchaseSettings
|
|
3774
3824
|
});
|
|
3775
3825
|
|
|
3776
3826
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
3777
|
-
var PostPurchaseOffer =
|
|
3778
|
-
|
|
3779
|
-
errors:
|
|
3780
|
-
message:
|
|
3781
|
-
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)
|
|
3782
3832
|
}),
|
|
3783
|
-
|
|
3784
|
-
successful:
|
|
3833
|
+
z47.strictObject({
|
|
3834
|
+
successful: z47.literal(true),
|
|
3785
3835
|
widget: PostPurchaseWidget
|
|
3786
3836
|
})
|
|
3787
3837
|
]);
|
|
@@ -4925,6 +4975,8 @@ export {
|
|
|
4925
4975
|
DESCRIPTION_LABELS,
|
|
4926
4976
|
DYNAMIC_TOKEN_ANYWHERE_REGEX,
|
|
4927
4977
|
DYNAMIC_TOKEN_REGEX,
|
|
4978
|
+
DecideRequestSchema,
|
|
4979
|
+
DecisionEntrySchema,
|
|
4928
4980
|
Direction,
|
|
4929
4981
|
DiscountSource,
|
|
4930
4982
|
DiscountType,
|
|
@@ -4954,11 +5006,18 @@ export {
|
|
|
4954
5006
|
ObjectFit,
|
|
4955
5007
|
OfferProduct,
|
|
4956
5008
|
OffersDirection,
|
|
5009
|
+
POST_PURCHASE_SKIP_LIMIT,
|
|
4957
5010
|
PayButtonBlock,
|
|
4958
5011
|
PopoverPosition,
|
|
4959
5012
|
PostPurchaseBlock,
|
|
4960
5013
|
PostPurchaseOffer,
|
|
5014
|
+
PostPurchaseOrderIdSchema,
|
|
4961
5015
|
PostPurchaseSettings,
|
|
5016
|
+
PostPurchaseShadowReportSchema,
|
|
5017
|
+
PostPurchaseShadowSelectionSchema,
|
|
5018
|
+
PostPurchaseSkipReason,
|
|
5019
|
+
PostPurchaseSkipTrace,
|
|
5020
|
+
PostPurchaseTimestampSchema,
|
|
4962
5021
|
PostPurchaseWidget,
|
|
4963
5022
|
PostPurchaseWidgetLinkedFlow,
|
|
4964
5023
|
Product,
|
|
@@ -4991,6 +5050,7 @@ export {
|
|
|
4991
5050
|
SeparatorBlock,
|
|
4992
5051
|
Session,
|
|
4993
5052
|
ShopConfig,
|
|
5053
|
+
ShopifyDomainSchema,
|
|
4994
5054
|
SmartCartBar,
|
|
4995
5055
|
SmartCartComponent,
|
|
4996
5056
|
SmartCartConfig,
|