@drawbridge/components 0.1.48 → 0.1.50

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 (125) hide show
  1. package/dist/bridge/fields.js +0 -278
  2. package/dist/bridge/fields.mjs +1 -276
  3. package/dist/bridge/form-subdomain-shop-modal.js +274 -234
  4. package/dist/bridge/form-subdomain-shop-modal.mjs +275 -233
  5. package/dist/bridge/form-subdomain.js +0 -7
  6. package/dist/bridge/form-subdomain.mjs +2 -9
  7. package/dist/bridge/lib/age-gate.js +0 -12
  8. package/dist/bridge/lib/age-gate.mjs +0 -11
  9. package/dist/bridge/lib/checkout-kit.js +32 -2
  10. package/dist/bridge/lib/checkout-kit.mjs +32 -2
  11. package/dist/bridge/lib/entry.js +3 -3
  12. package/dist/bridge/lib/entry.mjs +2 -2
  13. package/dist/bridge/product-tile.js +6 -9
  14. package/dist/bridge/product-tile.mjs +6 -9
  15. package/dist/bridge/template-layout.js +123 -238
  16. package/dist/bridge/template-layout.mjs +124 -239
  17. package/dist/bridge/template-modal.js +73 -28
  18. package/dist/bridge/template-modal.mjs +74 -29
  19. package/dist/dashboard/buttons-subscription.js +1 -1
  20. package/dist/dashboard/buttons-subscription.mjs +1 -1
  21. package/dist/dashboard/campaign-form.js +2 -7
  22. package/dist/dashboard/campaign-form.mjs +2 -7
  23. package/dist/dashboard/card-order.js +4 -22
  24. package/dist/dashboard/card-order.mjs +4 -22
  25. package/dist/dashboard/document-blocks.js +17 -4
  26. package/dist/dashboard/document-blocks.mjs +17 -4
  27. package/dist/dashboard/form-admin-provider.js +17 -71
  28. package/dist/dashboard/form-admin-provider.mjs +17 -71
  29. package/dist/dashboard/form-file-upload.js +2 -3
  30. package/dist/dashboard/form-file-upload.mjs +3 -4
  31. package/dist/dashboard/form-organization-campaign-advertisements.js +6 -47
  32. package/dist/dashboard/form-organization-campaign-advertisements.mjs +6 -47
  33. package/dist/dashboard/form-organization-campaign-agreement.js +121 -83
  34. package/dist/dashboard/form-organization-campaign-agreement.mjs +121 -83
  35. package/dist/dashboard/form-organization-campaign.js +0 -82
  36. package/dist/dashboard/form-organization-campaign.mjs +0 -81
  37. package/dist/dashboard/form-organization-connection.js +6 -48
  38. package/dist/dashboard/form-organization-connection.mjs +7 -48
  39. package/dist/dashboard/form-organization-workflow.js +1 -72
  40. package/dist/dashboard/form-organization-workflow.mjs +1 -69
  41. package/dist/dashboard/form-otc.js +5 -4
  42. package/dist/dashboard/form-otc.mjs +5 -4
  43. package/dist/dashboard/form-stripe.js +5 -12
  44. package/dist/dashboard/form-stripe.mjs +5 -12
  45. package/dist/dashboard/input-fields.js +158 -11
  46. package/dist/dashboard/input-fields.mjs +158 -11
  47. package/dist/dashboard/input-file.js +4 -21
  48. package/dist/dashboard/input-file.mjs +4 -21
  49. package/dist/dashboard/lib/connection-controls.js +2 -5
  50. package/dist/dashboard/lib/connection-controls.mjs +1 -3
  51. package/dist/dashboard/lib/form-page.js +1 -1
  52. package/dist/dashboard/lib/form-page.mjs +1 -1
  53. package/dist/dashboard/lib/uppy.js +1 -10
  54. package/dist/dashboard/lib/uppy.mjs +2 -11
  55. package/dist/dashboard/order-sections.js +6 -456
  56. package/dist/dashboard/order-sections.mjs +7 -453
  57. package/dist/dashboard/provider-ui.js +7 -9
  58. package/dist/dashboard/provider-ui.mjs +7 -9
  59. package/dist/dashboard/template-ui.js +12 -4
  60. package/dist/dashboard/template-ui.mjs +12 -4
  61. package/dist/input-checkbox.js +10 -28
  62. package/dist/input-checkbox.mjs +10 -28
  63. package/dist/product.js +24 -96
  64. package/dist/product.mjs +25 -97
  65. package/dist/shared/lib/helpers.js +6 -54
  66. package/dist/shared/lib/helpers.mjs +8 -53
  67. package/package.json +4 -74
  68. package/types/bridge/fields.d.ts +2 -14
  69. package/types/bridge/form-subdomain-shop-modal.d.ts +3 -27
  70. package/types/bridge/lib/age-gate.d.ts +0 -5
  71. package/types/bridge/lib/checkout-kit.d.ts +10 -2
  72. package/types/bridge/lib/entry.d.ts +3 -3
  73. package/types/dashboard/card-order.d.ts +0 -6
  74. package/types/dashboard/document-blocks.d.ts +3 -2
  75. package/types/dashboard/form-admin-provider.d.ts +2 -9
  76. package/types/dashboard/form-file-upload.d.ts +1 -2
  77. package/types/dashboard/form-organization-campaign-advertisements.d.ts +0 -3
  78. package/types/dashboard/form-organization-campaign-agreement.d.ts +5 -2
  79. package/types/dashboard/form-organization-campaign.d.ts +0 -3
  80. package/types/dashboard/form-organization-connection.d.ts +0 -11
  81. package/types/dashboard/form-otc.d.ts +1 -5
  82. package/types/dashboard/form-stripe.d.ts +2 -3
  83. package/types/dashboard/input-file.d.ts +0 -2
  84. package/types/dashboard/order-sections.d.ts +1 -24
  85. package/types/input-checkbox.d.ts +0 -2
  86. package/types/shared/lib/helpers.d.ts +0 -4
  87. package/dist/bridge/cart-drawer.js +0 -152
  88. package/dist/bridge/cart-drawer.mjs +0 -123
  89. package/dist/bridge/form-subdomain-checkout.js +0 -687
  90. package/dist/bridge/form-subdomain-checkout.mjs +0 -665
  91. package/dist/bridge/lib/cart.js +0 -79
  92. package/dist/bridge/lib/cart.mjs +0 -48
  93. package/dist/dashboard/embed-stripe.js +0 -145
  94. package/dist/dashboard/embed-stripe.mjs +0 -116
  95. package/dist/dashboard/form-organization-campaign-field-birthday.js +0 -193
  96. package/dist/dashboard/form-organization-campaign-field-birthday.mjs +0 -164
  97. package/dist/dashboard/form-organization-campaign-field-rating.js +0 -246
  98. package/dist/dashboard/form-organization-campaign-field-rating.mjs +0 -217
  99. package/dist/dashboard/form-organization-product.js +0 -1461
  100. package/dist/dashboard/form-organization-product.mjs +0 -1425
  101. package/dist/dashboard/input-gallery.js +0 -201
  102. package/dist/dashboard/input-gallery.mjs +0 -172
  103. package/dist/dashboard/lib/products.js +0 -169
  104. package/dist/dashboard/lib/products.mjs +0 -135
  105. package/dist/dashboard/lib/settings-paths.js +0 -35
  106. package/dist/dashboard/lib/settings-paths.mjs +0 -11
  107. package/dist/dashboard/shipping-rates.js +0 -404
  108. package/dist/dashboard/shipping-rates.mjs +0 -371
  109. package/dist/dashboard/template-buyer.js +0 -301
  110. package/dist/dashboard/template-buyer.mjs +0 -267
  111. package/dist/shared/order-summary.js +0 -139
  112. package/dist/shared/order-summary.mjs +0 -110
  113. package/types/bridge/cart-drawer.d.ts +0 -31
  114. package/types/bridge/form-subdomain-checkout.d.ts +0 -20
  115. package/types/bridge/lib/cart.d.ts +0 -44
  116. package/types/dashboard/embed-stripe.d.ts +0 -25
  117. package/types/dashboard/form-organization-campaign-field-birthday.d.ts +0 -31
  118. package/types/dashboard/form-organization-campaign-field-rating.d.ts +0 -33
  119. package/types/dashboard/form-organization-product.d.ts +0 -24
  120. package/types/dashboard/input-gallery.d.ts +0 -14
  121. package/types/dashboard/lib/products.d.ts +0 -14
  122. package/types/dashboard/lib/settings-paths.d.ts +0 -5
  123. package/types/dashboard/shipping-rates.d.ts +0 -26
  124. package/types/dashboard/template-buyer.d.ts +0 -50
  125. package/types/shared/order-summary.d.ts +0 -19
