@drawbridge/components 0.1.34 → 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 +587 -530
  111. package/dist/dashboard/form-organization-workflow.mjs +588 -531
  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
@@ -41,7 +41,7 @@ const FormOrganizationCampaignPageQRCustomize = ({
41
41
  body: {
42
42
  colors
43
43
  },
44
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.campaign) + "/page/" + (values == null ? void 0 : values.id) + "/qr/customize",
44
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.id) + "/qr/customize",
45
45
  method: "PUT"
46
46
  });
47
47
  onSuccess(response);
@@ -159,7 +159,7 @@ const FormOrganizationCampaignFormQRButton = ({
159
159
  title,
160
160
  values
161
161
  }) => {
162
- const endpoint = "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.campaign) + "/page/" + (values == null ? void 0 : values.id) + "/qr";
162
+ const endpoint = "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.id) + "/qr";
163
163
  const [loading, setLoading] = useState(false);
164
164
  const onGenerate = async () => {
165
165
  setLoading(true);
@@ -202,8 +202,8 @@ const FormOrganizationCampaignPageShare = ({
202
202
  value: (_g = values == null ? void 0 : values.share) == null ? void 0 : _g.url
203
203
  },
204
204
  children: inner({
205
- title: "Page url",
206
- description: "The default url for your page"
205
+ title: "Campaign url",
206
+ description: "The default url for your campaign"
207
207
  })
208
208
  }
209
209
  )
@@ -291,7 +291,7 @@ const FormOrganizationCampaignPageShare = ({
291
291
  },
292
292
  children: inner({
293
293
  title: "Share short link",
294
- description: "For when characters count \u2014 redirects to page url"
294
+ description: "For when characters count \u2014 redirects to campaign url"
295
295
  })
296
296
  }
297
297
  )
@@ -381,7 +381,7 @@ const FormOrganizationCampaignPageShare = ({
381
381
  },
382
382
  children: inner({
383
383
  title: "QR Codes",
384
- description: "Downloadable codes that link to your page"
384
+ description: "Downloadable codes that link to your campaign"
385
385
  })
386
386
  }
387
387
  )
@@ -458,7 +458,7 @@ const FormOrganizationCampaignPageShare = ({
458
458
  ...{
459
459
  className: "text-sm"
460
460
  },
461
- children: "Customize page url"
461
+ children: "Customize campaign url"
462
462
  }
463
463
  )
464
464
  }
@@ -170,8 +170,8 @@ const FormOrganizationCampaignPageShare = ({
170
170
  value: (_g = values == null ? void 0 : values.share) == null ? void 0 : _g.url
171
171
  },
172
172
  children: inner({
173
- title: "Page url",
174
- description: "The default url for your page"
173
+ title: "Campaign url",
174
+ description: "The default url for your campaign"
175
175
  })
176
176
  }
177
177
  )
@@ -259,7 +259,7 @@ const FormOrganizationCampaignPageShare = ({
259
259
  },
260
260
  children: inner({
261
261
  title: "Share short link",
262
- description: "For when characters count \u2014 redirects to page url"
262
+ description: "For when characters count \u2014 redirects to campaign url"
263
263
  })
264
264
  }
265
265
  )
@@ -349,7 +349,7 @@ const FormOrganizationCampaignPageShare = ({
349
349
  },
350
350
  children: inner({
351
351
  title: "QR Codes",
352
- description: "Downloadable codes that link to your page"
352
+ description: "Downloadable codes that link to your campaign"
353
353
  })
354
354
  }
355
355
  )
@@ -426,7 +426,7 @@ const FormOrganizationCampaignPageShare = ({
426
426
  ...{
427
427
  className: "text-sm"
428
428
  },
429
- children: "Customize page url"
429
+ children: "Customize campaign url"
430
430
  }
431
431
  )
432
432
  }
@@ -62,10 +62,9 @@ const FormOrganizationCampaignPageSlug = ({
62
62
  try {
63
63
  const args = {
64
64
  body: {
65
- ...values,
66
65
  slug
67
66
  },
68
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.campaign) + "/page/" + (values == null ? void 0 : values.id) + "/slug",
67
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.id) + "/slug",
69
68
  method: "PUT"
70
69
  };
71
70
  const response = await (0, import_fetch.request)(args);
@@ -155,7 +154,7 @@ const FormOrganizationCampaignPageSlug = ({
155
154
  text: "Revert",
156
155
  type: "button"
157
156
  },
158
- message: "Your default page url will still work: " + ((_a = values == null ? void 0 : values.share) == null ? void 0 : _a.url.replace(values == null ? void 0 : values.slug, "")) + (values == null ? void 0 : values.shortId)
157
+ message: "Your default campaign url will still work: " + ((_a = values == null ? void 0 : values.share) == null ? void 0 : _a.url.replace(values == null ? void 0 : values.slug, "")) + (values == null ? void 0 : values.shortId)
159
158
  }
160
159
  }
