@drawbridge/components 0.1.48 → 0.1.49

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 (125) hide show
  1. package/dist/bridge/fields.js +0 -278
  2. package/dist/bridge/fields.mjs +1 -276
  3. package/dist/bridge/form-subdomain-shop-modal.js +274 -234
  4. package/dist/bridge/form-subdomain-shop-modal.mjs +275 -233
  5. package/dist/bridge/form-subdomain.js +0 -7
  6. package/dist/bridge/form-subdomain.mjs +2 -9
  7. package/dist/bridge/lib/age-gate.js +0 -12
  8. package/dist/bridge/lib/age-gate.mjs +0 -11
  9. package/dist/bridge/lib/checkout-kit.js +32 -2
  10. package/dist/bridge/lib/checkout-kit.mjs +32 -2
  11. package/dist/bridge/lib/entry.js +0 -3
  12. package/dist/bridge/lib/entry.mjs +0 -2
  13. package/dist/bridge/product-tile.js +6 -9
  14. package/dist/bridge/product-tile.mjs +6 -9
  15. package/dist/bridge/template-layout.js +122 -237
  16. package/dist/bridge/template-layout.mjs +122 -237
  17. package/dist/bridge/template-modal.js +73 -28
  18. package/dist/bridge/template-modal.mjs +74 -29
  19. package/dist/dashboard/buttons-subscription.js +1 -1
  20. package/dist/dashboard/buttons-subscription.mjs +1 -1
  21. package/dist/dashboard/campaign-form.js +2 -7
  22. package/dist/dashboard/campaign-form.mjs +2 -7
  23. package/dist/dashboard/card-order.js +4 -22
  24. package/dist/dashboard/card-order.mjs +4 -22
  25. package/dist/dashboard/document-blocks.js +17 -4
  26. package/dist/dashboard/document-blocks.mjs +17 -4
  27. package/dist/dashboard/form-admin-provider.js +17 -71
  28. package/dist/dashboard/form-admin-provider.mjs +17 -71
  29. package/dist/dashboard/form-file-upload.js +2 -3
  30. package/dist/dashboard/form-file-upload.mjs +3 -4
  31. package/dist/dashboard/form-organization-campaign-advertisements.js +6 -47
  32. package/dist/dashboard/form-organization-campaign-advertisements.mjs +6 -47
  33. package/dist/dashboard/form-organization-campaign-agreement.js +121 -83
  34. package/dist/dashboard/form-organization-campaign-agreement.mjs +121 -83
  35. package/dist/dashboard/form-organization-campaign.js +0 -82
  36. package/dist/dashboard/form-organization-campaign.mjs +0 -81
  37. package/dist/dashboard/form-organization-connection.js +6 -48
  38. package/dist/dashboard/form-organization-connection.mjs +7 -48
  39. package/dist/dashboard/form-organization-workflow.js +1 -72
  40. package/dist/dashboard/form-organization-workflow.mjs +1 -69
  41. package/dist/dashboard/form-otc.js +5 -4
  42. package/dist/dashboard/form-otc.mjs +5 -4
  43. package/dist/dashboard/form-stripe.js +5 -12
  44. package/dist/dashboard/form-stripe.mjs +5 -12
  45. package/dist/dashboard/input-fields.js +158 -11
  46. package/dist/dashboard/input-fields.mjs +158 -11
  47. package/dist/dashboard/input-file.js +4 -21
  48. package/dist/dashboard/input-file.mjs +4 -21
  49. package/dist/dashboard/lib/connection-controls.js +2 -5
  50. package/dist/dashboard/lib/connection-controls.mjs +1 -3
  51. package/dist/dashboard/lib/form-page.js +1 -1
  52. package/dist/dashboard/lib/form-page.mjs +1 -1
  53. package/dist/dashboard/lib/uppy.js +1 -10
  54. package/dist/dashboard/lib/uppy.mjs +2 -11
  55. package/dist/dashboard/order-sections.js +6 -456
  56. package/dist/dashboard/order-sections.mjs +7 -453
  57. package/dist/dashboard/provider-ui.js +7 -9
  58. package/dist/dashboard/provider-ui.mjs +7 -9
  59. package/dist/dashboard/template-ui.js +12 -4
  60. package/dist/dashboard/template-ui.mjs +12 -4
  61. package/dist/input-checkbox.js +10 -28
  62. package/dist/input-checkbox.mjs +10 -28
  63. package/dist/product.js +24 -96
  64. package/dist/product.mjs +25 -97
  65. package/dist/shared/lib/helpers.js +6 -54
  66. package/dist/shared/lib/helpers.mjs +8 -53
  67. package/package.json +4 -74
  68. package/types/bridge/fields.d.ts +2 -14
  69. package/types/bridge/form-subdomain-shop-modal.d.ts +3 -27
  70. package/types/bridge/lib/age-gate.d.ts +0 -5
  71. package/types/bridge/lib/checkout-kit.d.ts +10 -2
  72. package/types/bridge/lib/entry.d.ts +0 -3
  73. package/types/dashboard/card-order.d.ts +0 -6
  74. package/types/dashboard/document-blocks.d.ts +3 -2
  75. package/types/dashboard/form-admin-provider.d.ts +2 -9
  76. package/types/dashboard/form-file-upload.d.ts +1 -2
  77. package/types/dashboard/form-organization-campaign-advertisements.d.ts +0 -3
  78. package/types/dashboard/form-organization-campaign-agreement.d.ts +5 -2
  79. package/types/dashboard/form-organization-campaign.d.ts +0 -3
  80. package/types/dashboard/form-organization-connection.d.ts +0 -11
  81. package/types/dashboard/form-otc.d.ts +1 -5
  82. package/types/dashboard/form-stripe.d.ts +2 -3
  83. package/types/dashboard/input-file.d.ts +0 -2
  84. package/types/dashboard/order-sections.d.ts +1 -24
  85. package/types/input-checkbox.d.ts +0 -2
  86. package/types/shared/lib/helpers.d.ts +0 -4
  87. package/dist/bridge/cart-drawer.js +0 -152
  88. package/dist/bridge/cart-drawer.mjs +0 -123
  89. package/dist/bridge/form-subdomain-checkout.js +0 -687
  90. package/dist/bridge/form-subdomain-checkout.mjs +0 -665
  91. package/dist/bridge/lib/cart.js +0 -79
  92. package/dist/bridge/lib/cart.mjs +0 -48
  93. package/dist/dashboard/embed-stripe.js +0 -145
  94. package/dist/dashboard/embed-stripe.mjs +0 -116
  95. package/dist/dashboard/form-organization-campaign-field-birthday.js +0 -193
  96. package/dist/dashboard/form-organization-campaign-field-birthday.mjs +0 -164
  97. package/dist/dashboard/form-organization-campaign-field-rating.js +0 -246
  98. package/dist/dashboard/form-organization-campaign-field-rating.mjs +0 -217
  99. package/dist/dashboard/form-organization-product.js +0 -1461
  100. package/dist/dashboard/form-organization-product.mjs +0 -1425
  101. package/dist/dashboard/input-gallery.js +0 -201
  102. package/dist/dashboard/input-gallery.mjs +0 -172
  103. package/dist/dashboard/lib/products.js +0 -169
  104. package/dist/dashboard/lib/products.mjs +0 -135
  105. package/dist/dashboard/lib/settings-paths.js +0 -35
  106. package/dist/dashboard/lib/settings-paths.mjs +0 -11
  107. package/dist/dashboard/shipping-rates.js +0 -404
  108. package/dist/dashboard/shipping-rates.mjs +0 -371
  109. package/dist/dashboard/template-buyer.js +0 -301
  110. package/dist/dashboard/template-buyer.mjs +0 -267
  111. package/dist/shared/order-summary.js +0 -139
  112. package/dist/shared/order-summary.mjs +0 -110
  113. package/types/bridge/cart-drawer.d.ts +0 -31
  114. package/types/bridge/form-subdomain-checkout.d.ts +0 -20
  115. package/types/bridge/lib/cart.d.ts +0 -44
  116. package/types/dashboard/embed-stripe.d.ts +0 -25
  117. package/types/dashboard/form-organization-campaign-field-birthday.d.ts +0 -31
  118. package/types/dashboard/form-organization-campaign-field-rating.d.ts +0 -33
  119. package/types/dashboard/form-organization-product.d.ts +0 -24
  120. package/types/dashboard/input-gallery.d.ts +0 -14
  121. package/types/dashboard/lib/products.d.ts +0 -14
  122. package/types/dashboard/lib/settings-paths.d.ts +0 -5
  123. package/types/dashboard/shipping-rates.d.ts +0 -26
  124. package/types/dashboard/template-buyer.d.ts +0 -50
  125. package/types/shared/order-summary.d.ts +0 -19
