@atomsolution/sdk-merchant 1.8.4 → 1.8.6
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.
- package/dist/assets/locales/en/file.json.d.ts +2 -0
- package/dist/assets/locales/vi/file.json.d.ts +2 -0
- package/dist/batch-product-creation/components/merchant-batch-create-form/product-info-preview/index.d.ts +1 -1
- package/dist/batch-product-creation.cjs +81 -74
- package/dist/batch-product-creation.cjs.map +1 -1
- package/dist/batch-product-creation.esm.js +81 -74
- package/dist/batch-product-creation.esm.js.map +1 -1
- package/dist/batch-product-creation.js +81 -74
- package/dist/batch-product-creation.js.map +1 -1
- package/dist/components/common/dataTable/tableHeader.d.ts +1 -1
- package/dist/digistore.cjs +1 -1
- package/dist/digistore.esm.js +1 -1
- package/dist/digistore.js +1 -1
- package/dist/{dropdownMenuAbsolute-djdsnyTz.cjs → dropdownMenuAbsolute-BYTyDl09.cjs} +4 -6
- package/dist/{dropdownMenuAbsolute-djdsnyTz.cjs.map → dropdownMenuAbsolute-BYTyDl09.cjs.map} +1 -1
- package/dist/{dropdownMenuAbsolute-BvDBLhd-.js → dropdownMenuAbsolute-CvvI2uRj.js} +4 -6
- package/dist/{dropdownMenuAbsolute-BvDBLhd-.js.map → dropdownMenuAbsolute-CvvI2uRj.js.map} +1 -1
- package/dist/merchant-profile.cjs +2 -2
- package/dist/merchant-profile.esm.js +2 -2
- package/dist/merchant-profile.js +2 -2
- package/dist/shared.cjs +1 -1
- package/dist/shared.esm.js +1 -1
- package/dist/shared.js +1 -1
- package/dist/{use-external-config.store-CAZvrNUF.js → use-external-config.store-CaaNmLce.js} +2 -2
- package/dist/{use-external-config.store-CAZvrNUF.js.map → use-external-config.store-CaaNmLce.js.map} +1 -1
- package/dist/{use-external-config.store-D2beE35F.cjs → use-external-config.store-WVwivWvK.cjs} +2 -2
- package/dist/{use-external-config.store-D2beE35F.cjs.map → use-external-config.store-WVwivWvK.cjs.map} +1 -1
- package/dist/{use-translation-DFiePp2h.js → use-translation-CPJMFAae.js} +10 -2
- package/dist/{use-translation-DFiePp2h.js.map → use-translation-CPJMFAae.js.map} +1 -1
- package/dist/{use-translation-CD6xknr3.cjs → use-translation-m-_wCmHs.cjs} +10 -2
- package/dist/{use-translation-CD6xknr3.cjs.map → use-translation-m-_wCmHs.cjs.map} +1 -1
- package/dist/utils/translations.d.ts +4 -0
- package/package.json +1 -1
|
@@ -68,14 +68,14 @@ var __asyncGenerator = (__this, __arguments, generator) => {
|
|
|
68
68
|
};
|
|
69
69
|
var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
|
|
70
70
|
import { j as jsxRuntimeExports } from "./jsx-runtime-ClP9nxnW.js";
|
|
71
|
-
import { u as useTranslation, t as translate } from "./use-translation-
|
|
71
|
+
import { u as useTranslation, t as translate } from "./use-translation-CPJMFAae.js";
|
|
72
72
|
import { ToastContainer } from "react-toastify";
|
|
73
73
|
import { a as useUnsavedChangesStore, u as useWesapApiConfig } from "./use-wesap-api-config.store-CIaEkA7m.js";
|
|
74
74
|
import * as React from "react";
|
|
75
75
|
import React__default, { useState, useRef, useEffect, useMemo, forwardRef, useCallback } from "react";
|
|
76
76
|
import create from "zustand";
|
|
77
|
-
import { u as useExternalConfigStore } from "./use-external-config.store-
|
|
78
|
-
import { t as twMerge, B as Button, c as commonjsRequire, b as commonjsGlobal, g as getDefaultExportFromCjs, u as useMediaQuery, T as TableSkeleton, R as ReusableTable, a as DropdownMenuAbsolute } from "./dropdownMenuAbsolute-
|
|
77
|
+
import { u as useExternalConfigStore } from "./use-external-config.store-CaaNmLce.js";
|
|
78
|
+
import { t as twMerge, B as Button, c as commonjsRequire, b as commonjsGlobal, g as getDefaultExportFromCjs, u as useMediaQuery, T as TableSkeleton, R as ReusableTable, a as DropdownMenuAbsolute } from "./dropdownMenuAbsolute-CvvI2uRj.js";
|
|
79
79
|
import * as ReactDOM from "react-dom";
|
|
80
80
|
import ReactDOM__default from "react-dom";
|
|
81
81
|
import { C as CustomToast } from "./index-ChOpfqCh.js";
|
|
@@ -57642,36 +57642,40 @@ const UpdateProductModal = ({
|
|
|
57642
57642
|
onDeleteImage: handleDeleteImage
|
|
57643
57643
|
}
|
|
57644
57644
|
),
|
|
57645
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
57646
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
57647
|
-
|
|
57648
|
-
|
|
57649
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Label, { labelText: translate2("name"), required: true, children: [
|
|
57650
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ErrorMessage, { name: "name", errors }),
|
|
57651
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Input, __spreadValues({}, register("name")))
|
|
57652
|
-
] }),
|
|
57653
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full min-w-full font-normal", children: [
|
|
57654
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "mb-[4px] flex items-center gap-[4px] text-[14px] font-bold leading-[20px] text-gray-700", children: [
|
|
57655
|
-
translate2("unit"),
|
|
57656
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-red-500", children: "*" })
|
|
57645
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
57646
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Label, { labelText: translate2("name"), required: true, children: [
|
|
57647
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ErrorMessage, { name: "name", errors }),
|
|
57648
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Input, __spreadValues({}, register("name")))
|
|
57657
57649
|
] }),
|
|
57658
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
57659
|
-
|
|
57660
|
-
|
|
57661
|
-
|
|
57662
|
-
unitOptions,
|
|
57663
|
-
setUnitOptions,
|
|
57664
|
-
onSelectOption: (value) => {
|
|
57665
|
-
setValue("unit", value);
|
|
57666
|
-
clearErrors("unit");
|
|
57667
|
-
},
|
|
57668
|
-
defaultValue: product == null ? void 0 : product.unit
|
|
57669
|
-
}
|
|
57670
|
-
)
|
|
57650
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Label, { labelText: translate2("code"), required: true, children: [
|
|
57651
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ErrorMessage, { name: "code", errors }),
|
|
57652
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Input, __spreadValues({}, register("code")))
|
|
57653
|
+
] })
|
|
57671
57654
|
] }),
|
|
57672
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
57673
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
57674
|
-
|
|
57655
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
57656
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full min-w-full font-normal", children: [
|
|
57657
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "mb-[4px] flex items-center gap-[4px] text-[14px] font-bold leading-[20px] text-gray-700", children: [
|
|
57658
|
+
translate2("unit"),
|
|
57659
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-red-500", children: "*" })
|
|
57660
|
+
] }),
|
|
57661
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ErrorMessage, { name: "unit", errors }),
|
|
57662
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
57663
|
+
UnitSelect,
|
|
57664
|
+
{
|
|
57665
|
+
unitOptions,
|
|
57666
|
+
setUnitOptions,
|
|
57667
|
+
onSelectOption: (value) => {
|
|
57668
|
+
setValue("unit", value);
|
|
57669
|
+
clearErrors("unit");
|
|
57670
|
+
},
|
|
57671
|
+
defaultValue: product == null ? void 0 : product.unit
|
|
57672
|
+
}
|
|
57673
|
+
)
|
|
57674
|
+
] }),
|
|
57675
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Label, { labelText: translate2("category"), children: [
|
|
57676
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ErrorMessage, { name: "category", errors }),
|
|
57677
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CategoriesInput, { register, control, errors })
|
|
57678
|
+
] })
|
|
57675
57679
|
] }),
|
|
57676
57680
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Label, { labelText: translate2("price_vat"), required: true, children: [
|
|
57677
57681
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ErrorMessage, { name: "priceAfterTax", errors }),
|
|
@@ -57982,36 +57986,42 @@ const ProductPreviewTable = ({
|
|
|
57982
57986
|
});
|
|
57983
57987
|
}
|
|
57984
57988
|
useEffect(() => {
|
|
57985
|
-
|
|
57986
|
-
const resetProducts = productsTableData2.map((product) => __spreadProps(__spreadValues({}, product), {
|
|
57987
|
-
note: ""
|
|
57988
|
-
}));
|
|
57989
|
-
return resetProducts;
|
|
57990
|
-
};
|
|
57991
|
-
const validate = () => __async(void 0, null, function* () {
|
|
57992
|
-
const resetErrorProducts = handleResetValidateMessages(productsTableData);
|
|
57993
|
-
yield handleValidateProductsExist(resetErrorProducts);
|
|
57994
|
-
const validated = resetErrorProducts.map((product) => {
|
|
57995
|
-
let errors = "";
|
|
57996
|
-
const schema = createProductPreviewSchema(translate2, taxDeductionMethod);
|
|
57997
|
-
const result = schema.safeParse(product);
|
|
57998
|
-
if (!result.success) {
|
|
57999
|
-
const fields = /* @__PURE__ */ new Set();
|
|
58000
|
-
const zErrors = result.error.issues.filter((error) => {
|
|
58001
|
-
if (fields.has(error.path[0])) return false;
|
|
58002
|
-
fields.add(error.path[0]);
|
|
58003
|
-
return true;
|
|
58004
|
-
}).map((error) => error.message).join("\n");
|
|
58005
|
-
errors = errors + zErrors;
|
|
58006
|
-
}
|
|
58007
|
-
product.note = product.note + errors;
|
|
58008
|
-
return product;
|
|
58009
|
-
});
|
|
58010
|
-
setValidatedProducts(validated);
|
|
57989
|
+
if (productsTableData.length === 0) {
|
|
58011
57990
|
setLoading(false);
|
|
57991
|
+
return;
|
|
57992
|
+
}
|
|
57993
|
+
let isMounted = true;
|
|
57994
|
+
const validate = () => __async(void 0, null, function* () {
|
|
57995
|
+
setLoading(true);
|
|
57996
|
+
const productsToValidate = productsTableData.map((p) => __spreadProps(__spreadValues({}, p), { note: "" }));
|
|
57997
|
+
try {
|
|
57998
|
+
yield handleValidateProductsExist(productsToValidate);
|
|
57999
|
+
if (!isMounted) return;
|
|
58000
|
+
const finalValidated = productsToValidate.map((product) => {
|
|
58001
|
+
var _a;
|
|
58002
|
+
let errors = "";
|
|
58003
|
+
const schema = createProductPreviewSchema(translate2, taxDeductionMethod);
|
|
58004
|
+
const result = schema.safeParse(product);
|
|
58005
|
+
if (!result.success) {
|
|
58006
|
+
errors = ((_a = result.error.issues[0]) == null ? void 0 : _a.message) || "";
|
|
58007
|
+
}
|
|
58008
|
+
return __spreadProps(__spreadValues({}, product), { note: product.note + errors });
|
|
58009
|
+
});
|
|
58010
|
+
setValidatedProducts(finalValidated);
|
|
58011
|
+
} catch (err) {
|
|
58012
|
+
console.error(err);
|
|
58013
|
+
} finally {
|
|
58014
|
+
if (isMounted) setLoading(false);
|
|
58015
|
+
}
|
|
58012
58016
|
});
|
|
58013
|
-
|
|
58014
|
-
|
|
58017
|
+
const timeoutId = setTimeout(() => {
|
|
58018
|
+
validate();
|
|
58019
|
+
}, 500);
|
|
58020
|
+
return () => {
|
|
58021
|
+
isMounted = false;
|
|
58022
|
+
clearTimeout(timeoutId);
|
|
58023
|
+
};
|
|
58024
|
+
}, [productsTableData, taxDeductionMethod]);
|
|
58015
58025
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-auto", children: [
|
|
58016
58026
|
loading ? /* @__PURE__ */ jsxRuntimeExports.jsx(TableSkeleton, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
58017
58027
|
ReusableTable,
|
|
@@ -58049,7 +58059,9 @@ const ProductInfoPreview = ({ taxDeductionMethod }) => {
|
|
|
58049
58059
|
const [showCreateProductConfirmModal, setShowCreateProductConfirmModal] = useState(false);
|
|
58050
58060
|
const [showCreateSuccessModal, setShowSuccessModal] = useState(false);
|
|
58051
58061
|
const [checkedProducts, setCheckedProducts] = useState([]);
|
|
58052
|
-
const [createdProductsResult, setCreatedProductsResult] = useState(
|
|
58062
|
+
const [createdProductsResult, setCreatedProductsResult] = useState(
|
|
58063
|
+
null
|
|
58064
|
+
);
|
|
58053
58065
|
const { sheetMappingData, selectedSheet, uploadedFile, reset } = useUploadStore();
|
|
58054
58066
|
const filterRow = sheetMappingData.filter((row) => {
|
|
58055
58067
|
return row.code || row.name || row.priceAfterTax || row.unit || row.category;
|
|
@@ -58079,8 +58091,7 @@ const ProductInfoPreview = ({ taxDeductionMethod }) => {
|
|
|
58079
58091
|
translate2("upload_information_description2"),
|
|
58080
58092
|
" ",
|
|
58081
58093
|
/* @__PURE__ */ jsxRuntimeExports.jsx("strong", { className: "text-[#1E2A7B]", children: uploadedFile == null ? void 0 : uploadedFile.name }),
|
|
58082
|
-
",",
|
|
58083
|
-
" ",
|
|
58094
|
+
", ",
|
|
58084
58095
|
translate2("sheet"),
|
|
58085
58096
|
" ",
|
|
58086
58097
|
/* @__PURE__ */ jsxRuntimeExports.jsx("strong", { className: "text-[#1E2A7B]", children: selectedSheet })
|
|
@@ -58107,7 +58118,7 @@ const ProductInfoPreview = ({ taxDeductionMethod }) => {
|
|
|
58107
58118
|
setCreatedProductsResult(data);
|
|
58108
58119
|
setShowSuccessModal(true);
|
|
58109
58120
|
},
|
|
58110
|
-
numCheckedProducts: `${checkedProducts.length}/${
|
|
58121
|
+
numCheckedProducts: `${checkedProducts.length}/${filterRow.length}`,
|
|
58111
58122
|
checkedProducts,
|
|
58112
58123
|
taxDeductionMethod
|
|
58113
58124
|
}
|
|
@@ -58132,23 +58143,19 @@ function FileUploadTab({
|
|
|
58132
58143
|
const [isUploading, setIsUploading] = useState(false);
|
|
58133
58144
|
const { translate: translate2 } = useTranslation("file");
|
|
58134
58145
|
const formatSize = (size) => size < 1024 * 1024 ? `${(size / 1024).toFixed(1)} KB` : `${(size / (1024 * 1024)).toFixed(2)} MB`;
|
|
58135
|
-
if (isCheckData)
|
|
58136
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ProductInfoPreview, { taxDeductionMethod });
|
|
58146
|
+
if (isCheckData) return /* @__PURE__ */ jsxRuntimeExports.jsx(ProductInfoPreview, { taxDeductionMethod });
|
|
58137
58147
|
return !isMappingData ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-8", children: [
|
|
58138
58148
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
58139
58149
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-[#0E121B] font-bold text-[24px] leading-[30px]", children: translate2("title") }),
|
|
58140
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
58150
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "text-[#0E121B] text-[16px] leading-5 font-normal list-disc pl-5", children: uploadedFile ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
58151
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: translate2("instruction3") }),
|
|
58152
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: translate2("instruction4") })
|
|
58153
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
58141
58154
|
/* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: translate2("instruction1") }),
|
|
58142
58155
|
/* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: translate2("instruction2") })
|
|
58143
|
-
] })
|
|
58156
|
+
] }) })
|
|
58144
58157
|
] }),
|
|
58145
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
58146
|
-
FileUploadButton,
|
|
58147
|
-
{
|
|
58148
|
-
isUploading,
|
|
58149
|
-
setIsUploading
|
|
58150
|
-
}
|
|
58151
|
-
),
|
|
58158
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(FileUploadButton, { isUploading, setIsUploading }),
|
|
58152
58159
|
uploadedFile && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
58153
58160
|
"div",
|
|
58154
58161
|
{
|