@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.
Files changed (33) hide show
  1. package/dist/assets/locales/en/file.json.d.ts +2 -0
  2. package/dist/assets/locales/vi/file.json.d.ts +2 -0
  3. package/dist/batch-product-creation/components/merchant-batch-create-form/product-info-preview/index.d.ts +1 -1
  4. package/dist/batch-product-creation.cjs +81 -74
  5. package/dist/batch-product-creation.cjs.map +1 -1
  6. package/dist/batch-product-creation.esm.js +81 -74
  7. package/dist/batch-product-creation.esm.js.map +1 -1
  8. package/dist/batch-product-creation.js +81 -74
  9. package/dist/batch-product-creation.js.map +1 -1
  10. package/dist/components/common/dataTable/tableHeader.d.ts +1 -1
  11. package/dist/digistore.cjs +1 -1
  12. package/dist/digistore.esm.js +1 -1
  13. package/dist/digistore.js +1 -1
  14. package/dist/{dropdownMenuAbsolute-djdsnyTz.cjs → dropdownMenuAbsolute-BYTyDl09.cjs} +4 -6
  15. package/dist/{dropdownMenuAbsolute-djdsnyTz.cjs.map → dropdownMenuAbsolute-BYTyDl09.cjs.map} +1 -1
  16. package/dist/{dropdownMenuAbsolute-BvDBLhd-.js → dropdownMenuAbsolute-CvvI2uRj.js} +4 -6
  17. package/dist/{dropdownMenuAbsolute-BvDBLhd-.js.map → dropdownMenuAbsolute-CvvI2uRj.js.map} +1 -1
  18. package/dist/merchant-profile.cjs +2 -2
  19. package/dist/merchant-profile.esm.js +2 -2
  20. package/dist/merchant-profile.js +2 -2
  21. package/dist/shared.cjs +1 -1
  22. package/dist/shared.esm.js +1 -1
  23. package/dist/shared.js +1 -1
  24. package/dist/{use-external-config.store-CAZvrNUF.js → use-external-config.store-CaaNmLce.js} +2 -2
  25. package/dist/{use-external-config.store-CAZvrNUF.js.map → use-external-config.store-CaaNmLce.js.map} +1 -1
  26. package/dist/{use-external-config.store-D2beE35F.cjs → use-external-config.store-WVwivWvK.cjs} +2 -2
  27. package/dist/{use-external-config.store-D2beE35F.cjs.map → use-external-config.store-WVwivWvK.cjs.map} +1 -1
  28. package/dist/{use-translation-DFiePp2h.js → use-translation-CPJMFAae.js} +10 -2
  29. package/dist/{use-translation-DFiePp2h.js.map → use-translation-CPJMFAae.js.map} +1 -1
  30. package/dist/{use-translation-CD6xknr3.cjs → use-translation-m-_wCmHs.cjs} +10 -2
  31. package/dist/{use-translation-CD6xknr3.cjs.map → use-translation-m-_wCmHs.cjs.map} +1 -1
  32. package/dist/utils/translations.d.ts +4 -0
  33. package/package.json +1 -1
