@drawbridge/components 0.1.33 → 0.1.35

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 (328) hide show
  1. package/components/styles.css +68 -355
  2. package/dist/advertisement.js +15 -20
  3. package/dist/advertisement.mjs +15 -20
  4. package/dist/bridge/advertisements.js +4 -2
  5. package/dist/bridge/advertisements.mjs +5 -3
  6. package/dist/bridge/fields.js +89 -6
  7. package/dist/bridge/fields.mjs +89 -7
  8. package/dist/bridge/form-subdomain-agreement.js +165 -0
  9. package/dist/bridge/form-subdomain-agreement.mjs +132 -0
  10. package/dist/bridge/form-subdomain-embed.js +5 -1
  11. package/dist/bridge/form-subdomain-embed.mjs +5 -1
  12. package/dist/bridge/form-subdomain-header.js +21 -14
  13. package/dist/bridge/form-subdomain-header.mjs +20 -14
  14. package/dist/bridge/form-subdomain-issue.js +17 -8
  15. package/dist/bridge/form-subdomain-issue.mjs +17 -8
  16. package/dist/bridge/form-subdomain-missions.js +58 -52
  17. package/dist/bridge/form-subdomain-missions.mjs +60 -54
  18. package/dist/bridge/form-subdomain.js +223 -94
  19. package/dist/bridge/form-subdomain.mjs +222 -96
  20. package/dist/bridge/lib/entry.js +61 -6
  21. package/dist/bridge/lib/entry.mjs +51 -5
  22. package/dist/bridge/lib/order.js +23 -0
  23. package/dist/bridge/lib/order.mjs +20 -0
  24. package/dist/bridge/template-layout.js +5 -2
  25. package/dist/bridge/template-layout.mjs +6 -3
  26. package/dist/bridge/template-modal.js +82 -15
  27. package/dist/bridge/template-modal.mjs +83 -16
  28. package/dist/bridge/template-subdomain-gallery.js +126 -75
  29. package/dist/bridge/template-subdomain-gallery.mjs +122 -75
  30. package/dist/bridge/template-subdomain.js +16 -14
  31. package/dist/bridge/template-subdomain.mjs +17 -15
  32. package/dist/dashboard/avatar.js +5 -0
  33. package/dist/dashboard/avatar.mjs +5 -0
  34. package/dist/dashboard/campaign-form.js +1798 -0
  35. package/dist/dashboard/campaign-form.mjs +1769 -0
  36. package/dist/dashboard/card-affiliate.js +3 -2
  37. package/dist/dashboard/card-affiliate.mjs +3 -2
  38. package/dist/dashboard/card-campaign-agreement.js +172 -0
  39. package/dist/dashboard/card-campaign-agreement.mjs +139 -0
  40. package/dist/dashboard/card-campaign-switch.js +34 -9
  41. package/dist/dashboard/card-campaign-switch.mjs +32 -8
  42. package/dist/dashboard/card-order.js +6 -14
  43. package/dist/dashboard/card-order.mjs +6 -14
  44. package/dist/dashboard/card-section.js +69 -26
  45. package/dist/dashboard/card-section.mjs +65 -26
  46. package/dist/dashboard/card-shortcut.js +181 -0
  47. package/dist/dashboard/card-shortcut.mjs +152 -0
  48. package/dist/dashboard/card-tile.js +3 -35
  49. package/dist/dashboard/card-tile.mjs +3 -34
  50. package/dist/dashboard/document-blocks.js +305 -0
  51. package/dist/dashboard/document-blocks.mjs +270 -0
  52. package/dist/dashboard/drawer-subscription.js +52 -14
  53. package/dist/dashboard/drawer-subscription.mjs +52 -14
  54. package/dist/dashboard/drawer.js +20 -3
  55. package/dist/dashboard/drawer.mjs +21 -4
  56. package/dist/dashboard/dropdown.js +6 -2
  57. package/dist/dashboard/dropdown.mjs +6 -2
  58. package/dist/dashboard/form-admin-subscription-custom.js +72 -8
  59. package/dist/dashboard/form-admin-subscription-custom.mjs +72 -8
  60. package/dist/dashboard/form-ai.js +0 -148
  61. package/dist/dashboard/form-ai.mjs +1 -148
  62. package/dist/dashboard/form-filters-analytics.js +88 -37
  63. package/dist/dashboard/form-filters-analytics.mjs +85 -38
  64. package/dist/dashboard/form-organization-brand.js +30 -13
  65. package/dist/dashboard/form-organization-brand.mjs +30 -13
  66. package/dist/dashboard/form-organization-campaign-advertisement.js +38 -112
  67. package/dist/dashboard/form-organization-campaign-advertisement.mjs +38 -112
  68. package/dist/dashboard/form-organization-campaign-advertisements.js +374 -0
  69. package/dist/dashboard/form-organization-campaign-advertisements.mjs +345 -0
  70. package/dist/dashboard/form-organization-campaign-agreement.js +414 -210
  71. package/dist/dashboard/form-organization-campaign-agreement.mjs +411 -212
  72. package/dist/dashboard/form-organization-campaign-design.js +258 -0
  73. package/dist/dashboard/form-organization-campaign-design.mjs +223 -0
  74. package/dist/dashboard/form-organization-campaign-field-item.js +585 -0
  75. package/dist/dashboard/form-organization-campaign-field-item.mjs +552 -0
  76. package/dist/dashboard/form-organization-campaign-field-number.js +48 -7
  77. package/dist/dashboard/form-organization-campaign-field-number.mjs +48 -7
  78. package/dist/dashboard/form-organization-campaign-field-select.js +15 -4
  79. package/dist/dashboard/form-organization-campaign-field-select.mjs +15 -4
  80. package/dist/dashboard/form-organization-campaign-field-skill.js +359 -0
  81. package/dist/dashboard/form-organization-campaign-field-skill.mjs +330 -0
  82. package/dist/dashboard/form-organization-campaign-field-text.js +46 -6
  83. package/dist/dashboard/form-organization-campaign-field-text.mjs +46 -6
  84. package/dist/dashboard/form-organization-campaign-field-textarea.js +22 -13
  85. package/dist/dashboard/form-organization-campaign-field-textarea.mjs +22 -13
  86. package/dist/dashboard/form-organization-campaign-footer.js +178 -0
  87. package/dist/dashboard/form-organization-campaign-footer.mjs +149 -0
  88. package/dist/dashboard/form-organization-campaign-integration-age.js +2 -35
  89. package/dist/dashboard/form-organization-campaign-integration-age.mjs +2 -35
  90. package/dist/dashboard/form-organization-campaign-integration-geocode.js +4 -1
  91. package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +4 -1
  92. package/dist/dashboard/form-organization-campaign-page-embed.js +1 -1
  93. package/dist/dashboard/form-organization-campaign-page-embed.mjs +1 -1
  94. package/dist/dashboard/form-organization-campaign-page-preview.js +1 -2
  95. package/dist/dashboard/form-organization-campaign-page-preview.mjs +1 -2
  96. package/dist/dashboard/form-organization-campaign-page-qr.js +2 -2
  97. package/dist/dashboard/form-organization-campaign-page-qr.mjs +2 -2
  98. package/dist/dashboard/form-organization-campaign-page-share.js +5 -5
  99. package/dist/dashboard/form-organization-campaign-page-share.mjs +5 -5
  100. package/dist/dashboard/form-organization-campaign-page-slug.js +2 -3
  101. package/dist/dashboard/form-organization-campaign-page-slug.mjs +2 -3
  102. package/dist/dashboard/form-organization-campaign-page.js +168 -265
  103. package/dist/dashboard/form-organization-campaign-page.mjs +170 -266
  104. package/dist/dashboard/form-organization-campaign-section.js +125 -107
  105. package/dist/dashboard/form-organization-campaign-section.mjs +121 -107
  106. package/dist/dashboard/form-organization-campaign.js +119 -9
  107. package/dist/dashboard/form-organization-campaign.mjs +118 -9
  108. package/dist/dashboard/form-organization-file-frame.js +7 -1
  109. package/dist/dashboard/form-organization-file-frame.mjs +7 -1
  110. package/dist/dashboard/form-organization-workflow.js +589 -532
  111. package/dist/dashboard/form-organization-workflow.mjs +590 -533
  112. package/dist/dashboard/form-organization.js +22 -0
  113. package/dist/dashboard/form-organization.mjs +22 -0
  114. package/dist/dashboard/form-reposition.js +396 -0
  115. package/dist/dashboard/form-reposition.mjs +359 -0
  116. package/dist/dashboard/form-support.js +189 -0
  117. package/dist/dashboard/form-support.mjs +160 -0
  118. package/dist/dashboard/form-tests.js +683 -0
  119. package/dist/dashboard/form-tests.mjs +646 -0
  120. package/dist/dashboard/form-verify-prize.js +114 -34
  121. package/dist/dashboard/form-verify-prize.mjs +111 -34
  122. package/dist/dashboard/google.js +8 -1
  123. package/dist/dashboard/google.mjs +8 -1
  124. package/dist/dashboard/input-array.js +2 -0
  125. package/dist/dashboard/input-array.mjs +2 -0
  126. package/dist/dashboard/input-editor.js +17 -6
  127. package/dist/dashboard/input-editor.mjs +17 -6
  128. package/dist/dashboard/input-fields.js +287 -437
  129. package/dist/dashboard/input-fields.mjs +287 -436
  130. package/dist/dashboard/input-file.js +70 -2
  131. package/dist/dashboard/input-file.mjs +70 -2
  132. package/dist/dashboard/input-font.js +64 -55
  133. package/dist/dashboard/input-font.mjs +64 -55
  134. package/dist/dashboard/input-resource.js +4 -1
  135. package/dist/dashboard/input-resource.mjs +4 -1
  136. package/dist/dashboard/lib/ab-tests.js +130 -0
  137. package/dist/dashboard/lib/ab-tests.mjs +94 -0
  138. package/dist/dashboard/lib/features.js +1 -1
  139. package/dist/dashboard/lib/features.mjs +1 -1
  140. package/dist/dashboard/lib/focus.js +93 -0
  141. package/dist/dashboard/lib/focus.mjs +69 -0
  142. package/dist/dashboard/lib/form-page.js +203 -0
  143. package/dist/dashboard/lib/form-page.mjs +155 -0
  144. package/dist/dashboard/lib/item-list.js +0 -15
  145. package/dist/dashboard/lib/item-list.mjs +0 -14
  146. package/dist/dashboard/lib/rail.js +16 -17
  147. package/dist/dashboard/lib/rail.mjs +15 -16
  148. package/dist/dashboard/lib/sms.js +8 -2
  149. package/dist/dashboard/lib/sms.mjs +6 -1
  150. package/dist/dashboard/list-resource.js +2 -0
  151. package/dist/dashboard/list-resource.mjs +2 -0
  152. package/dist/dashboard/menu.js +54 -5
  153. package/dist/dashboard/menu.mjs +53 -5
  154. package/dist/dashboard/modal.js +19 -4
  155. package/dist/dashboard/modal.mjs +20 -5
  156. package/dist/dashboard/order-sections.js +4 -0
  157. package/dist/dashboard/order-sections.mjs +4 -0
  158. package/dist/dashboard/preview.js +838 -324
  159. package/dist/dashboard/preview.mjs +826 -324
  160. package/dist/dashboard/provider-ui.js +20 -12
  161. package/dist/dashboard/provider-ui.mjs +21 -13
  162. package/dist/dashboard/recharts.js +53 -28
  163. package/dist/dashboard/recharts.mjs +53 -28
  164. package/dist/dashboard/swatch.js +35 -0
  165. package/dist/dashboard/swatch.mjs +31 -0
  166. package/dist/dashboard/table-contacts.js +6 -10
  167. package/dist/dashboard/table-contacts.mjs +6 -10
  168. package/dist/dashboard/table.js +10 -3
  169. package/dist/dashboard/table.mjs +9 -3
  170. package/dist/dashboard/template-dashboard.js +12 -7
  171. package/dist/dashboard/template-dashboard.mjs +11 -7
  172. package/dist/dashboard/template-design.js +564 -0
  173. package/dist/dashboard/template-design.mjs +531 -0
  174. package/dist/dashboard/template-rail.js +198 -126
  175. package/dist/dashboard/template-rail.mjs +196 -125
  176. package/dist/dashboard/template-socket.js +0 -3
  177. package/dist/dashboard/template-socket.mjs +0 -3
  178. package/dist/dashboard/template-test-page.js +436 -0
  179. package/dist/dashboard/template-test-page.mjs +407 -0
  180. package/dist/dashboard/template-tests.js +141 -0
  181. package/dist/dashboard/template-tests.mjs +112 -0
  182. package/dist/dashboard/template-ui.js +20 -11
  183. package/dist/dashboard/template-ui.mjs +22 -13
  184. package/dist/dashboard/template-variant.js +185 -0
  185. package/dist/dashboard/template-variant.mjs +156 -0
  186. package/dist/icons/arrow-down-long.js +47 -0
  187. package/dist/icons/arrow-down-long.mjs +28 -0
  188. package/dist/icons/arrows-pointing-out.js +46 -0
  189. package/dist/icons/arrows-pointing-out.mjs +27 -0
  190. package/dist/icons/beaker.js +46 -0
  191. package/dist/icons/beaker.mjs +27 -0
  192. package/dist/icons/identification.js +46 -0
  193. package/dist/icons/identification.mjs +27 -0
  194. package/dist/icons/lifebuoy.js +46 -0
  195. package/dist/icons/lifebuoy.mjs +27 -0
  196. package/dist/icons/rectangle-group.js +46 -0
  197. package/dist/icons/rectangle-group.mjs +27 -0
  198. package/dist/icons/rectangle-stack.js +46 -0
  199. package/dist/icons/rectangle-stack.mjs +27 -0
  200. package/dist/icons/shopping-bag.js +46 -0
  201. package/dist/icons/shopping-bag.mjs +27 -0
  202. package/dist/icons/swatch.js +46 -0
  203. package/dist/icons/swatch.mjs +27 -0
  204. package/dist/icons/window.js +46 -0
  205. package/dist/icons/window.mjs +27 -0
  206. package/dist/icons/zoom-in.js +46 -0
  207. package/dist/icons/zoom-in.mjs +27 -0
  208. package/dist/input-answer.js +60 -0
  209. package/dist/input-answer.mjs +27 -0
  210. package/dist/input-checkbox.js +7 -1
  211. package/dist/input-checkbox.mjs +7 -1
  212. package/dist/input-name.js +3 -3
  213. package/dist/input-name.mjs +3 -3
  214. package/dist/input-select.js +3 -1
  215. package/dist/input-select.mjs +3 -1
  216. package/dist/provider-font.js +4 -3
  217. package/dist/provider-font.mjs +4 -3
  218. package/dist/shared/badge.js +15 -0
  219. package/dist/shared/badge.mjs +11 -0
  220. package/dist/shared/carousel.js +11 -7
  221. package/dist/shared/carousel.mjs +11 -7
  222. package/dist/shared/document-pieces.js +295 -0
  223. package/dist/shared/document-pieces.mjs +260 -0
  224. package/dist/shared/lib/campaign.js +3 -9
  225. package/dist/shared/lib/campaign.mjs +3 -9
  226. package/dist/shared/lib/helpers.js +24 -0
  227. package/dist/shared/lib/helpers.mjs +22 -0
  228. package/dist/shared/lib/video.js +6 -0
  229. package/dist/shared/lib/video.mjs +5 -0
  230. package/dist/shared/sortable.js +27 -10
  231. package/dist/shared/sortable.mjs +27 -10
  232. package/dist/shared/tabs.js +1 -1
  233. package/dist/shared/tabs.mjs +1 -1
  234. package/dist/video.js +127 -9
  235. package/dist/video.mjs +125 -11
  236. package/package.json +176 -20
  237. package/types/bridge/fields.d.ts +6 -1
  238. package/types/bridge/form-subdomain-agreement.d.ts +27 -0
  239. package/types/bridge/form-subdomain-missions.d.ts +2 -0
  240. package/types/bridge/form-subdomain.d.ts +62 -3
  241. package/types/bridge/lib/entry.d.ts +44 -7
  242. package/types/bridge/lib/order.d.ts +13 -2
  243. package/types/bridge/subdomain-content.d.ts +1 -0
  244. package/types/bridge/template-subdomain-gallery.d.ts +13 -1
  245. package/types/dashboard/campaign-form.d.ts +42 -0
  246. package/types/dashboard/card-campaign-agreement.d.ts +26 -0
  247. package/types/dashboard/card-campaign-switch.d.ts +20 -1
  248. package/types/dashboard/card-order.d.ts +2 -2
  249. package/types/dashboard/card-section.d.ts +9 -1
  250. package/types/dashboard/card-shortcut.d.ts +38 -0
  251. package/types/dashboard/card-tile.d.ts +4 -9
  252. package/types/dashboard/document-blocks.d.ts +14 -0
  253. package/types/dashboard/drawer.d.ts +3 -0
  254. package/types/dashboard/form-ai.d.ts +0 -17
  255. package/types/dashboard/form-organization-brand.d.ts +3 -0
  256. package/types/dashboard/form-organization-campaign-advertisements.d.ts +15 -0
  257. package/types/dashboard/form-organization-campaign-agreement.d.ts +53 -10
  258. package/types/dashboard/form-organization-campaign-design.d.ts +46 -0
  259. package/types/dashboard/form-organization-campaign-field-item.d.ts +36 -0
  260. package/types/dashboard/form-organization-campaign-field-number.d.ts +4 -1
  261. package/types/dashboard/form-organization-campaign-field-select.d.ts +6 -1
  262. package/types/dashboard/form-organization-campaign-field-skill.d.ts +36 -0
  263. package/types/dashboard/form-organization-campaign-field-text.d.ts +5 -1
  264. package/types/dashboard/form-organization-campaign-field-textarea.d.ts +4 -1
  265. package/types/dashboard/form-organization-campaign-footer.d.ts +23 -0
  266. package/types/dashboard/form-organization-campaign-integration-age.d.ts +2 -1
  267. package/types/dashboard/form-organization-campaign-integration-geocode.d.ts +2 -0
  268. package/types/dashboard/form-organization-campaign-page.d.ts +9 -15
  269. package/types/dashboard/form-organization-campaign-section.d.ts +24 -8
  270. package/types/dashboard/form-organization-campaign.d.ts +3 -0
  271. package/types/dashboard/form-organization-workflow.d.ts +3 -0
  272. package/types/dashboard/form-organization.d.ts +2 -2
  273. package/types/dashboard/form-reposition.d.ts +29 -0
  274. package/types/dashboard/form-support.d.ts +14 -0
  275. package/types/dashboard/form-tests.d.ts +78 -0
  276. package/types/dashboard/form-verify-prize.d.ts +30 -3
  277. package/types/dashboard/input-editor.d.ts +9 -0
  278. package/types/dashboard/input-fields.d.ts +8 -5
  279. package/types/dashboard/input-file.d.ts +4 -0
  280. package/types/dashboard/input-resource.d.ts +1 -0
  281. package/types/dashboard/lib/ab-tests.d.ts +50 -0
  282. package/types/dashboard/lib/escape.d.ts +4 -0
  283. package/types/dashboard/lib/focus.d.ts +16 -0
  284. package/types/dashboard/lib/form-page.d.ts +25 -0
  285. package/types/dashboard/lib/item-list.d.ts +10 -5
  286. package/types/dashboard/lib/rail.d.ts +0 -1
  287. package/types/dashboard/lib/sms.d.ts +7 -0
  288. package/types/dashboard/modal.d.ts +3 -1
  289. package/types/dashboard/preview.d.ts +65 -10
  290. package/types/dashboard/recharts.d.ts +3 -0
  291. package/types/dashboard/swatch.d.ts +4 -0
  292. package/types/dashboard/template-dashboard.d.ts +3 -0
  293. package/types/dashboard/template-design.d.ts +30 -0
  294. package/types/dashboard/template-test-page.d.ts +69 -0
  295. package/types/dashboard/template-tests.d.ts +30 -0
  296. package/types/dashboard/template-variant.d.ts +18 -0
  297. package/types/icons/arrow-down-long.d.ts +5 -0
  298. package/types/icons/arrows-pointing-out.d.ts +5 -0
  299. package/types/icons/beaker.d.ts +5 -0
  300. package/types/icons/identification.d.ts +5 -0
  301. package/types/icons/lifebuoy.d.ts +5 -0
  302. package/types/icons/rectangle-group.d.ts +5 -0
  303. package/types/icons/rectangle-stack.d.ts +5 -0
  304. package/types/icons/shopping-bag.d.ts +5 -0
  305. package/types/icons/swatch.d.ts +5 -0
  306. package/types/icons/window.d.ts +5 -0
  307. package/types/icons/zoom-in.d.ts +5 -0
  308. package/types/input-answer.d.ts +15 -0
  309. package/types/input-select.d.ts +2 -0
  310. package/types/shared/button.d.ts +1 -1
  311. package/types/shared/document-pieces.d.ts +34 -0
  312. package/types/shared/lib/helpers.d.ts +22 -1
  313. package/types/shared/lib/motion.d.ts +2 -0
  314. package/types/shared/lib/video.d.ts +3 -0
  315. package/types/shared/sortable.d.ts +6 -0
  316. package/types/video.d.ts +18 -2
  317. package/dist/bridge/template-preview.js +0 -208
  318. package/dist/bridge/template-preview.mjs +0 -173
  319. package/dist/dashboard/device.js +0 -95
  320. package/dist/dashboard/device.mjs +0 -72
  321. package/dist/dashboard/form-organization-campaign-field-list.js +0 -425
  322. package/dist/dashboard/form-organization-campaign-field-list.mjs +0 -396
  323. package/dist/dashboard/item-row.js +0 -92
  324. package/dist/dashboard/item-row.mjs +0 -63
  325. package/types/bridge/template-preview.d.ts +0 -10
  326. package/types/dashboard/device.d.ts +0 -12
  327. package/types/dashboard/form-organization-campaign-field-list.d.ts +0 -36
  328. package/types/dashboard/item-row.d.ts +0 -25
