@appfunnel-dev/sdk 2.0.0-canary.4 → 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.
Files changed (60) hide show
  1. package/README.md +1 -1
  2. package/dist/{checkout-Dz8cGkB_.d.cts → checkout-CMEdxpgo.d.cts} +13 -13
  3. package/dist/{checkout-7Dy6IedP.d.ts → checkout-D1NUPv4p.d.ts} +13 -13
  4. package/dist/{chunk-AKO6XKXP.js → chunk-7YQLPPPG.js} +66 -91
  5. package/dist/chunk-7YQLPPPG.js.map +1 -0
  6. package/dist/{chunk-JSRKA375.cjs → chunk-BPOAWI4G.cjs} +68 -94
  7. package/dist/chunk-BPOAWI4G.cjs.map +1 -0
  8. package/dist/{chunk-M6U3FNRW.js → chunk-CFFMZYPE.js} +3 -3
  9. package/dist/{chunk-M6U3FNRW.js.map → chunk-CFFMZYPE.js.map} +1 -1
  10. package/dist/chunk-EMMSS5I5.cjs +37 -0
  11. package/dist/chunk-EMMSS5I5.cjs.map +1 -0
  12. package/dist/chunk-G3PMV62Z.js +33 -0
  13. package/dist/chunk-G3PMV62Z.js.map +1 -0
  14. package/dist/{chunk-LJYLGLFS.cjs → chunk-QMAZGLGV.cjs} +2 -35
  15. package/dist/chunk-QMAZGLGV.cjs.map +1 -0
  16. package/dist/{chunk-YY375F2B.js → chunk-TNLRQPVY.js} +3 -33
  17. package/dist/chunk-TNLRQPVY.js.map +1 -0
  18. package/dist/{chunk-CY4VBSMX.cjs → chunk-VAOR77NW.cjs} +7 -7
  19. package/dist/{chunk-CY4VBSMX.cjs.map → chunk-VAOR77NW.cjs.map} +1 -1
  20. package/dist/chunk-WYUDL4FI.cjs +8 -0
  21. package/dist/chunk-WYUDL4FI.cjs.map +1 -0
  22. package/dist/chunk-ZZJG4EYL.js +6 -0
  23. package/dist/chunk-ZZJG4EYL.js.map +1 -0
  24. package/dist/driver-paddle.cjs +23 -22
  25. package/dist/driver-paddle.cjs.map +1 -1
  26. package/dist/driver-paddle.d.cts +1 -1
  27. package/dist/driver-paddle.d.ts +1 -1
  28. package/dist/driver-paddle.js +3 -2
  29. package/dist/driver-paddle.js.map +1 -1
  30. package/dist/driver-stripe.cjs +277 -224
  31. package/dist/driver-stripe.cjs.map +1 -1
  32. package/dist/driver-stripe.d.cts +18 -2
  33. package/dist/driver-stripe.d.ts +18 -2
  34. package/dist/driver-stripe.js +244 -192
  35. package/dist/driver-stripe.js.map +1 -1
  36. package/dist/index.cjs +750 -150
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +151 -90
  39. package/dist/index.d.ts +151 -90
  40. package/dist/index.js +702 -98
  41. package/dist/index.js.map +1 -1
  42. package/dist/{manifest-Cr2y1op6.d.cts → manifest-CMe8yVkr.d.cts} +131 -88
  43. package/dist/{manifest-Cr2y1op6.d.ts → manifest-CMe8yVkr.d.ts} +131 -88
  44. package/dist/manifest-entry.cjs +62 -47
  45. package/dist/manifest-entry.cjs.map +1 -1
  46. package/dist/manifest-entry.d.cts +15 -15
  47. package/dist/manifest-entry.d.ts +15 -15
  48. package/dist/manifest-entry.js +25 -14
  49. package/dist/manifest-entry.js.map +1 -1
  50. package/dist/protocol.cjs +13 -0
  51. package/dist/protocol.cjs.map +1 -0
  52. package/dist/protocol.d.cts +182 -0
  53. package/dist/protocol.d.ts +182 -0
  54. package/dist/protocol.js +4 -0
  55. package/dist/protocol.js.map +1 -0
  56. package/package.json +14 -2
  57. package/dist/chunk-AKO6XKXP.js.map +0 -1
  58. package/dist/chunk-JSRKA375.cjs.map +0 -1
  59. package/dist/chunk-LJYLGLFS.cjs.map +0 -1
  60. package/dist/chunk-YY375F2B.js.map +0 -1