@@ -27,6 +27,8 @@ declare const _default: {
27
27
  "title": "Upload Product List",
28
28
  "instruction1": "After formatting is complete, upload the file here. The system will verify the file and return any corrections needed if information is not in the correct format for import into the system.",
29
29
  "instruction2": "Each upload is limited to 1 file and up to 100 rows of information (products). If the list contains more rows than allowed, the system will take rows 1 through 100 in order (excluding the header).",
30
+ "instruction3": "Each upload is limited to 1 file and up to 100 rows of information (products).",
31
+ "instruction4": "If the list contains more rows than allowed, the system will take rows 1 through 100 in order (excluding the header).",
30
32
  "deleteFile": "Delete file",
31
33
  "tabs": {
32
34
  "sampleDownload": "Download sample file",
@@ -27,6 +27,8 @@ declare const _default: {
27
27
  "title": "Tải lên danh sách sản phẩm",
28
28
  "instruction1": "Sau khi hoàn tất định dạng, hãy tải tệp lên đây. Hệ thống sẽ kiểm tra và trả kết quả cần chỉnh sửa trong trường hợp có thông tin không đúng định dạng để nhập vào hệ thống.",
29
29
  "instruction2": "Mỗi lượt tải lên danh sách chỉ được tối đa 01 tệp và tối đa 100 dòng thông tin (sản phẩm). Trường hợp danh sách có nhiều hơn số dòng thông tin quy định, hệ thống sẽ lấy theo thứ tự dòng thông tin số 1 đến dòng thông tin số 100 (không bao gồm tiêu đề).",
30
+ "instruction3": "Mỗi lượt tải lên danh sách chỉ được tối đa 01 tệp và tối đa 100 dòng thông tin (sản phẩm).",
31
+ "instruction4": "Trường hợp danh sách có nhiều hơn số dòng thông tin quy định, hệ thống sẽ lấy theo thứ tự dòng thông tin số 1 đến dòng thông tin số 100 (không bao gồm tiêu đề).",
30
32
  "deleteFile": "Xóa file",
31
33
  "tabs": {
32
34
  "sampleDownload": "Tải xuống tệp mẫu",
@@ -1,5 +1,5 @@
1
1
  type Props = {
2
- taxDeductionMethod: "direct" | "credit";
2
+ taxDeductionMethod: 'direct' | 'credit';
3
3
  };
4
4
  declare const ProductInfoPreview: ({ taxDeductionMethod }: Props) => import("react/jsx-runtime").JSX.Element;
5
5
  export default ProductInfoPreview;
@@ -70,13 +70,13 @@ var __asyncGenerator = (__this, __arguments, generator) => {
70
70
  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);
71
71
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
72
72
  const jsxRuntime = require("./jsx-runtime-DV8UmLi4.cjs");
73
- const useTranslation = require("./use-translation-CD6xknr3.cjs");
73
+ const useTranslation = require("./use-translation-m-_wCmHs.cjs");
74
74
  const reactToastify = require("react-toastify");
75
75
  const useWesapApiConfig_store = require("./use-wesap-api-config.store-BaseWS--.cjs");
76
76
  const React = require("react");
77
77
  const create = require("zustand");
78
- const useExternalConfig_store = require("./use-external-config.store-D2beE35F.cjs");
79
- const dropdownMenuAbsolute = require("./dropdownMenuAbsolute-djdsnyTz.cjs");
78
+ const useExternalConfig_store = require("./use-external-config.store-WVwivWvK.cjs");
79
+ const dropdownMenuAbsolute = require("./dropdownMenuAbsolute-BYTyDl09.cjs");
80
80
  const ReactDOM = require("react-dom");
81
81
  const index = require("./index-Ozgk-K52.cjs");
82
82
  const axios = require("axios");
@@ -57660,36 +57660,40 @@ const UpdateProductModal = ({
57660
57660
  onDeleteImage: handleDeleteImage
57661
57661
  }
57662
57662
  ),
57663
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Label, { labelText: translate("code"), required: true, children: [
57664
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ErrorMessage, { name: "code", errors }),
57665
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Input, __spreadValues({}, register("code")))
57666
- ] }),
57667
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Label, { labelText: translate("name"), required: true, children: [
57668
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ErrorMessage, { name: "name", errors }),
57669
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Input, __spreadValues({}, register("name")))
57670
- ] }),
57671
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "w-full min-w-full font-normal", children: [
57672
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("span", { className: "mb-[4px] flex items-center gap-[4px] text-[14px] font-bold leading-[20px] text-gray-700", children: [
57673
- translate("unit"),
57674
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { className: "text-red-500", children: "*" })
57663
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
57664
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Label, { labelText: translate("name"), required: true, children: [
57665
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ErrorMessage, { name: "name", errors }),
57666
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Input, __spreadValues({}, register("name")))
57675
57667
  ] }),
57676
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ErrorMessage, { name: "unit", errors }),
57677
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
57678
- UnitSelect,
57679
- {
57680
- unitOptions,
57681
- setUnitOptions,
57682
- onSelectOption: (value) => {
57683
- setValue("unit", value);
57684
- clearErrors("unit");
57685
- },
57686
- defaultValue: product == null ? void 0 : product.unit
57687
- }
57688
- )
57668
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Label, { labelText: translate("code"), required: true, children: [
57669
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ErrorMessage, { name: "code", errors }),
57670
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Input, __spreadValues({}, register("code")))
57671
+ ] })
57689
57672
  ] }),
