@drawbridge/components 0.1.36 → 0.1.37

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 (338) hide show
  1. package/components/styles.css +355 -68
  2. package/dist/advertisement.js +20 -15
  3. package/dist/advertisement.mjs +20 -15
  4. package/dist/bridge/advertisements.js +2 -4
  5. package/dist/bridge/advertisements.mjs +3 -5
  6. package/dist/bridge/fields.js +6 -89
  7. package/dist/bridge/fields.mjs +7 -89
  8. package/dist/bridge/form-subdomain-embed.js +1 -5
  9. package/dist/bridge/form-subdomain-embed.mjs +1 -5
  10. package/dist/bridge/form-subdomain-header.js +14 -21
  11. package/dist/bridge/form-subdomain-header.mjs +14 -20
  12. package/dist/bridge/form-subdomain-issue.js +8 -17
  13. package/dist/bridge/form-subdomain-issue.mjs +8 -17
  14. package/dist/bridge/form-subdomain-missions.js +52 -58
  15. package/dist/bridge/form-subdomain-missions.mjs +54 -60
  16. package/dist/bridge/form-subdomain.js +94 -223
  17. package/dist/bridge/form-subdomain.mjs +96 -222
  18. package/dist/bridge/lib/entry.js +6 -61
  19. package/dist/bridge/lib/entry.mjs +5 -51
  20. package/dist/bridge/lib/order.js +0 -23
  21. package/dist/bridge/lib/order.mjs +0 -20
  22. package/dist/bridge/template-layout.js +2 -5
  23. package/dist/bridge/template-layout.mjs +3 -6
  24. package/dist/bridge/template-modal.js +15 -82
  25. package/dist/bridge/template-modal.mjs +16 -83
  26. package/dist/bridge/template-preview.js +208 -0
  27. package/dist/bridge/template-preview.mjs +173 -0
  28. package/dist/bridge/template-subdomain-gallery.js +75 -126
  29. package/dist/bridge/template-subdomain-gallery.mjs +75 -122
  30. package/dist/bridge/template-subdomain.js +14 -16
  31. package/dist/bridge/template-subdomain.mjs +15 -17
  32. package/dist/dashboard/avatar.js +0 -5
  33. package/dist/dashboard/avatar.mjs +0 -5
  34. package/dist/dashboard/card-affiliate.js +2 -3
  35. package/dist/dashboard/card-affiliate.mjs +2 -3
  36. package/dist/dashboard/card-campaign-switch.js +9 -34
  37. package/dist/dashboard/card-campaign-switch.mjs +8 -32
  38. package/dist/dashboard/card-connection.js +91 -51
  39. package/dist/dashboard/card-connection.mjs +89 -50
  40. package/dist/dashboard/card-order.js +14 -6
  41. package/dist/dashboard/card-order.mjs +14 -6
  42. package/dist/dashboard/card-section.js +26 -69
  43. package/dist/dashboard/card-section.mjs +26 -65
  44. package/dist/dashboard/card-tile.js +35 -3
  45. package/dist/dashboard/card-tile.mjs +34 -3
  46. package/dist/dashboard/device.js +95 -0
  47. package/dist/dashboard/device.mjs +72 -0
  48. package/dist/dashboard/drawer-subscription.js +14 -52
  49. package/dist/dashboard/drawer-subscription.mjs +14 -52
  50. package/dist/dashboard/drawer.js +3 -20
  51. package/dist/dashboard/drawer.mjs +4 -21
  52. package/dist/dashboard/dropdown.js +2 -6
  53. package/dist/dashboard/dropdown.mjs +2 -6
  54. package/dist/dashboard/form-admin-subscription-custom.js +8 -72
  55. package/dist/dashboard/form-admin-subscription-custom.mjs +8 -72
  56. package/dist/dashboard/form-ai.js +148 -0
  57. package/dist/dashboard/form-ai.mjs +148 -1
  58. package/dist/dashboard/form-filters-analytics.js +62 -85
  59. package/dist/dashboard/form-filters-analytics.mjs +61 -85
  60. package/dist/dashboard/form-organization-brand.js +13 -30
  61. package/dist/dashboard/form-organization-brand.mjs +13 -30
  62. package/dist/dashboard/form-organization-campaign-advertisement.js +112 -38
  63. package/dist/dashboard/form-organization-campaign-advertisement.mjs +112 -38
  64. package/dist/dashboard/form-organization-campaign-agreement.js +210 -402
  65. package/dist/dashboard/form-organization-campaign-agreement.mjs +211 -398
  66. package/dist/dashboard/form-organization-campaign-field-list.js +425 -0
  67. package/dist/dashboard/form-organization-campaign-field-list.mjs +396 -0
  68. package/dist/dashboard/form-organization-campaign-field-number.js +7 -48
  69. package/dist/dashboard/form-organization-campaign-field-number.mjs +7 -48
  70. package/dist/dashboard/form-organization-campaign-field-select.js +4 -15
  71. package/dist/dashboard/form-organization-campaign-field-select.mjs +4 -15
  72. package/dist/dashboard/form-organization-campaign-field-text.js +6 -46
  73. package/dist/dashboard/form-organization-campaign-field-text.mjs +6 -46
  74. package/dist/dashboard/form-organization-campaign-field-textarea.js +13 -22
  75. package/dist/dashboard/form-organization-campaign-field-textarea.mjs +13 -22
  76. package/dist/dashboard/form-organization-campaign-integration-age.js +35 -2
  77. package/dist/dashboard/form-organization-campaign-integration-age.mjs +35 -2
  78. package/dist/dashboard/form-organization-campaign-integration-geocode.js +1 -4
  79. package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +1 -4
  80. package/dist/dashboard/form-organization-campaign-page-embed.js +1 -1
  81. package/dist/dashboard/form-organization-campaign-page-embed.mjs +1 -1
  82. package/dist/dashboard/form-organization-campaign-page-preview.js +2 -1
  83. package/dist/dashboard/form-organization-campaign-page-preview.mjs +2 -1
  84. package/dist/dashboard/form-organization-campaign-page-qr.js +2 -2
  85. package/dist/dashboard/form-organization-campaign-page-qr.mjs +2 -2
  86. package/dist/dashboard/form-organization-campaign-page-share.js +5 -5
  87. package/dist/dashboard/form-organization-campaign-page-share.mjs +5 -5
  88. package/dist/dashboard/form-organization-campaign-page-slug.js +3 -2
  89. package/dist/dashboard/form-organization-campaign-page-slug.mjs +3 -2
  90. package/dist/dashboard/form-organization-campaign-page.js +265 -168
  91. package/dist/dashboard/form-organization-campaign-page.mjs +266 -170
  92. package/dist/dashboard/form-organization-campaign-section.js +107 -125
  93. package/dist/dashboard/form-organization-campaign-section.mjs +107 -121
  94. package/dist/dashboard/form-organization-campaign.js +9 -119
  95. package/dist/dashboard/form-organization-campaign.mjs +9 -118
  96. package/dist/dashboard/form-organization-file-frame.js +1 -7
  97. package/dist/dashboard/form-organization-file-frame.mjs +1 -7
  98. package/dist/dashboard/form-organization-workflow.js +545 -589
  99. package/dist/dashboard/form-organization-workflow.mjs +545 -590
  100. package/dist/dashboard/form-organization.js +0 -22
  101. package/dist/dashboard/form-organization.mjs +0 -22
  102. package/dist/dashboard/form-verify-prize.js +34 -114
  103. package/dist/dashboard/form-verify-prize.mjs +34 -111
  104. package/dist/dashboard/google.js +1 -8
  105. package/dist/dashboard/google.mjs +1 -8
  106. package/dist/dashboard/input-array.js +0 -2
  107. package/dist/dashboard/input-array.mjs +0 -2
  108. package/dist/dashboard/input-combobox.js +9 -0
  109. package/dist/dashboard/input-combobox.mjs +9 -0
  110. package/dist/dashboard/input-date.js +8 -3
  111. package/dist/dashboard/input-date.mjs +8 -3
  112. package/dist/dashboard/input-editor.js +6 -17
  113. package/dist/dashboard/input-editor.mjs +6 -17
  114. package/dist/dashboard/input-fields.js +437 -287
  115. package/dist/dashboard/input-fields.mjs +436 -287
  116. package/dist/dashboard/input-file.js +2 -70
  117. package/dist/dashboard/input-file.mjs +2 -70
  118. package/dist/dashboard/input-font.js +55 -64
  119. package/dist/dashboard/input-font.mjs +55 -64
  120. package/dist/dashboard/input-resource.js +1 -4
  121. package/dist/dashboard/input-resource.mjs +1 -4
  122. package/dist/dashboard/item-row.js +92 -0
  123. package/dist/dashboard/item-row.mjs +63 -0
  124. package/dist/dashboard/lib/features.js +1 -1
  125. package/dist/dashboard/lib/features.mjs +1 -1
  126. package/dist/dashboard/lib/item-list.js +15 -0
  127. package/dist/dashboard/lib/item-list.mjs +14 -0
  128. package/dist/dashboard/lib/rail.js +17 -16
  129. package/dist/dashboard/lib/rail.mjs +16 -15
  130. package/dist/dashboard/lib/sms.js +2 -8
  131. package/dist/dashboard/lib/sms.mjs +1 -6
  132. package/dist/dashboard/list-resource.js +0 -2
  133. package/dist/dashboard/list-resource.mjs +0 -2
  134. package/dist/dashboard/menu.js +5 -54
  135. package/dist/dashboard/menu.mjs +5 -53
  136. package/dist/dashboard/modal.js +4 -19
  137. package/dist/dashboard/modal.mjs +5 -20
  138. package/dist/dashboard/order-sections.js +0 -4
  139. package/dist/dashboard/order-sections.mjs +0 -4
  140. package/dist/dashboard/preview.js +324 -838
  141. package/dist/dashboard/preview.mjs +324 -826
  142. package/dist/dashboard/provider-ui.js +12 -20
  143. package/dist/dashboard/provider-ui.mjs +13 -21
  144. package/dist/dashboard/recharts.js +28 -53
  145. package/dist/dashboard/recharts.mjs +28 -53
  146. package/dist/dashboard/swatch.js +0 -35
  147. package/dist/dashboard/swatch.mjs +0 -31
  148. package/dist/dashboard/table-contacts.js +10 -6
  149. package/dist/dashboard/table-contacts.mjs +10 -6
  150. package/dist/dashboard/table.js +3 -10
  151. package/dist/dashboard/table.mjs +3 -9
  152. package/dist/dashboard/template-dashboard.js +21 -13
  153. package/dist/dashboard/template-dashboard.mjs +21 -12
  154. package/dist/dashboard/template-rail.js +126 -198
  155. package/dist/dashboard/template-rail.mjs +125 -196
  156. package/dist/dashboard/template-socket.js +12 -0
  157. package/dist/dashboard/template-socket.mjs +12 -0
  158. package/dist/dashboard/template-ui.js +11 -20
  159. package/dist/dashboard/template-ui.mjs +13 -22
  160. package/dist/input-checkbox.js +1 -7
  161. package/dist/input-checkbox.mjs +1 -7
  162. package/dist/input-name.js +3 -3
  163. package/dist/input-name.mjs +3 -3
  164. package/dist/input-select.js +1 -3
  165. package/dist/input-select.mjs +1 -3
  166. package/dist/provider-font.js +3 -4
  167. package/dist/provider-font.mjs +3 -4
  168. package/dist/shared/badge.js +0 -15
  169. package/dist/shared/badge.mjs +0 -11
  170. package/dist/shared/carousel.js +7 -11
  171. package/dist/shared/carousel.mjs +7 -11
  172. package/dist/shared/lib/campaign.js +9 -3
  173. package/dist/shared/lib/campaign.mjs +9 -3
  174. package/dist/shared/lib/helpers.js +0 -24
  175. package/dist/shared/lib/helpers.mjs +0 -22
  176. package/dist/shared/lib/video.js +0 -6
  177. package/dist/shared/lib/video.mjs +0 -5
  178. package/dist/shared/sortable.js +10 -27
  179. package/dist/shared/sortable.mjs +10 -27
  180. package/dist/shared/tabs.js +1 -1
  181. package/dist/shared/tabs.mjs +1 -1
  182. package/dist/video.js +9 -127
  183. package/dist/video.mjs +11 -125
  184. package/package.json +20 -176
  185. package/types/bridge/fields.d.ts +1 -6
  186. package/types/bridge/form-subdomain-missions.d.ts +0 -2
  187. package/types/bridge/form-subdomain.d.ts +3 -62
  188. package/types/bridge/lib/entry.d.ts +7 -44
  189. package/types/bridge/lib/order.d.ts +2 -13
  190. package/types/bridge/subdomain-content.d.ts +0 -1
  191. package/types/bridge/template-preview.d.ts +10 -0
  192. package/types/bridge/template-subdomain-gallery.d.ts +1 -13
  193. package/types/dashboard/card-campaign-switch.d.ts +1 -20
  194. package/types/dashboard/card-connection.d.ts +8 -0
  195. package/types/dashboard/card-order.d.ts +2 -2
  196. package/types/dashboard/card-section.d.ts +1 -9
  197. package/types/dashboard/card-tile.d.ts +9 -4
  198. package/types/dashboard/device.d.ts +12 -0
  199. package/types/dashboard/drawer.d.ts +0 -3
  200. package/types/dashboard/form-ai.d.ts +17 -0
  201. package/types/dashboard/form-filters-analytics.d.ts +14 -0
  202. package/types/dashboard/form-organization-brand.d.ts +0 -3
  203. package/types/dashboard/form-organization-campaign-agreement.d.ts +10 -53
  204. package/types/dashboard/form-organization-campaign-field-list.d.ts +36 -0
  205. package/types/dashboard/form-organization-campaign-field-number.d.ts +1 -4
  206. package/types/dashboard/form-organization-campaign-field-select.d.ts +1 -6
  207. package/types/dashboard/form-organization-campaign-field-text.d.ts +1 -5
  208. package/types/dashboard/form-organization-campaign-field-textarea.d.ts +1 -4
  209. package/types/dashboard/form-organization-campaign-integration-age.d.ts +1 -2
  210. package/types/dashboard/form-organization-campaign-integration-geocode.d.ts +0 -2
  211. package/types/dashboard/form-organization-campaign-page.d.ts +15 -9
  212. package/types/dashboard/form-organization-campaign-section.d.ts +8 -24
  213. package/types/dashboard/form-organization-campaign.d.ts +0 -3
  214. package/types/dashboard/form-organization-workflow.d.ts +4 -3
  215. package/types/dashboard/form-organization.d.ts +2 -2
  216. package/types/dashboard/form-verify-prize.d.ts +3 -30
  217. package/types/dashboard/input-combobox.d.ts +2 -0
  218. package/types/dashboard/input-date.d.ts +2 -0
  219. package/types/dashboard/input-editor.d.ts +0 -9
  220. package/types/dashboard/input-fields.d.ts +5 -8
  221. package/types/dashboard/input-file.d.ts +0 -4
  222. package/types/dashboard/input-resource.d.ts +0 -1
  223. package/types/dashboard/item-row.d.ts +25 -0
  224. package/types/dashboard/lib/item-list.d.ts +5 -10
  225. package/types/dashboard/lib/rail.d.ts +1 -0
  226. package/types/dashboard/lib/sms.d.ts +0 -7
  227. package/types/dashboard/modal.d.ts +1 -3
  228. package/types/dashboard/preview.d.ts +10 -65
  229. package/types/dashboard/recharts.d.ts +0 -3
  230. package/types/dashboard/swatch.d.ts +0 -4
  231. package/types/dashboard/template-dashboard.d.ts +2 -3
  232. package/types/input-select.d.ts +0 -2
  233. package/types/shared/button.d.ts +1 -1
  234. package/types/shared/lib/helpers.d.ts +1 -22
  235. package/types/shared/lib/video.d.ts +0 -3
  236. package/types/shared/sortable.d.ts +0 -6
  237. package/types/video.d.ts +2 -18
  238. package/dist/bridge/form-subdomain-agreement.js +0 -165
  239. package/dist/bridge/form-subdomain-agreement.mjs +0 -132
  240. package/dist/dashboard/campaign-form.js +0 -1798
  241. package/dist/dashboard/campaign-form.mjs +0 -1769
  242. package/dist/dashboard/card-campaign-agreement.js +0 -172
  243. package/dist/dashboard/card-campaign-agreement.mjs +0 -139
  244. package/dist/dashboard/card-shortcut.js +0 -181
  245. package/dist/dashboard/card-shortcut.mjs +0 -152
  246. package/dist/dashboard/document-blocks.js +0 -305
  247. package/dist/dashboard/document-blocks.mjs +0 -270
  248. package/dist/dashboard/form-organization-campaign-advertisements.js +0 -374
  249. package/dist/dashboard/form-organization-campaign-advertisements.mjs +0 -345
  250. package/dist/dashboard/form-organization-campaign-design.js +0 -258
  251. package/dist/dashboard/form-organization-campaign-design.mjs +0 -223
  252. package/dist/dashboard/form-organization-campaign-field-item.js +0 -585
  253. package/dist/dashboard/form-organization-campaign-field-item.mjs +0 -552
  254. package/dist/dashboard/form-organization-campaign-field-skill.js +0 -359
  255. package/dist/dashboard/form-organization-campaign-field-skill.mjs +0 -330
  256. package/dist/dashboard/form-organization-campaign-footer.js +0 -178
  257. package/dist/dashboard/form-organization-campaign-footer.mjs +0 -149
  258. package/dist/dashboard/form-reposition.js +0 -396
  259. package/dist/dashboard/form-reposition.mjs +0 -359
  260. package/dist/dashboard/form-support.js +0 -189
  261. package/dist/dashboard/form-support.mjs +0 -160
  262. package/dist/dashboard/form-tests.js +0 -683
  263. package/dist/dashboard/form-tests.mjs +0 -646
  264. package/dist/dashboard/lib/ab-tests.js +0 -130
  265. package/dist/dashboard/lib/ab-tests.mjs +0 -94
  266. package/dist/dashboard/lib/focus.js +0 -93
  267. package/dist/dashboard/lib/focus.mjs +0 -69
  268. package/dist/dashboard/lib/form-page.js +0 -203
  269. package/dist/dashboard/lib/form-page.mjs +0 -155
  270. package/dist/dashboard/template-design.js +0 -564
  271. package/dist/dashboard/template-design.mjs +0 -531
  272. package/dist/dashboard/template-test-page.js +0 -436
  273. package/dist/dashboard/template-test-page.mjs +0 -407
  274. package/dist/dashboard/template-tests.js +0 -141
  275. package/dist/dashboard/template-tests.mjs +0 -112
  276. package/dist/dashboard/template-variant.js +0 -185
  277. package/dist/dashboard/template-variant.mjs +0 -156
  278. package/dist/icons/arrow-down-long.js +0 -47
  279. package/dist/icons/arrow-down-long.mjs +0 -28
  280. package/dist/icons/arrows-pointing-out.js +0 -46
  281. package/dist/icons/arrows-pointing-out.mjs +0 -27
  282. package/dist/icons/beaker.js +0 -46
  283. package/dist/icons/beaker.mjs +0 -27
  284. package/dist/icons/identification.js +0 -46
  285. package/dist/icons/identification.mjs +0 -27
  286. package/dist/icons/lifebuoy.js +0 -46
  287. package/dist/icons/lifebuoy.mjs +0 -27
  288. package/dist/icons/rectangle-group.js +0 -46
  289. package/dist/icons/rectangle-group.mjs +0 -27
  290. package/dist/icons/rectangle-stack.js +0 -46
  291. package/dist/icons/rectangle-stack.mjs +0 -27
  292. package/dist/icons/shopping-bag.js +0 -46
  293. package/dist/icons/shopping-bag.mjs +0 -27
  294. package/dist/icons/swatch.js +0 -46
  295. package/dist/icons/swatch.mjs +0 -27
  296. package/dist/icons/window.js +0 -46
  297. package/dist/icons/window.mjs +0 -27
  298. package/dist/icons/zoom-in.js +0 -46
  299. package/dist/icons/zoom-in.mjs +0 -27
  300. package/dist/input-answer.js +0 -60
  301. package/dist/input-answer.mjs +0 -27
  302. package/dist/shared/document-pieces.js +0 -295
  303. package/dist/shared/document-pieces.mjs +0 -260
  304. package/types/bridge/form-subdomain-agreement.d.ts +0 -27
  305. package/types/dashboard/campaign-form.d.ts +0 -42
  306. package/types/dashboard/card-campaign-agreement.d.ts +0 -26
  307. package/types/dashboard/card-shortcut.d.ts +0 -38
  308. package/types/dashboard/document-blocks.d.ts +0 -14
  309. package/types/dashboard/form-organization-campaign-advertisements.d.ts +0 -15
  310. package/types/dashboard/form-organization-campaign-design.d.ts +0 -46
  311. package/types/dashboard/form-organization-campaign-field-item.d.ts +0 -36
  312. package/types/dashboard/form-organization-campaign-field-skill.d.ts +0 -36
  313. package/types/dashboard/form-organization-campaign-footer.d.ts +0 -23
  314. package/types/dashboard/form-reposition.d.ts +0 -29
  315. package/types/dashboard/form-support.d.ts +0 -14
  316. package/types/dashboard/form-tests.d.ts +0 -78
  317. package/types/dashboard/lib/ab-tests.d.ts +0 -50
  318. package/types/dashboard/lib/escape.d.ts +0 -4
  319. package/types/dashboard/lib/focus.d.ts +0 -16
  320. package/types/dashboard/lib/form-page.d.ts +0 -25
  321. package/types/dashboard/template-design.d.ts +0 -30
  322. package/types/dashboard/template-test-page.d.ts +0 -69
  323. package/types/dashboard/template-tests.d.ts +0 -30
  324. package/types/dashboard/template-variant.d.ts +0 -18
  325. package/types/icons/arrow-down-long.d.ts +0 -5
  326. package/types/icons/arrows-pointing-out.d.ts +0 -5
  327. package/types/icons/beaker.d.ts +0 -5
  328. package/types/icons/identification.d.ts +0 -5
  329. package/types/icons/lifebuoy.d.ts +0 -5
  330. package/types/icons/rectangle-group.d.ts +0 -5
  331. package/types/icons/rectangle-stack.d.ts +0 -5
  332. package/types/icons/shopping-bag.d.ts +0 -5
  333. package/types/icons/swatch.d.ts +0 -5
  334. package/types/icons/window.d.ts +0 -5
  335. package/types/icons/zoom-in.d.ts +0 -5
  336. package/types/input-answer.d.ts +0 -15
  337. package/types/shared/document-pieces.d.ts +0 -34
  338. package/types/shared/lib/motion.d.ts +0 -2
