@drawbridge/components 0.1.37 → 0.1.39

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 (329) 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 +226 -95
  19. package/dist/bridge/form-subdomain.mjs +225 -97
  20. package/dist/bridge/lib/entry.js +71 -6
  21. package/dist/bridge/lib/entry.mjs +60 -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 +1815 -0
  35. package/dist/dashboard/campaign-form.mjs +1786 -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 +25 -10
  41. package/dist/dashboard/card-campaign-switch.mjs +24 -10
  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 +183 -0
  47. package/dist/dashboard/card-shortcut.mjs +154 -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 +86 -38
  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 +402 -210
  71. package/dist/dashboard/form-organization-campaign-agreement.mjs +398 -211
  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 +209 -0
  143. package/dist/dashboard/lib/form-page.mjs +161 -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 +192 -126
  175. package/dist/dashboard/template-rail.mjs +190 -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 +18 -9
  225. package/dist/shared/lib/campaign.mjs +17 -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 +46 -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 +13 -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 +40 -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/campaign.d.ts +11 -0
  313. package/types/shared/lib/helpers.d.ts +22 -1
  314. package/types/shared/lib/motion.d.ts +2 -0
  315. package/types/shared/lib/video.d.ts +3 -0
  316. package/types/shared/sortable.d.ts +6 -0
  317. package/types/video.d.ts +18 -2
  318. package/dist/bridge/template-preview.js +0 -208
  319. package/dist/bridge/template-preview.mjs +0 -173
  320. package/dist/dashboard/device.js +0 -95
  321. package/dist/dashboard/device.mjs +0 -72
  322. package/dist/dashboard/form-organization-campaign-field-list.js +0 -425
  323. package/dist/dashboard/form-organization-campaign-field-list.mjs +0 -396
  324. package/dist/dashboard/item-row.js +0 -92
  325. package/dist/dashboard/item-row.mjs +0 -63
  326. package/types/bridge/template-preview.d.ts +0 -10
  327. package/types/dashboard/device.d.ts +0 -12
  328. package/types/dashboard/form-organization-campaign-field-list.d.ts +0 -36
  329. package/types/dashboard/item-row.d.ts +0 -25
