@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
@@ -1,15 +1,32 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
3
4
  import { useQueryClient } from "@tanstack/react-query";
4
- import { formatDateString } from "@drawbridge/drawbridge-utils";
5
+ import { formatCurrency, formatDateString } from "@drawbridge/drawbridge-utils";
5
6
  import { request } from "@drawbridge/drawbridge-utils/fetch";
7
+ import { CARRIERS, paymentOf, shopifyOrderUrl } from "@drawbridge/drawbridge-utils/products";
8
+ import { Controller, useForm } from "../shared/lib/form.mjs";
9
+ import { statusBadge } from "../shared/lib/helpers.mjs";
6
10
  import { useCallbacks, useModal } from "./lib/hooks.mjs";
11
+ import CardDataItem from "./card-data-item.mjs";
7
12
  import CardSection from "./card-section.mjs";
13
+ import CardSetting from "./card-setting.mjs";
8
14
  import CardTask from "./card-task.mjs";
15
+ import EmbedStripe from "./embed-stripe.mjs";
9
16
  import FormAction from "./form-action.mjs";
10
17
  import Paged from "./paged.mjs";
18
+ import AddressLines from "../shared/address-lines.mjs";
11
19
  import Badge from "../shared/badge.mjs";
12
20
  import Button from "../shared/button.mjs";
21
+ import Empty from "../shared/empty.mjs";
22
+ import Fieldset from "../shared/fieldset.mjs";
23
+ import Form from "../shared/form.mjs";
24
+ import OrderSummary from "../shared/order-summary.mjs";
25
+ import InputCheckbox from "../input-checkbox.mjs";
26
+ import InputGroup from "../input-group.mjs";
27
+ import InputSelect from "../input-select.mjs";
28
+ import InputText from "../input-text.mjs";
29
+ import External from "../icons/external.mjs";
13
30
  import Plus from "../icons/plus.mjs";
