@vue-stripe/vue-stripe 5.0.0 → 5.1.1
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 +36 -9
- package/dist/cjs/index.js +1 -1
- package/dist/es/index.js +582 -535
- package/dist/types/components/VueStripeCheckout.vue.d.ts +34 -10
- package/dist/types/components/VueStripeCheckout.vue.d.ts.map +1 -1
- package/dist/types/composables/useStripeCheckout.d.ts +65 -2
- package/dist/types/composables/useStripeCheckout.d.ts.map +1 -1
- package/dist/types/tsconfig.build.tsbuildinfo +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/vue-stripe.css +1 -1
- package/package.json +3 -3
package/dist/es/index.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import { loadStripe as B } from "@stripe/stripe-js";
|
|
2
|
-
import { loadStripe as
|
|
3
|
-
import { defineComponent as
|
|
4
|
-
const R = Symbol("stripe"),
|
|
5
|
-
class
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
2
|
+
import { loadStripe as He } from "@stripe/stripe-js";
|
|
3
|
+
import { defineComponent as V, ref as v, onMounted as $, provide as F, createElementBlock as f, unref as m, openBlock as h, renderSlot as S, createElementVNode as g, toDisplayString as x, inject as _, watch as E, onUnmounted as P, createCommentVNode as U, normalizeClass as M, h as T, onBeforeUnmount as X, readonly as b, useSlots as G, computed as H, Fragment as N, createTextVNode as q } from "vue-demi";
|
|
4
|
+
const R = Symbol("stripe"), w = Symbol("stripe-elements");
|
|
5
|
+
class y extends Error {
|
|
6
|
+
constructor(n) {
|
|
7
|
+
super(n), this.name = "VueStripeProviderError";
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
class k extends Error {
|
|
11
|
-
constructor(
|
|
12
|
-
super(
|
|
11
|
+
constructor(n) {
|
|
12
|
+
super(n), this.name = "VueStripeElementsError";
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
class
|
|
16
|
-
constructor(
|
|
17
|
-
super(
|
|
15
|
+
class J extends Error {
|
|
16
|
+
constructor(n) {
|
|
17
|
+
super(n), this.name = "VueStripeLoadError";
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
switch (
|
|
20
|
+
function Te(a, n) {
|
|
21
|
+
switch (a) {
|
|
22
22
|
case "provider":
|
|
23
|
-
return new
|
|
23
|
+
return new y(n);
|
|
24
24
|
case "elements":
|
|
25
|
-
return new k(
|
|
25
|
+
return new k(n);
|
|
26
26
|
case "load":
|
|
27
|
-
return new
|
|
27
|
+
return new J(n);
|
|
28
28
|
default:
|
|
29
|
-
return new Error(
|
|
29
|
+
return new Error(n);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
const
|
|
32
|
+
const D = {
|
|
33
33
|
name: "vue-stripe",
|
|
34
|
-
version: "5.
|
|
34
|
+
version: "5.1.1",
|
|
35
35
|
url: "https://vuestripe.com",
|
|
36
36
|
partner_id: "pp_partner_IqtOXpBSuz0IE2"
|
|
37
|
-
},
|
|
37
|
+
}, Q = {
|
|
38
38
|
key: 0,
|
|
39
39
|
class: "vue-stripe-error"
|
|
40
|
-
},
|
|
40
|
+
}, Y = { class: "vue-stripe-error-message" }, Z = {
|
|
41
41
|
key: 1,
|
|
42
42
|
class: "vue-stripe-loading"
|
|
43
|
-
},
|
|
43
|
+
}, ee = { key: 2 }, te = /* @__PURE__ */ V({
|
|
44
44
|
__name: "VueStripeProvider",
|
|
45
45
|
props: {
|
|
46
46
|
publishableKey: {},
|
|
@@ -51,59 +51,59 @@ const j = {
|
|
|
51
51
|
options: {}
|
|
52
52
|
},
|
|
53
53
|
emits: ["load", "error"],
|
|
54
|
-
setup(
|
|
55
|
-
const
|
|
56
|
-
if (!
|
|
57
|
-
throw new
|
|
58
|
-
const
|
|
59
|
-
publishableKey:
|
|
60
|
-
stripeAccount:
|
|
61
|
-
apiVersion:
|
|
62
|
-
locale:
|
|
63
|
-
},
|
|
54
|
+
setup(a, { emit: n }) {
|
|
55
|
+
const u = a, o = n, s = v(null), l = v(!0), e = v(null), t = u.publishableKey || u.stripeKey;
|
|
56
|
+
if (!t)
|
|
57
|
+
throw new y("publishableKey or stripeKey is required");
|
|
58
|
+
const i = {
|
|
59
|
+
publishableKey: t,
|
|
60
|
+
stripeAccount: u.stripeAccount || u.options?.stripeAccount,
|
|
61
|
+
apiVersion: u.apiVersion || u.options?.apiVersion,
|
|
62
|
+
locale: u.locale || u.options?.locale
|
|
63
|
+
}, d = async () => {
|
|
64
64
|
try {
|
|
65
|
-
|
|
66
|
-
const c = {}, r =
|
|
67
|
-
if (r && (c.stripeAccount = r),
|
|
68
|
-
throw new
|
|
69
|
-
|
|
65
|
+
l.value = !0, e.value = null;
|
|
66
|
+
const c = {}, r = u.stripeAccount || u.options?.stripeAccount, p = u.apiVersion || u.options?.apiVersion, C = u.locale || u.options?.locale;
|
|
67
|
+
if (r && (c.stripeAccount = r), p && (c.apiVersion = p), C && (c.locale = C), s.value = await B(t, c), !s.value)
|
|
68
|
+
throw new y("Failed to initialize Stripe");
|
|
69
|
+
s.value.registerAppInfo(D), o("load", s.value);
|
|
70
70
|
} catch (c) {
|
|
71
71
|
const r = c instanceof Error ? c.message : "Failed to load Stripe";
|
|
72
|
-
|
|
72
|
+
e.value = r, console.error("[Vue Stripe] Initialization error:", r), o("error", c instanceof Error ? c : new Error(r));
|
|
73
73
|
} finally {
|
|
74
|
-
|
|
74
|
+
l.value = !1;
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
}),
|
|
80
|
-
stripe:
|
|
81
|
-
loading:
|
|
82
|
-
error:
|
|
83
|
-
}), (c, r) =>
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
return $(() => {
|
|
78
|
+
d();
|
|
79
|
+
}), F("vue-stripe-config", i), F(R, {
|
|
80
|
+
stripe: s,
|
|
81
|
+
loading: l,
|
|
82
|
+
error: e
|
|
83
|
+
}), (c, r) => m(e) ? (h(), f("div", Q, [
|
|
84
|
+
S(c.$slots, "error", { error: m(e) }, () => [
|
|
85
|
+
g("div", Y, x(m(e)), 1)
|
|
86
86
|
], !0)
|
|
87
|
-
])) :
|
|
88
|
-
|
|
89
|
-
r[0] || (r[0] =
|
|
87
|
+
])) : m(l) ? (h(), f("div", Z, [
|
|
88
|
+
S(c.$slots, "loading", {}, () => [
|
|
89
|
+
r[0] || (r[0] = g("div", { class: "vue-stripe-loading-message" }, " Loading Stripe... ", -1))
|
|
90
90
|
], !0)
|
|
91
|
-
])) : (h(), f("div",
|
|
92
|
-
|
|
91
|
+
])) : (h(), f("div", ee, [
|
|
92
|
+
S(c.$slots, "default", {}, void 0, !0)
|
|
93
93
|
]));
|
|
94
94
|
}
|
|
95
|
-
}),
|
|
96
|
-
const
|
|
97
|
-
for (const [
|
|
98
|
-
o
|
|
99
|
-
return
|
|
100
|
-
},
|
|
95
|
+
}), I = (a, n) => {
|
|
96
|
+
const u = a.__vccOpts || a;
|
|
97
|
+
for (const [o, s] of n)
|
|
98
|
+
u[o] = s;
|
|
99
|
+
return u;
|
|
100
|
+
}, Ue = /* @__PURE__ */ I(te, [["__scopeId", "data-v-ce126b08"]]), re = {
|
|
101
101
|
key: 0,
|
|
102
102
|
class: "vue-stripe-elements-error"
|
|
103
|
-
},
|
|
103
|
+
}, se = { class: "vue-stripe-error-message" }, ne = {
|
|
104
104
|
key: 1,
|
|
105
105
|
class: "vue-stripe-elements-loading"
|
|
106
|
-
},
|
|
106
|
+
}, ae = { key: 2 }, oe = /* @__PURE__ */ V({
|
|
107
107
|
__name: "VueStripeElements",
|
|
108
108
|
props: {
|
|
109
109
|
clientSecret: {},
|
|
@@ -115,323 +115,323 @@ const j = {
|
|
|
115
115
|
paymentMethodTypes: {},
|
|
116
116
|
options: {}
|
|
117
117
|
},
|
|
118
|
-
setup(
|
|
119
|
-
const
|
|
120
|
-
if (!
|
|
121
|
-
throw new
|
|
118
|
+
setup(a) {
|
|
119
|
+
const n = a, u = _(R);
|
|
120
|
+
if (!u)
|
|
121
|
+
throw new y(
|
|
122
122
|
"VueStripeElements must be used within VueStripeProvider"
|
|
123
123
|
);
|
|
124
|
-
const
|
|
125
|
-
if (!
|
|
126
|
-
|
|
124
|
+
const o = v(null), s = v(!0), l = v(null), e = () => {
|
|
125
|
+
if (!u.stripe.value) {
|
|
126
|
+
l.value = "Stripe instance not available", s.value = !1;
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
129
|
try {
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
...
|
|
130
|
+
l.value = null, s.value = !0;
|
|
131
|
+
const t = {
|
|
132
|
+
...n.options
|
|
133
133
|
};
|
|
134
|
-
|
|
135
|
-
} catch (
|
|
136
|
-
const
|
|
137
|
-
|
|
134
|
+
n.clientSecret && (t.clientSecret = n.clientSecret), n.mode && (t.mode = n.mode), n.currency && (t.currency = n.currency), n.amount !== void 0 && (t.amount = n.amount), n.setupFutureUsage && (t.setupFutureUsage = n.setupFutureUsage), n.captureMethod && (t.captureMethod = n.captureMethod), n.paymentMethodTypes && (t.paymentMethodTypes = n.paymentMethodTypes), o.value = u.stripe.value.elements(t), s.value = !1;
|
|
135
|
+
} catch (t) {
|
|
136
|
+
const i = t instanceof Error ? t.message : "Failed to create elements";
|
|
137
|
+
l.value = i, s.value = !1, console.error("[Vue Stripe] Elements creation error:", i);
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
return E(
|
|
141
|
-
() =>
|
|
142
|
-
(
|
|
143
|
-
|
|
141
|
+
() => u.stripe.value,
|
|
142
|
+
(t) => {
|
|
143
|
+
t && !o.value && e();
|
|
144
144
|
},
|
|
145
145
|
{ immediate: !0 }
|
|
146
146
|
), E(
|
|
147
|
-
() =>
|
|
147
|
+
() => n.clientSecret,
|
|
148
148
|
() => {
|
|
149
|
-
|
|
149
|
+
u.stripe.value && e();
|
|
150
150
|
}
|
|
151
151
|
), E(
|
|
152
|
-
() => [
|
|
152
|
+
() => [n.mode, n.currency, n.amount, n.setupFutureUsage],
|
|
153
153
|
() => {
|
|
154
|
-
|
|
154
|
+
u.stripe.value && e();
|
|
155
155
|
}
|
|
156
|
-
),
|
|
157
|
-
|
|
158
|
-
}),
|
|
159
|
-
elements:
|
|
160
|
-
loading:
|
|
161
|
-
error:
|
|
162
|
-
}), (
|
|
163
|
-
|
|
164
|
-
|
|
156
|
+
), $(() => {
|
|
157
|
+
u.stripe.value && !o.value && e();
|
|
158
|
+
}), F(w, {
|
|
159
|
+
elements: o,
|
|
160
|
+
loading: s,
|
|
161
|
+
error: l
|
|
162
|
+
}), (t, i) => m(l) ? (h(), f("div", re, [
|
|
163
|
+
S(t.$slots, "error", { error: m(l) }, () => [
|
|
164
|
+
g("div", se, x(m(l)), 1)
|
|
165
165
|
], !0)
|
|
166
|
-
])) :
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
])) : m(s) ? (h(), f("div", ne, [
|
|
167
|
+
S(t.$slots, "loading", {}, () => [
|
|
168
|
+
i[0] || (i[0] = g("div", { class: "vue-stripe-loading-message" }, " Initializing Elements... ", -1))
|
|
169
169
|
], !0)
|
|
170
|
-
])) : (h(), f("div",
|
|
171
|
-
|
|
170
|
+
])) : (h(), f("div", ae, [
|
|
171
|
+
S(t.$slots, "default", {}, void 0, !0)
|
|
172
172
|
]));
|
|
173
173
|
}
|
|
174
|
-
}),
|
|
174
|
+
}), Pe = /* @__PURE__ */ I(oe, [["__scopeId", "data-v-478abfa3"]]), le = { class: "vue-stripe-payment-element" }, ie = {
|
|
175
175
|
key: 0,
|
|
176
176
|
class: "vue-stripe-payment-element-error"
|
|
177
|
-
},
|
|
177
|
+
}, ue = { class: "vue-stripe-error-message" }, ce = {
|
|
178
178
|
key: 1,
|
|
179
179
|
class: "vue-stripe-payment-element-loader"
|
|
180
|
-
},
|
|
180
|
+
}, de = /* @__PURE__ */ V({
|
|
181
181
|
__name: "VueStripePaymentElement",
|
|
182
182
|
props: {
|
|
183
183
|
options: {}
|
|
184
184
|
},
|
|
185
185
|
emits: ["ready", "change", "focus", "blur", "escape", "loaderstart", "loaderstop"],
|
|
186
|
-
setup(
|
|
187
|
-
const
|
|
188
|
-
if (!
|
|
186
|
+
setup(a, { expose: n, emit: u }) {
|
|
187
|
+
const o = a, s = u, l = v(), e = v(null), t = v(!0), i = v(null), d = _(w);
|
|
188
|
+
if (!d)
|
|
189
189
|
throw new k(
|
|
190
190
|
"VueStripePaymentElement must be used within VueStripeElements"
|
|
191
191
|
);
|
|
192
192
|
const c = () => {
|
|
193
|
-
if (!
|
|
194
|
-
|
|
193
|
+
if (!d.elements.value) {
|
|
194
|
+
i.value = "Elements instance not available", t.value = !1;
|
|
195
195
|
return;
|
|
196
196
|
}
|
|
197
|
-
if (!
|
|
198
|
-
|
|
197
|
+
if (!l.value) {
|
|
198
|
+
i.value = "Mount point not available", t.value = !1;
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
201
|
try {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}),
|
|
205
|
-
|
|
206
|
-
}),
|
|
207
|
-
|
|
208
|
-
}),
|
|
209
|
-
|
|
210
|
-
}),
|
|
211
|
-
|
|
202
|
+
i.value = null, t.value = !0, e.value = d.elements.value.create("payment", o.options), e.value.on("ready", () => {
|
|
203
|
+
t.value = !1, s("ready", e.value);
|
|
204
|
+
}), e.value.on("change", (p) => {
|
|
205
|
+
s("change", p);
|
|
206
|
+
}), e.value.on("focus", () => {
|
|
207
|
+
s("focus");
|
|
208
|
+
}), e.value.on("blur", () => {
|
|
209
|
+
s("blur");
|
|
210
|
+
}), e.value.on("escape", () => {
|
|
211
|
+
s("escape");
|
|
212
212
|
});
|
|
213
|
-
const r =
|
|
213
|
+
const r = e.value;
|
|
214
214
|
r.on("loaderstart", () => {
|
|
215
|
-
|
|
215
|
+
s("loaderstart");
|
|
216
216
|
}), r.on("loaderstop", () => {
|
|
217
|
-
|
|
218
|
-
}),
|
|
217
|
+
s("loaderstop");
|
|
218
|
+
}), e.value.mount(l.value);
|
|
219
219
|
} catch (r) {
|
|
220
|
-
const
|
|
221
|
-
|
|
220
|
+
const p = r instanceof Error ? r.message : "Failed to create payment element";
|
|
221
|
+
i.value = p, t.value = !1, console.error("[Vue Stripe] Payment element creation error:", p);
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
224
|
return E(
|
|
225
|
-
() =>
|
|
225
|
+
() => o.options,
|
|
226
226
|
(r) => {
|
|
227
|
-
|
|
227
|
+
e.value && r && e.value.update(r);
|
|
228
228
|
},
|
|
229
229
|
{ deep: !0 }
|
|
230
230
|
), E(
|
|
231
|
-
() =>
|
|
231
|
+
() => d.elements.value,
|
|
232
232
|
(r) => {
|
|
233
|
-
r &&
|
|
233
|
+
r && l.value && !e.value && c();
|
|
234
234
|
},
|
|
235
235
|
{ immediate: !0 }
|
|
236
|
-
),
|
|
237
|
-
|
|
238
|
-
}),
|
|
239
|
-
|
|
240
|
-
}),
|
|
241
|
-
element:
|
|
242
|
-
loading:
|
|
243
|
-
error:
|
|
244
|
-
}), (r,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
236
|
+
), $(() => {
|
|
237
|
+
d.elements.value && l.value && !e.value && c();
|
|
238
|
+
}), P(() => {
|
|
239
|
+
e.value && e.value.destroy();
|
|
240
|
+
}), n({
|
|
241
|
+
element: e,
|
|
242
|
+
loading: t,
|
|
243
|
+
error: i
|
|
244
|
+
}), (r, p) => (h(), f("div", le, [
|
|
245
|
+
m(i) ? (h(), f("div", ie, [
|
|
246
|
+
S(r.$slots, "error", { error: m(i) }, () => [
|
|
247
|
+
g("div", ue, x(m(i)), 1)
|
|
248
248
|
], !0)
|
|
249
|
-
])) :
|
|
250
|
-
|
|
249
|
+
])) : U("", !0),
|
|
250
|
+
g("div", {
|
|
251
251
|
ref_key: "elementRef",
|
|
252
|
-
ref:
|
|
253
|
-
class:
|
|
252
|
+
ref: l,
|
|
253
|
+
class: M(["vue-stripe-payment-element-mount", { "vue-stripe-payment-element-loading": m(t) }])
|
|
254
254
|
}, null, 2),
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
255
|
+
m(t) ? (h(), f("div", ce, [
|
|
256
|
+
S(r.$slots, "loading", {}, () => [
|
|
257
|
+
p[0] || (p[0] = g("div", { class: "vue-stripe-loading-message" }, " Loading payment form... ", -1))
|
|
258
258
|
], !0)
|
|
259
|
-
])) :
|
|
259
|
+
])) : U("", !0)
|
|
260
260
|
]));
|
|
261
261
|
}
|
|
262
|
-
}),
|
|
262
|
+
}), Re = /* @__PURE__ */ I(de, [["__scopeId", "data-v-2477e9df"]]), pe = { class: "vue-stripe-express-checkout-element" }, ve = {
|
|
263
263
|
key: 0,
|
|
264
264
|
class: "vue-stripe-express-checkout-element-error"
|
|
265
|
-
},
|
|
265
|
+
}, me = { class: "vue-stripe-error-message" }, fe = {
|
|
266
266
|
key: 1,
|
|
267
267
|
class: "vue-stripe-express-checkout-element-loader"
|
|
268
|
-
},
|
|
268
|
+
}, he = /* @__PURE__ */ V({
|
|
269
269
|
__name: "VueStripeExpressCheckoutElement",
|
|
270
270
|
props: {
|
|
271
271
|
options: {}
|
|
272
272
|
},
|
|
273
273
|
emits: ["ready", "click", "confirm", "cancel", "shippingaddresschange", "shippingratechange"],
|
|
274
|
-
setup(
|
|
275
|
-
const
|
|
276
|
-
if (!
|
|
274
|
+
setup(a, { expose: n, emit: u }) {
|
|
275
|
+
const o = a, s = u, l = v(), e = v(null), t = v(!0), i = v(null), d = _(w);
|
|
276
|
+
if (!d)
|
|
277
277
|
throw new k(
|
|
278
278
|
"VueStripeExpressCheckoutElement must be used within VueStripeElements"
|
|
279
279
|
);
|
|
280
280
|
const c = () => {
|
|
281
|
-
if (!
|
|
282
|
-
|
|
281
|
+
if (!d.elements.value) {
|
|
282
|
+
i.value = "Elements instance not available", t.value = !1;
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
285
|
-
if (!
|
|
286
|
-
|
|
285
|
+
if (!l.value) {
|
|
286
|
+
i.value = "Mount point not available", t.value = !1;
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
289
|
try {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}),
|
|
293
|
-
|
|
294
|
-
}),
|
|
295
|
-
|
|
296
|
-
}),
|
|
297
|
-
|
|
298
|
-
}),
|
|
299
|
-
|
|
300
|
-
}),
|
|
301
|
-
|
|
302
|
-
}),
|
|
290
|
+
i.value = null, t.value = !0, e.value = d.elements.value.create("expressCheckout", o.options), e.value.on("ready", (r) => {
|
|
291
|
+
t.value = !1, s("ready", r);
|
|
292
|
+
}), e.value.on("click", (r) => {
|
|
293
|
+
s("click", r);
|
|
294
|
+
}), e.value.on("confirm", (r) => {
|
|
295
|
+
s("confirm", r);
|
|
296
|
+
}), e.value.on("cancel", () => {
|
|
297
|
+
s("cancel");
|
|
298
|
+
}), e.value.on("shippingaddresschange", (r) => {
|
|
299
|
+
s("shippingaddresschange", r);
|
|
300
|
+
}), e.value.on("shippingratechange", (r) => {
|
|
301
|
+
s("shippingratechange", r);
|
|
302
|
+
}), e.value.mount(l.value);
|
|
303
303
|
} catch (r) {
|
|
304
|
-
const
|
|
305
|
-
|
|
304
|
+
const p = r instanceof Error ? r.message : "Failed to create express checkout element";
|
|
305
|
+
i.value = p, t.value = !1, console.error("[Vue Stripe] Express checkout element creation error:", p);
|
|
306
306
|
}
|
|
307
307
|
};
|
|
308
308
|
return E(
|
|
309
|
-
() =>
|
|
309
|
+
() => o.options,
|
|
310
310
|
(r) => {
|
|
311
|
-
|
|
311
|
+
e.value && r && e.value.update(r);
|
|
312
312
|
},
|
|
313
313
|
{ deep: !0 }
|
|
314
314
|
), E(
|
|
315
|
-
() =>
|
|
315
|
+
() => d.elements.value,
|
|
316
316
|
(r) => {
|
|
317
|
-
r &&
|
|
317
|
+
r && l.value && !e.value && c();
|
|
318
318
|
},
|
|
319
319
|
{ immediate: !0 }
|
|
320
|
-
),
|
|
321
|
-
|
|
322
|
-
}),
|
|
323
|
-
|
|
324
|
-
}),
|
|
325
|
-
element:
|
|
326
|
-
loading:
|
|
327
|
-
error:
|
|
328
|
-
}), (r,
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
320
|
+
), $(() => {
|
|
321
|
+
d.elements.value && l.value && !e.value && c();
|
|
322
|
+
}), P(() => {
|
|
323
|
+
e.value && e.value.destroy();
|
|
324
|
+
}), n({
|
|
325
|
+
element: e,
|
|
326
|
+
loading: t,
|
|
327
|
+
error: i
|
|
328
|
+
}), (r, p) => (h(), f("div", pe, [
|
|
329
|
+
m(i) ? (h(), f("div", ve, [
|
|
330
|
+
S(r.$slots, "error", { error: m(i) }, () => [
|
|
331
|
+
g("div", me, x(m(i)), 1)
|
|
332
332
|
], !0)
|
|
333
|
-
])) :
|
|
334
|
-
|
|
333
|
+
])) : U("", !0),
|
|
334
|
+
g("div", {
|
|
335
335
|
ref_key: "elementRef",
|
|
336
|
-
ref:
|
|
337
|
-
class:
|
|
336
|
+
ref: l,
|
|
337
|
+
class: M(["vue-stripe-express-checkout-element-mount", { "vue-stripe-express-checkout-element-loading": m(t) }])
|
|
338
338
|
}, null, 2),
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
339
|
+
m(t) ? (h(), f("div", fe, [
|
|
340
|
+
S(r.$slots, "loading", {}, () => [
|
|
341
|
+
p[0] || (p[0] = g("div", { class: "vue-stripe-loading-message" }, " Loading express checkout... ", -1))
|
|
342
342
|
], !0)
|
|
343
|
-
])) :
|
|
343
|
+
])) : U("", !0)
|
|
344
344
|
]));
|
|
345
345
|
}
|
|
346
|
-
}), Me = /* @__PURE__ */
|
|
346
|
+
}), Me = /* @__PURE__ */ I(he, [["__scopeId", "data-v-20294cda"]]), ye = { class: "vue-stripe-card-element" }, ge = {
|
|
347
347
|
key: 0,
|
|
348
348
|
class: "vue-stripe-card-element-error"
|
|
349
|
-
},
|
|
349
|
+
}, Ee = { class: "vue-stripe-error-message" }, Se = {
|
|
350
350
|
key: 1,
|
|
351
351
|
class: "vue-stripe-card-element-loader"
|
|
352
|
-
},
|
|
352
|
+
}, _e = /* @__PURE__ */ V({
|
|
353
353
|
__name: "VueStripeCardElement",
|
|
354
354
|
props: {
|
|
355
355
|
options: {}
|
|
356
356
|
},
|
|
357
357
|
emits: ["ready", "change", "focus", "blur", "escape"],
|
|
358
|
-
setup(
|
|
359
|
-
const
|
|
360
|
-
if (!
|
|
358
|
+
setup(a, { expose: n, emit: u }) {
|
|
359
|
+
const o = a, s = u, l = v(), e = v(null), t = v(!0), i = v(null), d = _(w);
|
|
360
|
+
if (!d)
|
|
361
361
|
throw new k(
|
|
362
362
|
"VueStripeCardElement must be used within VueStripeElements"
|
|
363
363
|
);
|
|
364
364
|
const c = () => {
|
|
365
|
-
if (!
|
|
366
|
-
|
|
365
|
+
if (!d.elements.value) {
|
|
366
|
+
i.value = "Elements instance not available", t.value = !1;
|
|
367
367
|
return;
|
|
368
368
|
}
|
|
369
|
-
if (!
|
|
370
|
-
|
|
369
|
+
if (!l.value) {
|
|
370
|
+
i.value = "Mount point not available", t.value = !1;
|
|
371
371
|
return;
|
|
372
372
|
}
|
|
373
373
|
try {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
}),
|
|
377
|
-
r.error ?
|
|
378
|
-
}),
|
|
379
|
-
|
|
380
|
-
}),
|
|
381
|
-
|
|
382
|
-
}),
|
|
383
|
-
|
|
384
|
-
}),
|
|
374
|
+
i.value = null, t.value = !0, e.value = d.elements.value.create("card", o.options), e.value.on("ready", () => {
|
|
375
|
+
t.value = !1, s("ready", e.value);
|
|
376
|
+
}), e.value.on("change", (r) => {
|
|
377
|
+
r.error ? i.value = r.error.message : i.value = null, s("change", r);
|
|
378
|
+
}), e.value.on("focus", () => {
|
|
379
|
+
s("focus");
|
|
380
|
+
}), e.value.on("blur", () => {
|
|
381
|
+
s("blur");
|
|
382
|
+
}), e.value.on("escape", () => {
|
|
383
|
+
s("escape");
|
|
384
|
+
}), e.value.mount(l.value);
|
|
385
385
|
} catch (r) {
|
|
386
|
-
const
|
|
387
|
-
|
|
386
|
+
const p = r instanceof Error ? r.message : "Failed to create card element";
|
|
387
|
+
i.value = p, t.value = !1, console.error("[Vue Stripe] Card element creation error:", p);
|
|
388
388
|
}
|
|
389
389
|
};
|
|
390
390
|
return E(
|
|
391
|
-
() =>
|
|
391
|
+
() => o.options,
|
|
392
392
|
(r) => {
|
|
393
|
-
|
|
393
|
+
e.value && r && e.value.update(r);
|
|
394
394
|
},
|
|
395
395
|
{ deep: !0 }
|
|
396
396
|
), E(
|
|
397
|
-
() =>
|
|
397
|
+
() => d.elements.value,
|
|
398
398
|
(r) => {
|
|
399
|
-
r &&
|
|
399
|
+
r && l.value && !e.value && c();
|
|
400
400
|
},
|
|
401
401
|
{ immediate: !0 }
|
|
402
|
-
),
|
|
403
|
-
|
|
404
|
-
}),
|
|
405
|
-
|
|
406
|
-
}),
|
|
407
|
-
element:
|
|
408
|
-
loading:
|
|
409
|
-
error:
|
|
410
|
-
focus: () =>
|
|
411
|
-
blur: () =>
|
|
412
|
-
clear: () =>
|
|
413
|
-
}), (r,
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
402
|
+
), $(() => {
|
|
403
|
+
d.elements.value && l.value && !e.value && c();
|
|
404
|
+
}), P(() => {
|
|
405
|
+
e.value && e.value.destroy();
|
|
406
|
+
}), n({
|
|
407
|
+
element: e,
|
|
408
|
+
loading: t,
|
|
409
|
+
error: i,
|
|
410
|
+
focus: () => e.value?.focus(),
|
|
411
|
+
blur: () => e.value?.blur(),
|
|
412
|
+
clear: () => e.value?.clear()
|
|
413
|
+
}), (r, p) => (h(), f("div", ye, [
|
|
414
|
+
m(i) ? (h(), f("div", ge, [
|
|
415
|
+
S(r.$slots, "error", { error: m(i) }, () => [
|
|
416
|
+
g("div", Ee, x(m(i)), 1)
|
|
417
417
|
], !0)
|
|
418
|
-
])) :
|
|
419
|
-
|
|
418
|
+
])) : U("", !0),
|
|
419
|
+
g("div", {
|
|
420
420
|
ref_key: "elementRef",
|
|
421
|
-
ref:
|
|
422
|
-
class:
|
|
421
|
+
ref: l,
|
|
422
|
+
class: M(["vue-stripe-card-element-mount", { "vue-stripe-card-element-loading": m(t) }])
|
|
423
423
|
}, null, 2),
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
424
|
+
m(t) ? (h(), f("div", Se, [
|
|
425
|
+
S(r.$slots, "loading", {}, () => [
|
|
426
|
+
p[0] || (p[0] = g("div", { class: "vue-stripe-loading-message" }, " Loading card form... ", -1))
|
|
427
427
|
], !0)
|
|
428
|
-
])) :
|
|
428
|
+
])) : U("", !0)
|
|
429
429
|
]));
|
|
430
430
|
}
|
|
431
|
-
}), Ae = /* @__PURE__ */
|
|
432
|
-
function L({ elementType:
|
|
433
|
-
return
|
|
434
|
-
name:
|
|
431
|
+
}), Ae = /* @__PURE__ */ I(_e, [["__scopeId", "data-v-a41a7ee5"]]);
|
|
432
|
+
function L({ elementType: a, componentName: n }) {
|
|
433
|
+
return V({
|
|
434
|
+
name: n,
|
|
435
435
|
props: {
|
|
436
436
|
options: {
|
|
437
437
|
type: Object,
|
|
@@ -439,154 +439,154 @@ function L({ elementType: l, componentName: a }) {
|
|
|
439
439
|
}
|
|
440
440
|
},
|
|
441
441
|
emits: ["ready", "change", "focus", "blur", "escape"],
|
|
442
|
-
setup(
|
|
443
|
-
const
|
|
444
|
-
if (!
|
|
442
|
+
setup(u, { emit: o, expose: s }) {
|
|
443
|
+
const l = v(), e = v(null), t = v(!0), i = v(null), d = _(w);
|
|
444
|
+
if (!d)
|
|
445
445
|
throw new k(
|
|
446
|
-
`${
|
|
446
|
+
`${n} must be used within VueStripeElements`
|
|
447
447
|
);
|
|
448
448
|
const c = () => {
|
|
449
|
-
if (!
|
|
450
|
-
|
|
449
|
+
if (!d.elements.value) {
|
|
450
|
+
i.value = "Elements instance not available", t.value = !1;
|
|
451
451
|
return;
|
|
452
452
|
}
|
|
453
|
-
if (!
|
|
454
|
-
|
|
453
|
+
if (!l.value) {
|
|
454
|
+
i.value = "Mount point not available", t.value = !1;
|
|
455
455
|
return;
|
|
456
456
|
}
|
|
457
457
|
try {
|
|
458
|
-
|
|
459
|
-
const r =
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
}), r.on("change", (
|
|
463
|
-
const
|
|
464
|
-
|
|
458
|
+
i.value = null, t.value = !0;
|
|
459
|
+
const r = d.elements.value.create(a, u.options);
|
|
460
|
+
e.value = r, r.on("ready", () => {
|
|
461
|
+
t.value = !1, o("ready", e.value);
|
|
462
|
+
}), r.on("change", (p) => {
|
|
463
|
+
const C = p;
|
|
464
|
+
C.error ? i.value = C.error.message : i.value = null, o("change", C);
|
|
465
465
|
}), r.on("focus", () => {
|
|
466
|
-
|
|
466
|
+
o("focus");
|
|
467
467
|
}), r.on("blur", () => {
|
|
468
|
-
|
|
468
|
+
o("blur");
|
|
469
469
|
}), r.on("escape", () => {
|
|
470
|
-
|
|
471
|
-
}), r.mount(
|
|
470
|
+
o("escape");
|
|
471
|
+
}), r.mount(l.value);
|
|
472
472
|
} catch (r) {
|
|
473
|
-
const
|
|
474
|
-
|
|
473
|
+
const p = r instanceof Error ? r.message : `Failed to create ${a} element`;
|
|
474
|
+
i.value = p, t.value = !1, console.error(`[Vue Stripe] ${n} creation error:`, p);
|
|
475
475
|
}
|
|
476
476
|
};
|
|
477
477
|
return E(
|
|
478
|
-
() =>
|
|
478
|
+
() => u.options,
|
|
479
479
|
(r) => {
|
|
480
|
-
|
|
480
|
+
e.value?.update && r && e.value.update(r);
|
|
481
481
|
},
|
|
482
482
|
{ deep: !0 }
|
|
483
483
|
), E(
|
|
484
|
-
() =>
|
|
484
|
+
() => d.elements.value,
|
|
485
485
|
(r) => {
|
|
486
|
-
r &&
|
|
486
|
+
r && l.value && !e.value && c();
|
|
487
487
|
},
|
|
488
488
|
{ immediate: !0 }
|
|
489
|
-
),
|
|
490
|
-
|
|
491
|
-
}),
|
|
492
|
-
|
|
493
|
-
}),
|
|
494
|
-
element:
|
|
495
|
-
loading:
|
|
496
|
-
error:
|
|
489
|
+
), $(() => {
|
|
490
|
+
d.elements.value && l.value && !e.value && c();
|
|
491
|
+
}), P(() => {
|
|
492
|
+
e.value && e.value.destroy();
|
|
493
|
+
}), s({
|
|
494
|
+
element: e,
|
|
495
|
+
loading: t,
|
|
496
|
+
error: i,
|
|
497
497
|
focus: () => {
|
|
498
|
-
|
|
498
|
+
e.value?.focus?.();
|
|
499
499
|
},
|
|
500
500
|
blur: () => {
|
|
501
|
-
|
|
501
|
+
e.value?.blur?.();
|
|
502
502
|
},
|
|
503
503
|
clear: () => {
|
|
504
|
-
|
|
504
|
+
e.value?.clear?.();
|
|
505
505
|
}
|
|
506
506
|
}), () => {
|
|
507
|
-
const r = `vue-stripe-${
|
|
508
|
-
return
|
|
509
|
-
|
|
510
|
-
|
|
507
|
+
const r = `vue-stripe-${a}-element`;
|
|
508
|
+
return T("div", { class: r }, [
|
|
509
|
+
i.value && T("div", { class: `${r}-error` }, [
|
|
510
|
+
T("div", { class: "vue-stripe-error-message" }, i.value)
|
|
511
511
|
]),
|
|
512
|
-
|
|
513
|
-
ref:
|
|
512
|
+
T("div", {
|
|
513
|
+
ref: l,
|
|
514
514
|
class: {
|
|
515
515
|
[`${r}-mount`]: !0,
|
|
516
|
-
[`${r}-loading`]:
|
|
516
|
+
[`${r}-loading`]: t.value
|
|
517
517
|
}
|
|
518
518
|
}),
|
|
519
|
-
|
|
520
|
-
|
|
519
|
+
t.value && T("div", { class: `${r}-loader` }, [
|
|
520
|
+
T("div", { class: "vue-stripe-loading-message" }, `Loading ${a}...`)
|
|
521
521
|
])
|
|
522
522
|
]);
|
|
523
523
|
};
|
|
524
524
|
}
|
|
525
525
|
});
|
|
526
526
|
}
|
|
527
|
-
const
|
|
527
|
+
const Fe = L({
|
|
528
528
|
elementType: "cardNumber",
|
|
529
529
|
componentName: "VueStripeCardNumberElement"
|
|
530
|
-
}),
|
|
530
|
+
}), Le = L({
|
|
531
531
|
elementType: "cardExpiry",
|
|
532
532
|
componentName: "VueStripeCardExpiryElement"
|
|
533
|
-
}),
|
|
533
|
+
}), ze = L({
|
|
534
534
|
elementType: "cardCvc",
|
|
535
535
|
componentName: "VueStripeCardCvcElement"
|
|
536
|
-
}),
|
|
536
|
+
}), be = /* @__PURE__ */ V({
|
|
537
537
|
__name: "VueStripeLinkAuthenticationElement",
|
|
538
538
|
props: {
|
|
539
539
|
options: {}
|
|
540
540
|
},
|
|
541
541
|
emits: ["ready", "change"],
|
|
542
|
-
setup(
|
|
543
|
-
const
|
|
544
|
-
if (!
|
|
542
|
+
setup(a, { expose: n, emit: u }) {
|
|
543
|
+
const o = a, s = u, l = _(w);
|
|
544
|
+
if (!l)
|
|
545
545
|
throw new k(
|
|
546
546
|
"VueStripeLinkAuthenticationElement must be used within VueStripeElements"
|
|
547
547
|
);
|
|
548
|
-
const
|
|
549
|
-
if (!(!
|
|
548
|
+
const e = v(), t = v(null), i = () => {
|
|
549
|
+
if (!(!l.elements?.value || !e.value))
|
|
550
550
|
try {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
}),
|
|
554
|
-
|
|
551
|
+
t.value = l.elements?.value.create("linkAuthentication", o.options), t.value.mount(e.value), t.value.on("ready", () => {
|
|
552
|
+
t.value && s("ready", t.value);
|
|
553
|
+
}), t.value.on("change", (c) => {
|
|
554
|
+
s("change", c);
|
|
555
555
|
});
|
|
556
556
|
} catch (c) {
|
|
557
557
|
console.error("[Vue Stripe] Link authentication element creation error:", c);
|
|
558
558
|
}
|
|
559
|
-
},
|
|
560
|
-
|
|
559
|
+
}, d = () => {
|
|
560
|
+
t.value && (t.value.unmount(), t.value.destroy(), t.value = null);
|
|
561
561
|
};
|
|
562
562
|
return E(
|
|
563
|
-
() =>
|
|
563
|
+
() => l.elements?.value,
|
|
564
564
|
(c) => {
|
|
565
|
-
c &&
|
|
565
|
+
c && e.value && !t.value && i();
|
|
566
566
|
},
|
|
567
567
|
{ immediate: !0 }
|
|
568
568
|
), E(
|
|
569
|
-
() =>
|
|
569
|
+
() => o.options,
|
|
570
570
|
(c) => {
|
|
571
|
-
|
|
571
|
+
t.value && c && typeof t.value.update == "function" && t.value.update(c);
|
|
572
572
|
},
|
|
573
573
|
{ deep: !0 }
|
|
574
|
-
),
|
|
575
|
-
|
|
576
|
-
}),
|
|
577
|
-
|
|
578
|
-
}),
|
|
579
|
-
element:
|
|
580
|
-
focus: () =>
|
|
581
|
-
blur: () =>
|
|
582
|
-
clear: () =>
|
|
574
|
+
), $(() => {
|
|
575
|
+
l.elements?.value && e.value && i();
|
|
576
|
+
}), P(() => {
|
|
577
|
+
d();
|
|
578
|
+
}), n({
|
|
579
|
+
element: t,
|
|
580
|
+
focus: () => t.value?.focus(),
|
|
581
|
+
blur: () => t.value?.blur(),
|
|
582
|
+
clear: () => t.value?.clear()
|
|
583
583
|
}), (c, r) => (h(), f("div", {
|
|
584
584
|
ref_key: "elementRef",
|
|
585
|
-
ref:
|
|
585
|
+
ref: e,
|
|
586
586
|
class: "vue-stripe-link-auth-element"
|
|
587
587
|
}, null, 512));
|
|
588
588
|
}
|
|
589
|
-
}),
|
|
589
|
+
}), je = /* @__PURE__ */ I(be, [["__scopeId", "data-v-b79076eb"]]), we = V({
|
|
590
590
|
name: "VueStripeAddressElement",
|
|
591
591
|
props: {
|
|
592
592
|
options: {
|
|
@@ -597,79 +597,80 @@ const Re = L({
|
|
|
597
597
|
}
|
|
598
598
|
},
|
|
599
599
|
emits: ["ready", "change", "blur", "focus", "escape", "loadError"],
|
|
600
|
-
setup(
|
|
601
|
-
const
|
|
602
|
-
if (!
|
|
600
|
+
setup(a, { emit: n, expose: u }) {
|
|
601
|
+
const o = v(), s = v(null), l = _(w);
|
|
602
|
+
if (!l)
|
|
603
603
|
throw new k("VueStripeAddressElement must be used within VueStripeElements");
|
|
604
|
-
const
|
|
605
|
-
|
|
606
|
-
},
|
|
607
|
-
|
|
608
|
-
},
|
|
609
|
-
|
|
610
|
-
},
|
|
611
|
-
|
|
604
|
+
const e = () => {
|
|
605
|
+
n("ready");
|
|
606
|
+
}, t = (A) => {
|
|
607
|
+
n("change", A);
|
|
608
|
+
}, i = () => {
|
|
609
|
+
n("blur");
|
|
610
|
+
}, d = () => {
|
|
611
|
+
n("focus");
|
|
612
612
|
}, c = () => {
|
|
613
|
-
|
|
614
|
-
}, r = (
|
|
615
|
-
|
|
616
|
-
},
|
|
617
|
-
!
|
|
618
|
-
},
|
|
619
|
-
|
|
620
|
-
},
|
|
621
|
-
|
|
622
|
-
},
|
|
623
|
-
if (!
|
|
613
|
+
n("escape");
|
|
614
|
+
}, r = (A) => {
|
|
615
|
+
n("loadError", A);
|
|
616
|
+
}, p = () => {
|
|
617
|
+
!l.elements.value || !o.value || (s.value = l.elements.value.create("address", a.options), s.value.mount(o.value), s.value.on("ready", e), s.value.on("change", t), s.value.on("blur", i), s.value.on("focus", d), s.value.on("escape", c), s.value.on("loaderror", r));
|
|
618
|
+
}, C = () => {
|
|
619
|
+
s.value && s.value.update(a.options);
|
|
620
|
+
}, W = () => {
|
|
621
|
+
s.value && (s.value.off("ready", e), s.value.off("change", t), s.value.off("blur", i), s.value.off("focus", d), s.value.off("escape", c), s.value.off("loaderror", r), s.value.destroy(), s.value = null);
|
|
622
|
+
}, z = async () => {
|
|
623
|
+
if (!s.value)
|
|
624
624
|
throw new k("Address element not mounted");
|
|
625
|
-
return
|
|
625
|
+
return s.value.getValue();
|
|
626
|
+
}, j = () => {
|
|
627
|
+
s.value?.focus();
|
|
626
628
|
}, K = () => {
|
|
627
|
-
|
|
628
|
-
}, N = () => {
|
|
629
|
-
n.value?.clear();
|
|
629
|
+
s.value?.clear();
|
|
630
630
|
};
|
|
631
|
-
return
|
|
632
|
-
|
|
633
|
-
}),
|
|
634
|
-
|
|
635
|
-
}), E(() =>
|
|
636
|
-
|
|
637
|
-
}, { deep: !0 }),
|
|
638
|
-
element:
|
|
639
|
-
getValue:
|
|
640
|
-
focus:
|
|
641
|
-
clear:
|
|
631
|
+
return $(() => {
|
|
632
|
+
p();
|
|
633
|
+
}), X(() => {
|
|
634
|
+
W();
|
|
635
|
+
}), E(() => a.options, () => {
|
|
636
|
+
C();
|
|
637
|
+
}, { deep: !0 }), u({
|
|
638
|
+
element: s,
|
|
639
|
+
getValue: z,
|
|
640
|
+
focus: j,
|
|
641
|
+
clear: K
|
|
642
642
|
}), {
|
|
643
|
-
addressRef:
|
|
644
|
-
element:
|
|
645
|
-
getValue:
|
|
646
|
-
focus:
|
|
647
|
-
clear:
|
|
643
|
+
addressRef: o,
|
|
644
|
+
element: s,
|
|
645
|
+
getValue: z,
|
|
646
|
+
focus: j,
|
|
647
|
+
clear: K
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
|
-
}),
|
|
651
|
-
function
|
|
652
|
-
return h(), f("div",
|
|
650
|
+
}), ke = { ref: "addressRef" };
|
|
651
|
+
function Ve(a, n, u, o, s, l) {
|
|
652
|
+
return h(), f("div", ke, null, 512);
|
|
653
653
|
}
|
|
654
|
-
const
|
|
655
|
-
function
|
|
656
|
-
const
|
|
657
|
-
if (!
|
|
658
|
-
throw new
|
|
654
|
+
const Ke = /* @__PURE__ */ I(we, [["render", Ve]]);
|
|
655
|
+
function O() {
|
|
656
|
+
const a = _(R);
|
|
657
|
+
if (!a)
|
|
658
|
+
throw new y(
|
|
659
659
|
"useStripe must be called within a VueStripeProvider component"
|
|
660
660
|
);
|
|
661
661
|
return {
|
|
662
|
-
stripe:
|
|
663
|
-
loading:
|
|
664
|
-
error:
|
|
662
|
+
stripe: b(a.stripe),
|
|
663
|
+
loading: b(a.loading),
|
|
664
|
+
error: b(a.error),
|
|
665
665
|
initialize: async () => {
|
|
666
666
|
}
|
|
667
667
|
};
|
|
668
668
|
}
|
|
669
|
-
const
|
|
669
|
+
const Ce = ["disabled"], $e = /* @__PURE__ */ V({
|
|
670
670
|
__name: "VueStripeCheckout",
|
|
671
671
|
props: {
|
|
672
672
|
sessionId: {},
|
|
673
|
+
sessionUrl: {},
|
|
673
674
|
priceId: {},
|
|
674
675
|
mode: { default: "payment" },
|
|
675
676
|
successUrl: {},
|
|
@@ -677,220 +678,266 @@ const Ve = ["disabled"], ke = /* @__PURE__ */ w({
|
|
|
677
678
|
customerEmail: {},
|
|
678
679
|
clientReferenceId: {},
|
|
679
680
|
submitType: {},
|
|
680
|
-
options: {},
|
|
681
681
|
buttonText: { default: "Checkout" },
|
|
682
682
|
loadingText: { default: "Redirecting..." },
|
|
683
683
|
disabled: { type: Boolean, default: !1 },
|
|
684
684
|
buttonClass: { default: "vue-stripe-checkout-button" }
|
|
685
685
|
},
|
|
686
|
-
emits: ["
|
|
687
|
-
setup(
|
|
688
|
-
const o =
|
|
689
|
-
|
|
690
|
-
const e = new b("Stripe not initialized");
|
|
691
|
-
i("error", e);
|
|
692
|
-
return;
|
|
693
|
-
}
|
|
694
|
-
if (!o.sessionId && !o.priceId) {
|
|
695
|
-
const e = new b("Either sessionId or priceId is required");
|
|
696
|
-
i("error", e);
|
|
697
|
-
return;
|
|
698
|
-
}
|
|
686
|
+
emits: ["checkout", "success", "error", "before-redirect"],
|
|
687
|
+
setup(a, { expose: n, emit: u }) {
|
|
688
|
+
const o = a, s = u, { stripe: l } = O(), e = v(!1), t = G(), i = H(() => !!t.default), d = () => l.value !== null && typeof l.value.redirectToCheckout == "function", c = async () => {
|
|
689
|
+
e.value = !0, s("checkout");
|
|
699
690
|
try {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
691
|
+
if (o.sessionUrl) {
|
|
692
|
+
s("before-redirect", { url: o.sessionUrl }), window.location.replace(o.sessionUrl), s("success");
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
if (o.sessionId) {
|
|
696
|
+
if (!d())
|
|
697
|
+
throw new y(
|
|
698
|
+
"redirectToCheckout is not available. This method was removed in @stripe/stripe-js v8.x. Use sessionUrl prop with the checkout session URL instead."
|
|
699
|
+
);
|
|
700
|
+
if (!l.value)
|
|
701
|
+
throw new y("Stripe not initialized");
|
|
702
|
+
const r = await l.value.redirectToCheckout({
|
|
703
|
+
sessionId: o.sessionId
|
|
704
|
+
});
|
|
705
|
+
if (r.error)
|
|
706
|
+
throw new y(r.error.message || "Redirect to checkout failed");
|
|
707
|
+
s("success");
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
if (o.priceId) {
|
|
711
|
+
if (!d())
|
|
712
|
+
throw new y(
|
|
713
|
+
"Price-based checkout using redirectToCheckout is not available in @stripe/stripe-js v8.x. Create a Checkout Session on your server and use sessionUrl prop instead."
|
|
714
|
+
);
|
|
715
|
+
if (!l.value)
|
|
716
|
+
throw new y("Stripe not initialized");
|
|
717
|
+
console.warn(
|
|
718
|
+
"[Vue Stripe] Price-based checkout is deprecated in v8.x. Create a Checkout Session on your server and use sessionUrl prop instead."
|
|
719
|
+
);
|
|
720
|
+
const r = await l.value.redirectToCheckout({
|
|
721
|
+
lineItems: [
|
|
722
|
+
{
|
|
723
|
+
price: o.priceId,
|
|
724
|
+
quantity: 1
|
|
725
|
+
}
|
|
726
|
+
],
|
|
727
|
+
mode: o.mode,
|
|
728
|
+
successUrl: o.successUrl || window.location.origin + "/success",
|
|
729
|
+
cancelUrl: o.cancelUrl || window.location.origin + "/cancel",
|
|
730
|
+
customerEmail: o.customerEmail,
|
|
731
|
+
clientReferenceId: o.clientReferenceId,
|
|
732
|
+
submitType: o.submitType
|
|
733
|
+
});
|
|
734
|
+
if (r.error)
|
|
735
|
+
throw new y(r.error.message || "Redirect to checkout failed");
|
|
736
|
+
s("success");
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
throw new y(
|
|
740
|
+
"Either sessionUrl, sessionId, or priceId is required. For @stripe/stripe-js v8.x, use sessionUrl."
|
|
741
|
+
);
|
|
742
|
+
} catch (r) {
|
|
743
|
+
const p = r instanceof Error ? r : new Error("Checkout failed");
|
|
744
|
+
s("error", p), console.error("[Vue Stripe] Checkout error:", p);
|
|
724
745
|
} finally {
|
|
725
|
-
|
|
746
|
+
e.value = !1;
|
|
726
747
|
}
|
|
727
748
|
};
|
|
728
|
-
return (e,
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
749
|
+
return n({ checkout: c, loading: e }), (r, p) => m(i) ? (h(), f("span", {
|
|
750
|
+
key: 0,
|
|
751
|
+
onClick: c,
|
|
752
|
+
class: "vue-stripe-checkout-wrapper"
|
|
732
753
|
}, [
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
754
|
+
S(r.$slots, "default", {
|
|
755
|
+
checkout: c,
|
|
756
|
+
loading: m(e),
|
|
757
|
+
disabled: a.disabled
|
|
758
|
+
}, void 0, !0)
|
|
759
|
+
])) : (h(), f("button", {
|
|
760
|
+
key: 1,
|
|
761
|
+
disabled: m(e) || a.disabled,
|
|
762
|
+
class: M(a.buttonClass),
|
|
763
|
+
onClick: c
|
|
764
|
+
}, [
|
|
765
|
+
m(e) ? (h(), f(N, { key: 1 }, [
|
|
766
|
+
p[0] || (p[0] = g("span", { class: "vue-stripe-loading-spinner" }, null, -1)),
|
|
767
|
+
q(" " + x(a.loadingText), 1)
|
|
768
|
+
], 64)) : (h(), f(N, { key: 0 }, [
|
|
769
|
+
q(x(a.buttonText), 1)
|
|
770
|
+
], 64))
|
|
771
|
+
], 10, Ce));
|
|
740
772
|
}
|
|
741
|
-
}),
|
|
742
|
-
function
|
|
743
|
-
const
|
|
744
|
-
if (!
|
|
745
|
-
throw new
|
|
773
|
+
}), Ne = /* @__PURE__ */ I($e, [["__scopeId", "data-v-639387e4"]]);
|
|
774
|
+
function qe() {
|
|
775
|
+
const a = _(R), n = _(w);
|
|
776
|
+
if (!a)
|
|
777
|
+
throw new y(
|
|
746
778
|
"usePaymentIntent must be called within a VueStripeProvider component"
|
|
747
779
|
);
|
|
748
|
-
const
|
|
780
|
+
const u = v(!1), o = v(null);
|
|
749
781
|
return {
|
|
750
|
-
confirmPayment: async (
|
|
751
|
-
if (!
|
|
752
|
-
return
|
|
753
|
-
|
|
782
|
+
confirmPayment: async (l) => {
|
|
783
|
+
if (!a.stripe.value)
|
|
784
|
+
return o.value = "Stripe not initialized", { error: { message: "Stripe not initialized" } };
|
|
785
|
+
u.value = !0, o.value = null;
|
|
754
786
|
try {
|
|
755
|
-
const
|
|
756
|
-
if (
|
|
757
|
-
const { error:
|
|
758
|
-
if (
|
|
759
|
-
return
|
|
787
|
+
const e = l.elements ?? n?.elements.value;
|
|
788
|
+
if (e && !l.skipSubmit) {
|
|
789
|
+
const { error: i } = await e.submit();
|
|
790
|
+
if (i)
|
|
791
|
+
return o.value = i.message || "Form validation failed", { error: i };
|
|
760
792
|
}
|
|
761
|
-
const
|
|
762
|
-
elements:
|
|
763
|
-
clientSecret:
|
|
764
|
-
confirmParams:
|
|
765
|
-
redirect:
|
|
793
|
+
const t = await a.stripe.value.confirmPayment({
|
|
794
|
+
elements: e ?? void 0,
|
|
795
|
+
clientSecret: l.clientSecret,
|
|
796
|
+
confirmParams: l.confirmParams ?? {},
|
|
797
|
+
redirect: l.redirect ?? "if_required"
|
|
766
798
|
});
|
|
767
|
-
return
|
|
768
|
-
} catch (
|
|
769
|
-
const
|
|
770
|
-
return
|
|
799
|
+
return t.error && (o.value = t.error.message || "Payment confirmation failed"), t;
|
|
800
|
+
} catch (e) {
|
|
801
|
+
const t = e instanceof Error ? e.message : "Payment confirmation failed";
|
|
802
|
+
return o.value = t, { error: { message: t } };
|
|
771
803
|
} finally {
|
|
772
|
-
|
|
804
|
+
u.value = !1;
|
|
773
805
|
}
|
|
774
806
|
},
|
|
775
|
-
loading:
|
|
776
|
-
error:
|
|
807
|
+
loading: b(u),
|
|
808
|
+
error: b(o)
|
|
777
809
|
};
|
|
778
810
|
}
|
|
779
|
-
function
|
|
780
|
-
const
|
|
781
|
-
if (!
|
|
782
|
-
throw new
|
|
811
|
+
function Be() {
|
|
812
|
+
const a = _(R), n = _(w);
|
|
813
|
+
if (!a)
|
|
814
|
+
throw new y(
|
|
783
815
|
"useSetupIntent must be called within a VueStripeProvider component"
|
|
784
816
|
);
|
|
785
|
-
const
|
|
817
|
+
const u = v(!1), o = v(null);
|
|
786
818
|
return {
|
|
787
|
-
confirmSetup: async (
|
|
788
|
-
if (!
|
|
789
|
-
return
|
|
790
|
-
|
|
819
|
+
confirmSetup: async (l) => {
|
|
820
|
+
if (!a.stripe.value)
|
|
821
|
+
return o.value = "Stripe not initialized", { error: { message: "Stripe not initialized" } };
|
|
822
|
+
u.value = !0, o.value = null;
|
|
791
823
|
try {
|
|
792
|
-
const
|
|
793
|
-
if (
|
|
794
|
-
const { error:
|
|
795
|
-
if (
|
|
796
|
-
return
|
|
824
|
+
const e = l.elements ?? n?.elements.value;
|
|
825
|
+
if (e && !l.skipSubmit) {
|
|
826
|
+
const { error: i } = await e.submit();
|
|
827
|
+
if (i)
|
|
828
|
+
return o.value = i.message || "Form validation failed", { error: i };
|
|
797
829
|
}
|
|
798
|
-
const
|
|
799
|
-
elements:
|
|
800
|
-
clientSecret:
|
|
801
|
-
confirmParams:
|
|
802
|
-
redirect:
|
|
830
|
+
const t = await a.stripe.value.confirmSetup({
|
|
831
|
+
elements: e ?? void 0,
|
|
832
|
+
clientSecret: l.clientSecret,
|
|
833
|
+
confirmParams: l.confirmParams ?? {},
|
|
834
|
+
redirect: l.redirect ?? "if_required"
|
|
803
835
|
});
|
|
804
|
-
return
|
|
805
|
-
} catch (
|
|
806
|
-
const
|
|
807
|
-
return
|
|
836
|
+
return t.error && (o.value = t.error.message || "Setup confirmation failed"), t;
|
|
837
|
+
} catch (e) {
|
|
838
|
+
const t = e instanceof Error ? e.message : "Setup confirmation failed";
|
|
839
|
+
return o.value = t, { error: { message: t } };
|
|
808
840
|
} finally {
|
|
809
|
-
|
|
841
|
+
u.value = !1;
|
|
810
842
|
}
|
|
811
843
|
},
|
|
812
|
-
loading:
|
|
813
|
-
error:
|
|
844
|
+
loading: b(u),
|
|
845
|
+
error: b(o)
|
|
814
846
|
};
|
|
815
847
|
}
|
|
816
|
-
function
|
|
817
|
-
const { stripe:
|
|
848
|
+
function De() {
|
|
849
|
+
const { stripe: a } = O(), n = v(!1), u = v(null), o = () => a.value !== null && typeof a.value.redirectToCheckout == "function";
|
|
818
850
|
return {
|
|
819
|
-
redirectToCheckout: async (
|
|
820
|
-
|
|
821
|
-
throw new b("Stripe not initialized");
|
|
851
|
+
redirectToCheckout: async (e) => {
|
|
852
|
+
n.value = !0, u.value = null;
|
|
822
853
|
try {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
854
|
+
if ("url" in e && e.url) {
|
|
855
|
+
window.location.replace(e.url);
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
const t = e;
|
|
859
|
+
if (!o())
|
|
860
|
+
throw new y(
|
|
861
|
+
"redirectToCheckout is not available. This method was removed in @stripe/stripe-js v8.x. Create a Checkout Session on your server and use redirectToUrl() or pass { url } instead."
|
|
862
|
+
);
|
|
863
|
+
if (!a.value)
|
|
864
|
+
throw new y("Stripe not initialized");
|
|
865
|
+
console.warn(
|
|
866
|
+
"[Vue Stripe] Legacy redirectToCheckout is deprecated in @stripe/stripe-js v8.x. Use redirectToUrl() with a session URL from your server instead."
|
|
867
|
+
);
|
|
868
|
+
const i = await a.value.redirectToCheckout(t);
|
|
869
|
+
if (i.error) {
|
|
870
|
+
const d = i.error.message || "Checkout redirect failed";
|
|
871
|
+
throw u.value = d, new y(d);
|
|
828
872
|
}
|
|
829
|
-
} catch (
|
|
830
|
-
const
|
|
831
|
-
throw
|
|
873
|
+
} catch (t) {
|
|
874
|
+
const i = t instanceof Error ? t.message : "Checkout redirect failed";
|
|
875
|
+
throw u.value = i, t;
|
|
832
876
|
} finally {
|
|
833
|
-
|
|
877
|
+
n.value = !1;
|
|
834
878
|
}
|
|
835
879
|
},
|
|
836
|
-
|
|
837
|
-
|
|
880
|
+
redirectToUrl: (e) => {
|
|
881
|
+
n.value = !0, u.value = null, window.location.replace(e);
|
|
882
|
+
},
|
|
883
|
+
loading: b(n),
|
|
884
|
+
error: b(u)
|
|
838
885
|
};
|
|
839
886
|
}
|
|
840
|
-
function
|
|
841
|
-
const
|
|
842
|
-
if (!
|
|
887
|
+
function Oe() {
|
|
888
|
+
const a = _(w);
|
|
889
|
+
if (!a)
|
|
843
890
|
throw new k(
|
|
844
891
|
"Elements context not found. Make sure to wrap your component with VueStripeElements."
|
|
845
892
|
);
|
|
846
|
-
const
|
|
893
|
+
const n = async () => a.elements.value ? a.elements.value.submit() : { error: { message: "Elements not initialized" } };
|
|
847
894
|
return {
|
|
848
|
-
elements:
|
|
849
|
-
submit:
|
|
850
|
-
loading:
|
|
851
|
-
error:
|
|
895
|
+
elements: b(a.elements),
|
|
896
|
+
submit: n,
|
|
897
|
+
loading: b(a.loading),
|
|
898
|
+
error: b(a.error)
|
|
852
899
|
};
|
|
853
900
|
}
|
|
854
|
-
function
|
|
901
|
+
function We(a) {
|
|
855
902
|
return {
|
|
856
|
-
install(
|
|
857
|
-
|
|
858
|
-
let
|
|
859
|
-
|
|
903
|
+
install(n) {
|
|
904
|
+
n.provide("vue-stripe-config", a);
|
|
905
|
+
let u = null;
|
|
906
|
+
n.provide("vue-stripe-global", {
|
|
860
907
|
get stripe() {
|
|
861
|
-
if (!
|
|
862
|
-
const
|
|
863
|
-
|
|
908
|
+
if (!u) {
|
|
909
|
+
const o = {};
|
|
910
|
+
a.stripeAccount && (o.stripeAccount = a.stripeAccount), a.apiVersion && (o.apiVersion = a.apiVersion), a.locale && (o.locale = a.locale), u = B(a.publishableKey, o).then((s) => (s && s.registerAppInfo(D), s));
|
|
864
911
|
}
|
|
865
|
-
return
|
|
912
|
+
return u;
|
|
866
913
|
}
|
|
867
914
|
});
|
|
868
915
|
}
|
|
869
916
|
};
|
|
870
917
|
}
|
|
871
918
|
export {
|
|
872
|
-
|
|
873
|
-
|
|
919
|
+
Ke as VueStripeAddressElement,
|
|
920
|
+
ze as VueStripeCardCvcElement,
|
|
874
921
|
Ae as VueStripeCardElement,
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
922
|
+
Le as VueStripeCardExpiryElement,
|
|
923
|
+
Fe as VueStripeCardNumberElement,
|
|
924
|
+
Ne as VueStripeCheckout,
|
|
925
|
+
Pe as VueStripeElements,
|
|
879
926
|
k as VueStripeElementsError,
|
|
880
927
|
Me as VueStripeExpressCheckoutElement,
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
928
|
+
je as VueStripeLinkAuthenticationElement,
|
|
929
|
+
J as VueStripeLoadError,
|
|
930
|
+
Re as VueStripePaymentElement,
|
|
931
|
+
Ue as VueStripeProvider,
|
|
932
|
+
y as VueStripeProviderError,
|
|
933
|
+
We as createVueStripe,
|
|
934
|
+
Te as createVueStripeError,
|
|
935
|
+
He as loadStripe,
|
|
936
|
+
De as useCheckout,
|
|
937
|
+
Oe as useElements,
|
|
938
|
+
qe as usePaymentIntent,
|
|
939
|
+
Be as useSetupIntent,
|
|
940
|
+
O as useStripe,
|
|
941
|
+
De as useStripeCheckout,
|
|
942
|
+
Oe as useStripeElements
|
|
896
943
|
};
|