@@ -271,6 +271,10 @@ const DrawerSubscriptionSummary = ({
271
271
  const invoice = (data == null ? void 0 : data.invoice) || {};
272
272
  const first = invoice.first || invoice;
273
273
  const renews = Boolean(invoice.first) && invoice.first.total !== invoice.total;
274
+ const money = (cents) => "$" + (0, import_drawbridge_utils.formatNumber)((cents || 0) / 100, 2);
275
+ const per = (plan == null ? void 0 : plan.interval) || "month";
276
+ const fee = first.setup > 0;
277
+ const group = "space-y-1.5 mt-3 pt-3 border-t border-gray";
274
278
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
275
279
  "div",
276
280
  {
@@ -286,29 +290,63 @@ const DrawerSubscriptionSummary = ({
286
290
  className: "space-y-1.5"
287
291
  },
288
292
  children: [
289
- (plan == null ? void 0 : plan.title) && renderLine(
290
- "Plan",
291
- plan.title
292
- ),
293
+ (plan == null ? void 0 : plan.title) && (fee && Number.isFinite(plan == null ? void 0 : plan.price) ? renderLine(plan.title + ", per " + per, money(plan.price)) : renderLine("Plan", plan.title)),
294
+ fee && renderLine(
295
+ "Setup fee, one time",
296
+ money(first.setup)
297
+ )
298
+ ]
299
+ }
300
+ ),
301
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
302
+ "div",
303
+ {
304
+ ...{
305
+ className: group
306
+ },
307
+ children: [
293
308
  renderLine(
294
309
  "Subtotal",
295
- "$" + (0, import_drawbridge_utils.formatNumber)((first.subtotal || 0) / 100, 2)
310
+ money(first.subtotal)
296
311
  ),
297
312
  first.discount > 0 && renderLine(
298
313
  "Discount",
299
- "-$" + (0, import_drawbridge_utils.formatNumber)(first.discount / 100, 2)
314
+ "-" + money(first.discount)
300
315
  ),
301
316
  renderLine(
302
317
  "Tax",
303
- "$" + (0, import_drawbridge_utils.formatNumber)((first.tax || 0) / 100, 2)
304
- ),
305
- renderLine(
306
- "Total",
307
- "$" + (0, import_drawbridge_utils.formatNumber)((first.total || 0) / 100, 2)
318
+ money(first.tax)
319
+ )
320
+ ]
321
+ }
322
+ ),
323
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
324
+ "div",
325
+ {
326
+ ...{
327
+ className: group
328
+ },
329
+ children: [
330
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
331
+ "div",
332
+ {
333
+ ...{
334
+ className: "flex items-center justify-between font-medium"
335
+ },
336
+ children: [
337
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Total" }),
338
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: money(first.total) })
339
+ ]
340
+ }
308
341
  ),
