@atomsolution/sdk-merchant 1.5.2 → 1.5.4

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/download-sample.json.d.ts +9 -2
  2. package/dist/assets/locales/en/file.json.d.ts +2 -1
  3. package/dist/assets/locales/vi/download-sample.json.d.ts +9 -2
  4. package/dist/assets/locales/vi/file.json.d.ts +2 -1
  5. package/dist/batch-product-creation/components/merchant-batch-create-form/field-mapping-popup.d.ts +2 -1
  6. package/dist/batch-product-creation/components/merchant-batch-create-form/file-upload-tab.d.ts +1 -2
  7. package/dist/batch-product-creation/components/merchant-batch-create-form/modals/create-product-confirm-modal.d.ts +1 -2
  8. package/dist/batch-product-creation/components/merchant-batch-create-form/product-info-preview/index.d.ts +1 -2
  9. package/dist/batch-product-creation.cjs +53 -40
  10. package/dist/batch-product-creation.cjs.map +1 -1
  11. package/dist/batch-product-creation.esm.js +53 -40
  12. package/dist/batch-product-creation.esm.js.map +1 -1
  13. package/dist/batch-product-creation.js +53 -40
  14. package/dist/batch-product-creation.js.map +1 -1
  15. package/dist/components/MerchantBatchCreateForm/index.d.ts +1 -2
  16. package/dist/digistore.cjs +1 -1
  17. package/dist/digistore.esm.js +1 -1
  18. package/dist/digistore.js +1 -1
  19. package/dist/{dropdownMenuAbsolute-89gAGgGd.cjs → dropdownMenuAbsolute-77lk7HqZ.cjs} +2 -2
  20. package/dist/{dropdownMenuAbsolute-89gAGgGd.cjs.map → dropdownMenuAbsolute-77lk7HqZ.cjs.map} +1 -1
  21. package/dist/{dropdownMenuAbsolute-Dw7Pk9Ke.js → dropdownMenuAbsolute-x0WsXrLZ.js} +2 -2
  22. package/dist/{dropdownMenuAbsolute-Dw7Pk9Ke.js.map → dropdownMenuAbsolute-x0WsXrLZ.js.map} +1 -1
  23. package/dist/merchant-profile.cjs +2 -2
  24. package/dist/merchant-profile.esm.js +2 -2
  25. package/dist/merchant-profile.js +2 -2
  26. package/dist/style.css +4 -0
  27. package/dist/{use-translation-DoUEE54r.js → use-translation-CEr2fmqT.js} +25 -7
  28. package/dist/{use-translation-DoUEE54r.js.map → use-translation-CEr2fmqT.js.map} +1 -1
  29. package/dist/{use-translation-T0TNDEqs.cjs → use-translation-CN8MTMJN.cjs} +25 -7
  30. package/dist/{use-translation-T0TNDEqs.cjs.map → use-translation-CN8MTMJN.cjs.map} +1 -1
  31. package/dist/utils/translations.d.ts +18 -2
  32. package/package.json +1 -1
@@ -68,13 +68,13 @@ 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-DoUEE54r.js";
71
+ import { u as useTranslation, t as translate } from "./use-translation-CEr2fmqT.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 { 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-Dw7Pk9Ke.js";
77
+ 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-x0WsXrLZ.js";
78
78
  import * as ReactDOM from "react-dom";
79
79
  import ReactDOM__default from "react-dom";
80
80
  import { C as CustomToast } from "./index-ChOpfqCh.js";
@@ -110,10 +110,10 @@ function DownloadSampleFile() {
110
110
  const fieldOrder = [
111
111
  "productCode",
112
112
  "productName",
113
- "price",
113
+ "taxVAT",
114
+ "priceAfterTax",
114
115
  "unit",
115
116
  "category"
116
- // "image",
117
117
  ];
118
118
  const downloadFile = language === "en" ? sampleFileEn : sampleFileVi;
119
119
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-6 w-full", children: [
@@ -146,7 +146,14 @@ function DownloadSampleFile() {
146
146
  )
147
147
  }
148
148
  ),
149
- /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: downloadFile, download: language == "en" ? "digistore_bulkupload.xlsx" : "digistore_mautaosanpham.xlsx", children: translate2("downloadButton") })
149
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
150
+ "a",
151
+ {
152
+ href: downloadFile,
153
+ download: language == "en" ? "digistore_bulkupload.xlsx" : "digistore_mautaosanpham.xlsx",
154
+ children: translate2("downloadButton")
155
+ }
156
+ )
150
157
  ]
