@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
@@ -29,11 +29,11 @@ var form_organization_workflow_exports = {};
29
29
  __export(form_organization_workflow_exports, {
30
30
  FormOrganizationWorkflowEdit: () => FormOrganizationWorkflowEdit,
31
31
  RESPONSE: () => RESPONSE,
32
- SAMPLE: () => SAMPLE,
33
32
  TextPreview: () => TextPreview,
34
33
  firstEntryOnly: () => firstEntryOnly,
35
34
  hasStepOptions: () => hasStepOptions,
36
35
  issueRow: () => issueRow,
36
+ listsMembers: () => listsMembers,
37
37
  lockedStepOption: () => lockedStepOption,
38
38
  memberOptions: () => memberOptions,
39
39
  partToStart: () => partToStart,
@@ -47,8 +47,8 @@ __export(form_organization_workflow_exports, {
47
47
  stepReason: () => stepReason,
48
48
  stepRow: () => stepRow,
49
49
  stepVariables: () => stepVariables,
50
+ useEmailPreview: () => useEmailPreview,
50
51
  useStepPrefill: () => useStepPrefill,
51
- webhookSample: () => webhookSample,
52
52
  workflowSchema: () => workflowSchema
53
53
  });
54
54
  module.exports = __toCommonJS(form_organization_workflow_exports);
@@ -57,6 +57,7 @@ var import_image = __toESM(require("next/image"));
57
57
  var import_link = __toESM(require("./link"));
58
58
  var import_react = require("react");
59
59
  var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
60
+ var import_features = require("@drawbridge/drawbridge-utils/features");
60
61
  var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
61
62
  var import_html = require("@drawbridge/drawbridge-utils/html");
62
63
  var import_form = require("../shared/lib/form");
@@ -84,6 +85,7 @@ var import_sms = require("./lib/sms");
84
85
  var import_lock = __toESM(require("../icons/lock"));
85
86
  var import_trash = __toESM(require("../icons/trash"));
86
87
  var import_button = __toESM(require("../shared/button"));
88
+ var import_helpers = require("../shared/lib/helpers");
87
89
  const emailSteps = ["step.email.send"];
88
90
  const teamSteps = ["step.email.notify"];
89
91
  const messageSteps = [...emailSteps, "step.sms.send"];
@@ -114,6 +116,10 @@ const memberParams = {
114
116
  createdAt: -1
115
117
  }
116
118
  };
119
+ const listsMembers = (organization) => {
120
+ var _a;
121
+ 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);
122
+ };
117
123
  const memberOptions = (organization) => ({
118
124
  queryKey: ["organization-members", organization, "options"],
119
125
  queryFn: async () => {
@@ -126,11 +132,11 @@ const memberOptions = (organization) => ({
126
132
  },
127
133
  staleTime: Infinity
128
134
  });
129
- const useOrganizationMembers = (organization) => {
135
+ const useOrganizationMembers = (organization, listed) => {
130
136
  var _a;
131
137
  const members = (0, import_react_query.useQuery)({
132
138
  ...memberOptions(organization),
133
- enabled: Boolean(organization)
139
+ enabled: Boolean(organization) && listed
134
140
  });
135
141
  return {
136
142
  items: ((_a = members.data) == null ? void 0 : _a.items) || [],
@@ -402,9 +408,10 @@ const workflowSchema = import_yup.default.object({
402
408
  )
403
409
  });
404
410
  const useEmailPreview = ({ campaign, event, message, organization, subject, text, type }) => {
411
+ const queryClient = (0, import_react_query.useQueryClient)();
405
412
  const asked = JSON.stringify(teamSteps.includes(type) ? { type } : { message, subject, text });
406
413
  const [settled, setSettled] = (0, import_react.useState)(asked);
407
- const last = (0, import_react.useRef)();
414
+ const held = ["workflow-email-preview-shown", organization, campaign, event, type || null];
408
415
  (0, import_react.useEffect)(() => {
409
416
  const timer = setTimeout(() => setSettled(asked), 400);
410
417
  return () => clearTimeout(timer);
@@ -418,22 +425,33 @@ const useEmailPreview = ({ campaign, event, message, organization, subject, text
418
425
  endpoint: "/organization/" + organization + "/campaign/" + campaign + "/workflow/" + event + "/preview",
419
426
  method: "POST"
420
427
  });
428
+ queryClient.setQueryData(held, result);
421
429
  return result;
422
430
  },
423
431
  // Stale at once ( the dashboard's default is never ): the key holds the
424
432
  // step's copy only, and the placeholder under it is the campaign's, so
425
433
  // each visit to the trigger page asks again (Asana 1217773117236699).
426
434
  queryKey: ["workflow-email-preview", organization, campaign, event, settled],
435
+ retry: (count, error) => count < 5 && (0, import_fetch.isTransientError)(error),
427
436
  staleTime: 0
428
437
  });
429
- if (preview.data) last.current = preview.data;
430
- return last.current;
438
+ return preview.data || queryClient.getQueryData(held);
431
439
  };
440
+ const Shown = ({ children, off }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
441
+ "div",
442
+ {
443
+ ...{
444
+ className: "mx-auto w-full max-w-[600px] px-6 space-y-4" + (off ? " opacity-50" : "")
445
+ },
446
+ children
447
+ }
448
+ );
432
449
  const EmailStepCard = ({
433
450
  card,
434
451
  children,
435
452
  control,
436
453
  off,
454
+ slide,
437
455
  email: {
438
456
  campaign,
439
457
  event,
@@ -448,12 +466,14 @@ const EmailStepCard = ({
448
466
  name: [name + ".subject", name + ".message", name + ".text"]
449
467
  });
450
468
  const preview = useEmailPreview({ campaign, event, message, organization, subject, text, type });
469
+ const target = (0, import_preview.useCard)(slide);
451
470
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
452
471
  import_card_section.default,
453
472
  {
454
473
  ...{
455
474
  ...card,
456
- columns: 2
475
+ ...target.props,
476
+ className: "relative shrink-0" + target.className
457
477
  },
458
478
  children: [
459
479
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
@@ -487,46 +507,36 @@ const EmailStepCard = ({
487
507
  }
488
508
  ),
489
509
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
490
- "div",
510
+ import_preview.default,
491
511
  {
492
512
  ...{
493
- className: off ? "opacity-50" : ""
513
+ id: slide
494
514
  },
495
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_preview.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
496
- "iframe",
515
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
516
+ Shown,
497
517
  {
498
518
  ...{
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
- }
519
+ off
520
+ },
521
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
522
+ import_preview.Mail,
523
+ {
524
+ ...{
525
+ // The rendered email, as a mail app shows it.
526
+ html: preview == null ? void 0 : preview.html,
527
+ title
528
+ }
529
+ }
530
+ )
504
531
  }
505
- ) })
532
+ )
506
533
  }
507
534
  )
508
535
  ]