@@ -1,19 +1,23 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useMemo, useState } from "react";
3
+ import { Fragment, useEffect, useMemo, useState } from "react";
4
4
  import { useForm, useWatch } from "react-hook-form";
5
5
  import yup, { resolver } from "./lib/yup.mjs";
6
6
  import { cdnShopify } from "@drawbridge/drawbridge-utils/cdn";
7
- import { money } from "../shared/lib/helpers.mjs";
7
+ import { formatCurrency } from "@drawbridge/drawbridge-utils";
8
8
  import { FormSubdomainHeader } from "./form-subdomain-header.mjs";
9
9
  import Image from "next/image";
10
10
  import Product from "../product.mjs";
11
11
  import Empty from "../shared/empty.mjs";
12
12
  import Button from "../shared/button.mjs";
13
+ import Overlay from "../shared/overlay.mjs";
14
+ import Shop from "../icons/shop.mjs";
13
15
  import InputGroup from "../input-group.mjs";
14
16
  import InputNumber from "../input-number.mjs";
17
+ import { backgroundStyle, headerStyle } from "../styles.mjs";
18
+ import ChevronDown from "../icons/chevron-down.mjs";
19
+ import ChevronUp from "../icons/chevron-up.mjs";
15
20
  import Warning from "../icons/warning.mjs";