@@ -1,7 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useEffect, useMemo, useState } from "react";
4
- import { useQueries } from "@tanstack/react-query";
5
4
  import { Controller, useForm } from "../shared/lib/form.mjs";
6
5
  import { request } from "@drawbridge/drawbridge-utils/fetch";
7
6
  import yup, { resolver } from "../shared/lib/yup.mjs";
@@ -13,18 +12,11 @@ import InputSwitch from "../shared/input-switch.mjs";
13
12
  import CardTask from "./card-task.mjs";
14
13
  import InputSecret from "./input-secret.mjs";
15
14
  import Button from "../shared/button.mjs";
16
- import { Editable } from "./form-organization-connection.mjs";
17
- import { nestPaths, readPath } from "./lib/settings-paths.mjs";
18
- const schemaFor = (field, enabled) => {
15
+ const schemaFor = (field) => {
19
16
  if (field.input === "switch") return yup.boolean().label(field.label);
20
17
  const rule = field.input === "email" ? yup.string().label(field.label).email() : yup.string().label(field.label);
21
- return enabled && field.required && !field.redact && !field.hook ? rule.required() : rule.nullable();
18
+ return field.required && !field.redact ? rule.when("enabled", { is: false, otherwise: (s) => s.required(), then: (s) => s.nullable() }) : rule.nullable();
22
19
  };
23
- const shape = (tree) => yup.object(
24
- Object.fromEntries(
25
- Object.entries(tree).map(([key, node]) => [key, yup.isSchema(node) ? node : shape(node)])
26
- )
27
- );
28
20
  const FormAdminProvider = ({
29
21
  onError,
30
22
  onSuccess,
@@ -37,37 +29,25 @@ const FormAdminProvider = ({
37
29
  // A row that has never been touched has no answer stored and is on, so
38
30
  // the box starts checked rather than empty.
39
31
  enabled: (values == null ? void 0 : values.enabled) !== false,
40
- ...nestPaths(
41
- fields.map((field) => [
42
- field.key,
43
- field.input === "switch" ? readPath(values == null ? void 0 : values.settings, field.key) === true : field.redact ? "" : readPath(values == null ? void 0 : values.settings, field.key) ?? ""
44
- ])
32
+ ...Object.fromEntries(
33
+ fields.map((field) => {
34
+ var _a, _b;
35
+ return [
36
+ field.key,
37
+ field.input === "switch" ? ((_a = values == null ? void 0 : values.settings) == null ? void 0 : _a[field.key]) === true : field.redact ? "" : ((_b = values == null ? void 0 : values.settings) == null ? void 0 : _b[field.key]) ?? ""
38
+ ];
39
+ })
45
40
  )
46
41
  }),
47
42
  [fields, values]
48
43
  );
49
44
  const schema = useMemo(
50
- () => yup.lazy((data) => shape({
45
+ () => yup.object({
51
46
  enabled: yup.boolean().label("Enabled"),
52
- ...nestPaths(fields.map((field) => [field.key, schemaFor(field, (data == null ? void 0 : data.enabled) !== false)]))
53
- })),
47
+ ...Object.fromEntries(fields.map((field) => [field.key, schemaFor(field)]))
48
+ }),
54
49
  [fields]
55
50
  );
56
- const hooked = useMemo(() => fields.filter((field) => field.hook), [fields]);
57
- const sourced = useQueries({
58
- queries: hooked.map((field) => ({
59
- enabled: Boolean(values == null ? void 0 : values.slug),
60
- queryFn: async () => {
61
- const { result } = await request({
62
- endpoint: "/admin/provider/" + (values == null ? void 0 : values.slug) + "/hook/" + field.hook,
63
- params: { limit: 100 }
64
- });
65
- return ((result == null ? void 0 : result.items) || []).map((item) => ({ label: item.title, value: item.id }));
66
- },
67
- queryKey: ["admin-provider-hook", values == null ? void 0 : values.slug, field.hook, values == null ? void 0 : values.settings]
68
- }))
69
- });
70
- const optionsFor = Object.fromEntries(hooked.map((field, index) => [field.key, sourced[index]]));
71
51
  const [clearing, setClearing] = useState([]);
72
52
  useEffect(() => setClearing([]), [values == null ? void 0 : values.slug]);
73
53
  const { control, formState, handleSubmit } = useForm({
@@ -92,20 +72,10 @@ const FormAdminProvider = ({
92
72
  // admin then TYPED INTO is a replacement, not a removal. The api
93
73
  // applies `clear` after `settings`, so naming a key that also
94
74
  // carries a value deleted the value just typed and answered "Saved".
95
- //
96
- // `clear` stays a list of dotted keys; `settings` goes nested,
97
- // the shape the api stores.
98
- //
99
- // A PICKER EMPTIED IS A REMOVAL TOO. Its trash empties the value,
100
- // and blank would keep the saved one, so a picker that held a
101
- // saved value and is empty now is named here as well.
102
- clear: [
103
- ...clearing.filter((key) => !readPath(data, key)),
104
- ...fields.filter((field) => field.hook && !readPath(data, field.key) && readPath(values == null ? void 0 : values.settings, field.key)).map((field) => field.key)
105
- ],
75
+ clear: clearing.filter((key) => !(data == null ? void 0 : data[key])),
106
76
  enabled: Boolean(data == null ? void 0 : data.enabled),
107
- settings: nestPaths(
108
- fields.map((field) => [field.key, readPath(data, field.key) ?? ""])
77
+ settings: Object.fromEntries(
78
+ fields.map((field) => [field.key, (data == null ? void 0 : data[field.key]) ?? ""])
109
79
  )
110
80
  },
111
81
  endpoint: "/admin/provider/" + (values == null ? void 0 : values.slug),
@@ -231,35 +201,11 @@ const FormAdminProvider = ({
231
201
  value
232
202
  }
233
203
  }
234
- ) : field.input === "select" ? /* @__PURE__ */ jsx(
235
- InputGroup,
236
- {
237
- ...{
238
- error: (_a = readPath(formState == null ? void 0 : formState.errors, field.key)) == null ? void 0 : _a.message,
239
- input: /* @__PURE__ */ jsx(
240
- Editable,
241
- {
242
- ...{
243
- endpoint: "/admin/provider/" + (values == null ? void 0 : values.slug) + "/hook/" + field.hook,
244
- field,
245
- onChange,
246
- titleFor: (id) => {
247
- var _a2, _b2, _c;
248
- return ((_c = (_b2 = (_a2 = optionsFor[field.key]) == null ? void 0 : _a2.data) == null ? void 0 : _b2.find((option) => option.value === id)) == null ? void 0 : _c.label) || id;
249
- },
250
- value
251
- }
252
- }
253
- ),
254
- label: field.label,
255
- message: field.message
256
- }
257
- }
258
204
  ) : /* @__PURE__ */ jsx(
259
205
  InputGroup,
260
206
  {
261
207
  ...{
262
- error: (_b = readPath(formState == null ? void 0 : formState.errors, field.key)) == null ? void 0 : _b.message,
208
+ error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a[field.key]) == null ? void 0 : _b.message,
263
209
  input: /* @__PURE__ */ jsx(
264
210
  InputText,
265
211
  {
@@ -62,8 +62,7 @@ const FormFileUpload = ({
62
62
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
63
63
  const queryClient = (0, import_react_query.useQueryClient)();
64
64
  const app = queryClient.getQueryData(["app"]);
65
- const digital = type === "digital";
66
- const sizeLimits = digital ? import_helpers.digitalSizeLimits : maximumUploadBytes ? { ...import_helpers.fileSizeLimits, video: maximumUploadBytes / import_drawbridge_utils.megabyte } : import_helpers.fileSizeLimits;
65
+ const sizeLimits = maximumUploadBytes ? { ...import_helpers.fileSizeLimits, video: maximumUploadBytes / import_drawbridge_utils.megabyte } : import_helpers.fileSizeLimits;
67
66
  const uploaderRef = (0, import_react.useRef)(null);
68
67
  const successRef = (0, import_react.useRef)(onSuccess);
69
68
  const realRef = (0, import_react.useRef)(0);
@@ -263,7 +262,7 @@ const FormFileUpload = ({
263
262
  type: type2
264
263
  }
265
264
  }) => {
266
- if (digital || (data == null ? void 0 : data.size) >= multipartBytes) {
265
+ if ((data == null ? void 0 : data.size) >= multipartBytes) {
267
266
  return await onMultipart({
268
267
  data
269
268
  });
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
3
3
  import { bytesToGB, bytesToMB, formatNumber, gigabyte, megabyte } from "@drawbridge/drawbridge-utils";
4
4
  import { upload } from "@drawbridge/drawbridge-utils/fetch";
5
5
  import { useForm, Controller } from "../shared/lib/form.mjs";
6
- import { digitalSizeLimits, fileParts, fileSizeLimits, fileSizes, fileTypes } from "../shared/lib/helpers.mjs";
6
+ import { fileParts, fileSizeLimits, fileSizes, fileTypes } from "../shared/lib/helpers.mjs";
7
7
  import { getUploader, releaseUploader } from "./lib/uppy.mjs";
8
8
  import { trickle } from "./lib/trickle.mjs";
9
9
  import { useQueryClient } from "@tanstack/react-query";
@@ -30,8 +30,7 @@ const FormFileUpload = ({
30
30
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
31
31
  const queryClient = useQueryClient();
32
32
  const app = queryClient.getQueryData(["app"]);
33
- const digital = type === "digital";
34
- const sizeLimits = digital ? digitalSizeLimits : maximumUploadBytes ? { ...fileSizeLimits, video: maximumUploadBytes / megabyte } : fileSizeLimits;
33
+ const sizeLimits = maximumUploadBytes ? { ...fileSizeLimits, video: maximumUploadBytes / megabyte } : fileSizeLimits;
35
34
  const uploaderRef = useRef(null);
36
35
  const successRef = useRef(onSuccess);
37
36
  const realRef = useRef(0);
@@ -231,7 +230,7 @@ const FormFileUpload = ({
231
230
  type: type2
232
231
  }
233
232
  }) => {
234
- if (digital || (data == null ? void 0 : data.size) >= multipartBytes) {
233
+ if ((data == null ? void 0 : data.size) >= multipartBytes) {
235
234
  return await onMultipart({
236
235
  data
237
236
  });
@@ -35,7 +35,6 @@ var import_jsx_runtime = require("react/jsx-runtime");
35
35
  var import_react = require("react");
36
36
  var import_react_query = require("@tanstack/react-query");
37
37
  var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
38
- var import_products = require("@drawbridge/drawbridge-utils/products");
39
38
  var import_helpers = require("../shared/lib/helpers");
40
39
  var import_form_page = require("./lib/form-page");
41
40
  var import_form_organization_campaign_advertisement = __toESM(require("./form-organization-campaign-advertisement"));
@@ -53,7 +52,6 @@ var import_arrow_left = __toESM(require("../icons/arrow-left"));
53
52
  var import_loader = __toESM(require("../icons/loader"));
54
53
  var import_plus_small = __toESM(require("../icons/plus-small"));
55
54
  const FormOrganizationCampaignAdvertisements = ({
56
- checkout,
57
55
  commerce,
58
56
  disabled,
59
57
  onError,
@@ -77,7 +75,6 @@ const FormOrganizationCampaignAdvertisements = ({
77
75
  }),
78
76
  queryKey: (0, import_form_page.advertisementsKey)(params)
79
77
  });
80
- const made = import_products.PRODUCT_PROVIDER[checkout] === "drawbridge";
81
78
  const ads = (Array.isArray(data == null ? void 0 : data.result) ? data.result : (_a = data == null ? void 0 : data.result) == null ? void 0 : _a.items) || [];
82
79
  const full = ads.length >= import_form_page.MAX_ADS;
83
80
  const back = () => setView("list");
@@ -191,7 +188,7 @@ const FormOrganizationCampaignAdvertisements = ({
191
188
  ...{
192
189
  list: [
193
190
  { title: "Details" },
194
- { title: made ? "Products" : (commerce == null ? void 0 : commerce.title) || "Store" }
191
+ { title: (commerce == null ? void 0 : commerce.title) || "Store" }
195
192
  ],
196
193
  panels: [
197
194
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -217,12 +214,9 @@ const FormOrganizationCampaignAdvertisements = ({
217
214
  import_list_resource.default,
218
215
  {
219
216
  ...{
220
- endpoint: made ? "/organization/" + (params == null ? void 0 : params.organization) + "/products" : "/organization/" + (params == null ? void 0 : params.organization) + "/connection/" + ((commerce == null ? void 0 : commerce.slug) || "shopify") + "/hook/browse.products",
217
+ endpoint: "/organization/" + (params == null ? void 0 : params.organization) + "/connection/" + ((commerce == null ? void 0 : commerce.slug) || "shopify") + "/hook/browse.products",
221
218
  model: "product",
222
219
  params: {
223
- ...made && {
224
- provider: import_products.PRODUCT_PROVIDER[checkout]
225
- },
226
220
  sort: {
227
221
  createdAt: -1
228
222
  }
@@ -242,21 +236,20 @@ const FormOrganizationCampaignAdvertisements = ({
242
236
  }
243
237
  },
244
238
  render: (product) => {
245
- var _a2, _b, _c;
239
+ var _a2;
246
240
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
247
241
  import_card_product.default,
248
242
  {
249
243
  ...{
250
- image: made ? ((_b = (_a2 = (0, import_helpers.productAsset)(product)) == null ? void 0 : _a2.sizes) == null ? void 0 : _b["100x100"]) || null : ((_c = product.featuredImage) == null ? void 0 : _c.url) || null,
251
- title: product.title,
252
- updatedAt: product.updatedAt
244
+ image: ((_a2 = product.featuredImage) == null ? void 0 : _a2.url) || null,
245
+ title: product.title
253
246
  }
254
247
  }
255
248
  );
256
249
  },
257
250
  renderButton: ({ button, item }) => {
258
251
  var _a2, _b;
259
- return (made ? (item.variants || []).some(import_products.available) : (_b = (_a2 = item.variants) == null ? void 0 : _a2.edges) == null ? void 0 : _b.some((edge) => edge.node.availableForSale)) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
252
+ return ((_b = (_a2 = item.variants) == null ? void 0 : _a2.edges) == null ? void 0 : _b.some((edge) => edge.node.availableForSale)) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
260
253
  import_button.default,
261
254
  {
262
255
  ...button.props,
@@ -325,40 +318,6 @@ const FormOrganizationCampaignAdvertisements = ({
325
318
  onSort: reorder,
326
319
  renderItem: (ad, _index, handle) => {
327
320
  const badge = (0, import_helpers.statusBadge)("advertisement", ad.status);
328
- if (ad.locked) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
329
- import_card_shortcut.default,
330
- {
331
- ...{
332
- badge: badge && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
333
- import_badge.default,
334
- {
335
- ...{
336
- size: "small",
337
- type: badge.type
338
- },
339
- children: badge.text
340
- }
341
- ),
342
- controls: !disabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
343
- import_button.default,
344
- {
345
- ...{
346
- onClick: () => setView({
347
- remove: ad.id
348
- }),
349
- size: "small",
350
- variant: "error"
351
- },
352
- children: "Delete"
353
- }
354
- ),
355
- description: "Product no longer sold here",
356
- handle,
357
- image: ad.file || (0, import_helpers.productAsset)(ad.product),
358
- title: ad.title || "Untitled advertisement"
359
- }
360
- }
361
- );
362
321
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
363
322
  import_card_shortcut.default,
364
323
  {
@@ -3,7 +3,6 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
4
  import { useQuery, useQueryClient } from "@tanstack/react-query";
5
5
  import { request } from "@drawbridge/drawbridge-utils/fetch";
6
- import { available, PRODUCT_PROVIDER } from "@drawbridge/drawbridge-utils/products";
7
6
  import { productAsset, statusBadge } from "../shared/lib/helpers.mjs";
8
7
  import { adsLimit, advertisementsKey, MAX_ADS } from "./lib/form-page.mjs";
9
8
  import FormOrganizationCampaignAdvertisement from "./form-organization-campaign-advertisement.mjs";
@@ -21,7 +20,6 @@ import ArrowLeft from "../icons/arrow-left.mjs";
21
20
  import Loader from "../icons/loader.mjs";
22
21
  import PlusSmall from "../icons/plus-small.mjs";
23
22
  const FormOrganizationCampaignAdvertisements = ({
24
- checkout,
25
23
  commerce,
26
24
  disabled,
27
25
  onError,
@@ -45,7 +43,6 @@ const FormOrganizationCampaignAdvertisements = ({
45
43
  }),
46
44
  queryKey: advertisementsKey(params)
47
45
  });
48
- const made = PRODUCT_PROVIDER[checkout] === "drawbridge";
49
46
  const ads = (Array.isArray(data == null ? void 0 : data.result) ? data.result : (_a = data == null ? void 0 : data.result) == null ? void 0 : _a.items) || [];
50
47
  const full = ads.length >= MAX_ADS;
51
48
  const back = () => setView("list");
@@ -159,7 +156,7 @@ const FormOrganizationCampaignAdvertisements = ({
159
156
  ...{
160
157
  list: [
161
158
  { title: "Details" },
162
- { title: made ? "Products" : (commerce == null ? void 0 : commerce.title) || "Store" }
159
+ { title: (commerce == null ? void 0 : commerce.title) || "Store" }
163
160
  ],
164
161
  panels: [
165
162
  /* @__PURE__ */ jsx(
@@ -185,12 +182,9 @@ const FormOrganizationCampaignAdvertisements = ({
185
182
  ListResource,
186
183
  {
187
184
  ...{
188
- endpoint: made ? "/organization/" + (params == null ? void 0 : params.organization) + "/products" : "/organization/" + (params == null ? void 0 : params.organization) + "/connection/" + ((commerce == null ? void 0 : commerce.slug) || "shopify") + "/hook/browse.products",
185
+ endpoint: "/organization/" + (params == null ? void 0 : params.organization) + "/connection/" + ((commerce == null ? void 0 : commerce.slug) || "shopify") + "/hook/browse.products",
189
186
  model: "product",
190
187
  params: {
191
- ...made && {
192
- provider: PRODUCT_PROVIDER[checkout]
193
- },
194
188
  sort: {
195
189
  createdAt: -1
196
190
  }
@@ -210,21 +204,20 @@ const FormOrganizationCampaignAdvertisements = ({
210
204
  }
211
205
  },
212
206
  render: (product) => {
213
- var _a2, _b, _c;
207
+ var _a2;
214
208
  return /* @__PURE__ */ jsx(
215
209
  CardProduct,
216
210
  {
217
211
  ...{
218
- image: made ? ((_b = (_a2 = productAsset(product)) == null ? void 0 : _a2.sizes) == null ? void 0 : _b["100x100"]) || null : ((_c = product.featuredImage) == null ? void 0 : _c.url) || null,
219
- title: product.title,
220
- updatedAt: product.updatedAt
212
+ image: ((_a2 = product.featuredImage) == null ? void 0 : _a2.url) || null,
213
+ title: product.title
221
214
  }
222
215
  }
223
216
  );
224
217
  },
225
218
  renderButton: ({ button, item }) => {
226
219
  var _a2, _b;
227
- return (made ? (item.variants || []).some(available) : (_b = (_a2 = item.variants) == null ? void 0 : _a2.edges) == null ? void 0 : _b.some((edge) => edge.node.availableForSale)) ? /* @__PURE__ */ jsx(
220
+ return ((_b = (_a2 = item.variants) == null ? void 0 : _a2.edges) == null ? void 0 : _b.some((edge) => edge.node.availableForSale)) ? /* @__PURE__ */ jsx(
228
221
  Button,
229
222
  {
230
223
  ...button.props,
@@ -293,40 +286,6 @@ const FormOrganizationCampaignAdvertisements = ({
293
286
  onSort: reorder,
294
287
  renderItem: (ad, _index, handle) => {
295
288
  const badge = statusBadge("advertisement", ad.status);
296
- if (ad.locked) return /* @__PURE__ */ jsx(
297
- CardShortcut,
298
- {
299
- ...{
300
- badge: badge && /* @__PURE__ */ jsx(
301
- Badge,
302
- {
303
- ...{
304
- size: "small",
305
- type: badge.type
306
- },
307
- children: badge.text
308
- }
309
- ),
310
- controls: !disabled && /* @__PURE__ */ jsx(
311
- Button,
312
- {
313
- ...{
314
- onClick: () => setView({
315
- remove: ad.id
316
- }),
317
- size: "small",
318
- variant: "error"
319
- },
320
- children: "Delete"
321
- }
322
- ),
323
- description: "Product no longer sold here",
324
- handle,
325
- image: ad.file || productAsset(ad.product),
326
- title: ad.title || "Untitled advertisement"
327
- }
328
- }
329
- );
330
289
  return /* @__PURE__ */ jsx(
331
290
  CardShortcut,
332
291
  {