@drawbridge/components 0.1.47 → 0.1.48

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.
Files changed (114) hide show
  1. package/dist/bridge/cart-drawer.js +152 -0
  2. package/dist/bridge/cart-drawer.mjs +123 -0
  3. package/dist/bridge/fields.js +278 -0
  4. package/dist/bridge/fields.mjs +276 -1
  5. package/dist/bridge/form-subdomain-checkout.js +687 -0
  6. package/dist/bridge/form-subdomain-checkout.mjs +665 -0
  7. package/dist/bridge/form-subdomain-shop-modal.js +234 -274
  8. package/dist/bridge/form-subdomain-shop-modal.mjs +233 -275
  9. package/dist/bridge/form-subdomain.js +1 -0
  10. package/dist/bridge/form-subdomain.mjs +2 -1
  11. package/dist/bridge/lib/age-gate.js +12 -0
  12. package/dist/bridge/lib/age-gate.mjs +11 -0
  13. package/dist/bridge/lib/cart.js +79 -0
  14. package/dist/bridge/lib/cart.mjs +48 -0
  15. package/dist/bridge/lib/checkout-kit.js +2 -32
  16. package/dist/bridge/lib/checkout-kit.mjs +2 -32
  17. package/dist/bridge/product-tile.js +9 -6
  18. package/dist/bridge/product-tile.mjs +9 -6
  19. package/dist/bridge/template-layout.js +237 -122
  20. package/dist/bridge/template-layout.mjs +237 -122
  21. package/dist/bridge/template-modal.js +28 -73
  22. package/dist/bridge/template-modal.mjs +29 -74
  23. package/dist/dashboard/buttons-subscription.js +1 -1
  24. package/dist/dashboard/buttons-subscription.mjs +1 -1
  25. package/dist/dashboard/campaign-form.js +7 -2
  26. package/dist/dashboard/campaign-form.mjs +7 -2
  27. package/dist/dashboard/card-order.js +22 -4
  28. package/dist/dashboard/card-order.mjs +22 -4
  29. package/dist/dashboard/embed-stripe.js +145 -0
  30. package/dist/dashboard/embed-stripe.mjs +116 -0
  31. package/dist/dashboard/form-admin-provider.js +71 -17
  32. package/dist/dashboard/form-admin-provider.mjs +71 -17
  33. package/dist/dashboard/form-file-upload.js +3 -2
  34. package/dist/dashboard/form-file-upload.mjs +4 -3
  35. package/dist/dashboard/form-organization-campaign-advertisements.js +47 -6
  36. package/dist/dashboard/form-organization-campaign-advertisements.mjs +47 -6
  37. package/dist/dashboard/form-organization-campaign-field-birthday.js +193 -0
  38. package/dist/dashboard/form-organization-campaign-field-birthday.mjs +164 -0
  39. package/dist/dashboard/form-organization-campaign-field-rating.js +246 -0
  40. package/dist/dashboard/form-organization-campaign-field-rating.mjs +217 -0
  41. package/dist/dashboard/form-organization-campaign.js +82 -0
  42. package/dist/dashboard/form-organization-campaign.mjs +81 -0
  43. package/dist/dashboard/form-organization-connection.js +48 -6
  44. package/dist/dashboard/form-organization-connection.mjs +48 -7
  45. package/dist/dashboard/form-organization-product.js +1461 -0
  46. package/dist/dashboard/form-organization-product.mjs +1425 -0
  47. package/dist/dashboard/form-organization-workflow.js +72 -1
  48. package/dist/dashboard/form-organization-workflow.mjs +69 -1
  49. package/dist/dashboard/form-otc.js +4 -5
  50. package/dist/dashboard/form-otc.mjs +4 -5
  51. package/dist/dashboard/form-stripe.js +12 -5
  52. package/dist/dashboard/form-stripe.mjs +12 -5
  53. package/dist/dashboard/input-fields.js +11 -158
  54. package/dist/dashboard/input-fields.mjs +11 -158
  55. package/dist/dashboard/input-file.js +21 -4
  56. package/dist/dashboard/input-file.mjs +21 -4
  57. package/dist/dashboard/input-gallery.js +201 -0
  58. package/dist/dashboard/input-gallery.mjs +172 -0
  59. package/dist/dashboard/lib/connection-controls.js +5 -2
  60. package/dist/dashboard/lib/connection-controls.mjs +3 -1
  61. package/dist/dashboard/lib/form-page.js +1 -1
  62. package/dist/dashboard/lib/form-page.mjs +1 -1
  63. package/dist/dashboard/lib/products.js +169 -0
  64. package/dist/dashboard/lib/products.mjs +135 -0
  65. package/dist/dashboard/lib/settings-paths.js +35 -0
  66. package/dist/dashboard/lib/settings-paths.mjs +11 -0
  67. package/dist/dashboard/lib/uppy.js +10 -1
  68. package/dist/dashboard/lib/uppy.mjs +11 -2
  69. package/dist/dashboard/order-sections.js +456 -6
  70. package/dist/dashboard/order-sections.mjs +453 -7
  71. package/dist/dashboard/provider-ui.js +9 -7
  72. package/dist/dashboard/provider-ui.mjs +9 -7
  73. package/dist/dashboard/shipping-rates.js +404 -0
  74. package/dist/dashboard/shipping-rates.mjs +371 -0
  75. package/dist/dashboard/template-buyer.js +301 -0
  76. package/dist/dashboard/template-buyer.mjs +267 -0
  77. package/dist/input-checkbox.js +28 -10
  78. package/dist/input-checkbox.mjs +28 -10
  79. package/dist/product.js +96 -24
  80. package/dist/product.mjs +97 -25
  81. package/dist/shared/lib/helpers.js +54 -6
  82. package/dist/shared/lib/helpers.mjs +53 -8
  83. package/dist/shared/order-summary.js +139 -0
  84. package/dist/shared/order-summary.mjs +110 -0
  85. package/package.json +74 -4
  86. package/types/bridge/cart-drawer.d.ts +31 -0
  87. package/types/bridge/fields.d.ts +14 -2
  88. package/types/bridge/form-subdomain-checkout.d.ts +20 -0
  89. package/types/bridge/form-subdomain-shop-modal.d.ts +27 -3
  90. package/types/bridge/lib/age-gate.d.ts +5 -0
  91. package/types/bridge/lib/cart.d.ts +44 -0
  92. package/types/bridge/lib/checkout-kit.d.ts +2 -10
  93. package/types/dashboard/card-order.d.ts +6 -0
  94. package/types/dashboard/embed-stripe.d.ts +25 -0
  95. package/types/dashboard/form-admin-provider.d.ts +9 -2
  96. package/types/dashboard/form-file-upload.d.ts +2 -1
  97. package/types/dashboard/form-organization-campaign-advertisements.d.ts +3 -0
  98. package/types/dashboard/form-organization-campaign-field-birthday.d.ts +31 -0
  99. package/types/dashboard/form-organization-campaign-field-rating.d.ts +33 -0
  100. package/types/dashboard/form-organization-campaign.d.ts +3 -0
  101. package/types/dashboard/form-organization-connection.d.ts +11 -0
  102. package/types/dashboard/form-organization-product.d.ts +24 -0
  103. package/types/dashboard/form-otc.d.ts +5 -1
  104. package/types/dashboard/form-stripe.d.ts +3 -2
  105. package/types/dashboard/input-file.d.ts +2 -0
  106. package/types/dashboard/input-gallery.d.ts +14 -0
  107. package/types/dashboard/lib/products.d.ts +14 -0
  108. package/types/dashboard/lib/settings-paths.d.ts +5 -0
  109. package/types/dashboard/order-sections.d.ts +24 -1
  110. package/types/dashboard/shipping-rates.d.ts +26 -0
  111. package/types/dashboard/template-buyer.d.ts +50 -0
  112. package/types/input-checkbox.d.ts +2 -0
  113. package/types/shared/lib/helpers.d.ts +4 -0
  114. package/types/shared/order-summary.d.ts +19 -0