161
160
  )
@@ -30,10 +30,9 @@ const FormOrganizationCampaignPageSlug = ({
30
30
  try {
31
31
  const args = {
32
32
  body: {
33
- ...values,
34
33
  slug
35
34
  },
36
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.campaign) + "/page/" + (values == null ? void 0 : values.id) + "/slug",
35
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.id) + "/slug",
37
36
  method: "PUT"
38
37
  };
39
38
  const response = await request(args);
@@ -123,7 +122,7 @@ const FormOrganizationCampaignPageSlug = ({
123
122
  text: "Revert",
124
123
  type: "button"
125
124
  },
126
- message: "Your default page url will still work: " + ((_a = values == null ? void 0 : values.share) == null ? void 0 : _a.url.replace(values == null ? void 0 : values.slug, "")) + (values == null ? void 0 : values.shortId)
125
+ message: "Your default campaign url will still work: " + ((_a = values == null ? void 0 : values.share) == null ? void 0 : _a.url.replace(values == null ? void 0 : values.slug, "")) + (values == null ? void 0 : values.shortId)
127
126
  }
128
127
  }
129
128
  )
@@ -27,7 +27,6 @@ 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_campaign_page_exports = {};
29
29
  __export(form_organization_campaign_page_exports, {
30
- FormOrganizationCampaignPage: () => FormOrganizationCampaignPage,
31
30
  FormOrganizationCampaignPageEdit: () => FormOrganizationCampaignPageEdit
32
31
  });
33
32
  module.exports = __toCommonJS(form_organization_campaign_page_exports);
@@ -37,201 +36,92 @@ var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
37
36
  var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
38
37
  var import_yup = __toESM(require("../shared/lib/yup"));
39
38
  var import_form = require("../shared/lib/form");
40
- var import_react_query = require("@tanstack/react-query");
41
39
  var import_form2 = __toESM(require("../shared/form"));
42
40
  var import_fieldset = __toESM(require("../shared/fieldset"));
43
41
  var import_input_group = __toESM(require("../input-group"));
44
- var import_input_switch = __toESM(require("../shared/input-switch"));
45
- var import_input_resource = __toESM(require("./input-resource"));
42
+ var import_input_text = __toESM(require("../input-text"));
46
43
  var import_button = __toESM(require("../shared/button"));
47
- var import_accordion = __toESM(require("./accordion"));
44
+ var import_tabs = __toESM(require("../shared/tabs"));
48
45
  var import_input_fields = require("./input-fields");