151
158
  }
152
159
  ),
@@ -26640,25 +26647,30 @@ function FileUploadButton({
26640
26647
  }
26641
26648
  ) });
26642
26649
  }
26643
- const HIDDEN_SYSTEM_FIELDS = ["Giá bán trước thuế", "Price before tax"];
26644
- const HIDDEN_MAPPING_FIELDS$1 = [
26645
- "Giá bán trước thuế",
26646
- "Price before tax",
26647
- "Thuế VAT",
26648
- "Tax"
26649
- ];
26650
+ const NON_MAPPABLE_FIELDS = ["Giá bán trước thuế", "Price before tax"];
26651
+ const getMappableSystemFields = (fields, method) => {
26652
+ return fields.filter((field) => {
26653
+ if (NON_MAPPABLE_FIELDS.includes(field)) return false;
26654
+ if (method === "direct") {
26655
+ return field !== "Thuế VAT" && field !== "Tax";
26656
+ }
26657
+ return true;
26658
+ });
26659
+ };
26650
26660
  function FieldMappingPopup({
26651
26661
  sheetHeaders,
26652
26662
  mappings,
26653
26663
  defaultMappings,
26654
- onChange
26664
+ onChange,
26665
+ taxDeductionMethod
26655
26666
  }) {
26656
26667
  const [open, setOpen] = useState(false);
26657
26668
  const popoverRef = useRef(null);
26658
26669
  const { translate: translate2 } = useTranslation("file");
26659
26670
  const systemFields = translate2("systemFields");
26660
- const visibleSystemFields = systemFields.filter(
26661
- (field) => !HIDDEN_SYSTEM_FIELDS.includes(field) && !HIDDEN_MAPPING_FIELDS$1.includes(field)
26671
+ const visibleSystemFields = getMappableSystemFields(
26672
+ systemFields,
26673
+ taxDeductionMethod
26662
26674
  );
26663
26675
  const handleSelect = (field, value) => {
26664
26676
  const newMappings = __spreadValues({}, mappings);
@@ -26763,12 +26775,12 @@ function FieldMappingPopup({
26763
26775
  ] });
26764
26776
  }
26765
26777
  const EXCLUDED_SYSTEM_FIELDS = ["Giá bán trước thuế", "Price before tax"];
26766
- const HIDDEN_MAPPING_FIELDS = [
26767
- "Giá bán trước thuế",
26768
- "Price before tax",
26769
- "Thuế VAT",
26770
- "Tax"
26771
- ];
26778
+ const getHiddenFieldsByTaxMethod = (method) => {
26779
+ if (method === "credit") {
26780
+ return [];
26781
+ }
26782
+ return ["Giá bán trước thuế", "Price before tax", "Thuế VAT", "Tax"];
26783
+ };
26772
26784
  function MergeAndCheckData({ taxDeductionMethod }) {
26773
26785
  const [useHeader, setUseHeader] = useState(true);
26774
26786
  const [showCancelPopup, setShowCancelPopup] = useState(false);
@@ -26877,7 +26889,7 @@ function MergeAndCheckData({ taxDeductionMethod }) {
26877
26889
  }
26878
26890
  });
26879
26891
  const visibleSystemFields = systemFields.filter(
26880
- (field) => !HIDDEN_MAPPING_FIELDS.includes(field)
26892
+ (field) => !getHiddenFieldsByTaxMethod(taxDeductionMethod).includes(field)
26881
26893
  );
