@invoice-sdk/widget 1.118.0 → 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-BP6_YoN3.js → index-DlbtRz_x.js} +377 -404
- package/dist/{index-D7Tgbbr0.js → index-EgycCzHi.js} +1270 -1220
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +74 -74
- package/dist/{loading-BBaWO-p-.js → loading-Btbxdqb9.js} +10 -10
- package/dist/{widget-DnM5jqo5.js → widget-Cr35XYNA.js} +2 -2
- package/package.json +1 -1
|
@@ -1,278 +1,279 @@
|
|
|
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
|
|
12
|
+
var j = (r, t, e) => new Promise((i, d) => {
|
|
13
13
|
var s = (p) => {
|
|
14
14
|
try {
|
|
15
15
|
g(e.next(p));
|
|
16
16
|
} catch (N) {
|
|
17
|
-
|
|
17
|
+
d(N);
|
|
18
18
|
}
|
|
19
19
|
}, a = (p) => {
|
|
20
20
|
try {
|
|
21
21
|
g(e.throw(p));
|
|
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
|
|
29
|
-
import { t as
|
|
30
|
-
function z(
|
|
31
|
-
const t =
|
|
32
|
-
return t ? t.length < 2 || t.length > 250 ? { valid: !1, error:
|
|
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:
|
|
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 =
|
|
40
|
-
return t ? t.length < 6 || t.length > 254 ? { valid: !1, error:
|
|
38
|
+
function K(r) {
|
|
39
|
+
const t = r.trim();
|
|
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
|
-
return t ? { valid: !1, error:
|
|
46
|
-
const
|
|
47
|
-
if (/[<>:"\/\\|?*@#$%!A-Za-z]/.test(
|
|
48
|
-
return { valid: !1, error:
|
|
45
|
+
return t ? { valid: !1, error: n("required_phone") } : { valid: !0 };
|
|
46
|
+
const i = e.replace(/\s/g, "");
|
|
47
|
+
if (/[<>:"\/\\|?*@#$%!A-Za-z]/.test(i))
|
|
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 =
|
|
54
|
-
if (!t) return { valid: !1, error:
|
|
52
|
+
function Q(r) {
|
|
53
|
+
const t = r.trim();
|
|
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))
|
|
57
|
-
return { valid: !1, error:
|
|
57
|
+
return { valid: !1, error: n("tax_code_invalid") };
|
|
58
58
|
if ((e.match(/-/g) || []).length > 1)
|
|
59
|
-
return { valid: !1, error:
|
|
59
|
+
return { valid: !1, error: n("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: n("tax_code_invalid_format") } : { valid: !0 };
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function pe({ defaultValues: r = {}, onChange: t } = {}) {
|
|
64
64
|
const e = {
|
|
65
|
-
representativeName:
|
|
66
|
-
buyerAddress:
|
|
67
|
-
email:
|
|
68
|
-
phone:
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
function
|
|
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
|
+
function d() {
|
|
72
72
|
typeof t == "function" && t($({}, e));
|
|
73
73
|
}
|
|
74
|
-
function s({ label: v, required:
|
|
75
|
-
const
|
|
76
|
-
|
|
74
|
+
function s({ label: v, required: E, name: H, type: Z = "text", placeholder: b }) {
|
|
75
|
+
const A = document.createElement("div");
|
|
76
|
+
A.className = "";
|
|
77
77
|
const _ = document.createElement("label");
|
|
78
|
-
_.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950", _.htmlFor =
|
|
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 =
|
|
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");
|
|
82
|
-
return T.className = "wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden", T.setAttribute("data-error-for",
|
|
83
|
-
e[
|
|
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
|
+
e[H] = m.value, m.classList.remove(
|
|
84
84
|
"wgt:border-semantic-error",
|
|
85
85
|
"wgt:bg-semantic-error-50"
|
|
86
|
-
), T.classList.add("wgt:hidden"),
|
|
86
|
+
), T.classList.add("wgt:hidden"), d();
|
|
87
87
|
}), m.addEventListener("blur", () => {
|
|
88
|
-
let
|
|
89
|
-
switch (
|
|
88
|
+
let w;
|
|
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 =
|
|
109
|
-
}),
|
|
108
|
+
), T.textContent = w.error, T.classList.remove("wgt:hidden"));
|
|
109
|
+
}), A.appendChild(_), A.appendChild(m), A.appendChild(T), { field: A, input: m, errorEl: T };
|
|
110
110
|
}
|
|
111
111
|
const {
|
|
112
112
|
field: a,
|
|
113
113
|
input: g,
|
|
114
114
|
errorEl: p
|
|
115
115
|
} = s({
|
|
116
|
-
label:
|
|
116
|
+
label: n("representativeName"),
|
|
117
117
|
required: !0,
|
|
118
118
|
name: "representativeName",
|
|
119
|
-
placeholder:
|
|
120
|
-
}), { field: N, errorEl:
|
|
121
|
-
label:
|
|
119
|
+
placeholder: n("representativeName_input")
|
|
120
|
+
}), { field: N, errorEl: k } = s({
|
|
121
|
+
label: n("buyerAddress"),
|
|
122
122
|
required: !1,
|
|
123
123
|
name: "buyerAddress",
|
|
124
|
-
placeholder:
|
|
124
|
+
placeholder: n("buyerAddress_input")
|
|
125
125
|
}), {
|
|
126
126
|
field: F,
|
|
127
|
-
input:
|
|
128
|
-
errorEl:
|
|
127
|
+
input: M,
|
|
128
|
+
errorEl: l
|
|
129
129
|
} = s({
|
|
130
|
-
label:
|
|
130
|
+
label: n("email"),
|
|
131
131
|
required: !0,
|
|
132
132
|
name: "email",
|
|
133
133
|
type: "email",
|
|
134
|
-
placeholder:
|
|
134
|
+
placeholder: n("email_input")
|
|
135
135
|
}), {
|
|
136
136
|
field: x,
|
|
137
|
-
input:
|
|
138
|
-
errorEl:
|
|
137
|
+
input: o,
|
|
138
|
+
errorEl: u
|
|
139
139
|
} = s({
|
|
140
|
-
label:
|
|
140
|
+
label: n("phone"),
|
|
141
141
|
required: !1,
|
|
142
142
|
name: "phone",
|
|
143
143
|
type: "tel",
|
|
144
|
-
placeholder:
|
|
144
|
+
placeholder: n("phone_input")
|
|
145
145
|
});
|
|
146
|
-
|
|
146
|
+
i.appendChild(a), i.appendChild(N), i.appendChild(F), i.appendChild(x);
|
|
147
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
|
-
const
|
|
156
|
-
if (
|
|
155
|
+
const H = z(e.representativeName);
|
|
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
|
-
const
|
|
165
|
-
if (
|
|
164
|
+
const Z = K(e.email);
|
|
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
|
-
function
|
|
177
|
-
defaultValues:
|
|
176
|
+
function ge({
|
|
177
|
+
defaultValues: r = {},
|
|
178
178
|
onChange: t,
|
|
179
179
|
onFetchByTaxCode: e
|
|
180
180
|
} = {}) {
|
|
181
|
-
const
|
|
182
|
-
noTaxCode: !!
|
|
183
|
-
taxCode:
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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 || ""
|
|
190
|
+
}, d = document.createElement("div");
|
|
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
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
|
-
const
|
|
198
|
-
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
return
|
|
203
|
-
|
|
198
|
+
const P = document.createElement("label");
|
|
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] || "";
|
|
202
|
+
const R = document.createElement("div");
|
|
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
|
-
}),
|
|
208
|
-
if (!
|
|
207
|
+
), R.classList.add("wgt:hidden"), s();
|
|
208
|
+
}), y.addEventListener("blur", () => {
|
|
209
|
+
if (!y.value.trim() && !L) return;
|
|
209
210
|
let U;
|
|
210
211
|
switch (f) {
|
|
211
|
-
case "
|
|
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
|
-
}), O.appendChild(
|
|
231
|
+
), R.textContent = U.error, R.classList.remove("wgt:hidden"));
|
|
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
|
-
N.textContent =
|
|
239
|
-
|
|
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", () => {
|
|
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();
|
|
243
244
|
}), g.appendChild(p), g.appendChild(N);
|
|
244
|
-
const A = document.createElement("div");
|
|
245
|
-
A.className = "wgt:space-y-2";
|
|
246
|
-
const F = document.createElement("label");
|
|
247
|
-
F.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950 ", F.innerHTML = r("confirmation_popup_taxCode") + '<span class="wgt:text-[#ED1C24]">*</span>';
|
|
248
245
|
const k = document.createElement("div");
|
|
249
|
-
k.className = "wgt:
|
|
250
|
-
const
|
|
251
|
-
|
|
246
|
+
k.className = "wgt:space-y-2";
|
|
247
|
+
const F = document.createElement("label");
|
|
248
|
+
F.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950 ", F.innerHTML = n("confirmation_popup_taxCode") + '<span class="wgt:text-[#ED1C24]">*</span>';
|
|
249
|
+
const M = document.createElement("div");
|
|
250
|
+
M.className = "wgt:flex wgt:gap-2 wgt:mt-2";
|
|
251
|
+
const l = document.createElement("input");
|
|
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
|
-
x.className = "wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden",
|
|
254
|
-
|
|
254
|
+
x.className = "wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden", l.addEventListener("input", () => {
|
|
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
|
-
if (
|
|
260
|
-
const C = Q(
|
|
261
|
-
C.valid || (
|
|
259
|
+
}), l.addEventListener("blur", () => {
|
|
260
|
+
if (i.noTaxCode || !l.value.trim()) return;
|
|
261
|
+
const C = Q(l.value);
|
|
262
|
+
C.valid || (l.classList.add(
|
|
262
263
|
"wgt:border-semantic-error",
|
|
263
264
|
"wgt:bg-semantic-error-50"
|
|
264
265
|
), x.textContent = C.error, x.classList.remove("wgt:hidden"));
|
|
265
266
|
});
|
|
266
|
-
const
|
|
267
|
+
const o = G({
|
|
267
268
|
type: "button",
|
|
268
|
-
title:
|
|
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
|
-
handleClick: () =>
|
|
271
|
-
if (
|
|
271
|
+
handleClick: () => j(null, null, function* () {
|
|
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",
|
|
277
278
|
"wgt:bg-semantic-error-50"
|
|
278
279
|
), x.textContent = "Vui lòng nhập MST", x.classList.remove("wgt:hidden");
|
|
@@ -280,228 +281,228 @@ function pe({
|
|
|
280
281
|
}
|
|
281
282
|
const L = Q(C);
|
|
282
283
|
if (!L.valid) {
|
|
283
|
-
|
|
284
|
+
l.classList.add(
|
|
284
285
|
"wgt:border-semantic-error",
|
|
285
286
|
"wgt:bg-semantic-error-50"
|
|
286
287
|
), x.textContent = L.error, x.classList.remove("wgt:hidden");
|
|
287
288
|
return;
|
|
288
289
|
}
|
|
289
290
|
try {
|
|
290
|
-
|
|
291
|
-
const f = yield e(C, $({},
|
|
291
|
+
o.disabled = !0;
|
|
292
|
+
const f = yield e(C, $({}, i));
|
|
292
293
|
if (!f || typeof f != "object") return;
|
|
293
|
-
f.representativeName != null && (
|
|
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();
|
|
294
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
|
-
|
|
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
|
+
field: u,
|
|
307
308
|
input: h,
|
|
308
309
|
errorEl: c
|
|
309
310
|
} = a({
|
|
310
|
-
label:
|
|
311
|
+
label: n("businessName"),
|
|
311
312
|
required: !0,
|
|
312
|
-
name: "
|
|
313
|
-
placeholder:
|
|
313
|
+
name: "businessName",
|
|
314
|
+
placeholder: n("businessName_input")
|
|
314
315
|
}), {
|
|
315
316
|
field: v,
|
|
316
|
-
input:
|
|
317
|
-
errorEl:
|
|
317
|
+
input: E,
|
|
318
|
+
errorEl: H
|
|
318
319
|
} = a({
|
|
319
|
-
label:
|
|
320
|
+
label: n("representativeName"),
|
|
320
321
|
required: !0,
|
|
321
322
|
name: "representativeName",
|
|
322
|
-
placeholder:
|
|
323
|
+
placeholder: n("representativeName_input")
|
|
323
324
|
}), {
|
|
324
|
-
field:
|
|
325
|
+
field: Z,
|
|
325
326
|
input: b,
|
|
326
|
-
errorEl:
|
|
327
|
+
errorEl: A
|
|
327
328
|
} = a({
|
|
328
|
-
label:
|
|
329
|
+
label: n("buyerAddress"),
|
|
329
330
|
required: !1,
|
|
330
331
|
name: "buyerAddress",
|
|
331
|
-
placeholder:
|
|
332
|
+
placeholder: n("buyerAddress_input")
|
|
332
333
|
}), {
|
|
333
334
|
field: _,
|
|
334
335
|
input: m,
|
|
335
336
|
errorEl: T
|
|
336
337
|
} = a({
|
|
337
|
-
label:
|
|
338
|
+
label: n("email"),
|
|
338
339
|
required: !0,
|
|
339
340
|
name: "email",
|
|
340
341
|
type: "email",
|
|
341
|
-
placeholder:
|
|
342
|
+
placeholder: n("email_input")
|
|
342
343
|
}), {
|
|
343
|
-
field:
|
|
344
|
+
field: w,
|
|
344
345
|
input: V,
|
|
345
|
-
errorEl:
|
|
346
|
+
errorEl: S
|
|
346
347
|
} = a({
|
|
347
|
-
label:
|
|
348
|
+
label: n("phone"),
|
|
348
349
|
required: !0,
|
|
349
350
|
name: "phone",
|
|
350
351
|
type: "tel",
|
|
351
|
-
placeholder:
|
|
352
|
+
placeholder: n("phone_input")
|
|
352
353
|
});
|
|
353
|
-
|
|
354
|
-
function
|
|
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;
|
|
355
|
+
function B() {
|
|
355
356
|
let C = !0;
|
|
356
|
-
function L(
|
|
357
|
-
|
|
357
|
+
function L(P, y, R) {
|
|
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
|
-
),
|
|
362
|
+
), R && y && (y.textContent = R, y.classList.remove("wgt:hidden")), C = !1;
|
|
362
363
|
}
|
|
363
|
-
if (!
|
|
364
|
-
const
|
|
365
|
-
|
|
364
|
+
if (!i.noTaxCode) {
|
|
365
|
+
const P = Q(i.taxCode);
|
|
366
|
+
P.valid || L(l, x, P.error);
|
|
366
367
|
}
|
|
367
|
-
const f = z(
|
|
368
|
+
const f = z(i.businessName);
|
|
368
369
|
f.valid || L(h, c, f.error);
|
|
369
|
-
const W = z(
|
|
370
|
-
if (W.valid || L(
|
|
371
|
-
const
|
|
372
|
-
|
|
370
|
+
const W = z(i.representativeName);
|
|
371
|
+
if (W.valid || L(E, H, W.error), i.buyerAddress.trim()) {
|
|
372
|
+
const P = X(i.buyerAddress);
|
|
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
|
-
return O.valid || L(V,
|
|
377
|
+
const O = Y(i.phone, !0);
|
|
378
|
+
return O.valid || L(V, S, O.error), C;
|
|
378
379
|
}
|
|
379
380
|
function q() {
|
|
380
|
-
return $({},
|
|
381
|
+
return $({}, i);
|
|
381
382
|
}
|
|
382
|
-
return { container:
|
|
383
|
+
return { container: d, getValues: q, validate: B };
|
|
383
384
|
}
|
|
384
|
-
function
|
|
385
|
-
type:
|
|
385
|
+
function me({
|
|
386
|
+
type: r,
|
|
386
387
|
data: t,
|
|
387
388
|
orderInfo: e,
|
|
388
|
-
theme:
|
|
389
|
-
onClose:
|
|
389
|
+
theme: i,
|
|
390
|
+
onClose: d,
|
|
390
391
|
onConfirm: s
|
|
391
392
|
}) {
|
|
392
393
|
const a = document.createElement("div");
|
|
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");
|
|
400
401
|
p.className = "wgt:px-6 wgt:pt-6 wgt:pb-4 wgt:space-y-2";
|
|
401
402
|
const N = document.createElement("h3");
|
|
402
|
-
N.className = "wgt:text-xl wgt:font-semibold wgt:text-center wgt:text-strong-950", N.textContent =
|
|
403
|
-
const
|
|
404
|
-
|
|
403
|
+
N.className = "wgt:text-xl wgt:font-semibold wgt:text-center wgt:text-strong-950", N.textContent = n("confirmation_popup_title");
|
|
404
|
+
const k = document.createElement("p");
|
|
405
|
+
k.className = "wgt:text-sm wgt:text-center wgt:text-[#525866]", k.textContent = n("confirmation_popup_subtitle"), p.appendChild(N), p.appendChild(k), g.appendChild(p);
|
|
405
406
|
const F = document.createElement("div");
|
|
406
407
|
F.className = "wgt:px-6 wgt:pb-4";
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
function
|
|
408
|
+
const M = document.createElement("div");
|
|
409
|
+
M.className = "wgt:space-y-3 wgt:rounded-xl wgt:bg-weak-50 wgt:px-4 wgt:py-3";
|
|
410
|
+
function l(b, A, _) {
|
|
410
411
|
const m = document.createElement("div");
|
|
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
|
-
V.className = "wgt:text-sm wgt:text-[#525866] wgt:w-1/3", V.textContent =
|
|
418
|
-
const
|
|
419
|
-
return
|
|
418
|
+
V.className = "wgt:text-sm wgt:text-[#525866] wgt:w-1/3", V.textContent = A;
|
|
419
|
+
const S = document.createElement("span");
|
|
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>',
|
|
422
|
-
|
|
423
|
-
|
|
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>';
|
|
423
|
+
M.appendChild(
|
|
424
|
+
l(
|
|
424
425
|
x,
|
|
425
|
-
|
|
426
|
+
n("confirmation_popup_orderCode"),
|
|
426
427
|
e == null ? void 0 : e.billNo
|
|
427
428
|
)
|
|
428
|
-
),
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
429
|
+
), M.appendChild(
|
|
430
|
+
l(
|
|
431
|
+
o,
|
|
432
|
+
n("confirmation_popup_address"),
|
|
432
433
|
e == null ? void 0 : e.merchantAddress
|
|
433
434
|
)
|
|
434
|
-
),
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
435
|
+
), M.appendChild(
|
|
436
|
+
l(
|
|
437
|
+
u,
|
|
438
|
+
n("confirmation_popup_totalAmount"),
|
|
438
439
|
te(e == null ? void 0 : e.amount) + " VND"
|
|
439
440
|
)
|
|
440
|
-
), F.appendChild(
|
|
441
|
+
), F.appendChild(M), g.appendChild(F);
|
|
441
442
|
const h = document.createElement("div");
|
|
442
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
|
-
function v(b,
|
|
446
|
+
function v(b, A) {
|
|
446
447
|
const _ = document.createElement("div");
|
|
447
448
|
_.className = "wgt:flex wgt:items-start wgt:justify-between wgt:gap-4";
|
|
448
449
|
const m = document.createElement("span");
|
|
449
450
|
m.className = "wgt:text-sm wgt:text-[#0E121B] wgt:w-1/3", m.textContent = b;
|
|
450
451
|
const T = document.createElement("span");
|
|
451
|
-
return T.className = "wgt:text-sm wgt:font-semibold wgt:text-strong-950 wgt:text-right wgt:w-2/3", T.textContent =
|
|
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
|
-
v(
|
|
454
|
+
r === "business" ? (c.appendChild(
|
|
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"),
|
|
458
461
|
t.representativeName
|
|
459
462
|
)
|
|
460
463
|
), c.appendChild(
|
|
461
|
-
v(
|
|
464
|
+
v(n("confirmation_popup_buyerAddress"), t.buyerAddress)
|
|
462
465
|
), c.appendChild(
|
|
463
|
-
v(
|
|
466
|
+
v(n("confirmation_popup_email"), t.email)
|
|
464
467
|
), c.appendChild(
|
|
465
|
-
v(
|
|
466
|
-
), c.appendChild(
|
|
467
|
-
v(r("confirmation_popup_phone"), t.phone)
|
|
468
|
+
v(n("confirmation_popup_phone"), t.phone)
|
|
468
469
|
)) : (c.appendChild(
|
|
469
470
|
v(
|
|
470
|
-
|
|
471
|
+
n("confirmation_popup_representativeName"),
|
|
471
472
|
t.representativeName
|
|
472
473
|
)
|
|
473
474
|
), c.appendChild(
|
|
474
|
-
v(
|
|
475
|
+
v(n("confirmation_popup_buyerAddress"), t.buyerAddress)
|
|
475
476
|
), c.appendChild(
|
|
476
|
-
v(
|
|
477
|
+
v(n("confirmation_popup_email"), t.email)
|
|
477
478
|
)), h.appendChild(c), g.appendChild(h);
|
|
478
|
-
const
|
|
479
|
-
|
|
480
|
-
const
|
|
479
|
+
const E = document.createElement("div");
|
|
480
|
+
E.className = "wgt:px-6 wgt:pb-6 wgt:flex wgt:gap-3";
|
|
481
|
+
const H = G({
|
|
481
482
|
type: "button",
|
|
482
483
|
title: "Đóng",
|
|
483
484
|
className: "wgt:flex-1 wgt:py-3 wgt:text-sm wgt:font-semibold wgt:rounded-[8px] wgt:bg-white wgt:text-primary wgt:border wgt:border-primary",
|
|
484
485
|
handleClick: () => {
|
|
485
|
-
typeof
|
|
486
|
+
typeof d == "function" && d(), a.remove();
|
|
486
487
|
}
|
|
487
|
-
}),
|
|
488
|
+
}), Z = G({
|
|
488
489
|
type: "button",
|
|
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
|
-
b.target === a && (typeof
|
|
496
|
+
return E.appendChild(H), E.appendChild(Z), g.appendChild(E), a.appendChild(g), a.addEventListener("click", (b) => {
|
|
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
|
-
taxCode:
|
|
504
|
+
onSubmit: i,
|
|
505
|
+
taxCode: d = ""
|
|
505
506
|
}) {
|
|
506
507
|
const s = document.createElement("div");
|
|
507
508
|
s.className = "wgt:flex wgt:flex-col wgt:items-center wgt:justify-between wgt:h-full wgt:shadow wgt:rounded-xl", e && s.setAttribute("data-theme", e);
|
|
@@ -513,55 +514,55 @@ function me({
|
|
|
513
514
|
close: N
|
|
514
515
|
} = oe();
|
|
515
516
|
s.style.position = s.style.position || "relative", s.appendChild(g);
|
|
516
|
-
const
|
|
517
|
-
|
|
517
|
+
const k = document.createElement("div");
|
|
518
|
+
k.className = "wgt:space-y-1";
|
|
518
519
|
const F = document.createElement("h3");
|
|
519
|
-
F.className = "wgt:text-2xl wgt:font-semibold wgt:text-text-black wgt:text-center wgt:justify-center", F.textContent =
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
function x(
|
|
525
|
-
const Z = document.createElement("div");
|
|
526
|
-
Z.className = "wgt:flex wgt:items-start";
|
|
520
|
+
F.className = "wgt:text-2xl wgt:font-semibold wgt:text-text-black wgt:text-center wgt:justify-center", F.textContent = n("invoiceform_title");
|
|
521
|
+
const M = document.createElement("p");
|
|
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);
|
|
523
|
+
const l = document.createElement("div");
|
|
524
|
+
l.className = "wgt:mt-2 wgt:space-y-3 wgt:rounded-xl wgt:bg-weak-50 wgt:px-6 wgt:py-6";
|
|
525
|
+
function x(w, V) {
|
|
527
526
|
const S = document.createElement("div");
|
|
528
|
-
S.className = "wgt:flex wgt:items-
|
|
527
|
+
S.className = "wgt:flex wgt:items-start";
|
|
528
|
+
const B = document.createElement("div");
|
|
529
|
+
B.className = "wgt:flex wgt:items-center wgt:gap-2 wgt:w-1/3";
|
|
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
|
+
L.className = "wgt:text-sm wgt:text-weak-700", L.textContent = w, B.appendChild(q), B.appendChild(L);
|
|
550
551
|
const f = document.createElement("span");
|
|
551
|
-
return f.className = "wgt:text-sm wgt:font-semibold wgt:text-strong-950 wgt:w-2/3 wgt:text-right", f.textContent = V,
|
|
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
|
-
|
|
554
|
-
x(
|
|
555
|
-
),
|
|
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)
|
|
556
|
+
), l.appendChild(
|
|
556
557
|
x(
|
|
557
|
-
|
|
558
|
-
te(
|
|
558
|
+
n("total_amount"),
|
|
559
|
+
te(r == null ? void 0 : r.amount) + " VND"
|
|
559
560
|
)
|
|
560
|
-
), a.appendChild(
|
|
561
|
-
const
|
|
562
|
-
|
|
563
|
-
const
|
|
564
|
-
|
|
561
|
+
), a.appendChild(l);
|
|
562
|
+
const o = document.createElement("div");
|
|
563
|
+
o.className = "wgt:mt-4 wgt:rounded-xl wgt:border wgt:border-[#E1E4EA] wgt:bg-white wgt:pb-6", a.appendChild(o);
|
|
564
|
+
const u = document.createElement("div");
|
|
565
|
+
u.className = "wgt:flex wgt:border-b wgt:border-[#E1E4EA]", o.appendChild(u);
|
|
565
566
|
const h = document.createElement("button");
|
|
566
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">
|
|
@@ -569,7 +570,7 @@ function me({
|
|
|
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"/>
|
|
570
571
|
</svg>
|
|
571
572
|
|
|
572
|
-
${
|
|
573
|
+
${n("individual")}
|
|
573
574
|
</span>
|
|
574
575
|
`;
|
|
575
576
|
const c = document.createElement("button");
|
|
@@ -579,64 +580,64 @@ function me({
|
|
|
579
580
|
<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"/>
|
|
580
581
|
</svg>
|
|
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
|
-
v.className = "wgt:mt-4 wgt:px-4",
|
|
587
|
-
const
|
|
588
|
-
defaultValues: { taxCode:
|
|
589
|
-
onFetchByTaxCode: (
|
|
590
|
-
var
|
|
591
|
-
const V = yield
|
|
587
|
+
v.className = "wgt:mt-4 wgt:px-4", o.appendChild(v);
|
|
588
|
+
const E = pe(), H = ge({
|
|
589
|
+
defaultValues: { taxCode: d || "" },
|
|
590
|
+
onFetchByTaxCode: (w) => j(null, null, function* () {
|
|
591
|
+
var S, B;
|
|
592
|
+
const V = yield de(w);
|
|
592
593
|
return {
|
|
593
|
-
representativeName: (
|
|
594
|
-
buyerAddress: (
|
|
594
|
+
representativeName: (S = V.nguoi_dai_dien) != null ? S : "",
|
|
595
|
+
buyerAddress: (B = V.dia_chi) != null ? B : ""
|
|
595
596
|
};
|
|
596
597
|
})
|
|
597
598
|
});
|
|
598
|
-
let
|
|
599
|
-
function
|
|
600
|
-
|
|
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
|
-
h.addEventListener("click", () =>
|
|
605
|
+
h.addEventListener("click", () => A("individual")), c.addEventListener("click", () => A("business")), A("individual");
|
|
605
606
|
const _ = document.createElement("p");
|
|
606
|
-
_.className = "wgt:mt-2 wgt:text-xs wgt:text-[#FF8447] wgt:text-left wgt:justify-center", _.textContent =
|
|
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");
|
|
608
609
|
m.className = "wgt:mt-6 wgt:w-full wgt:flex wgt:justify-center wgt:items-center";
|
|
609
610
|
const T = G({
|
|
610
611
|
type: "button",
|
|
611
|
-
title:
|
|
612
|
+
title: n("btn_preview"),
|
|
612
613
|
className: "wgt:min-w-[163px] wgt:text-white",
|
|
613
614
|
handleClick: () => {
|
|
614
615
|
if (!b.validate())
|
|
615
616
|
return;
|
|
616
|
-
const
|
|
617
|
-
type:
|
|
617
|
+
const w = {
|
|
618
|
+
type: Z,
|
|
618
619
|
data: b.getValues()
|
|
619
|
-
}, { overlay: V } =
|
|
620
|
-
type:
|
|
621
|
-
data:
|
|
622
|
-
orderInfo:
|
|
620
|
+
}, { overlay: V } = me({
|
|
621
|
+
type: w.type,
|
|
622
|
+
data: w.data,
|
|
623
|
+
orderInfo: r,
|
|
623
624
|
theme: e,
|
|
624
625
|
onClose: () => {
|
|
625
626
|
console.log("Popup closed");
|
|
626
627
|
},
|
|
627
|
-
onConfirm: () =>
|
|
628
|
-
var
|
|
628
|
+
onConfirm: () => j(null, null, function* () {
|
|
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 = (
|
|
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();
|
|
636
637
|
if (N(), f === "invoiced") {
|
|
637
638
|
J({
|
|
638
|
-
message:
|
|
639
|
-
description:
|
|
639
|
+
message: n("invoice_success"),
|
|
640
|
+
description: n("invoice_description"),
|
|
640
641
|
// okLabel: t('close'),
|
|
641
642
|
isSuccess: !0,
|
|
642
643
|
hideOkButton: !0,
|
|
@@ -647,8 +648,8 @@ function me({
|
|
|
647
648
|
}
|
|
648
649
|
if (f === "failed") {
|
|
649
650
|
J({
|
|
650
|
-
message:
|
|
651
|
-
description:
|
|
651
|
+
message: n("invoice_failed"),
|
|
652
|
+
description: n("invoice_description_failed"),
|
|
652
653
|
// okLabel: t('close'),
|
|
653
654
|
isSuccess: !1,
|
|
654
655
|
hideOkButton: !0,
|
|
@@ -659,8 +660,8 @@ function me({
|
|
|
659
660
|
}
|
|
660
661
|
} catch (C) {
|
|
661
662
|
N(), J({
|
|
662
|
-
message:
|
|
663
|
-
description:
|
|
663
|
+
message: n("invoice_failed"),
|
|
664
|
+
description: n("invoice_description_failed"),
|
|
664
665
|
// okLabel: t('close'),
|
|
665
666
|
isSuccess: !1,
|
|
666
667
|
hideOkButton: !0,
|
|
@@ -675,32 +676,32 @@ function me({
|
|
|
675
676
|
});
|
|
676
677
|
return m.appendChild(T), a.appendChild(m), { container: s };
|
|
677
678
|
}
|
|
678
|
-
function we({ theme:
|
|
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
|
-
|
|
683
|
-
const
|
|
684
|
-
|
|
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";
|
|
684
|
+
const d = document.createElement("div");
|
|
685
|
+
d.className = "wgt:flex wgt:justify-center wgt:mb-4";
|
|
685
686
|
const s = document.createElement("div");
|
|
686
687
|
s.className = "wgt:w-12 wgt:h-12 wgt:rounded-full wgt:flex wgt:items-center wgt:justify-center", s.style.backgroundColor = "#335CFF", s.innerHTML = `
|
|
687
688
|
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
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
|
-
`,
|
|
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 =
|
|
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 =
|
|
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
|
|
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
|
-
|
|
702
|
-
const
|
|
703
|
-
|
|
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";
|
|
703
|
+
const d = document.createElement("div");
|
|
704
|
+
d.className = "wgt:flex wgt:justify-center wgt:mb-2";
|
|
704
705
|
const s = document.createElement("div");
|
|
705
706
|
s.innerHTML = `
|
|
706
707
|
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -720,163 +721,135 @@ function ue({ 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
|
-
`,
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
733
|
-
e.className = "wgt:min-h-screen wgt:flex wgt:items-center wgt:bg-[#F3F4F6] wgt:p-4 wgt:justify-center", i && e.setAttribute("data-theme", i);
|
|
734
|
-
const n = document.createElement("div");
|
|
735
|
-
n.className = "wgt:w-full wgt:items-center wgt:flex wgt:flex-col wgt:min-h-screen wgt:justify-center wgt:bg-white wgt:rounded-2xl wgt:shadow-sm wgt:px-4 wgt:py-5 wgt:text-center";
|
|
736
|
-
const o = document.createElement("div");
|
|
737
|
-
o.className = "wgt:flex wgt:justify-center wgt:mb-2 wgt:items-center wgt:justify-center";
|
|
738
|
-
const s = document.createElement("div");
|
|
739
|
-
s.innerHTML = `
|
|
740
|
-
<svg width="148" height="148" viewBox="0 0 148 148" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
741
|
-
<path d="M135.244 83.385C135.244 100.471 128.265 115.873 117.075 126.943C106.125 137.892 90.9645 144.51 74.2393 144.51C57.6344 144.51 42.4734 137.772 31.4035 126.943C20.2132 115.873 13.2344 100.471 13.2344 83.385C13.2344 49.5736 40.5482 22.2598 74.2393 22.2598C107.93 22.2598 135.244 49.6939 135.244 83.385Z" fill="#F1F3FA" stroke="#D5DAE5" stroke-width="1.58571" stroke-miterlimit="10"/>
|
|
742
|
-
<path d="M65.7815 28.5312L61.2562 44.4926L72.0884 51.9999L71.3267 70.3394L84.999 45.2472L78.6484 40.1734L85.9114 28.5312H94.065L118.732 55.3638L119.694 132.853C119.694 135.5 117.528 137.546 114.881 137.546H39.317C36.6697 137.546 34.5039 135.38 34.5039 132.853V33.224C34.5039 30.5768 36.6697 28.5312 39.317 28.5312H65.7815Z" fill="white" stroke="#D5DAE5" stroke-width="1.58571" stroke-miterlimit="10" stroke-linejoin="round"/>
|
|
743
|
-
<path d="M60.7974 44.7749H46.2381C45.3958 44.7749 44.6738 44.053 44.6738 43.2107C44.6738 42.3684 45.3958 41.6465 46.2381 41.6465H60.7974C61.6397 41.6465 62.3616 42.3684 62.3616 43.2107C62.3616 44.053 61.6397 44.7749 60.7974 44.7749Z" fill="#D5DAE5"/>
|
|
744
|
-
<path d="M60.1958 53.437H46.2381C45.3958 53.437 44.6738 52.7151 44.6738 51.8728C44.6738 51.0305 45.3958 50.3086 46.2381 50.3086H60.0755C60.9177 50.3086 61.6397 51.0305 61.6397 51.8728C61.6397 52.7151 60.9177 53.437 60.1958 53.437Z" fill="#D5DAE5"/>
|
|
745
|
-
<path d="M93.0469 28.5312V49.9491C93.0469 52.9573 95.694 55.3638 98.7022 55.3638H117.714" fill="#D5DAE5"/>
|
|
746
|
-
<path d="M61.7026 21.3768L57.1523 14.5273" stroke="#AAB2C5" stroke-width="1.58571"/>
|
|
747
|
-
<path d="M73.8365 17.9519L74.3711 0.601562" stroke="#AAB2C5" stroke-width="1.58571"/>
|
|
748
|
-
<path d="M84.7168 21.5372L91.9805 5.77148" stroke="#AAB2C5" stroke-width="1.58571"/>
|
|
749
|
-
<path d="M60.0089 108.149C59.5035 108.149 59.0991 107.947 58.6948 107.644C57.9872 106.936 57.9872 105.723 58.6948 105.016C63.3449 100.467 69.5112 97.9395 76.082 97.9395C82.6528 97.9395 88.8192 100.467 93.4692 105.016C94.1769 105.723 94.1769 106.936 93.4692 107.644C92.7616 108.352 91.5486 108.352 90.8409 107.644C86.8985 103.701 81.6419 101.579 76.082 101.579C70.5221 101.579 65.2655 103.701 61.3231 107.644C60.9187 107.947 60.5144 108.149 60.0089 108.149Z" fill="#AAB2C5"/>
|
|
750
|
-
<path d="M66.3775 81.0578L68.8036 78.6317C69.5113 77.9241 69.5113 76.711 68.8036 76.0034C68.096 75.2958 66.883 75.2958 66.1753 76.0034L63.7492 78.4295L61.3231 76.0034C60.6155 75.2958 59.4024 75.2958 58.6948 76.0034C57.9872 76.711 57.9872 77.9241 58.6948 78.6317L61.1209 81.0578L58.6948 83.4839C57.9872 84.1915 57.9872 85.4046 58.6948 86.1122C59.0991 86.5166 59.5035 86.6177 60.0089 86.6177C60.5144 86.6177 60.9187 86.4155 61.3231 86.1122L63.7492 83.6861L66.1753 86.1122C66.5797 86.5166 66.984 86.6177 67.4895 86.6177C67.9949 86.6177 68.3993 86.4155 68.8036 86.1122C69.5113 85.4046 69.5113 84.1915 68.8036 83.4839L66.3775 81.0578Z" fill="#AAB2C5"/>
|
|
751
|
-
<path d="M90.942 81.0578L93.3681 78.6317C94.0757 77.9241 94.0757 76.711 93.3681 76.0034C92.6605 75.2958 91.4474 75.2958 90.7398 76.0034L88.3137 78.4295L85.8875 76.0034C85.1799 75.2958 83.9669 75.2958 83.2592 76.0034C82.5516 76.711 82.5516 77.9241 83.2592 78.6317L85.6853 81.0578L83.2592 83.4839C82.5516 84.1915 82.5516 85.4046 83.2592 86.1122C83.6636 86.5166 84.0679 86.6177 84.5734 86.6177C85.0788 86.6177 85.4832 86.4155 85.8875 86.1122L88.3137 83.6861L90.7398 86.1122C91.1441 86.5166 91.5485 86.6177 92.0539 86.6177C92.5594 86.6177 92.9637 86.4155 93.3681 86.1122C94.0757 85.4046 94.0757 84.1915 93.3681 83.4839L90.942 81.0578Z" fill="#AAB2C5"/>
|
|
752
|
-
</svg>
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
`, o.appendChild(s), n.appendChild(o);
|
|
756
|
-
const a = document.createElement("h2");
|
|
757
|
-
return a.className = "wgt:text-base wgt:font-medium wgt:text-[#99A0AE] wgt:mb-2", a.textContent = r("order_not_found_title"), n.appendChild(a), e.appendChild(n), { container: e };
|
|
732
|
+
function ie(r) {
|
|
733
|
+
return String(r || "").trim().toLowerCase();
|
|
758
734
|
}
|
|
759
|
-
function
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
let o = !1;
|
|
766
|
-
function s(l) {
|
|
767
|
-
o || (n.innerHTML = "", l && n.appendChild(l));
|
|
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";
|
|
738
|
+
let d = !1;
|
|
739
|
+
function s(o) {
|
|
740
|
+
d || (i.innerHTML = "", o && i.appendChild(o));
|
|
768
741
|
}
|
|
769
|
-
function a(
|
|
770
|
-
|
|
771
|
-
const
|
|
742
|
+
function a(o) {
|
|
743
|
+
o && console.log("[DEBUG] renderFailedPage:", o);
|
|
744
|
+
const u = ce({
|
|
772
745
|
theme: e,
|
|
773
746
|
onClose: F
|
|
774
747
|
});
|
|
775
|
-
s(
|
|
748
|
+
s(u.container);
|
|
776
749
|
}
|
|
777
750
|
function g() {
|
|
778
|
-
const
|
|
751
|
+
const o = Ce({
|
|
779
752
|
theme: e
|
|
780
753
|
});
|
|
781
|
-
s(
|
|
754
|
+
s(o.container);
|
|
782
755
|
}
|
|
783
|
-
function p(
|
|
784
|
-
const
|
|
756
|
+
function p(o) {
|
|
757
|
+
const u = we({
|
|
785
758
|
theme: e
|
|
786
759
|
});
|
|
787
|
-
s(
|
|
760
|
+
s(u.container);
|
|
788
761
|
}
|
|
789
|
-
function N(
|
|
790
|
-
const
|
|
791
|
-
orderInfo:
|
|
762
|
+
function N(o) {
|
|
763
|
+
const u = ue({
|
|
764
|
+
orderInfo: o || {},
|
|
792
765
|
theme: e,
|
|
793
|
-
onSubmit: (v) =>
|
|
794
|
-
const
|
|
795
|
-
if (!
|
|
766
|
+
onSubmit: (v) => j(null, [v], function* ({ type: h, data: c }) {
|
|
767
|
+
const E = k();
|
|
768
|
+
if (!E)
|
|
796
769
|
return a({ reason: "MISSING_UUID_ON_SUBMIT" }), { ok: !1 };
|
|
797
|
-
const
|
|
798
|
-
return yield
|
|
770
|
+
const H = fe(h, c);
|
|
771
|
+
return yield le(E, H), { ok: !0, finalData: yield ve(E, {
|
|
799
772
|
maxTries: 20,
|
|
800
773
|
intervalMs: 1500
|
|
801
774
|
}) };
|
|
802
775
|
}),
|
|
803
776
|
onBack: F
|
|
804
777
|
});
|
|
805
|
-
s(
|
|
778
|
+
s(u.container);
|
|
806
779
|
}
|
|
807
|
-
function
|
|
780
|
+
function k() {
|
|
808
781
|
var h;
|
|
809
|
-
const
|
|
810
|
-
return String((h =
|
|
782
|
+
const o = new URLSearchParams(window.location.search || "");
|
|
783
|
+
return String((h = o.get("uuid")) != null ? h : "").trim() || String(r || "").trim() || String((t == null ? void 0 : t.uuid) || "").trim();
|
|
811
784
|
}
|
|
812
785
|
function F() {
|
|
813
|
-
return
|
|
814
|
-
yield
|
|
786
|
+
return j(this, null, function* () {
|
|
787
|
+
yield M();
|
|
815
788
|
});
|
|
816
789
|
}
|
|
817
|
-
function
|
|
818
|
-
return
|
|
790
|
+
function M() {
|
|
791
|
+
return j(this, null, function* () {
|
|
819
792
|
try {
|
|
820
|
-
const
|
|
821
|
-
if (!
|
|
793
|
+
const o = k();
|
|
794
|
+
if (!o)
|
|
822
795
|
return a({ reason: "EMPTY_UUID_NO_API_CALL" });
|
|
823
|
-
const
|
|
796
|
+
const u = yield ne(o), h = String((u == null ? void 0 : u.message) || "").trim();
|
|
824
797
|
if (h)
|
|
825
|
-
return a({ reason: "API_MESSAGE", apiMsg: h, res:
|
|
826
|
-
const c =
|
|
827
|
-
return c === "expired" ? g() : c === "invoiced" ? p(
|
|
828
|
-
} catch (
|
|
829
|
-
return console.log("[DEBUG] loadAndRender error:",
|
|
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 });
|
|
801
|
+
} catch (o) {
|
|
802
|
+
return console.log("[DEBUG] loadAndRender error:", o), a({ reason: "EXCEPTION", error: (o == null ? void 0 : o.message) || o });
|
|
830
803
|
}
|
|
831
804
|
});
|
|
832
805
|
}
|
|
833
|
-
function
|
|
834
|
-
return
|
|
806
|
+
function l() {
|
|
807
|
+
return j(this, null, function* () {
|
|
835
808
|
a({ reason: "INIT_DEFAULT_RENDER" });
|
|
836
809
|
try {
|
|
837
|
-
yield
|
|
838
|
-
} catch (
|
|
810
|
+
yield M();
|
|
811
|
+
} catch (o) {
|
|
839
812
|
return a({
|
|
840
813
|
reason: "INIT_EXCEPTION",
|
|
841
|
-
error: (
|
|
814
|
+
error: (o == null ? void 0 : o.message) || o
|
|
842
815
|
});
|
|
843
816
|
}
|
|
844
817
|
});
|
|
845
818
|
}
|
|
846
819
|
function x() {
|
|
847
|
-
|
|
820
|
+
d = !0, i.innerHTML = "";
|
|
848
821
|
}
|
|
849
|
-
return { container:
|
|
822
|
+
return { container: i, init: l, destroy: x };
|
|
850
823
|
}
|
|
851
|
-
function he(
|
|
852
|
-
return String(
|
|
824
|
+
function he(r) {
|
|
825
|
+
return String(r || "").trim().toLowerCase() === "business" ? "enterprise" : "individual";
|
|
853
826
|
}
|
|
854
|
-
function fe(
|
|
855
|
-
const e = he(
|
|
827
|
+
function fe(r, t) {
|
|
828
|
+
const e = he(r), i = {
|
|
856
829
|
invoiceType: e,
|
|
857
830
|
buyerName: (t == null ? void 0 : t.representativeName) || "",
|
|
858
831
|
address: (t == null ? void 0 : t.buyerAddress) || "",
|
|
859
832
|
email: (t == null ? void 0 : t.email) || ""
|
|
860
833
|
};
|
|
861
|
-
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;
|
|
862
835
|
}
|
|
863
|
-
function ve(
|
|
864
|
-
return
|
|
836
|
+
function ve(i) {
|
|
837
|
+
return j(this, arguments, function* (r, { maxTries: t = 20, intervalMs: e = 1500 } = {}) {
|
|
865
838
|
for (let s = 0; s < t; s++) {
|
|
866
839
|
yield xe(e);
|
|
867
|
-
const a = yield ne(
|
|
840
|
+
const a = yield ne(r), g = ie(a == null ? void 0 : a.status);
|
|
868
841
|
if (g === "invoiced") return a;
|
|
869
842
|
if (g === "expired") {
|
|
870
843
|
const p = new Error("Invoice request expired while polling");
|
|
871
844
|
throw p.code = "EXPIRED", p.data = a, p;
|
|
872
845
|
}
|
|
873
846
|
}
|
|
874
|
-
const
|
|
875
|
-
throw
|
|
847
|
+
const d = new Error("Polling timeout: status not invoiced");
|
|
848
|
+
throw d.code = "POLL_TIMEOUT", d;
|
|
876
849
|
});
|
|
877
850
|
}
|
|
878
|
-
function xe(
|
|
879
|
-
return new Promise((t) => setTimeout(t,
|
|
851
|
+
function xe(r) {
|
|
852
|
+
return new Promise((t) => setTimeout(t, r));
|
|
880
853
|
}
|
|
881
854
|
export {
|
|
882
855
|
Ne as createInvoiceRequestFlow
|