@drawbridge/components 0.1.37 → 0.1.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. package/components/styles.css +68 -355
  2. package/dist/advertisement.js +15 -20
  3. package/dist/advertisement.mjs +15 -20
  4. package/dist/bridge/advertisements.js +4 -2
  5. package/dist/bridge/advertisements.mjs +5 -3
  6. package/dist/bridge/fields.js +89 -6
  7. package/dist/bridge/fields.mjs +89 -7
  8. package/dist/bridge/form-subdomain-agreement.js +165 -0
  9. package/dist/bridge/form-subdomain-agreement.mjs +132 -0
  10. package/dist/bridge/form-subdomain-embed.js +5 -1
  11. package/dist/bridge/form-subdomain-embed.mjs +5 -1
  12. package/dist/bridge/form-subdomain-header.js +21 -14
  13. package/dist/bridge/form-subdomain-header.mjs +20 -14
  14. package/dist/bridge/form-subdomain-issue.js +17 -8
  15. package/dist/bridge/form-subdomain-issue.mjs +17 -8
  16. package/dist/bridge/form-subdomain-missions.js +58 -52
  17. package/dist/bridge/form-subdomain-missions.mjs +60 -54
  18. package/dist/bridge/form-subdomain.js +226 -95
  19. package/dist/bridge/form-subdomain.mjs +225 -97
  20. package/dist/bridge/lib/entry.js +71 -6
  21. package/dist/bridge/lib/entry.mjs +60 -5
  22. package/dist/bridge/lib/order.js +23 -0
  23. package/dist/bridge/lib/order.mjs +20 -0
  24. package/dist/bridge/template-layout.js +5 -2
  25. package/dist/bridge/template-layout.mjs +6 -3
  26. package/dist/bridge/template-modal.js +82 -15
  27. package/dist/bridge/template-modal.mjs +83 -16
  28. package/dist/bridge/template-subdomain-gallery.js +126 -75
  29. package/dist/bridge/template-subdomain-gallery.mjs +122 -75
  30. package/dist/bridge/template-subdomain.js +16 -14
  31. package/dist/bridge/template-subdomain.mjs +17 -15
  32. package/dist/dashboard/avatar.js +5 -0
  33. package/dist/dashboard/avatar.mjs +5 -0
  34. package/dist/dashboard/campaign-form.js +1815 -0
  35. package/dist/dashboard/campaign-form.mjs +1786 -0
  36. package/dist/dashboard/card-affiliate.js +3 -2
  37. package/dist/dashboard/card-affiliate.mjs +3 -2
  38. package/dist/dashboard/card-campaign-agreement.js +172 -0
  39. package/dist/dashboard/card-campaign-agreement.mjs +139 -0
  40. package/dist/dashboard/card-campaign-switch.js +25 -10
  41. package/dist/dashboard/card-campaign-switch.mjs +24 -10
  42. package/dist/dashboard/card-order.js +6 -14
  43. package/dist/dashboard/card-order.mjs +6 -14
  44. package/dist/dashboard/card-section.js +69 -26
  45. package/dist/dashboard/card-section.mjs +65 -26
  46. package/dist/dashboard/card-shortcut.js +183 -0
  47. package/dist/dashboard/card-shortcut.mjs +154 -0
  48. package/dist/dashboard/card-tile.js +3 -35
  49. package/dist/dashboard/card-tile.mjs +3 -34
  50. package/dist/dashboard/document-blocks.js +305 -0
  51. package/dist/dashboard/document-blocks.mjs +270 -0
  52. package/dist/dashboard/drawer-subscription.js +52 -14
  53. package/dist/dashboard/drawer-subscription.mjs +52 -14
  54. package/dist/dashboard/drawer.js +20 -3
  55. package/dist/dashboard/drawer.mjs +21 -4
  56. package/dist/dashboard/dropdown.js +6 -2
  57. package/dist/dashboard/dropdown.mjs +6 -2
  58. package/dist/dashboard/form-admin-subscription-custom.js +72 -8
  59. package/dist/dashboard/form-admin-subscription-custom.mjs +72 -8
  60. package/dist/dashboard/form-ai.js +0 -148
  61. package/dist/dashboard/form-ai.mjs +1 -148
  62. package/dist/dashboard/form-filters-analytics.js +86 -38
  63. package/dist/dashboard/form-filters-analytics.mjs +85 -38
  64. package/dist/dashboard/form-organization-brand.js +30 -13
  65. package/dist/dashboard/form-organization-brand.mjs +30 -13
  66. package/dist/dashboard/form-organization-campaign-advertisement.js +38 -112
  67. package/dist/dashboard/form-organization-campaign-advertisement.mjs +38 -112
  68. package/dist/dashboard/form-organization-campaign-advertisements.js +374 -0
  69. package/dist/dashboard/form-organization-campaign-advertisements.mjs +345 -0
  70. package/dist/dashboard/form-organization-campaign-agreement.js +402 -210
  71. package/dist/dashboard/form-organization-campaign-agreement.mjs +398 -211
  72. package/dist/dashboard/form-organization-campaign-design.js +258 -0
  73. package/dist/dashboard/form-organization-campaign-design.mjs +223 -0
  74. package/dist/dashboard/form-organization-campaign-field-item.js +585 -0
  75. package/dist/dashboard/form-organization-campaign-field-item.mjs +552 -0
  76. package/dist/dashboard/form-organization-campaign-field-number.js +48 -7
  77. package/dist/dashboard/form-organization-campaign-field-number.mjs +48 -7
  78. package/dist/dashboard/form-organization-campaign-field-select.js +15 -4
  79. package/dist/dashboard/form-organization-campaign-field-select.mjs +15 -4
  80. package/dist/dashboard/form-organization-campaign-field-skill.js +359 -0
  81. package/dist/dashboard/form-organization-campaign-field-skill.mjs +330 -0
  82. package/dist/dashboard/form-organization-campaign-field-text.js +46 -6
  83. package/dist/dashboard/form-organization-campaign-field-text.mjs +46 -6
  84. package/dist/dashboard/form-organization-campaign-field-textarea.js +22 -13
  85. package/dist/dashboard/form-organization-campaign-field-textarea.mjs +22 -13
  86. package/dist/dashboard/form-organization-campaign-footer.js +178 -0
  87. package/dist/dashboard/form-organization-campaign-footer.mjs +149 -0
  88. package/dist/dashboard/form-organization-campaign-integration-age.js +2 -35
  89. package/dist/dashboard/form-organization-campaign-integration-age.mjs +2 -35
  90. package/dist/dashboard/form-organization-campaign-integration-geocode.js +4 -1
  91. package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +4 -1
  92. package/dist/dashboard/form-organization-campaign-page-embed.js +1 -1
  93. package/dist/dashboard/form-organization-campaign-page-embed.mjs +1 -1
  94. package/dist/dashboard/form-organization-campaign-page-preview.js +1 -2
  95. package/dist/dashboard/form-organization-campaign-page-preview.mjs +1 -2
  96. package/dist/dashboard/form-organization-campaign-page-qr.js +2 -2
  97. package/dist/dashboard/form-organization-campaign-page-qr.mjs +2 -2
  98. package/dist/dashboard/form-organization-campaign-page-share.js +5 -5
  99. package/dist/dashboard/form-organization-campaign-page-share.mjs +5 -5
  100. package/dist/dashboard/form-organization-campaign-page-slug.js +2 -3
  101. package/dist/dashboard/form-organization-campaign-page-slug.mjs +2 -3
  102. package/dist/dashboard/form-organization-campaign-page.js +168 -265
  103. package/dist/dashboard/form-organization-campaign-page.mjs +170 -266
  104. package/dist/dashboard/form-organization-campaign-section.js +125 -107
  105. package/dist/dashboard/form-organization-campaign-section.mjs +121 -107
  106. package/dist/dashboard/form-organization-campaign.js +119 -9
  107. package/dist/dashboard/form-organization-campaign.mjs +118 -9
  108. package/dist/dashboard/form-organization-file-frame.js +7 -1
  109. package/dist/dashboard/form-organization-file-frame.mjs +7 -1
  110. package/dist/dashboard/form-organization-workflow.js +587 -530
  111. package/dist/dashboard/form-organization-workflow.mjs +588 -531
  112. package/dist/dashboard/form-organization.js +22 -0
  113. package/dist/dashboard/form-organization.mjs +22 -0
  114. package/dist/dashboard/form-reposition.js +396 -0
  115. package/dist/dashboard/form-reposition.mjs +359 -0
  116. package/dist/dashboard/form-support.js +189 -0
  117. package/dist/dashboard/form-support.mjs +160 -0
  118. package/dist/dashboard/form-tests.js +683 -0
  119. package/dist/dashboard/form-tests.mjs +646 -0
  120. package/dist/dashboard/form-verify-prize.js +114 -34
  121. package/dist/dashboard/form-verify-prize.mjs +111 -34
  122. package/dist/dashboard/google.js +8 -1
  123. package/dist/dashboard/google.mjs +8 -1
  124. package/dist/dashboard/input-array.js +2 -0
  125. package/dist/dashboard/input-array.mjs +2 -0
  126. package/dist/dashboard/input-editor.js +17 -6
  127. package/dist/dashboard/input-editor.mjs +17 -6
  128. package/dist/dashboard/input-fields.js +287 -437
  129. package/dist/dashboard/input-fields.mjs +287 -436
  130. package/dist/dashboard/input-file.js +70 -2
  131. package/dist/dashboard/input-file.mjs +70 -2
  132. package/dist/dashboard/input-font.js +64 -55
  133. package/dist/dashboard/input-font.mjs +64 -55
  134. package/dist/dashboard/input-resource.js +4 -1
  135. package/dist/dashboard/input-resource.mjs +4 -1
  136. package/dist/dashboard/lib/ab-tests.js +130 -0
  137. package/dist/dashboard/lib/ab-tests.mjs +94 -0
  138. package/dist/dashboard/lib/features.js +1 -1
  139. package/dist/dashboard/lib/features.mjs +1 -1
  140. package/dist/dashboard/lib/focus.js +93 -0
  141. package/dist/dashboard/lib/focus.mjs +69 -0
  142. package/dist/dashboard/lib/form-page.js +209 -0
  143. package/dist/dashboard/lib/form-page.mjs +161 -0
  144. package/dist/dashboard/lib/item-list.js +0 -15
  145. package/dist/dashboard/lib/item-list.mjs +0 -14
  146. package/dist/dashboard/lib/rail.js +16 -17
  147. package/dist/dashboard/lib/rail.mjs +15 -16
  148. package/dist/dashboard/lib/sms.js +8 -2
  149. package/dist/dashboard/lib/sms.mjs +6 -1
  150. package/dist/dashboard/list-resource.js +2 -0
  151. package/dist/dashboard/list-resource.mjs +2 -0
  152. package/dist/dashboard/menu.js +54 -5
  153. package/dist/dashboard/menu.mjs +53 -5
  154. package/dist/dashboard/modal.js +19 -4
  155. package/dist/dashboard/modal.mjs +20 -5
  156. package/dist/dashboard/order-sections.js +4 -0
  157. package/dist/dashboard/order-sections.mjs +4 -0
  158. package/dist/dashboard/preview.js +838 -324
  159. package/dist/dashboard/preview.mjs +826 -324
  160. package/dist/dashboard/provider-ui.js +20 -12
  161. package/dist/dashboard/provider-ui.mjs +21 -13
  162. package/dist/dashboard/recharts.js +53 -28
  163. package/dist/dashboard/recharts.mjs +53 -28
  164. package/dist/dashboard/swatch.js +35 -0
  165. package/dist/dashboard/swatch.mjs +31 -0
  166. package/dist/dashboard/table-contacts.js +6 -10
  167. package/dist/dashboard/table-contacts.mjs +6 -10
  168. package/dist/dashboard/table.js +10 -3
  169. package/dist/dashboard/table.mjs +9 -3
  170. package/dist/dashboard/template-dashboard.js +12 -7
  171. package/dist/dashboard/template-dashboard.mjs +11 -7
  172. package/dist/dashboard/template-design.js +564 -0
  173. package/dist/dashboard/template-design.mjs +531 -0
  174. package/dist/dashboard/template-rail.js +192 -126
  175. package/dist/dashboard/template-rail.mjs +190 -125
  176. package/dist/dashboard/template-socket.js +0 -3
  177. package/dist/dashboard/template-socket.mjs +0 -3
  178. package/dist/dashboard/template-test-page.js +436 -0
  179. package/dist/dashboard/template-test-page.mjs +407 -0
  180. package/dist/dashboard/template-tests.js +141 -0
  181. package/dist/dashboard/template-tests.mjs +112 -0
  182. package/dist/dashboard/template-ui.js +20 -11
  183. package/dist/dashboard/template-ui.mjs +22 -13
  184. package/dist/dashboard/template-variant.js +185 -0
  185. package/dist/dashboard/template-variant.mjs +156 -0
  186. package/dist/icons/arrow-down-long.js +47 -0
  187. package/dist/icons/arrow-down-long.mjs +28 -0
  188. package/dist/icons/arrows-pointing-out.js +46 -0
  189. package/dist/icons/arrows-pointing-out.mjs +27 -0
  190. package/dist/icons/beaker.js +46 -0
  191. package/dist/icons/beaker.mjs +27 -0
  192. package/dist/icons/identification.js +46 -0
  193. package/dist/icons/identification.mjs +27 -0
  194. package/dist/icons/lifebuoy.js +46 -0
  195. package/dist/icons/lifebuoy.mjs +27 -0
  196. package/dist/icons/rectangle-group.js +46 -0
  197. package/dist/icons/rectangle-group.mjs +27 -0
  198. package/dist/icons/rectangle-stack.js +46 -0
  199. package/dist/icons/rectangle-stack.mjs +27 -0
  200. package/dist/icons/shopping-bag.js +46 -0
  201. package/dist/icons/shopping-bag.mjs +27 -0
  202. package/dist/icons/swatch.js +46 -0
  203. package/dist/icons/swatch.mjs +27 -0
  204. package/dist/icons/window.js +46 -0
  205. package/dist/icons/window.mjs +27 -0
  206. package/dist/icons/zoom-in.js +46 -0
  207. package/dist/icons/zoom-in.mjs +27 -0
  208. package/dist/input-answer.js +60 -0
  209. package/dist/input-answer.mjs +27 -0
  210. package/dist/input-checkbox.js +7 -1
  211. package/dist/input-checkbox.mjs +7 -1
  212. package/dist/input-name.js +3 -3
  213. package/dist/input-name.mjs +3 -3
  214. package/dist/input-select.js +3 -1
  215. package/dist/input-select.mjs +3 -1
  216. package/dist/provider-font.js +4 -3
  217. package/dist/provider-font.mjs +4 -3
  218. package/dist/shared/badge.js +15 -0
  219. package/dist/shared/badge.mjs +11 -0
  220. package/dist/shared/carousel.js +11 -7
  221. package/dist/shared/carousel.mjs +11 -7
  222. package/dist/shared/document-pieces.js +295 -0
  223. package/dist/shared/document-pieces.mjs +260 -0
  224. package/dist/shared/lib/campaign.js +18 -9
  225. package/dist/shared/lib/campaign.mjs +17 -9
  226. package/dist/shared/lib/helpers.js +24 -0
  227. package/dist/shared/lib/helpers.mjs +22 -0
  228. package/dist/shared/lib/video.js +6 -0
  229. package/dist/shared/lib/video.mjs +5 -0
  230. package/dist/shared/sortable.js +27 -10
  231. package/dist/shared/sortable.mjs +27 -10
  232. package/dist/shared/tabs.js +1 -1
  233. package/dist/shared/tabs.mjs +1 -1
  234. package/dist/video.js +127 -9
  235. package/dist/video.mjs +125 -11
  236. package/package.json +176 -20
  237. package/types/bridge/fields.d.ts +6 -1
  238. package/types/bridge/form-subdomain-agreement.d.ts +27 -0
  239. package/types/bridge/form-subdomain-missions.d.ts +2 -0
  240. package/types/bridge/form-subdomain.d.ts +62 -3
  241. package/types/bridge/lib/entry.d.ts +46 -7
  242. package/types/bridge/lib/order.d.ts +13 -2
  243. package/types/bridge/subdomain-content.d.ts +1 -0
  244. package/types/bridge/template-subdomain-gallery.d.ts +13 -1
  245. package/types/dashboard/campaign-form.d.ts +42 -0
  246. package/types/dashboard/card-campaign-agreement.d.ts +26 -0
  247. package/types/dashboard/card-campaign-switch.d.ts +13 -1
  248. package/types/dashboard/card-order.d.ts +2 -2
  249. package/types/dashboard/card-section.d.ts +9 -1
  250. package/types/dashboard/card-shortcut.d.ts +40 -0
  251. package/types/dashboard/card-tile.d.ts +4 -9
  252. package/types/dashboard/document-blocks.d.ts +14 -0
  253. package/types/dashboard/drawer.d.ts +3 -0
  254. package/types/dashboard/form-ai.d.ts +0 -17
  255. package/types/dashboard/form-organization-brand.d.ts +3 -0
  256. package/types/dashboard/form-organization-campaign-advertisements.d.ts +15 -0
  257. package/types/dashboard/form-organization-campaign-agreement.d.ts +53 -10
  258. package/types/dashboard/form-organization-campaign-design.d.ts +46 -0
  259. package/types/dashboard/form-organization-campaign-field-item.d.ts +36 -0
  260. package/types/dashboard/form-organization-campaign-field-number.d.ts +4 -1
  261. package/types/dashboard/form-organization-campaign-field-select.d.ts +6 -1
  262. package/types/dashboard/form-organization-campaign-field-skill.d.ts +36 -0
  263. package/types/dashboard/form-organization-campaign-field-text.d.ts +5 -1
  264. package/types/dashboard/form-organization-campaign-field-textarea.d.ts +4 -1
  265. package/types/dashboard/form-organization-campaign-footer.d.ts +23 -0
  266. package/types/dashboard/form-organization-campaign-integration-age.d.ts +2 -1
  267. package/types/dashboard/form-organization-campaign-integration-geocode.d.ts +2 -0
  268. package/types/dashboard/form-organization-campaign-page.d.ts +9 -15
  269. package/types/dashboard/form-organization-campaign-section.d.ts +24 -8
  270. package/types/dashboard/form-organization-campaign.d.ts +3 -0
  271. package/types/dashboard/form-organization-workflow.d.ts +3 -0
  272. package/types/dashboard/form-organization.d.ts +2 -2
  273. package/types/dashboard/form-reposition.d.ts +29 -0
  274. package/types/dashboard/form-support.d.ts +14 -0
  275. package/types/dashboard/form-tests.d.ts +78 -0
  276. package/types/dashboard/form-verify-prize.d.ts +30 -3
  277. package/types/dashboard/input-editor.d.ts +9 -0
  278. package/types/dashboard/input-fields.d.ts +8 -5
  279. package/types/dashboard/input-file.d.ts +4 -0
  280. package/types/dashboard/input-resource.d.ts +1 -0
  281. package/types/dashboard/lib/ab-tests.d.ts +50 -0
  282. package/types/dashboard/lib/escape.d.ts +4 -0
  283. package/types/dashboard/lib/focus.d.ts +16 -0
  284. package/types/dashboard/lib/form-page.d.ts +25 -0
  285. package/types/dashboard/lib/item-list.d.ts +10 -5
  286. package/types/dashboard/lib/rail.d.ts +0 -1
  287. package/types/dashboard/lib/sms.d.ts +7 -0
  288. package/types/dashboard/modal.d.ts +3 -1
  289. package/types/dashboard/preview.d.ts +65 -10
  290. package/types/dashboard/recharts.d.ts +3 -0
  291. package/types/dashboard/swatch.d.ts +4 -0
  292. package/types/dashboard/template-dashboard.d.ts +3 -0
  293. package/types/dashboard/template-design.d.ts +30 -0
  294. package/types/dashboard/template-test-page.d.ts +69 -0
  295. package/types/dashboard/template-tests.d.ts +30 -0
  296. package/types/dashboard/template-variant.d.ts +18 -0
  297. package/types/icons/arrow-down-long.d.ts +5 -0
  298. package/types/icons/arrows-pointing-out.d.ts +5 -0
  299. package/types/icons/beaker.d.ts +5 -0
  300. package/types/icons/identification.d.ts +5 -0
  301. package/types/icons/lifebuoy.d.ts +5 -0
  302. package/types/icons/rectangle-group.d.ts +5 -0
  303. package/types/icons/rectangle-stack.d.ts +5 -0
  304. package/types/icons/shopping-bag.d.ts +5 -0
  305. package/types/icons/swatch.d.ts +5 -0
  306. package/types/icons/window.d.ts +5 -0
  307. package/types/icons/zoom-in.d.ts +5 -0
  308. package/types/input-answer.d.ts +15 -0
  309. package/types/input-select.d.ts +2 -0
  310. package/types/shared/button.d.ts +1 -1
  311. package/types/shared/document-pieces.d.ts +34 -0
  312. package/types/shared/lib/campaign.d.ts +11 -0
  313. package/types/shared/lib/helpers.d.ts +22 -1
  314. package/types/shared/lib/motion.d.ts +2 -0
  315. package/types/shared/lib/video.d.ts +3 -0
  316. package/types/shared/sortable.d.ts +6 -0
  317. package/types/video.d.ts +18 -2
  318. package/dist/bridge/template-preview.js +0 -208
  319. package/dist/bridge/template-preview.mjs +0 -173
  320. package/dist/dashboard/device.js +0 -95
  321. package/dist/dashboard/device.mjs +0 -72
  322. package/dist/dashboard/form-organization-campaign-field-list.js +0 -425
  323. package/dist/dashboard/form-organization-campaign-field-list.mjs +0 -396
  324. package/dist/dashboard/item-row.js +0 -92
  325. package/dist/dashboard/item-row.mjs +0 -63
  326. package/types/bridge/template-preview.d.ts +0 -10
  327. package/types/dashboard/device.d.ts +0 -12
  328. package/types/dashboard/form-organization-campaign-field-list.d.ts +0 -36
  329. package/types/dashboard/item-row.d.ts +0 -25
