@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,22 +28,43 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var order_sections_exports = {};
30
30
  __export(order_sections_exports, {
31
+ FormFulfill: () => FormFulfill,
32
+ OrderCustomer: () => OrderCustomer,
31
33
  OrderFulfillment: () => OrderFulfillment,
34
+ OrderPayment: () => OrderPayment,
35
+ OrderSummarySection: () => OrderSummarySection,
32
36
  fulfillmentControls: () => fulfillmentControls,
33
37
  useConfirm: () => useConfirm
34
38
  });
35
39
  module.exports = __toCommonJS(order_sections_exports);
36
40
  var import_jsx_runtime = require("react/jsx-runtime");
41
+ var import_react = require("react");
37
42
  var import_react_query = require("@tanstack/react-query");
38
43
  var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
39
44
  var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
45
+ var import_products = require("@drawbridge/drawbridge-utils/products");
46
+ var import_form = require("../shared/lib/form");
47
+ var import_helpers = require("../shared/lib/helpers");
40
48
  var import_hooks = require("./lib/hooks");
49
+ var import_card_data_item = __toESM(require("./card-data-item"));
41
50
  var import_card_section = __toESM(require("./card-section"));
51
+ var import_card_setting = __toESM(require("./card-setting"));
42
52
  var import_card_task = __toESM(require("./card-task"));
53
+ var import_embed_stripe = __toESM(require("./embed-stripe"));
43
54
  var import_form_action = __toESM(require("./form-action"));
44
55
  var import_paged = __toESM(require("./paged"));
56
+ var import_address_lines = __toESM(require("../shared/address-lines"));
45
57
  var import_badge = __toESM(require("../shared/badge"));
46
58
  var import_button = __toESM(require("../shared/button"));
59
+ var import_empty = __toESM(require("../shared/empty"));
60
+ var import_fieldset = __toESM(require("../shared/fieldset"));
61
+ var import_form2 = __toESM(require("../shared/form"));
62
+ var import_order_summary = __toESM(require("../shared/order-summary"));
63
+ var import_input_checkbox = __toESM(require("../input-checkbox"));
64
+ var import_input_group = __toESM(require("../input-group"));
65
+ var import_input_select = __toESM(require("../input-select"));
66
+ var import_input_text = __toESM(require("../input-text"));
67
+ var import_external = __toESM(require("../icons/external"));
47
68
  var import_plus = __toESM(require("../icons/plus"));