57690
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Label, { labelText: translate("category"), children: [
57691
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ErrorMessage, { name: "category", errors }),
57692
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(CategoriesInput, { register, control, errors })
57673
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
57674
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "w-full min-w-full font-normal", children: [
57675
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("span", { className: "mb-[4px] flex items-center gap-[4px] text-[14px] font-bold leading-[20px] text-gray-700", children: [
57676
+ translate("unit"),
57677
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { className: "text-red-500", children: "*" })
57678
+ ] }),
57679
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ErrorMessage, { name: "unit", errors }),
57680
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
57681
+ UnitSelect,
57682
+ {
57683
+ unitOptions,
57684
+ setUnitOptions,
57685
+ onSelectOption: (value) => {
57686
+ setValue("unit", value);
57687
+ clearErrors("unit");
57688
+ },
57689
+ defaultValue: product == null ? void 0 : product.unit
57690
+ }
57691
+ )
57692
+ ] }),
57693
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Label, { labelText: translate("category"), children: [
57694
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ErrorMessage, { name: "category", errors }),
57695
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(CategoriesInput, { register, control, errors })
57696
+ ] })
57693
57697
  ] }),
57694
57698
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Label, { labelText: translate("price_vat"), required: true, children: [
57695
57699
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ErrorMessage, { name: "priceAfterTax", errors }),
@@ -58000,36 +58004,42 @@ const ProductPreviewTable = ({
58000
58004
  });
58001
58005
  }