49
- const props = {
50
- classNamePanel: "mt-6"
51
- };
52
- const FormOrganizationCampaignPage = ({
53
- canManageBrands,
54
- onError,
55
- onSuccess,
56
- values
57
- }) => {
58
- const methods = (0, import_form.useForm)({
59
- resolver: (0, import_yup.resolver)(
60
- import_yup.default.object({
61
- ...import_input_fields.schemas.page(),
62
- brand: import_yup.default.object().label("Brand").nullable()
63
- })
64
- ),
65
- values
66
- });
67
- const { control, formState, handleSubmit } = methods;
68
- const onSubmit = async ({
69
- brand,
70
- title
71
- }) => {
72
- try {
73
- const args = {
74
- // Send `brand` only when the selector was shown: an explicit value
75
- // (id or null) changes the server's inheritance, and a hidden
76
- // selector must leave the legacy behavior untouched.
77
- body: {
78
- ...canManageBrands && { brand: (brand == null ? void 0 : brand.id) ?? null },
79
- title
80
- },
81
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.campaign) + "/page",
82
- method: "POST"
83
- };
84
- const response = await (0, import_fetch.request)(args);
85
- onSuccess(response);
86
- } catch (error) {
87
- onError(error);
88
- }
89
- };
90
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormProvider, { ...methods, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
91
- import_form2.default,
92
- {
93
- ...{
94
- className: "relative w-full space-y-6",
95
- onSubmit: handleSubmit(onSubmit)
96
- },
97
- children: [
98
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
99
- import_fieldset.default,
100
- {
101
- ...{
102
- disabled: formState == null ? void 0 : formState.isSubmitting
103
- },
104
- children: [
105
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_fields.InputFieldsPage, {}),
106
- canManageBrands && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
107
- import_form.Controller,
108
- {
109
- ...{
110
- control,
111
- name: "brand",
112
- render: ({ field: { value, onChange } }) => {
113
- var _a, _b;
114
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
115
- import_input_group.default,
116
- {
117
- ...{
118
- error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.brand) == null ? void 0 : _b.message,
119
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
120
- import_input_resource.default,
121
- {
122
- ...{
123
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/brands",
124
- model: "brand",
125
- onChange,
126
- value
127
- }
128
- }
129
- ),
130
- label: "Brand"
131
- }
132
- }
133
- );
134
- }
135
- }
136
- }
137
- )
138
- ]
139
- }
140
- ),
141
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
142
- import_fieldset.default,
143
- {
144
- ...{
145
- disabled: formState == null ? void 0 : formState.isSubmitting
146
- },
147
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
148
- import_button.default,
149
- {
150
- ...{
151
- loading: formState == null ? void 0 : formState.isSubmitting,
152
- type: "submit"
153
- },
154
- children: "Submit"
155
- }
156
- )
157
- }
158
- )
159
- ]
160
- }
161
- ) });
162
- };
46
+ var import_form_organization_campaign_design = require("./form-organization-campaign-design");
47
+ var import_helpers = require("../shared/lib/helpers");
48
+ const DESIGN = ["descriptions", "images", "style"];
163
49
  const FormOrganizationCampaignPageEdit = ({
164
50
  disabled,
165
51
  onError,
166
52
  onSuccess,
167
53
  onUpdate,
168
54
  organization,
55
+ tabs,
169
56
  values = {}
170
57
  }) => {
171
- var _a, _b, _c, _d, _e, _f;
172
- const queryClient = (0, import_react_query.useQueryClient)();
173
- const app = queryClient.getQueryData(["app"]);
174
- const [open, setOpen] = (0, import_react.useState)("Details");
175
- const section = (title) => ({
176
- active: open === title,
177
- onClick: () => setOpen(title),
178
- title
179
- });
58
+ var _a;
59
+ const [tab, setTab] = (0, import_react.useState)(0);
60
+ const formId = (0, import_react.useId)();
61
+ const variant = typeof (values == null ? void 0 : values.title) === "string";
180
62
  const methods = (0, import_form.useForm)({
181
63
  resolver: (0, import_yup.resolver)(
182
64
  import_yup.default.object({
183
- ...import_input_fields.schemas.style(),
184
- ...import_input_fields.schemas.page(),
185
65
  description: import_yup.default.string().label("Description").nullable().max(300),
66
+ // @story pages/reposition
67
+ // Each item { file, description, position }.
186
68
  gallery: import_yup.default.array().label("Gallery").of(
187
- import_yup.default.mixed().file().label("File").required().nullable()
69
+ import_yup.default.object({
70
+ description: import_yup.default.string().label("Description").nullable().max(150),
71
+ file: import_yup.default.mixed().file().label("File").required().nullable(),
72
+ position: import_yup.default.object().nullable()
73
+ })
188
74
  ),
189
75
  headline: import_yup.default.string().label("Headline").required().max(150),
190
- images: import_yup.default.object({
191
- logo: import_yup.default.mixed().file().nullable(),
192
- preview: import_yup.default.mixed().file().nullable()
193
- }),
194
- slug: import_yup.default.string().label("Slug").required().min(5).max(15),
195
- status: import_yup.default.string().label("Status").required().oneOf(app.enums.page.status.enum)
76
+ ...tabs && {
77
+ ...import_input_fields.schemas.images(),
78
+ ...import_input_fields.schemas.style()
79
+ },
80
+ // @story ab-tests/variants
81
+ // A variant's Title renames it in its test; a page has none of its own.
82
+ ...variant && {
83
+ title: import_yup.default.string().label("Title").required().max(150)
84
+ }
196
85
  })
197
86
  ),
198
87
  values: {
199
88
  ...values,
89
+ gallery: (0, import_helpers.galleryItems)(values == null ? void 0 : values.gallery, (_a = values == null ? void 0 : values.descriptions) == null ? void 0 : _a.gallery),
200
90
  headline: (values == null ? void 0 : values.headline) === import_drawbridge_utils.constants.page.headline ? "" : (values == null ? void 0 : values.headline) ?? ""
201
91
  }
202
92
  });
203
93
  const { control, handleSubmit, formState, getValues, reset } = methods;
204
- const onSubmit = async ({
205
- description,
206
- descriptions,
207
- gallery,
208
- headline,
209
- images: {
210
- logo,
211
- preview
212
- },
213
- links,
214
- status,
215
- style,
216
- title
217
- }) => {
94
+ const onSubmit = async (form) => {
95
+ const {
96
+ description,
97
+ gallery,
98
+ headline,
99
+ links,
100
+ title
101
+ } = form;
218
102
  try {
103
+ const own = tabs ? (0, import_form_organization_campaign_design.designBody)(form) : null;
219
104
  const args = {
220
105
  body: {
221
106
  description,
222
- // @story pages/build
223
- // Each image's own Description, saved with the rest of the page.
224
- descriptions: descriptions || {},
225
107
  headline,
226
- gallery: gallery.map(({ id }) => id),
227
- images: {
228
- logo: logo == null ? void 0 : logo.id,
229
- preview: preview == null ? void 0 : preview.id
108
+ ...own && {
109
+ descriptions: {
110
+ logo: own.descriptions.logo
111
+ },
112
+ images: {
113
+ logo: own.images.logo
114
+ },
115
+ style: own.style
230
116
  },
117
+ // @story pages/reposition
118
+ // One list of { file, description, position }, each with its own
119
+ // Description.
120
+ gallery: (gallery || []).map(import_helpers.galleryValue),
231
121
  links,
232
- status,
233
- style,
234
- title
122
+ ...variant && {
123
+ title
124
+ }
235
125
  },
236
126
  endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.campaign) + "/page/" + values.id,
237
127
  method: "PUT"
@@ -243,11 +133,80 @@ const FormOrganizationCampaignPageEdit = ({
243
133
  onError(error);
244
134
  }
245
135
  };
246
- const errors = [
247
- ((_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.title) || ((_b = formState == null ? void 0 : formState.errors) == null ? void 0 : _b.slug) || ((_c = formState == null ? void 0 : formState.errors) == null ? void 0 : _c.headline),
248
- ((_d = formState == null ? void 0 : formState.errors) == null ? void 0 : _d.gallery) || ((_e = formState == null ? void 0 : formState.errors) == null ? void 0 : _e.images),
249
- (_f = formState == null ? void 0 : formState.errors) == null ? void 0 : _f.integrations
250
- ];
136
+ const content = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
137
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
138
+ import_fieldset.default,
139
+ {
140
+ ...{
141
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
142
+ },
143
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
144
+ import_input_fields.InputFieldsDetails,
145
+ {
146
+ ...{
147
+ onUpdate,
148
+ organization
149
+ }
150
+ }
151
+ )
152
+ }
153
+ ),
154
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
155
+ import_fieldset.default,
156
+ {
157
+ ...{
158
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
159
+ },
160
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
161
+ import_input_fields.InputFieldsMedia,
162
+ {
163
+ ...{
164
+ onUpdate,
165
+ organization,
166
+ values
167
+ }
168
+ }
169
+ )
170
+ }
171
+ )
172
+ ] });
173
+ const look = tabs && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
174
+ import_fieldset.default,
175
+ {
176
+ ...{
177
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
178
+ },
179
+ children: [
180
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
181
+ import_input_fields.InputFieldsImages,
182
+ {
183
+ ...{
184
+ described: true,
185
+ onUpdate,
186
+ organization,
187
+ preview: false,
188
+ values
189
+ }
190
+ }
191
+ ),
192
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
193
+ import_input_fields.InputFieldsStyle,
194
+ {
195
+ ...{
196
+ onUpdate
197
+ }
198
+ }
199
+ )
200
+ ]
201
+ }
202
+ ) });
203
+ const refocus = (0, import_react.useRef)(false);
204
+ (0, import_react.useEffect)(() => {
205
+ var _a2, _b;
206
+ if (!refocus.current || formState.isSubmitting) return;
207
+ refocus.current = false;
208
+ (_b = (_a2 = document.getElementById(formId)) == null ? void 0 : _a2.querySelector('.input-group.error :is(input:not([type="hidden"]), textarea, select)')) == null ? void 0 : _b.focus();
209
+ }, [tab, formState.isSubmitting, formState.submitCount]);
251
210
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
252
211
  import_form.FormProvider,
