@rebuy/rebuy 2.2.0-rc.2 → 2.2.0-rc.4
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.js +185 -185
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +17 -17
- package/dist/index.mjs.map +1 -1
- package/dist/schema/button.d.ts +5 -5
- package/dist/schema/button.d.ts.map +1 -1
- package/dist/schema/common.d.ts +1 -1
- package/dist/schema/common.d.ts.map +1 -1
- package/dist/schema/constants.d.ts +1 -1
- package/dist/schema/constants.d.ts.map +1 -1
- package/dist/schema/data-source.d.ts +1 -1
- package/dist/schema/data-source.d.ts.map +1 -1
- package/dist/schema/image.d.ts +1 -1
- package/dist/schema/image.d.ts.map +1 -1
- package/dist/schema/layout.d.ts +3 -3
- package/dist/schema/layout.d.ts.map +1 -1
- package/dist/schema/offers.d.ts +2 -3
- package/dist/schema/offers.d.ts.map +1 -1
- package/dist/schema/product.d.ts +2 -2
- package/dist/schema/product.d.ts.map +1 -1
- package/dist/schema/products.d.ts +2 -2
- package/dist/schema/products.d.ts.map +1 -1
- package/dist/schema/quantity.d.ts +1 -1
- package/dist/schema/quantity.d.ts.map +1 -1
- package/dist/schema/reviews.d.ts +1 -1
- package/dist/schema/reviews.d.ts.map +1 -1
- package/dist/schema/root.d.ts +1 -1
- package/dist/schema/root.d.ts.map +1 -1
- package/dist/schema/shared.d.ts +1 -1
- package/dist/schema/shared.d.ts.map +1 -1
- package/dist/schema/subscription.d.ts +1 -1
- package/dist/schema/subscription.d.ts.map +1 -1
- package/dist/schema/table.d.ts +1 -1
- package/dist/schema/table.d.ts.map +1 -1
- package/dist/schema/text.d.ts +5 -5
- package/dist/schema/text.d.ts.map +1 -1
- package/dist/schema/variants.d.ts +1 -1
- package/dist/schema/variants.d.ts.map +1 -1
- package/package.json +2 -7
- package/dist/schema/index.js +0 -652
- package/dist/schema/index.js.map +0 -7
- package/dist/schema/index.mjs +0 -629
- package/dist/schema/index.mjs.map +0 -7
package/dist/schema/index.js
DELETED
|
@@ -1,652 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/schema/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
BorderRadius: () => BorderRadius,
|
|
24
|
-
BorderStyle: () => BorderStyle,
|
|
25
|
-
BorderWidth: () => BorderWidth,
|
|
26
|
-
ButtonAction: () => ButtonAction,
|
|
27
|
-
ButtonField: () => ButtonField,
|
|
28
|
-
ButtonStyle: () => ButtonStyle,
|
|
29
|
-
CABBorder: () => CABBorder,
|
|
30
|
-
CABButtonContent: () => CABButtonContent,
|
|
31
|
-
CABButtonSection: () => CABButtonSection,
|
|
32
|
-
CABDataSourceSection: () => CABDataSourceSection,
|
|
33
|
-
CABImageSection: () => CABImageSection,
|
|
34
|
-
CABLayoutSection: () => CABLayoutSection,
|
|
35
|
-
CABOffersSection: () => CABOffersSection,
|
|
36
|
-
CABProductSection: () => CABProductSection,
|
|
37
|
-
CABProductsSection: () => CABProductsSection,
|
|
38
|
-
CABQuantitySection: () => CABQuantitySection,
|
|
39
|
-
CABReviewsSection: () => CABReviewsSection,
|
|
40
|
-
CABRootSection: () => CABRootSection,
|
|
41
|
-
CABSection: () => CABSection,
|
|
42
|
-
CABSubscriptionSection: () => CABSubscriptionSection,
|
|
43
|
-
CABTableSection: () => CABTableSection,
|
|
44
|
-
CABTextSection: () => CABTextSection,
|
|
45
|
-
CABVariantsSection: () => CABVariantsSection,
|
|
46
|
-
COMBINED_ENDPOINTS: () => COMBINED_ENDPOINTS,
|
|
47
|
-
DEFAULT_ENDPOINTS: () => DEFAULT_ENDPOINTS,
|
|
48
|
-
DYNAMIC_TOKEN_REGEX: () => DYNAMIC_TOKEN_REGEX,
|
|
49
|
-
Direction: () => Direction,
|
|
50
|
-
EditorMode: () => EditorMode,
|
|
51
|
-
HEX_COLOR_REGEX: () => HEX_COLOR_REGEX,
|
|
52
|
-
HTML_TAGS_REGEX: () => HTML_TAGS_REGEX,
|
|
53
|
-
HorizontalAlignment: () => HorizontalAlignment,
|
|
54
|
-
LanguageKey: () => LanguageKey,
|
|
55
|
-
NO_HTML: () => NO_HTML,
|
|
56
|
-
ObjectFit: () => ObjectFit,
|
|
57
|
-
QuantityInput: () => QuantityInput,
|
|
58
|
-
STATIC_ENDPOINTS: () => STATIC_ENDPOINTS,
|
|
59
|
-
SectionType: () => SectionType,
|
|
60
|
-
Spacing: () => Spacing,
|
|
61
|
-
TextAlignment: () => TextAlignment,
|
|
62
|
-
TextColorName: () => TextColorName,
|
|
63
|
-
TextSizeName: () => TextSizeName,
|
|
64
|
-
TiptapDocument: () => TiptapDocument,
|
|
65
|
-
TiptapParagraph: () => TiptapParagraph,
|
|
66
|
-
TiptapText: () => TiptapText,
|
|
67
|
-
VariantSelector: () => VariantSelector,
|
|
68
|
-
VerticalAlignment: () => VerticalAlignment,
|
|
69
|
-
WidgetType: () => WidgetType,
|
|
70
|
-
borderRadii: () => borderRadii,
|
|
71
|
-
borderStyles: () => borderStyles,
|
|
72
|
-
borderWidths: () => borderWidths,
|
|
73
|
-
buttonActions: () => buttonActions,
|
|
74
|
-
buttonFields: () => buttonFields,
|
|
75
|
-
buttonStyles: () => buttonStyles,
|
|
76
|
-
checkForHTML: () => checkForHTML,
|
|
77
|
-
directions: () => directions,
|
|
78
|
-
editorModes: () => editorModes,
|
|
79
|
-
hasHTMLInDoc: () => hasHTMLInDoc,
|
|
80
|
-
horizontalAlignments: () => horizontalAlignments,
|
|
81
|
-
isHTML: () => isHTML,
|
|
82
|
-
languageKeys: () => languageKeys,
|
|
83
|
-
objectFits: () => objectFits,
|
|
84
|
-
quantityInputs: () => quantityInputs,
|
|
85
|
-
sectionTypes: () => sectionTypes,
|
|
86
|
-
spacings: () => spacings,
|
|
87
|
-
targetAreas: () => targetAreas,
|
|
88
|
-
textAlignments: () => textAlignments,
|
|
89
|
-
textColorNames: () => textColorNames,
|
|
90
|
-
textSizeNames: () => textSizeNames,
|
|
91
|
-
variantSelectors: () => variantSelectors,
|
|
92
|
-
verticalAlignments: () => verticalAlignments,
|
|
93
|
-
widgetTypes: () => widgetTypes
|
|
94
|
-
});
|
|
95
|
-
module.exports = __toCommonJS(index_exports);
|
|
96
|
-
|
|
97
|
-
// src/schema/button.ts
|
|
98
|
-
var import_uuid12 = require("uuid");
|
|
99
|
-
var import_zod16 = require("zod");
|
|
100
|
-
|
|
101
|
-
// src/schema/common.ts
|
|
102
|
-
var import_zod = require("zod");
|
|
103
|
-
var borderRadii = ["none", "small", "base", "large", "fullyRounded"];
|
|
104
|
-
var borderRadius = import_zod.z.enum(borderRadii);
|
|
105
|
-
var BorderRadius = borderRadius.enum;
|
|
106
|
-
var borderStyles = ["none", "base", "dotted", "dashed"];
|
|
107
|
-
var borderStyle = import_zod.z.enum(borderStyles);
|
|
108
|
-
var BorderStyle = borderStyle.enum;
|
|
109
|
-
var borderWidths = ["base", "medium", "thick"];
|
|
110
|
-
var borderWidth = import_zod.z.enum(borderWidths);
|
|
111
|
-
var BorderWidth = borderWidth.enum;
|
|
112
|
-
var buttonActions = [
|
|
113
|
-
"addToOrder",
|
|
114
|
-
"declineAllOffers",
|
|
115
|
-
"declineOffer",
|
|
116
|
-
"goToRebuyApp",
|
|
117
|
-
"goToRebuyVault",
|
|
118
|
-
"goToURL",
|
|
119
|
-
"removeFromCart",
|
|
120
|
-
"showVariants",
|
|
121
|
-
"switchToSubscription"
|
|
122
|
-
];
|
|
123
|
-
var buttonAction = import_zod.z.enum(buttonActions);
|
|
124
|
-
var ButtonAction = buttonAction.enum;
|
|
125
|
-
var buttonFields = [
|
|
126
|
-
"addedToCart",
|
|
127
|
-
"addingToCart",
|
|
128
|
-
"addToCart",
|
|
129
|
-
"buttonLabel",
|
|
130
|
-
"declineAllOffers",
|
|
131
|
-
"declineOffer",
|
|
132
|
-
"destinationUrl",
|
|
133
|
-
"payNow",
|
|
134
|
-
"removeFromCart",
|
|
135
|
-
"showVariant",
|
|
136
|
-
"showVariants",
|
|
137
|
-
"soldOut",
|
|
138
|
-
"switchToOneTimeAction",
|
|
139
|
-
"switchToOneTimePurchase",
|
|
140
|
-
"switchToSubscriptionAction",
|
|
141
|
-
"switchToSubscriptionNoDiscount",
|
|
142
|
-
"switchToSubscriptionWithDiscount"
|
|
143
|
-
];
|
|
144
|
-
var buttonField = import_zod.z.enum(buttonFields);
|
|
145
|
-
var ButtonField = buttonField.enum;
|
|
146
|
-
var buttonStyles = ["primary", "secondary", "plain", "custom"];
|
|
147
|
-
var buttonStyle = import_zod.z.enum(buttonStyles);
|
|
148
|
-
var ButtonStyle = buttonStyle.enum;
|
|
149
|
-
var directions = ["columns", "rows"];
|
|
150
|
-
var direction = import_zod.z.enum(directions);
|
|
151
|
-
var Direction = direction.enum;
|
|
152
|
-
var editorModes = [
|
|
153
|
-
"checkoutExtension",
|
|
154
|
-
"postPurchaseOffer",
|
|
155
|
-
"thankYouPage",
|
|
156
|
-
"orderStatusPage",
|
|
157
|
-
"ordersIndexPage",
|
|
158
|
-
"customerProfilePage"
|
|
159
|
-
];
|
|
160
|
-
var editorMode = import_zod.z.enum(editorModes);
|
|
161
|
-
var EditorMode = editorMode.enum;
|
|
162
|
-
var horizontalAlignments = ["start", "center", "end"];
|
|
163
|
-
var horizontalAlignment = import_zod.z.enum(horizontalAlignments);
|
|
164
|
-
var HorizontalAlignment = horizontalAlignment.enum;
|
|
165
|
-
var languageKeys = [
|
|
166
|
-
"ar",
|
|
167
|
-
"cs",
|
|
168
|
-
"da",
|
|
169
|
-
"de",
|
|
170
|
-
"en",
|
|
171
|
-
"es",
|
|
172
|
-
"fi",
|
|
173
|
-
"fr",
|
|
174
|
-
"ga",
|
|
175
|
-
"he",
|
|
176
|
-
"hi",
|
|
177
|
-
"id",
|
|
178
|
-
"it",
|
|
179
|
-
"ja",
|
|
180
|
-
"ko",
|
|
181
|
-
"nl",
|
|
182
|
-
"no",
|
|
183
|
-
"pl",
|
|
184
|
-
"pt",
|
|
185
|
-
"ru",
|
|
186
|
-
"sv",
|
|
187
|
-
"th",
|
|
188
|
-
"tr",
|
|
189
|
-
"uk",
|
|
190
|
-
"vi",
|
|
191
|
-
"zh"
|
|
192
|
-
];
|
|
193
|
-
var languageKey = import_zod.z.enum(languageKeys);
|
|
194
|
-
var LanguageKey = languageKey.enum;
|
|
195
|
-
var objectFits = ["cover", "contain"];
|
|
196
|
-
var objectFit = import_zod.z.enum(objectFits);
|
|
197
|
-
var ObjectFit = objectFit.enum;
|
|
198
|
-
var quantityInputs = ["select", "number"];
|
|
199
|
-
var quantityInput = import_zod.z.enum(quantityInputs);
|
|
200
|
-
var QuantityInput = quantityInput.enum;
|
|
201
|
-
var sectionTypes = [
|
|
202
|
-
"button",
|
|
203
|
-
"dataSource",
|
|
204
|
-
"image",
|
|
205
|
-
"layout",
|
|
206
|
-
"offers",
|
|
207
|
-
"product",
|
|
208
|
-
"products",
|
|
209
|
-
"quantity",
|
|
210
|
-
"reviews",
|
|
211
|
-
"subscription",
|
|
212
|
-
"table",
|
|
213
|
-
"text",
|
|
214
|
-
"variants"
|
|
215
|
-
];
|
|
216
|
-
var sectionType = import_zod.z.enum(sectionTypes);
|
|
217
|
-
var SectionType = sectionType.enum;
|
|
218
|
-
var spacings = ["none", "extraTight", "tight", "base", "loose", "extraLoose"];
|
|
219
|
-
var spacing = import_zod.z.enum(spacings);
|
|
220
|
-
var Spacing = spacing.enum;
|
|
221
|
-
var textAlignments = ["start", "center", "end"];
|
|
222
|
-
var textAlignment = import_zod.z.enum(textAlignments);
|
|
223
|
-
var TextAlignment = textAlignment.enum;
|
|
224
|
-
var textColorNames = ["base", "subdued", "accent", "decorative", "success", "warning", "critical"];
|
|
225
|
-
var textColorName = import_zod.z.enum(textColorNames);
|
|
226
|
-
var TextColorName = textColorName.enum;
|
|
227
|
-
var textSizeNames = ["extraSmall", "small", "base", "medium", "large", "extraLarge"];
|
|
228
|
-
var textSizeName = import_zod.z.enum(textSizeNames);
|
|
229
|
-
var TextSizeName = textSizeName.enum;
|
|
230
|
-
var variantSelectors = ["menu", "button", "radio", "color", "image"];
|
|
231
|
-
var variantSelector = import_zod.z.enum(variantSelectors);
|
|
232
|
-
var VariantSelector = variantSelector.enum;
|
|
233
|
-
var verticalAlignments = ["top", "middle", "bottom"];
|
|
234
|
-
var verticalAlignment = import_zod.z.enum(verticalAlignments);
|
|
235
|
-
var VerticalAlignment = verticalAlignment.enum;
|
|
236
|
-
|
|
237
|
-
// src/schema/image.ts
|
|
238
|
-
var import_uuid11 = require("uuid");
|
|
239
|
-
var import_zod15 = require("zod");
|
|
240
|
-
|
|
241
|
-
// src/schema/regex.ts
|
|
242
|
-
var DYNAMIC_TOKEN_REGEX = /^\{\{\s*[A-Za-z]+\s*\}\}$/;
|
|
243
|
-
var HEX_COLOR_REGEX = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
244
|
-
var HTML_TAGS_REGEX = /<[^>]*>/gi;
|
|
245
|
-
|
|
246
|
-
// src/schema/shared.ts
|
|
247
|
-
var import_zod14 = require("zod");
|
|
248
|
-
|
|
249
|
-
// src/schema/data-source.ts
|
|
250
|
-
var import_uuid = require("uuid");
|
|
251
|
-
var import_zod3 = require("zod");
|
|
252
|
-
|
|
253
|
-
// src/schema/constants.ts
|
|
254
|
-
var import_lodash_es = require("lodash-es");
|
|
255
|
-
var import_zod2 = require("zod");
|
|
256
|
-
var DEFAULT_ENDPOINTS = [
|
|
257
|
-
{ label: "Recommended (AI)", value: "/products/recommended" },
|
|
258
|
-
{ label: "Top Sellers", value: "/products/top_sellers" },
|
|
259
|
-
{ label: "Buy It Again", value: "/products/purchased" },
|
|
260
|
-
{ label: "Recently Viewed", value: "/products/viewed" },
|
|
261
|
-
{ label: "Products Search", value: "/products/search" },
|
|
262
|
-
{ label: "Collection Products", value: "/products/collections" },
|
|
263
|
-
{ label: "Similar Products (AI)", value: "/products/similar_products" }
|
|
264
|
-
];
|
|
265
|
-
var STATIC_ENDPOINTS = [
|
|
266
|
-
{ label: "Recommended (AI)", value: "/products/recommended" },
|
|
267
|
-
{ label: "Top Sellers", value: "/products/top_sellers" },
|
|
268
|
-
{ label: "Trending Products", value: "/products/trending_products" },
|
|
269
|
-
{ label: "Buy It Again", value: "/products/purchased" },
|
|
270
|
-
{ label: "Collection Products", value: "/products/collections" },
|
|
271
|
-
{ label: "Recently Viewed", value: "/products/viewed" },
|
|
272
|
-
{ label: "Static Products", value: "/products/static" },
|
|
273
|
-
{ label: "Products Search", value: "/products/search" },
|
|
274
|
-
{ label: "Similar Products (AI)", value: "/products/similar_products" }
|
|
275
|
-
];
|
|
276
|
-
var COMBINED_ENDPOINTS = (0, import_lodash_es.uniqBy)([...DEFAULT_ENDPOINTS, ...STATIC_ENDPOINTS], "value");
|
|
277
|
-
var targetAreas = {
|
|
278
|
-
[EditorMode.checkoutExtension]: [
|
|
279
|
-
{ icon: "splitscreen_top", label: "Header Area", width: "984px" },
|
|
280
|
-
{ icon: "splitscreen_left", label: "Main Column", width: "503px" },
|
|
281
|
-
{ icon: "splitscreen_right", label: "Summary Column", width: "404px" }
|
|
282
|
-
],
|
|
283
|
-
[EditorMode.postPurchaseOffer]: null,
|
|
284
|
-
[EditorMode.thankYouPage]: [
|
|
285
|
-
{ icon: "splitscreen_top", label: "Header Area", width: "984px" },
|
|
286
|
-
{ icon: "splitscreen_left", label: "Main Column", width: "503px" },
|
|
287
|
-
{ icon: "splitscreen_right", label: "Summary Column", width: "404px" }
|
|
288
|
-
],
|
|
289
|
-
[EditorMode.orderStatusPage]: [
|
|
290
|
-
// { fill: true, flip: 'vertical', icon: 'bottom_navigation', label: 'Announcement Bar' },
|
|
291
|
-
{ icon: "splitscreen_top", label: "Header Area", width: "1124px" },
|
|
292
|
-
{ fill: true, icon: "view_column_2", label: "Main Area", width: "646px" },
|
|
293
|
-
{ icon: "splitscreen_bottom", label: "Footer Area", width: "1124px" }
|
|
294
|
-
],
|
|
295
|
-
[EditorMode.ordersIndexPage]: [
|
|
296
|
-
// { fill: true, flip: 'vertical', icon: 'bottom_navigation', label: 'Announcement Bar' },
|
|
297
|
-
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
298
|
-
],
|
|
299
|
-
[EditorMode.customerProfilePage]: [
|
|
300
|
-
// { fill: true, flip: 'vertical', icon: 'bottom_navigation', label: 'Announcement Bar' },
|
|
301
|
-
{ icon: "splitscreen_top", label: "Main Area", width: "1124px" }
|
|
302
|
-
]
|
|
303
|
-
};
|
|
304
|
-
var widgetTypes = [
|
|
305
|
-
"bundle_builder",
|
|
306
|
-
"cart",
|
|
307
|
-
"cart_subscription",
|
|
308
|
-
"dynamic_bundle",
|
|
309
|
-
"gift_with_purchase",
|
|
310
|
-
"pre_purchase",
|
|
311
|
-
"product",
|
|
312
|
-
"product_addon",
|
|
313
|
-
"product_upsell",
|
|
314
|
-
"recharge_checkout",
|
|
315
|
-
"recharge_customer_portal",
|
|
316
|
-
"recharge_post_purchase",
|
|
317
|
-
"shopify_checkout",
|
|
318
|
-
"shopify_checkout_extension",
|
|
319
|
-
"shopify_post_purchase",
|
|
320
|
-
"shopify_post_purchase_extension",
|
|
321
|
-
"switch_to_subscription",
|
|
322
|
-
"ui_extension_ad",
|
|
323
|
-
"ui_extension_button",
|
|
324
|
-
"ui_extension_content_block",
|
|
325
|
-
"ui_extension_line_item_editor",
|
|
326
|
-
"ui_extension_progress_bar"
|
|
327
|
-
];
|
|
328
|
-
var widgetType = import_zod2.z.enum(widgetTypes);
|
|
329
|
-
var WidgetType = widgetType.enum;
|
|
330
|
-
|
|
331
|
-
// src/schema/data-source.ts
|
|
332
|
-
var CABDataSourceSection = import_zod3.z.strictObject({
|
|
333
|
-
dataSourceId: import_zod3.z.number().nullable().default(null),
|
|
334
|
-
dataSourcePath: import_zod3.z.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
335
|
-
limit: import_zod3.z.number().default(1),
|
|
336
|
-
name: import_zod3.z.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
337
|
-
sectionId: import_zod3.z.uuidv7().default(() => (0, import_uuid.v7)()),
|
|
338
|
-
sectionType: import_zod3.z.literal(SectionType.dataSource).default(SectionType.dataSource)
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
// src/schema/layout.ts
|
|
342
|
-
var import_uuid2 = require("uuid");
|
|
343
|
-
var import_zod4 = require("zod");
|
|
344
|
-
var CABLayoutSection = import_zod4.z.strictObject({
|
|
345
|
-
alignment: import_zod4.z.strictObject({
|
|
346
|
-
horizontal: import_zod4.z.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
347
|
-
vertical: import_zod4.z.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
348
|
-
}).default({
|
|
349
|
-
horizontal: HorizontalAlignment.start,
|
|
350
|
-
vertical: VerticalAlignment.top
|
|
351
|
-
}),
|
|
352
|
-
border: CABBorder,
|
|
353
|
-
direction: import_zod4.z.enum(directions).default(Direction.rows),
|
|
354
|
-
name: import_zod4.z.string().optional(),
|
|
355
|
-
padding: import_zod4.z.enum(spacings).default(Spacing.none),
|
|
356
|
-
sectionId: import_zod4.z.uuidv7().default(() => (0, import_uuid2.v7)()),
|
|
357
|
-
sections: import_zod4.z.array(import_zod4.z.lazy(() => CABSection)).default(() => []),
|
|
358
|
-
sectionType: import_zod4.z.literal(SectionType.layout).default(SectionType.layout),
|
|
359
|
-
spacing: import_zod4.z.enum(spacings).default(Spacing.base),
|
|
360
|
-
width: import_zod4.z.number().default(100)
|
|
361
|
-
});
|
|
362
|
-
|
|
363
|
-
// src/schema/offers.ts
|
|
364
|
-
var import_zod8 = require("zod");
|
|
365
|
-
|
|
366
|
-
// src/schema/products.ts
|
|
367
|
-
var import_uuid5 = require("uuid");
|
|
368
|
-
var import_zod7 = require("zod");
|
|
369
|
-
|
|
370
|
-
// src/schema/product.ts
|
|
371
|
-
var import_uuid4 = require("uuid");
|
|
372
|
-
var import_zod6 = require("zod");
|
|
373
|
-
|
|
374
|
-
// src/schema/text.ts
|
|
375
|
-
var import_lodash_es3 = require("lodash-es");
|
|
376
|
-
var import_uuid3 = require("uuid");
|
|
377
|
-
var import_zod5 = require("zod");
|
|
378
|
-
|
|
379
|
-
// src/schema/utils.ts
|
|
380
|
-
var import_lodash_es2 = require("lodash-es");
|
|
381
|
-
var isHTML = (html = "") => {
|
|
382
|
-
if (typeof window !== "undefined") {
|
|
383
|
-
const parser = new DOMParser();
|
|
384
|
-
const doc = parser.parseFromString(html, "text/html");
|
|
385
|
-
const hasHTML = (nodeList) => Array.from(nodeList).some((node) => node.nodeType === 1);
|
|
386
|
-
return hasHTML(doc.body.childNodes) || hasHTML(doc.head.childNodes);
|
|
387
|
-
}
|
|
388
|
-
return HTML_TAGS_REGEX.test(html);
|
|
389
|
-
};
|
|
390
|
-
var hasHTMLInDoc = (doc) => doc.content.some(({ content = [] }) => content.some(({ text }) => isHTML(text)));
|
|
391
|
-
var checkForHTML = (input) => !((0, import_lodash_es2.isString)(input) && isHTML(input) || (0, import_lodash_es2.isPlainObject)(input) && hasHTMLInDoc(input));
|
|
392
|
-
var NO_HTML = { message: "HTML is not supported" };
|
|
393
|
-
|
|
394
|
-
// src/schema/text.ts
|
|
395
|
-
var enumOrOmit = (...vals) => import_zod5.z.string().transform((val) => vals.includes(val) ? val : void 0).optional();
|
|
396
|
-
var TiptapText = import_zod5.z.strictObject({
|
|
397
|
-
marks: import_zod5.z.array(
|
|
398
|
-
import_zod5.z.discriminatedUnion("type", [
|
|
399
|
-
import_zod5.z.strictObject({ type: import_zod5.z.literal("bold") }),
|
|
400
|
-
import_zod5.z.strictObject({ type: import_zod5.z.literal("italic") }),
|
|
401
|
-
import_zod5.z.strictObject({
|
|
402
|
-
attrs: import_zod5.z.strictObject({
|
|
403
|
-
class: import_zod5.z.string().nullable(),
|
|
404
|
-
href: import_zod5.z.union([import_zod5.z.url(), import_zod5.z.string().regex(DYNAMIC_TOKEN_REGEX)]),
|
|
405
|
-
rel: import_zod5.z.string().default("noopener noreferrer nofollow"),
|
|
406
|
-
target: import_zod5.z.string().default("_blank")
|
|
407
|
-
}),
|
|
408
|
-
type: import_zod5.z.literal("link")
|
|
409
|
-
}),
|
|
410
|
-
import_zod5.z.strictObject({ type: import_zod5.z.literal("strike") }),
|
|
411
|
-
import_zod5.z.strictObject({
|
|
412
|
-
attrs: import_zod5.z.strictObject({
|
|
413
|
-
color: enumOrOmit(...textColorNames).default(TextColorName.base),
|
|
414
|
-
fontSize: enumOrOmit(...textSizeNames).default(TextSizeName.base)
|
|
415
|
-
}),
|
|
416
|
-
type: import_zod5.z.literal("textStyle")
|
|
417
|
-
})
|
|
418
|
-
])
|
|
419
|
-
).optional(),
|
|
420
|
-
text: import_zod5.z.string().default(""),
|
|
421
|
-
type: import_zod5.z.literal("text").default("text")
|
|
422
|
-
});
|
|
423
|
-
var TiptapParagraph = import_zod5.z.strictObject({
|
|
424
|
-
attrs: import_zod5.z.strictObject({
|
|
425
|
-
textAlign: enumOrOmit(...textAlignments)
|
|
426
|
-
}).default({ textAlign: TextAlignment.start }),
|
|
427
|
-
content: import_zod5.z.array(TiptapText).default([]),
|
|
428
|
-
type: import_zod5.z.literal("paragraph").default("paragraph")
|
|
429
|
-
});
|
|
430
|
-
var TiptapDocument = import_zod5.z.strictObject({
|
|
431
|
-
attrs: import_zod5.z.strictObject({
|
|
432
|
-
blockSpacing: enumOrOmit(...spacings)
|
|
433
|
-
}).default({ blockSpacing: Spacing.base }),
|
|
434
|
-
content: import_zod5.z.array(TiptapParagraph).default([TiptapParagraph.parse({})]),
|
|
435
|
-
type: import_zod5.z.literal("doc").default("doc")
|
|
436
|
-
});
|
|
437
|
-
var CABTextSection = import_zod5.z.strictObject({
|
|
438
|
-
buttonField: import_zod5.z.enum(buttonFields).optional(),
|
|
439
|
-
content: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.union([import_zod5.z.string(), TiptapDocument]).refine(checkForHTML, NO_HTML).optional()).default({ en: TiptapDocument.parse({}) }).optional(),
|
|
440
|
-
name: import_zod5.z.string().optional(),
|
|
441
|
-
sectionId: import_zod5.z.uuidv7().default(() => (0, import_uuid3.v7)()),
|
|
442
|
-
sectionType: import_zod5.z.literal(SectionType.text).default(SectionType.text)
|
|
443
|
-
}).superRefine(({ buttonField: buttonField2, content }, ctx) => {
|
|
444
|
-
if (buttonField2 === ButtonField.destinationUrl && content) {
|
|
445
|
-
(0, import_lodash_es3.forEach)(content, (value, lang) => {
|
|
446
|
-
if (value && (0, import_lodash_es3.isString)(value)) {
|
|
447
|
-
if (DYNAMIC_TOKEN_REGEX.test(value)) return;
|
|
448
|
-
try {
|
|
449
|
-
new URL(value);
|
|
450
|
-
} catch {
|
|
451
|
-
ctx.addIssue({
|
|
452
|
-
code: "custom",
|
|
453
|
-
message: "Invalid URL",
|
|
454
|
-
path: ["content", lang]
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
// src/schema/product.ts
|
|
463
|
-
var CABProductSection = import_zod6.z.strictObject({
|
|
464
|
-
name: import_zod6.z.string().optional(),
|
|
465
|
-
options: import_zod6.z.array(
|
|
466
|
-
import_zod6.z.strictObject({
|
|
467
|
-
/** `name` represents `Color`, `Size`, etc. */
|
|
468
|
-
name: import_zod6.z.string(),
|
|
469
|
-
optionId: import_zod6.z.number(),
|
|
470
|
-
selector: import_zod6.z.enum(variantSelectors).default(VariantSelector.menu),
|
|
471
|
-
values: import_zod6.z.array(
|
|
472
|
-
import_zod6.z.strictObject({
|
|
473
|
-
color: import_zod6.z.string().optional(),
|
|
474
|
-
image: CABImageSection.optional(),
|
|
475
|
-
/** `name` represents `Red`, `Blue`, etc. */
|
|
476
|
-
name: import_zod6.z.string(),
|
|
477
|
-
text: CABTextSection.optional()
|
|
478
|
-
})
|
|
479
|
-
)
|
|
480
|
-
})
|
|
481
|
-
).default(() => []),
|
|
482
|
-
productId: import_zod6.z.number().nullable().default(null),
|
|
483
|
-
sectionId: import_zod6.z.uuidv7().default(() => (0, import_uuid4.v7)()),
|
|
484
|
-
sectionType: import_zod6.z.literal(SectionType.product).default(SectionType.product)
|
|
485
|
-
});
|
|
486
|
-
|
|
487
|
-
// src/schema/products.ts
|
|
488
|
-
var CABProductsSection = import_zod7.z.strictObject({
|
|
489
|
-
name: import_zod7.z.string().optional(),
|
|
490
|
-
sectionId: import_zod7.z.uuidv7().default(() => (0, import_uuid5.v7)()),
|
|
491
|
-
sections: import_zod7.z.array(CABProductSection).default(() => []),
|
|
492
|
-
sectionType: import_zod7.z.literal(SectionType.products).default(SectionType.products)
|
|
493
|
-
});
|
|
494
|
-
|
|
495
|
-
// src/schema/offers.ts
|
|
496
|
-
var CABOffersSection = CABLayoutSection.omit({ sections: true, sectionType: true }).extend(
|
|
497
|
-
import_zod8.z.strictObject({
|
|
498
|
-
sections: import_zod8.z.array(import_zod8.z.lazy(() => CABSection)).default(() => [CABDataSourceSection.parse({}), CABProductsSection.parse({})]),
|
|
499
|
-
sectionType: import_zod8.z.literal(SectionType.offers).default(SectionType.offers)
|
|
500
|
-
}).shape
|
|
501
|
-
);
|
|
502
|
-
|
|
503
|
-
// src/schema/quantity.ts
|
|
504
|
-
var import_uuid6 = require("uuid");
|
|
505
|
-
var import_zod9 = require("zod");
|
|
506
|
-
var CABQuantitySection = import_zod9.z.strictObject({
|
|
507
|
-
errorMessages: import_zod9.z.record(
|
|
508
|
-
import_zod9.z.string(),
|
|
509
|
-
import_zod9.z.strictObject({
|
|
510
|
-
max: import_zod9.z.string().optional(),
|
|
511
|
-
min: import_zod9.z.string().optional(),
|
|
512
|
-
neg: import_zod9.z.string().optional()
|
|
513
|
-
})
|
|
514
|
-
).default({
|
|
515
|
-
en: {
|
|
516
|
-
max: "Maximum quantity allowed is {{max}}",
|
|
517
|
-
min: "Minimum quantity required is {{min}}",
|
|
518
|
-
neg: "Quantity cannot be negative"
|
|
519
|
-
}
|
|
520
|
-
}),
|
|
521
|
-
inputType: import_zod9.z.enum(quantityInputs).default(QuantityInput.select),
|
|
522
|
-
max: import_zod9.z.number().min(1).max(100).default(10),
|
|
523
|
-
min: import_zod9.z.number().min(1).default(1),
|
|
524
|
-
name: import_zod9.z.string().optional(),
|
|
525
|
-
sectionId: import_zod9.z.uuidv7().default(() => (0, import_uuid6.v7)()),
|
|
526
|
-
sectionType: import_zod9.z.literal(SectionType.quantity).default(SectionType.quantity)
|
|
527
|
-
});
|
|
528
|
-
|
|
529
|
-
// src/schema/reviews.ts
|
|
530
|
-
var import_uuid7 = require("uuid");
|
|
531
|
-
var import_zod10 = require("zod");
|
|
532
|
-
var CABReviewsSection = import_zod10.z.strictObject({
|
|
533
|
-
name: import_zod10.z.string().optional(),
|
|
534
|
-
sectionId: import_zod10.z.uuidv7().default(() => (0, import_uuid7.v7)()),
|
|
535
|
-
sectionType: import_zod10.z.literal(SectionType.reviews).default(SectionType.reviews)
|
|
536
|
-
});
|
|
537
|
-
|
|
538
|
-
// src/schema/subscription.ts
|
|
539
|
-
var import_uuid8 = require("uuid");
|
|
540
|
-
var import_zod11 = require("zod");
|
|
541
|
-
var CABSubscriptionSection = import_zod11.z.strictObject({
|
|
542
|
-
name: import_zod11.z.string().optional(),
|
|
543
|
-
sectionId: import_zod11.z.uuidv7().default(() => (0, import_uuid8.v7)()),
|
|
544
|
-
sectionType: import_zod11.z.literal(SectionType.subscription).default(SectionType.subscription)
|
|
545
|
-
});
|
|
546
|
-
|
|
547
|
-
// src/schema/table.ts
|
|
548
|
-
var import_uuid9 = require("uuid");
|
|
549
|
-
var import_zod12 = require("zod");
|
|
550
|
-
var CABTableSection = import_zod12.z.strictObject({
|
|
551
|
-
name: import_zod12.z.string().optional(),
|
|
552
|
-
sectionId: import_zod12.z.uuidv7().default(() => (0, import_uuid9.v7)()),
|
|
553
|
-
sectionType: import_zod12.z.literal(SectionType.table).default(SectionType.table)
|
|
554
|
-
});
|
|
555
|
-
|
|
556
|
-
// src/schema/variants.ts
|
|
557
|
-
var import_lodash_es4 = require("lodash-es");
|
|
558
|
-
var import_uuid10 = require("uuid");
|
|
559
|
-
var import_zod13 = require("zod");
|
|
560
|
-
var CABVariantsSection = import_zod13.z.strictObject({
|
|
561
|
-
name: import_zod13.z.string().optional(),
|
|
562
|
-
sectionId: import_zod13.z.uuidv7().default(() => (0, import_uuid10.v7)()),
|
|
563
|
-
sectionType: import_zod13.z.literal(SectionType.variants).default(SectionType.variants),
|
|
564
|
-
selector: import_zod13.z.enum((0, import_lodash_es4.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu)
|
|
565
|
-
});
|
|
566
|
-
|
|
567
|
-
// src/schema/shared.ts
|
|
568
|
-
var CABBorder = import_zod14.z.strictObject({
|
|
569
|
-
radius: import_zod14.z.enum(borderRadii).default(BorderRadius.base),
|
|
570
|
-
style: import_zod14.z.enum(borderStyles).default(BorderStyle.none),
|
|
571
|
-
width: import_zod14.z.enum(borderWidths).default(BorderWidth.base)
|
|
572
|
-
}).default({
|
|
573
|
-
radius: BorderRadius.base,
|
|
574
|
-
style: BorderStyle.none,
|
|
575
|
-
width: BorderWidth.base
|
|
576
|
-
});
|
|
577
|
-
var CABSection = import_zod14.z.lazy(
|
|
578
|
-
() => import_zod14.z.discriminatedUnion("sectionType", [
|
|
579
|
-
CABButtonSection,
|
|
580
|
-
CABDataSourceSection,
|
|
581
|
-
CABImageSection,
|
|
582
|
-
CABLayoutSection,
|
|
583
|
-
CABOffersSection,
|
|
584
|
-
CABProductSection,
|
|
585
|
-
CABProductsSection,
|
|
586
|
-
CABQuantitySection,
|
|
587
|
-
CABReviewsSection,
|
|
588
|
-
CABSubscriptionSection,
|
|
589
|
-
CABTableSection,
|
|
590
|
-
CABTextSection,
|
|
591
|
-
CABVariantsSection
|
|
592
|
-
])
|
|
593
|
-
);
|
|
594
|
-
|
|
595
|
-
// src/schema/image.ts
|
|
596
|
-
var CABImageSection = import_zod15.z.strictObject({
|
|
597
|
-
altText: import_zod15.z.string().refine(checkForHTML, NO_HTML).default(""),
|
|
598
|
-
aspectRatio: import_zod15.z.literal(1).nullable().default(null),
|
|
599
|
-
border: CABBorder,
|
|
600
|
-
buttonField: import_zod15.z.enum(buttonFields).optional(),
|
|
601
|
-
category: import_zod15.z.enum(["gallery", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
602
|
-
name: import_zod15.z.string().optional(),
|
|
603
|
-
naturalHeight: import_zod15.z.number().default(0),
|
|
604
|
-
naturalWidth: import_zod15.z.number().default(0),
|
|
605
|
-
objectFit: import_zod15.z.enum(objectFits).default(ObjectFit.cover),
|
|
606
|
-
sectionId: import_zod15.z.uuidv7().default(() => (0, import_uuid11.v7)()),
|
|
607
|
-
sectionType: import_zod15.z.literal(SectionType.image).default(SectionType.image),
|
|
608
|
-
source: import_zod15.z.union([import_zod15.z.url(), import_zod15.z.literal(""), import_zod15.z.string().regex(DYNAMIC_TOKEN_REGEX)]).default(""),
|
|
609
|
-
width: import_zod15.z.number().default(100)
|
|
610
|
-
});
|
|
611
|
-
|
|
612
|
-
// src/schema/button.ts
|
|
613
|
-
var CABButtonContent = import_zod16.z.discriminatedUnion("sectionType", [CABImageSection, CABTextSection]);
|
|
614
|
-
var CABButtonSection = import_zod16.z.strictObject({
|
|
615
|
-
action: import_zod16.z.union([import_zod16.z.literal(""), import_zod16.z.enum(buttonActions)]).default(""),
|
|
616
|
-
buttonStyle: import_zod16.z.enum(buttonStyles).default(ButtonStyle.primary),
|
|
617
|
-
custom: import_zod16.z.strictObject({
|
|
618
|
-
color: import_zod16.z.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
619
|
-
height: import_zod16.z.number().default(52),
|
|
620
|
-
width: import_zod16.z.number().default(300)
|
|
621
|
-
}).default({
|
|
622
|
-
color: "#005bd3",
|
|
623
|
-
height: 52,
|
|
624
|
-
width: 300
|
|
625
|
-
}),
|
|
626
|
-
name: import_zod16.z.string().optional(),
|
|
627
|
-
sectionId: import_zod16.z.uuidv7().default(() => (0, import_uuid12.v7)()),
|
|
628
|
-
sections: import_zod16.z.array(CABButtonContent).default(() => []),
|
|
629
|
-
sectionType: import_zod16.z.literal(SectionType.button).default(SectionType.button)
|
|
630
|
-
});
|
|
631
|
-
|
|
632
|
-
// src/schema/root.ts
|
|
633
|
-
var import_zod17 = require("zod");
|
|
634
|
-
var TargetArea = import_zod17.z.strictObject({
|
|
635
|
-
fill: import_zod17.z.boolean().optional(),
|
|
636
|
-
flip: import_zod17.z.enum(["both", "horizontal", "vertical"]).optional(),
|
|
637
|
-
icon: import_zod17.z.string(),
|
|
638
|
-
label: import_zod17.z.string(),
|
|
639
|
-
width: import_zod17.z.string()
|
|
640
|
-
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
641
|
-
var CABRootSection = CABLayoutSection.extend(
|
|
642
|
-
import_zod17.z.strictObject({
|
|
643
|
-
editorMode: import_zod17.z.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
644
|
-
previewMode: import_zod17.z.boolean().default(false),
|
|
645
|
-
storeId: import_zod17.z.number().nullable().default(null),
|
|
646
|
-
targetArea: TargetArea.nullable(),
|
|
647
|
-
type: import_zod17.z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
648
|
-
version: import_zod17.z.literal(2).default(2),
|
|
649
|
-
widgetId: import_zod17.z.number().nullable().default(null)
|
|
650
|
-
}).shape
|
|
651
|
-
);
|
|
652
|
-
//# sourceMappingURL=index.js.map
|