58002
58006
  React.useEffect(() => {
58003
- const handleResetValidateMessages = (productsTableData2) => {
58004
- const resetProducts = productsTableData2.map((product) => __spreadProps(__spreadValues({}, product), {
58005
- note: ""
58006
- }));
58007
- return resetProducts;
58008
- };
58009
- const validate = () => __async(exports, null, function* () {
58010
- const resetErrorProducts = handleResetValidateMessages(productsTableData);
58011
- yield handleValidateProductsExist(resetErrorProducts);
58012
- const validated = resetErrorProducts.map((product) => {
58013
- let errors = "";
58014
- const schema = createProductPreviewSchema(translate, taxDeductionMethod);
58015
- const result = schema.safeParse(product);
58016
- if (!result.success) {
58017
- const fields = /* @__PURE__ */ new Set();
58018
- const zErrors = result.error.issues.filter((error) => {
58019
- if (fields.has(error.path[0])) return false;
58020
- fields.add(error.path[0]);
58021
- return true;
58022
- }).map((error) => error.message).join("\n");
58023
- errors = errors + zErrors;
58024
- }
58025
- product.note = product.note + errors;
58026
- return product;
58027
- });
58028
- setValidatedProducts(validated);
58007
+ if (productsTableData.length === 0) {
58029
58008
  setLoading(false);
58009
+ return;
58010
+ }
58011
+ let isMounted = true;
58012
+ const validate = () => __async(exports, null, function* () {
58013
+ setLoading(true);
58014
+ const productsToValidate = productsTableData.map((p) => __spreadProps(__spreadValues({}, p), { note: "" }));
58015
+ try {
58016
+ yield handleValidateProductsExist(productsToValidate);
58017
+ if (!isMounted) return;
58018
+ const finalValidated = productsToValidate.map((product) => {
58019
+ var _a;
58020
+ let errors = "";
58021
+ const schema = createProductPreviewSchema(translate, taxDeductionMethod);
58022
+ const result = schema.safeParse(product);
58023
+ if (!result.success) {
58024
+ errors = ((_a = result.error.issues[0]) == null ? void 0 : _a.message) || "";
58025
+ }
58026
+ return __spreadProps(__spreadValues({}, product), { note: product.note + errors });
58027
+ });
58028
+ setValidatedProducts(finalValidated);
58029
+ } catch (err) {
58030
+ console.error(err);
58031
+ } finally {
58032
+ if (isMounted) setLoading(false);
58033
+ }
58030
58034
  });
58031
- validate();
58032
- }, [productsTableData]);
58035
+ const timeoutId = setTimeout(() => {
58036
+ validate();
58037
+ }, 500);
58038
+ return () => {
58039
+ isMounted = false;
58040
+ clearTimeout(timeoutId);
58041
+ };
58042
+ }, [productsTableData, taxDeductionMethod]);
58033
58043
  return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "overflow-x-auto", children: [
58034
58044
  loading ? /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(dropdownMenuAbsolute.TableSkeleton, {}) : /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
58035
58045
  dropdownMenuAbsolute.ReusableTable,
@@ -58067,7 +58077,9 @@ const ProductInfoPreview = ({ taxDeductionMethod }) => {
58067
58077
  const [showCreateProductConfirmModal, setShowCreateProductConfirmModal] = React.useState(false);
58068
58078
  const [showCreateSuccessModal, setShowSuccessModal] = React.useState(false);
58069
58079
  const [checkedProducts, setCheckedProducts] = React.useState([]);
58070
- const [createdProductsResult, setCreatedProductsResult] = React.useState(null);
58080
+ const [createdProductsResult, setCreatedProductsResult] = React.useState(
58081
+ null
58082
+ );
58071
58083
  const { sheetMappingData, selectedSheet, uploadedFile, reset } = useUploadStore();
58072
58084
  const filterRow = sheetMappingData.filter((row) => {
58073
58085
  return row.code || row.name || row.priceAfterTax || row.unit || row.category;
@@ -58097,8 +58109,7 @@ const ProductInfoPreview = ({ taxDeductionMethod }) => {
58097
58109
  translate("upload_information_description2"),
58098
58110
  " ",
58099
58111
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("strong", { className: "text-[#1E2A7B]", children: uploadedFile == null ? void 0 : uploadedFile.name }),
58100
- ",",
58101
- " ",
58112
+ ", ",
58102
58113
  translate("sheet"),
58103
58114
  " ",
58104
58115
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("strong", { className: "text-[#1E2A7B]", children: selectedSheet })
@@ -58125,7 +58136,7 @@ const ProductInfoPreview = ({ taxDeductionMethod }) => {
58125
58136
  setCreatedProductsResult(data);
58126
58137
  setShowSuccessModal(true);
58127
58138
  },
58128
- numCheckedProducts: `${checkedProducts.length}/${sheetMappingData.length}`,
58139
+ numCheckedProducts: `${checkedProducts.length}/${filterRow.length}`,
58129
58140
  checkedProducts,
58130
58141
  taxDeductionMethod
58131
58142
  }
@@ -58150,23 +58161,19 @@ function FileUploadTab({
58150
58161
  const [isUploading, setIsUploading] = React.useState(false);
58151
58162
  const { translate } = useTranslation.useTranslation("file");
58152
58163
  const formatSize = (size) => size < 1024 * 1024 ? `${(size / 1024).toFixed(1)} KB` : `${(size / (1024 * 1024)).toFixed(2)} MB`;
58153
- if (isCheckData)
58154
- return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ProductInfoPreview, { taxDeductionMethod });
58164
+ if (isCheckData) return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(ProductInfoPreview, { taxDeductionMethod });
58155
58165
  return !isMappingData ? /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-8", children: [
58156
58166
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-6", children: [
58157
58167
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("p", { className: "text-[#0E121B] font-bold text-[24px] leading-[30px]", children: translate("title") }),
58158
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("ul", { className: "text-[#0E121B] text-[16px] leading-5 font-normal list-disc pl-5", children: [
58168
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("ul", { className: "text-[#0E121B] text-[16px] leading-5 font-normal list-disc pl-5", children: uploadedFile ? /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment, { children: [
58169
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("li", { children: translate("instruction3") }),
58170
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("li", { children: translate("instruction4") })
58171
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment, { children: [
58159
58172
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("li", { children: translate("instruction1") }),
58160
58173
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("li", { children: translate("instruction2") })
58161
- ] })
58174
+ ] }) })
58162
58175
  ] }),
58163
- /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
58164
- FileUploadButton,
58165
- {
58166
- isUploading,
58167
- setIsUploading
58168
- }
58169
- ),
58176
+ /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(FileUploadButton, { isUploading, setIsUploading }),
58170
58177
  uploadedFile && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(
58171
58178
  "div",
58172
58179
  {