26882
26894
  const filteredRows = sheetMappingData.filter((row) => {
26883
26895
  return row.code || row.name || row.priceAfterTax || row.unit || row.category;
@@ -26886,7 +26898,17 @@ function MergeAndCheckData({ taxDeductionMethod }) {
26886
26898
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-8", children: [
26887
26899
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
26888
26900
  /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-[20px] leading-[30px] font-bold text-[#0E121B] mb-2", children: translate2("mergeDataTitle") }),
26889
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-[16px] leading-[20px] font-normal text-[#0E121B] whitespace-pre-line", children: translate2("mergeDescription") })
26901
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-[16px] leading-[20px] font-normal text-[#0E121B] whitespace-pre-line", children: translate2("mergeDescription") }),
26902
+ /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
26903
+ taxDeductionMethod == "direct" && /* @__PURE__ */ jsxRuntimeExports.jsx(
26904
+ "p",
26905
+ {
26906
+ className: "text-[14px] w-fit leading-[18px] font-normal text-[#0E121B] bg-blue-200",
26907
+ dangerouslySetInnerHTML: {
26908
+ __html: translate2("directTaxNote")
26909
+ }
26910
+ }
26911
+ )
26890
26912
  ] }),
26891
26913
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 items-center justify-start", children: [
26892
26914
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -26895,7 +26917,8 @@ function MergeAndCheckData({ taxDeductionMethod }) {
26895
26917
  sheetHeaders,
26896
26918
  mappings,
26897
26919
  defaultMappings,
26898
- onChange: (m) => setMappings(m)
26920
+ onChange: (m) => setMappings(m),
26921
+ taxDeductionMethod
26899
26922
  }
26900
26923
  ),
26901
26924
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [
@@ -29211,14 +29234,12 @@ const CreateProductConfirmModal = ({
29211
29234
  open,
29212
29235
  onClose,
29213
29236
  onSuccess,
29214
- taxDeductionMethod,
29215
- directTax
29237
+ taxDeductionMethod
29216
29238
  }) => {
29217
29239
  const [loading, setLoading] = useState(false);
29218
29240
  const { translate: translate2 } = useTranslation("batch-create-product");
29219
29241
  const handleCreateProducts = () => __async(void 0, null, function* () {
29220
29242
  setLoading(true);
29221
- console.log(checkedProducts);
29222
29243
  const formattedProducts = checkedProducts.map((product) => ({
29223
29244
  code: product.code,
29224
29245
  name: product.name,
@@ -29226,7 +29247,7 @@ const CreateProductConfirmModal = ({
29226
29247
  img: product.img || "",
29227
29248
  unit: product.unit,
29228
29249
  cost: 0,
29229
- tax: taxDeductionMethod == "direct" ? directTax != null ? directTax : 0 : product.tax,
29250
+ tax: taxDeductionMethod == "direct" ? 0 : product.tax,
29230
29251
  status: 0,
29231
29252
  category_names: product.category
29232
29253
  }));
@@ -57884,7 +57905,7 @@ const ProductPreviewTable = ({
57884
57905
  )
57885
57906
  ] });
57886
57907
  };
57887
- const ProductInfoPreview = ({ taxDeductionMethod, directTax }) => {
57908
+ const ProductInfoPreview = ({ taxDeductionMethod }) => {
57888
57909
  const [showCreateProductConfirmModal, setShowCreateProductConfirmModal] = useState(false);
57889
57910
  const [showCreateSuccessModal, setShowSuccessModal] = useState(false);
57890
57911
  const [checkedProducts, setCheckedProducts] = useState([]);
@@ -57945,8 +57966,7 @@ const ProductInfoPreview = ({ taxDeductionMethod, directTax }) => {
57945
57966
  },
57946
57967
  numCheckedProducts: `${checkedProducts.length}/${sheetMappingData.length}`,
57947
57968
  checkedProducts,
57948
- taxDeductionMethod,
57949
- directTax
57969
+ taxDeductionMethod
57950
57970
  }
57951
57971
  ),
57952
57972
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -57961,8 +57981,7 @@ const ProductInfoPreview = ({ taxDeductionMethod, directTax }) => {
57961
57981
  ] });
57962
57982
  };
57963
57983
  function FileUploadTab({
57964
- taxDeductionMethod,
57965
- directTax
57984
+ taxDeductionMethod
57966
57985
  }) {
57967
57986
  const { isCheckData, isMappingData, uploadedFile, setUploadedFile } = useUploadStore();
57968
57987
  const setIsDirty = useUnsavedChangesStore((state) => state.setIsDirty);
@@ -57970,13 +57989,7 @@ function FileUploadTab({
57970
57989
  const { translate: translate2 } = useTranslation("file");
57971
57990
  const formatSize = (size) => size < 1024 * 1024 ? `${(size / 1024).toFixed(1)} KB` : `${(size / (1024 * 1024)).toFixed(2)} MB`;
57972
57991
  if (isCheckData)
57973
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
57974
- ProductInfoPreview,
57975
- {
57976
- taxDeductionMethod,
57977
- directTax
57978
- }
57979
- );
57992
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ProductInfoPreview, { taxDeductionMethod });
57980
57993
  return !isMappingData ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-8", children: [
57981
57994
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-6", children: [
57982
57995
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-[#0E121B] font-bold text-[24px] leading-[30px]", children: translate2("title") }),