@atomsolution/sdk-merchant 1.4.2 → 1.5.2
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 +3 -1
- package/dist/assets/locales/en/merchant-batch-create-form.json.d.ts +3 -1
- package/dist/assets/locales/vi/file.json.d.ts +3 -1
- package/dist/assets/locales/vi/merchant-batch-create-form.json.d.ts +3 -1
- package/dist/batch-product-creation/components/merchant-batch-create-form/file-upload-tab.d.ts +6 -1
- package/dist/batch-product-creation/components/merchant-batch-create-form/index.d.ts +6 -1
- package/dist/batch-product-creation/components/merchant-batch-create-form/merge-and-check-data.d.ts +5 -1
- package/dist/batch-product-creation/components/merchant-batch-create-form/modals/create-product-confirm-modal.d.ts +3 -1
- package/dist/batch-product-creation/components/merchant-batch-create-form/modals/update-product-modal/index.d.ts +2 -1
- package/dist/batch-product-creation/components/merchant-batch-create-form/product-info-preview/index.d.ts +5 -1
- package/dist/batch-product-creation/components/merchant-batch-create-form/product-info-preview/product-preview-table/index.d.ts +2 -2
- package/dist/batch-product-creation/store/use-upload-store.d.ts +3 -1
- package/dist/batch-product-creation/types/product-info-preview.d.ts +32 -3
- package/dist/batch-product-creation.cjs +700 -541
- package/dist/batch-product-creation.cjs.map +1 -1
- package/dist/batch-product-creation.esm.js +701 -542
- package/dist/batch-product-creation.esm.js.map +1 -1
- package/dist/batch-product-creation.js +701 -542
- package/dist/batch-product-creation.js.map +1 -1
- package/dist/components/MerchantBatchCreateForm/index.d.ts +6 -0
- package/dist/digistore.cjs +1 -1
- package/dist/digistore.esm.js +1 -1
- package/dist/digistore.js +1 -1
- package/dist/{dropdownMenuAbsolute-BKV3mzgE.cjs → dropdownMenuAbsolute-89gAGgGd.cjs} +2 -2
- package/dist/{dropdownMenuAbsolute-BKV3mzgE.cjs.map → dropdownMenuAbsolute-89gAGgGd.cjs.map} +1 -1
- package/dist/{dropdownMenuAbsolute-BreOsoPt.js → dropdownMenuAbsolute-Dw7Pk9Ke.js} +2 -2
- package/dist/{dropdownMenuAbsolute-BreOsoPt.js.map → dropdownMenuAbsolute-Dw7Pk9Ke.js.map} +1 -1
- package/dist/{index.esm-DPmk5fdS.js → index.esm-CW4gWR7r.js} +3 -3
- package/dist/{index.esm-DPmk5fdS.js.map → index.esm-CW4gWR7r.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/permission.esm.js +1 -1
- package/dist/permission.js +1 -1
- package/dist/style.css +4 -0
- package/dist/{use-translation-Df6YK55O.js → use-translation-DoUEE54r.js} +17 -5
- package/dist/{use-translation-Df6YK55O.js.map → use-translation-DoUEE54r.js.map} +1 -1
- package/dist/{use-translation-OSujcs4v.cjs → use-translation-T0TNDEqs.cjs} +17 -5
- package/dist/{use-translation-OSujcs4v.cjs.map → use-translation-T0TNDEqs.cjs.map} +1 -1
- package/dist/utils/translations.d.ts +4 -0
- package/package.json +1 -1
|
@@ -53,8 +53,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
53
53
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
54
54
|
const jsxRuntime = require("./jsx-runtime-DV8UmLi4.cjs");
|
|
55
55
|
const React = require("react");
|
|
56
|
-
const dropdownMenuAbsolute = require("./dropdownMenuAbsolute-
|
|
57
|
-
const useTranslation = require("./use-translation-
|
|
56
|
+
const dropdownMenuAbsolute = require("./dropdownMenuAbsolute-89gAGgGd.cjs");
|
|
57
|
+
const useTranslation = require("./use-translation-T0TNDEqs.cjs");
|
|
58
58
|
const usePortalApiConfig_store = require("./use-portal-api-config.store-C8a2gebE.cjs");
|
|
59
59
|
const axios = require("axios");
|
|
60
60
|
var runtime = { exports: {} };
|
|
@@ -51,8 +51,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
51
51
|
};
|
|
52
52
|
import { j as jsxRuntimeExports } from "./jsx-runtime-ClP9nxnW.js";
|
|
53
53
|
import { useState, useCallback, useEffect, useRef, memo, useMemo } from "react";
|
|
54
|
-
import { c as commonjsRequire, g as getDefaultExportFromCjs, B as Button, D as DropdownMenu, u as useMediaQuery, T as TableSkeleton, R as ReusableTable, a as DropdownMenuAbsolute } from "./dropdownMenuAbsolute-
|
|
55
|
-
import { u as useTranslation } from "./use-translation-
|
|
54
|
+
import { c as commonjsRequire, g as getDefaultExportFromCjs, B as Button, D as DropdownMenu, u as useMediaQuery, T as TableSkeleton, R as ReusableTable, a as DropdownMenuAbsolute } from "./dropdownMenuAbsolute-Dw7Pk9Ke.js";
|
|
55
|
+
import { u as useTranslation } from "./use-translation-DoUEE54r.js";
|
|
56
56
|
import { u as usePortalApiConfig } from "./use-portal-api-config.store-C1UTTpK9.js";
|
|
57
57
|
import axios from "axios";
|
|
58
58
|
var runtime = { exports: {} };
|
package/dist/merchant-profile.js
CHANGED
|
@@ -51,8 +51,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
51
51
|
};
|
|
52
52
|
import { j as jsxRuntimeExports } from "./jsx-runtime-ClP9nxnW.js";
|
|
53
53
|
import { useState, useCallback, useEffect, useRef, memo, useMemo } from "react";
|
|
54
|
-
import { c as commonjsRequire, g as getDefaultExportFromCjs, B as Button, D as DropdownMenu, u as useMediaQuery, T as TableSkeleton, R as ReusableTable, a as DropdownMenuAbsolute } from "./dropdownMenuAbsolute-
|
|
55
|
-
import { u as useTranslation } from "./use-translation-
|
|
54
|
+
import { c as commonjsRequire, g as getDefaultExportFromCjs, B as Button, D as DropdownMenu, u as useMediaQuery, T as TableSkeleton, R as ReusableTable, a as DropdownMenuAbsolute } from "./dropdownMenuAbsolute-Dw7Pk9Ke.js";
|
|
55
|
+
import { u as useTranslation } from "./use-translation-DoUEE54r.js";
|
|
56
56
|
import { u as usePortalApiConfig } from "./use-portal-api-config.store-C1UTTpK9.js";
|
|
57
57
|
import axios from "axios";
|
|
58
58
|
var runtime = { exports: {} };
|
package/dist/permission.esm.js
CHANGED
|
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
};
|
|
40
40
|
import { j as jsxRuntimeExports } from "./jsx-runtime-ClP9nxnW.js";
|
|
41
41
|
import { useState } from "react";
|
|
42
|
-
import { u as useForm, a as useController } from "./index.esm-
|
|
42
|
+
import { u as useForm, a as useController } from "./index.esm-CW4gWR7r.js";
|
|
43
43
|
const formatParams = (params) => {
|
|
44
44
|
const searchParams = new URLSearchParams();
|
|
45
45
|
Object.entries(params).forEach(([key, value]) => {
|
package/dist/permission.js
CHANGED
|
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
};
|
|
40
40
|
import { j as jsxRuntimeExports } from "./jsx-runtime-ClP9nxnW.js";
|
|
41
41
|
import { useState } from "react";
|
|
42
|
-
import { u as useForm, a as useController } from "./index.esm-
|
|
42
|
+
import { u as useForm, a as useController } from "./index.esm-CW4gWR7r.js";
|
|
43
43
|
const formatParams = (params) => {
|
|
44
44
|
const searchParams = new URLSearchParams();
|
|
45
45
|
Object.entries(params).forEach(([key, value]) => {
|
package/dist/style.css
CHANGED
|
@@ -458,7 +458,9 @@ const image$1 = "Hình ảnh sản phẩm";
|
|
|
458
458
|
const no_image$1 = "Không có ảnh";
|
|
459
459
|
const name$1 = "Tên sản phẩm";
|
|
460
460
|
const code$1 = "Mã sản phẩm";
|
|
461
|
-
const price_vat$1 = "Giá";
|
|
461
|
+
const price_vat$1 = "Giá bán sau thuế";
|
|
462
|
+
const tax$1 = "Thuế VAT";
|
|
463
|
+
const price_without_vat$1 = "Giá bán trước thuế";
|
|
462
464
|
const category$1 = "Danh mục sản phẩm";
|
|
463
465
|
const unit$1 = "Đơn vị tính";
|
|
464
466
|
const not_available$1 = "Chưa có";
|
|
@@ -544,6 +546,8 @@ const BATCH_CREATE_PRODUCT_VI = {
|
|
|
544
546
|
name: name$1,
|
|
545
547
|
code: code$1,
|
|
546
548
|
price_vat: price_vat$1,
|
|
549
|
+
tax: tax$1,
|
|
550
|
+
price_without_vat: price_without_vat$1,
|
|
547
551
|
category: category$1,
|
|
548
552
|
unit: unit$1,
|
|
549
553
|
not_available: not_available$1,
|
|
@@ -629,7 +633,9 @@ const image = "Product Image";
|
|
|
629
633
|
const no_image = "No Image";
|
|
630
634
|
const name = "Product Name";
|
|
631
635
|
const code = "Product Code";
|
|
632
|
-
const price_vat = "Price";
|
|
636
|
+
const price_vat = "Price after tax";
|
|
637
|
+
const tax = "Tax VAT";
|
|
638
|
+
const price_without_vat = "Price before tax";
|
|
633
639
|
const category = "Category";
|
|
634
640
|
const unit = "Unit";
|
|
635
641
|
const not_available = "Not available";
|
|
@@ -715,6 +721,8 @@ const BATCH_CREATE_PRODUCT_EN = {
|
|
|
715
721
|
name,
|
|
716
722
|
code,
|
|
717
723
|
price_vat,
|
|
724
|
+
tax,
|
|
725
|
+
price_without_vat,
|
|
718
726
|
category,
|
|
719
727
|
unit,
|
|
720
728
|
not_available,
|
|
@@ -846,7 +854,9 @@ const reset$1 = "Khôi phục lại";
|
|
|
846
854
|
const systemFields$1 = [
|
|
847
855
|
"Mã sản phẩm",
|
|
848
856
|
"Tên sản phẩm",
|
|
849
|
-
"Giá",
|
|
857
|
+
"Giá bán trước thuế",
|
|
858
|
+
"Thuế VAT",
|
|
859
|
+
"Giá bán sau thuế",
|
|
850
860
|
"Đơn vị tính",
|
|
851
861
|
"Danh mục sản phẩm"
|
|
852
862
|
];
|
|
@@ -925,7 +935,9 @@ const reset = "Reset";
|
|
|
925
935
|
const systemFields = [
|
|
926
936
|
"Product Code",
|
|
927
937
|
"Product Name",
|
|
928
|
-
"Price",
|
|
938
|
+
"Price before tax",
|
|
939
|
+
"Tax (VAT)",
|
|
940
|
+
"Price after tax",
|
|
929
941
|
"Unit",
|
|
930
942
|
"Product Category"
|
|
931
943
|
];
|
|
@@ -1259,4 +1271,4 @@ export {
|
|
|
1259
1271
|
translate as t,
|
|
1260
1272
|
useTranslation as u
|
|
1261
1273
|
};
|
|
1262
|
-
//# sourceMappingURL=use-translation-
|
|
1274
|
+
//# sourceMappingURL=use-translation-DoUEE54r.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-translation-
|
|
1
|
+
{"version":3,"file":"use-translation-DoUEE54r.js","sources":["../src/utils/translations.ts","../src/hooks/use-translation.ts"],"sourcesContent":["import TABLE_VI from '@/assets/locales/vi/table.json';\nimport TABLE_EN from '@/assets/locales/en/table.json';\nimport FORM_VI from '@/assets/locales/vi/form.json';\nimport FORM_EN from '@/assets/locales/en/form.json';\nimport BATCH_CREATE_PRODUCT_VI from '@/assets/locales/vi/merchant-batch-create-form.json';\nimport BATCH_CREATE_PRODUCT_EN from '@/assets/locales/en/merchant-batch-create-form.json';\nimport COMMON_VI from '@/assets/locales/vi/common.json';\nimport COMMON_EN from '@/assets/locales/en/common.json';\nimport FILE_VI from '@/assets/locales/vi/file.json';\nimport FILE_VN from '@/assets/locales/en/file.json';\nimport DOWNLOAD_SAMPLE_VI from '@/assets/locales/vi/download-sample.json';\nimport DOWNLOAD_SAMPLE_EN from '@/assets/locales/en/download-sample.json';\nimport DIGISTORE_ID_VI from '@/assets/locales/vi/digistore-id.json';\nimport DIGISTORE_ID_EN from '@/assets/locales/en/digistore-id.json';\n\nexport const TRANSLATIONS = {\n vi: {\n common: COMMON_VI,\n table: TABLE_VI,\n form: FORM_VI,\n 'batch-create-product': BATCH_CREATE_PRODUCT_VI,\n file: FILE_VI,\n 'download-sample': DOWNLOAD_SAMPLE_VI,\n 'digistore-id': DIGISTORE_ID_VI\n },\n en: {\n common: COMMON_EN,\n table: TABLE_EN,\n form: FORM_EN,\n 'batch-create-product': BATCH_CREATE_PRODUCT_EN,\n file: FILE_VN,\n 'download-sample': DOWNLOAD_SAMPLE_EN,\n 'digistore-id': DIGISTORE_ID_EN\n },\n} as const;\n","import useExternalConfigStore from '@/shared/store/use-external-config.store';\nimport { TRANSLATIONS } from '../utils/translations';\n\nexport type Language = keyof typeof TRANSLATIONS;\ntype Namespace = keyof (typeof TRANSLATIONS)[Language];\n\ninterface UseTranslationReturn {\n translate: (key: string) => string;\n language?: Language;\n}\n\nexport const translate = (\n key: string,\n name_space: Namespace = 'table',\n language?: Language\n): string => {\n const lang = language || useExternalConfigStore.getState().language;\n\n const splitKey = key?.split(':');\n const [namespace, derivedKey] =\n splitKey.length > 1 ? splitKey : [name_space, key];\n\n const ns = namespace as Namespace;\n const translations = TRANSLATIONS[lang][ns] as any;\n const keys = derivedKey.split('.');\n let value: any = translations;\n for (const k of keys) {\n value = value?.[k];\n }\n\n return value ?? key;\n};\n\nexport const useTranslation = (\n defaultNs: Namespace = 'table',\n manualLanguage?: Language\n): UseTranslationReturn => {\n const language: Language =\n manualLanguage || useExternalConfigStore.getState().language;\n const translateWithDefault = (key: string) =>\n translate(key, defaultNs, language);\n\n return { translate: translateWithDefault, language };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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B,SAAA,EAAW;AAE3D,QAAM,WAAW,2BAAK,MAAM;AAC5B,QAAM,CAAC,WAAW,UAAU,IAC1B,SAAS,SAAS,IAAI,WAAW,CAAC,YAAY,GAAG;AAEnD,QAAM,KAAK;AACX,QAAM,eAAe,aAAa,IAAI,EAAE,EAAE;AAC1C,QAAM,OAAO,WAAW,MAAM,GAAG;AACjC,MAAI,QAAa;AACjB,aAAW,KAAK,MAAM;AACpB,YAAQ,+BAAQ;AAAA,EAClB;AAEA,SAAO,wBAAS;AAClB;AAEO,MAAM,iBAAiB,CAC5B,YAAuB,SACvB,mBACyB;AACzB,QAAM,WACJ,kBAAkB,uBAAuB,SAAA,EAAW;AACtD,QAAM,uBAAuB,CAAC,QAC5B,UAAU,KAAK,WAAW,QAAQ;AAEpC,SAAO,EAAE,WAAW,sBAAsB,SAAA;AAC5C;"}
|
|
@@ -459,7 +459,9 @@ const image$1 = "Hình ảnh sản phẩm";
|
|
|
459
459
|
const no_image$1 = "Không có ảnh";
|
|
460
460
|
const name$1 = "Tên sản phẩm";
|
|
461
461
|
const code$1 = "Mã sản phẩm";
|
|
462
|
-
const price_vat$1 = "Giá";
|
|
462
|
+
const price_vat$1 = "Giá bán sau thuế";
|
|
463
|
+
const tax$1 = "Thuế VAT";
|
|
464
|
+
const price_without_vat$1 = "Giá bán trước thuế";
|
|
463
465
|
const category$1 = "Danh mục sản phẩm";
|
|
464
466
|
const unit$1 = "Đơn vị tính";
|
|
465
467
|
const not_available$1 = "Chưa có";
|
|
@@ -545,6 +547,8 @@ const BATCH_CREATE_PRODUCT_VI = {
|
|
|
545
547
|
name: name$1,
|
|
546
548
|
code: code$1,
|
|
547
549
|
price_vat: price_vat$1,
|
|
550
|
+
tax: tax$1,
|
|
551
|
+
price_without_vat: price_without_vat$1,
|
|
548
552
|
category: category$1,
|
|
549
553
|
unit: unit$1,
|
|
550
554
|
not_available: not_available$1,
|
|
@@ -630,7 +634,9 @@ const image = "Product Image";
|
|
|
630
634
|
const no_image = "No Image";
|
|
631
635
|
const name = "Product Name";
|
|
632
636
|
const code = "Product Code";
|
|
633
|
-
const price_vat = "Price";
|
|
637
|
+
const price_vat = "Price after tax";
|
|
638
|
+
const tax = "Tax VAT";
|
|
639
|
+
const price_without_vat = "Price before tax";
|
|
634
640
|
const category = "Category";
|
|
635
641
|
const unit = "Unit";
|
|
636
642
|
const not_available = "Not available";
|
|
@@ -716,6 +722,8 @@ const BATCH_CREATE_PRODUCT_EN = {
|
|
|
716
722
|
name,
|
|
717
723
|
code,
|
|
718
724
|
price_vat,
|
|
725
|
+
tax,
|
|
726
|
+
price_without_vat,
|
|
719
727
|
category,
|
|
720
728
|
unit,
|
|
721
729
|
not_available,
|
|
@@ -847,7 +855,9 @@ const reset$1 = "Khôi phục lại";
|
|
|
847
855
|
const systemFields$1 = [
|
|
848
856
|
"Mã sản phẩm",
|
|
849
857
|
"Tên sản phẩm",
|
|
850
|
-
"Giá",
|
|
858
|
+
"Giá bán trước thuế",
|
|
859
|
+
"Thuế VAT",
|
|
860
|
+
"Giá bán sau thuế",
|
|
851
861
|
"Đơn vị tính",
|
|
852
862
|
"Danh mục sản phẩm"
|
|
853
863
|
];
|
|
@@ -926,7 +936,9 @@ const reset = "Reset";
|
|
|
926
936
|
const systemFields = [
|
|
927
937
|
"Product Code",
|
|
928
938
|
"Product Name",
|
|
929
|
-
"Price",
|
|
939
|
+
"Price before tax",
|
|
940
|
+
"Tax (VAT)",
|
|
941
|
+
"Price after tax",
|
|
930
942
|
"Unit",
|
|
931
943
|
"Product Category"
|
|
932
944
|
];
|
|
@@ -1258,4 +1270,4 @@ const useTranslation = (defaultNs = "table", manualLanguage) => {
|
|
|
1258
1270
|
};
|
|
1259
1271
|
exports.translate = translate;
|
|
1260
1272
|
exports.useTranslation = useTranslation;
|
|
1261
|
-
//# sourceMappingURL=use-translation-
|
|
1273
|
+
//# sourceMappingURL=use-translation-T0TNDEqs.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-translation-
|
|
1
|
+
{"version":3,"file":"use-translation-T0TNDEqs.cjs","sources":["../src/utils/translations.ts","../src/hooks/use-translation.ts"],"sourcesContent":["import TABLE_VI from '@/assets/locales/vi/table.json';\nimport TABLE_EN from '@/assets/locales/en/table.json';\nimport FORM_VI from '@/assets/locales/vi/form.json';\nimport FORM_EN from '@/assets/locales/en/form.json';\nimport BATCH_CREATE_PRODUCT_VI from '@/assets/locales/vi/merchant-batch-create-form.json';\nimport BATCH_CREATE_PRODUCT_EN from '@/assets/locales/en/merchant-batch-create-form.json';\nimport COMMON_VI from '@/assets/locales/vi/common.json';\nimport COMMON_EN from '@/assets/locales/en/common.json';\nimport FILE_VI from '@/assets/locales/vi/file.json';\nimport FILE_VN from '@/assets/locales/en/file.json';\nimport DOWNLOAD_SAMPLE_VI from '@/assets/locales/vi/download-sample.json';\nimport DOWNLOAD_SAMPLE_EN from '@/assets/locales/en/download-sample.json';\nimport DIGISTORE_ID_VI from '@/assets/locales/vi/digistore-id.json';\nimport DIGISTORE_ID_EN from '@/assets/locales/en/digistore-id.json';\n\nexport const TRANSLATIONS = {\n vi: {\n common: COMMON_VI,\n table: TABLE_VI,\n form: FORM_VI,\n 'batch-create-product': BATCH_CREATE_PRODUCT_VI,\n file: FILE_VI,\n 'download-sample': DOWNLOAD_SAMPLE_VI,\n 'digistore-id': DIGISTORE_ID_VI\n },\n en: {\n common: COMMON_EN,\n table: TABLE_EN,\n form: FORM_EN,\n 'batch-create-product': BATCH_CREATE_PRODUCT_EN,\n file: FILE_VN,\n 'download-sample': DOWNLOAD_SAMPLE_EN,\n 'digistore-id': DIGISTORE_ID_EN\n },\n} as const;\n","import useExternalConfigStore from '@/shared/store/use-external-config.store';\nimport { TRANSLATIONS } from '../utils/translations';\n\nexport type Language = keyof typeof TRANSLATIONS;\ntype Namespace = keyof (typeof TRANSLATIONS)[Language];\n\ninterface UseTranslationReturn {\n translate: (key: string) => string;\n language?: Language;\n}\n\nexport const translate = (\n key: string,\n name_space: Namespace = 'table',\n language?: Language\n): string => {\n const lang = language || useExternalConfigStore.getState().language;\n\n const splitKey = key?.split(':');\n const [namespace, derivedKey] =\n splitKey.length > 1 ? splitKey : [name_space, key];\n\n const ns = namespace as Namespace;\n const translations = TRANSLATIONS[lang][ns] as any;\n const keys = derivedKey.split('.');\n let value: any = translations;\n for (const k of keys) {\n value = value?.[k];\n }\n\n return value ?? key;\n};\n\nexport const useTranslation = (\n defaultNs: Namespace = 'table',\n manualLanguage?: Language\n): UseTranslationReturn => {\n const language: Language =\n manualLanguage || useExternalConfigStore.getState().language;\n const translateWithDefault = (key: string) =>\n translate(key, defaultNs, language);\n\n return { translate: translateWithDefault, language };\n};\n"],"names":["useExternalConfigStore"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,WAAW,CAAC,YAAY,GAAG;AAEnD,QAAM,KAAK;AACX,QAAM,eAAe,aAAa,IAAI,EAAE,EAAE;AAC1C,QAAM,OAAO,WAAW,MAAM,GAAG;AACjC,MAAI,QAAa;AACjB,aAAW,KAAK,MAAM;AACpB,YAAQ,+BAAQ;AAAA,EAClB;AAEA,SAAO,wBAAS;AAClB;AAEO,MAAM,iBAAiB,CAC5B,YAAuB,SACvB,mBACyB;AACzB,QAAM,WACJ,kBAAkBA,+CAAuB,SAAA,EAAW;AACtD,QAAM,uBAAuB,CAAC,QAC5B,UAAU,KAAK,WAAW,QAAQ;AAEpC,SAAO,EAAE,WAAW,sBAAsB,SAAA;AAC5C;;;"}
|
|
@@ -142,6 +142,8 @@ export declare const TRANSLATIONS: {
|
|
|
142
142
|
name: string;
|
|
143
143
|
code: string;
|
|
144
144
|
price_vat: string;
|
|
145
|
+
tax: string;
|
|
146
|
+
price_without_vat: string;
|
|
145
147
|
category: string;
|
|
146
148
|
unit: string;
|
|
147
149
|
not_available: string;
|
|
@@ -484,6 +486,8 @@ export declare const TRANSLATIONS: {
|
|
|
484
486
|
name: string;
|
|
485
487
|
code: string;
|
|
486
488
|
price_vat: string;
|
|
489
|
+
tax: string;
|
|
490
|
+
price_without_vat: string;
|
|
487
491
|
category: string;
|
|
488
492
|
unit: string;
|
|
489
493
|
not_available: string;
|