@atomsolution/sdk-merchant 1.8.4 → 1.8.5

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 (32) hide show
  1. package/dist/assets/locales/en/file.json.d.ts +2 -2
  2. package/dist/assets/locales/vi/file.json.d.ts +2 -2
  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 +42 -35
  5. package/dist/batch-product-creation.cjs.map +1 -1
  6. package/dist/batch-product-creation.esm.js +42 -35
  7. package/dist/batch-product-creation.esm.js.map +1 -1
  8. package/dist/batch-product-creation.js +42 -35
  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-BvDBLhd-.js → dropdownMenuAbsolute-0z-SL48l.js} +4 -6
  15. package/dist/{dropdownMenuAbsolute-BvDBLhd-.js.map → dropdownMenuAbsolute-0z-SL48l.js.map} +1 -1
  16. package/dist/{dropdownMenuAbsolute-djdsnyTz.cjs → dropdownMenuAbsolute-t4SPWS3W.cjs} +4 -6
  17. package/dist/{dropdownMenuAbsolute-djdsnyTz.cjs.map → dropdownMenuAbsolute-t4SPWS3W.cjs.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-CD6xknr3.cjs → use-translation-Ba-GPTbc.cjs} +6 -6
  29. package/dist/{use-translation-CD6xknr3.cjs.map → use-translation-Ba-GPTbc.cjs.map} +1 -1
  30. package/dist/{use-translation-DFiePp2h.js → use-translation-Dpu_N-4j.js} +6 -6
  31. package/dist/{use-translation-DFiePp2h.js.map → use-translation-Dpu_N-4j.js.map} +1 -1
  32. package/package.json +1 -1
@@ -25,8 +25,8 @@ declare const _default: {
25
25
  "Product Category"
26
26
  ],
27
27
  "title": "Upload Product List",
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
- "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).",
28
+ "instruction1": "Each upload is limited to 1 file and up to 100 rows of information (products).",
29
+ "instruction2": "If the list contains more rows than allowed, the system will take rows 1 through 100 in order (excluding the header).",
30
30
  "deleteFile": "Delete file",
31
31
  "tabs": {
32
32
  "sampleDownload": "Download sample file",
@@ -25,8 +25,8 @@ declare const _default: {
25
25
  "Danh mục sản phẩm"
26
26
  ],
27
27
  "title": "Tải lên danh sách sản phẩm",
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 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
- "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 đề).",
28
+ "instruction1": "Mỗi lượt tải lên danh sách chỉ được tối đa 01 tệp tối đa 100 dòng thông tin (sản phẩm).",
29
+ "instruction2": "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
30
  "deleteFile": "Xóa file",
31
31
  "tabs": {
32
32
  "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-Ba-GPTbc.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-t4SPWS3W.cjs");
80
80
  const ReactDOM = require("react-dom");
81
81
  const index = require("./index-Ozgk-K52.cjs");
82
82
  const axios = require("axios");
@@ -58000,36 +58000,42 @@ const ProductPreviewTable = ({
58000
58000
  });
58001
58001
  }
58002
58002
  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);
58003
+ if (productsTableData.length === 0) {
58029
58004
  setLoading(false);
58005
+ return;
58006
+ }
58007
+ let isMounted = true;
58008
+ const validate = () => __async(exports, null, function* () {
58009
+ setLoading(true);
58010
+ const productsToValidate = productsTableData.map((p) => __spreadProps(__spreadValues({}, p), { note: "" }));
58011
+ try {
58012
+ yield handleValidateProductsExist(productsToValidate);
58013
+ if (!isMounted) return;
58014
+ const finalValidated = productsToValidate.map((product) => {
58015
+ var _a;
58016
+ let errors = "";
58017
+ const schema = createProductPreviewSchema(translate, taxDeductionMethod);
58018
+ const result = schema.safeParse(product);
58019
+ if (!result.success) {
58020
+ errors = ((_a = result.error.issues[0]) == null ? void 0 : _a.message) || "";
58021
+ }
58022
+ return __spreadProps(__spreadValues({}, product), { note: product.note + errors });
58023
+ });
58024
+ setValidatedProducts(finalValidated);
58025
+ } catch (err) {
58026
+ console.error(err);
58027
+ } finally {
58028
+ if (isMounted) setLoading(false);
58029
+ }
58030
58030
  });
58031
- validate();
58032
- }, [productsTableData]);
58031
+ const timeoutId = setTimeout(() => {
58032
+ validate();
58033
+ }, 500);
58034
+ return () => {
58035
+ isMounted = false;
58036
+ clearTimeout(timeoutId);
58037
+ };
58038
+ }, [productsTableData, taxDeductionMethod]);
58033
58039
  return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "overflow-x-auto", children: [
58034
58040
  loading ? /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(dropdownMenuAbsolute.TableSkeleton, {}) : /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
58035
58041
  dropdownMenuAbsolute.ReusableTable,
@@ -58067,7 +58073,9 @@ const ProductInfoPreview = ({ taxDeductionMethod }) => {
58067
58073
  const [showCreateProductConfirmModal, setShowCreateProductConfirmModal] = React.useState(false);
58068
58074
  const [showCreateSuccessModal, setShowSuccessModal] = React.useState(false);
58069
58075
  const [checkedProducts, setCheckedProducts] = React.useState([]);
58070
- const [createdProductsResult, setCreatedProductsResult] = React.useState(null);
58076
+ const [createdProductsResult, setCreatedProductsResult] = React.useState(
58077
+ null
58078
+ );
58071
58079
  const { sheetMappingData, selectedSheet, uploadedFile, reset } = useUploadStore();
58072
58080
  const filterRow = sheetMappingData.filter((row) => {
58073
58081
  return row.code || row.name || row.priceAfterTax || row.unit || row.category;
@@ -58097,8 +58105,7 @@ const ProductInfoPreview = ({ taxDeductionMethod }) => {
58097
58105
  translate("upload_information_description2"),
58098
58106
  " ",
58099
58107
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("strong", { className: "text-[#1E2A7B]", children: uploadedFile == null ? void 0 : uploadedFile.name }),
58100
- ",",
58101
- " ",
58108
+ ", ",
58102
58109
  translate("sheet"),
58103
58110
  " ",
58104
58111
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("strong", { className: "text-[#1E2A7B]", children: selectedSheet })
@@ -58125,7 +58132,7 @@ const ProductInfoPreview = ({ taxDeductionMethod }) => {
58125
58132
  setCreatedProductsResult(data);
58126
58133
  setShowSuccessModal(true);
58127
58134
  },
58128
- numCheckedProducts: `${checkedProducts.length}/${sheetMappingData.length}`,
58135
+ numCheckedProducts: `${checkedProducts.length}/${filterRow.length}`,
58129
58136
  checkedProducts,
58130
58137
  taxDeductionMethod
58131
58138
  }