509
536
  }
510
537
  );
511
538
  };
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 }) });
539
+ 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 }) });
530
540
  const StepPreview = ({ campaign, control, image, name, organization, type }) => {
531
541
  const [message] = (0, import_form.useWatch)({
532
542
  control,
@@ -539,23 +549,20 @@ const StepPreview = ({ campaign, control, image, name, organization, type }) =>
539
549
  (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" }),
540
550
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mt-2", children: "Reply STOP to opt out" })
541
551
  ] });
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
+ if (type === "step.webhook.send") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_preview.NoPreview, {});
553
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_preview.NoPreview, { children: image && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
554
+ import_image.default,
555
+ {
556
+ ...{
557
+ alt: "",
558
+ className: "w-12 h-12 object-contain",
559
+ height: 48,
560
+ src: image,
561
+ unoptimized: true,
562
+ width: 48
555
563
  }
556
- ),
557
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "No preview available" })
558
- ] });
564
+ }
565
+ ) });
559
566
  };
560
567
  const LeadEmailNote = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
561
568
  "p",
@@ -601,6 +608,7 @@ const ResponseStepCard = ({
601
608
  formState,
602
609
  off,
603
610
  onChecking,
611
+ slide,
604
612
  response: {
605
613
  autoResponse,
606
614
  campaign,
@@ -609,6 +617,8 @@ const ResponseStepCard = ({
609
617
  id,
610
618
  index,
611
619
  organization,
620
+ picked,
621
+ setPicked,
612
622
  settings,
613
623
  title,
614
624
  variables
@@ -616,7 +626,6 @@ const ResponseStepCard = ({
616
626
  setValue
617
627
  }) => {
618
628
  var _a, _b, _c, _d, _e;
619
- const [picked, setPicked] = (0, import_react.useState)("email");
620
629
  const name = `steps.${index}`;
621
630
  const parts = responseParts({ autoResponse, campaign, organization, settings });
622
631
  const shown = parts.sms.absent ? "email" : parts.email.hidden ? "sms" : parts.sms.hidden ? "email" : picked;
@@ -630,6 +639,7 @@ const ResponseStepCard = ({
630
639
  text: (_c = settings == null ? void 0 : settings.email) == null ? void 0 : _c.text
631
640
  });
632
641
  const brand = (0, import_sms.smsBrandLine)(title, (_d = settings == null ? void 0 : settings.sms) == null ? void 0 : _d.message);
642
+ const target = (0, import_preview.useCard)(slide);
633
643
  const partSwitch = ({ label, message, other, part }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
634
644
  import_form.Controller,
635
645
  {
@@ -669,7 +679,8 @@ const ResponseStepCard = ({
669
679
  {
670
680
  ...{
671
681
  ...card,
672
- columns: 2
682
+ ...target.props,
683
+ className: "relative shrink-0" + target.className
673
684
  },
674
685
  children: [
675
686
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
@@ -807,29 +818,29 @@ const ResponseStepCard = ({
807
818
  }
808
819
  ),
809
820
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
810
- "div",
821
+ import_preview.default,
811
822
  {
812
823
  ...{
813
- className: off || !parts[shown].on ? "opacity-50" : ""
824
+ id: slide,
825
+ ...!parts.email.hidden && !parts.sms.hidden && {
826
+ states: {
827
+ onChange: setPicked,
828
+ options: RESPONSE_STATES,
829
+ value: shown
830
+ }
831
+ }
814
832
  },
815
833
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
816
- import_preview.default,
834
+ Shown,
817
835
  {
818
836
  ...{
819
- ...!parts.email.hidden && !parts.sms.hidden && {
820
- states: {
821
- onChange: setPicked,
822
- options: RESPONSE_STATES,
823
- value: shown
824
- }
825
- }
837
+ off: off || !parts[shown].on
826
838
  },
827
839
  children: shown === "email" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
828
- "iframe",
840
+ import_preview.Mail,
829
841
  {
830
842
  ...{
831
- className: "block w-full h-full border-0 bg-white",
832
- srcDoc: (preview == null ? void 0 : preview.html) || "",
843
+ html: preview == null ? void 0 : preview.html,
833
844
  title: "Auto response"
834
845
  }
835
846
  }
@@ -863,6 +874,54 @@ const ResponseStepCard = ({
863
874
  }
864
875
  );
865
876
  };
877
+ const PlainStepCard = ({
878
+ children,
879
+ control,
880
+ off,
881
+ preview,
882
+ slide,
883
+ ...card
884
+ }) => {
885
+ const target = (0, import_preview.useCard)(slide);
886
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
887
+ import_card_section.default,
888
+ {
889
+ ...{
890
+ ...card,
891
+ ...target.props,
892
+ className: "relative shrink-0" + target.className
893
+ },
894
+ children: [
895
+ children,
896
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
897
+ import_preview.default,
898
+ {
899
+ ...{
900
+ id: slide
901
+ },
902
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
903
+ Shown,
904
+ {
905
+ ...{
906
+ off
907
+ },
908
+ children: preview ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
909
+ StepPreview,
910
+ {
911
+ ...{
912
+ control,
913
+ ...preview
914
+ }
915
+ }
916
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_preview.NoPreview, {})
917
+ }
918
+ )
919
+ }
920
+ )
921
+ ]
922
+ }
923
+ );
924
+ };
866
925
  const StepCard = ({
867
926
  children,
868
927
  control,
@@ -874,6 +933,7 @@ const StepCard = ({
874
933
  preview,
875
934
  response,
876
935
  setValue,
936
+ slide,
877
937
  ...card
878
938
  }) => response ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
879
939
  ResponseStepCard,
@@ -886,7 +946,8 @@ const StepCard = ({
886
946
  off,
887
947
  onChecking,
888
948
  response,
889
- setValue
949
+ setValue,
950
+ slide
890
951
  },
891
952
  children
892
953
  }
@@ -897,37 +958,22 @@ const StepCard = ({
897
958
  card,
898
959
  control,
899
960
  email,
900
- off
961
+ off,
962
+ slide
901
963
  },
902
964
  children
903
965
  }
904
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
905
- import_card_section.default,
966
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
967
+ PlainStepCard,
906
968
  {
907
969
  ...{
908
970
  ...card,
909
- columns: preview ? 2 : 1
971
+ control,
972
+ off,
973
+ preview,
974
+ slide
910
975
  },
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
- ]
976
+ children
931
977
  }
932
978
  );
933
979
  const FormOrganizationWorkflowEdit = ({
@@ -939,9 +985,10 @@ const FormOrganizationWorkflowEdit = ({
939
985
  }) => {
940
986
  var _a, _b, _c, _d, _e, _f, _g, _h;
941
987
  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);
943
988
  const queryClient = (0, import_react_query.useQueryClient)();
944
989
  const organizationData = queryClient.getQueryData(["organization", values == null ? void 0 : values.organization]);
990
+ const membersListed = listsMembers(organizationData);
991
+ const { items: memberItems, loading: membersLoading } = useOrganizationMembers(values == null ? void 0 : values.organization, membersListed);
945
992
  const ownerEmail = organizationData.owner.email;
946
993
  const smsActive = (0, import_sms.smsNumberActive)(organizationData);
947
994
  const campaignData = queryClient.getQueryData(["campaign", values == null ? void 0 : values.campaign]);
@@ -962,6 +1009,7 @@ const FormOrganizationWorkflowEdit = ({
962
1009
  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;
963
1010
  const defaultSteps = ((values == null ? void 0 : values.steps) || []).map((s) => stepRow(s, memberItems));
964
1011
  const [checking, setChecking] = (0, import_react.useState)({});
1012
+ const [responsePart, setResponsePart] = (0, import_react.useState)("email");
965
1013
  const checkingAny = Object.values(checking).some(Boolean);
966
1014
  const onChecking = (0, import_react.useCallback)(
967
1015
  (id, value) => setChecking(
@@ -969,16 +1017,13 @@ const FormOrganizationWorkflowEdit = ({
969
1017
  ),
970
1018
  []
971
1019
  );
972
- const { control, formState, getValues, handleSubmit, setValue } = (0, import_form.useForm)({
1020
+ const { control, formState, getValues, handleSubmit, reset, setValue, watch } = (0, import_form.useForm)({
973
1021
  values: {
974
1022
  steps: defaultSteps
975
1023
  },
976
1024
  resolver: (0, import_yup.resolver)(workflowSchema)
977
1025
  });
978
- const watchedSteps = (0, import_form.useWatch)({
979
- control,
980
- name: "steps"
981
- });
1026
+ const watchedSteps = watch("steps");
982
1027
  const issueIndex = issueRow({ issue: values == null ? void 0 : values.issue, steps: watchedSteps || [] });
983
1028
  const getAvailableVariables = (index) => stepVariables(catalog, watchedSteps, index);
984
1029
  const loading = membersLoading || commerceConnection.isLoading;
@@ -1167,6 +1212,7 @@ const FormOrganizationWorkflowEdit = ({
1167
1212
  setValue("steps." + index + ".connectionId", step.connectionId || "");
1168
1213
  setValue("steps." + index + ".slug", step.slug || "");
1169
1214
  });
1215
+ reset(getValues());
1170
1216
  onSuccess(response);
1171
1217
  } catch (error) {
1172
1218
  onError(error);
@@ -1175,6 +1221,13 @@ const FormOrganizationWorkflowEdit = ({
1175
1221
  if (loading) {
1176
1222
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loader.LoaderDynamic, {});
1177
1223
  }
1224
+ const slides = (watchedSteps || []).map((step, index) => {
1225
+ var _a2;
1226
+ return {
1227
+ id: "step-" + index,
1228
+ 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 ")
1229
+ };
1230
+ });
1178
1231
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1179
1232
  import_form2.default,
1180
1233
  {
@@ -1182,484 +1235,488 @@ const FormOrganizationWorkflowEdit = ({
1182
1235
  className: "relative w-full",
1183
1236
  onSubmit: handleSubmit(onSubmit)
1184
1237
  },
1185
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1186
- import_fieldset.default,
1238
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1239
+ import_preview.SliderLayout,
1187
1240
  {
1188
1241
  ...{
1189
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
1242
+ plain: true,
1243
+ slides
1190
1244
  },
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,
1245
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1246
+ import_fieldset.default,
1247
+ {
1248
+ ...{
1249
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
1250
+ },
1251
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1252
+ import_card_section.default,
1253
+ {
1254
+ ...{
1255
+ title: "Sequence",
1256
+ variant: "gray"
1257
+ },
1258
+ children: [
1259
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1260
+ import_input_group.default,
1261
+ {
1262
+ ...{
1263
+ error: (_h = (_g = formState == null ? void 0 : formState.errors) == null ? void 0 : _g.steps) == null ? void 0 : _h.message,
1264
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1265
+ import_input_array.InputArraySortable,
1264
1266
  {
1265
1267
  ...{
1266
1268
  control,
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 && {
1273
- autoResponse: values == null ? void 0 : values.autoResponse,
1274
- campaign: values == null ? void 0 : values.campaign,
1275
- enabled: step.enabled,
1276
- event,
1277
- id: field.id,
1278
- index,
1279
- organization: values == null ? void 0 : values.organization,
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
1269
+ empty: null,
1270
+ // Each handle says which step it moves.
1271
+ handleLabel: (field) => {
1272
+ var _a2;
1273
+ 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");
1294
1274
  },
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",
1275
+ name: "steps",
1276
+ renderButton: (append) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1277
+ import_input_array.InputArrayButton,
1306
1278
  {
1307
1279
  ...{
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
- }
1280
+ disabled: !canAddStep,
1281
+ onClick: () => append(stepRow()),
1282
+ text: "Add step"
1283
+ }
1284
+ }
1285
+ )
1286
+ },
1287
+ children: ({ field, handle, index, remove }) => {
1288
+ var _a2;
1289
+ const step = (watchedSteps == null ? void 0 : watchedSteps[index]) || field;
1290
+ const parts = step.type === RESPONSE && responseParts({
1291
+ autoResponse: values == null ? void 0 : values.autoResponse,
1292
+ campaign: values == null ? void 0 : values.campaign,
1293
+ organization: values == null ? void 0 : values.organization,
1294
+ settings: step.settings
1295
+ });
1296
+ const stepOptions = getStepOptions(index);
1297
+ return (
1298
+ // @story workflows/edit
1299
+ // EACH STEP IS ITS OWN CARD in the flow under the Trigger card,
1300
+ // edited in place: the drag handle left of Step N, as every
1301
+ // sortable list has it, then its connection badge and Remove
1302
+ // in the card's head, its fields in the body.
1303
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1304
+ StepCard,
1305
+ {
1306
+ ...{
1307
+ control,
1308
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting),
1309
+ formState,
1310
+ onChecking,
1311
+ setValue,
1312
+ // @story workflows/auto-response
1313
+ response: step.type === RESPONSE && {
1314
+ autoResponse: values == null ? void 0 : values.autoResponse,
1315
+ campaign: values == null ? void 0 : values.campaign,
1316
+ enabled: step.enabled,
1317
+ event,
1318
+ id: field.id,
1319
+ index,
1320
+ organization: values == null ? void 0 : values.organization,
1321
+ picked: responsePart,
1322
+ setPicked: setResponsePart,
1323
+ settings: step.settings,
1324
+ title: organizationData == null ? void 0 : organizationData.title,
1325
+ variables: getAvailableVariables(index)
1319
1326
  },
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,
1327
+ // @story workflows/send-email
1328
+ // A Send email step shows its email beside its form.
1329
+ off: step.enabled === false,
1330
+ // Every other step with a type has its preview too.
1331
+ preview: step.type && !renderedSteps.includes(step.type) && {
1332
+ campaign: campaignData,
1333
+ image: ((_a2 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a2.image) || null,
1334
+ name: `steps.${index}`,
1335
+ organization: organizationData,
1336
+ type: step.type
1337
+ },
1338
+ // Send email and Email notification show the email the api renders.
1339
+ email: renderedSteps.includes(step.type) && {
1340
+ campaign: values == null ? void 0 : values.campaign,
1341
+ event,
1342
+ name: `steps.${index}`,
1343
+ organization: values == null ? void 0 : values.organization,
1344
+ title: emailSteps.includes(step.type) ? "Send email" : "Email notification",
1345
+ type: step.type
1346
+ },
1347
+ cta: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1348
+ "span",
1349
+ {
1350
+ ...{
1351
+ className: "flex items-center gap-2"
1352
+ },
1353
+ children: [
1354
+ renderStepBadge(step, index),
1355
+ !lockedStep(index) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1356
+ import_input_array.InputArrayControl,
1332
1357
  {
1333
1358
  ...{
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)
1359
+ onClick: () => remove(index),
1360
+ icon: import_trash.default
1361
+ }
1362
+ },
1363
+ "remove"
1364
+ ),
1365
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1366
+ import_form.Controller,
1367
+ {
1368
+ ...{
1369
+ control,
1370
+ name: `steps.${index}.enabled`,
1371
+ render: ({ field: { onChange, value } }) => {
1372
+ var _a3;
1373
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1374
+ import_input_switch.default,
1375
+ {
1376
+ ...{
1377
+ "aria-label": ((_a3 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a3.key) || "Step " + (index + 1),
1378
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting) || lockedStep(index) || parts && !parts.can,
1379
+ onChange: (next) => {
1380
+ onChange(next);
1381
+ if (parts && next && partToStart(parts)) setValue(`steps.${index}.settings.${partToStart(parts)}.enabled`, true);
1382
+ },
1383
+ small: true,
1384
+ value: value !== false && (!parts || parts.can)
1385
+ }
1386
+ }
1387
+ );
1388
+ }
1342
1389
  }
1343
1390
  }
1344
- );
1345
- }
1391
+ )
1392
+ ]
1346
1393
  }
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,
1394
+ ),
1395
+ "data-step": index + 1,
1396
+ slide: "step-" + index,
1397
+ title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1398
+ "span",
1399
+ {
1400
+ ...{
1401
+ className: "flex items-center gap-2"
1402
+ },
1403
+ children: [
1404
+ handle,
1405
+ "Step " + (index + 1)
1406
+ ]
1407
+ }
1408
+ )
1409
+ },
1410
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1411
+ "div",
1412
+ {
1413
+ ...{
1414
+ // A step switched off is greyed; its settings are kept.
1415
+ // Auto response's whole card greys, its parts as well.
1416
+ className: "space-y-3" + (step.enabled === false && !parts ? " opacity-50" : "")
1417
+ },
1418
+ children: [
1419
+ issueIndex === index && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1420
+ import_error.default,
1393
1421
  {
1394
1422
  ...{
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)
1423
+ error: values.issue.message
1424
+ }
1425
+ }
1426
+ ),
1427
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1428
+ import_form.Controller,
1429
+ {
1430
+ ...{
1431
+ control,
1432
+ name: `steps.${index}.type`,
1433
+ render: ({ field: { onChange } }) => {
1434
+ var _a3, _b2, _c2, _d2;
1435
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1436
+ import_input_group.default,
1437
+ {
1438
+ ...{
1439
+ 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,
1440
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1441
+ import_input_combobox.default,
1442
+ {
1443
+ ...{
1444
+ onChange: (val) => {
1445
+ var _a4;
1446
+ const [type] = val.split("::");
1447
+ const option = getStepOptions(index).find((o) => o.value === val);
1448
+ const copy = pickedCopy({ row: getValues(`steps.${index}`), type });
1449
+ setValue(`steps.${index}.settings`, type === RESPONSE ? responseStart((_a4 = values == null ? void 0 : values.autoResponse) == null ? void 0 : _a4.number) : null);
1450
+ onChange(type);
1451
+ setValue(`steps.${index}.connectionId`, (option == null ? void 0 : option.connectionId) || "");
1452
+ setValue(`steps.${index}.slug`, (option == null ? void 0 : option.slug) || "");
1453
+ if (copy) Object.entries(copy).forEach(([key, value]) => setValue(`steps.${index}.${key}`, value));
1454
+ },
1455
+ // Locked for a member on the owner's step; disabled
1456
+ // with nothing left to pick.
1457
+ disabled: lockedStep(index) || !hasStepOptions(stepOptions),
1458
+ options: stepOptions,
1459
+ // Resolved from the WHOLE ROW, not from this path: the
1460
+ // option value carries a connection the type alone cannot
1461
+ // name.
1462
+ value: getStepValue(step, index)
1463
+ }
1464
+ }
1465
+ ),
1466
+ label: "Step"
1467
+ }
1419
1468
  }
1420
- }
1421
- ),
1422
- label: "Step"
1469
+ );
1470
+ }
1423
1471
  }
1424
1472
  }
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
+ ),
1474
+ firstEntryOnly({ campaign: campaignData, event, type: step.type }) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1475
+ "p",
1476
+ {
1477
+ ...{
1478
+ className: "text-sm text-gray-dark"
1479
+ },
1480
+ children: "Runs on a person's first entry only."
1481
+ }
1482
+ ),
1483
+ step.type === "step.webhook.send" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1484
+ import_form.Controller,
1449
1485
  {
1450
1486
  ...{
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 || ""
1487
+ control,
1488
+ name: `steps.${index}.url`,
1489
+ render: ({ field: { value, onChange } }) => {
1490
+ var _a3, _b2, _c2, _d2;
1491
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1492
+ import_input_group.default,
1493
+ {
1494
+ ...{
1495
+ 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,
1496
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1497
+ import_input_url.default,
1498
+ {
1499
+ ...{
1500
+ onChange,
1501
+ value: value || ""
1502
+ }
1503
+ }
1504
+ ),
1505
+ label: "Webhook URL"
1506
+ }
1458
1507
  }
1459
- }
1460
- ),
1461
- label: "Webhook URL"
1508
+ );
1509
+ }
1462
1510
  }
1463
1511
  }
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,
1512
+ ),
1513
+ 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." }),
1514
+ teamSteps.includes(step.type) && !lockedStep(index) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1515
+ import_form.Controller,
1480
1516
  {
1481
1517
  ...{
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 || []
1518
+ control,
1519
+ name: `steps.${index}.members`,
1520
+ render: ({ field: { value, onChange } }) => {
1521
+ var _a3, _b2, _c2, _d2;
1522
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1523
+ import_input_group.default,
1524
+ {
1525
+ ...{
1526
+ 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,
1527
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1528
+ import_input_resource.default,
1529
+ {
1530
+ ...{
1531
+ empty: "No members to add",
1532
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/members",
1533
+ // The owner is a chip like the others, only it cannot be
1534
+ // removed: they are always a recipient and it is resolved
1535
+ // in sync. Shaped like a member so `render` labels it the
1536
+ // same way.
1537
+ fixed: [{ email: ownerEmail }],
1538
+ model: "member",
1539
+ multiple: true,
1540
+ onChange,
1541
+ params: memberParams,
1542
+ // No Add member where the list cannot be read.
1543
+ picker: membersListed,
1544
+ render: memberLabel,
1545
+ // The row shows the name ( memberLabel ), so the search has
1546
+ // to hit the name too. The members endpoint joins `user`
1547
+ // before its search stage, so the nested keys resolve.
1548
+ // Email stays for invitees who have not registered yet.
1549
+ // ponytail: a full "First Last" query matches neither key;
1550
+ // a $concat'd name on the API side if that comes up.
1551
+ searchKeys: ["email", "user.firstName", "user.lastName"],
1552
+ value: value || []
1553
+ }
1554
+ }
1555
+ ),
1556
+ label: "Recipients"
1557
+ }
1507
1558
  }
1508
- }
1509
- ),
1510
- label: "Recipients"
1559
+ );
1560
+ }
1511
1561
  }
1512
1562
  }
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,
1563
+ ),
1564
+ emailSteps.includes(step.type) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1565
+ import_form_notification.FormNotification,
1566
+ {
1567
+ ...{
1568
+ control,
1569
+ // As the Fieldset above: the Message editor is a
1570
+ // contenteditable, which a disabled fieldset never reaches.
1571
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting),
1572
+ formState,
1573
+ onChecking,
1574
+ setValue,
1575
+ values: {
1576
+ id: field.id,
1577
+ name: `steps.${index}`,
1578
+ organization: values == null ? void 0 : values.organization,
1579
+ variables: getAvailableVariables(index)
1580
+ }
1581
+ }
1582
+ }
1583
+ ),
1584
+ event === "lead.insert" && emailSteps.includes(step.type) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LeadEmailNote, {}),
1585
+ step.type === "step.sms.send" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1586
+ import_form.Controller,
1549
1587
  {
1550
1588
  ...{
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 || ""
1589
+ control,
1590
+ name: `steps.${index}.message`,
1591
+ render: ({ field: { value, onChange } }) => {
1592
+ var _a3, _b2, _c2, _d2;
1593
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1594
+ import_input_group.default,
1595
+ {
1596
+ ...{
1597
+ 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,
1598
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1599
+ import_input_textarea.default,
1600
+ {
1601
+ ...{
1602
+ onChange,
1603
+ rows: 3,
1604
+ value: value || ""
1605
+ }
1606
+ }
1607
+ ),
1608
+ label: "Message"
1609
+ }
1559
1610
  }
1560
- }
1561
- ),
1562
- label: "Message"
1611
+ );
1612
+ }
1563
1613
  }
