@invoice-sdk/widget 1.3.0 → 1.4.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.
package/dist/index.esm.js CHANGED
@@ -1,424 +1,445 @@
1
- function Q({ steps: f = [], currentStep: p = 1 } = {}) {
1
+ function Z({ steps: m = [], currentStep: e = 1 } = {}) {
2
+ const s = document.createElement("div");
3
+ s.className = [
4
+ "wgt:relative",
5
+ "wgt:flex",
6
+ "wgt:bg-weak-50",
7
+ "wgt:rounded-[10px]",
8
+ "wgt:overflow-hidden",
9
+ "wgt:shadow-sm",
10
+ "wgt:justify-between"
11
+ ].join(" ");
2
12
  const o = document.createElement("div");
3
13
  o.className = [
4
- "relative",
5
- "flex",
6
- "bg-weak-50",
7
- "rounded-[10px]",
8
- "overflow-hidden",
9
- "shadow-sm",
10
- "justify-between"
11
- ].join(" ");
12
- const l = document.createElement("div");
13
- l.className = [
14
- "absolute",
15
- "inset-0",
16
- "h-full",
17
- "bg-primary/16",
18
- "transition-all",
19
- "duration-250"
14
+ "wgt:absolute",
15
+ "wgt:inset-0",
16
+ "wgt:h-full",
17
+ "wgt:bg-primary/16",
18
+ "wgt:transition-all",
19
+ "wgt:duration-250"
20
20
  ].join(" ");
21
21
  const c = document.createElement("div");
22
- c.className = "relative flex w-full z-10";
23
- const e = [];
24
- f.forEach((t, r) => {
25
- const n = r + 1, a = document.createElement("div");
22
+ c.className = "wgt:relative wgt:flex wgt:w-full wgt:z-10";
23
+ const t = [];
24
+ m.forEach((n, r) => {
25
+ const l = r + 1, a = document.createElement("div");
26
26
  a.setAttribute("role", "listitem"), a.setAttribute(
27
27
  "aria-label",
28
- `Step ${n} of ${f.length}: ${t.label}${p === n ? " (current)" : ""}`
28
+ `Step ${l} of ${m.length}: ${n.label}${e === l ? " (current)" : ""}`
29
29
  ), a.className = [
30
- "relative",
31
- "flex-1",
32
- "flex",
33
- "items-center",
34
- "justify-center",
35
- "py-5",
36
- "pr-9",
37
- "px-4"
30
+ "wgt:relative",
31
+ "wgt:flex-1",
32
+ "wgt:flex",
33
+ "wgt:items-center",
34
+ "wgt:justify-center",
35
+ "wgt:py-5",
36
+ "wgt:pr-9",
37
+ "wgt:px-4"
38
38
  ].join(" ");
39
- const i = document.createElement("div");
40
- i.className = [
41
- "flex",
42
- "items-center",
43
- "justify-center",
44
- "w-8",
45
- "h-8",
46
- "rounded-full",
39
+ const g = document.createElement("div");
40
+ g.className = [
41
+ "wgt:flex",
42
+ "wgt:items-center",
43
+ "wgt:justify-center",
44
+ "wgt:w-8",
45
+ "wgt:h-8",
46
+ "wgt:rounded-full",
47
47
  // color will be set in update()
48
- "flex-shrink-0",
49
- "mr-4"
48
+ "wgt:flex-shrink-0",
49
+ "wgt:mr-4"
50
50
  ].join(" ");
51
- const s = document.createElement("span");
52
- s.innerText = String(n), s.className = "text-white font-medium", i.appendChild(s);
53
- const m = document.createElement("span");
54
- m.innerText = t.label, m.className = "font-medium whitespace-nowrap", a.appendChild(i), a.appendChild(m), c.appendChild(a), e.push({ wrapper: a, circle: i, textSpan: m });
55
- }), o.appendChild(l), o.appendChild(c);
56
- function d(t) {
57
- const r = o.getBoundingClientRect(), n = r.width || 0;
51
+ const i = document.createElement("span");
52
+ i.innerText = String(l), i.className = "wgt:text-white wgt:font-medium", g.appendChild(i);
53
+ const w = document.createElement("span");
54
+ w.innerText = n.label, w.className = "wgt:font-medium wgt:whitespace-nowrap", a.appendChild(g), a.appendChild(w), c.appendChild(a), t.push({ wrapper: a, circle: g, textSpan: w });
55
+ }), s.appendChild(o), s.appendChild(c);
56
+ function d(n) {
57
+ const r = s.getBoundingClientRect(), l = r.width || 0;
58
58
  let a = 0;
59
- if (t > 0 && t <= e.length) {
60
- const m = e[t - 1].wrapper.getBoundingClientRect(), x = r.left;
61
- a = m.left - x + m.width;
59
+ if (n > 0 && n <= t.length) {
60
+ const w = t[n - 1].wrapper.getBoundingClientRect(), u = r.left;
61
+ a = w.left - u + w.width;
62
62
  }
63
- const i = n > 0 ? Math.min(a / n * 100, 100) : 0;
64
- l.style.width = `${i}%`, e.forEach((s, m) => {
65
- const x = m + 1, v = x < t, g = x === t;
66
- v || g ? (s.textSpan.classList.add("text-primary-dark"), s.textSpan.classList.remove("text-soft-400")) : (s.textSpan.classList.add("text-soft-400"), s.textSpan.classList.remove("text-primary-dark")), v || g ? (s.circle.classList.add("bg-icon-primary"), s.circle.classList.remove("bg-icon-soft-400")) : (s.circle.classList.add("bg-icon-soft-400"), s.circle.classList.remove("bg-icon-primary"));
63
+ const g = l > 0 ? Math.min(a / l * 100, 100) : 0;
64
+ o.style.width = `${g}%`, t.forEach((i, w) => {
65
+ const u = w + 1, T = u < n, f = u === n;
66
+ T || f ? (i.textSpan.classList.add("wgt:text-primary-dark"), i.textSpan.classList.remove("wgt:text-soft-400")) : (i.textSpan.classList.add("wgt:text-soft-400"), i.textSpan.classList.remove("wgt:text-primary-dark")), T || f ? (i.circle.classList.add("wgt:bg-icon-primary"), i.circle.classList.remove("wgt:bg-icon-soft-400")) : (i.circle.classList.add("wgt:bg-icon-soft-400"), i.circle.classList.remove("wgt:bg-icon-primary"));
67
67
  });
68
68
  }
69
- return setTimeout(() => d(p), 0), {
70
- container: o,
69
+ return setTimeout(() => d(e), 0), {
70
+ container: s,
71
71
  /**
72
72
  * @param {number} newStep – the new 1‐based current step
73
73
  */
74
- update(t) {
75
- d(t);
74
+ update(n) {
75
+ d(n);
76
76
  }
77
77
  };
78
78
  }
79
- function A({ steps: f = [], currentStep: p = 1 } = {}) {
80
- const o = document.createElement("div");
81
- o.className = ["flex", "flex-col", "h-fit", "gap-6", "items-center", "justify-start"].join(" ");
82
- const l = document.createElement("h1");
83
- l.className = ["text-[28px]", "font-bold", "leading-[30px]", "text-strong-950"].join(" "), l.innerText = "Đăng ký hóa đơn điện tử";
79
+ function _({ steps: m = [], currentStep: e = 1 } = {}) {
80
+ const s = document.createElement("div");
81
+ s.className = [
82
+ "wgt:flex",
83
+ "wgt:flex-col",
84
+ "wgt:h-fit",
85
+ "wgt:gap-6",
86
+ "wgt:items-center",
87
+ "wgt:justify-start",
88
+ "wgt:fixed",
89
+ "wgt:w-full",
90
+ "wgt:h-screen",
91
+ "wgt:inset-0",
92
+ "wgt:py-8",
93
+ "wgt:overflow-auto"
94
+ ].join(" ");
95
+ const o = document.createElement("h1");
96
+ o.className = [
97
+ "wgt:text-[28px]",
98
+ "wgt:font-bold",
99
+ "wgt:leading-[30px]",
100
+ "wgt:text-strong-950"
101
+ ].join(" "), o.innerText = "Đăng ký hóa đơn điện tử";
84
102
  const c = document.createElement("div");
85
103
  c.className = [
86
- "w-[1320px]",
87
- "flex-1",
88
- "mx-auto",
89
- "p-6",
90
- "flex",
91
- "flex-col",
92
- "border",
93
- "border-[#E1E4EA]",
94
- "rounded-3xl",
95
- "gap-6",
96
- "shadow-[0px_1px_8px_0px_rgba(82,88,102,0.06)]"
104
+ "wgt:w-[1320px]",
105
+ "wgt:flex-1",
106
+ "wgt:mx-auto",
107
+ "wgt:p-6",
108
+ "wgt:flex",
109
+ "wgt:flex-col",
110
+ "wgt:border",
111
+ "wgt:border-[#E1E4EA]",
112
+ "wgt:rounded-3xl",
113
+ "wgt:gap-6",
114
+ "wgt:shadow-[0px_1px_8px_0px_rgba(82,88,102,0.06)]"
97
115
  ].join(" ");
98
- const e = Q({ steps: f.map((t) => ({ label: t })), currentStep: p });
99
- c.appendChild(e.container);
116
+ const t = Z({
117
+ steps: m.map((n) => ({ label: n })),
118
+ currentStep: e
119
+ });
120
+ c.appendChild(t.container);
100
121
  const d = document.createElement("div");
101
- return d.className = "flex-1", c.appendChild(d), o.appendChild(l), o.appendChild(c), {
102
- container: o,
122
+ return d.className = "wgt:flex-1", c.appendChild(d), s.appendChild(o), s.appendChild(c), {
123
+ container: s,
103
124
  /**
104
125
  * Change which step is active (1‐based index):
105
126
  */
106
- setStep(t) {
107
- e.update(t);
127
+ setStep(n) {
128
+ t.update(n);
108
129
  },
109
130
  /**
110
131
  * Replace whatever content is inside the “children” area:
111
132
  * @param {HTMLElement} domNode
112
133
  */
113
- setContent(t) {
114
- d.replaceChildren(t);
134
+ setContent(n) {
135
+ d.replaceChildren(n);
115
136
  }
116
137
  };
117
138
  }
118
- function W({ checked: f = !1, onChange: p }) {
119
- const o = document.createElement("label");
120
- o.className = "relative inline-flex cursor-pointer items-center";
121
- const l = document.createElement("input");
122
- l.type = "checkbox", l.checked = f, l.className = "peer sr-only", l.addEventListener("change", (t) => {
123
- const r = t.target.checked;
124
- typeof p == "function" && p(r), l.checked = r, e(r);
139
+ function I({ checked: m = !1, onChange: e }) {
140
+ const s = document.createElement("label");
141
+ s.className = "wgt:relative wgt:inline-flex wgt:cursor-pointer wgt:items-center";
142
+ const o = document.createElement("input");
143
+ o.type = "checkbox", o.checked = m, o.className = "wgt:peer wgt:sr-only", o.addEventListener("change", (n) => {
144
+ const r = n.target.checked;
145
+ typeof e == "function" && e(r), o.checked = r, t(r);
125
146
  });
126
147
  const c = document.createElement("div");
127
148
  c.className = [
128
- "border-grey-6",
129
- "relative",
130
- "h-5",
131
- "w-5",
132
- "rounded-full",
133
- "border-2"
149
+ "wgt:border-grey-6",
150
+ "wgt:relative",
151
+ "wgt:h-5",
152
+ "wgt:w-5",
153
+ "wgt:rounded-full",
154
+ "wgt:border-2"
134
155
  // The “before:” pseudo‐element shows when checked → we’ll toggle via JS
135
156
  ].join(" ");
136
- function e(t) {
137
- t ? (c.classList.add("border-primary"), d.style.display = "block") : (c.classList.remove("border-primary"), d.style.display = "none");
157
+ function t(n) {
158
+ n ? (c.classList.add("wgt:border-primary"), d.style.display = "block") : (c.classList.remove("wgt:border-primary"), d.style.display = "none");
138
159
  }
139
160
  const d = document.createElement("div");
140
161
  return d.className = [
141
- "absolute",
142
- "left-1/2",
143
- "top-1/2",
144
- "h-2.5",
145
- "w-2.5",
146
- "-translate-x-1/2",
147
- "-translate-y-1/2",
148
- "rounded-full",
149
- "bg-primary"
150
- ].join(" "), d.style.display = f ? "block" : "none", c.appendChild(d), o.appendChild(l), o.appendChild(c), {
151
- container: o,
152
- setChecked(t) {
153
- l.checked = t, e(t), typeof p == "function" && p(t);
162
+ "wgt:absolute",
163
+ "wgt:left-1/2",
164
+ "wgt:top-1/2",
165
+ "wgt:h-2.5",
166
+ "wgt:w-2.5",
167
+ "wgt:-translate-x-1/2",
168
+ "wgt:-translate-y-1/2",
169
+ "wgt:rounded-full",
170
+ "wgt:bg-primary"
171
+ ].join(" "), d.style.display = m ? "block" : "none", c.appendChild(d), s.appendChild(o), s.appendChild(c), {
172
+ container: s,
173
+ setChecked(n) {
174
+ o.checked = n, t(n), typeof e == "function" && e(n);
154
175
  }
155
176
  };
156
177
  }
157
- function q({
158
- providers: f = [],
159
- selectedRoute: p = null,
160
- onProviderChange: o
178
+ function $({
179
+ providers: m = [],
180
+ selectedRoute: e = null,
181
+ onProviderChange: s
161
182
  }) {
162
- const l = document.createElement("div");
163
- l.className = "w-full flex flex-col gap-4";
183
+ const o = document.createElement("div");
184
+ o.className = "wgt:w-full wgt:flex wgt:flex-col wgt:gap-4";
164
185
  const c = document.createElement("h2");
165
- c.className = "heading", c.innerText = "Nhà cung cấp", l.appendChild(c);
166
- const e = document.createElement("div");
167
- e.className = "grid grid-cols-3 gap-4", l.appendChild(e);
186
+ c.className = "heading", c.innerText = "Nhà cung cấp", o.appendChild(c);
187
+ const t = document.createElement("div");
188
+ t.className = "wgt:grid wgt:grid-cols-3 wgt:gap-4", o.appendChild(t);
168
189
  function d() {
169
- e.innerHTML = "", f.forEach((t) => {
170
- const r = t.route === p, n = document.createElement("div");
171
- n.dataset.checked = r ? "true" : "false", n.className = [
172
- "flex",
173
- "items-center",
174
- "justify-between",
175
- "gap-2",
176
- "p-4",
177
- "border",
178
- "border-border-light",
179
- "rounded-xl",
180
- "hover:bg-gray-100",
181
- "cursor-pointer",
182
- "transition-colors",
183
- "duration-200",
184
- r ? "border-primary" : ""
185
- ].filter(Boolean).join(" "), n.addEventListener("click", () => {
186
- p = t.route, typeof o == "function" && o(t), d();
190
+ t.innerHTML = "", m.forEach((n) => {
191
+ const r = n.route === e, l = document.createElement("div");
192
+ l.dataset.checked = r ? "true" : "false", l.className = [
193
+ "wgt:flex",
194
+ "wgt:items-center",
195
+ "wgt:justify-between",
196
+ "wgt:gap-2",
197
+ "wgt:p-4",
198
+ "wgt:border",
199
+ "wgt:border-border-light",
200
+ "wgt:rounded-xl",
201
+ "wgt:hover:bg-gray-100",
202
+ "wgt:cursor-pointer",
203
+ "wgt:transition-colors",
204
+ "wgt:duration-200",
205
+ r ? "wgt:border-primary" : ""
206
+ ].filter(Boolean).join(" "), l.addEventListener("click", () => {
207
+ e = n.route, typeof s == "function" && s(n), d();
187
208
  });
188
209
  const a = document.createElement("div");
189
- a.className = "flex items-center gap-3";
190
- const i = document.createElement("img");
191
- i.src = t.logoUrl, i.alt = t.name, i.className = "h-8 object-contain";
192
- const s = document.createElement("div");
193
- s.className = "w-[1px] h-8 bg-border-light";
194
- const m = document.createElement("label");
195
- m.className = "text-base font-semibold leading-5 text-black uppercase", m.innerText = t.name, a.appendChild(i), a.appendChild(s), a.appendChild(m);
196
- const { container: x } = W({
210
+ a.className = "wgt:flex wgt:items-center wgt:gap-3";
211
+ const g = document.createElement("img");
212
+ g.src = n.logoUrl, g.alt = n.name, g.className = "wgt:h-8 wgt:object-contain";
213
+ const i = document.createElement("div");
214
+ i.className = "wgt:w-[1px] wgt:h-8 wgt:bg-border-light";
215
+ const w = document.createElement("label");
216
+ w.className = "wgt:text-base wgt:font-semibold wgt:leading-5 wgt:text-black wgt:uppercase", w.innerText = n.name, a.appendChild(g), a.appendChild(i), a.appendChild(w);
217
+ const { container: u } = I({
197
218
  checked: r,
198
- onChange: (v) => {
199
- v && (p = t.route, typeof o == "function" && o(t), d());
219
+ onChange: (T) => {
220
+ T && (e = n.route, typeof s == "function" && s(n), d());
200
221
  }
201
222
  });
202
- n.appendChild(a), n.appendChild(x), e.appendChild(n);
223
+ l.appendChild(a), l.appendChild(u), t.appendChild(l);
203
224
  });
204
225
  }
205
226
  return d(), {
206
- container: l,
207
- setSelectedRoute(t) {
208
- p = t, d();
227
+ container: o,
228
+ setSelectedRoute(n) {
229
+ e = n, d();
209
230
  }
210
231
  };
211
232
  }
212
- function S({
213
- name: f,
214
- value: p = "",
215
- type: o = "text",
216
- placeholder: l = "",
233
+ function j({
234
+ name: m,
235
+ value: e = "",
236
+ type: s = "text",
237
+ placeholder: o = "",
217
238
  label: c,
218
- required: e = !1,
239
+ required: t = !1,
219
240
  error: d = null,
220
- onInput: t = null
241
+ onInput: n = null
221
242
  }) {
222
243
  const r = document.createElement("div");
223
- r.className = "flex flex-col";
224
- const n = document.createElement("label");
225
- if (n.htmlFor = f, n.className = "font-medium mb-2 text-text-black", n.innerText = c, e) {
226
- const s = document.createElement("span");
227
- s.className = "text-red-500 ml-1", s.innerText = "*", n.appendChild(s);
244
+ r.className = "wgt:flex wgt:flex-col";
245
+ const l = document.createElement("label");
246
+ if (l.htmlFor = m, l.className = "wgt:font-medium wgt:mb-2 wgt:text-text-black", l.innerText = c, t) {
247
+ const i = document.createElement("span");
248
+ i.className = "wgt:text-red-500 wgt:ml-1", i.innerText = "*", l.appendChild(i);
228
249
  }
229
250
  const a = document.createElement("input");
230
- a.type = o, a.name = f, a.id = f, a.value = p, a.placeholder = l, a.className = [
231
- "border",
232
- "rounded",
233
- "px-3",
234
- "py-2",
235
- "focus:outline-none",
236
- "focus:ring-2",
237
- "focus:ring-blue-500",
238
- d ? "border-red-500" : "border-gray-300"
239
- ].join(" "), e && a.setAttribute("required", "true"), typeof t == "function" && a.addEventListener("input", t);
240
- const i = document.createElement("span");
241
- return i.className = "text-red-500 text-sm mt-1", i.innerText = d || "", d || (i.style.display = "none"), r.appendChild(n), r.appendChild(a), r.appendChild(i), {
251
+ a.type = s, a.name = m, a.id = m, a.value = e, a.placeholder = o, a.className = [
252
+ "wgt:border",
253
+ "wgt:rounded",
254
+ "wgt:px-3",
255
+ "wgt:py-2",
256
+ "wgt:focus:outline-none",
257
+ "wgt:focus:ring-2",
258
+ "wgt:focus:ring-blue-500",
259
+ d ? "wgt:border-red-500" : "wgt:border-gray-300"
260
+ ].join(" "), t && a.setAttribute("required", "true"), typeof n == "function" && a.addEventListener("input", n);
261
+ const g = document.createElement("span");
262
+ return g.className = "wgt:text-red-500 wgt:text-sm mt-1", g.innerText = d || "", d || (g.style.display = "none"), r.appendChild(l), r.appendChild(a), r.appendChild(g), {
242
263
  container: r,
243
264
  inputEl: a,
244
- setError(s) {
245
- s ? (i.innerText = s, i.style.display = "block", a.classList.remove("border-gray-300"), a.classList.add("border-red-500")) : (i.innerText = "", i.style.display = "none", a.classList.remove("border-red-500"), a.classList.add("border-gray-300"));
265
+ setError(i) {
266
+ i ? (g.innerText = i, g.style.display = "block", a.classList.remove("wgt:border-gray-300"), a.classList.add("wgt:border-red-500")) : (g.innerText = "", g.style.display = "none", a.classList.remove("wgt:border-red-500"), a.classList.add("wgt:border-gray-300"));
246
267
  },
247
268
  getValue() {
248
269
  return a.value;
249
270
  }
250
271
  };
251
272
  }
252
- function j({
253
- name: f,
254
- value: p = "",
255
- options: o = [],
256
- label: l,
273
+ function F({
274
+ name: m,
275
+ value: e = "",
276
+ options: s = [],
277
+ label: o,
257
278
  disabled: c = !1,
258
- error: e = null,
279
+ error: t = null,
259
280
  onChange: d = null
260
281
  }) {
261
- const t = document.createElement("div");
262
- t.className = "flex flex-col";
282
+ const n = document.createElement("div");
283
+ n.className = "wgt:flex wgt:flex-col";
263
284
  const r = document.createElement("label");
264
- r.htmlFor = f, r.className = "font-medium mb-1 text-gray-700", r.innerText = l;
265
- const n = document.createElement("select");
266
- n.id = f, n.name = f, n.disabled = c, n.className = [
267
- "border",
268
- "rounded",
269
- "px-3",
270
- "py-2",
271
- "bg-white",
272
- "focus:outline-none",
273
- "focus:ring-2",
274
- "focus:ring-blue-500",
275
- e ? "border-red-500" : "border-gray-300"
285
+ r.htmlFor = m, r.className = "wgt:font-medium wgt:mb-1 wgt:text-gray-700", r.innerText = o;
286
+ const l = document.createElement("select");
287
+ l.id = m, l.name = m, l.disabled = c, l.className = [
288
+ "wgt:border",
289
+ "wgt:rounded",
290
+ "wgt:px-3",
291
+ "wgt:py-2",
292
+ "wgt:bg-white",
293
+ "wgt:focus:outline-none",
294
+ "wgt:focus:ring-2",
295
+ "wgt:focus:ring-blue-500",
296
+ t ? "wgt:border-red-500" : "wgt:border-gray-300"
276
297
  ].join(" ");
277
298
  const a = document.createElement("option");
278
- a.value = "", a.disabled = !0, a.selected = p === "" || p == null, a.innerText = `-- Chọn ${l.toLowerCase()} --`, n.appendChild(a), o.forEach((s) => {
279
- const m = document.createElement("option");
280
- m.value = s.value, m.innerText = s.label, s.value === p && (m.selected = !0), n.appendChild(m);
281
- }), typeof d == "function" && n.addEventListener("change", d);
282
- const i = document.createElement("span");
283
- return i.className = "text-red-500 text-sm mt-1", i.innerText = e || "", e || (i.style.display = "none"), t.appendChild(n), t.appendChild(i), {
284
- container: t,
285
- selectEl: n,
286
- setError(s) {
287
- s ? (i.innerText = s, i.style.display = "block", n.classList.remove("border-gray-300"), n.classList.add("border-red-500")) : (i.innerText = "", i.style.display = "none", n.classList.remove("border-red-500"), n.classList.add("border-gray-300"));
299
+ a.value = "", a.disabled = !0, a.selected = e === "" || e == null, a.innerText = `-- Chọn ${o.toLowerCase()} --`, l.appendChild(a), s.forEach((i) => {
300
+ const w = document.createElement("option");
301
+ w.value = i.value, w.innerText = i.label, i.value === e && (w.selected = !0), l.appendChild(w);
302
+ }), typeof d == "function" && l.addEventListener("change", d);
303
+ const g = document.createElement("span");
304
+ return g.className = "wgt:text-red-500 wgt:text-sm wgt:mt-1", g.innerText = t || "", t || (g.style.display = "none"), n.appendChild(l), n.appendChild(g), {
305
+ container: n,
306
+ selectEl: l,
307
+ setError(i) {
308
+ i ? (g.innerText = i, g.style.display = "block", l.classList.remove("wgt:border-gray-300"), l.classList.add("wgt:border-red-500")) : (g.innerText = "", g.style.display = "none", l.classList.remove("wgt:border-red-500"), l.classList.add("wgt:border-gray-300"));
288
309
  },
289
310
  getValue() {
290
- return n.value;
311
+ return l.value;
291
312
  },
292
- setOptions(s) {
293
- for (; n.options.length > 1; )
294
- n.remove(1);
295
- s.forEach((m) => {
296
- const x = document.createElement("option");
297
- x.value = m.value, x.innerText = m.label, n.appendChild(x);
313
+ setOptions(i) {
314
+ for (; l.options.length > 1; )
315
+ l.remove(1);
316
+ i.forEach((w) => {
317
+ const u = document.createElement("option");
318
+ u.value = w.value, u.innerText = w.label, l.appendChild(u);
298
319
  });
299
320
  },
300
- setDisabled(s) {
301
- n.disabled = !!s;
321
+ setDisabled(i) {
322
+ l.disabled = !!i;
302
323
  }
303
324
  };
304
325
  }
305
- function I({
306
- label: f,
307
- required: p = !1,
308
- file: o = null,
309
- onFileChange: l,
326
+ function O({
327
+ label: m,
328
+ required: e = !1,
329
+ file: s = null,
330
+ onFileChange: o,
310
331
  error: c = null
311
332
  }) {
312
- const e = document.createElement("div");
313
- e.className = "flex flex-col";
333
+ const t = document.createElement("form");
334
+ t.className = "wgt:flex wgt:flex-col";
314
335
  const d = document.createElement("label");
315
- if (d.className = "font-medium mb-1 text-gray-700", d.innerText = f, p) {
316
- const u = document.createElement("span");
317
- u.className = "text-red-500 ml-1", u.innerText = "*", d.appendChild(u);
336
+ if (d.htmlFor = "upload", d.className = "wgt:font-medium wgt:mb-1 wgt:text-gray-700", d.innerText = m, e) {
337
+ const p = document.createElement("span");
338
+ p.className = "wgt:text-red-500 wgt:ml-1", p.innerText = "*", d.appendChild(p);
318
339
  }
319
- e.appendChild(d);
320
- const t = document.createElement("div");
321
- t.className = [
322
- "h-fit",
323
- "py-4",
324
- "w-full",
325
- "rounded",
326
- "overflow-hidden",
327
- "flex",
328
- "items-center",
329
- "cursor-pointer",
330
- "justify-center",
331
- "border",
332
- "border-dashed",
333
- "border-grey-6",
334
- "flex-col",
335
- "gap-2"
336
- ].join(" "), t.addEventListener("click", () => {
337
- r.click();
338
- });
340
+ t.appendChild(d);
341
+ const n = document.createElement("div");
342
+ n.className = [
343
+ "wgt:h-fit",
344
+ "wgt:py-4",
345
+ "wgt:w-full",
346
+ "wgt:rounded",
347
+ "wgt:overflow-hidden",
348
+ "wgt:flex",
349
+ "wgt:items-center",
350
+ "wgt:cursor-pointer",
351
+ "wgt:justify-center",
352
+ "wgt:border",
353
+ "wgt:border-dashed",
354
+ "wgt:border-grey-6",
355
+ "wgt:flex-col",
356
+ "wgt:gap-2"
357
+ ].join(" ");
339
358
  const r = document.createElement("input");
340
- r.type = "file", r.accept = "image/*,.pdf", r.className = "hidden", r.addEventListener("change", (u) => {
341
- const C = u.target.files && u.target.files[0] ? u.target.files[0] : null;
342
- N(C);
359
+ r.id = "upload", r.type = "file", r.accept = "image/*,.pdf", r.className = "wgt:hidden", r.addEventListener("change", (p) => {
360
+ const b = p.target.files && p.target.files[0] ? p.target.files[0] : null;
361
+ x(b), s = b;
343
362
  });
344
- const n = document.createElement("div");
345
- n.className = "w-full flex flex-col gap-2 items-center justify-center";
363
+ const l = document.createElement("div");
364
+ l.className = "wgt:w-full wgt:flex wgt:flex-col wgt:gap-2 wgt:items-center wgt:justify-center";
346
365
  const a = document.createElement("span");
347
- a.className = "text-red-500 text-sm mt-1", a.innerText = c || "", c || (a.style.display = "none");
348
- let i = null;
349
- function s() {
350
- if (!o || i) return;
351
- i = document.createElement("div"), i.className = [
352
- "fixed",
353
- "inset-0",
354
- "bg-black",
355
- "bg-opacity-75",
356
- "z-50",
357
- "flex",
358
- "items-center",
359
- "justify-center"
360
- ].join(" "), i.addEventListener("click", () => m());
361
- const u = document.createElement("div");
362
- u.className = "relative w-full h-screen bg-white overflow-auto";
363
- const C = document.createElement("button");
364
- C.innerHTML = "&times;", C.className = "absolute w-8 h-8 top-2 right-2 text-gray-600 text-2xl cursor-pointer", C.setAttribute("aria-label", "Close preview"), C.addEventListener("click", (h) => {
365
- h.stopPropagation(), m();
366
- }), u.appendChild(C);
367
- const y = document.createElement("div");
368
- if (y.className = "px-10 w-full h-full flex flex-col items-center justify-center", o.type === "application/pdf") {
366
+ a.className = "wgt:text-red-500 wgt:text-sm wgt:mt-1", a.innerText = c || "", c || (a.style.display = "none");
367
+ let g = null;
368
+ function i() {
369
+ if (!s || g) return;
370
+ g = document.createElement("div"), g.className = [
371
+ "wgt:fixed",
372
+ "wgt:inset-0",
373
+ "wgt:bg-black",
374
+ "wgt:bg-opacity-75",
375
+ "wgt:z-50",
376
+ "wgt:flex",
377
+ "wgt:items-center",
378
+ "wgt:justify-center"
379
+ ].join(" "), g.addEventListener("click", () => w());
380
+ const p = document.createElement("div");
381
+ p.className = "wgt:relative wgt:w-full wgt:h-screen wgt:bg-white wgt:overflow-auto";
382
+ const b = document.createElement("button");
383
+ b.innerHTML = "&times;", b.className = "wgt:absolute wgt:w-8 wgt:h-8 wgt:top-2 wgt:right-2 wgt:text-gray-600 wgt:text-2xl wgt:cursor-pointer", b.setAttribute("aria-label", "Close preview"), b.addEventListener("click", (h) => {
384
+ h.stopPropagation(), w();
385
+ }), p.appendChild(b);
386
+ const v = document.createElement("div");
387
+ if (v.className = "wgt:px-10 wgt:w-full wgt:h-full wgt:flex wgt:flex-col wgt:items-center wgt:justify-center", s.type === "application/pdf") {
369
388
  const h = document.createElement("object");
370
- h.data = g, h.type = "application/pdf", h.className = "w-full h-full object-contain", y.appendChild(h);
389
+ h.data = f, h.type = "application/pdf", h.className = "wgt:w-full wgt:h-full wgt:object-contain", v.appendChild(h);
371
390
  } else {
372
391
  const h = document.createElement("img");
373
- h.src = g, h.alt = "Full Preview", h.className = "max-h-screen object-contain", y.appendChild(h);
392
+ h.src = f, h.alt = "Full Preview", h.className = "wgt:max-h-screen wgt:object-contain", v.appendChild(h);
374
393
  }
375
- u.appendChild(y), i.appendChild(u), document.body.appendChild(i);
394
+ p.appendChild(v), g.appendChild(p), document.body.appendChild(g);
376
395
  }
377
- function m() {
378
- i && (document.body.removeChild(i), i = null);
396
+ function w() {
397
+ g && (document.body.removeChild(g), g = null);
379
398
  }
380
- const x = document.createElement("button");
381
- x.type = "button", x.className = "bg-primary hover:bg-primary-dark text-white px-4 py-1 rounded-md cursor-pointer", x.innerText = "Upload file", x.addEventListener("click", (u) => {
382
- u.stopPropagation(), r.click();
399
+ const u = document.createElement("button");
400
+ u.type = "button", u.className = "wgt:bg-primary wgt:hover:bg-primary-dark wgt:text-white wgt:px-4 wgt:py-1 wgt:rounded-md wgt:cursor-pointer", u.innerText = "Upload file", u.addEventListener("click", (p) => {
401
+ p.stopPropagation(), r.click();
383
402
  });
384
- function v(u, C = 2) {
385
- if (u === 0) return "0 Bytes";
386
- const y = 1024, h = Math.max(0, C), w = ["Bytes", "KB", "MB", "GB", "TB"], b = Math.floor(Math.log(u) / Math.log(y));
387
- return parseFloat((u / Math.pow(y, b)).toFixed(h)) + " " + w[b];
403
+ function T(p, b = 2) {
404
+ if (p === 0) return "0 Bytes";
405
+ const v = 1024, h = Math.max(0, b), H = ["Bytes", "KB", "MB", "GB", "TB"], y = Math.floor(Math.log(p) / Math.log(v));
406
+ return parseFloat((p / Math.pow(v, y)).toFixed(h)) + " " + H[y];
388
407
  }
389
- let g = null;
390
- function E(u) {
391
- g && (URL.revokeObjectURL(g), g = null), u && (g = URL.createObjectURL(u));
408
+ let f = null;
409
+ function E(p) {
410
+ f && (URL.revokeObjectURL(f), f = null), p && (f = URL.createObjectURL(p));
392
411
  }
393
- function N(u) {
394
- if (E(u), n.innerHTML = "", u) {
395
- const C = document.createElement("div");
396
- C.className = "flex w-full items-center justify-between";
397
- const y = document.createElement("div");
398
- if (y.className = "flex space-x-4 w-full justify-start items-center px-4", u.type === "application/pdf") {
399
- const T = document.createElement("div");
400
- T.className = "flex-shrink-0 flex items-center justify-center rounded", T.innerHTML = `
412
+ function x(p) {
413
+ if (E(p), l.innerHTML = "", p) {
414
+ const b = document.createElement("div");
415
+ b.className = "wgt:flex wgt:w-full wgt:items-center wgt:justify-between";
416
+ const v = document.createElement("div");
417
+ if (v.className = "wgt:flex wgt:space-x-4 wgt:w-full wgt:justify-start wgt:items-center wgt:px-4", v.addEventListener("click", () => {
418
+ r.click();
419
+ }), p.type === "application/pdf") {
420
+ const N = document.createElement("div");
421
+ N.className = "wgt:flex-shrink-0 wgt:flex wgt:items-center wgt:justify-center wgt:rounded", N.innerHTML = `
401
422
  <svg xmlns="http://www.w3.org/2000/svg" class="w-8 h-8 text-gray-500" fill="currentColor" viewBox="0 0 24 24">
402
423
  <path d="M6 2h9l5 5v15a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"/>
403
424
  <path d="M14 2v5h5"/>
404
425
  </svg>
405
- `, y.appendChild(T);
426
+ `, v.appendChild(N);
406
427
  } else {
407
- const T = document.createElement("img");
408
- T.src = g, T.alt = "Preview thumbnail", T.className = "object-contain h-20 w-20 rounded", y.appendChild(T);
428
+ const N = document.createElement("img");
429
+ N.src = f, N.alt = "Preview thumbnail", N.className = "wgt:object-contain wgt:h-20 wgt:w-20 wgt:rounded", v.appendChild(N);
409
430
  }
410
431
  const h = document.createElement("div");
411
- h.className = "flex-1";
412
- const w = document.createElement("p");
413
- w.className = "text-sm font-medium text-gray-800 truncate", w.innerText = u.name;
414
- const b = document.createElement("p");
415
- b.className = "text-sm text-gray-500", b.innerText = v(u.size), h.appendChild(w), h.appendChild(b), y.appendChild(h), C.appendChild(y);
416
- const k = document.createElement("button");
417
- k.type = "button", k.innerText = "Preview", k.className = "px-2 text-xs font-medium text-text-black", k.addEventListener("click", (T) => {
418
- T.preventDefault(), s();
419
- }), C.appendChild(k), n.appendChild(C);
432
+ h.className = "wgt:flex-1";
433
+ const H = document.createElement("p");
434
+ H.className = "wgt:text-sm wgt:font-medium wgt:text-gray-800 wgt:truncate", H.innerText = p.name;
435
+ const y = document.createElement("p");
436
+ y.className = "wgt:text-sm wgt:text-gray-500", y.innerText = T(p.size), h.appendChild(H), h.appendChild(y), v.appendChild(h), b.appendChild(v);
437
+ const C = document.createElement("button");
438
+ C.type = "button", C.innerText = "Preview", C.className = "wgt:p-2 wgt:text-xs wgt:font-medium wgt:text-text-black wgt:cursor:pointer", C.addEventListener("click", (N) => {
439
+ N.stopPropagation(), i();
440
+ }), b.appendChild(C), l.appendChild(b);
420
441
  } else {
421
- n.innerHTML = `
442
+ l.innerHTML = `
422
443
  <svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
423
444
  <path d="M13.1313 9.25809L13.1313 22.2754" stroke="#595959" stroke-width="0.810811" stroke-linecap="round" stroke-linejoin="round"/>
424
445
  <path d="M16.2832 12.4238L13.1308 9.25842L9.97834 12.4238" stroke="#595959" stroke-width="0.810811" stroke-linecap="round" stroke-linejoin="round"/>
@@ -427,27 +448,30 @@ function I({
427
448
  <span class="text-sm font-semibold leading-4 text-grey-8">Tải tệp lên</span>
428
449
  <span class="text-xs font-normal leading-3 text-grey-7">(Tối thiểu 400x400px, PNG hoặc JPEG)</span>
429
450
  `;
430
- const C = document.createElement("div");
431
- C.className = "flex items-center", C.appendChild(x), n.appendChild(C);
451
+ const b = document.createElement("div");
452
+ b.className = "wgt:flex wgt:items-center", b.appendChild(u), l.appendChild(b);
432
453
  }
433
454
  }
434
- return N(o), t.appendChild(n), t.appendChild(r), e.appendChild(t), e.appendChild(a), {
435
- container: e,
436
- setFile(u) {
437
- o = u, N(u);
455
+ return x(s), n.appendChild(l), n.appendChild(r), t.appendChild(n), t.appendChild(a), {
456
+ container: t,
457
+ getValues() {
458
+ return s;
459
+ },
460
+ setFile(p) {
461
+ s = p, x(p);
438
462
  },
439
463
  clearFile() {
440
- o = null, N(null);
464
+ s = null, x(null);
441
465
  },
442
- setError(u) {
443
- u ? (a.innerText = u, a.style.display = "block") : (a.innerText = "", a.style.display = "none");
466
+ setError(p) {
467
+ p ? (a.innerText = p, a.style.display = "block") : (a.innerText = "", a.style.display = "none");
444
468
  }
445
469
  };
446
470
  }
447
- const U = [
471
+ const z = [
448
472
  { value: "VN", label: "Việt Nam" }
449
473
  // …you could list other countries here…
450
- ], D = {
474
+ ], U = {
451
475
  VN: [
452
476
  { value: "HN", label: "Hà Nội" },
453
477
  { value: "HCM", label: "TP. Hồ Chí Minh" },
@@ -455,7 +479,7 @@ const U = [
455
479
  // …etc…
456
480
  ]
457
481
  // if you had other countries, put them here
458
- }, F = {
482
+ }, R = {
459
483
  HN: [
460
484
  { value: "QL", label: "Quận Ba Đình" },
461
485
  { value: "TL", label: "Quận Tây Hồ" }
@@ -471,7 +495,7 @@ const U = [
471
495
  { value: "S0", label: "Sơn Trà" }
472
496
  // …etc…
473
497
  ]
474
- }, R = {
498
+ }, W = {
475
499
  QL: [
476
500
  { value: "PD", label: "Phường Điện Biên" },
477
501
  { value: "NT", label: "Phường Ngọc Hà" }
@@ -497,127 +521,134 @@ const U = [
497
521
  { value: "NB", label: "Phường Nại Hiên Đông" }
498
522
  ]
499
523
  };
500
- function Z({ onSubmit: f }) {
501
- const p = document.createElement("form");
502
- p.className = "w-full", p.addEventListener("submit", (h) => {
503
- h.preventDefault();
504
- const w = y();
505
- typeof f == "function" && f(w);
524
+ function G({ onSubmit: m, registrationData: e }) {
525
+ var H, y, C, N, V, M, S;
526
+ const s = document.createElement("form");
527
+ s.className = "wgt:w-full", s.addEventListener("submit", (k) => {
528
+ k.preventDefault();
529
+ const L = h();
530
+ typeof m == "function" && m(L);
506
531
  });
507
532
  const o = document.createElement("div");
508
- o.className = "grid grid-cols-1 md:grid-cols-2 gap-8", p.appendChild(o);
509
- const l = document.createElement("div");
510
- l.className = "space-y-4";
533
+ o.className = "wgt:grid wgt:grid-cols-1 wgt:md:grid-cols-2 wgt:gap-8", s.appendChild(o);
511
534
  const c = document.createElement("div");
512
- c.className = "space-y-4", o.appendChild(l), o.appendChild(c);
513
- const e = S({
535
+ c.className = "wgt:space-y-4";
536
+ const t = document.createElement("div");
537
+ t.className = "wgt:space-y-4", o.appendChild(c), o.appendChild(t);
538
+ const d = j({
514
539
  name: "taxCode",
515
540
  label: "Mã số thuế",
516
541
  required: !0,
517
542
  error: null,
518
543
  placeholder: "",
519
- type: "text"
544
+ type: "text",
545
+ value: (e == null ? void 0 : e.taxCode) ?? ""
520
546
  });
521
- l.appendChild(e.container);
522
- const d = S({
547
+ c.appendChild(d.container);
548
+ const n = j({
523
549
  name: "representative",
524
550
  label: "Người đại diện",
525
551
  required: !0,
526
552
  error: null,
527
553
  placeholder: "",
528
- type: "text"
554
+ type: "text",
555
+ value: (e == null ? void 0 : e.representative) ?? ""
529
556
  });
530
- l.appendChild(d.container);
531
- const t = S({
557
+ c.appendChild(n.container);
558
+ const r = j({
532
559
  name: "email",
533
560
  label: "Email",
534
561
  required: !0,
535
562
  error: null,
536
563
  placeholder: "",
537
- type: "email"
564
+ type: "email",
565
+ value: (e == null ? void 0 : e.email) ?? ""
538
566
  });
539
- l.appendChild(t.container);
540
- const r = S({
567
+ c.appendChild(r.container);
568
+ const l = j({
541
569
  name: "phone",
542
570
  label: "Số điện thoại",
543
571
  required: !0,
544
572
  error: null,
545
573
  placeholder: "",
546
- type: "tel"
574
+ type: "tel",
575
+ value: (e == null ? void 0 : e.phone) ?? ""
547
576
  });
548
- l.appendChild(r.container);
549
- const n = I({
577
+ c.appendChild(l.container);
578
+ const a = O({
550
579
  label: "Giấy phép đăng ký kinh doanh",
551
580
  required: !0,
552
- file: null,
553
- onFileChange: (h) => {
581
+ file: (e == null ? void 0 : e.license) ?? null,
582
+ onFileChange: (k) => {
554
583
  },
555
584
  error: null
556
585
  });
557
- l.appendChild(n.container);
558
- const a = S({
586
+ c.appendChild(a.container);
587
+ const g = j({
559
588
  name: "companyName",
560
589
  label: "Tên công ty",
561
590
  required: !1,
562
591
  error: null,
563
592
  placeholder: "",
564
- type: "text"
593
+ type: "text",
594
+ value: (e == null ? void 0 : e.companyName) ?? ""
565
595
  });
566
- c.appendChild(a.container);
567
- const i = S({
596
+ t.appendChild(g.container);
597
+ const i = j({
568
598
  name: "position",
569
599
  label: "Chức vụ",
570
600
  required: !1,
571
601
  error: null,
572
602
  placeholder: "",
573
- type: "text"
603
+ type: "text",
604
+ value: (e == null ? void 0 : e.position) ?? ""
574
605
  });
575
- c.appendChild(i.container);
576
- const s = document.createElement("div");
577
- s.className = "w-full flex flex-col gap-2", c.appendChild(s);
578
- const m = document.createElement("span");
579
- m.className = "font-medium text-text-black", m.innerText = "Địa chỉ", s.appendChild(m);
580
- const x = j({
606
+ t.appendChild(i.container);
607
+ const w = document.createElement("div");
608
+ w.className = "wgt:w-full wgt:flex wgt:flex-col wgt:gap-2", t.appendChild(w);
609
+ const u = document.createElement("span");
610
+ u.className = "wgt:font-medium wgt:text-text-black", u.innerText = "Địa chỉ", w.appendChild(u);
611
+ const T = F({
581
612
  name: "country",
582
613
  label: "Quốc gia",
583
- options: U,
614
+ options: z,
584
615
  // e.g. [{value:"vn",label:"Việt Nam"}, …]
585
616
  value: "",
586
617
  disabled: !1,
587
618
  error: null,
588
- onChange: (h) => {
589
- const w = h.target.value;
590
- D[w] ? (v.setOptions(D[w]), v.setDisabled(!1)) : (v.setOptions([]), v.setDisabled(!0)), v.selectEl.value = "", g.setOptions([]), g.selectEl.value = "", g.setDisabled(!0), E.setOptions([]), E.selectEl.value = "", E.setDisabled(!0);
619
+ onChange: (k) => {
620
+ const L = k.target.value;
621
+ U[L] ? (f.setOptions(U[L]), f.setDisabled(!1)) : (f.setOptions([]), f.setDisabled(!0)), f.selectEl.value = "", E.setOptions([]), E.selectEl.value = "", E.setDisabled(!0), x.setOptions([]), x.selectEl.value = "", x.setDisabled(!0);
591
622
  }
592
623
  });
593
- s.appendChild(x.container);
594
- const v = j({
624
+ w.appendChild(T.container);
625
+ const f = F({
595
626
  name: "province",
596
627
  label: "Tỉnh/Thành phố",
597
628
  options: [],
598
629
  value: "",
599
630
  disabled: !0,
600
631
  error: null,
601
- onChange: (h) => {
602
- const w = h.target.value;
603
- F[w] ? (g.setOptions(F[w]), g.setDisabled(!1)) : (g.setOptions([]), g.setDisabled(!0)), E.setOptions([]), E.selectEl.value = "", E.setDisabled(!0);
632
+ onChange: (k) => {
633
+ const L = k.target.value;
634
+ R[L] ? (E.setOptions(R[L]), E.setDisabled(!1)) : (E.setOptions([]), E.setDisabled(!0)), x.setOptions([]), x.selectEl.value = "", x.setDisabled(!0);
604
635
  }
605
636
  });
606
- s.appendChild(v.container);
607
- const g = j({
637
+ w.appendChild(f.container);
638
+ const E = F({
608
639
  name: "district",
609
640
  label: "Quận/Huyện",
610
641
  options: [],
611
642
  value: "",
612
643
  disabled: !0,
613
644
  error: null,
614
- onChange: (h) => {
615
- const w = h.target.value;
616
- R[w] ? (E.setOptions(R[w]), E.setDisabled(!1)) : (E.setOptions([]), E.setDisabled(!0));
645
+ onChange: (k) => {
646
+ const L = k.target.value;
647
+ W[L] ? (x.setOptions(W[L]), x.setDisabled(!1)) : (x.setOptions([]), x.setDisabled(!0));
617
648
  }
618
649
  });
619
- s.appendChild(g.container);
620
- const E = j({
650
+ w.appendChild(E.container);
651
+ const x = F({
621
652
  name: "ward",
622
653
  label: "Phường/Xã",
623
654
  options: [],
@@ -627,231 +658,268 @@ function Z({ onSubmit: f }) {
627
658
  onChange: () => {
628
659
  }
629
660
  });
630
- s.appendChild(E.container);
631
- const N = S({
661
+ w.appendChild(x.container);
662
+ const p = j({
632
663
  name: "detail",
633
664
  label: "Địa chỉ cụ thể",
634
665
  required: !1,
635
666
  error: null,
636
667
  placeholder: "",
637
- type: "text"
668
+ type: "text",
669
+ value: ((H = e == null ? void 0 : e.address) == null ? void 0 : H.detail) ?? ""
638
670
  });
639
- s.appendChild(N.container);
640
- const u = document.createElement("div");
641
- u.className = "flex items-center justify-end gap-2";
642
- const C = document.createElement("button");
643
- C.type = "submit", C.innerText = "Tiếp theo", C.className = [
644
- "bg-primary",
645
- "hover:bg-primary-dark",
646
- "text-white",
647
- "px-6",
648
- "py-2",
649
- "rounded",
650
- "disabled:opacity-50",
651
- "disabled:cursor-not-allowed",
652
- "cursor-pointer"
653
- ].join(" "), u.appendChild(C), p.appendChild(u);
654
- function y() {
671
+ w.appendChild(p.container);
672
+ const b = document.createElement("div");
673
+ b.className = "wgt:flex wgt:mt-4 wgt:items-center wgt:justify-end wgt:gap-2 ";
674
+ const v = document.createElement("button");
675
+ if (v.type = "submit", v.innerText = "Tiếp theo", v.className = [
676
+ "wgt:bg-primary",
677
+ "wgt:hover:bg-primary-dark",
678
+ "wgt:text-white",
679
+ "wgt:px-6",
680
+ "wgt:py-2",
681
+ "wgt:rounded",
682
+ "wgt:disabled:opacity-50",
683
+ "wgt:disabled:cursor-not-allowed",
684
+ "wgt:cursor-pointer"
685
+ ].join(" "), b.appendChild(v), s.appendChild(b), (y = e == null ? void 0 : e.address) != null && y.country) {
686
+ const k = e == null ? void 0 : e.address.country;
687
+ T.selectEl.value = k;
688
+ const L = U[k] || [];
689
+ if (L.length > 0) {
690
+ f.setOptions(L), f.setDisabled(!1);
691
+ const P = (C = e == null ? void 0 : e.address) == null ? void 0 : C.province;
692
+ P && (f.selectEl.value = P);
693
+ }
694
+ const A = (N = e == null ? void 0 : e.address) == null ? void 0 : N.province;
695
+ if (A && R[A]) {
696
+ const P = R[A];
697
+ E.setOptions(P), E.setDisabled(!1);
698
+ const B = (V = e == null ? void 0 : e.address) == null ? void 0 : V.district;
699
+ B && (E.selectEl.value = B);
700
+ }
701
+ const q = (M = e == null ? void 0 : e.address) == null ? void 0 : M.district;
702
+ if (q && W[q]) {
703
+ const P = W[q];
704
+ x.setOptions(P), x.setDisabled(!1);
705
+ const B = (S = e == null ? void 0 : e.address) == null ? void 0 : S.ward;
706
+ B && (x.selectEl.value = B);
707
+ }
708
+ }
709
+ function h() {
655
710
  return {
656
- taxCode: e.getValue().trim(),
657
- representative: d.getValue().trim(),
658
- email: t.getValue().trim(),
659
- phone: r.getValue().trim(),
660
- license: n ? n.file : null,
661
- companyName: a.getValue().trim(),
711
+ taxCode: d.getValue().trim(),
712
+ representative: n.getValue().trim(),
713
+ email: r.getValue().trim(),
714
+ phone: l.getValue().trim(),
715
+ license: a.getValues(),
716
+ companyName: g.getValue().trim(),
662
717
  position: i.getValue().trim(),
663
718
  address: {
664
- country: x.getValue(),
665
- province: v.getValue(),
666
- district: g.getValue(),
667
- ward: E.getValue(),
668
- detail: N.getValue().trim()
719
+ country: T.getValue(),
720
+ province: f.getValue(),
721
+ district: E.getValue(),
722
+ ward: x.getValue(),
723
+ detail: p.getValue().trim()
669
724
  }
670
725
  };
671
726
  }
672
727
  return {
673
- container: p,
674
- getValues: y
728
+ container: s,
729
+ getValues: h
675
730
  };
676
731
  }
677
- function _({ providerProps: f, formProps: p }) {
678
- const o = document.createElement("div");
679
- o.className = "flex flex-col gap-4 w-full max-w-[1072px] mx-auto";
680
- const l = q(f);
681
- o.appendChild(l.container);
682
- const c = Z(p);
683
- return o.appendChild(c.container), { container: o };
732
+ function K({ providerProps: m, formProps: e }) {
733
+ const s = document.createElement("div");
734
+ s.className = "wgt:flex wgt:flex-col wgt:gap-4 wgt:w-full wgt:max-w-[1072px] wgt:mx-auto";
735
+ const o = $(m);
736
+ s.appendChild(o.container);
737
+ const c = G(e);
738
+ return s.appendChild(c.container), { container: s };
684
739
  }
685
- function O({ value: f = "", onInputChange: p } = {}) {
686
- const o = document.createElement("div");
687
- o.className = "flex flex-col";
688
- const l = document.createElement("label");
689
- l.className = "font-medium mb-1 text-gray-700", l.innerHTML = 'Chọn gói đăng ký <span class="text-red-500">*</span>', o.appendChild(l);
740
+ function X({ value: m = "", onInputChange: e } = {}) {
741
+ const s = document.createElement("div");
742
+ s.className = "wgt:flex wgt:flex-col";
743
+ const o = document.createElement("label");
744
+ o.className = "wgt:font-medium wgt:mb-1 wgt:text-gray-700", o.innerHTML = 'Chọn gói đăng ký <span class="wgt:text-red-500">*</span>', s.appendChild(o);
690
745
  const c = document.createElement("div");
691
- c.className = "flex rounded-lg border border-gray-300 overflow-hidden";
692
- const e = document.createElement("input");
693
- e.type = "text", e.inputMode = "numeric", e.value = f, e.placeholder = "Số đơn/tháng", e.className = [
694
- "flex-1",
695
- "px-4",
696
- "py-2",
697
- "text-gray-700",
698
- "placeholder-gray-400",
699
- "bg-white",
700
- "focus:outline-none"
701
- ].join(" "), typeof p == "function" && e.addEventListener("input", p);
746
+ c.className = "wgt:flex wgt:rounded-lg wgt:border wgt:border-gray-300 wgt:overflow-hidden";
747
+ const t = document.createElement("input");
748
+ t.type = "text", t.inputMode = "numeric", t.value = m, t.placeholder = "Số đơn/tháng", t.className = [
749
+ "wgt:flex-1",
750
+ "wgt:px-4",
751
+ "wgt:py-2",
752
+ "wgt:text-gray-700",
753
+ "wgt:placeholder-gray-400",
754
+ "wgt:bg-white",
755
+ "wgt:focus:outline-none"
756
+ ].join(" "), typeof e == "function" && t.addEventListener("input", e);
702
757
  const d = document.createElement("span");
703
- return d.className = "px-4 py-2 bg-gray-100 text-gray-600 flex-shrink-0", d.innerText = "đơn/tháng", c.appendChild(e), c.appendChild(d), o.appendChild(c), {
704
- container: o,
705
- inputEl: e,
758
+ return d.className = "wgt:px-4 wgt:py-2 wgt:bg-gray-100 wgt:text-gray-600 wgt:flex-shrink-0", d.innerText = "đơn/tháng", c.appendChild(t), c.appendChild(d), s.appendChild(c), {
759
+ container: s,
760
+ inputEl: t,
706
761
  getValue() {
707
- return e.value;
762
+ return t.value;
708
763
  },
709
- setValue(t) {
710
- e.value = t;
764
+ setValue(n) {
765
+ t.value = n;
711
766
  }
712
767
  };
713
768
  }
714
- function $({
715
- packageOptions: f = [],
716
- selectedPackageId: p = "",
717
- onPackageSelect: o
769
+ function J({
770
+ packageOptions: m = [],
771
+ selectedPackageId: e = "",
772
+ handlePackageSelect: s
718
773
  } = {}) {
719
- const l = document.createElement("div");
720
- l.className = "space-y-6";
774
+ const o = document.createElement("div");
775
+ o.className = "space-y-6";
721
776
  const c = document.createElement("h3");
722
- c.className = "text-lg font-medium text-gray-800 mb-2", c.innerText = "Gói phù hợp nhất", l.appendChild(c);
723
- const e = document.createElement("div");
724
- e.className = "w-full grid grid-cols-3 gap-6", l.appendChild(e);
777
+ c.className = "wgt:text-lg wgt:font-medium wgt:text-gray-800 wgt:mb-2", c.innerText = "Gói phù hợp nhất", o.appendChild(c);
778
+ const t = document.createElement("div");
779
+ t.className = "wgt:w-full wgt:grid wgt:grid-cols-3 wgt:gap-6", o.appendChild(t);
725
780
  function d() {
726
- e.innerHTML = "", f.forEach((t) => {
727
- const r = t.id === p, n = document.createElement("label");
728
- n.className = [
729
- "relative",
730
- "border",
731
- "rounded-xl",
732
- "p-4",
733
- "flex-shrink-0",
734
- "cursor-pointer",
735
- "bg-white",
736
- r ? "border-primary" : "border-grey-6 hover:border-gray-300"
781
+ t.innerHTML = "", m.forEach((n) => {
782
+ const r = n.id === e, l = document.createElement("label");
783
+ l.className = [
784
+ "wgt:relative",
785
+ "wgt:border",
786
+ "wgt:rounded-xl",
787
+ "wgt:p-4",
788
+ "wgt:flex-shrink-0",
789
+ "wgt:cursor-pointer",
790
+ "wgt:bg-white",
791
+ r ? "wgt:border-primary" : "wgt:border-grey-6 wgt:hover:border-gray-300"
737
792
  ].filter(Boolean).join(" ");
738
793
  const a = document.createElement("div");
739
- a.className = "flex justify-between items-center";
740
- const i = document.createElement("span");
741
- i.className = [
742
- "text-base",
743
- "font-semibold",
744
- r ? "text-green-700" : "text-gray-800"
745
- ].join(" "), i.innerText = t.code, a.appendChild(i);
746
- const { container: s } = W({
794
+ a.className = "wgt:flex wgt:justify-between wgt:items-center";
795
+ const g = document.createElement("span");
796
+ g.className = [
797
+ "wgt:text-base",
798
+ "wgt:font-semibold",
799
+ r ? "wgt:text-green-700" : "wgt:text-gray-800"
800
+ ].join(" "), g.innerText = n.code, a.appendChild(g);
801
+ const { container: i } = I({
747
802
  checked: r,
748
- onChange: (u) => {
749
- u && (p = t.id, typeof o == "function" && o(t.id), d());
803
+ onChange: (p) => {
804
+ p && (e = n.id, typeof s == "function" && s(n.id), d());
750
805
  }
751
806
  });
752
- a.appendChild(s), n.appendChild(a);
753
- const m = document.createElement("div");
754
- m.className = "flex items-center text-gray-600 mt-2";
755
- const x = document.createElement("svg");
756
- x.setAttribute("xmlns", "http://www.w3.org/2000/svg"), x.setAttribute("class", "w-5 h-5 text-green-500 flex-shrink-0"), x.setAttribute("fill", "none"), x.setAttribute("viewBox", "0 0 24 24"), x.setAttribute("stroke", "currentColor"), x.setAttribute("stroke-width", "3"), x.innerHTML = `
807
+ a.appendChild(i), l.appendChild(a);
808
+ const w = document.createElement("div");
809
+ w.className = "wgt:flex wgt:items-center wgt:text-gray-600 wgt:mt-2";
810
+ const u = document.createElement("svg");
811
+ u.setAttribute("xmlns", "http://www.w3.org/2000/svg"), u.setAttribute("class", "w-5 h-5 text-green-500 flex-shrink-0"), u.setAttribute("fill", "none"), u.setAttribute("viewBox", "0 0 24 24"), u.setAttribute("stroke", "currentColor"), u.setAttribute("stroke-width", "3"), u.innerHTML = `
757
812
  <path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" />
758
- `, m.appendChild(x);
759
- const v = document.createElement("span");
760
- v.className = "ml-2 text-sm", v.innerText = `${t.unitsPerMonth.toLocaleString("vi-VN")} hóa đơn điện tử / tháng`, m.appendChild(v), n.appendChild(m);
761
- const g = document.createElement("div");
762
- g.className = "mt-4";
813
+ `, w.appendChild(u);
814
+ const T = document.createElement("span");
815
+ T.className = "wgt:ml-2 wgt:text-sm", T.innerText = `${n.unitsPerMonth.toLocaleString("vi-VN")} hóa đơn điện tử / tháng`, w.appendChild(T), l.appendChild(w);
816
+ const f = document.createElement("div");
817
+ f.className = "wgt:mt-4";
763
818
  const E = document.createElement("span");
764
819
  E.className = [
765
- "block",
766
- "text-2xl",
767
- "font-bold",
768
- r ? "text-green-700" : "text-gray-900"
769
- ].join(" "), E.innerText = t.priceVND.toLocaleString("vi-VN"), g.appendChild(E);
770
- const N = document.createElement("span");
771
- N.className = "text-sm text-gray-600", N.innerText = "VND/Gói", g.appendChild(N), n.appendChild(g), e.appendChild(n);
820
+ "wgt:block",
821
+ "wgt:text-2xl",
822
+ "wgt:font-bold",
823
+ r ? "wgt:text-green-700" : "wgt:text-gray-900"
824
+ ].join(" "), E.innerText = n.priceVND.toLocaleString("vi-VN"), f.appendChild(E);
825
+ const x = document.createElement("span");
826
+ x.className = "wgt:text-sm wgt:text-gray-600", x.innerText = "VND/Gói", f.appendChild(x), l.appendChild(f), t.appendChild(l);
772
827
  });
773
828
  }
774
829
  return d(), {
775
- container: l,
776
- setSelectedPackageId(t) {
777
- p = t, d();
830
+ container: o,
831
+ setSelectedPackageId(n) {
832
+ e = n, d();
778
833
  }
779
834
  };
780
835
  }
781
- function P({
782
- title: f,
783
- isDisabled: p = !1,
784
- handleClick: o = null,
785
- type: l = "button",
836
+ function Q({
837
+ title: m,
838
+ isDisabled: e = !1,
839
+ handleClick: s = null,
840
+ type: o = "button",
786
841
  className: c = ""
787
842
  } = {}) {
788
- const e = document.createElement("button");
789
- return e.type = l, e.disabled = p, e.className = [
790
- "bg-primary",
791
- "hover:bg-primary-dark",
792
- "text-white",
793
- "px-6",
794
- "py-2",
795
- "rounded",
796
- "disabled:opacity-50",
797
- "disabled:cursor-not-allowed",
798
- "cursor-pointer",
843
+ const t = document.createElement("button");
844
+ return t.type = o, t.disabled = e, t.className = [
845
+ "wgt:bg-primary",
846
+ "wgt:hover:bg-primary-dark",
847
+ "wgt:text-white",
848
+ "wgt:px-6",
849
+ "wgt:py-2",
850
+ "wgt:rounded",
851
+ "wgt:disabled:opacity-50",
852
+ "wgt:disabled:cursor-not-allowed",
853
+ "wgt:cursor-pointer",
799
854
  c
800
- ].filter(Boolean).join(" "), e.innerText = f, typeof o == "function" && e.addEventListener("click", (d) => {
801
- e.disabled || o(d);
802
- }), e;
855
+ ].filter(Boolean).join(" "), t.innerText = m, typeof s == "function" && t.addEventListener("click", (d) => {
856
+ t.disabled || s(d);
857
+ }), t;
803
858
  }
804
- function z({ onNext: f, onPrev: p, setSelectedOption: o }) {
805
- const l = [
859
+ function Y({
860
+ onNext: m,
861
+ onPrev: e,
862
+ setSelectedOption: s,
863
+ selectedOption: o
864
+ }) {
865
+ const c = [
806
866
  { id: "pkg-300-a", code: "DT-300", unitsPerMonth: 300, priceVND: 45e4 },
807
867
  { id: "pkg-500", code: "DT-500", unitsPerMonth: 500, priceVND: 75e4 },
808
- { id: "pkg-1000-b", code: "DT-1000", unitsPerMonth: 1e3, priceVND: 105e4 }
809
- ], c = document.createElement("div");
810
- c.className = "flex flex-col gap-6";
811
- const e = document.createElement("div");
812
- e.className = "w-full max-w-[1070px] mx-auto flex flex-col gap-6", c.appendChild(e);
868
+ {
869
+ id: "pkg-1000-b",
870
+ code: "DT-1000",
871
+ unitsPerMonth: 1e3,
872
+ priceVND: 105e4
873
+ }
874
+ ], t = document.createElement("div");
875
+ t.className = "wgt:flex wgt:flex-col wgt:gap-6 wgt:h-full wgt:justify-between";
813
876
  const d = document.createElement("div");
814
- d.className = "w-full px-6 pb-6 pt-4 rounded-3xl bg-weak-50 flex flex-col gap-6", e.appendChild(d);
815
- let t = "", r = [...l], n = l[1].id;
816
- const a = O({
817
- value: t,
818
- onInputChange: (b) => {
819
- t = b.target.value.replace(/\D/g, ""), v();
877
+ d.className = "wgt:w-full wgt:max-w-[1070px] wgt:mx-auto wgt:flex wgt:flex-col wgt:gap-6", t.appendChild(d);
878
+ const n = document.createElement("div");
879
+ n.className = "wgt:w-full wgt:px-6 wgt:pb-6 wgt:pt-4 wgt:rounded-3xl wgt:bg-weak-50 wgt:flex wgt:flex-col wgt:gap-6", d.appendChild(n);
880
+ let r = "", l = [...c], a = (o == null ? void 0 : o.id) ?? c[1].id;
881
+ const g = X({
882
+ value: r,
883
+ onInputChange: (C) => {
884
+ r = C.target.value.replace(/\D/g, ""), f();
820
885
  }
821
886
  });
822
- d.appendChild(a.container);
887
+ n.appendChild(g.container);
823
888
  const i = document.createElement("div");
824
- d.appendChild(i);
825
- let s = null;
826
- function m() {
827
- if (i.innerHTML = "", r.length > 0)
828
- s = $({
829
- packageOptions: r,
830
- selectedPackageId: n
831
- }), i.appendChild(s.container);
889
+ n.appendChild(i);
890
+ let w = null;
891
+ function u() {
892
+ if (i.innerHTML = "", l.length > 0)
893
+ w = J({
894
+ packageOptions: l,
895
+ selectedPackageId: a,
896
+ handlePackageSelect: (C) => {
897
+ a = C, u();
898
+ }
899
+ }), i.appendChild(w.container);
832
900
  else {
833
- const b = document.createElement("span");
834
- b.className = "text-gray-500", b.innerText = "No package found.", i.appendChild(b), s = null;
901
+ const C = document.createElement("span");
902
+ C.className = "wgt:text-gray-500", C.innerText = "No package found.", i.appendChild(C), w = null;
835
903
  }
836
904
  }
837
- let x = null;
838
- function v() {
839
- x && clearTimeout(x), t !== "" ? x = setTimeout(() => {
840
- const b = l.find(
841
- (k) => k.code.endsWith(t)
905
+ let T = null;
906
+ function f() {
907
+ T && clearTimeout(T), r !== "" ? T = setTimeout(() => {
908
+ const C = c.find(
909
+ (N) => N.code.endsWith(r)
842
910
  );
843
- b ? (n = b.id, r = [b]) : r = [], m();
844
- }, 500) : (r = [...l], m());
911
+ C ? (a = C.id, l = [C]) : l = [], u();
912
+ }, 500) : (l = [...c], u());
845
913
  }
846
- m();
847
- const g = document.createElement("div");
848
- g.className = "flex items-center gap-4";
849
- const E = document.createElement("span");
850
- E.className = "text-sm font-semibold leading-[18px] text-text-black", E.innerText = "Hình thức thanh toán:", g.appendChild(E);
851
- const N = document.createElement("div");
852
- N.className = "p-2 w-fit rounded-[10px] border border-soft-200 flex items-center gap-2";
853
- const u = document.createElement("div");
854
- u.innerHTML = `
914
+ u();
915
+ const E = document.createElement("div");
916
+ E.className = "wgt:flex wgt:items-center wgt:gap-4";
917
+ const x = document.createElement("span");
918
+ x.className = "wgt:text-sm wgt:font-semibold wgt:leading-[18px] wgt:text-text-black", x.innerText = "Hình thức thanh toán:", E.appendChild(x);
919
+ const p = document.createElement("div");
920
+ p.className = "wgt:p-2 wgt:w-fit wgt:rounded-[10px] wgt:border wgt:border-soft-200 wgt:flex wgt:items-center wgt:gap-2";
921
+ const b = document.createElement("div");
922
+ b.innerHTML = `
855
923
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none"
856
924
  xmlns="http://www.w3.org/2000/svg">
857
925
  <rect width="24" height="24" rx="8" fill="#379DF1" />
@@ -871,146 +939,146 @@ function z({ onNext: f, onPrev: p, setSelectedOption: o }) {
871
939
  </clipPath>
872
940
  </defs>
873
941
  </svg>
874
- `, N.appendChild(u);
875
- const C = document.createElement("span");
876
- C.className = "text-base font-semibold leading-5 text-strong-950", C.innerText = "Thanh toán qua mã QR", N.appendChild(C), g.appendChild(N), e.appendChild(g);
877
- const y = document.createElement("div");
878
- y.className = "flex items-center justify-between gap-2 px-6";
879
- const h = P({
942
+ `, p.appendChild(b);
943
+ const v = document.createElement("span");
944
+ v.className = "wgt:text-base wgt:font-semibold wgt:leading-5 wgt:text-strong-950", v.innerText = "Thanh toán qua mã QR", p.appendChild(v), E.appendChild(p), d.appendChild(E);
945
+ const h = document.createElement("div");
946
+ h.className = "wgt:flex wgt:items-center wgt:justify-between wgt:gap-2 wgt:px-6";
947
+ const H = Q({
880
948
  type: "button",
881
949
  title: "Quay lại",
882
- className: "bg-transparent !text-primary hover:bg-transparent underline",
883
- handleClick: p
950
+ className: "wgt:bg-transparent wgt:!text-primary wgt:hover:bg-transparent wgt:underline",
951
+ handleClick: e
884
952
  });
885
- y.appendChild(h);
886
- const w = P({
953
+ h.appendChild(H);
954
+ const y = Q({
887
955
  type: "button",
888
956
  title: "Tiếp theo",
889
957
  className: "",
890
958
  handleClick: () => {
891
- const b = l.find(
892
- (k) => k.id === n
959
+ const C = c.find(
960
+ (N) => N.id === a
893
961
  );
894
- b && (o(b), f());
962
+ C && (s(C), m());
895
963
  }
896
964
  });
897
- return y.appendChild(w), c.appendChild(y), { container: c };
965
+ return h.appendChild(y), t.appendChild(h), { container: t };
898
966
  }
899
- function G({
900
- qrSrc: f = "",
901
- logos: p = [],
902
- accountName: o = "",
903
- accountNumber: l = "",
967
+ function D({
968
+ qrSrc: m = "",
969
+ logos: e = [],
970
+ accountName: s = "",
971
+ accountNumber: o = "",
904
972
  bankName: c = "",
905
- instructions: e = [],
973
+ instructions: t = [],
906
974
  illustrationSrc: d = ""
907
975
  } = {}) {
908
- const t = document.createElement("div");
909
- t.className = "flex flex-col md:flex-row gap-6 p-6 bg-gray-50 rounded-xl";
910
- const r = document.createElement("div"), n = document.createElement("h3");
911
- n.className = "text-lg font-semibold text-gray-800 mb-4 text-center", n.innerText = "Quét mã QR để thanh toán", r.appendChild(n);
976
+ const n = document.createElement("div");
977
+ n.className = "wgt:flex wgt:flex-col wgt:md:flex-row wgt:gap-6 wgt:p-6 wgt:bg-gray-50 wgt:rounded-xl";
978
+ const r = document.createElement("div"), l = document.createElement("h3");
979
+ l.className = "wgt:text-lg wgt:font-semibold wgt:text-gray-800 wgt:mb-4 wgt:text-center", l.innerText = "Quét mã QR để thanh toán", r.appendChild(l);
912
980
  const a = document.createElement("div");
913
- a.className = "bg-white rounded-md p-6 flex flex-col gap-4 border border-[#E4E7EC]";
914
- const i = document.createElement("div");
915
- i.className = "flex justify-center";
916
- const s = document.createElement("img");
917
- s.src = f, s.alt = "QR code", s.className = "w-full max-w-[200px] aspect-square object-contain", i.appendChild(s), a.appendChild(i);
918
- const m = document.createElement("div");
919
- m.className = "flex justify-center items-center gap-4 flex-wrap", p.forEach((b) => {
920
- const k = document.createElement("img");
921
- k.src = b, k.alt = "Logo", k.className = "w-8 object-contain", m.appendChild(k);
922
- }), a.appendChild(m);
923
- const x = document.createElement("div");
924
- x.className = "text-center flex flex-col gap-1";
925
- const v = document.createElement("h3");
926
- v.className = "text-lg font-bold text-text-black", v.innerText = o, x.appendChild(v);
927
- const g = document.createElement("p");
928
- g.className = "text-sm text-grey-8", g.innerHTML = `Số tài khoản: <span class="font-medium">${l}</span>`, x.appendChild(g);
981
+ a.className = "wgt:bg-white wgt:rounded-md wgt:p-6 wgt:flex wgt:flex-col wgt:gap-4 wgt:border wgt:border-[#E4E7EC]";
982
+ const g = document.createElement("div");
983
+ g.className = "wgt:flex wgt:justify-center";
984
+ const i = document.createElement("img");
985
+ i.src = m, i.alt = "QR code", i.className = "wgt:w-full wgt:max-w-[200px] wgt:aspect-square wgt:object-contain", g.appendChild(i), a.appendChild(g);
986
+ const w = document.createElement("div");
987
+ w.className = "wgt:flex wgt:justify-center wgt:items-center wgt:gap-4 wgt:flex-wrap", e.forEach((y) => {
988
+ const C = document.createElement("img");
989
+ C.src = y, C.alt = "Logo", C.className = "wgt:w-8 wgt:object-contain", w.appendChild(C);
990
+ }), a.appendChild(w);
991
+ const u = document.createElement("div");
992
+ u.className = "wgt:text-center wgt:flex wgt:flex-col wgt:gap-1";
993
+ const T = document.createElement("h3");
994
+ T.className = "wgt:text-lg wgt:font-bold wgt:text-text-black", T.innerText = s, u.appendChild(T);
995
+ const f = document.createElement("p");
996
+ f.className = "wgt:text-sm wgt:text-grey-8", f.innerHTML = `Số tài khoản: <span class="wgt:font-medium">${o}</span>`, u.appendChild(f);
929
997
  const E = document.createElement("p");
930
- E.className = "text-sm text-grey-8", E.innerHTML = `Ngân hàng thụ hưởng: <span class="font-medium">${c}</span>`, x.appendChild(E), a.appendChild(x), r.appendChild(a), t.appendChild(r);
931
- const N = document.createElement("div");
932
- N.className = "flex flex-col justify-between md:w-1/2";
933
- const u = document.createElement("div"), C = document.createElement("h3");
934
- C.className = "text-lg font-semibold text-gray-800 mb-4", C.innerText = "Hướng dẫn thanh toán QR", u.appendChild(C);
935
- const y = document.createElement("ol");
936
- y.className = "space-y-4", e.forEach((b, k) => {
937
- const T = document.createElement("li");
938
- T.className = "flex items-start";
939
- const L = document.createElement("div");
940
- L.className = "flex-shrink-0 mt-0.5";
941
- const H = document.createElement("div");
942
- H.className = "w-6 h-6 rounded-full bg-primary flex items-center justify-center";
943
- const M = document.createElement("span");
944
- M.className = "text-white text-sm font-semibold", M.innerText = String(k + 1), H.appendChild(M), L.appendChild(H);
945
- const V = document.createElement("p");
946
- V.className = "ml-3 text-gray-700", V.innerText = b, T.appendChild(L), T.appendChild(V), y.appendChild(T);
947
- }), u.appendChild(y), N.appendChild(u);
998
+ E.className = "wgt:text-sm wgt:text-grey-8", E.innerHTML = `Ngân hàng thụ hưởng: <span class="wgt:font-medium">${c}</span>`, u.appendChild(E), a.appendChild(u), r.appendChild(a), n.appendChild(r);
999
+ const x = document.createElement("div");
1000
+ x.className = "wgt:flex wgt:flex-col wgt:justify-between wgt:md:w-1/2";
1001
+ const p = document.createElement("div"), b = document.createElement("h3");
1002
+ b.className = "wgt:text-lg wgt:font-semibold wgt:text-gray-800 mb-4", b.innerText = "Hướng dẫn thanh toán QR", p.appendChild(b);
1003
+ const v = document.createElement("ol");
1004
+ v.className = "wgt:space-y-4", t.forEach((y, C) => {
1005
+ const N = document.createElement("li");
1006
+ N.className = "wgt:flex wgt:items-start";
1007
+ const V = document.createElement("div");
1008
+ V.className = "wgt:flex-shrink-0 wgt:mt-0.5";
1009
+ const M = document.createElement("div");
1010
+ M.className = "wgt:w-6 wgt:h-6 wgt:rounded-full wgt:bg-primary wgt:flex wgt:items-center wgt:justify-center";
1011
+ const S = document.createElement("span");
1012
+ S.className = "wgt:text-white wgt:text-sm wgt:font-semibold", S.innerText = String(C + 1), M.appendChild(S), V.appendChild(M);
1013
+ const k = document.createElement("p");
1014
+ k.className = "wgt:ml-3 wgt:text-gray-700", k.innerText = y, N.appendChild(V), N.appendChild(k), v.appendChild(N);
1015
+ }), p.appendChild(v), x.appendChild(p);
948
1016
  const h = document.createElement("div");
949
- h.className = "h-[300px] flex justify-center";
950
- const w = document.createElement("img");
951
- return w.src = d, w.alt = "QR payment illustration", w.className = "h-full object-contain", h.appendChild(w), N.appendChild(h), t.appendChild(N), {
952
- container: t,
953
- update(b = {}) {
954
- b.qrSrc != null && (s.src = b.qrSrc), b.logos && (m.innerHTML = "", b.logos.forEach((k) => {
955
- const T = document.createElement("img");
956
- T.src = k, T.alt = "Logo", T.className = "w-8 object-contain", m.appendChild(T);
957
- })), b.accountName != null && (v.innerText = b.accountName), b.accountNumber != null && (g.innerHTML = `Số tài khoản: <span class="font-medium">${b.accountNumber}</span>`), b.bankName != null && (E.innerHTML = `Ngân hàng thụ hưởng: <span class="font-medium">${b.bankName}</span>`), b.instructions && (y.innerHTML = "", b.instructions.forEach((k, T) => {
958
- const L = document.createElement("li");
959
- L.className = "flex items-start";
960
- const H = document.createElement("div");
961
- H.className = "flex-shrink-0 mt-0.5";
1017
+ h.className = "wgt:h-[300px] wgt:flex wgt:justify-center";
1018
+ const H = document.createElement("img");
1019
+ return H.src = d, H.alt = "QR payment illustration", H.className = "wgt:h-full wgt:object-contain", h.appendChild(H), x.appendChild(h), n.appendChild(x), {
1020
+ container: n,
1021
+ update(y = {}) {
1022
+ y.qrSrc != null && (i.src = y.qrSrc), y.logos && (w.innerHTML = "", y.logos.forEach((C) => {
1023
+ const N = document.createElement("img");
1024
+ N.src = C, N.alt = "Logo", N.className = "wgt:w-8 wgt:object-contain", w.appendChild(N);
1025
+ })), y.accountName != null && (T.innerText = y.accountName), y.accountNumber != null && (f.innerHTML = `Số tài khoản: <span class="wgt:font-medium">${y.accountNumber}</span>`), y.bankName != null && (E.innerHTML = `Ngân hàng thụ hưởng: <span class="wgt:font-medium">${y.bankName}</span>`), y.instructions && (v.innerHTML = "", y.instructions.forEach((C, N) => {
1026
+ const V = document.createElement("li");
1027
+ V.className = "wgt:flex wgt:items-start";
962
1028
  const M = document.createElement("div");
963
- M.className = "w-6 h-6 rounded-full bg-primary flex items-center justify-center";
964
- const V = document.createElement("span");
965
- V.className = "text-white text-sm font-semibold", V.innerText = String(T + 1), M.appendChild(V), H.appendChild(M);
966
- const B = document.createElement("p");
967
- B.className = "ml-3 text-gray-700", B.innerText = k, L.appendChild(H), L.appendChild(B), y.appendChild(L);
968
- })), b.illustrationSrc != null && (w.src = b.illustrationSrc);
1029
+ M.className = "wgt:flex-shrink-0 wgt:mt-0.5";
1030
+ const S = document.createElement("div");
1031
+ S.className = "wgt:w-6 wgt:h-6 wgt:rounded-full wgt:bg-primary wgt:flex wgt:items-center wgt:justify-center";
1032
+ const k = document.createElement("span");
1033
+ k.className = "wgt:text-white wgt:text-sm wgt:font-semibold", k.innerText = String(N + 1), S.appendChild(k), M.appendChild(S);
1034
+ const L = document.createElement("p");
1035
+ L.className = "wgt:ml-3 wgt:text-gray-700", L.innerText = C, V.appendChild(M), V.appendChild(L), v.appendChild(V);
1036
+ })), y.illustrationSrc != null && (H.src = y.illustrationSrc);
969
1037
  }
970
1038
  };
971
1039
  }
972
- function K({
973
- qrSrc: f,
974
- logos: p = [],
975
- accountName: o = "",
976
- accountNumber: l = "",
1040
+ function ee({
1041
+ qrSrc: m,
1042
+ logos: e = [],
1043
+ accountName: s = "",
1044
+ accountNumber: o = "",
977
1045
  bankName: c = "",
978
- instructions: e = [],
1046
+ instructions: t = [],
979
1047
  illustrationSrc: d
980
1048
  } = {}) {
981
- const { container: t } = G({
982
- qrSrc: f,
983
- logos: p,
984
- accountName: o,
985
- accountNumber: l,
1049
+ const { container: n } = D({
1050
+ qrSrc: m,
1051
+ logos: e,
1052
+ accountName: s,
1053
+ accountNumber: o,
986
1054
  bankName: c,
987
- instructions: e,
1055
+ instructions: t,
988
1056
  illustrationSrc: d
989
1057
  });
990
- return { container: t };
1058
+ return { container: n };
991
1059
  }
992
- function X({
993
- selectedProvider: f = null,
994
- selectedOption: p = null,
995
- totalAmountText: o = "",
996
- onCancel: l
1060
+ function te({
1061
+ selectedProvider: m = null,
1062
+ selectedOption: e = null,
1063
+ totalAmountText: s = "",
1064
+ onCancel: o
997
1065
  } = {}) {
998
1066
  const c = document.createElement("div");
999
1067
  c.className = [
1000
- "w-[440px]",
1001
- "flex",
1002
- "flex-col",
1003
- "rounded-2xl",
1004
- "border",
1005
- "border-soft-200",
1006
- "overflow-hidden"
1068
+ "wgt:w-[440px]",
1069
+ "wgt:flex",
1070
+ "wgt:flex-col",
1071
+ "wgt:rounded-2xl",
1072
+ "wgt:border",
1073
+ "wgt:border-soft-200",
1074
+ "wgt:overflow-hidden"
1007
1075
  ].join(" ");
1008
- const e = document.createElement("div");
1009
- e.className = "p-4 w-full flex items-center justify-center gap-2 bg-primary/10";
1076
+ const t = document.createElement("div");
1077
+ t.className = "wgt:p-4 wgt:w-full wgt:flex wgt:items-center wgt:justify-center wgt:gap-2 wgt:bg-primary/10";
1010
1078
  const d = document.createElement("p");
1011
- d.className = "text-base font-medium leading-6 text-primary", d.innerHTML = 'Hoàn tất thanh toán của bạn trong <span class="font-bold">01:00:00</span>', e.appendChild(d);
1012
- const t = document.createElement("svg");
1013
- t.setAttribute("width", "24"), t.setAttribute("height", "24"), t.setAttribute("viewBox", "0 0 24 24"), t.setAttribute("fill", "none"), t.setAttribute("xmlns", "http://www.w3.org/2000/svg"), t.innerHTML = `
1079
+ d.className = "wgt:text-base wgt:font-medium wgt:leading-6 wgt:text-primary", d.innerHTML = 'Hoàn tất thanh toán của bạn trong <span class="font-bold">01:00:00</span>', t.appendChild(d);
1080
+ const n = document.createElement("svg");
1081
+ n.setAttribute("width", "24"), n.setAttribute("height", "24"), n.setAttribute("viewBox", "0 0 24 24"), n.setAttribute("fill", "none"), n.setAttribute("xmlns", "http://www.w3.org/2000/svg"), n.innerHTML = `
1014
1082
  <path
1015
1083
  d="M12 1.40039C17.8537 1.40039 22.5996 6.14633 22.5996 12C22.5996 17.8537 17.8537 22.5996 12 22.5996C6.14633 22.5996 1.40039 17.8537 1.40039 12C1.40039 6.14633 6.14633 1.40039 12 1.40039ZM12 3.38086C7.24117 3.38086 3.38086 7.24117 3.38086 12C3.38086 16.7588 7.24117 20.6191 12 20.6191C16.7588 20.6191 20.6191 16.7588 20.6191 12C20.6191 7.24117 16.7588 3.38086 12 3.38086Z"
1016
1084
  fill="#1D963E"
@@ -1021,95 +1089,95 @@ function X({
1021
1089
  d="M16.0945 14.9672L12.7523 12.5508V6.75C12.7523 6.64687 12.668 6.5625 12.5648 6.5625H11.4375C11.3344 6.5625 11.25 6.64687 11.25 6.75V13.2047C11.25 13.2656 11.2781 13.3219 11.3273 13.357L15.2039 16.1836C15.2883 16.2445 15.4055 16.2258 15.4664 16.1437L16.1367 15.2297C16.1976 15.1429 16.1789 15.0258 16.0945 14.9672Z"
1022
1090
  fill="#1D963E"
1023
1091
  />
1024
- `, e.appendChild(t), c.appendChild(e);
1092
+ `, t.appendChild(n), c.appendChild(t);
1025
1093
  const r = document.createElement("div");
1026
1094
  r.className = [
1027
- "p-6",
1028
- "w-full",
1029
- "flex",
1030
- "flex-col",
1031
- "gap-10",
1032
- "shadow-[0px_2px_6px_0px_rgba(31,34,41,0.04)]"
1095
+ "wgt:p-6",
1096
+ "wgt:w-full",
1097
+ "wgt:flex",
1098
+ "wgt:flex-col",
1099
+ "wgt:gap-10",
1100
+ "wgt:shadow-[0px_2px_6px_0px_rgba(31,34,41,0.04)]"
1033
1101
  ].join(" ");
1034
- const n = document.createElement("div");
1035
- n.className = "w-full flex flex-col gap-4";
1102
+ const l = document.createElement("div");
1103
+ l.className = "wgt:w-full wgt:flex wgt:flex-col wgt:gap-4";
1036
1104
  const a = document.createElement("h2");
1037
- a.className = "text-xl font-semibold leading-6 text-black", a.innerText = "Thông tin đơn hàng", n.appendChild(a);
1038
- const i = document.createElement("div");
1039
- i.className = "w-full flex items-center justify-between";
1040
- const s = document.createElement("h4");
1041
- s.className = "text-sm font-normal leading-5 text-[#475467]", s.innerText = "Nhà cung cấp";
1042
- const m = document.createElement("img");
1043
- f && f.logo && (m.src = f.logo, m.alt = f.name, m.className = "h-6 object-contain"), i.appendChild(s), i.appendChild(m), n.appendChild(i);
1044
- const x = document.createElement("div");
1045
- x.className = "w-full flex items-center justify-between";
1046
- const v = document.createElement("h4");
1047
- v.className = "text-sm font-normal leading-5 text-[#475467]", v.innerText = "Gói đăng ký";
1048
- const g = document.createElement("span");
1049
- g.className = "text-base font-semibold leading-6 text-text-blackF", g.innerText = p ? String(p.unitsPerMonth) : "", x.appendChild(v), x.appendChild(g), n.appendChild(x);
1105
+ a.className = "wgt:text-xl wgt:font-semibold wgt:leading-6 wgt:text-black", a.innerText = "Thông tin đơn hàng", l.appendChild(a);
1106
+ const g = document.createElement("div");
1107
+ g.className = "wgt:w-full wgt:flex wgt:items-center wgt:justify-between";
1108
+ const i = document.createElement("h4");
1109
+ i.className = "wgt:text-sm wgt:font-normal wgt:leading-5 wgt:text-[#475467]", i.innerText = "Nhà cung cấp";
1110
+ const w = document.createElement("img");
1111
+ m && m.logoUrl && (w.src = m.logoUrl, w.alt = m.name, w.className = "wgt:h-6 wgt:object-contain"), g.appendChild(i), g.appendChild(w), l.appendChild(g);
1112
+ const u = document.createElement("div");
1113
+ u.className = "wgt:w-full wgt:flex wgt:items-center wgt:justify-between";
1114
+ const T = document.createElement("h4");
1115
+ T.className = "wgt:text-sm wgt:font-normal wgt:leading-5 wgt:text-[#475467]", T.innerText = "Gói đăng ký";
1116
+ const f = document.createElement("span");
1117
+ f.className = "wgt:text-base wgt:font-semibold wgt:leading-6 wgt:text-text-black", f.innerText = e ? String(e.unitsPerMonth) : "", u.appendChild(T), u.appendChild(f), l.appendChild(u);
1050
1118
  const E = document.createElement("hr");
1051
- n.appendChild(E);
1052
- const N = document.createElement("div");
1053
- N.className = "w-full flex items-center justify-between";
1054
- const u = document.createElement("h4");
1055
- u.className = "text-sm font-normal leading-5 text-[#475467]", u.innerText = "Số tiền thanh toán";
1056
- const C = document.createElement("span");
1057
- C.className = "text-2xl font-bold leading-6 text-[#ED1C24]", C.innerText = o, N.appendChild(u), N.appendChild(C), n.appendChild(N), r.appendChild(n);
1058
- const y = P({
1119
+ l.appendChild(E);
1120
+ const x = document.createElement("div");
1121
+ x.className = "wgt:w-full wgt:flex wgt:items-center wgt:justify-between";
1122
+ const p = document.createElement("h4");
1123
+ p.className = "wgt:text-sm wgt:font-normal wgt:leading-5 wgt:text-[#475467]", p.innerText = "Số tiền thanh toán";
1124
+ const b = document.createElement("span");
1125
+ b.className = "wgt:text-2xl wgt:font-bold wgt:leading-6 wgt:text-[#ED1C24]", b.innerText = s, x.appendChild(p), x.appendChild(b), l.appendChild(x), r.appendChild(l);
1126
+ const v = Q({
1059
1127
  title: "Hủy giao dịch",
1060
- className: "bg-transparent border border-primary !text-primary hover:bg-transparent",
1128
+ className: "wgt:bg-transparent wgt:border wgt:border-primary wgt:!text-primary wgt:hover:bg-transparent",
1061
1129
  handleClick: () => {
1062
- typeof l == "function" && l();
1130
+ typeof o == "function" && o();
1063
1131
  }
1064
1132
  });
1065
- return r.appendChild(y), c.appendChild(r), {
1133
+ return r.appendChild(v), c.appendChild(r), {
1066
1134
  container: c,
1067
1135
  setSelectedProvider(h) {
1068
- f = h, m.src = (h == null ? void 0 : h.logo) || "", m.alt = (h == null ? void 0 : h.name) || "";
1136
+ m = h, w.src = (h == null ? void 0 : h.logo) || "", w.alt = (h == null ? void 0 : h.name) || "";
1069
1137
  },
1070
1138
  setSelectedOption(h) {
1071
- p = h, g.innerText = h ? String(h.unitsPerMonth) : "";
1139
+ e = h, f.innerText = h ? String(h.unitsPerMonth) : "";
1072
1140
  },
1073
1141
  setTotalAmountText(h) {
1074
- o = h, C.innerText = h;
1142
+ s = h, b.innerText = h;
1075
1143
  }
1076
1144
  };
1077
1145
  }
1078
- function J({ onPrev: f, checkoutProps: p, orderInfoProps: o }) {
1079
- const l = document.createElement("div");
1080
- l.className = "flex flex-col gap-6";
1146
+ function ne({ onPrev: m, checkoutProps: e, orderInfoProps: s }) {
1147
+ const o = document.createElement("div");
1148
+ o.className = "wgt:flex wgt:flex-col wgt:gap-6";
1081
1149
  const c = document.createElement("div");
1082
- c.className = "w-full flex items-start gap-6";
1083
- const e = document.createElement("div");
1084
- e.className = "flex-1";
1085
- const { container: d } = K(p);
1086
- e.appendChild(d), c.appendChild(e);
1087
- const { container: t } = X(o);
1088
- c.appendChild(t), l.appendChild(c);
1150
+ c.className = "wgt:w-full wgt:flex wgt:items-start wgt:gap-6";
1151
+ const t = document.createElement("div");
1152
+ t.className = "wgt:flex-1";
1153
+ const { container: d } = ee(e);
1154
+ t.appendChild(d), c.appendChild(t);
1155
+ const { container: n } = te(s);
1156
+ c.appendChild(n), o.appendChild(c);
1089
1157
  const r = document.createElement("div");
1090
- r.className = "flex items-center justify-between gap-2 px-6";
1091
- const n = P({
1158
+ r.className = "wgt:flex wgt:items-center wgt:justify-between wgt:gap-2 wgt:px-6";
1159
+ const l = Q({
1092
1160
  type: "button",
1093
1161
  title: "Quay lại",
1094
- className: "bg-transparent !text-primary hover:bg-transparent underline",
1095
- handleClick: f
1162
+ className: "wgt:bg-transparent wgt:!text-primary wgt:hover:bg-transparent wgt:underline",
1163
+ handleClick: m
1096
1164
  });
1097
- return r.appendChild(n), l.appendChild(r), { container: l };
1165
+ return r.appendChild(l), o.appendChild(r), { container: o };
1098
1166
  }
1099
- function Y(f) {
1100
- const p = [
1167
+ function le(m) {
1168
+ const e = [
1101
1169
  "Thông Tin",
1102
1170
  "Gói Hóa Đơn",
1103
1171
  "Xác Nhận Và Thanh Toán"
1104
- ], { container: o, setStep: l, setContent: c } = A({
1105
- steps: p.map((n) => n),
1172
+ ], { container: s, setStep: o, setContent: c } = _({
1173
+ steps: e.map((a) => a),
1106
1174
  currentStep: 1
1107
1175
  });
1108
- f.appendChild(o);
1109
- let e = 1, d = null, t = null;
1110
- function r(n) {
1111
- if (n === 1) {
1112
- const { container: a } = _({
1176
+ m.appendChild(s);
1177
+ let t = 1, d = null, n = null, r = null;
1178
+ function l(a) {
1179
+ if (a === 1) {
1180
+ const { container: g } = K({
1113
1181
  providerProps: {
1114
1182
  providers: [
1115
1183
  { name: "Misa", route: "misa", logoUrl: "./assets/misa.svg" },
@@ -1123,28 +1191,30 @@ function Y(f) {
1123
1191
  },
1124
1192
  formProps: {
1125
1193
  onSubmit: (i) => {
1126
- e = 2, l(e), r(e);
1127
- }
1194
+ n = i, t = 2, o(t), l(t);
1195
+ },
1196
+ registrationData: n
1128
1197
  }
1129
1198
  });
1130
- c(a);
1131
- } else if (n === 2) {
1132
- const { container: a } = z({
1199
+ c(g);
1200
+ } else if (a === 2) {
1201
+ const { container: g } = Y({
1133
1202
  onNext: () => {
1134
- e = 3, l(e), r(e);
1203
+ t = 3, o(t), l(t);
1135
1204
  },
1136
1205
  onPrev: () => {
1137
- e = 1, l(e), r(e);
1206
+ t = 1, o(t), l(t);
1138
1207
  },
1139
1208
  setSelectedOption: (i) => {
1140
- t = i;
1141
- }
1209
+ r = i;
1210
+ },
1211
+ selectedOption: r
1142
1212
  });
1143
- c(a);
1144
- } else if (n === 3) {
1145
- const { container: a } = J({
1213
+ c(g);
1214
+ } else if (a === 3) {
1215
+ const { container: g } = ne({
1146
1216
  onPrev: () => {
1147
- e = 2, l(e), r(e);
1217
+ t = 2, o(t), l(t);
1148
1218
  },
1149
1219
  checkoutProps: {
1150
1220
  qrSrc: "./assets/qrcode.png",
@@ -1167,18 +1237,18 @@ function Y(f) {
1167
1237
  },
1168
1238
  orderInfoProps: {
1169
1239
  selectedProvider: d || { name: "", logo: "" },
1170
- selectedOption: t || { unitsPerMonth: 0 },
1171
- totalAmountText: t ? t.priceVND.toLocaleString("vi-VN") + " VND" : "0 VND",
1240
+ selectedOption: r || { unitsPerMonth: 0 },
1241
+ totalAmountText: r ? r.priceVND.toLocaleString("vi-VN") + " VND" : "0 VND",
1172
1242
  onCancel: () => {
1173
- e = 2, l(e), r(e);
1243
+ t = 2, o(t), l(t);
1174
1244
  }
1175
1245
  }
1176
1246
  });
1177
- c(a);
1247
+ c(g);
1178
1248
  }
1179
1249
  }
1180
- r(e);
1250
+ l(t);
1181
1251
  }
1182
1252
  export {
1183
- Y as InvoiceRegisterWidget
1253
+ le as InvoiceRegisterWidget
1184
1254
  };