@invoice-sdk/widget 1.115.7 → 1.116.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,237 @@
1
+ var n = (e, t, r) => new Promise((i, c) => {
2
+ var s = (o) => {
3
+ try {
4
+ g(r.next(o));
5
+ } catch (p) {
6
+ c(p);
7
+ }
8
+ }, d = (o) => {
9
+ try {
10
+ g(r.throw(o));
11
+ } catch (p) {
12
+ c(p);
13
+ }
14
+ }, g = (o) => o.done ? i(o.value) : Promise.resolve(o.value).then(s, d);
15
+ g((r = r.apply(e, t)).next());
16
+ });
17
+ import { j as l, g as w, k as f, C as m, G as y, l as E, I as R, S as v, n as C, a as h, o as I, p as u, q as T, O as b } from "./index-Ba_b4M50.js";
18
+ function _({
19
+ title: e,
20
+ isDisabled: t = !1,
21
+ handleClick: r = null,
22
+ type: i = "button",
23
+ className: c = ""
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
+ c
37
+ ].filter(Boolean).join(" "), s.innerText = e, typeof r == "function" && s.addEventListener("click", (d) => n(null, null, function* () {
38
+ if (!s.disabled) {
39
+ s.disabled = !0;
40
+ try {
41
+ yield r(d);
42
+ } catch (g) {
43
+ console.error("Button click handler error:", g);
44
+ } finally {
45
+ s.disabled = !1;
46
+ }
47
+ }
48
+ })), s;
49
+ }
50
+ const a = l.create({
51
+ headers: {
52
+ Accept: "application/json"
53
+ }
54
+ });
55
+ a.interceptors.request.use(
56
+ function(e) {
57
+ return e.baseURL = w().invoiceHubBaseUrl, e;
58
+ },
59
+ function(e) {
60
+ return Promise.reject(e);
61
+ }
62
+ );
63
+ f(a, {});
64
+ function k(e) {
65
+ return n(this, null, function* () {
66
+ if (!e)
67
+ throw new Error("Tax code is required to fetch tax information.");
68
+ return yield a.get(E, {
69
+ params: {
70
+ tax: e
71
+ }
72
+ });
73
+ });
74
+ }
75
+ function x(e, t, r) {
76
+ return n(this, null, function* () {
77
+ if (!t)
78
+ throw new Error("Tax code is required to check new customer.");
79
+ return (yield a.get(m, {
80
+ params: {
81
+ provider: e,
82
+ taxCode: t,
83
+ invoiceType: r
84
+ }
85
+ })).data;
86
+ });
87
+ }
88
+ function $(e, t) {
89
+ return n(this, null, function* () {
90
+ return (yield a.get(y, {
91
+ params: {
92
+ provider: e,
93
+ taxCode: t
94
+ }
95
+ })).data;
96
+ });
97
+ }
98
+ const A = (e) => new Intl.NumberFormat("vi-VN").format(e), O = "1.116.0";
99
+ function U(r) {
100
+ return n(this, arguments, function* ({ search: e, bank: t }) {
101
+ return (yield a.get(`${u}`, {
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 n(this, arguments, function* ({ bank: e }) {
113
+ return (yield a.get(`${u}`, {
114
+ params: {
115
+ isActive: !0,
116
+ type: "initial_fee",
117
+ bank: e
118
+ }
119
+ })).data;
120
+ });
121
+ }
122
+ function j(i) {
123
+ return n(this, arguments, function* ({ bank: e, hasRenew: t, isCashRegister: r }) {
124
+ return (yield a.get(`${u}`, {
125
+ params: {
126
+ isActive: !0,
127
+ type: "service",
128
+ bank: e,
129
+ hasRenew: t,
130
+ limit: 99,
131
+ isCashRegister: r
132
+ }
133
+ })).data;
134
+ });
135
+ }
136
+ function q(t) {
137
+ return n(this, arguments, function* ({ bank: e }) {
138
+ return (yield a.get(`${u}`, {
139
+ params: {
140
+ isActive: !0,
141
+ type: "signature",
142
+ bank: e,
143
+ limit: 99
144
+ }
145
+ })).data;
146
+ });
147
+ }
148
+ function F(e) {
149
+ return n(this, null, function* () {
150
+ const t = new FormData();
151
+ return t.append(
152
+ "eInvoiceRegistration",
153
+ JSON.stringify(e.eInvoiceRegistration)
154
+ ), 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(
155
+ "organizationRegistrationCert",
156
+ e.organizationRegistrationCert
157
+ ), e.legalRepresentativeIdCard.forEach((i) => {
158
+ t.append("legalRepresentativeIdCard", i);
159
+ }), t.append("isRenew", e.isRenew), t.append("isCashRegister", e.isCashRegister), yield a.post(C, t, {
160
+ headers: {
161
+ "Content-Type": "multipart/form-data",
162
+ "X-Invoice-Widget-Mode": h(),
163
+ "X-Invoice-Widget-Version": O
164
+ }
165
+ });
166
+ });
167
+ }
168
+ function G(e) {
169
+ return n(this, null, function* () {
170
+ return yield a.get(`${b}/${e}/status`);
171
+ });
172
+ }
173
+ function B() {
174
+ return n(this, arguments, function* ({ isRenewable: e } = {}) {
175
+ return (yield a.get(I, {
176
+ params: e === !0 ? { isRenewable: !0 } : void 0
177
+ })).data;
178
+ });
179
+ }
180
+ function W(e) {
181
+ return n(this, null, function* () {
182
+ return yield a.post(`${T}/${e}`);
183
+ });
184
+ }
185
+ function D(e) {
186
+ return n(this, null, function* () {
187
+ return yield a.get(
188
+ `${R}/${encodeURIComponent(e)}`
189
+ );
190
+ });
191
+ }
192
+ function L(e, t) {
193
+ return n(this, null, function* () {
194
+ try {
195
+ return yield a.post(
196
+ `${v}/${encodeURIComponent(e)}`,
197
+ t
198
+ );
199
+ } catch (r) {
200
+ throw r;
201
+ }
202
+ });
203
+ }
204
+ function V() {
205
+ const e = document.createElement("div");
206
+ 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";
207
+ const t = document.createElement("div");
208
+ 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";
209
+ const r = document.createElement("div");
210
+ 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), {
211
+ container: e,
212
+ open: () => {
213
+ e.style.display = "flex";
214
+ },
215
+ close: () => {
216
+ e.style.display = "none";
217
+ }
218
+ };
219
+ }
220
+ export {
221
+ x as a,
222
+ k as b,
223
+ _ as c,
224
+ U as d,
225
+ V as e,
226
+ A as f,
227
+ $ as g,
228
+ F as h,
229
+ B as i,
230
+ M as j,
231
+ j as k,
232
+ q as l,
233
+ W as m,
234
+ G as n,
235
+ D as o,
236
+ L as s
237
+ };
@@ -35,8 +35,8 @@ var ln = (t, n, e) => new Promise((c, h) => {
35
35
  }, o = (A) => A.done ? c(A.value) : Promise.resolve(A.value).then(a, u);
36
36
  o((e = e.apply(t, n)).next());
37
37
  });
38
- import { t as g, g as jh, a as Uh, b as Et, s as Ut, c as It, d as rc, e as Tc, f as xc, m as dc, h as wc, i as pc, v as Cc } from "./index-DUTxhky5.js";
39
- import { c as yt, a as _h, g as _t, b as fc, f as Sn, d as Xc, e as Bc, h as Nc, i as Ec, j as Hc, k as yc, l as Pc, m as kc } from "./invoice-DUiIiOd_.js";
38
+ import { t as g, g as jh, a as Uh, b as Et, s as Ut, c as It, d as rc, e as Tc, f as xc, m as dc, h as wc, i as pc, v as Cc } from "./index-Ba_b4M50.js";
39
+ import { c as yt, a as _h, g as _t, b as fc, f as Sn, d as Xc, e as t0, h as Bc, i as Nc, j as Ec, k as Hc, l as yc, m as Pc, n as kc } from "./loading-BHrUW4gA.js";
40
40
  import { g as $h } from "./_commonjsHelpers-bAxELxBV.js";
41
41
  function qh({ steps: t = [], currentStep: n = 1 } = {}) {
42
42
  const e = document.createElement("div");
@@ -183,7 +183,7 @@ function vc({ steps: t = [], currentStep: n = 1 } = {}) {
183
183
  updateTitle: o
184
184
  };
185
185
  }
186
- function t0({
186
+ function h0({
187
187
  name: t,
188
188
  value: n = "",
189
189
  label: e = "",
@@ -303,7 +303,7 @@ function Lc({
303
303
  d.className = "wgt:w-[1px] wgt:h-8 wgt:bg-border-light";
304
304
  const I = document.createElement("label");
305
305
  I.className = "wgt:text-base wgt:font-semibold wgt:leading-5 wgt:text-black wgt:uppercase", I.innerText = s.name, l.appendChild(x), l.appendChild(d), l.appendChild(I);
306
- const { container: k } = t0({
306
+ const { container: k } = h0({
307
307
  checked: r,
308
308
  onChange: (b) => {
309
309
  b && (n = s.route, typeof e == "function" && e(s), u());
@@ -2977,7 +2977,7 @@ function x1({
2977
2977
  N.className = "wgt:w-fit wgt:px-2 wgt:py-0.5 wgt:rounded wgt:bg-primary wgt:text-white wgt:bg-gradient-to-r wgt:from-[#FF8447] wgt:to-[#F6B51E] wgt:text-sm wgt:font-semibold", N.innerText = c, s.appendChild(N);
2978
2978
  }
2979
2979
  q.appendChild(s);
2980
- const { container: i } = t0({
2980
+ const { container: i } = h0({
2981
2981
  checked: h,
2982
2982
  onChange: (N) => {
2983
2983
  }
@@ -3141,7 +3141,7 @@ function d1({
3141
3141
  "wgt:-mt-4",
3142
3142
  "wgt:@max-2xl:px-0"
3143
3143
  ].join(" ");
3144
- const A = t0({
3144
+ const A = h0({
3145
3145
  name: t,
3146
3146
  value: n,
3147
3147
  checked: a,
@@ -3173,22 +3173,6 @@ function d1({
3173
3173
  const i = document.createElement("p");
3174
3174
  return i.className = "wgt:text-text-soft-400 wgt:text-sm", i.textContent = h, q.appendChild(i), o.appendChild(q), { container: o };
3175
3175
  }
3176
- function h0() {
3177
- const t = document.createElement("div");
3178
- t.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", t.style.display = "none";
3179
- const n = document.createElement("div");
3180
- n.className = "wgt:flex wgt:flex-col wgt:items-center wgt:gap-4 wgt:bg-white wgt:rounded-lg wgt:p-6 wgt:shadow-lg";
3181
- const e = document.createElement("div");
3182
- return e.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", n.appendChild(e), t.appendChild(n), {
3183
- container: t,
3184
- open: () => {
3185
- t.style.display = "flex";
3186
- },
3187
- close: () => {
3188
- t.style.display = "none";
3189
- }
3190
- };
3191
- }
3192
3176
  function w1({
3193
3177
  promotion: t,
3194
3178
  onSelect: n,
@@ -3221,7 +3205,7 @@ function w1({
3221
3205
  ].join(" ");
3222
3206
  const q = Yt(Et());
3223
3207
  A.textContent = t[q], u.appendChild(A);
3224
- const { container: s } = t0({
3208
+ const { container: s } = h0({
3225
3209
  checked: t.isSelected,
3226
3210
  onChange: () => {
3227
3211
  let i = !t.isSelected;
@@ -3500,7 +3484,7 @@ function N1(N) {
3500
3484
  container: U,
3501
3485
  open: cn,
3502
3486
  close: Y
3503
- } = h0();
3487
+ } = t0();
3504
3488
  O.appendChild(U);
3505
3489
  let rn = null;
3506
3490
  if (X) {
@@ -4352,7 +4336,7 @@ function k1({
4352
4336
  container: O,
4353
4337
  open: U,
4354
4338
  close: cn
4355
- } = h0();
4339
+ } = t0();
4356
4340
  document.body.appendChild(O);
4357
4341
  const Y = yt({
4358
4342
  title: A ? g("confirmFreeOrder") || "Xác nhận đơn hàng" : g("cancelTransaction") || "Hủy giao dịch",
@@ -6210,7 +6194,7 @@ function ea(o) {
6210
6194
  container: C,
6211
6195
  open: X,
6212
6196
  close: y
6213
- } = h0();
6197
+ } = t0();
6214
6198
  N.appendChild(C);
6215
6199
  const Q = document.createElement("div");
6216
6200
  Q.className = "wgt:w-full wgt:flex wgt:items-start wgt:gap-6 wgt:@max-2xl:flex-col-reverse";
@@ -7265,7 +7249,7 @@ function Xa(t, n, e, c, h, a) {
7265
7249
  }
7266
7250
  });
7267
7251
  }
7268
- const { container: T, open: m } = h0();
7252
+ const { container: T, open: m } = t0();
7269
7253
  I && (i(T), m()), yield L0(
7270
7254
  x.route,
7271
7255
  (M = (v = d == null ? void 0 : d.eInvoiceRegistration) == null ? void 0 : v.organization) == null ? void 0 : M.taxCode,
package/package.json CHANGED
@@ -46,7 +46,7 @@
46
46
  "prepare": "npm run build"
47
47
  },
48
48
  "type": "module",
49
- "version": "1.115.7",
49
+ "version": "1.116.0",
50
50
  "repository": {},
51
51
  "dependencies": {
52
52
  "@invoice-sdk/id_extraction_qr": "^1.8.3",
@@ -1,220 +0,0 @@
1
- var a = (e, t, r) => new Promise((i, c) => {
2
- var s = (o) => {
3
- try {
4
- u(r.next(o));
5
- } catch (d) {
6
- c(d);
7
- }
8
- }, g = (o) => {
9
- try {
10
- u(r.throw(o));
11
- } catch (d) {
12
- c(d);
13
- }
14
- }, u = (o) => o.done ? i(o.value) : Promise.resolve(o.value).then(s, g);
15
- u((r = r.apply(e, t)).next());
16
- });
17
- import { j as f, g as l, k as w, C as R, G as m, l as E, I as v, S as C, n as y, a as I, o as T, p, q as O, O as h } from "./index-DUTxhky5.js";
18
- function N({
19
- title: e,
20
- isDisabled: t = !1,
21
- handleClick: r = null,
22
- type: i = "button",
23
- className: c = ""
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
- c
37
- ].filter(Boolean).join(" "), s.innerText = e, typeof r == "function" && s.addEventListener("click", (g) => a(null, null, function* () {
38
- if (!s.disabled) {
39
- s.disabled = !0;
40
- try {
41
- yield r(g);
42
- } catch (u) {
43
- console.error("Button click handler error:", u);
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(E, {
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(R, {
80
- params: {
81
- provider: e,
82
- taxCode: t,
83
- invoiceType: r
84
- }
85
- })).data;
86
- });
87
- }
88
- function A(e, t) {
89
- return a(this, null, function* () {
90
- return (yield n.get(m, {
91
- params: {
92
- provider: e,
93
- taxCode: t
94
- }
95
- })).data;
96
- });
97
- }
98
- const b = (e) => new Intl.NumberFormat("vi-VN").format(e), S = "1.115.7";
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(i) {
123
- return a(this, arguments, function* ({ bank: e, hasRenew: t, isCashRegister: r }) {
124
- return (yield n.get(`${p}`, {
125
- params: {
126
- isActive: !0,
127
- type: "service",
128
- bank: e,
129
- hasRenew: t,
130
- limit: 99,
131
- isCashRegister: r
132
- }
133
- })).data;
134
- });
135
- }
136
- function F(t) {
137
- return a(this, arguments, function* ({ bank: e }) {
138
- return (yield n.get(`${p}`, {
139
- params: {
140
- isActive: !0,
141
- type: "signature",
142
- bank: e,
143
- limit: 99
144
- }
145
- })).data;
146
- });
147
- }
148
- function G(e) {
149
- return a(this, null, function* () {
150
- const t = new FormData();
151
- return t.append(
152
- "eInvoiceRegistration",
153
- JSON.stringify(e.eInvoiceRegistration)
154
- ), 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(
155
- "organizationRegistrationCert",
156
- e.organizationRegistrationCert
157
- ), e.legalRepresentativeIdCard.forEach((i) => {
158
- t.append("legalRepresentativeIdCard", i);
159
- }), t.append("isRenew", e.isRenew), t.append("isCashRegister", e.isCashRegister), yield n.post(y, t, {
160
- headers: {
161
- "Content-Type": "multipart/form-data",
162
- "X-Invoice-Widget-Mode": I(),
163
- "X-Invoice-Widget-Version": S
164
- }
165
- });
166
- });
167
- }
168
- function j(e) {
169
- return a(this, null, function* () {
170
- return yield n.get(`${h}/${e}/status`);
171
- });
172
- }
173
- function B() {
174
- return a(this, arguments, function* ({ isRenewable: e } = {}) {
175
- return (yield n.get(T, {
176
- params: e === !0 ? { isRenewable: !0 } : void 0
177
- })).data;
178
- });
179
- }
180
- function D(e) {
181
- return a(this, null, function* () {
182
- return yield n.post(`${O}/${e}`);
183
- });
184
- }
185
- function V(e) {
186
- return a(this, null, function* () {
187
- return yield n.get(
188
- `${v}/${encodeURIComponent(e)}`
189
- );
190
- });
191
- }
192
- function W(e, t) {
193
- return a(this, null, function* () {
194
- try {
195
- return yield n.post(
196
- `${C}/${encodeURIComponent(e)}`,
197
- t
198
- );
199
- } catch (r) {
200
- throw r;
201
- }
202
- });
203
- }
204
- export {
205
- $ as a,
206
- x as b,
207
- N as c,
208
- U as d,
209
- G as e,
210
- b as f,
211
- A as g,
212
- B as h,
213
- M as i,
214
- q as j,
215
- F as k,
216
- D as l,
217
- j as m,
218
- V as n,
219
- W as s
220
- };