@atomsolution/sdk-merchant 1.6.4 → 1.6.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.
- package/dist/batch-product-creation/types/product-info-preview.d.ts +3 -3
- package/dist/batch-product-creation.cjs +43 -12
- package/dist/batch-product-creation.cjs.map +1 -1
- package/dist/batch-product-creation.esm.js +43 -12
- package/dist/batch-product-creation.esm.js.map +1 -1
- package/dist/batch-product-creation.js +43 -12
- package/dist/batch-product-creation.js.map +1 -1
- package/dist/components/MerchantBatchCreateForm/modals/UpdateProductModal/index.d.ts +17 -0
- package/dist/digistore.cjs +1 -1
- package/dist/digistore.esm.js +1 -1
- package/dist/digistore.js +1 -1
- package/dist/{dropdownMenuAbsolute-Dwd-XAjy.cjs → dropdownMenuAbsolute-BYYjG2Li.cjs} +2 -2
- package/dist/{dropdownMenuAbsolute-Dwd-XAjy.cjs.map → dropdownMenuAbsolute-BYYjG2Li.cjs.map} +1 -1
- package/dist/{dropdownMenuAbsolute-CZJdH-DA.js → dropdownMenuAbsolute-jJMEt4nE.js} +2 -2
- package/dist/{dropdownMenuAbsolute-CZJdH-DA.js.map → dropdownMenuAbsolute-jJMEt4nE.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/{use-translation-CEsmTQjP.cjs → use-translation-CtS9Hvn9.cjs} +1 -2
- package/dist/{use-translation-CEsmTQjP.cjs.map → use-translation-CtS9Hvn9.cjs.map} +1 -1
- package/dist/{use-translation-IKmTNALv.js → use-translation-DN_PcKTS.js} +1 -2
- package/dist/{use-translation-IKmTNALv.js.map → use-translation-DN_PcKTS.js.map} +1 -1
- package/package.json +1 -1
|
@@ -11,8 +11,8 @@ export declare const ProductPreviewSchema: z.ZodObject<{
|
|
|
11
11
|
unitOfMesure: z.ZodOptional<z.ZodString>;
|
|
12
12
|
note: z.ZodOptional<z.ZodString>;
|
|
13
13
|
}, z.core.$strip>;
|
|
14
|
-
export declare const createProductPreviewSchema: (method: "direct" | "credit") => z.ZodObject<{
|
|
15
|
-
img: z.ZodUnion<[z.
|
|
14
|
+
export declare const createProductPreviewSchema: (t: (key: string) => string, method: "direct" | "credit") => z.ZodObject<{
|
|
15
|
+
img: z.ZodUnion<[z.ZodString, z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"">, z.ZodNull]>>]>;
|
|
16
16
|
name: z.ZodString;
|
|
17
17
|
unit: z.ZodString;
|
|
18
18
|
code: z.ZodString;
|
|
@@ -23,7 +23,7 @@ export declare const createProductPreviewSchema: (method: "direct" | "credit") =
|
|
|
23
23
|
unitOfMesure: z.ZodOptional<z.ZodString>;
|
|
24
24
|
note: z.ZodOptional<z.ZodString>;
|
|
25
25
|
}, z.core.$strip> | z.ZodObject<{
|
|
26
|
-
img: z.ZodUnion<[z.
|
|
26
|
+
img: z.ZodUnion<[z.ZodString, z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"">, z.ZodNull]>>]>;
|
|
27
27
|
name: z.ZodString;
|
|
28
28
|
unit: z.ZodString;
|
|
29
29
|
code: z.ZodString;
|
|
@@ -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-
|
|
73
|
+
const useTranslation = require("./use-translation-CtS9Hvn9.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
78
|
const useExternalConfig_store = require("./use-external-config.store-WVwivWvK.cjs");
|
|
79
|
-
const dropdownMenuAbsolute = require("./dropdownMenuAbsolute-
|
|
79
|
+
const dropdownMenuAbsolute = require("./dropdownMenuAbsolute-BYYjG2Li.cjs");
|
|
80
80
|
const ReactDOM = require("react-dom");
|
|
81
81
|
const index = require("./index-Ozgk-K52.cjs");
|
|
82
82
|
const axios = require("axios");
|
|
@@ -56204,13 +56204,41 @@ const ProductPreviewSchema = object({
|
|
|
56204
56204
|
unitOfMesure: string().optional(),
|
|
56205
56205
|
note: string().optional()
|
|
56206
56206
|
});
|
|
56207
|
-
const createProductPreviewSchema = (method) => {
|
|
56208
|
-
|
|
56209
|
-
|
|
56210
|
-
|
|
56211
|
-
|
|
56212
|
-
|
|
56207
|
+
const createProductPreviewSchema = (t2, method) => {
|
|
56208
|
+
const ProductPreviewSchema2 = object({
|
|
56209
|
+
img: string().url(t2("batch-create-product:img_invalid_url")).or(literal("").or(_null()).optional()),
|
|
56210
|
+
name: string(t2("batch-create-product:name_must_be_string")).min(1, t2("batch-create-product:name_required")).min(2, t2("batch-create-product:name_invalid")).max(50, t2("batch-create-product:name_invalid")).regex(/^[^<>:"/\\|?@#$%!]+$/, t2("batch-create-product:name_invalid")),
|
|
56211
|
+
unit: string(t2("batch-create-product:unit_must_be_string")).min(1, t2("batch-create-product:unit_required")).min(2, t2("batch-create-product:unit_invalid")).max(20, t2("batch-create-product:unit_invalid")).regex(/^[^<>:"/\\|?@#$%!,.]+$/, t2("batch-create-product:unit_invalid")),
|
|
56212
|
+
code: string(t2("batch-create-product:code_must_be_string")).min(1, t2("batch-create-product:code_required")).min(2, t2("batch-create-product:code_invalid")).max(20, t2("batch-create-product:code_invalid")).regex(/^[A-Za-z0-9\-_.]+$/, t2("batch-create-product:code_invalid")),
|
|
56213
|
+
priceBeforeTax: number({ error: () => "" }).optional(),
|
|
56214
|
+
tax: number({
|
|
56215
|
+
error: () => t2("batch-create-product:tax_invalid")
|
|
56216
|
+
}).refine((v) => TAX_VALUES.includes(v), {
|
|
56217
|
+
message: t2("batch-create-product:tax_invalid")
|
|
56218
|
+
}),
|
|
56219
|
+
priceAfterTax: number({
|
|
56220
|
+
error: (issue2) => {
|
|
56221
|
+
if (issue2.input === void 0 || issue2.input === null || issue2.input === "") {
|
|
56222
|
+
return t2("batch-create-product:price_required");
|
|
56223
|
+
}
|
|
56224
|
+
return t2("batch-create-product:price_invalid");
|
|
56225
|
+
}
|
|
56226
|
+
}).min(1e3, t2("batch-create-product:price_invalid")).int(t2("batch-create-product:price_invalid")),
|
|
56227
|
+
category: array(
|
|
56228
|
+
string(t2("batch-create-product:category_must_be_string")).min(2, t2("batch-create-product:category_invalid")).max(50, t2("batch-create-product:category_invalid")).regex(
|
|
56229
|
+
/^[^<>:"/\\|?*@#$%!]+$/,
|
|
56230
|
+
t2("batch-create-product:category_invalid")
|
|
56231
|
+
).trim().or(literal(""))
|
|
56232
|
+
),
|
|
56233
|
+
unitOfMesure: string().optional(),
|
|
56234
|
+
note: string().optional()
|
|
56213
56235
|
});
|
|
56236
|
+
if (method === "direct") {
|
|
56237
|
+
return ProductPreviewSchema2.extend({
|
|
56238
|
+
tax: any()
|
|
56239
|
+
});
|
|
56240
|
+
}
|
|
56241
|
+
return ProductPreviewSchema2;
|
|
56214
56242
|
};
|
|
56215
56243
|
object(__spreadProps(__spreadValues({}, ProductPreviewSchema.shape), {
|
|
56216
56244
|
id: string()
|
|
@@ -57501,7 +57529,8 @@ const UpdateProductModal = ({
|
|
|
57501
57529
|
taxDeductionMethod
|
|
57502
57530
|
}) => {
|
|
57503
57531
|
var _a, _b;
|
|
57504
|
-
const
|
|
57532
|
+
const { translate } = useTranslation.useTranslation("batch-create-product");
|
|
57533
|
+
const schema = createProductPreviewSchema(translate, taxDeductionMethod);
|
|
57505
57534
|
const {
|
|
57506
57535
|
register,
|
|
57507
57536
|
handleSubmit,
|
|
@@ -57519,7 +57548,6 @@ const UpdateProductModal = ({
|
|
|
57519
57548
|
const imgValue = watch("img");
|
|
57520
57549
|
const priceAfterTax = watch("priceAfterTax");
|
|
57521
57550
|
const tax = watch("tax");
|
|
57522
|
-
const { translate } = useTranslation.useTranslation("batch-create-product");
|
|
57523
57551
|
const handleFileUpload = (file) => __async(exports, null, function* () {
|
|
57524
57552
|
const uploaded = yield uploadImage(file);
|
|
57525
57553
|
if (uploaded == null ? void 0 : uploaded.error) {
|
|
@@ -57659,7 +57687,7 @@ const UpdateProductModal = ({
|
|
|
57659
57687
|
clearErrors("tax");
|
|
57660
57688
|
},
|
|
57661
57689
|
children: [
|
|
57662
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("option", { value: "", children: translate("select_tax") }),
|
|
57690
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("option", { value: "", hidden: true, children: translate("select_tax") }),
|
|
57663
57691
|
TAX_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("option", { value: opt.value, children: opt.label }, opt.value))
|
|
57664
57692
|
]
|
|
57665
57693
|
}
|
|
@@ -58000,7 +58028,10 @@ const ProductPreviewTable = ({
|
|
|
58000
58028
|
yield handleValidateProductsExist(resetErrorProducts);
|
|
58001
58029
|
const validated = resetErrorProducts.map((product) => {
|
|
58002
58030
|
let errors = "";
|
|
58003
|
-
const schema = createProductPreviewSchema(
|
|
58031
|
+
const schema = createProductPreviewSchema(
|
|
58032
|
+
translate,
|
|
58033
|
+
taxDeductionMethod
|
|
58034
|
+
);
|
|
58004
58035
|
const result = schema.safeParse(product);
|
|
58005
58036
|
if (!result.success) {
|
|
58006
58037
|
const fields = /* @__PURE__ */ new Set();
|