@@ -29,11 +29,12 @@ var form_organization_workflow_exports = {};
29
29
  __export(form_organization_workflow_exports, {
30
30
  FormOrganizationWorkflowEdit: () => FormOrganizationWorkflowEdit,
31
31
  RESPONSE: () => RESPONSE,
32
+ SAMPLE: () => SAMPLE,
32
33
  TextPreview: () => TextPreview,
33
34
  firstEntryOnly: () => firstEntryOnly,
34
35
  hasStepOptions: () => hasStepOptions,
35
36
  issueRow: () => issueRow,
36
- listsMembers: () => listsMembers,
37
+ lockedStepOption: () => lockedStepOption,
37
38
  memberOptions: () => memberOptions,
38
39
  partToStart: () => partToStart,
39
40
  pickedCopy: () => pickedCopy,
@@ -46,8 +47,8 @@ __export(form_organization_workflow_exports, {
46
47
  stepReason: () => stepReason,
47
48
  stepRow: () => stepRow,
48
49
  stepVariables: () => stepVariables,
49
- useEmailPreview: () => useEmailPreview,
50
50
  useStepPrefill: () => useStepPrefill,
51
+ webhookSample: () => webhookSample,
51
52
  workflowSchema: () => workflowSchema
52
53
  });
53
54
  module.exports = __toCommonJS(form_organization_workflow_exports);
@@ -56,7 +57,6 @@ var import_image = __toESM(require("next/image"));
56
57
  var import_link = __toESM(require("./link"));
57
58
  var import_react = require("react");
58
59
  var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
59
- var import_features = require("@drawbridge/drawbridge-utils/features");
60
60
  var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
61
61
  var import_html = require("@drawbridge/drawbridge-utils/html");
62
62
  var import_form = require("../shared/lib/form");
@@ -81,9 +81,9 @@ var import_preview = __toESM(require("./preview"));
81
81
  var import_card_task = __toESM(require("./card-task"));
82
82
  var import_loader = require("../shared/loader");
83
83
  var import_sms = require("./lib/sms");
84
+ var import_lock = __toESM(require("../icons/lock"));
84
85
  var import_trash = __toESM(require("../icons/trash"));
85
86
  var import_button = __toESM(require("../shared/button"));
86
- var import_helpers = require("../shared/lib/helpers");
87
87
  const emailSteps = ["step.email.send"];
88
88
  const teamSteps = ["step.email.notify"];
89
89
  const messageSteps = [...emailSteps, "step.sms.send"];
@@ -114,10 +114,6 @@ const memberParams = {
114
114
  createdAt: -1
115
115
  }
116
116
  };
117
- const listsMembers = (organization) => {
118
- var _a;
119
- return (0, import_helpers.hasCapability)(organization, "members") && ((0, import_drawbridge_utils.getPlanFeature)(organization == null ? void 0 : organization.plan, import_features.organization.members.key).granted || ((_a = organization == null ? void 0 : organization.totals) == null ? void 0 : _a.members) > 0);
120
- };
121
117
  const memberOptions = (organization) => ({
122
118
  queryKey: ["organization-members", organization, "options"],
123
119
  queryFn: async () => {
@@ -130,11 +126,11 @@ const memberOptions = (organization) => ({
130
126
  },
131
127
  staleTime: Infinity
132
128
  });
133
- const useOrganizationMembers = (organization, listed) => {
129
+ const useOrganizationMembers = (organization) => {
134
130
  var _a;
135
131
  const members = (0, import_react_query.useQuery)({
136
132
  ...memberOptions(organization),
137
- enabled: Boolean(organization) && listed
133
+ enabled: Boolean(organization)
138
134
  });
139
135
  return {
140
136
  items: ((_a = members.data) == null ? void 0 : _a.items) || [],
@@ -187,6 +183,15 @@ const stepReason = ({ entry, saved = [], type }) => {
187
183
  var _a, _b;
188
184
  return ((_a = ((entry == null ? void 0 : entry.steps) || []).find((step) => (step == null ? void 0 : step.value) === type && (step == null ? void 0 : step.reason))) == null ? void 0 : _a.reason) || ((_b = saved.find((step) => (step == null ? void 0 : step.type) === type && (step == null ? void 0 : step.reason))) == null ? void 0 : _b.reason) || null;
189
185
  };
186
+ const lockedStepOption = (step, current) => (step == null ? void 0 : step.locked) && step.value !== current ? {
187
+ badge: {
188
+ text: step.locked
189
+ },
190
+ disabled: true,
191
+ element: void 0,
192
+ icon: import_lock.default,
193
+ props: {}
194
+ } : {};
190
195
  const hasStepOptions = (options = []) => options.some((option) => Boolean(option == null ? void 0 : option.value) && !(option == null ? void 0 : option.disabled));
191
196
  const responseStart = (number) => ({
192
197
  email: {
@@ -397,10 +402,9 @@ const workflowSchema = import_yup.default.object({
397
402
  )
398
403
  });
399
404
  const useEmailPreview = ({ campaign, event, message, organization, subject, text, type }) => {
400
- const queryClient = (0, import_react_query.useQueryClient)();
401
405
  const asked = JSON.stringify(teamSteps.includes(type) ? { type } : { message, subject, text });
402
406
  const [settled, setSettled] = (0, import_react.useState)(asked);
403
- const held = ["workflow-email-preview-shown", organization, campaign, event, type || null];
407
+ const last = (0, import_react.useRef)();
404
408
  (0, import_react.useEffect)(() => {
405
409
  const timer = setTimeout(() => setSettled(asked), 400);
406
410
  return () => clearTimeout(timer);
@@ -414,33 +418,22 @@ const useEmailPreview = ({ campaign, event, message, organization, subject, text
414
418
  endpoint: "/organization/" + organization + "/campaign/" + campaign + "/workflow/" + event + "/preview",
415
419
  method: "POST"
416
420
  });
417
- queryClient.setQueryData(held, result);
418
421
  return result;
419
422
  },
420
423
  // Stale at once ( the dashboard's default is never ): the key holds the
421
424
  // step's copy only, and the placeholder under it is the campaign's, so
422
425
  // each visit to the trigger page asks again (Asana 1217773117236699).
423
426
  queryKey: ["workflow-email-preview", organization, campaign, event, settled],
424
- retry: (count, error) => count < 5 && (0, import_fetch.isTransientError)(error),
425
427
  staleTime: 0
426
428
  });
427
- return preview.data || queryClient.getQueryData(held);
429
+ if (preview.data) last.current = preview.data;
430
+ return last.current;
428
431
  };
429
- const Shown = ({ children, off }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
430
- "div",
431
- {
432
- ...{
433
- className: "mx-auto w-full max-w-[600px] px-6 space-y-4" + (off ? " opacity-50" : "")
434
- },
435
- children
436
- }
437
- );
438
432
  const EmailStepCard = ({
439
433
  card,
440
434
  children,
441
435
  control,
442
436
  off,
443
- slide,
444
437
  email: {
445
438
  campaign,
446
439
  event,
@@ -455,14 +448,12 @@ const EmailStepCard = ({
455
448
  name: [name + ".subject", name + ".message", name + ".text"]
456
449
  });
457
450
  const preview = useEmailPreview({ campaign, event, message, organization, subject, text, type });
458
- const target = (0, import_preview.useCard)(slide);
459
451
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
460
452
  import_card_section.default,
461
453
  {
462
454
  ...{
463
455
  ...card,
464
- ...target.props,
465
- className: "relative shrink-0" + target.className
456
+ columns: 2
466
457
  },
467
458
  children: [
468
459
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
@@ -496,36 +487,46 @@ const EmailStepCard = ({
496
487
  }
497
488
  ),
498
489
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
499
- import_preview.default,
490
+ "div",
500
491
  {
501
492
  ...{
502
- id: slide
493
+ className: off ? "opacity-50" : ""
503
494
  },
504
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
505
- Shown,
495
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_preview.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
496
+ "iframe",
506
497
  {
507
498
  ...{
508
- off
509
- },
510
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
511
- import_preview.Mail,
512
- {
513
- ...{
514
- // The rendered email, as a mail app shows it.
515
- html: preview == null ? void 0 : preview.html,
516
- title
517
- }
518
- }
519
- )
499
+ // The rendered email, as a mail app shows it.
500
+ className: "block w-full h-full border-0 bg-white",
501
+ srcDoc: (preview == null ? void 0 : preview.html) || "",
502
+ title
503
+ }
520
504
  }
521
- )
505
+ ) })
522
506
  }
523
507
  )
524
508
  ]
525
509
  }
526
510
  );
527
511
  };
528
- const TextPreview = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "p-6 font-sans", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "max-w-xs px-4 py-3 rounded-2xl rounded-bl-sm bg-white text-black break-words", children }) });
512
+ const SAMPLE = {
513
+ email: "sam.rivera@example.com",
514
+ name: "Sam Rivera",
515
+ phone: "+14165550142"
516
+ };
517
+ const webhookSample = ({ campaign }) => JSON.stringify({
518
+ campaign: {
519
+ id: (campaign == null ? void 0 : campaign.id) || "cmp_sample",
520
+ title: (campaign == null ? void 0 : campaign.title) || "Your campaign"
521
+ },
522
+ email: SAMPLE.email,
523
+ id: "lead_sample",
524
+ name: SAMPLE.name,
525
+ phone: {
526
+ number: SAMPLE.phone
527
+ }
528
+ }, null, 2);
529
+ const TextPreview = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "p-6 font-sans", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "max-w-xs px-4 py-3 rounded-2xl rounded-bl-sm bg-gray-light text-black break-words", children }) });
529
530
  const StepPreview = ({ campaign, control, image, name, organization, type }) => {
530
531
  const [message] = (0, import_form.useWatch)({
531
532
  control,
@@ -538,20 +539,23 @@ const StepPreview = ({ campaign, control, image, name, organization, type }) =>
538
539
  (campaign == null ? void 0 : campaign.awarding) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mt-2 px-2 py-1 rounded border border-dashed border-gray-dark text-gray-dark", children: "The entrant's missions appear here" }),
539
540
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mt-2", children: "Reply STOP to opt out" })
540
541
  ] });
