@drawbridge/components 0.1.35 → 0.1.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (338) hide show
  1. package/components/styles.css +355 -68
  2. package/dist/advertisement.js +20 -15
  3. package/dist/advertisement.mjs +20 -15
  4. package/dist/bridge/advertisements.js +2 -4
  5. package/dist/bridge/advertisements.mjs +3 -5
  6. package/dist/bridge/fields.js +6 -89
  7. package/dist/bridge/fields.mjs +7 -89
  8. package/dist/bridge/form-subdomain-embed.js +1 -5
  9. package/dist/bridge/form-subdomain-embed.mjs +1 -5
  10. package/dist/bridge/form-subdomain-header.js +14 -21
  11. package/dist/bridge/form-subdomain-header.mjs +14 -20
  12. package/dist/bridge/form-subdomain-issue.js +8 -17
  13. package/dist/bridge/form-subdomain-issue.mjs +8 -17
  14. package/dist/bridge/form-subdomain-missions.js +52 -58
  15. package/dist/bridge/form-subdomain-missions.mjs +54 -60
  16. package/dist/bridge/form-subdomain.js +94 -223
  17. package/dist/bridge/form-subdomain.mjs +96 -222
  18. package/dist/bridge/lib/entry.js +6 -61
  19. package/dist/bridge/lib/entry.mjs +5 -51
  20. package/dist/bridge/lib/order.js +0 -23
  21. package/dist/bridge/lib/order.mjs +0 -20
  22. package/dist/bridge/template-layout.js +2 -5
  23. package/dist/bridge/template-layout.mjs +3 -6
  24. package/dist/bridge/template-modal.js +15 -82
  25. package/dist/bridge/template-modal.mjs +16 -83
  26. package/dist/bridge/template-preview.js +208 -0
  27. package/dist/bridge/template-preview.mjs +173 -0
  28. package/dist/bridge/template-subdomain-gallery.js +75 -126
  29. package/dist/bridge/template-subdomain-gallery.mjs +75 -122
  30. package/dist/bridge/template-subdomain.js +14 -16
  31. package/dist/bridge/template-subdomain.mjs +15 -17
  32. package/dist/dashboard/avatar.js +0 -5
  33. package/dist/dashboard/avatar.mjs +0 -5
  34. package/dist/dashboard/card-affiliate.js +2 -3
  35. package/dist/dashboard/card-affiliate.mjs +2 -3
  36. package/dist/dashboard/card-campaign-switch.js +9 -34
  37. package/dist/dashboard/card-campaign-switch.mjs +8 -32
  38. package/dist/dashboard/card-connection.js +91 -51
  39. package/dist/dashboard/card-connection.mjs +89 -50
  40. package/dist/dashboard/card-order.js +14 -6
  41. package/dist/dashboard/card-order.mjs +14 -6
  42. package/dist/dashboard/card-section.js +26 -69
  43. package/dist/dashboard/card-section.mjs +26 -65
  44. package/dist/dashboard/card-tile.js +35 -3
  45. package/dist/dashboard/card-tile.mjs +34 -3
  46. package/dist/dashboard/device.js +95 -0
  47. package/dist/dashboard/device.mjs +72 -0
  48. package/dist/dashboard/drawer-subscription.js +14 -52
  49. package/dist/dashboard/drawer-subscription.mjs +14 -52
  50. package/dist/dashboard/drawer.js +3 -20
  51. package/dist/dashboard/drawer.mjs +4 -21
  52. package/dist/dashboard/dropdown.js +2 -6
  53. package/dist/dashboard/dropdown.mjs +2 -6
  54. package/dist/dashboard/form-admin-subscription-custom.js +8 -72
  55. package/dist/dashboard/form-admin-subscription-custom.mjs +8 -72
  56. package/dist/dashboard/form-ai.js +148 -0
  57. package/dist/dashboard/form-ai.mjs +148 -1
  58. package/dist/dashboard/form-filters-analytics.js +62 -85
  59. package/dist/dashboard/form-filters-analytics.mjs +61 -85
  60. package/dist/dashboard/form-organization-brand.js +13 -30
  61. package/dist/dashboard/form-organization-brand.mjs +13 -30
  62. package/dist/dashboard/form-organization-campaign-advertisement.js +112 -38
  63. package/dist/dashboard/form-organization-campaign-advertisement.mjs +112 -38
  64. package/dist/dashboard/form-organization-campaign-agreement.js +210 -414
  65. package/dist/dashboard/form-organization-campaign-agreement.mjs +212 -411
  66. package/dist/dashboard/form-organization-campaign-field-list.js +425 -0
  67. package/dist/dashboard/form-organization-campaign-field-list.mjs +396 -0
  68. package/dist/dashboard/form-organization-campaign-field-number.js +7 -48
  69. package/dist/dashboard/form-organization-campaign-field-number.mjs +7 -48
  70. package/dist/dashboard/form-organization-campaign-field-select.js +4 -15
  71. package/dist/dashboard/form-organization-campaign-field-select.mjs +4 -15
  72. package/dist/dashboard/form-organization-campaign-field-text.js +6 -46
  73. package/dist/dashboard/form-organization-campaign-field-text.mjs +6 -46
  74. package/dist/dashboard/form-organization-campaign-field-textarea.js +13 -22
  75. package/dist/dashboard/form-organization-campaign-field-textarea.mjs +13 -22
  76. package/dist/dashboard/form-organization-campaign-integration-age.js +35 -2
  77. package/dist/dashboard/form-organization-campaign-integration-age.mjs +35 -2
  78. package/dist/dashboard/form-organization-campaign-integration-geocode.js +1 -4
  79. package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +1 -4
  80. package/dist/dashboard/form-organization-campaign-page-embed.js +1 -1
  81. package/dist/dashboard/form-organization-campaign-page-embed.mjs +1 -1
  82. package/dist/dashboard/form-organization-campaign-page-preview.js +2 -1
  83. package/dist/dashboard/form-organization-campaign-page-preview.mjs +2 -1
  84. package/dist/dashboard/form-organization-campaign-page-qr.js +2 -2
  85. package/dist/dashboard/form-organization-campaign-page-qr.mjs +2 -2
  86. package/dist/dashboard/form-organization-campaign-page-share.js +5 -5
  87. package/dist/dashboard/form-organization-campaign-page-share.mjs +5 -5
  88. package/dist/dashboard/form-organization-campaign-page-slug.js +3 -2
  89. package/dist/dashboard/form-organization-campaign-page-slug.mjs +3 -2
  90. package/dist/dashboard/form-organization-campaign-page.js +265 -168
  91. package/dist/dashboard/form-organization-campaign-page.mjs +266 -170
  92. package/dist/dashboard/form-organization-campaign-section.js +107 -125
  93. package/dist/dashboard/form-organization-campaign-section.mjs +107 -121
  94. package/dist/dashboard/form-organization-campaign.js +9 -119
  95. package/dist/dashboard/form-organization-campaign.mjs +9 -118
  96. package/dist/dashboard/form-organization-file-frame.js +1 -7
  97. package/dist/dashboard/form-organization-file-frame.mjs +1 -7
  98. package/dist/dashboard/form-organization-workflow.js +545 -589
  99. package/dist/dashboard/form-organization-workflow.mjs +545 -590
  100. package/dist/dashboard/form-organization.js +0 -22
  101. package/dist/dashboard/form-organization.mjs +0 -22
  102. package/dist/dashboard/form-verify-prize.js +34 -114
  103. package/dist/dashboard/form-verify-prize.mjs +34 -111
  104. package/dist/dashboard/google.js +1 -8
  105. package/dist/dashboard/google.mjs +1 -8
  106. package/dist/dashboard/input-array.js +0 -2
  107. package/dist/dashboard/input-array.mjs +0 -2
  108. package/dist/dashboard/input-combobox.js +9 -0
  109. package/dist/dashboard/input-combobox.mjs +9 -0
  110. package/dist/dashboard/input-date.js +8 -3
  111. package/dist/dashboard/input-date.mjs +8 -3
  112. package/dist/dashboard/input-editor.js +6 -17
  113. package/dist/dashboard/input-editor.mjs +6 -17
  114. package/dist/dashboard/input-fields.js +437 -287
  115. package/dist/dashboard/input-fields.mjs +436 -287
  116. package/dist/dashboard/input-file.js +2 -70
  117. package/dist/dashboard/input-file.mjs +2 -70
  118. package/dist/dashboard/input-font.js +55 -64
  119. package/dist/dashboard/input-font.mjs +55 -64
  120. package/dist/dashboard/input-resource.js +1 -4
  121. package/dist/dashboard/input-resource.mjs +1 -4
  122. package/dist/dashboard/item-row.js +92 -0
  123. package/dist/dashboard/item-row.mjs +63 -0
  124. package/dist/dashboard/lib/features.js +1 -1
  125. package/dist/dashboard/lib/features.mjs +1 -1
  126. package/dist/dashboard/lib/item-list.js +15 -0
  127. package/dist/dashboard/lib/item-list.mjs +14 -0
  128. package/dist/dashboard/lib/rail.js +17 -16
  129. package/dist/dashboard/lib/rail.mjs +16 -15
  130. package/dist/dashboard/lib/sms.js +2 -8
  131. package/dist/dashboard/lib/sms.mjs +1 -6
  132. package/dist/dashboard/list-resource.js +0 -2
  133. package/dist/dashboard/list-resource.mjs +0 -2
  134. package/dist/dashboard/menu.js +5 -54
  135. package/dist/dashboard/menu.mjs +5 -53
  136. package/dist/dashboard/modal.js +4 -19
  137. package/dist/dashboard/modal.mjs +5 -20
  138. package/dist/dashboard/order-sections.js +0 -4
  139. package/dist/dashboard/order-sections.mjs +0 -4
  140. package/dist/dashboard/preview.js +324 -838
  141. package/dist/dashboard/preview.mjs +324 -826
  142. package/dist/dashboard/provider-ui.js +12 -20
  143. package/dist/dashboard/provider-ui.mjs +13 -21
  144. package/dist/dashboard/recharts.js +28 -53
  145. package/dist/dashboard/recharts.mjs +28 -53
  146. package/dist/dashboard/swatch.js +0 -35
  147. package/dist/dashboard/swatch.mjs +0 -31
  148. package/dist/dashboard/table-contacts.js +10 -6
  149. package/dist/dashboard/table-contacts.mjs +10 -6
  150. package/dist/dashboard/table.js +3 -10
  151. package/dist/dashboard/table.mjs +3 -9
  152. package/dist/dashboard/template-dashboard.js +21 -13
  153. package/dist/dashboard/template-dashboard.mjs +21 -12
  154. package/dist/dashboard/template-rail.js +126 -198
  155. package/dist/dashboard/template-rail.mjs +125 -196
  156. package/dist/dashboard/template-socket.js +12 -0
  157. package/dist/dashboard/template-socket.mjs +12 -0
  158. package/dist/dashboard/template-ui.js +11 -20
  159. package/dist/dashboard/template-ui.mjs +13 -22
  160. package/dist/input-checkbox.js +1 -7
  161. package/dist/input-checkbox.mjs +1 -7
  162. package/dist/input-name.js +3 -3
  163. package/dist/input-name.mjs +3 -3
  164. package/dist/input-select.js +1 -3
  165. package/dist/input-select.mjs +1 -3
  166. package/dist/provider-font.js +3 -4
  167. package/dist/provider-font.mjs +3 -4
  168. package/dist/shared/badge.js +0 -15
  169. package/dist/shared/badge.mjs +0 -11
  170. package/dist/shared/carousel.js +7 -11
  171. package/dist/shared/carousel.mjs +7 -11
  172. package/dist/shared/lib/campaign.js +9 -3
  173. package/dist/shared/lib/campaign.mjs +9 -3
  174. package/dist/shared/lib/helpers.js +0 -24
  175. package/dist/shared/lib/helpers.mjs +0 -22
  176. package/dist/shared/lib/video.js +0 -6
  177. package/dist/shared/lib/video.mjs +0 -5
  178. package/dist/shared/sortable.js +10 -27
  179. package/dist/shared/sortable.mjs +10 -27
  180. package/dist/shared/tabs.js +1 -1
  181. package/dist/shared/tabs.mjs +1 -1
  182. package/dist/video.js +9 -127
  183. package/dist/video.mjs +11 -125
  184. package/package.json +20 -176
  185. package/types/bridge/fields.d.ts +1 -6
  186. package/types/bridge/form-subdomain-missions.d.ts +0 -2
  187. package/types/bridge/form-subdomain.d.ts +3 -62
  188. package/types/bridge/lib/entry.d.ts +7 -44
  189. package/types/bridge/lib/order.d.ts +2 -13
  190. package/types/bridge/subdomain-content.d.ts +0 -1
  191. package/types/bridge/template-preview.d.ts +10 -0
  192. package/types/bridge/template-subdomain-gallery.d.ts +1 -13
  193. package/types/dashboard/card-campaign-switch.d.ts +1 -20
  194. package/types/dashboard/card-connection.d.ts +8 -0
  195. package/types/dashboard/card-order.d.ts +2 -2
  196. package/types/dashboard/card-section.d.ts +1 -9
  197. package/types/dashboard/card-tile.d.ts +9 -4
  198. package/types/dashboard/device.d.ts +12 -0
  199. package/types/dashboard/drawer.d.ts +0 -3
  200. package/types/dashboard/form-ai.d.ts +17 -0
  201. package/types/dashboard/form-filters-analytics.d.ts +14 -0
  202. package/types/dashboard/form-organization-brand.d.ts +0 -3
  203. package/types/dashboard/form-organization-campaign-agreement.d.ts +10 -53
  204. package/types/dashboard/form-organization-campaign-field-list.d.ts +36 -0
  205. package/types/dashboard/form-organization-campaign-field-number.d.ts +1 -4
  206. package/types/dashboard/form-organization-campaign-field-select.d.ts +1 -6
  207. package/types/dashboard/form-organization-campaign-field-text.d.ts +1 -5
  208. package/types/dashboard/form-organization-campaign-field-textarea.d.ts +1 -4
  209. package/types/dashboard/form-organization-campaign-integration-age.d.ts +1 -2
  210. package/types/dashboard/form-organization-campaign-integration-geocode.d.ts +0 -2
  211. package/types/dashboard/form-organization-campaign-page.d.ts +15 -9
  212. package/types/dashboard/form-organization-campaign-section.d.ts +8 -24
  213. package/types/dashboard/form-organization-campaign.d.ts +0 -3
  214. package/types/dashboard/form-organization-workflow.d.ts +4 -3
  215. package/types/dashboard/form-organization.d.ts +2 -2
  216. package/types/dashboard/form-verify-prize.d.ts +3 -30
  217. package/types/dashboard/input-combobox.d.ts +2 -0
  218. package/types/dashboard/input-date.d.ts +2 -0
  219. package/types/dashboard/input-editor.d.ts +0 -9
  220. package/types/dashboard/input-fields.d.ts +5 -8
  221. package/types/dashboard/input-file.d.ts +0 -4
  222. package/types/dashboard/input-resource.d.ts +0 -1
  223. package/types/dashboard/item-row.d.ts +25 -0
  224. package/types/dashboard/lib/item-list.d.ts +5 -10
  225. package/types/dashboard/lib/rail.d.ts +1 -0
  226. package/types/dashboard/lib/sms.d.ts +0 -7
  227. package/types/dashboard/modal.d.ts +1 -3
  228. package/types/dashboard/preview.d.ts +10 -65
  229. package/types/dashboard/recharts.d.ts +0 -3
  230. package/types/dashboard/swatch.d.ts +0 -4
  231. package/types/dashboard/template-dashboard.d.ts +2 -3
  232. package/types/input-select.d.ts +0 -2
  233. package/types/shared/button.d.ts +1 -1
  234. package/types/shared/lib/helpers.d.ts +1 -22
  235. package/types/shared/lib/video.d.ts +0 -3
  236. package/types/shared/sortable.d.ts +0 -6
  237. package/types/video.d.ts +2 -18
  238. package/dist/bridge/form-subdomain-agreement.js +0 -165
  239. package/dist/bridge/form-subdomain-agreement.mjs +0 -132
  240. package/dist/dashboard/campaign-form.js +0 -1798
  241. package/dist/dashboard/campaign-form.mjs +0 -1769
  242. package/dist/dashboard/card-campaign-agreement.js +0 -172
  243. package/dist/dashboard/card-campaign-agreement.mjs +0 -139
  244. package/dist/dashboard/card-shortcut.js +0 -181
  245. package/dist/dashboard/card-shortcut.mjs +0 -152
  246. package/dist/dashboard/document-blocks.js +0 -305
  247. package/dist/dashboard/document-blocks.mjs +0 -270
  248. package/dist/dashboard/form-organization-campaign-advertisements.js +0 -374
  249. package/dist/dashboard/form-organization-campaign-advertisements.mjs +0 -345
  250. package/dist/dashboard/form-organization-campaign-design.js +0 -258
  251. package/dist/dashboard/form-organization-campaign-design.mjs +0 -223
  252. package/dist/dashboard/form-organization-campaign-field-item.js +0 -585
  253. package/dist/dashboard/form-organization-campaign-field-item.mjs +0 -552
  254. package/dist/dashboard/form-organization-campaign-field-skill.js +0 -359
  255. package/dist/dashboard/form-organization-campaign-field-skill.mjs +0 -330
  256. package/dist/dashboard/form-organization-campaign-footer.js +0 -178
  257. package/dist/dashboard/form-organization-campaign-footer.mjs +0 -149
  258. package/dist/dashboard/form-reposition.js +0 -396
  259. package/dist/dashboard/form-reposition.mjs +0 -359
  260. package/dist/dashboard/form-support.js +0 -189
  261. package/dist/dashboard/form-support.mjs +0 -160
  262. package/dist/dashboard/form-tests.js +0 -683
  263. package/dist/dashboard/form-tests.mjs +0 -646
  264. package/dist/dashboard/lib/ab-tests.js +0 -130
  265. package/dist/dashboard/lib/ab-tests.mjs +0 -94
  266. package/dist/dashboard/lib/focus.js +0 -93
  267. package/dist/dashboard/lib/focus.mjs +0 -69
  268. package/dist/dashboard/lib/form-page.js +0 -203
  269. package/dist/dashboard/lib/form-page.mjs +0 -155
  270. package/dist/dashboard/template-design.js +0 -564
  271. package/dist/dashboard/template-design.mjs +0 -531
  272. package/dist/dashboard/template-test-page.js +0 -436
  273. package/dist/dashboard/template-test-page.mjs +0 -407
  274. package/dist/dashboard/template-tests.js +0 -141
  275. package/dist/dashboard/template-tests.mjs +0 -112
  276. package/dist/dashboard/template-variant.js +0 -185
  277. package/dist/dashboard/template-variant.mjs +0 -156
  278. package/dist/icons/arrow-down-long.js +0 -47
  279. package/dist/icons/arrow-down-long.mjs +0 -28
  280. package/dist/icons/arrows-pointing-out.js +0 -46
  281. package/dist/icons/arrows-pointing-out.mjs +0 -27
  282. package/dist/icons/beaker.js +0 -46
  283. package/dist/icons/beaker.mjs +0 -27
  284. package/dist/icons/identification.js +0 -46
  285. package/dist/icons/identification.mjs +0 -27
  286. package/dist/icons/lifebuoy.js +0 -46
  287. package/dist/icons/lifebuoy.mjs +0 -27
  288. package/dist/icons/rectangle-group.js +0 -46
  289. package/dist/icons/rectangle-group.mjs +0 -27
  290. package/dist/icons/rectangle-stack.js +0 -46
  291. package/dist/icons/rectangle-stack.mjs +0 -27
  292. package/dist/icons/shopping-bag.js +0 -46
  293. package/dist/icons/shopping-bag.mjs +0 -27
  294. package/dist/icons/swatch.js +0 -46
  295. package/dist/icons/swatch.mjs +0 -27
  296. package/dist/icons/window.js +0 -46
  297. package/dist/icons/window.mjs +0 -27
  298. package/dist/icons/zoom-in.js +0 -46
  299. package/dist/icons/zoom-in.mjs +0 -27
  300. package/dist/input-answer.js +0 -60
  301. package/dist/input-answer.mjs +0 -27
  302. package/dist/shared/document-pieces.js +0 -295
  303. package/dist/shared/document-pieces.mjs +0 -260
  304. package/types/bridge/form-subdomain-agreement.d.ts +0 -27
  305. package/types/dashboard/campaign-form.d.ts +0 -42
  306. package/types/dashboard/card-campaign-agreement.d.ts +0 -26
  307. package/types/dashboard/card-shortcut.d.ts +0 -38
  308. package/types/dashboard/document-blocks.d.ts +0 -14
  309. package/types/dashboard/form-organization-campaign-advertisements.d.ts +0 -15
  310. package/types/dashboard/form-organization-campaign-design.d.ts +0 -46
  311. package/types/dashboard/form-organization-campaign-field-item.d.ts +0 -36
  312. package/types/dashboard/form-organization-campaign-field-skill.d.ts +0 -36
  313. package/types/dashboard/form-organization-campaign-footer.d.ts +0 -23
  314. package/types/dashboard/form-reposition.d.ts +0 -29
  315. package/types/dashboard/form-support.d.ts +0 -14
  316. package/types/dashboard/form-tests.d.ts +0 -78
  317. package/types/dashboard/lib/ab-tests.d.ts +0 -50
  318. package/types/dashboard/lib/escape.d.ts +0 -4
  319. package/types/dashboard/lib/focus.d.ts +0 -16
  320. package/types/dashboard/lib/form-page.d.ts +0 -25
  321. package/types/dashboard/template-design.d.ts +0 -30
  322. package/types/dashboard/template-test-page.d.ts +0 -69
  323. package/types/dashboard/template-tests.d.ts +0 -30
  324. package/types/dashboard/template-variant.d.ts +0 -18
  325. package/types/icons/arrow-down-long.d.ts +0 -5
  326. package/types/icons/arrows-pointing-out.d.ts +0 -5
  327. package/types/icons/beaker.d.ts +0 -5
  328. package/types/icons/identification.d.ts +0 -5
  329. package/types/icons/lifebuoy.d.ts +0 -5
  330. package/types/icons/rectangle-group.d.ts +0 -5
  331. package/types/icons/rectangle-stack.d.ts +0 -5
  332. package/types/icons/shopping-bag.d.ts +0 -5
  333. package/types/icons/swatch.d.ts +0 -5
  334. package/types/icons/window.d.ts +0 -5
  335. package/types/icons/zoom-in.d.ts +0 -5
  336. package/types/input-answer.d.ts +0 -15
  337. package/types/shared/document-pieces.d.ts +0 -34
  338. package/types/shared/lib/motion.d.ts +0 -2
