@drawbridge/components 0.1.46 → 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 (162) 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-shop.js +4 -1
  10. package/dist/bridge/form-subdomain-shop.mjs +4 -1
  11. package/dist/bridge/form-subdomain.js +24 -5
  12. package/dist/bridge/form-subdomain.mjs +25 -6
  13. package/dist/bridge/lib/age-gate.js +12 -0
  14. package/dist/bridge/lib/age-gate.mjs +11 -0
  15. package/dist/bridge/lib/cart.js +79 -0
  16. package/dist/bridge/lib/cart.mjs +48 -0
  17. package/dist/bridge/lib/checkout-kit.js +2 -32
  18. package/dist/bridge/lib/checkout-kit.mjs +2 -32
  19. package/dist/bridge/lib/entry.js +41 -0
  20. package/dist/bridge/lib/entry.mjs +40 -0
  21. package/dist/bridge/product-tile.js +13 -6
  22. package/dist/bridge/product-tile.mjs +13 -6
  23. package/dist/bridge/template-layout.js +263 -129
  24. package/dist/bridge/template-layout.mjs +264 -130
  25. package/dist/bridge/template-modal.js +39 -74
  26. package/dist/bridge/template-modal.mjs +40 -75
  27. package/dist/dashboard/avatar.js +2 -3
  28. package/dist/dashboard/avatar.mjs +2 -3
  29. package/dist/dashboard/buttons-subscription.js +1 -1
  30. package/dist/dashboard/buttons-subscription.mjs +1 -1
  31. package/dist/dashboard/campaign-form.js +179 -155
  32. package/dist/dashboard/campaign-form.mjs +179 -155
  33. package/dist/dashboard/campaign-share.js +347 -0
  34. package/dist/dashboard/campaign-share.mjs +314 -0
  35. package/dist/dashboard/card-affiliate.js +1 -1
  36. package/dist/dashboard/card-affiliate.mjs +1 -1
  37. package/dist/dashboard/card-campaign-switch.js +4 -1
  38. package/dist/dashboard/card-campaign-switch.mjs +4 -1
  39. package/dist/dashboard/card-order.js +22 -4
  40. package/dist/dashboard/card-order.mjs +22 -4
  41. package/dist/dashboard/embed-stripe.js +145 -0
  42. package/dist/dashboard/embed-stripe.mjs +116 -0
  43. package/dist/dashboard/form-admin-provider.js +71 -17
  44. package/dist/dashboard/form-admin-provider.mjs +71 -17
  45. package/dist/dashboard/form-file-upload.js +3 -2
  46. package/dist/dashboard/form-file-upload.mjs +4 -3
  47. package/dist/dashboard/form-organization-campaign-advertisements.js +47 -6
  48. package/dist/dashboard/form-organization-campaign-advertisements.mjs +47 -6
  49. package/dist/dashboard/form-organization-campaign-field-birthday.js +193 -0
  50. package/dist/dashboard/form-organization-campaign-field-birthday.mjs +164 -0
  51. package/dist/dashboard/form-organization-campaign-field-rating.js +246 -0
  52. package/dist/dashboard/form-organization-campaign-field-rating.mjs +217 -0
  53. package/dist/dashboard/form-organization-campaign-page.js +73 -39
  54. package/dist/dashboard/form-organization-campaign-page.mjs +73 -39
  55. package/dist/dashboard/form-organization-campaign.js +82 -0
  56. package/dist/dashboard/form-organization-campaign.mjs +81 -0
  57. package/dist/dashboard/form-organization-connection.js +48 -6
  58. package/dist/dashboard/form-organization-connection.mjs +48 -7
  59. package/dist/dashboard/form-organization-product.js +1461 -0
  60. package/dist/dashboard/form-organization-product.mjs +1425 -0
  61. package/dist/dashboard/form-organization-workflow.js +72 -1
  62. package/dist/dashboard/form-organization-workflow.mjs +69 -1
  63. package/dist/dashboard/form-otc.js +4 -5
  64. package/dist/dashboard/form-otc.mjs +4 -5
  65. package/dist/dashboard/form-stripe.js +12 -5
  66. package/dist/dashboard/form-stripe.mjs +12 -5
  67. package/dist/dashboard/input-combobox.js +6 -0
  68. package/dist/dashboard/input-combobox.mjs +6 -0
  69. package/dist/dashboard/input-fields.js +37 -161
  70. package/dist/dashboard/input-fields.mjs +37 -161
  71. package/dist/dashboard/input-file.js +21 -4
  72. package/dist/dashboard/input-file.mjs +21 -4
  73. package/dist/dashboard/input-font.js +2 -0
  74. package/dist/dashboard/input-font.mjs +2 -0
  75. package/dist/dashboard/input-gallery.js +201 -0
  76. package/dist/dashboard/input-gallery.mjs +172 -0
  77. package/dist/dashboard/input-group-ai.js +15 -3
  78. package/dist/dashboard/input-group-ai.mjs +15 -3
  79. package/dist/dashboard/lib/ab-tests.js +2 -2
  80. package/dist/dashboard/lib/ab-tests.mjs +2 -2
  81. package/dist/dashboard/lib/connection-controls.js +5 -2
  82. package/dist/dashboard/lib/connection-controls.mjs +3 -1
  83. package/dist/dashboard/lib/form-page.js +1 -1
  84. package/dist/dashboard/lib/form-page.mjs +1 -1
  85. package/dist/dashboard/lib/menu.js +19 -0
  86. package/dist/dashboard/lib/menu.mjs +18 -0
  87. package/dist/dashboard/lib/products.js +169 -0
  88. package/dist/dashboard/lib/products.mjs +135 -0
  89. package/dist/dashboard/lib/settings-paths.js +35 -0
  90. package/dist/dashboard/lib/settings-paths.mjs +11 -0
  91. package/dist/dashboard/lib/uppy.js +10 -1
  92. package/dist/dashboard/lib/uppy.mjs +11 -2
  93. package/dist/dashboard/menu.js +13 -2
  94. package/dist/dashboard/menu.mjs +13 -2
  95. package/dist/dashboard/order-sections.js +456 -6
  96. package/dist/dashboard/order-sections.mjs +453 -7
  97. package/dist/dashboard/preview.js +119 -52
  98. package/dist/dashboard/preview.mjs +119 -52
  99. package/dist/dashboard/provider-ui.js +9 -7
  100. package/dist/dashboard/provider-ui.mjs +9 -7
  101. package/dist/dashboard/recharts.js +10 -4
  102. package/dist/dashboard/recharts.mjs +10 -4
  103. package/dist/dashboard/shipping-rates.js +404 -0
  104. package/dist/dashboard/shipping-rates.mjs +371 -0
  105. package/dist/dashboard/template-buyer.js +301 -0
  106. package/dist/dashboard/template-buyer.mjs +267 -0
  107. package/dist/dashboard/template-dashboard.js +11 -1
  108. package/dist/dashboard/template-dashboard.mjs +11 -1
  109. package/dist/dashboard/template-design.js +209 -130
  110. package/dist/dashboard/template-design.mjs +210 -131
  111. package/dist/dashboard/template-ui.js +157 -55
  112. package/dist/dashboard/template-ui.mjs +158 -56
  113. package/dist/icons/flags.js +134 -0
  114. package/dist/icons/flags.mjs +115 -0
  115. package/dist/input-checkbox.js +28 -10
  116. package/dist/input-checkbox.mjs +28 -10
  117. package/dist/product.js +96 -24
  118. package/dist/product.mjs +97 -25
  119. package/dist/shared/carousel.js +14 -5
  120. package/dist/shared/carousel.mjs +14 -5
  121. package/dist/shared/lib/helpers.js +54 -6
  122. package/dist/shared/lib/helpers.mjs +53 -8
  123. package/dist/shared/order-summary.js +139 -0
  124. package/dist/shared/order-summary.mjs +110 -0
  125. package/package.json +84 -4
  126. package/types/bridge/cart-drawer.d.ts +31 -0
  127. package/types/bridge/fields.d.ts +14 -2
  128. package/types/bridge/form-subdomain-checkout.d.ts +20 -0
  129. package/types/bridge/form-subdomain-shop-modal.d.ts +27 -3
  130. package/types/bridge/form-subdomain.d.ts +13 -0
  131. package/types/bridge/lib/age-gate.d.ts +5 -0
  132. package/types/bridge/lib/cart.d.ts +44 -0
  133. package/types/bridge/lib/checkout-kit.d.ts +2 -10
  134. package/types/bridge/lib/entry.d.ts +5 -0
  135. package/types/bridge/product-tile.d.ts +2 -0
  136. package/types/dashboard/campaign-share.d.ts +16 -0
  137. package/types/dashboard/card-order.d.ts +6 -0
  138. package/types/dashboard/embed-stripe.d.ts +25 -0
  139. package/types/dashboard/form-admin-provider.d.ts +9 -2
  140. package/types/dashboard/form-file-upload.d.ts +2 -1
  141. package/types/dashboard/form-organization-campaign-advertisements.d.ts +3 -0
  142. package/types/dashboard/form-organization-campaign-field-birthday.d.ts +31 -0
  143. package/types/dashboard/form-organization-campaign-field-rating.d.ts +33 -0
  144. package/types/dashboard/form-organization-campaign-page.d.ts +8 -1
  145. package/types/dashboard/form-organization-campaign.d.ts +3 -0
  146. package/types/dashboard/form-organization-connection.d.ts +11 -0
  147. package/types/dashboard/form-organization-product.d.ts +24 -0
  148. package/types/dashboard/form-otc.d.ts +5 -1
  149. package/types/dashboard/form-stripe.d.ts +3 -2
  150. package/types/dashboard/input-combobox.d.ts +2 -0
  151. package/types/dashboard/input-file.d.ts +2 -0
  152. package/types/dashboard/input-gallery.d.ts +14 -0
  153. package/types/dashboard/lib/products.d.ts +14 -0
  154. package/types/dashboard/lib/settings-paths.d.ts +5 -0
  155. package/types/dashboard/order-sections.d.ts +24 -1
  156. package/types/dashboard/preview.d.ts +11 -3
  157. package/types/dashboard/shipping-rates.d.ts +26 -0
  158. package/types/dashboard/template-buyer.d.ts +50 -0
  159. package/types/icons/flags.d.ts +5 -0
  160. package/types/input-checkbox.d.ts +2 -0
  161. package/types/shared/lib/helpers.d.ts +4 -0
  162. package/types/shared/order-summary.d.ts +19 -0
