@invoice-sdk/widget 1.118.1 → 1.118.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/{index-BZ06NKO0.js → index-DlbtRz_x.js} +216 -215
- package/dist/{index-B-xYoQuR.js → index-EgycCzHi.js} +7 -7
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +47 -47
- package/dist/{loading-C9dC-rXa.js → loading-Btbxdqb9.js} +2 -2
- package/dist/{widget-JgL2oEhq.js → widget-Cr35XYNA.js} +2 -2
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
1
|
+
var re = Object.defineProperty;
|
|
2
2
|
var D = Object.getOwnPropertySymbols;
|
|
3
3
|
var ae = Object.prototype.hasOwnProperty, se = Object.prototype.propertyIsEnumerable;
|
|
4
|
-
var ee = (
|
|
4
|
+
var ee = (r, t, e) => t in r ? re(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, $ = (r, t) => {
|
|
5
5
|
for (var e in t || (t = {}))
|
|
6
|
-
ae.call(t, e) && ee(
|
|
6
|
+
ae.call(t, e) && ee(r, e, t[e]);
|
|
7
7
|
if (D)
|
|
8
8
|
for (var e of D(t))
|
|
9
|
-
se.call(t, e) && ee(
|
|
10
|
-
return
|
|
9
|
+
se.call(t, e) && ee(r, e, t[e]);
|
|
10
|
+
return r;
|
|
11
11
|
};
|
|
12
|
-
var j = (
|
|
12
|
+
var j = (r, t, e) => new Promise((i, d) => {
|
|
13
13
|
var s = (p) => {
|
|
14
14
|
try {
|
|
15
15
|
g(e.next(p));
|
|
@@ -22,35 +22,35 @@ var j = (i, t, e) => new Promise((r, d) => {
|
|
|
22
22
|
} catch (N) {
|
|
23
23
|
d(N);
|
|
24
24
|
}
|
|
25
|
-
}, g = (p) => p.done ?
|
|
26
|
-
g((e = e.apply(
|
|
25
|
+
}, g = (p) => p.done ? i(p.value) : Promise.resolve(p.value).then(s, a);
|
|
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 n, c as J, j as ce } from "./index-
|
|
30
|
-
function z(
|
|
31
|
-
const t =
|
|
32
|
-
return t ? t.length < 2 || t.length > 250 ? { valid: !1, error: n("length_2_250") } : /[<>:"\/\\|?*@#$%!^]/.test(t) ? { valid: !1, error: n("invalid_characters") } : { valid: !0 } : { valid: !1, error: n("
|
|
28
|
+
import { c as G, f as te, e as oe, b as de, o as ne, s as le } from "./loading-Btbxdqb9.js";
|
|
29
|
+
import { t as n, c as J, j as ce } from "./index-EgycCzHi.js";
|
|
30
|
+
function z(r) {
|
|
31
|
+
const t = r.trim();
|
|
32
|
+
return t ? t.length < 2 || t.length > 250 ? { valid: !1, error: n("length_2_250") } : /[<>:"\/\\|?*@#$%!^]/.test(t) ? { valid: !1, error: n("invalid_characters") } : { valid: !0 } : { valid: !1, error: n("required_name") };
|
|
33
33
|
}
|
|
34
|
-
function X(
|
|
35
|
-
const e =
|
|
36
|
-
return e ? e.length < 2 || e.length > 250 ? { valid: !1, error: n("length_2_250") } : /[<>:"
|
|
34
|
+
function X(r, t = !1) {
|
|
35
|
+
const e = String(r != null ? r : "").trim();
|
|
36
|
+
return e ? e.length < 2 || e.length > 250 ? { valid: !1, error: n("length_2_250") } : /[<>:"\\|?*@#$%!^]/.test(e) ? { valid: !1, error: n("invalid_characters") } : { valid: !0 } : t ? { valid: !1, error: n("required_address") } : { valid: !0 };
|
|
37
37
|
}
|
|
38
|
-
function K(
|
|
39
|
-
const t =
|
|
38
|
+
function K(r) {
|
|
39
|
+
const t = r.trim();
|
|
40
40
|
return t ? t.length < 6 || t.length > 254 ? { valid: !1, error: n("email_length") } : /[<>:"\/\\|?*#$%!\s]/.test(t) ? { valid: !1, error: n("email_invalid_format") } : /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(t) ? t.includes("@@") ? { valid: !1, error: n("email_invalid_format") } : { valid: !0 } : { valid: !1, error: n("email_invalid_format") } : { valid: !1, error: n("required_email") };
|
|
41
41
|
}
|
|
42
|
-
function Y(
|
|
43
|
-
const e =
|
|
42
|
+
function Y(r, t = !1) {
|
|
43
|
+
const e = r.trim();
|
|
44
44
|
if (!e)
|
|
45
45
|
return t ? { valid: !1, error: n("required_phone") } : { valid: !0 };
|
|
46
|
-
const
|
|
47
|
-
if (/[<>:"\/\\|?*@#$%!A-Za-z]/.test(
|
|
46
|
+
const i = e.replace(/\s/g, "");
|
|
47
|
+
if (/[<>:"\/\\|?*@#$%!A-Za-z]/.test(i))
|
|
48
48
|
return { valid: !1, error: n("phone_invalid") };
|
|
49
49
|
const s = /^0\d{9}$/, a = /^\+84\d{9}$/;
|
|
50
|
-
return !s.test(
|
|
50
|
+
return !s.test(i) && !a.test(i) ? { valid: !1, error: n("phone_invalid_format") } : { valid: !0 };
|
|
51
51
|
}
|
|
52
|
-
function Q(
|
|
53
|
-
const t =
|
|
52
|
+
function Q(r) {
|
|
53
|
+
const t = r.trim();
|
|
54
54
|
if (!t) return { valid: !1, error: n("required_tax_code") };
|
|
55
55
|
const e = t.replace(/\s/g, "");
|
|
56
56
|
if (/[<>:"\/\\|?*@#$%!A-Za-z\s]/.test(e))
|
|
@@ -60,22 +60,22 @@ function Q(i) {
|
|
|
60
60
|
const s = /^\d{10}$/, a = /^\d{10}-\d{3}$/;
|
|
61
61
|
return !s.test(e) && !a.test(e) ? { valid: !1, error: n("tax_code_invalid_format") } : { valid: !0 };
|
|
62
62
|
}
|
|
63
|
-
function pe({ defaultValues:
|
|
63
|
+
function pe({ defaultValues: r = {}, onChange: t } = {}) {
|
|
64
64
|
const e = {
|
|
65
|
-
representativeName:
|
|
66
|
-
buyerAddress:
|
|
67
|
-
email:
|
|
68
|
-
phone:
|
|
69
|
-
},
|
|
70
|
-
|
|
65
|
+
representativeName: r.representativeName || "",
|
|
66
|
+
buyerAddress: r.buyerAddress || "",
|
|
67
|
+
email: r.email || "",
|
|
68
|
+
phone: r.phone || ""
|
|
69
|
+
}, i = document.createElement("div");
|
|
70
|
+
i.className = "wgt:space-y-2";
|
|
71
71
|
function d() {
|
|
72
72
|
typeof t == "function" && t($({}, e));
|
|
73
73
|
}
|
|
74
|
-
function s({ label: v, required:
|
|
74
|
+
function s({ label: v, required: E, name: H, type: Z = "text", placeholder: b }) {
|
|
75
75
|
const A = document.createElement("div");
|
|
76
76
|
A.className = "";
|
|
77
77
|
const _ = document.createElement("label");
|
|
78
|
-
_.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950", _.htmlFor = H, _.innerHTML =
|
|
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
80
|
m.id = H, m.name = H, m.type = Z, 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");
|
|
@@ -85,27 +85,27 @@ function pe({ defaultValues: i = {}, onChange: t } = {}) {
|
|
|
85
85
|
"wgt:bg-semantic-error-50"
|
|
86
86
|
), T.classList.add("wgt:hidden"), d();
|
|
87
87
|
}), m.addEventListener("blur", () => {
|
|
88
|
-
let
|
|
88
|
+
let w;
|
|
89
89
|
switch (H) {
|
|
90
90
|
case "representativeName":
|
|
91
|
-
|
|
91
|
+
w = z(m.value);
|
|
92
92
|
break;
|
|
93
93
|
case "buyerAddress":
|
|
94
|
-
|
|
94
|
+
w = X(m.value);
|
|
95
95
|
break;
|
|
96
96
|
case "email":
|
|
97
|
-
|
|
97
|
+
w = K(m.value);
|
|
98
98
|
break;
|
|
99
99
|
case "phone":
|
|
100
|
-
|
|
100
|
+
w = Y(m.value, !1);
|
|
101
101
|
break;
|
|
102
102
|
default:
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
|
-
!
|
|
105
|
+
!w.valid && w.error && (m.classList.add(
|
|
106
106
|
"wgt:border-semantic-error",
|
|
107
107
|
"wgt:bg-semantic-error-50"
|
|
108
|
-
), T.textContent =
|
|
108
|
+
), T.textContent = w.error, T.classList.remove("wgt:hidden"));
|
|
109
109
|
}), A.appendChild(_), A.appendChild(m), A.appendChild(T), { field: A, input: m, errorEl: T };
|
|
110
110
|
}
|
|
111
111
|
const {
|
|
@@ -135,7 +135,7 @@ function pe({ defaultValues: i = {}, onChange: t } = {}) {
|
|
|
135
135
|
}), {
|
|
136
136
|
field: x,
|
|
137
137
|
input: o,
|
|
138
|
-
errorEl:
|
|
138
|
+
errorEl: u
|
|
139
139
|
} = s({
|
|
140
140
|
label: n("phone"),
|
|
141
141
|
required: !1,
|
|
@@ -143,100 +143,101 @@ function pe({ defaultValues: i = {}, onChange: t } = {}) {
|
|
|
143
143
|
type: "tel",
|
|
144
144
|
placeholder: n("phone_input")
|
|
145
145
|
});
|
|
146
|
-
|
|
147
|
-
function
|
|
146
|
+
i.appendChild(a), i.appendChild(N), i.appendChild(F), i.appendChild(x);
|
|
147
|
+
function h() {
|
|
148
148
|
let v = !0;
|
|
149
|
-
function
|
|
149
|
+
function E(b, A, _) {
|
|
150
150
|
b.classList.add(
|
|
151
151
|
"wgt:border-semantic-error",
|
|
152
152
|
"wgt:bg-semantic-error-50"
|
|
153
153
|
), _ && A && (A.textContent = _, A.classList.remove("wgt:hidden")), v = !1;
|
|
154
154
|
}
|
|
155
155
|
const H = z(e.representativeName);
|
|
156
|
-
if (H.valid ||
|
|
156
|
+
if (H.valid || E(g, p, H.error), e.buyerAddress.trim()) {
|
|
157
157
|
const b = X(e.buyerAddress);
|
|
158
|
-
b.valid ||
|
|
158
|
+
b.valid || E(
|
|
159
159
|
document.querySelector('input[name="buyerAddress"]'),
|
|
160
160
|
k,
|
|
161
161
|
b.error
|
|
162
162
|
);
|
|
163
163
|
}
|
|
164
164
|
const Z = K(e.email);
|
|
165
|
-
if (Z.valid ||
|
|
165
|
+
if (Z.valid || E(M, l, Z.error), e.phone.trim()) {
|
|
166
166
|
const b = Y(e.phone, !1);
|
|
167
|
-
b.valid ||
|
|
167
|
+
b.valid || E(o, u, b.error);
|
|
168
168
|
}
|
|
169
169
|
return v;
|
|
170
170
|
}
|
|
171
171
|
function c() {
|
|
172
172
|
return $({}, e);
|
|
173
173
|
}
|
|
174
|
-
return { container:
|
|
174
|
+
return { container: i, getValues: c, validate: h };
|
|
175
175
|
}
|
|
176
176
|
function ge({
|
|
177
|
-
defaultValues:
|
|
177
|
+
defaultValues: r = {},
|
|
178
178
|
onChange: t,
|
|
179
179
|
onFetchByTaxCode: e
|
|
180
180
|
} = {}) {
|
|
181
|
-
const
|
|
182
|
-
noTaxCode: !!
|
|
183
|
-
taxCode:
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
181
|
+
const i = {
|
|
182
|
+
noTaxCode: !!r.noTaxCode,
|
|
183
|
+
taxCode: r.taxCode || "",
|
|
184
|
+
businessName: r.businessName || "",
|
|
185
|
+
representativeName: r.representativeName || "",
|
|
186
|
+
buyerAddress: r.buyerAddress || "",
|
|
187
|
+
// performerName: defaultValues.performerName || '',
|
|
188
|
+
email: r.email || "",
|
|
189
|
+
phone: r.phone || ""
|
|
189
190
|
}, d = document.createElement("div");
|
|
190
191
|
d.className = "wgt:space-y-2";
|
|
191
192
|
function s() {
|
|
192
|
-
typeof t == "function" && t($({},
|
|
193
|
+
typeof t == "function" && t($({}, i));
|
|
193
194
|
}
|
|
194
|
-
function a({ label: C, required: L, name:
|
|
195
|
+
function a({ label: C, required: L, name: f, type: W = "text", placeholder: I }) {
|
|
195
196
|
const O = document.createElement("div");
|
|
196
197
|
O.className = "";
|
|
197
198
|
const P = document.createElement("label");
|
|
198
|
-
P.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950", P.htmlFor =
|
|
199
|
-
const
|
|
200
|
-
|
|
199
|
+
P.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950", P.htmlFor = f, P.innerHTML = L ? `${C} <span class="wgt:text-[#ED1C24]">*</span>` : C;
|
|
200
|
+
const y = document.createElement("input");
|
|
201
|
+
y.id = f, y.name = f, 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 = i[f] || "";
|
|
201
202
|
const R = document.createElement("div");
|
|
202
|
-
return R.className = "wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden", R.setAttribute("data-error-for",
|
|
203
|
-
|
|
203
|
+
return R.className = "wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden", R.setAttribute("data-error-for", f), y.addEventListener("input", () => {
|
|
204
|
+
i[f] = y.value, y.classList.remove(
|
|
204
205
|
"wgt:border-semantic-error",
|
|
205
206
|
"wgt:bg-semantic-error-50"
|
|
206
207
|
), R.classList.add("wgt:hidden"), s();
|
|
207
|
-
}),
|
|
208
|
-
if (!
|
|
208
|
+
}), y.addEventListener("blur", () => {
|
|
209
|
+
if (!y.value.trim() && !L) return;
|
|
209
210
|
let U;
|
|
210
|
-
switch (
|
|
211
|
-
case "
|
|
211
|
+
switch (f) {
|
|
212
|
+
case "businesName":
|
|
212
213
|
case "representativeName":
|
|
213
|
-
U = z(
|
|
214
|
+
U = z(y.value);
|
|
214
215
|
break;
|
|
215
216
|
case "buyerAddress":
|
|
216
|
-
U = X(
|
|
217
|
+
U = X(y.value);
|
|
217
218
|
break;
|
|
218
219
|
case "email":
|
|
219
|
-
U = K(
|
|
220
|
+
U = K(y.value);
|
|
220
221
|
break;
|
|
221
222
|
case "phone":
|
|
222
|
-
U = Y(
|
|
223
|
+
U = Y(y.value, !0);
|
|
223
224
|
break;
|
|
224
225
|
default:
|
|
225
226
|
return;
|
|
226
227
|
}
|
|
227
|
-
!U.valid && U.error && (
|
|
228
|
+
!U.valid && U.error && (y.classList.add(
|
|
228
229
|
"wgt:border-semantic-error",
|
|
229
230
|
"wgt:bg-semantic-error-50"
|
|
230
231
|
), R.textContent = U.error, R.classList.remove("wgt:hidden"));
|
|
231
|
-
}), O.appendChild(P), O.appendChild(
|
|
232
|
+
}), O.appendChild(P), O.appendChild(y), O.appendChild(R), { field: O, input: y, errorEl: R };
|
|
232
233
|
}
|
|
233
234
|
const g = document.createElement("label");
|
|
234
235
|
g.className = "wgt:flex wgt:items-center wgt:gap-2 wgt:font-medium wgt:text-strong-950 wgt:text-sm";
|
|
235
236
|
const p = document.createElement("input");
|
|
236
|
-
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 = i.noTaxCode;
|
|
237
238
|
const N = document.createElement("span");
|
|
238
239
|
N.textContent = n("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", () => {
|
|
239
|
-
|
|
240
|
+
i.noTaxCode = p.checked, l.disabled = i.noTaxCode, o.disabled = i.noTaxCode, l.classList.remove(
|
|
240
241
|
"wgt:border-semantic-error",
|
|
241
242
|
"wgt:bg-semantic-error-50"
|
|
242
243
|
), x.classList.add("wgt:hidden"), s();
|
|
@@ -248,15 +249,15 @@ function ge({
|
|
|
248
249
|
const M = document.createElement("div");
|
|
249
250
|
M.className = "wgt:flex wgt:gap-2 wgt:mt-2";
|
|
250
251
|
const l = document.createElement("input");
|
|
251
|
-
l.type = "text", l.name = "taxCode", l.placeholder = n("taxCode_input"), l.value =
|
|
252
|
+
l.type = "text", l.name = "taxCode", l.placeholder = n("taxCode_input"), l.value = i.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";
|
|
252
253
|
const x = document.createElement("div");
|
|
253
254
|
x.className = "wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden", l.addEventListener("input", () => {
|
|
254
|
-
|
|
255
|
+
i.taxCode = l.value, l.classList.remove(
|
|
255
256
|
"wgt:border-semantic-error",
|
|
256
257
|
"wgt:bg-semantic-error-50"
|
|
257
258
|
), x.classList.add("wgt:hidden"), s();
|
|
258
259
|
}), l.addEventListener("blur", () => {
|
|
259
|
-
if (
|
|
260
|
+
if (i.noTaxCode || !l.value.trim()) return;
|
|
260
261
|
const C = Q(l.value);
|
|
261
262
|
C.valid || (l.classList.add(
|
|
262
263
|
"wgt:border-semantic-error",
|
|
@@ -268,9 +269,9 @@ function ge({
|
|
|
268
269
|
title: n("fetch_info"),
|
|
269
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",
|
|
270
271
|
handleClick: () => j(null, null, function* () {
|
|
271
|
-
if (
|
|
272
|
+
if (i.noTaxCode || typeof e != "function")
|
|
272
273
|
return;
|
|
273
|
-
const C = String(
|
|
274
|
+
const C = String(i.taxCode || "").trim();
|
|
274
275
|
if (!C) {
|
|
275
276
|
l.classList.add(
|
|
276
277
|
"wgt:border-semantic-error",
|
|
@@ -288,32 +289,32 @@ function ge({
|
|
|
288
289
|
}
|
|
289
290
|
try {
|
|
290
291
|
o.disabled = !0;
|
|
291
|
-
const
|
|
292
|
-
if (!
|
|
293
|
-
|
|
294
|
-
} catch (
|
|
292
|
+
const f = yield e(C, $({}, i));
|
|
293
|
+
if (!f || typeof f != "object") return;
|
|
294
|
+
f.representativeName != null && (i.representativeName = String(f.representativeName || ""), E.value = i.representativeName), f.buyerAddress != null && (i.buyerAddress = String(f.buyerAddress || ""), b.value = i.buyerAddress), s();
|
|
295
|
+
} catch (f) {
|
|
295
296
|
l.classList.add(
|
|
296
297
|
"wgt:border-semantic-error",
|
|
297
298
|
"wgt:bg-semantic-error-50"
|
|
298
299
|
), x.textContent = "Không tìm thấy thông tin MST", x.classList.remove("wgt:hidden");
|
|
299
300
|
} finally {
|
|
300
|
-
o.disabled =
|
|
301
|
+
o.disabled = i.noTaxCode;
|
|
301
302
|
}
|
|
302
303
|
})
|
|
303
304
|
});
|
|
304
305
|
M.appendChild(l), M.appendChild(o), k.appendChild(F), k.appendChild(M), k.appendChild(x);
|
|
305
306
|
const {
|
|
306
|
-
field:
|
|
307
|
-
input:
|
|
307
|
+
field: u,
|
|
308
|
+
input: h,
|
|
308
309
|
errorEl: c
|
|
309
310
|
} = a({
|
|
310
|
-
label: n("
|
|
311
|
+
label: n("businessName"),
|
|
311
312
|
required: !0,
|
|
312
|
-
name: "
|
|
313
|
-
placeholder: n("
|
|
313
|
+
name: "businessName",
|
|
314
|
+
placeholder: n("businessName_input")
|
|
314
315
|
}), {
|
|
315
316
|
field: v,
|
|
316
|
-
input:
|
|
317
|
+
input: E,
|
|
317
318
|
errorEl: H
|
|
318
319
|
} = a({
|
|
319
320
|
label: n("representativeName"),
|
|
@@ -340,7 +341,7 @@ function ge({
|
|
|
340
341
|
type: "email",
|
|
341
342
|
placeholder: n("email_input")
|
|
342
343
|
}), {
|
|
343
|
-
field:
|
|
344
|
+
field: w,
|
|
344
345
|
input: V,
|
|
345
346
|
errorEl: S
|
|
346
347
|
} = a({
|
|
@@ -350,42 +351,42 @@ function ge({
|
|
|
350
351
|
type: "tel",
|
|
351
352
|
placeholder: n("phone_input")
|
|
352
353
|
});
|
|
353
|
-
d.appendChild(g), d.appendChild(k), d.appendChild(
|
|
354
|
+
d.appendChild(g), d.appendChild(k), d.appendChild(u), d.appendChild(v), d.appendChild(Z), d.appendChild(_), d.appendChild(w), l.disabled = i.noTaxCode, o.disabled = i.noTaxCode;
|
|
354
355
|
function B() {
|
|
355
356
|
let C = !0;
|
|
356
|
-
function L(P,
|
|
357
|
+
function L(P, y, R) {
|
|
357
358
|
P.classList.add(
|
|
358
359
|
"wgt:border-semantic-error",
|
|
359
|
-
"wgt:bg-semantic-error-50
|
|
360
|
+
"wgt:bg-semantic-error-50",
|
|
360
361
|
"wgt:mt-2"
|
|
361
|
-
), R &&
|
|
362
|
+
), R && y && (y.textContent = R, y.classList.remove("wgt:hidden")), C = !1;
|
|
362
363
|
}
|
|
363
|
-
if (!
|
|
364
|
-
const P = Q(
|
|
364
|
+
if (!i.noTaxCode) {
|
|
365
|
+
const P = Q(i.taxCode);
|
|
365
366
|
P.valid || L(l, x, P.error);
|
|
366
367
|
}
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
const W = z(
|
|
370
|
-
if (W.valid || L(
|
|
371
|
-
const P = X(
|
|
368
|
+
const f = z(i.businessName);
|
|
369
|
+
f.valid || L(h, c, f.error);
|
|
370
|
+
const W = z(i.representativeName);
|
|
371
|
+
if (W.valid || L(E, H, W.error), i.buyerAddress.trim()) {
|
|
372
|
+
const P = X(i.buyerAddress);
|
|
372
373
|
P.valid || L(b, A, P.error);
|
|
373
374
|
}
|
|
374
|
-
const I = K(
|
|
375
|
+
const I = K(i.email);
|
|
375
376
|
I.valid || L(m, T, I.error);
|
|
376
|
-
const O = Y(
|
|
377
|
+
const O = Y(i.phone, !0);
|
|
377
378
|
return O.valid || L(V, S, O.error), C;
|
|
378
379
|
}
|
|
379
380
|
function q() {
|
|
380
|
-
return $({},
|
|
381
|
+
return $({}, i);
|
|
381
382
|
}
|
|
382
383
|
return { container: d, getValues: q, validate: B };
|
|
383
384
|
}
|
|
384
385
|
function me({
|
|
385
|
-
type:
|
|
386
|
+
type: r,
|
|
386
387
|
data: t,
|
|
387
388
|
orderInfo: e,
|
|
388
|
-
theme:
|
|
389
|
+
theme: i,
|
|
389
390
|
onClose: d,
|
|
390
391
|
onConfirm: s
|
|
391
392
|
}) {
|
|
@@ -393,7 +394,7 @@ function me({
|
|
|
393
394
|
a.className = "wgt:fixed wgt:inset-0 wgt:flex wgt:items-center wgt:justify-center wgt:z-50 wgt:p-4", a.style.cssText = `
|
|
394
395
|
background-color: rgba(0, 0, 0, 0.5);
|
|
395
396
|
backdrop-filter: blur(4px);
|
|
396
|
-
`,
|
|
397
|
+
`, i && a.setAttribute("data-theme", i);
|
|
397
398
|
const g = document.createElement("div");
|
|
398
399
|
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";
|
|
399
400
|
const p = document.createElement("div");
|
|
@@ -411,14 +412,14 @@ function me({
|
|
|
411
412
|
m.className = "wgt:flex wgt:items-start wgt:gap-3";
|
|
412
413
|
const T = document.createElement("span");
|
|
413
414
|
T.className = "wgt:text-primary wgt:flex-shrink-0", T.innerHTML = b;
|
|
414
|
-
const
|
|
415
|
-
|
|
415
|
+
const w = document.createElement("div");
|
|
416
|
+
w.className = "wgt:flex wgt:items-start wgt:justify-between wgt:flex-1 wgt:gap-2";
|
|
416
417
|
const V = document.createElement("span");
|
|
417
418
|
V.className = "wgt:text-sm wgt:text-[#525866] wgt:w-1/3", V.textContent = A;
|
|
418
419
|
const S = document.createElement("span");
|
|
419
|
-
return S.className = "wgt:text-sm wgt:font-semibold wgt:text-strong-950 wgt:text-right wgt:w-2/3", S.textContent = _ || "-",
|
|
420
|
+
return S.className = "wgt:text-sm wgt:font-semibold wgt:text-strong-950 wgt:text-right wgt:w-2/3", S.textContent = _ || "-", w.appendChild(V), w.appendChild(S), m.appendChild(T), m.appendChild(w), m;
|
|
420
421
|
}
|
|
421
|
-
const x = '<svg class="wgt:w-4 wgt:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /></svg>', o = '<svg class="wgt:w-4 wgt:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" /></svg>',
|
|
422
|
+
const x = '<svg class="wgt:w-4 wgt:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /></svg>', o = '<svg class="wgt:w-4 wgt:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" /></svg>', u = '<svg class="wgt:w-4 wgt:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';
|
|
422
423
|
M.appendChild(
|
|
423
424
|
l(
|
|
424
425
|
x,
|
|
@@ -433,13 +434,13 @@ function me({
|
|
|
433
434
|
)
|
|
434
435
|
), M.appendChild(
|
|
435
436
|
l(
|
|
436
|
-
|
|
437
|
+
u,
|
|
437
438
|
n("confirmation_popup_totalAmount"),
|
|
438
439
|
te(e == null ? void 0 : e.amount) + " VND"
|
|
439
440
|
)
|
|
440
441
|
), F.appendChild(M), g.appendChild(F);
|
|
441
|
-
const
|
|
442
|
-
|
|
442
|
+
const h = document.createElement("div");
|
|
443
|
+
h.className = "wgt:px-6 wgt:pb-6";
|
|
443
444
|
const c = document.createElement("div");
|
|
444
445
|
c.className = "wgt:space-y-3 wgt:rounded-xl wgt:border wgt:border-[#E1E4EA] wgt:px-4 wgt:py-4";
|
|
445
446
|
function v(b, A) {
|
|
@@ -450,8 +451,10 @@ function me({
|
|
|
450
451
|
const T = document.createElement("span");
|
|
451
452
|
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), _;
|
|
452
453
|
}
|
|
453
|
-
|
|
454
|
+
r === "business" ? (c.appendChild(
|
|
454
455
|
v(n("confirmation_popup_taxCode"), t.taxCode)
|
|
456
|
+
), c.appendChild(
|
|
457
|
+
v(n("businessName"), t.businessName)
|
|
455
458
|
), c.appendChild(
|
|
456
459
|
v(
|
|
457
460
|
n("confirmation_popup_representativeName"),
|
|
@@ -459,8 +462,6 @@ function me({
|
|
|
459
462
|
)
|
|
460
463
|
), c.appendChild(
|
|
461
464
|
v(n("confirmation_popup_buyerAddress"), t.buyerAddress)
|
|
462
|
-
), c.appendChild(
|
|
463
|
-
v(n("confirmation_popup_performerName"), t.performerName)
|
|
464
465
|
), c.appendChild(
|
|
465
466
|
v(n("confirmation_popup_email"), t.email)
|
|
466
467
|
), c.appendChild(
|
|
@@ -474,9 +475,9 @@ function me({
|
|
|
474
475
|
v(n("confirmation_popup_buyerAddress"), t.buyerAddress)
|
|
475
476
|
), c.appendChild(
|
|
476
477
|
v(n("confirmation_popup_email"), t.email)
|
|
477
|
-
)),
|
|
478
|
-
const
|
|
479
|
-
|
|
478
|
+
)), h.appendChild(c), g.appendChild(h);
|
|
479
|
+
const E = document.createElement("div");
|
|
480
|
+
E.className = "wgt:px-6 wgt:pb-6 wgt:flex wgt:gap-3";
|
|
480
481
|
const H = G({
|
|
481
482
|
type: "button",
|
|
482
483
|
title: "Đóng",
|
|
@@ -489,18 +490,18 @@ function me({
|
|
|
489
490
|
title: "Xác nhận",
|
|
490
491
|
className: "wgt:flex-1 wgt:py-3 wgt:text-sm wgt:font-semibold wgt:rounded-[8px] wgt:bg-primary wgt:text-white",
|
|
491
492
|
handleClick: () => {
|
|
492
|
-
typeof s == "function" && s({ type:
|
|
493
|
+
typeof s == "function" && s({ type: r, data: t }), a.remove();
|
|
493
494
|
}
|
|
494
495
|
});
|
|
495
|
-
return
|
|
496
|
+
return E.appendChild(H), E.appendChild(Z), g.appendChild(E), a.appendChild(g), a.addEventListener("click", (b) => {
|
|
496
497
|
b.target === a && (typeof d == "function" && d(), a.remove());
|
|
497
498
|
}), { overlay: a };
|
|
498
499
|
}
|
|
499
|
-
function
|
|
500
|
-
orderInfo:
|
|
500
|
+
function ue({
|
|
501
|
+
orderInfo: r,
|
|
501
502
|
onPreview: t,
|
|
502
503
|
theme: e,
|
|
503
|
-
onSubmit:
|
|
504
|
+
onSubmit: i,
|
|
504
505
|
taxCode: d = ""
|
|
505
506
|
}) {
|
|
506
507
|
const s = document.createElement("div");
|
|
@@ -521,7 +522,7 @@ function we({
|
|
|
521
522
|
M.className = "wgt:text-sm wgt:text-weak-700 wgt:text-center wgt:justify-center", M.textContent = n("invoiceform_subtitle"), k.appendChild(F), k.appendChild(M), a.appendChild(k);
|
|
522
523
|
const l = document.createElement("div");
|
|
523
524
|
l.className = "wgt:mt-2 wgt:space-y-3 wgt:rounded-xl wgt:bg-weak-50 wgt:px-6 wgt:py-6";
|
|
524
|
-
function x(
|
|
525
|
+
function x(w, V) {
|
|
525
526
|
const S = document.createElement("div");
|
|
526
527
|
S.className = "wgt:flex wgt:items-start";
|
|
527
528
|
const B = document.createElement("div");
|
|
@@ -529,41 +530,41 @@ function we({
|
|
|
529
530
|
const q = document.createElement("span");
|
|
530
531
|
q.className = "wgt:inline-flex wgt:items-center wgt:justify-center wgt:w-4 wgt:h-4 wgt:text-icon-primary";
|
|
531
532
|
let C = "";
|
|
532
|
-
|
|
533
|
+
w === n("orderCode") ? C = `
|
|
533
534
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
534
535
|
<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"/>
|
|
535
536
|
</svg>
|
|
536
537
|
|
|
537
|
-
` :
|
|
538
|
+
` : w === n("address_form") ? C = `
|
|
538
539
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
539
540
|
<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"/>
|
|
540
541
|
</svg>
|
|
541
542
|
|
|
542
|
-
` :
|
|
543
|
+
` : w === n("total_amount") && (C = `
|
|
543
544
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
544
545
|
<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"/>
|
|
545
546
|
</svg>
|
|
546
547
|
|
|
547
548
|
`), q.innerHTML = C;
|
|
548
549
|
const L = document.createElement("span");
|
|
549
|
-
L.className = "wgt:text-sm wgt:text-weak-700", L.textContent =
|
|
550
|
-
const
|
|
551
|
-
return
|
|
550
|
+
L.className = "wgt:text-sm wgt:text-weak-700", L.textContent = w, B.appendChild(q), B.appendChild(L);
|
|
551
|
+
const f = document.createElement("span");
|
|
552
|
+
return f.className = "wgt:text-sm wgt:font-semibold wgt:text-strong-950 wgt:w-2/3 wgt:text-right", f.textContent = V, S.appendChild(B), S.appendChild(f), S;
|
|
552
553
|
}
|
|
553
|
-
l.appendChild(x(n("orderCode"),
|
|
554
|
-
x(n("address_form"),
|
|
554
|
+
l.appendChild(x(n("orderCode"), r == null ? void 0 : r.billNo)), l.appendChild(
|
|
555
|
+
x(n("address_form"), r == null ? void 0 : r.merchantAddress)
|
|
555
556
|
), l.appendChild(
|
|
556
557
|
x(
|
|
557
558
|
n("total_amount"),
|
|
558
|
-
te(
|
|
559
|
+
te(r == null ? void 0 : r.amount) + " VND"
|
|
559
560
|
)
|
|
560
561
|
), a.appendChild(l);
|
|
561
562
|
const o = document.createElement("div");
|
|
562
563
|
o.className = "wgt:mt-4 wgt:rounded-xl wgt:border wgt:border-[#E1E4EA] wgt:bg-white wgt:pb-6", a.appendChild(o);
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
const
|
|
566
|
-
|
|
564
|
+
const u = document.createElement("div");
|
|
565
|
+
u.className = "wgt:flex wgt:border-b wgt:border-[#E1E4EA]", o.appendChild(u);
|
|
566
|
+
const h = document.createElement("button");
|
|
567
|
+
h.type = "button", h.className = "wgt:relative wgt:flex-1 wgt:py-4 wgt:text-sm wgt:font-semibold ", h.innerHTML = `
|
|
567
568
|
<span class="wgt:flex wgt:items-center wgt:justify-center wgt:gap-2">
|
|
568
569
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
569
570
|
<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"/>
|
|
@@ -581,27 +582,27 @@ function we({
|
|
|
581
582
|
|
|
582
583
|
${n("business")}
|
|
583
584
|
</span>
|
|
584
|
-
`,
|
|
585
|
+
`, u.appendChild(h), u.appendChild(c);
|
|
585
586
|
const v = document.createElement("div");
|
|
586
587
|
v.className = "wgt:mt-4 wgt:px-4", o.appendChild(v);
|
|
587
|
-
const
|
|
588
|
+
const E = pe(), H = ge({
|
|
588
589
|
defaultValues: { taxCode: d || "" },
|
|
589
|
-
onFetchByTaxCode: (
|
|
590
|
+
onFetchByTaxCode: (w) => j(null, null, function* () {
|
|
590
591
|
var S, B;
|
|
591
|
-
const V = yield de(
|
|
592
|
+
const V = yield de(w);
|
|
592
593
|
return {
|
|
593
594
|
representativeName: (S = V.nguoi_dai_dien) != null ? S : "",
|
|
594
595
|
buyerAddress: (B = V.dia_chi) != null ? B : ""
|
|
595
596
|
};
|
|
596
597
|
})
|
|
597
598
|
});
|
|
598
|
-
let Z = "individual", b =
|
|
599
|
-
function A(
|
|
600
|
-
Z =
|
|
599
|
+
let Z = "individual", b = E;
|
|
600
|
+
function A(w) {
|
|
601
|
+
Z = w, h.style.borderBottom = "none", c.style.borderBottom = "none";
|
|
601
602
|
const V = "wgt:relative wgt:flex-1 wgt:py-4 wgt:text-sm wgt:font-semibold";
|
|
602
|
-
|
|
603
|
+
w === "individual" ? (h.className = `${V} wgt:text-strong-950`, h.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)", h.className = `${V} wgt:text-soft-400`, v.innerHTML = "", v.appendChild(H.container), b = H);
|
|
603
604
|
}
|
|
604
|
-
|
|
605
|
+
h.addEventListener("click", () => A("individual")), c.addEventListener("click", () => A("business")), A("individual");
|
|
605
606
|
const _ = document.createElement("p");
|
|
606
607
|
_.className = "wgt:mt-2 wgt:text-xs wgt:text-[#FF8447] wgt:text-left wgt:justify-center", _.textContent = n("invoiceform_note"), a.appendChild(_);
|
|
607
608
|
const m = document.createElement("div");
|
|
@@ -613,13 +614,13 @@ function we({
|
|
|
613
614
|
handleClick: () => {
|
|
614
615
|
if (!b.validate())
|
|
615
616
|
return;
|
|
616
|
-
const
|
|
617
|
+
const w = {
|
|
617
618
|
type: Z,
|
|
618
619
|
data: b.getValues()
|
|
619
620
|
}, { overlay: V } = me({
|
|
620
|
-
type:
|
|
621
|
-
data:
|
|
622
|
-
orderInfo:
|
|
621
|
+
type: w.type,
|
|
622
|
+
data: w.data,
|
|
623
|
+
orderInfo: r,
|
|
623
624
|
theme: e,
|
|
624
625
|
onClose: () => {
|
|
625
626
|
console.log("Popup closed");
|
|
@@ -628,12 +629,12 @@ function we({
|
|
|
628
629
|
var S, B, q;
|
|
629
630
|
V.remove(), p();
|
|
630
631
|
try {
|
|
631
|
-
if (typeof
|
|
632
|
-
const C = yield
|
|
633
|
-
type:
|
|
634
|
-
data:
|
|
635
|
-
}), L = (q = (B = (S = C == null ? void 0 : C.finalData) != null ? S : C == null ? void 0 : C.data) != null ? B : C) != null ? q : {},
|
|
636
|
-
if (N(),
|
|
632
|
+
if (typeof i != "function") return;
|
|
633
|
+
const C = yield i({
|
|
634
|
+
type: w.type,
|
|
635
|
+
data: w.data
|
|
636
|
+
}), L = (q = (B = (S = C == null ? void 0 : C.finalData) != null ? S : C == null ? void 0 : C.data) != null ? B : C) != null ? q : {}, f = String((L == null ? void 0 : L.status) || "").trim().toLowerCase();
|
|
637
|
+
if (N(), f === "invoiced") {
|
|
637
638
|
J({
|
|
638
639
|
message: n("invoice_success"),
|
|
639
640
|
description: n("invoice_description"),
|
|
@@ -645,7 +646,7 @@ function we({
|
|
|
645
646
|
}).open();
|
|
646
647
|
return;
|
|
647
648
|
}
|
|
648
|
-
if (
|
|
649
|
+
if (f === "failed") {
|
|
649
650
|
J({
|
|
650
651
|
message: n("invoice_failed"),
|
|
651
652
|
description: n("invoice_description_failed"),
|
|
@@ -675,11 +676,11 @@ function we({
|
|
|
675
676
|
});
|
|
676
677
|
return m.appendChild(T), a.appendChild(m), { container: s };
|
|
677
678
|
}
|
|
678
|
-
function
|
|
679
|
+
function we({ theme: r, onClose: t } = {}) {
|
|
679
680
|
const e = document.createElement("div");
|
|
680
|
-
e.className = " wgt:flex wgt:h-screen wgt:bg-[#F3F4F6] wgt:p-4",
|
|
681
|
-
const
|
|
682
|
-
|
|
681
|
+
e.className = " wgt:flex wgt:h-screen wgt:bg-[#F3F4F6] wgt:p-4", r && e.setAttribute("data-theme", r);
|
|
682
|
+
const i = document.createElement("div");
|
|
683
|
+
i.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";
|
|
683
684
|
const d = document.createElement("div");
|
|
684
685
|
d.className = "wgt:flex wgt:justify-center wgt:mb-4";
|
|
685
686
|
const s = document.createElement("div");
|
|
@@ -688,17 +689,17 @@ function ue({ theme: i, onClose: t } = {}) {
|
|
|
688
689
|
<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"/>
|
|
689
690
|
</svg>
|
|
690
691
|
|
|
691
|
-
`, d.appendChild(s),
|
|
692
|
+
`, d.appendChild(s), i.appendChild(d);
|
|
692
693
|
const a = document.createElement("h2");
|
|
693
|
-
a.className = "wgt:text-base wgt:font-semibold wgt:text-[#0E121B] wgt:mb-2", a.textContent = n("invoiceCheckout_title"),
|
|
694
|
+
a.className = "wgt:text-base wgt:font-semibold wgt:text-[#0E121B] wgt:mb-2", a.textContent = n("invoiceCheckout_title"), i.appendChild(a);
|
|
694
695
|
const g = document.createElement("p");
|
|
695
|
-
return g.className = "wgt:text-sm wgt:text-[#525866] wgt:leading-relaxed", g.textContent = n("invoiceCheckout_description"),
|
|
696
|
+
return g.className = "wgt:text-sm wgt:text-[#525866] wgt:leading-relaxed", g.textContent = n("invoiceCheckout_description"), i.appendChild(g), e.appendChild(i), { container: e };
|
|
696
697
|
}
|
|
697
|
-
function Ce({ theme:
|
|
698
|
+
function Ce({ theme: r, onClose: t } = {}) {
|
|
698
699
|
const e = document.createElement("div");
|
|
699
|
-
e.className = "wgt:min-h-screen wgt:flex wgt:bg-[#F3F4F6] wgt:p-4",
|
|
700
|
-
const
|
|
701
|
-
|
|
700
|
+
e.className = "wgt:min-h-screen wgt:flex wgt:bg-[#F3F4F6] wgt:p-4", r && e.setAttribute("data-theme", r);
|
|
701
|
+
const i = document.createElement("div");
|
|
702
|
+
i.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";
|
|
702
703
|
const d = document.createElement("div");
|
|
703
704
|
d.className = "wgt:flex wgt:justify-center wgt:mb-2";
|
|
704
705
|
const s = document.createElement("div");
|
|
@@ -720,31 +721,31 @@ function Ce({ theme: i, onClose: t } = {}) {
|
|
|
720
721
|
<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"/>
|
|
721
722
|
</svg>
|
|
722
723
|
|
|
723
|
-
`, d.appendChild(s),
|
|
724
|
+
`, d.appendChild(s), i.appendChild(d);
|
|
724
725
|
const a = document.createElement("h2");
|
|
725
|
-
a.className = "wgt:text-base wgt:font-semibold wgt:text-[#0E121B] wgt:mb-2", a.textContent = n("invoiceExpired_title"),
|
|
726
|
+
a.className = "wgt:text-base wgt:font-semibold wgt:text-[#0E121B] wgt:mb-2", a.textContent = n("invoiceExpired_title"), i.appendChild(a);
|
|
726
727
|
const g = document.createElement("p");
|
|
727
|
-
g.className = "wgt:text-sm wgt:text-[#525866] wgt:leading-relaxed wgt:px-2 wgt:mb-3", g.textContent = n("invoiceExpired_description"),
|
|
728
|
+
g.className = "wgt:text-sm wgt:text-[#525866] wgt:leading-relaxed wgt:px-2 wgt:mb-3", g.textContent = n("invoiceExpired_description"), i.appendChild(g);
|
|
728
729
|
const p = document.createElement("p");
|
|
729
|
-
return p.className = "wgt:text-sm wgt:text-[#99A0AE] wgt:italic wgt:leading-relaxed wgt:px-4", p.textContent = n("invoiceExpired_note"),
|
|
730
|
+
return p.className = "wgt:text-sm wgt:text-[#99A0AE] wgt:italic wgt:leading-relaxed wgt:px-4", p.textContent = n("invoiceExpired_note"), i.appendChild(p), e.appendChild(i), { container: e };
|
|
730
731
|
}
|
|
731
|
-
function
|
|
732
|
-
return String(
|
|
732
|
+
function ie(r) {
|
|
733
|
+
return String(r || "").trim().toLowerCase();
|
|
733
734
|
}
|
|
734
|
-
function Ne({ uuid:
|
|
735
|
-
const
|
|
736
|
-
|
|
735
|
+
function Ne({ uuid: r, orderInfo: t, theme: e }) {
|
|
736
|
+
const i = document.createElement("div");
|
|
737
|
+
i.className = "wgt:w-full wgt:min-h-screen";
|
|
737
738
|
let d = !1;
|
|
738
739
|
function s(o) {
|
|
739
|
-
d || (
|
|
740
|
+
d || (i.innerHTML = "", o && i.appendChild(o));
|
|
740
741
|
}
|
|
741
742
|
function a(o) {
|
|
742
743
|
o && console.log("[DEBUG] renderFailedPage:", o);
|
|
743
|
-
const
|
|
744
|
+
const u = ce({
|
|
744
745
|
theme: e,
|
|
745
746
|
onClose: F
|
|
746
747
|
});
|
|
747
|
-
s(
|
|
748
|
+
s(u.container);
|
|
748
749
|
}
|
|
749
750
|
function g() {
|
|
750
751
|
const o = Ce({
|
|
@@ -753,33 +754,33 @@ function Ne({ uuid: i, orderInfo: t, theme: e }) {
|
|
|
753
754
|
s(o.container);
|
|
754
755
|
}
|
|
755
756
|
function p(o) {
|
|
756
|
-
const
|
|
757
|
+
const u = we({
|
|
757
758
|
theme: e
|
|
758
759
|
});
|
|
759
|
-
s(
|
|
760
|
+
s(u.container);
|
|
760
761
|
}
|
|
761
762
|
function N(o) {
|
|
762
|
-
const
|
|
763
|
+
const u = ue({
|
|
763
764
|
orderInfo: o || {},
|
|
764
765
|
theme: e,
|
|
765
|
-
onSubmit: (v) => j(null, [v], function* ({ type:
|
|
766
|
-
const
|
|
767
|
-
if (!
|
|
766
|
+
onSubmit: (v) => j(null, [v], function* ({ type: h, data: c }) {
|
|
767
|
+
const E = k();
|
|
768
|
+
if (!E)
|
|
768
769
|
return a({ reason: "MISSING_UUID_ON_SUBMIT" }), { ok: !1 };
|
|
769
|
-
const H =
|
|
770
|
-
return yield le(
|
|
770
|
+
const H = fe(h, c);
|
|
771
|
+
return yield le(E, H), { ok: !0, finalData: yield ve(E, {
|
|
771
772
|
maxTries: 20,
|
|
772
773
|
intervalMs: 1500
|
|
773
774
|
}) };
|
|
774
775
|
}),
|
|
775
776
|
onBack: F
|
|
776
777
|
});
|
|
777
|
-
s(
|
|
778
|
+
s(u.container);
|
|
778
779
|
}
|
|
779
780
|
function k() {
|
|
780
|
-
var
|
|
781
|
+
var h;
|
|
781
782
|
const o = new URLSearchParams(window.location.search || "");
|
|
782
|
-
return String((
|
|
783
|
+
return String((h = o.get("uuid")) != null ? h : "").trim() || String(r || "").trim() || String((t == null ? void 0 : t.uuid) || "").trim();
|
|
783
784
|
}
|
|
784
785
|
function F() {
|
|
785
786
|
return j(this, null, function* () {
|
|
@@ -792,11 +793,11 @@ function Ne({ uuid: i, orderInfo: t, theme: e }) {
|
|
|
792
793
|
const o = k();
|
|
793
794
|
if (!o)
|
|
794
795
|
return a({ reason: "EMPTY_UUID_NO_API_CALL" });
|
|
795
|
-
const
|
|
796
|
-
if (
|
|
797
|
-
return a({ reason: "API_MESSAGE", apiMsg:
|
|
798
|
-
const c =
|
|
799
|
-
return c === "expired" ? g() : c === "invoiced" ? p(
|
|
796
|
+
const u = yield ne(o), h = String((u == null ? void 0 : u.message) || "").trim();
|
|
797
|
+
if (h)
|
|
798
|
+
return a({ reason: "API_MESSAGE", apiMsg: h, res: u });
|
|
799
|
+
const c = ie(u == null ? void 0 : u.status);
|
|
800
|
+
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 });
|
|
800
801
|
} catch (o) {
|
|
801
802
|
return console.log("[DEBUG] loadAndRender error:", o), a({ reason: "EXCEPTION", error: (o == null ? void 0 : o.message) || o });
|
|
802
803
|
}
|
|
@@ -816,27 +817,27 @@ function Ne({ uuid: i, orderInfo: t, theme: e }) {
|
|
|
816
817
|
});
|
|
817
818
|
}
|
|
818
819
|
function x() {
|
|
819
|
-
d = !0,
|
|
820
|
+
d = !0, i.innerHTML = "";
|
|
820
821
|
}
|
|
821
|
-
return { container:
|
|
822
|
+
return { container: i, init: l, destroy: x };
|
|
822
823
|
}
|
|
823
|
-
function
|
|
824
|
-
return String(
|
|
824
|
+
function he(r) {
|
|
825
|
+
return String(r || "").trim().toLowerCase() === "business" ? "enterprise" : "individual";
|
|
825
826
|
}
|
|
826
|
-
function
|
|
827
|
-
const e =
|
|
827
|
+
function fe(r, t) {
|
|
828
|
+
const e = he(r), i = {
|
|
828
829
|
invoiceType: e,
|
|
829
830
|
buyerName: (t == null ? void 0 : t.representativeName) || "",
|
|
830
831
|
address: (t == null ? void 0 : t.buyerAddress) || "",
|
|
831
832
|
email: (t == null ? void 0 : t.email) || ""
|
|
832
833
|
};
|
|
833
|
-
return e === "enterprise" && (
|
|
834
|
+
return e === "enterprise" && (i.taxCode = t != null && t.noTaxCode ? "" : (t == null ? void 0 : t.taxCode) || "", i.businessName = (t == null ? void 0 : t.businessName) || ""), i;
|
|
834
835
|
}
|
|
835
|
-
function ve(
|
|
836
|
-
return j(this, arguments, function* (
|
|
836
|
+
function ve(i) {
|
|
837
|
+
return j(this, arguments, function* (r, { maxTries: t = 20, intervalMs: e = 1500 } = {}) {
|
|
837
838
|
for (let s = 0; s < t; s++) {
|
|
838
839
|
yield xe(e);
|
|
839
|
-
const a = yield ne(
|
|
840
|
+
const a = yield ne(r), g = ie(a == null ? void 0 : a.status);
|
|
840
841
|
if (g === "invoiced") return a;
|
|
841
842
|
if (g === "expired") {
|
|
842
843
|
const p = new Error("Invoice request expired while polling");
|
|
@@ -847,8 +848,8 @@ function ve(r) {
|
|
|
847
848
|
throw d.code = "POLL_TIMEOUT", d;
|
|
848
849
|
});
|
|
849
850
|
}
|
|
850
|
-
function xe(
|
|
851
|
-
return new Promise((t) => setTimeout(t,
|
|
851
|
+
function xe(r) {
|
|
852
|
+
return new Promise((t) => setTimeout(t, r));
|
|
852
853
|
}
|
|
853
854
|
export {
|
|
854
855
|
Ne as createInvoiceRequestFlow
|