@appfunnel-dev/sdk 2.0.0-canary.5 → 2.0.0-canary.7
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 +1 -1
- package/dist/{checkout-Dz8cGkB_.d.cts → checkout-CMEdxpgo.d.cts} +13 -13
- package/dist/{checkout-7Dy6IedP.d.ts → checkout-D1NUPv4p.d.ts} +13 -13
- package/dist/{chunk-AXXG3ODP.js → chunk-7YQLPPPG.js} +58 -90
- package/dist/chunk-7YQLPPPG.js.map +1 -0
- package/dist/{chunk-G44BUG6G.cjs → chunk-BPOAWI4G.cjs} +60 -93
- package/dist/chunk-BPOAWI4G.cjs.map +1 -0
- package/dist/driver-paddle.d.cts +1 -1
- package/dist/driver-paddle.d.ts +1 -1
- package/dist/driver-stripe.cjs +241 -189
- package/dist/driver-stripe.cjs.map +1 -1
- package/dist/driver-stripe.d.cts +18 -2
- package/dist/driver-stripe.d.ts +18 -2
- package/dist/driver-stripe.js +242 -191
- package/dist/driver-stripe.js.map +1 -1
- package/dist/index.cjs +298 -122
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -24
- package/dist/index.d.ts +24 -24
- package/dist/index.js +260 -80
- package/dist/index.js.map +1 -1
- package/dist/{manifest-Dl7faaKe.d.cts → manifest-CMe8yVkr.d.cts} +97 -88
- package/dist/{manifest-Dl7faaKe.d.ts → manifest-CMe8yVkr.d.ts} +97 -88
- package/dist/manifest-entry.cjs +38 -38
- package/dist/manifest-entry.cjs.map +1 -1
- package/dist/manifest-entry.d.cts +15 -15
- package/dist/manifest-entry.d.ts +15 -15
- package/dist/manifest-entry.js +16 -12
- package/dist/manifest-entry.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-AXXG3ODP.js.map +0 -1
- package/dist/chunk-G44BUG6G.cjs.map +0 -1
package/dist/driver-stripe.d.cts
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
import { C as CheckoutDriverContext, a as CheckoutDriver } from './checkout-
|
|
1
|
+
import { C as CheckoutDriverContext, a as CheckoutDriver } from './checkout-CMEdxpgo.cjs';
|
|
2
2
|
import 'react';
|
|
3
3
|
import './capabilities-7_hy5f5G.cjs';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Detect the editor's null-origin preview (the builder mounts the funnel inside an
|
|
7
|
+
* `about:srcdoc` iframe, whose document origin is the opaque string `'null'`). This
|
|
8
|
+
* is the ONE context we disable Stripe's advanced-fraud-signals in — never a live
|
|
9
|
+
* funnel, which is always served from a real custom-domain origin, so `origin` is a
|
|
10
|
+
* concrete URL there and this returns false. We read `window.origin` (opaque →
|
|
11
|
+
* `'null'`) with a defensive fallback to `location.origin`; SSR (no `window`) is a
|
|
12
|
+
* real page, not the preview, so it returns false too.
|
|
13
|
+
*
|
|
14
|
+
* Why disable there: (1) fraud-signal noise on a throwaway preview is meaningless,
|
|
15
|
+
* and (2) Stripe's `m-outer` metrics iframe — a cross-origin frame injected into an
|
|
16
|
+
* already-opaque-origin document — breaks the editor's screenshot capture (the MCP
|
|
17
|
+
* `get_screenshot` path). Advanced fraud signals are Stripe's fraud protection for
|
|
18
|
+
* REAL charges; a preview never charges, so turning them off costs nothing there.
|
|
19
|
+
*/
|
|
20
|
+
declare function isNullOriginPreview(): boolean;
|
|
5
21
|
/** Build the Stripe checkout driver for a funnel mount (pass to `createFunnelTree`). */
|
|
6
22
|
declare function stripeCheckoutDriver(ctx: CheckoutDriverContext): CheckoutDriver;
|
|
7
23
|
|
|
8
|
-
export { CheckoutDriver, CheckoutDriverContext, stripeCheckoutDriver };
|
|
24
|
+
export { CheckoutDriver, CheckoutDriverContext, isNullOriginPreview, stripeCheckoutDriver };
|
package/dist/driver-stripe.d.ts
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
import { C as CheckoutDriverContext, a as CheckoutDriver } from './checkout-
|
|
1
|
+
import { C as CheckoutDriverContext, a as CheckoutDriver } from './checkout-D1NUPv4p.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import './capabilities-7_hy5f5G.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Detect the editor's null-origin preview (the builder mounts the funnel inside an
|
|
7
|
+
* `about:srcdoc` iframe, whose document origin is the opaque string `'null'`). This
|
|
8
|
+
* is the ONE context we disable Stripe's advanced-fraud-signals in — never a live
|
|
9
|
+
* funnel, which is always served from a real custom-domain origin, so `origin` is a
|
|
10
|
+
* concrete URL there and this returns false. We read `window.origin` (opaque →
|
|
11
|
+
* `'null'`) with a defensive fallback to `location.origin`; SSR (no `window`) is a
|
|
12
|
+
* real page, not the preview, so it returns false too.
|
|
13
|
+
*
|
|
14
|
+
* Why disable there: (1) fraud-signal noise on a throwaway preview is meaningless,
|
|
15
|
+
* and (2) Stripe's `m-outer` metrics iframe — a cross-origin frame injected into an
|
|
16
|
+
* already-opaque-origin document — breaks the editor's screenshot capture (the MCP
|
|
17
|
+
* `get_screenshot` path). Advanced fraud signals are Stripe's fraud protection for
|
|
18
|
+
* REAL charges; a preview never charges, so turning them off costs nothing there.
|
|
19
|
+
*/
|
|
20
|
+
declare function isNullOriginPreview(): boolean;
|
|
5
21
|
/** Build the Stripe checkout driver for a funnel mount (pass to `createFunnelTree`). */
|
|
6
22
|
declare function stripeCheckoutDriver(ctx: CheckoutDriverContext): CheckoutDriver;
|
|
7
23
|
|
|
8
|
-
export { CheckoutDriver, CheckoutDriverContext, stripeCheckoutDriver };
|
|
24
|
+
export { CheckoutDriver, CheckoutDriverContext, isNullOriginPreview, stripeCheckoutDriver };
|
package/dist/driver-stripe.js
CHANGED
|
@@ -1,8 +1,199 @@
|
|
|
1
1
|
import { completeWithPoll, postSession, leaveForRedirect, settlementToResult, toCheckoutError, postComplete } from './chunk-CFFMZYPE.js';
|
|
2
2
|
import { checkoutError } from './chunk-TNLRQPVY.js';
|
|
3
|
-
import { __commonJS,
|
|
3
|
+
import { __commonJS, __toESM, __export } from './chunk-G3PMV62Z.js';
|
|
4
4
|
import React, { createElement, useState, useRef, useEffect } from 'react';
|
|
5
5
|
|
|
6
|
+
// node_modules/@stripe/stripe-js/dist/pure.js
|
|
7
|
+
var require_pure = __commonJS({
|
|
8
|
+
"node_modules/@stripe/stripe-js/dist/pure.js"(exports) {
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
function _typeof2(obj) {
|
|
11
|
+
"@babel/helpers - typeof";
|
|
12
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
13
|
+
_typeof2 = function(obj2) {
|
|
14
|
+
return typeof obj2;
|
|
15
|
+
};
|
|
16
|
+
} else {
|
|
17
|
+
_typeof2 = function(obj2) {
|
|
18
|
+
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return _typeof2(obj);
|
|
22
|
+
}
|
|
23
|
+
var RELEASE_TRAIN = "dahlia";
|
|
24
|
+
var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion2(version) {
|
|
25
|
+
return version === 3 ? "v3" : version;
|
|
26
|
+
};
|
|
27
|
+
var ORIGIN = "https://js.stripe.com";
|
|
28
|
+
var STRIPE_JS_URL = "".concat(ORIGIN, "/").concat(RELEASE_TRAIN, "/stripe.js");
|
|
29
|
+
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
30
|
+
var STRIPE_JS_URL_REGEX = /^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;
|
|
31
|
+
var EXISTING_SCRIPT_MESSAGE = "loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";
|
|
32
|
+
var isStripeJSURL = function isStripeJSURL2(url) {
|
|
33
|
+
return V3_URL_REGEX.test(url) || STRIPE_JS_URL_REGEX.test(url);
|
|
34
|
+
};
|
|
35
|
+
var findScript = function findScript2() {
|
|
36
|
+
var scripts = document.querySelectorAll('script[src^="'.concat(ORIGIN, '"]'));
|
|
37
|
+
for (var i = 0; i < scripts.length; i++) {
|
|
38
|
+
var script = scripts[i];
|
|
39
|
+
if (!isStripeJSURL(script.src)) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
return script;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
};
|
|
46
|
+
var injectScript = function injectScript2(params) {
|
|
47
|
+
var queryString = params && !params.advancedFraudSignals ? "?advancedFraudSignals=false" : "";
|
|
48
|
+
var script = document.createElement("script");
|
|
49
|
+
script.src = "".concat(STRIPE_JS_URL).concat(queryString);
|
|
50
|
+
var headOrBody = document.head || document.body;
|
|
51
|
+
if (!headOrBody) {
|
|
52
|
+
throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");
|
|
53
|
+
}
|
|
54
|
+
headOrBody.appendChild(script);
|
|
55
|
+
return script;
|
|
56
|
+
};
|
|
57
|
+
var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
58
|
+
if (!stripe || !stripe._registerWrapper) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
stripe._registerWrapper({
|
|
62
|
+
name: "stripe-js",
|
|
63
|
+
version: "9.9.0",
|
|
64
|
+
startTime
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
var stripePromise = null;
|
|
68
|
+
var onErrorListener = null;
|
|
69
|
+
var onLoadListener = null;
|
|
70
|
+
var onError = function onError2(reject) {
|
|
71
|
+
return function(cause) {
|
|
72
|
+
reject(new Error("Failed to load Stripe.js", {
|
|
73
|
+
cause
|
|
74
|
+
}));
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
var onLoad = function onLoad2(resolve, reject) {
|
|
78
|
+
return function() {
|
|
79
|
+
if (window.Stripe) {
|
|
80
|
+
resolve(window.Stripe);
|
|
81
|
+
} else {
|
|
82
|
+
reject(new Error("Stripe.js not available"));
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
var loadScript = function loadScript2(params) {
|
|
87
|
+
if (stripePromise !== null) {
|
|
88
|
+
return stripePromise;
|
|
89
|
+
}
|
|
90
|
+
stripePromise = new Promise(function(resolve, reject) {
|
|
91
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
92
|
+
resolve(null);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (window.Stripe && params) {
|
|
96
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
97
|
+
}
|
|
98
|
+
if (window.Stripe) {
|
|
99
|
+
resolve(window.Stripe);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
var script = findScript();
|
|
104
|
+
if (script && params) {
|
|
105
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
106
|
+
} else if (!script) {
|
|
107
|
+
script = injectScript(params);
|
|
108
|
+
} else if (script && onLoadListener !== null && onErrorListener !== null) {
|
|
109
|
+
var _script$parentNode;
|
|
110
|
+
script.removeEventListener("load", onLoadListener);
|
|
111
|
+
script.removeEventListener("error", onErrorListener);
|
|
112
|
+
(_script$parentNode = script.parentNode) === null || _script$parentNode === void 0 ? void 0 : _script$parentNode.removeChild(script);
|
|
113
|
+
script = injectScript(params);
|
|
114
|
+
}
|
|
115
|
+
onLoadListener = onLoad(resolve, reject);
|
|
116
|
+
onErrorListener = onError(reject);
|
|
117
|
+
script.addEventListener("load", onLoadListener);
|
|
118
|
+
script.addEventListener("error", onErrorListener);
|
|
119
|
+
} catch (error) {
|
|
120
|
+
reject(error);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
return stripePromise["catch"](function(error) {
|
|
125
|
+
stripePromise = null;
|
|
126
|
+
return Promise.reject(error);
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
var initStripe = function initStripe2(maybeStripe, args, startTime) {
|
|
130
|
+
if (maybeStripe === null) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
var pk = args[0];
|
|
134
|
+
if (typeof pk !== "string") {
|
|
135
|
+
throw new Error("Expected publishable key to be of type string, got type ".concat(_typeof2(pk), " instead."));
|
|
136
|
+
}
|
|
137
|
+
var isTestKey = pk.match(/^pk_test/);
|
|
138
|
+
var version = runtimeVersionToUrlVersion(maybeStripe.version);
|
|
139
|
+
var expectedVersion = RELEASE_TRAIN;
|
|
140
|
+
if (isTestKey && version !== expectedVersion) {
|
|
141
|
+
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.9.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
142
|
+
}
|
|
143
|
+
var stripe = maybeStripe.apply(void 0, args);
|
|
144
|
+
registerWrapper(stripe, startTime);
|
|
145
|
+
return stripe;
|
|
146
|
+
};
|
|
147
|
+
var validateLoadParams = function validateLoadParams2(params) {
|
|
148
|
+
var errorMessage = "invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(params), "\n");
|
|
149
|
+
if (params === null || _typeof2(params) !== "object") {
|
|
150
|
+
throw new Error(errorMessage);
|
|
151
|
+
}
|
|
152
|
+
if (Object.keys(params).length === 1 && typeof params.advancedFraudSignals === "boolean") {
|
|
153
|
+
return params;
|
|
154
|
+
}
|
|
155
|
+
throw new Error(errorMessage);
|
|
156
|
+
};
|
|
157
|
+
var loadParams;
|
|
158
|
+
var loadStripeCalled = false;
|
|
159
|
+
var loadStripe2 = function loadStripe3() {
|
|
160
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
161
|
+
args[_key] = arguments[_key];
|
|
162
|
+
}
|
|
163
|
+
loadStripeCalled = true;
|
|
164
|
+
var startTime = Date.now();
|
|
165
|
+
return loadScript(loadParams).then(function(maybeStripe) {
|
|
166
|
+
return initStripe(maybeStripe, args, startTime);
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
loadStripe2.setLoadParameters = function(params) {
|
|
170
|
+
if (loadStripeCalled && loadParams) {
|
|
171
|
+
var validatedParams = validateLoadParams(params);
|
|
172
|
+
var parameterKeys = Object.keys(validatedParams);
|
|
173
|
+
var sameParameters = parameterKeys.reduce(function(previousValue, currentValue) {
|
|
174
|
+
var _loadParams;
|
|
175
|
+
return previousValue && params[currentValue] === ((_loadParams = loadParams) === null || _loadParams === void 0 ? void 0 : _loadParams[currentValue]);
|
|
176
|
+
}, true);
|
|
177
|
+
if (sameParameters) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (loadStripeCalled) {
|
|
182
|
+
throw new Error("You cannot change load parameters after calling loadStripe");
|
|
183
|
+
}
|
|
184
|
+
loadParams = validateLoadParams(params);
|
|
185
|
+
};
|
|
186
|
+
exports.loadStripe = loadStripe2;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// node_modules/@stripe/stripe-js/pure/index.js
|
|
191
|
+
var require_pure2 = __commonJS({
|
|
192
|
+
"node_modules/@stripe/stripe-js/pure/index.js"(exports, module) {
|
|
193
|
+
module.exports = require_pure();
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
|
|
6
197
|
// ../../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js
|
|
7
198
|
var require_react_is_production_min = __commonJS({
|
|
8
199
|
"../../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js"(exports) {
|
|
@@ -938,168 +1129,8 @@ var require_prop_types = __commonJS({
|
|
|
938
1129
|
}
|
|
939
1130
|
});
|
|
940
1131
|
|
|
941
|
-
//
|
|
942
|
-
|
|
943
|
-
"@babel/helpers - typeof";
|
|
944
|
-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
945
|
-
_typeof = function(obj2) {
|
|
946
|
-
return typeof obj2;
|
|
947
|
-
};
|
|
948
|
-
} else {
|
|
949
|
-
_typeof = function(obj2) {
|
|
950
|
-
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
951
|
-
};
|
|
952
|
-
}
|
|
953
|
-
return _typeof(obj);
|
|
954
|
-
}
|
|
955
|
-
var RELEASE_TRAIN = "dahlia";
|
|
956
|
-
var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion2(version) {
|
|
957
|
-
return version === 3 ? "v3" : version;
|
|
958
|
-
};
|
|
959
|
-
var ORIGIN = "https://js.stripe.com";
|
|
960
|
-
var STRIPE_JS_URL = "".concat(ORIGIN, "/").concat(RELEASE_TRAIN, "/stripe.js");
|
|
961
|
-
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
962
|
-
var STRIPE_JS_URL_REGEX = /^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;
|
|
963
|
-
var EXISTING_SCRIPT_MESSAGE = "loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";
|
|
964
|
-
var isStripeJSURL = function isStripeJSURL2(url) {
|
|
965
|
-
return V3_URL_REGEX.test(url) || STRIPE_JS_URL_REGEX.test(url);
|
|
966
|
-
};
|
|
967
|
-
var findScript = function findScript2() {
|
|
968
|
-
var scripts = document.querySelectorAll('script[src^="'.concat(ORIGIN, '"]'));
|
|
969
|
-
for (var i = 0; i < scripts.length; i++) {
|
|
970
|
-
var script = scripts[i];
|
|
971
|
-
if (!isStripeJSURL(script.src)) {
|
|
972
|
-
continue;
|
|
973
|
-
}
|
|
974
|
-
return script;
|
|
975
|
-
}
|
|
976
|
-
return null;
|
|
977
|
-
};
|
|
978
|
-
var injectScript = function injectScript2(params) {
|
|
979
|
-
var queryString = "";
|
|
980
|
-
var script = document.createElement("script");
|
|
981
|
-
script.src = "".concat(STRIPE_JS_URL).concat(queryString);
|
|
982
|
-
var headOrBody = document.head || document.body;
|
|
983
|
-
if (!headOrBody) {
|
|
984
|
-
throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");
|
|
985
|
-
}
|
|
986
|
-
headOrBody.appendChild(script);
|
|
987
|
-
return script;
|
|
988
|
-
};
|
|
989
|
-
var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
990
|
-
if (!stripe || !stripe._registerWrapper) {
|
|
991
|
-
return;
|
|
992
|
-
}
|
|
993
|
-
stripe._registerWrapper({
|
|
994
|
-
name: "stripe-js",
|
|
995
|
-
version: "9.9.0",
|
|
996
|
-
startTime
|
|
997
|
-
});
|
|
998
|
-
};
|
|
999
|
-
var stripePromise$1 = null;
|
|
1000
|
-
var onErrorListener = null;
|
|
1001
|
-
var onLoadListener = null;
|
|
1002
|
-
var onError = function onError2(reject) {
|
|
1003
|
-
return function(cause) {
|
|
1004
|
-
reject(new Error("Failed to load Stripe.js", {
|
|
1005
|
-
cause
|
|
1006
|
-
}));
|
|
1007
|
-
};
|
|
1008
|
-
};
|
|
1009
|
-
var onLoad = function onLoad2(resolve, reject) {
|
|
1010
|
-
return function() {
|
|
1011
|
-
if (window.Stripe) {
|
|
1012
|
-
resolve(window.Stripe);
|
|
1013
|
-
} else {
|
|
1014
|
-
reject(new Error("Stripe.js not available"));
|
|
1015
|
-
}
|
|
1016
|
-
};
|
|
1017
|
-
};
|
|
1018
|
-
var loadScript = function loadScript2(params) {
|
|
1019
|
-
if (stripePromise$1 !== null) {
|
|
1020
|
-
return stripePromise$1;
|
|
1021
|
-
}
|
|
1022
|
-
stripePromise$1 = new Promise(function(resolve, reject) {
|
|
1023
|
-
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
1024
|
-
resolve(null);
|
|
1025
|
-
return;
|
|
1026
|
-
}
|
|
1027
|
-
if (window.Stripe) {
|
|
1028
|
-
resolve(window.Stripe);
|
|
1029
|
-
return;
|
|
1030
|
-
}
|
|
1031
|
-
try {
|
|
1032
|
-
var script = findScript();
|
|
1033
|
-
if (script && params) ; else if (!script) {
|
|
1034
|
-
script = injectScript(params);
|
|
1035
|
-
} else if (script && onLoadListener !== null && onErrorListener !== null) {
|
|
1036
|
-
var _script$parentNode;
|
|
1037
|
-
script.removeEventListener("load", onLoadListener);
|
|
1038
|
-
script.removeEventListener("error", onErrorListener);
|
|
1039
|
-
(_script$parentNode = script.parentNode) === null || _script$parentNode === void 0 ? void 0 : _script$parentNode.removeChild(script);
|
|
1040
|
-
script = injectScript(params);
|
|
1041
|
-
}
|
|
1042
|
-
onLoadListener = onLoad(resolve, reject);
|
|
1043
|
-
onErrorListener = onError(reject);
|
|
1044
|
-
script.addEventListener("load", onLoadListener);
|
|
1045
|
-
script.addEventListener("error", onErrorListener);
|
|
1046
|
-
} catch (error) {
|
|
1047
|
-
reject(error);
|
|
1048
|
-
return;
|
|
1049
|
-
}
|
|
1050
|
-
});
|
|
1051
|
-
return stripePromise$1["catch"](function(error) {
|
|
1052
|
-
stripePromise$1 = null;
|
|
1053
|
-
return Promise.reject(error);
|
|
1054
|
-
});
|
|
1055
|
-
};
|
|
1056
|
-
var initStripe = function initStripe2(maybeStripe, args, startTime) {
|
|
1057
|
-
if (maybeStripe === null) {
|
|
1058
|
-
return null;
|
|
1059
|
-
}
|
|
1060
|
-
var pk = args[0];
|
|
1061
|
-
if (typeof pk !== "string") {
|
|
1062
|
-
throw new Error("Expected publishable key to be of type string, got type ".concat(_typeof(pk), " instead."));
|
|
1063
|
-
}
|
|
1064
|
-
var isTestKey = pk.match(/^pk_test/);
|
|
1065
|
-
var version = runtimeVersionToUrlVersion(maybeStripe.version);
|
|
1066
|
-
var expectedVersion = RELEASE_TRAIN;
|
|
1067
|
-
if (isTestKey && version !== expectedVersion) {
|
|
1068
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.9.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
1069
|
-
}
|
|
1070
|
-
var stripe = maybeStripe.apply(void 0, args);
|
|
1071
|
-
registerWrapper(stripe, startTime);
|
|
1072
|
-
return stripe;
|
|
1073
|
-
};
|
|
1074
|
-
var stripePromise;
|
|
1075
|
-
var loadCalled = false;
|
|
1076
|
-
var getStripePromise = function getStripePromise2() {
|
|
1077
|
-
if (stripePromise) {
|
|
1078
|
-
return stripePromise;
|
|
1079
|
-
}
|
|
1080
|
-
stripePromise = loadScript(null)["catch"](function(error) {
|
|
1081
|
-
stripePromise = null;
|
|
1082
|
-
return Promise.reject(error);
|
|
1083
|
-
});
|
|
1084
|
-
return stripePromise;
|
|
1085
|
-
};
|
|
1086
|
-
Promise.resolve().then(function() {
|
|
1087
|
-
return getStripePromise();
|
|
1088
|
-
})["catch"](function(error) {
|
|
1089
|
-
if (!loadCalled) {
|
|
1090
|
-
console.warn(error);
|
|
1091
|
-
}
|
|
1092
|
-
});
|
|
1093
|
-
var loadStripe = function loadStripe2() {
|
|
1094
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1095
|
-
args[_key] = arguments[_key];
|
|
1096
|
-
}
|
|
1097
|
-
loadCalled = true;
|
|
1098
|
-
var startTime = Date.now();
|
|
1099
|
-
return getStripePromise().then(function(maybeStripe) {
|
|
1100
|
-
return initStripe(maybeStripe, args, startTime);
|
|
1101
|
-
});
|
|
1102
|
-
};
|
|
1132
|
+
// src/drivers/stripe.tsx
|
|
1133
|
+
var import_pure = __toESM(require_pure2(), 1);
|
|
1103
1134
|
|
|
1104
1135
|
// node_modules/@stripe/react-stripe-js/dist/react-stripe.esm.mjs
|
|
1105
1136
|
var react_stripe_esm_exports = {};
|
|
@@ -1252,13 +1283,13 @@ function _toPropertyKey(t) {
|
|
|
1252
1283
|
var i = _toPrimitive(t, "string");
|
|
1253
1284
|
return "symbol" == typeof i ? i : i + "";
|
|
1254
1285
|
}
|
|
1255
|
-
function
|
|
1286
|
+
function _typeof(o) {
|
|
1256
1287
|
"@babel/helpers - typeof";
|
|
1257
|
-
return
|
|
1288
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
1258
1289
|
return typeof o2;
|
|
1259
1290
|
} : function(o2) {
|
|
1260
1291
|
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
1261
|
-
},
|
|
1292
|
+
}, _typeof(o);
|
|
1262
1293
|
}
|
|
1263
1294
|
function _unsupportedIterableToArray(r, a) {
|
|
1264
1295
|
if (r) {
|
|
@@ -1298,7 +1329,7 @@ var usePrevious = function usePrevious2(value) {
|
|
|
1298
1329
|
return ref.current;
|
|
1299
1330
|
};
|
|
1300
1331
|
var isUnknownObject = function isUnknownObject2(raw) {
|
|
1301
|
-
return raw !== null &&
|
|
1332
|
+
return raw !== null && _typeof(raw) === "object";
|
|
1302
1333
|
};
|
|
1303
1334
|
var isPromise = function isPromise2(raw) {
|
|
1304
1335
|
return isUnknownObject(raw) && typeof raw.then === "function";
|
|
@@ -1791,7 +1822,7 @@ var EmbeddedCheckoutServerElement = function EmbeddedCheckoutServerElement2(_ref
|
|
|
1791
1822
|
};
|
|
1792
1823
|
var EmbeddedCheckout = isServer ? EmbeddedCheckoutServerElement : EmbeddedCheckoutClientElement;
|
|
1793
1824
|
var FinancialAccountDisclosure = function FinancialAccountDisclosure2(_ref) {
|
|
1794
|
-
var rawStripeProp = _ref.stripe,
|
|
1825
|
+
var rawStripeProp = _ref.stripe, onLoad = _ref.onLoad, onError = _ref.onError, options = _ref.options;
|
|
1795
1826
|
var businessName = options === null || options === void 0 ? void 0 : options.businessName;
|
|
1796
1827
|
var learnMoreLink = options === null || options === void 0 ? void 0 : options.learnMoreLink;
|
|
1797
1828
|
var containerRef = React.useRef(null);
|
|
@@ -1802,9 +1833,9 @@ var FinancialAccountDisclosure = function FinancialAccountDisclosure2(_ref) {
|
|
|
1802
1833
|
React.useEffect(function() {
|
|
1803
1834
|
var isMounted = true;
|
|
1804
1835
|
if (parsed.tag === "async") {
|
|
1805
|
-
parsed.stripePromise.then(function(
|
|
1806
|
-
if (
|
|
1807
|
-
setStripeState(
|
|
1836
|
+
parsed.stripePromise.then(function(stripePromise) {
|
|
1837
|
+
if (stripePromise && isMounted) {
|
|
1838
|
+
setStripeState(stripePromise);
|
|
1808
1839
|
}
|
|
1809
1840
|
});
|
|
1810
1841
|
} else if (parsed.tag === "sync") {
|
|
@@ -1846,14 +1877,14 @@ var FinancialAccountDisclosure = function FinancialAccountDisclosure2(_ref) {
|
|
|
1846
1877
|
_yield$stripeState$cr = _context.sent;
|
|
1847
1878
|
disclosureContent = _yield$stripeState$cr.htmlElement;
|
|
1848
1879
|
error = _yield$stripeState$cr.error;
|
|
1849
|
-
if (error &&
|
|
1850
|
-
|
|
1880
|
+
if (error && onError) {
|
|
1881
|
+
onError(error);
|
|
1851
1882
|
} else if (disclosureContent) {
|
|
1852
1883
|
container = containerRef.current;
|
|
1853
1884
|
container.innerHTML = "";
|
|
1854
1885
|
container.appendChild(disclosureContent);
|
|
1855
|
-
if (
|
|
1856
|
-
|
|
1886
|
+
if (onLoad) {
|
|
1887
|
+
onLoad();
|
|
1857
1888
|
}
|
|
1858
1889
|
}
|
|
1859
1890
|
case 8:
|
|
@@ -1868,13 +1899,13 @@ var FinancialAccountDisclosure = function FinancialAccountDisclosure2(_ref) {
|
|
|
1868
1899
|
};
|
|
1869
1900
|
})();
|
|
1870
1901
|
createDisclosure();
|
|
1871
|
-
}, [stripeState, businessName, learnMoreLink,
|
|
1902
|
+
}, [stripeState, businessName, learnMoreLink, onLoad, onError]);
|
|
1872
1903
|
return /* @__PURE__ */ React.createElement("div", {
|
|
1873
1904
|
ref: containerRef
|
|
1874
1905
|
});
|
|
1875
1906
|
};
|
|
1876
1907
|
var IssuingDisclosure = function IssuingDisclosure2(_ref) {
|
|
1877
|
-
var rawStripeProp = _ref.stripe,
|
|
1908
|
+
var rawStripeProp = _ref.stripe, onLoad = _ref.onLoad, onError = _ref.onError, options = _ref.options;
|
|
1878
1909
|
var issuingProgramID = options === null || options === void 0 ? void 0 : options.issuingProgramID;
|
|
1879
1910
|
var publicCardProgramName = options === null || options === void 0 ? void 0 : options.publicCardProgramName;
|
|
1880
1911
|
var learnMoreLink = options === null || options === void 0 ? void 0 : options.learnMoreLink;
|
|
@@ -1886,9 +1917,9 @@ var IssuingDisclosure = function IssuingDisclosure2(_ref) {
|
|
|
1886
1917
|
React.useEffect(function() {
|
|
1887
1918
|
var isMounted = true;
|
|
1888
1919
|
if (parsed.tag === "async") {
|
|
1889
|
-
parsed.stripePromise.then(function(
|
|
1890
|
-
if (
|
|
1891
|
-
setStripeState(
|
|
1920
|
+
parsed.stripePromise.then(function(stripePromise) {
|
|
1921
|
+
if (stripePromise && isMounted) {
|
|
1922
|
+
setStripeState(stripePromise);
|
|
1892
1923
|
}
|
|
1893
1924
|
});
|
|
1894
1925
|
} else if (parsed.tag === "sync") {
|
|
@@ -1931,14 +1962,14 @@ var IssuingDisclosure = function IssuingDisclosure2(_ref) {
|
|
|
1931
1962
|
_yield$stripeState$cr = _context.sent;
|
|
1932
1963
|
disclosureContent = _yield$stripeState$cr.htmlElement;
|
|
1933
1964
|
error = _yield$stripeState$cr.error;
|
|
1934
|
-
if (error &&
|
|
1935
|
-
|
|
1965
|
+
if (error && onError) {
|
|
1966
|
+
onError(error);
|
|
1936
1967
|
} else if (disclosureContent) {
|
|
1937
1968
|
container = containerRef.current;
|
|
1938
1969
|
container.innerHTML = "";
|
|
1939
1970
|
container.appendChild(disclosureContent);
|
|
1940
|
-
if (
|
|
1941
|
-
|
|
1971
|
+
if (onLoad) {
|
|
1972
|
+
onLoad();
|
|
1942
1973
|
}
|
|
1943
1974
|
}
|
|
1944
1975
|
case 8:
|
|
@@ -1953,7 +1984,7 @@ var IssuingDisclosure = function IssuingDisclosure2(_ref) {
|
|
|
1953
1984
|
};
|
|
1954
1985
|
})();
|
|
1955
1986
|
createDisclosure();
|
|
1956
|
-
}, [stripeState, issuingProgramID, publicCardProgramName, learnMoreLink,
|
|
1987
|
+
}, [stripeState, issuingProgramID, publicCardProgramName, learnMoreLink, onLoad, onError]);
|
|
1957
1988
|
return /* @__PURE__ */ React.createElement("div", {
|
|
1958
1989
|
ref: containerRef
|
|
1959
1990
|
});
|
|
@@ -1986,10 +2017,30 @@ var IssuingCardCopyButtonElement = createElementComponent("issuingCardCopyButton
|
|
|
1986
2017
|
|
|
1987
2018
|
// src/drivers/stripe.tsx
|
|
1988
2019
|
var stripeInstances = /* @__PURE__ */ new Map();
|
|
2020
|
+
function isNullOriginPreview() {
|
|
2021
|
+
if (typeof window === "undefined") return false;
|
|
2022
|
+
try {
|
|
2023
|
+
const origin = window.origin ?? window.location?.origin;
|
|
2024
|
+
return origin === "null";
|
|
2025
|
+
} catch {
|
|
2026
|
+
return false;
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
var fraudSignalsConfigured = false;
|
|
2030
|
+
function configureFraudSignals() {
|
|
2031
|
+
if (fraudSignalsConfigured) return;
|
|
2032
|
+
fraudSignalsConfigured = true;
|
|
2033
|
+
if (!isNullOriginPreview()) return;
|
|
2034
|
+
try {
|
|
2035
|
+
import_pure.loadStripe.setLoadParameters({ advancedFraudSignals: false });
|
|
2036
|
+
} catch {
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
1989
2039
|
async function loadProvider(publishableKey) {
|
|
1990
2040
|
let stripe = stripeInstances.get(publishableKey);
|
|
1991
2041
|
if (!stripe) {
|
|
1992
|
-
|
|
2042
|
+
configureFraudSignals();
|
|
2043
|
+
stripe = (0, import_pure.loadStripe)(publishableKey);
|
|
1993
2044
|
stripeInstances.set(publishableKey, stripe);
|
|
1994
2045
|
}
|
|
1995
2046
|
return { rsj: react_stripe_esm_exports, stripe };
|
|
@@ -2151,7 +2202,7 @@ function ConfirmForm({
|
|
|
2151
2202
|
secretKind,
|
|
2152
2203
|
onStart,
|
|
2153
2204
|
onPaymentAdded,
|
|
2154
|
-
onError
|
|
2205
|
+
onError,
|
|
2155
2206
|
reportFailure,
|
|
2156
2207
|
finish
|
|
2157
2208
|
}) {
|
|
@@ -2168,19 +2219,19 @@ function ConfirmForm({
|
|
|
2168
2219
|
const { error, setupIntent } = await stripe.confirmSetup({ elements, redirect: "if_required" });
|
|
2169
2220
|
if (error) {
|
|
2170
2221
|
reportFailure(error.setup_intent?.id);
|
|
2171
|
-
return
|
|
2222
|
+
return onError(fromStripeError(error));
|
|
2172
2223
|
}
|
|
2173
2224
|
await finish(setupIntent?.id);
|
|
2174
2225
|
} else {
|
|
2175
2226
|
const { error, paymentIntent } = await stripe.confirmPayment({ elements, redirect: "if_required" });
|
|
2176
2227
|
if (error) {
|
|
2177
2228
|
reportFailure(error.payment_intent?.id);
|
|
2178
|
-
return
|
|
2229
|
+
return onError(fromStripeError(error));
|
|
2179
2230
|
}
|
|
2180
2231
|
await finish(paymentIntent?.id);
|
|
2181
2232
|
}
|
|
2182
2233
|
} catch (e) {
|
|
2183
|
-
|
|
2234
|
+
onError(toCheckoutError(e));
|
|
2184
2235
|
} finally {
|
|
2185
2236
|
setSubmitting(false);
|
|
2186
2237
|
}
|
|
@@ -2243,6 +2294,6 @@ object-assign/index.js:
|
|
|
2243
2294
|
*)
|
|
2244
2295
|
*/
|
|
2245
2296
|
|
|
2246
|
-
export { stripeCheckoutDriver };
|
|
2297
|
+
export { isNullOriginPreview, stripeCheckoutDriver };
|
|
2247
2298
|
//# sourceMappingURL=driver-stripe.js.map
|
|
2248
2299
|
//# sourceMappingURL=driver-stripe.js.map
|