@invoice-sdk/widget 1.124.2 → 1.124.4
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/_commonjsHelpers-DaMA6jEr.js +8 -0
- package/dist/{browser-ponyfill-BxQPfTD2.js → browser-ponyfill-CQgzcFnT.js} +7 -7
- package/dist/{index-tAcS3qVN.js → index-6Tzpgq-I.js} +566 -608
- package/dist/{index-D8SOjo7a.js → index-CNB26P5W.js} +2348 -2400
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +82 -82
- package/dist/loading-BCCQ18FQ.js +220 -0
- package/dist/{widget-DN6mATiV.js → widget-D4LFWjW1.js} +4597 -4655
- package/package.json +1 -1
- package/dist/_commonjsHelpers-bAxELxBV.js +0 -8
- package/dist/loading-riArY4Yy.js +0 -266
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { k as u, g as p, l as d, C as l, G as w, n as m, o as f, I as E, p as R, S as y, q as C, e as I, r as v, u as o, w as T, O as h } from "./index-CNB26P5W.js";
|
|
2
|
+
function _({
|
|
3
|
+
title: e,
|
|
4
|
+
isDisabled: t = !1,
|
|
5
|
+
handleClick: r = null,
|
|
6
|
+
type: s = "button",
|
|
7
|
+
className: i = ""
|
|
8
|
+
} = {}) {
|
|
9
|
+
const a = document.createElement("button");
|
|
10
|
+
return a.type = s, a.disabled = t, a.className = [
|
|
11
|
+
"wgt:bg-primary",
|
|
12
|
+
"wgt:hover:bg-primary-dark",
|
|
13
|
+
"wgt:px-6",
|
|
14
|
+
"wgt:py-2",
|
|
15
|
+
"wgt:rounded-lg",
|
|
16
|
+
"wgt:disabled:opacity-50",
|
|
17
|
+
"wgt:disabled:cursor-not-allowed",
|
|
18
|
+
"wgt:cursor-pointer",
|
|
19
|
+
"wgt:hover:text-primary-hover-text",
|
|
20
|
+
i
|
|
21
|
+
].filter(Boolean).join(" "), a.innerText = e, typeof r == "function" && a.addEventListener("click", async (c) => {
|
|
22
|
+
if (!a.disabled) {
|
|
23
|
+
a.disabled = !0;
|
|
24
|
+
try {
|
|
25
|
+
await r(c);
|
|
26
|
+
} catch (g) {
|
|
27
|
+
console.error("Button click handler error:", g);
|
|
28
|
+
} finally {
|
|
29
|
+
a.disabled = !1;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}), a;
|
|
33
|
+
}
|
|
34
|
+
const n = u.create({
|
|
35
|
+
headers: {
|
|
36
|
+
Accept: "application/json"
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
n.interceptors.request.use(
|
|
40
|
+
function(e) {
|
|
41
|
+
return e.baseURL = p().invoiceHubBaseUrl, e;
|
|
42
|
+
},
|
|
43
|
+
function(e) {
|
|
44
|
+
return Promise.reject(e);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
d(n, {});
|
|
48
|
+
async function b(e) {
|
|
49
|
+
if (!e)
|
|
50
|
+
throw new Error("Tax code is required to fetch tax information.");
|
|
51
|
+
return await n.get(m, {
|
|
52
|
+
params: {
|
|
53
|
+
tax: e
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async function N(e, t, r) {
|
|
58
|
+
if (!t)
|
|
59
|
+
throw new Error("Tax code is required to check new customer.");
|
|
60
|
+
return (await n.get(l, {
|
|
61
|
+
params: {
|
|
62
|
+
provider: e,
|
|
63
|
+
taxCode: t,
|
|
64
|
+
invoiceType: r
|
|
65
|
+
}
|
|
66
|
+
})).data;
|
|
67
|
+
}
|
|
68
|
+
async function U(e, t) {
|
|
69
|
+
return (await n.get(w, {
|
|
70
|
+
params: {
|
|
71
|
+
provider: e,
|
|
72
|
+
taxCode: t
|
|
73
|
+
}
|
|
74
|
+
})).data;
|
|
75
|
+
}
|
|
76
|
+
const $ = (e) => new Intl.NumberFormat("vi-VN").format(e), O = "1.124.4";
|
|
77
|
+
async function k({ search: e, bank: t }) {
|
|
78
|
+
return (await n.get(`${o}`, {
|
|
79
|
+
params: {
|
|
80
|
+
isActive: !0,
|
|
81
|
+
search: e || null,
|
|
82
|
+
type: "service",
|
|
83
|
+
bank: t
|
|
84
|
+
}
|
|
85
|
+
})).data;
|
|
86
|
+
}
|
|
87
|
+
async function x({ bank: e }) {
|
|
88
|
+
return (await n.get(`${o}`, {
|
|
89
|
+
params: {
|
|
90
|
+
isActive: !0,
|
|
91
|
+
type: "initial_fee",
|
|
92
|
+
bank: e
|
|
93
|
+
}
|
|
94
|
+
})).data;
|
|
95
|
+
}
|
|
96
|
+
async function A({
|
|
97
|
+
bank: e,
|
|
98
|
+
hasRenew: t,
|
|
99
|
+
isCashRegister: r,
|
|
100
|
+
customerType: s
|
|
101
|
+
}) {
|
|
102
|
+
return (await n.get(`${o}`, {
|
|
103
|
+
params: {
|
|
104
|
+
isActive: !0,
|
|
105
|
+
type: "service",
|
|
106
|
+
bank: e,
|
|
107
|
+
hasRenew: t,
|
|
108
|
+
limit: 99,
|
|
109
|
+
isCashRegister: r,
|
|
110
|
+
customerType: "ENTERPRISE"
|
|
111
|
+
}
|
|
112
|
+
})).data;
|
|
113
|
+
}
|
|
114
|
+
async function M({ bank: e }) {
|
|
115
|
+
return (await n.get(`${o}`, {
|
|
116
|
+
params: {
|
|
117
|
+
isActive: !0,
|
|
118
|
+
type: "signature",
|
|
119
|
+
bank: e,
|
|
120
|
+
limit: 99
|
|
121
|
+
}
|
|
122
|
+
})).data;
|
|
123
|
+
}
|
|
124
|
+
async function q(e) {
|
|
125
|
+
const t = new FormData();
|
|
126
|
+
return t.append(
|
|
127
|
+
"eInvoiceRegistration",
|
|
128
|
+
JSON.stringify(e.eInvoiceRegistration)
|
|
129
|
+
), t.append("provider", e.provider), t.append("bank", e.bank), t.append("packages", JSON.stringify(e.packages)), t.append("promotionCodes", JSON.stringify(e.promotionCodes)), t.append("logo", e.logo), t.append(
|
|
130
|
+
"organizationRegistrationCert",
|
|
131
|
+
e.organizationRegistrationCert
|
|
132
|
+
), e.legalRepresentativeIdCard.forEach((s) => {
|
|
133
|
+
t.append("legalRepresentativeIdCard", s);
|
|
134
|
+
}), t.append("isRenew", e.isRenew), t.append("isCashRegister", e.isCashRegister), await n.post(C, t, {
|
|
135
|
+
headers: {
|
|
136
|
+
"Content-Type": "multipart/form-data",
|
|
137
|
+
"X-Invoice-Widget-Mode": I(),
|
|
138
|
+
"X-Invoice-Widget-Version": O
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
async function B(e) {
|
|
143
|
+
return await n.get(`${h}/${e}/status`);
|
|
144
|
+
}
|
|
145
|
+
async function F({ isRenewable: e, serialNumber: t } = {}) {
|
|
146
|
+
const r = {
|
|
147
|
+
isRenewable: !!e,
|
|
148
|
+
serialNumber: (t ?? "").trim()
|
|
149
|
+
};
|
|
150
|
+
return console.log("PROMO params:", r), (await n.get(v, { params: r })).data;
|
|
151
|
+
}
|
|
152
|
+
async function G(e) {
|
|
153
|
+
return await n.post(`${T}/${e}`);
|
|
154
|
+
}
|
|
155
|
+
async function V(e) {
|
|
156
|
+
return await n.get(
|
|
157
|
+
`${E}/${encodeURIComponent(e)}`
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
async function j(e, t) {
|
|
161
|
+
try {
|
|
162
|
+
return await n.post(
|
|
163
|
+
`${y}/${encodeURIComponent(e)}`,
|
|
164
|
+
t
|
|
165
|
+
);
|
|
166
|
+
} catch (r) {
|
|
167
|
+
throw r;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
async function W(e) {
|
|
171
|
+
return await n.get(
|
|
172
|
+
`${f}/${encodeURIComponent(e)}`
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
async function D(e, t) {
|
|
176
|
+
try {
|
|
177
|
+
return await n.post(
|
|
178
|
+
`${R}/${encodeURIComponent(e)}`,
|
|
179
|
+
t
|
|
180
|
+
);
|
|
181
|
+
} catch (r) {
|
|
182
|
+
throw r;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function L() {
|
|
186
|
+
const e = document.createElement("div");
|
|
187
|
+
e.className = "wgt:absolute wgt:inset-0 wgt:bg-white/80 wgt:items-center wgt:justify-center wgt:z-50 wgt:w-full wgt:h-full wgt:backdrop-blur-sm", e.style.display = "none";
|
|
188
|
+
const t = document.createElement("div");
|
|
189
|
+
t.className = "wgt:flex wgt:flex-col wgt:items-center wgt:gap-4 wgt:bg-white wgt:rounded-lg wgt:p-6 wgt:shadow-lg";
|
|
190
|
+
const r = document.createElement("div");
|
|
191
|
+
return r.className = "wgt:h-12 wgt:w-12 wgt:animate-spin wgt:rounded-full wgt:border-4 wgt:border-solid wgt:border-primary wgt:border-t-transparent", t.appendChild(r), e.appendChild(t), {
|
|
192
|
+
container: e,
|
|
193
|
+
open: () => {
|
|
194
|
+
e.style.display = "flex";
|
|
195
|
+
},
|
|
196
|
+
close: () => {
|
|
197
|
+
e.style.display = "none";
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
export {
|
|
202
|
+
N as a,
|
|
203
|
+
b,
|
|
204
|
+
_ as c,
|
|
205
|
+
k as d,
|
|
206
|
+
L as e,
|
|
207
|
+
$ as f,
|
|
208
|
+
U as g,
|
|
209
|
+
q as h,
|
|
210
|
+
F as i,
|
|
211
|
+
x as j,
|
|
212
|
+
A as k,
|
|
213
|
+
M as l,
|
|
214
|
+
G as m,
|
|
215
|
+
B as n,
|
|
216
|
+
W as o,
|
|
217
|
+
V as p,
|
|
218
|
+
j as q,
|
|
219
|
+
D as s
|
|
220
|
+
};
|