@drawbridge/components 0.1.12 → 0.1.14

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 (236) hide show
  1. package/components/styles.css +364 -2
  2. package/dist/advertisement.js +3 -1
  3. package/dist/advertisement.mjs +3 -1
  4. package/dist/bridge/advertisements.js +2 -0
  5. package/dist/bridge/advertisements.mjs +2 -0
  6. package/dist/bridge/countdown.js +2 -1
  7. package/dist/bridge/countdown.mjs +2 -1
  8. package/dist/bridge/form-subdomain-embed.js +18 -20
  9. package/dist/bridge/form-subdomain-embed.mjs +18 -20
  10. package/dist/bridge/form-subdomain-header.js +24 -1
  11. package/dist/bridge/form-subdomain-header.mjs +24 -1
  12. package/dist/bridge/form-subdomain-missions.js +538 -0
  13. package/dist/bridge/form-subdomain-missions.mjs +502 -0
  14. package/dist/bridge/form-subdomain.js +530 -220
  15. package/dist/bridge/form-subdomain.mjs +533 -222
  16. package/dist/bridge/lib/entry.js +59 -0
  17. package/dist/bridge/lib/entry.mjs +29 -0
  18. package/dist/bridge/lib/location.js +38 -0
  19. package/dist/bridge/lib/location.mjs +13 -0
  20. package/dist/bridge/lib/order.js +71 -0
  21. package/dist/bridge/lib/order.mjs +44 -0
  22. package/dist/bridge/lib/url.js +9 -0
  23. package/dist/bridge/lib/url.mjs +7 -0
  24. package/dist/bridge/share-button.js +5 -3
  25. package/dist/bridge/share-button.mjs +5 -3
  26. package/dist/bridge/subdomain-content.js +7 -6
  27. package/dist/bridge/subdomain-content.mjs +7 -6
  28. package/dist/bridge/template-layout.js +59 -21
  29. package/dist/bridge/template-layout.mjs +59 -21
  30. package/dist/bridge/template-modal.js +42 -76
  31. package/dist/bridge/template-modal.mjs +39 -73
  32. package/dist/bridge/template-preview.js +208 -0
  33. package/dist/bridge/template-preview.mjs +173 -0
  34. package/dist/bridge/template-subdomain-gallery.js +6 -2
  35. package/dist/bridge/template-subdomain-gallery.mjs +6 -2
  36. package/dist/bridge/template-subdomain-link.js +6 -1
  37. package/dist/bridge/template-subdomain-link.mjs +6 -1
  38. package/dist/bridge/template-subdomain.js +20 -15
  39. package/dist/bridge/template-subdomain.mjs +20 -15
  40. package/dist/dashboard/accordion.js +74 -39
  41. package/dist/dashboard/accordion.mjs +74 -39
  42. package/dist/dashboard/avatar.js +109 -3
  43. package/dist/dashboard/avatar.mjs +106 -4
  44. package/dist/dashboard/buttons-subscription.js +384 -0
  45. package/dist/dashboard/buttons-subscription.mjs +349 -0
  46. package/dist/dashboard/card-campaign-switch.js +265 -0
  47. package/dist/dashboard/card-campaign-switch.mjs +231 -0
  48. package/dist/dashboard/card-order.js +28 -11
  49. package/dist/dashboard/card-order.mjs +28 -11
  50. package/dist/dashboard/card-section.js +26 -2
  51. package/dist/dashboard/card-section.mjs +26 -2
  52. package/dist/dashboard/card-tile.js +6 -7
  53. package/dist/dashboard/card-tile.mjs +6 -7
  54. package/dist/dashboard/connection-workflows.js +196 -0
  55. package/dist/dashboard/connection-workflows.mjs +162 -0
  56. package/dist/dashboard/device.js +95 -0
  57. package/dist/dashboard/device.mjs +72 -0
  58. package/dist/dashboard/form-admin-campaign.js +19 -50
  59. package/dist/dashboard/form-admin-campaign.mjs +20 -51
  60. package/dist/dashboard/form-ai.js +9 -6
  61. package/dist/dashboard/form-ai.mjs +9 -6
  62. package/dist/dashboard/form-auth.js +35 -25
  63. package/dist/dashboard/form-auth.mjs +36 -26
  64. package/dist/dashboard/form-file.js +10 -1
  65. package/dist/dashboard/form-file.mjs +10 -1
  66. package/dist/dashboard/form-filters-analytics.js +14 -1
  67. package/dist/dashboard/form-filters-analytics.mjs +15 -2
  68. package/dist/dashboard/form-organization-campaign-advertisement.js +15 -1
  69. package/dist/dashboard/form-organization-campaign-advertisement.mjs +16 -2
  70. package/dist/dashboard/form-organization-campaign-agreement.js +215 -164
  71. package/dist/dashboard/form-organization-campaign-agreement.mjs +215 -164
  72. package/dist/dashboard/form-organization-campaign-field-email.js +0 -34
  73. package/dist/dashboard/form-organization-campaign-field-email.mjs +0 -34
  74. package/dist/dashboard/form-organization-campaign-field-list.js +466 -0
  75. package/dist/dashboard/form-organization-campaign-field-list.mjs +437 -0
  76. package/dist/dashboard/form-organization-campaign-field-phone.js +0 -34
  77. package/dist/dashboard/form-organization-campaign-field-phone.mjs +0 -34
  78. package/dist/dashboard/form-organization-campaign-field-remove.js +66 -0
  79. package/dist/dashboard/form-organization-campaign-field-remove.mjs +33 -0
  80. package/dist/dashboard/form-organization-campaign-integration-age.js +6 -12
  81. package/dist/dashboard/form-organization-campaign-integration-age.mjs +6 -12
  82. package/dist/dashboard/form-organization-campaign-integration-enable.js +52 -24
  83. package/dist/dashboard/form-organization-campaign-integration-enable.mjs +54 -26
  84. package/dist/dashboard/form-organization-campaign-integration-geocode.js +6 -12
  85. package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +6 -12
  86. package/dist/dashboard/form-organization-campaign-integration-gtm.js +6 -12
  87. package/dist/dashboard/form-organization-campaign-integration-gtm.mjs +6 -12
  88. package/dist/dashboard/form-organization-campaign-link.js +7 -1
  89. package/dist/dashboard/form-organization-campaign-link.mjs +7 -1
  90. package/dist/dashboard/form-organization-campaign-mission.js +291 -0
  91. package/dist/dashboard/form-organization-campaign-mission.mjs +258 -0
  92. package/dist/dashboard/form-organization-campaign-page-embed.js +13 -2
  93. package/dist/dashboard/form-organization-campaign-page-embed.mjs +12 -1
  94. package/dist/dashboard/form-organization-campaign-page.js +20 -11
  95. package/dist/dashboard/form-organization-campaign-page.mjs +20 -11
  96. package/dist/dashboard/form-organization-campaign-prize-edit.js +12 -1
  97. package/dist/dashboard/form-organization-campaign-prize-edit.mjs +12 -1
  98. package/dist/dashboard/form-organization-campaign-section.js +223 -0
  99. package/dist/dashboard/form-organization-campaign-section.mjs +194 -0
  100. package/dist/dashboard/form-organization-campaign.js +114 -469
  101. package/dist/dashboard/form-organization-campaign.mjs +113 -467
  102. package/dist/dashboard/form-organization-export.js +4 -7
  103. package/dist/dashboard/form-organization-export.mjs +4 -7
  104. package/dist/dashboard/form-organization-identity.js +46 -51
  105. package/dist/dashboard/form-organization-identity.mjs +46 -51
  106. package/dist/dashboard/form-organization-workflow.js +518 -686
  107. package/dist/dashboard/form-organization-workflow.mjs +517 -682
  108. package/dist/dashboard/form-organization.js +82 -110
  109. package/dist/dashboard/form-organization.mjs +81 -109
  110. package/dist/dashboard/form-otc.js +4 -5
  111. package/dist/dashboard/form-otc.mjs +4 -5
  112. package/dist/dashboard/form-payment-methods.js +20 -9
  113. package/dist/dashboard/form-payment-methods.mjs +20 -9
  114. package/dist/dashboard/form-stripe.js +30 -0
  115. package/dist/dashboard/form-stripe.mjs +26 -0
  116. package/dist/dashboard/input-array.js +4 -2
  117. package/dist/dashboard/input-array.mjs +4 -2
  118. package/dist/dashboard/input-combobox.js +7 -3
  119. package/dist/dashboard/input-combobox.mjs +7 -3
  120. package/dist/dashboard/input-date.js +7 -0
  121. package/dist/dashboard/input-date.mjs +7 -0
  122. package/dist/dashboard/input-fields.js +80 -20
  123. package/dist/dashboard/input-fields.mjs +80 -20
  124. package/dist/dashboard/input-file.js +21 -1
  125. package/dist/dashboard/input-file.mjs +21 -1
  126. package/dist/dashboard/input-font.js +10 -1
  127. package/dist/dashboard/input-font.mjs +10 -1
  128. package/dist/dashboard/lib/item-list.js +57 -0
  129. package/dist/dashboard/lib/item-list.mjs +33 -0
  130. package/dist/dashboard/lib/menu.js +50 -0
  131. package/dist/dashboard/lib/menu.mjs +26 -0
  132. package/dist/dashboard/locked.js +82 -0
  133. package/dist/dashboard/locked.mjs +53 -0
  134. package/dist/dashboard/menu.js +72 -19
  135. package/dist/dashboard/menu.mjs +72 -19
  136. package/dist/dashboard/note-ai.js +69 -0
  137. package/dist/dashboard/note-ai.mjs +36 -0
  138. package/dist/dashboard/preview.js +419 -0
  139. package/dist/dashboard/preview.mjs +384 -0
  140. package/dist/dashboard/steps.js +39 -13
  141. package/dist/dashboard/steps.mjs +37 -12
  142. package/dist/dashboard/table-contacts.js +136 -0
  143. package/dist/dashboard/table-contacts.mjs +103 -0
  144. package/dist/dashboard/template-not-found.js +4 -2
  145. package/dist/dashboard/template-not-found.mjs +4 -2
  146. package/dist/dashboard/template-socket.js +51 -7
  147. package/dist/dashboard/template-socket.mjs +51 -7
  148. package/dist/icons/desktop.js +46 -0
  149. package/dist/icons/desktop.mjs +27 -0
  150. package/dist/icons/phone.js +46 -0
  151. package/dist/icons/phone.mjs +27 -0
  152. package/dist/icons/puzzle-piece.js +46 -0
  153. package/dist/icons/puzzle-piece.mjs +27 -0
  154. package/dist/icons/tablet.js +46 -0
  155. package/dist/icons/tablet.mjs +27 -0
  156. package/dist/icons/users.js +46 -0
  157. package/dist/icons/users.mjs +27 -0
  158. package/dist/input-checkbox.js +1 -0
  159. package/dist/input-checkbox.mjs +1 -0
  160. package/dist/input-code.js +101 -0
  161. package/dist/input-code.mjs +78 -0
  162. package/dist/input-text.js +2 -1
  163. package/dist/input-text.mjs +2 -1
  164. package/dist/shared/input-checkbox-list.js +0 -1
  165. package/dist/shared/input-checkbox-list.mjs +0 -1
  166. package/dist/shared/input-switch.js +6 -1
  167. package/dist/shared/input-switch.mjs +6 -1
  168. package/dist/shared/lib/campaign.js +117 -0
  169. package/dist/shared/lib/campaign.mjs +91 -0
  170. package/dist/shared/lib/helpers.js +14 -2
  171. package/dist/shared/lib/helpers.mjs +13 -2
  172. package/package.json +133 -13
  173. package/types/bridge/form-subdomain-header.d.ts +2 -0
  174. package/types/bridge/form-subdomain-missions.d.ts +36 -0
  175. package/types/bridge/form-subdomain.d.ts +23 -1
  176. package/types/bridge/lib/entry.d.ts +26 -0
  177. package/types/bridge/lib/location.d.ts +13 -0
  178. package/types/bridge/lib/order.d.ts +30 -0
  179. package/types/bridge/lib/url.d.ts +19 -0
  180. package/types/bridge/template-modal.d.ts +1 -1
  181. package/types/bridge/template-preview.d.ts +10 -0
  182. package/types/bridge/template-subdomain-link.d.ts +2 -0
  183. package/types/dashboard/accordion.d.ts +2 -0
  184. package/types/dashboard/avatar.d.ts +18 -2
  185. package/types/dashboard/buttons-subscription.d.ts +22 -0
  186. package/types/dashboard/card-campaign-switch.d.ts +32 -0
  187. package/types/dashboard/card-order.d.ts +11 -0
  188. package/types/dashboard/card-section.d.ts +2 -0
  189. package/types/dashboard/connection-workflows.d.ts +33 -0
  190. package/types/dashboard/device.d.ts +12 -0
  191. package/types/dashboard/form-admin-campaign.d.ts +3 -2
  192. package/types/dashboard/form-ai.d.ts +2 -2
  193. package/types/dashboard/form-organization-campaign-agreement.d.ts +18 -12
  194. package/types/dashboard/form-organization-campaign-field-email.d.ts +1 -2
  195. package/types/dashboard/form-organization-campaign-field-list.d.ts +36 -0
  196. package/types/dashboard/form-organization-campaign-field-phone.d.ts +1 -2
  197. package/types/dashboard/form-organization-campaign-field-remove.d.ts +22 -0
  198. package/types/dashboard/form-organization-campaign-field-select.d.ts +2 -1
  199. package/types/dashboard/form-organization-campaign-field-textarea.d.ts +2 -1
  200. package/types/dashboard/form-organization-campaign-integration-age.d.ts +3 -3
  201. package/types/dashboard/form-organization-campaign-integration-enable.d.ts +3 -3
  202. package/types/dashboard/form-organization-campaign-mission.d.ts +40 -0
  203. package/types/dashboard/form-organization-campaign-section.d.ts +27 -0
  204. package/types/dashboard/form-organization-campaign.d.ts +27 -17
  205. package/types/dashboard/form-organization-identity.d.ts +2 -0
  206. package/types/dashboard/form-organization-workflow.d.ts +43 -47
  207. package/types/dashboard/form-organization.d.ts +7 -2
  208. package/types/dashboard/form-stripe.d.ts +3 -0
  209. package/types/dashboard/input-combobox.d.ts +2 -0
  210. package/types/dashboard/input-date.d.ts +2 -0
  211. package/types/dashboard/input-fields.d.ts +3 -2
  212. package/types/dashboard/input-file.d.ts +4 -0
  213. package/types/dashboard/lib/item-list.d.ts +14 -0
  214. package/types/dashboard/lib/menu.d.ts +17 -0
  215. package/types/dashboard/locked.d.ts +10 -0
  216. package/types/dashboard/menu.d.ts +10 -2
  217. package/types/dashboard/note-ai.d.ts +15 -0
  218. package/types/dashboard/preview.d.ts +33 -0
  219. package/types/dashboard/steps.d.ts +19 -4
  220. package/types/dashboard/table-cell-title.d.ts +2 -2
  221. package/types/dashboard/table-contacts.d.ts +2 -0
  222. package/types/icons/desktop.d.ts +5 -0
  223. package/types/icons/phone.d.ts +5 -0
  224. package/types/icons/puzzle-piece.d.ts +5 -0
  225. package/types/icons/tablet.d.ts +5 -0
  226. package/types/icons/users.d.ts +5 -0
  227. package/types/input-code.d.ts +23 -0
  228. package/types/shared/input-switch.d.ts +2 -0
  229. package/types/shared/lib/campaign.d.ts +35 -0
  230. package/types/shared/lib/helpers.d.ts +3 -0
  231. package/dist/dashboard/card-integration.js +0 -187
  232. package/dist/dashboard/card-integration.mjs +0 -158
  233. package/dist/dashboard/iframe.js +0 -159
  234. package/dist/dashboard/iframe.mjs +0 -130
  235. package/types/dashboard/card-integration.d.ts +0 -24
  236. package/types/dashboard/iframe.d.ts +0 -18
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
28
  var form_organization_exports = {};
