@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
@@ -28,12 +28,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
28
28
  var form_organization_campaign_exports = {};
29
29
  __export(form_organization_campaign_exports, {
30
30
  FormOrganizationCampaign: () => FormOrganizationCampaign,
31
- FormOrganizationCampaignDefaults: () => FormOrganizationCampaignDefaults,
31
+ FormOrganizationCampaignCopy: () => FormOrganizationCampaignCopy,
32
32
  FormOrganizationCampaignNotifications: () => FormOrganizationCampaignNotifications,
33
- FormOrganizationCampaignSettingsLimits: () => FormOrganizationCampaignSettingsLimits,
34
33
  FormOrganizationCampaignSettingsShop: () => FormOrganizationCampaignSettingsShop,
35
- FormOrganizationCampaignStatus: () => FormOrganizationCampaignStatus,
36
- FormOrganizationCampaignTitle: () => FormOrganizationCampaignTitle
34
+ FormOrganizationCampaignTitle: () => FormOrganizationCampaignTitle,
35
+ copyPlaceholder: () => copyPlaceholder
37
36
  });
38
37
  module.exports = __toCommonJS(form_organization_campaign_exports);
39
38
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -48,7 +47,6 @@ var import_form2 = __toESM(require("../shared/form"));
48
47
  var import_fieldset = __toESM(require("../shared/fieldset"));
49
48
  var import_input_group = __toESM(require("../input-group"));
50
49
  var import_input_text = __toESM(require("../input-text"));
51
- var import_input_number = __toESM(require("../input-number"));
52
50
  var import_input_combobox = __toESM(require("./input-combobox"));
53
51
  var import_input_textarea = __toESM(require("../input-textarea"));
54
52
  var import_input_resource = __toESM(require("./input-resource"));
