@atomsolution/sdk-merchant 1.8.3 → 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 +51 -37
  5. package/dist/batch-product-creation.cjs.map +1 -1
  6. package/dist/batch-product-creation.esm.js +51 -37
  7. package/dist/batch-product-creation.esm.js.map +1 -1
  8. package/dist/batch-product-creation.js +51 -37
  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");
@@ -57505,7 +57505,11 @@ const CustomDropdown = ({
57505
57505
  "button",
57506
57506
  {
57507
57507
  type: "button",
57508
- onClick: () => setIsOpen(!isOpen),
57508
+ onMouseDown: (e) => e.stopPropagation(),
57509
+ onClick: (e) => {
57510
+ e.stopPropagation();
57511
+ setIsOpen(!isOpen);
57512
+ },
57509
57513
  className: "flex items-center justify-between w-full bg-white border border-[#E8E8E8] rounded-lg px-3 py-[8px] text-sm focus:outline-none focus:border-blue-400 transition-colors",
57510
57514
  children: [
57511
57515
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { className: !selectedOption ? "text-gray-400" : "text-gray-900", children: selectedOption ? selectedOption.label : placeholder }),
@@ -57536,7 +57540,10 @@ const CustomDropdown = ({
57536
57540
  "button",
57537
57541
  {
57538
57542
  type: "button",
57539
- onClick: () => {
57543
+ onMouseDown: (e) => e.stopPropagation(),
57544
+ onClick: (e) => {
57545
+ e.preventDefault();
57546
+ e.stopPropagation();
57540
57547
  onChange(option.value);
57541
57548
  setIsOpen(false);
57542
57549
  },
@@ -57993,36 +58000,42 @@ const ProductPreviewTable = ({
57993
58000
  });
57994
58001
  }
57995
58002
  React.useEffect(() => {
57996
- const handleResetValidateMessages = (productsTableData2) => {
57997
- const resetProducts = productsTableData2.map((product) => __spreadProps(__spreadValues({}, product), {
57998
- note: ""
57999
- }));
58000
- return resetProducts;
58001
- };
58002
- const validate = () => __async(exports, null, function* () {
58003
- const resetErrorProducts = handleResetValidateMessages(productsTableData);
58004
- yield handleValidateProductsExist(resetErrorProducts);
58005
- const validated = resetErrorProducts.map((product) => {
58006
- let errors = "";
58007
- const schema = createProductPreviewSchema(translate, taxDeductionMethod);
58008
- const result = schema.safeParse(product);
58009
- if (!result.success) {
58010
- const fields = /* @__PURE__ */ new Set();
58011
- const zErrors = result.error.issues.filter((error) => {
58012
- if (fields.has(error.path[0])) return false;
58013
- fields.add(error.path[0]);
58014
- return true;
58015
- }).map((error) => error.message).join("\n");
58016
- errors = errors + zErrors;
58017
- }
58018
- product.note = product.note + errors;
58019
- return product;
58020
- });
58021
- setValidatedProducts(validated);
58003
+ if (productsTableData.length === 0) {
58022
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
+ }
58023
58030
  });
58024
- validate();
58025
- }, [productsTableData]);
58031
+ const timeoutId = setTimeout(() => {
58032
+ validate();
58033
+ }, 500);
58034
+ return () => {
58035
+ isMounted = false;
58036
+ clearTimeout(timeoutId);
58037
+ };
58038
+ }, [productsTableData, taxDeductionMethod]);
58026
58039
  return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "overflow-x-auto", children: [
58027
58040
  loading ? /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(dropdownMenuAbsolute.TableSkeleton, {}) : /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
58028
58041
  dropdownMenuAbsolute.ReusableTable,
@@ -58060,7 +58073,9 @@ const ProductInfoPreview = ({ taxDeductionMethod }) => {
58060
58073
  const [showCreateProductConfirmModal, setShowCreateProductConfirmModal] = React.useState(false);
58061
58074
  const [showCreateSuccessModal, setShowSuccessModal] = React.useState(false);
58062
58075
  const [checkedProducts, setCheckedProducts] = React.useState([]);
58063
- const [createdProductsResult, setCreatedProductsResult] = React.useState(null);
58076
+ const [createdProductsResult, setCreatedProductsResult] = React.useState(
58077
+ null
58078
+ );
58064
58079
  const { sheetMappingData, selectedSheet, uploadedFile, reset } = useUploadStore();
58065
58080
  const filterRow = sheetMappingData.filter((row) => {
58066
58081
  return row.code || row.name || row.priceAfterTax || row.unit || row.category;
@@ -58090,8 +58105,7 @@ const ProductInfoPreview = ({ taxDeductionMethod }) => {
58090
58105
  translate("upload_information_description2"),
58091
58106
  " ",
58092
58107
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("strong", { className: "text-[#1E2A7B]", children: uploadedFile == null ? void 0 : uploadedFile.name }),
58093
- ",",
58094
- " ",
58108
+ ", ",
58095
58109
  translate("sheet"),
58096
58110
  " ",
58097
58111
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("strong", { className: "text-[#1E2A7B]", children: selectedSheet })
@@ -58118,7 +58132,7 @@ const ProductInfoPreview = ({ taxDeductionMethod }) => {
58118
58132
  setCreatedProductsResult(data);
58119
58133
  setShowSuccessModal(true);
58120
58134
  },
58121
- numCheckedProducts: `${checkedProducts.length}/${sheetMappingData.length}`,
58135
+ numCheckedProducts: `${checkedProducts.length}/${filterRow.length}`,
58122
58136
  checkedProducts,
58123
58137
  taxDeductionMethod
58124
58138
  }