@drawbridge/components 0.1.48 → 0.1.49
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/bridge/fields.js +0 -278
- package/dist/bridge/fields.mjs +1 -276
- package/dist/bridge/form-subdomain-shop-modal.js +274 -234
- package/dist/bridge/form-subdomain-shop-modal.mjs +275 -233
- package/dist/bridge/form-subdomain.js +0 -7
- package/dist/bridge/form-subdomain.mjs +2 -9
- package/dist/bridge/lib/age-gate.js +0 -12
- package/dist/bridge/lib/age-gate.mjs +0 -11
- package/dist/bridge/lib/checkout-kit.js +32 -2
- package/dist/bridge/lib/checkout-kit.mjs +32 -2
- package/dist/bridge/lib/entry.js +0 -3
- package/dist/bridge/lib/entry.mjs +0 -2
- package/dist/bridge/product-tile.js +6 -9
- package/dist/bridge/product-tile.mjs +6 -9
- package/dist/bridge/template-layout.js +122 -237
- package/dist/bridge/template-layout.mjs +122 -237
- package/dist/bridge/template-modal.js +73 -28
- package/dist/bridge/template-modal.mjs +74 -29
- package/dist/dashboard/buttons-subscription.js +1 -1
- package/dist/dashboard/buttons-subscription.mjs +1 -1
- package/dist/dashboard/campaign-form.js +2 -7
- package/dist/dashboard/campaign-form.mjs +2 -7
- package/dist/dashboard/card-order.js +4 -22
- package/dist/dashboard/card-order.mjs +4 -22
- package/dist/dashboard/document-blocks.js +17 -4
- package/dist/dashboard/document-blocks.mjs +17 -4
- package/dist/dashboard/form-admin-provider.js +17 -71
- package/dist/dashboard/form-admin-provider.mjs +17 -71
- package/dist/dashboard/form-file-upload.js +2 -3
- package/dist/dashboard/form-file-upload.mjs +3 -4
- package/dist/dashboard/form-organization-campaign-advertisements.js +6 -47
- package/dist/dashboard/form-organization-campaign-advertisements.mjs +6 -47
- package/dist/dashboard/form-organization-campaign-agreement.js +121 -83
- package/dist/dashboard/form-organization-campaign-agreement.mjs +121 -83
- package/dist/dashboard/form-organization-campaign.js +0 -82
- package/dist/dashboard/form-organization-campaign.mjs +0 -81
- package/dist/dashboard/form-organization-connection.js +6 -48
- package/dist/dashboard/form-organization-connection.mjs +7 -48
- package/dist/dashboard/form-organization-workflow.js +1 -72
- package/dist/dashboard/form-organization-workflow.mjs +1 -69
- package/dist/dashboard/form-otc.js +5 -4
- package/dist/dashboard/form-otc.mjs +5 -4
- package/dist/dashboard/form-stripe.js +5 -12
- package/dist/dashboard/form-stripe.mjs +5 -12
- package/dist/dashboard/input-fields.js +158 -11
- package/dist/dashboard/input-fields.mjs +158 -11
- package/dist/dashboard/input-file.js +4 -21
- package/dist/dashboard/input-file.mjs +4 -21
- package/dist/dashboard/lib/connection-controls.js +2 -5
- package/dist/dashboard/lib/connection-controls.mjs +1 -3
- package/dist/dashboard/lib/form-page.js +1 -1
- package/dist/dashboard/lib/form-page.mjs +1 -1
- package/dist/dashboard/lib/uppy.js +1 -10
- package/dist/dashboard/lib/uppy.mjs +2 -11
- package/dist/dashboard/order-sections.js +6 -456
- package/dist/dashboard/order-sections.mjs +7 -453
- package/dist/dashboard/provider-ui.js +7 -9
- package/dist/dashboard/provider-ui.mjs +7 -9
- package/dist/dashboard/template-ui.js +12 -4
- package/dist/dashboard/template-ui.mjs +12 -4
- package/dist/input-checkbox.js +10 -28
- package/dist/input-checkbox.mjs +10 -28
- package/dist/product.js +24 -96
- package/dist/product.mjs +25 -97
- package/dist/shared/lib/helpers.js +6 -54
- package/dist/shared/lib/helpers.mjs +8 -53
- package/package.json +4 -74
- package/types/bridge/fields.d.ts +2 -14
- package/types/bridge/form-subdomain-shop-modal.d.ts +3 -27
- package/types/bridge/lib/age-gate.d.ts +0 -5
- package/types/bridge/lib/checkout-kit.d.ts +10 -2
- package/types/bridge/lib/entry.d.ts +0 -3
- package/types/dashboard/card-order.d.ts +0 -6
- package/types/dashboard/document-blocks.d.ts +3 -2
- package/types/dashboard/form-admin-provider.d.ts +2 -9
- package/types/dashboard/form-file-upload.d.ts +1 -2
- package/types/dashboard/form-organization-campaign-advertisements.d.ts +0 -3
- package/types/dashboard/form-organization-campaign-agreement.d.ts +5 -2
- package/types/dashboard/form-organization-campaign.d.ts +0 -3
- package/types/dashboard/form-organization-connection.d.ts +0 -11
- package/types/dashboard/form-otc.d.ts +1 -5
- package/types/dashboard/form-stripe.d.ts +2 -3
- package/types/dashboard/input-file.d.ts +0 -2
- package/types/dashboard/order-sections.d.ts +1 -24
- package/types/input-checkbox.d.ts +0 -2
- package/types/shared/lib/helpers.d.ts +0 -4
- package/dist/bridge/cart-drawer.js +0 -152
- package/dist/bridge/cart-drawer.mjs +0 -123
- package/dist/bridge/form-subdomain-checkout.js +0 -687
- package/dist/bridge/form-subdomain-checkout.mjs +0 -665
- package/dist/bridge/lib/cart.js +0 -79
- package/dist/bridge/lib/cart.mjs +0 -48
- package/dist/dashboard/embed-stripe.js +0 -145
- package/dist/dashboard/embed-stripe.mjs +0 -116
- package/dist/dashboard/form-organization-campaign-field-birthday.js +0 -193
- package/dist/dashboard/form-organization-campaign-field-birthday.mjs +0 -164
- package/dist/dashboard/form-organization-campaign-field-rating.js +0 -246
- package/dist/dashboard/form-organization-campaign-field-rating.mjs +0 -217
- package/dist/dashboard/form-organization-product.js +0 -1461
- package/dist/dashboard/form-organization-product.mjs +0 -1425
- package/dist/dashboard/input-gallery.js +0 -201
- package/dist/dashboard/input-gallery.mjs +0 -172
- package/dist/dashboard/lib/products.js +0 -169
- package/dist/dashboard/lib/products.mjs +0 -135
- package/dist/dashboard/lib/settings-paths.js +0 -35
- package/dist/dashboard/lib/settings-paths.mjs +0 -11
- package/dist/dashboard/shipping-rates.js +0 -404
- package/dist/dashboard/shipping-rates.mjs +0 -371
- package/dist/dashboard/template-buyer.js +0 -301
- package/dist/dashboard/template-buyer.mjs +0 -267
- package/dist/shared/order-summary.js +0 -139
- package/dist/shared/order-summary.mjs +0 -110
- package/types/bridge/cart-drawer.d.ts +0 -31
- package/types/bridge/form-subdomain-checkout.d.ts +0 -20
- package/types/bridge/lib/cart.d.ts +0 -44
- package/types/dashboard/embed-stripe.d.ts +0 -25
- package/types/dashboard/form-organization-campaign-field-birthday.d.ts +0 -31
- package/types/dashboard/form-organization-campaign-field-rating.d.ts +0 -33
- package/types/dashboard/form-organization-product.d.ts +0 -24
- package/types/dashboard/input-gallery.d.ts +0 -14
- package/types/dashboard/lib/products.d.ts +0 -14
- package/types/dashboard/lib/settings-paths.d.ts +0 -5
- package/types/dashboard/shipping-rates.d.ts +0 -26
- package/types/dashboard/template-buyer.d.ts +0 -50
- package/types/shared/order-summary.d.ts +0 -19
|
@@ -28,8 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var form_subdomain_shop_modal_exports = {};
|
|
30
30
|
__export(form_subdomain_shop_modal_exports, {
|
|
31
|
-
CartItem: () => CartItem,
|
|
32
|
-
CartRecommended: () => CartRecommended,
|
|
33
31
|
FormSubdomainCart: () => FormSubdomainCart,
|
|
34
32
|
FormSubdomainProduct: () => FormSubdomainProduct
|
|
35
33
|
});
|
|
@@ -39,16 +37,20 @@ var import_react = require("react");
|
|
|
39
37
|
var import_react_hook_form = require("react-hook-form");
|
|
40
38
|
var import_yup = __toESM(require("./lib/yup"));
|
|
41
39
|
var import_cdn = require("@drawbridge/drawbridge-utils/cdn");
|
|
42
|
-
var
|
|
40
|
+
var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
|
|
43
41
|
var import_form_subdomain_header = require("./form-subdomain-header");
|
|
44
42
|
var import_image = __toESM(require("next/image"));
|
|
45
43
|
var import_product = __toESM(require("../product"));
|
|
46
44
|
var import_empty = __toESM(require("../shared/empty"));
|
|
47
45
|
var import_button = __toESM(require("../shared/button"));
|
|
46
|
+
var import_overlay = __toESM(require("../shared/overlay"));
|
|
47
|
+
var import_shop = __toESM(require("../icons/shop"));
|
|
48
48
|
var import_input_group = __toESM(require("../input-group"));
|
|
49
49
|
var import_input_number = __toESM(require("../input-number"));
|
|
50
|
+
var import_styles = require("../styles");
|
|
51
|
+
var import_chevron_down = __toESM(require("../icons/chevron-down"));
|
|
52
|
+
var import_chevron_up = __toESM(require("../icons/chevron-up"));
|
|
50
53
|
var import_warning = __toESM(require("../icons/warning"));
|
|
51
|
-
var import_cart = require("./lib/cart");
|
|
52
54
|
const FormSubdomainProduct = ({
|
|
53
55
|
back,
|
|
54
56
|
button,
|
|
@@ -66,12 +68,8 @@ const FormSubdomainProduct = ({
|
|
|
66
68
|
);
|
|
67
69
|
const [action, setAction] = (0, import_react.useState)(null);
|
|
68
70
|
const { formState, getValues, setError, clearErrors, setValue, control } = (0, import_react_hook_form.useForm)({
|
|
69
|
-
// @story checkout/cart
|
|
70
|
-
// Only a product with one variant starts with it chosen. With more, the
|
|
71
|
-
// buyer chooses, and Add to cart or Buy now before that reads "Please
|
|
72
|
-
// select a variant".
|
|
73
71
|
defaultValues: {
|
|
74
|
-
variant: ((
|
|
72
|
+
variant: ((_a = available[0]) == null ? void 0 : _a.id) || ""
|
|
75
73
|
},
|
|
76
74
|
resolver: (0, import_yup.resolver)(
|
|
77
75
|
import_yup.default.object({
|
|
@@ -82,7 +80,7 @@ const FormSubdomainProduct = ({
|
|
|
82
80
|
const variant = (0, import_react_hook_form.useWatch)({ control, name: "variant" });
|
|
83
81
|
const onVariantChange = (value) => {
|
|
84
82
|
setValue("variant", value);
|
|
85
|
-
clearErrors(
|
|
83
|
+
clearErrors("root");
|
|
86
84
|
};
|
|
87
85
|
const performAction = async (actionType) => {
|
|
88
86
|
var _a2, _b2;
|
|
@@ -164,159 +162,35 @@ const FormSubdomainProduct = ({
|
|
|
164
162
|
}
|
|
165
163
|
);
|
|
166
164
|
};
|
|
167
|
-
const CartItem = ({
|
|
168
|
-
aside,
|
|
169
|
-
children,
|
|
170
|
-
currency,
|
|
171
|
-
image,
|
|
172
|
-
price,
|
|
173
|
-
subtitle,
|
|
174
|
-
title
|
|
175
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
176
|
-
"div",
|
|
177
|
-
{
|
|
178
|
-
...{
|
|
179
|
-
className: "flex items-center space-x-3 text-left"
|
|
180
|
-
},
|
|
181
|
-
children: [
|
|
182
|
-
image && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
183
|
-
"div",
|
|
184
|
-
{
|
|
185
|
-
...{
|
|
186
|
-
className: "relative w-14 h-14 rounded overflow-hidden shrink-0"
|
|
187
|
-
},
|
|
188
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
189
|
-
import_image.default,
|
|
190
|
-
{
|
|
191
|
-
...{
|
|
192
|
-
alt: title || "",
|
|
193
|
-
className: "object-cover",
|
|
194
|
-
fill: true,
|
|
195
|
-
sizes: "56px",
|
|
196
|
-
// A Shopify picture is resized by Shopify's CDN; ours is already sized.
|
|
197
|
-
src: /cdn\.shopify\.com/.test(image) && (0, import_cdn.cdnShopify)(image, "100x100") || image,
|
|
198
|
-
unoptimized: true
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
)
|
|
202
|
-
}
|
|
203
|
-
),
|
|
204
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
205
|
-
"div",
|
|
206
|
-
{
|
|
207
|
-
...{
|
|
208
|
-
className: "flex-1 space-y-0.5 min-w-0"
|
|
209
|
-
},
|
|
210
|
-
children: [
|
|
211
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
212
|
-
"p",
|
|
213
|
-
{
|
|
214
|
-
...{
|
|
215
|
-
className: "text-sm font-medium leading-tight truncate"
|
|
216
|
-
},
|
|
217
|
-
children: title
|
|
218
|
-
}
|
|
219
|
-
),
|
|
220
|
-
subtitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
221
|
-
"p",
|
|
222
|
-
{
|
|
223
|
-
...{
|
|
224
|
-
className: "text-xs opacity-60"
|
|
225
|
-
},
|
|
226
|
-
children: subtitle
|
|
227
|
-
}
|
|
228
|
-
),
|
|
229
|
-
Number.isFinite(Number(price)) && price !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
230
|
-
"p",
|
|
231
|
-
{
|
|
232
|
-
...{
|
|
233
|
-
className: "text-xs opacity-60"
|
|
234
|
-
},
|
|
235
|
-
children: (0, import_helpers.money)({
|
|
236
|
-
code: currency,
|
|
237
|
-
value: price
|
|
238
|
-
})
|
|
239
|
-
}
|
|
240
|
-
),
|
|
241
|
-
children
|
|
242
|
-
]
|
|
243
|
-
}
|
|
244
|
-
),
|
|
245
|
-
aside
|
|
246
|
-
]
|
|
247
|
-
}
|
|
248
|
-
);
|
|
249
|
-
const CartRecommended = ({
|
|
250
|
-
items = [],
|
|
251
|
-
onOpen,
|
|
252
|
-
style
|
|
253
|
-
}) => items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
254
|
-
"div",
|
|
255
|
-
{
|
|
256
|
-
...{
|
|
257
|
-
className: "py-6 space-y-4 border-t border-current"
|
|
258
|
-
},
|
|
259
|
-
children: [
|
|
260
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
261
|
-
import_form_subdomain_header.FormSubdomainHeader,
|
|
262
|
-
{
|
|
263
|
-
...{
|
|
264
|
-
style,
|
|
265
|
-
title: "Recommended"
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
),
|
|
269
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
270
|
-
"div",
|
|
271
|
-
{
|
|
272
|
-
...{
|
|
273
|
-
className: "space-y-3"
|
|
274
|
-
},
|
|
275
|
-
children: items.map((product) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
276
|
-
import_button.default,
|
|
277
|
-
{
|
|
278
|
-
...{
|
|
279
|
-
"aria-label": "Open " + (product.title || "product"),
|
|
280
|
-
onClick: () => onOpen == null ? void 0 : onOpen(product),
|
|
281
|
-
variant: "link"
|
|
282
|
-
},
|
|
283
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
284
|
-
"span",
|
|
285
|
-
{
|
|
286
|
-
...{
|
|
287
|
-
className: "block w-full"
|
|
288
|
-
},
|
|
289
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CartItem, { ...(0, import_cart.recommendedRow)(product) })
|
|
290
|
-
}
|
|
291
|
-
)
|
|
292
|
-
},
|
|
293
|
-
product.id
|
|
294
|
-
))
|
|
295
|
-
}
|
|
296
|
-
)
|
|
297
|
-
]
|
|
298
|
-
}
|
|
299
|
-
);
|
|
300
165
|
const FormSubdomainCart = ({
|
|
301
166
|
button,
|
|
302
167
|
cart,
|
|
303
|
-
|
|
168
|
+
children,
|
|
169
|
+
drawer = true,
|
|
304
170
|
onLineRemove,
|
|
305
171
|
onLineUpdate,
|
|
306
|
-
onOpenProduct,
|
|
307
172
|
onSuccess,
|
|
308
173
|
style,
|
|
309
174
|
tracking
|
|
310
175
|
}) => {
|
|
176
|
+
const [show, setShow] = (0, import_react.useState)(false);
|
|
177
|
+
const [updating, setUpdating] = (0, import_react.useState)(false);
|
|
311
178
|
const [lineErrors, setLineErrors] = (0, import_react.useState)({});
|
|
312
179
|
const lines = (0, import_react.useMemo)(() => (cart == null ? void 0 : cart.lines) || [], [cart]);
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
180
|
+
(0, import_react.useEffect)(() => {
|
|
181
|
+
lines.filter((line) => line.quantity <= 0).forEach((line) => onLineRemove(line.id));
|
|
182
|
+
}, [lines, onLineRemove]);
|
|
183
|
+
const lineCount = lines.reduce((sum, line) => sum + (line.quantity || 0), 0);
|
|
184
|
+
const hasSoldOut = lines.some((line) => line.availableForSale === false);
|
|
185
|
+
const canCheckout = Boolean(cart == null ? void 0 : cart.checkoutUrl) && lines.length > 0 && !hasSoldOut;
|
|
186
|
+
const cartTotal = lines.length > 0 ? (0, import_drawbridge_utils.formatCurrency)({
|
|
316
187
|
code: lines[0].currency,
|
|
188
|
+
display: "parts",
|
|
317
189
|
value: lines.reduce((sum, line) => sum + Number(line.price) * (line.quantity || 0), 0)
|
|
318
190
|
}) : null;
|
|
319
191
|
const wrap = async (lineId, fn) => {
|
|
192
|
+
if (updating) return;
|
|
193
|
+
setUpdating(true);
|
|
320
194
|
setLineErrors((prev) => {
|
|
321
195
|
const next = { ...prev };
|
|
322
196
|
delete next[lineId];
|
|
@@ -329,9 +203,11 @@ const FormSubdomainCart = ({
|
|
|
329
203
|
...prev,
|
|
330
204
|
[lineId]: (error == null ? void 0 : error.message) || "Could not update line"
|
|
331
205
|
}));
|
|
206
|
+
} finally {
|
|
207
|
+
setUpdating(false);
|
|
332
208
|
}
|
|
333
209
|
};
|
|
334
|
-
const handleQuantity = (line, next) =>
|
|
210
|
+
const handleQuantity = (line, next) => wrap(line.id, () => {
|
|
335
211
|
var _a, _b;
|
|
336
212
|
if (next <= 0) {
|
|
337
213
|
const productSlug = (_a = line.productTitle) == null ? void 0 : _a.toLowerCase().replace(/\s+/g, "-");
|
|
@@ -349,7 +225,7 @@ const FormSubdomainCart = ({
|
|
|
349
225
|
return onLineUpdate(line.id, next);
|
|
350
226
|
});
|
|
351
227
|
const handleCheckout = () => {
|
|
352
|
-
if (!
|
|
228
|
+
if (!canCheckout) return;
|
|
353
229
|
onSuccess({
|
|
354
230
|
result: cart
|
|
355
231
|
});
|
|
@@ -379,26 +255,115 @@ const FormSubdomainCart = ({
|
|
|
379
255
|
},
|
|
380
256
|
children: lines.map((line) => {
|
|
381
257
|
var _a, _b, _c, _d, _e;
|
|
382
|
-
const note = (0, import_cart.lineNote)(line, cut);
|
|
383
258
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
384
259
|
import_input_group.default,
|
|
385
260
|
{
|
|
386
261
|
...{
|
|
387
262
|
className: "py-6",
|
|
388
263
|
error: lineErrors[line.id],
|
|
389
|
-
input: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
390
|
-
|
|
264
|
+
input: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
265
|
+
"div",
|
|
391
266
|
{
|
|
392
267
|
...{
|
|
393
|
-
|
|
268
|
+
className: "flex items-center space-x-3"
|
|
269
|
+
},
|
|
270
|
+
children: [
|
|
271
|
+
line.image && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
272
|
+
"div",
|
|
273
|
+
{
|
|
274
|
+
...{
|
|
275
|
+
className: "relative w-14 h-14 rounded overflow-hidden shrink-0"
|
|
276
|
+
},
|
|
277
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
278
|
+
import_image.default,
|
|
279
|
+
{
|
|
280
|
+
...{
|
|
281
|
+
alt: line.productTitle || "",
|
|
282
|
+
className: "object-cover",
|
|
283
|
+
fill: true,
|
|
284
|
+
sizes: "56px",
|
|
285
|
+
src: (0, import_cdn.cdnShopify)(line.image, "100x100") || line.image,
|
|
286
|
+
unoptimized: true
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
}
|
|
291
|
+
),
|
|
292
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
293
|
+
"div",
|
|
294
|
+
{
|
|
295
|
+
...{
|
|
296
|
+
className: "flex-1 space-y-0.5 min-w-0"
|
|
297
|
+
},
|
|
298
|
+
children: [
|
|
299
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
300
|
+
"p",
|
|
301
|
+
{
|
|
302
|
+
...{
|
|
303
|
+
className: "text-sm font-medium leading-tight truncate"
|
|
304
|
+
},
|
|
305
|
+
children: line.productTitle
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
line.variantTitle && line.variantTitle !== "Default Title" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
309
|
+
"p",
|
|
310
|
+
{
|
|
311
|
+
...{
|
|
312
|
+
className: "text-xs opacity-60"
|
|
313
|
+
},
|
|
314
|
+
children: line.variantTitle
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
line.price && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
318
|
+
"p",
|
|
319
|
+
{
|
|
320
|
+
...{
|
|
321
|
+
className: "text-xs opacity-60"
|
|
322
|
+
},
|
|
323
|
+
children: (0, import_drawbridge_utils.formatCurrency)({
|
|
324
|
+
code: line.currency,
|
|
325
|
+
display: "parts",
|
|
326
|
+
value: line.price
|
|
327
|
+
})
|
|
328
|
+
}
|
|
329
|
+
),
|
|
330
|
+
line.availableForSale === false && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
331
|
+
"p",
|
|
332
|
+
{
|
|
333
|
+
...{
|
|
334
|
+
className: "flex items-center justify-start space-x-2 py-1 px-1.5 rounded text-sm",
|
|
335
|
+
...Object.keys(style || {}).length > 0 && {
|
|
336
|
+
style: {
|
|
337
|
+
backgroundColor: (_c = (_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) == null ? void 0 : _c.replace(")", ",.1)"),
|
|
338
|
+
color: (_e = (_d = style == null ? void 0 : style.text) == null ? void 0 : _d.color) == null ? void 0 : _e.rgb
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
children: [
|
|
343
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
344
|
+
import_warning.default,
|
|
345
|
+
{
|
|
346
|
+
...{
|
|
347
|
+
className: "w-4 h-4",
|
|
348
|
+
"aria-hidden": true
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
),
|
|
352
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Sold out" })
|
|
353
|
+
]
|
|
354
|
+
}
|
|
355
|
+
)
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
),
|
|
359
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
394
360
|
import_input_number.default,
|
|
395
361
|
{
|
|
396
362
|
...{
|
|
397
363
|
"aria-label": "Quantity",
|
|
364
|
+
disabled: updating,
|
|
398
365
|
inline: true,
|
|
399
366
|
layout: "split",
|
|
400
|
-
// The api's most of one item ( lib/cart.js MAX_QUANTITY ).
|
|
401
|
-
max: 99,
|
|
402
367
|
min: 0,
|
|
403
368
|
onChange: (value) => handleQuantity(line, value),
|
|
404
369
|
small: true,
|
|
@@ -406,39 +371,8 @@ const FormSubdomainCart = ({
|
|
|
406
371
|
value: line.quantity
|
|
407
372
|
}
|
|
408
373
|
}
|
|
409
|
-
)
|
|
410
|
-
|
|
411
|
-
image: line.image,
|
|
412
|
-
price: line.price || null,
|
|
413
|
-
subtitle: line.variantTitle !== "Default Title" ? line.variantTitle : null,
|
|
414
|
-
title: line.productTitle
|
|
415
|
-
},
|
|
416
|
-
children: note && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
417
|
-
"p",
|
|
418
|
-
{
|
|
419
|
-
...{
|
|
420
|
-
className: "flex items-center justify-start space-x-2 py-1 px-1.5 rounded text-sm",
|
|
421
|
-
...Object.keys(style || {}).length > 0 && {
|
|
422
|
-
style: {
|
|
423
|
-
backgroundColor: (_c = (_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) == null ? void 0 : _c.replace(")", ",.1)"),
|
|
424
|
-
color: (_e = (_d = style == null ? void 0 : style.text) == null ? void 0 : _d.color) == null ? void 0 : _e.rgb
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
},
|
|
428
|
-
children: [
|
|
429
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
430
|
-
import_warning.default,
|
|
431
|
-
{
|
|
432
|
-
...{
|
|
433
|
-
className: "w-4 h-4",
|
|
434
|
-
"aria-hidden": true
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
),
|
|
438
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: note })
|
|
439
|
-
]
|
|
440
|
-
}
|
|
441
|
-
)
|
|
374
|
+
)
|
|
375
|
+
]
|
|
442
376
|
}
|
|
443
377
|
),
|
|
444
378
|
style
|
|
@@ -449,6 +383,156 @@ const FormSubdomainCart = ({
|
|
|
449
383
|
})
|
|
450
384
|
}
|
|
451
385
|
);
|
|
386
|
+
const footer = lines.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
387
|
+
"div",
|
|
388
|
+
{
|
|
389
|
+
...{
|
|
390
|
+
className: "space-y-4"
|
|
391
|
+
},
|
|
392
|
+
children: [
|
|
393
|
+
cartTotal && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
394
|
+
"div",
|
|
395
|
+
{
|
|
396
|
+
...{
|
|
397
|
+
className: "flex items-center justify-between text-sm"
|
|
398
|
+
},
|
|
399
|
+
children: [
|
|
400
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "SUBTOTAL" }),
|
|
401
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: cartTotal })
|
|
402
|
+
]
|
|
403
|
+
}
|
|
404
|
+
),
|
|
405
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
406
|
+
import_button.default,
|
|
407
|
+
{
|
|
408
|
+
...{
|
|
409
|
+
disabled: !canCheckout,
|
|
410
|
+
loading: updating,
|
|
411
|
+
onClick: handleCheckout,
|
|
412
|
+
style
|
|
413
|
+
},
|
|
414
|
+
children: "Checkout"
|
|
415
|
+
}
|
|
416
|
+
)
|
|
417
|
+
]
|
|
418
|
+
}
|
|
419
|
+
);
|
|
420
|
+
if (children && !drawer) {
|
|
421
|
+
return children(setShow);
|
|
422
|
+
}
|
|
423
|
+
;
|
|
424
|
+
if (children) {
|
|
425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
426
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
427
|
+
"div",
|
|
428
|
+
{
|
|
429
|
+
...{
|
|
430
|
+
className: "transition ease-in-out" + (show ? " blur-[8px]" : " pb-10")
|
|
431
|
+
},
|
|
432
|
+
children: children(setShow)
|
|
433
|
+
}
|
|
434
|
+
),
|
|
435
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
436
|
+
import_overlay.default,
|
|
437
|
+
{
|
|
438
|
+
...{
|
|
439
|
+
className: "z-10 absolute inset-0",
|
|
440
|
+
onClick: () => setShow(false),
|
|
441
|
+
show,
|
|
442
|
+
style
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
),
|
|
446
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
447
|
+
"div",
|
|
448
|
+
{
|
|
449
|
+
...{
|
|
450
|
+
className: "z-20 absolute bottom-0 left-0 w-full max-h-full flex flex-col transition-transform duration-300 ease-out " + (show ? "translate-y-0 rounded-t-xl" : "translate-y-[calc(100%-60px)]"),
|
|
451
|
+
style: (0, import_styles.backgroundStyle)(style)
|
|
452
|
+
},
|
|
453
|
+
children: [
|
|
454
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
455
|
+
import_button.default,
|
|
456
|
+
{
|
|
457
|
+
...{
|
|
458
|
+
onClick: () => setShow(!show),
|
|
459
|
+
variant: "link"
|
|
460
|
+
},
|
|
461
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
462
|
+
"span",
|
|
463
|
+
{
|
|
464
|
+
...{
|
|
465
|
+
className: "flex px-6 w-full items-center justify-between " + (show ? "pt-6" : "border-t border-current py-[17px]"),
|
|
466
|
+
style: (0, import_styles.headerStyle)(style)
|
|
467
|
+
},
|
|
468
|
+
children: [
|
|
469
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
470
|
+
"span",
|
|
471
|
+
{
|
|
472
|
+
...{
|
|
473
|
+
className: "flex items-center space-x-2"
|
|
474
|
+
},
|
|
475
|
+
children: [
|
|
476
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
477
|
+
import_shop.default,
|
|
478
|
+
{
|
|
479
|
+
...{
|
|
480
|
+
className: "w-5 h-5"
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
),
|
|
484
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
485
|
+
"Cart ",
|
|
486
|
+
"(" + lineCount + ")",
|
|
487
|
+
" "
|
|
488
|
+
] })
|
|
489
|
+
]
|
|
490
|
+
}
|
|
491
|
+
),
|
|
492
|
+
show ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
493
|
+
import_chevron_down.default,
|
|
494
|
+
{
|
|
495
|
+
...{
|
|
496
|
+
className: "w-5 h-5"
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
500
|
+
import_chevron_up.default,
|
|
501
|
+
{
|
|
502
|
+
...{
|
|
503
|
+
className: "w-5 h-5"
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
)
|
|
507
|
+
]
|
|
508
|
+
}
|
|
509
|
+
)
|
|
510
|
+
}
|
|
511
|
+
),
|
|
512
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
513
|
+
"div",
|
|
514
|
+
{
|
|
515
|
+
...{
|
|
516
|
+
className: "flex-1 overflow-y-auto px-6" + (lines.length === 0 ? " pb-6" : "")
|
|
517
|
+
},
|
|
518
|
+
children: items
|
|
519
|
+
}
|
|
520
|
+
),
|
|
521
|
+
lines.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
522
|
+
"div",
|
|
523
|
+
{
|
|
524
|
+
...{
|
|
525
|
+
className: "shrink-0 px-6 pb-6"
|
|
526
|
+
},
|
|
527
|
+
children: footer
|
|
528
|
+
}
|
|
529
|
+
)
|
|
530
|
+
]
|
|
531
|
+
}
|
|
532
|
+
)
|
|
533
|
+
] });
|
|
534
|
+
}
|
|
535
|
+
;
|
|
452
536
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
453
537
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
454
538
|
import_form_subdomain_header.FormSubdomainHeader,
|
|
@@ -468,49 +552,7 @@ const FormSubdomainCart = ({
|
|
|
468
552
|
},
|
|
469
553
|
children: [
|
|
470
554
|
items,
|
|
471
|
-
|
|
472
|
-
CartRecommended,
|
|
473
|
-
{
|
|
474
|
-
...{
|
|
475
|
-
items: (cart == null ? void 0 : cart.recommended) || [],
|
|
476
|
-
onOpen: onOpenProduct,
|
|
477
|
-
style
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
),
|
|
481
|
-
lines.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
482
|
-
"div",
|
|
483
|
-
{
|
|
484
|
-
...{
|
|
485
|
-
className: "space-y-4"
|
|
486
|
-
},
|
|
487
|
-
children: [
|
|
488
|
-
cartTotal && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
489
|
-
"div",
|
|
490
|
-
{
|
|
491
|
-
...{
|
|
492
|
-
className: "flex items-center justify-between text-sm"
|
|
493
|
-
},
|
|
494
|
-
children: [
|
|
495
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "SUBTOTAL" }),
|
|
496
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: cartTotal })
|
|
497
|
-
]
|
|
498
|
-
}
|
|
499
|
-
),
|
|
500
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
501
|
-
import_button.default,
|
|
502
|
-
{
|
|
503
|
-
...{
|
|
504
|
-
disabled: !checkoutable,
|
|
505
|
-
onClick: handleCheckout,
|
|
506
|
-
style
|
|
507
|
-
},
|
|
508
|
-
children: "Checkout"
|
|
509
|
-
}
|
|
510
|
-
)
|
|
511
|
-
]
|
|
512
|
-
}
|
|
513
|
-
)
|
|
555
|
+
footer
|
|
514
556
|
]
|
|
515
557
|
}
|
|
516
558
|
)
|
|
@@ -518,8 +560,6 @@ const FormSubdomainCart = ({
|
|
|
518
560
|
};
|
|
519
561
|
// Annotate the CommonJS export names for ESM import in node:
|
|
520
562
|
0 && (module.exports = {
|
|
521
|
-
CartItem,
|
|
522
|
-
CartRecommended,
|
|
523
563
|
FormSubdomainCart,
|
|
524
564
|
FormSubdomainProduct
|
|
525
565
|
});
|