@invoice-sdk/widget 1.118.5 → 1.119.0
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/{index-BceUiawR.js → index-DenpejIA.js} +3 -3
- package/dist/{index-B8Y5gHlu.js → index-F-HfnKsx.js} +190 -187
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +32 -32
- package/dist/{loading-2ZdJld2F.js → loading-CpzNkc72.js} +2 -2
- package/dist/{widget-W9IrBGcj.js → widget-nsfT51qb.js} +2 -2
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ var ee = (r, t, e) => t in r ? re(r, t, { enumerable: !0, configurable: !0, writ
|
|
|
9
9
|
se.call(t, e) && ee(r, e, t[e]);
|
|
10
10
|
return r;
|
|
11
11
|
};
|
|
12
|
-
var j = (r, t, e) => new Promise((
|
|
12
|
+
var j = (r, t, e) => new Promise((n, d) => {
|
|
13
13
|
var s = (p) => {
|
|
14
14
|
try {
|
|
15
15
|
g(e.next(p));
|
|
@@ -22,43 +22,43 @@ var j = (r, t, e) => new Promise((i, d) => {
|
|
|
22
22
|
} catch (N) {
|
|
23
23
|
d(N);
|
|
24
24
|
}
|
|
25
|
-
}, g = (p) => p.done ?
|
|
25
|
+
}, g = (p) => p.done ? n(p.value) : Promise.resolve(p.value).then(s, a);
|
|
26
26
|
g((e = e.apply(r, t)).next());
|
|
27
27
|
});
|
|
28
|
-
import { c as G, f as te, e as oe, b as de, o as ne, s as le } from "./loading-
|
|
29
|
-
import { t as
|
|
28
|
+
import { c as G, f as te, e as oe, b as de, o as ne, s as le } from "./loading-CpzNkc72.js";
|
|
29
|
+
import { t as i, c as J, j as ce } from "./index-DenpejIA.js";
|
|
30
30
|
function z(r) {
|
|
31
31
|
const t = r.trim();
|
|
32
|
-
return t ? t.length < 2 || t.length > 250 ? { valid: !1, error:
|
|
32
|
+
return t ? t.length < 2 || t.length > 250 ? { valid: !1, error: i("length_2_250") } : /[<>:"\/\\|?*@#$%!^]/.test(t) ? { valid: !1, error: i("invalid_characters") } : { valid: !0 } : { valid: !1, error: i("required_name") };
|
|
33
33
|
}
|
|
34
34
|
function X(r, t = !1) {
|
|
35
35
|
const e = String(r != null ? r : "").trim();
|
|
36
|
-
return e ? e.length < 2 || e.length > 250 ? { valid: !1, error:
|
|
36
|
+
return e ? e.length < 2 || e.length > 250 ? { valid: !1, error: i("length_2_250") } : /[<>:"\\|?*@#$%!^]/.test(e) ? { valid: !1, error: i("invalid_characters") } : { valid: !0 } : t ? { valid: !1, error: i("required_address") } : { valid: !0 };
|
|
37
37
|
}
|
|
38
38
|
function K(r) {
|
|
39
39
|
const t = r.trim();
|
|
40
|
-
return t ? t.length < 6 || t.length > 254 ? { valid: !1, error:
|
|
40
|
+
return t ? t.length < 6 || t.length > 254 ? { valid: !1, error: i("email_length") } : /[<>:"\/\\|?*#$%!\s]/.test(t) ? { valid: !1, error: i("email_invalid_format") } : /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(t) ? t.includes("@@") ? { valid: !1, error: i("email_invalid_format") } : { valid: !0 } : { valid: !1, error: i("email_invalid_format") } : { valid: !1, error: i("required_email") };
|
|
41
41
|
}
|
|
42
42
|
function Y(r, t = !1) {
|
|
43
43
|
const e = r.trim();
|
|
44
44
|
if (!e)
|
|
45
|
-
return t ? { valid: !1, error:
|
|
46
|
-
const
|
|
47
|
-
if (/[<>:"\/\\|?*@#$%!A-Za-z]/.test(
|
|
48
|
-
return { valid: !1, error:
|
|
45
|
+
return t ? { valid: !1, error: i("required_phone") } : { valid: !0 };
|
|
46
|
+
const n = e.replace(/\s/g, "");
|
|
47
|
+
if (/[<>:"\/\\|?*@#$%!A-Za-z]/.test(n))
|
|
48
|
+
return { valid: !1, error: i("phone_invalid") };
|
|
49
49
|
const s = /^0\d{9}$/, a = /^\+84\d{9}$/;
|
|
50
|
-
return !s.test(
|
|
50
|
+
return !s.test(n) && !a.test(n) ? { valid: !1, error: i("phone_invalid_format") } : { valid: !0 };
|
|
51
51
|
}
|
|
52
52
|
function Q(r) {
|
|
53
53
|
const t = r.trim();
|
|
54
|
-
if (!t) return { valid: !1, error:
|
|
54
|
+
if (!t) return { valid: !1, error: i("required_tax_code") };
|
|
55
55
|
const e = t.replace(/\s/g, "");
|
|
56
56
|
if (/[<>:"\/\\|?*@#$%!A-Za-z\s]/.test(e))
|
|
57
|
-
return { valid: !1, error:
|
|
57
|
+
return { valid: !1, error: i("tax_code_invalid") };
|
|
58
58
|
if ((e.match(/-/g) || []).length > 1)
|
|
59
|
-
return { valid: !1, error:
|
|
59
|
+
return { valid: !1, error: i("tax_code_invalid_format") };
|
|
60
60
|
const s = /^\d{10}$/, a = /^\d{10}-\d{3}$/;
|
|
61
|
-
return !s.test(e) && !a.test(e) ? { valid: !1, error:
|
|
61
|
+
return !s.test(e) && !a.test(e) ? { valid: !1, error: i("tax_code_invalid_format") } : { valid: !0 };
|
|
62
62
|
}
|
|
63
63
|
function pe({ defaultValues: r = {}, onChange: t } = {}) {
|
|
64
64
|
const e = {
|
|
@@ -66,18 +66,18 @@ function pe({ defaultValues: r = {}, onChange: t } = {}) {
|
|
|
66
66
|
buyerAddress: r.buyerAddress || "",
|
|
67
67
|
email: r.email || "",
|
|
68
68
|
phone: r.phone || ""
|
|
69
|
-
},
|
|
70
|
-
|
|
69
|
+
}, n = document.createElement("div");
|
|
70
|
+
n.className = "wgt:space-y-2";
|
|
71
71
|
function d() {
|
|
72
72
|
typeof t == "function" && t($({}, e));
|
|
73
73
|
}
|
|
74
|
-
function s({ label: v, required: E, name: H, type:
|
|
74
|
+
function s({ label: v, required: E, name: H, type: B = "text", placeholder: b }) {
|
|
75
75
|
const A = document.createElement("div");
|
|
76
76
|
A.className = "";
|
|
77
77
|
const _ = document.createElement("label");
|
|
78
78
|
_.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950", _.htmlFor = H, _.innerHTML = E ? `${v} <span class="wgt:text-semantic-error wgt:text-[#ED1C24]">*</span>` : v;
|
|
79
79
|
const m = document.createElement("input");
|
|
80
|
-
m.id = H, m.name = H, m.type =
|
|
80
|
+
m.id = H, m.name = H, m.type = B, m.placeholder = b || "", m.className = "wgt:w-full wgt:rounded-lg wgt:border wgt:border-[#E4E7EC] wgt:mt-2 wgt:bg-white wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:text-strong-950 focus:wgt:outline-none focus:wgt:border-primary focus:wgt:ring-1 focus:wgt:ring-primary", m.value = e[H] || "";
|
|
81
81
|
const T = document.createElement("div");
|
|
82
82
|
return T.className = "wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden", T.setAttribute("data-error-for", H), m.addEventListener("input", () => {
|
|
83
83
|
e[H] = m.value, m.classList.remove(
|
|
@@ -113,38 +113,38 @@ function pe({ defaultValues: r = {}, onChange: t } = {}) {
|
|
|
113
113
|
input: g,
|
|
114
114
|
errorEl: p
|
|
115
115
|
} = s({
|
|
116
|
-
label:
|
|
116
|
+
label: i("representativeName"),
|
|
117
117
|
required: !0,
|
|
118
118
|
name: "representativeName",
|
|
119
|
-
placeholder:
|
|
119
|
+
placeholder: i("representativeName_input")
|
|
120
120
|
}), { field: N, errorEl: k } = s({
|
|
121
|
-
label:
|
|
121
|
+
label: i("buyerAddress"),
|
|
122
122
|
required: !1,
|
|
123
123
|
name: "buyerAddress",
|
|
124
|
-
placeholder:
|
|
124
|
+
placeholder: i("buyerAddress_input")
|
|
125
125
|
}), {
|
|
126
126
|
field: F,
|
|
127
127
|
input: M,
|
|
128
128
|
errorEl: l
|
|
129
129
|
} = s({
|
|
130
|
-
label:
|
|
130
|
+
label: i("email"),
|
|
131
131
|
required: !0,
|
|
132
132
|
name: "email",
|
|
133
133
|
type: "email",
|
|
134
|
-
placeholder:
|
|
134
|
+
placeholder: i("email_input")
|
|
135
135
|
}), {
|
|
136
136
|
field: x,
|
|
137
137
|
input: o,
|
|
138
138
|
errorEl: u
|
|
139
139
|
} = s({
|
|
140
|
-
label:
|
|
140
|
+
label: i("phone"),
|
|
141
141
|
required: !1,
|
|
142
142
|
name: "phone",
|
|
143
143
|
type: "tel",
|
|
144
|
-
placeholder:
|
|
144
|
+
placeholder: i("phone_input")
|
|
145
145
|
});
|
|
146
|
-
|
|
147
|
-
function
|
|
146
|
+
n.appendChild(a), n.appendChild(N), n.appendChild(F), n.appendChild(x);
|
|
147
|
+
function f() {
|
|
148
148
|
let v = !0;
|
|
149
149
|
function E(b, A, _) {
|
|
150
150
|
b.classList.add(
|
|
@@ -161,8 +161,8 @@ function pe({ defaultValues: r = {}, onChange: t } = {}) {
|
|
|
161
161
|
b.error
|
|
162
162
|
);
|
|
163
163
|
}
|
|
164
|
-
const
|
|
165
|
-
if (
|
|
164
|
+
const B = K(e.email);
|
|
165
|
+
if (B.valid || E(M, l, B.error), e.phone.trim()) {
|
|
166
166
|
const b = Y(e.phone, !1);
|
|
167
167
|
b.valid || E(o, u, b.error);
|
|
168
168
|
}
|
|
@@ -171,14 +171,14 @@ function pe({ defaultValues: r = {}, onChange: t } = {}) {
|
|
|
171
171
|
function c() {
|
|
172
172
|
return $({}, e);
|
|
173
173
|
}
|
|
174
|
-
return { container:
|
|
174
|
+
return { container: n, getValues: c, validate: f };
|
|
175
175
|
}
|
|
176
176
|
function ge({
|
|
177
177
|
defaultValues: r = {},
|
|
178
178
|
onChange: t,
|
|
179
179
|
onFetchByTaxCode: e
|
|
180
180
|
} = {}) {
|
|
181
|
-
const
|
|
181
|
+
const n = {
|
|
182
182
|
noTaxCode: !!r.noTaxCode,
|
|
183
183
|
taxCode: r.taxCode || "",
|
|
184
184
|
businessName: r.businessName || "",
|
|
@@ -190,25 +190,25 @@ function ge({
|
|
|
190
190
|
}, d = document.createElement("div");
|
|
191
191
|
d.className = "wgt:space-y-2";
|
|
192
192
|
function s() {
|
|
193
|
-
typeof t == "function" && t($({},
|
|
193
|
+
typeof t == "function" && t($({}, n));
|
|
194
194
|
}
|
|
195
|
-
function a({ label: C, required: L, name:
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
|
|
195
|
+
function a({ label: C, required: L, name: h, type: W = "text", placeholder: I }) {
|
|
196
|
+
const Z = document.createElement("div");
|
|
197
|
+
Z.className = "";
|
|
198
|
+
const q = document.createElement("label");
|
|
199
|
+
q.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950", q.htmlFor = h, q.innerHTML = L ? `${C} <span class="wgt:text-[#ED1C24]">*</span>` : C;
|
|
200
200
|
const y = document.createElement("input");
|
|
201
|
-
y.id =
|
|
202
|
-
const
|
|
203
|
-
return
|
|
204
|
-
|
|
201
|
+
y.id = h, y.name = h, y.type = W, y.placeholder = I || "", y.className = "wgt:w-full wgt:rounded-lg wgt:border wgt:border-[#E4E7EC] wgt:mt-2 wgt:bg-white wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:text-strong-950 focus:wgt:outline-none focus:wgt:border-primary focus:wgt:ring-1 focus:wgt:ring-primary", y.value = n[h] || "";
|
|
202
|
+
const O = document.createElement("div");
|
|
203
|
+
return O.className = "wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden", O.setAttribute("data-error-for", h), y.addEventListener("input", () => {
|
|
204
|
+
n[h] = y.value, y.classList.remove(
|
|
205
205
|
"wgt:border-semantic-error",
|
|
206
206
|
"wgt:bg-semantic-error-50"
|
|
207
|
-
),
|
|
207
|
+
), O.classList.add("wgt:hidden"), s();
|
|
208
208
|
}), y.addEventListener("blur", () => {
|
|
209
209
|
if (!y.value.trim() && !L) return;
|
|
210
210
|
let U;
|
|
211
|
-
switch (
|
|
211
|
+
switch (h) {
|
|
212
212
|
case "businesName":
|
|
213
213
|
case "representativeName":
|
|
214
214
|
U = z(y.value);
|
|
@@ -228,16 +228,16 @@ function ge({
|
|
|
228
228
|
!U.valid && U.error && (y.classList.add(
|
|
229
229
|
"wgt:border-semantic-error",
|
|
230
230
|
"wgt:bg-semantic-error-50"
|
|
231
|
-
),
|
|
232
|
-
}),
|
|
231
|
+
), O.textContent = U.error, O.classList.remove("wgt:hidden"));
|
|
232
|
+
}), Z.appendChild(q), Z.appendChild(y), Z.appendChild(O), { field: Z, input: y, errorEl: O };
|
|
233
233
|
}
|
|
234
234
|
const g = document.createElement("label");
|
|
235
235
|
g.className = "wgt:flex wgt:items-center wgt:gap-2 wgt:font-medium wgt:text-strong-950 wgt:text-sm";
|
|
236
236
|
const p = document.createElement("input");
|
|
237
|
-
p.type = "checkbox", p.className = "wgt:h-4 wgt:w-4 wgt:rounded wgt:border-[#E4E7EC] focus:wgt:outline-none focus:wgt:ring-primary", p.checked =
|
|
237
|
+
p.type = "checkbox", p.className = "wgt:h-4 wgt:w-4 wgt:rounded wgt:border-[#E4E7EC] focus:wgt:outline-none focus:wgt:ring-primary", p.checked = n.noTaxCode;
|
|
238
238
|
const N = document.createElement("span");
|
|
239
|
-
N.textContent =
|
|
240
|
-
|
|
239
|
+
N.textContent = i("business_noTaxCode"), N.className = "wgt:italic wgt:font-normal wgt:text-[14px] wgt:leading-[20px] wgt:tracking-[0px] wgt:align-middle wgt:text-[#525866]", N.style.fontFamily = "Inter, sans-serif", p.addEventListener("change", () => {
|
|
240
|
+
n.noTaxCode = p.checked, l.disabled = n.noTaxCode, o.disabled = n.noTaxCode, l.classList.remove(
|
|
241
241
|
"wgt:border-semantic-error",
|
|
242
242
|
"wgt:bg-semantic-error-50"
|
|
243
243
|
), x.classList.add("wgt:hidden"), s();
|
|
@@ -245,19 +245,19 @@ function ge({
|
|
|
245
245
|
const k = document.createElement("div");
|
|
246
246
|
k.className = "wgt:space-y-2";
|
|
247
247
|
const F = document.createElement("label");
|
|
248
|
-
F.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950 ", F.innerHTML =
|
|
248
|
+
F.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950 ", F.innerHTML = i("confirmation_popup_taxCode") + '<span class="wgt:text-[#ED1C24]">*</span>';
|
|
249
249
|
const M = document.createElement("div");
|
|
250
250
|
M.className = "wgt:flex wgt:gap-2 wgt:mt-2";
|
|
251
251
|
const l = document.createElement("input");
|
|
252
|
-
l.type = "text", l.name = "taxCode", l.placeholder =
|
|
252
|
+
l.type = "text", l.name = "taxCode", l.placeholder = i("taxCode_input"), l.value = n.taxCode, l.className = "wgt:flex-1 wgt:rounded-lg wgt:border wgt:border-[#E4E7EC] wgt:bg-white wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:text-strong-950 focus:wgt:outline-none focus:wgt:border-primary focus:wgt:ring-1 focus:wgt:ring-primary";
|
|
253
253
|
const x = document.createElement("div");
|
|
254
254
|
x.className = "wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden", l.addEventListener("input", () => {
|
|
255
|
-
|
|
255
|
+
n.taxCode = l.value, l.classList.remove(
|
|
256
256
|
"wgt:border-semantic-error",
|
|
257
257
|
"wgt:bg-semantic-error-50"
|
|
258
258
|
), x.classList.add("wgt:hidden"), s();
|
|
259
259
|
}), l.addEventListener("blur", () => {
|
|
260
|
-
if (
|
|
260
|
+
if (n.noTaxCode || !l.value.trim()) return;
|
|
261
261
|
const C = Q(l.value);
|
|
262
262
|
C.valid || (l.classList.add(
|
|
263
263
|
"wgt:border-semantic-error",
|
|
@@ -266,12 +266,12 @@ function ge({
|
|
|
266
266
|
});
|
|
267
267
|
const o = G({
|
|
268
268
|
type: "button",
|
|
269
|
-
title:
|
|
269
|
+
title: i("fetch_info"),
|
|
270
270
|
className: "wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:font-semibold wgt:rounded-lg wgt:flex-shrink-0 wgt:text-primary wgt:bg-white wgt:border wgt:border-primary",
|
|
271
271
|
handleClick: () => j(null, null, function* () {
|
|
272
|
-
if (
|
|
272
|
+
if (n.noTaxCode || typeof e != "function")
|
|
273
273
|
return;
|
|
274
|
-
const C = String(
|
|
274
|
+
const C = String(n.taxCode || "").trim();
|
|
275
275
|
if (!C) {
|
|
276
276
|
l.classList.add(
|
|
277
277
|
"wgt:border-semantic-error",
|
|
@@ -289,104 +289,106 @@ function ge({
|
|
|
289
289
|
}
|
|
290
290
|
try {
|
|
291
291
|
o.disabled = !0;
|
|
292
|
-
const
|
|
293
|
-
if (!
|
|
294
|
-
f.representativeName != null && (
|
|
295
|
-
} catch (
|
|
292
|
+
const h = yield e(C, $({}, n));
|
|
293
|
+
if (!h || typeof h != "object") return;
|
|
294
|
+
h.businessName != null && (n.businessName = String(h.businessName || ""), f.value = n.businessName), h.representativeName != null && (n.representativeName = String(h.representativeName || ""), E.value = n.representativeName), h.buyerAddress != null && (n.buyerAddress = String(h.buyerAddress || ""), b.value = n.buyerAddress), s();
|
|
295
|
+
} catch (h) {
|
|
296
296
|
l.classList.add(
|
|
297
297
|
"wgt:border-semantic-error",
|
|
298
298
|
"wgt:bg-semantic-error-50"
|
|
299
299
|
), x.textContent = "Không tìm thấy thông tin MST", x.classList.remove("wgt:hidden");
|
|
300
300
|
} finally {
|
|
301
|
-
o.disabled =
|
|
301
|
+
o.disabled = n.noTaxCode;
|
|
302
302
|
}
|
|
303
303
|
})
|
|
304
304
|
});
|
|
305
305
|
M.appendChild(l), M.appendChild(o), k.appendChild(F), k.appendChild(M), k.appendChild(x);
|
|
306
306
|
const {
|
|
307
307
|
field: u,
|
|
308
|
-
input:
|
|
308
|
+
input: f,
|
|
309
309
|
errorEl: c
|
|
310
310
|
} = a({
|
|
311
|
-
label:
|
|
311
|
+
label: i("businessName"),
|
|
312
312
|
required: !0,
|
|
313
313
|
name: "businessName",
|
|
314
|
-
placeholder:
|
|
314
|
+
placeholder: i("businessName_input")
|
|
315
315
|
}), {
|
|
316
316
|
field: v,
|
|
317
317
|
input: E,
|
|
318
318
|
errorEl: H
|
|
319
319
|
} = a({
|
|
320
|
-
label:
|
|
320
|
+
label: i("representativeName"),
|
|
321
321
|
required: !0,
|
|
322
322
|
name: "representativeName",
|
|
323
|
-
placeholder:
|
|
323
|
+
placeholder: i("representativeName_input")
|
|
324
324
|
}), {
|
|
325
|
-
field:
|
|
325
|
+
field: B,
|
|
326
326
|
input: b,
|
|
327
327
|
errorEl: A
|
|
328
328
|
} = a({
|
|
329
|
-
label:
|
|
329
|
+
label: i("buyerAddress"),
|
|
330
330
|
required: !1,
|
|
331
331
|
name: "buyerAddress",
|
|
332
|
-
placeholder:
|
|
332
|
+
placeholder: i("buyerAddress_input")
|
|
333
333
|
}), {
|
|
334
334
|
field: _,
|
|
335
335
|
input: m,
|
|
336
336
|
errorEl: T
|
|
337
337
|
} = a({
|
|
338
|
-
label:
|
|
338
|
+
label: i("email"),
|
|
339
339
|
required: !0,
|
|
340
340
|
name: "email",
|
|
341
341
|
type: "email",
|
|
342
|
-
placeholder:
|
|
342
|
+
placeholder: i("email_input")
|
|
343
343
|
}), {
|
|
344
344
|
field: w,
|
|
345
345
|
input: V,
|
|
346
346
|
errorEl: S
|
|
347
347
|
} = a({
|
|
348
|
-
label:
|
|
349
|
-
required: !
|
|
348
|
+
label: i("phone"),
|
|
349
|
+
required: !1,
|
|
350
350
|
name: "phone",
|
|
351
351
|
type: "tel",
|
|
352
|
-
placeholder:
|
|
352
|
+
placeholder: i("phone_input")
|
|
353
353
|
});
|
|
354
|
-
d.appendChild(g), d.appendChild(k), d.appendChild(u), d.appendChild(v), d.appendChild(
|
|
355
|
-
function
|
|
354
|
+
d.appendChild(g), d.appendChild(k), d.appendChild(u), d.appendChild(v), d.appendChild(B), d.appendChild(_), d.appendChild(w), l.disabled = n.noTaxCode, o.disabled = n.noTaxCode;
|
|
355
|
+
function P() {
|
|
356
356
|
let C = !0;
|
|
357
|
-
function L(
|
|
358
|
-
|
|
357
|
+
function L(Z, q, y) {
|
|
358
|
+
Z.classList.add(
|
|
359
359
|
"wgt:border-semantic-error",
|
|
360
360
|
"wgt:bg-semantic-error-50",
|
|
361
361
|
"wgt:mt-2"
|
|
362
|
-
),
|
|
362
|
+
), y && q && (q.textContent = y, q.classList.remove("wgt:hidden")), C = !1;
|
|
363
|
+
}
|
|
364
|
+
if (!n.noTaxCode) {
|
|
365
|
+
const Z = Q(n.taxCode);
|
|
366
|
+
Z.valid || L(l, x, Z.error);
|
|
363
367
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
368
|
+
const h = z(n.businessName);
|
|
369
|
+
h.valid || L(f, c, h.error);
|
|
370
|
+
const W = z(n.representativeName);
|
|
371
|
+
if (W.valid || L(E, H, W.error), n.buyerAddress.trim()) {
|
|
372
|
+
const Z = X(n.buyerAddress);
|
|
373
|
+
Z.valid || L(b, A, Z.error);
|
|
367
374
|
}
|
|
368
|
-
const
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
const P = X(i.buyerAddress);
|
|
373
|
-
P.valid || L(b, A, P.error);
|
|
375
|
+
const I = K(n.email);
|
|
376
|
+
if (I.valid || L(m, T, I.error), n.phone.trim()) {
|
|
377
|
+
const Z = Y(n.phone, !0);
|
|
378
|
+
Z.valid || L(V, S, Z.error);
|
|
374
379
|
}
|
|
375
|
-
|
|
376
|
-
I.valid || L(m, T, I.error);
|
|
377
|
-
const O = Y(i.phone, !0);
|
|
378
|
-
return O.valid || L(V, S, O.error), C;
|
|
380
|
+
return C;
|
|
379
381
|
}
|
|
380
|
-
function
|
|
381
|
-
return $({},
|
|
382
|
+
function R() {
|
|
383
|
+
return $({}, n);
|
|
382
384
|
}
|
|
383
|
-
return { container: d, getValues:
|
|
385
|
+
return { container: d, getValues: R, validate: P };
|
|
384
386
|
}
|
|
385
387
|
function me({
|
|
386
388
|
type: r,
|
|
387
389
|
data: t,
|
|
388
390
|
orderInfo: e,
|
|
389
|
-
theme:
|
|
391
|
+
theme: n,
|
|
390
392
|
onClose: d,
|
|
391
393
|
onConfirm: s
|
|
392
394
|
}) {
|
|
@@ -394,15 +396,15 @@ function me({
|
|
|
394
396
|
a.className = "wgt:fixed wgt:inset-0 wgt:flex wgt:items-center wgt:justify-center wgt:z-50 wgt:p-4", a.style.cssText = `
|
|
395
397
|
background-color: rgba(0, 0, 0, 0.5);
|
|
396
398
|
backdrop-filter: blur(4px);
|
|
397
|
-
`,
|
|
399
|
+
`, n && a.setAttribute("data-theme", n);
|
|
398
400
|
const g = document.createElement("div");
|
|
399
401
|
g.className = "wgt:w-full wgt:max-w-md wgt:bg-white wgt:rounded-2xl wgt:shadow-xl wgt:max-h-[90vh] wgt:overflow-y-auto";
|
|
400
402
|
const p = document.createElement("div");
|
|
401
403
|
p.className = "wgt:px-6 wgt:pt-6 wgt:pb-4 wgt:space-y-2";
|
|
402
404
|
const N = document.createElement("h3");
|
|
403
|
-
N.className = "wgt:text-xl wgt:font-semibold wgt:text-center wgt:text-strong-950", N.textContent =
|
|
405
|
+
N.className = "wgt:text-xl wgt:font-semibold wgt:text-center wgt:text-strong-950", N.textContent = i("confirmation_popup_title");
|
|
404
406
|
const k = document.createElement("p");
|
|
405
|
-
k.className = "wgt:text-sm wgt:text-center wgt:text-[#525866]", k.textContent =
|
|
407
|
+
k.className = "wgt:text-sm wgt:text-center wgt:text-[#525866]", k.textContent = i("confirmation_popup_subtitle"), p.appendChild(N), p.appendChild(k), g.appendChild(p);
|
|
406
408
|
const F = document.createElement("div");
|
|
407
409
|
F.className = "wgt:px-6 wgt:pb-4";
|
|
408
410
|
const M = document.createElement("div");
|
|
@@ -423,24 +425,24 @@ function me({
|
|
|
423
425
|
M.appendChild(
|
|
424
426
|
l(
|
|
425
427
|
x,
|
|
426
|
-
|
|
428
|
+
i("confirmation_popup_orderCode"),
|
|
427
429
|
e == null ? void 0 : e.billNo
|
|
428
430
|
)
|
|
429
431
|
), M.appendChild(
|
|
430
432
|
l(
|
|
431
433
|
o,
|
|
432
|
-
|
|
434
|
+
i("confirmation_popup_address"),
|
|
433
435
|
e == null ? void 0 : e.merchantAddress
|
|
434
436
|
)
|
|
435
437
|
), M.appendChild(
|
|
436
438
|
l(
|
|
437
439
|
u,
|
|
438
|
-
|
|
440
|
+
i("confirmation_popup_totalAmount"),
|
|
439
441
|
te(e == null ? void 0 : e.amount) + " VND"
|
|
440
442
|
)
|
|
441
443
|
), F.appendChild(M), g.appendChild(F);
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
+
const f = document.createElement("div");
|
|
445
|
+
f.className = "wgt:px-6 wgt:pb-6";
|
|
444
446
|
const c = document.createElement("div");
|
|
445
447
|
c.className = "wgt:space-y-3 wgt:rounded-xl wgt:border wgt:border-[#E1E4EA] wgt:px-4 wgt:py-4";
|
|
446
448
|
function v(b, A) {
|
|
@@ -452,30 +454,30 @@ function me({
|
|
|
452
454
|
return T.className = "wgt:text-sm wgt:font-semibold wgt:text-strong-950 wgt:text-right wgt:w-2/3", T.textContent = A || "-", _.appendChild(m), _.appendChild(T), _;
|
|
453
455
|
}
|
|
454
456
|
r === "business" ? (c.appendChild(
|
|
455
|
-
v(
|
|
457
|
+
v(i("confirmation_popup_taxCode"), t.taxCode)
|
|
456
458
|
), c.appendChild(
|
|
457
|
-
v(
|
|
459
|
+
v(i("businessName"), t.businessName)
|
|
458
460
|
), c.appendChild(
|
|
459
461
|
v(
|
|
460
|
-
|
|
462
|
+
i("confirmation_popup_representativeName"),
|
|
461
463
|
t.representativeName
|
|
462
464
|
)
|
|
463
465
|
), c.appendChild(
|
|
464
|
-
v(
|
|
466
|
+
v(i("confirmation_popup_buyerAddress"), t.buyerAddress)
|
|
465
467
|
), c.appendChild(
|
|
466
|
-
v(
|
|
468
|
+
v(i("confirmation_popup_email"), t.email)
|
|
467
469
|
), c.appendChild(
|
|
468
|
-
v(
|
|
470
|
+
v(i("confirmation_popup_phone"), t.phone)
|
|
469
471
|
)) : (c.appendChild(
|
|
470
472
|
v(
|
|
471
|
-
|
|
473
|
+
i("confirmation_popup_representativeName"),
|
|
472
474
|
t.representativeName
|
|
473
475
|
)
|
|
474
476
|
), c.appendChild(
|
|
475
|
-
v(
|
|
477
|
+
v(i("confirmation_popup_buyerAddress"), t.buyerAddress)
|
|
476
478
|
), c.appendChild(
|
|
477
|
-
v(
|
|
478
|
-
)),
|
|
479
|
+
v(i("confirmation_popup_email"), t.email)
|
|
480
|
+
)), f.appendChild(c), g.appendChild(f);
|
|
479
481
|
const E = document.createElement("div");
|
|
480
482
|
E.className = "wgt:px-6 wgt:pb-6 wgt:flex wgt:gap-3";
|
|
481
483
|
const H = G({
|
|
@@ -485,7 +487,7 @@ function me({
|
|
|
485
487
|
handleClick: () => {
|
|
486
488
|
typeof d == "function" && d(), a.remove();
|
|
487
489
|
}
|
|
488
|
-
}),
|
|
490
|
+
}), B = G({
|
|
489
491
|
type: "button",
|
|
490
492
|
title: "Xác nhận",
|
|
491
493
|
className: "wgt:flex-1 wgt:py-3 wgt:text-sm wgt:font-semibold wgt:rounded-[8px] wgt:bg-primary wgt:text-white",
|
|
@@ -493,7 +495,7 @@ function me({
|
|
|
493
495
|
typeof s == "function" && s({ type: r, data: t }), a.remove();
|
|
494
496
|
}
|
|
495
497
|
});
|
|
496
|
-
return E.appendChild(H), E.appendChild(
|
|
498
|
+
return E.appendChild(H), E.appendChild(B), g.appendChild(E), a.appendChild(g), a.addEventListener("click", (b) => {
|
|
497
499
|
b.target === a && (typeof d == "function" && d(), a.remove());
|
|
498
500
|
}), { overlay: a };
|
|
499
501
|
}
|
|
@@ -501,7 +503,7 @@ function ue({
|
|
|
501
503
|
orderInfo: r,
|
|
502
504
|
onPreview: t,
|
|
503
505
|
theme: e,
|
|
504
|
-
onSubmit:
|
|
506
|
+
onSubmit: n,
|
|
505
507
|
taxCode: d = ""
|
|
506
508
|
}) {
|
|
507
509
|
const s = document.createElement("div");
|
|
@@ -517,45 +519,45 @@ function ue({
|
|
|
517
519
|
const k = document.createElement("div");
|
|
518
520
|
k.className = "wgt:space-y-1";
|
|
519
521
|
const F = document.createElement("h3");
|
|
520
|
-
F.className = "wgt:text-2xl wgt:font-semibold wgt:text-text-black wgt:text-center wgt:justify-center", F.textContent =
|
|
522
|
+
F.className = "wgt:text-2xl wgt:font-semibold wgt:text-text-black wgt:text-center wgt:justify-center", F.textContent = i("invoiceform_title");
|
|
521
523
|
const M = document.createElement("p");
|
|
522
|
-
M.className = "wgt:text-sm wgt:text-weak-700 wgt:text-center wgt:justify-center", M.textContent =
|
|
524
|
+
M.className = "wgt:text-sm wgt:text-weak-700 wgt:text-center wgt:justify-center", M.textContent = i("invoiceform_subtitle"), k.appendChild(F), k.appendChild(M), a.appendChild(k);
|
|
523
525
|
const l = document.createElement("div");
|
|
524
526
|
l.className = "wgt:mt-2 wgt:space-y-3 wgt:rounded-xl wgt:bg-weak-50 wgt:px-6 wgt:py-6";
|
|
525
527
|
function x(w, V) {
|
|
526
528
|
const S = document.createElement("div");
|
|
527
529
|
S.className = "wgt:flex wgt:items-start";
|
|
528
|
-
const
|
|
529
|
-
|
|
530
|
-
const
|
|
531
|
-
|
|
530
|
+
const P = document.createElement("div");
|
|
531
|
+
P.className = "wgt:flex wgt:items-center wgt:gap-2 wgt:w-1/3";
|
|
532
|
+
const R = document.createElement("span");
|
|
533
|
+
R.className = "wgt:inline-flex wgt:items-center wgt:justify-center wgt:w-4 wgt:h-4 wgt:text-icon-primary";
|
|
532
534
|
let C = "";
|
|
533
|
-
w ===
|
|
535
|
+
w === i("orderCode") ? C = `
|
|
534
536
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
535
537
|
<path d="M12.7996 14H3.19961C3.04048 14 2.88787 13.9368 2.77535 13.8243C2.66282 13.7117 2.59961 13.5591 2.59961 13.4V2.6C2.59961 2.44087 2.66282 2.28826 2.77535 2.17574C2.88787 2.06321 3.04048 2 3.19961 2H12.7996C12.9587 2 13.1114 2.06321 13.2239 2.17574C13.3364 2.28826 13.3996 2.44087 13.3996 2.6V13.4C13.3996 13.5591 13.3364 13.7117 13.2239 13.8243C13.1114 13.9368 12.9587 14 12.7996 14ZM12.1996 12.8V3.2H3.79961V12.8H12.1996ZM5.59961 6.2H10.3996V7.4H5.59961V6.2ZM5.59961 8.6H10.3996V9.8H5.59961V8.6Z" fill="currentColor"/>
|
|
536
538
|
</svg>
|
|
537
539
|
|
|
538
|
-
` : w ===
|
|
540
|
+
` : w === i("address_form") ? C = `
|
|
539
541
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
540
542
|
<path d="M7.99961 13.34L10.9696 10.37C11.557 9.78256 11.9569 9.03419 12.1189 8.21948C12.281 7.40477 12.1978 6.56031 11.8799 5.79289C11.562 5.02546 11.0236 4.36954 10.333 3.90805C9.64229 3.44657 8.83028 3.20026 7.99961 3.20026C7.16895 3.20026 6.35694 3.44657 5.66626 3.90805C4.97558 4.36954 4.43726 5.02546 4.11936 5.79289C3.80146 6.56031 3.71826 7.40477 3.88028 8.21948C4.04231 9.03419 4.44227 9.78256 5.02961 10.37L7.99961 13.34ZM7.99961 15.0368L4.18121 11.2184C3.42602 10.4631 2.91172 9.50096 2.70337 8.45346C2.49501 7.40597 2.60195 6.32021 3.01067 5.33349C3.41938 4.34678 4.11152 3.50342 4.99954 2.91006C5.88756 2.3167 6.9316 2 7.99961 2C9.06763 2 10.1117 2.3167 10.9997 2.91006C11.8877 3.50342 12.5798 4.34678 12.9886 5.33349C13.3973 6.32021 13.5042 7.40597 13.2959 8.45346C13.0875 9.50096 12.5732 10.4631 11.818 11.2184L7.99961 15.0368ZM7.99961 8.59995C8.31787 8.59995 8.6231 8.47353 8.84814 8.24848C9.07318 8.02344 9.19961 7.71821 9.19961 7.39995C9.19961 7.08169 9.07318 6.77647 8.84814 6.55143C8.6231 6.32638 8.31787 6.19995 7.99961 6.19995C7.68135 6.19995 7.37613 6.32638 7.15108 6.55143C6.92604 6.77647 6.79961 7.08169 6.79961 7.39995C6.79961 7.71821 6.92604 8.02344 7.15108 8.24848C7.37613 8.47353 7.68135 8.59995 7.99961 8.59995ZM7.99961 9.79995C7.36309 9.79995 6.75264 9.5471 6.30256 9.09701C5.85247 8.64692 5.59961 8.03647 5.59961 7.39995C5.59961 6.76343 5.85247 6.15298 6.30256 5.7029C6.75264 5.25281 7.36309 4.99995 7.99961 4.99995C8.63613 4.99995 9.24658 5.25281 9.69667 5.7029C10.1468 6.15298 10.3996 6.76343 10.3996 7.39995C10.3996 8.03647 10.1468 8.64692 9.69667 9.09701C9.24658 9.5471 8.63613 9.79995 7.99961 9.79995Z" fill="currentColor"/>
|
|
541
543
|
</svg>
|
|
542
544
|
|
|
543
|
-
` : w ===
|
|
545
|
+
` : w === i("total_amount") && (C = `
|
|
544
546
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
545
547
|
<path d="M8 14C4.6862 14 2 11.3138 2 8C2 4.6862 4.6862 2 8 2C11.3138 2 14 4.6862 14 8C14 11.3138 11.3138 14 8 14ZM8 12.8C9.27304 12.8 10.4939 12.2943 11.3941 11.3941C12.2943 10.4939 12.8 9.27304 12.8 8C12.8 6.72696 12.2943 5.50606 11.3941 4.60589C10.4939 3.70571 9.27304 3.2 8 3.2C6.72696 3.2 5.50606 3.70571 4.60589 4.60589C3.70571 5.50606 3.2 6.72696 3.2 8C3.2 9.27304 3.70571 10.4939 4.60589 11.3941C5.50606 12.2943 6.72696 12.8 8 12.8V12.8ZM5.9 9.2H9.2C9.27957 9.2 9.35587 9.16839 9.41213 9.11213C9.46839 9.05587 9.5 8.97957 9.5 8.9C9.5 8.82044 9.46839 8.74413 9.41213 8.68787C9.35587 8.63161 9.27957 8.6 9.2 8.6H6.8C6.40218 8.6 6.02064 8.44197 5.73934 8.16066C5.45804 7.87936 5.3 7.49783 5.3 7.1C5.3 6.70218 5.45804 6.32065 5.73934 6.03934C6.02064 5.75804 6.40218 5.6 6.8 5.6H7.4V4.4H8.6V5.6H10.1V6.8H6.8C6.72044 6.8 6.64413 6.83161 6.58787 6.88787C6.53161 6.94413 6.5 7.02044 6.5 7.1C6.5 7.17957 6.53161 7.25587 6.58787 7.31213C6.64413 7.36839 6.72044 7.4 6.8 7.4H9.2C9.59783 7.4 9.97936 7.55804 10.2607 7.83934C10.542 8.12065 10.7 8.50218 10.7 8.9C10.7 9.29783 10.542 9.67936 10.2607 9.96066C9.97936 10.242 9.59783 10.4 9.2 10.4H8.6V11.6H7.4V10.4H5.9V9.2Z" fill="currentColor"/>
|
|
546
548
|
</svg>
|
|
547
549
|
|
|
548
|
-
`),
|
|
550
|
+
`), R.innerHTML = C;
|
|
549
551
|
const L = document.createElement("span");
|
|
550
|
-
L.className = "wgt:text-sm wgt:text-weak-700", L.textContent = w,
|
|
551
|
-
const
|
|
552
|
-
return
|
|
552
|
+
L.className = "wgt:text-sm wgt:text-weak-700", L.textContent = w, P.appendChild(R), P.appendChild(L);
|
|
553
|
+
const h = document.createElement("span");
|
|
554
|
+
return h.className = "wgt:text-sm wgt:font-semibold wgt:text-strong-950 wgt:w-2/3 wgt:text-right", h.textContent = V, S.appendChild(P), S.appendChild(h), S;
|
|
553
555
|
}
|
|
554
|
-
l.appendChild(x(
|
|
555
|
-
x(
|
|
556
|
+
l.appendChild(x(i("orderCode"), r == null ? void 0 : r.billNo)), l.appendChild(
|
|
557
|
+
x(i("address_form"), r == null ? void 0 : r.merchantAddress)
|
|
556
558
|
), l.appendChild(
|
|
557
559
|
x(
|
|
558
|
-
|
|
560
|
+
i("total_amount"),
|
|
559
561
|
te(r == null ? void 0 : r.amount) + " VND"
|
|
560
562
|
)
|
|
561
563
|
), a.appendChild(l);
|
|
@@ -563,14 +565,14 @@ function ue({
|
|
|
563
565
|
o.className = "wgt:mt-4 wgt:rounded-xl wgt:border wgt:border-[#E1E4EA] wgt:bg-white wgt:pb-6", a.appendChild(o);
|
|
564
566
|
const u = document.createElement("div");
|
|
565
567
|
u.className = "wgt:flex wgt:border-b wgt:border-[#E1E4EA]", o.appendChild(u);
|
|
566
|
-
const
|
|
567
|
-
|
|
568
|
+
const f = document.createElement("button");
|
|
569
|
+
f.type = "button", f.className = "wgt:relative wgt:flex-1 wgt:py-4 wgt:text-sm wgt:font-semibold ", f.innerHTML = `
|
|
568
570
|
<span class="wgt:flex wgt:items-center wgt:justify-center wgt:gap-2">
|
|
569
571
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
570
572
|
<path d="M10 12C11.4587 12 12.8572 12.5799 13.8887 13.6113C14.8016 14.5242 15.3592 15.7247 15.4756 17H14.9746C14.8598 15.8576 14.3542 14.7839 13.5352 13.9648C12.5975 13.0272 11.3261 12.5 10 12.5C8.67392 12.5 7.40253 13.0272 6.46484 13.9648C5.64577 14.7839 5.14018 15.8576 5.02539 17H4.52441C4.64082 15.7247 5.19843 14.5242 6.11133 13.6113C7.07838 12.6443 8.36805 12.0742 9.72754 12.0068L10 12ZM10 2.25C12.2101 2.25 14 4.03989 14 6.25C14 8.46011 12.2101 10.25 10 10.25C7.78989 10.25 6 8.46011 6 6.25C6 4.03989 7.78989 2.25 10 2.25ZM10 2.75C8.06636 2.75 6.5 4.31636 6.5 6.25C6.5 8.18364 8.06636 9.75 10 9.75C11.9336 9.75 13.5 8.18364 13.5 6.25C13.5 4.31636 11.9336 2.75 10 2.75Z" fill="currentColor" stroke="currentColor"/>
|
|
571
573
|
</svg>
|
|
572
574
|
|
|
573
|
-
${
|
|
575
|
+
${i("individual")}
|
|
574
576
|
</span>
|
|
575
577
|
`;
|
|
576
578
|
const c = document.createElement("button");
|
|
@@ -580,42 +582,43 @@ function ue({
|
|
|
580
582
|
<path d="M4 3.875H11.5C11.5332 3.875 11.5654 3.88769 11.5889 3.91113C11.6123 3.93457 11.625 3.96685 11.625 4V15.875H15.875V8.625H14.375V8.375H16C16.0332 8.375 16.0654 8.38769 16.0889 8.41113C16.1123 8.43457 16.125 8.46685 16.125 8.5V15.875H17.625V16.125H2.375V15.875H3.875V4C3.875 3.96685 3.88769 3.93457 3.91113 3.91113C3.93457 3.88769 3.96685 3.875 4 3.875ZM4.125 15.875H11.375V4.125H4.125V15.875ZM8.625 9.875V10.125H6.875V9.875H8.625ZM8.625 6.875V7.125H6.875V6.875H8.625Z" fill="currentColor" stroke="currentColor" stroke-width="1.25"/>
|
|
581
583
|
</svg>
|
|
582
584
|
|
|
583
|
-
${
|
|
585
|
+
${i("business")}
|
|
584
586
|
</span>
|
|
585
|
-
`, u.appendChild(
|
|
587
|
+
`, u.appendChild(f), u.appendChild(c);
|
|
586
588
|
const v = document.createElement("div");
|
|
587
589
|
v.className = "wgt:mt-4 wgt:px-4", o.appendChild(v);
|
|
588
590
|
const E = pe(), H = ge({
|
|
589
591
|
defaultValues: { taxCode: d || "" },
|
|
590
592
|
onFetchByTaxCode: (w) => j(null, null, function* () {
|
|
591
|
-
var S,
|
|
593
|
+
var S, P, R;
|
|
592
594
|
const V = yield de(w);
|
|
593
595
|
return {
|
|
594
596
|
representativeName: (S = V.nguoi_dai_dien) != null ? S : "",
|
|
595
|
-
buyerAddress: (
|
|
597
|
+
buyerAddress: (P = V.dia_chi) != null ? P : "",
|
|
598
|
+
businessName: (R = V.ten_cty) != null ? R : ""
|
|
596
599
|
};
|
|
597
600
|
})
|
|
598
601
|
});
|
|
599
|
-
let
|
|
602
|
+
let B = "individual", b = E;
|
|
600
603
|
function A(w) {
|
|
601
|
-
|
|
604
|
+
B = w, f.style.borderBottom = "none", c.style.borderBottom = "none";
|
|
602
605
|
const V = "wgt:relative wgt:flex-1 wgt:py-4 wgt:text-sm wgt:font-semibold";
|
|
603
|
-
w === "individual" ? (
|
|
606
|
+
w === "individual" ? (f.className = `${V} wgt:text-strong-950`, f.style.borderBottom = "2px solid var(--primary)", c.className = `${V} wgt:text-soft-400`, v.innerHTML = "", v.appendChild(E.container), b = E) : (c.className = `${V} wgt:text-strong-950`, c.style.borderBottom = "2px solid var(--primary)", f.className = `${V} wgt:text-soft-400`, v.innerHTML = "", v.appendChild(H.container), b = H);
|
|
604
607
|
}
|
|
605
|
-
|
|
608
|
+
f.addEventListener("click", () => A("individual")), c.addEventListener("click", () => A("business")), A("individual");
|
|
606
609
|
const _ = document.createElement("p");
|
|
607
|
-
_.className = "wgt:mt-2 wgt:text-xs wgt:text-[#FF8447] wgt:text-left wgt:justify-center", _.textContent =
|
|
610
|
+
_.className = "wgt:mt-2 wgt:text-xs wgt:text-[#FF8447] wgt:text-left wgt:justify-center", _.textContent = i("invoiceform_note"), a.appendChild(_);
|
|
608
611
|
const m = document.createElement("div");
|
|
609
612
|
m.className = "wgt:mt-6 wgt:w-full wgt:flex wgt:justify-center wgt:items-center";
|
|
610
613
|
const T = G({
|
|
611
614
|
type: "button",
|
|
612
|
-
title:
|
|
615
|
+
title: i("btn_preview"),
|
|
613
616
|
className: "wgt:min-w-[163px] wgt:text-white",
|
|
614
617
|
handleClick: () => {
|
|
615
618
|
if (!b.validate())
|
|
616
619
|
return;
|
|
617
620
|
const w = {
|
|
618
|
-
type:
|
|
621
|
+
type: B,
|
|
619
622
|
data: b.getValues()
|
|
620
623
|
}, { overlay: V } = me({
|
|
621
624
|
type: w.type,
|
|
@@ -626,18 +629,18 @@ function ue({
|
|
|
626
629
|
console.log("Popup closed");
|
|
627
630
|
},
|
|
628
631
|
onConfirm: () => j(null, null, function* () {
|
|
629
|
-
var S,
|
|
632
|
+
var S, P, R;
|
|
630
633
|
V.remove(), p();
|
|
631
634
|
try {
|
|
632
|
-
if (typeof
|
|
633
|
-
const C = yield
|
|
635
|
+
if (typeof n != "function") return;
|
|
636
|
+
const C = yield n({
|
|
634
637
|
type: w.type,
|
|
635
638
|
data: w.data
|
|
636
|
-
}), L = (
|
|
637
|
-
if (N(),
|
|
639
|
+
}), L = (R = (P = (S = C == null ? void 0 : C.finalData) != null ? S : C == null ? void 0 : C.data) != null ? P : C) != null ? R : {}, h = String((L == null ? void 0 : L.status) || "").trim().toLowerCase();
|
|
640
|
+
if (N(), h === "invoiced") {
|
|
638
641
|
J({
|
|
639
|
-
message:
|
|
640
|
-
description:
|
|
642
|
+
message: i("invoice_success"),
|
|
643
|
+
description: i("invoice_description"),
|
|
641
644
|
// okLabel: t('close'),
|
|
642
645
|
isSuccess: !0,
|
|
643
646
|
hideOkButton: !0,
|
|
@@ -646,10 +649,10 @@ function ue({
|
|
|
646
649
|
}).open();
|
|
647
650
|
return;
|
|
648
651
|
}
|
|
649
|
-
if (
|
|
652
|
+
if (h === "failed") {
|
|
650
653
|
J({
|
|
651
|
-
message:
|
|
652
|
-
description:
|
|
654
|
+
message: i("invoice_failed"),
|
|
655
|
+
description: i("invoice_description_failed"),
|
|
653
656
|
// okLabel: t('close'),
|
|
654
657
|
isSuccess: !1,
|
|
655
658
|
hideOkButton: !0,
|
|
@@ -660,8 +663,8 @@ function ue({
|
|
|
660
663
|
}
|
|
661
664
|
} catch (C) {
|
|
662
665
|
N(), J({
|
|
663
|
-
message:
|
|
664
|
-
description:
|
|
666
|
+
message: i("invoice_failed"),
|
|
667
|
+
description: i("invoice_description_failed"),
|
|
665
668
|
// okLabel: t('close'),
|
|
666
669
|
isSuccess: !1,
|
|
667
670
|
hideOkButton: !0,
|
|
@@ -679,8 +682,8 @@ function ue({
|
|
|
679
682
|
function we({ theme: r, onClose: t } = {}) {
|
|
680
683
|
const e = document.createElement("div");
|
|
681
684
|
e.className = " wgt:flex wgt:h-screen wgt:bg-[#F3F4F6] wgt:p-4", r && e.setAttribute("data-theme", r);
|
|
682
|
-
const
|
|
683
|
-
|
|
685
|
+
const n = document.createElement("div");
|
|
686
|
+
n.className = "wgt:w-full wgt:max-w-md wgt:max-h-[208px] wgt:bg-white wgt:rounded-2xl wgt:shadow-sm wgt:p-8 wgt:text-center";
|
|
684
687
|
const d = document.createElement("div");
|
|
685
688
|
d.className = "wgt:flex wgt:justify-center wgt:mb-4";
|
|
686
689
|
const s = document.createElement("div");
|
|
@@ -689,17 +692,17 @@ function we({ theme: r, onClose: t } = {}) {
|
|
|
689
692
|
<path d="M20.7996 22.75H5.19961C4.94102 22.75 4.69303 22.6473 4.51018 22.4644C4.32733 22.2816 4.22461 22.0336 4.22461 21.775V4.225C4.22461 3.96641 4.32733 3.71842 4.51018 3.53557C4.69303 3.35272 4.94102 3.25 5.19961 3.25H20.7996C21.0582 3.25 21.3062 3.35272 21.489 3.53557C21.6719 3.71842 21.7746 3.96641 21.7746 4.225V21.775C21.7746 22.0336 21.6719 22.2816 21.489 22.4644C21.3062 22.6473 21.0582 22.75 20.7996 22.75ZM9.09961 10.075V12.025H16.8996V10.075H9.09961ZM9.09961 13.975V15.925H16.8996V13.975H9.09961Z" fill="white"/>
|
|
690
693
|
</svg>
|
|
691
694
|
|
|
692
|
-
`, d.appendChild(s),
|
|
695
|
+
`, d.appendChild(s), n.appendChild(d);
|
|
693
696
|
const a = document.createElement("h2");
|
|
694
|
-
a.className = "wgt:text-base wgt:font-semibold wgt:text-[#0E121B] wgt:mb-2", a.textContent =
|
|
697
|
+
a.className = "wgt:text-base wgt:font-semibold wgt:text-[#0E121B] wgt:mb-2", a.textContent = i("invoiceCheckout_title"), n.appendChild(a);
|
|
695
698
|
const g = document.createElement("p");
|
|
696
|
-
return g.className = "wgt:text-sm wgt:text-[#525866] wgt:leading-relaxed", g.textContent =
|
|
699
|
+
return g.className = "wgt:text-sm wgt:text-[#525866] wgt:leading-relaxed", g.textContent = i("invoiceCheckout_description"), n.appendChild(g), e.appendChild(n), { container: e };
|
|
697
700
|
}
|
|
698
701
|
function Ce({ theme: r, onClose: t } = {}) {
|
|
699
702
|
const e = document.createElement("div");
|
|
700
703
|
e.className = "wgt:min-h-screen wgt:flex wgt:bg-[#F3F4F6] wgt:p-4", r && e.setAttribute("data-theme", r);
|
|
701
|
-
const
|
|
702
|
-
|
|
704
|
+
const n = document.createElement("div");
|
|
705
|
+
n.className = "wgt:w-full wgt:max-w-md wgt:max-h-[252px] wgt:bg-white wgt:rounded-2xl wgt:shadow-sm wgt:px-4 wgt:py-5 wgt:text-center";
|
|
703
706
|
const d = document.createElement("div");
|
|
704
707
|
d.className = "wgt:flex wgt:justify-center wgt:mb-2";
|
|
705
708
|
const s = document.createElement("div");
|
|
@@ -721,23 +724,23 @@ function Ce({ theme: r, onClose: t } = {}) {
|
|
|
721
724
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.7788 33.9142C39.4439 33.9142 39.9696 34.4369 39.9696 35.1051C39.9696 35.7748 39.4447 36.2959 38.7788 36.2959C38.1144 36.2959 37.5879 35.7748 37.5879 35.1051C37.5879 34.4361 38.1144 33.9142 38.7788 33.9142ZM44.1494 28.6799C43.9468 28.6837 43.7479 28.7675 43.6039 28.9146L39.9376 32.59C39.5826 32.4232 39.1925 32.3234 38.7788 32.3234C37.2542 32.3234 36.0039 33.5813 36.0039 35.1051C36.0039 36.6296 37.2542 37.8891 38.7788 37.8891C40.3033 37.8891 41.5544 36.6296 41.5544 35.1051C41.5544 34.5679 41.3944 34.0712 41.1285 33.6445L44.727 30.0376C45.2367 29.5317 44.8702 28.6632 44.1494 28.6799Z" fill="#808080"/>
|
|
722
725
|
</svg>
|
|
723
726
|
|
|
724
|
-
`, d.appendChild(s),
|
|
727
|
+
`, d.appendChild(s), n.appendChild(d);
|
|
725
728
|
const a = document.createElement("h2");
|
|
726
|
-
a.className = "wgt:text-base wgt:font-semibold wgt:text-[#0E121B] wgt:mb-2", a.textContent =
|
|
729
|
+
a.className = "wgt:text-base wgt:font-semibold wgt:text-[#0E121B] wgt:mb-2", a.textContent = i("invoiceExpired_title"), n.appendChild(a);
|
|
727
730
|
const g = document.createElement("p");
|
|
728
|
-
g.className = "wgt:text-sm wgt:text-[#525866] wgt:leading-relaxed wgt:px-2 wgt:mb-3", g.textContent =
|
|
731
|
+
g.className = "wgt:text-sm wgt:text-[#525866] wgt:leading-relaxed wgt:px-2 wgt:mb-3", g.textContent = i("invoiceExpired_description"), n.appendChild(g);
|
|
729
732
|
const p = document.createElement("p");
|
|
730
|
-
return p.className = "wgt:text-sm wgt:text-[#99A0AE] wgt:italic wgt:leading-relaxed wgt:px-4", p.textContent =
|
|
733
|
+
return p.className = "wgt:text-sm wgt:text-[#99A0AE] wgt:italic wgt:leading-relaxed wgt:px-4", p.textContent = i("invoiceExpired_note"), n.appendChild(p), e.appendChild(n), { container: e };
|
|
731
734
|
}
|
|
732
735
|
function ie(r) {
|
|
733
736
|
return String(r || "").trim().toLowerCase();
|
|
734
737
|
}
|
|
735
738
|
function Ne({ uuid: r, orderInfo: t, theme: e }) {
|
|
736
|
-
const
|
|
737
|
-
|
|
739
|
+
const n = document.createElement("div");
|
|
740
|
+
n.className = "wgt:w-full wgt:min-h-screen";
|
|
738
741
|
let d = !1;
|
|
739
742
|
function s(o) {
|
|
740
|
-
d || (
|
|
743
|
+
d || (n.innerHTML = "", o && n.appendChild(o));
|
|
741
744
|
}
|
|
742
745
|
function a(o) {
|
|
743
746
|
o && console.log("[DEBUG] renderFailedPage:", o);
|
|
@@ -763,11 +766,11 @@ function Ne({ uuid: r, orderInfo: t, theme: e }) {
|
|
|
763
766
|
const u = ue({
|
|
764
767
|
orderInfo: o || {},
|
|
765
768
|
theme: e,
|
|
766
|
-
onSubmit: (v) => j(null, [v], function* ({ type:
|
|
769
|
+
onSubmit: (v) => j(null, [v], function* ({ type: f, data: c }) {
|
|
767
770
|
const E = k();
|
|
768
771
|
if (!E)
|
|
769
772
|
return a({ reason: "MISSING_UUID_ON_SUBMIT" }), { ok: !1 };
|
|
770
|
-
const H = fe(
|
|
773
|
+
const H = fe(f, c);
|
|
771
774
|
return yield le(E, H), { ok: !0, finalData: yield ve(E, {
|
|
772
775
|
maxTries: 20,
|
|
773
776
|
intervalMs: 1500
|
|
@@ -778,9 +781,9 @@ function Ne({ uuid: r, orderInfo: t, theme: e }) {
|
|
|
778
781
|
s(u.container);
|
|
779
782
|
}
|
|
780
783
|
function k() {
|
|
781
|
-
var
|
|
784
|
+
var f;
|
|
782
785
|
const o = new URLSearchParams(window.location.search || "");
|
|
783
|
-
return String((
|
|
786
|
+
return String((f = o.get("uuid")) != null ? f : "").trim() || String(r || "").trim() || String((t == null ? void 0 : t.uuid) || "").trim();
|
|
784
787
|
}
|
|
785
788
|
function F() {
|
|
786
789
|
return j(this, null, function* () {
|
|
@@ -793,9 +796,9 @@ function Ne({ uuid: r, orderInfo: t, theme: e }) {
|
|
|
793
796
|
const o = k();
|
|
794
797
|
if (!o)
|
|
795
798
|
return a({ reason: "EMPTY_UUID_NO_API_CALL" });
|
|
796
|
-
const u = yield ne(o),
|
|
797
|
-
if (
|
|
798
|
-
return a({ reason: "API_MESSAGE", apiMsg:
|
|
799
|
+
const u = yield ne(o), f = String((u == null ? void 0 : u.message) || "").trim();
|
|
800
|
+
if (f)
|
|
801
|
+
return a({ reason: "API_MESSAGE", apiMsg: f, res: u });
|
|
799
802
|
const c = ie(u == null ? void 0 : u.status);
|
|
800
803
|
return c === "expired" ? g() : c === "invoiced" ? p(u) : c === "pending" || c === "waiting" ? N(u || t || {}) : c === "" && u && Object.keys(u).length > 0 ? N(u) : a({ reason: "UNKNOWN_STATUS", status: c, res: u });
|
|
801
804
|
} catch (o) {
|
|
@@ -817,23 +820,23 @@ function Ne({ uuid: r, orderInfo: t, theme: e }) {
|
|
|
817
820
|
});
|
|
818
821
|
}
|
|
819
822
|
function x() {
|
|
820
|
-
d = !0,
|
|
823
|
+
d = !0, n.innerHTML = "";
|
|
821
824
|
}
|
|
822
|
-
return { container:
|
|
825
|
+
return { container: n, init: l, destroy: x };
|
|
823
826
|
}
|
|
824
827
|
function he(r) {
|
|
825
828
|
return String(r || "").trim().toLowerCase() === "business" ? "enterprise" : "individual";
|
|
826
829
|
}
|
|
827
830
|
function fe(r, t) {
|
|
828
|
-
const e = he(r),
|
|
831
|
+
const e = he(r), n = {
|
|
829
832
|
invoiceType: e,
|
|
830
833
|
buyerName: (t == null ? void 0 : t.representativeName) || "",
|
|
831
834
|
address: (t == null ? void 0 : t.buyerAddress) || "",
|
|
832
835
|
email: (t == null ? void 0 : t.email) || ""
|
|
833
836
|
};
|
|
834
|
-
return e === "enterprise" && (
|
|
837
|
+
return e === "enterprise" && (n.taxCode = t != null && t.noTaxCode ? "" : (t == null ? void 0 : t.taxCode) || "", n.businessName = (t == null ? void 0 : t.businessName) || ""), n;
|
|
835
838
|
}
|
|
836
|
-
function ve(
|
|
839
|
+
function ve(n) {
|
|
837
840
|
return j(this, arguments, function* (r, { maxTries: t = 20, intervalMs: e = 1500 } = {}) {
|
|
838
841
|
for (let s = 0; s < t; s++) {
|
|
839
842
|
yield xe(e);
|