@@ -1,8 +1,24 @@
1
- import { C as CheckoutDriverContext, a as CheckoutDriver } from './checkout-Dz8cGkB_.cjs';
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 };
@@ -1,8 +1,24 @@
1
- import { C as CheckoutDriverContext, a as CheckoutDriver } from './checkout-7Dy6IedP.js';
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 };
@@ -1,7 +1,199 @@
1
- import { completeWithPoll, postSession, leaveForRedirect, settlementToResult, toCheckoutError, postComplete } from './chunk-M6U3FNRW.js';
2
- import { __commonJS, __export, __toESM, checkoutError } from './chunk-YY375F2B.js';
1
+ import { completeWithPoll, postSession, leaveForRedirect, settlementToResult, toCheckoutError, postComplete } from './chunk-CFFMZYPE.js';
2
+ import { checkoutError } from './chunk-TNLRQPVY.js';
3
+ import { __commonJS, __toESM, __export } from './chunk-G3PMV62Z.js';
3
4
  import React, { createElement, useState, useRef, useEffect } from 'react';
4
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
+
5
197
  // ../../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js
6
198
  var require_react_is_production_min = __commonJS({
7
199
  "../../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js"(exports) {
@@ -937,168 +1129,8 @@ var require_prop_types = __commonJS({
937
1129
  }
938
1130
  });
939
1131
 
940
- // node_modules/@stripe/stripe-js/dist/index.mjs
941
- function _typeof(obj) {
942
- "@babel/helpers - typeof";
943
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
944
- _typeof = function(obj2) {
945
- return typeof obj2;
946
- };
947
- } else {
948
- _typeof = function(obj2) {
949
- return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
950
- };
951
- }
952
- return _typeof(obj);
953
- }
954
- var RELEASE_TRAIN = "dahlia";
955
- var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion2(version) {
956
- return version === 3 ? "v3" : version;
957
- };
958
- var ORIGIN = "https://js.stripe.com";
959
- var STRIPE_JS_URL = "".concat(ORIGIN, "/").concat(RELEASE_TRAIN, "/stripe.js");
960
- var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
961
- var STRIPE_JS_URL_REGEX = /^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;
962
- 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";
963
- var isStripeJSURL = function isStripeJSURL2(url) {
964
- return V3_URL_REGEX.test(url) || STRIPE_JS_URL_REGEX.test(url);
965
- };
966
- var findScript = function findScript2() {
967
- var scripts = document.querySelectorAll('script[src^="'.concat(ORIGIN, '"]'));
968
- for (var i = 0; i < scripts.length; i++) {
969
- var script = scripts[i];
970
- if (!isStripeJSURL(script.src)) {
971
- continue;
972
- }
973
- return script;
974
- }
975
- return null;
976
- };
977
- var injectScript = function injectScript2(params) {
978
- var queryString = "";
979
- var script = document.createElement("script");
980
- script.src = "".concat(STRIPE_JS_URL).concat(queryString);
981
- var headOrBody = document.head || document.body;
982
- if (!headOrBody) {
983
- throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");
984
- }
985
- headOrBody.appendChild(script);
986
- return script;
987
- };
988
- var registerWrapper = function registerWrapper2(stripe, startTime) {
989
- if (!stripe || !stripe._registerWrapper) {
990
- return;
991
- }
992
- stripe._registerWrapper({
993
- name: "stripe-js",
994
- version: "9.9.0",
995
- startTime
996
- });
997
- };
998
- var stripePromise$1 = null;
999
- var onErrorListener = null;
1000
- var onLoadListener = null;
1001
- var onError = function onError2(reject) {
1002
- return function(cause) {
1003
- reject(new Error("Failed to load Stripe.js", {
1004
- cause
1005
- }));
1006
- };
1007
- };
1008
- var onLoad = function onLoad2(resolve, reject) {
1009
- return function() {
1010
- if (window.Stripe) {
1011
- resolve(window.Stripe);
1012
- } else {
1013
- reject(new Error("Stripe.js not available"));
1014
- }
1015
- };
1016
- };
1017
- var loadScript = function loadScript2(params) {
1018
- if (stripePromise$1 !== null) {
1019
- return stripePromise$1;
1020
- }
1021
- stripePromise$1 = new Promise(function(resolve, reject) {
1022
- if (typeof window === "undefined" || typeof document === "undefined") {
1023
- resolve(null);
1024
- return;
1025
- }
1026
- if (window.Stripe) {
1027
- resolve(window.Stripe);
1028
- return;
1029
- }
1030
- try {
1031
- var script = findScript();
1032
- if (script && params) ; else if (!script) {
1033
- script = injectScript(params);
1034
- } else if (script && onLoadListener !== null && onErrorListener !== null) {
1035
- var _script$parentNode;
1036
- script.removeEventListener("load", onLoadListener);
1037
- script.removeEventListener("error", onErrorListener);
1038
- (_script$parentNode = script.parentNode) === null || _script$parentNode === void 0 ? void 0 : _script$parentNode.removeChild(script);
1039
- script = injectScript(params);
1040
- }
1041
- onLoadListener = onLoad(resolve, reject);
1042
- onErrorListener = onError(reject);
1043
- script.addEventListener("load", onLoadListener);
1044
- script.addEventListener("error", onErrorListener);
1045
- } catch (error) {
1046
- reject(error);
1047
- return;
1048
- }
1049
- });
1050
- return stripePromise$1["catch"](function(error) {
1051
- stripePromise$1 = null;
1052
- return Promise.reject(error);
1053
- });
1054
- };
1055
- var initStripe = function initStripe2(maybeStripe, args, startTime) {
1056
- if (maybeStripe === null) {
1057
- return null;
1058
- }
1059
- var pk = args[0];
1060
- if (typeof pk !== "string") {
1061
- throw new Error("Expected publishable key to be of type string, got type ".concat(_typeof(pk), " instead."));
1062
- }
1063
- var isTestKey = pk.match(/^pk_test/);
1064
- var version = runtimeVersionToUrlVersion(maybeStripe.version);
1065
- var expectedVersion = RELEASE_TRAIN;
1066
- if (isTestKey && version !== expectedVersion) {
1067
- 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"));
1068
- }
1069
- var stripe = maybeStripe.apply(void 0, args);
1070
- registerWrapper(stripe, startTime);
1071
- return stripe;
1072
- };
1073
- var stripePromise;
1074
- var loadCalled = false;
1075
- var getStripePromise = function getStripePromise2() {
1076
- if (stripePromise) {
1077
- return stripePromise;
1078
- }
1079
- stripePromise = loadScript(null)["catch"](function(error) {
1080
- stripePromise = null;
1081
- return Promise.reject(error);
1082
- });
1083
- return stripePromise;
1084
- };
1085
- Promise.resolve().then(function() {
1086
- return getStripePromise();
1087
- })["catch"](function(error) {
1088
- if (!loadCalled) {
1089
- console.warn(error);
1090
- }
1091
- });
1092
- var loadStripe = function loadStripe2() {
1093
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1094
- args[_key] = arguments[_key];
1095
- }
1096
- loadCalled = true;
1097
- var startTime = Date.now();
1098
- return getStripePromise().then(function(maybeStripe) {
1099
- return initStripe(maybeStripe, args, startTime);
1100
- });
1101
- };
1132
+ // src/drivers/stripe.tsx
1133
+ var import_pure = __toESM(require_pure2(), 1);
1102
1134
 