48
69
  const date = (value) => (0, import_drawbridge_utils.formatDateString)({
49
70
  date: value,
@@ -62,8 +83,8 @@ const useConfirm = () => {
62
83
  const { onError } = (0, import_hooks.useCallbacks)({
63
84
  queryClient
64
85
  });
65
- return ({ action, body, endpoint, message, method = "PUT", onSuccess, task, warning }) => modal.open({
66
- title: action,
86
+ return ({ action, body, endpoint, message, method = "PUT", onSuccess, task, title, warning }) => modal.open({
87
+ title: title || action,
67
88
  message: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
68
89
  import_form_action.default,
69
90
  {
@@ -110,19 +131,305 @@ const fulfillmentControls = ({ manage, order }) => {
110
131
  var _a;
111
132
  const editable = Boolean(manage) && (order == null ? void 0 : order.status) === "open";
112
133
  return {
113
- add: editable && ((_a = order == null ? void 0 : order.fulfillment) == null ? void 0 : _a.status) !== "fulfilled",
134
+ add: editable && ((_a = order == null ? void 0 : order.fulfillment) == null ? void 0 : _a.status) !== "fulfilled" && (order == null ? void 0 : order.payment) !== "refunded",
114
135
  cancel: editable
115
136
  };
116
137
  };
138
+ const stripeOrder = (order) => {
139
+ var _a;
140
+ return ((_a = order == null ? void 0 : order.provider) == null ? void 0 : _a.slug) === "stripe";
141
+ };
142
+ const moneyOf = (order) => (value) => (0, import_drawbridge_utils.formatCurrency)({ code: ((order == null ? void 0 : order.currency) || "usd").toUpperCase(), value: value || 0 });
143
+ const FormFulfill = ({ endpoint, onError, onSuccess }) => {
144
+ const { control, formState, handleSubmit } = (0, import_form.useForm)({
145
+ values: {
146
+ carrier: import_products.CARRIERS[0],
147
+ emailed: true,
148
+ tracking: ""
149
+ }
150
+ });
151
+ const onSubmit = async ({ carrier, emailed, tracking }) => {
152
+ try {
153
+ onSuccess(await (0, import_fetch.request)({
154
+ body: {
155
+ carrier,
156
+ emailed: Boolean(emailed),
157
+ tracking: (tracking || "").trim()
158
+ },
159
+ endpoint: endpoint + "/fulfillment",
160
+ method: "POST"
161
+ }));
162
+ } catch (error) {
163
+ onError == null ? void 0 : onError(error);
164
+ }
165
+ };
166
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
167
+ import_form2.default,
168
+ {
169
+ ...{
170
+ className: "relative w-full space-y-6",
171
+ onSubmit: handleSubmit(onSubmit)
172
+ },
173
+ children: [
174
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
175
+ import_fieldset.default,
176
+ {
177
+ ...{
178
+ className: "space-y-6",
179
+ disabled: formState == null ? void 0 : formState.isSubmitting
180
+ },
181
+ children: [
182
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
183
+ import_form.Controller,
184
+ {
185
+ ...{
186
+ control,
187
+ name: "carrier",
188
+ render: ({ field: { onChange, value } }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
189
+ import_input_group.default,
190
+ {
191
+ ...{
192
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
193
+ import_input_select.default,
194
+ {
195
+ ...{
196
+ onChange,
197
+ options: import_products.CARRIERS.map((carrier) => ({
198
+ label: carrier,
199
+ value: carrier
200
+ })),
201
+ value
202
+ }
203
+ }
204
+ ),
205
+ label: "Carrier"
206
+ }
207
+ }
208
+ )
209
+ }
210
+ }
211
+ ),
212
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
213
+ import_form.Controller,
214
+ {
215
+ ...{
216
+ control,
217
+ name: "tracking",
218
+ render: ({ field: { onChange, value } }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
219
+ import_input_group.default,
220
+ {
221
+ ...{
222
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
223
+ import_input_text.default,
224
+ {
225
+ ...{
226
+ onChange,
227
+ value: value || ""
228
+ }
229
+ }
230
+ ),
231
+ label: "Tracking number"
232
+ }
233
+ }
234
+ )
235
+ }
236
+ }
237
+ ),
238
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
239
+ import_form.Controller,
240
+ {
241
+ ...{
242
+ control,
243
+ name: "emailed",
244
+ render: ({ field: { onChange, value } }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
245
+ import_input_checkbox.default,
246
+ {
247
+ ...{
248
+ label: "Email the customer their tracking details",
249
+ onChange,
250
+ value
251
+ }
252
+ }
253
+ )
254
+ }
255
+ }
256
+ )
257
+ ]
258
+ }
259
+ ),
260
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
261
+ import_fieldset.default,
262
+ {
263
+ ...{
264
+ disabled: formState == null ? void 0 : formState.isSubmitting
265
+ },
266
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
267
+ import_button.default,
268
+ {
269
+ ...{
270
+ loading: formState == null ? void 0 : formState.isSubmitting,
271
+ type: "submit"
272
+ },
273
+ children: "Mark as fulfilled"
274
+ }
275
+ )
276
+ }
277
+ )
278
+ ]
279
+ }
280
+ );
281
+ };
282
+ const ShopifyFulfillment = ({ order }) => {
283
+ var _a, _b, _c;
284
+ const status = (0, import_helpers.statusBadge)("fulfillment", (_a = order == null ? void 0 : order.fulfillment) == null ? void 0 : _a.status);
285
+ const href = (0, import_products.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 });
286
+ return status && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
287
+ import_card_section.default,
288
+ {
289
+ ...{
290
+ className: "shrink-0",
291
+ cta: href && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
292
+ import_button.default,
293
+ {
294
+ ...{
295
+ ...small,
296
+ "aria-label": "Open in Shopify",
297
+ element: "a",
298
+ href,
299
+ icon: import_external.default,
300
+ target: "_blank"
301
+ }
302
+ }
303
+ ),
304
+ title: "Fulfillment"
305
+ },
306
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
307
+ import_empty.default,
308
+ {
309
+ ...{
310
+ variant: "secondary"
311
+ },
312
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "This order is " + status.text.toLowerCase() + " in Shopify" })
313
+ }
314
+ )
315
+ }
316
+ );
317
+ };
117
318
  const small = {
118
319
  inline: true,
119
320
  size: "small",
120
321
  variant: "secondary"
121
322
  };