@@ -64,7 +62,7 @@ const FormOrganizationCampaign = ({
64
62
  const queryClient = (0, import_react_query.useQueryClient)();
65
63
  const app = queryClient.getQueryData(["app"]);
66
64
  const schema = {
67
- ...import_input_fields.schemas.campaign({ typeEnum: app.enums.campaign.type.enum }),
65
+ ...import_input_fields.schemas.campaign(),
68
66
  brand: import_yup.default.object().label("Brand").nullable(),
69
67
  industry: (values == null ? void 0 : values.template) ? import_yup.default.string().label("Industry").oneOf([...app.enums.campaign.industry.enum, "", null]).nullable() : import_yup.default.string().label("Industry").oneOf(app.enums.campaign.industry.enum).required()
70
68
  };
@@ -72,26 +70,31 @@ const FormOrganizationCampaign = ({
72
70
  resolver: (0, import_yup.resolver)(
73
71
  import_yup.default.object(schema)
74
72
  ),
73
+ // @story campaigns/create
74
+ // Both switches start on.
75
75
  values: {
76
- type: "giveaway",
76
+ form: true,
77
+ giveaway: true,
77
78
  ...values
78
79
  }
79
80
  });
80
81
  const { control, handleSubmit, formState } = methods;
81
82
  const onSubmit = async ({
82
83
  brand,
84
+ form,
85
+ giveaway,
83
86
  industry,
84
- title,
85
- type
87
+ title
86
88
  }) => {
87
89
  try {
88
90
  const response = await (0, import_fetch.request)({
89
91
  body: {
90
92
  brand: (brand == null ? void 0 : brand.id) ?? null,
93
+ form,
94
+ giveaway,
91
95
  industry,
92
96
  template: (values == null ? void 0 : values.template) || null,
93
- title,
94
- type
97
+ title
95
98
  },
96
99
  endpoint: "/organization/" + values.organization + "/campaign",
97
100
  method: "POST"
@@ -212,227 +215,133 @@ const FormOrganizationCampaign = ({
212
215
  }
213
216
  ) });
214
217
  };
215
- const FormOrganizationCampaignDefaults = ({
218
+ const copyFields = {
219
+ active: ["Giveaway button text", "The entry button text while the giveaway is awarding entries."],
220
+ button: ["Default button text", "The entry button text while the form is open and no entries are being awarded."],
221
+ confirmation: ["Submission success text", "The message shown to a lead after they successfully submit an entry."],
222
+ inactive: ["Closed button text", "The entry button text while the form is not taking entries."],
223
+ order: ["Order confirmation text", "Shown when a buyer comes back from checkout."],
224
+ rejection: ["Already submitted text", 'The message shown to a lead who has already reached their submission limit. Defaults to "You have already submitted".'],
225
+ title: ["Panel title", 'The title of the panel after a submission. Defaults to "Entry submitted" while entries are being awarded, and "Submitted" otherwise.']
226
+ };
227
+ const copyPlaceholder = (key, awarding) => {
228
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
229
+ return key === "title" ? (_e = (_d = (_c = (_b = (_a = import_drawbridge_utils.constants) == null ? void 0 : _a.campaign) == null ? void 0 : _b.form) == null ? void 0 : _c.copy) == null ? void 0 : _d.title) == null ? void 0 : _e[awarding ? "awarding" : "open"] : (_i = (_h = (_g = (_f = import_drawbridge_utils.constants) == null ? void 0 : _f.campaign) == null ? void 0 : _g.form) == null ? void 0 : _h.copy) == null ? void 0 : _i[key];
230
+ };
231
+ const FormOrganizationCampaignCopy = ({
232
+ awarding,
216
233
  disabled,
234
+ onChange,
217
235
  onError,
236
+ onFocus,
218
237
  onSuccess,
238
+ sections = [],
219
239
  values
220
240
  }) => {
221
- const schema = {
222
- defaults: import_yup.default.object({
223
- active: import_yup.default.string().label("Active message").max(150).nullable(),
224
- inactive: import_yup.default.string().label("Inactive message").max(150).nullable(),
225
- confirmation: import_yup.default.string().label("Confirmation message").max(150).nullable(),
226
- purchase: import_yup.default.string().label("Purchase message").max(150).nullable(),
227
- rejection: import_yup.default.string().label("Rejection message").max(150).nullable()
228
- })
229
- };
241
+ const keys = sections.flatMap(([, list]) => list);
230
242
  const { control, handleSubmit, formState } = (0, import_form.useForm)({
231
243
  resolver: (0, import_yup.resolver)(
232
- import_yup.default.object(schema)
244
+ import_yup.default.object(
245
+ Object.fromEntries(keys.map((key) => [key, import_yup.default.string().label(copyFields[key][0]).max(150).nullable()]))
246
+ )
233
247
  ),
234
- values
248
+ values: Object.fromEntries(keys.map((key) => {
249
+ var _a, _b;
250
+ return [key, ((_b = (_a = values == null ? void 0 : values.form) == null ? void 0 : _a.copy) == null ? void 0 : _b[key]) || ""];
251
+ }))
235
252
  });
236
- const onSubmit = async ({
237
- defaults
238
- }) => {
253
+ const watched = (0, import_form.useWatch)({
254
+ control
255
+ });
256
+ const typed = JSON.stringify(keys.map((key) => watched == null ? void 0 : watched[key]));
257
+ (0, import_react.useEffect)(
258
+ () => {
259
+ onChange == null ? void 0 : onChange(Object.fromEntries(keys.map((key) => [key, watched == null ? void 0 : watched[key]])));
260
+ },
261
+ // eslint-disable-next-line react-hooks/exhaustive-deps
262
+ [typed]
263
+ );
264
+ const onSubmit = async (copy) => {
239
265
  try {
240
- const args = {
266
+ const response = await (0, import_fetch.request)({
241
267
  body: {
242
- defaults
268
+ form: {
269
+ copy: Object.fromEntries(keys.map((key) => [key, (copy == null ? void 0 : copy[key]) || null]))
270
+ }
243
271
  },
244
272
  endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.id),
245
273
  method: "PUT"
246
- };
247
- const response = await (0, import_fetch.request)(args);
274
+ });
248
275
  onSuccess(response);
249
276
  } catch (error) {
250
277
  onError(error);
251
278
  }
252
279
  };
280
+ const field = (key) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
281
+ import_form.Controller,
282
+ {
283
+ ...{
284
+ control,
285
+ name: key,
286
+ render: ({ field: { value, onChange: change } }) => {
287
+ var _a, _b;
288
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
289
+ import_input_group.default,
290
+ {
291
+ ...{
292
+ error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a[key]) == null ? void 0 : _b.message,
293
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
294
+ import_input_text.default,
295
+ {
296
+ ...{
297
+ onChange: change,
298
+ onFocus: () => onFocus == null ? void 0 : onFocus(key),
299
+ placeholder: copyPlaceholder(key, awarding),
300
+ value: value || ""
301
+ }
302
+ }
303
+ ),
304
+ label: copyFields[key][0],
305
+ message: copyFields[key][1]
306
+ }
307
+ }
308
+ );
309
+ }
310
+ }
311
+ },
312
+ key
313
+ );
253
314
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
254
315
  import_form2.default,
255
316
  {
256
317
  ...{
257
- className: "relative w-full space-y-8",
318
+ // Divided as the Page editor's form, Save under the last section.
319
+ className: "relative w-full divide-y divide-gray [&>*]:py-6 [&>*:first-child]:pt-0 [&>*:last-child]:pb-0",
258
320
  onSubmit: handleSubmit(onSubmit)
259
321
  },
260
322
  children: [
261
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
262
- import_fieldset.default,
323
+ sections.map(([title, list]) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
324
+ "section",
263
325
  {
264
326
  ...{
265
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
327
+ className: "space-y-6",
328
+ "data-guide": "section-" + title.toLowerCase()
266
329
  },
267
330
  children: [
331
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: title }),
268
332
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
269
- import_form.Controller,
270
- {
271
- ...{
272
- control,
273
- name: "defaults.active",
274
- render: ({ field: { value, onChange } }) => {
275
- var _a, _b, _c, _d, _e, _f;
276
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
277
- import_input_group.default,
278
- {
279
- ...{
280
- error: (_c = (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.defaults) == null ? void 0 : _b.active) == null ? void 0 : _c.message,
281
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
282
- import_input_text.default,
283
- {
284
- ...{
285
- onChange,
286
- placeholder: (_f = (_e = (_d = import_drawbridge_utils.constants) == null ? void 0 : _d.campaign) == null ? void 0 : _e.defaults) == null ? void 0 : _f.active,
287
- value: value || ""
288
- }
289
- }
290
- ),
291
- label: "Campaign active button text",
292
- message: "The call-to-action button text shown while the campaign is open and accepting entries."
293
- }
294
- }
295
- );
296
- }
297
- }
298
- }
299
- ),
300
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
301
- import_form.Controller,
302
- {
303
- ...{
304
- control,
305
- name: "defaults.inactive",
306
- render: ({ field: { value, onChange } }) => {
307
- var _a, _b, _c, _d, _e, _f;
308
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
309
- import_input_group.default,
310
- {
311
- ...{
312
- error: (_c = (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.defaults) == null ? void 0 : _b.inactive) == null ? void 0 : _c.message,
313
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
314
- import_input_text.default,
315
- {
316
- ...{
317
- onChange,
318
- placeholder: (_f = (_e = (_d = import_drawbridge_utils.constants) == null ? void 0 : _d.campaign) == null ? void 0 : _e.defaults) == null ? void 0 : _f.inactive,
319
- value: value || ""
320
- }
321
- }
322
- ),
323
- label: "Campaign inactive button text",
324
- message: "The call-to-action button text shown when the campaign is closed or not accepting entries."
325
- }
326
- }
327
- );
328
- }
329
- }
330
- }
331
- ),
332
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
333
- import_form.Controller,
334
- {
335
- ...{
336
- control,
337
- name: "defaults.confirmation",
338
- render: ({ field: { value, onChange } }) => {
339
- var _a, _b, _c, _d, _e, _f;
340
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
341
- import_input_group.default,
342
- {
343
- ...{
344
- error: (_c = (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.defaults) == null ? void 0 : _b.confirmation) == null ? void 0 : _c.message,
345
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
346
- import_input_text.default,
347
- {
348
- ...{
349
- onChange,
350
- placeholder: (_f = (_e = (_d = import_drawbridge_utils.constants) == null ? void 0 : _d.campaign) == null ? void 0 : _e.defaults) == null ? void 0 : _f.confirmation,
351
- value: value || ""
352
- }
353
- }
354
- ),
355
- label: "Submission success text",
356
- message: "The message shown to a lead after they successfully submit an entry."
357
- }
358
- }
359
- );
360
- }
361
- }
362
- }
363
- ),
364
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
365
- import_form.Controller,
366
- {
367
- ...{
368
- control,
369
- name: "defaults.purchase",
370
- render: ({ field: { value, onChange } }) => {
371
- var _a, _b, _c;
372
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
373
- import_input_group.default,
374
- {
375
- ...{
376
- error: (_c = (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.defaults) == null ? void 0 : _b.purchase) == null ? void 0 : _c.message,
377
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
378
- import_input_text.default,
379
- {
380
- ...{
381
- onChange,
382
- // Mirrors the fallback drawbridge-share renders when
383
- // defaults.purchase is unset (template-layout.js). The
384
- // sibling fields read theirs from the shared constants;
385
- // this one has no constant, so the copy lives in both
386
- // places and must be changed in both.
387
- placeholder: "Thank you for your purchase",
388
- value: value || ""
389
- }
390
- }
391
- ),
392
- label: "Purchase success text",
393
- message: "The message shown to a buyer after they complete a purchase."
394
- }
395
- }
396
- );
397
- }
398
- }
399
- }
400
- ),
401
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
402
- import_form.Controller,
333
+ import_fieldset.default,
403
334
  {
404
335
  ...{
405
- control,
406
- name: "defaults.rejection",
407
- render: ({ field: { value, onChange } }) => {
408
- var _a, _b, _c, _d, _e, _f;
409
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
410
- import_input_group.default,
411
- {
412
- ...{
413
- error: (_c = (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.defaults) == null ? void 0 : _b.rejection) == null ? void 0 : _c.message,
414
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
415
- import_input_text.default,
416
- {
417
- ...{
418
- onChange,
419
- placeholder: (_f = (_e = (_d = import_drawbridge_utils.constants) == null ? void 0 : _d.campaign) == null ? void 0 : _e.defaults) == null ? void 0 : _f.rejection,
420
- value: value || ""
421
- }
422
- }
423
- ),
424
- label: "Already submitted text",
425
- message: 'The message shown to a lead who has already reached their submission limit. Defaults to "You have already submitted".'
426
- }
427
- }
428
- );
429
- }
430
- }
336
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
337
+ },
338
+ children: list.map(field)
431
339
  }