541
- if (type === "step.webhook.send") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_preview.NoPreview, {});
542
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_preview.NoPreview, { children: image && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
543
- import_image.default,
544
- {
545
- ...{
546
- alt: "",
547
- className: "w-12 h-12 object-contain",
548
- height: 48,
549
- src: image,
550
- unoptimized: true,
551
- width: 48
542
+ if (type === "step.webhook.send") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { className: "p-6 text-xs whitespace-pre-wrap break-all font-mono", children: "X-Drawbridge-Signature: t=\u2026,v1=\u2026\n\n" + webhookSample({ campaign }) });
543
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "min-h-screen flex flex-col items-center justify-center gap-3 p-6 text-gray-dark", children: [
544
+ image && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
545
+ import_image.default,
546
+ {
547
+ ...{
548
+ alt: "",
549
+ className: "w-12 h-12 object-contain",
550
+ height: 48,
551
+ src: image,
552
+ unoptimized: true,
553
+ width: 48
554
+ }
552
555
  }
553
- }
554
- ) });
556
+ ),
557
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "No preview available" })
558
+ ] });
555
559
  };
556
560
  const LeadEmailNote = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
557
561
  "p",
@@ -597,7 +601,6 @@ const ResponseStepCard = ({
597
601
  formState,
598
602
  off,
599
603
  onChecking,
600
- slide,
601
604
  response: {
602
605
  autoResponse,
603
606
  campaign,
@@ -606,8 +609,6 @@ const ResponseStepCard = ({
606
609
  id,
607
610
  index,
608
611
  organization,
609
- picked,
610
- setPicked,
611
612
  settings,
612
613
  title,
613
614
  variables
@@ -615,6 +616,7 @@ const ResponseStepCard = ({
615
616
  setValue
616
617
  }) => {
617
618
  var _a, _b, _c, _d, _e;
619
+ const [picked, setPicked] = (0, import_react.useState)("email");
618
620
  const name = `steps.${index}`;
619
621
  const parts = responseParts({ autoResponse, campaign, organization, settings });
620
622
  const shown = parts.sms.absent ? "email" : parts.email.hidden ? "sms" : parts.sms.hidden ? "email" : picked;
@@ -628,7 +630,6 @@ const ResponseStepCard = ({
628
630
  text: (_c = settings == null ? void 0 : settings.email) == null ? void 0 : _c.text
629
631
  });
630
632
  const brand = (0, import_sms.smsBrandLine)(title, (_d = settings == null ? void 0 : settings.sms) == null ? void 0 : _d.message);
631
- const target = (0, import_preview.useCard)(slide);
632
633
  const partSwitch = ({ label, message, other, part }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
633
634
  import_form.Controller,
634
635
  {
@@ -668,8 +669,7 @@ const ResponseStepCard = ({
668
669
  {
669
670
  ...{
670
671
  ...card,
671
- ...target.props,
672
- className: "relative shrink-0" + target.className
672
+ columns: 2
673
673
  },
674
674
  children: [
675
675
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
@@ -807,29 +807,29 @@ const ResponseStepCard = ({
807
807
  }
808
808
  ),
809
809
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
810
- import_preview.default,
810
+ "div",
811
811
  {
812
812
  ...{
813
- id: slide,
814
- ...!parts.email.hidden && !parts.sms.hidden && {
815
- states: {
816
- onChange: setPicked,
817
- options: RESPONSE_STATES,
818
- value: shown
819
- }
820
- }
813
+ className: off || !parts[shown].on ? "opacity-50" : ""
821
814
  },
822
815
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
823
- Shown,
816
+ import_preview.default,
824
817
  {
825
818
  ...{
826
- off: off || !parts[shown].on
819
+ ...!parts.email.hidden && !parts.sms.hidden && {
820
+ states: {
821
+ onChange: setPicked,
822
+ options: RESPONSE_STATES,
823
+ value: shown
824
+ }
825
+ }
827
826
  },
828
827
  children: shown === "email" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
829
- import_preview.Mail,
828
+ "iframe",
830
829
  {
831
830
  ...{
832
- html: preview == null ? void 0 : preview.html,
831
+ className: "block w-full h-full border-0 bg-white",
832
+ srcDoc: (preview == null ? void 0 : preview.html) || "",
833
833
  title: "Auto response"
834
834
  }
835
835
  }
@@ -863,54 +863,6 @@ const ResponseStepCard = ({
863
863
  }
864
864
  );
865
865
  };
866
- const PlainStepCard = ({
867
- children,
868
- control,
869
- off,
870
- preview,
871
- slide,
872
- ...card
873
- }) => {
874
- const target = (0, import_preview.useCard)(slide);
875
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
876
- import_card_section.default,
877
- {
878
- ...{
879
- ...card,
880
- ...target.props,
881
- className: "relative shrink-0" + target.className
882
- },
883
- children: [
884
- children,
885
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
886
- import_preview.default,
887
- {
888
- ...{
889
- id: slide
890
- },
891
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
892
- Shown,
893
- {
894
- ...{
895
- off
896
- },
897
- children: preview ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
898
- StepPreview,
899
- {
900
- ...{
901
- control,
902
- ...preview
903
- }
904
- }
905
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_preview.NoPreview, {})
906
- }
907
- )
908
- }
909
- )
910
- ]
911
- }
912
- );
913
- };
914
866
  const StepCard = ({
915
867
  children,
916
868
  control,
@@ -922,7 +874,6 @@ const StepCard = ({
922
874
  preview,
923
875
  response,
924
876
  setValue,
925
- slide,
926
877
  ...card
927
878
  }) => response ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
928
879
  ResponseStepCard,
@@ -935,8 +886,7 @@ const StepCard = ({
935
886
  off,
936
887
  onChecking,
937
888
  response,
938
- setValue,
939
- slide
889
+ setValue
940
890
  },
941
891
  children
942
892
  }
@@ -947,22 +897,37 @@ const StepCard = ({
947
897
  card,
948
898
  control,
949
899
  email,
950
- off,
951
- slide
900
+ off
952
901
  },
953
902
  children
954
903
  }
955
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
956
- PlainStepCard,
904
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
905
+ import_card_section.default,
957
906
  {
958
907
  ...{
959
908
  ...card,
960
- control,
961
- off,
962
- preview,
963
- slide
909
+ columns: preview ? 2 : 1
964
910
  },
965
- children
911
+ children: [
912
+ children,
913
+ preview && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
914
+ "div",
915
+ {
916
+ ...{
917
+ className: off ? "opacity-50" : ""
918
+ },
919
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_preview.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
920
+ StepPreview,
921
+ {
922
+ ...{
923
+ control,
924
+ ...preview
925
+ }
926
+ }
927
+ ) })
928
+ }
929
+ )
930
+ ]
966
931
  }
967
932
  );
968
933
  const FormOrganizationWorkflowEdit = ({
@@ -974,10 +939,9 @@ const FormOrganizationWorkflowEdit = ({
974
939
  }) => {
975
940
  var _a, _b, _c, _d, _e, _f, _g, _h;
976
941
  const event = (_a = values == null ? void 0 : values.trigger) == null ? void 0 : _a.event;
942
+ const { items: memberItems, loading: membersLoading } = useOrganizationMembers(values == null ? void 0 : values.organization);
977
943
  const queryClient = (0, import_react_query.useQueryClient)();
978
944
  const organizationData = queryClient.getQueryData(["organization", values == null ? void 0 : values.organization]);
979
- const membersListed = listsMembers(organizationData);
980
- const { items: memberItems, loading: membersLoading } = useOrganizationMembers(values == null ? void 0 : values.organization, membersListed);
981
945
  const ownerEmail = organizationData.owner.email;
982
946
  const smsActive = (0, import_sms.smsNumberActive)(organizationData);
983
947
  const campaignData = queryClient.getQueryData(["campaign", values == null ? void 0 : values.campaign]);
@@ -998,7 +962,6 @@ const FormOrganizationWorkflowEdit = ({
998
962
  const commerceDomain = ((_d = (_c = commerceConnection.data) == null ? void 0 : _c.source) == null ? void 0 : _d.domain) || ((_f = (_e = commerceConnection.data) == null ? void 0 : _e.settings) == null ? void 0 : _f.domain) || null;
999
963
  const defaultSteps = ((values == null ? void 0 : values.steps) || []).map((s) => stepRow(s, memberItems));
1000
964
  const [checking, setChecking] = (0, import_react.useState)({});
1001
- const [responsePart, setResponsePart] = (0, import_react.useState)("email");
1002
965
  const checkingAny = Object.values(checking).some(Boolean);
1003
966
  const onChecking = (0, import_react.useCallback)(
1004
967
  (id, value) => setChecking(
@@ -1006,13 +969,16 @@ const FormOrganizationWorkflowEdit = ({
1006
969
  ),
1007
970
  []
1008
971
  );
1009
- const { control, formState, getValues, handleSubmit, reset, setValue, watch } = (0, import_form.useForm)({
972
+ const { control, formState, getValues, handleSubmit, setValue } = (0, import_form.useForm)({
1010
973
  values: {
1011
974
  steps: defaultSteps
1012
975
  },
1013
976
  resolver: (0, import_yup.resolver)(workflowSchema)
1014
977
  });
1015
- const watchedSteps = watch("steps");
978
+ const watchedSteps = (0, import_form.useWatch)({
979
+ control,
980
+ name: "steps"
981
+ });
1016
982
  const issueIndex = issueRow({ issue: values == null ? void 0 : values.issue, steps: watchedSteps || [] });
1017
983
  const getAvailableVariables = (index) => stepVariables(catalog, watchedSteps, index);
1018
984
  const loading = membersLoading || commerceConnection.isLoading;
@@ -1022,7 +988,7 @@ const FormOrganizationWorkflowEdit = ({
1022
988
  return [
1023
989
  { key: "Select a step", value: "" },
1024
990
  ...((catalog == null ? void 0 : catalog.steps) || []).filter((step) => !usedTypes.includes(step.value)).sort((a, b) => String(a.key).localeCompare(String(b.key))).map((step) => {
1025
- var _a2;
991
+ var _a2, _b2;
1026
992
  return {
1027
993
  ...step,
1028
994
  // Option values must be unique per catalog entry, not per step
@@ -1088,7 +1054,8 @@ const FormOrganizationWorkflowEdit = ({
1088
1054
  text: "Owner access only"
1089
1055
  },
1090
1056
  disabled: true
1091
- } : {}
1057
+ } : {},
1058
+ ...lockedStepOption(step, (_b2 = watchedSteps == null ? void 0 : watchedSteps[index]) == null ? void 0 : _b2.type)
1092
1059
  };
1093
1060
  })
1094
1061
  ];
@@ -1200,7 +1167,6 @@ const FormOrganizationWorkflowEdit = ({
1200
1167
  setValue("steps." + index + ".connectionId", step.connectionId || "");
1201
1168
  setValue("steps." + index + ".slug", step.slug || "");
1202
1169
  });
1203
- reset(getValues());
1204
1170
  onSuccess(response);
1205
1171
  } catch (error) {
1206
1172
  onError(error);
@@ -1209,13 +1175,6 @@ const FormOrganizationWorkflowEdit = ({
1209
1175
  if (loading) {
1210
1176
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loader.LoaderDynamic, {});
1211
1177
  }
1212
- const slides = (watchedSteps || []).map((step, index) => {
1213
- var _a2;
1214
- return {
1215
- id: "step-" + index,
1216
- title: ["Step " + (index + 1), (_a2 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === (step == null ? void 0 : step.type))) == null ? void 0 : _a2.key].filter(Boolean).join(" \xB7 ")
1217
- };
1218
- });
1219
1178
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1220
1179
  import_form2.default,
1221
1180
  {
@@ -1223,488 +1182,484 @@ const FormOrganizationWorkflowEdit = ({
1223
1182
  className: "relative w-full",
1224
1183
  onSubmit: handleSubmit(onSubmit)
1225
1184
  },
1226
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1227
- import_preview.SliderLayout,
1185
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1186
+ import_fieldset.default,
1228
1187
  {
1229
1188
  ...{
1230
- plain: true,
1231
- slides
1189
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
1232
1190
  },
1233
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1234
- import_fieldset.default,
1235
- {
1236
- ...{
1237
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
1238
- },
1239
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1240
- import_card_section.default,
1241
- {
1242
- ...{
1243
- title: "Sequence",
1244
- variant: "gray"
1245
- },
1246
- children: [
1247
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1248
- import_input_group.default,
1249
- {
1250
- ...{
1251
- error: (_h = (_g = formState == null ? void 0 : formState.errors) == null ? void 0 : _g.steps) == null ? void 0 : _h.message,
1252
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1253
- import_input_array.InputArraySortable,
1191
+ children: [
1192
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1193
+ import_card_task.default,
1194
+ {
1195
+ ...{
1196
+ message: "Workflows run sequences that increase action usage.",
1197
+ title: "Workflows count towards actions",
1198
+ type: "warning"
1199
+ }
1200
+ }
1201
+ ),
1202
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1203
+ import_card_section.default,
1204
+ {
1205
+ ...{
1206
+ "data-trigger": true,
1207
+ title: "Trigger"
1208
+ },
1209
+ children: [
1210
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: values == null ? void 0 : values.title }),
1211
+ (values == null ? void 0 : values.description) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1212
+ "p",
1213
+ {
1214
+ ...{
1215
+ className: "text-sm text-gray-dark"
1216
+ },
1217
+ children: values.description
1218
+ }
1219
+ )
1220
+ ]
1221
+ }
1222
+ ),
1223
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1224
+ import_input_group.default,
1225
+ {
1226
+ ...{
1227
+ error: (_h = (_g = formState == null ? void 0 : formState.errors) == null ? void 0 : _g.steps) == null ? void 0 : _h.message,
1228
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1229
+ import_input_array.InputArraySortable,
1230
+ {
1231
+ ...{
1232
+ control,
1233
+ empty: null,
1234
+ name: "steps",
1235
+ renderButton: (append) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1236
+ import_input_array.InputArrayButton,
1237
+ {
1238
+ ...{
1239
+ disabled: !canAddStep,
1240
+ onClick: () => append(stepRow()),
1241
+ text: "Add step"
1242
+ }
1243
+ }
1244
+ )
1245
+ },
1246
+ children: ({ field, handle, index, remove }) => {
1247
+ var _a2;
1248
+ const step = (watchedSteps == null ? void 0 : watchedSteps[index]) || field;
1249
+ const parts = step.type === RESPONSE && responseParts({
1250
+ autoResponse: values == null ? void 0 : values.autoResponse,
1251
+ campaign: values == null ? void 0 : values.campaign,
1252
+ organization: values == null ? void 0 : values.organization,
1253
+ settings: step.settings
1254
+ });
1255
+ const stepOptions = getStepOptions(index);
1256
+ return (
1257
+ // @story workflows/edit
1258
+ // EACH STEP IS ITS OWN CARD in the flow under the Trigger card,
1259
+ // edited in place: the drag handle left of Step N, as every
1260
+ // sortable list has it, then its connection badge and Remove
1261
+ // in the card's head, its fields in the body.
1262
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1263
+ StepCard,
1254
1264
  {
1255
1265
  ...{
1256
1266
  control,
1257
- empty: null,
1258
- // Each handle says which step it moves.
1259
- handleLabel: (field) => {
1260
- var _a2;
1261
- return "Move " + (((_a2 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === (field == null ? void 0 : field.type))) == null ? void 0 : _a2.key) || "step");
1262
- },
1263
- name: "steps",
1264
- renderButton: (append) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1265
- import_input_array.InputArrayButton,
1266
- {
1267
- ...{
1268
- disabled: !canAddStep,
1269
- onClick: () => append(stepRow()),
1270
- text: "Add step"
1271
- }
1272
- }
1273
- )
1274
- },
1275
- children: ({ field, handle, index, remove }) => {
1276
- var _a2;
1277
- const step = (watchedSteps == null ? void 0 : watchedSteps[index]) || field;
1278
- const parts = step.type === RESPONSE && responseParts({
1267
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting),
1268
+ formState,
1269
+ onChecking,
1270
+ setValue,
1271
+ // @story workflows/auto-response
1272
+ response: step.type === RESPONSE && {
1279
1273
  autoResponse: values == null ? void 0 : values.autoResponse,
1280
1274
  campaign: values == null ? void 0 : values.campaign,
1275
+ enabled: step.enabled,
1276
+ event,
1277
+ id: field.id,
1278
+ index,
1281
1279
  organization: values == null ? void 0 : values.organization,
1282
- settings: step.settings
1283
- });
1284
- const stepOptions = getStepOptions(index);
1285
- return (
1286
- // @story workflows/edit
1287
- // EACH STEP IS ITS OWN CARD in the flow under the Trigger card,
1288
- // edited in place: the drag handle left of Step N, as every
1289
- // sortable list has it, then its connection badge and Remove
1290
- // in the card's head, its fields in the body.
1291
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1292
- StepCard,
1293
- {
1294
- ...{
1295
- control,
1296
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting),
1297
- formState,
1298
- onChecking,
1299
- setValue,
1300
- // @story workflows/auto-response
1301
- response: step.type === RESPONSE && {
1302
- autoResponse: values == null ? void 0 : values.autoResponse,
1303
- campaign: values == null ? void 0 : values.campaign,
1304
- enabled: step.enabled,
1305
- event,
1306
- id: field.id,
1307
- index,
1308
- organization: values == null ? void 0 : values.organization,
1309
- picked: responsePart,
1310
- setPicked: setResponsePart,
1311
- settings: step.settings,
1312
- title: organizationData == null ? void 0 : organizationData.title,
1313
- variables: getAvailableVariables(index)
1314
- },
1315
- // @story workflows/send-email
1316
- // A Send email step shows its email beside its form.
1317
- off: step.enabled === false,
1318
- // Every other step with a type has its preview too.
1319
- preview: step.type && !renderedSteps.includes(step.type) && {
1320
- campaign: campaignData,
1321
- image: ((_a2 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a2.image) || null,
1322
- name: `steps.${index}`,
1323
- organization: organizationData,
1324
- type: step.type
1325
- },
1326
- // Send email and Email notification show the email the api renders.
1327
- email: renderedSteps.includes(step.type) && {
1328
- campaign: values == null ? void 0 : values.campaign,
1329
- event,
1330
- name: `steps.${index}`,
1331
- organization: values == null ? void 0 : values.organization,
1332
- title: emailSteps.includes(step.type) ? "Send email" : "Email notification",
1333
- type: step.type
1280
+ settings: step.settings,
1281
+ title: organizationData == null ? void 0 : organizationData.title,
1282
+ variables: getAvailableVariables(index)
1283
+ },
1284
+ // @story workflows/send-email
1285
+ // A Send email step shows its email beside its form.
1286
+ off: step.enabled === false,
1287
+ // Every other step with a type has its preview too.
1288
+ preview: step.type && !renderedSteps.includes(step.type) && {
1289
+ campaign: campaignData,
1290
+ image: ((_a2 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a2.image) || null,
1291
+ name: `steps.${index}`,
1292
+ organization: organizationData,
1293
+ type: step.type
1294
+ },
1295
+ // Send email and Email notification show the email the api renders.
1296
+ email: renderedSteps.includes(step.type) && {
1297
+ campaign: values == null ? void 0 : values.campaign,
1298
+ event,
1299
+ name: `steps.${index}`,
1300
+ organization: values == null ? void 0 : values.organization,
1301
+ title: emailSteps.includes(step.type) ? "Send email" : "Email notification",
1302
+ type: step.type
1303
+ },
1304
+ cta: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1305
+ "span",
1306
+ {
1307
+ ...{
1308
+ className: "flex items-center gap-2"
1309
+ },
1310
+ children: [
1311
+ renderStepBadge(step, index),
1312
+ !lockedStep(index) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1313
+ import_input_array.InputArrayControl,
1314
+ {
1315
+ ...{
1316
+ onClick: () => remove(index),
1317
+ icon: import_trash.default
1318
+ }
1334
1319
  },
1335
- cta: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1336
- "span",
1337
- {
1338
- ...{
1339
- className: "flex items-center gap-2"
1340
- },
1341
- children: [
1342
- renderStepBadge(step, index),
1343
- !lockedStep(index) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1344
- import_input_array.InputArrayControl,
1345
- {
1346
- ...{
1347
- onClick: () => remove(index),
1348
- icon: import_trash.default
1349
- }
1350
- },
1351
- "remove"
1352
- ),
1353
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1354
- import_form.Controller,
1320
+ "remove"
1321
+ ),
1322
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1323
+ import_form.Controller,
1324
+ {
1325
+ ...{
1326
+ control,
1327
+ name: `steps.${index}.enabled`,
1328
+ render: ({ field: { onChange, value } }) => {
1329
+ var _a3;
1330
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1331
+ import_input_switch.default,
1355
1332
  {
1356
1333
  ...{
1357
- control,
1358
- name: `steps.${index}.enabled`,
1359
- render: ({ field: { onChange, value } }) => {
1360
- var _a3;
1361
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1362
- import_input_switch.default,
1363
- {
1364
- ...{
1365
- "aria-label": ((_a3 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a3.key) || "Step " + (index + 1),
1366
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting) || lockedStep(index) || parts && !parts.can,
1367
- onChange: (next) => {
1368
- onChange(next);
1369
- if (parts && next && partToStart(parts)) setValue(`steps.${index}.settings.${partToStart(parts)}.enabled`, true);
1370
- },
1371
- small: true,
1372
- value: value !== false && (!parts || parts.can)
1373
- }
1374
- }
1375
- );
1376
- }
1334
+ "aria-label": ((_a3 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a3.key) || "Step " + (index + 1),
1335
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting) || lockedStep(index) || parts && !parts.can,
1336
+ onChange: (next) => {
1337
+ onChange(next);
1338
+ if (parts && next && partToStart(parts)) setValue(`steps.${index}.settings.${partToStart(parts)}.enabled`, true);
1339
+ },
1340
+ small: true,
1341
+ value: value !== false && (!parts || parts.can)
1377
1342
  }
1378
1343
  }
1379
- )
1380
- ]
1381
- }
1382
- ),
1383
- "data-step": index + 1,
1384
- slide: "step-" + index,
1385
- title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1386
- "span",
1387
- {
1388
- ...{
1389
- className: "flex items-center gap-2"
1390
- },
1391
- children: [
1392
- handle,
1393
- "Step " + (index + 1)
1394
- ]
1344
+ );
1345
+ }
1395
1346
  }
1396
- )
1397
- },
1398
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1399
- "div",
1400
- {
1401
- ...{
1402
- // A step switched off is greyed; its settings are kept.
1403
- // Auto response's whole card greys, its parts as well.
1404
- className: "space-y-3" + (step.enabled === false && !parts ? " opacity-50" : "")
1405
- },
1406
- children: [
1407
- issueIndex === index && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1408
- import_error.default,
1409
- {
1410
- ...{
1411
- error: values.issue.message
1412
- }
1413
- }
1414
- ),
1415
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1416
- import_form.Controller,
1347
+ }
1348
+ )
1349
+ ]
1350
+ }
1351
+ ),
1352
+ "data-step": index + 1,
1353
+ title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1354
+ "span",
1355
+ {
1356
+ ...{
1357
+ className: "flex items-center gap-2"
1358
+ },
1359
+ children: [
1360
+ handle,
1361
+ "Step " + (index + 1)
1362
+ ]
1363
+ }
1364
+ )
1365
+ },
1366
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1367
+ "div",
1368
+ {
1369
+ ...{
1370
+ // A step switched off is greyed; its settings are kept.
1371
+ // Auto response's whole card greys, its parts as well.
1372
+ className: "space-y-3" + (step.enabled === false && !parts ? " opacity-50" : "")
1373
+ },
1374
+ children: [
1375
+ issueIndex === index && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1376
+ import_error.default,
1377
+ {
1378
+ ...{
1379
+ error: values.issue.message
1380
+ }
1381
+ }
1382
+ ),
1383
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1384
+ import_form.Controller,
1385
+ {
1386
+ ...{
1387
+ control,
1388
+ name: `steps.${index}.type`,
1389
+ render: ({ field: { onChange } }) => {
1390
+ var _a3, _b2, _c2, _d2;
1391
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1392
+ import_input_group.default,
1417
1393
  {
1418
1394
  ...{
1419
- control,
1420
- name: `steps.${index}.type`,
1421
- render: ({ field: { onChange } }) => {
1422
- var _a3, _b2, _c2, _d2;
1423
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1424
- import_input_group.default,
1425
- {
1426
- ...{
1427
- error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.type) == null ? void 0 : _d2.message,
1428
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1429
- import_input_combobox.default,
1430
- {
1431
- ...{
1432
- onChange: (val) => {
1433
- var _a4;
1434
- const [type] = val.split("::");
1435
- const option = getStepOptions(index).find((o) => o.value === val);
1436
- const copy = pickedCopy({ row: getValues(`steps.${index}`), type });
1437
- setValue(`steps.${index}.settings`, type === RESPONSE ? responseStart((_a4 = values == null ? void 0 : values.autoResponse) == null ? void 0 : _a4.number) : null);
1438
- onChange(type);
1439
- setValue(`steps.${index}.connectionId`, (option == null ? void 0 : option.connectionId) || "");
1440
- setValue(`steps.${index}.slug`, (option == null ? void 0 : option.slug) || "");
1441
- if (copy) Object.entries(copy).forEach(([key, value]) => setValue(`steps.${index}.${key}`, value));
1442
- },
1443
- // Locked for a member on the owner's step; disabled
1444
- // with nothing left to pick.
1445
- disabled: lockedStep(index) || !hasStepOptions(stepOptions),
1446
- options: stepOptions,
1447
- // Resolved from the WHOLE ROW, not from this path: the
1448
- // option value carries a connection the type alone cannot
1449
- // name.
1450
- value: getStepValue(step, index)
1451
- }
1452
- }
1453
- ),
1454
- label: "Step"
1455
- }
1395
+ error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.type) == null ? void 0 : _d2.message,
1396
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1397
+ import_input_combobox.default,
1398
+ {
1399
+ ...{
1400
+ onChange: (val) => {
1401
+ var _a4;
1402
+ const [type] = val.split("::");
1403
+ const option = getStepOptions(index).find((o) => o.value === val);
1404
+ const copy = pickedCopy({ row: getValues(`steps.${index}`), type });
1405
+ setValue(`steps.${index}.settings`, type === RESPONSE ? responseStart((_a4 = values == null ? void 0 : values.autoResponse) == null ? void 0 : _a4.number) : null);
1406
+ onChange(type);
1407
+ setValue(`steps.${index}.connectionId`, (option == null ? void 0 : option.connectionId) || "");
1408
+ setValue(`steps.${index}.slug`, (option == null ? void 0 : option.slug) || "");
1409
+ if (copy) Object.entries(copy).forEach(([key, value]) => setValue(`steps.${index}.${key}`, value));
1410
+ },
1411
+ // Locked for a member on the owner's step; disabled
1412
+ // with nothing left to pick.
1413
+ disabled: lockedStep(index) || !hasStepOptions(stepOptions),
1414
+ options: stepOptions,
1415
+ // Resolved from the WHOLE ROW, not from this path: the
1416
+ // option value carries a connection the type alone cannot
1417
+ // name.
1418
+ value: getStepValue(step, index)
1456
1419
  }
1457
- );
1458
- }
1420
+ }
1421
+ ),
1422
+ label: "Step"
1459
1423
  }
1460
1424
  }
1461
- ),
1462
- firstEntryOnly({ campaign: campaignData, event, type: step.type }) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1463
- "p",
1464
- {
1465
- ...{
1466
- className: "text-sm text-gray-dark"
1467
- },
1468
- children: "Runs on a person's first entry only."
1469
- }
1470
- ),
1471
- step.type === "step.webhook.send" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1472
- import_form.Controller,
1425
+ );
1426
+ }
1427
+ }
1428
+ }
1429
+ ),
1430
+ firstEntryOnly({ campaign: campaignData, event, type: step.type }) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1431
+ "p",
1432
+ {
1433
+ ...{
1434
+ className: "text-sm text-gray-dark"
1435
+ },
1436
+ children: "Runs on a person's first entry only."
1437
+ }
1438
+ ),
1439
+ step.type === "step.webhook.send" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1440
+ import_form.Controller,
1441
+ {
1442
+ ...{
1443
+ control,
1444
+ name: `steps.${index}.url`,
1445
+ render: ({ field: { value, onChange } }) => {
1446
+ var _a3, _b2, _c2, _d2;
1447
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1448
+ import_input_group.default,
1473
1449
  {
1474
1450
  ...{
1475
- control,
1476
- name: `steps.${index}.url`,
1477
- render: ({ field: { value, onChange } }) => {
1478
- var _a3, _b2, _c2, _d2;
1479
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1480
- import_input_group.default,
1481
- {
1482
- ...{
1483
- error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.url) == null ? void 0 : _d2.message,
1484
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1485
- import_input_url.default,
1486
- {
1487
- ...{
1488
- onChange,
1489
- value: value || ""
1490
- }
1491
- }
1492
- ),
1493
- label: "Webhook URL"
1494
- }
1451
+ error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.url) == null ? void 0 : _d2.message,
1452
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1453
+ import_input_url.default,
1454
+ {
1455
+ ...{
1456
+ onChange,
1457
+ value: value || ""
1495
1458
  }
1496
- );
1497
- }
1459
+ }
1460
+ ),
1461
+ label: "Webhook URL"
1498
1462
  }
1499
1463
  }
1500
- ),
1501
- teamSteps.includes(step.type) && lockedStep(index) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-gray-500", children: "Recipients are chosen by the organization owner." }),
1502
- teamSteps.includes(step.type) && !lockedStep(index) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1503
- import_form.Controller,
1464
+ );
1465
+ }
1466
+ }
1467
+ }
1468
+ ),
1469
+ teamSteps.includes(step.type) && lockedStep(index) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-gray-500", children: "Recipients are chosen by the organization owner." }),
1470
+ teamSteps.includes(step.type) && !lockedStep(index) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1471
+ import_form.Controller,
1472
+ {
1473
+ ...{
1474
+ control,
1475
+ name: `steps.${index}.members`,
1476
+ render: ({ field: { value, onChange } }) => {
1477
+ var _a3, _b2, _c2, _d2;
1478
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1479
+ import_input_group.default,
1504
1480
  {
1505
1481
  ...{
1506
- control,
1507
- name: `steps.${index}.members`,
1508
- render: ({ field: { value, onChange } }) => {
1509
- var _a3, _b2, _c2, _d2;
1510
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1511
- import_input_group.default,
1512
- {
1513
- ...{
1514
- error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.members) == null ? void 0 : _d2.message,
1515
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1516
- import_input_resource.default,
1517
- {
1518
- ...{
1519
- empty: "No members to add",
1520
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/members",
1521
- // The owner is a chip like the others, only it cannot be
1522
- // removed: they are always a recipient and it is resolved
1523
- // in sync. Shaped like a member so `render` labels it the
1524
- // same way.
1525
- fixed: [{ email: ownerEmail }],
1526
- model: "member",
1527
- multiple: true,
1528
- onChange,
1529
- params: memberParams,
1530
- // No Add member where the list cannot be read.
1531
- picker: membersListed,
1532
- render: memberLabel,
1533
- // The row shows the name ( memberLabel ), so the search has
1534
- // to hit the name too. The members endpoint joins `user`
1535
- // before its search stage, so the nested keys resolve.
1536
- // Email stays for invitees who have not registered yet.
1537
- // ponytail: a full "First Last" query matches neither key;
1538
- // a $concat'd name on the API side if that comes up.
1539
- searchKeys: ["email", "user.firstName", "user.lastName"],
1540
- value: value || []
1541
- }
1542
- }
1543
- ),
1544
- label: "Recipients"
1545
- }
1482
+ error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.members) == null ? void 0 : _d2.message,
1483
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1484
+ import_input_resource.default,
1485
+ {
1486
+ ...{
1487
+ empty: "No members to add",
1488
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/members",
1489
+ // The owner is a chip like the others, only it cannot be
1490
+ // removed: they are always a recipient and it is resolved
1491
+ // in sync. Shaped like a member so `render` labels it the
1492
+ // same way.
1493
+ fixed: [{ email: ownerEmail }],
1494
+ model: "member",
1495
+ multiple: true,
1496
+ onChange,
1497
+ params: memberParams,
1498
+ render: memberLabel,
1499
+ // The row shows the name ( memberLabel ), so the search has
1500
+ // to hit the name too. The members endpoint joins `user`
1501
+ // before its search stage, so the nested keys resolve.
1502
+ // Email stays for invitees who have not registered yet.
1503
+ // ponytail: a full "First Last" query matches neither key;
1504
+ // a $concat'd name on the API side if that comes up.
1505
+ searchKeys: ["email", "user.firstName", "user.lastName"],
1506
+ value: value || []
1546
1507
  }
1547
- );
1548
- }
1549
- }
1550
- }
1551
- ),
1552
- emailSteps.includes(step.type) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1553
- import_form_notification.FormNotification,
1554
- {
1555
- ...{
1556
- control,
1557
- // As the Fieldset above: the Message editor is a
1558
- // contenteditable, which a disabled fieldset never reaches.
1559
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting),
1560
- formState,
1561
- onChecking,
1562
- setValue,
1563
- values: {
1564
- id: field.id,
1565
- name: `steps.${index}`,
1566
- organization: values == null ? void 0 : values.organization,
1567
- variables: getAvailableVariables(index)
1568
- }
1508
+ }
1509
+ ),
1510
+ label: "Recipients"
1569
1511
  }
1570
1512
  }