1103
1135
  // node_modules/@stripe/react-stripe-js/dist/react-stripe.esm.mjs
1104
1136
  var react_stripe_esm_exports = {};
@@ -1251,13 +1283,13 @@ function _toPropertyKey(t) {
1251
1283
  var i = _toPrimitive(t, "string");
1252
1284
  return "symbol" == typeof i ? i : i + "";
1253
1285
  }
1254
- function _typeof2(o) {
1286
+ function _typeof(o) {
1255
1287
  "@babel/helpers - typeof";
1256
- return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
1288
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
1257
1289
  return typeof o2;
1258
1290
  } : function(o2) {
1259
1291
  return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
1260
- }, _typeof2(o);
1292
+ }, _typeof(o);
1261
1293
  }
1262
1294
  function _unsupportedIterableToArray(r, a) {
1263
1295
  if (r) {
@@ -1297,7 +1329,7 @@ var usePrevious = function usePrevious2(value) {
1297
1329
  return ref.current;
1298
1330
  };
1299
1331
  var isUnknownObject = function isUnknownObject2(raw) {
1300
- return raw !== null && _typeof2(raw) === "object";
1332
+ return raw !== null && _typeof(raw) === "object";
1301
1333
  };
1302
1334
  var isPromise = function isPromise2(raw) {
1303
1335
  return isUnknownObject(raw) && typeof raw.then === "function";
@@ -1790,7 +1822,7 @@ var EmbeddedCheckoutServerElement = function EmbeddedCheckoutServerElement2(_ref
1790
1822
  };
1791
1823
  var EmbeddedCheckout = isServer ? EmbeddedCheckoutServerElement : EmbeddedCheckoutClientElement;
1792
1824
  var FinancialAccountDisclosure = function FinancialAccountDisclosure2(_ref) {
1793
- var rawStripeProp = _ref.stripe, onLoad3 = _ref.onLoad, onError3 = _ref.onError, options = _ref.options;
1825
+ var rawStripeProp = _ref.stripe, onLoad = _ref.onLoad, onError = _ref.onError, options = _ref.options;
1794
1826
  var businessName = options === null || options === void 0 ? void 0 : options.businessName;
1795
1827
  var learnMoreLink = options === null || options === void 0 ? void 0 : options.learnMoreLink;
1796
1828
  var containerRef = React.useRef(null);
@@ -1801,9 +1833,9 @@ var FinancialAccountDisclosure = function FinancialAccountDisclosure2(_ref) {
1801
1833
  React.useEffect(function() {
1802
1834
  var isMounted = true;
1803
1835
  if (parsed.tag === "async") {
1804
- parsed.stripePromise.then(function(stripePromise2) {
1805
- if (stripePromise2 && isMounted) {
1806
- setStripeState(stripePromise2);
1836
+ parsed.stripePromise.then(function(stripePromise) {
1837
+ if (stripePromise && isMounted) {
1838
+ setStripeState(stripePromise);
1807
1839
  }
1808
1840
  });
1809
1841
  } else if (parsed.tag === "sync") {
@@ -1845,14 +1877,14 @@ var FinancialAccountDisclosure = function FinancialAccountDisclosure2(_ref) {
1845
1877
  _yield$stripeState$cr = _context.sent;
1846
1878
  disclosureContent = _yield$stripeState$cr.htmlElement;
1847
1879
  error = _yield$stripeState$cr.error;
1848
- if (error && onError3) {
1849
- onError3(error);
1880
+ if (error && onError) {
1881
+ onError(error);
1850
1882
  } else if (disclosureContent) {
1851
1883
  container = containerRef.current;
1852
1884
  container.innerHTML = "";
1853
1885
  container.appendChild(disclosureContent);
1854
- if (onLoad3) {
1855
- onLoad3();
1886
+ if (onLoad) {
1887
+ onLoad();
1856
1888
  }
1857
1889
  }
1858
1890
  case 8:
@@ -1867,13 +1899,13 @@ var FinancialAccountDisclosure = function FinancialAccountDisclosure2(_ref) {
1867
1899
  };
1868
1900
  })();
1869
1901
  createDisclosure();
1870
- }, [stripeState, businessName, learnMoreLink, onLoad3, onError3]);
1902
+ }, [stripeState, businessName, learnMoreLink, onLoad, onError]);
1871
1903
  return /* @__PURE__ */ React.createElement("div", {
1872
1904
  ref: containerRef
1873
1905
  });
1874
1906
  };
1875
1907
  var IssuingDisclosure = function IssuingDisclosure2(_ref) {
1876
- var rawStripeProp = _ref.stripe, onLoad3 = _ref.onLoad, onError3 = _ref.onError, options = _ref.options;
1908
+ var rawStripeProp = _ref.stripe, onLoad = _ref.onLoad, onError = _ref.onError, options = _ref.options;
1877
1909
  var issuingProgramID = options === null || options === void 0 ? void 0 : options.issuingProgramID;
1878
1910
  var publicCardProgramName = options === null || options === void 0 ? void 0 : options.publicCardProgramName;
1879
1911
  var learnMoreLink = options === null || options === void 0 ? void 0 : options.learnMoreLink;
@@ -1885,9 +1917,9 @@ var IssuingDisclosure = function IssuingDisclosure2(_ref) {
1885
1917
  React.useEffect(function() {
1886
1918
  var isMounted = true;
1887
1919
  if (parsed.tag === "async") {
1888
- parsed.stripePromise.then(function(stripePromise2) {
1889
- if (stripePromise2 && isMounted) {
1890
- setStripeState(stripePromise2);
1920
+ parsed.stripePromise.then(function(stripePromise) {
1921
+ if (stripePromise && isMounted) {
1922
+ setStripeState(stripePromise);
1891
1923
  }
1892
1924
  });
1893
1925
  } else if (parsed.tag === "sync") {
@@ -1930,14 +1962,14 @@ var IssuingDisclosure = function IssuingDisclosure2(_ref) {
1930
1962
  _yield$stripeState$cr = _context.sent;
1931
1963
  disclosureContent = _yield$stripeState$cr.htmlElement;
1932
1964
  error = _yield$stripeState$cr.error;
1933
- if (error && onError3) {
1934
- onError3(error);
1965
+ if (error && onError) {
1966
+ onError(error);
1935
1967
  } else if (disclosureContent) {
1936
1968
  container = containerRef.current;
1937
1969
  container.innerHTML = "";
1938
1970
  container.appendChild(disclosureContent);
1939
- if (onLoad3) {
1940
- onLoad3();
1971
+ if (onLoad) {
1972
+ onLoad();
1941
1973
  }
1942
1974
  }
1943
1975
  case 8:
@@ -1952,7 +1984,7 @@ var IssuingDisclosure = function IssuingDisclosure2(_ref) {
1952
1984
  };
1953
1985
  })();
1954
1986
  createDisclosure();
1955
- }, [stripeState, issuingProgramID, publicCardProgramName, learnMoreLink, onLoad3, onError3]);
1987
+ }, [stripeState, issuingProgramID, publicCardProgramName, learnMoreLink, onLoad, onError]);
1956
1988
  return /* @__PURE__ */ React.createElement("div", {
1957
1989
  ref: containerRef
1958
1990
  });
@@ -1985,10 +2017,30 @@ var IssuingCardCopyButtonElement = createElementComponent("issuingCardCopyButton
1985
2017
 
1986
2018
  // src/drivers/stripe.tsx
1987
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
+ }
1988
2039
  async function loadProvider(publishableKey) {
1989
2040
  let stripe = stripeInstances.get(publishableKey);
1990
2041
  if (!stripe) {
1991
- stripe = loadStripe(publishableKey);
2042
+ configureFraudSignals();
2043
+ stripe = (0, import_pure.loadStripe)(publishableKey);
1992
2044
  stripeInstances.set(publishableKey, stripe);
1993
2045
  }
1994
2046
  return { rsj: react_stripe_esm_exports, stripe };
@@ -2150,7 +2202,7 @@ function ConfirmForm({
2150
2202
  secretKind,
2151
2203
  onStart,
2152
2204
  onPaymentAdded,
2153
- onError: onError3,
2205
+ onError,
2154
2206
  reportFailure,
2155
2207
  finish
2156
2208
  }) {
@@ -2167,19 +2219,19 @@ function ConfirmForm({
2167
2219
  const { error, setupIntent } = await stripe.confirmSetup({ elements, redirect: "if_required" });
2168
2220
  if (error) {
2169
2221
  reportFailure(error.setup_intent?.id);
2170
- return onError3(fromStripeError(error));
2222
+ return onError(fromStripeError(error));
2171
2223
  }
2172
2224
  await finish(setupIntent?.id);
2173
2225
  } else {
2174
2226
  const { error, paymentIntent } = await stripe.confirmPayment({ elements, redirect: "if_required" });
2175
2227
  if (error) {
2176
2228
  reportFailure(error.payment_intent?.id);
2177
- return onError3(fromStripeError(error));
2229
+ return onError(fromStripeError(error));
2178
2230
  }
2179
2231
  await finish(paymentIntent?.id);
2180
2232
  }
2181
2233
  } catch (e) {
2182
- onError3(toCheckoutError(e));
2234
+ onError(toCheckoutError(e));
2183
2235
  } finally {
2184
2236
  setSubmitting(false);
2185
2237
  }
@@ -2242,6 +2294,6 @@ object-assign/index.js:
2242
2294
  *)
2243
2295
  */
2244
2296
 
2245
- export { stripeCheckoutDriver };
2297
+ export { isNullOriginPreview, stripeCheckoutDriver };
2246
2298
  //# sourceMappingURL=driver-stripe.js.map
2247
2299
  //# sourceMappingURL=driver-stripe.js.map