@open-mercato/core 0.10.1-develop.7922.1.417ebe275c → 0.10.1-develop.7923.1.35033d071b

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.
@@ -1,4 +1,4 @@
1
- [build:core] found 6265 entry points
1
+ [build:core] found 6266 entry points
2
2
  [build:core] built successfully
3
3
  [build:core:generated] found 271 entry points
4
4
  [build:core:generated] built successfully
@@ -194,6 +194,10 @@ function CreateCatalogProductPage() {
194
194
  return readInboxProductDraft();
195
195
  }, [fromInboxAction]);
196
196
  const initialValuesRef = React.useRef(null);
197
+ const mediaUploadingRef = React.useRef(false);
198
+ const handleMediaUploadingChange = React.useCallback((isUploading) => {
199
+ mediaUploadingRef.current = isUploading;
200
+ }, []);
197
201
  if (!initialValuesRef.current) {
198
202
  const initial = createInitialProductFormValues();
199
203
  if (inboxDraft?.payload) {
@@ -280,7 +284,8 @@ function CreateCatalogProductPage() {
280
284
  errors,
281
285
  priceKinds,
282
286
  taxRates,
283
- requiredFieldIds
287
+ requiredFieldIds,
288
+ onMediaUploadingChange: handleMediaUploadingChange
284
289
  }
285
290
  )
286
291
  },
@@ -307,7 +312,7 @@ function CreateCatalogProductPage() {
307
312
  )
308
313
  }
309
314
  ],
310
- [priceKinds, taxRates, t]
315
+ [handleMediaUploadingChange, priceKinds, taxRates, t]
311
316
  );
312
317
  return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsx(PageBody, { children: /* @__PURE__ */ jsx(
313
318
  CrudForm,
@@ -324,6 +329,11 @@ function CreateCatalogProductPage() {
324
329
  submitLabel: t("catalog.products.create.submit", "Create"),
325
330
  cancelHref: "/backend/catalog/products",
326
331
  onSubmit: async (formValues) => {
332
+ if (mediaUploadingRef.current) {
333
+ throw createCrudFormError(
334
+ t("catalog.products.media.uploading", "Uploading\u2026")
335
+ );
336
+ }
327
337
  const title = formValues.title?.trim();
328
338
  if (!title) {
329
339
  throw createCrudFormError(
@@ -840,7 +850,8 @@ function ProductBuilder({
840
850
  errors,
841
851
  priceKinds,
842
852
  taxRates,
843
- requiredFieldIds
853
+ requiredFieldIds,
854
+ onMediaUploadingChange
844
855
  }) {
845
856
  const t = useT();
846
857
  const steps = PRODUCT_FORM_STEPS;
@@ -1218,7 +1229,8 @@ function ProductBuilder({
1218
1229
  items: mediaItems,
1219
1230
  defaultMediaId: values.defaultMediaId ?? null,
1220
1231
  onItemsChange: handleMediaItemsChange,
1221
- onDefaultChange: handleDefaultMediaChange
1232
+ onDefaultChange: handleDefaultMediaChange,
1233
+ onUploadingChange: onMediaUploadingChange
1222
1234
  }
1223
1235
  ),
1224
1236
  /* @__PURE__ */ jsx(