14
31
  const date = (value) => formatDateString({
15
32
  date: value,
@@ -28,8 +45,8 @@ const useConfirm = () => {
28
45
  const { onError } = useCallbacks({
29
46
  queryClient
30
47
  });
31
- return ({ action, body, endpoint, message, method = "PUT", onSuccess, task, warning }) => modal.open({
32
- title: action,
48
+ return ({ action, body, endpoint, message, method = "PUT", onSuccess, task, title, warning }) => modal.open({
49
+ title: title || action,
33
50
  message: /* @__PURE__ */ jsxs(
34
51
  FormAction,
35
52
  {
@@ -76,19 +93,305 @@ const fulfillmentControls = ({ manage, order }) => {
76
93
  var _a;
77
94
  const editable = Boolean(manage) && (order == null ? void 0 : order.status) === "open";
78
95
  return {
79
- add: editable && ((_a = order == null ? void 0 : order.fulfillment) == null ? void 0 : _a.status) !== "fulfilled",
96
+ add: editable && ((_a = order == null ? void 0 : order.fulfillment) == null ? void 0 : _a.status) !== "fulfilled" && (order == null ? void 0 : order.payment) !== "refunded",
80
97
  cancel: editable
81
98
  };
82
99
  };
100
+ const stripeOrder = (order) => {
101
+ var _a;
102
+ return ((_a = order == null ? void 0 : order.provider) == null ? void 0 : _a.slug) === "stripe";
103
+ };
104
+ const moneyOf = (order) => (value) => formatCurrency({ code: ((order == null ? void 0 : order.currency) || "usd").toUpperCase(), value: value || 0 });
105
+ const FormFulfill = ({ endpoint, onError, onSuccess }) => {
106
+ const { control, formState, handleSubmit } = useForm({
107
+ values: {
108
+ carrier: CARRIERS[0],
109
+ emailed: true,
110
+ tracking: ""
111
+ }
112
+ });
113
+ const onSubmit = async ({ carrier, emailed, tracking }) => {
114
+ try {
115
+ onSuccess(await request({
116
+ body: {
117
+ carrier,
118
+ emailed: Boolean(emailed),
119
+ tracking: (tracking || "").trim()
120
+ },
121
+ endpoint: endpoint + "/fulfillment",
122
+ method: "POST"
123
+ }));
124
+ } catch (error) {
125
+ onError == null ? void 0 : onError(error);
126
+ }
127
+ };
128
+ return /* @__PURE__ */ jsxs(
129
+ Form,
130
+ {
131
+ ...{
132
+ className: "relative w-full space-y-6",
133
+ onSubmit: handleSubmit(onSubmit)
134
+ },
135
+ children: [
136
+ /* @__PURE__ */ jsxs(
137
+ Fieldset,
138
+ {
139
+ ...{
140
+ className: "space-y-6",
141
+ disabled: formState == null ? void 0 : formState.isSubmitting
142
+ },
143
+ children: [
144
+ /* @__PURE__ */ jsx(
145
+ Controller,
146
+ {
147
+ ...{
148
+ control,
149
+ name: "carrier",
150
+ render: ({ field: { onChange, value } }) => /* @__PURE__ */ jsx(
151
+ InputGroup,
152
+ {
153
+ ...{
154
+ input: /* @__PURE__ */ jsx(
155
+ InputSelect,
156
+ {
157
+ ...{
158
+ onChange,
159
+ options: CARRIERS.map((carrier) => ({
160
+ label: carrier,
161
+ value: carrier
162
+ })),
163
+ value
164
+ }
165
+ }
166
+ ),
167
+ label: "Carrier"
168
+ }
169
+ }
170
+ )
171
+ }
172
+ }
173
+ ),
174
+ /* @__PURE__ */ jsx(
175
+ Controller,
176
+ {
177
+ ...{
178
+ control,
179
+ name: "tracking",
180
+ render: ({ field: { onChange, value } }) => /* @__PURE__ */ jsx(
181
+ InputGroup,
182
+ {
183
+ ...{
184
+ input: /* @__PURE__ */ jsx(
185
+ InputText,
186
+ {
187
+ ...{
188
+ onChange,
189
+ value: value || ""
190
+ }
191
+ }
192
+ ),
193
+ label: "Tracking number"
194
+ }
195
+ }
196
+ )
197
+ }
198
+ }
199
+ ),
200
+ /* @__PURE__ */ jsx(
201
+ Controller,
202
+ {
203
+ ...{
204
+ control,
205
+ name: "emailed",
206
+ render: ({ field: { onChange, value } }) => /* @__PURE__ */ jsx(
207
+ InputCheckbox,
208
+ {
209
+ ...{
210
+ label: "Email the customer their tracking details",
211
+ onChange,
212
+ value
213
+ }
214
+ }
215
+ )
216
+ }
217
+ }
218
+ )
219
+ ]
220
+ }
221
+ ),
222
+ /* @__PURE__ */ jsx(
223
+ Fieldset,
224
+ {
225
+ ...{
226
+ disabled: formState == null ? void 0 : formState.isSubmitting
227
+ },
228
+ children: /* @__PURE__ */ jsx(
229
+ Button,
230
+ {
231
+ ...{
232
+ loading: formState == null ? void 0 : formState.isSubmitting,
233
+ type: "submit"
234
+ },
235
+ children: "Mark as fulfilled"
236
+ }
237
+ )
238
+ }
239
+ )
240
+ ]
241
+ }
242
+ );
243
+ };
244
+ const ShopifyFulfillment = ({ order }) => {
245
+ var _a, _b, _c;
246
+ const status = statusBadge("fulfillment", (_a = order == null ? void 0 : order.fulfillment) == null ? void 0 : _a.status);
247
+ const href = shopifyOrderUrl({ domain: (_b = order == null ? void 0 : order.source) == null ? void 0 : _b.domain, providerId: (_c = order == null ? void 0 : order.provider) == null ? void 0 : _c.id });
248
+ return status && /* @__PURE__ */ jsx(
249
+ CardSection,
250
+ {
251
+ ...{
252
+ className: "shrink-0",
253
+ cta: href && /* @__PURE__ */ jsx(
254
+ Button,
255
+ {
256
+ ...{
257
+ ...small,
258
+ "aria-label": "Open in Shopify",
259
+ element: "a",
260
+ href,
261
+ icon: External,
262
+ target: "_blank"
263
+ }
264
+ }
265
+ ),
266
+ title: "Fulfillment"
267
+ },
268
+ children: /* @__PURE__ */ jsx(
269
+ Empty,
270
+ {
271
+ ...{
272
+ variant: "secondary"
273
+ },
274
+ children: /* @__PURE__ */ jsx("p", { children: "This order is " + status.text.toLowerCase() + " in Shopify" })
275
+ }
276
+ )
277
+ }
278
+ );
279
+ };
83
280
  const small = {
84
281
  inline: true,
85
282
  size: "small",
86
283
  variant: "secondary"
87
284
  };
285
+ const PaidRow = ({ cancel, disabled, item }) => /* @__PURE__ */ jsxs(
286
+ "div",
287
+ {
288
+ ...{
289
+ className: "space-y-3 py-4 first:pt-0 last:pb-0"
290
+ },
291
+ children: [
292
+ /* @__PURE__ */ jsxs(
293
+ "div",
294
+ {
295
+ ...{
296
+ className: "flex items-center justify-between gap-4"
297
+ },
298
+ children: [
299
+ /* @__PURE__ */ jsxs(
300
+ "div",
301
+ {
302
+ ...{
303
+ className: "flex items-center gap-3 min-w-0"
304
+ },
305
+ children: [
306
+ /* @__PURE__ */ jsx(
307
+ "p",
308
+ {
309
+ ...{
310
+ className: "break-words"
311
+ },
312
+ children: item.tracking || "No tracking number"
313
+ }
314
+ ),
315
+ /* @__PURE__ */ jsx(
316
+ Badge,
317
+ {
318
+ ...{
319
+ type: item.status === "active" ? "success" : "secondary"
320
+ },
321
+ children: item.status === "active" ? "Fulfilled" : "Canceled"
322
+ }
323
+ )
324
+ ]
325
+ }
326
+ ),
327
+ item.status === "active" && /* @__PURE__ */ jsx(
328
+ Button,
329
+ {
330
+ ...{
331
+ ...small,
332
+ disabled,
333
+ onClick: cancel
334
+ },
335
+ children: "Cancel"
336
+ }
337
+ )
338
+ ]
339
+ }
340
+ ),
341
+ /* @__PURE__ */ jsx(
342
+ "div",
343
+ {
344
+ ...{
345
+ className: "grid grid-cols-3 gap-6"
346
+ },
347
+ children: [
348
+ ["Carrier", item.carrier || "\u2014"],
349
+ ["Date", date(item.createdAt)],
350
+ ["Customer", item.emailed ? "Emailed" : "Not emailed"]
351
+ ].map(([label, value]) => /* @__PURE__ */ jsx(
352
+ CardDataItem,
353
+ {
354
+ ...{
355
+ className: "flex flex-col min-w-0",
356
+ classNameSlotLeft: "text-sm disabled",
357
+ classNameSlotRight: "break-words",
358
+ element: "div",
359
+ label,
360
+ value
361
+ }
362
+ },
363
+ label
364
+ ))
365
+ }
366
+ )
367
+ ]
368
+ }
369
+ );
88
370
  const OrderFulfillment = ({ endpoint, manage, onSuccess, order }) => {
371
+ var _a;
372
+ const queryClient = useQueryClient();
373
+ const modal = useModal({
374
+ queryClient
375
+ });
376
+ const { onError } = useCallbacks({
377
+ queryClient
378
+ });
89
379
  const confirm = useConfirm();
90
380
  const controls = fulfillmentControls({ manage, order });
91
- const fulfill = () => confirm({
381
+ const paid = stripeOrder(order);
382
+ const fulfill = () => paid ? modal.open({
383
+ message: /* @__PURE__ */ jsx(
384
+ FormFulfill,
385
+ {
386
+ ...{
387
+ endpoint,
388
+ onError,
389
+ onSuccess
390
+ }
391
+ }
392
+ ),
393
+ title: "Mark as fulfilled"
394
+ }) : confirm({
92
395
  action: "Mark as fulfilled",
93
396
  endpoint: endpoint + "/fulfillment",
94
397
  message: "Mark this order as fulfilled?",
@@ -101,9 +404,11 @@ const OrderFulfillment = ({ endpoint, manage, onSuccess, order }) => {
101
404
  status: "canceled"
102
405
  },
103
406
  endpoint: endpoint + "/fulfillment/" + item.id,
104
- message: "Cancel this fulfillment?",
407
+ message: paid ? "The order goes back to Unfulfilled. The customer is not emailed." : "Cancel this fulfillment?",
105
408
  onSuccess
106
409
  });
410
+ if (((_a = order == null ? void 0 : order.provider) == null ? void 0 : _a.slug) === "shopify") return /* @__PURE__ */ jsx(ShopifyFulfillment, { ...{ order } });
411
+ if (paid && !(order == null ? void 0 : order.fulfillment)) return null;
107
412
  const cta = /* @__PURE__ */ jsx(
108
413
  Button,
109
414
  {
@@ -144,7 +449,17 @@ const OrderFulfillment = ({ endpoint, manage, onSuccess, order }) => {
144
449
  ...{
145
450
  className: "divide-y divide-gray"
146
451
  },
147
- children: items.map((item) => /* @__PURE__ */ jsxs(
452
+ children: items.map((item) => paid ? /* @__PURE__ */ jsx(
453
+ PaidRow,
454
+ {
455
+ ...{
456
+ cancel: () => cancel(item),
457
+ disabled: !controls.cancel,
458
+ item
459
+ }
460
+ },
461
+ item.id
462
+ ) : /* @__PURE__ */ jsxs(
148
463
  "div",
149
464
  {
150
465
  ...{
@@ -193,8 +508,139 @@ const OrderFulfillment = ({ endpoint, manage, onSuccess, order }) => {
193
508
  }
194
509
  );
195
510
  };
511
+ const OrderSummarySection = ({ order }) => {
512
+ var _a, _b;
513
+ const money = moneyOf(order);
514
+ const { shipping, subtotal, tax, total } = (order == null ? void 0 : order.amounts) || {};
515
+ const rate = (_b = (_a = order == null ? void 0 : order.shipping) == null ? void 0 : _a.rate) == null ? void 0 : _b.name;
516
+ return /* @__PURE__ */ jsx(
517
+ CardSection,
518
+ {
519
+ ...{
520
+ className: "shrink-0",
521
+ title: "Summary"
522
+ },
523
+ children: /* @__PURE__ */ jsx(
524
+ OrderSummary,
525
+ {
526
+ ...{
527
+ rows: [
528
+ ["Subtotal", money(subtotal)],
529
+ [rate ? "Shipping (" + rate + ")" : "Shipping", money(shipping)],
530
+ ["Tax", money(tax)],
531
+ ["Total", money(total)]
532
+ ]
533
+ }
534
+ }
535
+ )
536
+ }
537
+ );
538
+ };
539
+ const OrderCustomer = ({ order }) => {
540
+ var _a, _b, _c, _d;
541
+ const name = [(_a = order == null ? void 0 : order.customer) == null ? void 0 : _a.firstName, (_b = order == null ? void 0 : order.customer) == null ? void 0 : _b.lastName].filter(Boolean).join(" ");
542
+ return /* @__PURE__ */ jsx(
543
+ CardSection,
544
+ {
545
+ ...{
546
+ className: "shrink-0",
547
+ title: "Customer"
548
+ },
549
+ children: /* @__PURE__ */ jsx(
550
+ CardSetting,
551
+ {
552
+ ...{
553
+ rows: [
554
+ {
555
+ label: "Name",
556
+ value: name || "\u2014"
557
+ },
558
+ {
559
+ label: "Email",
560
+ value: ((_c = order == null ? void 0 : order.customer) == null ? void 0 : _c.email) || "\u2014"
561
+ },
562
+ ((_d = order == null ? void 0 : order.shipping) == null ? void 0 : _d.address) && {
563
+ label: "Ships to",
564
+ value: /* @__PURE__ */ jsx(AddressLines, { ...order.shipping.address })
565
+ }
566
+ ].filter(Boolean)
567
+ }
568
+ }
569
+ )
570
+ }
571
+ );
572
+ };
573
+ const OrderPayment = ({ endpoint, onClose, order }) => {
574
+ var _a, _b;
575
+ const [open, setOpen] = useState(false);
576
+ const status = statusBadge("payment", paymentOf(order));
577
+ return /* @__PURE__ */ jsxs(
578
+ CardSection,
579
+ {
580
+ ...{
581
+ className: "shrink-0",
582
+ title: "Payment"
583
+ },
584
+ children: [
585
+ /* @__PURE__ */ jsx(
586
+ CardSetting,
587
+ {
588
+ ...{
589
+ rows: [
590
+ {
591
+ label: "Amount",
592
+ value: moneyOf(order)((_a = order == null ? void 0 : order.amounts) == null ? void 0 : _a.total)
593
+ },
594
+ {
595
+ label: "Status",
596
+ value: (status == null ? void 0 : status.text) || "\u2014"
597
+ }
598
+ ]
599
+ }
600
+ }
601
+ ),
602
+ /* @__PURE__ */ jsx(
603
+ "div",
604
+ {
605
+ ...{
606
+ className: "pt-4"
607
+ },
608
+ children: /* @__PURE__ */ jsx(
609
+ Button,
610
+ {
611
+ ...{
612
+ ...small,
613
+ onClick: () => setOpen(true)
614
+ },
615
+ children: "Refund"
616
+ }
617
+ )
618
+ }
619
+ ),
620
+ open && /* @__PURE__ */ jsx(
621
+ EmbedStripe,
622
+ {
623
+ ...{
624
+ component: "payment_details",
625
+ endpoint,
626
+ onClose: () => {
627
+ setOpen(false);
628
+ onClose == null ? void 0 : onClose();
629
+ },
630
+ payment: (_b = order == null ? void 0 : order.provider) == null ? void 0 : _b.id
631
+ }
632
+ }
633
+ )
634
+ ]
635
+ }
636
+ );
637
+ };
196
638
  export {
639
+ FormFulfill,
640
+ OrderCustomer,
197
641
  OrderFulfillment,
642
+ OrderPayment,
643
+ OrderSummarySection,
198
644
  fulfillmentControls,
199
645
  useConfirm
200
646
  };
@@ -43,11 +43,12 @@ var import_guard_navigation = __toESM(require("./guard-navigation"));
43
43
  var import_modal = __toESM(require("./modal"));
44
44
  var import_notice = __toESM(require("./notice"));
45
45
  var import_loader = require("../shared/loader");
46
+ var import_helpers = require("../shared/lib/helpers");
46
47
  const ProviderUi = ({
47
48
  children,
48
49
  token
49
50
  }) => {
50
- var _a, _b, _c, _d, _e, _f;
51
+ var _a, _b, _c, _d, _e, _f, _g, _h;
51
52
  const queryClient = (0, import_react_query.useQueryClient)();
52
53
  queryClient.setQueryDefaults(["socket"], { structuralSharing: false });
53
54
  const tokenRef = (0, import_react.useRef)(token);
@@ -181,8 +182,9 @@ const ProviderUi = ({
181
182
  }
182
183
  ]
183
184
  });
184
- const expired = ((_a = account == null ? void 0 : account.error) == null ? void 0 : _a.status) === 401 && typeof window !== "undefined" ? (0, import_navigation.expiredSessionHref)({
185
- csrf: (_b = document.cookie.match(/(?:^|;\s*)drawbridge\.csrf=([^;]+)/)) == null ? void 0 : _b[1],
185
+ (0, import_helpers.setStripeKey)((_b = (_a = app == null ? void 0 : app.data) == null ? void 0 : _a.credentials) == null ? void 0 : _b.stripePublishableKey);
186
+ const expired = ((_c = account == null ? void 0 : account.error) == null ? void 0 : _c.status) === 401 && typeof window !== "undefined" ? (0, import_navigation.expiredSessionHref)({
187
+ csrf: (_d = document.cookie.match(/(?:^|;\s*)drawbridge\.csrf=([^;]+)/)) == null ? void 0 : _d[1],
186
188
  pathname: window.location.pathname,
187
189
  search: window.location.search
188
190
  }) : null;
@@ -216,7 +218,7 @@ const ProviderUi = ({
216
218
  ...{
217
219
  button: false,
218
220
  href: false,
219
- message: (_c = app == null ? void 0 : app.error) == null ? void 0 : _c.message
221
+ message: (_e = app == null ? void 0 : app.error) == null ? void 0 : _e.message
220
222
  }
221
223
  }
222
224
  );
@@ -229,7 +231,7 @@ const ProviderUi = ({
229
231
  {
230
232
  ...{
231
233
  button: false,
232
- message: (_d = account == null ? void 0 : account.error) == null ? void 0 : _d.message
234
+ message: (_f = account == null ? void 0 : account.error) == null ? void 0 : _f.message
233
235
  }
234
236
  }
235
237
  );
@@ -241,7 +243,7 @@ const ProviderUi = ({
241
243
  ...{
242
244
  button: "Sign in",
243
245
  href: "/auth",
244
- message: (_e = account == null ? void 0 : account.error) == null ? void 0 : _e.message
246
+ message: (_g = account == null ? void 0 : account.error) == null ? void 0 : _g.message
245
247
  }
246
248
  }
247
249
  );
@@ -261,7 +263,7 @@ const ProviderUi = ({
261
263
  })
262
264
  )
263
265
  },
264
- children: (_f = drawer == null ? void 0 : drawer.data) == null ? void 0 : _f.children
266
+ children: (_h = drawer == null ? void 0 : drawer.data) == null ? void 0 : _h.children
265
267
  }
266
268
  ),
267
269
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -11,11 +11,12 @@ import GuardNavigation from "./guard-navigation.mjs";
11
11
  import Modal from "./modal.mjs";
12
12
  import Notice from "./notice.mjs";
13
13
  import { LogoLoader } from "../shared/loader.mjs";
14
+ import { setStripeKey } from "../shared/lib/helpers.mjs";
14
15
  const ProviderUi = ({
15
16
  children,
16
17
  token
17
18
  }) => {
18
- var _a, _b, _c, _d, _e, _f;
19
+ var _a, _b, _c, _d, _e, _f, _g, _h;
19
20
  const queryClient = useQueryClient();
20
21
  queryClient.setQueryDefaults(["socket"], { structuralSharing: false });
21
22
  const tokenRef = useRef(token);
@@ -149,8 +150,9 @@ const ProviderUi = ({
149
150
  }
150
151
  ]
151
152
  });
152
- const expired = ((_a = account == null ? void 0 : account.error) == null ? void 0 : _a.status) === 401 && typeof window !== "undefined" ? expiredSessionHref({
153
- csrf: (_b = document.cookie.match(/(?:^|;\s*)drawbridge\.csrf=([^;]+)/)) == null ? void 0 : _b[1],
153
+ setStripeKey((_b = (_a = app == null ? void 0 : app.data) == null ? void 0 : _a.credentials) == null ? void 0 : _b.stripePublishableKey);
154
+ const expired = ((_c = account == null ? void 0 : account.error) == null ? void 0 : _c.status) === 401 && typeof window !== "undefined" ? expiredSessionHref({
155
+ csrf: (_d = document.cookie.match(/(?:^|;\s*)drawbridge\.csrf=([^;]+)/)) == null ? void 0 : _d[1],
154
156
  pathname: window.location.pathname,
155
157
  search: window.location.search
156
158
  }) : null;
@@ -184,7 +186,7 @@ const ProviderUi = ({
184
186
  ...{
185
187
  button: false,
186
188
  href: false,
187
- message: (_c = app == null ? void 0 : app.error) == null ? void 0 : _c.message
189
+ message: (_e = app == null ? void 0 : app.error) == null ? void 0 : _e.message
188
190
  }
189
191
  }
190
192
  );
@@ -197,7 +199,7 @@ const ProviderUi = ({
197
199
  {
198
200
  ...{
199
201
  button: false,
200
- message: (_d = account == null ? void 0 : account.error) == null ? void 0 : _d.message
202
+ message: (_f = account == null ? void 0 : account.error) == null ? void 0 : _f.message
201
203
  }
202
204
  }
203
205
  );
@@ -209,7 +211,7 @@ const ProviderUi = ({
209
211
  ...{
210
212
  button: "Sign in",
211
213
  href: "/auth",
212
- message: (_e = account == null ? void 0 : account.error) == null ? void 0 : _e.message
214
+ message: (_g = account == null ? void 0 : account.error) == null ? void 0 : _g.message
213
215
  }
214
216
  }
215
217
  );
@@ -229,7 +231,7 @@ const ProviderUi = ({
229
231
  })
230
232
  )
231
233
  },
232
- children: (_f = drawer == null ? void 0 : drawer.data) == null ? void 0 : _f.children
234
+ children: (_h = drawer == null ? void 0 : drawer.data) == null ? void 0 : _h.children
233
235
  }
234
236
  ),
235
237
  /* @__PURE__ */ jsx(