@@ -2,9 +2,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import Image from "next/image";
3
3
  import Link from "./link.mjs";
4
4
  import { Fragment, useCallback, useEffect, useRef, useState } from "react";
5
- import { constants, getPlanFeature } from "@drawbridge/drawbridge-utils";
6
- import { organization as organizationFeatures } from "@drawbridge/drawbridge-utils/features";
7
- import { isTransientError, request } from "@drawbridge/drawbridge-utils/fetch";
5
+ import { constants } from "@drawbridge/drawbridge-utils";
6
+ import { request } from "@drawbridge/drawbridge-utils/fetch";
8
7
  import { escapeHtml } from "@drawbridge/drawbridge-utils/html";
9
8
  import { useForm, useWatch, Controller } from "../shared/lib/form.mjs";
10
9
  import { keepPreviousData, useQuery, useQueryClient } from "@tanstack/react-query";
@@ -24,13 +23,13 @@ import Badge from "../shared/badge.mjs";
24
23
  import InputSwitch from "../shared/input-switch.mjs";
25
24
  import CardSection from "./card-section.mjs";
26
25
  import Accordion from "./accordion.mjs";
27
- import Preview, { Mail, NoPreview, SliderLayout, useCard } from "./preview.mjs";
26
+ import Preview from "./preview.mjs";
28
27
  import CardTask from "./card-task.mjs";