@@ -1,4 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { formatDateString } from "@drawbridge/drawbridge-utils";
2
3
  import { request } from "@drawbridge/drawbridge-utils/fetch";
3
4
  import { useForm, Controller } from "../shared/lib/form.mjs";
4
5
  import yup, { resolver } from "../shared/lib/yup.mjs";
@@ -6,6 +7,7 @@ import Form from "../shared/form.mjs";
6
7
  import Fieldset from "../shared/fieldset.mjs";
7
8
  import InputGroup from "../input-group.mjs";
8
9
  import InputNumber from "../input-number.mjs";
10
+ import InputSelect from "../input-select.mjs";
9
11
  import InputText from "../input-text.mjs";
10
12
  import InputSwitch from "../shared/input-switch.mjs";
11
13
  import { featureLabel, grantableFeatures } from "./lib/features.mjs";
@@ -13,14 +15,26 @@ import { overageFromForm, overageToForm } from "./lib/overage.mjs";
13
15
  import Button from "../shared/button.mjs";
14
16
  const gigabyte = 1024 * 1024 * 1024;
15
17
  const blank = (value, original) => original === "" || original === null || original === void 0 ? null : value;
18
+ const cents = (value) => value == null || Math.abs(value * 100 - Math.round(value * 100)) < 1e-6;
19
+ const day = (date) => formatDateString({
20
+ date,
21
+ options: {
22
+ day: "numeric",
23
+ month: "short",
24
+ year: "numeric"
25
+ }
26
+ });
27
+ const monthsLabel = (months) => months + (months === 1 ? " month" : " months");
16
28
  const FormAdminSubscriptionCustom = ({
17
29
  onSuccess,
18
30
  onError,
19
31
  values
20
32
  }) => {
21
- var _a, _b, _c, _d, _e, _f, _g, _h;
33
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
22
34
  const custom = (values == null ? void 0 : values.custom) || {};
23
- const { control, handleSubmit, formState } = useForm({
35
+ const active = (values == null ? void 0 : values.status) === "active";
36
+ const locked = active || Boolean((_a = custom == null ? void 0 : custom.setup) == null ? void 0 : _a.billedAt);
37
+ const { control, handleSubmit, formState, watch } = useForm({
24
38
  resolver: resolver(
25
39
  // Required here mirrors the API's availability gate. A custom plan is
26
40
  // self-describing, so an unset term resolves to NOTHING rather than to
@@ -39,6 +53,15 @@ const FormAdminSubscriptionCustom = ({
39
53
  conversion: yup.number().transform(blank).nullable().label("Conversion rate").min(0).max(100).required(),
40
54
  members: yup.number().transform(blank).nullable().label("Members").min(0),
41
55
  storage: yup.number().transform(blank).nullable().label("Storage").min(0),
56
+ setup: yup.number().transform(blank).nullable().label("Setup fee").min(0).test("cents", "Setup fee must be dollars and cents", cents),
57
+ support: yup.boolean().label("Support"),
58
+ lasts: yup.string().oneOf(["forever", "months"]).label("Support lasts"),
59
+ // Asked for only when support is on and lasts a number of months.
60
+ // Checked only while shown, so a hidden value never blocks Submit.
61
+ months: yup.number().transform(blank).nullable().label("Months").when(["support", "lasts"], {
62
+ is: (support, lasts) => support && lasts === "months",
63
+ then: (schema) => schema.integer().min(1).max(120).required()
64
+ }),
42
65
  overages: yup.number().transform(blank).nullable().label("Actions overage").min(0).required(),
43
66
  available: yup.boolean().label("Available"),
44
67
  features: yup.array().of(yup.string()).label("Features"),
@@ -46,20 +69,24 @@ const FormAdminSubscriptionCustom = ({
46
69
  })
47
70
  ),
48
71
  values: {
49
- actions: ((_b = (_a = custom == null ? void 0 : custom.limits) == null ? void 0 : _a.organization) == null ? void 0 : _b.actions) ?? "",
72
+ actions: ((_c = (_b = custom == null ? void 0 : custom.limits) == null ? void 0 : _b.organization) == null ? void 0 : _c.actions) ?? "",
50
73
  available: Boolean(custom == null ? void 0 : custom.available),
51
- features: ((_c = custom == null ? void 0 : custom.features) == null ? void 0 : _c.granted) || [],
52
- amount: Number.isFinite((_d = custom == null ? void 0 : custom.data) == null ? void 0 : _d.amount) ? custom.data.amount / 100 : "",
74
+ features: ((_d = custom == null ? void 0 : custom.features) == null ? void 0 : _d.granted) || [],
75
+ amount: Number.isFinite((_e = custom == null ? void 0 : custom.data) == null ? void 0 : _e.amount) ? custom.data.amount / 100 : "",
53
76
  conversion: (custom == null ? void 0 : custom.conversion) ?? "",
54
- members: ((_f = (_e = custom == null ? void 0 : custom.limits) == null ? void 0 : _e.organization) == null ? void 0 : _f.members) ?? "",
55
- storage: Number.isFinite((_h = (_g = custom == null ? void 0 : custom.limits) == null ? void 0 : _g.organization) == null ? void 0 : _h.storage) ? custom.limits.organization.storage / gigabyte : "",
77
+ members: ((_g = (_f = custom == null ? void 0 : custom.limits) == null ? void 0 : _f.organization) == null ? void 0 : _g.members) ?? "",
78
+ setup: Number.isFinite((_h = custom == null ? void 0 : custom.setup) == null ? void 0 : _h.amount) ? custom.setup.amount / 100 : "",
79
+ support: ((_i = custom == null ? void 0 : custom.support) == null ? void 0 : _i.enabled) === true,
80
+ lasts: ((_j = custom == null ? void 0 : custom.support) == null ? void 0 : _j.months) ? "months" : "forever",
81
+ months: ((_k = custom == null ? void 0 : custom.support) == null ? void 0 : _k.months) ?? "",
82
+ storage: Number.isFinite((_m = (_l = custom == null ? void 0 : custom.limits) == null ? void 0 : _l.organization) == null ? void 0 : _m.storage) ? custom.limits.organization.storage / gigabyte : "",
56
83
  // Stored as CENTS per action; edited in dollars, like `amount`. The
57
84
  // conversion pair lives in lib/overage.js with the float-dust rounding.
58
85
  overages: overageToForm(custom == null ? void 0 : custom.overages),
59
86
  title: (custom == null ? void 0 : custom.title) ?? ""
60
87
  }
61
88
  });
62
- const onSubmit = async ({ actions, available, amount, conversion, features, members, overages, storage, title }) => {
89
+ const onSubmit = async ({ actions, available, amount, conversion, features, lasts, members, months, overages, setup, storage, support, title }) => {
63
90
  try {
64
91
  const response = await request({
65
92
  body: {
@@ -71,6 +98,13 @@ const FormAdminSubscriptionCustom = ({
71
98
  ...Number.isFinite(amount) && { data: { amount: Math.round(amount * 100) } },
72
99
  ...Number.isFinite(conversion) && { conversion },
73
100
  ...Number.isFinite(overages) && { overages: overageFromForm(overages) },
101
+ // Whole cents, converted here as the price is. Empty or 0 is no fee.
102
+ ...Number.isFinite(setup) && setup > 0 && { setup: { amount: Math.round(setup * 100) } },
103
+ // Off keeps the stored months and date; forever sends no months.
104
+ support: {
105
+ enabled: Boolean(support),
106
+ ...support && lasts === "months" && Number.isFinite(months) && { months }
107
+ },
74
108
  limits: {
75
109
  organization: {
76
110
  ...Number.isFinite(actions) && { actions },
@@ -137,6 +171,15 @@ const FormAdminSubscriptionCustom = ({
137
171
  (value) => Number.isFinite(value) ? "Sent as " + Math.round(value * 100).toLocaleString("en-US") + " cents. Applies immediately only if this is the plan they are billing on." : "The organization is billed this each period.",
138
172
  ({ onChange, value }) => /* @__PURE__ */ jsx(InputNumber, { ...{ min: 1, onChange, placeholder: "2499.00", step: 0.01, type: "number", value: value ?? "" } })
139
173
  ),
174
+ field(
175
+ "setup",
176
+ "Setup fee ($)",
177
+ (value) => {
178
+ var _a2;
179
+ return locked ? ((_a2 = custom == null ? void 0 : custom.setup) == null ? void 0 : _a2.billedAt) ? "Billed on " + day(custom.setup.billedAt) + "." : "They are on this plan, so a fee can no longer be added." : value > 0 ? "Sent as " + Math.round(value * 100).toLocaleString("en-US") + " cents. Billed once, on their first invoice." : "Billed once, on their first invoice. Leave empty for no fee.";
180
+ },
181
+ ({ onChange, value }) => /* @__PURE__ */ jsx(InputNumber, { ...{ disabled: locked, min: 0, onChange, placeholder: locked ? "None" : "2500.00", step: 0.01, type: "number", value: value ?? "" } })
182
+ ),
140
183
  field(
141
184
  "actions",
142
185
  "Actions included",
@@ -219,6 +262,27 @@ const FormAdminSubscriptionCustom = ({
219
262
  }
220
263
  }
221
264
  ),
265
+ field(
266
+ "support",
267
+ "Support",
268
+ "On: members see a Support button in their dashboard and can send us a message.",
269
+ ({ onChange, value }) => /* @__PURE__ */ jsx(InputSwitch, { ...{ onChange, value: value || false } })
270
+ ),
271
+ watch("support") && field(
272
+ "lasts",
273
+ "Support lasts",
274
+ (value) => value === "months" ? null : "For as long as they are on this plan.",
275
+ ({ onChange, value }) => /* @__PURE__ */ jsx(InputSelect, { ...{ onChange, options: [{ label: "Forever", value: "forever" }, { label: "A number of months", value: "months" }], value: value || "forever" } })
276
+ ),
277
+ watch("support") && watch("lasts") === "months" && field(
278
+ "months",
279
+ "Months",
280
+ (value) => {
281
+ var _a2, _b2;
282
+ return !Number.isFinite(value) ? "Counted from the day they start this plan." : value === ((_a2 = custom == null ? void 0 : custom.support) == null ? void 0 : _a2.months) && ((_b2 = custom == null ? void 0 : custom.support) == null ? void 0 : _b2.until) ? (new Date(custom.support.until) < /* @__PURE__ */ new Date() ? "Support ended " : "Support ends ") + day(custom.support.until) + "." : (custom == null ? void 0 : custom.startedAt) ? "Support ends " + monthsLabel(value) + " after the day they started this plan." : "Support ends " + monthsLabel(value) + " after they start this plan.";
283
+ },
284
+ ({ onChange, value }) => /* @__PURE__ */ jsx(InputNumber, { ...{ max: 120, min: 1, onChange, placeholder: "6", step: 1, type: "number", value: value ?? "" } })
285
+ ),
222
286
  field(
223
287
  "available",
224
288
  "Available to the organization",
@@ -30,7 +30,6 @@ __export(form_ai_exports, {
30
30
  FormAiBrand: () => FormAiBrand,
31
31
  FormAiCampaign: () => FormAiCampaign,
32
32
  FormAiImage: () => FormAiImage,
33
- FormAiPage: () => FormAiPage,
34
33
  FormAiText: () => FormAiText
35
34
  });
36
35
  module.exports = __toCommonJS(form_ai_exports);
@@ -433,152 +432,6 @@ const FormAiImage = ({
433
432
  }
434
433
  );
435
434
  };
436
- const FormAiPage = ({
437
- canManageBrands,
438
- disabled,
439
- onError,
440
- onSuccess,
441
- values
442
- }) => {
443
- const methods = (0, import_form.useForm)({
444
- guard: false,
445
- resolver: (0, import_yup.resolver)(
446
- import_yup.default.object({
447
- ...import_input_fields.schemas.page(),
448
- brand: import_yup.default.object().label("Brand").nullable(),
449
- url: import_yup.default.string().label("Url").max(150).matches(import_drawbridge_utils.regex.url, "Url must start with https").required().url()
450
- })
451
- ),
452
- values
453
- });
454
- const { control, formState, handleSubmit } = methods;
455
- const onSubmit = async ({
456
- brand,
457
- title,
458
- url
459
- }) => {
460
- try {
461
- const args = {
462
- body: {
463
- brand: (brand == null ? void 0 : brand.id) ?? null,
464
- title,
465
- url
466
- },
467
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.campaign) + "/ai/page",
468
- method: "POST"
469
- };
470
- const response = await (0, import_fetch.request)(args);
471
- onSuccess(response);
472
- } catch (error) {
473
- onError(error);
474
- }
475
- };
476
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormProvider, { ...methods, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
477
- import_form2.default,
478
- {
479
- ...{
480
- className: "relative w-full space-y-6",
481
- onSubmit: handleSubmit(onSubmit)
482
- },
483
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_wrapper_ai.default, { children: [
484
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
485
- import_fieldset.default,
486
- {
487
- ...{
488
- className: "space-y-4",
489
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
490
- },
491
- children: [
492
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_fields.InputFieldsPage, {}),
493
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
494
- import_form.Controller,
495
- {
496
- ...{
497
- control,
498
- name: "url",
499
- render: ({ field: { value, onChange } }) => {
500
- var _a, _b;
501
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
502
- import_input_group.default,
503
- {
504
- ...{
505
- error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.url) == null ? void 0 : _b.message,
506
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
507
- import_input_url.default,
508
- {
509
- ...{
510
- onChange,
511
- placeholder: "Enter a url to get started",
512
- value: value || ""
513
- }
514
- }
515
- ),
516
- label: "Url"
517
- }
518
- }
519
- );
520
- }
521
- }
522
- }
523
- ),
524
- canManageBrands && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
525
- import_form.Controller,
526
- {
527
- ...{
528
- control,
529
- name: "brand",
530
- render: ({ field: { value, onChange } }) => {
531
- var _a, _b;
532
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
533
- import_input_group.default,
534
- {
535
- ...{
536
- error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.brand) == null ? void 0 : _b.message,
537
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
538
- import_input_resource.default,
539
- {
540
- ...{
541
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/brands",
542
- model: "brand",
543
- onChange,
544
- value
545
- }
546
- }
547
- ),
548
- label: "Brand"
549
- }
550
- }
551
- );
552
- }
553
- }
554
- }
555
- )
556
- ]
557
- }
558
- ),
559
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
560
- import_fieldset.default,
561
- {
562
- ...{
563
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
564
- },
565
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
566
- import_button.default,
567
- {
568
- ...{
569
- loading: formState == null ? void 0 : formState.isSubmitting,
570
- type: "submit",
571
- variant: "ai"
572
- },
573
- children: "Generate"
574
- }
575
- )
576
- }
577
- )
578
- ] })
579
- }
580
- ) });
581
- };
582
435
  const FormAiText = ({
583
436
  disabled,
584
437
  onChange = () => {
@@ -777,6 +630,5 @@ const FormAiText = ({
777
630
  FormAiBrand,
778
631
  FormAiCampaign,
779
632
  FormAiImage,
780
- FormAiPage,
781
633
  FormAiText
782
634
  });
@@ -11,7 +11,7 @@ import InputGroup from "../input-group.mjs";
11
11
  import InputText from "../input-text.mjs";
12
12
  import InputUrl from "../shared/input-url.mjs";
13
13
  import InputResource from "./input-resource.mjs";
14
- import { InputFieldsCampaign, InputFieldsPage, schemas } from "./input-fields.mjs";
14
+ import { InputFieldsCampaign, schemas } from "./input-fields.mjs";
15
15
  import InputTextarea from "../input-textarea.mjs";
16
16
  import InputRadio from "./input-radio.mjs";
17
17
  import CardTask from "./card-task.mjs";
@@ -397,152 +397,6 @@ const FormAiImage = ({
397
397
  }
398
398
  );
399
399
  };
400
- const FormAiPage = ({
401
- canManageBrands,
402
- disabled,
403
- onError,
404
- onSuccess,
405
- values
406
- }) => {
407
- const methods = useForm({
408
- guard: false,
409
- resolver: resolver(
410
- yup.object({
411
- ...schemas.page(),
412
- brand: yup.object().label("Brand").nullable(),
413
- url: yup.string().label("Url").max(150).matches(regex.url, "Url must start with https").required().url()
414
- })
415
- ),
416
- values
417
- });
418
- const { control, formState, handleSubmit } = methods;
419
- const onSubmit = async ({
420
- brand,
421
- title,
422
- url
423
- }) => {
424
- try {
425
- const args = {
426
- body: {
427
- brand: (brand == null ? void 0 : brand.id) ?? null,
428
- title,
429
- url
430
- },
431
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.campaign) + "/ai/page",
432
- method: "POST"
433
- };
434
- const response = await request(args);
435
- onSuccess(response);
436
- } catch (error) {
437
- onError(error);
438
- }
439
- };
440
- return /* @__PURE__ */ jsx(FormProvider, { ...methods, children: /* @__PURE__ */ jsx(
441
- Form,
442
- {
443
- ...{
444
- className: "relative w-full space-y-6",
445
- onSubmit: handleSubmit(onSubmit)
446
- },
447
- children: /* @__PURE__ */ jsxs(WrapperAI, { children: [
448
- /* @__PURE__ */ jsxs(
449
- Fieldset,
450
- {
451
- ...{
452
- className: "space-y-4",
453
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
454
- },
455
- children: [
456
- /* @__PURE__ */ jsx(InputFieldsPage, {}),
457
- /* @__PURE__ */ jsx(
458
- Controller,
459
- {
460
- ...{
461
- control,
462
- name: "url",
463
- render: ({ field: { value, onChange } }) => {
464
- var _a, _b;
465
- return /* @__PURE__ */ jsx(
466
- InputGroup,
467
- {
468
- ...{
469
- error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.url) == null ? void 0 : _b.message,
470
- input: /* @__PURE__ */ jsx(
471
- InputUrl,
472
- {
473
- ...{
474
- onChange,
475
- placeholder: "Enter a url to get started",
476
- value: value || ""
477
- }
478
- }
479
- ),
480
- label: "Url"
481
- }
482
- }
483
- );
484
- }
485
- }
486
- }
487
- ),
488
- canManageBrands && /* @__PURE__ */ jsx(
489
- Controller,
490
- {
491
- ...{
492
- control,
493
- name: "brand",
494
- render: ({ field: { value, onChange } }) => {
495
- var _a, _b;
496
- return /* @__PURE__ */ jsx(
497
- InputGroup,
498
- {
499
- ...{
500
- error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.brand) == null ? void 0 : _b.message,
501
- input: /* @__PURE__ */ jsx(
502
- InputResource,
503
- {
504
- ...{
505
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/brands",
506
- model: "brand",
507
- onChange,
508
- value
509
- }
510
- }
511
- ),
512
- label: "Brand"
513
- }
514
- }
515
- );
516
- }
517
- }
518
- }
519
- )
520
- ]
521
- }
522
- ),
523
- /* @__PURE__ */ jsx(
524
- Fieldset,
525
- {
526
- ...{
527
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
528
- },
529
- children: /* @__PURE__ */ jsx(
530
- Button,
531
- {
532
- ...{
533
- loading: formState == null ? void 0 : formState.isSubmitting,
534
- type: "submit",
535
- variant: "ai"
536
- },
537
- children: "Generate"
538
- }
539
- )
540
- }
541
- )
542
- ] })
543
- }
544
- ) });
545
- };
546
400
  const FormAiText = ({
547
401
  disabled,
548
402
  onChange = () => {
@@ -740,6 +594,5 @@ export {
740
594
  FormAiBrand,
741
595
  FormAiCampaign,
742
596
  FormAiImage,
743
- FormAiPage,
744
597
  FormAiText
745
598
  };
@@ -29,21 +29,50 @@ var form_filters_analytics_exports = {};
29
29
  __export(form_filters_analytics_exports, {
30
30
  analyticsFloor: () => analyticsFloor,
31
31
  default: () => form_filters_analytics_default,
32
- periodOptions: () => periodOptions
32
+ periodOptions: () => periodOptions,
33
+ variantResource: () => variantResource
33
34
  });
34
35
  module.exports = __toCommonJS(form_filters_analytics_exports);
35
36
  var import_jsx_runtime = require("react/jsx-runtime");
36
37
  var import_react = require("react");
37
38
  var import_form = require("../shared/lib/form");
38
39
  var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
40
+ var import_features = require("@drawbridge/drawbridge-utils/features");
39
41
  var import_form2 = __toESM(require("../shared/form"));
40
42
  var import_fieldset = __toESM(require("../shared/fieldset"));
41
43
  var import_input_group = __toESM(require("../input-group"));
42
44
  var import_input_date = __toESM(require("./input-date"));
43
45
  var import_input_resource = __toESM(require("./input-resource"));
44
46
  var import_input_combobox = __toESM(require("./input-combobox"));
47
+ var import_card_task = __toESM(require("./card-task"));
45
48
  var import_tabs = __toESM(require("../shared/tabs"));
46
49
  var import_button = __toESM(require("../shared/button"));
50
+ var import_helpers = require("../shared/lib/helpers");
51
+ const variantResource = ({ endpoint, organization }) => {
52
+ const feature = (0, import_drawbridge_utils.getPlanFeature)(organization == null ? void 0 : organization.plan, import_features.organization.tests.key);
53
+ return {
54
+ endpoint,
55
+ key: "variant",
56
+ // Named for what people know, their tests (Darren, 2026-11-14).
57
+ label: "A/B test",
58
+ // "Select an A/B test page", "No A/B test pages found".
59
+ model: "A/B test page",
60
+ // The api's name for the variant: its test and its own title, "Summer
61
+ // hero · Video first", a test variant the only kind the list holds.
62
+ render: (item) => item == null ? void 0 : item.name,
63
+ ...!(feature == null ? void 0 : feature.granted) && {
64
+ upgrade: {
65
+ ...(0, import_helpers.hasCapability)(organization, "billing") && {
66
+ button: {
67
+ href: "/organizations/" + (organization == null ? void 0 : organization.id) + "/billing",
68
+ text: "Upgrade"
69
+ }
70
+ },
71
+ message: (feature == null ? void 0 : feature.message) || import_features.organization.tests.error
72
+ }
73
+ }
74
+ };
75
+ };
47
76
  const pad = (number) => String(number).padStart(2, "0");
48
77
  const analyticsFloor = (show, now = /* @__PURE__ */ new Date()) => {
49
78
  if (!show) return null;
@@ -102,8 +131,8 @@ const FormFiltersAnalytics = ({
102
131
  const dateRangeEnd = (0, import_form.useWatch)({ control, name: "filters.end", defaultValue: filters == null ? void 0 : filters.end }) || "";
103
132
  const campaign = (0, import_form.useWatch)({ control, name: "filters.campaign", defaultValue: filters == null ? void 0 : filters.campaign }) || null;
104
133
  const campaignId = campaign && typeof campaign === "object" ? campaign.id : campaign;
105
- const page = (0, import_form.useWatch)({ control, name: "filters.page", defaultValue: filters == null ? void 0 : filters.page }) || null;
106
- const pageCampaign = page && typeof page === "object" && page.campaign || null;
134
+ const variant = (0, import_form.useWatch)({ control, name: "filters.variant", defaultValue: filters == null ? void 0 : filters.variant }) || null;
135
+ const variantCampaign = variant && typeof variant === "object" && variant.campaign || null;
107
136
  const affiliate = (0, import_form.useWatch)({ control, name: "filters.affiliate", defaultValue: filters == null ? void 0 : filters.affiliate }) || null;
108
137
  const affiliateCampaigns = affiliate && typeof affiliate === "object" && Array.isArray(affiliate.campaigns) ? affiliate.campaigns : null;
109
138
  const onSubmit = async ({
@@ -172,7 +201,7 @@ const FormFiltersAnalytics = ({
172
201
  },
173
202
  key
174
203
  ));
175
- const renderResources = (fields) => fields.map(({ key, label, endpoint, model, multiple, params, render: renderItem }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
204
+ const renderResources = (fields) => fields.map(({ key, label, endpoint, model, multiple, params, render: renderItem, upgrade }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
176
205
  import_form.Controller,
177
206
  {
178
207
  ...{
@@ -183,43 +212,61 @@ const FormFiltersAnalytics = ({
183
212
  {
184
213
  ...{
185
214
  label: (0, import_drawbridge_utils.capitalize)(label),
186
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
187
- import_input_resource.default,
215
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
216
+ "div",
188
217
  {
189
218
  ...{
190
- endpoint,
191
- model,
192
- multiple: Boolean(multiple),
193
- onChange: (item) => {
194
- onChange(item);
195
- if (key === "campaign" && item && pageCampaign !== item.id) {
196
- setValue("filters.page", null);
197
- }
198
- ;
199
- },
200
- params: {
201
- ...params,
202
- ...key === "page" && campaignId && {
203
- filters: {
204
- campaign: campaignId
205
- }
206
- },
207
- ...key === "campaign" && pageCampaign && {
208
- filters: {
209
- id: pageCampaign
210
- }
211
- },
212
- ...key === "campaign" && !pageCampaign && affiliateCampaigns && {
213
- filters: {
214
- id: {
215
- $in: affiliateCampaigns
216
- }
219
+ className: "space-y-2"
220
+ },
221
+ children: [
222
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
223
+ import_input_resource.default,
224
+ {
225
+ ...{
226
+ // A filter the plan leaves out cannot be picked.
227
+ disabled: Boolean(upgrade),
228
+ endpoint,
229
+ model,
230
+ multiple: Boolean(multiple),
231
+ onChange: (item) => {
232
+ onChange(item);
233
+ if (key === "campaign" && item && variantCampaign !== item.id) {
234
+ setValue("filters.variant", null);
235
+ }
236
+ ;
237
+ },
238
+ params: {
239
+ ...params,
240
+ ...key === "variant" && campaignId && {
241
+ filters: {
242
+ campaign: campaignId
243
+ }
244
+ },
245
+ ...key === "campaign" && variantCampaign && {
246
+ filters: {
247
+ id: variantCampaign
248
+ }
249
+ },
250
+ ...key === "campaign" && !variantCampaign && affiliateCampaigns && {
251
+ filters: {
252
+ id: {
253
+ $in: affiliateCampaigns
254
+ }
255
+ }
256
+ }
257
+ },
258
+ render: renderItem,
259
+ value: upgrade ? null : multiple ? value || [] : value || null
217
260
  }
218
261
  }
219
- },
220
- render: renderItem,
221
- value: multiple ? value || [] : value || null
222
- }
262
+ ),
263
+ upgrade && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
264
+ import_card_task.default,
265
+ {
266
+ ...upgrade
267
+ }
268
+ )
269
+ ]
223
270
  }
224
271
  )
225
272
  }
@@ -332,5 +379,6 @@ var form_filters_analytics_default = FormFiltersAnalytics;
332
379
  // Annotate the CommonJS export names for ESM import in node:
333
380
  0 && (module.exports = {
334
381
  analyticsFloor,
335
- periodOptions
382
+ periodOptions,
383
+ variantResource
336
384
  });