@drawbridge/components 0.1.37 → 0.1.38

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 +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 +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
@@ -0,0 +1,1798 @@
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
+ title,
444
+ ...upgrade ? {
445
+ href: upgrade
446
+ } : {
447
+ disabled,
448
+ onClick: () => {
449
+ onClose();
450
+ onClick();
451
+ }
452
+ }
453
+ }
454
+ },
455
+ title
456
+ ))
457
+ }
458
+ );
459
+ const Choices = ({ choices, onClose }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
460
+ "div",
461
+ {
462
+ ...{
463
+ className: "relative w-full space-y-3"
464
+ },
465
+ children: choices.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
466
+ Choice,
467
+ {
468
+ ...{
469
+ ...choice,
470
+ onClick: () => {
471
+ onClose();
472
+ choice.onClick();
473
+ }
474
+ }
475
+ },
476
+ choice.title
477
+ ))
478
+ }
479
+ );
480
+ const Drawn = ({ currency, field, style }) => {
481
+ var _a, _b;
482
+ return (field == null ? void 0 : field.slug) === "list" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
483
+ import_form_subdomain.FormSubdomainItemList,
484
+ {
485
+ ...{
486
+ currency,
487
+ field,
488
+ onChange: noop,
489
+ prices: true,
490
+ style,
491
+ value: {}
492
+ }
493
+ }
494
+ ) : ((_b = (_a = import_fields.components)[drawnAs[field == null ? void 0 : field.slug] || (field == null ? void 0 : field.slug)]) == null ? void 0 : _b.call(_a, {
495
+ field,
496
+ onChange: noop,
497
+ style,
498
+ value: ""
499
+ })) || null;
500
+ };
501
+ const FooterEnd = ({
502
+ campaign,
503
+ phone,
504
+ style,
505
+ texts
506
+ }) => {
507
+ var _a, _b, _c, _d;
508
+ const agreements = (campaign == null ? void 0 : campaign.agreements) || {};
509
+ const privacy = (0, import_form_page.privacyLink)(agreements);
510
+ const recaptcha = Boolean((_b = (_a = campaign == null ? void 0 : campaign.integrations) == null ? void 0 : _a.recaptcha) == null ? void 0 : _b.enabled);
511
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
512
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
513
+ "div",
514
+ {
515
+ ...{
516
+ className: "space-y-3"
517
+ },
518
+ children: (0, import_form_page.footerAgreements)({
519
+ agreements,
520
+ phone,
521
+ texts
522
+ }).map(({ key, label }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
523
+ import_input_checkbox.default,
524
+ {
525
+ ...{
526
+ label,
527
+ onChange: noop,
528
+ style,
529
+ value: false
530
+ }
531
+ },
532
+ key
533
+ ))
534
+ }
535
+ ),
536
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
537
+ "div",
538
+ {
539
+ ...{
540
+ className: "pt-2"
541
+ },
542
+ children: [
543
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
544
+ import_button.default,
545
+ {
546
+ ...{
547
+ style
548
+ },
549
+ children: ((_d = (_c = campaign == null ? void 0 : campaign.form) == null ? void 0 : _c.copy) == null ? void 0 : _d.submit) || "Submit"
550
+ }
551
+ ),
552
+ (privacy || recaptcha) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
553
+ "div",
554
+ {
555
+ ...{
556
+ className: "pt-4 space-y-2 text-center"
557
+ },
558
+ children: [
559
+ privacy && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
560
+ "p",
561
+ {
562
+ ...{
563
+ className: "text-xs underline"
564
+ },
565
+ children: privacy
566
+ }
567
+ ),
568
+ recaptcha && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
569
+ "div",
570
+ {
571
+ ...{
572
+ className: "text-[10px] opacity-50"
573
+ },
574
+ children: [
575
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "This site is protected by reCAPTCHA." }),
576
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
577
+ "The Google ",
578
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "underline", children: "Privacy Policy" }),
579
+ " and ",
580
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "underline", children: "Terms of Service" }),
581
+ " apply"
582
+ ] })
583
+ ]
584
+ }
585
+ )
586
+ ]
587
+ }
588
+ )
589
+ ]
590
+ }
591
+ )
592
+ ] });
593
+ };
594
+ const Step = ({
595
+ actions,
596
+ campaign,
597
+ canManage,
598
+ collapsed,
599
+ currency,
600
+ fonts,
601
+ handle,
602
+ last,
603
+ params,
604
+ phone,
605
+ section,
606
+ sections,
607
+ style,
608
+ texts
609
+ }) => {
610
+ var _a, _b;
611
+ const queryClient = (0, import_react_query.useQueryClient)();
612
+ const modal = (0, import_hooks.useModal)({
613
+ queryClient
614
+ });
615
+ const items = section.items || [];
616
+ const type = fieldType[section.type];
617
+ const plan = (0, import_form_page.planLocked)(section);
618
+ const upgrade = plan ? ((_b = (_a = section.task) == null ? void 0 : _a.button) == null ? void 0 : _b.href) || null : null;
619
+ const locked = (0, import_form_page.giveawayLocked)(section);
620
+ const on = (0, import_form_page.sectionOn)(section);
621
+ const shown = on && !collapsed;
622
+ const card = (0, import_preview.useCard)(section.id);
623
+ const add = () => modal.open({
624
+ message: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
625
+ Choices,
626
+ {
627
+ ...{
628
+ choices: (section.inputs || []).map(({ slug, title, ...input }) => ({
629
+ ...input,
630
+ disabled: (0, import_form_page.addedOnce)(slug, section.keys),
631
+ message: (0, import_form_page.addedOnce)(slug, section.keys) ? "Field has already been added" : input.granted === false ? input.message : null,
632
+ onClick: () => actions.manage({
633
+ ...input,
634
+ section,
635
+ slug,
636
+ title,
637
+ type
638
+ }),
639
+ title
640
+ })),
641
+ onClose: () => modal.close()
642
+ }
643
+ }
644
+ ),
645
+ title: "Add field to " + section.title
646
+ });
647
+ const manage = (field) => actions.manage({
648
+ ...field,
649
+ section,
650
+ type
651
+ });
652
+ const movable = section.type === "section" && sections.length > 1;
653
+ const cta = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
654
+ "div",
655
+ {
656
+ ...{
657
+ className: "flex items-center gap-2"
658
+ },
659
+ children: [
660
+ !on && !plan && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_badge.Disabled, {}),
661
+ menuOrUpgrade(
662
+ upgrade,
663
+ [
664
+ {
665
+ disabled: plan,
666
+ element: "button",
667
+ onClick: () => actions.section({
668
+ ...section,
669
+ fallback: "Next"
670
+ }),
671
+ title: "Manage"
672
+ },
673
+ // @story fields/order-section
674
+ // Order deletes as a custom section does ( Darren, 2026-11-16 ).
675
+ (section.type === "section" || section.type === "order") && {
676
+ className: "text-red-dark",
677
+ disabled: !canManage,
678
+ element: "button",
679
+ onClick: () => actions.removeSection(section),
680
+ title: "Delete"
681
+ }
682
+ ].filter(Boolean),
683
+ section.title + " options"
684
+ ),
685
+ canManage && !upgrade && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
686
+ import_button.default,
687
+ {
688
+ ...{
689
+ // The button reads Add; its name says what it adds.
690
+ "aria-label": "Add field to " + section.title,
691
+ disabled: plan,
692
+ icon: import_plus_small.default,
693
+ inline: true,
694
+ onClick: add,
695
+ size: "small",
696
+ variant: "success"
697
+ },
698
+ children: "Add"
699
+ }
700
+ )
701
+ ]
702
+ }
703
+ );
704
+ const editor = items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
705
+ import_empty.default,
706
+ {
707
+ ...{
708
+ variant: "secondary"
709
+ },
710
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "No fields have been added" })
711
+ }
712
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
713
+ import_sortable.default,
714
+ {
715
+ ...{
716
+ classNameSortableItem: "pb-2 last:pb-0",
717
+ disabled: !canManage,
718
+ handleClassName: GRIP,
719
+ handleLabel: (field) => "Move " + name(field),
720
+ items,
721
+ onSort: (sorted) => actions.reorder({
722
+ items: sorted,
723
+ section
724
+ }),
725
+ renderItem: (field, _index, handle2) => {
726
+ var _a2, _b2, _c;
727
+ const price = (0, import_form_page.itemPrice)(field);
728
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
729
+ Row,
730
+ {
731
+ ...{
732
+ handle: handle2,
733
+ label: (0, import_form_page.rowLabel)(field),
734
+ menu: options(
735
+ [
736
+ {
737
+ disabled: canManage && !((_a2 = field == null ? void 0 : field.methods) == null ? void 0 : _a2.includes("put")),
738
+ element: "button",
739
+ onClick: () => manage(field),
740
+ title: "Manage"
741
+ },
742
+ // The skill testing question stays where it was added.
743
+ movable && (field == null ? void 0 : field.slug) !== "skill" && {
744
+ disabled: !canManage || !((_b2 = field == null ? void 0 : field.methods) == null ? void 0 : _b2.includes("put")),
745
+ element: "button",
746
+ onClick: () => actions.move({
747
+ ...field,
748
+ section,
749
+ sections,
750
+ type
751
+ }),
752
+ title: "Move"
753
+ },
754
+ // @story fields/delete
755
+ // Name and Email offer no Delete at all ( `removable : false` ).
756
+ (field == null ? void 0 : field.removable) !== false && {
757
+ className: "text-red-dark",
758
+ disabled: !canManage || !((_c = field == null ? void 0 : field.methods) == null ? void 0 : _c.includes("delete")),
759
+ element: "button",
760
+ onClick: () => actions.delete(field, section),
761
+ title: "Delete"
762
+ }
763
+ ].filter(Boolean),
764
+ name(field) + " options"
765
+ ),
766
+ onEdit: () => manage(field),
767
+ 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)({
768
+ code: (currency || "usd").toUpperCase(),
769
+ display: "parts",
770
+ value: price
771
+ })) : field == null ? void 0 : field.title
772
+ }
773
+ }
774
+ );
775
+ },
776
+ sortableElement: "div"
777
+ }
778
+ }
779
+ );
780
+ const body = collapsed ? null : plan ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
781
+ import_card_task.default,
782
+ {
783
+ ...{
784
+ ...section.task,
785
+ // Upgrade sits in the header: the card keeps the plan's words.
786
+ ...upgrade && {
787
+ button: null
788
+ }
789
+ }
790
+ }
791
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
792
+ locked && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
793
+ "div",
794
+ {
795
+ ...{
796
+ className: "pb-4"
797
+ },
798
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
799
+ import_card_task.default,
800
+ {
801
+ ...{
802
+ button: {
803
+ href: "/organizations/" + (params == null ? void 0 : params.organization) + "/campaigns/" + (params == null ? void 0 : params.campaign) + "/giveaway",
804
+ text: "Go to Giveaway"
805
+ },
806
+ message: "Orders are off while the giveaway is on."
807
+ }
808
+ }
809
+ )
810
+ }
811
+ ),
812
+ editor,
813
+ shown && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
814
+ import_preview.default,
815
+ {
816
+ ...{
817
+ id: section.id
818
+ },
819
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
820
+ Drawing,
821
+ {
822
+ ...{
823
+ fonts
824
+ },
825
+ children: [
826
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
827
+ import_form_subdomain_header.FormSubdomainHeader,
828
+ {
829
+ ...{
830
+ description: section.description,
831
+ style,
832
+ title: section.title
833
+ }
834
+ }
835
+ ),
836
+ items.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
837
+ Drawn,
838
+ {
839
+ ...{
840
+ currency,
841
+ field,
842
+ style
843
+ }
844
+ }
845
+ ) }, field.id)),
846
+ section.type === "order" && (0, import_form_page.showsTotal)(items) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
847
+ "div",
848
+ {
849
+ ...{
850
+ className: "flex items-center justify-between text-sm"
851
+ },
852
+ children: [
853
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "TOTAL \xB7 0 ITEMS" }),
854
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: (0, import_drawbridge_utils.formatCurrency)({
855
+ code: (currency || "usd").toUpperCase(),
856
+ display: "parts",
857
+ value: 0
858
+ }) })
859
+ ]
860
+ }
861
+ ),
862
+ last ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
863
+ FooterEnd,
864
+ {
865
+ ...{
866
+ campaign,
867
+ phone,
868
+ style,
869
+ texts
870
+ }
871
+ }
872
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
873
+ "div",
874
+ {
875
+ ...{
876
+ className: "pt-2"
877
+ },
878
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
879
+ import_button.default,
880
+ {
881
+ ...{
882
+ style
883
+ },
884
+ children: section.button || "Next"
885
+ }
886
+ )
887
+ }
888
+ )
889
+ ]
890
+ }
891
+ )
892
+ }
893
+ )
894
+ ] });
895
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
896
+ import_card_section.default,
897
+ {
898
+ ...{
899
+ children: body,
900
+ className: "relative shrink-0" + (on ? card.className : skipped.className),
901
+ cta,
902
+ "data-guide": "section-" + section.id,
903
+ ...on ? card.props : {
904
+ style: skipped.style
905
+ },
906
+ // A custom section drags by the handle left of its title, always shown,
907
+ // in a grey box the height of its title and description.
908
+ title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
909
+ "span",
910
+ {
911
+ ...{
912
+ className: "flex items-center gap-3"
913
+ },
914
+ children: [
915
+ handle,
916
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
917
+ Title,
918
+ {
919
+ ...section
920
+ }
921
+ )
922
+ ]
923
+ }
924
+ )
925
+ }
926
+ }
927
+ );
928
+ };
929
+ const AgeStep = ({
930
+ actions,
931
+ age,
932
+ canManage,
933
+ fonts,
934
+ style
935
+ }) => {
936
+ var _a;
937
+ const on = age.enabled !== false;
938
+ const title = ((_a = age.settings) == null ? void 0 : _a.title) || "Confirm your age";
939
+ const card = (0, import_preview.useCard)("age");
940
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
941
+ import_card_section.default,
942
+ {
943
+ ...{
944
+ className: "relative shrink-0" + (on ? card.className : skipped.className),
945
+ cta: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
946
+ "div",
947
+ {
948
+ ...{
949
+ className: "flex items-center gap-2"
950
+ },
951
+ children: [
952
+ !on && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_badge.Disabled, {}),
953
+ options(
954
+ [
955
+ {
956
+ element: "button",
957
+ onClick: () => {
958
+ var _a2, _b, _c;
959
+ return actions.section({
960
+ button: (_a2 = age.settings) == null ? void 0 : _a2.button,
961
+ description: (_b = age.settings) == null ? void 0 : _b.description,
962
+ enabled: on,
963
+ fallback: "Next",
964
+ id: "age",
965
+ title: (_c = age.settings) == null ? void 0 : _c.title,
966
+ type: "age"
967
+ });
968
+ },
969
+ title: "Manage"
970
+ },
971
+ {
972
+ className: "text-red-dark",
973
+ disabled: !canManage,
974
+ element: "button",
975
+ // A section, so the section's Delete ( Darren, 2026-11-11 ).
976
+ onClick: () => actions.removeSection({
977
+ id: "age",
978
+ title
979
+ }),
980
+ title: "Delete"
981
+ }
982
+ ],
983
+ "Age gate options"
984
+ )
985
+ ]
986
+ }
987
+ ),
988
+ "data-guide": "section-age",
989
+ ...on ? card.props : {
990
+ style: skipped.style
991
+ },
992
+ title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
993
+ Title,
994
+ {
995
+ ...{
996
+ description: (0, import_form_page.ageRange)(age.settings),
997
+ title
998
+ }
999
+ }
1000
+ )
1001
+ },
1002
+ children: [
1003
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1004
+ Row,
1005
+ {
1006
+ ...{
1007
+ label: "Date of birth\xA0*",
1008
+ menu: options(
1009
+ [
1010
+ {
1011
+ element: "button",
1012
+ onClick: () => actions.integration(age),
1013
+ title: "Manage"
1014
+ }
1015
+ ],
1016
+ "Age gate field options"
1017
+ ),
1018
+ onEdit: () => actions.integration(age),
1019
+ type: "Age gate"
1020
+ }
1021
+ }
1022
+ ),
1023
+ on && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1024
+ import_preview.default,
1025
+ {
1026
+ ...{
1027
+ id: "age"
1028
+ },
1029
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1030
+ Drawing,
1031
+ {
1032
+ ...{
1033
+ fonts
1034
+ },
1035
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1036
+ import_form_subdomain.FormSubdomainAge,
1037
+ {
1038
+ ...{
1039
+ style,
1040
+ values: age.settings
1041
+ }
1042
+ }
1043
+ )
1044
+ }
1045
+ )
1046
+ }
1047
+ )
1048
+ ]
1049
+ }
1050
+ );
1051
+ };
1052
+ const Location = ({
1053
+ fonts,
1054
+ item,
1055
+ style
1056
+ }) => {
1057
+ const card = (0, import_preview.useCard)("location");
1058
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1059
+ "div",
1060
+ {
1061
+ ...{
1062
+ className: "flex justify-center"
1063
+ },
1064
+ children: [
1065
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1066
+ "div",
1067
+ {
1068
+ ...{
1069
+ "aria-label": "Show the location check",
1070
+ className: "rounded-full outline-offset-2 focus-visible:outline focus-visible:outline-2" + card.className,
1071
+ role: "button",
1072
+ tabIndex: 0,
1073
+ ...card.props
1074
+ },
1075
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1076
+ import_badge.default,
1077
+ {
1078
+ ...{
1079
+ className: "bg-gray",
1080
+ "data-guide": "section-geocode",
1081
+ type: null
1082
+ },
1083
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1084
+ "span",
1085
+ {
1086
+ ...{
1087
+ className: "flex items-center gap-2"
1088
+ },
1089
+ children: [
1090
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1091
+ import_map_pin.default,
1092
+ {
1093
+ ...{
1094
+ "aria-hidden": true,
1095
+ className: "w-4 h-4"
1096
+ }
1097
+ }
1098
+ ),
1099
+ (0, import_form_page.locationText)(item)
1100
+ ]
1101
+ }
1102
+ )
1103
+ }
1104
+ )
1105
+ }
1106
+ ),
1107
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1108
+ import_preview.default,
1109
+ {
1110
+ ...{
1111
+ id: "location"
1112
+ },
1113
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1114
+ Drawing,
1115
+ {
1116
+ ...{
1117
+ fonts
1118
+ },
1119
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1120
+ import_form_subdomain.FormSubdomainGeocode,
1121
+ {
1122
+ ...{
1123
+ still: true,
1124
+ style
1125
+ }
1126
+ }
1127
+ )
1128
+ }
1129
+ )
1130
+ }
1131
+ )
1132
+ ]
1133
+ }
1134
+ );
1135
+ };
1136
+ const Start = ({
1137
+ actions,
1138
+ campaign,
1139
+ fonts,
1140
+ style
1141
+ }) => {
1142
+ const [state, setState] = (0, import_react.useState)(() => (0, import_entry.buttonState)(campaign, (campaign == null ? void 0 : campaign.valid) !== false));
1143
+ const card = (0, import_preview.useCard)("start");
1144
+ const edit = () => actions.copy(buttonStates.map(({ value }) => value), "Entry button");
1145
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1146
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1147
+ import_card_section.default,
1148
+ {
1149
+ ...{
1150
+ className: "relative shrink-0" + card.className,
1151
+ cta: options(
1152
+ [
1153
+ {
1154
+ element: "button",
1155
+ onClick: edit,
1156
+ title: "Manage"
1157
+ }
1158
+ ],
1159
+ "Entry button options"
1160
+ ),
1161
+ "data-guide": "section-start",
1162
+ ...card.props,
1163
+ title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1164
+ Title,
1165
+ {
1166
+ ...{
1167
+ description: "Opens the form on the share page.",
1168
+ title: "Entry button"
1169
+ }
1170
+ }
1171
+ ),
1172
+ variant: "gray"
1173
+ }
1174
+ }
1175
+ ),
1176
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1177
+ import_preview.default,
1178
+ {
1179
+ ...{
1180
+ id: "start",
1181
+ states: {
1182
+ onChange: setState,
1183
+ options: buttonStates,
1184
+ value: state
1185
+ }
1186
+ },
1187
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1188
+ Drawing,
1189
+ {
1190
+ ...{
1191
+ fonts
1192
+ },
1193
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1194
+ "div",
1195
+ {
1196
+ ...{
1197
+ className: "flex justify-center"
1198
+ },
1199
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1200
+ import_button.default,
1201
+ {
1202
+ ...{
1203
+ disabled: state === "inactive",
1204
+ style
1205
+ },
1206
+ children: copyText(campaign, state)
1207
+ }
1208
+ )
1209
+ }
1210
+ )
1211
+ }
1212
+ )
1213
+ }
1214
+ )
1215
+ ] });
1216
+ };
1217
+ const Footer = ({
1218
+ actions,
1219
+ campaign,
1220
+ phone,
1221
+ texts
1222
+ }) => {
1223
+ const slider = (0, import_react.useContext)(import_preview.Slider);
1224
+ const edit = () => actions.footer({
1225
+ phone,
1226
+ texts
1227
+ });
1228
+ const agreements = (0, import_form_page.agreementRows)(campaign == null ? void 0 : campaign.agreements, texts);
1229
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1230
+ "div",
1231
+ {
1232
+ ...{
1233
+ 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"),
1234
+ "data-guide": "section-footer",
1235
+ ...slider && {
1236
+ onFocusCapture: () => slider.select(slider.last),
1237
+ onPointerDownCapture: (event) => slider.select(slider.last, event.currentTarget, event.target)
1238
+ }
1239
+ },
1240
+ children: [
1241
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1242
+ "div",
1243
+ {
1244
+ ...{
1245
+ className: "flex items-center justify-between gap-4"
1246
+ },
1247
+ children: [
1248
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1249
+ "div",
1250
+ {
1251
+ ...{
1252
+ className: "text-gray-dark"
1253
+ },
1254
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1255
+ Title,
1256
+ {
1257
+ ...{
1258
+ description: "Automatically added to the bottom of the last section.",
1259
+ title: "Footer"
1260
+ }
1261
+ }
1262
+ )
1263
+ }
1264
+ ),
1265
+ options(
1266
+ [
1267
+ {
1268
+ element: "button",
1269
+ onClick: edit,
1270
+ title: "Manage"
1271
+ }
1272
+ ],
1273
+ "Footer options"
1274
+ )
1275
+ ]
1276
+ }
1277
+ ),
1278
+ agreements.map(({ id, on, title }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1279
+ "p",
1280
+ {
1281
+ ...{
1282
+ className: "flex items-center gap-2"
1283
+ },
1284
+ children: [
1285
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1286
+ import_indicator.default,
1287
+ {
1288
+ ...{
1289
+ type: on ? "active" : "inactive"
1290
+ }
1291
+ }
1292
+ ),
1293
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title }),
1294
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1295
+ "span",
1296
+ {
1297
+ ...{
1298
+ className: "sr-only"
1299
+ },
1300
+ children: on ? ", on" : ", off"
1301
+ }
1302
+ )
1303
+ ]
1304
+ },
1305
+ id
1306
+ ))
1307
+ ]
1308
+ }
1309
+ );
1310
+ };
1311
+ const Agreements = ({ campaign, documents, fonts, style }) => {
1312
+ var _a, _b, _c, _d, _e;
1313
+ const [picked, setPicked] = (0, import_react.useState)(null);
1314
+ const id = documents.some((item) => item.value === picked) ? picked : (_a = documents[0]) == null ? void 0 : _a.value;
1315
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1316
+ import_preview.default,
1317
+ {
1318
+ ...{
1319
+ id: "agreements",
1320
+ states: {
1321
+ onChange: setPicked,
1322
+ options: documents,
1323
+ value: id
1324
+ }
1325
+ },
1326
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1327
+ Drawing,
1328
+ {
1329
+ ...{
1330
+ fonts,
1331
+ reads: "Agreements"
1332
+ },
1333
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1334
+ import_form_subdomain_agreement.AgreementDocument,
1335
+ {
1336
+ ...{
1337
+ data: (_b = campaign == null ? void 0 : campaign.preview) == null ? void 0 : _b.documents,
1338
+ style,
1339
+ 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
1340
+ }
1341
+ }
1342
+ )
1343
+ }
1344
+ )
1345
+ }
1346
+ );
1347
+ };
1348
+ const After = ({
1349
+ actions,
1350
+ after,
1351
+ campaign,
1352
+ canManage,
1353
+ fonts,
1354
+ organization,
1355
+ params,
1356
+ style
1357
+ }) => {
1358
+ var _a, _b, _c;
1359
+ const queryClient = (0, import_react_query.useQueryClient)();
1360
+ const app = queryClient.getQueryData(["app"]);
1361
+ const [response, setResponse] = (0, import_react.useState)("confirmation");
1362
+ const card = (0, import_preview.useCard)("after");
1363
+ const all = after.advertisements || [];
1364
+ const missions = after.missions || [];
1365
+ const ads = all.filter((ad) => (ad == null ? void 0 : ad.status) === "published").map((ad) => {
1366
+ var _a2, _b2, _c2;
1367
+ 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);
1368
+ });
1369
+ const page = campaign == null ? void 0 : campaign.preview;
1370
+ const editMessages = () => actions.copy(messageStates.map(({ value }) => value), "Messages");
1371
+ const adsPlan = (0, import_drawbridge_utils.getPlanFeature)(organization == null ? void 0 : organization.plan, import_features.organization.advertisements.key);
1372
+ const rows = {
1373
+ advertisements: {
1374
+ edit: () => actions.advertisements(),
1375
+ label: "Advertisements",
1376
+ upgrade: !adsPlan.granted && ((_a = organization == null ? void 0 : organization.capabilities) == null ? void 0 : _a.billing) === "manage" && "/organizations/" + (params == null ? void 0 : params.organization) + "/billing",
1377
+ preview: ads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1378
+ import_advertisements.default,
1379
+ {
1380
+ ...{
1381
+ campaign: campaign == null ? void 0 : campaign.id,
1382
+ items: ads,
1383
+ organization: campaign == null ? void 0 : campaign.organization,
1384
+ preview: true,
1385
+ slug: page == null ? void 0 : page.slug,
1386
+ style,
1387
+ subdomain: page == null ? void 0 : page.subdomain
1388
+ }
1389
+ }
1390
+ ),
1391
+ // Published out of every advertisement, drafts included, as Missions counts ( Darren, 2026-11-16 ).
1392
+ type: adsPlan.granted ? (0, import_form_page.counted)(ads.length, all.length) : adsPlan.message || import_features.organization.advertisements.error
1393
+ },
1394
+ // No text under Message: it followed the preview's picker, which read as the
1395
+ // row changing ( Darren, 2026-11-11 ).
1396
+ message: {
1397
+ edit: editMessages,
1398
+ label: "Message",
1399
+ preview: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1400
+ import_form_subdomain.FormSubdomainMessage,
1401
+ {
1402
+ ...{
1403
+ message: copyText(campaign, response),
1404
+ style
1405
+ }
1406
+ }
1407
+ )
1408
+ },
1409
+ // Its Manage leaves the page for Missions, so pressing the row opens nothing:
1410
+ // it jumped away while a person only meant to show its step ( Darren, 2026-11-13 ).
1411
+ missions: {
1412
+ edit: actions.missions,
1413
+ label: "Missions",
1414
+ leaves: true,
1415
+ preview: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1416
+ import_form_subdomain_missions.FormSubdomainMissions,
1417
+ {
1418
+ ...{
1419
+ missions,
1420
+ slug: page == null ? void 0 : page.slug,
1421
+ style,
1422
+ subdomain: page == null ? void 0 : page.subdomain
1423
+ }
1424
+ }
1425
+ ),
1426
+ // Switched on out of the missions the Missions page lists ( the api's count ).
1427
+ type: (0, import_form_page.counted)((_b = after.missionCount) == null ? void 0 : _b.on, (_c = after.missionCount) == null ? void 0 : _c.total)
1428
+ }
1429
+ };
1430
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1431
+ import_card_section.default,
1432
+ {
1433
+ ...{
1434
+ className: "relative shrink-0" + card.className,
1435
+ "data-guide": "section-after",
1436
+ ...card.props,
1437
+ title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1438
+ Title,
1439
+ {
1440
+ ...{
1441
+ description: "What a person sees once they submit.",
1442
+ title: "After entry"
1443
+ }
1444
+ }
1445
+ ),
1446
+ variant: "gray"
1447
+ },
1448
+ children: [
1449
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1450
+ import_sortable.default,
1451
+ {
1452
+ ...{
1453
+ classNameSortableItem: "pb-2 last:pb-0",
1454
+ disabled: !canManage,
1455
+ handleClassName: GRIP,
1456
+ handleLabel: (key) => "Move " + rows[key].label,
1457
+ items: (0, import_form_page.afterRows)(after.order),
1458
+ onSort: actions.reorderAfter,
1459
+ renderItem: (key, _index, handle) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1460
+ Row,
1461
+ {
1462
+ ...{
1463
+ handle,
1464
+ label: rows[key].label,
1465
+ menu: menuOrUpgrade(
1466
+ rows[key].upgrade,
1467
+ [
1468
+ {
1469
+ element: "button",
1470
+ onClick: rows[key].edit,
1471
+ title: "Manage"
1472
+ }
1473
+ ],
1474
+ rows[key].label + " options"
1475
+ ),
1476
+ // A row showing Upgrade opens nothing: Upgrade is its only control ( Darren,
1477
+ // 2026-11-12 ). Nor does Missions: only its Manage leaves the page.
1478
+ onEdit: rows[key].upgrade || rows[key].leaves ? null : rows[key].edit,
1479
+ type: rows[key].type
1480
+ }
1481
+ }
1482
+ ),
1483
+ sortableElement: "div"
1484
+ }
1485
+ }
1486
+ ),
1487
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1488
+ import_preview.default,
1489
+ {
1490
+ ...{
1491
+ id: "after",
1492
+ states: {
1493
+ onChange: setResponse,
1494
+ options: messageStates,
1495
+ value: response
1496
+ }
1497
+ },
1498
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1499
+ Drawing,
1500
+ {
1501
+ ...{
1502
+ fonts
1503
+ },
1504
+ children: (0, import_form_page.afterRows)(after.order, response).map((key) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: rows[key].preview }, key))
1505
+ }
1506
+ )
1507
+ }
1508
+ )
1509
+ ]
1510
+ }
1511
+ );
1512
+ };
1513
+ const CampaignForm = ({
1514
+ actions,
1515
+ campaign,
1516
+ canManage,
1517
+ onOpened,
1518
+ open,
1519
+ organization,
1520
+ params,
1521
+ sections,
1522
+ style
1523
+ }) => {
1524
+ var _a, _b;
1525
+ const queryClient = (0, import_react_query.useQueryClient)();
1526
+ const modal = (0, import_hooks.useModal)({
1527
+ queryClient
1528
+ });
1529
+ const [dragging, setDragging] = (0, import_react.useState)(false);
1530
+ const parts = (0, import_form_page.formParts)(sections);
1531
+ const { after, age, customs, information, location, order } = parts;
1532
+ const steps = [information, ...customs, order].filter(Boolean);
1533
+ const lastId = (0, import_form_page.lastStepId)(steps);
1534
+ const phone = (0, import_form_page.asksPhone)(steps);
1535
+ const texts = (0, import_sms.textsOn)(organization);
1536
+ const currency = ((_a = organization == null ? void 0 : organization.defaults) == null ? void 0 : _a.currency) || "usd";
1537
+ 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]);
1538
+ (0, import_react.useEffect)(() => {
1539
+ if (open !== "footer") return;
1540
+ actions.footer({
1541
+ phone,
1542
+ texts
1543
+ });
1544
+ onOpened == null ? void 0 : onOpened();
1545
+ }, [open]);
1546
+ const choices = customs.map((section) => ({
1547
+ description: section.description,
1548
+ label: section.title,
1549
+ questions: (section.items || []).length,
1550
+ value: section.id
1551
+ }));
1552
+ const orderPlan = (0, import_drawbridge_utils.getPlanFeature)(organization == null ? void 0 : organization.plan, import_features.fields.order.key);
1553
+ const addOrder = {
1554
+ description: "Items to buy, last in the form",
1555
+ icon: import_shopping_bag.default,
1556
+ onClick: actions.addOrder,
1557
+ title: "Order",
1558
+ ...!orderPlan.granted && {
1559
+ description: orderPlan.message,
1560
+ disabled: true,
1561
+ locked: true,
1562
+ upgrade: ((_b = organization == null ? void 0 : organization.capabilities) == null ? void 0 : _b.billing) === "manage" ? "/organizations/" + (params == null ? void 0 : params.organization) + "/billing" : null
1563
+ }
1564
+ };
1565
+ const addSection = (before) => ({
1566
+ 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",
1567
+ disabled: customs.length >= import_form_page.MAX_SECTIONS,
1568
+ icon: import_rectangle_stack.default,
1569
+ onClick: () => actions.addSection(before),
1570
+ title: "Section"
1571
+ });
1572
+ const addAge = {
1573
+ description: "Asks their age before the form",
1574
+ icon: import_identification.default,
1575
+ onClick: actions.addAge,
1576
+ title: "Age gate"
1577
+ };
1578
+ const choose = (choices2) => () => modal.open({
1579
+ message: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1580
+ SectionChoices,
1581
+ {
1582
+ ...{
1583
+ choices: choices2,
1584
+ onClose: () => modal.close()
1585
+ }
1586
+ }
1587
+ ),
1588
+ title: "Add section"
1589
+ });
1590
+ const middle = (before) => canManage && customs.length < import_form_page.MAX_SECTIONS ? choose([addSection(before)]) : null;
1591
+ const step = (section, fonts, handle, collapsed) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1592
+ Step,
1593
+ {
1594
+ ...{
1595
+ actions,
1596
+ campaign,
1597
+ canManage,
1598
+ collapsed,
1599
+ currency,
1600
+ fonts,
1601
+ handle,
1602
+ last: section.id === lastId,
1603
+ params,
1604
+ phone,
1605
+ section,
1606
+ sections: choices,
1607
+ style,
1608
+ texts
1609
+ }
1610
+ }
1611
+ );
1612
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1613
+ import_provider_font.default,
1614
+ {
1615
+ ...style,
1616
+ children: (fonts) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1617
+ import_preview.SliderLayout,
1618
+ {
1619
+ ...{
1620
+ blank: dragging,
1621
+ last: lastId,
1622
+ slides: (0, import_form_page.formSlides)(parts, documents.length > 0),
1623
+ style
1624
+ },
1625
+ children: [
1626
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1627
+ Start,
1628
+ {
1629
+ ...{
1630
+ actions,
1631
+ campaign,
1632
+ fonts,
1633
+ style
1634
+ }
1635
+ }
1636
+ ),
1637
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Arrow, {}),
1638
+ location && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1639
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1640
+ Location,
1641
+ {
1642
+ ...{
1643
+ fonts,
1644
+ item: location,
1645
+ style
1646
+ }
1647
+ }
1648
+ ),
1649
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Arrow, {})
1650
+ ] }),
1651
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1652
+ import_card_section.default,
1653
+ {
1654
+ ...{
1655
+ className: "shrink-0",
1656
+ "data-guide": "section-fields",
1657
+ title: "Fields",
1658
+ variant: "gray"
1659
+ },
1660
+ children: [
1661
+ !age && canManage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1662
+ Join,
1663
+ {
1664
+ ...{
1665
+ label: "Add an age gate",
1666
+ onAdd: choose([addAge]),
1667
+ start: true
1668
+ }
1669
+ }
1670
+ ),
1671
+ age && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1672
+ AgeStep,
1673
+ {
1674
+ ...{
1675
+ actions,
1676
+ age,
1677
+ canManage,
1678
+ fonts,
1679
+ style
1680
+ }
1681
+ }
1682
+ ),
1683
+ information && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1684
+ age && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Join, {}),
1685
+ step(information, fonts)
1686
+ ] }),
1687
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1688
+ import_sortable.default,
1689
+ {
1690
+ ...{
1691
+ disabled: !canManage,
1692
+ handleClassName: GRIP,
1693
+ handleLabel: (section) => "Move " + section.title,
1694
+ items: customs,
1695
+ onDragging: setDragging,
1696
+ onSort: (sorted) => actions.reorderSections(sorted.map((section) => section.id)),
1697
+ renderItem: (section, _index, handle) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1698
+ dragging ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1699
+ "div",
1700
+ {
1701
+ ...{
1702
+ className: "h-4"
1703
+ }
1704
+ }
1705
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1706
+ Join,
1707
+ {
1708
+ ...{
1709
+ label: "Add a section here",
1710
+ onAdd: middle(section.id)
1711
+ }
1712
+ }
1713
+ ),
1714
+ step(section, fonts, handle, dragging)
1715
+ ] }),
1716
+ sortableElement: "div"
1717
+ }
1718
+ }
1719
+ ),
1720
+ order && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1721
+ dragging ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1722
+ "div",
1723
+ {
1724
+ ...{
1725
+ className: "h-4"
1726
+ }
1727
+ }
1728
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1729
+ Join,
1730
+ {
1731
+ ...{
1732
+ label: "Add a section here",
1733
+ onAdd: middle()
1734
+ }
1735
+ }
1736
+ ),
1737
+ step(order, fonts)
1738
+ ] }),
1739
+ !order && canManage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1740
+ Join,
1741
+ {
1742
+ ...{
1743
+ end: true,
1744
+ label: "Add an order or a section here",
1745
+ onAdd: choose([addOrder, addSection()])
1746
+ }
1747
+ }
1748
+ ),
1749
+ lastId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1750
+ Footer,
1751
+ {
1752
+ ...{
1753
+ actions,
1754
+ campaign,
1755
+ phone,
1756
+ texts
1757
+ }
1758
+ }
1759
+ ),
1760
+ documents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1761
+ Agreements,
1762
+ {
1763
+ ...{
1764
+ campaign,
1765
+ documents,
1766
+ fonts,
1767
+ style
1768
+ }
1769
+ }
1770
+ )
1771
+ ]
1772
+ }
1773
+ ),
1774
+ after && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1775
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Arrow, {}),
1776
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1777
+ After,
1778
+ {
1779
+ ...{
1780
+ actions,
1781
+ after,
1782
+ campaign,
1783
+ canManage,
1784
+ fonts,
1785
+ organization,
1786
+ params,
1787
+ style
1788
+ }
1789
+ }
1790
+ )
1791
+ ] })
1792
+ ]
1793
+ }
1794
+ )
1795
+ }
1796
+ );
1797
+ };
1798
+ var campaign_form_default = CampaignForm;