1571
- ),
1572
- event === "lead.insert" && emailSteps.includes(step.type) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LeadEmailNote, {}),
1573
- step.type === "step.sms.send" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1574
- import_form.Controller,
1513
+ );
1514
+ }
1515
+ }
1516
+ }
1517
+ ),
1518
+ emailSteps.includes(step.type) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1519
+ import_form_notification.FormNotification,
1520
+ {
1521
+ ...{
1522
+ control,
1523
+ // As the Fieldset above: the Message editor is a
1524
+ // contenteditable, which a disabled fieldset never reaches.
1525
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting),
1526
+ formState,
1527
+ onChecking,
1528
+ setValue,
1529
+ values: {
1530
+ id: field.id,
1531
+ name: `steps.${index}`,
1532
+ organization: values == null ? void 0 : values.organization,
1533
+ variables: getAvailableVariables(index)
1534
+ }
1535
+ }
1536
+ }
1537
+ ),
1538
+ event === "lead.insert" && emailSteps.includes(step.type) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LeadEmailNote, {}),
1539
+ step.type === "step.sms.send" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1540
+ import_form.Controller,
1541
+ {
1542
+ ...{
1543
+ control,
1544
+ name: `steps.${index}.message`,
1545
+ render: ({ field: { value, onChange } }) => {
1546
+ var _a3, _b2, _c2, _d2;
1547
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1548
+ import_input_group.default,
1575
1549
  {
1576
1550
  ...{
1577
- control,
1578
- name: `steps.${index}.message`,
1579
- render: ({ field: { value, onChange } }) => {
1580
- var _a3, _b2, _c2, _d2;
1581
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1582
- import_input_group.default,
1583
- {
1584
- ...{
1585
- error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.message) == null ? void 0 : _d2.message,
1586
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1587
- import_input_textarea.default,
1588
- {
1589
- ...{
1590
- onChange,
1591
- rows: 3,
1592
- value: value || ""
1593
- }
1594
- }
1595
- ),
1596
- label: "Message"
1597
- }
1551
+ error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.message) == null ? void 0 : _d2.message,
1552
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1553
+ import_input_textarea.default,
1554
+ {
1555
+ ...{
1556
+ onChange,
1557
+ rows: 3,
1558
+ value: value || ""
1598
1559
  }
1599
- );
1600
- }
1560
+ }
1561
+ ),
1562
+ label: "Message"
1601
1563
  }