309
- renews && renderLine(
310
- "Renews at",
311
- "$" + (0, import_drawbridge_utils.formatNumber)((invoice.total || 0) / 100, 2)
342
+ renews && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
343
+ "p",
344
+ {
345
+ ...{
346
+ className: "text-sm text-gray-dark"
347
+ },
348
+ children: "Then " + money(invoice.total) + " per " + per + ", tax included."
349
+ }
312
350
  )
313
351
  ]
314
352
  }
@@ -239,6 +239,10 @@ const DrawerSubscriptionSummary = ({
239
239
  const invoice = (data == null ? void 0 : data.invoice) || {};
240
240
  const first = invoice.first || invoice;
241
241
  const renews = Boolean(invoice.first) && invoice.first.total !== invoice.total;
242
+ const money = (cents) => "$" + formatNumber((cents || 0) / 100, 2);
243
+ const per = (plan == null ? void 0 : plan.interval) || "month";
244
+ const fee = first.setup > 0;
245
+ const group = "space-y-1.5 mt-3 pt-3 border-t border-gray";
242
246
  return /* @__PURE__ */ jsxs(
243
247
  "div",
244
248
  {
@@ -254,29 +258,63 @@ const DrawerSubscriptionSummary = ({
254
258
  className: "space-y-1.5"
255
259
  },
256
260
  children: [
257
- (plan == null ? void 0 : plan.title) && renderLine(
258
- "Plan",
259
- plan.title
260
- ),
261
+ (plan == null ? void 0 : plan.title) && (fee && Number.isFinite(plan == null ? void 0 : plan.price) ? renderLine(plan.title + ", per " + per, money(plan.price)) : renderLine("Plan", plan.title)),
262
+ fee && renderLine(
263
+ "Setup fee, one time",
264
+ money(first.setup)
265
+ )
266
+ ]
267
+ }
268
+ ),
269
+ /* @__PURE__ */ jsxs(
270
+ "div",
271
+ {
272
+ ...{
273
+ className: group
274
+ },
275
+ children: [
261
276
  renderLine(
262
277
  "Subtotal",
263
- "$" + formatNumber((first.subtotal || 0) / 100, 2)
278
+ money(first.subtotal)
264
279
  ),
265
280
  first.discount > 0 && renderLine(
266
281
  "Discount",
267
- "-$" + formatNumber(first.discount / 100, 2)
282
+ "-" + money(first.discount)
268
283
  ),
269
284
  renderLine(
270
285
  "Tax",
271
- "$" + formatNumber((first.tax || 0) / 100, 2)
272
- ),
273
- renderLine(
274
- "Total",
275
- "$" + formatNumber((first.total || 0) / 100, 2)
286
+ money(first.tax)
287
+ )
288
+ ]
289
+ }
290
+ ),
291
+ /* @__PURE__ */ jsxs(
292
+ "div",
293
+ {
294
+ ...{
295
+ className: group
296
+ },
297
+ children: [
298
+ /* @__PURE__ */ jsxs(
299
+ "div",
300
+ {
301
+ ...{
302
+ className: "flex items-center justify-between font-medium"
303
+ },
304
+ children: [
305
+ /* @__PURE__ */ jsx("p", { children: "Total" }),
306
+ /* @__PURE__ */ jsx("p", { children: money(first.total) })
307
+ ]
308
+ }
276
309
  ),
277
- renews && renderLine(
278
- "Renews at",
279
- "$" + formatNumber((invoice.total || 0) / 100, 2)
310
+ renews && /* @__PURE__ */ jsx(
311
+ "p",
312
+ {
313
+ ...{
314
+ className: "text-sm text-gray-dark"
315
+ },
316
+ children: "Then " + money(invoice.total) + " per " + per + ", tax included."
317
+ }
280
318
  )
281
319
  ]
282
320
  }
@@ -34,6 +34,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
34
34
  var import_react = require("react");
35
35
  var import_react2 = require("@headlessui/react");
36
36
  var import_escape = require("./lib/escape");
37
+ var import_focus = require("./lib/focus");
37
38
  var import_motion = require("../shared/lib/motion");
38
39
  var import_times = __toESM(require("../icons/times"));
39
40
  var import_button = __toESM(require("../shared/button"));
@@ -49,11 +50,14 @@ const Drawer = ({
49
50
  title
50
51
  }) => {
51
52
  const close = (0, import_react.useRef)(null);
53
+ const heading = (0, import_react.useId)();
54
+ const [panel, setPanel] = (0, import_react.useState)(null);
52
55
  (0, import_escape.useEscape)(active, close);
56
+ (0, import_focus.useTrap)(Boolean(active) && overlay, panel);
53
57
  const classes = {
54
58
  drawer: [
55
59
  className,
56
- "block fixed top-0 right-0 w-full h-full bg-white overflow-y-scroll",
60
+ "block fixed top-0 right-0 w-full h-full bg-white overflow-y-scroll outline-none",
57
61
  "md:w-1/2 lg:w-1/3",
58
62
  // Enter slides in immediately (no delay): the panel used to wait
59
63
  // 300ms at translate-x-full, so a reopen before the previous leave
@@ -86,9 +90,14 @@ const Drawer = ({
86
90
  import_react2.Transition,
87
91
  {
88
92
  ...{
93
+ "aria-labelledby": heading,
94
+ "aria-modal": overlay,
89
95
  as: "div",
90
96
  className: classes.drawer.join(" "),
91
- show: Boolean(active)
97
+ ref: setPanel,
98
+ role: "dialog",
99
+ show: Boolean(active),
100
+ tabIndex: -1
92
101
  },
93
102
  children: [
94
103
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
@@ -98,7 +107,15 @@ const Drawer = ({
98
107
  className: classes.header.join(" ")
99
108
  },
100
109
  children: [
101
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: title }),
110
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
111
+ "div",
112
+ {
113
+ ...{
114
+ id: heading
115
+ },
116
+ children: title
117
+ }
118
+ ),
102
119
  onClose instanceof Function && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
103
120
  import_button.default,
104
121
  {
@@ -1,7 +1,8 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Fragment, useRef } from "react";
2
+ import { Fragment, useId, useRef, useState } from "react";
3
3
  import { Transition } from "@headlessui/react";
4
4
  import { useEscape } from "./lib/escape.mjs";
5
+ import { useTrap } from "./lib/focus.mjs";
5
6
  import { motion } from "../shared/lib/motion.mjs";
6
7
  import Times from "../icons/times.mjs";
7
8
  import Button from "../shared/button.mjs";
@@ -17,11 +18,14 @@ const Drawer = ({
17
18
  title
18
19
  }) => {
19
20
  const close = useRef(null);
21
+ const heading = useId();
22
+ const [panel, setPanel] = useState(null);
20
23
  useEscape(active, close);
24
+ useTrap(Boolean(active) && overlay, panel);
21
25
  const classes = {
22
26
  drawer: [
23
27
  className,
24
- "block fixed top-0 right-0 w-full h-full bg-white overflow-y-scroll",
28
+ "block fixed top-0 right-0 w-full h-full bg-white overflow-y-scroll outline-none",
25
29
  "md:w-1/2 lg:w-1/3",
26
30
  // Enter slides in immediately (no delay): the panel used to wait
27
31
  // 300ms at translate-x-full, so a reopen before the previous leave
@@ -54,9 +58,14 @@ const Drawer = ({
54
58
  Transition,
55
59
  {
56
60
  ...{
61
+ "aria-labelledby": heading,
62
+ "aria-modal": overlay,
57
63
  as: "div",
58
64
  className: classes.drawer.join(" "),
59
- show: Boolean(active)
65
+ ref: setPanel,
66
+ role: "dialog",
67
+ show: Boolean(active),
68
+ tabIndex: -1
60
69
  },
61
70
  children: [
62
71
  /* @__PURE__ */ jsxs(
@@ -66,7 +75,15 @@ const Drawer = ({
66
75
  className: classes.header.join(" ")
67
76
  },
68
77
  children: [
69
- /* @__PURE__ */ jsx("div", { children: title }),
78
+ /* @__PURE__ */ jsx(
79
+ "div",
80
+ {
81
+ ...{
82
+ id: heading
83
+ },
84
+ children: title
85
+ }
86
+ ),
70
87
  onClose instanceof Function && /* @__PURE__ */ jsx(
71
88
  Button,
72
89
  {
@@ -45,6 +45,7 @@ const Dropdown = ({
45
45
  className = "flex",
46
46
  classNameMenu = "w-32",
47
47
  items = [],
48
+ onKeyDownMenu,
48
49
  ...rest
49
50
  }) => {
50
51
  const classes = {
@@ -53,7 +54,8 @@ const Dropdown = ({
53
54
  classNameMenu
54
55
  ],
55
56
  menuItem: [
56
- "w-full flex items-center justify-between py-2 px-4 text-sm text-left"
57
+ // 44 px tall on a phone, a finger's size; 36 px on a desktop.
58
+ "w-full flex items-center justify-between py-3 md:py-2 px-4 text-sm text-left"
57
59
  ]
58
60
  };
59
61
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -86,7 +88,8 @@ const Dropdown = ({
86
88
  {
87
89
  ...{
88
90
  anchor,
89
- className: classes.menu.join(" ")
91
+ className: classes.menu.join(" "),
92
+ onKeyDown: onKeyDownMenu
90
93
  },
91
94
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
92
95
  "div",
@@ -133,6 +136,7 @@ const Dropdown = ({
133
136
  IconComponent,
134
137
  {
135
138
  ...{
139
+ "aria-hidden": true,
136
140
  className: "w-4 h-4 " + (iconClassName && iconClassName)
137
141
  }
138
142
  }
@@ -13,6 +13,7 @@ const Dropdown = ({
13
13
  className = "flex",
14
14
  classNameMenu = "w-32",
15
15
  items = [],
16
+ onKeyDownMenu,
16
17
  ...rest
17
18
  }) => {
18
19
  const classes = {
@@ -21,7 +22,8 @@ const Dropdown = ({
21
22
  classNameMenu
22
23
  ],
23
24
  menuItem: [
24
- "w-full flex items-center justify-between py-2 px-4 text-sm text-left"
25
+ // 44 px tall on a phone, a finger's size; 36 px on a desktop.
26
+ "w-full flex items-center justify-between py-3 md:py-2 px-4 text-sm text-left"
25
27
  ]
26
28
  };
27
29
  return /* @__PURE__ */ jsx(
@@ -54,7 +56,8 @@ const Dropdown = ({
54
56
  {
55
57
  ...{
56
58
  anchor,
57
- className: classes.menu.join(" ")
59
+ className: classes.menu.join(" "),
60
+ onKeyDown: onKeyDownMenu
58
61
  },
59
62
  children: /* @__PURE__ */ jsx(
60
63
  "div",
@@ -101,6 +104,7 @@ const Dropdown = ({
101
104
  IconComponent,
102
105
  {
103
106
  ...{
107
+ "aria-hidden": true,
104
108
  className: "w-4 h-4 " + (iconClassName && iconClassName)
105
109
  }
106
110
  }
@@ -31,6 +31,7 @@ __export(form_admin_subscription_custom_exports, {
31
31
  });
32
32
  module.exports = __toCommonJS(form_admin_subscription_custom_exports);
33
33
  var import_jsx_runtime = require("react/jsx-runtime");
34
+ var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
34
35
  var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
35
36
  var import_form = require("../shared/lib/form");
36
37
  var import_yup = __toESM(require("../shared/lib/yup"));
@@ -38,6 +39,7 @@ var import_form2 = __toESM(require("../shared/form"));
38
39
  var import_fieldset = __toESM(require("../shared/fieldset"));
39
40
  var import_input_group = __toESM(require("../input-group"));
40
41
  var import_input_number = __toESM(require("../input-number"));
42
+ var import_input_select = __toESM(require("../input-select"));
41
43
  var import_input_text = __toESM(require("../input-text"));
42
44
  var import_input_switch = __toESM(require("../shared/input-switch"));
43
45
  var import_features = require("./lib/features");
@@ -45,14 +47,26 @@ var import_overage = require("./lib/overage");
45
47
  var import_button = __toESM(require("../shared/button"));
46
48
  const gigabyte = 1024 * 1024 * 1024;
47
49
  const blank = (value, original) => original === "" || original === null || original === void 0 ? null : value;
50
+ const cents = (value) => value == null || Math.abs(value * 100 - Math.round(value * 100)) < 1e-6;
51
+ const day = (date) => (0, import_drawbridge_utils.formatDateString)({
52
+ date,
53
+ options: {
54
+ day: "numeric",
55
+ month: "short",
56
+ year: "numeric"
57
+ }
58
+ });
59
+ const monthsLabel = (months) => months + (months === 1 ? " month" : " months");
48
60
  const FormAdminSubscriptionCustom = ({
49
61
  onSuccess,
50
62
  onError,
51
63
  values
52
64
  }) => {
53
- var _a, _b, _c, _d, _e, _f, _g, _h;
65
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
54
66
  const custom = (values == null ? void 0 : values.custom) || {};
55
- const { control, handleSubmit, formState } = (0, import_form.useForm)({
67
+ const active = (values == null ? void 0 : values.status) === "active";
68
+ const locked = active || Boolean((_a = custom == null ? void 0 : custom.setup) == null ? void 0 : _a.billedAt);
69
+ const { control, handleSubmit, formState, watch } = (0, import_form.useForm)({
56
70
  resolver: (0, import_yup.resolver)(
57
71
  // Required here mirrors the API's availability gate. A custom plan is
58
72
  // self-describing, so an unset term resolves to NOTHING rather than to
@@ -71,6 +85,15 @@ const FormAdminSubscriptionCustom = ({
71
85
  conversion: import_yup.default.number().transform(blank).nullable().label("Conversion rate").min(0).max(100).required(),
72
86
  members: import_yup.default.number().transform(blank).nullable().label("Members").min(0),
73
87
  storage: import_yup.default.number().transform(blank).nullable().label("Storage").min(0),
88
+ setup: import_yup.default.number().transform(blank).nullable().label("Setup fee").min(0).test("cents", "Setup fee must be dollars and cents", cents),
89
+ support: import_yup.default.boolean().label("Support"),
90
+ lasts: import_yup.default.string().oneOf(["forever", "months"]).label("Support lasts"),
91
+ // Asked for only when support is on and lasts a number of months.
92
+ // Checked only while shown, so a hidden value never blocks Submit.
93
+ months: import_yup.default.number().transform(blank).nullable().label("Months").when(["support", "lasts"], {
94
+ is: (support, lasts) => support && lasts === "months",
95
+ then: (schema) => schema.integer().min(1).max(120).required()
96
+ }),
74
97
  overages: import_yup.default.number().transform(blank).nullable().label("Actions overage").min(0).required(),
75
98
  available: import_yup.default.boolean().label("Available"),
76
99
  features: import_yup.default.array().of(import_yup.default.string()).label("Features"),
@@ -78,20 +101,24 @@ const FormAdminSubscriptionCustom = ({
78
101
  })
79
102
  ),
80
103
  values: {
81
- actions: ((_b = (_a = custom == null ? void 0 : custom.limits) == null ? void 0 : _a.organization) == null ? void 0 : _b.actions) ?? "",
104
+ actions: ((_c = (_b = custom == null ? void 0 : custom.limits) == null ? void 0 : _b.organization) == null ? void 0 : _c.actions) ?? "",
82
105
  available: Boolean(custom == null ? void 0 : custom.available),
83
- features: ((_c = custom == null ? void 0 : custom.features) == null ? void 0 : _c.granted) || [],
84
- amount: Number.isFinite((_d = custom == null ? void 0 : custom.data) == null ? void 0 : _d.amount) ? custom.data.amount / 100 : "",
106
+ features: ((_d = custom == null ? void 0 : custom.features) == null ? void 0 : _d.granted) || [],
107
+ amount: Number.isFinite((_e = custom == null ? void 0 : custom.data) == null ? void 0 : _e.amount) ? custom.data.amount / 100 : "",
85
108
  conversion: (custom == null ? void 0 : custom.conversion) ?? "",
86
- members: ((_f = (_e = custom == null ? void 0 : custom.limits) == null ? void 0 : _e.organization) == null ? void 0 : _f.members) ?? "",
87
- storage: Number.isFinite((_h = (_g = custom == null ? void 0 : custom.limits) == null ? void 0 : _g.organization) == null ? void 0 : _h.storage) ? custom.limits.organization.storage / gigabyte : "",
109
+ members: ((_g = (_f = custom == null ? void 0 : custom.limits) == null ? void 0 : _f.organization) == null ? void 0 : _g.members) ?? "",
110
+ setup: Number.isFinite((_h = custom == null ? void 0 : custom.setup) == null ? void 0 : _h.amount) ? custom.setup.amount / 100 : "",
111
+ support: ((_i = custom == null ? void 0 : custom.support) == null ? void 0 : _i.enabled) === true,
112
+ lasts: ((_j = custom == null ? void 0 : custom.support) == null ? void 0 : _j.months) ? "months" : "forever",
113
+ months: ((_k = custom == null ? void 0 : custom.support) == null ? void 0 : _k.months) ?? "",
114
+ storage: Number.isFinite((_m = (_l = custom == null ? void 0 : custom.limits) == null ? void 0 : _l.organization) == null ? void 0 : _m.storage) ? custom.limits.organization.storage / gigabyte : "",
88
115
  // Stored as CENTS per action; edited in dollars, like `amount`. The
89
116
  // conversion pair lives in lib/overage.js with the float-dust rounding.
90
117
  overages: (0, import_overage.overageToForm)(custom == null ? void 0 : custom.overages),
91
118
  title: (custom == null ? void 0 : custom.title) ?? ""
92
119
  }
93
120
  });
94
- const onSubmit = async ({ actions, available, amount, conversion, features, members, overages, storage, title }) => {
121
+ const onSubmit = async ({ actions, available, amount, conversion, features, lasts, members, months, overages, setup, storage, support, title }) => {
95
122
  try {
96
123
  const response = await (0, import_fetch.request)({
97
124
  body: {
@@ -103,6 +130,13 @@ const FormAdminSubscriptionCustom = ({
103
130
  ...Number.isFinite(amount) && { data: { amount: Math.round(amount * 100) } },
104
131
  ...Number.isFinite(conversion) && { conversion },
105
132
  ...Number.isFinite(overages) && { overages: (0, import_overage.overageFromForm)(overages) },
133
+ // Whole cents, converted here as the price is. Empty or 0 is no fee.
134
+ ...Number.isFinite(setup) && setup > 0 && { setup: { amount: Math.round(setup * 100) } },
135
+ // Off keeps the stored months and date; forever sends no months.
136
+ support: {
137
+ enabled: Boolean(support),
138
+ ...support && lasts === "months" && Number.isFinite(months) && { months }
139
+ },
106
140
  limits: {
107
141
  organization: {
108
142
  ...Number.isFinite(actions) && { actions },
@@ -169,6 +203,15 @@ const FormAdminSubscriptionCustom = ({
169
203
  (value) => Number.isFinite(value) ? "Sent as " + Math.round(value * 100).toLocaleString("en-US") + " cents. Applies immediately only if this is the plan they are billing on." : "The organization is billed this each period.",
170
204
  ({ onChange, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_number.default, { ...{ min: 1, onChange, placeholder: "2499.00", step: 0.01, type: "number", value: value ?? "" } })
171
205
  ),
206
+ field(
207
+ "setup",
208
+ "Setup fee ($)",
209
+ (value) => {
210
+ var _a2;
211
+ return locked ? ((_a2 = custom == null ? void 0 : custom.setup) == null ? void 0 : _a2.billedAt) ? "Billed on " + day(custom.setup.billedAt) + "." : "They are on this plan, so a fee can no longer be added." : value > 0 ? "Sent as " + Math.round(value * 100).toLocaleString("en-US") + " cents. Billed once, on their first invoice." : "Billed once, on their first invoice. Leave empty for no fee.";
212
+ },
213
+ ({ onChange, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_number.default, { ...{ disabled: locked, min: 0, onChange, placeholder: locked ? "None" : "2500.00", step: 0.01, type: "number", value: value ?? "" } })
214
+ ),
172
215
  field(
173
216
  "actions",
174
217
  "Actions included",
@@ -251,6 +294,27 @@ const FormAdminSubscriptionCustom = ({
251
294
  }
252
295
  }
253
296
  ),
297
+ field(
298
+ "support",
299
+ "Support",
300
+ "On: members see a Support button in their dashboard and can send us a message.",
301
+ ({ onChange, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_switch.default, { ...{ onChange, value: value || false } })
302
+ ),
303
+ watch("support") && field(
304
+ "lasts",
305
+ "Support lasts",
306
+ (value) => value === "months" ? null : "For as long as they are on this plan.",
307
+ ({ onChange, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_select.default, { ...{ onChange, options: [{ label: "Forever", value: "forever" }, { label: "A number of months", value: "months" }], value: value || "forever" } })
308
+ ),
309
+ watch("support") && watch("lasts") === "months" && field(
310
+ "months",
311
+ "Months",
312
+ (value) => {
313
+ var _a2, _b2;
314
+ return !Number.isFinite(value) ? "Counted from the day they start this plan." : value === ((_a2 = custom == null ? void 0 : custom.support) == null ? void 0 : _a2.months) && ((_b2 = custom == null ? void 0 : custom.support) == null ? void 0 : _b2.until) ? (new Date(custom.support.until) < /* @__PURE__ */ new Date() ? "Support ended " : "Support ends ") + day(custom.support.until) + "." : (custom == null ? void 0 : custom.startedAt) ? "Support ends " + monthsLabel(value) + " after the day they started this plan." : "Support ends " + monthsLabel(value) + " after they start this plan.";
315
+ },
316
+ ({ onChange, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_number.default, { ...{ max: 120, min: 1, onChange, placeholder: "6", step: 1, type: "number", value: value ?? "" } })
317
+ ),
254
318
  field(
255
319
  "available",
256
320
  "Available to the organization",