cppay-sdk 0.0.2-beta.41 → 0.0.2-beta.43
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/README.md +630 -2
- package/dist/react.cjs +1 -1
- package/dist/react.js +354 -281
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +319 -246
- package/package.json +1 -1
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(
|
|
71
|
-
let
|
|
72
|
-
typeof window < "u" && !
|
|
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
|
-
}),
|
|
94
|
-
e.isConnected ?
|
|
95
|
-
}),
|
|
96
|
-
|
|
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(
|
|
100
|
-
|
|
99
|
+
watch(f, (e) => {
|
|
100
|
+
o("update:paymentStep", e);
|
|
101
101
|
});
|
|
102
|
-
let
|
|
102
|
+
let N = async () => {
|
|
103
103
|
try {
|
|
104
|
-
|
|
104
|
+
S.value = !0, g.value = void 0, D.value && await D.value.open();
|
|
105
105
|
} catch (e) {
|
|
106
|
-
|
|
106
|
+
g.value = e instanceof Error ? e.message : c.value.walletConnectionFailed, o("error", e);
|
|
107
107
|
} finally {
|
|
108
|
-
|
|
108
|
+
S.value = !1;
|
|
109
109
|
}
|
|
110
|
-
},
|
|
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,
|
|
119
|
-
let
|
|
120
|
-
return isNaN(
|
|
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
|
-
|
|
123
|
-
let
|
|
124
|
-
|
|
125
|
-
|
|
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
|
|
133
|
-
|
|
132
|
+
let t = e - Math.floor(Date.now() / 1e3);
|
|
133
|
+
w.value = z(t), t <= 0 && V();
|
|
134
134
|
};
|
|
135
|
-
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
},
|
|
139
|
-
if (!
|
|
140
|
-
let e = parseFloat(
|
|
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
|
|
143
|
-
return
|
|
144
|
-
}),
|
|
142
|
+
let t = L(y.value);
|
|
143
|
+
return R((parseFloat(a.amount) / e).toFixed(t), t);
|
|
144
|
+
}), U = async () => {
|
|
145
145
|
try {
|
|
146
|
-
|
|
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
|
-
|
|
148
|
+
g.value = e instanceof Error ? e.message : c.value.loadPaymentNetworkFailed, o("error", e);
|
|
149
149
|
} finally {
|
|
150
|
-
|
|
150
|
+
p.value = !1;
|
|
151
151
|
}
|
|
152
|
-
},
|
|
153
|
-
if (
|
|
154
|
-
await
|
|
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(
|
|
159
|
+
throw e.code === 4902 ? Error(c.value.pleaseAddNetwork) : e;
|
|
160
160
|
}
|
|
161
|
-
},
|
|
162
|
-
if (!(!
|
|
163
|
-
|
|
164
|
-
let e =
|
|
165
|
-
await
|
|
166
|
-
let
|
|
167
|
-
account:
|
|
168
|
-
transport: custom(
|
|
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 (
|
|
171
|
-
let
|
|
172
|
-
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,
|
|
187
|
+
args: [e.receiveAddress, parseUnits(e.paymentAmount, I.value.decimals)],
|
|
188
188
|
chain: null
|
|
189
189
|
});
|
|
190
|
-
console.log("转账交易哈希:",
|
|
190
|
+
console.log("转账交易哈希:", n), j.value = n;
|
|
191
191
|
} else {
|
|
192
|
-
let
|
|
192
|
+
let n = await t.sendTransaction({
|
|
193
193
|
to: e.receiveAddress,
|
|
194
|
-
value: parseUnits(e.paymentAmount,
|
|
194
|
+
value: parseUnits(e.paymentAmount, I.value.decimals),
|
|
195
195
|
chain: null
|
|
196
196
|
});
|
|
197
|
-
console.log("转账交易哈希:",
|
|
197
|
+
console.log("转账交易哈希:", n), j.value = n;
|
|
198
198
|
}
|
|
199
|
-
|
|
199
|
+
p.value = !1, f.value = "checking", X({ paymentId: e.paymentId });
|
|
200
200
|
} catch (e) {
|
|
201
|
-
console.error("钱包支付失败:", e),
|
|
201
|
+
console.error("钱包支付失败:", e), g.value = e instanceof Error ? e.message : c.value.walletPaymentFailed, o("error", e), p.value = !1;
|
|
202
202
|
}
|
|
203
|
-
},
|
|
204
|
-
if (!(!
|
|
205
|
-
let e =
|
|
206
|
-
await
|
|
207
|
-
let
|
|
208
|
-
account:
|
|
209
|
-
transport: custom(
|
|
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 (!
|
|
212
|
-
let
|
|
213
|
-
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,
|
|
228
|
+
args: [e.spenderAddress, parseUnits(e.approveAmount, I.value.decimals)],
|
|
229
229
|
chain: null
|
|
230
230
|
});
|
|
231
|
-
console.log("授权交易哈希:",
|
|
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),
|
|
233
|
+
console.error("钱包授权失败:", e), g.value = e instanceof Error ? e.message : c.value.walletPaymentFailed, o("error", e), p.value = !1;
|
|
234
234
|
}
|
|
235
|
-
},
|
|
236
|
-
if (!
|
|
237
|
-
|
|
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
|
-
|
|
241
|
-
},
|
|
242
|
-
if (!(!
|
|
243
|
-
|
|
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 (
|
|
246
|
-
paymentChain:
|
|
247
|
-
paymentToken:
|
|
248
|
-
orderId:
|
|
249
|
-
amount:
|
|
250
|
-
remark:
|
|
251
|
-
}), e = `${
|
|
252
|
-
else if (
|
|
253
|
-
if (!
|
|
254
|
-
|
|
255
|
-
paymentChain:
|
|
256
|
-
paymentToken:
|
|
257
|
-
orderId:
|
|
258
|
-
amountOfUsd:
|
|
259
|
-
intervalDays:
|
|
260
|
-
}), e = `${
|
|
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
|
-
|
|
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
|
-
|
|
268
|
+
g.value = e instanceof Error ? e.message : c.value.createPaymentFailed, o("error", e);
|
|
269
269
|
}
|
|
270
|
-
},
|
|
271
|
-
|
|
272
|
-
},
|
|
273
|
-
|
|
274
|
-
let
|
|
275
|
-
|
|
276
|
-
|
|
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 (
|
|
280
|
-
let
|
|
281
|
-
|
|
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
|
-
|
|
331
|
+
O.value?.unsubscribe();
|
|
286
332
|
}
|
|
287
333
|
});
|
|
288
|
-
},
|
|
289
|
-
if (!
|
|
290
|
-
let e =
|
|
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),
|
|
293
|
-
|
|
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(
|
|
300
|
-
e.length > 0 && (
|
|
345
|
+
watch(F, (e) => {
|
|
346
|
+
e.length > 0 && (y.value = e[0].symbol);
|
|
301
347
|
}), onMounted(() => {
|
|
302
|
-
|
|
348
|
+
M(), _.value.length || U(), $();
|
|
303
349
|
}), onUnmounted(() => {
|
|
304
|
-
|
|
350
|
+
O.value?.unsubscribe(), V();
|
|
305
351
|
});
|
|
306
|
-
let
|
|
307
|
-
if (
|
|
308
|
-
await navigator.clipboard.writeText(
|
|
309
|
-
let e =
|
|
310
|
-
|
|
311
|
-
|
|
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,
|
|
318
|
-
|
|
319
|
-
createElementVNode("h3", _hoisted_3$1, toDisplayString(
|
|
320
|
-
|
|
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:
|
|
324
|
-
}, [...
|
|
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
|
-
|
|
338
|
-
createElementVNode("div", _hoisted_10, [createElementVNode("span", _hoisted_11, toDisplayString(
|
|
339
|
-
createElementVNode("div", _hoisted_13, [createElementVNode("span", _hoisted_14, toDisplayString(
|
|
340
|
-
createElementVNode("div", _hoisted_16, [createElementVNode("span", _hoisted_17, toDisplayString(
|
|
341
|
-
createElementVNode("div", _hoisted_19, [createElementVNode("span", _hoisted_20, toDisplayString(
|
|
342
|
-
|
|
343
|
-
createElementVNode("div", _hoisted_25, [createElementVNode("span", _hoisted_26, toDisplayString(
|
|
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
|
-
])]) :
|
|
346
|
-
|
|
347
|
-
createElementVNode("h3", _hoisted_29, toDisplayString(
|
|
348
|
-
createElementVNode("p", _hoisted_30, toDisplayString(
|
|
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:
|
|
351
|
-
|
|
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(
|
|
354
|
-
])]) :
|
|
355
|
-
|
|
356
|
-
createElementVNode("h3", _hoisted_33, toDisplayString(
|
|
357
|
-
createElementVNode("p", _hoisted_34, toDisplayString(
|
|
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:
|
|
360
|
-
|
|
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(
|
|
363
|
-
])]) :
|
|
364
|
-
|
|
365
|
-
createElementVNode("h3", _hoisted_37, toDisplayString(
|
|
366
|
-
createElementVNode("p", _hoisted_38, toDisplayString(
|
|
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:
|
|
369
|
-
|
|
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(
|
|
372
|
-
])]) :
|
|
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(
|
|
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: (
|
|
377
|
-
class: normalizeClass(["_cppay-select-btn", { "_cppay-selected":
|
|
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(
|
|
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: (
|
|
386
|
-
class: normalizeClass(["_cppay-select-btn", { "_cppay-selected":
|
|
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(
|
|
394
|
-
createElementVNode("div", _hoisted_58, [
|
|
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:
|
|
398
|
-
onMouseleave:
|
|
399
|
-
}, [createElementVNode("div", _hoisted_59, [
|
|
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(
|
|
407
|
-
onClick:
|
|
408
|
-
disabled: !
|
|
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(
|
|
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, [
|
|
483
|
+
createElementVNode("div", _hoisted_63, [createElementVNode("div", _hoisted_64, [b.value ? (openBlock(), createElementBlock("img", {
|
|
413
484
|
key: 0,
|
|
414
|
-
src:
|
|
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
|
-
|
|
420
|
-
createElementVNode("div", _hoisted_73, [createElementVNode("div", _hoisted_74, [createElementVNode("div", _hoisted_75, [createElementVNode("span", null, toDisplayString(
|
|
421
|
-
onClick:
|
|
422
|
-
class: normalizeClass(["_cppay-copy-btn", { "_cppay-copy-success":
|
|
423
|
-
title:
|
|
424
|
-
}, [
|
|
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
|
-
|
|
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
|
-
|
|
505
|
+
g.value ? (openBlock(), createElementBlock("div", {
|
|
435
506
|
key: 0,
|
|
436
507
|
class: "_cppay-error-tooltip-wrapper",
|
|
437
|
-
onMouseenter:
|
|
438
|
-
onMouseleave:
|
|
439
|
-
}, [createElementVNode("div", _hoisted_85, [
|
|
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(
|
|
447
|
-
|
|
448
|
-
onClick:
|
|
449
|
-
disabled:
|
|
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(
|
|
452
|
-
onClick:
|
|
453
|
-
disabled:
|
|
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:
|
|
456
|
-
}, [createElementVNode("span", _hoisted_91, toDisplayString(
|
|
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:
|
|
465
|
-
disabled:
|
|
535
|
+
onClick: N,
|
|
536
|
+
disabled: S.value,
|
|
466
537
|
class: "_cppay-btn _cppay-btn-secondary _cppay-connect-wallet-btn"
|
|
467
|
-
}, [createElementVNode("span", null, toDisplayString(
|
|
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:
|
|
470
|
-
disabled:
|
|
540
|
+
onClick: Y,
|
|
541
|
+
disabled: m.value,
|
|
471
542
|
class: "_cppay-btn _cppay-btn-primary"
|
|
472
|
-
}, [
|
|
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(
|
|
490
|
-
|
|
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:
|
|
493
|
-
|
|
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(
|
|
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:
|
|
518
|
-
let
|
|
519
|
-
watch(() =>
|
|
520
|
-
e || (
|
|
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
|
|
523
|
-
|
|
595
|
+
let l = (e) => {
|
|
596
|
+
s.value = e;
|
|
524
597
|
};
|
|
525
598
|
onMounted(() => {
|
|
526
599
|
let e = (e) => {
|
|
527
|
-
e.key === "Escape" &&
|
|
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
|
|
534
|
-
|
|
535
|
-
},
|
|
536
|
-
switch (
|
|
537
|
-
case "success": return
|
|
538
|
-
case "expired": return
|
|
539
|
-
case "failed": return
|
|
540
|
-
case "error": return
|
|
541
|
-
case "payment": return
|
|
542
|
-
default: return
|
|
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 (
|
|
618
|
+
return (t, n) => e.modelValue ? (openBlock(), createElementBlock("div", {
|
|
546
619
|
key: 0,
|
|
547
620
|
class: "_cppay-overlay",
|
|
548
|
-
onClick:
|
|
549
|
-
}, [createElementVNode("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("h2", _hoisted_3, toDisplayString(
|
|
550
|
-
onClick:
|
|
551
|
-
disabled: !
|
|
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
|
-
}, [...
|
|
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":
|
|
572
|
-
onSuccess:
|
|
573
|
-
onExpired:
|
|
574
|
-
onFailed:
|
|
575
|
-
onError:
|
|
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(
|
|
578
|
-
"choose-bottom": withCtx(() => [renderSlot(
|
|
579
|
-
success: withCtx(() => [renderSlot(
|
|
580
|
-
failed: withCtx(() => [renderSlot(
|
|
581
|
-
error: withCtx(() => [renderSlot(
|
|
582
|
-
expired: withCtx(() => [renderSlot(
|
|
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
|
|
617
|
-
document.body.appendChild(
|
|
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(
|
|
702
|
+
} }).mount(t);
|
|
630
703
|
} }, useCppayPayment = () => ({
|
|
631
704
|
showPayment,
|
|
632
705
|
closePayment
|