253
212
  {
@@ -258,126 +217,71 @@ const FormOrganizationCampaignPageEdit = ({
258
217
  ...{
259
218
  // Divided, Save under the last section.
260
219
  className: "relative w-full divide-y divide-gray [&>*]:py-6 [&>*:first-child]:pt-0 [&>*:last-child]:pb-0",
261
- onSubmit: handleSubmit(onSubmit)
220
+ id: formId,
221
+ onSubmit: handleSubmit(onSubmit, (errors) => {
222
+ refocus.current = true;
223
+ if (tabs) setTab(DESIGN.includes(Object.keys(errors)[0]) ? 1 : 0);
224
+ })
262
225
  },
263
226
  children: [
264
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
265
- import_accordion.default,
227
+ variant && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
228
+ import_fieldset.default,
266
229
  {
267
230
  ...{
268
- ...props,
269
- ...section("Details"),
270
- error: errors == null ? void 0 : errors[0]
231
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
271
232
  },
272
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
273
- import_fieldset.default,
233
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
234
+ import_form.Controller,
274
235
  {
275
236
  ...{
276
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
277
- },
278
- children: [
279
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
280
- import_form.Controller,
281
- {
282
- ...{
283
- control,
284
- defaultValue: "active",
285
- name: "status",
286
- render: ({ field: { value, onChange } }) => {
287
- var _a2, _b2;
288
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
289
- import_input_group.default,
237
+ control,
238
+ name: "title",
239
+ render: ({ field: { value, onChange } }) => {
240
+ var _a2, _b;
241
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
242
+ import_input_group.default,
243
+ {
244
+ ...{
245
+ error: (_b = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.title) == null ? void 0 : _b.message,
246
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
247
+ import_input_text.default,
290
248
  {
291
249
  ...{
292
- "data-guide": "form-input-status",
293
- error: (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.status) == null ? void 0 : _b2.message,
294
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
295
- import_input_switch.default,
296
- {
297
- ...{
298
- helper: Boolean(value === "published") ? "published" : "drafted",
299
- onChange: (active) => onChange(active ? "published" : "drafted"),
300
- value: Boolean(value === "published")
301
- }
302
- }
303
- ),
304
- label: "Status"
250
+ onChange,
251
+ value: value || ""
305
252
  }
306
253
  }
307
- );
254
+ ),
255
+ label: "Title"
308
256
  }
309
257
  }
310
- }
311
- ),
312
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
313
- import_input_fields.InputFieldsPage,
314
- {
315
- ...{
316
- onUpdate: () => onUpdate(getValues())
317
- }
318
- }
319
- ),
320
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
321
- import_input_fields.InputFieldsDetails,
322
- {
323
- ...{
324
- onUpdate,
325
- organization
326
- }
327
- }
328
- )
329
- ]
330
- }
331
- )
332
- }
333
- ),
334
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
335
- import_accordion.default,
336
- {
337
- ...{
338
- ...props,
339
- ...section("Media"),
340
- error: errors == null ? void 0 : errors[1]
341
- },
342
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
343
- import_fieldset.default,
344
- {
345
- ...{
346
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
347
- },
348
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
349
- import_input_fields.InputFieldsMedia,
350
- {
351
- ...{
352
- onUpdate,
353
- organization,
354
- values
355
- }
258
+ );
356
259
  }
357
- )
260
+ }
358
261
  }
