@drawbridge/components 0.1.34 → 0.1.36

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