1602
1564
  }
1603
- ),
1604
- step.type === "step.commerce.code.issue" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1605
- import_form.Controller,
1565
+ );
1566
+ }
1567
+ }
1568
+ }
1569
+ ),
1570
+ step.type === "step.commerce.code.issue" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1571
+ import_form.Controller,
1572
+ {
1573
+ ...{
1574
+ control,
1575
+ name: `steps.${index}.discount`,
1576
+ render: ({ field: { value, onChange } }) => {
1577
+ var _a3, _b2, _c2, _d2;
1578
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1579
+ import_input_group.default,
1606
1580
  {
1607
1581
  ...{
1608
- control,
1609
- name: `steps.${index}.discount`,
1610
- render: ({ field: { value, onChange } }) => {
1611
- var _a3, _b2, _c2, _d2;
1612
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1613
- import_input_group.default,
1614
- {
1615
- ...{
1616
- error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.discount) == null ? void 0 : _d2.message,
1617
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1618
- import_input_resource.default,
1582
+ error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.discount) == null ? void 0 : _d2.message,
1583
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1584
+ import_input_resource.default,
1585
+ {
1586
+ ...{
1587
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/connection/" + commerceConnectionId + "/hook/browse.promotions",
1588
+ model: "discount",
1589
+ onChange,
1590
+ // A DISCOUNT THE STORE CANNOT BACK IS SHOWN AND EXPLAINED, never
1591
+ // filtered out. The merchant can see it in Shopify admin, so a row
1592
+ // missing here with no reason reads as our bug rather than their
1593
+ // setting — and the reason names the fix.
1594
+ render: (item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
1595
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (item == null ? void 0 : item.blocked) ? "text-gray-dark" : void 0, children: item == null ? void 0 : item.title }),
1596
+ ((item == null ? void 0 : item.blocked) || (item == null ? void 0 : item.warning)) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "block text-sm text-gray-dark", children: item.blocked || item.warning })
1597
+ ] }),
1598
+ renderButton: ({ button, item }) => (
1599
+ // The list's small inline Add, unless the list says otherwise.
1600
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1601
+ import_button.default,
1619
1602
  {
1620
1603
  ...{
1621
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/connection/" + commerceConnectionId + "/hook/browse.promotions",
1622
- model: "discount",
1623
- onChange,
1624
- // A DISCOUNT THE STORE CANNOT BACK IS SHOWN AND EXPLAINED, never
1625
- // filtered out. The merchant can see it in Shopify admin, so a row
1626
- // missing here with no reason reads as our bug rather than their
1627
- // setting — and the reason names the fix.
1628
- render: (item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
1629
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (item == null ? void 0 : item.blocked) ? "text-gray-dark" : void 0, children: item == null ? void 0 : item.title }),
1630
- ((item == null ? void 0 : item.blocked) || (item == null ? void 0 : item.warning)) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "block text-sm text-gray-dark", children: item.blocked || item.warning })
1631
- ] }),
1632
- renderButton: ({ button, item }) => (
1633
- // The list's small inline Add, unless the list says otherwise.
1634
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1635
- import_button.default,
1636
- {
1637
- ...{
1638
- inline: true,
1639
- size: "small",
1640
- ...button.props,
1641
- disabled: Boolean(item == null ? void 0 : item.blocked),
1642
- title: (item == null ? void 0 : item.blocked) || void 0
1643
- },
1644
- children: button.text
1645
- }
1646
- )
1647
- ),
1648
- value: value || null
1649
- }
1604
+ inline: true,
1605
+ size: "small",
1606
+ ...button.props,
1607
+ disabled: Boolean(item == null ? void 0 : item.blocked),
1608
+ title: (item == null ? void 0 : item.blocked) || void 0
1609
+ },
1610
+ children: button.text
1650
1611
  }
