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