16
- import { canCheckout, cartCount, lineNote, recommendedRow } from "./lib/cart.mjs";
17
21
  const FormSubdomainProduct = ({
18
22
  back,
19
23
  button,
@@ -31,12 +35,8 @@ const FormSubdomainProduct = ({
31
35
  );
32
36
  const [action, setAction] = useState(null);
33
37
  const { formState, getValues, setError, clearErrors, setValue, control } = useForm({
34
- // @story checkout/cart
35
- // Only a product with one variant starts with it chosen. With more, the
36
- // buyer chooses, and Add to cart or Buy now before that reads "Please
37
- // select a variant".
38
38
  defaultValues: {
39
- variant: ((product == null ? void 0 : product.variants) || []).length === 1 ? ((_a = available[0]) == null ? void 0 : _a.id) || "" : ""
39
+ variant: ((_a = available[0]) == null ? void 0 : _a.id) || ""
40
40
  },
41
41
  resolver: resolver(
42
42
  yup.object({
@@ -47,7 +47,7 @@ const FormSubdomainProduct = ({
47
47
  const variant = useWatch({ control, name: "variant" });
48
48
  const onVariantChange = (value) => {
49
49
  setValue("variant", value);
50
- clearErrors(value ? ["root", "variant"] : "root");
50
+ clearErrors("root");
51
51
  };
52
52
  const performAction = async (actionType) => {
53
53
  var _a2, _b2;
@@ -129,159 +129,35 @@ const FormSubdomainProduct = ({
129
129
  }
130
130
  );
131
131
  };
132
- const CartItem = ({
133
- aside,
134
- children,
135
- currency,
136
- image,
137
- price,
138
- subtitle,
139
- title
140
- }) => /* @__PURE__ */ jsxs(
141
- "div",
142
- {
143
- ...{
144
- className: "flex items-center space-x-3 text-left"
145
- },
146
- children: [
147
- image && /* @__PURE__ */ jsx(
148
- "div",
149
- {
150
- ...{
151
- className: "relative w-14 h-14 rounded overflow-hidden shrink-0"
152
- },
153
- children: /* @__PURE__ */ jsx(
154
- Image,
155
- {
156
- ...{
157
- alt: title || "",
158
- className: "object-cover",
159
- fill: true,
160
- sizes: "56px",
161
- // A Shopify picture is resized by Shopify's CDN; ours is already sized.
162
- src: /cdn\.shopify\.com/.test(image) && cdnShopify(image, "100x100") || image,
163
- unoptimized: true
164
- }
165
- }
166
- )
167
- }
168
- ),
169
- /* @__PURE__ */ jsxs(
170
- "div",
171
- {
172
- ...{
173
- className: "flex-1 space-y-0.5 min-w-0"
174
- },
175
- children: [
176
- /* @__PURE__ */ jsx(
177
- "p",
178
- {
179
- ...{
180
- className: "text-sm font-medium leading-tight truncate"
181
- },
182
- children: title
183
- }
184
- ),
185
- subtitle && /* @__PURE__ */ jsx(
186
- "p",
187
- {
188
- ...{
189
- className: "text-xs opacity-60"
190
- },
191
- children: subtitle
192
- }
193
- ),
194
- Number.isFinite(Number(price)) && price !== null && /* @__PURE__ */ jsx(
195
- "p",
196
- {
197
- ...{
198
- className: "text-xs opacity-60"
199
- },
200
- children: money({
201
- code: currency,
202
- value: price
203
- })
204
- }
205
- ),
206
- children
207
- ]
208
- }
209
- ),
210
- aside
211
- ]
212
- }
213
- );
214
- const CartRecommended = ({
215
- items = [],
216
- onOpen,
217
- style
218
- }) => items.length > 0 && /* @__PURE__ */ jsxs(
219
- "div",
220
- {
221
- ...{
222
- className: "py-6 space-y-4 border-t border-current"
223
- },
224
- children: [
225
- /* @__PURE__ */ jsx(
226
- FormSubdomainHeader,
227
- {
228
- ...{
229
- style,
230
- title: "Recommended"
231
- }
232
- }
233
- ),
234
- /* @__PURE__ */ jsx(
235
- "div",
236
- {
237
- ...{
238
- className: "space-y-3"
239
- },
240
- children: items.map((product) => /* @__PURE__ */ jsx(
241
- Button,
242
- {
243
- ...{
244
- "aria-label": "Open " + (product.title || "product"),
245
- onClick: () => onOpen == null ? void 0 : onOpen(product),
246
- variant: "link"
247
- },
248
- children: /* @__PURE__ */ jsx(
249
- "span",
250
- {
251
- ...{
252
- className: "block w-full"
253
- },
254
- children: /* @__PURE__ */ jsx(CartItem, { ...recommendedRow(product) })
255
- }
256
- )
257
- },
258
- product.id
259
- ))
260
- }
261
- )
262
- ]
263
- }
264
- );
265
132
  const FormSubdomainCart = ({
266
133
  button,
267
134
  cart,
268
- cut = [],
135
+ children,
136
+ drawer = true,
269
137
  onLineRemove,
270
138
  onLineUpdate,
271
- onOpenProduct,
272
139
  onSuccess,
273
140
  style,
274
141
  tracking
275
142
  }) => {
143
+ const [show, setShow] = useState(false);
144
+ const [updating, setUpdating] = useState(false);
276
145
  const [lineErrors, setLineErrors] = useState({});
277
146
  const lines = useMemo(() => (cart == null ? void 0 : cart.lines) || [], [cart]);
278
- const lineCount = cartCount(cart);
279
- const checkoutable = canCheckout(cart);
280
- const cartTotal = lines.length > 0 ? money({
147
+ useEffect(() => {
148
+ lines.filter((line) => line.quantity <= 0).forEach((line) => onLineRemove(line.id));
149
+ }, [lines, onLineRemove]);
150
+ const lineCount = lines.reduce((sum, line) => sum + (line.quantity || 0), 0);
151
+ const hasSoldOut = lines.some((line) => line.availableForSale === false);
152
+ const canCheckout = Boolean(cart == null ? void 0 : cart.checkoutUrl) && lines.length > 0 && !hasSoldOut;
153
+ const cartTotal = lines.length > 0 ? formatCurrency({
281
154
  code: lines[0].currency,
155
+ display: "parts",
282
156
  value: lines.reduce((sum, line) => sum + Number(line.price) * (line.quantity || 0), 0)
283
157
  }) : null;
284
158
  const wrap = async (lineId, fn) => {
159
+ if (updating) return;
160
+ setUpdating(true);
285
161
  setLineErrors((prev) => {
286
162
  const next = { ...prev };
287
163
  delete next[lineId];
@@ -294,9 +170,11 @@ const FormSubdomainCart = ({
294
170
  ...prev,
295
171
  [lineId]: (error == null ? void 0 : error.message) || "Could not update line"
296
172
  }));
173
+ } finally {
174
+ setUpdating(false);
297
175
  }
298
176
  };
299
- const handleQuantity = (line, next) => next === null || next === void 0 || next === "" || Number.isNaN(Number(next)) ? void 0 : wrap(line.id, () => {
177
+ const handleQuantity = (line, next) => wrap(line.id, () => {
300
178
  var _a, _b;
301
179
  if (next <= 0) {
302
180
  const productSlug = (_a = line.productTitle) == null ? void 0 : _a.toLowerCase().replace(/\s+/g, "-");
@@ -314,7 +192,7 @@ const FormSubdomainCart = ({
314
192
  return onLineUpdate(line.id, next);
315
193
  });
316
194
  const handleCheckout = () => {
317
- if (!checkoutable) return;
195
+ if (!canCheckout) return;
318
196
  onSuccess({
319
197
  result: cart
320
198
  });
@@ -344,26 +222,115 @@ const FormSubdomainCart = ({
344
222
  },
345
223
  children: lines.map((line) => {
346
224
  var _a, _b, _c, _d, _e;
347
- const note = lineNote(line, cut);
348
225
  return /* @__PURE__ */ jsx(
349
226
  InputGroup,
350
227
  {
351
228
  ...{
352
229
  className: "py-6",
353
230
  error: lineErrors[line.id],
354
- input: /* @__PURE__ */ jsx(
355
- CartItem,
231
+ input: /* @__PURE__ */ jsxs(
232
+ "div",
356
233
  {
357
234
  ...{
358
- aside: /* @__PURE__ */ jsx(
235
+ className: "flex items-center space-x-3"
236
+ },
237
+ children: [
238
+ line.image && /* @__PURE__ */ jsx(
239
+ "div",
240
+ {
241
+ ...{
242
+ className: "relative w-14 h-14 rounded overflow-hidden shrink-0"
243
+ },
244
+ children: /* @__PURE__ */ jsx(
245
+ Image,
246
+ {
247
+ ...{
248
+ alt: line.productTitle || "",
249
+ className: "object-cover",
250
+ fill: true,
251
+ sizes: "56px",
252
+ src: cdnShopify(line.image, "100x100") || line.image,
253
+ unoptimized: true
254
+ }
255
+ }
256
+ )
257
+ }
258
+ ),
259
+ /* @__PURE__ */ jsxs(
260
+ "div",
261
+ {
262
+ ...{
263
+ className: "flex-1 space-y-0.5 min-w-0"
264
+ },
265
+ children: [
266
+ /* @__PURE__ */ jsx(
267
+ "p",
268
+ {
269
+ ...{
270
+ className: "text-sm font-medium leading-tight truncate"
271
+ },
272
+ children: line.productTitle
273
+ }
274
+ ),
275
+ line.variantTitle && line.variantTitle !== "Default Title" && /* @__PURE__ */ jsx(
276
+ "p",
277
+ {
278
+ ...{
279
+ className: "text-xs opacity-60"
280
+ },
281
+ children: line.variantTitle
282
+ }
283
+ ),
284
+ line.price && /* @__PURE__ */ jsx(
285
+ "p",
286
+ {
287
+ ...{
288
+ className: "text-xs opacity-60"
289
+ },
290
+ children: formatCurrency({
291
+ code: line.currency,
292
+ display: "parts",
293
+ value: line.price
294
+ })
295
+ }
296
+ ),
297
+ line.availableForSale === false && /* @__PURE__ */ jsxs(
298
+ "p",
299
+ {
300
+ ...{
301
+ className: "flex items-center justify-start space-x-2 py-1 px-1.5 rounded text-sm",
302
+ ...Object.keys(style || {}).length > 0 && {
303
+ style: {
304
+ 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)"),
305
+ color: (_e = (_d = style == null ? void 0 : style.text) == null ? void 0 : _d.color) == null ? void 0 : _e.rgb
306
+ }
307
+ }
308
+ },
309
+ children: [
310
+ /* @__PURE__ */ jsx(
311
+ Warning,
312
+ {
313
+ ...{
314
+ className: "w-4 h-4",
315
+ "aria-hidden": true
316
+ }
317
+ }
318
+ ),
319
+ /* @__PURE__ */ jsx("span", { children: "Sold out" })
320
+ ]
321
+ }
322
+ )
323
+ ]
324
+ }
325
+ ),
326
+ /* @__PURE__ */ jsx(
359
327
  InputNumber,
360
328
  {
361
329
  ...{
362
330
  "aria-label": "Quantity",
331
+ disabled: updating,
363
332
  inline: true,
364
333
  layout: "split",
365
- // The api's most of one item ( lib/cart.js MAX_QUANTITY ).
366
- max: 99,
367
334
  min: 0,
368
335
  onChange: (value) => handleQuantity(line, value),
369
336
  small: true,
@@ -371,39 +338,8 @@ const FormSubdomainCart = ({
371
338
  value: line.quantity
372
339
  }
373
340
  }
374
- ),
375
- currency: line.currency,
376
- image: line.image,
377
- price: line.price || null,
378
- subtitle: line.variantTitle !== "Default Title" ? line.variantTitle : null,
379
- title: line.productTitle
380
- },
381
- children: note && /* @__PURE__ */ jsxs(
382
- "p",
383
- {
384
- ...{
385
- className: "flex items-center justify-start space-x-2 py-1 px-1.5 rounded text-sm",
386
- ...Object.keys(style || {}).length > 0 && {
387
- style: {
388
- 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)"),
389
- color: (_e = (_d = style == null ? void 0 : style.text) == null ? void 0 : _d.color) == null ? void 0 : _e.rgb
390
- }
391
- }
392
- },
393
- children: [
394
- /* @__PURE__ */ jsx(
395
- Warning,
396
- {
397
- ...{
398
- className: "w-4 h-4",
399
- "aria-hidden": true
400
- }
401
- }
402
- ),
403
- /* @__PURE__ */ jsx("span", { children: note })
404
- ]
405
- }
406
- )
341
+ )
342
+ ]
407
343
  }
408
344
  ),
409
345
  style
@@ -414,6 +350,156 @@ const FormSubdomainCart = ({
414
350
  })
415
351
  }
416
352
  );
353
+ const footer = lines.length > 0 && /* @__PURE__ */ jsxs(
354
+ "div",
355
+ {
356
+ ...{
357
+ className: "space-y-4"
358
+ },
359
+ children: [
360
+ cartTotal && /* @__PURE__ */ jsxs(
361
+ "div",
362
+ {
363
+ ...{
364
+ className: "flex items-center justify-between text-sm"
365
+ },
366
+ children: [
367
+ /* @__PURE__ */ jsx("span", { children: "SUBTOTAL" }),
368
+ /* @__PURE__ */ jsx("span", { children: cartTotal })
369
+ ]
370
+ }
371
+ ),
372
+ /* @__PURE__ */ jsx(
373
+ Button,
374
+ {
375
+ ...{
376
+ disabled: !canCheckout,
377
+ loading: updating,
378
+ onClick: handleCheckout,
379
+ style
380
+ },
381
+ children: "Checkout"
382
+ }
383
+ )
384
+ ]
385
+ }
386
+ );
387
+ if (children && !drawer) {
388
+ return children(setShow);
389
+ }
390
+ ;
391
+ if (children) {
392
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
393
+ /* @__PURE__ */ jsx(
394
+ "div",
395
+ {
396
+ ...{
397
+ className: "transition ease-in-out" + (show ? " blur-[8px]" : " pb-10")
398
+ },
399
+ children: children(setShow)
400
+ }
401
+ ),
402
+ /* @__PURE__ */ jsx(
403
+ Overlay,
404
+ {
405
+ ...{
406
+ className: "z-10 absolute inset-0",
407
+ onClick: () => setShow(false),
408
+ show,
409
+ style
410
+ }
411
+ }
412
+ ),
413
+ /* @__PURE__ */ jsxs(
414
+ "div",
415
+ {
416
+ ...{
417
+ 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)]"),
418
+ style: backgroundStyle(style)
419
+ },
420
+ children: [
421
+ /* @__PURE__ */ jsx(
422
+ Button,
423
+ {
424
+ ...{
425
+ onClick: () => setShow(!show),
426
+ variant: "link"
427
+ },
428
+ children: /* @__PURE__ */ jsxs(
429
+ "span",
430
+ {
431
+ ...{
432
+ className: "flex px-6 w-full items-center justify-between " + (show ? "pt-6" : "border-t border-current py-[17px]"),
433
+ style: headerStyle(style)
434
+ },
435
+ children: [
436
+ /* @__PURE__ */ jsxs(
437
+ "span",
438
+ {
439
+ ...{
440
+ className: "flex items-center space-x-2"
441
+ },
442
+ children: [
443
+ /* @__PURE__ */ jsx(
444
+ Shop,
445
+ {
446
+ ...{
447
+ className: "w-5 h-5"
448
+ }
449
+ }
450
+ ),
451
+ /* @__PURE__ */ jsxs("span", { children: [
452
+ "Cart ",
453
+ "(" + lineCount + ")",
454
+ " "
455
+ ] })
456
+ ]
457
+ }
458
+ ),
459
+ show ? /* @__PURE__ */ jsx(
460
+ ChevronDown,
461
+ {
462
+ ...{
463
+ className: "w-5 h-5"
464
+ }
465
+ }
466
+ ) : /* @__PURE__ */ jsx(
467
+ ChevronUp,
468
+ {
469
+ ...{
470
+ className: "w-5 h-5"
471
+ }
472
+ }
473
+ )
474
+ ]
475
+ }
476
+ )
477
+ }
478
+ ),
479
+ /* @__PURE__ */ jsx(
480
+ "div",
481
+ {
482
+ ...{
483
+ className: "flex-1 overflow-y-auto px-6" + (lines.length === 0 ? " pb-6" : "")
484
+ },
485
+ children: items
486
+ }
487
+ ),
488
+ lines.length > 0 && /* @__PURE__ */ jsx(
489
+ "div",
490
+ {
491
+ ...{
492
+ className: "shrink-0 px-6 pb-6"
493
+ },
494
+ children: footer
495
+ }
496
+ )
497
+ ]
498
+ }
499
+ )
500
+ ] });
501
+ }
502
+ ;
417
503
  return /* @__PURE__ */ jsxs("div", { children: [
418
504
  /* @__PURE__ */ jsx(
419
505
  FormSubdomainHeader,
@@ -433,57 +519,13 @@ const FormSubdomainCart = ({
433
519
  },
434
520
  children: [
435
521
  items,
436
- /* @__PURE__ */ jsx(
437
- CartRecommended,
438
- {
439
- ...{
440
- items: (cart == null ? void 0 : cart.recommended) || [],
441
- onOpen: onOpenProduct,
442
- style
443
- }
444
- }
445
- ),
446
- lines.length > 0 && /* @__PURE__ */ jsxs(
447
- "div",
448
- {
449
- ...{
450
- className: "space-y-4"
451
- },
452
- children: [
453
- cartTotal && /* @__PURE__ */ jsxs(
454
- "div",
455
- {
456
- ...{
457
- className: "flex items-center justify-between text-sm"
458
- },
459
- children: [
460
- /* @__PURE__ */ jsx("span", { children: "SUBTOTAL" }),
461
- /* @__PURE__ */ jsx("span", { children: cartTotal })
462
- ]
463
- }
464
- ),
465
- /* @__PURE__ */ jsx(
466
- Button,
467
- {
468
- ...{
469
- disabled: !checkoutable,
470
- onClick: handleCheckout,
471
- style
472
- },
473
- children: "Checkout"
474
- }
475
- )
476
- ]
477
- }
478
- )
522
+ footer
479
523
  ]
480
524
  }
481
525
  )
482
526
  ] });
483
527
  };
484
528
  export {
485
- CartItem,
486
- CartRecommended,
487
529
  FormSubdomainCart,
488
530
  FormSubdomainProduct
489
531
  };
@@ -848,7 +848,6 @@ const FormSubdomainSection = ({
848
848
  var _a2;
849
849
  return (0, import_entry.agreementContent)((_a2 = values == null ? void 0 : values.agreements) == null ? void 0 : _a2[key]);
850
850
  };
851
- const optOutLine = (0, import_entry.termsOptOut)(values);
852
851
  const smsConsent = Boolean(last) && (values == null ? void 0 : values.sms) !== false && Boolean((_c = (_b = values == null ? void 0 : values.agreements) == null ? void 0 : _b.sms) == null ? void 0 : _c.enabled) && slugs.includes("phone");
853
852
  const marketingConsent = Boolean(last) && Boolean((_e = (_d = values == null ? void 0 : values.agreements) == null ? void 0 : _d.marketing) == null ? void 0 : _e.enabled) && (0, import_entry.agreementShown)((_f = values == null ? void 0 : values.agreements) == null ? void 0 : _f.marketing);
854
853
  const termsConsent = Boolean(last) && Boolean((_h = (_g = values == null ? void 0 : values.agreements) == null ? void 0 : _g.terms) == null ? void 0 : _h.enabled) && (0, import_entry.agreementShown)((_i = values == null ? void 0 : values.agreements) == null ? void 0 : _i.terms);
@@ -1149,11 +1148,6 @@ const FormSubdomainSection = ({
1149
1148
  {
1150
1149
  ...{
1151
1150
  error: (_c2 = (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.agreements) == null ? void 0 : _b2[key]) == null ? void 0 : _c2.message,
1152
- // @story public-entry/read-agreement
1153
- // The organizer's own rules may not say it; our document does, in Opting out.
1154
- ...key === "terms" && opens("terms") === "link" && optOutLine && {
1155
- message: optOutLine
1156
- },
1157
1151
  input: checkbox({
1158
1152
  fallback,
1159
1153
  key,
@@ -1369,7 +1363,6 @@ const FormSubdomain = ({
1369
1363
  callback: (object) => {
1370
1364
  setData({
1371
1365
  ...data,
1372
- fields: (0, import_age_gate.ageBirthday)(fields, data.fields, object == null ? void 0 : object.birthday),
1373
1366
  integrations: {
1374
1367
  ...data.integrations,
1375
1368
  ...object
@@ -10,11 +10,11 @@ import { ordersItems } from "@drawbridge/drawbridge-utils/fields-validate";
10
10
  import { captureException } from "@drawbridge/drawbridge-telemetry/nextjs";
11
11
  import { useForm, useWatch, Controller } from "react-hook-form";
12
12
  import yup, { resolver } from "./lib/yup.mjs";
13
- import { ageBirthday, ageFor, ageGateSchema } from "./lib/age-gate.mjs";
13
+ import { ageFor, ageGateSchema } from "./lib/age-gate.mjs";
14
14
  import { useGoogleReCaptcha } from "react-google-recaptcha-v3";
15
15
  import { assertRecaptcha } from "./lib/recaptcha.mjs";
16
16
  import { submissionEndpoint } from "./lib/url.mjs";
17
- import { AFTER, agreementContent, agreementPhrase, agreementShown, agreementTitles, agreementWording, panelMissions, termsOptOut } from "./lib/entry.mjs";
17
+ import { AFTER, agreementContent, agreementPhrase, agreementShown, agreementTitles, agreementWording, panelMissions } from "./lib/entry.mjs";
18
18
  import FormSubdomainAgreement from "./form-subdomain-agreement.mjs";
19
19
  import { LOCATION_TIMEOUT, locationCopy, locationStatus } from "./lib/location.mjs";
20
20
  import { isLastList, itemCount, itemRuns, limitMessage, orderTotal, priced, refusedSection, sectionsOf } from "./lib/order.mjs";
@@ -811,7 +811,6 @@ const FormSubdomainSection = ({
811
811
  var _a2;
812
812
  return agreementContent((_a2 = values == null ? void 0 : values.agreements) == null ? void 0 : _a2[key]);
813
813
  };
814
- const optOutLine = termsOptOut(values);
815
814
  const smsConsent = Boolean(last) && (values == null ? void 0 : values.sms) !== false && Boolean((_c = (_b = values == null ? void 0 : values.agreements) == null ? void 0 : _b.sms) == null ? void 0 : _c.enabled) && slugs.includes("phone");
816
815
  const marketingConsent = Boolean(last) && Boolean((_e = (_d = values == null ? void 0 : values.agreements) == null ? void 0 : _d.marketing) == null ? void 0 : _e.enabled) && agreementShown((_f = values == null ? void 0 : values.agreements) == null ? void 0 : _f.marketing);
817
816
  const termsConsent = Boolean(last) && Boolean((_h = (_g = values == null ? void 0 : values.agreements) == null ? void 0 : _g.terms) == null ? void 0 : _h.enabled) && agreementShown((_i = values == null ? void 0 : values.agreements) == null ? void 0 : _i.terms);
@@ -1112,11 +1111,6 @@ const FormSubdomainSection = ({
1112
1111
  {
1113
1112
  ...{
1114
1113
  error: (_c2 = (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.agreements) == null ? void 0 : _b2[key]) == null ? void 0 : _c2.message,
1115
- // @story public-entry/read-agreement
1116
- // The organizer's own rules may not say it; our document does, in Opting out.
1117
- ...key === "terms" && opens("terms") === "link" && optOutLine && {
1118
- message: optOutLine
1119
- },
1120
1114
  input: checkbox({
1121
1115
  fallback,
1122
1116
  key,
@@ -1332,7 +1326,6 @@ const FormSubdomain = ({
1332
1326
  callback: (object) => {
1333
1327
  setData({
1334
1328
  ...data,
1335
- fields: ageBirthday(fields, data.fields, object == null ? void 0 : object.birthday),
1336
1329
  integrations: {
1337
1330
  ...data.integrations,
1338
1331
  ...object