@@ -0,0 +1,1815 @@
1
+ "use client";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name2 in all)
10
+ __defProp(target, name2, { get: all[name2], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var campaign_form_exports = {};
30
+ __export(campaign_form_exports, {
31
+ default: () => campaign_form_default
32
+ });
33
+ module.exports = __toCommonJS(campaign_form_exports);
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ var import_react = require("react");
36
+ var import_react_query = require("@tanstack/react-query");
37
+ var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
38
+ var import_features = require("@drawbridge/drawbridge-utils/features");
39
+ var import_hooks = require("./lib/hooks");
40
+ var import_sms = require("./lib/sms");
41
+ var import_form_page = require("./lib/form-page");
42
+ var import_helpers = require("../shared/lib/helpers");
43
+ var import_entry = require("../bridge/lib/entry");
44
+ var import_card_section = __toESM(require("./card-section"));
45
+ var import_card_shortcut = __toESM(require("./card-shortcut"));
46
+ var import_card_task = __toESM(require("./card-task"));
47
+ var import_dropdown = __toESM(require("./dropdown"));
48
+ var import_link = __toESM(require("./link"));
49
+ var import_preview = __toESM(require("./preview"));
50
+ var import_empty = __toESM(require("../shared/empty"));
51
+ var import_badge = __toESM(require("../shared/badge"));
52
+ var import_button = __toESM(require("../shared/button"));
53
+ var import_indicator = __toESM(require("../shared/indicator"));
54
+ var import_sortable = __toESM(require("../shared/sortable"));
55
+ var import_input_checkbox = __toESM(require("../input-checkbox"));
56
+ var import_provider_font = __toESM(require("../provider-font"));
57
+ var import_fields = require("../bridge/fields");
58
+ var import_form_subdomain_header = require("../bridge/form-subdomain-header");
59
+ var import_form_subdomain = require("../bridge/form-subdomain");
60
+ var import_form_subdomain_missions = require("../bridge/form-subdomain-missions");
61
+ var import_advertisements = __toESM(require("../bridge/advertisements"));
62
+ var import_form_subdomain_agreement = require("../bridge/form-subdomain-agreement");
63
+ var import_arrow_down_long = __toESM(require("../icons/arrow-down-long"));
64
+ var import_identification = __toESM(require("../icons/identification"));
65
+ var import_lock = __toESM(require("../icons/lock"));
66
+ var import_rectangle_stack = __toESM(require("../icons/rectangle-stack"));
67
+ var import_shopping_bag = __toESM(require("../icons/shopping-bag"));
68
+ var import_ellipsis = __toESM(require("../icons/ellipsis"));
69
+ var import_map_pin = __toESM(require("../icons/map-pin"));
70
+ var import_plus_small = __toESM(require("../icons/plus-small"));
71
+ const drawnAs = {
72
+ note: "textarea",
73
+ pickup: "select"
74
+ };
75
+ const buttonStates = [
76
+ {
77
+ key: "Default",
78
+ value: "button"
79
+ },
80
+ {
81
+ key: "Giveaway",
82
+ value: "active"
83
+ },
84
+ {
85
+ key: "Closed",
86
+ value: "inactive"
87
+ }
88
+ ];
89
+ const messageStates = [
90
+ {
91
+ key: "Submission success",
92
+ value: "confirmation"
93
+ },
94
+ {
95
+ key: "Already submitted",
96
+ value: "rejection"
97
+ },
98
+ {
99
+ key: "Order confirmation",
100
+ value: "order"
101
+ }
102
+ ];
103
+ const fieldType = {
104
+ information: "lead",
105
+ order: "order",
106
+ section: "additional"
107
+ };
108
+ const noop = () => {
109
+ };
110
+ const copyText = (campaign, key) => {
111
+ var _a, _b, _c, _d, _e, _f;
112
+ return ((_b = (_a = campaign == null ? void 0 : campaign.form) == null ? void 0 : _a.copy) == null ? void 0 : _b[key]) || ((_f = (_e = (_d = (_c = import_drawbridge_utils.constants) == null ? void 0 : _c.campaign) == null ? void 0 : _d.form) == null ? void 0 : _e.copy) == null ? void 0 : _f[key]);
113
+ };
114
+ const name = (field) => (field == null ? void 0 : field.label) || (field == null ? void 0 : field.title);
115
+ const options = (items, label) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
116
+ import_dropdown.default,
117
+ {
118
+ ...{
119
+ button: {
120
+ "aria-label": label,
121
+ icon: import_ellipsis.default
122
+ },
123
+ items
124
+ }
125
+ }
126
+ );
127
+ const menuOrUpgrade = (upgrade, items, label) => upgrade ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
128
+ import_button.default,
129
+ {
130
+ ...{
131
+ element: import_link.default,
132
+ href: upgrade,
133
+ inline: true,
134
+ size: "small"
135
+ },
136
+ children: "Upgrade"
137
+ }
138
+ ) : options(items, label);
139
+ const Inert = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
140
+ "div",
141
+ {
142
+ ...{
143
+ className: "pointer-events-none",
144
+ inert: true
145
+ },
146
+ children
147
+ }
148
+ );
149
+ const Drawing = ({ children, fonts, reads }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
150
+ "div",
151
+ {
152
+ ...{
153
+ className: "mx-auto w-full max-w-[28rem] px-6",
154
+ "data-reads": reads || void 0,
155
+ style: fonts == null ? void 0 : fonts.body
156
+ },
157
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Inert, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
158
+ "div",
159
+ {
160
+ ...{
161
+ className: "space-y-4"
162
+ },
163
+ children
164
+ }
165
+ ) })
166
+ }
167
+ );
168
+ const GRIP = "flex items-center justify-center w-10 h-10 shrink-0 rounded bg-gray-light cursor-move touch-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-black";
169
+ const Row = ({
170
+ handle,
171
+ label,
172
+ menu,
173
+ onEdit,
174
+ type
175
+ }) => {
176
+ const text = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
177
+ "span",
178
+ {
179
+ ...{
180
+ className: "block text-left"
181
+ },
182
+ children: [
183
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
184
+ "span",
185
+ {
186
+ ...{
187
+ className: "block break-words"
188
+ },
189
+ children: label
190
+ }
191
+ ),
192
+ type && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
193
+ "span",
194
+ {
195
+ ...{
196
+ className: "block text-sm text-gray-dark break-words"
197
+ },
198
+ children: type
199
+ }
200
+ )
201
+ ]
202
+ }
203
+ );
204
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
205
+ "div",
206
+ {
207
+ ...{
208
+ className: "flex items-center gap-3 min-h-14 px-3 py-2 rounded border border-gray bg-white"
209
+ },
210
+ children: [
211
+ handle,
212
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
213
+ "div",
214
+ {
215
+ ...{
216
+ className: "flex-1 min-w-0"
217
+ },
218
+ children: onEdit ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
219
+ import_button.default,
220
+ {
221
+ ...{
222
+ justify: "start",
223
+ onClick: onEdit,
224
+ variant: "link"
225
+ },
226
+ children: text
227
+ }
228
+ ) : text
229
+ }
230
+ ),
231
+ menu
232
+ ]
233
+ }
234
+ );
235
+ };
236
+ const Title = ({ description, title }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
237
+ "span",
238
+ {
239
+ ...{
240
+ className: "block"
241
+ },
242
+ children: [
243
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
244
+ "span",
245
+ {
246
+ ...{
247
+ className: "block"
248
+ },
249
+ children: title
250
+ }
251
+ ),
252
+ description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
253
+ "span",
254
+ {
255
+ ...{
256
+ className: "block text-sm"
257
+ },
258
+ children: description
259
+ }
260
+ )
261
+ ]
262
+ }
263
+ );
264
+ const skipped = {
265
+ className: " border-dashed border-gray-dark/50",
266
+ style: {
267
+ backgroundColor: "transparent"
268
+ }
269
+ };
270
+ const STROKE = 1.5;
271
+ const LINE = "text-gray-dark/50";
272
+ const Arrow = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
273
+ "div",
274
+ {
275
+ ...{
276
+ "aria-hidden": true,
277
+ className: "flex justify-center py-1 " + LINE
278
+ },
279
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
280
+ import_arrow_down_long.default,
281
+ {
282
+ ...{
283
+ className: "w-3 h-12",
284
+ strokeWidth: STROKE
285
+ }
286
+ }
287
+ )
288
+ }
289
+ );
290
+ const Join = ({ end, label, onAdd, start }) => !onAdd ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
291
+ "div",
292
+ {
293
+ ...{
294
+ "aria-hidden": true,
295
+ className: "flex justify-center py-1 " + LINE
296
+ },
297
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
298
+ import_arrow_down_long.default,
299
+ {
300
+ ...{
301
+ className: "w-3 h-10",
302
+ strokeWidth: STROKE
303
+ }
304
+ }
305
+ )
306
+ }
307
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
308
+ "div",
309
+ {
310
+ ...{
311
+ className: "flex flex-col items-center"
312
+ },
313
+ children: [
314
+ !start && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
315
+ "span",
316
+ {
317
+ ...{
318
+ className: "h-3 bg-current " + LINE,
319
+ style: {
320
+ width: STROKE
321
+ }
322
+ }
323
+ }
324
+ ),
325
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
326
+ import_button.default,
327
+ {
328
+ ...{
329
+ "aria-label": label,
330
+ icon: import_plus_small.default,
331
+ inline: true,
332
+ onClick: onAdd,
333
+ size: "small",
334
+ variant: "round"
335
+ }
336
+ }
337
+ ),
338
+ !end && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
339
+ "span",
340
+ {
341
+ ...{
342
+ className: "h-3 bg-current " + LINE,
343
+ style: {
344
+ width: STROKE
345
+ }
346
+ }
347
+ }
348
+ )
349
+ ]
350
+ }
351
+ );
352
+ const Choice = ({
353
+ disabled,
354
+ granted = true,
355
+ message,
356
+ onClick,
357
+ title,
358
+ upgrade
359
+ }) => {
360
+ const href = granted ? null : upgrade == null ? void 0 : upgrade.href;
361
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
362
+ import_button.default,
363
+ {
364
+ ...{
365
+ element: href ? import_link.default : "button",
366
+ ...href ? {
367
+ href
368
+ } : {
369
+ disabled: disabled || !granted,
370
+ icon: import_plus_small.default,
371
+ onClick,
372
+ type: "button"
373
+ },
374
+ justify: "between",
375
+ variant: "secondary"
376
+ },
377
+ children: [
378
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
379
+ "span",
380
+ {
381
+ ...{
382
+ className: "flex-1 text-left"
383
+ },
384
+ children: [
385
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
386
+ "span",
387
+ {
388
+ ...{
389
+ className: "block"
390
+ },
391
+ children: title
392
+ }
393
+ ),
394
+ (message || !granted) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
395
+ "span",
396
+ {
397
+ ...{
398
+ className: "block text-sm"
399
+ },
400
+ children: message
401
+ }
402
+ )
403
+ ]
404
+ }
405
+ ),
406
+ href && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
407
+ import_button.default,
408
+ {
409
+ ...{
410
+ element: "span",
411
+ inline: true,
412
+ size: "small"
413
+ },
414
+ children: "Upgrade"
415
+ }
416
+ )
417
+ ]
418
+ }
419
+ );
420
+ };
421
+ const SectionChoices = ({ choices, onClose }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
422
+ "div",
423
+ {
424
+ ...{
425
+ className: "grid gap-3"
426
+ },
427
+ children: choices.map(({ description, disabled, icon, locked, onClick, title, upgrade }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
428
+ import_card_shortcut.default,
429
+ {
430
+ ...{
431
+ badge: locked && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
432
+ import_lock.default,
433
+ {
434
+ ...{
435
+ "aria-label": "Locked",
436
+ className: "w-4 h-4 text-gray-dark",
437
+ role: "img"
438
+ }
439
+ }
440
+ ),
441
+ description,
442
+ icon,
443
+ locked,
444
+ title,
445
+ ...upgrade ? {
446
+ href: upgrade
447
+ } : {
448
+ disabled,
449
+ onClick: () => {
450
+ onClose();
451
+ onClick();
452
+ }
453
+ }
454
+ }
455
+ },
456
+ title
457
+ ))
458
+ }
459
+ );
460
+ const Choices = ({ choices, onClose }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
461
+ "div",
462
+ {
463
+ ...{
464
+ className: "relative w-full space-y-3"
465
+ },
466
+ children: choices.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
467
+ Choice,
468
+ {
469
+ ...{
470
+ ...choice,
471
+ onClick: () => {
472
+ onClose();
473
+ choice.onClick();
474
+ }
475
+ }
476
+ },
477
+ choice.title
478
+ ))
479
+ }
480
+ );
481
+ const Drawn = ({ currency, field, style }) => {
482
+ var _a, _b;
483
+ return (field == null ? void 0 : field.slug) === "list" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
484
+ import_form_subdomain.FormSubdomainItemList,
485
+ {
486
+ ...{
487
+ currency,
488
+ field,
489
+ onChange: noop,
490
+ prices: true,
491
+ style,
492
+ value: {}
493
+ }
494
+ }
495
+ ) : ((_b = (_a = import_fields.components)[drawnAs[field == null ? void 0 : field.slug] || (field == null ? void 0 : field.slug)]) == null ? void 0 : _b.call(_a, {
496
+ field,
497
+ onChange: noop,
498
+ style,
499
+ value: ""
500
+ })) || null;
501
+ };
502
+ const FooterEnd = ({
503
+ campaign,
504
+ phone,
505
+ style,
506
+ texts
507
+ }) => {
508
+ var _a, _b, _c, _d;
509
+ const agreements = (campaign == null ? void 0 : campaign.agreements) || {};
510
+ const privacy = (0, import_form_page.privacyLink)(agreements);
511
+ const recaptcha = Boolean((_b = (_a = campaign == null ? void 0 : campaign.integrations) == null ? void 0 : _a.recaptcha) == null ? void 0 : _b.enabled);
512
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
513
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
514
+ "div",
515
+ {
516
+ ...{
517
+ className: "space-y-3"
518
+ },
519
+ children: (0, import_form_page.footerAgreements)({
520
+ agreements,
521
+ phone,
522
+ texts
523
+ }).map(({ key, lead, name: name2, required, underline }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
524
+ import_input_checkbox.default,
525
+ {
526
+ ...{
527
+ // @story public-entry/read-agreement
528
+ // As the share form draws it: only the name is underlined.
529
+ label: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
530
+ lead,
531
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
532
+ "span",
533
+ {
534
+ ...{
535
+ className: underline ? "underline" : void 0
536
+ },
537
+ children: name2
538
+ }
539
+ ),
540
+ required
541
+ ] }),
542
+ onChange: noop,
543
+ style,
544
+ value: false
545
+ }
546
+ },
547
+ key
548
+ ))
549
+ }
550
+ ),
551
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
552
+ "div",
553
+ {
554
+ ...{
555
+ className: "pt-2"
556
+ },
557
+ children: [
558
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
559
+ import_button.default,
560
+ {
561
+ ...{
562
+ style
563
+ },
564
+ children: ((_d = (_c = campaign == null ? void 0 : campaign.form) == null ? void 0 : _c.copy) == null ? void 0 : _d.submit) || "Submit"
565
+ }
566
+ ),
567
+ (privacy || recaptcha) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
568
+ "div",
569
+ {
570
+ ...{
571
+ className: "pt-4 space-y-2 text-center"
572
+ },
573
+ children: [
574
+ privacy && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
575
+ "p",
576
+ {
577
+ ...{
578
+ className: "text-xs underline"
579
+ },
580
+ children: privacy
581
+ }
582
+ ),
583
+ recaptcha && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
584
+ "div",
585
+ {
586
+ ...{
587
+ className: "text-[10px] opacity-50"
588
+ },
589
+ children: [
590
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "This site is protected by reCAPTCHA." }),
591
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
592
+ "The Google ",
593
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "underline", children: "Privacy Policy" }),
594
+ " and ",
595
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "underline", children: "Terms of Service" }),
596
+ " apply"
597
+ ] })
598
+ ]
599
+ }
600
+ )
601
+ ]
602
+ }
603
+ )
604
+ ]
605
+ }
606
+ )
607
+ ] });
608
+ };
609
+ const Step = ({
610
+ actions,
611
+ campaign,
612
+ canManage,
613
+ collapsed,
614
+ currency,
615
+ fonts,
616
+ handle,
617
+ last,
618
+ params,
619
+ phone,
620
+ section,
621
+ sections,
622
+ style,
623
+ texts
624
+ }) => {
625
+ var _a, _b;
626
+ const queryClient = (0, import_react_query.useQueryClient)();
627
+ const modal = (0, import_hooks.useModal)({
628
+ queryClient
629
+ });
630
+ const items = section.items || [];
631
+ const type = fieldType[section.type];
632
+ const plan = (0, import_form_page.planLocked)(section);
633
+ const upgrade = plan ? ((_b = (_a = section.task) == null ? void 0 : _a.button) == null ? void 0 : _b.href) || null : null;
634
+ const locked = (0, import_form_page.giveawayLocked)(section);
635
+ const on = (0, import_form_page.sectionOn)(section);
636
+ const shown = on && !collapsed;
637
+ const card = (0, import_preview.useCard)(section.id);
638
+ const add = () => modal.open({
639
+ message: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
640
+ Choices,
641
+ {
642
+ ...{
643
+ choices: (section.inputs || []).map(({ slug, title, ...input }) => ({
644
+ ...input,
645
+ disabled: (0, import_form_page.addedOnce)(slug, section.keys),
646
+ message: (0, import_form_page.addedOnce)(slug, section.keys) ? "Field has already been added" : input.granted === false ? input.message : null,
647
+ onClick: () => actions.manage({
648
+ ...input,
649
+ section,
650
+ slug,
651
+ title,
652
+ type
653
+ }),
654
+ title
655
+ })),
656
+ onClose: () => modal.close()
657
+ }
658
+ }
659
+ ),
660
+ title: "Add field to " + section.title
661
+ });
662
+ const manage = (field) => actions.manage({
663
+ ...field,
664
+ section,
665
+ type
666
+ });
667
+ const movable = section.type === "section" && sections.length > 1;
668
+ const cta = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
669
+ "div",
670
+ {
671
+ ...{
672
+ className: "flex items-center gap-2"
673
+ },
674
+ children: [
675
+ !on && !plan && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_badge.Disabled, {}),
676
+ menuOrUpgrade(
677
+ upgrade,
678
+ [
679
+ {
680
+ disabled: plan,
681
+ element: "button",
682
+ onClick: () => actions.section({
683
+ ...section,
684
+ fallback: "Next"
685
+ }),
686
+ title: "Manage"
687
+ },
688
+ // @story fields/order-section
689
+ // Order deletes as a custom section does ( Darren, 2026-11-16 ).
690
+ (section.type === "section" || section.type === "order") && {
691
+ className: "text-red-dark",
692
+ disabled: !canManage,
693
+ element: "button",
694
+ onClick: () => actions.removeSection(section),
695
+ title: "Delete"
696
+ }
697
+ ].filter(Boolean),
698
+ section.title + " options"
699
+ ),
700
+ canManage && !upgrade && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
701
+ import_button.default,
702
+ {
703
+ ...{
704
+ // The button reads Add; its name says what it adds.
705
+ "aria-label": "Add field to " + section.title,
706
+ disabled: plan,
707
+ icon: import_plus_small.default,
708
+ inline: true,
709
+ onClick: add,
710
+ size: "small",
711
+ variant: "success"
712
+ },
713
+ children: "Add"
714
+ }
715
+ )
716
+ ]
717
+ }
718
+ );
719
+ const editor = items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
720
+ import_empty.default,
721
+ {
722
+ ...{
723
+ variant: "secondary"
724
+ },
725
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "No fields have been added" })
726
+ }
727
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
728
+ import_sortable.default,
729
+ {
730
+ ...{
731
+ classNameSortableItem: "pb-2 last:pb-0",
732
+ disabled: !canManage,
733
+ handleClassName: GRIP,
734
+ handleLabel: (field) => "Move " + name(field),
735
+ items,
736
+ onSort: (sorted) => actions.reorder({
737
+ items: sorted,
738
+ section
739
+ }),
740
+ renderItem: (field, _index, handle2) => {
741
+ var _a2, _b2, _c;
742
+ const price = (0, import_form_page.itemPrice)(field);
743
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
744
+ Row,
745
+ {
746
+ ...{
747
+ handle: handle2,
748
+ label: (0, import_form_page.rowLabel)(field),
749
+ menu: options(
750
+ [
751
+ {
752
+ disabled: canManage && !((_a2 = field == null ? void 0 : field.methods) == null ? void 0 : _a2.includes("put")),
753
+ element: "button",
754
+ onClick: () => manage(field),
755
+ title: "Manage"
756
+ },
757
+ // The skill testing question stays where it was added.
758
+ movable && (field == null ? void 0 : field.slug) !== "skill" && {
759
+ disabled: !canManage || !((_b2 = field == null ? void 0 : field.methods) == null ? void 0 : _b2.includes("put")),
760
+ element: "button",
761
+ onClick: () => actions.move({
762
+ ...field,
763
+ section,
764
+ sections,
765
+ type
766
+ }),
767
+ title: "Move"
768
+ },
769
+ // @story fields/delete
770
+ // Name and Email offer no Delete at all ( `removable : false` ).
771
+ (field == null ? void 0 : field.removable) !== false && {
772
+ className: "text-red-dark",
773
+ disabled: !canManage || !((_c = field == null ? void 0 : field.methods) == null ? void 0 : _c.includes("delete")),
774
+ element: "button",
775
+ onClick: () => actions.delete(field, section),
776
+ title: "Delete"
777
+ }
778
+ ].filter(Boolean),
779
+ name(field) + " options"
780
+ ),
781
+ onEdit: () => manage(field),
782
+ type: (0, import_form_page.itemGroup)(field) ? "Item group \xB7 " + field.settings.items.length + " items" : (field == null ? void 0 : field.slug) === "list" ? "Item" + (price === null ? "" : " \xB7 " + (0, import_drawbridge_utils.formatCurrency)({
783
+ code: (currency || "usd").toUpperCase(),
784
+ display: "parts",
785
+ value: price
786
+ })) : field == null ? void 0 : field.title
787
+ }
788
+ }
789
+ );
790
+ },
791
+ sortableElement: "div"
792
+ }
793
+ }
794
+ );
795
+ const body = collapsed ? null : plan ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
796
+ import_card_task.default,
797
+ {
798
+ ...{
799
+ ...section.task,
800
+ // Upgrade sits in the header: the card keeps the plan's words.
801
+ ...upgrade && {
802
+ button: null
803
+ }
804
+ }
805
+ }
806
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
807
+ locked && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
808
+ "div",
809
+ {
810
+ ...{
811
+ className: "pb-4"
812
+ },
813
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
814
+ import_card_task.default,
815
+ {
816
+ ...{
817
+ button: {
818
+ href: "/organizations/" + (params == null ? void 0 : params.organization) + "/campaigns/" + (params == null ? void 0 : params.campaign) + "/giveaway",
819
+ text: "Go to Giveaway"
820
+ },
821
+ message: "Orders are off while the giveaway is on."
822
+ }
823
+ }
824
+ )
825
+ }
826
+ ),
827
+ editor,
828
+ shown && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
829
+ import_preview.default,
830
+ {
831
+ ...{
832
+ id: section.id
833
+ },
834
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
835
+ Drawing,
836
+ {
837
+ ...{
838
+ fonts
839
+ },
840
+ children: [
841
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
842
+ import_form_subdomain_header.FormSubdomainHeader,
843
+ {
844
+ ...{
845
+ description: section.description,
846
+ style,
847
+ title: section.title
848
+ }
849
+ }
850
+ ),
851
+ items.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
852
+ Drawn,
853
+ {
854
+ ...{
855
+ currency,
856
+ field,
857
+ style
858
+ }
859
+ }
860
+ ) }, field.id)),
861
+ section.type === "order" && (0, import_form_page.showsTotal)(items) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
862
+ "div",
863
+ {
864
+ ...{
865
+ className: "flex items-center justify-between text-sm"
866
+ },
867
+ children: [
868
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "TOTAL \xB7 0 ITEMS" }),
869
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: (0, import_drawbridge_utils.formatCurrency)({
870
+ code: (currency || "usd").toUpperCase(),
871
+ display: "parts",
872
+ value: 0
873
+ }) })
874
+ ]
875
+ }
876
+ ),
877
+ last ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
878
+ FooterEnd,
879
+ {
880
+ ...{
881
+ campaign,
882
+ phone,
883
+ style,
884
+ texts
885
+ }
886
+ }
887
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
888
+ "div",
889
+ {
890
+ ...{
891
+ className: "pt-2"
892
+ },
893
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
894
+ import_button.default,
895
+ {
896
+ ...{
897
+ style
898
+ },
899
+ children: section.button || "Next"
900
+ }
901
+ )
902
+ }
903
+ )
904
+ ]
905
+ }
906
+ )
907
+ }
908
+ )
909
+ ] });
910
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
911
+ import_card_section.default,
912
+ {
913
+ ...{
914
+ children: body,
915
+ className: "relative shrink-0" + (on ? card.className : skipped.className),
916
+ cta,
917
+ "data-guide": "section-" + section.id,
918
+ ...on ? card.props : {
919
+ style: skipped.style
920
+ },
921
+ // A custom section drags by the handle left of its title, always shown,
922
+ // in a grey box the height of its title and description.
923
+ title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
924
+ "span",
925
+ {
926
+ ...{
927
+ className: "flex items-center gap-3"
928
+ },
929
+ children: [
930
+ handle,
931
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
932
+ Title,
933
+ {
934
+ ...section
935
+ }
936
+ )
937
+ ]
938
+ }
939
+ )
940
+ }
941
+ }
942
+ );
943
+ };
944
+ const AgeStep = ({
945
+ actions,
946
+ age,
947
+ canManage,
948
+ fonts,
949
+ style
950
+ }) => {
951
+ var _a;
952
+ const on = age.enabled !== false;
953
+ const title = ((_a = age.settings) == null ? void 0 : _a.title) || "Confirm your age";
954
+ const card = (0, import_preview.useCard)("age");
955
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
956
+ import_card_section.default,
957
+ {
958
+ ...{
959
+ className: "relative shrink-0" + (on ? card.className : skipped.className),
960
+ cta: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
961
+ "div",
962
+ {
963
+ ...{
964
+ className: "flex items-center gap-2"
965
+ },
966
+ children: [
967
+ !on && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_badge.Disabled, {}),
968
+ options(
969
+ [
970
+ {
971
+ element: "button",
972
+ onClick: () => {
973
+ var _a2, _b, _c;
974
+ return actions.section({
975
+ button: (_a2 = age.settings) == null ? void 0 : _a2.button,
976
+ description: (_b = age.settings) == null ? void 0 : _b.description,
977
+ enabled: on,
978
+ fallback: "Next",
979
+ id: "age",
980
+ title: (_c = age.settings) == null ? void 0 : _c.title,
981
+ type: "age"
982
+ });
983
+ },
984
+ title: "Manage"
985
+ },
986
+ {
987
+ className: "text-red-dark",
988
+ disabled: !canManage,
989
+ element: "button",
990
+ // A section, so the section's Delete ( Darren, 2026-11-11 ).
991
+ onClick: () => actions.removeSection({
992
+ id: "age",
993
+ title
994
+ }),
995
+ title: "Delete"
996
+ }
997
+ ],
998
+ "Age gate options"
999
+ )
1000
+ ]
1001
+ }
1002
+ ),
1003
+ "data-guide": "section-age",
1004
+ ...on ? card.props : {
1005
+ style: skipped.style
1006
+ },
1007
+ title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1008
+ Title,
1009
+ {
1010
+ ...{
1011
+ description: (0, import_form_page.ageRange)(age.settings),
1012
+ title
1013
+ }
1014
+ }
1015
+ )
1016
+ },
1017
+ children: [
1018
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1019
+ Row,
1020
+ {
1021
+ ...{
1022
+ label: "Date of birth\xA0*",
1023
+ menu: options(
1024
+ [
1025
+ {
1026
+ element: "button",
1027
+ onClick: () => actions.integration(age),
1028
+ title: "Manage"
1029
+ }
1030
+ ],
1031
+ "Age gate field options"
1032
+ ),
1033
+ onEdit: () => actions.integration(age),
1034
+ type: "Age gate"
1035
+ }
1036
+ }
1037
+ ),
1038
+ on && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1039
+ import_preview.default,
1040
+ {
1041
+ ...{
1042
+ id: "age"
1043
+ },
1044
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1045
+ Drawing,
1046
+ {
1047
+ ...{
1048
+ fonts
1049
+ },
1050
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1051
+ import_form_subdomain.FormSubdomainAge,
1052
+ {
1053
+ ...{
1054
+ style,
1055
+ values: age.settings
1056
+ }
1057
+ }
1058
+ )
1059
+ }
1060
+ )
1061
+ }
1062
+ )
1063
+ ]
1064
+ }
1065
+ );
1066
+ };
1067
+ const Location = ({
1068
+ fonts,
1069
+ item,
1070
+ style
1071
+ }) => {
1072
+ const card = (0, import_preview.useCard)("location");
1073
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1074
+ "div",
1075
+ {
1076
+ ...{
1077
+ className: "flex justify-center"
1078
+ },
1079
+ children: [
1080
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1081
+ "div",
1082
+ {
1083
+ ...{
1084
+ "aria-label": "Show the location check",
1085
+ className: "rounded-full outline-offset-2 focus-visible:outline focus-visible:outline-2" + card.className,
1086
+ role: "button",
1087
+ tabIndex: 0,
1088
+ ...card.props
1089
+ },
1090
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1091
+ import_badge.default,
1092
+ {
1093
+ ...{
1094
+ className: "bg-gray",
1095
+ "data-guide": "section-geocode",
1096
+ type: null
1097
+ },
1098
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1099
+ "span",
1100
+ {
1101
+ ...{
1102
+ className: "flex items-center gap-2"
1103
+ },
1104
+ children: [
1105
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1106
+ import_map_pin.default,
1107
+ {
1108
+ ...{
1109
+ "aria-hidden": true,
1110
+ className: "w-4 h-4"
1111
+ }
1112
+ }
1113
+ ),
1114
+ (0, import_form_page.locationText)(item)
1115
+ ]
1116
+ }
1117
+ )
1118
+ }
1119
+ )
1120
+ }
1121
+ ),
1122
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1123
+ import_preview.default,
1124
+ {
1125
+ ...{
1126
+ id: "location"
1127
+ },
1128
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1129
+ Drawing,
1130
+ {
1131
+ ...{
1132
+ fonts
1133
+ },
1134
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1135
+ import_form_subdomain.FormSubdomainGeocode,
1136
+ {
1137
+ ...{
1138
+ still: true,
1139
+ style
1140
+ }
1141
+ }
1142
+ )
1143
+ }
1144
+ )
1145
+ }
1146
+ )
1147
+ ]
1148
+ }
1149
+ );
1150
+ };
1151
+ const Start = ({
1152
+ actions,
1153
+ campaign,
1154
+ fonts,
1155
+ style
1156
+ }) => {
1157
+ const live = (0, import_entry.buttonState)(campaign, (campaign == null ? void 0 : campaign.valid) !== false);
1158
+ const [state, setState] = (0, import_react.useState)(live);
1159
+ const card = (0, import_preview.useCard)("start");
1160
+ (0, import_react.useEffect)(() => setState(live), [live]);
1161
+ const edit = () => actions.copy(buttonStates.map(({ value }) => value), "Entry button");
1162
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1163
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1164
+ import_card_section.default,
1165
+ {
1166
+ ...{
1167
+ className: "relative shrink-0" + card.className,
1168
+ cta: options(
1169
+ [
1170
+ {
1171
+ element: "button",
1172
+ onClick: edit,
1173
+ title: "Manage"
1174
+ }
1175
+ ],
1176
+ "Entry button options"
1177
+ ),
1178
+ "data-guide": "section-start",
1179
+ ...card.props,
1180
+ title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1181
+ Title,
1182
+ {
1183
+ ...{
1184
+ description: "Opens the form on the share page.",
1185
+ title: "Entry button"
1186
+ }
1187
+ }
1188
+ ),
1189
+ variant: "gray"
1190
+ }
1191
+ }
1192
+ ),
1193
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1194
+ import_preview.default,
1195
+ {
1196
+ ...{
1197
+ id: "start",
1198
+ states: {
1199
+ onChange: setState,
1200
+ options: buttonStates,
1201
+ value: state
1202
+ }
1203
+ },
1204
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1205
+ Drawing,
1206
+ {
1207
+ ...{
1208
+ fonts
1209
+ },
1210
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1211
+ "div",
1212
+ {
1213
+ ...{
1214
+ className: "flex justify-center"
1215
+ },
1216
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1217
+ import_button.default,
1218
+ {
1219
+ ...{
1220
+ disabled: state === "inactive",
1221
+ style
1222
+ },
1223
+ children: copyText(campaign, state)
1224
+ }
1225
+ )
1226
+ }
1227
+ )
1228
+ }
1229
+ )
1230
+ }
1231
+ )
1232
+ ] });
1233
+ };
1234
+ const Footer = ({
1235
+ actions,
1236
+ campaign,
1237
+ phone,
1238
+ texts
1239
+ }) => {
1240
+ const slider = (0, import_react.useContext)(import_preview.Slider);
1241
+ const edit = () => actions.footer({
1242
+ phone,
1243
+ texts
1244
+ });
1245
+ const agreements = (0, import_form_page.agreementRows)(campaign == null ? void 0 : campaign.agreements, texts);
1246
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1247
+ "div",
1248
+ {
1249
+ ...{
1250
+ className: "space-y-3 mt-8 pt-6 border-t border-gray-dark/20" + ((slider == null ? void 0 : slider.current) === (slider == null ? void 0 : slider.last) ? "" : " cursor-pointer"),
1251
+ "data-guide": "section-footer",
1252
+ ...slider && {
1253
+ onFocusCapture: () => slider.select(slider.last),
1254
+ onPointerDownCapture: (event) => slider.select(slider.last, event.currentTarget, event.target)
1255
+ }
1256
+ },
1257
+ children: [
1258
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1259
+ "div",
1260
+ {
1261
+ ...{
1262
+ className: "flex items-center justify-between gap-4"
1263
+ },
1264
+ children: [
1265
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1266
+ "div",
1267
+ {
1268
+ ...{
1269
+ className: "text-gray-dark"
1270
+ },
1271
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1272
+ Title,
1273
+ {
1274
+ ...{
1275
+ description: "Automatically added to the bottom of the last section.",
1276
+ title: "Footer"
1277
+ }
1278
+ }
1279
+ )
1280
+ }
1281
+ ),
1282
+ options(
1283
+ [
1284
+ {
1285
+ element: "button",
1286
+ onClick: edit,
1287
+ title: "Manage"
1288
+ }
1289
+ ],
1290
+ "Footer options"
1291
+ )
1292
+ ]
1293
+ }
1294
+ ),
1295
+ agreements.map(({ id, on, title }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1296
+ "p",
1297
+ {
1298
+ ...{
1299
+ className: "flex items-center gap-2"
1300
+ },
1301
+ children: [
1302
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1303
+ import_indicator.default,
1304
+ {
1305
+ ...{
1306
+ type: on ? "active" : "inactive"
1307
+ }
1308
+ }
1309
+ ),
1310
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title }),
1311
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1312
+ "span",
1313
+ {
1314
+ ...{
1315
+ className: "sr-only"
1316
+ },
1317
+ children: on ? ", on" : ", off"
1318
+ }
1319
+ )
1320
+ ]
1321
+ },
1322
+ id
1323
+ ))
1324
+ ]
1325
+ }
1326
+ );
1327
+ };
1328
+ const Agreements = ({ campaign, documents, fonts, style }) => {
1329
+ var _a, _b, _c, _d, _e;
1330
+ const [picked, setPicked] = (0, import_react.useState)(null);
1331
+ const id = documents.some((item) => item.value === picked) ? picked : (_a = documents[0]) == null ? void 0 : _a.value;
1332
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1333
+ import_preview.default,
1334
+ {
1335
+ ...{
1336
+ id: "agreements",
1337
+ states: {
1338
+ onChange: setPicked,
1339
+ options: documents,
1340
+ value: id
1341
+ }
1342
+ },
1343
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1344
+ Drawing,
1345
+ {
1346
+ ...{
1347
+ fonts,
1348
+ reads: "Agreements"
1349
+ },
1350
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1351
+ import_form_subdomain_agreement.AgreementDocument,
1352
+ {
1353
+ ...{
1354
+ data: (_b = campaign == null ? void 0 : campaign.preview) == null ? void 0 : _b.documents,
1355
+ style,
1356
+ value: (_e = (_d = (_c = campaign == null ? void 0 : campaign.agreements) == null ? void 0 : _c[id]) == null ? void 0 : _d.values) == null ? void 0 : _e.document
1357
+ }
1358
+ }
1359
+ )
1360
+ }
1361
+ )
1362
+ }
1363
+ );
1364
+ };
1365
+ const After = ({
1366
+ actions,
1367
+ after,
1368
+ campaign,
1369
+ canManage,
1370
+ fonts,
1371
+ organization,
1372
+ params,
1373
+ style
1374
+ }) => {
1375
+ var _a, _b, _c;
1376
+ const queryClient = (0, import_react_query.useQueryClient)();
1377
+ const app = queryClient.getQueryData(["app"]);
1378
+ const [response, setResponse] = (0, import_react.useState)("confirmation");
1379
+ const card = (0, import_preview.useCard)("after");
1380
+ const all = after.advertisements || [];
1381
+ const missions = after.missions || [];
1382
+ const ads = all.filter((ad) => (ad == null ? void 0 : ad.status) === "published").map((ad) => {
1383
+ var _a2, _b2, _c2;
1384
+ return (0, import_helpers.advertisementPreview)(ad, (_c2 = (_b2 = (_a2 = app == null ? void 0 : app.enums) == null ? void 0 : _a2.advertisement) == null ? void 0 : _b2.action) == null ? void 0 : _c2.options);
1385
+ });
1386
+ const page = campaign == null ? void 0 : campaign.preview;
1387
+ const editMessages = () => actions.copy(messageStates.map(({ value }) => value), "Messages");
1388
+ const adsPlan = (0, import_drawbridge_utils.getPlanFeature)(organization == null ? void 0 : organization.plan, import_features.organization.advertisements.key);
1389
+ const rows = {
1390
+ advertisements: {
1391
+ edit: () => actions.advertisements(),
1392
+ label: "Advertisements",
1393
+ upgrade: !adsPlan.granted && ((_a = organization == null ? void 0 : organization.capabilities) == null ? void 0 : _a.billing) === "manage" && "/organizations/" + (params == null ? void 0 : params.organization) + "/billing",
1394
+ preview: ads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1395
+ import_advertisements.default,
1396
+ {
1397
+ ...{
1398
+ campaign: campaign == null ? void 0 : campaign.id,
1399
+ items: ads,
1400
+ organization: campaign == null ? void 0 : campaign.organization,
1401
+ preview: true,
1402
+ slug: page == null ? void 0 : page.slug,
1403
+ style,
1404
+ subdomain: page == null ? void 0 : page.subdomain
1405
+ }
1406
+ }
1407
+ ),
1408
+ // Published out of every advertisement, drafts included, as Missions counts ( Darren, 2026-11-16 ).
1409
+ type: adsPlan.granted ? (0, import_form_page.counted)(ads.length, all.length) : adsPlan.message || import_features.organization.advertisements.error
1410
+ },
1411
+ // No text under Message: it followed the preview's picker, which read as the
1412
+ // row changing ( Darren, 2026-11-11 ).
1413
+ message: {
1414
+ edit: editMessages,
1415
+ label: "Message",
1416
+ preview: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1417
+ import_form_subdomain.FormSubdomainMessage,
1418
+ {
1419
+ ...{
1420
+ message: copyText(campaign, response),
1421
+ style
1422
+ }
1423
+ }
1424
+ )
1425
+ },
1426
+ // Its Manage leaves the page for Missions, so pressing the row opens nothing:
1427
+ // it jumped away while a person only meant to show its step ( Darren, 2026-11-13 ).
1428
+ missions: {
1429
+ edit: actions.missions,
1430
+ label: "Missions",
1431
+ leaves: true,
1432
+ preview: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1433
+ import_form_subdomain_missions.FormSubdomainMissions,
1434
+ {
1435
+ ...{
1436
+ missions,
1437
+ slug: page == null ? void 0 : page.slug,
1438
+ style,
1439
+ subdomain: page == null ? void 0 : page.subdomain
1440
+ }
1441
+ }
1442
+ ),
1443
+ // Switched on out of the missions the Missions page lists ( the api's count ).
1444
+ type: (0, import_form_page.counted)((_b = after.missionCount) == null ? void 0 : _b.on, (_c = after.missionCount) == null ? void 0 : _c.total)
1445
+ }
1446
+ };
1447
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1448
+ import_card_section.default,
1449
+ {
1450
+ ...{
1451
+ className: "relative shrink-0" + card.className,
1452
+ "data-guide": "section-after",
1453
+ ...card.props,
1454
+ title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1455
+ Title,
1456
+ {
1457
+ ...{
1458
+ description: "What a person sees once they submit.",
1459
+ title: "After entry"
1460
+ }
1461
+ }
1462
+ ),
1463
+ variant: "gray"
1464
+ },
1465
+ children: [
1466
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1467
+ import_sortable.default,
1468
+ {
1469
+ ...{
1470
+ classNameSortableItem: "pb-2 last:pb-0",
1471
+ disabled: !canManage,
1472
+ handleClassName: GRIP,
1473
+ handleLabel: (key) => "Move " + rows[key].label,
1474
+ items: (0, import_form_page.afterRows)(after.order),
1475
+ onSort: actions.reorderAfter,
1476
+ renderItem: (key, _index, handle) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1477
+ Row,
1478
+ {
1479
+ ...{
1480
+ handle,
1481
+ label: rows[key].label,
1482
+ menu: menuOrUpgrade(
1483
+ rows[key].upgrade,
1484
+ [
1485
+ {
1486
+ element: "button",
1487
+ onClick: rows[key].edit,
1488
+ title: "Manage"
1489
+ }
1490
+ ],
1491
+ rows[key].label + " options"
1492
+ ),
1493
+ // A row showing Upgrade opens nothing: Upgrade is its only control ( Darren,
1494
+ // 2026-11-12 ). Nor does Missions: only its Manage leaves the page.
1495
+ onEdit: rows[key].upgrade || rows[key].leaves ? null : rows[key].edit,
1496
+ type: rows[key].type
1497
+ }
1498
+ }
1499
+ ),
1500
+ sortableElement: "div"
1501
+ }
1502
+ }
1503
+ ),
1504
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1505
+ import_preview.default,
1506
+ {
1507
+ ...{
1508
+ id: "after",
1509
+ states: {
1510
+ onChange: setResponse,
1511
+ options: messageStates,
1512
+ value: response
1513
+ }
1514
+ },
1515
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1516
+ Drawing,
1517
+ {
1518
+ ...{
1519
+ fonts
1520
+ },
1521
+ children: (0, import_form_page.afterRows)(after.order, response).map((key) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: rows[key].preview }, key))
1522
+ }
1523
+ )
1524
+ }
1525
+ )
1526
+ ]
1527
+ }
1528
+ );
1529
+ };
1530
+ const CampaignForm = ({
1531
+ actions,
1532
+ campaign,
1533
+ canManage,
1534
+ onOpened,
1535
+ open,
1536
+ organization,
1537
+ params,
1538
+ sections,
1539
+ style
1540
+ }) => {
1541
+ var _a, _b;
1542
+ const queryClient = (0, import_react_query.useQueryClient)();
1543
+ const modal = (0, import_hooks.useModal)({
1544
+ queryClient
1545
+ });
1546
+ const [dragging, setDragging] = (0, import_react.useState)(false);
1547
+ const parts = (0, import_form_page.formParts)(sections);
1548
+ const { after, age, customs, information, location, order } = parts;
1549
+ const steps = [information, ...customs, order].filter(Boolean);
1550
+ const lastId = (0, import_form_page.lastStepId)(steps);
1551
+ const phone = (0, import_form_page.asksPhone)(steps);
1552
+ const texts = (0, import_sms.textsOn)(organization);
1553
+ const currency = ((_a = organization == null ? void 0 : organization.defaults) == null ? void 0 : _a.currency) || "usd";
1554
+ const documents = (0, import_react.useMemo)(() => (0, import_form_page.readableDocuments)(campaign == null ? void 0 : campaign.agreements, texts), [campaign == null ? void 0 : campaign.agreements, texts]);
1555
+ (0, import_react.useEffect)(() => {
1556
+ if (open !== "footer") return;
1557
+ actions.footer({
1558
+ phone,
1559
+ texts
1560
+ });
1561
+ onOpened == null ? void 0 : onOpened();
1562
+ }, [open]);
1563
+ const choices = customs.map((section) => ({
1564
+ description: section.description,
1565
+ label: section.title,
1566
+ questions: (section.items || []).length,
1567
+ value: section.id
1568
+ }));
1569
+ const orderPlan = (0, import_drawbridge_utils.getPlanFeature)(organization == null ? void 0 : organization.plan, import_features.fields.order.key);
1570
+ const addOrder = {
1571
+ description: "Items to buy, last in the form",
1572
+ icon: import_shopping_bag.default,
1573
+ onClick: actions.addOrder,
1574
+ title: "Order",
1575
+ ...!orderPlan.granted && {
1576
+ description: orderPlan.message,
1577
+ disabled: true,
1578
+ locked: true,
1579
+ upgrade: ((_b = organization == null ? void 0 : organization.capabilities) == null ? void 0 : _b.billing) === "manage" ? "/organizations/" + (params == null ? void 0 : params.organization) + "/billing" : null
1580
+ }
1581
+ };
1582
+ const addSection = (before) => ({
1583
+ description: customs.length >= import_form_page.MAX_SECTIONS ? "A form can have up to " + import_form_page.MAX_SECTIONS + " sections" : "A step with its own questions",
1584
+ disabled: customs.length >= import_form_page.MAX_SECTIONS,
1585
+ icon: import_rectangle_stack.default,
1586
+ onClick: () => actions.addSection(before),
1587
+ title: "Section"
1588
+ });
1589
+ const addAge = {
1590
+ description: "Asks their age before the form",
1591
+ icon: import_identification.default,
1592
+ onClick: actions.addAge,
1593
+ title: "Age gate"
1594
+ };
1595
+ const choose = (choices2) => () => modal.open({
1596
+ message: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1597
+ SectionChoices,
1598
+ {
1599
+ ...{
1600
+ choices: choices2,
1601
+ onClose: () => modal.close()
1602
+ }
1603
+ }
1604
+ ),
1605
+ title: "Add section"
1606
+ });
1607
+ const middle = (before) => canManage && customs.length < import_form_page.MAX_SECTIONS ? choose([addSection(before)]) : null;
1608
+ const step = (section, fonts, handle, collapsed) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1609
+ Step,
1610
+ {
1611
+ ...{
1612
+ actions,
1613
+ campaign,
1614
+ canManage,
1615
+ collapsed,
1616
+ currency,
1617
+ fonts,
1618
+ handle,
1619
+ last: section.id === lastId,
1620
+ params,
1621
+ phone,
1622
+ section,
1623
+ sections: choices,
1624
+ style,
1625
+ texts
1626
+ }
1627
+ }
1628
+ );
1629
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1630
+ import_provider_font.default,
1631
+ {
1632
+ ...style,
1633
+ children: (fonts) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1634
+ import_preview.SliderLayout,
1635
+ {
1636
+ ...{
1637
+ blank: dragging,
1638
+ last: lastId,
1639
+ slides: (0, import_form_page.formSlides)(parts, documents.length > 0),
1640
+ style
1641
+ },
1642
+ children: [
1643
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1644
+ Start,
1645
+ {
1646
+ ...{
1647
+ actions,
1648
+ campaign,
1649
+ fonts,
1650
+ style
1651
+ }
1652
+ }
1653
+ ),
1654
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Arrow, {}),
1655
+ location && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1656
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1657
+ Location,
1658
+ {
1659
+ ...{
1660
+ fonts,
1661
+ item: location,
1662
+ style
1663
+ }
1664
+ }
1665
+ ),
1666
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Arrow, {})
1667
+ ] }),
1668
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1669
+ import_card_section.default,
1670
+ {
1671
+ ...{
1672
+ className: "shrink-0",
1673
+ "data-guide": "section-fields",
1674
+ title: "Fields",
1675
+ variant: "gray"
1676
+ },
1677
+ children: [
1678
+ !age && canManage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1679
+ Join,
1680
+ {
1681
+ ...{
1682
+ label: "Add an age gate",
1683
+ onAdd: choose([addAge]),
1684
+ start: true
1685
+ }
1686
+ }
1687
+ ),
1688
+ age && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1689
+ AgeStep,
1690
+ {
1691
+ ...{
1692
+ actions,
1693
+ age,
1694
+ canManage,
1695
+ fonts,
1696
+ style
1697
+ }
1698
+ }
1699
+ ),
1700
+ information && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1701
+ age && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Join, {}),
1702
+ step(information, fonts)
1703
+ ] }),
1704
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1705
+ import_sortable.default,
1706
+ {
1707
+ ...{
1708
+ disabled: !canManage,
1709
+ handleClassName: GRIP,
1710
+ handleLabel: (section) => "Move " + section.title,
1711
+ items: customs,
1712
+ onDragging: setDragging,
1713
+ onSort: (sorted) => actions.reorderSections(sorted.map((section) => section.id)),
1714
+ renderItem: (section, _index, handle) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1715
+ dragging ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1716
+ "div",
1717
+ {
1718
+ ...{
1719
+ className: "h-4"
1720
+ }
1721
+ }
1722
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1723
+ Join,
1724
+ {
1725
+ ...{
1726
+ label: "Add a section here",
1727
+ onAdd: middle(section.id)
1728
+ }
1729
+ }
1730
+ ),
1731
+ step(section, fonts, handle, dragging)
1732
+ ] }),
1733
+ sortableElement: "div"
1734
+ }
1735
+ }
1736
+ ),
1737
+ order && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1738
+ dragging ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1739
+ "div",
1740
+ {
1741
+ ...{
1742
+ className: "h-4"
1743
+ }
1744
+ }
1745
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1746
+ Join,
1747
+ {
1748
+ ...{
1749
+ label: "Add a section here",
1750
+ onAdd: middle()
1751
+ }
1752
+ }
1753
+ ),
1754
+ step(order, fonts)
1755
+ ] }),
1756
+ !order && canManage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1757
+ Join,
1758
+ {
1759
+ ...{
1760
+ end: true,
1761
+ label: "Add an order or a section here",
1762
+ onAdd: choose([addOrder, addSection()])
1763
+ }
1764
+ }
1765
+ ),
1766
+ lastId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1767
+ Footer,
1768
+ {
1769
+ ...{
1770
+ actions,
1771
+ campaign,
1772
+ phone,
1773
+ texts
1774
+ }
1775
+ }
1776
+ ),
1777
+ documents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1778
+ Agreements,
1779
+ {
1780
+ ...{
1781
+ campaign,
1782
+ documents,
1783
+ fonts,
1784
+ style
1785
+ }
1786
+ }
1787
+ )
1788
+ ]
1789
+ }
1790
+ ),
1791
+ after && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1792
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Arrow, {}),
1793
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1794
+ After,
1795
+ {
1796
+ ...{
1797
+ actions,
1798
+ after,
1799
+ campaign,
1800
+ canManage,
1801
+ fonts,
1802
+ organization,
1803
+ params,
1804
+ style
1805
+ }
1806
+ }
1807
+ )
1808
+ ] })
1809
+ ]
1810
+ }
1811
+ )
1812
+ }
1813
+ );
1814
+ };
1815
+ var campaign_form_default = CampaignForm;