@@ -28,6 +28,8 @@ 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,
31
33
  FormSubdomainCart: () => FormSubdomainCart,
32
34
  FormSubdomainProduct: () => FormSubdomainProduct
33
35
  });
@@ -37,20 +39,16 @@ var import_react = require("react");
37
39
  var import_react_hook_form = require("react-hook-form");
38
40
  var import_yup = __toESM(require("./lib/yup"));
39
41
  var import_cdn = require("@drawbridge/drawbridge-utils/cdn");
40
- var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
42
+ var import_helpers = require("../shared/lib/helpers");
41
43
  var import_form_subdomain_header = require("./form-subdomain-header");
42
44
  var import_image = __toESM(require("next/image"));
43
45
  var import_product = __toESM(require("../product"));
44
46
  var import_empty = __toESM(require("../shared/empty"));
45
47
  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"));
53
50
  var import_warning = __toESM(require("../icons/warning"));
51
+ var import_cart = require("./lib/cart");
54
52
  const FormSubdomainProduct = ({
55
53
  back,
56
54
  button,
@@ -68,8 +66,12 @@ const FormSubdomainProduct = ({
68
66
  );
69
67
  const [action, setAction] = (0, import_react.useState)(null);
70
68
  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".
71
73
  defaultValues: {
72
- variant: ((_a = available[0]) == null ? void 0 : _a.id) || ""
74
+ variant: ((product == null ? void 0 : product.variants) || []).length === 1 ? ((_a = available[0]) == null ? void 0 : _a.id) || "" : ""
73
75
  },
74
76
  resolver: (0, import_yup.resolver)(
75
77
  import_yup.default.object({
@@ -80,7 +82,7 @@ const FormSubdomainProduct = ({
80
82
  const variant = (0, import_react_hook_form.useWatch)({ control, name: "variant" });
81
83
  const onVariantChange = (value) => {
82
84
  setValue("variant", value);
83
- clearErrors("root");
85
+ clearErrors(value ? ["root", "variant"] : "root");
84
86
  };
85
87
  const performAction = async (actionType) => {
86
88
  var _a2, _b2;
@@ -162,35 +164,159 @@ const FormSubdomainProduct = ({
162
164
  }
163
165
  );
164
166
  };
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
+ );
165
300
  const FormSubdomainCart = ({
166
301
  button,
167
302
  cart,
168
- children,
169
- drawer = true,
303
+ cut = [],
170
304
  onLineRemove,
171
305
  onLineUpdate,
306
+ onOpenProduct,
172
307
  onSuccess,
173
308
  style,
174
309
  tracking
175
310
  }) => {
176
- const [show, setShow] = (0, import_react.useState)(false);
177
- const [updating, setUpdating] = (0, import_react.useState)(false);
178
311
  const [lineErrors, setLineErrors] = (0, import_react.useState)({});
179
312
  const lines = (0, import_react.useMemo)(() => (cart == null ? void 0 : cart.lines) || [], [cart]);
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)({
313
+ const lineCount = (0, import_cart.cartCount)(cart);
314
+ const checkoutable = (0, import_cart.canCheckout)(cart);
315
+ const cartTotal = lines.length > 0 ? (0, import_helpers.money)({
187
316
  code: lines[0].currency,
188
- display: "parts",
189
317
  value: lines.reduce((sum, line) => sum + Number(line.price) * (line.quantity || 0), 0)
190
318
  }) : null;
191
319
  const wrap = async (lineId, fn) => {
192
- if (updating) return;
193
- setUpdating(true);
194
320
  setLineErrors((prev) => {
195
321
  const next = { ...prev };
196
322
  delete next[lineId];
@@ -203,11 +329,9 @@ const FormSubdomainCart = ({
203
329
  ...prev,
204
330
  [lineId]: (error == null ? void 0 : error.message) || "Could not update line"
205
331
  }));
206
- } finally {
207
- setUpdating(false);
208
332
  }
209
333
  };
210
- const handleQuantity = (line, next) => wrap(line.id, () => {
334
+ const handleQuantity = (line, next) => next === null || next === void 0 || next === "" || Number.isNaN(Number(next)) ? void 0 : wrap(line.id, () => {
211
335
  var _a, _b;
212
336
  if (next <= 0) {
213
337
  const productSlug = (_a = line.productTitle) == null ? void 0 : _a.toLowerCase().replace(/\s+/g, "-");
@@ -225,7 +349,7 @@ const FormSubdomainCart = ({
225
349
  return onLineUpdate(line.id, next);
226
350
  });
227
351
  const handleCheckout = () => {
228
- if (!canCheckout) return;
352
+ if (!checkoutable) return;
229
353
  onSuccess({
230
354
  result: cart
231
355
  });
@@ -255,115 +379,26 @@ const FormSubdomainCart = ({
255
379
  },
256
380
  children: lines.map((line) => {
257
381
  var _a, _b, _c, _d, _e;
382
+ const note = (0, import_cart.lineNote)(line, cut);
258
383
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
259
384
  import_input_group.default,
260
385
  {
261
386
  ...{
262
387
  className: "py-6",
263
388
  error: lineErrors[line.id],
264
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
265
- "div",
389
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
390
+ CartItem,
266
391
  {
267
392
  ...{
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)(
393
+ aside: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
360
394
  import_input_number.default,
361
395
  {
362
396
  ...{
363
397
  "aria-label": "Quantity",
364
- disabled: updating,
365
398
  inline: true,
366
399
  layout: "split",
400
+ // The api's most of one item ( lib/cart.js MAX_QUANTITY ).
401
+ max: 99,
367
402
  min: 0,
368
403
  onChange: (value) => handleQuantity(line, value),
369
404
  small: true,
@@ -371,8 +406,39 @@ const FormSubdomainCart = ({
371
406
  value: line.quantity
372
407
  }
373
408
  }
374
- )
375
- ]
409
+ ),
410
+ currency: line.currency,
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
+ )
376
442
  }
377
443
  ),
378
444
  style
@@ -383,156 +449,6 @@ const FormSubdomainCart = ({
383
449
  })
384
450
  }
385
451
  );
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
- ;
536
452
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
537
453
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
538
454
  import_form_subdomain_header.FormSubdomainHeader,
@@ -552,7 +468,49 @@ const FormSubdomainCart = ({
552
468
  },
553
469
  children: [
554
470
  items,
555
- footer
471
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
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
+ )
556
514
  ]
557
515
  }
558
516
  )
@@ -560,6 +518,8 @@ const FormSubdomainCart = ({
560
518
  };
561
519
  // Annotate the CommonJS export names for ESM import in node:
562
520
  0 && (module.exports = {
521
+ CartItem,
522
+ CartRecommended,
563
523
  FormSubdomainCart,
564
524
  FormSubdomainProduct
565
525
  });