@drawbridge/components 0.1.12 → 0.1.14

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 (236) hide show
  1. package/components/styles.css +364 -2
  2. package/dist/advertisement.js +3 -1
  3. package/dist/advertisement.mjs +3 -1
  4. package/dist/bridge/advertisements.js +2 -0
  5. package/dist/bridge/advertisements.mjs +2 -0
  6. package/dist/bridge/countdown.js +2 -1
  7. package/dist/bridge/countdown.mjs +2 -1
  8. package/dist/bridge/form-subdomain-embed.js +18 -20
  9. package/dist/bridge/form-subdomain-embed.mjs +18 -20
  10. package/dist/bridge/form-subdomain-header.js +24 -1
  11. package/dist/bridge/form-subdomain-header.mjs +24 -1
  12. package/dist/bridge/form-subdomain-missions.js +538 -0
  13. package/dist/bridge/form-subdomain-missions.mjs +502 -0
  14. package/dist/bridge/form-subdomain.js +530 -220
  15. package/dist/bridge/form-subdomain.mjs +533 -222
  16. package/dist/bridge/lib/entry.js +59 -0
  17. package/dist/bridge/lib/entry.mjs +29 -0
  18. package/dist/bridge/lib/location.js +38 -0
  19. package/dist/bridge/lib/location.mjs +13 -0
  20. package/dist/bridge/lib/order.js +71 -0
  21. package/dist/bridge/lib/order.mjs +44 -0
  22. package/dist/bridge/lib/url.js +9 -0
  23. package/dist/bridge/lib/url.mjs +7 -0
  24. package/dist/bridge/share-button.js +5 -3
  25. package/dist/bridge/share-button.mjs +5 -3
  26. package/dist/bridge/subdomain-content.js +7 -6
  27. package/dist/bridge/subdomain-content.mjs +7 -6
  28. package/dist/bridge/template-layout.js +59 -21
  29. package/dist/bridge/template-layout.mjs +59 -21
  30. package/dist/bridge/template-modal.js +42 -76
  31. package/dist/bridge/template-modal.mjs +39 -73
  32. package/dist/bridge/template-preview.js +208 -0
  33. package/dist/bridge/template-preview.mjs +173 -0
  34. package/dist/bridge/template-subdomain-gallery.js +6 -2
  35. package/dist/bridge/template-subdomain-gallery.mjs +6 -2
  36. package/dist/bridge/template-subdomain-link.js +6 -1
  37. package/dist/bridge/template-subdomain-link.mjs +6 -1
  38. package/dist/bridge/template-subdomain.js +20 -15
  39. package/dist/bridge/template-subdomain.mjs +20 -15
  40. package/dist/dashboard/accordion.js +74 -39
  41. package/dist/dashboard/accordion.mjs +74 -39
  42. package/dist/dashboard/avatar.js +109 -3
  43. package/dist/dashboard/avatar.mjs +106 -4
  44. package/dist/dashboard/buttons-subscription.js +384 -0
  45. package/dist/dashboard/buttons-subscription.mjs +349 -0
  46. package/dist/dashboard/card-campaign-switch.js +265 -0
  47. package/dist/dashboard/card-campaign-switch.mjs +231 -0
  48. package/dist/dashboard/card-order.js +28 -11
  49. package/dist/dashboard/card-order.mjs +28 -11
  50. package/dist/dashboard/card-section.js +26 -2
  51. package/dist/dashboard/card-section.mjs +26 -2
  52. package/dist/dashboard/card-tile.js +6 -7
  53. package/dist/dashboard/card-tile.mjs +6 -7
  54. package/dist/dashboard/connection-workflows.js +196 -0
  55. package/dist/dashboard/connection-workflows.mjs +162 -0
  56. package/dist/dashboard/device.js +95 -0
  57. package/dist/dashboard/device.mjs +72 -0
  58. package/dist/dashboard/form-admin-campaign.js +19 -50
  59. package/dist/dashboard/form-admin-campaign.mjs +20 -51
  60. package/dist/dashboard/form-ai.js +9 -6
  61. package/dist/dashboard/form-ai.mjs +9 -6
  62. package/dist/dashboard/form-auth.js +35 -25
  63. package/dist/dashboard/form-auth.mjs +36 -26
  64. package/dist/dashboard/form-file.js +10 -1
  65. package/dist/dashboard/form-file.mjs +10 -1
  66. package/dist/dashboard/form-filters-analytics.js +14 -1
  67. package/dist/dashboard/form-filters-analytics.mjs +15 -2
  68. package/dist/dashboard/form-organization-campaign-advertisement.js +15 -1
  69. package/dist/dashboard/form-organization-campaign-advertisement.mjs +16 -2
  70. package/dist/dashboard/form-organization-campaign-agreement.js +215 -164
  71. package/dist/dashboard/form-organization-campaign-agreement.mjs +215 -164
  72. package/dist/dashboard/form-organization-campaign-field-email.js +0 -34
  73. package/dist/dashboard/form-organization-campaign-field-email.mjs +0 -34
  74. package/dist/dashboard/form-organization-campaign-field-list.js +466 -0
  75. package/dist/dashboard/form-organization-campaign-field-list.mjs +437 -0
  76. package/dist/dashboard/form-organization-campaign-field-phone.js +0 -34
  77. package/dist/dashboard/form-organization-campaign-field-phone.mjs +0 -34
  78. package/dist/dashboard/form-organization-campaign-field-remove.js +66 -0
  79. package/dist/dashboard/form-organization-campaign-field-remove.mjs +33 -0
  80. package/dist/dashboard/form-organization-campaign-integration-age.js +6 -12
  81. package/dist/dashboard/form-organization-campaign-integration-age.mjs +6 -12
  82. package/dist/dashboard/form-organization-campaign-integration-enable.js +52 -24
  83. package/dist/dashboard/form-organization-campaign-integration-enable.mjs +54 -26
  84. package/dist/dashboard/form-organization-campaign-integration-geocode.js +6 -12
  85. package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +6 -12
  86. package/dist/dashboard/form-organization-campaign-integration-gtm.js +6 -12
  87. package/dist/dashboard/form-organization-campaign-integration-gtm.mjs +6 -12
  88. package/dist/dashboard/form-organization-campaign-link.js +7 -1
  89. package/dist/dashboard/form-organization-campaign-link.mjs +7 -1
  90. package/dist/dashboard/form-organization-campaign-mission.js +291 -0
  91. package/dist/dashboard/form-organization-campaign-mission.mjs +258 -0
  92. package/dist/dashboard/form-organization-campaign-page-embed.js +13 -2
  93. package/dist/dashboard/form-organization-campaign-page-embed.mjs +12 -1
  94. package/dist/dashboard/form-organization-campaign-page.js +20 -11
  95. package/dist/dashboard/form-organization-campaign-page.mjs +20 -11
  96. package/dist/dashboard/form-organization-campaign-prize-edit.js +12 -1
  97. package/dist/dashboard/form-organization-campaign-prize-edit.mjs +12 -1
  98. package/dist/dashboard/form-organization-campaign-section.js +223 -0
  99. package/dist/dashboard/form-organization-campaign-section.mjs +194 -0
  100. package/dist/dashboard/form-organization-campaign.js +114 -469
  101. package/dist/dashboard/form-organization-campaign.mjs +113 -467
  102. package/dist/dashboard/form-organization-export.js +4 -7
  103. package/dist/dashboard/form-organization-export.mjs +4 -7
  104. package/dist/dashboard/form-organization-identity.js +46 -51
  105. package/dist/dashboard/form-organization-identity.mjs +46 -51
  106. package/dist/dashboard/form-organization-workflow.js +518 -686
  107. package/dist/dashboard/form-organization-workflow.mjs +517 -682
  108. package/dist/dashboard/form-organization.js +82 -110
  109. package/dist/dashboard/form-organization.mjs +81 -109
  110. package/dist/dashboard/form-otc.js +4 -5
  111. package/dist/dashboard/form-otc.mjs +4 -5
  112. package/dist/dashboard/form-payment-methods.js +20 -9
  113. package/dist/dashboard/form-payment-methods.mjs +20 -9
  114. package/dist/dashboard/form-stripe.js +30 -0
  115. package/dist/dashboard/form-stripe.mjs +26 -0
  116. package/dist/dashboard/input-array.js +4 -2
  117. package/dist/dashboard/input-array.mjs +4 -2
  118. package/dist/dashboard/input-combobox.js +7 -3
  119. package/dist/dashboard/input-combobox.mjs +7 -3
  120. package/dist/dashboard/input-date.js +7 -0
  121. package/dist/dashboard/input-date.mjs +7 -0
  122. package/dist/dashboard/input-fields.js +80 -20
  123. package/dist/dashboard/input-fields.mjs +80 -20
  124. package/dist/dashboard/input-file.js +21 -1
  125. package/dist/dashboard/input-file.mjs +21 -1
  126. package/dist/dashboard/input-font.js +10 -1
  127. package/dist/dashboard/input-font.mjs +10 -1
  128. package/dist/dashboard/lib/item-list.js +57 -0
  129. package/dist/dashboard/lib/item-list.mjs +33 -0
  130. package/dist/dashboard/lib/menu.js +50 -0
  131. package/dist/dashboard/lib/menu.mjs +26 -0
  132. package/dist/dashboard/locked.js +82 -0
  133. package/dist/dashboard/locked.mjs +53 -0
  134. package/dist/dashboard/menu.js +72 -19
  135. package/dist/dashboard/menu.mjs +72 -19
  136. package/dist/dashboard/note-ai.js +69 -0
  137. package/dist/dashboard/note-ai.mjs +36 -0
  138. package/dist/dashboard/preview.js +419 -0
  139. package/dist/dashboard/preview.mjs +384 -0
  140. package/dist/dashboard/steps.js +39 -13
  141. package/dist/dashboard/steps.mjs +37 -12
  142. package/dist/dashboard/table-contacts.js +136 -0
  143. package/dist/dashboard/table-contacts.mjs +103 -0
  144. package/dist/dashboard/template-not-found.js +4 -2
  145. package/dist/dashboard/template-not-found.mjs +4 -2
  146. package/dist/dashboard/template-socket.js +51 -7
  147. package/dist/dashboard/template-socket.mjs +51 -7
  148. package/dist/icons/desktop.js +46 -0
  149. package/dist/icons/desktop.mjs +27 -0
  150. package/dist/icons/phone.js +46 -0
  151. package/dist/icons/phone.mjs +27 -0
  152. package/dist/icons/puzzle-piece.js +46 -0
  153. package/dist/icons/puzzle-piece.mjs +27 -0
  154. package/dist/icons/tablet.js +46 -0
  155. package/dist/icons/tablet.mjs +27 -0
  156. package/dist/icons/users.js +46 -0
  157. package/dist/icons/users.mjs +27 -0
  158. package/dist/input-checkbox.js +1 -0
  159. package/dist/input-checkbox.mjs +1 -0
  160. package/dist/input-code.js +101 -0
  161. package/dist/input-code.mjs +78 -0
  162. package/dist/input-text.js +2 -1
  163. package/dist/input-text.mjs +2 -1
  164. package/dist/shared/input-checkbox-list.js +0 -1
  165. package/dist/shared/input-checkbox-list.mjs +0 -1
  166. package/dist/shared/input-switch.js +6 -1
  167. package/dist/shared/input-switch.mjs +6 -1
  168. package/dist/shared/lib/campaign.js +117 -0
  169. package/dist/shared/lib/campaign.mjs +91 -0
  170. package/dist/shared/lib/helpers.js +14 -2
  171. package/dist/shared/lib/helpers.mjs +13 -2
  172. package/package.json +133 -13
  173. package/types/bridge/form-subdomain-header.d.ts +2 -0
  174. package/types/bridge/form-subdomain-missions.d.ts +36 -0
  175. package/types/bridge/form-subdomain.d.ts +23 -1
  176. package/types/bridge/lib/entry.d.ts +26 -0
  177. package/types/bridge/lib/location.d.ts +13 -0
  178. package/types/bridge/lib/order.d.ts +30 -0
  179. package/types/bridge/lib/url.d.ts +19 -0
  180. package/types/bridge/template-modal.d.ts +1 -1
  181. package/types/bridge/template-preview.d.ts +10 -0
  182. package/types/bridge/template-subdomain-link.d.ts +2 -0
  183. package/types/dashboard/accordion.d.ts +2 -0
  184. package/types/dashboard/avatar.d.ts +18 -2
  185. package/types/dashboard/buttons-subscription.d.ts +22 -0
  186. package/types/dashboard/card-campaign-switch.d.ts +32 -0
  187. package/types/dashboard/card-order.d.ts +11 -0
  188. package/types/dashboard/card-section.d.ts +2 -0
  189. package/types/dashboard/connection-workflows.d.ts +33 -0
  190. package/types/dashboard/device.d.ts +12 -0
  191. package/types/dashboard/form-admin-campaign.d.ts +3 -2
  192. package/types/dashboard/form-ai.d.ts +2 -2
  193. package/types/dashboard/form-organization-campaign-agreement.d.ts +18 -12
  194. package/types/dashboard/form-organization-campaign-field-email.d.ts +1 -2
  195. package/types/dashboard/form-organization-campaign-field-list.d.ts +36 -0
  196. package/types/dashboard/form-organization-campaign-field-phone.d.ts +1 -2
  197. package/types/dashboard/form-organization-campaign-field-remove.d.ts +22 -0
  198. package/types/dashboard/form-organization-campaign-field-select.d.ts +2 -1
  199. package/types/dashboard/form-organization-campaign-field-textarea.d.ts +2 -1
  200. package/types/dashboard/form-organization-campaign-integration-age.d.ts +3 -3
  201. package/types/dashboard/form-organization-campaign-integration-enable.d.ts +3 -3
  202. package/types/dashboard/form-organization-campaign-mission.d.ts +40 -0
  203. package/types/dashboard/form-organization-campaign-section.d.ts +27 -0
  204. package/types/dashboard/form-organization-campaign.d.ts +27 -17
  205. package/types/dashboard/form-organization-identity.d.ts +2 -0
  206. package/types/dashboard/form-organization-workflow.d.ts +43 -47
  207. package/types/dashboard/form-organization.d.ts +7 -2
  208. package/types/dashboard/form-stripe.d.ts +3 -0
  209. package/types/dashboard/input-combobox.d.ts +2 -0
  210. package/types/dashboard/input-date.d.ts +2 -0
  211. package/types/dashboard/input-fields.d.ts +3 -2
  212. package/types/dashboard/input-file.d.ts +4 -0
  213. package/types/dashboard/lib/item-list.d.ts +14 -0
  214. package/types/dashboard/lib/menu.d.ts +17 -0
  215. package/types/dashboard/locked.d.ts +10 -0
  216. package/types/dashboard/menu.d.ts +10 -2
  217. package/types/dashboard/note-ai.d.ts +15 -0
  218. package/types/dashboard/preview.d.ts +33 -0
  219. package/types/dashboard/steps.d.ts +19 -4
  220. package/types/dashboard/table-cell-title.d.ts +2 -2
  221. package/types/dashboard/table-contacts.d.ts +2 -0
  222. package/types/icons/desktop.d.ts +5 -0
  223. package/types/icons/phone.d.ts +5 -0
  224. package/types/icons/puzzle-piece.d.ts +5 -0
  225. package/types/icons/tablet.d.ts +5 -0
  226. package/types/icons/users.d.ts +5 -0
  227. package/types/input-code.d.ts +23 -0
  228. package/types/shared/input-switch.d.ts +2 -0
  229. package/types/shared/lib/campaign.d.ts +35 -0
  230. package/types/shared/lib/helpers.d.ts +3 -0
  231. package/dist/dashboard/card-integration.js +0 -187
  232. package/dist/dashboard/card-integration.mjs +0 -158
  233. package/dist/dashboard/iframe.js +0 -159
  234. package/dist/dashboard/iframe.mjs +0 -130
  235. package/types/dashboard/card-integration.d.ts +0 -24
  236. package/types/dashboard/iframe.d.ts +0 -18
