cppay-sdk 0.0.2-beta.36 → 0.0.2-beta.37

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
@@ -1,6 +1,6 @@
1
- import { t as cppay_default } from "./cppay-DnoMkyVy.js";
2
- import { n as injectStyle, r as payment_dialog_default, t as getLocaleMessages } from "./locales-KW7cSv4d.js";
3
- import { Fragment, computed, createApp, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, h, normalizeClass, onMounted, onUnmounted, openBlock, ref, renderList, renderSlot, toDisplayString, watch, withCtx } from "vue";
1
+ import { t as cppay_default } from "./cppay-J9nBy01A.js";
2
+ import { n as injectStyle, r as payment_dialog_default, t as getLocaleMessages } from "./locales-De6oJnka.js";
3
+ import { Fragment, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, h, normalizeClass, onMounted, onUnmounted, openBlock, ref, renderList, renderSlot, shallowRef, toDisplayString, watch, withCtx } from "vue";
4
4
  import * as QRCode from "qrcode";
5
5
  import { EMPTY, defer, timer } from "rxjs";
6
6
  import { expand, retry, switchMap, tap, timeout } from "rxjs/operators";
@@ -56,7 +56,7 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = {
56
56
  apikey: {},
57
57
  orderId: {},
58
58
  amount: {},
59
- plain: { default: "one-time" },
59
+ plain: {},
60
60
  intervalDays: {},
61
61
  slots: {},
62
62
  locale: {}
@@ -66,14 +66,11 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = {
66
66
  "success",
67
67
  "expired",
68
68
  "failed",
69
- "error",
70
- "update:loading",
71
- "update:isCheckingPayment",
72
- "update:error"
69
+ "error"
73
70
  ],
74
- setup(t, { emit: n }) {
75
- let a = t, o = n, s = computed(() => getLocaleMessages(a.locale || "zh-CN")), c = new cppay_default(a.apikey), f = ref("select"), y = ref(!1), b = ref(!1), x = ref(), S = ref([]), C = ref(), w = ref(), T = ref(), E = ref(), D = ref(!1), O = ref(), k = ref(""), A = ref(!1), j = ref(!1), M = ref(null), N = ref(null), P = ref(null), F = ref(null), I = () => {
76
- typeof window < "u" && !M.value && (M.value = createAppKit({
71
+ setup(i, { emit: a }) {
72
+ let c = i, l = a, u = computed(() => getLocaleMessages(c.locale)), d = new cppay_default(c.apikey), g = ref("select"), _ = ref(!1), v = computed(() => g.value === "checking"), y = ref(), b = ref([]), x = ref(), S = ref(), C = ref(), w = ref(), T = ref(!1), E = ref(), D = ref(""), O = ref(!1), k = ref(!1), A = shallowRef(null), j = ref(null), M = ref(null), N = ref(null), P = () => {
73
+ typeof window < "u" && !A.value && (A.value = createAppKit({
77
74
  debug: !1,
78
75
  enableNetworkSwitch: !1,
79
76
  adapters: [new EthersAdapter()],
@@ -94,30 +91,24 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = {
94
91
  icons: ["https://cppay.com/icon.png"]
95
92
  },
96
93
  features: { analytics: !1 }
97
- }), E.value = M.value.getAddress(), O.value = M.value.getProvider("eip155"), M.value.subscribeAccount((e) => {
98
- e.isConnected ? E.value = e.address : (E.value = void 0, O.value = void 0);
99
- }), M.value.subscribeProviders((e) => {
100
- O.value = e?.eip155;
94
+ }), w.value = A.value.getAddress(), E.value = A.value.getProvider("eip155"), A.value.subscribeAccount((e) => {
95
+ e.isConnected ? w.value = e.address : (w.value = void 0, E.value = void 0);
96
+ }), A.value.subscribeProviders((e) => {
97
+ E.value = e?.eip155;
101
98
  }));
102
99
  };
103
- watch(f, (e) => {
104
- o("update:paymentStep", e);
105
- }), watch(y, (e) => {
106
- o("update:loading", e);
107
- }), watch(b, (e) => {
108
- o("update:isCheckingPayment", e);
109
- }), watch(x, (e) => {
110
- o("update:error", e);
100
+ watch(g, (e) => {
101
+ l("update:paymentStep", e);
111
102
  });
112
- let L = async () => {
103
+ let F = async () => {
113
104
  try {
114
- D.value = !0, x.value = void 0, M.value && await M.value.open();
105
+ T.value = !0, y.value = void 0, A.value && await A.value.open();
115
106
  } catch (e) {
116
- x.value = e instanceof Error ? e.message : s.value.walletConnectionFailed, o("error", e);
107
+ y.value = e instanceof Error ? e.message : u.value.walletConnectionFailed, l("error", e);
117
108
  } finally {
118
- D.value = !1;
109
+ T.value = !1;
119
110
  }
120
- }, R = computed(() => S.value.find((e) => e.chain === C.value)), z = computed(() => R.value?.tokens || []), B = computed(() => z.value.find((e) => e.symbol === w.value)), V = (e) => [
111
+ }, I = computed(() => b.value.find((e) => e.chain === x.value)), L = computed(() => I.value?.tokens || []), R = computed(() => L.value.find((e) => e.symbol === S.value)), z = (e) => [
121
112
  "USDT",
122
113
  "USDC",
123
114
  "BUSD",
@@ -125,90 +116,102 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = {
125
116
  "TUSD",
126
117
  "USDD",
127
118
  "FDUSD"
128
- ].includes(e.toUpperCase()) ? 2 : 6, H = (e, t) => {
129
- let n = parseFloat(e);
130
- return isNaN(n) ? "0" : n.toFixed(t).replace(/\.?0+$/, "");
131
- }, U = (e) => {
132
- if (e <= 0) return s.value.expired;
133
- let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = e % 60;
134
- return t > 0 ? `${t}${s.value.hours}${n}${s.value.minutes}${r}${s.value.seconds}` : `${n}${s.value.minutes}${r}${s.value.seconds}`;
135
- }, W = (e) => {
136
- P.value && clearInterval(P.value);
137
- let t = () => {
138
- let t = e - Math.floor(Date.now() / 1e3);
139
- k.value = U(t), t <= 0 && (f.value = "expired", G());
119
+ ].includes(e.toUpperCase()) ? 2 : 6, B = (e, i) => {
120
+ let a = parseFloat(e);
121
+ return isNaN(a) ? "0" : a.toFixed(i).replace(/\.?0+$/, "");
122
+ }, V = (e) => {
123
+ if (e <= 0) return u.value.expired;
124
+ let i = Math.floor(e / 3600), a = Math.floor(e % 3600 / 60), o = e % 60;
125
+ return i > 0 ? `${i}${u.value.hours}${a}${u.value.minutes}${o}${u.value.seconds}` : `${a}${u.value.minutes}${o}${u.value.seconds}`;
126
+ }, H = (e) => {
127
+ M.value && clearInterval(M.value);
128
+ let i = () => {
129
+ if (g.value === "checking") {
130
+ U();
131
+ return;
132
+ }
133
+ let i = e - Math.floor(Date.now() / 1e3);
134
+ D.value = V(i), i <= 0 && (g.value = "expired", U());
140
135
  };
141
- t(), P.value = setInterval(t, 1e3);
142
- }, G = () => {
143
- P.value &&= (clearInterval(P.value), null);
144
- }, K = computed(() => {
145
- if (!w.value || !B.value) return "0";
146
- let e = parseFloat(B.value.price);
136
+ i(), M.value = setInterval(i, 1e3);
137
+ }, U = () => {
138
+ M.value &&= (clearInterval(M.value), null);
139
+ }, W = computed(() => {
140
+ if (!S.value || !R.value) return "0";
141
+ let e = parseFloat(R.value.price);
147
142
  if (isNaN(e) || e === 0) return "0";
148
- let t = V(w.value);
149
- return H((parseFloat(a.amount) / e).toFixed(t), t);
150
- }), q = async () => {
143
+ let i = z(S.value);
144
+ return B((parseFloat(c.amount) / e).toFixed(i), i);
145
+ }), G = async () => {
151
146
  try {
152
- x.value = void 0;
153
- let e = await c.getSupportedChains();
154
- S.value = e, e.length > 0 && (C.value = e[0].chain);
147
+ _.value = !0, y.value = void 0, b.value = await d.getSupportedChains(), b.value.length > 0 && (x.value = b.value[0].chain);
155
148
  } catch (e) {
156
- x.value = e instanceof Error ? e.message : s.value.loadPaymentNetworkFailed, o("error", e);
149
+ y.value = e instanceof Error ? e.message : u.value.loadPaymentNetworkFailed, l("error", e);
150
+ } finally {
151
+ _.value = !1;
157
152
  }
158
- }, J = async (e) => {
159
- if (O.value) try {
160
- await O.value.request({
153
+ }, K = async (e) => {
154
+ if (E.value) try {
155
+ await E.value.request({
161
156
  method: "wallet_switchEthereumChain",
162
157
  params: [{ chainId: `0x${e.toString(16)}` }]
163
158
  });
164
159
  } catch (e) {
165
- throw e.code === 4902 ? Error(s.value.pleaseAddNetwork) : e;
160
+ throw e.code === 4902 ? Error(u.value.pleaseAddNetwork) : e;
166
161
  }
167
- }, Y = async () => {
168
- if (!(!E.value || !O.value || !F.value || !B.value || !R.value)) try {
169
- let e = F.value;
170
- await J(R.value.chainId);
171
- let t = createWalletClient({
172
- account: E.value,
173
- transport: custom(O.value)
162
+ }, q = async () => {
163
+ if (!(!w.value || !E.value || !N.value || !R.value || !I.value)) try {
164
+ _.value = !0;
165
+ let e = N.value;
166
+ await K(I.value.chainId);
167
+ let i = createWalletClient({
168
+ account: w.value,
169
+ transport: custom(E.value)
174
170
  });
175
- B.value.address ? await t.writeContract({
176
- address: B.value.address,
177
- abi: [{
178
- name: "transfer",
179
- type: "function",
180
- stateMutability: "nonpayable",
181
- inputs: [{
182
- name: "to",
183
- type: "address"
184
- }, {
185
- name: "amount",
186
- type: "uint256"
171
+ if (R.value.address) {
172
+ let a = await i.writeContract({
173
+ address: R.value.address,
174
+ abi: [{
175
+ name: "transfer",
176
+ type: "function",
177
+ stateMutability: "nonpayable",
178
+ inputs: [{
179
+ name: "to",
180
+ type: "address"
181
+ }, {
182
+ name: "amount",
183
+ type: "uint256"
184
+ }],
185
+ outputs: [{ type: "bool" }]
187
186
  }],
188
- outputs: [{ type: "bool" }]
189
- }],
190
- functionName: "transfer",
191
- args: [e.receiveAddress, parseUnits(e.paymentAmount, B.value.decimals)],
192
- chain: null
193
- }) : await t.sendTransaction({
194
- to: e.receiveAddress,
195
- value: parseUnits(e.paymentAmount, B.value.decimals),
196
- chain: null
197
- }), T.value = void 0;
187
+ functionName: "transfer",
188
+ args: [e.receiveAddress, parseUnits(e.paymentAmount, R.value.decimals)],
189
+ chain: null
190
+ });
191
+ console.log("转账交易哈希:", a);
192
+ } else {
193
+ let a = await i.sendTransaction({
194
+ to: e.receiveAddress,
195
+ value: parseUnits(e.paymentAmount, R.value.decimals),
196
+ chain: null
197
+ });
198
+ console.log("转账交易哈希:", a);
199
+ }
200
+ _.value = !1, g.value = "checking";
198
201
  } catch (e) {
199
- o("update:error", e instanceof Error ? e.message : s.value.walletPaymentFailed), o("error", e);
202
+ console.error("钱包支付失败:", e), y.value = e instanceof Error ? e.message : u.value.walletPaymentFailed, l("error", e), _.value = !1;
200
203
  }
201
- }, X = async () => {
202
- if (!(!E.value || !O.value || !F.value || !B.value || !R.value)) try {
203
- let e = F.value;
204
- await J(R.value.chainId);
205
- let t = createWalletClient({
206
- account: E.value,
207
- transport: custom(O.value)
204
+ }, J = async () => {
205
+ if (!(!w.value || !E.value || !N.value || !R.value || !I.value)) try {
206
+ let e = N.value;
207
+ await K(I.value.chainId);
208
+ let i = createWalletClient({
209
+ account: w.value,
210
+ transport: custom(E.value)
208
211
  });
209
- if (!B.value.address) throw Error(s.value.subscriptionDoesNotSupportNative);
210
- await t.writeContract({
211
- address: B.value.address,
212
+ if (!R.value.address) throw Error(u.value.subscriptionDoesNotSupportNative);
213
+ let a = await i.writeContract({
214
+ address: R.value.address,
212
215
  abi: [{
213
216
  name: "approve",
214
217
  type: "function",
@@ -223,143 +226,142 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = {
223
226
  outputs: [{ type: "bool" }]
224
227
  }],
225
228
  functionName: "approve",
226
- args: [e.spenderAddress, parseUnits(e.approveAmount, B.value.decimals)],
229
+ args: [e.spenderAddress, parseUnits(e.approveAmount, R.value.decimals)],
227
230
  chain: null
228
- }), T.value = void 0;
231
+ });
232
+ console.log("授权交易哈希:", a), _.value = !1, g.value = "checking";
229
233
  } catch (e) {
230
- x.value = e instanceof Error ? e.message : s.value.walletPaymentFailed, o("error", e);
234
+ console.error("钱包授权失败:", e), y.value = e instanceof Error ? e.message : u.value.walletPaymentFailed, l("error", e), _.value = !1;
231
235
  }
232
- }, Z = async () => {
233
- if (!E.value) {
234
- x.value = s.value.pleaseConnectWallet, o("error", Error(s.value.pleaseConnectWallet));
236
+ }, Y = async () => {
237
+ if (!w.value) {
238
+ y.value = u.value.pleaseConnectWallet, l("error", Error(u.value.pleaseConnectWallet));
235
239
  return;
236
240
  }
237
- a.plain === "one-time" ? await Y() : a.plain === "subscription" && await X();
238
- }, Q = async () => {
239
- if (!(!C.value || !w.value)) try {
240
- x.value = void 0;
241
+ c.plain === "instant" ? await q() : c.plain === "subscription" && await J();
242
+ }, X = async () => {
243
+ if (!(!x.value || !S.value)) try {
244
+ y.value = void 0;
241
245
  let e = "";
242
- a.plain === "one-time" ? (F.value = await c.createOnetimePayment({
243
- paymentChain: C.value,
244
- paymentToken: w.value,
245
- orderId: a.orderId,
246
- amount: K.value
247
- }), e = `${C.value.toLowerCase()}:${F.value.receiveAddress}?amount=${F.value.paymentAmount}`, W(F.value.expireAt), $({ paymentId: F.value.paymentId })) : a.plain === "subscription" && (F.value = await c.createSubscriptionPayment({
248
- paymentChain: C.value,
249
- paymentToken: w.value,
250
- orderId: a.orderId,
251
- amountOfUsd: K.value,
252
- intervalDays: a.intervalDays || 30
253
- }), e = `${C.value.toLowerCase()}:${F.value.spenderAddress}?amount=${F.value.approveAmount}`, W(F.value.expireAt), $({ subscriptionId: F.value.subscriptionId })), f.value = "payment", T.value = await QRCode.toDataURL(e, {
246
+ c.plain === "instant" ? (N.value = await d.createOnetimePayment({
247
+ paymentChain: x.value,
248
+ paymentToken: S.value,
249
+ orderId: c.orderId,
250
+ amount: W.value
251
+ }), e = `${x.value.toLowerCase()}:${N.value.receiveAddress}?amount=${N.value.paymentAmount}`, H(N.value.expireAt), Q({ paymentId: N.value.paymentId })) : c.plain === "subscription" && (N.value = await d.createSubscriptionPayment({
252
+ paymentChain: x.value,
253
+ paymentToken: S.value,
254
+ orderId: c.orderId,
255
+ amountOfUsd: W.value,
256
+ intervalDays: c.intervalDays || 30
257
+ }), e = `${x.value.toLowerCase()}:${N.value.spenderAddress}?amount=${N.value.approveAmount}`, H(N.value.expireAt), Q({ subscriptionId: N.value.subscriptionId })), g.value = "payment", C.value = await QRCode.toDataURL(e, {
254
258
  width: 200,
255
259
  margin: 2,
256
260
  errorCorrectionLevel: "H"
257
261
  });
258
262
  } catch (e) {
259
- x.value = e instanceof Error ? e.message : s.value.createPaymentFailed, o("error", e);
263
+ y.value = e instanceof Error ? e.message : u.value.createPaymentFailed, l("error", e);
260
264
  }
261
- }, $ = (e) => {
262
- N.value?.unsubscribe();
263
- let t = () => defer(() => a.plain === "subscription" ? c.checkSubscriptionPaymentStatus(e) : c.checkOnetimePaymentStatus(e)).pipe(timeout(15e3), retry({ delay: 2e3 }));
264
- N.value = t().pipe(expand((e) => e.status === "pending" ? timer(2e3).pipe(switchMap(() => t())) : EMPTY), tap((e) => {
265
- (e.status === "paid" || e.status === "approved") && (f.value = "success", o("success", e)), e.status === "expired" && (f.value = "expired", o("expired", e)), e.status === "failed" && (f.value = "failed", o("failed", e));
265
+ }, Z = () => {
266
+ N.value && (y.value = void 0, g.value = "checking");
267
+ }, Q = (e) => {
268
+ j.value?.unsubscribe();
269
+ let i = () => defer(() => c.plain === "subscription" ? d.checkSubscriptionPaymentStatus(e) : d.checkOnetimePaymentStatus(e)).pipe(timeout(15e3), retry({ delay: 2e3 }));
270
+ j.value = i().pipe(expand((e) => e.status === "pending" ? timer(2e3).pipe(switchMap(() => i())) : EMPTY), tap((e) => {
271
+ (e.status === "paid" || e.status === "approved") && (g.value = "success", l("success", e)), e.status === "expired" && (g.value = "expired", l("expired", e)), e.status === "failed" && (g.value = "failed", l("failed", e));
266
272
  })).subscribe({
267
273
  error: (e) => {
268
- if (F.value) {
269
- let t = e instanceof Error ? e.message : s.value.checkPaymentStatusFailed;
270
- f.value = "error", x.value = t, o("error", e);
274
+ if (N.value) {
275
+ let i = e instanceof Error ? e.message : u.value.checkPaymentStatusFailed;
276
+ g.value = "error", y.value = i, l("error", e);
271
277
  }
272
278
  },
273
279
  complete: () => {
274
- N.value?.unsubscribe();
280
+ j.value?.unsubscribe();
275
281
  }
276
282
  });
277
- }, Rt = async () => {
278
- if (!F.value) return;
279
- let e = a.plain === "subscription" ? F.value.spenderAddress : F.value.receiveAddress;
283
+ }, $ = async () => {
284
+ if (!N.value) return;
285
+ let e = c.plain === "subscription" ? N.value.spenderAddress : N.value.receiveAddress;
280
286
  if (e) try {
281
- await navigator.clipboard.writeText(e), A.value = !0, setTimeout(() => {
282
- A.value = !1;
287
+ await navigator.clipboard.writeText(e), O.value = !0, setTimeout(() => {
288
+ O.value = !1;
283
289
  }, 2e3);
284
290
  } catch (e) {
285
291
  console.error("复制失败:", e);
286
292
  }
287
293
  };
288
- return watch(() => f.value, (e) => {
289
- e === "select" && S.value.length === 0 && q();
290
- }, { immediate: !0 }), watch(z, (e) => {
291
- e.length > 0 && !w.value && (w.value = e[0].symbol);
292
- }), watch(() => a.orderId, (e) => {
293
- e && $({ orderId: e });
294
+ return watch(L, (e) => {
295
+ e.length > 0 && (S.value = e[0].symbol);
294
296
  }), onMounted(() => {
295
- I();
297
+ P(), b.value.length || G(), c.orderId && Q({ orderId: c.orderId });
296
298
  }), onUnmounted(() => {
297
- N.value?.unsubscribe(), G();
298
- }), (e, n) => (openBlock(), createElementBlock("div", _hoisted_1$1, [f.value === "success" ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
299
- n[7] ||= createElementVNode("div", { class: "_cppay-state-icon" }, "✅", -1),
300
- createElementVNode("h3", _hoisted_3$1, toDisplayString(t.plain === "subscription" ? s.value.authorizationSuccess : s.value.paymentSuccess), 1),
301
- createElementVNode("p", _hoisted_4$1, toDisplayString(t.plain === "subscription" ? s.value.subscriptionActivated : s.value.transactionCompleted), 1)
302
- ])) : f.value === "expired" ? (openBlock(), createElementBlock("div", _hoisted_5, [
303
- n[8] ||= createElementVNode("div", { class: "_cppay-state-icon" }, "⏰", -1),
304
- createElementVNode("h3", _hoisted_6, toDisplayString(s.value.paymentExpired), 1),
299
+ j.value?.unsubscribe(), U();
300
+ }), (e, a) => (openBlock(), createElementBlock("div", _hoisted_1$1, [g.value === "success" ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
301
+ a[6] ||= createElementVNode("div", { class: "_cppay-state-icon" }, "✅", -1),
302
+ createElementVNode("h3", _hoisted_3$1, toDisplayString(i.plain === "subscription" ? u.value.authorizationSuccess : u.value.paymentSuccess), 1),
303
+ createElementVNode("p", _hoisted_4$1, toDisplayString(i.plain === "subscription" ? u.value.subscriptionActivated : u.value.transactionCompleted), 1)
304
+ ])) : g.value === "expired" ? (openBlock(), createElementBlock("div", _hoisted_5, [
305
+ a[7] ||= createElementVNode("div", { class: "_cppay-state-icon" }, "⏰", -1),
306
+ createElementVNode("h3", _hoisted_6, toDisplayString(u.value.paymentExpired), 1),
305
307
  createElementVNode("button", {
306
- onClick: n[0] ||= (e) => f.value = "select",
307
- disabled: y.value || b.value,
308
+ onClick: a[0] ||= (e) => g.value = "select",
309
+ disabled: _.value || v.value,
308
310
  class: "_cppay-btn _cppay-btn-text"
309
- }, toDisplayString(s.value.returnButton), 9, _hoisted_7)
310
- ])) : f.value === "error" ? (openBlock(), createElementBlock("div", _hoisted_8, [n[9] ||= createElementVNode("div", { class: "_cppay-state-icon" }, "❌", -1), createElementVNode("h3", _hoisted_9, toDisplayString(s.value.checking), 1)])) : f.value === "failed" ? (openBlock(), createElementBlock("div", _hoisted_10, [n[10] ||= createElementVNode("div", { class: "_cppay-state-icon" }, "❌", -1), createElementVNode("h3", _hoisted_11, toDisplayString(s.value.paymentFailed), 1)])) : f.value === "select" ? (openBlock(), createElementBlock("div", _hoisted_12, [
311
+ }, toDisplayString(u.value.returnButton), 9, _hoisted_7)
312
+ ])) : g.value === "error" ? (openBlock(), createElementBlock("div", _hoisted_8, [a[8] ||= createElementVNode("div", { class: "_cppay-state-icon" }, "❌", -1), createElementVNode("h3", _hoisted_9, toDisplayString(u.value.checking), 1)])) : g.value === "failed" ? (openBlock(), createElementBlock("div", _hoisted_10, [a[9] ||= createElementVNode("div", { class: "_cppay-state-icon" }, "❌", -1), createElementVNode("h3", _hoisted_11, toDisplayString(u.value.paymentFailed), 1)])) : g.value === "select" ? (openBlock(), createElementBlock("div", _hoisted_12, [
311
313
  renderSlot(e.$slots, "choose-top"),
312
- createElementVNode("div", _hoisted_13, [createElementVNode("label", _hoisted_14, toDisplayString(s.value.paymentNetwork), 1), createElementVNode("div", _hoisted_15, [(openBlock(!0), createElementBlock(Fragment, null, renderList(S.value, (e) => (openBlock(), createElementBlock("button", {
314
+ createElementVNode("div", _hoisted_13, [createElementVNode("label", _hoisted_14, toDisplayString(u.value.paymentNetwork), 1), createElementVNode("div", _hoisted_15, [(openBlock(!0), createElementBlock(Fragment, null, renderList(b.value, (e) => (openBlock(), createElementBlock("button", {
313
315
  key: e.chain,
314
- onClick: (t) => C.value = e.chain,
315
- class: normalizeClass(["_cppay-select-btn", { "_cppay-selected": C.value === e.chain }])
316
+ onClick: (i) => x.value = e.chain,
317
+ class: normalizeClass(["_cppay-select-btn", { "_cppay-selected": x.value === e.chain }])
316
318
  }, [e.icon ? (openBlock(), createElementBlock("img", {
317
319
  key: 0,
318
320
  src: e.icon,
319
321
  alt: e.chain
320
322
  }, null, 8, _hoisted_17)) : createCommentVNode("", !0), createElementVNode("span", null, toDisplayString(e.chain), 1)], 10, _hoisted_16))), 128))])]),
321
- createElementVNode("div", _hoisted_18, [createElementVNode("label", _hoisted_19, toDisplayString(s.value.paymentToken), 1), createElementVNode("div", _hoisted_20, [(openBlock(!0), createElementBlock(Fragment, null, renderList(z.value, (e) => (openBlock(), createElementBlock("button", {
323
+ createElementVNode("div", _hoisted_18, [createElementVNode("label", _hoisted_19, toDisplayString(u.value.paymentToken), 1), createElementVNode("div", _hoisted_20, [(openBlock(!0), createElementBlock(Fragment, null, renderList(L.value, (e) => (openBlock(), createElementBlock("button", {
322
324
  key: e.symbol,
323
- onClick: (t) => w.value = e.symbol,
324
- class: normalizeClass(["_cppay-select-btn", { "_cppay-selected": w.value === e.symbol }])
325
+ onClick: (i) => S.value = e.symbol,
326
+ class: normalizeClass(["_cppay-select-btn", { "_cppay-selected": S.value === e.symbol }])
325
327
  }, [e.icon ? (openBlock(), createElementBlock("img", {
326
328
  key: 0,
327
329
  src: e.icon,
328
330
  alt: e.symbol
329
331
  }, null, 8, _hoisted_22)) : createCommentVNode("", !0), createElementVNode("span", null, toDisplayString(e.symbol), 1)], 10, _hoisted_21))), 128))])]),
330
332
  renderSlot(e.$slots, "choose-bottom"),
331
- createElementVNode("div", _hoisted_23, [createElementVNode("div", _hoisted_24, [createElementVNode("div", _hoisted_25, [createElementVNode("span", _hoisted_26, toDisplayString(s.value.paymentAmount), 1), createElementVNode("div", _hoisted_27, [createElementVNode("div", _hoisted_28, toDisplayString(K.value ?? "-") + " " + toDisplayString(w.value ?? ""), 1), createElementVNode("div", _hoisted_29, "≈ $" + toDisplayString(t.amount), 1)])])])]),
332
- createElementVNode("div", _hoisted_30, [x.value ? (openBlock(), createElementBlock("div", {
333
+ createElementVNode("div", _hoisted_23, [createElementVNode("div", _hoisted_24, [createElementVNode("div", _hoisted_25, [createElementVNode("span", _hoisted_26, toDisplayString(u.value.paymentAmount), 1), createElementVNode("div", _hoisted_27, [createElementVNode("div", _hoisted_28, toDisplayString(W.value ?? "-") + " " + toDisplayString(S.value ?? ""), 1), createElementVNode("div", _hoisted_29, "≈ $" + toDisplayString(i.amount), 1)])])])]),
334
+ createElementVNode("div", _hoisted_30, [y.value ? (openBlock(), createElementBlock("div", {
333
335
  key: 0,
334
336
  class: "_cppay-error-tooltip-wrapper",
335
- onMouseenter: n[1] ||= (e) => j.value = !0,
336
- onMouseleave: n[2] ||= (e) => j.value = !1
337
- }, [createElementVNode("div", _hoisted_31, [n[11] ||= createElementVNode("svg", {
337
+ onMouseenter: a[1] ||= (e) => k.value = !0,
338
+ onMouseleave: a[2] ||= (e) => k.value = !1
339
+ }, [createElementVNode("div", _hoisted_31, [a[10] ||= createElementVNode("svg", {
338
340
  viewBox: "0 0 20 20",
339
341
  fill: "currentColor"
340
342
  }, [createElementVNode("path", {
341
343
  "fill-rule": "evenodd",
342
344
  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",
343
345
  "clip-rule": "evenodd"
344
- })], -1), createElementVNode("span", null, toDisplayString(x.value), 1)]), j.value ? (openBlock(), createElementBlock("div", _hoisted_32, toDisplayString(x.value), 1)) : createCommentVNode("", !0)], 32)) : createCommentVNode("", !0), createElementVNode("button", {
345
- onClick: Q,
346
- disabled: !C.value || !w.value || y.value,
346
+ })], -1), createElementVNode("span", null, toDisplayString(y.value), 1)]), k.value ? (openBlock(), createElementBlock("div", _hoisted_32, toDisplayString(y.value), 1)) : createCommentVNode("", !0)], 32)) : createCommentVNode("", !0), createElementVNode("button", {
347
+ onClick: X,
348
+ disabled: !x.value || !S.value || _.value,
347
349
  class: "_cppay-btn _cppay-btn-primary"
348
- }, toDisplayString(y.value ? s.value.processing : s.value.continuePayment), 9, _hoisted_33)])
350
+ }, toDisplayString(_.value ? u.value.processing : u.value.continuePayment), 9, _hoisted_33)])
349
351
  ])) : (openBlock(), createElementBlock("div", _hoisted_34, [
350
- createElementVNode("div", _hoisted_35, [createElementVNode("div", _hoisted_36, [T.value ? (openBlock(), createElementBlock("img", {
352
+ createElementVNode("div", _hoisted_35, [createElementVNode("div", _hoisted_36, [C.value ? (openBlock(), createElementBlock("img", {
351
353
  key: 0,
352
- src: T.value,
354
+ src: C.value,
353
355
  alt: "Payment QR Code",
354
356
  class: "_cppay-qr-image"
355
357
  }, null, 8, _hoisted_37)) : createCommentVNode("", !0)])]),
356
358
  createElementVNode("div", _hoisted_38, [
357
- B.value ? (openBlock(), createElementBlock("div", _hoisted_39, [createElementVNode("div", _hoisted_40, [createElementVNode("div", _hoisted_41, [createElementVNode("div", _hoisted_42, toDisplayString(t.plain === "subscription" ? s.value.authorizationAmount : s.value.paymentAmount), 1), createElementVNode("div", _hoisted_43, [F.value ? (openBlock(), createElementBlock("span", _hoisted_44, toDisplayString(t.plain === "subscription" ? `${H(F.value.approveAmount, V(B.value.symbol))} ${B.value.symbol}` : `${H(F.value.paymentAmount, V(B.value.symbol))} ${B.value.symbol}`), 1)) : createCommentVNode("", !0), createElementVNode("span", null, "≈ $" + toDisplayString(t.amount), 1)])])])])) : createCommentVNode("", !0),
358
- createElementVNode("div", _hoisted_45, [createElementVNode("div", _hoisted_46, [createElementVNode("div", _hoisted_47, [createElementVNode("span", null, toDisplayString(t.plain === "subscription" ? s.value.authorizationContractAddress : s.value.paymentAddress), 1), k.value ? (openBlock(), createElementBlock("span", _hoisted_48, "⏰ " + toDisplayString(k.value), 1)) : createCommentVNode("", !0)]), createElementVNode("div", _hoisted_49, [F.value ? (openBlock(), createElementBlock("code", _hoisted_50, toDisplayString(t.plain === "subscription" ? F.value.spenderAddress : F.value.receiveAddress), 1)) : createCommentVNode("", !0), createElementVNode("button", {
359
- onClick: Rt,
360
- class: normalizeClass(["_cppay-copy-btn", { "_cppay-copy-success": A.value }]),
361
- title: A.value ? s.value.copied : s.value.copyAddress
362
- }, [A.value ? (openBlock(), createElementBlock("svg", _hoisted_53, [...n[13] ||= [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_52, [...n[12] ||= [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", {
359
+ R.value ? (openBlock(), createElementBlock("div", _hoisted_39, [createElementVNode("div", _hoisted_40, [createElementVNode("div", _hoisted_41, [createElementVNode("div", _hoisted_42, toDisplayString(i.plain === "subscription" ? u.value.authorizationAmount : u.value.paymentAmount), 1), createElementVNode("div", _hoisted_43, [N.value ? (openBlock(), createElementBlock("span", _hoisted_44, toDisplayString(i.plain === "subscription" ? `${B(N.value.approveAmount, z(R.value.symbol))} ${R.value.symbol}` : `${B(N.value.paymentAmount, z(R.value.symbol))} ${R.value.symbol}`), 1)) : createCommentVNode("", !0), createElementVNode("span", null, "≈ $" + toDisplayString(i.amount), 1)])])])])) : createCommentVNode("", !0),
360
+ createElementVNode("div", _hoisted_45, [createElementVNode("div", _hoisted_46, [createElementVNode("div", _hoisted_47, [createElementVNode("span", null, toDisplayString(i.plain === "subscription" ? u.value.authorizationContractAddress : u.value.paymentAddress), 1), D.value ? (openBlock(), createElementBlock("span", _hoisted_48, "⏰ " + toDisplayString(D.value), 1)) : createCommentVNode("", !0)]), createElementVNode("div", _hoisted_49, [N.value ? (openBlock(), createElementBlock("code", _hoisted_50, toDisplayString(i.plain === "subscription" ? N.value.spenderAddress : N.value.receiveAddress), 1)) : createCommentVNode("", !0), createElementVNode("button", {
361
+ onClick: $,
362
+ class: normalizeClass(["_cppay-copy-btn", { "_cppay-copy-success": O.value }]),
363
+ title: O.value ? u.value.copied : u.value.copyAddress
364
+ }, [O.value ? (openBlock(), createElementBlock("svg", _hoisted_53, [...a[12] ||= [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_52, [...a[11] ||= [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", {
363
365
  x: "8",
364
366
  y: "2",
365
367
  width: "8",
@@ -367,31 +369,31 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = {
367
369
  rx: "1",
368
370
  ry: "1"
369
371
  }, null, -1)]]))], 10, _hoisted_51)])])]),
370
- t.plain === "subscription" ? (openBlock(), createElementBlock("div", _hoisted_54, [createElementVNode("div", _hoisted_55, toDisplayString(s.value.subscriptionNotice), 1), createElementVNode("div", _hoisted_56, toDisplayString(s.value.subscriptionNoticeMessage), 1)])) : createCommentVNode("", !0)
372
+ i.plain === "subscription" ? (openBlock(), createElementBlock("div", _hoisted_54, [createElementVNode("div", _hoisted_55, toDisplayString(u.value.subscriptionNotice), 1), createElementVNode("div", _hoisted_56, toDisplayString(u.value.subscriptionNoticeMessage), 1)])) : createCommentVNode("", !0)
371
373
  ]),
372
- x.value ? (openBlock(), createElementBlock("div", {
374
+ y.value ? (openBlock(), createElementBlock("div", {
373
375
  key: 0,
374
376
  class: "_cppay-error-tooltip-wrapper",
375
- onMouseenter: n[3] ||= (e) => j.value = !0,
376
- onMouseleave: n[4] ||= (e) => j.value = !1
377
- }, [createElementVNode("div", _hoisted_57, [n[14] ||= createElementVNode("svg", {
377
+ onMouseenter: a[3] ||= (e) => k.value = !0,
378
+ onMouseleave: a[4] ||= (e) => k.value = !1
379
+ }, [createElementVNode("div", _hoisted_57, [a[13] ||= createElementVNode("svg", {
378
380
  viewBox: "0 0 20 20",
379
381
  fill: "currentColor"
380
382
  }, [createElementVNode("path", {
381
383
  "fill-rule": "evenodd",
382
384
  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",
383
385
  "clip-rule": "evenodd"
384
- })], -1), createElementVNode("span", null, toDisplayString(x.value), 1)]), j.value ? (openBlock(), createElementBlock("div", _hoisted_58, toDisplayString(x.value), 1)) : createCommentVNode("", !0)], 32)) : createCommentVNode("", !0),
385
- b.value ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_59, [E.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createElementVNode("button", {
386
- onClick: Z,
387
- disabled: y.value,
386
+ })], -1), createElementVNode("span", null, toDisplayString(y.value), 1)]), k.value ? (openBlock(), createElementBlock("div", _hoisted_58, toDisplayString(y.value), 1)) : createCommentVNode("", !0)], 32)) : createCommentVNode("", !0),
387
+ v.value ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_59, [w.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createElementVNode("button", {
388
+ onClick: Y,
389
+ disabled: _.value,
388
390
  class: "_cppay-btn _cppay-btn-primary"
389
- }, toDisplayString(y.value ? t.plain === "subscription" ? s.value.authorizing : s.value.processing : (t.plain, s.value.walletPay)), 9, _hoisted_61), createElementVNode("button", {
390
- onClick: L,
391
- disabled: y.value,
391
+ }, toDisplayString(_.value ? i.plain === "subscription" ? u.value.authorizing : u.value.processing : (i.plain, u.value.walletPay)), 9, _hoisted_61), createElementVNode("button", {
392
+ onClick: F,
393
+ disabled: _.value,
392
394
  class: "_cppay-btn _cppay-wallet-address-btn",
393
- title: s.value.clickToModifyWallet
394
- }, [createElementVNode("span", _hoisted_63, toDisplayString(E.value.slice(0, 10)) + "..." + toDisplayString(E.value.slice(-4)), 1), n[15] ||= createElementVNode("svg", {
395
+ title: u.value.clickToModifyWallet
396
+ }, [createElementVNode("span", _hoisted_63, toDisplayString(w.value.slice(0, 10)) + "..." + toDisplayString(w.value.slice(-4)), 1), a[14] ||= createElementVNode("svg", {
395
397
  class: "_cppay-wallet-arrow",
396
398
  viewBox: "0 0 24 24",
397
399
  fill: "none",
@@ -399,21 +401,21 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = {
399
401
  "stroke-width": "2"
400
402
  }, [createElementVNode("polyline", { points: "6 9 12 15 18 9" })], -1)], 8, _hoisted_62)], 64)) : (openBlock(), createElementBlock("button", {
401
403
  key: 0,
402
- onClick: L,
403
- disabled: D.value,
404
+ onClick: F,
405
+ disabled: T.value,
404
406
  class: "_cppay-btn _cppay-btn-secondary _cppay-connect-wallet-btn"
405
- }, [createElementVNode("span", null, toDisplayString(D.value ? s.value.processing : s.value.connectWallet), 1)], 8, _hoisted_60))])),
407
+ }, [createElementVNode("span", null, toDisplayString(T.value ? u.value.processing : u.value.connectWallet), 1)], 8, _hoisted_60))])),
406
408
  createElementVNode("div", _hoisted_64, [createElementVNode("button", {
407
- onClick: n[5] ||= (e) => f.value = "payment",
408
- disabled: b.value,
409
+ onClick: Z,
410
+ disabled: v.value,
409
411
  class: "_cppay-btn _cppay-btn-primary"
410
- }, toDisplayString(b.value ? s.value.checking : s.value.completedPayment), 9, _hoisted_65)]),
411
- n[16] ||= createElementVNode("hr", { class: "_cppay-divider" }, null, -1),
412
+ }, toDisplayString(v.value ? u.value.checking : u.value.completedPayment), 9, _hoisted_65)]),
413
+ a[15] ||= createElementVNode("hr", { class: "_cppay-divider" }, null, -1),
412
414
  createElementVNode("div", _hoisted_66, [createElementVNode("button", {
413
- onClick: n[6] ||= (e) => f.value = "select",
414
- disabled: y.value || b.value,
415
+ onClick: a[5] ||= (e) => g.value = "select",
416
+ disabled: _.value || v.value,
415
417
  class: "_cppay-btn _cppay-btn-text"
416
- }, toDisplayString(s.value.changePaymentMethod), 9, _hoisted_67)])
418
+ }, toDisplayString(u.value.changePaymentMethod), 9, _hoisted_67)])
417
419
  ]))]));
418
420
  }
419
421
  }), _hoisted_1 = { class: "_cppay-dialog" }, _hoisted_2 = { class: "_cppay-header" }, _hoisted_3 = { class: "_cppay-title" }, _hoisted_4 = ["disabled"], PaymentDialog_default = /* @__PURE__ */ defineComponent({
@@ -423,9 +425,9 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = {
423
425
  apikey: {},
424
426
  orderId: {},
425
427
  amount: {},
426
- plain: { default: "one-time" },
427
- intervalDays: { default: 30 },
428
- locale: { default: "zh-CN" }
428
+ plain: {},
429
+ intervalDays: {},
430
+ locale: {}
429
431
  },
430
432
  emits: [
431
433
  "update:modelValue",
@@ -434,53 +436,43 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = {
434
436
  "failed",
435
437
  "error"
436
438
  ],
437
- setup(e, { emit: t }) {
438
- let n = e, i = t, a = computed(() => getLocaleMessages(n.locale)), s = ref("select"), c = ref(!1), l = ref(!1), u = ref();
439
- watch(() => s.value, (e) => {
440
- e === "success" && setTimeout(() => {
441
- _();
442
- }, 1e3);
443
- }), watch(() => n.modelValue, (e) => {
444
- e || (s.value = "select", u.value = void 0, c.value = !1, l.value = !1);
439
+ setup(e, { emit: i }) {
440
+ let a = e, s = i, c = computed(() => getLocaleMessages(a.locale)), u = ref("select"), d = computed(() => u.value !== "checking");
441
+ watch(() => a.modelValue, (e) => {
442
+ e || (u.value = "select");
445
443
  });
446
- let d = (e) => {
447
- s.value = e;
448
- }, p = (e) => {
449
- c.value = e;
450
- }, m = (e) => {
451
- l.value = e;
452
- }, g = (e) => {
444
+ let f = (e) => {
453
445
  u.value = e;
454
446
  };
455
447
  onMounted(() => {
456
448
  let e = (e) => {
457
- e.key === "Escape" && n.modelValue && !c.value && !l.value && _();
449
+ e.key === "Escape" && a.modelValue && !d.value && p();
458
450
  };
459
451
  return window.addEventListener("keydown", e), () => {
460
452
  window.removeEventListener("keydown", e);
461
453
  };
462
454
  });
463
- let _ = () => {
464
- c.value || l.value || i("update:modelValue", !1);
465
- }, v = () => {
466
- switch (s.value) {
467
- case "success": return a.value.paymentResult;
468
- case "expired": return a.value.paymentExpired;
469
- case "failed": return a.value.paymentFailed;
470
- case "error": return a.value.error;
471
- case "payment": return a.value.completePayment;
472
- default: return a.value.selectPaymentMethod;
455
+ let p = () => {
456
+ d.value && s("update:modelValue", !1);
457
+ }, m = () => {
458
+ switch (u.value) {
459
+ case "success": return c.value.paymentResult;
460
+ case "expired": return c.value.paymentExpired;
461
+ case "failed": return c.value.paymentFailed;
462
+ case "error": return c.value.error;
463
+ case "payment": return c.value.completePayment;
464
+ default: return c.value.selectPaymentMethod;
473
465
  }
474
466
  };
475
- return (t, n) => e.modelValue ? (openBlock(), createElementBlock("div", {
467
+ return (i, a) => e.modelValue ? (openBlock(), createElementBlock("div", {
476
468
  key: 0,
477
469
  class: "_cppay-overlay",
478
- onClick: n[4] ||= (e) => e.target === e.currentTarget && !c.value && !l.value && _()
479
- }, [createElementVNode("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("h2", _hoisted_3, toDisplayString(v()), 1), createElementVNode("button", {
480
- onClick: _,
481
- disabled: c.value || l.value,
470
+ onClick: a[4] ||= (e) => e.target === e.currentTarget && p()
471
+ }, [createElementVNode("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("h2", _hoisted_3, toDisplayString(m()), 1), createElementVNode("button", {
472
+ onClick: p,
473
+ disabled: !d.value,
482
474
  class: "_cppay-close-btn"
483
- }, [...n[5] ||= [createElementVNode("svg", {
475
+ }, [...a[5] ||= [createElementVNode("svg", {
484
476
  fill: "none",
485
477
  stroke: "currentColor",
486
478
  viewBox: "0 0 24 24"
@@ -489,24 +481,22 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = {
489
481
  "stroke-linejoin": "round",
490
482
  "stroke-width": "2",
491
483
  d: "M6 18L18 6M6 6l12 12"
492
- })], -1)]], 8, _hoisted_4)]), createVNode(PaymentContent_default, {
484
+ })], -1)]], 8, _hoisted_4)]), e.modelValue ? (openBlock(), createBlock(PaymentContent_default, {
485
+ key: 0,
493
486
  apikey: e.apikey,
494
487
  orderId: e.orderId,
495
488
  amount: e.amount,
496
489
  plain: e.plain,
497
490
  intervalDays: e.intervalDays,
498
491
  locale: e.locale,
499
- "onUpdate:paymentStep": d,
500
- "onUpdate:loading": p,
501
- "onUpdate:isCheckingPayment": m,
502
- "onUpdate:error": g,
503
- onSuccess: n[0] ||= (e) => i("success", e),
504
- onExpired: n[1] ||= (e) => i("expired", e),
505
- onFailed: n[2] ||= (e) => i("failed", e),
506
- onError: n[3] ||= (e) => i("error", e)
492
+ "onUpdate:paymentStep": f,
493
+ onSuccess: a[0] ||= (e) => s("success", e),
494
+ onExpired: a[1] ||= (e) => s("expired", e),
495
+ onFailed: a[2] ||= (e) => s("failed", e),
496
+ onError: a[3] ||= (e) => s("error", e)
507
497
  }, {
508
- "choose-top": withCtx(() => [renderSlot(t.$slots, "choose-top")]),
509
- "choose-bottom": withCtx(() => [renderSlot(t.$slots, "choose-bottom")]),
498
+ "choose-top": withCtx(() => [renderSlot(i.$slots, "choose-top")]),
499
+ "choose-bottom": withCtx(() => [renderSlot(i.$slots, "choose-bottom")]),
510
500
  _: 3
511
501
  }, 8, [
512
502
  "apikey",
@@ -515,7 +505,7 @@ var _hoisted_1$1 = { class: "_cppay-content" }, _hoisted_2$1 = {
515
505
  "plain",
516
506
  "intervalDays",
517
507
  "locale"
518
- ])])])) : createCommentVNode("", !0);
508
+ ])) : createCommentVNode("", !0)])])) : createCommentVNode("", !0);
519
509
  }
520
510
  }), cppayState = ref({
521
511
  apikey: "",
@@ -540,13 +530,13 @@ var handleClose = () => {
540
530
  }, handleError = (e) => {
541
531
  cppayState.value.options?.onError?.(e);
542
532
  };
543
- const CppayPlugin = { install(e, t) {
544
- if (!t?.apikey) throw Error("Cppay plugin requires an apikey");
545
- cppayState.value.apikey = t.apikey, e.config.globalProperties.$showPayment = showPayment, e.config.globalProperties.$closePayment = closePayment;
546
- let n = (e) => {
533
+ const CppayPlugin = { install(e, i) {
534
+ if (!i?.apikey) throw Error("Cppay plugin requires an apikey");
535
+ cppayState.value.apikey = i.apikey, e.config.globalProperties.$showPayment = showPayment, e.config.globalProperties.$closePayment = closePayment;
536
+ let a = (e) => {
547
537
  e.key === "Escape" && cppayState.value.open && handleClose();
548
- }, r = document.createElement("div");
549
- document.body.appendChild(r), createApp({ setup() {
538
+ }, o = document.createElement("div");
539
+ document.body.appendChild(o), createApp({ setup() {
550
540
  return () => cppayState.value.options ? h(PaymentDialog_default, {
551
541
  modelValue: cppayState.value.open,
552
542
  "onUpdate:modelValue": (e) => {
@@ -562,8 +552,8 @@ const CppayPlugin = { install(e, t) {
562
552
  onFailed: handleFailed,
563
553
  onError: handleError
564
554
  }) : null;
565
- } }).mount(r), cppayState.value.open && document.addEventListener("keydown", n), e.config.globalProperties.$watchEffect?.(() => {
566
- cppayState.value.open ? document.addEventListener("keydown", n) : document.removeEventListener("keydown", n);
555
+ } }).mount(o), cppayState.value.open && document.addEventListener("keydown", a), e.config.globalProperties.$watchEffect?.(() => {
556
+ cppayState.value.open ? document.addEventListener("keydown", a) : document.removeEventListener("keydown", a);
567
557
  });
568
558
  } }, useCppayPayment = () => {
569
559
  if (!cppayState.value.apikey) throw Error("useCppayPayment must be used after installing CppayPlugin");