cppay-sdk 0.0.2-beta.41 → 0.0.2-beta.42

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/vue.js CHANGED
@@ -67,9 +67,9 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = { class: "_cppay-
67
67
  "failed",
68
68
  "error"
69
69
  ],
70
- setup(n, { emit: r }) {
71
- let o = n, s = r, l = computed(() => getLocaleMessages(o.locale)), u = computed(() => new cppay_default(o.apikey, o.ott)), p = ref("select"), m = ref(!1), g = computed(() => p.value === "checking"), _ = ref(), v = ref([]), y = ref(), b = ref(), x = ref(), S = ref(), C = ref(!1), w = ref(), T = ref(""), E = ref(!1), D = ref(!1), O = shallowRef(null), k = ref(null), A = ref(null), j = ref(null), M = ref(""), N = () => {
72
- typeof window < "u" && !O.value && (O.value = createAppKit({
70
+ setup(t, { emit: n }) {
71
+ let a = t, o = n, c = computed(() => getLocaleMessages(a.locale)), l = computed(() => new cppay_default(a.apikey, a.ott)), f = ref("select"), p = ref(!1), m = computed(() => f.value === "checking"), g = ref(), _ = ref([]), v = ref(), y = ref(), b = ref(), x = ref(), S = ref(!1), C = ref(), w = ref(""), T = ref(!1), E = ref(!1), D = shallowRef(null), O = ref(null), k = ref(null), A = ref(null), j = ref(""), M = () => {
72
+ typeof window < "u" && !D.value && (D.value = createAppKit({
73
73
  debug: !1,
74
74
  enableNetworkSwitch: !1,
75
75
  adapters: [new EthersAdapter()],
@@ -90,24 +90,24 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = { class: "_cppay-
90
90
  icons: ["https://cppay.com/icon.png"]
91
91
  },
92
92
  features: { analytics: !1 }
93
- }), S.value = O.value.getAddress(), w.value = O.value.getProvider("eip155"), O.value.subscribeAccount((e) => {
94
- e.isConnected ? S.value = e.address : (S.value = void 0, w.value = void 0);
95
- }), O.value.subscribeProviders((e) => {
96
- w.value = e?.eip155;
93
+ }), x.value = D.value.getAddress(), C.value = D.value.getProvider("eip155"), D.value.subscribeAccount((e) => {
94
+ e.isConnected ? x.value = e.address : (x.value = void 0, C.value = void 0);
95
+ }), D.value.subscribeProviders((e) => {
96
+ C.value = e?.eip155;
97
97
  }));
98
98
  };
99
- watch(p, (e) => {
100
- s("update:paymentStep", e);
99
+ watch(f, (e) => {
100
+ o("update:paymentStep", e);
101
101
  });
102
- let P = async () => {
102
+ let N = async () => {
103
103
  try {
104
- C.value = !0, _.value = void 0, O.value && await O.value.open();
104
+ S.value = !0, g.value = void 0, D.value && await D.value.open();
105
105
  } catch (e) {
106
- _.value = e instanceof Error ? e.message : l.value.walletConnectionFailed, s("error", e);
106
+ g.value = e instanceof Error ? e.message : c.value.walletConnectionFailed, o("error", e);
107
107
  } finally {
108
- C.value = !1;
108
+ S.value = !1;
109
109
  }
110
- }, F = computed(() => v.value.find((e) => e.chain === y.value)), I = computed(() => F.value?.tokens || []), L = computed(() => I.value.find((e) => e.symbol === b.value)), R = (e) => [
110
+ }, P = computed(() => _.value.find((e) => e.chain === v.value)), F = computed(() => P.value?.tokens || []), I = computed(() => F.value.find((e) => e.symbol === y.value)), L = (e) => [
111
111
  "USDT",
112
112
  "USDC",
113
113
  "BUSD",
@@ -115,61 +115,61 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = { class: "_cppay-
115
115
  "TUSD",
116
116
  "USDD",
117
117
  "FDUSD"
118
- ].includes(e.toUpperCase()) ? 2 : 6, z = (e, n) => {
119
- let r = parseFloat(e);
120
- return isNaN(r) ? "0" : r.toFixed(n).replace(/\.?0+$/, "");
118
+ ].includes(e.toUpperCase()) ? 2 : 6, R = (e, t) => {
119
+ let n = parseFloat(e);
120
+ return isNaN(n) ? "0" : n.toFixed(t).replace(/\.?0+$/, "");
121
+ }, z = (e) => {
122
+ if (e <= 0) return c.value.expired;
123
+ let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = e % 60, i = (e) => e.toString().padStart(2, "0");
124
+ return t > 0 ? `${t}:${i(n)}:${i(r)}` : `${n}:${i(r)}`;
121
125
  }, B = (e) => {
122
- if (e <= 0) return l.value.expired;
123
- let n = Math.floor(e / 3600), r = Math.floor(e % 3600 / 60), i = e % 60, a = (e) => e.toString().padStart(2, "0");
124
- return n > 0 ? `${n}:${a(r)}:${a(i)}` : `${r}:${a(i)}`;
125
- }, V = (e) => {
126
- A.value && clearInterval(A.value);
127
- let n = () => {
128
- if (p.value === "checking") {
129
- H();
126
+ k.value && clearInterval(k.value);
127
+ let t = () => {
128
+ if (f.value === "checking") {
129
+ V();
130
130
  return;
131
131
  }
132
- let n = e - Math.floor(Date.now() / 1e3);
133
- T.value = B(n), n <= 0 && (p.value = "expired", H());
132
+ let t = e - Math.floor(Date.now() / 1e3);
133
+ w.value = z(t), t <= 0 && V();
134
134
  };
135
- n(), A.value = setInterval(n, 1e3);
136
- }, H = () => {
137
- A.value &&= (clearInterval(A.value), null);
138
- }, U = computed(() => {
139
- if (!b.value || !L.value) return "0";
140
- let e = parseFloat(L.value.price);
135
+ t(), k.value = setInterval(t, 1e3);
136
+ }, V = () => {
137
+ k.value &&= (clearInterval(k.value), null);
138
+ }, H = computed(() => {
139
+ if (!y.value || !I.value) return "0";
140
+ let e = parseFloat(I.value.price);
141
141
  if (isNaN(e) || e === 0) return "0";
142
- let n = R(b.value);
143
- return z((parseFloat(o.amount) / e).toFixed(n), n);
144
- }), W = async () => {
142
+ let t = L(y.value);
143
+ return R((parseFloat(a.amount) / e).toFixed(t), t);
144
+ }), U = async () => {
145
145
  try {
146
- m.value = !0, _.value = void 0, v.value = await u.value.getSupportedChains(), v.value.length > 0 && (y.value = v.value[0].chain);
146
+ p.value = !0, g.value = void 0, _.value = await l.value.getSupportedChains(), _.value.length > 0 && (v.value = _.value[0].chain);
147
147
  } catch (e) {
148
- _.value = e instanceof Error ? e.message : l.value.loadPaymentNetworkFailed, s("error", e);
148
+ g.value = e instanceof Error ? e.message : c.value.loadPaymentNetworkFailed, o("error", e);
149
149
  } finally {
150
- m.value = !1;
150
+ p.value = !1;
151
151
  }
152
- }, G = async (e) => {
153
- if (w.value) try {
154
- await w.value.request({
152
+ }, W = async (e) => {
153
+ if (C.value) try {
154
+ await C.value.request({
155
155
  method: "wallet_switchEthereumChain",
156
156
  params: [{ chainId: `0x${e.toString(16)}` }]
157
157
  });
158
158
  } catch (e) {
159
- throw e.code === 4902 ? Error(l.value.pleaseAddNetwork) : e;
159
+ throw e.code === 4902 ? Error(c.value.pleaseAddNetwork) : e;
160
160
  }
161
- }, K = async () => {
162
- if (!(!S.value || !w.value || !j.value || !L.value || !F.value)) try {
163
- m.value = !0;
164
- let e = j.value;
165
- await G(F.value.chainId);
166
- let n = createWalletClient({
167
- account: S.value,
168
- transport: custom(w.value)
161
+ }, G = async () => {
162
+ if (!(!x.value || !C.value || !A.value || !I.value || !P.value)) try {
163
+ p.value = !0;
164
+ let e = A.value;
165
+ await W(P.value.chainId);
166
+ let t = createWalletClient({
167
+ account: x.value,
168
+ transport: custom(C.value)
169
169
  });
170
- if (L.value.address) {
171
- let r = await n.writeContract({
172
- address: L.value.address,
170
+ if (I.value.address) {
171
+ let n = await t.writeContract({
172
+ address: I.value.address,
173
173
  abi: [{
174
174
  name: "transfer",
175
175
  type: "function",
@@ -184,33 +184,33 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = { class: "_cppay-
184
184
  outputs: [{ type: "bool" }]
185
185
  }],
186
186
  functionName: "transfer",
187
- args: [e.receiveAddress, parseUnits(e.paymentAmount, L.value.decimals)],
187
+ args: [e.receiveAddress, parseUnits(e.paymentAmount, I.value.decimals)],
188
188
  chain: null
189
189
  });
190
- console.log("转账交易哈希:", r), M.value = r;
190
+ console.log("转账交易哈希:", n), j.value = n;
191
191
  } else {
192
- let r = await n.sendTransaction({
192
+ let n = await t.sendTransaction({
193
193
  to: e.receiveAddress,
194
- value: parseUnits(e.paymentAmount, L.value.decimals),
194
+ value: parseUnits(e.paymentAmount, I.value.decimals),
195
195
  chain: null
196
196
  });
197
- console.log("转账交易哈希:", r), M.value = r;
197
+ console.log("转账交易哈希:", n), j.value = n;
198
198
  }
199
- m.value = !1, p.value = "checking";
199
+ p.value = !1, f.value = "checking", X({ paymentId: e.paymentId });
200
200
  } catch (e) {
201
- console.error("钱包支付失败:", e), _.value = e instanceof Error ? e.message : l.value.walletPaymentFailed, s("error", e), m.value = !1;
201
+ console.error("钱包支付失败:", e), g.value = e instanceof Error ? e.message : c.value.walletPaymentFailed, o("error", e), p.value = !1;
202
202
  }
203
- }, q = async () => {
204
- if (!(!S.value || !w.value || !j.value || !L.value || !F.value)) try {
205
- let e = j.value;
206
- await G(F.value.chainId);
207
- let n = createWalletClient({
208
- account: S.value,
209
- transport: custom(w.value)
203
+ }, K = async () => {
204
+ if (!(!x.value || !C.value || !A.value || !I.value || !P.value)) try {
205
+ let e = A.value;
206
+ await W(P.value.chainId);
207
+ let t = createWalletClient({
208
+ account: x.value,
209
+ transport: custom(C.value)
210
210
  });
211
- if (!L.value.address) throw Error(l.value.subscriptionDoesNotSupportNative);
212
- let r = await n.writeContract({
213
- address: L.value.address,
211
+ if (!I.value.address) throw Error(c.value.subscriptionDoesNotSupportNative);
212
+ let n = await t.writeContract({
213
+ address: I.value.address,
214
214
  abi: [{
215
215
  name: "approve",
216
216
  type: "function",
@@ -225,103 +225,168 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = { class: "_cppay-
225
225
  outputs: [{ type: "bool" }]
226
226
  }],
227
227
  functionName: "approve",
228
- args: [e.spenderAddress, parseUnits(e.approveAmount, L.value.decimals)],
228
+ args: [e.spenderAddress, parseUnits(e.approveAmount, I.value.decimals)],
229
229
  chain: null
230
230
  });
231
- console.log("授权交易哈希:", r), M.value = r, m.value = !1, p.value = "checking";
231
+ console.log("授权交易哈希:", n), j.value = n, p.value = !1, f.value = "checking", X({ subscriptionId: e.subscriptionId });
232
232
  } catch (e) {
233
- console.error("钱包授权失败:", e), _.value = e instanceof Error ? e.message : l.value.walletPaymentFailed, s("error", e), m.value = !1;
233
+ console.error("钱包授权失败:", e), g.value = e instanceof Error ? e.message : c.value.walletPaymentFailed, o("error", e), p.value = !1;
234
234
  }
235
- }, J = async () => {
236
- if (!S.value) {
237
- _.value = l.value.pleaseConnectWallet, s("error", Error(l.value.pleaseConnectWallet));
235
+ }, q = async () => {
236
+ if (!x.value) {
237
+ g.value = c.value.pleaseConnectWallet, o("error", Error(c.value.pleaseConnectWallet));
238
238
  return;
239
239
  }
240
- o.plain === "instant" ? await K() : o.plain === "subscription" && await q();
241
- }, Y = async () => {
242
- if (!(!y.value || !b.value)) try {
243
- _.value = void 0;
240
+ a.plain === "instant" ? await G() : a.plain === "subscription" && await K();
241
+ }, J = async () => {
242
+ if (!(!v.value || !y.value)) try {
243
+ g.value = void 0;
244
244
  let e = "";
245
- if (o.plain === "instant") j.value = await u.value.createOnetimePayment({
246
- paymentChain: y.value,
247
- paymentToken: b.value,
248
- orderId: o.orderId,
249
- amount: U.value,
250
- remark: o.remark
251
- }), e = `${y.value.toLowerCase()}:${j.value.receiveAddress}?amount=${j.value.paymentAmount}`, V(j.value.expireAt), Z({ paymentId: j.value.paymentId });
252
- else if (o.plain === "subscription") {
253
- if (!o.intervalDays) throw Error(`Invalid Renewal Days: ${o.intervalDays ?? ""}`);
254
- j.value = await u.value.createSubscriptionPayment({
255
- paymentChain: y.value,
256
- paymentToken: b.value,
257
- orderId: o.orderId,
258
- amountOfUsd: U.value,
259
- intervalDays: o.intervalDays
260
- }), e = `${y.value.toLowerCase()}:${j.value.spenderAddress}?amount=${j.value.approveAmount}`, V(j.value.expireAt), Z({ subscriptionId: j.value.subscriptionId });
245
+ if (a.plain === "instant") A.value = await l.value.createOnetimePayment({
246
+ paymentChain: v.value,
247
+ paymentToken: y.value,
248
+ orderId: a.orderId,
249
+ amount: H.value,
250
+ remark: a.remark
251
+ }), e = `${v.value.toLowerCase()}:${A.value.receiveAddress}?amount=${A.value.paymentAmount}`, B(A.value.expireAt), Z(A.value.paymentId, "instant");
252
+ else if (a.plain === "subscription") {
253
+ if (!a.intervalDays) throw Error(`Invalid Renewal Days: ${a.intervalDays ?? ""}`);
254
+ A.value = await l.value.createSubscriptionPayment({
255
+ paymentChain: v.value,
256
+ paymentToken: y.value,
257
+ orderId: a.orderId,
258
+ amountOfUsd: H.value,
259
+ intervalDays: a.intervalDays
260
+ }), e = `${v.value.toLowerCase()}:${A.value.spenderAddress}?amount=${A.value.approveAmount}`, B(A.value.expireAt), Z(A.value.subscriptionId, "subscription");
261
261
  }
262
- p.value = "payment", x.value = await QRCode.toDataURL(e, {
262
+ f.value = "payment", b.value = await QRCode.toDataURL(e, {
263
263
  width: 200,
264
264
  margin: 2,
265
265
  errorCorrectionLevel: "H"
266
266
  });
267
267
  } catch (e) {
268
- _.value = e instanceof Error ? e.message : l.value.createPaymentFailed, s("error", e);
268
+ g.value = e instanceof Error ? e.message : c.value.createPaymentFailed, o("error", e);
269
269
  }
270
- }, X = () => {
271
- j.value && (_.value = void 0, p.value = "checking");
272
- }, Z = (e) => {
273
- k.value?.unsubscribe();
274
- let n = () => defer(() => o.plain === "subscription" ? u.value.checkSubscriptionPaymentStatus(e) : u.value.checkOnetimePaymentStatus(e)).pipe(timeout(15e3), retry({ delay: 2e3 }));
275
- k.value = n().pipe(expand((e) => e.status === "pending" ? timer(2e3).pipe(switchMap(() => n())) : EMPTY), tap((e) => {
276
- (e.status === "paid" || e.status === "approved") && (p.value = "success", s("success", e)), e.status === "expired" && (p.value = "expired", s("expired", e)), e.status === "failed" && (p.value = "failed", s("failed", e));
270
+ }, Y = () => {
271
+ A.value && (g.value = void 0, f.value = "checking", a.plain === "instant" ? X({ paymentId: A.value.paymentId }) : a.plain === "subscription" && X({ subscriptionId: A.value.subscriptionId }));
272
+ }, X = (e) => {
273
+ O.value?.unsubscribe();
274
+ let t = () => defer(() => a.plain === "subscription" ? l.value.checkSubscriptionPaymentStatus(e) : l.value.checkOnetimePaymentStatus(e)).pipe(timeout(15e3), retry({ delay: 2e3 }));
275
+ O.value = t().pipe(expand((e) => e.status === "pending" ? timer(2e3).pipe(switchMap(() => t())) : EMPTY), tap((e) => {
276
+ if (!A.value && a.plain === "instant") {
277
+ let t = e;
278
+ A.value = {
279
+ paymentId: t.paymentId,
280
+ orderId: t.orderId,
281
+ paymentChain: t.chain,
282
+ paymentToken: t.token,
283
+ paymentAmount: t.payAmount,
284
+ receiveAddress: t.receiveAddress,
285
+ expireAt: t.expireAt
286
+ }, v.value = t.chain, y.value = t.token, B(t.expireAt);
287
+ let n = `${t.chain.toLowerCase()}:${t.receiveAddress}?amount=${t.payAmount}`;
288
+ QRCode.toDataURL(n, {
289
+ width: 200,
290
+ margin: 2,
291
+ errorCorrectionLevel: "H"
292
+ }).then((e) => {
293
+ b.value = e, f.value = "payment";
294
+ }).catch((e) => {
295
+ console.error("生成二维码失败:", e), f.value = "select";
296
+ });
297
+ }
298
+ if (!A.value && a.plain === "subscription") {
299
+ let t = e;
300
+ A.value = {
301
+ subscriptionId: t.subscriptionId,
302
+ orderId: t.orderId,
303
+ paymentChain: t.chain,
304
+ paymentToken: t.token,
305
+ approveAmount: t.approveAmount,
306
+ spenderAddress: t.approvedAddress,
307
+ expireAt: t.expireAt,
308
+ intervalDays: 0,
309
+ amountOfUsd: t.amountOfUsd
310
+ }, v.value = t.chain, y.value = t.token, B(t.expireAt);
311
+ let n = `${t.chain.toLowerCase()}:${t.approvedAddress}?amount=${t.approveAmount}`;
312
+ QRCode.toDataURL(n, {
313
+ width: 200,
314
+ margin: 2,
315
+ errorCorrectionLevel: "H"
316
+ }).then((e) => {
317
+ b.value = e, f.value = "payment";
318
+ }).catch((e) => {
319
+ console.error("生成二维码失败:", e), f.value = "select";
320
+ });
321
+ }
322
+ (e.status === "paid" || e.status === "approved") && (f.value = "success", Q(), o("success", e)), e.status === "expired" && (f.value = "expired", Q(), o("expired", e)), e.status === "failed" && (f.value = "failed", Q(), o("failed", e));
277
323
  })).subscribe({
278
324
  error: (e) => {
279
- if (j.value) {
280
- let n = e instanceof Error ? e.message : l.value.checkPaymentStatusFailed;
281
- p.value = "error", _.value = n, s("error", e);
325
+ if (A.value) {
326
+ let t = e instanceof Error ? e.message : c.value.checkPaymentStatusFailed;
327
+ f.value = "error", g.value = t, Q(), o("error", e);
282
328
  }
283
329
  },
284
330
  complete: () => {
285
- k.value?.unsubscribe();
331
+ O.value?.unsubscribe();
286
332
  }
287
333
  });
288
- }, Q = async () => {
289
- if (!j.value) return;
290
- let e = o.plain === "subscription" ? j.value.spenderAddress : j.value.receiveAddress;
334
+ }, bn = async () => {
335
+ if (!A.value) return;
336
+ let e = a.plain === "subscription" ? A.value.spenderAddress : A.value.receiveAddress;
291
337
  if (e) try {
292
- await navigator.clipboard.writeText(e), E.value = !0, setTimeout(() => {
293
- E.value = !1;
338
+ await navigator.clipboard.writeText(e), T.value = !0, setTimeout(() => {
339
+ T.value = !1;
294
340
  }, 2e3);
295
341
  } catch (e) {
296
342
  console.error("复制失败:", e);
297
343
  }
298
344
  };
299
- watch(I, (e) => {
300
- e.length > 0 && (b.value = e[0].symbol);
345
+ watch(F, (e) => {
346
+ e.length > 0 && (y.value = e[0].symbol);
301
347
  }), onMounted(() => {
302
- N(), v.value.length || W(), o.orderId && Z({ orderId: o.orderId });
348
+ M(), _.value.length || U(), $();
303
349
  }), onUnmounted(() => {
304
- k.value?.unsubscribe(), H();
350
+ O.value?.unsubscribe(), V();
305
351
  });
306
- let $ = async () => {
307
- if (M.value) try {
308
- await navigator.clipboard.writeText(M.value);
309
- let e = E.value;
310
- E.value = !0, setTimeout(() => {
311
- E.value = e;
352
+ let xn = async () => {
353
+ if (j.value) try {
354
+ await navigator.clipboard.writeText(j.value);
355
+ let e = T.value;
356
+ T.value = !0, setTimeout(() => {
357
+ T.value = e;
312
358
  }, 2e3);
313
359
  } catch (e) {
314
360
  console.error("复制失败:", e);
315
361
  }
362
+ }, Z = (e, t) => {
363
+ if (typeof window > "u") return;
364
+ let n = new URL(window.location.href), r = t === "subscription" ? "subscriptionId" : "paymentId";
365
+ n.searchParams.set(r, e), window.history.replaceState({}, "", n.toString());
366
+ }, Q = () => {
367
+ if (typeof window > "u") return;
368
+ let e = new URL(window.location.href);
369
+ e.searchParams.delete("paymentId"), e.searchParams.delete("subscriptionId"), window.history.replaceState({}, "", e.toString());
370
+ }, $ = async () => {
371
+ if (typeof window > "u") return;
372
+ let e = new URL(window.location.href);
373
+ if (a.plain === "instant") {
374
+ let t = e.searchParams.get("paymentId");
375
+ t && (f.value = "payment", X({ paymentId: t }));
376
+ }
377
+ if (a.plain === "subscription") {
378
+ let t = e.searchParams.get("subscriptionId");
379
+ t && (f.value = "payment", X({ subscriptionId: t }));
380
+ }
316
381
  };
317
- return (e, r) => (openBlock(), createElementBlock("div", _hoisted_1$1, [p.value === "success" ? renderSlot(e.$slots, "success", { key: 0 }, () => [createElementVNode("div", _hoisted_2$1, [
318
- r[9] ||= createElementVNode("div", { class: "_cppay-state-success-bg" }, [createElementVNode("div", { class: "_cppay-state-success-icon" }, "✓")], -1),
319
- createElementVNode("h3", _hoisted_3$1, toDisplayString(n.plain === "subscription" ? l.value.authorizationSuccess : l.value.paymentSuccess), 1),
320
- M.value ? (openBlock(), createElementBlock("div", _hoisted_4$1, [createElementVNode("div", _hoisted_5, toDisplayString(l.value.transactionHash), 1), createElementVNode("div", _hoisted_6, [createElementVNode("code", _hoisted_7, toDisplayString(M.value.slice(0, 18)) + "..." + toDisplayString(M.value.slice(-18)), 1), createElementVNode("button", {
321
- onClick: $,
382
+ return (e, n) => (openBlock(), createElementBlock("div", _hoisted_1$1, [f.value === "success" ? renderSlot(e.$slots, "success", { key: 0 }, () => [createElementVNode("div", _hoisted_2$1, [
383
+ n[9] ||= createElementVNode("div", { class: "_cppay-state-success-bg" }, [createElementVNode("div", { class: "_cppay-state-success-icon" }, "✓")], -1),
384
+ createElementVNode("h3", _hoisted_3$1, toDisplayString(t.plain === "subscription" ? c.value.authorizationSuccess : c.value.paymentSuccess), 1),
385
+ j.value ? (openBlock(), createElementBlock("div", _hoisted_4$1, [createElementVNode("div", _hoisted_5, toDisplayString(c.value.transactionHash), 1), createElementVNode("div", _hoisted_6, [createElementVNode("code", _hoisted_7, toDisplayString(j.value.slice(0, 18)) + "..." + toDisplayString(j.value.slice(-18)), 1), createElementVNode("button", {
386
+ onClick: xn,
322
387
  class: "_cppay-state-copy-btn",
323
- title: l.value.copyAddress
324
- }, [...r[8] ||= [createElementVNode("svg", {
388
+ title: c.value.copyAddress
389
+ }, [...n[8] ||= [createElementVNode("svg", {
325
390
  viewBox: "0 0 24 24",
326
391
  fill: "none",
327
392
  stroke: "currentColor",
@@ -334,94 +399,100 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = { class: "_cppay-
334
399
  rx: "1",
335
400
  ry: "1"
336
401
  })], -1)]], 8, _hoisted_8)])])) : createCommentVNode("", !0),
337
- j.value ? (openBlock(), createElementBlock("div", _hoisted_9, [
338
- createElementVNode("div", _hoisted_10, [createElementVNode("span", _hoisted_11, toDisplayString(l.value.orderId), 1), createElementVNode("span", _hoisted_12, toDisplayString(j.value.orderId), 1)]),
339
- createElementVNode("div", _hoisted_13, [createElementVNode("span", _hoisted_14, toDisplayString(n.plain === "subscription" ? l.value.authorizationAmount : l.value.paymentAmount), 1), createElementVNode("span", _hoisted_15, toDisplayString(n.plain === "subscription" ? `${z(j.value.approveAmount, R(b.value))} ${b.value}` : `${z(j.value.paymentAmount, R(b.value))} ${b.value}`), 1)]),
340
- createElementVNode("div", _hoisted_16, [createElementVNode("span", _hoisted_17, toDisplayString(l.value.paymentNetwork), 1), createElementVNode("span", _hoisted_18, toDisplayString(j.value.paymentChain), 1)]),
341
- createElementVNode("div", _hoisted_19, [createElementVNode("span", _hoisted_20, toDisplayString(l.value.paymentToken), 1), createElementVNode("span", _hoisted_21, toDisplayString(j.value.paymentToken), 1)]),
342
- n.plain === "subscription" ? (openBlock(), createElementBlock("div", _hoisted_22, [createElementVNode("span", _hoisted_23, toDisplayString(l.value.renewalInterval), 1), createElementVNode("span", _hoisted_24, toDisplayString(j.value.intervalDays) + " " + toDisplayString(l.value.days), 1)])) : createCommentVNode("", !0),
343
- createElementVNode("div", _hoisted_25, [createElementVNode("span", _hoisted_26, toDisplayString(n.plain === "subscription" ? l.value.subscriptionId : l.value.paymentId), 1), createElementVNode("span", _hoisted_27, toDisplayString(n.plain === "subscription" ? j.value.subscriptionId : j.value.paymentId), 1)])
402
+ A.value ? (openBlock(), createElementBlock("div", _hoisted_9, [
403
+ createElementVNode("div", _hoisted_10, [createElementVNode("span", _hoisted_11, toDisplayString(c.value.orderId), 1), createElementVNode("span", _hoisted_12, toDisplayString(A.value.orderId), 1)]),
404
+ createElementVNode("div", _hoisted_13, [createElementVNode("span", _hoisted_14, toDisplayString(t.plain === "subscription" ? c.value.authorizationAmount : c.value.paymentAmount), 1), createElementVNode("span", _hoisted_15, toDisplayString(t.plain === "subscription" ? `${R(A.value.approveAmount, L(y.value))} ${y.value}` : `${R(A.value.paymentAmount, L(y.value))} ${y.value}`), 1)]),
405
+ createElementVNode("div", _hoisted_16, [createElementVNode("span", _hoisted_17, toDisplayString(c.value.paymentNetwork), 1), createElementVNode("span", _hoisted_18, toDisplayString(A.value.paymentChain), 1)]),
406
+ createElementVNode("div", _hoisted_19, [createElementVNode("span", _hoisted_20, toDisplayString(c.value.paymentToken), 1), createElementVNode("span", _hoisted_21, toDisplayString(A.value.paymentToken), 1)]),
407
+ t.plain === "subscription" ? (openBlock(), createElementBlock("div", _hoisted_22, [createElementVNode("span", _hoisted_23, toDisplayString(c.value.renewalInterval), 1), createElementVNode("span", _hoisted_24, toDisplayString(A.value.intervalDays) + " " + toDisplayString(c.value.days), 1)])) : createCommentVNode("", !0),
408
+ createElementVNode("div", _hoisted_25, [createElementVNode("span", _hoisted_26, toDisplayString(t.plain === "subscription" ? c.value.subscriptionId : c.value.paymentId), 1), createElementVNode("span", _hoisted_27, toDisplayString(t.plain === "subscription" ? A.value.subscriptionId : A.value.paymentId), 1)])
344
409
  ])) : createCommentVNode("", !0)
345
- ])]) : p.value === "expired" ? renderSlot(e.$slots, "expired", { key: 1 }, () => [createElementVNode("div", _hoisted_28, [
346
- r[10] ||= createElementVNode("div", { class: "_cppay-state-expired-bg" }, [createElementVNode("div", { class: "_cppay-state-expired-icon" }, "⏰")], -1),
347
- createElementVNode("h3", _hoisted_29, toDisplayString(l.value.paymentExpired), 1),
348
- createElementVNode("p", _hoisted_30, toDisplayString(l.value.pleaseInitiatePaymentAgain), 1),
410
+ ])]) : f.value === "expired" ? renderSlot(e.$slots, "expired", { key: 1 }, () => [createElementVNode("div", _hoisted_28, [
411
+ n[10] ||= createElementVNode("div", { class: "_cppay-state-expired-bg" }, [createElementVNode("div", { class: "_cppay-state-expired-icon" }, "⏰")], -1),
412
+ createElementVNode("h3", _hoisted_29, toDisplayString(c.value.paymentExpired), 1),
413
+ createElementVNode("p", _hoisted_30, toDisplayString(c.value.pleaseInitiatePaymentAgain), 1),
349
414
  createElementVNode("button", {
350
- onClick: r[0] ||= (e) => p.value = "select",
351
- disabled: m.value || g.value,
415
+ onClick: n[0] ||= () => {
416
+ f.value = "select", Q();
417
+ },
418
+ disabled: p.value || m.value,
352
419
  class: "_cppay-btn _cppay-btn-primary _cppay-state-btn"
353
- }, toDisplayString(l.value.returnButton), 9, _hoisted_31)
354
- ])]) : p.value === "error" ? renderSlot(e.$slots, "error", { key: 2 }, () => [createElementVNode("div", _hoisted_32, [
355
- r[11] ||= createElementVNode("div", { class: "_cppay-state-error-bg" }, [createElementVNode("div", { class: "_cppay-state-error-icon" }, "!")], -1),
356
- createElementVNode("h3", _hoisted_33, toDisplayString(_.value || l.value.error), 1),
357
- createElementVNode("p", _hoisted_34, toDisplayString(l.value.checkStatusFailed), 1),
420
+ }, toDisplayString(c.value.returnButton), 9, _hoisted_31)
421
+ ])]) : f.value === "error" ? renderSlot(e.$slots, "error", { key: 2 }, () => [createElementVNode("div", _hoisted_32, [
422
+ n[11] ||= createElementVNode("div", { class: "_cppay-state-error-bg" }, [createElementVNode("div", { class: "_cppay-state-error-icon" }, "!")], -1),
423
+ createElementVNode("h3", _hoisted_33, toDisplayString(g.value || c.value.error), 1),
424
+ createElementVNode("p", _hoisted_34, toDisplayString(c.value.checkStatusFailed), 1),
358
425
  createElementVNode("button", {
359
- onClick: r[1] ||= (e) => p.value = "select",
360
- disabled: m.value || g.value,
426
+ onClick: n[1] ||= () => {
427
+ f.value = "select", Q();
428
+ },
429
+ disabled: p.value || m.value,
361
430
  class: "_cppay-btn _cppay-btn-primary _cppay-state-btn"
362
- }, toDisplayString(l.value.returnButton), 9, _hoisted_35)
363
- ])]) : p.value === "failed" ? renderSlot(e.$slots, "failed", { key: 3 }, () => [createElementVNode("div", _hoisted_36, [
364
- r[12] ||= createElementVNode("div", { class: "_cppay-state-failed-bg" }, [createElementVNode("div", { class: "_cppay-state-failed-icon" }, "✕")], -1),
365
- createElementVNode("h3", _hoisted_37, toDisplayString(l.value.paymentFailed), 1),
366
- createElementVNode("p", _hoisted_38, toDisplayString(l.value.pleaseInitiatePaymentAgain), 1),
431
+ }, toDisplayString(c.value.returnButton), 9, _hoisted_35)
432
+ ])]) : f.value === "failed" ? renderSlot(e.$slots, "failed", { key: 3 }, () => [createElementVNode("div", _hoisted_36, [
433
+ n[12] ||= createElementVNode("div", { class: "_cppay-state-failed-bg" }, [createElementVNode("div", { class: "_cppay-state-failed-icon" }, "✕")], -1),
434
+ createElementVNode("h3", _hoisted_37, toDisplayString(c.value.paymentFailed), 1),
435
+ createElementVNode("p", _hoisted_38, toDisplayString(c.value.pleaseInitiatePaymentAgain), 1),
367
436
  createElementVNode("button", {
368
- onClick: r[2] ||= (e) => p.value = "select",
369
- disabled: m.value || g.value,
437
+ onClick: n[2] ||= () => {
438
+ f.value = "select", Q();
439
+ },
440
+ disabled: p.value || m.value,
370
441
  class: "_cppay-btn _cppay-btn-primary _cppay-state-btn"
371
- }, toDisplayString(l.value.returnButton), 9, _hoisted_39)
372
- ])]) : p.value === "select" ? (openBlock(), createElementBlock("div", _hoisted_40, [
442
+ }, toDisplayString(c.value.returnButton), 9, _hoisted_39)
443
+ ])]) : f.value === "select" ? (openBlock(), createElementBlock("div", _hoisted_40, [
373
444
  renderSlot(e.$slots, "choose-top"),
374
- createElementVNode("div", _hoisted_41, [createElementVNode("label", _hoisted_42, toDisplayString(l.value.paymentNetwork), 1), createElementVNode("div", _hoisted_43, [(openBlock(!0), createElementBlock(Fragment, null, renderList(v.value, (e) => (openBlock(), createElementBlock("button", {
445
+ createElementVNode("div", _hoisted_41, [createElementVNode("label", _hoisted_42, toDisplayString(c.value.paymentNetwork), 1), createElementVNode("div", _hoisted_43, [(openBlock(!0), createElementBlock(Fragment, null, renderList(_.value, (e) => (openBlock(), createElementBlock("button", {
375
446
  key: e.chain,
376
- onClick: (n) => y.value = e.chain,
377
- class: normalizeClass(["_cppay-select-btn", { "_cppay-selected": y.value === e.chain }])
447
+ onClick: (t) => v.value = e.chain,
448
+ class: normalizeClass(["_cppay-select-btn", { "_cppay-selected": v.value === e.chain }])
378
449
  }, [e.icon ? (openBlock(), createElementBlock("img", {
379
450
  key: 0,
380
451
  src: e.icon,
381
452
  alt: e.chain
382
453
  }, null, 8, _hoisted_45)) : createCommentVNode("", !0), createElementVNode("span", null, toDisplayString(e.chain), 1)], 10, _hoisted_44))), 128))])]),
383
- createElementVNode("div", _hoisted_46, [createElementVNode("label", _hoisted_47, toDisplayString(l.value.paymentToken), 1), createElementVNode("div", _hoisted_48, [(openBlock(!0), createElementBlock(Fragment, null, renderList(I.value, (e) => (openBlock(), createElementBlock("button", {
454
+ createElementVNode("div", _hoisted_46, [createElementVNode("label", _hoisted_47, toDisplayString(c.value.paymentToken), 1), createElementVNode("div", _hoisted_48, [(openBlock(!0), createElementBlock(Fragment, null, renderList(F.value, (e) => (openBlock(), createElementBlock("button", {
384
455
  key: e.symbol,
385
- onClick: (n) => b.value = e.symbol,
386
- class: normalizeClass(["_cppay-select-btn", { "_cppay-selected": b.value === e.symbol }])
456
+ onClick: (t) => y.value = e.symbol,
457
+ class: normalizeClass(["_cppay-select-btn", { "_cppay-selected": y.value === e.symbol }])
387
458
  }, [e.icon ? (openBlock(), createElementBlock("img", {
388
459
  key: 0,
389
460
  src: e.icon,
390
461
  alt: e.symbol
391
462
  }, null, 8, _hoisted_50)) : createCommentVNode("", !0), createElementVNode("span", null, toDisplayString(e.symbol), 1)], 10, _hoisted_49))), 128))])]),
392
463
  renderSlot(e.$slots, "choose-bottom"),
393
- createElementVNode("div", _hoisted_51, [createElementVNode("div", _hoisted_52, [createElementVNode("div", _hoisted_53, [createElementVNode("span", _hoisted_54, toDisplayString(l.value.paymentAmount), 1), createElementVNode("div", _hoisted_55, [createElementVNode("div", _hoisted_56, toDisplayString(U.value ?? "-") + " " + toDisplayString(b.value ?? ""), 1), createElementVNode("div", _hoisted_57, "≈ $" + toDisplayString(n.amount), 1)])])])]),
394
- createElementVNode("div", _hoisted_58, [_.value ? (openBlock(), createElementBlock("div", {
464
+ createElementVNode("div", _hoisted_51, [createElementVNode("div", _hoisted_52, [createElementVNode("div", _hoisted_53, [createElementVNode("span", _hoisted_54, toDisplayString(c.value.paymentAmount), 1), createElementVNode("div", _hoisted_55, [createElementVNode("div", _hoisted_56, toDisplayString(H.value ?? "-") + " " + toDisplayString(y.value ?? ""), 1), createElementVNode("div", _hoisted_57, "≈ $" + toDisplayString(t.amount), 1)])])])]),
465
+ createElementVNode("div", _hoisted_58, [g.value ? (openBlock(), createElementBlock("div", {
395
466
  key: 0,
396
467
  class: "_cppay-error-tooltip-wrapper",
397
- onMouseenter: r[3] ||= (e) => D.value = !0,
398
- onMouseleave: r[4] ||= (e) => D.value = !1
399
- }, [createElementVNode("div", _hoisted_59, [r[13] ||= createElementVNode("svg", {
468
+ onMouseenter: n[3] ||= (e) => E.value = !0,
469
+ onMouseleave: n[4] ||= (e) => E.value = !1
470
+ }, [createElementVNode("div", _hoisted_59, [n[13] ||= createElementVNode("svg", {
400
471
  viewBox: "0 0 20 20",
401
472
  fill: "currentColor"
402
473
  }, [createElementVNode("path", {
403
474
  "fill-rule": "evenodd",
404
475
  d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",
405
476
  "clip-rule": "evenodd"
406
- })], -1), createElementVNode("span", null, toDisplayString(_.value), 1)]), D.value ? (openBlock(), createElementBlock("div", _hoisted_60, toDisplayString(_.value), 1)) : createCommentVNode("", !0)], 32)) : createCommentVNode("", !0), createElementVNode("button", {
407
- onClick: Y,
408
- disabled: !y.value || !b.value || m.value,
477
+ })], -1), createElementVNode("span", null, toDisplayString(g.value), 1)]), E.value ? (openBlock(), createElementBlock("div", _hoisted_60, toDisplayString(g.value), 1)) : createCommentVNode("", !0)], 32)) : createCommentVNode("", !0), createElementVNode("button", {
478
+ onClick: J,
479
+ disabled: !v.value || !y.value || p.value,
409
480
  class: "_cppay-btn _cppay-btn-primary"
410
- }, toDisplayString(m.value ? l.value.processing : l.value.continuePayment), 9, _hoisted_61)])
481
+ }, toDisplayString(p.value ? c.value.processing : c.value.continuePayment), 9, _hoisted_61)])
411
482
  ])) : (openBlock(), createElementBlock("div", _hoisted_62, [
412
- createElementVNode("div", _hoisted_63, [createElementVNode("div", _hoisted_64, [x.value ? (openBlock(), createElementBlock("img", {
483
+ createElementVNode("div", _hoisted_63, [createElementVNode("div", _hoisted_64, [b.value ? (openBlock(), createElementBlock("img", {
413
484
  key: 0,
414
- src: x.value,
485
+ src: b.value,
415
486
  alt: "Payment QR Code",
416
487
  class: "_cppay-qr-image"
417
488
  }, null, 8, _hoisted_65)) : createCommentVNode("", !0)])]),
418
489
  createElementVNode("div", _hoisted_66, [
419
- L.value ? (openBlock(), createElementBlock("div", _hoisted_67, [createElementVNode("div", _hoisted_68, [createElementVNode("div", _hoisted_69, [createElementVNode("div", _hoisted_70, toDisplayString(n.plain === "subscription" ? l.value.authorizationAmount : l.value.paymentAmount), 1), createElementVNode("div", _hoisted_71, [j.value ? (openBlock(), createElementBlock("span", _hoisted_72, toDisplayString(n.plain === "subscription" ? `${z(j.value.approveAmount, R(L.value.symbol))} ${L.value.symbol}` : `${z(j.value.paymentAmount, R(L.value.symbol))} ${L.value.symbol}`), 1)) : createCommentVNode("", !0), createElementVNode("span", null, "≈ $" + toDisplayString(n.amount), 1)])])])])) : createCommentVNode("", !0),
420
- createElementVNode("div", _hoisted_73, [createElementVNode("div", _hoisted_74, [createElementVNode("div", _hoisted_75, [createElementVNode("span", null, toDisplayString(n.plain === "subscription" ? l.value.authorizationContractAddress : l.value.paymentAddress), 1), T.value ? (openBlock(), createElementBlock("span", _hoisted_76, "⏰ " + toDisplayString(T.value), 1)) : createCommentVNode("", !0)]), createElementVNode("div", _hoisted_77, [j.value ? (openBlock(), createElementBlock("code", _hoisted_78, toDisplayString(n.plain === "subscription" ? j.value.spenderAddress : j.value.receiveAddress), 1)) : createCommentVNode("", !0), createElementVNode("button", {
421
- onClick: Q,
422
- class: normalizeClass(["_cppay-copy-btn", { "_cppay-copy-success": E.value }]),
423
- title: E.value ? l.value.copied : l.value.copyAddress
424
- }, [E.value ? (openBlock(), createElementBlock("svg", _hoisted_81, [...r[15] ||= [createElementVNode("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" }, null, -1)]])) : (openBlock(), createElementBlock("svg", _hoisted_80, [...r[14] ||= [createElementVNode("path", { d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2" }, null, -1), createElementVNode("rect", {
490
+ I.value ? (openBlock(), createElementBlock("div", _hoisted_67, [createElementVNode("div", _hoisted_68, [createElementVNode("div", _hoisted_69, [createElementVNode("div", _hoisted_70, toDisplayString(t.plain === "subscription" ? c.value.authorizationAmount : c.value.paymentAmount), 1), createElementVNode("div", _hoisted_71, [A.value ? (openBlock(), createElementBlock("span", _hoisted_72, toDisplayString(t.plain === "subscription" ? `${R(A.value.approveAmount, L(I.value.symbol))} ${I.value.symbol}` : `${R(A.value.paymentAmount, L(I.value.symbol))} ${I.value.symbol}`), 1)) : createCommentVNode("", !0), createElementVNode("span", null, "≈ $" + toDisplayString(t.amount), 1)])])])])) : createCommentVNode("", !0),
491
+ createElementVNode("div", _hoisted_73, [createElementVNode("div", _hoisted_74, [createElementVNode("div", _hoisted_75, [createElementVNode("span", null, toDisplayString(t.plain === "subscription" ? c.value.authorizationContractAddress : c.value.paymentAddress), 1), w.value ? (openBlock(), createElementBlock("span", _hoisted_76, "⏰ " + toDisplayString(w.value), 1)) : createCommentVNode("", !0)]), createElementVNode("div", _hoisted_77, [A.value ? (openBlock(), createElementBlock("code", _hoisted_78, toDisplayString(t.plain === "subscription" ? A.value.spenderAddress : A.value.receiveAddress), 1)) : createCommentVNode("", !0), createElementVNode("button", {
492
+ onClick: bn,
493
+ class: normalizeClass(["_cppay-copy-btn", { "_cppay-copy-success": T.value }]),
494
+ title: T.value ? c.value.copied : c.value.copyAddress
495
+ }, [T.value ? (openBlock(), createElementBlock("svg", _hoisted_81, [...n[15] ||= [createElementVNode("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" }, null, -1)]])) : (openBlock(), createElementBlock("svg", _hoisted_80, [...n[14] ||= [createElementVNode("path", { d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2" }, null, -1), createElementVNode("rect", {
425
496
  x: "8",
426
497
  y: "2",
427
498
  width: "8",
@@ -429,31 +500,31 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = { class: "_cppay-
429
500
  rx: "1",
430
501
  ry: "1"
431
502
  }, null, -1)]]))], 10, _hoisted_79)])])]),
432
- n.plain === "subscription" ? (openBlock(), createElementBlock("div", _hoisted_82, [createElementVNode("div", _hoisted_83, toDisplayString(l.value.subscriptionNotice), 1), createElementVNode("div", _hoisted_84, toDisplayString(l.value.subscriptionNoticeMessage), 1)])) : createCommentVNode("", !0)
503
+ t.plain === "subscription" ? (openBlock(), createElementBlock("div", _hoisted_82, [createElementVNode("div", _hoisted_83, toDisplayString(c.value.subscriptionNotice), 1), createElementVNode("div", _hoisted_84, toDisplayString(c.value.subscriptionNoticeMessage), 1)])) : createCommentVNode("", !0)
433
504
  ]),
434
- _.value ? (openBlock(), createElementBlock("div", {
505
+ g.value ? (openBlock(), createElementBlock("div", {
435
506
  key: 0,
436
507
  class: "_cppay-error-tooltip-wrapper",
437
- onMouseenter: r[5] ||= (e) => D.value = !0,
438
- onMouseleave: r[6] ||= (e) => D.value = !1
439
- }, [createElementVNode("div", _hoisted_85, [r[16] ||= createElementVNode("svg", {
508
+ onMouseenter: n[5] ||= (e) => E.value = !0,
509
+ onMouseleave: n[6] ||= (e) => E.value = !1
510
+ }, [createElementVNode("div", _hoisted_85, [n[16] ||= createElementVNode("svg", {
440
511
  viewBox: "0 0 20 20",
441
512
  fill: "currentColor"
442
513
  }, [createElementVNode("path", {
443
514
  "fill-rule": "evenodd",
444
515
  d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",
445
516
  "clip-rule": "evenodd"
446
- })], -1), createElementVNode("span", null, toDisplayString(_.value), 1)]), D.value ? (openBlock(), createElementBlock("div", _hoisted_86, toDisplayString(_.value), 1)) : createCommentVNode("", !0)], 32)) : createCommentVNode("", !0),
447
- g.value ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_87, [S.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createElementVNode("button", {
448
- onClick: J,
449
- disabled: m.value,
517
+ })], -1), createElementVNode("span", null, toDisplayString(g.value), 1)]), E.value ? (openBlock(), createElementBlock("div", _hoisted_86, toDisplayString(g.value), 1)) : createCommentVNode("", !0)], 32)) : createCommentVNode("", !0),
518
+ m.value ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_87, [x.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createElementVNode("button", {
519
+ onClick: q,
520
+ disabled: p.value,
450
521
  class: "_cppay-btn _cppay-btn-primary"
451
- }, toDisplayString(m.value ? n.plain === "subscription" ? l.value.authorizing : l.value.processing : (n.plain, l.value.walletPay)), 9, _hoisted_89), createElementVNode("button", {
452
- onClick: P,
453
- disabled: m.value,
522
+ }, toDisplayString(p.value ? t.plain === "subscription" ? c.value.authorizing : c.value.processing : (t.plain, c.value.walletPay)), 9, _hoisted_89), createElementVNode("button", {
523
+ onClick: N,
524
+ disabled: p.value,
454
525
  class: "_cppay-btn _cppay-wallet-address-btn",
455
- title: l.value.clickToModifyWallet
456
- }, [createElementVNode("span", _hoisted_91, toDisplayString(S.value.slice(0, 10)) + "..." + toDisplayString(S.value.slice(-4)), 1), r[17] ||= createElementVNode("svg", {
526
+ title: c.value.clickToModifyWallet
527
+ }, [createElementVNode("span", _hoisted_91, toDisplayString(x.value.slice(0, 10)) + "..." + toDisplayString(x.value.slice(-4)), 1), n[17] ||= createElementVNode("svg", {
457
528
  class: "_cppay-wallet-arrow",
458
529
  viewBox: "0 0 24 24",
459
530
  fill: "none",
@@ -461,15 +532,15 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = { class: "_cppay-
461
532
  "stroke-width": "2"
462
533
  }, [createElementVNode("polyline", { points: "6 9 12 15 18 9" })], -1)], 8, _hoisted_90)], 64)) : (openBlock(), createElementBlock("button", {
463
534
  key: 0,
464
- onClick: P,
465
- disabled: C.value,
535
+ onClick: N,
536
+ disabled: S.value,
466
537
  class: "_cppay-btn _cppay-btn-secondary _cppay-connect-wallet-btn"
467
- }, [createElementVNode("span", null, toDisplayString(C.value ? l.value.processing : l.value.connectWallet), 1)], 8, _hoisted_88))])),
538
+ }, [createElementVNode("span", null, toDisplayString(S.value ? c.value.processing : c.value.connectWallet), 1)], 8, _hoisted_88))])),
468
539
  createElementVNode("div", _hoisted_92, [createElementVNode("button", {
469
- onClick: X,
470
- disabled: g.value,
540
+ onClick: Y,
541
+ disabled: m.value,
471
542
  class: "_cppay-btn _cppay-btn-primary"
472
- }, [g.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [r[18] ||= createElementVNode("svg", {
543
+ }, [m.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [n[18] ||= createElementVNode("svg", {
473
544
  class: "_cppay-spinner",
474
545
  viewBox: "0 0 24 24",
475
546
  fill: "none",
@@ -486,13 +557,15 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = { class: "_cppay-
486
557
  stroke: "currentColor",
487
558
  "stroke-width": "3",
488
559
  "stroke-linecap": "round"
489
- })], -1), createTextVNode(" " + toDisplayString(l.value.checking), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(l.value.completedPayment), 1)], 64))], 8, _hoisted_93)]),
490
- r[19] ||= createElementVNode("hr", { class: "_cppay-divider" }, null, -1),
560
+ })], -1), createTextVNode(" " + toDisplayString(c.value.checking), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(c.value.completedPayment), 1)], 64))], 8, _hoisted_93)]),
561
+ n[19] ||= createElementVNode("hr", { class: "_cppay-divider" }, null, -1),
491
562
  createElementVNode("div", _hoisted_94, [createElementVNode("button", {
492
- onClick: r[7] ||= (e) => p.value = "select",
493
- disabled: m.value || g.value,
563
+ onClick: n[7] ||= () => {
564
+ f.value = "select", Q();
565
+ },
566
+ disabled: p.value || m.value,
494
567
  class: "_cppay-btn _cppay-btn-text"
495
- }, toDisplayString(l.value.changePaymentMethod), 9, _hoisted_95)])
568
+ }, toDisplayString(c.value.changePaymentMethod), 9, _hoisted_95)])
496
569
  ]))]));
497
570
  }
498
571
  }), _hoisted_1 = { class: "_cppay-dialog" }, _hoisted_2 = { class: "_cppay-header" }, _hoisted_3 = { class: "_cppay-title" }, _hoisted_4 = ["disabled"], PaymentDialog_default = /* @__PURE__ */ defineComponent({
@@ -514,43 +587,43 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = { class: "_cppay-
514
587
  "failed",
515
588
  "error"
516
589
  ],
517
- setup(e, { emit: n }) {
518
- let r = e, a = n, o = computed(() => getLocaleMessages(r.locale)), c = ref("select"), l = computed(() => c.value !== "checking");
519
- watch(() => r.modelValue, (e) => {
520
- e || (c.value = "select");
590
+ setup(e, { emit: t }) {
591
+ let n = e, i = t, a = computed(() => getLocaleMessages(n.locale)), s = ref("select"), c = computed(() => s.value !== "checking");
592
+ watch(() => n.modelValue, (e) => {
593
+ e || (s.value = "select");
521
594
  });
522
- let u = (e) => {
523
- c.value = e;
595
+ let l = (e) => {
596
+ s.value = e;
524
597
  };
525
598
  onMounted(() => {
526
599
  let e = (e) => {
527
- e.key === "Escape" && r.modelValue && !l.value && d();
600
+ e.key === "Escape" && n.modelValue && !c.value && u();
528
601
  };
529
602
  return window.addEventListener("keydown", e), () => {
530
603
  window.removeEventListener("keydown", e);
531
604
  };
532
605
  });
533
- let d = () => {
534
- l.value && a("update:modelValue", !1);
535
- }, f = () => {
536
- switch (c.value) {
537
- case "success": return o.value.paymentResult;
538
- case "expired": return o.value.paymentExpired;
539
- case "failed": return o.value.paymentFailed;
540
- case "error": return o.value.error;
541
- case "payment": return o.value.completePayment;
542
- default: return o.value.selectPaymentMethod;
606
+ let u = () => {
607
+ c.value && i("update:modelValue", !1);
608
+ }, d = () => {
609
+ switch (s.value) {
610
+ case "success": return a.value.paymentResult;
611
+ case "expired": return a.value.paymentExpired;
612
+ case "failed": return a.value.paymentFailed;
613
+ case "error": return a.value.error;
614
+ case "payment": return a.value.completePayment;
615
+ default: return a.value.selectPaymentMethod;
543
616
  }
544
617
  };
545
- return (n, r) => e.modelValue ? (openBlock(), createElementBlock("div", {
618
+ return (t, n) => e.modelValue ? (openBlock(), createElementBlock("div", {
546
619
  key: 0,
547
620
  class: "_cppay-overlay",
548
- onClick: r[4] ||= (e) => e.target === e.currentTarget && d()
549
- }, [createElementVNode("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("h2", _hoisted_3, toDisplayString(f()), 1), createElementVNode("button", {
550
- onClick: d,
551
- disabled: !l.value,
621
+ onClick: n[4] ||= (e) => e.target === e.currentTarget && u()
622
+ }, [createElementVNode("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("h2", _hoisted_3, toDisplayString(d()), 1), createElementVNode("button", {
623
+ onClick: u,
624
+ disabled: !c.value,
552
625
  class: "_cppay-close-btn"
553
- }, [...r[5] ||= [createElementVNode("svg", {
626
+ }, [...n[5] ||= [createElementVNode("svg", {
554
627
  fill: "none",
555
628
  stroke: "currentColor",
556
629
  viewBox: "0 0 24 24"
@@ -568,18 +641,18 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = { class: "_cppay-
568
641
  plain: e.plain,
569
642
  intervalDays: e.intervalDays,
570
643
  locale: e.locale,
571
- "onUpdate:paymentStep": u,
572
- onSuccess: r[0] ||= (e) => a("success", e),
573
- onExpired: r[1] ||= (e) => a("expired", e),
574
- onFailed: r[2] ||= (e) => a("failed", e),
575
- onError: r[3] ||= (e) => a("error", e)
644
+ "onUpdate:paymentStep": l,
645
+ onSuccess: n[0] ||= (e) => i("success", e),
646
+ onExpired: n[1] ||= (e) => i("expired", e),
647
+ onFailed: n[2] ||= (e) => i("failed", e),
648
+ onError: n[3] ||= (e) => i("error", e)
576
649
  }, {
577
- "choose-top": withCtx(() => [renderSlot(n.$slots, "choose-top")]),
578
- "choose-bottom": withCtx(() => [renderSlot(n.$slots, "choose-bottom")]),
579
- success: withCtx(() => [renderSlot(n.$slots, "success")]),
580
- failed: withCtx(() => [renderSlot(n.$slots, "failed")]),
581
- error: withCtx(() => [renderSlot(n.$slots, "error")]),
582
- expired: withCtx(() => [renderSlot(n.$slots, "expired")]),
650
+ "choose-top": withCtx(() => [renderSlot(t.$slots, "choose-top")]),
651
+ "choose-bottom": withCtx(() => [renderSlot(t.$slots, "choose-bottom")]),
652
+ success: withCtx(() => [renderSlot(t.$slots, "success")]),
653
+ failed: withCtx(() => [renderSlot(t.$slots, "failed")]),
654
+ error: withCtx(() => [renderSlot(t.$slots, "error")]),
655
+ expired: withCtx(() => [renderSlot(t.$slots, "expired")]),
583
656
  _: 3
584
657
  }, 8, [
585
658
  "apikey",
@@ -613,8 +686,8 @@ var handleClose = () => {
613
686
  };
614
687
  const CppayPlugin = { install(e) {
615
688
  e.config.globalProperties.$showPayment = showPayment, e.config.globalProperties.$closePayment = closePayment;
616
- let n = document.createElement("div");
617
- document.body.appendChild(n), createApp({ setup() {
689
+ let t = document.createElement("div");
690
+ document.body.appendChild(t), createApp({ setup() {
618
691
  return () => cppayState.value.options ? h(PaymentDialog_default, {
619
692
  modelValue: cppayState.value.open,
620
693
  "onUpdate:modelValue": (e) => {
@@ -626,7 +699,7 @@ const CppayPlugin = { install(e) {
626
699
  onFailed: handleFailed,
627
700
  onError: handleError
628
701
  }) : null;
629
- } }).mount(n);
702
+ } }).mount(t);
630
703
  } }, useCppayPayment = () => ({
631
704
  showPayment,
632
705
  closePayment