@@ -70,20 +70,14 @@ const FormOrganizationCampaignIntegrationAge = ({
70
70
  settings
71
71
  }) => {
72
72
  try {
73
- const args = {
73
+ const response = await (0, import_fetch.request)({
74
74
  body: {
75
75
  enabled,
76
- settings,
77
- slug: values.slug
76
+ settings
78
77
  },
79
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration",
80
- method: "POST"
81
- };
82
- if (values == null ? void 0 : values.id) {
83
- args.endpoint = args.endpoint + "/" + values.id;
84
- args.method = "PUT";
85
- }
86
- const response = await (0, import_fetch.request)(args);
78
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration/" + values.slug,
79
+ method: "PUT"
80
+ });
87
81
  onSuccess(response);
88
82
  } catch (error) {
89
83
  onError(error);
@@ -202,7 +196,7 @@ const FormOrganizationCampaignIntegrationAge = ({
202
196
  loading: formState == null ? void 0 : formState.isSubmitting,
203
197
  type: "submit"
204
198
  },
205
- children: (values == null ? void 0 : values.id) ? "Save" : "Add"
199
+ children: (values == null ? void 0 : values.added) ? "Save" : "Add"
206
200
  }
207
201
  )
208
202
  ]
@@ -38,20 +38,14 @@ const FormOrganizationCampaignIntegrationAge = ({
38
38
  settings
39
39
  }) => {
40
40
  try {
41
- const args = {
41
+ const response = await request({
42
42
  body: {
43
43
  enabled,
44
- settings,
45
- slug: values.slug
44
+ settings
46
45
  },
47
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration",
48
- method: "POST"
49
- };
50
- if (values == null ? void 0 : values.id) {
51
- args.endpoint = args.endpoint + "/" + values.id;
52
- args.method = "PUT";
53
- }
54
- const response = await request(args);
46
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration/" + values.slug,
47
+ method: "PUT"
48
+ });
55
49
  onSuccess(response);
56
50
  } catch (error) {
57
51
  onError(error);
@@ -170,7 +164,7 @@ const FormOrganizationCampaignIntegrationAge = ({
170
164
  loading: formState == null ? void 0 : formState.isSubmitting,
171
165
  type: "submit"
172
166
  },
173
- children: (values == null ? void 0 : values.id) ? "Save" : "Add"
167
+ children: (values == null ? void 0 : values.added) ? "Save" : "Add"
174
168
  }
175
169
  )
176
170
  ]