1651
- ),
1652
- label: "Discount",
1653
- // "Issue" means MINT, not send — this step creates the code and saves
1654
- // it to the lead, and nothing reaches them until a later email step
1655
- // names the variable. Said here because the step picker says nothing:
1656
- // QA read "Issue a discount code", built the one-step workflow that
1657
- // describes, and reported the codes as never arriving.
1658
- message: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1659
- "Creates the code and saves it to the lead. To send it, keep this step before Auto response and add Shopify Discount Code to its message.",
1660
- commerceDomain ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1661
- " ",
1662
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "https://" + commerceDomain + "/admin/discounts", rel: "noopener noreferrer", target: "_blank", children: "Manage discounts" })
1663
- ] }) : null
1664
- ] })
1665
- }
1612
+ )
1613
+ ),
1614
+ value: value || null
1666
1615
  }
1667
- );
1668
- }
1616
+ }
1617
+ ),
1618
+ label: "Discount",
1619
+ // "Issue" means MINT, not send — this step creates the code and saves
1620
+ // it to the lead, and nothing reaches them until a later email step
1621
+ // names the variable. Said here because the step picker says nothing:
1622
+ // QA read "Issue a discount code", built the one-step workflow that
1623
+ // describes, and reported the codes as never arriving.
1624
+ message: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1625
+ "Creates the code and saves it to the lead. To send it, keep this step before Auto response and add Shopify Discount Code to its message.",
1626
+ commerceDomain ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1627
+ " ",
1628
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "https://" + commerceDomain + "/admin/discounts", rel: "noopener noreferrer", target: "_blank", children: "Manage discounts" })
1629
+ ] }) : null
1630
+ ] })
1669
1631
  }