29
28
  import { LoaderDynamic } from "../shared/loader.mjs";
30
29
  import { smsBrandLine, smsNumberActive } from "./lib/sms.mjs";
30
+ import Lock from "../icons/lock.mjs";
31
31
  import Trash from "../icons/trash.mjs";
32
32
  import Button from "../shared/button.mjs";
33
- import { hasCapability } from "../shared/lib/helpers.mjs";
34
33
  const emailSteps = ["step.email.send"];
35
34
  const teamSteps = ["step.email.notify"];
36
35
  const messageSteps = [...emailSteps, "step.sms.send"];
@@ -61,10 +60,6 @@ const memberParams = {
61
60
  createdAt: -1
62
61
  }
63
62
  };
64
- const listsMembers = (organization) => {
65
- var _a;
66
- return hasCapability(organization, "members") && (getPlanFeature(organization == null ? void 0 : organization.plan, organizationFeatures.members.key).granted || ((_a = organization == null ? void 0 : organization.totals) == null ? void 0 : _a.members) > 0);
67
- };
68
63
  const memberOptions = (organization) => ({
69
64
  queryKey: ["organization-members", organization, "options"],
70
65
  queryFn: async () => {
@@ -77,11 +72,11 @@ const memberOptions = (organization) => ({
77
72
  },
78
73
  staleTime: Infinity
79
74
  });
80
- const useOrganizationMembers = (organization, listed) => {
75
+ const useOrganizationMembers = (organization) => {
81
76
  var _a;
82
77
  const members = useQuery({
83
78
  ...memberOptions(organization),
84
- enabled: Boolean(organization) && listed
79
+ enabled: Boolean(organization)
85
80
  });
86
81
  return {
87
82
  items: ((_a = members.data) == null ? void 0 : _a.items) || [],
@@ -134,6 +129,15 @@ const stepReason = ({ entry, saved = [], type }) => {
134
129
  var _a, _b;
135
130
  return ((_a = ((entry == null ? void 0 : entry.steps) || []).find((step) => (step == null ? void 0 : step.value) === type && (step == null ? void 0 : step.reason))) == null ? void 0 : _a.reason) || ((_b = saved.find((step) => (step == null ? void 0 : step.type) === type && (step == null ? void 0 : step.reason))) == null ? void 0 : _b.reason) || null;
136
131
  };
132
+ const lockedStepOption = (step, current) => (step == null ? void 0 : step.locked) && step.value !== current ? {
133
+ badge: {
134
+ text: step.locked
135
+ },
136
+ disabled: true,
137
+ element: void 0,
138
+ icon: Lock,
139
+ props: {}
140
+ } : {};
137
141
  const hasStepOptions = (options = []) => options.some((option) => Boolean(option == null ? void 0 : option.value) && !(option == null ? void 0 : option.disabled));
138
142
  const responseStart = (number) => ({
139
143
  email: {
@@ -344,10 +348,9 @@ const workflowSchema = yup.object({
344
348
  )
345
349
  });
346
350
  const useEmailPreview = ({ campaign, event, message, organization, subject, text, type }) => {
347
- const queryClient = useQueryClient();
348
351
  const asked = JSON.stringify(teamSteps.includes(type) ? { type } : { message, subject, text });
349
352
  const [settled, setSettled] = useState(asked);
350
- const held = ["workflow-email-preview-shown", organization, campaign, event, type || null];
353
+ const last = useRef();
351
354
  useEffect(() => {
352
355
  const timer = setTimeout(() => setSettled(asked), 400);
353
356
  return () => clearTimeout(timer);
@@ -361,33 +364,22 @@ const useEmailPreview = ({ campaign, event, message, organization, subject, text
361
364
  endpoint: "/organization/" + organization + "/campaign/" + campaign + "/workflow/" + event + "/preview",
362
365
  method: "POST"
363
366
  });
364
- queryClient.setQueryData(held, result);
365
367
  return result;
366
368
  },
367
369
  // Stale at once ( the dashboard's default is never ): the key holds the
368
370
  // step's copy only, and the placeholder under it is the campaign's, so
369
371
  // each visit to the trigger page asks again (Asana 1217773117236699).
370
372
  queryKey: ["workflow-email-preview", organization, campaign, event, settled],
371
- retry: (count, error) => count < 5 && isTransientError(error),
372
373
  staleTime: 0
373
374
  });
374
- return preview.data || queryClient.getQueryData(held);
375
+ if (preview.data) last.current = preview.data;
376
+ return last.current;
375
377
  };
376
- const Shown = ({ children, off }) => /* @__PURE__ */ jsx(
377
- "div",
378
- {
379
- ...{
380
- className: "mx-auto w-full max-w-[600px] px-6 space-y-4" + (off ? " opacity-50" : "")
381
- },
382
- children
383
- }
384
- );
385
378
  const EmailStepCard = ({
386
379
  card,
387
380
  children,
388
381
  control,
389
382
  off,
390
- slide,
391
383
  email: {
392
384
  campaign,
393
385
  event,
@@ -402,14 +394,12 @@ const EmailStepCard = ({
402
394
  name: [name + ".subject", name + ".message", name + ".text"]
403
395
  });
404
396
  const preview = useEmailPreview({ campaign, event, message, organization, subject, text, type });
405
- const target = useCard(slide);
406
397
  return /* @__PURE__ */ jsxs(
407
398
  CardSection,
408
399
  {
409
400
  ...{
410
401
  ...card,
411
- ...target.props,
412
- className: "relative shrink-0" + target.className
402
+ columns: 2
413
403
  },
414
404
  children: [
415
405
  /* @__PURE__ */ jsxs(
@@ -443,36 +433,46 @@ const EmailStepCard = ({
443
433
  }
444
434
  ),
445
435
  /* @__PURE__ */ jsx(
446
- Preview,
436
+ "div",
447
437
  {
448
438
  ...{
449
- id: slide
439
+ className: off ? "opacity-50" : ""
450
440
  },
451
- children: /* @__PURE__ */ jsx(
452
- Shown,
441
+ children: /* @__PURE__ */ jsx(Preview, { children: /* @__PURE__ */ jsx(
442
+ "iframe",
453
443
  {
454
444
  ...{
455
- off
456
- },
457
- children: /* @__PURE__ */ jsx(
458
- Mail,
459
- {
460
- ...{
461
- // The rendered email, as a mail app shows it.
462
- html: preview == null ? void 0 : preview.html,
463
- title
464
- }
465
- }
466
- )
445
+ // The rendered email, as a mail app shows it.
446
+ className: "block w-full h-full border-0 bg-white",
447
+ srcDoc: (preview == null ? void 0 : preview.html) || "",
448
+ title
449
+ }
467
450
  }
468
- )
451
+ ) })
469
452
  }
470
453
  )
471
454
  ]
472
455
  }
473
456
  );
474
457
  };
475
- const TextPreview = ({ children }) => /* @__PURE__ */ jsx("div", { className: "p-6 font-sans", children: /* @__PURE__ */ jsx("div", { className: "max-w-xs px-4 py-3 rounded-2xl rounded-bl-sm bg-white text-black break-words", children }) });
458
+ const SAMPLE = {
459
+ email: "sam.rivera@example.com",
460
+ name: "Sam Rivera",
461
+ phone: "+14165550142"
462
+ };
463
+ const webhookSample = ({ campaign }) => JSON.stringify({
464
+ campaign: {
465
+ id: (campaign == null ? void 0 : campaign.id) || "cmp_sample",
466
+ title: (campaign == null ? void 0 : campaign.title) || "Your campaign"
467
+ },
468
+ email: SAMPLE.email,
469
+ id: "lead_sample",
470
+ name: SAMPLE.name,
471
+ phone: {
472
+ number: SAMPLE.phone
473
+ }
474
+ }, null, 2);
475
+ const TextPreview = ({ children }) => /* @__PURE__ */ jsx("div", { className: "p-6 font-sans", children: /* @__PURE__ */ jsx("div", { className: "max-w-xs px-4 py-3 rounded-2xl rounded-bl-sm bg-gray-light text-black break-words", children }) });
476
476
  const StepPreview = ({ campaign, control, image, name, organization, type }) => {
477
477
  const [message] = useWatch({
478
478
  control,
@@ -485,20 +485,23 @@ const StepPreview = ({ campaign, control, image, name, organization, type }) =>
485
485
  (campaign == null ? void 0 : campaign.awarding) && /* @__PURE__ */ 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" }),
486
486
  /* @__PURE__ */ jsx("p", { className: "mt-2", children: "Reply STOP to opt out" })
487
487
  ] });
488
- if (type === "step.webhook.send") return /* @__PURE__ */ jsx(NoPreview, {});
489
- return /* @__PURE__ */ jsx(NoPreview, { children: image && /* @__PURE__ */ jsx(
490
- Image,
491
- {
492
- ...{
493
- alt: "",
494
- className: "w-12 h-12 object-contain",
495
- height: 48,
496
- src: image,
497
- unoptimized: true,
498
- width: 48
488
+ if (type === "step.webhook.send") return /* @__PURE__ */ 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 }) });
489
+ return /* @__PURE__ */ jsxs("div", { className: "min-h-screen flex flex-col items-center justify-center gap-3 p-6 text-gray-dark", children: [
490
+ image && /* @__PURE__ */ jsx(
491
+ Image,
492
+ {
493
+ ...{
494
+ alt: "",
495
+ className: "w-12 h-12 object-contain",
496
+ height: 48,
497
+ src: image,
498
+ unoptimized: true,
499
+ width: 48
500
+ }
499
501
  }
500
- }
501
- ) });
502
+ ),
503
+ /* @__PURE__ */ jsx("p", { children: "No preview available" })
504
+ ] });
502
505
  };
503
506
  const LeadEmailNote = () => /* @__PURE__ */ jsx(
504
507
  "p",
@@ -544,7 +547,6 @@ const ResponseStepCard = ({
544
547
  formState,
545
548
  off,
546
549
  onChecking,
547
- slide,
548
550
  response: {
549
551
  autoResponse,
550
552
  campaign,
@@ -553,8 +555,6 @@ const ResponseStepCard = ({
553
555
  id,
554
556
  index,
555
557
  organization,
556
- picked,
557
- setPicked,
558
558
  settings,
559
559
  title,
560
560
  variables
@@ -562,6 +562,7 @@ const ResponseStepCard = ({
562
562
  setValue
563
563
  }) => {
564
564
  var _a, _b, _c, _d, _e;
565
+ const [picked, setPicked] = useState("email");
565
566
  const name = `steps.${index}`;
566
567
  const parts = responseParts({ autoResponse, campaign, organization, settings });
567
568
  const shown = parts.sms.absent ? "email" : parts.email.hidden ? "sms" : parts.sms.hidden ? "email" : picked;
@@ -575,7 +576,6 @@ const ResponseStepCard = ({
575
576
  text: (_c = settings == null ? void 0 : settings.email) == null ? void 0 : _c.text
576
577
  });
577
578
  const brand = smsBrandLine(title, (_d = settings == null ? void 0 : settings.sms) == null ? void 0 : _d.message);
578
- const target = useCard(slide);
579
579
  const partSwitch = ({ label, message, other, part }) => /* @__PURE__ */ jsx(
580
580
  Controller,
581
581
  {
@@ -615,8 +615,7 @@ const ResponseStepCard = ({
615
615
  {
616
616
  ...{
617
617
  ...card,
618
- ...target.props,
619
- className: "relative shrink-0" + target.className
618
+ columns: 2
620
619
  },
621
620
  children: [
622
621
  /* @__PURE__ */ jsxs(
@@ -754,29 +753,29 @@ const ResponseStepCard = ({
754
753
  }
755
754
  ),
756
755
  /* @__PURE__ */ jsx(
757
- Preview,
756
+ "div",
758
757
  {
759
758
  ...{
760
- id: slide,
761
- ...!parts.email.hidden && !parts.sms.hidden && {
762
- states: {
763
- onChange: setPicked,
764
- options: RESPONSE_STATES,
765
- value: shown
766
- }
767
- }
759
+ className: off || !parts[shown].on ? "opacity-50" : ""
768
760
  },
769
761
  children: /* @__PURE__ */ jsx(
770
- Shown,
762
+ Preview,
771
763
  {
772
764
  ...{
773
- off: off || !parts[shown].on
765
+ ...!parts.email.hidden && !parts.sms.hidden && {
766
+ states: {
767
+ onChange: setPicked,
768
+ options: RESPONSE_STATES,
769
+ value: shown
770
+ }
771
+ }
774
772
  },
775
773
  children: shown === "email" ? /* @__PURE__ */ jsx(
776
- Mail,
774
+ "iframe",
777
775
  {
778
776
  ...{
779
- html: preview == null ? void 0 : preview.html,
777
+ className: "block w-full h-full border-0 bg-white",
778
+ srcDoc: (preview == null ? void 0 : preview.html) || "",
780
779
  title: "Auto response"
781
780
  }
782
781
  }
@@ -810,54 +809,6 @@ const ResponseStepCard = ({
810
809
  }
811
810
  );
812
811
  };
813
- const PlainStepCard = ({
814
- children,
815
- control,
816
- off,
817
- preview,
818
- slide,
819
- ...card
820
- }) => {
821
- const target = useCard(slide);
822
- return /* @__PURE__ */ jsxs(
823
- CardSection,
824
- {
825
- ...{
826
- ...card,
827
- ...target.props,
828
- className: "relative shrink-0" + target.className
829
- },
830
- children: [
831
- children,
832
- /* @__PURE__ */ jsx(
833
- Preview,
834
- {
835
- ...{
836
- id: slide
837
- },
838
- children: /* @__PURE__ */ jsx(
839
- Shown,
840
- {
841
- ...{
842
- off
843
- },
844
- children: preview ? /* @__PURE__ */ jsx(
845
- StepPreview,
846
- {
847
- ...{
848
- control,
849
- ...preview
850
- }
851
- }
852
- ) : /* @__PURE__ */ jsx(NoPreview, {})
853
- }
854
- )
855
- }
856
- )
857
- ]
858
- }
859
- );
860
- };
861
812
  const StepCard = ({
862
813
  children,
863
814
  control,
@@ -869,7 +820,6 @@ const StepCard = ({
869
820
  preview,
870
821
  response,
871
822
  setValue,
872
- slide,
873
823
  ...card
874
824
  }) => response ? /* @__PURE__ */ jsx(
875
825
  ResponseStepCard,
@@ -882,8 +832,7 @@ const StepCard = ({
882
832
  off,
883
833
  onChecking,
884
834
  response,
885
- setValue,
886
- slide
835
+ setValue
887
836
  },
888
837
  children
889
838
  }
@@ -894,22 +843,37 @@ const StepCard = ({
894
843
  card,
895
844
  control,
896
845
  email,
897
- off,
898
- slide
846
+ off
899
847
  },
900
848
  children
901
849
  }
902
- ) : /* @__PURE__ */ jsx(
903
- PlainStepCard,
850
+ ) : /* @__PURE__ */ jsxs(
851
+ CardSection,
904
852
  {
905
853
  ...{
906
854
  ...card,
907
- control,
908
- off,
909
- preview,
910
- slide
855
+ columns: preview ? 2 : 1
911
856
  },
912
- children
857
+ children: [
858
+ children,
859
+ preview && /* @__PURE__ */ jsx(
860
+ "div",
861
+ {
862
+ ...{
863
+ className: off ? "opacity-50" : ""
864
+ },
865
+ children: /* @__PURE__ */ jsx(Preview, { children: /* @__PURE__ */ jsx(
866
+ StepPreview,
867
+ {
868
+ ...{
869
+ control,
870
+ ...preview
871
+ }
872
+ }
873
+ ) })
874
+ }
875
+ )
876
+ ]
913
877
  }
914
878
  );
915
879
  const FormOrganizationWorkflowEdit = ({
@@ -921,10 +885,9 @@ const FormOrganizationWorkflowEdit = ({
921
885
  }) => {
922
886
  var _a, _b, _c, _d, _e, _f, _g, _h;
923
887
  const event = (_a = values == null ? void 0 : values.trigger) == null ? void 0 : _a.event;
888
+ const { items: memberItems, loading: membersLoading } = useOrganizationMembers(values == null ? void 0 : values.organization);
924
889
  const queryClient = useQueryClient();
925
890
  const organizationData = queryClient.getQueryData(["organization", values == null ? void 0 : values.organization]);
926
- const membersListed = listsMembers(organizationData);
927
- const { items: memberItems, loading: membersLoading } = useOrganizationMembers(values == null ? void 0 : values.organization, membersListed);
928
891
  const ownerEmail = organizationData.owner.email;
929
892
  const smsActive = smsNumberActive(organizationData);
930
893
  const campaignData = queryClient.getQueryData(["campaign", values == null ? void 0 : values.campaign]);
@@ -945,7 +908,6 @@ const FormOrganizationWorkflowEdit = ({
945
908
  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;
946
909
  const defaultSteps = ((values == null ? void 0 : values.steps) || []).map((s) => stepRow(s, memberItems));
947
910
  const [checking, setChecking] = useState({});
948
- const [responsePart, setResponsePart] = useState("email");
949
911
  const checkingAny = Object.values(checking).some(Boolean);
950
912
  const onChecking = useCallback(
951
913
  (id, value) => setChecking(
@@ -953,13 +915,16 @@ const FormOrganizationWorkflowEdit = ({
953
915
  ),
954
916
  []
955
917
  );
956
- const { control, formState, getValues, handleSubmit, reset, setValue, watch } = useForm({
918
+ const { control, formState, getValues, handleSubmit, setValue } = useForm({
957
919
  values: {
958
920
  steps: defaultSteps
959
921
  },
960
922
  resolver: resolver(workflowSchema)
961
923
  });
962
- const watchedSteps = watch("steps");
924
+ const watchedSteps = useWatch({
925
+ control,
926
+ name: "steps"
927
+ });
963
928
  const issueIndex = issueRow({ issue: values == null ? void 0 : values.issue, steps: watchedSteps || [] });
964
929
  const getAvailableVariables = (index) => stepVariables(catalog, watchedSteps, index);
965
930
  const loading = membersLoading || commerceConnection.isLoading;
@@ -969,7 +934,7 @@ const FormOrganizationWorkflowEdit = ({
969
934
  return [
970
935
  { key: "Select a step", value: "" },
971
936
  ...((catalog == null ? void 0 : catalog.steps) || []).filter((step) => !usedTypes.includes(step.value)).sort((a, b) => String(a.key).localeCompare(String(b.key))).map((step) => {
972
- var _a2;
937
+ var _a2, _b2;
973
938
  return {
974
939
  ...step,
975
940
  // Option values must be unique per catalog entry, not per step
@@ -1035,7 +1000,8 @@ const FormOrganizationWorkflowEdit = ({
1035
1000
  text: "Owner access only"
1036
1001
  },
1037
1002
  disabled: true
1038
- } : {}
1003
+ } : {},
1004
+ ...lockedStepOption(step, (_b2 = watchedSteps == null ? void 0 : watchedSteps[index]) == null ? void 0 : _b2.type)
1039
1005
  };
1040
1006
  })
1041
1007
  ];
@@ -1147,7 +1113,6 @@ const FormOrganizationWorkflowEdit = ({
1147
1113
  setValue("steps." + index + ".connectionId", step.connectionId || "");
1148
1114
  setValue("steps." + index + ".slug", step.slug || "");
1149
1115
  });
1150
- reset(getValues());
1151
1116
  onSuccess(response);
1152
1117
  } catch (error) {
1153
1118
  onError(error);
@@ -1156,13 +1121,6 @@ const FormOrganizationWorkflowEdit = ({
1156
1121
  if (loading) {
1157
1122
  return /* @__PURE__ */ jsx(LoaderDynamic, {});
1158
1123
  }
1159
- const slides = (watchedSteps || []).map((step, index) => {
1160
- var _a2;
1161
- return {
1162
- id: "step-" + index,
1163
- 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 ")
1164
- };
1165
- });
1166
1124
  return /* @__PURE__ */ jsx(
1167
1125
  Form,
1168
1126
  {
@@ -1170,488 +1128,484 @@ const FormOrganizationWorkflowEdit = ({
1170
1128
  className: "relative w-full",
1171
1129
  onSubmit: handleSubmit(onSubmit)
1172
1130
  },
1173
- children: /* @__PURE__ */ jsx(
1174
- SliderLayout,
1131
+ children: /* @__PURE__ */ jsxs(
1132
+ Fieldset,
1175
1133
  {
1176
1134
  ...{
1177
- plain: true,
1178
- slides
1135
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
1179
1136
  },
1180
- children: /* @__PURE__ */ jsx(
1181
- Fieldset,
1182
- {
1183
- ...{
1184
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
1185
- },
1186
- children: /* @__PURE__ */ jsxs(
1187
- CardSection,
1188
- {
1189
- ...{
1190
- title: "Sequence",
1191
- variant: "gray"
1192
- },
1193
- children: [
1194
- /* @__PURE__ */ jsx(
1195
- InputGroup,
1196
- {
1197
- ...{
1198
- error: (_h = (_g = formState == null ? void 0 : formState.errors) == null ? void 0 : _g.steps) == null ? void 0 : _h.message,
1199
- input: /* @__PURE__ */ jsx(
1200
- InputArraySortable,
1137
+ children: [
1138
+ /* @__PURE__ */ jsx(
1139
+ CardTask,
1140
+ {
1141
+ ...{
1142
+ message: "Workflows run sequences that increase action usage.",
1143
+ title: "Workflows count towards actions",
1144
+ type: "warning"
1145
+ }
1146
+ }
1147
+ ),
1148
+ /* @__PURE__ */ jsxs(
1149
+ CardSection,
1150
+ {
1151
+ ...{
1152
+ "data-trigger": true,
1153
+ title: "Trigger"
1154
+ },
1155
+ children: [
1156
+ /* @__PURE__ */ jsx("p", { children: values == null ? void 0 : values.title }),
1157
+ (values == null ? void 0 : values.description) && /* @__PURE__ */ jsx(
1158
+ "p",
1159
+ {
1160
+ ...{
1161
+ className: "text-sm text-gray-dark"
1162
+ },
1163
+ children: values.description
1164
+ }
1165
+ )
1166
+ ]
1167
+ }
1168
+ ),
1169
+ /* @__PURE__ */ jsx(
1170
+ InputGroup,
1171
+ {
1172
+ ...{
1173
+ error: (_h = (_g = formState == null ? void 0 : formState.errors) == null ? void 0 : _g.steps) == null ? void 0 : _h.message,
1174
+ input: /* @__PURE__ */ jsx(
1175
+ InputArraySortable,
1176
+ {
1177
+ ...{
1178
+ control,
1179
+ empty: null,
1180
+ name: "steps",
1181
+ renderButton: (append) => /* @__PURE__ */ jsx(
1182
+ InputArrayButton,
1183
+ {
1184
+ ...{
1185
+ disabled: !canAddStep,
1186
+ onClick: () => append(stepRow()),
1187
+ text: "Add step"
1188
+ }
1189
+ }
1190
+ )
1191
+ },
1192
+ children: ({ field, handle, index, remove }) => {
1193
+ var _a2;
1194
+ const step = (watchedSteps == null ? void 0 : watchedSteps[index]) || field;
1195
+ const parts = step.type === RESPONSE && responseParts({
1196
+ autoResponse: values == null ? void 0 : values.autoResponse,
1197
+ campaign: values == null ? void 0 : values.campaign,
1198
+ organization: values == null ? void 0 : values.organization,
1199
+ settings: step.settings
1200
+ });
1201
+ const stepOptions = getStepOptions(index);
1202
+ return (
1203
+ // @story workflows/edit
1204
+ // EACH STEP IS ITS OWN CARD in the flow under the Trigger card,
1205
+ // edited in place: the drag handle left of Step N, as every
1206
+ // sortable list has it, then its connection badge and Remove
1207
+ // in the card's head, its fields in the body.
1208
+ /* @__PURE__ */ jsx(
1209
+ StepCard,
1201
1210
  {
1202
1211
  ...{
1203
1212
  control,
1204
- empty: null,
1205
- // Each handle says which step it moves.
1206
- handleLabel: (field) => {
1207
- var _a2;
1208
- 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");
1209
- },
1210
- name: "steps",
1211
- renderButton: (append) => /* @__PURE__ */ jsx(
1212
- InputArrayButton,
1213
- {
1214
- ...{
1215
- disabled: !canAddStep,
1216
- onClick: () => append(stepRow()),
1217
- text: "Add step"
1218
- }
1219
- }
1220
- )
1221
- },
1222
- children: ({ field, handle, index, remove }) => {
1223
- var _a2;
1224
- const step = (watchedSteps == null ? void 0 : watchedSteps[index]) || field;
1225
- const parts = step.type === RESPONSE && responseParts({
1213
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting),
1214
+ formState,
1215
+ onChecking,
1216
+ setValue,
1217
+ // @story workflows/auto-response
1218
+ response: step.type === RESPONSE && {
1226
1219
  autoResponse: values == null ? void 0 : values.autoResponse,
1227
1220
  campaign: values == null ? void 0 : values.campaign,
1221
+ enabled: step.enabled,
1222
+ event,
1223
+ id: field.id,
1224
+ index,
1228
1225
  organization: values == null ? void 0 : values.organization,
1229
- settings: step.settings
1230
- });
1231
- const stepOptions = getStepOptions(index);
1232
- return (
1233
- // @story workflows/edit
1234
- // EACH STEP IS ITS OWN CARD in the flow under the Trigger card,
1235
- // edited in place: the drag handle left of Step N, as every
1236
- // sortable list has it, then its connection badge and Remove
1237
- // in the card's head, its fields in the body.
1238
- /* @__PURE__ */ jsx(
1239
- StepCard,
1240
- {
1241
- ...{
1242
- control,
1243
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting),
1244
- formState,
1245
- onChecking,
1246
- setValue,
1247
- // @story workflows/auto-response
1248
- response: step.type === RESPONSE && {
1249
- autoResponse: values == null ? void 0 : values.autoResponse,
1250
- campaign: values == null ? void 0 : values.campaign,
1251
- enabled: step.enabled,
1252
- event,
1253
- id: field.id,
1254
- index,
1255
- organization: values == null ? void 0 : values.organization,
1256
- picked: responsePart,
1257
- setPicked: setResponsePart,
1258
- settings: step.settings,
1259
- title: organizationData == null ? void 0 : organizationData.title,
1260
- variables: getAvailableVariables(index)
1261
- },
1262
- // @story workflows/send-email
1263
- // A Send email step shows its email beside its form.
1264
- off: step.enabled === false,
1265
- // Every other step with a type has its preview too.
1266
- preview: step.type && !renderedSteps.includes(step.type) && {
1267
- campaign: campaignData,
1268
- image: ((_a2 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a2.image) || null,
1269
- name: `steps.${index}`,
1270
- organization: organizationData,
1271
- type: step.type
1272
- },
1273
- // Send email and Email notification show the email the api renders.
1274
- email: renderedSteps.includes(step.type) && {
1275
- campaign: values == null ? void 0 : values.campaign,
1276
- event,
1277
- name: `steps.${index}`,
1278
- organization: values == null ? void 0 : values.organization,
1279
- title: emailSteps.includes(step.type) ? "Send email" : "Email notification",
1280
- type: step.type
1226
+ settings: step.settings,
1227
+ title: organizationData == null ? void 0 : organizationData.title,
1228
+ variables: getAvailableVariables(index)
1229
+ },
1230
+ // @story workflows/send-email
1231
+ // A Send email step shows its email beside its form.
1232
+ off: step.enabled === false,
1233
+ // Every other step with a type has its preview too.
1234
+ preview: step.type && !renderedSteps.includes(step.type) && {
1235
+ campaign: campaignData,
1236
+ image: ((_a2 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a2.image) || null,
1237
+ name: `steps.${index}`,
1238
+ organization: organizationData,
1239
+ type: step.type
1240
+ },
1241
+ // Send email and Email notification show the email the api renders.
1242
+ email: renderedSteps.includes(step.type) && {
1243
+ campaign: values == null ? void 0 : values.campaign,
1244
+ event,
1245
+ name: `steps.${index}`,
1246
+ organization: values == null ? void 0 : values.organization,
1247
+ title: emailSteps.includes(step.type) ? "Send email" : "Email notification",
1248
+ type: step.type
1249
+ },
1250
+ cta: /* @__PURE__ */ jsxs(
1251
+ "span",
1252
+ {
1253
+ ...{
1254
+ className: "flex items-center gap-2"
1255
+ },
1256
+ children: [
1257
+ renderStepBadge(step, index),
1258
+ !lockedStep(index) && /* @__PURE__ */ jsx(
1259
+ InputArrayControl,
1260
+ {
1261
+ ...{
1262
+ onClick: () => remove(index),
1263
+ icon: Trash
1264
+ }
1281
1265
  },
1282
- cta: /* @__PURE__ */ jsxs(
1283
- "span",
1284
- {
1285
- ...{
1286
- className: "flex items-center gap-2"
1287
- },
1288
- children: [
1289
- renderStepBadge(step, index),
1290
- !lockedStep(index) && /* @__PURE__ */ jsx(
1291
- InputArrayControl,
1292
- {
1293
- ...{
1294
- onClick: () => remove(index),
1295
- icon: Trash
1296
- }
1297
- },
1298
- "remove"
1299
- ),
1300
- /* @__PURE__ */ jsx(
1301
- Controller,
1266
+ "remove"
1267
+ ),
1268
+ /* @__PURE__ */ jsx(
1269
+ Controller,
1270
+ {
1271
+ ...{
1272
+ control,
1273
+ name: `steps.${index}.enabled`,
1274
+ render: ({ field: { onChange, value } }) => {
1275
+ var _a3;
1276
+ return /* @__PURE__ */ jsx(
1277
+ InputSwitch,
1302
1278
  {
1303
1279
  ...{
1304
- control,
1305
- name: `steps.${index}.enabled`,
1306
- render: ({ field: { onChange, value } }) => {
1307
- var _a3;
1308
- return /* @__PURE__ */ jsx(
1309
- InputSwitch,
1310
- {
1311
- ...{
1312
- "aria-label": ((_a3 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a3.key) || "Step " + (index + 1),
1313
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting) || lockedStep(index) || parts && !parts.can,
1314
- onChange: (next) => {
1315
- onChange(next);
1316
- if (parts && next && partToStart(parts)) setValue(`steps.${index}.settings.${partToStart(parts)}.enabled`, true);
1317
- },
1318
- small: true,
1319
- value: value !== false && (!parts || parts.can)
1320
- }
1321
- }
1322
- );
1323
- }
1280
+ "aria-label": ((_a3 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a3.key) || "Step " + (index + 1),
1281
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting) || lockedStep(index) || parts && !parts.can,
1282
+ onChange: (next) => {
1283
+ onChange(next);
1284
+ if (parts && next && partToStart(parts)) setValue(`steps.${index}.settings.${partToStart(parts)}.enabled`, true);
1285
+ },
1286
+ small: true,
1287
+ value: value !== false && (!parts || parts.can)
1324
1288
  }
1325
1289
  }
1326
- )
1327
- ]
1328
- }
1329
- ),
1330
- "data-step": index + 1,
1331
- slide: "step-" + index,
1332
- title: /* @__PURE__ */ jsxs(
1333
- "span",
1334
- {
1335
- ...{
1336
- className: "flex items-center gap-2"
1337
- },
1338
- children: [
1339
- handle,
1340
- "Step " + (index + 1)
1341
- ]
1290
+ );
1291
+ }
1342
1292
  }
1343
- )
1344
- },
1345
- children: /* @__PURE__ */ jsxs(
1346
- "div",
1347
- {
1348
- ...{
1349
- // A step switched off is greyed; its settings are kept.
1350
- // Auto response's whole card greys, its parts as well.
1351
- className: "space-y-3" + (step.enabled === false && !parts ? " opacity-50" : "")
1352
- },
1353
- children: [
1354
- issueIndex === index && /* @__PURE__ */ jsx(
1355
- Error,
1356
- {
1357
- ...{
1358
- error: values.issue.message
1359
- }
1360
- }
1361
- ),
1362
- /* @__PURE__ */ jsx(
1363
- Controller,
1293
+ }
1294
+ )
1295
+ ]
1296
+ }
1297
+ ),
1298
+ "data-step": index + 1,
1299
+ title: /* @__PURE__ */ jsxs(
1300
+ "span",
1301
+ {
1302
+ ...{
1303
+ className: "flex items-center gap-2"
1304
+ },
1305
+ children: [
1306
+ handle,
1307
+ "Step " + (index + 1)
1308
+ ]
1309
+ }
1310
+ )
1311
+ },
1312
+ children: /* @__PURE__ */ jsxs(
1313
+ "div",
1314
+ {
1315
+ ...{
1316
+ // A step switched off is greyed; its settings are kept.
1317
+ // Auto response's whole card greys, its parts as well.
1318
+ className: "space-y-3" + (step.enabled === false && !parts ? " opacity-50" : "")
1319
+ },
1320
+ children: [
1321
+ issueIndex === index && /* @__PURE__ */ jsx(
1322
+ Error,
1323
+ {
1324
+ ...{
1325
+ error: values.issue.message
1326
+ }
1327
+ }
1328
+ ),
1329
+ /* @__PURE__ */ jsx(
1330
+ Controller,
1331
+ {
1332
+ ...{
1333
+ control,
1334
+ name: `steps.${index}.type`,
1335
+ render: ({ field: { onChange } }) => {
1336
+ var _a3, _b2, _c2, _d2;
1337
+ return /* @__PURE__ */ jsx(
1338
+ InputGroup,
1364
1339
  {
1365
1340
  ...{
1366
- control,
1367
- name: `steps.${index}.type`,
1368
- render: ({ field: { onChange } }) => {
1369
- var _a3, _b2, _c2, _d2;
1370
- return /* @__PURE__ */ jsx(
1371
- InputGroup,
1372
- {
1373
- ...{
1374
- 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,
1375
- input: /* @__PURE__ */ jsx(
1376
- InputCombobox,
1377
- {
1378
- ...{
1379
- onChange: (val) => {
1380
- var _a4;
1381
- const [type] = val.split("::");
1382
- const option = getStepOptions(index).find((o) => o.value === val);
1383
- const copy = pickedCopy({ row: getValues(`steps.${index}`), type });
1384
- setValue(`steps.${index}.settings`, type === RESPONSE ? responseStart((_a4 = values == null ? void 0 : values.autoResponse) == null ? void 0 : _a4.number) : null);
1385
- onChange(type);
1386
- setValue(`steps.${index}.connectionId`, (option == null ? void 0 : option.connectionId) || "");
1387
- setValue(`steps.${index}.slug`, (option == null ? void 0 : option.slug) || "");
1388
- if (copy) Object.entries(copy).forEach(([key, value]) => setValue(`steps.${index}.${key}`, value));
1389
- },
1390
- // Locked for a member on the owner's step; disabled
1391
- // with nothing left to pick.
1392
- disabled: lockedStep(index) || !hasStepOptions(stepOptions),
1393
- options: stepOptions,
1394
- // Resolved from the WHOLE ROW, not from this path: the
1395
- // option value carries a connection the type alone cannot
1396
- // name.
1397
- value: getStepValue(step, index)
1398
- }
1399
- }
1400
- ),
1401
- label: "Step"
1402
- }
1341
+ 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,
1342
+ input: /* @__PURE__ */ jsx(
1343
+ InputCombobox,
1344
+ {
1345
+ ...{
1346
+ onChange: (val) => {
1347
+ var _a4;
1348
+ const [type] = val.split("::");
1349
+ const option = getStepOptions(index).find((o) => o.value === val);
1350
+ const copy = pickedCopy({ row: getValues(`steps.${index}`), type });
1351
+ setValue(`steps.${index}.settings`, type === RESPONSE ? responseStart((_a4 = values == null ? void 0 : values.autoResponse) == null ? void 0 : _a4.number) : null);
1352
+ onChange(type);
1353
+ setValue(`steps.${index}.connectionId`, (option == null ? void 0 : option.connectionId) || "");
1354
+ setValue(`steps.${index}.slug`, (option == null ? void 0 : option.slug) || "");
1355
+ if (copy) Object.entries(copy).forEach(([key, value]) => setValue(`steps.${index}.${key}`, value));
1356
+ },
1357
+ // Locked for a member on the owner's step; disabled
1358
+ // with nothing left to pick.
1359
+ disabled: lockedStep(index) || !hasStepOptions(stepOptions),
1360
+ options: stepOptions,
1361
+ // Resolved from the WHOLE ROW, not from this path: the
1362
+ // option value carries a connection the type alone cannot
1363
+ // name.
1364
+ value: getStepValue(step, index)
1403
1365
  }
1404
- );
1405
- }
1366
+ }
1367
+ ),
1368
+ label: "Step"
1406
1369
  }
1407
1370
  }
1408
- ),
1409
- firstEntryOnly({ campaign: campaignData, event, type: step.type }) && /* @__PURE__ */ jsx(
1410
- "p",
1411
- {
1412
- ...{
1413
- className: "text-sm text-gray-dark"
1414
- },
1415
- children: "Runs on a person's first entry only."
1416
- }
1417
- ),
1418
- step.type === "step.webhook.send" && /* @__PURE__ */ jsx(
1419
- Controller,
1371
+ );
1372
+ }
1373
+ }
1374
+ }
1375
+ ),
1376
+ firstEntryOnly({ campaign: campaignData, event, type: step.type }) && /* @__PURE__ */ jsx(
1377
+ "p",
1378
+ {
1379
+ ...{
1380
+ className: "text-sm text-gray-dark"
1381
+ },
1382
+ children: "Runs on a person's first entry only."
1383
+ }
1384
+ ),
1385
+ step.type === "step.webhook.send" && /* @__PURE__ */ jsx(
1386
+ Controller,
1387
+ {
1388
+ ...{
1389
+ control,
1390
+ name: `steps.${index}.url`,
1391
+ render: ({ field: { value, onChange } }) => {
1392
+ var _a3, _b2, _c2, _d2;
1393
+ return /* @__PURE__ */ jsx(
1394
+ InputGroup,
1420
1395
  {
1421
1396
  ...{
1422
- control,
1423
- name: `steps.${index}.url`,
1424
- render: ({ field: { value, onChange } }) => {
1425
- var _a3, _b2, _c2, _d2;
1426
- return /* @__PURE__ */ jsx(
1427
- InputGroup,
1428
- {
1429
- ...{
1430
- 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,
1431
- input: /* @__PURE__ */ jsx(
1432
- InputUrl,
1433
- {
1434
- ...{
1435
- onChange,
1436
- value: value || ""
1437
- }
1438
- }
1439
- ),
1440
- label: "Webhook URL"
1441
- }
1397
+ 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,
1398
+ input: /* @__PURE__ */ jsx(
1399
+ InputUrl,
1400
+ {
1401
+ ...{
1402
+ onChange,
1403
+ value: value || ""
1442
1404
  }
1443
- );
1444
- }
1405
+ }
1406
+ ),
1407
+ label: "Webhook URL"
1445
1408
  }
1446
1409
  }
1447
- ),
1448
- teamSteps.includes(step.type) && lockedStep(index) && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: "Recipients are chosen by the organization owner." }),
1449
- teamSteps.includes(step.type) && !lockedStep(index) && /* @__PURE__ */ jsx(
1450
- Controller,
1410
+ );
1411
+ }
1412
+ }
1413
+ }
1414
+ ),
1415
+ teamSteps.includes(step.type) && lockedStep(index) && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: "Recipients are chosen by the organization owner." }),
1416
+ teamSteps.includes(step.type) && !lockedStep(index) && /* @__PURE__ */ jsx(
1417
+ Controller,
1418
+ {
1419
+ ...{
1420
+ control,
1421
+ name: `steps.${index}.members`,
1422
+ render: ({ field: { value, onChange } }) => {
1423
+ var _a3, _b2, _c2, _d2;
1424
+ return /* @__PURE__ */ jsx(
1425
+ InputGroup,
1451
1426
  {
1452
1427
  ...{
1453
- control,
1454
- name: `steps.${index}.members`,
1455
- render: ({ field: { value, onChange } }) => {
1456
- var _a3, _b2, _c2, _d2;
1457
- return /* @__PURE__ */ jsx(
1458
- InputGroup,
1459
- {
1460
- ...{
1461
- 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,
1462
- input: /* @__PURE__ */ jsx(
1463
- InputResource,
1464
- {
1465
- ...{
1466
- empty: "No members to add",
1467
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/members",
1468
- // The owner is a chip like the others, only it cannot be
1469
- // removed: they are always a recipient and it is resolved
1470
- // in sync. Shaped like a member so `render` labels it the
1471
- // same way.
1472
- fixed: [{ email: ownerEmail }],
1473
- model: "member",
1474
- multiple: true,
1475
- onChange,
1476
- params: memberParams,
1477
- // No Add member where the list cannot be read.
1478
- picker: membersListed,
1479
- render: memberLabel,
1480
- // The row shows the name ( memberLabel ), so the search has
1481
- // to hit the name too. The members endpoint joins `user`
1482
- // before its search stage, so the nested keys resolve.
1483
- // Email stays for invitees who have not registered yet.
1484
- // ponytail: a full "First Last" query matches neither key;
1485
- // a $concat'd name on the API side if that comes up.
1486
- searchKeys: ["email", "user.firstName", "user.lastName"],
1487
- value: value || []
1488
- }
1489
- }
1490
- ),
1491
- label: "Recipients"
1492
- }
1428
+ 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,
1429
+ input: /* @__PURE__ */ jsx(
1430
+ InputResource,
1431
+ {
1432
+ ...{
1433
+ empty: "No members to add",
1434
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/members",
1435
+ // The owner is a chip like the others, only it cannot be
1436
+ // removed: they are always a recipient and it is resolved
1437
+ // in sync. Shaped like a member so `render` labels it the
1438
+ // same way.
1439
+ fixed: [{ email: ownerEmail }],
1440
+ model: "member",
1441
+ multiple: true,
1442
+ onChange,
1443
+ params: memberParams,
1444
+ render: memberLabel,
1445
+ // The row shows the name ( memberLabel ), so the search has
1446
+ // to hit the name too. The members endpoint joins `user`
1447
+ // before its search stage, so the nested keys resolve.
1448
+ // Email stays for invitees who have not registered yet.
1449
+ // ponytail: a full "First Last" query matches neither key;
1450
+ // a $concat'd name on the API side if that comes up.
1451
+ searchKeys: ["email", "user.firstName", "user.lastName"],
1452
+ value: value || []
1493
1453
  }
1494
- );
1495
- }
1496
- }
1497
- }
1498
- ),
1499
- emailSteps.includes(step.type) && /* @__PURE__ */ jsx(
1500
- FormNotification,
1501
- {
1502
- ...{
1503
- control,
1504
- // As the Fieldset above: the Message editor is a
1505
- // contenteditable, which a disabled fieldset never reaches.
1506
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting),
1507
- formState,
1508
- onChecking,
1509
- setValue,
1510
- values: {
1511
- id: field.id,
1512
- name: `steps.${index}`,
1513
- organization: values == null ? void 0 : values.organization,
1514
- variables: getAvailableVariables(index)
1515
- }
1454
+ }
1455
+ ),
1456
+ label: "Recipients"
1516
1457
  }
1517
1458
  }
1518
- ),
1519
- event === "lead.insert" && emailSteps.includes(step.type) && /* @__PURE__ */ jsx(LeadEmailNote, {}),
1520
- step.type === "step.sms.send" && /* @__PURE__ */ jsx(
1521
- Controller,
1459
+ );
1460
+ }
1461
+ }
1462
+ }
1463
+ ),
1464
+ emailSteps.includes(step.type) && /* @__PURE__ */ jsx(
1465
+ FormNotification,
1466
+ {
1467
+ ...{
1468
+ control,
1469
+ // As the Fieldset above: the Message editor is a
1470
+ // contenteditable, which a disabled fieldset never reaches.
1471
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting),
1472
+ formState,
1473
+ onChecking,
1474
+ setValue,
1475
+ values: {
1476
+ id: field.id,
1477
+ name: `steps.${index}`,
1478
+ organization: values == null ? void 0 : values.organization,
1479
+ variables: getAvailableVariables(index)
1480
+ }
1481
+ }
1482
+ }
1483
+ ),
1484
+ event === "lead.insert" && emailSteps.includes(step.type) && /* @__PURE__ */ jsx(LeadEmailNote, {}),
1485
+ step.type === "step.sms.send" && /* @__PURE__ */ jsx(
1486
+ Controller,
1487
+ {
1488
+ ...{
1489
+ control,
1490
+ name: `steps.${index}.message`,
1491
+ render: ({ field: { value, onChange } }) => {
1492
+ var _a3, _b2, _c2, _d2;
1493
+ return /* @__PURE__ */ jsx(
1494
+ InputGroup,
1522
1495
  {
1523
1496
  ...{
1524
- control,
1525
- name: `steps.${index}.message`,
1526
- render: ({ field: { value, onChange } }) => {
1527
- var _a3, _b2, _c2, _d2;
1528
- return /* @__PURE__ */ jsx(
1529
- InputGroup,
1530
- {
1531
- ...{
1532
- 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,
1533
- input: /* @__PURE__ */ jsx(
1534
- InputTextarea,
1535
- {
1536
- ...{
1537
- onChange,
1538
- rows: 3,
1539
- value: value || ""
1540
- }
1541
- }
1542
- ),
1543
- label: "Message"
1544
- }
1497
+ 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,
1498
+ input: /* @__PURE__ */ jsx(
1499
+ InputTextarea,
1500
+ {
1501
+ ...{
1502
+ onChange,
1503
+ rows: 3,
1504
+ value: value || ""
1545
1505
  }
1546
- );
1547
- }
1506
+ }
1507
+ ),
1508
+ label: "Message"
1548
1509
  }
1549
1510
  }
1550
- ),
1551
- step.type === "step.commerce.code.issue" && /* @__PURE__ */ jsx(
1552
- Controller,
1511
+ );
1512
+ }
1513
+ }
1514
+ }
1515
+ ),
1516
+ step.type === "step.commerce.code.issue" && /* @__PURE__ */ jsx(
1517
+ Controller,
1518
+ {
1519
+ ...{
1520
+ control,
1521
+ name: `steps.${index}.discount`,
1522
+ render: ({ field: { value, onChange } }) => {
1523
+ var _a3, _b2, _c2, _d2;
1524
+ return /* @__PURE__ */ jsx(
1525
+ InputGroup,
1553
1526
  {
1554
1527
  ...{
1555
- control,
1556
- name: `steps.${index}.discount`,
1557
- render: ({ field: { value, onChange } }) => {
1558
- var _a3, _b2, _c2, _d2;
1559
- return /* @__PURE__ */ jsx(
1560
- InputGroup,
1561
- {
1562
- ...{
1563
- 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,
1564
- input: /* @__PURE__ */ jsx(
1565
- InputResource,
1528
+ 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,
1529
+ input: /* @__PURE__ */ jsx(
1530
+ InputResource,
1531
+ {
1532
+ ...{
1533
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/connection/" + commerceConnectionId + "/hook/browse.promotions",
1534
+ model: "discount",
1535
+ onChange,
1536
+ // A DISCOUNT THE STORE CANNOT BACK IS SHOWN AND EXPLAINED, never
1537
+ // filtered out. The merchant can see it in Shopify admin, so a row
1538
+ // missing here with no reason reads as our bug rather than their
1539
+ // setting — and the reason names the fix.
1540
+ render: (item) => /* @__PURE__ */ jsxs("div", { children: [
1541
+ /* @__PURE__ */ jsx("span", { className: (item == null ? void 0 : item.blocked) ? "text-gray-dark" : void 0, children: item == null ? void 0 : item.title }),
1542
+ ((item == null ? void 0 : item.blocked) || (item == null ? void 0 : item.warning)) && /* @__PURE__ */ jsx("span", { className: "block text-sm text-gray-dark", children: item.blocked || item.warning })
1543
+ ] }),
1544
+ renderButton: ({ button, item }) => (
1545
+ // The list's small inline Add, unless the list says otherwise.
1546
+ /* @__PURE__ */ jsx(
1547
+ Button,
1566
1548
  {
1567
1549
  ...{
1568
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/connection/" + commerceConnectionId + "/hook/browse.promotions",
1569
- model: "discount",
1570
- onChange,
1571
- // A DISCOUNT THE STORE CANNOT BACK IS SHOWN AND EXPLAINED, never
1572
- // filtered out. The merchant can see it in Shopify admin, so a row
1573
- // missing here with no reason reads as our bug rather than their
1574
- // setting — and the reason names the fix.
1575
- render: (item) => /* @__PURE__ */ jsxs("div", { children: [
1576
- /* @__PURE__ */ jsx("span", { className: (item == null ? void 0 : item.blocked) ? "text-gray-dark" : void 0, children: item == null ? void 0 : item.title }),
1577
- ((item == null ? void 0 : item.blocked) || (item == null ? void 0 : item.warning)) && /* @__PURE__ */ jsx("span", { className: "block text-sm text-gray-dark", children: item.blocked || item.warning })
1578
- ] }),
1579
- renderButton: ({ button, item }) => (
1580
- // The list's small inline Add, unless the list says otherwise.
1581
- /* @__PURE__ */ jsx(
1582
- Button,
1583
- {
1584
- ...{
1585
- inline: true,
1586
- size: "small",
1587
- ...button.props,
1588
- disabled: Boolean(item == null ? void 0 : item.blocked),
1589
- title: (item == null ? void 0 : item.blocked) || void 0
1590
- },
1591
- children: button.text
1592
- }
1593
- )
1594
- ),
1595
- value: value || null
1596
- }
1550
+ inline: true,
1551
+ size: "small",
1552
+ ...button.props,
1553
+ disabled: Boolean(item == null ? void 0 : item.blocked),
1554
+ title: (item == null ? void 0 : item.blocked) || void 0
1555
+ },
1556
+ children: button.text
1597
1557
  }
1598
- ),
1599
- label: "Discount",
1600
- // "Issue" means MINT, not send — this step creates the code and saves
1601
- // it to the lead, and nothing reaches them until a later email step
1602
- // names the variable. Said here because the step picker says nothing:
1603
- // QA read "Issue a discount code", built the one-step workflow that
1604
- // describes, and reported the codes as never arriving.
1605
- message: /* @__PURE__ */ jsxs(Fragment, { children: [
1606
- "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.",
1607
- commerceDomain ? /* @__PURE__ */ jsxs(Fragment, { children: [
1608
- " ",
1609
- /* @__PURE__ */ jsx("a", { href: "https://" + commerceDomain + "/admin/discounts", rel: "noopener noreferrer", target: "_blank", children: "Manage discounts" })
1610
- ] }) : null
1611
- ] })
1612
- }
1558
+ )
1559
+ ),
1560
+ value: value || null
1613
1561
  }
1614
- );
1615
- }
1562
+ }
1563
+ ),
1564
+ label: "Discount",
1565
+ // "Issue" means MINT, not send — this step creates the code and saves
1566
+ // it to the lead, and nothing reaches them until a later email step
1567
+ // names the variable. Said here because the step picker says nothing:
1568
+ // QA read "Issue a discount code", built the one-step workflow that
1569
+ // describes, and reported the codes as never arriving.
1570
+ message: /* @__PURE__ */ jsxs(Fragment, { children: [
1571
+ "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.",
1572
+ commerceDomain ? /* @__PURE__ */ jsxs(Fragment, { children: [
1573
+ " ",
1574
+ /* @__PURE__ */ jsx("a", { href: "https://" + commerceDomain + "/admin/discounts", rel: "noopener noreferrer", target: "_blank", children: "Manage discounts" })
1575
+ ] }) : null
1576
+ ] })
1616
1577
  }
1617
1578
  }
1618
- )
1619
- ]
1579
+ );
1580
+ }
1620
1581
  }
1621
- )
1622
- }
1623
- )
1624
- );
1625
- }
1582
+ }
1583
+ )
1584
+ ]
1585
+ }
1586
+ )
1626
1587
  }
1627
1588
  )
1628
- }
1629
- }
1630
- ),
1631
- /* @__PURE__ */ jsx(
1632
- "div",
1633
- {
1634
- ...{
1635
- className: "pt-6"
1636
- },
1637
- children: /* @__PURE__ */ jsx(
1638
- Button,
1639
- {
1640
- ...{
1641
- disabled: checkingAny,
1642
- loading: (formState == null ? void 0 : formState.isSubmitting) || checkingAny,
1643
- type: "submit"
1644
- },
1645
- children: "Save"
1646
- }
1647
- )
1589
+ );
1648
1590
  }
1649
- )
1650
- ]
1591
+ }
1592
+ ),
1593
+ label: "Sequence"
1651
1594
  }
1652
- )
1653
- }
1654
- )
1595
+ }
1596
+ ),
1597
+ /* @__PURE__ */ jsx(
1598
+ Button,
1599
+ {
1600
+ ...{
1601
+ disabled: checkingAny,
1602
+ loading: (formState == null ? void 0 : formState.isSubmitting) || checkingAny,
1603
+ type: "submit"
1604
+ },
1605
+ children: "Save"
1606
+ }
1607
+ )
1608
+ ]
1655
1609
  }
1656
1610
  )
1657
1611
  }
@@ -1660,11 +1614,12 @@ const FormOrganizationWorkflowEdit = ({
1660
1614
  export {
1661
1615
  FormOrganizationWorkflowEdit,
1662
1616
  RESPONSE,
1617
+ SAMPLE,
1663
1618
  TextPreview,
1664
1619
  firstEntryOnly,
1665
1620
  hasStepOptions,
1666
1621
  issueRow,
1667
- listsMembers,
1622
+ lockedStepOption,
1668
1623
  memberOptions,
1669
1624
  partToStart,
1670
1625
  pickedCopy,
@@ -1677,7 +1632,7 @@ export {
1677
1632
  stepReason,
1678
1633
  stepRow,
1679
1634
  stepVariables,
1680
- useEmailPreview,
1681
1635
  useStepPrefill,
1636
+ webhookSample,
1682
1637
  workflowSchema
1683
1638
  };