@@ -36,6 +36,8 @@ var import_form = require("../shared/lib/form");
36
36
  var import_yup = __toESM(require("../shared/lib/yup"));
37
37
  var import_form2 = __toESM(require("../shared/form"));
38
38
  var import_fieldset = __toESM(require("../shared/fieldset"));
39
+ var import_input_group = __toESM(require("../input-group"));
40
+ var import_input_switch = __toESM(require("../shared/input-switch"));
39
41
  var import_button = __toESM(require("../shared/button"));
40
42
  const FormOrganizationCampaignIntegrationEnable = ({
41
43
  disabled,
@@ -43,7 +45,7 @@ const FormOrganizationCampaignIntegrationEnable = ({
43
45
  onError,
44
46
  values
45
47
  }) => {
46
- const { handleSubmit, formState } = (0, import_form.useForm)({
48
+ const { control, handleSubmit, formState } = (0, import_form.useForm)({
47
49
  defaultValues: values,
48
50
  resolver: (0, import_yup.resolver)(
49
51
  import_yup.default.object({
@@ -55,20 +57,14 @@ const FormOrganizationCampaignIntegrationEnable = ({
55
57
  enabled
56
58
  }) => {
57
59
  try {
58
- const args = {
60
+ const response = await (0, import_fetch.request)({
59
61
  body: {
60
- enabled: true,
61
- settings: {},
62
- slug: values.slug
62
+ enabled,
63
+ settings: {}
63
64
  },
64
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration",
65
- method: "POST"
66
- };
67
- if (values == null ? void 0 : values.id) {
68
- args.endpoint = args.endpoint + "/" + values.id;
69
- args.method = "PUT";
70
- }
71
- const response = await (0, import_fetch.request)(args);
65
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration/" + values.slug,
66
+ method: "PUT"
67
+ });
72
68
  onSuccess(response);
73
69
  } catch (error) {
74
70
  onError(error);
@@ -81,22 +77,54 @@ const FormOrganizationCampaignIntegrationEnable = ({
81
77
  className: "relative w-full",
82
78
  onSubmit: handleSubmit(onSubmit)
83
79
  },
84
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
80
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
85
81
  import_fieldset.default,
86
82
  {
87
83
  ...{
88
84
  disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
89
85
  },
90
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
91
- import_button.default,
92
- {
93
- ...{
94
- loading: formState == null ? void 0 : formState.isSubmitting,
95
- type: "submit"
96
- },
97
- children: (values == null ? void 0 : values.id) ? "Save" : "Add"
98
- }
99
- )
86
+ children: [
87
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
88
+ import_form.Controller,
89
+ {
90
+ ...{
91
+ control,
92
+ name: "enabled",
93
+ render: ({ field: { value, onChange } }) => {
94
+ var _a, _b;
95
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
96
+ import_input_group.default,
97
+ {
98
+ ...{
99
+ error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.enabled) == null ? void 0 : _b.message,
100
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
101
+ import_input_switch.default,
102
+ {
103
+ ...{
104
+ onChange,
105
+ value: value || false
106
+ }
107
+ }
108
+ ),
109
+ label: "Enabled"
110
+ }
111
+ }
112
+ );
113
+ }
114
+ }
115
+ }
116
+ ),
117
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
118
+ import_button.default,
119
+ {
120
+ ...{
121
+ loading: formState == null ? void 0 : formState.isSubmitting,
122
+ type: "submit"
123
+ },
124
+ children: (values == null ? void 0 : values.added) ? "Save" : "Add"
125
+ }
126
+ )
127
+ ]
100
128
  }
101
129
  )
102
130
  }
@@ -1,9 +1,11 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { request } from "@drawbridge/drawbridge-utils/fetch";
3
- import { useForm } from "../shared/lib/form.mjs";
3
+ import { useForm, Controller } from "../shared/lib/form.mjs";
4
4
  import yup, { resolver } from "../shared/lib/yup.mjs";
5
5
  import Form from "../shared/form.mjs";
6
6
  import Fieldset from "../shared/fieldset.mjs";
7
+ import InputGroup from "../input-group.mjs";
8
+ import InputSwitch from "../shared/input-switch.mjs";
7
9
  import Button from "../shared/button.mjs";
8
10
  const FormOrganizationCampaignIntegrationEnable = ({
9
11
  disabled,
@@ -11,7 +13,7 @@ const FormOrganizationCampaignIntegrationEnable = ({
11
13
  onError,
12
14
  values
13
15
  }) => {
14
- const { handleSubmit, formState } = useForm({
16
+ const { control, handleSubmit, formState } = useForm({
15
17
  defaultValues: values,
16
18
  resolver: resolver(
17
19
  yup.object({
@@ -23,20 +25,14 @@ const FormOrganizationCampaignIntegrationEnable = ({
23
25
  enabled
24
26
  }) => {
25
27
  try {
26
- const args = {
28
+ const response = await request({
27
29
  body: {
28
- enabled: true,
29
- settings: {},
30
- slug: values.slug
30
+ enabled,
31
+ settings: {}
31
32
  },
32
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration",
33
- method: "POST"
34
- };
35
- if (values == null ? void 0 : values.id) {
36
- args.endpoint = args.endpoint + "/" + values.id;
37
- args.method = "PUT";
38
- }
39
- const response = await request(args);
33
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration/" + values.slug,
34
+ method: "PUT"
35
+ });
40
36
  onSuccess(response);
41
37
  } catch (error) {
42
38
  onError(error);
@@ -49,22 +45,54 @@ const FormOrganizationCampaignIntegrationEnable = ({
49
45
  className: "relative w-full",
50
46
  onSubmit: handleSubmit(onSubmit)
51
47
  },
52
- children: /* @__PURE__ */ jsx(
48
+ children: /* @__PURE__ */ jsxs(
53
49
  Fieldset,
54
50
  {
55
51
  ...{
56
52
  disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
57
53
  },
58
- children: /* @__PURE__ */ jsx(
59
- Button,
60
- {
61
- ...{
62
- loading: formState == null ? void 0 : formState.isSubmitting,
63
- type: "submit"
64
- },
65
- children: (values == null ? void 0 : values.id) ? "Save" : "Add"
66
- }
67
- )
54
+ children: [
55
+ /* @__PURE__ */ jsx(
56
+ Controller,
57
+ {
58
+ ...{
59
+ control,
60
+ name: "enabled",
61
+ render: ({ field: { value, onChange } }) => {
62
+ var _a, _b;
63
+ return /* @__PURE__ */ jsx(
64
+ InputGroup,
65
+ {
66
+ ...{
67
+ error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.enabled) == null ? void 0 : _b.message,
68
+ input: /* @__PURE__ */ jsx(
69
+ InputSwitch,
70
+ {
71
+ ...{
72
+ onChange,
73
+ value: value || false
74
+ }
75
+ }
76
+ ),
77
+ label: "Enabled"
78
+ }
79
+ }
80
+ );
81
+ }
82
+ }
83
+ }
84
+ ),
85
+ /* @__PURE__ */ jsx(
86
+ Button,
87
+ {
88
+ ...{
89
+ loading: formState == null ? void 0 : formState.isSubmitting,
90
+ type: "submit"
91
+ },
92
+ children: (values == null ? void 0 : values.added) ? "Save" : "Add"
93
+ }
94
+ )
95
+ ]
68
96
  }
69
97
  )
70
98
  }
@@ -76,20 +76,14 @@ const FormOrganizationCampaignIntegrationGeocode = ({
76
76
  }) => {
77
77
  try {
78
78
  const { zoom, ...location } = settings;
79
- const args = {
79
+ const response = await (0, import_fetch.request)({
80
80
  body: {
81
81
  enabled,
82
- settings: location,
83
- slug: values.slug
82
+ settings: location
84
83
  },
85
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration",
86
- method: "POST"
87
- };
88
- if (values == null ? void 0 : values.id) {
89
- args.endpoint = args.endpoint + "/" + values.id;
90
- args.method = "PUT";
91
- }
92
- const response = await (0, import_fetch.request)(args);
84
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration/" + values.slug,
85
+ method: "PUT"
86
+ });
93
87
  onSuccess(response);
94
88
  } catch (error) {
95
89
  onError(error);
@@ -176,7 +170,7 @@ const FormOrganizationCampaignIntegrationGeocode = ({
176
170
  loading: formState == null ? void 0 : formState.isSubmitting,
177
171
  type: "submit"
178
172
  },
179
- children: (values == null ? void 0 : values.id) ? "Save" : "Add"
173
+ children: (values == null ? void 0 : values.added) ? "Save" : "Add"
180
174
  }
181
175
  )
182
176
  ]
@@ -44,20 +44,14 @@ const FormOrganizationCampaignIntegrationGeocode = ({
44
44
  }) => {
45
45
  try {
46
46
  const { zoom, ...location } = settings;
47
- const args = {
47
+ const response = await request({
48
48
  body: {
49
49
  enabled,
50
- settings: location,
51
- slug: values.slug
50
+ settings: location
52
51
  },
53
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration",
54
- method: "POST"
55
- };
56
- if (values == null ? void 0 : values.id) {
57
- args.endpoint = args.endpoint + "/" + values.id;
58
- args.method = "PUT";
59
- }
60
- const response = await request(args);
52
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration/" + values.slug,
53
+ method: "PUT"
54
+ });
61
55
  onSuccess(response);
62
56
  } catch (error) {
63
57
  onError(error);
@@ -144,7 +138,7 @@ const FormOrganizationCampaignIntegrationGeocode = ({
144
138
  loading: formState == null ? void 0 : formState.isSubmitting,
145
139
  type: "submit"
146
140
  },
147
- children: (values == null ? void 0 : values.id) ? "Save" : "Add"
141
+ children: (values == null ? void 0 : values.added) ? "Save" : "Add"
148
142
  }
149
143
  )
150
144
  ]
@@ -64,20 +64,14 @@ const FormOrganizationCampaignIntegrationGtm = ({
64
64
  settings
65
65
  }) => {
66
66
  try {
67
- const args = {
67
+ const response = await (0, import_fetch.request)({
68
68
  body: {
69
69
  enabled,
70
- settings,
71
- slug: values.slug
70
+ settings
72
71
  },
73
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration",
74
- method: "POST"
75
- };
76
- if (values == null ? void 0 : values.id) {
77
- args.endpoint = args.endpoint + "/" + values.id;
78
- args.method = "PUT";
79
- }
80
- const response = await (0, import_fetch.request)(args);
72
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration/" + values.slug,
73
+ method: "PUT"
74
+ });
81
75
  onSuccess(response);
82
76
  } catch (error) {
83
77
  onError(error);
@@ -164,7 +158,7 @@ const FormOrganizationCampaignIntegrationGtm = ({
164
158
  loading: formState == null ? void 0 : formState.isSubmitting,
165
159
  type: "submit"
166
160
  },
167
- children: (values == null ? void 0 : values.id) ? "Save" : "Add"
161
+ children: (values == null ? void 0 : values.added) ? "Save" : "Add"
168
162
  }
169
163
  )
170
164
  ]
@@ -32,20 +32,14 @@ const FormOrganizationCampaignIntegrationGtm = ({
32
32
  settings
33
33
  }) => {
34
34
  try {
35
- const args = {
35
+ const response = await request({
36
36
  body: {
37
37
  enabled,
38
- settings,
39
- slug: values.slug
38
+ settings
40
39
  },
41
- endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration",
42
- method: "POST"
43
- };
44
- if (values == null ? void 0 : values.id) {
45
- args.endpoint = args.endpoint + "/" + values.id;
46
- args.method = "PUT";
47
- }
48
- const response = await request(args);
40
+ endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + values.campaign + "/integration/" + values.slug,
41
+ method: "PUT"
42
+ });
49
43
  onSuccess(response);
50
44
  } catch (error) {
51
45
  onError(error);
@@ -132,7 +126,7 @@ const FormOrganizationCampaignIntegrationGtm = ({
132
126
  loading: formState == null ? void 0 : formState.isSubmitting,
133
127
  type: "submit"
134
128
  },
135
- children: (values == null ? void 0 : values.id) ? "Save" : "Add"
129
+ children: (values == null ? void 0 : values.added) ? "Save" : "Add"
136
130
  }
137
131
  )
138
132
  ]
@@ -73,7 +73,7 @@ const FormOrganizationCampaignLink = ({
73
73
  values
74
74
  }) => {
75
75
  var _a;
76
- const { control, formState, handleSubmit, watch } = (0, import_form.useForm)({
76
+ const { control, formState, handleSubmit, setValue, watch } = (0, import_form.useForm)({
77
77
  resolver: (0, import_yup.resolver)(
78
78
  import_yup.default.object({
79
79
  asset: import_yup.default.object().label("Asset").nullable(),
@@ -88,6 +88,7 @@ const FormOrganizationCampaignLink = ({
88
88
  const UrlIcon = import_social2.icons[(_a = (0, import_social.matchSocial)(watch("url"))) == null ? void 0 : _a.platform] || import_link.default;
89
89
  const onSubmit = async ({
90
90
  asset,
91
+ descriptions,
91
92
  title,
92
93
  url
93
94
  }) => {
@@ -96,6 +97,7 @@ const FormOrganizationCampaignLink = ({
96
97
  const args = {
97
98
  body: {
98
99
  asset: (asset == null ? void 0 : asset.id) || null,
100
+ descriptions: descriptions || {},
99
101
  // derived fresh from the url every save so manual social
100
102
  // links gain icons and url edits keep the icon honest
101
103
  icon: ((_a2 = (0, import_social.matchSocial)(url)) == null ? void 0 : _a2.platform) || null,
@@ -199,9 +201,13 @@ const FormOrganizationCampaignLink = ({
199
201
  import_input_file.default,
200
202
  {
201
203
  ...{
204
+ // @story links/edit
205
+ // The image's own Description, saved with the link.
206
+ description: watch("descriptions.asset"),
202
207
  endpoint: "/organization/" + values.organization,
203
208
  organization,
204
209
  onChange,
210
+ onDescription: (text) => setValue("descriptions.asset", text, { shouldDirty: true }),
205
211
  type: "image",
206
212
  value: value || ""
207
213
  }
@@ -41,7 +41,7 @@ const FormOrganizationCampaignLink = ({
41
41
  values
42
42
  }) => {
43
43
  var _a;
44
- const { control, formState, handleSubmit, watch } = useForm({
44
+ const { control, formState, handleSubmit, setValue, watch } = useForm({
45
45
  resolver: resolver(
46
46
  yup.object({
47
47
  asset: yup.object().label("Asset").nullable(),
@@ -56,6 +56,7 @@ const FormOrganizationCampaignLink = ({
56
56
  const UrlIcon = icons[(_a = matchSocial(watch("url"))) == null ? void 0 : _a.platform] || LinkIcon;
57
57
  const onSubmit = async ({
58
58
  asset,
59
+ descriptions,
59
60
  title,
60
61
  url
61
62
  }) => {
@@ -64,6 +65,7 @@ const FormOrganizationCampaignLink = ({
64
65
  const args = {
65
66
  body: {
66
67
  asset: (asset == null ? void 0 : asset.id) || null,
68
+ descriptions: descriptions || {},
67
69
  // derived fresh from the url every save so manual social
68
70
  // links gain icons and url edits keep the icon honest
69
71
  icon: ((_a2 = matchSocial(url)) == null ? void 0 : _a2.platform) || null,
@@ -167,9 +169,13 @@ const FormOrganizationCampaignLink = ({
167
169
  InputFile,
168
170
  {
169
171
  ...{
172
+ // @story links/edit
173
+ // The image's own Description, saved with the link.
174
+ description: watch("descriptions.asset"),
170
175
  endpoint: "/organization/" + values.organization,
171
176
  organization,
172
177
  onChange,
178
+ onDescription: (text) => setValue("descriptions.asset", text, { shouldDirty: true }),
173
179
  type: "image",
174
180
  value: value || ""
175
181
  }