1670
1632
  }
1671
- )
1672
- ]
1633
+ );
1634
+ }
1673
1635
  }
1674
- )
1675
- }
1676
- )
1677
- );
1678
- }
1636
+ }
1637
+ )
1638
+ ]
1639
+ }
1640
+ )
1679
1641
  }
1680
1642
  )
1681
- }
1682
- }
1683
- ),
1684
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1685
- "div",
1686
- {
1687
- ...{
1688
- className: "pt-6"
1689
- },
1690
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1691
- import_button.default,
1692
- {
1693
- ...{
1694
- disabled: checkingAny,
1695
- loading: (formState == null ? void 0 : formState.isSubmitting) || checkingAny,
1696
- type: "submit"
1697
- },
1698
- children: "Save"
1699
- }
1700
- )
1643
+ );
1701
1644
  }
1702
- )
1703
- ]
1645
+ }
1646
+ ),
1647
+ label: "Sequence"
1704
1648
  }
1705
- )
1706
- }
1707
- )
1649
+ }
1650
+ ),
1651
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1652
+ import_button.default,
1653
+ {
1654
+ ...{
1655
+ disabled: checkingAny,
1656
+ loading: (formState == null ? void 0 : formState.isSubmitting) || checkingAny,
1657
+ type: "submit"
1658
+ },
1659
+ children: "Save"
1660
+ }
1661
+ )
1662
+ ]
1708
1663
  }
1709
1664
  )
1710
1665
  }
@@ -1714,11 +1669,12 @@ const FormOrganizationWorkflowEdit = ({
1714
1669
  0 && (module.exports = {
1715
1670
  FormOrganizationWorkflowEdit,
1716
1671
  RESPONSE,
1672
+ SAMPLE,
1717
1673
  TextPreview,
1718
1674
  firstEntryOnly,
1719
1675
  hasStepOptions,
1720
1676
  issueRow,
1721
- listsMembers,
1677
+ lockedStepOption,
1722
1678
  memberOptions,
1723
1679
  partToStart,
1724
1680
  pickedCopy,
@@ -1731,7 +1687,7 @@ const FormOrganizationWorkflowEdit = ({
1731
1687
  stepReason,
1732
1688
  stepRow,
1733
1689
  stepVariables,
1734
- useEmailPreview,
1735
1690
  useStepPrefill,
1691
+ webhookSample,
1736
1692
  workflowSchema
1737
1693
  });