432
340
  )
433
341
  ]
434
- }
435
- ),
342
+ },
343
+ title
344
+ )),
436
345
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
437
346
  import_fieldset.default,
438
347
  {
@@ -446,7 +355,7 @@ const FormOrganizationCampaignDefaults = ({
446
355
  loading: formState == null ? void 0 : formState.isSubmitting,
447
356
  type: "submit"
448
357
  },
449
- children: "Submit"
358
+ children: "Save"
450
359
  }
451
360
  )
452
361
  }
@@ -461,7 +370,7 @@ const FormOrganizationCampaignNotifications = ({
461
370
  onSuccess,
462
371
  values
463
372
  }) => {
464
- var _a;
373
+ var _a, _b;
465
374
  const notification = import_yup.default.object({
466
375
  subject: import_yup.default.string().label("Subject").required().max(150),
467
376
  message: import_yup.default.string().label("Message").required().max(2e3)
@@ -471,13 +380,12 @@ const FormOrganizationCampaignNotifications = ({
471
380
  draw: notification
472
381
  })
473
382
  };
474
- const draw = (_a = values == null ? void 0 : values.notifications) == null ? void 0 : _a.draw;
383
+ const draw = (_b = (_a = values == null ? void 0 : values.giveaway) == null ? void 0 : _a.notifications) == null ? void 0 : _b.draw;
475
384
  const drawMessage = (draw == null ? void 0 : draw.message) ?? "";
476
385
  const drawSubject = (draw == null ? void 0 : draw.subject) ?? "";
477
386
  const seeded = {
478
387
  ...values,
479
388
  notifications: {
480
- ...values == null ? void 0 : values.notifications,
481
389
  draw: {
482
390
  message: drawMessage,
483
391
  // THE SAVED SCORE, RE-TAGGED WITH THE COPY IT MEASURED.
@@ -527,7 +435,9 @@ const FormOrganizationCampaignNotifications = ({
527
435
  }
528
436
  const args = {
529
437
  body: {
530
- notifications
438
+ giveaway: {
439
+ notifications
440
+ }
531
441
  },
532
442
  endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.id),
533
443
  method: "PUT"
@@ -715,106 +625,6 @@ const FormOrganizationCampaignTitle = ({
715
625
  }
716
626
  );
717
627
  };
718
- const FormOrganizationCampaignStatus = ({
719
- disabled,
720
- onError,
721
- onSuccess,
722
- values
723
- }) => {
724
- const queryClient = (0, import_react_query.useQueryClient)();
725
- const app = queryClient.getQueryData(["app"]);
726
- const { control, handleSubmit, formState } = (0, import_form.useForm)({
727
- resolver: (0, import_yup.resolver)(
728
- import_yup.default.object({
729
- status: import_yup.default.string().label("Type").required().oneOf(app.enums.campaign.status.enum)
730
- })
731
- ),
732
- values
733
- });
734
- const onSubmit = async ({
735
- status
736
- }) => {
737
- try {
738
- const response = await (0, import_fetch.request)({
739
- body: {
740
- status
741
- },
742
- endpoint: "/organization/" + values.organization + "/campaign/" + values.id,
743
- method: "PUT"
744
- });
745
- onSuccess(response);
746
- } catch (error) {
747
- onError(error);
748
- }
749
- };
750
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
751
- import_form2.default,
752
- {
753
- ...{
754
- className: "relative w-full space-y-8",
755
- onSubmit: handleSubmit(onSubmit)
756
- },
757
- children: [
758
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
759
- import_fieldset.default,
760
- {
761
- ...{
762
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
763
- },
764
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
765
- import_form.Controller,
766
- {
767
- ...{
768
- control,
769
- name: "status",
770
- render: ({ field: { value, onChange } }) => {
771
- var _a, _b;
772
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
773
- import_input_group.default,
774
- {
775
- ...{
776
- error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.status) == null ? void 0 : _b.message,
777
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
778
- import_input_combobox.default,
779
- {
780
- ...{
781
- onChange,
782
- options: app.enums.campaign.status.options,
783
- value
784
- }
785
- }
786
- )
787
- }
788
- }
789
- );
790
- }
791
- }
792
- }
793
- )
794
- }
795
- ),
796
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
797
- import_fieldset.default,
798
- {
799
- ...{
800
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
801
- },
802
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
803
- import_button.default,
804
- {
805
- ...{
806
- loading: formState == null ? void 0 : formState.isSubmitting,
807
- type: "submit"
808
- },
809
- children: "Submit"
810
- }
811
- )
812
- }
813
- )
814
- ]
815
- }
816
- );
817
- };
818
628
  const FormOrganizationCampaignSettingsShop = ({
819
629
  values,
820
630
  disabled,
@@ -930,177 +740,12 @@ const FormOrganizationCampaignSettingsShop = ({
930
740
  }
931
741
  );
932
742
  };
933
- const FormOrganizationCampaignSettingsLimits = ({
934
- values,
935
- disabled,
936
- onError,
937
- onSuccess
938
- }) => {
939
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
940
- const { control, handleSubmit, formState } = (0, import_form.useForm)({
941
- defaultValues: values,
942
- resolver: (0, import_yup.resolver)(
943
- import_yup.default.object({
944
- settings: import_yup.default.object({
945
- submissionEntryLimit: import_yup.default.number().label("Limit").integer().required().min(1).max(50)
946
- })
947
- })
948
- )
949
- });
950
- const submissionEntryFilterMessage = (0, import_form.useWatch)({
951
- control,
952
- name: "settings.submissionEntryFilter"
953
- });
954
- const onSubmit = async ({
955
- settings
956
- }) => {
957
- try {
958
- const response = await (0, import_fetch.request)({
959
- body: {
960
- settings
961
- },
962
- endpoint: "/organization/" + values.organization + "/campaign/" + values.id,
963
- method: "PUT"
964
- });
965
- onSuccess(response);
966
- } catch (error) {
967
- onError(error);
968
- }
969
- };
970
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
971
- import_form2.default,
972
- {
973
- ...{
974
- className: "relative w-full space-y-8",
975
- onSubmit: handleSubmit(onSubmit)
976
- },
977
- children: [
978
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
979
- import_fieldset.default,
980
- {
981
- ...{
982
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
983
- },
984
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
985
- import_input_group.default,
986
- {
987
- ...{
988
- error: ((_c = (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.settings) == null ? void 0 : _b.submissionEntryLimit) == null ? void 0 : _c.message) || ((_g = (_f = (_e = (_d = formState == null ? void 0 : formState.errors) == null ? void 0 : _d.settings) == null ? void 0 : _e.submissionEntryLimit) == null ? void 0 : _f.number) == null ? void 0 : _g.message) || ((_j = (_i = (_h = formState == null ? void 0 : formState.errors) == null ? void 0 : _h.settings) == null ? void 0 : _i.submissionEntryFilter) == null ? void 0 : _j.message),
989
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
990
- "div",
991
- {
992
- ...{
993
- className: "flex flex-col md:flex-row items-center w-full gap-3"
994
- },
995
- children: [
996
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
997
- "div",
998
- {
999
- ...{
1000
- className: "grow-0 w-full md:w-1/2"
1001
- },
1002
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1003
- import_form.Controller,
1004
- {
1005
- ...{
1006
- control,
1007
- name: "settings.submissionEntryLimit",
1008
- render: ({ field: { value, onChange } }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1009
- import_input_number.default,
1010
- {
1011
- ...{
1012
- min: 1,
1013
- step: 1,
1014
- onChange,
1015
- value: value || ""
1016
- }
1017
- }
1018
- )
1019
- }
1020
- }
1021
- )
1022
- }
1023
- ),
1024
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1025
- "p",
1026
- {
1027
- ...{
1028
- className: "hidden md:block"
1029
- },
1030
- children: "/"
1031
- }
1032
- ),
1033
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1034
- import_form.Controller,
1035
- {
1036
- ...{
1037
- control,
1038
- name: "settings.submissionEntryFilter",
1039
- render: ({ field: { value, onChange } }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1040
- import_input_combobox.default,
1041
- {
1042
- ...{
1043
- onChange,
1044
- options: [
1045
- {
1046
- key: "Campaign",
1047
- value: "campaign"
1048
- },
1049
- {
1050
- key: "Day",
1051
- value: "day"
1052
- },
1053
- ...values.type !== "default" ? [{
1054
- key: "Range",
1055
- value: "range"
1056
- }] : []
1057
- ],
1058
- value: value || "campaign"
1059
- }
1060
- }
1061
- )
1062
- }
1063
- }
1064
- )
1065
- ]
1066
- }
1067
- ),
1068
- label: "Submission limit",
1069
- message: "The number of entries leads can submit per " + submissionEntryFilterMessage
1070
- }
1071
- }
1072
- )
1073
- }
1074
- ),
1075
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1076
- import_fieldset.default,
1077
- {
1078
- ...{
1079
- disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
1080
- },
1081
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1082
- import_button.default,
1083
- {
1084
- ...{
1085
- loading: formState == null ? void 0 : formState.isSubmitting,
1086
- type: "submit"
1087
- },
1088
- children: "Submit"
1089
- }
1090
- )
1091
- }
1092
- )
1093
- ]
1094
- }
1095
- );
1096
- };
1097
743
  // Annotate the CommonJS export names for ESM import in node:
1098
744
  0 && (module.exports = {
1099
745
  FormOrganizationCampaign,
1100
- FormOrganizationCampaignDefaults,
746
+ FormOrganizationCampaignCopy,
1101
747
  FormOrganizationCampaignNotifications,
1102
- FormOrganizationCampaignSettingsLimits,
1103
748
  FormOrganizationCampaignSettingsShop,
1104
- FormOrganizationCampaignStatus,
1105
- FormOrganizationCampaignTitle
749
+ FormOrganizationCampaignTitle,
750
+ copyPlaceholder
1106
751
  });