359
262
  )
360
263
  }
361
264
  ),
362
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
363
- import_accordion.default,
265
+ tabs ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
266
+ import_tabs.default,
364
267
  {
365
268
  ...{
366
- ...props,
367
- ...section("Style"),
368
- error: errors == null ? void 0 : errors[2]
369
- },
370
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
371
- import_input_fields.InputFieldsStyle,
372
- {
373
- ...{
374
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting),
375
- onUpdate
269
+ active: tab,
270
+ list: [
271
+ {
272
+ title: "Content"
273
+ },
274
+ {
275
+ title: "Design"
376
276
  }
377
- }
378
- )
277
+ ],
278
+ onChange: setTab,
279
+ panelClassName: "w-full",
280
+ panelItemClassName: "w-full divide-y divide-gray [&>*]:py-6 [&>*:first-child]:pt-2 [&>*:last-child]:pb-0",
281
+ panels: [content, look]
282
+ }
379
283
  }
380
- ),
284
+ ) : content,
381
285
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
382
286
  import_fieldset.default,
383
287
  {
@@ -404,6 +308,5 @@ const FormOrganizationCampaignPageEdit = ({
404
308
  };
405
309
  // Annotate the CommonJS export names for ESM import in node:
406
310
  0 && (module.exports = {
407
- FormOrganizationCampaignPage,
408
311
  FormOrganizationCampaignPageEdit
409
312
  });