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