323
+ const PaidRow = ({ cancel, disabled, item }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
324
+ "div",
325
+ {
326
+ ...{
327
+ className: "space-y-3 py-4 first:pt-0 last:pb-0"
328
+ },
329
+ children: [
330
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
331
+ "div",
332
+ {
333
+ ...{
334
+ className: "flex items-center justify-between gap-4"
335
+ },
336
+ children: [
337
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
338
+ "div",
339
+ {
340
+ ...{
341
+ className: "flex items-center gap-3 min-w-0"
342
+ },
343
+ children: [
344
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
345
+ "p",
346
+ {
347
+ ...{
348
+ className: "break-words"
349
+ },
350
+ children: item.tracking || "No tracking number"
351
+ }
352
+ ),
353
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
354
+ import_badge.default,
355
+ {
356
+ ...{
357
+ type: item.status === "active" ? "success" : "secondary"
358
+ },
359
+ children: item.status === "active" ? "Fulfilled" : "Canceled"
360
+ }
361
+ )
362
+ ]
363
+ }
364
+ ),
365
+ item.status === "active" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
366
+ import_button.default,
367
+ {
368
+ ...{
369
+ ...small,
370
+ disabled,
371
+ onClick: cancel
372
+ },
373
+ children: "Cancel"
374
+ }
375
+ )
376
+ ]
377
+ }
378
+ ),
379
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
380
+ "div",
381
+ {
382
+ ...{
383
+ className: "grid grid-cols-3 gap-6"
384
+ },
385
+ children: [
386
+ ["Carrier", item.carrier || "\u2014"],
387
+ ["Date", date(item.createdAt)],
388
+ ["Customer", item.emailed ? "Emailed" : "Not emailed"]
389
+ ].map(([label, value]) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
390
+ import_card_data_item.default,
391
+ {
392
+ ...{
393
+ className: "flex flex-col min-w-0",
394
+ classNameSlotLeft: "text-sm disabled",
395
+ classNameSlotRight: "break-words",
396
+ element: "div",
397
+ label,
398
+ value
399
+ }
400
+ },
401
+ label
402
+ ))
403
+ }
404
+ )
405
+ ]
406
+ }
407
+ );
122
408
  const OrderFulfillment = ({ endpoint, manage, onSuccess, order }) => {
409
+ var _a;
410
+ const queryClient = (0, import_react_query.useQueryClient)();
411
+ const modal = (0, import_hooks.useModal)({
412
+ queryClient
413
+ });
414
+ const { onError } = (0, import_hooks.useCallbacks)({
415
+ queryClient
416
+ });
123
417
  const confirm = useConfirm();
124
418
  const controls = fulfillmentControls({ manage, order });
125
- const fulfill = () => confirm({
419
+ const paid = stripeOrder(order);
420
+ const fulfill = () => paid ? modal.open({
421
+ message: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
422
+ FormFulfill,
423
+ {
424
+ ...{
425
+ endpoint,
426
+ onError,
427
+ onSuccess
428
+ }
429
+ }
430
+ ),
431
+ title: "Mark as fulfilled"
432
+ }) : confirm({
126
433
  action: "Mark as fulfilled",
127
434
  endpoint: endpoint + "/fulfillment",
128
435
  message: "Mark this order as fulfilled?",
@@ -135,9 +442,11 @@ const OrderFulfillment = ({ endpoint, manage, onSuccess, order }) => {
135
442
  status: "canceled"
136
443
  },
137
444
  endpoint: endpoint + "/fulfillment/" + item.id,
138
- message: "Cancel this fulfillment?",
445
+ message: paid ? "The order goes back to Unfulfilled. The customer is not emailed." : "Cancel this fulfillment?",
139
446
  onSuccess
140
447
  });
448
+ if (((_a = order == null ? void 0 : order.provider) == null ? void 0 : _a.slug) === "shopify") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShopifyFulfillment, { ...{ order } });
449
+ if (paid && !(order == null ? void 0 : order.fulfillment)) return null;
141
450
  const cta = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
142
451
  import_button.default,
143
452
  {
@@ -178,7 +487,17 @@ const OrderFulfillment = ({ endpoint, manage, onSuccess, order }) => {
178
487
  ...{
179
488
  className: "divide-y divide-gray"
180
489
  },
181
- children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
490
+ children: items.map((item) => paid ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
491
+ PaidRow,
492
+ {
493
+ ...{
494
+ cancel: () => cancel(item),
495
+ disabled: !controls.cancel,
496
+ item
497
+ }
498
+ },
499
+ item.id
500
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
182
501
  "div",
183
502
  {
184
503
  ...{
@@ -227,9 +546,140 @@ const OrderFulfillment = ({ endpoint, manage, onSuccess, order }) => {
227
546
  }
228
547
  );
229
548
  };
549
+ const OrderSummarySection = ({ order }) => {
550
+ var _a, _b;
551
+ const money = moneyOf(order);
552
+ const { shipping, subtotal, tax, total } = (order == null ? void 0 : order.amounts) || {};
553
+ const rate = (_b = (_a = order == null ? void 0 : order.shipping) == null ? void 0 : _a.rate) == null ? void 0 : _b.name;
554
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
555
+ import_card_section.default,
556
+ {
557
+ ...{
558
+ className: "shrink-0",
559
+ title: "Summary"
560
+ },
561
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
562
+ import_order_summary.default,
563
+ {
564
+ ...{
565
+ rows: [
566
+ ["Subtotal", money(subtotal)],
567
+ [rate ? "Shipping (" + rate + ")" : "Shipping", money(shipping)],
568
+ ["Tax", money(tax)],
569
+ ["Total", money(total)]
570
+ ]
571
+ }
572
+ }
573
+ )
574
+ }
575
+ );
576
+ };
577
+ const OrderCustomer = ({ order }) => {
578
+ var _a, _b, _c, _d;
579
+ 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(" ");
580
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
581
+ import_card_section.default,
582
+ {
583
+ ...{
584
+ className: "shrink-0",
585
+ title: "Customer"
586
+ },
587
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
588
+ import_card_setting.default,
589
+ {
590
+ ...{
591
+ rows: [
592
+ {
593
+ label: "Name",
594
+ value: name || "\u2014"
595
+ },
596
+ {
597
+ label: "Email",
598
+ value: ((_c = order == null ? void 0 : order.customer) == null ? void 0 : _c.email) || "\u2014"
599
+ },
600
+ ((_d = order == null ? void 0 : order.shipping) == null ? void 0 : _d.address) && {
601
+ label: "Ships to",
602
+ value: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_address_lines.default, { ...order.shipping.address })
603
+ }
604
+ ].filter(Boolean)
605
+ }
606
+ }
607
+ )
608
+ }
609
+ );
610
+ };
611
+ const OrderPayment = ({ endpoint, onClose, order }) => {
612
+ var _a, _b;
613
+ const [open, setOpen] = (0, import_react.useState)(false);
614
+ const status = (0, import_helpers.statusBadge)("payment", (0, import_products.paymentOf)(order));
615
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
616
+ import_card_section.default,
617
+ {
618
+ ...{
619
+ className: "shrink-0",
620
+ title: "Payment"
621
+ },
622
+ children: [
623
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
624
+ import_card_setting.default,
625
+ {
626
+ ...{
627
+ rows: [
628
+ {
629
+ label: "Amount",
630
+ value: moneyOf(order)((_a = order == null ? void 0 : order.amounts) == null ? void 0 : _a.total)
631
+ },
632
+ {
633
+ label: "Status",
634
+ value: (status == null ? void 0 : status.text) || "\u2014"
635
+ }
636
+ ]
637
+ }
638
+ }
639
+ ),
640
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
641
+ "div",
642
+ {
643
+ ...{
644
+ className: "pt-4"
645
+ },
646
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
647
+ import_button.default,
648
+ {
649
+ ...{
650
+ ...small,
651
+ onClick: () => setOpen(true)
652
+ },
653
+ children: "Refund"
654
+ }
655
+ )
656
+ }
657
+ ),
658
+ open && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
659
+ import_embed_stripe.default,
660
+ {
661
+ ...{
662
+ component: "payment_details",
663
+ endpoint,
664
+ onClose: () => {
665
+ setOpen(false);
666
+ onClose == null ? void 0 : onClose();
667
+ },
668
+ payment: (_b = order == null ? void 0 : order.provider) == null ? void 0 : _b.id
669
+ }
670
+ }
671
+ )
672
+ ]
673
+ }
674
+ );
675
+ };
230
676
  // Annotate the CommonJS export names for ESM import in node:
231
677
  0 && (module.exports = {
678
+ FormFulfill,
679
+ OrderCustomer,
232
680
  OrderFulfillment,
681
+ OrderPayment,
682
+ OrderSummarySection,
233
683
  fulfillmentControls,
234
684
  useConfirm
235
685
  });