1564
1614
  }
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,
1615
+ ),
1616
+ step.type === "step.commerce.code.issue" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1617
+ import_form.Controller,
1580
1618
  {
1581
1619
  ...{
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,
1620
+ control,
1621
+ name: `steps.${index}.discount`,
1622
+ render: ({ field: { value, onChange } }) => {
1623
+ var _a3, _b2, _c2, _d2;
1624
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1625
+ import_input_group.default,
1626
+ {
1627
+ ...{
1628
+ 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,
1629
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1630
+ import_input_resource.default,
1602
1631
  {
1603
1632
  ...{
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
1633
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/connection/" + commerceConnectionId + "/hook/browse.promotions",
1634
+ model: "discount",
1635
+ onChange,
1636
+ // A DISCOUNT THE STORE CANNOT BACK IS SHOWN AND EXPLAINED, never
1637
+ // filtered out. The merchant can see it in Shopify admin, so a row
1638
+ // missing here with no reason reads as our bug rather than their
1639
+ // setting — and the reason names the fix.
1640
+ render: (item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
1641
+ /* @__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 }),
1642
+ ((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 })
1643
+ ] }),
1644
+ renderButton: ({ button, item }) => (
1645
+ // The list's small inline Add, unless the list says otherwise.
1646
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1647
+ import_button.default,
1648
+ {
1649
+ ...{
1650
+ inline: true,
1651
+ size: "small",
1652
+ ...button.props,
1653
+ disabled: Boolean(item == null ? void 0 : item.blocked),
1654
+ title: (item == null ? void 0 : item.blocked) || void 0
1655
+ },
1656
+ children: button.text
1657
+ }
1658
+ )
1659
+ ),
1660
+ value: value || null
1661
+ }
1611
1662
  }
1612
- )
1613
- ),
1614
- value: value || null
1663
+ ),
1664
+ label: "Discount",
1665
+ // "Issue" means MINT, not send — this step creates the code and saves
1666
+ // it to the lead, and nothing reaches them until a later email step
1667
+ // names the variable. Said here because the step picker says nothing:
1668
+ // QA read "Issue a discount code", built the one-step workflow that
1669
+ // describes, and reported the codes as never arriving.
1670
+ message: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1671
+ "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.",
1672
+ commerceDomain ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1673
+ " ",
1674
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "https://" + commerceDomain + "/admin/discounts", rel: "noopener noreferrer", target: "_blank", children: "Manage discounts" })
1675
+ ] }) : null
1676
+ ] })
1677
+ }
1615
1678
  }
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
- ] })
1679
+ );
1680
+ }
1631
1681
  }
1632
1682
  }
1633
- );
1634
- }
1683
+ )
1684
+ ]
1635
1685
  }
1636
- }
1637
- )
1638
- ]
1639
- }
1640
- )
1686
+ )
1687
+ }
1688
+ )
1689
+ );
1690
+ }
1641
1691
  }
1642
1692
  )
1643
- );
1693
+ }
1644
1694
  }
1645
- }
1646
- ),
1647
- label: "Sequence"
1695
+ ),
1696
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1697
+ "div",
1698
+ {
1699
+ ...{
1700
+ className: "pt-6"
1701
+ },
1702
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1703
+ import_button.default,
1704
+ {
1705
+ ...{
1706
+ disabled: checkingAny,
1707
+ loading: (formState == null ? void 0 : formState.isSubmitting) || checkingAny,
1708
+ type: "submit"
1709
+ },
1710
+ children: "Save"
1711
+ }
1712
+ )
1713
+ }
1714
+ )
1715
+ ]
1648
1716
  }
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
- ]
1717
+ )
1718
+ }
1719
+ )
1663
1720
  }
1664
1721
  )
1665
1722
  }
@@ -1669,11 +1726,11 @@ const FormOrganizationWorkflowEdit = ({
1669
1726
  0 && (module.exports = {
1670
1727
  FormOrganizationWorkflowEdit,
1671
1728
  RESPONSE,
1672
- SAMPLE,
1673
1729
  TextPreview,
1674
1730
  firstEntryOnly,
1675
1731
  hasStepOptions,
1676
1732
  issueRow,
1733
+ listsMembers,
1677
1734
  lockedStepOption,
1678
1735
  memberOptions,
1679
1736
  partToStart,
@@ -1687,7 +1744,7 @@ const FormOrganizationWorkflowEdit = ({
1687
1744
  stepReason,
1688
1745
  stepRow,
1689
1746
  stepVariables,
1747
+ useEmailPreview,
1690
1748
  useStepPrefill,
1691
- webhookSample,
1692
1749
  workflowSchema
1693
1750
  });