@@ -28,6 +28,7 @@ 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_organization_connection_exports = {};
30
30
  __export(form_organization_connection_exports, {
31
+ Editable: () => Editable,
31
32
  FormOrganizationConnection: () => FormOrganizationConnection
32
33
  });
33
34
  module.exports = __toCommonJS(form_organization_connection_exports);
@@ -227,10 +228,11 @@ const FormOrganizationConnection = ({
227
228
  onSuccess,
228
229
  values
229
230
  }) => {
230
- var _a, _b, _c, _d, _e, _f;
231
+ var _a, _b, _c, _d, _e, _f, _g, _h;
231
232
  const fields = (values == null ? void 0 : values.fields) || [];
232
233
  const kind = (_a = values == null ? void 0 : values.connect) == null ? void 0 : _a.type;
233
- const redirect = kind === "install" ? (_b = values == null ? void 0 : values.connect) == null ? void 0 : _b.redirect : null;
234
+ const link = Boolean((_b = values == null ? void 0 : values.connect) == null ? void 0 : _b.link);
235
+ const redirect = kind === "install" ? (_c = values == null ? void 0 : values.connect) == null ? void 0 : _c.redirect : null;
234
236
  const readable = fields.filter((field) => !field.input).map((field) => {
235
237
  var _a2;
236
238
  return {
@@ -243,6 +245,17 @@ const FormOrganizationConnection = ({
243
245
  const consent = async () => {
244
246
  setConsenting(true);
245
247
  try {
248
+ if (link) {
249
+ await (0, import_fetch.request)({
250
+ body: {
251
+ settings: {},
252
+ slug: values == null ? void 0 : values.slug
253
+ },
254
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/connection",
255
+ method: "POST"
256
+ });
257
+ }
258
+ ;
246
259
  const { result } = await (0, import_fetch.request)({
247
260
  endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/connection/" + (values == null ? void 0 : values.slug) + "/authorize",
248
261
  method: "POST"
@@ -335,6 +348,34 @@ const FormOrganizationConnection = ({
335
348
  }
336
349
  ) : null;
337
350
  }
351
+ if (link) {
352
+ return (values == null ? void 0 : values.status) === "active" ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
353
+ import_form2.default,
354
+ {
355
+ ...{
356
+ className: "relative w-full space-y-8"
357
+ },
358
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
359
+ import_fieldset.default,
360
+ {
361
+ ...{
362
+ disabled: disabled || consenting
363
+ },
364
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
365
+ import_button.default,
366
+ {
367
+ ...{
368
+ loading: consenting,
369
+ onClick: consent
370
+ },
371
+ children: ((_d = values == null ? void 0 : values.actions) == null ? void 0 : _d.create) || "Connect"
372
+ }
373
+ )
374
+ }
375
+ )
376
+ }
377
+ );
378
+ }
338
379
  if (kind === "oauth") {
339
380
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
340
381
  import_form2.default,
@@ -404,7 +445,7 @@ const FormOrganizationConnection = ({
404
445
  // the connection would read Active over nothing.
405
446
  disabled: disabled || Object.values(optionsFor).some((entry) => entry == null ? void 0 : entry.isLoading),
406
447
  isSubmitting: formState == null ? void 0 : formState.isSubmitting,
407
- text: ((_c = values == null ? void 0 : values.actions) == null ? void 0 : _c.update) || "Save"
448
+ text: ((_e = values == null ? void 0 : values.actions) == null ? void 0 : _e.update) || "Save"
408
449
  }
409
450
  }
410
451
  ),
@@ -415,7 +456,7 @@ const FormOrganizationConnection = ({
415
456
  loading: consenting,
416
457
  onClick: consent
417
458
  },
418
- children: ((_d = values == null ? void 0 : values.actions) == null ? void 0 : _d.create) || "Connect"
459
+ children: ((_f = values == null ? void 0 : values.actions) == null ? void 0 : _f.create) || "Connect"
419
460
  }
420
461
  )
421
462
  ]
@@ -524,13 +565,13 @@ const FormOrganizationConnection = ({
524
565
  },
525
566
  field.key
526
567
  )),
527
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
568
+ (0, import_connection_controls.savable)({ actions: values == null ? void 0 : values.actions, connected, inputs }) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
528
569
  Submit,
529
570
  {
530
571
  ...{
531
572
  disabled,
532
573
  isSubmitting: formState == null ? void 0 : formState.isSubmitting,
533
- text: connected ? ((_e = values == null ? void 0 : values.actions) == null ? void 0 : _e.update) || "Submit" : ((_f = values == null ? void 0 : values.actions) == null ? void 0 : _f.create) || "Submit"
574
+ text: connected ? ((_g = values == null ? void 0 : values.actions) == null ? void 0 : _g.update) || "Submit" : ((_h = values == null ? void 0 : values.actions) == null ? void 0 : _h.create) || "Submit"
534
575
  }
535
576
  }
536
577
  )
@@ -542,5 +583,6 @@ const FormOrganizationConnection = ({
542
583
  };
543
584
  // Annotate the CommonJS export names for ESM import in node:
544
585
  0 && (module.exports = {
586
+ Editable,
545
587
  FormOrganizationConnection
546
588
  });
@@ -17,7 +17,7 @@ import InputCheckbox from "../input-checkbox.mjs";
17
17
  import InputSwitch from "../shared/input-switch.mjs";
18
18
  import Button from "../shared/button.mjs";
19
19
  import CopyToClipboard from "../shared/copy-to-clipboard.mjs";
20
- import { isConnected } from "./lib/connection-controls.mjs";
20
+ import { isConnected, savable } from "./lib/connection-controls.mjs";
21
21
  const Submit = ({
22
22
  disabled,
23
23
  isSubmitting,
@@ -195,10 +195,11 @@ const FormOrganizationConnection = ({
195
195
  onSuccess,
196
196
  values
197
197
  }) => {
198
- var _a, _b, _c, _d, _e, _f;
198
+ var _a, _b, _c, _d, _e, _f, _g, _h;
199
199
  const fields = (values == null ? void 0 : values.fields) || [];
200
200
  const kind = (_a = values == null ? void 0 : values.connect) == null ? void 0 : _a.type;
201
- const redirect = kind === "install" ? (_b = values == null ? void 0 : values.connect) == null ? void 0 : _b.redirect : null;
201
+ const link = Boolean((_b = values == null ? void 0 : values.connect) == null ? void 0 : _b.link);
202
+ const redirect = kind === "install" ? (_c = values == null ? void 0 : values.connect) == null ? void 0 : _c.redirect : null;
202
203
  const readable = fields.filter((field) => !field.input).map((field) => {
203
204
  var _a2;
204
205
  return {
@@ -211,6 +212,17 @@ const FormOrganizationConnection = ({
211
212
  const consent = async () => {
212
213
  setConsenting(true);
213
214
  try {
215
+ if (link) {
216
+ await request({
217
+ body: {
218
+ settings: {},
219
+ slug: values == null ? void 0 : values.slug
220
+ },
221
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/connection",
222
+ method: "POST"
223
+ });
224
+ }
225
+ ;
214
226
  const { result } = await request({
215
227
  endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/connection/" + (values == null ? void 0 : values.slug) + "/authorize",
216
228
  method: "POST"
@@ -303,6 +315,34 @@ const FormOrganizationConnection = ({
303
315
  }
304
316
  ) : null;
305
317
  }
318
+ if (link) {
319
+ return (values == null ? void 0 : values.status) === "active" ? null : /* @__PURE__ */ jsx(
320
+ Form,
321
+ {
322
+ ...{
323
+ className: "relative w-full space-y-8"
324
+ },
325
+ children: /* @__PURE__ */ jsx(
326
+ Fieldset,
327
+ {
328
+ ...{
329
+ disabled: disabled || consenting
330
+ },
331
+ children: /* @__PURE__ */ jsx(
332
+ Button,
333
+ {
334
+ ...{
335
+ loading: consenting,
336
+ onClick: consent
337
+ },
338
+ children: ((_d = values == null ? void 0 : values.actions) == null ? void 0 : _d.create) || "Connect"
339
+ }
340
+ )
341
+ }
342
+ )
343
+ }
344
+ );
345
+ }
306
346
  if (kind === "oauth") {
307
347
  return /* @__PURE__ */ jsx(
308
348
  Form,
@@ -372,7 +412,7 @@ const FormOrganizationConnection = ({
372
412
  // the connection would read Active over nothing.
373
413
  disabled: disabled || Object.values(optionsFor).some((entry) => entry == null ? void 0 : entry.isLoading),
374
414
  isSubmitting: formState == null ? void 0 : formState.isSubmitting,
375
- text: ((_c = values == null ? void 0 : values.actions) == null ? void 0 : _c.update) || "Save"
415
+ text: ((_e = values == null ? void 0 : values.actions) == null ? void 0 : _e.update) || "Save"
376
416
  }
377
417
  }
378
418
  ),
@@ -383,7 +423,7 @@ const FormOrganizationConnection = ({
383
423
  loading: consenting,
384
424
  onClick: consent
385
425
  },
386
- children: ((_d = values == null ? void 0 : values.actions) == null ? void 0 : _d.create) || "Connect"
426
+ children: ((_f = values == null ? void 0 : values.actions) == null ? void 0 : _f.create) || "Connect"
387
427
  }
388
428
  )
389
429
  ]
@@ -492,13 +532,13 @@ const FormOrganizationConnection = ({
492
532
  },
493
533
  field.key
494
534
  )),
495
- /* @__PURE__ */ jsx(
535
+ savable({ actions: values == null ? void 0 : values.actions, connected, inputs }) && /* @__PURE__ */ jsx(
496
536
  Submit,
497
537
  {
498
538
  ...{
499
539
  disabled,
500
540
  isSubmitting: formState == null ? void 0 : formState.isSubmitting,
501
- text: connected ? ((_e = values == null ? void 0 : values.actions) == null ? void 0 : _e.update) || "Submit" : ((_f = values == null ? void 0 : values.actions) == null ? void 0 : _f.create) || "Submit"
541
+ text: connected ? ((_g = values == null ? void 0 : values.actions) == null ? void 0 : _g.update) || "Submit" : ((_h = values == null ? void 0 : values.actions) == null ? void 0 : _h.create) || "Submit"
502
542
  }
503
543
  }
504
544
  )
@@ -509,5 +549,6 @@ const FormOrganizationConnection = ({
509
549
  );
510
550
  };
511
551
  export {
552
+ Editable,
512
553
  FormOrganizationConnection
513
554
  };