29
29
  __export(form_organization_exports, {
30
- FormOrganizationBusiness: () => FormOrganizationBusiness,
30
+ FormOrganizationBusinessField: () => FormOrganizationBusinessField,
31
31
  FormOrganizationDefaults: () => FormOrganizationDefaults,
32
32
  FormOrganizationRevenue: () => FormOrganizationRevenue,
33
33
  FormOrganizationSubdomain: () => FormOrganizationSubdomain,
@@ -335,30 +335,77 @@ const FormOrganizationSubdomain = ({
335
335
  }
336
336
  );
337
337
  };
338
- const FormOrganizationBusiness = ({
339
- values,
338
+ const business = {
339
+ email: {
340
+ input: ({ onChange, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
341
+ import_input_text.default,
342
+ {
343
+ ...{
344
+ onChange,
345
+ placeholder: "you@yourbrand.com",
346
+ type: "email",
347
+ value: value || ""
348
+ }
349
+ }
350
+ ),
351
+ label: "Contact email",
352
+ message: "Where verification providers send their updates.",
353
+ schema: import_yup.default.string().label("Contact email").required().email()
354
+ },
355
+ name: {
356
+ input: ({ onChange, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
357
+ import_input_text.default,
358
+ {
359
+ ...{
360
+ onChange,
361
+ placeholder: "Acme Holdings Ltd",
362
+ value: value || ""
363
+ }
364
+ }
365
+ ),
366
+ label: "Legal business name",
367
+ message: "Your legal or trading name. We submit verifications under it.",
368
+ schema: import_yup.default.string().label("Legal business name").required().max(150)
369
+ },
370
+ website: {
371
+ input: ({ onChange, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
372
+ import_input_url.default,
373
+ {
374
+ ...{
375
+ onChange,
376
+ placeholder: "https://yourbrand.com",
377
+ value
378
+ }
379
+ }
380
+ ),
381
+ label: "Website",
382
+ message: "We verify your SMS number against it. Your sending domain is its domain.",
383
+ schema: import_yup.default.string().label("Website").max(2048).matches(import_drawbridge_utils.regex.url, "Website must start with https").required().url()
384
+ }
385
+ };
386
+ const FormOrganizationBusinessField = ({
387
+ name,
340
388
  onError,
341
- onSuccess
389
+ onSuccess,
390
+ owner,
391
+ values
342
392
  }) => {
343
- var _a, _b, _c;
393
+ var _a;
394
+ const field = business[name];
344
395
  const { control, formState, handleSubmit } = (0, import_form.useForm)({
345
396
  defaultValues: {
346
- email: ((_a = values == null ? void 0 : values.business) == null ? void 0 : _a.email) || "",
347
- name: ((_b = values == null ? void 0 : values.business) == null ? void 0 : _b.name) || "",
348
- website: ((_c = values == null ? void 0 : values.business) == null ? void 0 : _c.website) || ""
397
+ [name]: ((_a = values == null ? void 0 : values.business) == null ? void 0 : _a[name]) || name === "email" && owner || ""
349
398
  },
350
399
  resolver: (0, import_yup.resolver)(
351
400
  import_yup.default.object({
352
- email: import_yup.default.string().label("Contact email").required().email(),
353
- name: import_yup.default.string().label("Business name").required().max(150),
354
- website: import_yup.default.string().label("Website").max(2048).matches(import_drawbridge_utils.regex.url, "Website must start with https").required().url()
401
+ [name]: field.schema
355
402
  })
356
403
  )
357
404
  });
358
- const onSubmit = async ({ email, name, website }) => {
405
+ const onSubmit = async (body) => {
359
406
  try {
360
407
  const response = await (0, import_fetch.request)({
361
- body: { email, name, website },
408
+ body,
362
409
  endpoint: "/organization/" + (values == null ? void 0 : values.id) + "/business",
363
410
  method: "PUT"
364
411
  });
@@ -375,110 +422,35 @@ const FormOrganizationBusiness = ({
375
422
  onSubmit: handleSubmit(onSubmit)
376
423
  },
377
424
  children: [
378
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
425
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
379
426
  import_fieldset.default,
380
427
  {
381
428
  ...{
382
429
  disabled: formState == null ? void 0 : formState.isSubmitting
383
430
  },
384
- children: [
385
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
386
- import_form.Controller,
387
- {
388
- ...{
389
- control,
390
- name: "name",
391
- render: ({ field: { value, onChange } }) => {
392
- var _a2, _b2;
393
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
394
- import_input_group.default,
395
- {
396
- ...{
397
- error: (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.name) == null ? void 0 : _b2.message,
398
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
399
- import_input_text.default,
400
- {
401
- ...{
402
- onChange,
403
- placeholder: "Acme Holdings Ltd",
404
- value: value || ""
405
- }
406
- }
407
- ),
408
- label: "Legal business name",
409
- message: "Your legal or trading name \u2014 what verifications are submitted under."
410
- }
411
- }
412
- );
413
- }
414
- }
415
- }
416
- ),
417
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
418
- import_form.Controller,
419
- {
420
- ...{
421
- control,
422
- name: "website",
423
- render: ({ field: { value, onChange } }) => {
424
- var _a2, _b2;
425
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
426
- import_input_group.default,
427
- {
428
- ...{
429
- error: (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.website) == null ? void 0 : _b2.message,
430
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
431
- import_input_url.default,
432
- {
433
- ...{
434
- onChange,
435
- placeholder: "https://yourbrand.com",
436
- value
437
- }
438
- }
439
- ),
440
- label: "Website"
441
- }
442
- }
443
- );
444
- }
445
- }
446
- }
447
- ),
448
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
449
- import_form.Controller,
450
- {
451
- ...{
452
- control,
453
- name: "email",
454
- render: ({ field: { value, onChange } }) => {
455
- var _a2, _b2;
456
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
457
- import_input_group.default,
458
- {
459
- ...{
460
- error: (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.email) == null ? void 0 : _b2.message,
461
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
462
- import_input_text.default,
463
- {
464
- ...{
465
- onChange,
466
- placeholder: "you@yourbrand.com",
467
- type: "email",
468
- value: value || ""
469
- }
470
- }
471
- ),
472
- label: "Contact email",
473
- message: "Where verification providers send their updates."
474
- }
431
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
432
+ import_form.Controller,
433
+ {
434
+ ...{
435
+ control,
436
+ name,
437
+ render: ({ field: { value, onChange } }) => {
438
+ var _a2, _b;
439
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
440
+ import_input_group.default,
441
+ {
442
+ ...{
443
+ error: (_b = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2[name]) == null ? void 0 : _b.message,
444
+ input: field.input({ onChange, value }),
445
+ label: field.label,
446
+ message: field.message
475
447
  }
476
- );
477
- }
448
+ }
449
+ );
478
450
  }
479
451
  }
480
- )
481
- ]
452
+ }
453
+ )
482
454
  }
483
455
  ),
484
456
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -780,7 +752,7 @@ const FormOrganizationRevenue = ({
780
752
  var form_organization_default = FormOrganization;
781
753
  // Annotate the CommonJS export names for ESM import in node:
782
754
  0 && (module.exports = {
783
- FormOrganizationBusiness,
755
+ FormOrganizationBusinessField,
784
756
  FormOrganizationDefaults,
785
757
  FormOrganizationRevenue,
786
758
  FormOrganizationSubdomain,
@@ -298,30 +298,77 @@ const FormOrganizationSubdomain = ({
298
298
  }
299
299
  );
300
300
  };
301
- const FormOrganizationBusiness = ({
302
- values,
301
+ const business = {
302
+ email: {
303
+ input: ({ onChange, value }) => /* @__PURE__ */ jsx(
304
+ InputText,
305
+ {
306
+ ...{
307
+ onChange,
308
+ placeholder: "you@yourbrand.com",
309
+ type: "email",
310
+ value: value || ""
311
+ }
312
+ }
313
+ ),
314
+ label: "Contact email",
315
+ message: "Where verification providers send their updates.",
316
+ schema: yup.string().label("Contact email").required().email()
317
+ },
318
+ name: {
319
+ input: ({ onChange, value }) => /* @__PURE__ */ jsx(
320
+ InputText,
321
+ {
322
+ ...{
323
+ onChange,
324
+ placeholder: "Acme Holdings Ltd",
325
+ value: value || ""
326
+ }
327
+ }
328
+ ),
329
+ label: "Legal business name",
330
+ message: "Your legal or trading name. We submit verifications under it.",
331
+ schema: yup.string().label("Legal business name").required().max(150)
332
+ },
333
+ website: {
334
+ input: ({ onChange, value }) => /* @__PURE__ */ jsx(
335
+ InputUrl,
336
+ {
337
+ ...{
338
+ onChange,
339
+ placeholder: "https://yourbrand.com",
340
+ value
341
+ }
342
+ }
343
+ ),
344
+ label: "Website",
345
+ message: "We verify your SMS number against it. Your sending domain is its domain.",
346
+ schema: yup.string().label("Website").max(2048).matches(regex.url, "Website must start with https").required().url()
347
+ }
348
+ };
349
+ const FormOrganizationBusinessField = ({
350
+ name,
303
351
  onError,
304
- onSuccess
352
+ onSuccess,
353
+ owner,
354
+ values
305
355
  }) => {
306
- var _a, _b, _c;
356
+ var _a;
357
+ const field = business[name];
307
358
  const { control, formState, handleSubmit } = useForm({
308
359
  defaultValues: {
309
- email: ((_a = values == null ? void 0 : values.business) == null ? void 0 : _a.email) || "",
310
- name: ((_b = values == null ? void 0 : values.business) == null ? void 0 : _b.name) || "",
311
- website: ((_c = values == null ? void 0 : values.business) == null ? void 0 : _c.website) || ""
360
+ [name]: ((_a = values == null ? void 0 : values.business) == null ? void 0 : _a[name]) || name === "email" && owner || ""
312
361
  },
313
362
  resolver: resolver(
314
363
  yup.object({
315
- email: yup.string().label("Contact email").required().email(),
316
- name: yup.string().label("Business name").required().max(150),
317
- website: yup.string().label("Website").max(2048).matches(regex.url, "Website must start with https").required().url()
364
+ [name]: field.schema
318
365
  })
319
366
  )
320
367
  });
321
- const onSubmit = async ({ email, name, website }) => {
368
+ const onSubmit = async (body) => {
322
369
  try {
323
370
  const response = await request({
324
- body: { email, name, website },
371
+ body,
325
372
  endpoint: "/organization/" + (values == null ? void 0 : values.id) + "/business",
326
373
  method: "PUT"
327
374
  });
@@ -338,110 +385,35 @@ const FormOrganizationBusiness = ({
338
385
  onSubmit: handleSubmit(onSubmit)
339
386
  },
340
387
  children: [
341
- /* @__PURE__ */ jsxs(
388
+ /* @__PURE__ */ jsx(
342
389
  Fieldset,
343
390
  {
344
391
  ...{
345
392
  disabled: formState == null ? void 0 : formState.isSubmitting
346
393
  },
347
- children: [
348
- /* @__PURE__ */ jsx(
349
- Controller,
350
- {
351
- ...{
352
- control,
353
- name: "name",
354
- render: ({ field: { value, onChange } }) => {
355
- var _a2, _b2;
356
- return /* @__PURE__ */ jsx(
357
- InputGroup,
358
- {
359
- ...{
360
- error: (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.name) == null ? void 0 : _b2.message,
361
- input: /* @__PURE__ */ jsx(
362
- InputText,
363
- {
364
- ...{
365
- onChange,
366
- placeholder: "Acme Holdings Ltd",
367
- value: value || ""
368
- }
369
- }
370
- ),
371
- label: "Legal business name",
372
- message: "Your legal or trading name \u2014 what verifications are submitted under."
373
- }
374
- }
375
- );
376
- }
377
- }
378
- }
379
- ),
380
- /* @__PURE__ */ jsx(
381
- Controller,
382
- {
383
- ...{
384
- control,
385
- name: "website",
386
- render: ({ field: { value, onChange } }) => {
387
- var _a2, _b2;
388
- return /* @__PURE__ */ jsx(
389
- InputGroup,
390
- {
391
- ...{
392
- error: (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.website) == null ? void 0 : _b2.message,
393
- input: /* @__PURE__ */ jsx(
394
- InputUrl,
395
- {
396
- ...{
397
- onChange,
398
- placeholder: "https://yourbrand.com",
399
- value
400
- }
401
- }
402
- ),
403
- label: "Website"
404
- }
405
- }
406
- );
407
- }
408
- }
409
- }
410
- ),
411
- /* @__PURE__ */ jsx(
412
- Controller,
413
- {
414
- ...{
415
- control,
416
- name: "email",
417
- render: ({ field: { value, onChange } }) => {
418
- var _a2, _b2;
419
- return /* @__PURE__ */ jsx(
420
- InputGroup,
421
- {
422
- ...{
423
- error: (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.email) == null ? void 0 : _b2.message,
424
- input: /* @__PURE__ */ jsx(
425
- InputText,
426
- {
427
- ...{
428
- onChange,
429
- placeholder: "you@yourbrand.com",
430
- type: "email",
431
- value: value || ""
432
- }
433
- }
434
- ),
435
- label: "Contact email",
436
- message: "Where verification providers send their updates."
437
- }
394
+ children: /* @__PURE__ */ jsx(
395
+ Controller,
396
+ {
397
+ ...{
398
+ control,
399
+ name,
400
+ render: ({ field: { value, onChange } }) => {
401
+ var _a2, _b;
402
+ return /* @__PURE__ */ jsx(
403
+ InputGroup,
404
+ {
405
+ ...{
406
+ error: (_b = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2[name]) == null ? void 0 : _b.message,
407
+ input: field.input({ onChange, value }),
408
+ label: field.label,
409
+ message: field.message
438
410
  }
439
- );
440
- }
411
+ }
412
+ );
441
413
  }
442
414
  }
443
- )
444
- ]
415
+ }
416
+ )
445
417
  }
446
418
  ),
447
419
  /* @__PURE__ */ jsx(
@@ -742,7 +714,7 @@ const FormOrganizationRevenue = ({
742
714
  };
743
715
  var form_organization_default = FormOrganization;
744
716
  export {
745
- FormOrganizationBusiness,
717
+ FormOrganizationBusinessField,
746
718
  FormOrganizationDefaults,
747
719
  FormOrganizationRevenue,
748
720
  FormOrganizationSubdomain,
@@ -39,7 +39,7 @@ var import_yup = __toESM(require("../shared/lib/yup"));
39
39
  var import_form2 = __toESM(require("../shared/form"));
40
40
  var import_fieldset = __toESM(require("../shared/fieldset"));
41
41
  var import_input_group = __toESM(require("../input-group"));
42
- var import_input_text = __toESM(require("../input-text"));
42
+ var import_input_code = __toESM(require("../input-code"));
43
43
  var import_button = __toESM(require("../shared/button"));
44
44
  const FormOtcCode = ({
45
45
  onError,
@@ -177,14 +177,13 @@ const FormOtcConfirm = ({
177
177
  ...{
178
178
  error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.code) == null ? void 0 : _b.message,
179
179
  input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
180
- import_input_text.default,
180
+ import_input_code.default,
181
181
  {
182
182
  ...{
183
- autoComplete: "one-time-code",
184
183
  autoFocus: true,
185
- inputMode: "numeric",
186
- maxLength: 6,
187
184
  onChange,
185
+ // The sixth digit confirms, as on the missions panel.
186
+ onComplete: () => handleSubmit(onSubmit)(),
188
187
  value: value || ""
189
188
  }
190
189
  }
@@ -6,7 +6,7 @@ import yup, { resolver } from "../shared/lib/yup.mjs";
6
6
  import Form from "../shared/form.mjs";
7
7
  import Fieldset from "../shared/fieldset.mjs";
8
8
  import InputGroup from "../input-group.mjs";
9
- import InputText from "../input-text.mjs";
9
+ import InputCode from "../input-code.mjs";
10
10
  import Button from "../shared/button.mjs";
11
11
  const FormOtcCode = ({
12
12
  onError,
@@ -144,14 +144,13 @@ const FormOtcConfirm = ({
144
144
  ...{
145
145
  error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.code) == null ? void 0 : _b.message,
146
146
  input: /* @__PURE__ */ jsx(
147
- InputText,
147
+ InputCode,
148
148
  {
149
149
  ...{
150
- autoComplete: "one-time-code",
151
150
  autoFocus: true,
152
- inputMode: "numeric",
153
- maxLength: 6,
154
151
  onChange,
152
+ // The sixth digit confirms, as on the missions panel.
153
+ onComplete: () => handleSubmit(onSubmit)(),
155
154
  value: value || ""
156
155
  }
157
156
  }
@@ -160,20 +160,31 @@ const FormPaymentMethods = ({
160
160
  ]
161
161
  }
162
162
  )
163
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_empty.default, { children: [
164
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "No payment methods found" }),
165
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
166
- import_button.default,
163
+ ] }) : (
164
+ // Opened in a modal or the subscription drawer, both white: the grey box.
165
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
166
+ import_empty.default,
167
167
  {
168
168
  ...{
169
- onClick: () => onClickAdd(closeModal),
170
- // An empty box's action is small, as the dashboard's empty states draw theirs.
171
- size: "small"
169
+ variant: "secondary"
172
170
  },
173
- children: "Add payment method"
171
+ children: [
172
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "No payment methods found" }),
173
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
174
+ import_button.default,
175
+ {
176
+ ...{
177
+ onClick: () => onClickAdd(closeModal),
178
+ // An empty box's action is small, as the dashboard's empty states draw theirs.
179
+ size: "small"
180
+ },
181
+ children: "Add payment method"
182
+ }
183
+ )
184
+ ]
174
185
  }
175
186
  )
176
- ] })
187
+ )
177
188
  }
178
189
  );
179
190
  }
@@ -128,20 +128,31 @@ const FormPaymentMethods = ({
128
128
  ]
129
129
  }
130
130
  )
131
- ] }) : /* @__PURE__ */ jsxs(Empty, { children: [
132
- /* @__PURE__ */ jsx("p", { children: "No payment methods found" }),
133
- /* @__PURE__ */ jsx(
134
- Button,
131
+ ] }) : (
132
+ // Opened in a modal or the subscription drawer, both white: the grey box.
133
+ /* @__PURE__ */ jsxs(
134
+ Empty,
135
135
  {
136
136
  ...{
137
- onClick: () => onClickAdd(closeModal),
138
- // An empty box's action is small, as the dashboard's empty states draw theirs.
139
- size: "small"
137
+ variant: "secondary"
140
138
  },
141
- children: "Add payment method"
139
+ children: [
140
+ /* @__PURE__ */ jsx("p", { children: "No payment methods found" }),
141
+ /* @__PURE__ */ jsx(
142
+ Button,
143
+ {
144
+ ...{
145
+ onClick: () => onClickAdd(closeModal),
146
+ // An empty box's action is small, as the dashboard's empty states draw theirs.
147
+ size: "small"
148
+ },
149
+ children: "Add payment method"
150
+ }
151
+ )
152
+ ]
142
153
  }
143
154
  )
144
- ] })
155
+ )
145
156
  }
146
157
  );
147
158
  }
@@ -27,6 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
28
  var form_stripe_exports = {};
29
29
  __export(form_stripe_exports, {
30
+ FormStripeIntent: () => FormStripeIntent,
30
31
  default: () => form_stripe_default
31
32
  });
32
33
  module.exports = __toCommonJS(form_stripe_exports);
@@ -40,6 +41,7 @@ var import_form = __toESM(require("../shared/form"));
40
41
  var import_fieldset = __toESM(require("../shared/fieldset"));
41
42
  var import_empty = __toESM(require("../shared/empty"));
42
43
  var import_card_task = __toESM(require("./card-task"));
44
+ var import_provider_resource = __toESM(require("./provider-resource"));
43
45
  var import_button = __toESM(require("../shared/button"));
44
46
  const stripe = (0, import_stripe_js.loadStripe)(process.env.NEXT_PUBLIC_STRIPE_API_KEY);
45
47
  const FormStripeInner = ({
@@ -233,4 +235,32 @@ const FormStripe = ({
233
235
  }
234
236
  );
235
237
  };
238
+ const FormStripeIntent = ({ onSuccess }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
239
+ import_provider_resource.default,
240
+ {
241
+ ...{
242
+ cache: "no-store",
243
+ endpoint: "/account/intent",
244
+ error: ({ error }) => error.message,
245
+ loader: true,
246
+ queryKey: ["payment-intent"]
247
+ },
248
+ children: (query) => {
249
+ var _a;
250
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
251
+ FormStripe,
252
+ {
253
+ ...{
254
+ clientSecret: (_a = query == null ? void 0 : query.data) == null ? void 0 : _a.clientSecret,
255
+ onSuccess
256
+ }
257
+ }
258
+ );
259
+ }
260
+ }
261
+ );
236
262
  var form_stripe_default = FormStripe;
263
+ // Annotate the CommonJS export names for ESM import in node:
264
+ 0 && (module.exports = {
265
+ FormStripeIntent
266
+ });