droplinked-payment-hub
Version:
A unified payment component that handles different payment providers
1,240 lines • 7.04 MB
JavaScript
import { jsxs, jsx, Fragment as Fragment$1 } from "react/jsx-runtime";
import * as React from "react";
import React__default, { useState, forwardRef, useCallback, useEffect, createContext, useContext, useRef } from "react";
import * as ReactDOM from "react-dom";
import ReactDOM__default from "react-dom";
const defaultButtonStyle = {
backgroundColor: "#4F46E5",
textColor: "#FFFFFF",
fontSize: "14px",
fontWeight: 500,
borderRadius: "4px"
}, defaultCommonStyle = {
fontFamily: "system-ui, -apple-system, sans-serif",
fontSizeLabel: "14px",
fontSizeInput: "16px",
fontSizePaymentButton: "16px",
fontWeightLabel: 500,
fontWeightInput: 400,
fontWeightPaymentButton: 600,
colorContainer: "#FFFFFF",
colorBorderInput: "#E5E7EB",
colorBorderPaymentButton: "transparent",
borderRadius: "8px",
colorDisabled: "#9CA3AF",
colorError: "#EF4444",
colorPrimary: "#4F46E5",
colorInput: "#FFFFFF",
textColorLabel: "#374151",
textColorPaymentButton: "#FFFFFF",
textColorInput: "#1F2937",
placeholderColor: "#9CA3AF",
containerWidth: "100%",
verticalPadding: "12px",
verticalSpacing: "16px",
containerPadding: "16px",
backgroundBody: "#F9FAFB",
textColorParagraphs: "#4B5563",
submitButton: {
...defaultButtonStyle
},
cancelButton: {
backgroundColor: "#F3F4F6",
textColor: "#4B5563",
fontSize: "14px",
fontWeight: 500,
borderRadius: "4px"
},
theme: "light"
}, getBaseApiUrl = (t = !1) => t ? "https://apiv3dev.droplinked.com/" : "https://apiv3.droplinked.com/", createPaymentIntent = async (t, n, ie = !1, c, se) => {
const ue = `${getBaseApiUrl(ie)}v2/orders/${t}/payment-intent`;
try {
const le = {
paymentMethod: n
};
n.toLowerCase() === "paypal" && (c && (le.return_url = c), se && (le.cancel_url = se));
const ge = await fetch(ue, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(le)
});
if (!ge.ok) {
let me = "Oops! something went wrong";
try {
const ke = await ge.json();
me = ke?.data?.message || ke?.message || me;
} catch (ke) {
console.error("Failed to parse error response:", ke);
}
throw new Error(me);
}
const ye = await ge.json(), Ie = ye?.data ?? ye;
console.log("Payment Intent Payload (pre-normalize):", Ie);
const Ae = {
clientSecret: Ie?.clientSecret,
checkoutUrl: Ie?.checkoutUrl,
method: Ie?.method,
shopId: Ie?.shopId
};
return console.log("Payment Intent Response:", Ae), Ae;
} catch (le) {
throw console.error("Error creating payment intent:", le), le;
}
};
function getDefaultExportFromCjs$4(t) {
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
function getAugmentedNamespace$1(t) {
if (Object.prototype.hasOwnProperty.call(t, "__esModule")) return t;
var n = t.default;
if (typeof n == "function") {
var ie = function c() {
var se = !1;
try {
se = this instanceof c;
} catch {
}
return se ? Reflect.construct(n, arguments, this.constructor) : n.apply(this, arguments);
};
ie.prototype = n.prototype;
} else ie = {};
return Object.defineProperty(ie, "__esModule", { value: !0 }), Object.keys(t).forEach(function(c) {
var se = Object.getOwnPropertyDescriptor(t, c);
Object.defineProperty(ie, c, se.get ? se : {
enumerable: !0,
get: function() {
return t[c];
}
});
}), ie;
}
function getDefaultExportFromCjs$3(t) {
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
var browser$g = { exports: {} }, process$2 = browser$g.exports = {}, cachedSetTimeout$1, cachedClearTimeout$1;
function defaultSetTimout$1() {
throw new Error("setTimeout has not been defined");
}
function defaultClearTimeout$1() {
throw new Error("clearTimeout has not been defined");
}
(function() {
try {
typeof setTimeout == "function" ? cachedSetTimeout$1 = setTimeout : cachedSetTimeout$1 = defaultSetTimout$1;
} catch {
cachedSetTimeout$1 = defaultSetTimout$1;
}
try {
typeof clearTimeout == "function" ? cachedClearTimeout$1 = clearTimeout : cachedClearTimeout$1 = defaultClearTimeout$1;
} catch {
cachedClearTimeout$1 = defaultClearTimeout$1;
}
})();
function runTimeout$1(t) {
if (cachedSetTimeout$1 === setTimeout)
return setTimeout(t, 0);
if ((cachedSetTimeout$1 === defaultSetTimout$1 || !cachedSetTimeout$1) && setTimeout)
return cachedSetTimeout$1 = setTimeout, setTimeout(t, 0);
try {
return cachedSetTimeout$1(t, 0);
} catch {
try {
return cachedSetTimeout$1.call(null, t, 0);
} catch {
return cachedSetTimeout$1.call(this, t, 0);
}
}
}
function runClearTimeout$1(t) {
if (cachedClearTimeout$1 === clearTimeout)
return clearTimeout(t);
if ((cachedClearTimeout$1 === defaultClearTimeout$1 || !cachedClearTimeout$1) && clearTimeout)
return cachedClearTimeout$1 = clearTimeout, clearTimeout(t);
try {
return cachedClearTimeout$1(t);
} catch {
try {
return cachedClearTimeout$1.call(null, t);
} catch {
return cachedClearTimeout$1.call(this, t);
}
}
}
var queue$1 = [], draining$1 = !1, currentQueue$1, queueIndex$1 = -1;
function cleanUpNextTick$1() {
!draining$1 || !currentQueue$1 || (draining$1 = !1, currentQueue$1.length ? queue$1 = currentQueue$1.concat(queue$1) : queueIndex$1 = -1, queue$1.length && drainQueue$1());
}
function drainQueue$1() {
if (!draining$1) {
var t = runTimeout$1(cleanUpNextTick$1);
draining$1 = !0;
for (var n = queue$1.length; n; ) {
for (currentQueue$1 = queue$1, queue$1 = []; ++queueIndex$1 < n; )
currentQueue$1 && currentQueue$1[queueIndex$1].run();
queueIndex$1 = -1, n = queue$1.length;
}
currentQueue$1 = null, draining$1 = !1, runClearTimeout$1(t);
}
}
process$2.nextTick = function(t) {
var n = new Array(arguments.length - 1);
if (arguments.length > 1)
for (var ie = 1; ie < arguments.length; ie++)
n[ie - 1] = arguments[ie];
queue$1.push(new Item$1(t, n)), queue$1.length === 1 && !draining$1 && runTimeout$1(drainQueue$1);
};
function Item$1(t, n) {
this.fun = t, this.array = n;
}
Item$1.prototype.run = function() {
this.fun.apply(null, this.array);
};
process$2.title = "browser";
process$2.browser = !0;
process$2.env = {};
process$2.argv = [];
process$2.version = "";
process$2.versions = {};
function noop$1() {
}
process$2.on = noop$1;
process$2.addListener = noop$1;
process$2.once = noop$1;
process$2.off = noop$1;
process$2.removeListener = noop$1;
process$2.removeAllListeners = noop$1;
process$2.emit = noop$1;
process$2.prependListener = noop$1;
process$2.prependOnceListener = noop$1;
process$2.listeners = function(t) {
return [];
};
process$2.binding = function(t) {
throw new Error("process.binding is not supported");
};
process$2.cwd = function() {
return "/";
};
process$2.chdir = function(t) {
throw new Error("process.chdir is not supported");
};
process$2.umask = function() {
return 0;
};
var browserExports$1 = browser$g.exports;
const process$1$1 = /* @__PURE__ */ getDefaultExportFromCjs$3(browserExports$1);
var propTypes = { exports: {} }, reactIs = { exports: {} }, reactIs_production_min = {};
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var hasRequiredReactIs_production_min;
function requireReactIs_production_min() {
if (hasRequiredReactIs_production_min) return reactIs_production_min;
hasRequiredReactIs_production_min = 1;
var t = typeof Symbol == "function" && Symbol.for, n = t ? Symbol.for("react.element") : 60103, ie = t ? Symbol.for("react.portal") : 60106, c = t ? Symbol.for("react.fragment") : 60107, se = t ? Symbol.for("react.strict_mode") : 60108, ae = t ? Symbol.for("react.profiler") : 60114, ue = t ? Symbol.for("react.provider") : 60109, le = t ? Symbol.for("react.context") : 60110, ge = t ? Symbol.for("react.async_mode") : 60111, ye = t ? Symbol.for("react.concurrent_mode") : 60111, Ie = t ? Symbol.for("react.forward_ref") : 60112, Ae = t ? Symbol.for("react.suspense") : 60113, me = t ? Symbol.for("react.suspense_list") : 60120, ke = t ? Symbol.for("react.memo") : 60115, Ne = t ? Symbol.for("react.lazy") : 60116, _e = t ? Symbol.for("react.block") : 60121, Pe = t ? Symbol.for("react.fundamental") : 60117, Ee = t ? Symbol.for("react.responder") : 60118, De = t ? Symbol.for("react.scope") : 60119;
function Fe(we) {
if (typeof we == "object" && we !== null) {
var fe = we.$$typeof;
switch (fe) {
case n:
switch (we = we.type, we) {
case ge:
case ye:
case c:
case ae:
case se:
case Ae:
return we;
default:
switch (we = we && we.$$typeof, we) {
case le:
case Ie:
case Ne:
case ke:
case ue:
return we;
default:
return fe;
}
}
case ie:
return fe;
}
}
}
function Se(we) {
return Fe(we) === ye;
}
return reactIs_production_min.AsyncMode = ge, reactIs_production_min.ConcurrentMode = ye, reactIs_production_min.ContextConsumer = le, reactIs_production_min.ContextProvider = ue, reactIs_production_min.Element = n, reactIs_production_min.ForwardRef = Ie, reactIs_production_min.Fragment = c, reactIs_production_min.Lazy = Ne, reactIs_production_min.Memo = ke, reactIs_production_min.Portal = ie, reactIs_production_min.Profiler = ae, reactIs_production_min.StrictMode = se, reactIs_production_min.Suspense = Ae, reactIs_production_min.isAsyncMode = function(we) {
return Se(we) || Fe(we) === ge;
}, reactIs_production_min.isConcurrentMode = Se, reactIs_production_min.isContextConsumer = function(we) {
return Fe(we) === le;
}, reactIs_production_min.isContextProvider = function(we) {
return Fe(we) === ue;
}, reactIs_production_min.isElement = function(we) {
return typeof we == "object" && we !== null && we.$$typeof === n;
}, reactIs_production_min.isForwardRef = function(we) {
return Fe(we) === Ie;
}, reactIs_production_min.isFragment = function(we) {
return Fe(we) === c;
}, reactIs_production_min.isLazy = function(we) {
return Fe(we) === Ne;
}, reactIs_production_min.isMemo = function(we) {
return Fe(we) === ke;
}, reactIs_production_min.isPortal = function(we) {
return Fe(we) === ie;
}, reactIs_production_min.isProfiler = function(we) {
return Fe(we) === ae;
}, reactIs_production_min.isStrictMode = function(we) {
return Fe(we) === se;
}, reactIs_production_min.isSuspense = function(we) {
return Fe(we) === Ae;
}, reactIs_production_min.isValidElementType = function(we) {
return typeof we == "string" || typeof we == "function" || we === c || we === ye || we === ae || we === se || we === Ae || we === me || typeof we == "object" && we !== null && (we.$$typeof === Ne || we.$$typeof === ke || we.$$typeof === ue || we.$$typeof === le || we.$$typeof === Ie || we.$$typeof === Pe || we.$$typeof === Ee || we.$$typeof === De || we.$$typeof === _e);
}, reactIs_production_min.typeOf = Fe, reactIs_production_min;
}
var reactIs_development = {}, hasRequiredReactIs_development;
function requireReactIs_development() {
return hasRequiredReactIs_development || (hasRequiredReactIs_development = 1, process$1$1.env.NODE_ENV !== "production" && (function() {
var t = typeof Symbol == "function" && Symbol.for, n = t ? Symbol.for("react.element") : 60103, ie = t ? Symbol.for("react.portal") : 60106, c = t ? Symbol.for("react.fragment") : 60107, se = t ? Symbol.for("react.strict_mode") : 60108, ae = t ? Symbol.for("react.profiler") : 60114, ue = t ? Symbol.for("react.provider") : 60109, le = t ? Symbol.for("react.context") : 60110, ge = t ? Symbol.for("react.async_mode") : 60111, ye = t ? Symbol.for("react.concurrent_mode") : 60111, Ie = t ? Symbol.for("react.forward_ref") : 60112, Ae = t ? Symbol.for("react.suspense") : 60113, me = t ? Symbol.for("react.suspense_list") : 60120, ke = t ? Symbol.for("react.memo") : 60115, Ne = t ? Symbol.for("react.lazy") : 60116, _e = t ? Symbol.for("react.block") : 60121, Pe = t ? Symbol.for("react.fundamental") : 60117, Ee = t ? Symbol.for("react.responder") : 60118, De = t ? Symbol.for("react.scope") : 60119;
function Fe($e) {
return typeof $e == "string" || typeof $e == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
$e === c || $e === ye || $e === ae || $e === se || $e === Ae || $e === me || typeof $e == "object" && $e !== null && ($e.$$typeof === Ne || $e.$$typeof === ke || $e.$$typeof === ue || $e.$$typeof === le || $e.$$typeof === Ie || $e.$$typeof === Pe || $e.$$typeof === Ee || $e.$$typeof === De || $e.$$typeof === _e);
}
function Se($e) {
if (typeof $e == "object" && $e !== null) {
var je = $e.$$typeof;
switch (je) {
case n:
var $t = $e.type;
switch ($t) {
case ge:
case ye:
case c:
case ae:
case se:
case Ae:
return $t;
default:
var jt = $t && $t.$$typeof;
switch (jt) {
case le:
case Ie:
case Ne:
case ke:
case ue:
return jt;
default:
return je;
}
}
case ie:
return je;
}
}
}
var we = ge, fe = ye, Me = le, He = ue, qe = n, Qe = Ie, de = c, he = Ne, be = ke, Ce = ie, Oe = ae, Je = se, Ue = Ae, Be = !1;
function ce($e) {
return Be || (Be = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), pe($e) || Se($e) === ge;
}
function pe($e) {
return Se($e) === ye;
}
function ve($e) {
return Se($e) === le;
}
function Te($e) {
return Se($e) === ue;
}
function Ge($e) {
return typeof $e == "object" && $e !== null && $e.$$typeof === n;
}
function Le($e) {
return Se($e) === Ie;
}
function Ve($e) {
return Se($e) === c;
}
function Pt($e) {
return Se($e) === Ne;
}
function We($e) {
return Se($e) === ke;
}
function Ke($e) {
return Se($e) === ie;
}
function Rt($e) {
return Se($e) === ae;
}
function Wt($e) {
return Se($e) === se;
}
function Ft($e) {
return Se($e) === Ae;
}
reactIs_development.AsyncMode = we, reactIs_development.ConcurrentMode = fe, reactIs_development.ContextConsumer = Me, reactIs_development.ContextProvider = He, reactIs_development.Element = qe, reactIs_development.ForwardRef = Qe, reactIs_development.Fragment = de, reactIs_development.Lazy = he, reactIs_development.Memo = be, reactIs_development.Portal = Ce, reactIs_development.Profiler = Oe, reactIs_development.StrictMode = Je, reactIs_development.Suspense = Ue, reactIs_development.isAsyncMode = ce, reactIs_development.isConcurrentMode = pe, reactIs_development.isContextConsumer = ve, reactIs_development.isContextProvider = Te, reactIs_development.isElement = Ge, reactIs_development.isForwardRef = Le, reactIs_development.isFragment = Ve, reactIs_development.isLazy = Pt, reactIs_development.isMemo = We, reactIs_development.isPortal = Ke, reactIs_development.isProfiler = Rt, reactIs_development.isStrictMode = Wt, reactIs_development.isSuspense = Ft, reactIs_development.isValidElementType = Fe, reactIs_development.typeOf = Se;
})()), reactIs_development;
}
var hasRequiredReactIs;
function requireReactIs() {
return hasRequiredReactIs || (hasRequiredReactIs = 1, process$1$1.env.NODE_ENV === "production" ? reactIs.exports = requireReactIs_production_min() : reactIs.exports = requireReactIs_development()), reactIs.exports;
}
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
var objectAssign, hasRequiredObjectAssign;
function requireObjectAssign() {
if (hasRequiredObjectAssign) return objectAssign;
hasRequiredObjectAssign = 1;
var t = Object.getOwnPropertySymbols, n = Object.prototype.hasOwnProperty, ie = Object.prototype.propertyIsEnumerable;
function c(ae) {
if (ae == null)
throw new TypeError("Object.assign cannot be called with null or undefined");
return Object(ae);
}
function se() {
try {
if (!Object.assign)
return !1;
var ae = new String("abc");
if (ae[5] = "de", Object.getOwnPropertyNames(ae)[0] === "5")
return !1;
for (var ue = {}, le = 0; le < 10; le++)
ue["_" + String.fromCharCode(le)] = le;
var ge = Object.getOwnPropertyNames(ue).map(function(Ie) {
return ue[Ie];
});
if (ge.join("") !== "0123456789")
return !1;
var ye = {};
return "abcdefghijklmnopqrst".split("").forEach(function(Ie) {
ye[Ie] = Ie;
}), Object.keys(Object.assign({}, ye)).join("") === "abcdefghijklmnopqrst";
} catch {
return !1;
}
}
return objectAssign = se() ? Object.assign : function(ae, ue) {
for (var le, ge = c(ae), ye, Ie = 1; Ie < arguments.length; Ie++) {
le = Object(arguments[Ie]);
for (var Ae in le)
n.call(le, Ae) && (ge[Ae] = le[Ae]);
if (t) {
ye = t(le);
for (var me = 0; me < ye.length; me++)
ie.call(le, ye[me]) && (ge[ye[me]] = le[ye[me]]);
}
}
return ge;
}, objectAssign;
}
var ReactPropTypesSecret_1, hasRequiredReactPropTypesSecret;
function requireReactPropTypesSecret() {
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
hasRequiredReactPropTypesSecret = 1;
var t = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
return ReactPropTypesSecret_1 = t, ReactPropTypesSecret_1;
}
var has, hasRequiredHas;
function requireHas() {
return hasRequiredHas || (hasRequiredHas = 1, has = Function.call.bind(Object.prototype.hasOwnProperty)), has;
}
var checkPropTypes_1, hasRequiredCheckPropTypes;
function requireCheckPropTypes() {
if (hasRequiredCheckPropTypes) return checkPropTypes_1;
hasRequiredCheckPropTypes = 1;
var t = function() {
};
if (process$1$1.env.NODE_ENV !== "production") {
var n = /* @__PURE__ */ requireReactPropTypesSecret(), ie = {}, c = /* @__PURE__ */ requireHas();
t = function(ae) {
var ue = "Warning: " + ae;
typeof console < "u" && console.error(ue);
try {
throw new Error(ue);
} catch {
}
};
}
function se(ae, ue, le, ge, ye) {
if (process$1$1.env.NODE_ENV !== "production") {
for (var Ie in ae)
if (c(ae, Ie)) {
var Ae;
try {
if (typeof ae[Ie] != "function") {
var me = Error(
(ge || "React class") + ": " + le + " type `" + Ie + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof ae[Ie] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
);
throw me.name = "Invariant Violation", me;
}
Ae = ae[Ie](ue, Ie, ge, le, null, n);
} catch (Ne) {
Ae = Ne;
}
if (Ae && !(Ae instanceof Error) && t(
(ge || "React class") + ": type specification of " + le + " `" + Ie + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof Ae + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
), Ae instanceof Error && !(Ae.message in ie)) {
ie[Ae.message] = !0;
var ke = ye ? ye() : "";
t(
"Failed " + le + " type: " + Ae.message + (ke ?? "")
);
}
}
}
}
return se.resetWarningCache = function() {
process$1$1.env.NODE_ENV !== "production" && (ie = {});
}, checkPropTypes_1 = se, checkPropTypes_1;
}
var factoryWithTypeCheckers, hasRequiredFactoryWithTypeCheckers;
function requireFactoryWithTypeCheckers() {
if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
hasRequiredFactoryWithTypeCheckers = 1;
var t = requireReactIs(), n = requireObjectAssign(), ie = /* @__PURE__ */ requireReactPropTypesSecret(), c = /* @__PURE__ */ requireHas(), se = /* @__PURE__ */ requireCheckPropTypes(), ae = function() {
};
process$1$1.env.NODE_ENV !== "production" && (ae = function(le) {
var ge = "Warning: " + le;
typeof console < "u" && console.error(ge);
try {
throw new Error(ge);
} catch {
}
});
function ue() {
return null;
}
return factoryWithTypeCheckers = function(le, ge) {
var ye = typeof Symbol == "function" && Symbol.iterator, Ie = "@@iterator";
function Ae(pe) {
var ve = pe && (ye && pe[ye] || pe[Ie]);
if (typeof ve == "function")
return ve;
}
var me = "<<anonymous>>", ke = {
array: Ee("array"),
bigint: Ee("bigint"),
bool: Ee("boolean"),
func: Ee("function"),
number: Ee("number"),
object: Ee("object"),
string: Ee("string"),
symbol: Ee("symbol"),
any: De(),
arrayOf: Fe,
element: Se(),
elementType: we(),
instanceOf: fe,
node: Qe(),
objectOf: He,
oneOf: Me,
oneOfType: qe,
shape: he,
exact: be
};
function Ne(pe, ve) {
return pe === ve ? pe !== 0 || 1 / pe === 1 / ve : pe !== pe && ve !== ve;
}
function _e(pe, ve) {
this.message = pe, this.data = ve && typeof ve == "object" ? ve : {}, this.stack = "";
}
_e.prototype = Error.prototype;
function Pe(pe) {
if (process$1$1.env.NODE_ENV !== "production")
var ve = {}, Te = 0;
function Ge(Ve, Pt, We, Ke, Rt, Wt, Ft) {
if (Ke = Ke || me, Wt = Wt || We, Ft !== ie) {
if (ge) {
var $e = new Error(
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
);
throw $e.name = "Invariant Violation", $e;
} else if (process$1$1.env.NODE_ENV !== "production" && typeof console < "u") {
var je = Ke + ":" + We;
!ve[je] && // Avoid spamming the console because they are often not actionable except for lib authors
Te < 3 && (ae(
"You are manually calling a React.PropTypes validation function for the `" + Wt + "` prop on `" + Ke + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
), ve[je] = !0, Te++);
}
}
return Pt[We] == null ? Ve ? Pt[We] === null ? new _e("The " + Rt + " `" + Wt + "` is marked as required " + ("in `" + Ke + "`, but its value is `null`.")) : new _e("The " + Rt + " `" + Wt + "` is marked as required in " + ("`" + Ke + "`, but its value is `undefined`.")) : null : pe(Pt, We, Ke, Rt, Wt);
}
var Le = Ge.bind(null, !1);
return Le.isRequired = Ge.bind(null, !0), Le;
}
function Ee(pe) {
function ve(Te, Ge, Le, Ve, Pt, We) {
var Ke = Te[Ge], Rt = Je(Ke);
if (Rt !== pe) {
var Wt = Ue(Ke);
return new _e(
"Invalid " + Ve + " `" + Pt + "` of type " + ("`" + Wt + "` supplied to `" + Le + "`, expected ") + ("`" + pe + "`."),
{ expectedType: pe }
);
}
return null;
}
return Pe(ve);
}
function De() {
return Pe(ue);
}
function Fe(pe) {
function ve(Te, Ge, Le, Ve, Pt) {
if (typeof pe != "function")
return new _e("Property `" + Pt + "` of component `" + Le + "` has invalid PropType notation inside arrayOf.");
var We = Te[Ge];
if (!Array.isArray(We)) {
var Ke = Je(We);
return new _e("Invalid " + Ve + " `" + Pt + "` of type " + ("`" + Ke + "` supplied to `" + Le + "`, expected an array."));
}
for (var Rt = 0; Rt < We.length; Rt++) {
var Wt = pe(We, Rt, Le, Ve, Pt + "[" + Rt + "]", ie);
if (Wt instanceof Error)
return Wt;
}
return null;
}
return Pe(ve);
}
function Se() {
function pe(ve, Te, Ge, Le, Ve) {
var Pt = ve[Te];
if (!le(Pt)) {
var We = Je(Pt);
return new _e("Invalid " + Le + " `" + Ve + "` of type " + ("`" + We + "` supplied to `" + Ge + "`, expected a single ReactElement."));
}
return null;
}
return Pe(pe);
}
function we() {
function pe(ve, Te, Ge, Le, Ve) {
var Pt = ve[Te];
if (!t.isValidElementType(Pt)) {
var We = Je(Pt);
return new _e("Invalid " + Le + " `" + Ve + "` of type " + ("`" + We + "` supplied to `" + Ge + "`, expected a single ReactElement type."));
}
return null;
}
return Pe(pe);
}
function fe(pe) {
function ve(Te, Ge, Le, Ve, Pt) {
if (!(Te[Ge] instanceof pe)) {
var We = pe.name || me, Ke = ce(Te[Ge]);
return new _e("Invalid " + Ve + " `" + Pt + "` of type " + ("`" + Ke + "` supplied to `" + Le + "`, expected ") + ("instance of `" + We + "`."));
}
return null;
}
return Pe(ve);
}
function Me(pe) {
if (!Array.isArray(pe))
return process$1$1.env.NODE_ENV !== "production" && (arguments.length > 1 ? ae(
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
) : ae("Invalid argument supplied to oneOf, expected an array.")), ue;
function ve(Te, Ge, Le, Ve, Pt) {
for (var We = Te[Ge], Ke = 0; Ke < pe.length; Ke++)
if (Ne(We, pe[Ke]))
return null;
var Rt = JSON.stringify(pe, function(Ft, $e) {
var je = Ue($e);
return je === "symbol" ? String($e) : $e;
});
return new _e("Invalid " + Ve + " `" + Pt + "` of value `" + String(We) + "` " + ("supplied to `" + Le + "`, expected one of " + Rt + "."));
}
return Pe(ve);
}
function He(pe) {
function ve(Te, Ge, Le, Ve, Pt) {
if (typeof pe != "function")
return new _e("Property `" + Pt + "` of component `" + Le + "` has invalid PropType notation inside objectOf.");
var We = Te[Ge], Ke = Je(We);
if (Ke !== "object")
return new _e("Invalid " + Ve + " `" + Pt + "` of type " + ("`" + Ke + "` supplied to `" + Le + "`, expected an object."));
for (var Rt in We)
if (c(We, Rt)) {
var Wt = pe(We, Rt, Le, Ve, Pt + "." + Rt, ie);
if (Wt instanceof Error)
return Wt;
}
return null;
}
return Pe(ve);
}
function qe(pe) {
if (!Array.isArray(pe))
return process$1$1.env.NODE_ENV !== "production" && ae("Invalid argument supplied to oneOfType, expected an instance of array."), ue;
for (var ve = 0; ve < pe.length; ve++) {
var Te = pe[ve];
if (typeof Te != "function")
return ae(
"Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + Be(Te) + " at index " + ve + "."
), ue;
}
function Ge(Le, Ve, Pt, We, Ke) {
for (var Rt = [], Wt = 0; Wt < pe.length; Wt++) {
var Ft = pe[Wt], $e = Ft(Le, Ve, Pt, We, Ke, ie);
if ($e == null)
return null;
$e.data && c($e.data, "expectedType") && Rt.push($e.data.expectedType);
}
var je = Rt.length > 0 ? ", expected one of type [" + Rt.join(", ") + "]" : "";
return new _e("Invalid " + We + " `" + Ke + "` supplied to " + ("`" + Pt + "`" + je + "."));
}
return Pe(Ge);
}
function Qe() {
function pe(ve, Te, Ge, Le, Ve) {
return Ce(ve[Te]) ? null : new _e("Invalid " + Le + " `" + Ve + "` supplied to " + ("`" + Ge + "`, expected a ReactNode."));
}
return Pe(pe);
}
function de(pe, ve, Te, Ge, Le) {
return new _e(
(pe || "React class") + ": " + ve + " type `" + Te + "." + Ge + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + Le + "`."
);
}
function he(pe) {
function ve(Te, Ge, Le, Ve, Pt) {
var We = Te[Ge], Ke = Je(We);
if (Ke !== "object")
return new _e("Invalid " + Ve + " `" + Pt + "` of type `" + Ke + "` " + ("supplied to `" + Le + "`, expected `object`."));
for (var Rt in pe) {
var Wt = pe[Rt];
if (typeof Wt != "function")
return de(Le, Ve, Pt, Rt, Ue(Wt));
var Ft = Wt(We, Rt, Le, Ve, Pt + "." + Rt, ie);
if (Ft)
return Ft;
}
return null;
}
return Pe(ve);
}
function be(pe) {
function ve(Te, Ge, Le, Ve, Pt) {
var We = Te[Ge], Ke = Je(We);
if (Ke !== "object")
return new _e("Invalid " + Ve + " `" + Pt + "` of type `" + Ke + "` " + ("supplied to `" + Le + "`, expected `object`."));
var Rt = n({}, Te[Ge], pe);
for (var Wt in Rt) {
var Ft = pe[Wt];
if (c(pe, Wt) && typeof Ft != "function")
return de(Le, Ve, Pt, Wt, Ue(Ft));
if (!Ft)
return new _e(
"Invalid " + Ve + " `" + Pt + "` key `" + Wt + "` supplied to `" + Le + "`.\nBad object: " + JSON.stringify(Te[Ge], null, " ") + `
Valid keys: ` + JSON.stringify(Object.keys(pe), null, " ")
);
var $e = Ft(We, Wt, Le, Ve, Pt + "." + Wt, ie);
if ($e)
return $e;
}
return null;
}
return Pe(ve);
}
function Ce(pe) {
switch (typeof pe) {
case "number":
case "string":
case "undefined":
return !0;
case "boolean":
return !pe;
case "object":
if (Array.isArray(pe))
return pe.every(Ce);
if (pe === null || le(pe))
return !0;
var ve = Ae(pe);
if (ve) {
var Te = ve.call(pe), Ge;
if (ve !== pe.entries) {
for (; !(Ge = Te.next()).done; )
if (!Ce(Ge.value))
return !1;
} else
for (; !(Ge = Te.next()).done; ) {
var Le = Ge.value;
if (Le && !Ce(Le[1]))
return !1;
}
} else
return !1;
return !0;
default:
return !1;
}
}
function Oe(pe, ve) {
return pe === "symbol" ? !0 : ve ? ve["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && ve instanceof Symbol : !1;
}
function Je(pe) {
var ve = typeof pe;
return Array.isArray(pe) ? "array" : pe instanceof RegExp ? "object" : Oe(ve, pe) ? "symbol" : ve;
}
function Ue(pe) {
if (typeof pe > "u" || pe === null)
return "" + pe;
var ve = Je(pe);
if (ve === "object") {
if (pe instanceof Date)
return "date";
if (pe instanceof RegExp)
return "regexp";
}
return ve;
}
function Be(pe) {
var ve = Ue(pe);
switch (ve) {
case "array":
case "object":
return "an " + ve;
case "boolean":
case "date":
case "regexp":
return "a " + ve;
default:
return ve;
}
}
function ce(pe) {
return !pe.constructor || !pe.constructor.name ? me : pe.constructor.name;
}
return ke.checkPropTypes = se, ke.resetWarningCache = se.resetWarningCache, ke.PropTypes = ke, ke;
}, factoryWithTypeCheckers;
}
var factoryWithThrowingShims, hasRequiredFactoryWithThrowingShims;
function requireFactoryWithThrowingShims() {
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
hasRequiredFactoryWithThrowingShims = 1;
var t = /* @__PURE__ */ requireReactPropTypesSecret();
function n() {
}
function ie() {
}
return ie.resetWarningCache = n, factoryWithThrowingShims = function() {
function c(ue, le, ge, ye, Ie, Ae) {
if (Ae !== t) {
var me = new Error(
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
);
throw me.name = "Invariant Violation", me;
}
}
c.isRequired = c;
function se() {
return c;
}
var ae = {
array: c,
bigint: c,
bool: c,
func: c,
number: c,
object: c,
string: c,
symbol: c,
any: c,
arrayOf: se,
element: c,
elementType: c,
instanceOf: se,
node: c,
objectOf: se,
oneOf: se,
oneOfType: se,
shape: se,
exact: se,
checkPropTypes: ie,
resetWarningCache: n
};
return ae.PropTypes = ae, ae;
}, factoryWithThrowingShims;
}
var hasRequiredPropTypes;
function requirePropTypes() {
if (hasRequiredPropTypes) return propTypes.exports;
if (hasRequiredPropTypes = 1, process$1$1.env.NODE_ENV !== "production") {
var t = requireReactIs(), n = !0;
propTypes.exports = /* @__PURE__ */ requireFactoryWithTypeCheckers()(t.isElement, n);
} else
propTypes.exports = /* @__PURE__ */ requireFactoryWithThrowingShims()();
return propTypes.exports;
}
var propTypesExports = /* @__PURE__ */ requirePropTypes();
const PropTypes = /* @__PURE__ */ getDefaultExportFromCjs$4(propTypesExports);
function ownKeys(t, n) {
var ie = Object.keys(t);
if (Object.getOwnPropertySymbols) {
var c = Object.getOwnPropertySymbols(t);
n && (c = c.filter(function(se) {
return Object.getOwnPropertyDescriptor(t, se).enumerable;
})), ie.push.apply(ie, c);
}
return ie;
}
function _objectSpread2(t) {
for (var n = 1; n < arguments.length; n++) {
var ie = arguments[n] != null ? arguments[n] : {};
n % 2 ? ownKeys(Object(ie), !0).forEach(function(c) {
_defineProperty(t, c, ie[c]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(ie)) : ownKeys(Object(ie)).forEach(function(c) {
Object.defineProperty(t, c, Object.getOwnPropertyDescriptor(ie, c));
});
}
return t;
}
function _typeof(t) {
"@babel/helpers - typeof";
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? _typeof = function(n) {
return typeof n;
} : _typeof = function(n) {
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
}, _typeof(t);
}
function _defineProperty(t, n, ie) {
return n in t ? Object.defineProperty(t, n, {
value: ie,
enumerable: !0,
configurable: !0,
writable: !0
}) : t[n] = ie, t;
}
function _objectWithoutPropertiesLoose(t, n) {
if (t == null) return {};
var ie = {}, c = Object.keys(t), se, ae;
for (ae = 0; ae < c.length; ae++)
se = c[ae], !(n.indexOf(se) >= 0) && (ie[se] = t[se]);
return ie;
}
function _objectWithoutProperties(t, n) {
if (t == null) return {};
var ie = _objectWithoutPropertiesLoose(t, n), c, se;
if (Object.getOwnPropertySymbols) {
var ae = Object.getOwnPropertySymbols(t);
for (se = 0; se < ae.length; se++)
c = ae[se], !(n.indexOf(c) >= 0) && Object.prototype.propertyIsEnumerable.call(t, c) && (ie[c] = t[c]);
}
return ie;
}
function _slicedToArray(t, n) {
return _arrayWithHoles(t) || _iterableToArrayLimit(t, n) || _unsupportedIterableToArray(t, n) || _nonIterableRest();
}
function _arrayWithHoles(t) {
if (Array.isArray(t)) return t;
}
function _iterableToArrayLimit(t, n) {
var ie = t && (typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"]);
if (ie != null) {
var c = [], se = !0, ae = !1, ue, le;
try {
for (ie = ie.call(t); !(se = (ue = ie.next()).done) && (c.push(ue.value), !(n && c.length === n)); se = !0)
;
} catch (ge) {
ae = !0, le = ge;
} finally {
try {
!se && ie.return != null && ie.return();
} finally {
if (ae) throw le;
}
}
return c;
}
}
function _unsupportedIterableToArray(t, n) {
if (t) {
if (typeof t == "string") return _arrayLikeToArray(t, n);
var ie = Object.prototype.toString.call(t).slice(8, -1);
if (ie === "Object" && t.constructor && (ie = t.constructor.name), ie === "Map" || ie === "Set") return Array.from(t);
if (ie === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ie)) return _arrayLikeToArray(t, n);
}
}
function _arrayLikeToArray(t, n) {
(n == null || n > t.length) && (n = t.length);
for (var ie = 0, c = new Array(n); ie < n; ie++) c[ie] = t[ie];
return c;
}
function _nonIterableRest() {
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
var useAttachEvent = function(n, ie, c) {
var se = !!c, ae = React__default.useRef(c);
React__default.useEffect(function() {
ae.current = c;
}, [c]), React__default.useEffect(function() {
if (!se || !n)
return function() {
};
var ue = function() {
ae.current && ae.current.apply(ae, arguments);
};
return n.on(ie, ue), function() {
n.off(ie, ue);
};
}, [se, ie, n, ae]);
}, usePrevious = function(n) {
var ie = React__default.useRef(n);
return React__default.useEffect(function() {
ie.current = n;
}, [n]), ie.current;
}, isUnknownObject = function(n) {
return n !== null && _typeof(n) === "object";
}, isPromise = function(n) {
return isUnknownObject(n) && typeof n.then == "function";
}, isStripe = function(n) {
return isUnknownObject(n) && typeof n.elements == "function" && typeof n.createToken == "function" && typeof n.createPaymentMethod == "function" && typeof n.confirmCardPayment == "function";
}, PLAIN_OBJECT_STR = "[object Object]", isEqual = function t(n, ie) {
if (!isUnknownObject(n) || !isUnknownObject(ie))
return n === ie;
var c = Array.isArray(n), se = Array.isArray(ie);
if (c !== se) return !1;
var ae = Object.prototype.toString.call(n) === PLAIN_OBJECT_STR, ue = Object.prototype.toString.call(ie) === PLAIN_OBJECT_STR;
if (ae !== ue) return !1;
if (!ae && !c) return n === ie;
var le = Object.keys(n), ge = Object.keys(ie);
if (le.length !== ge.length) return !1;
for (var ye = {}, Ie = 0; Ie < le.length; Ie += 1)
ye[le[Ie]] = !0;
for (var Ae = 0; Ae < ge.length; Ae += 1)
ye[ge[Ae]] = !0;
var me = Object.keys(ye);
if (me.length !== le.length)
return !1;
var ke = n, Ne = ie, _e = function(Ee) {
return t(ke[Ee], Ne[Ee]);
};
return me.every(_e);
}, extractAllowedOptionsUpdates = function(n, ie, c) {
return isUnknownObject(n) ? Object.keys(n).reduce(function(se, ae) {
var ue = !isUnknownObject(ie) || !isEqual(n[ae], ie[ae]);
return c.includes(ae) ? (ue && console.warn("Unsupported prop change: options.".concat(ae, " is not a mutable property.")), se) : ue ? _objectSpread2(_objectSpread2({}, se || {}), {}, _defineProperty({}, ae, n[ae])) : se;
}, null) : null;
}, INVALID_STRIPE_ERROR$1 = "Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.", validateStripe = function(n) {
var ie = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : INVALID_STRIPE_ERROR$1;
if (n === null || isStripe(n))
return n;
throw new Error(ie);
}, parseStripeProp = function(n) {
var ie = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : INVALID_STRIPE_ERROR$1;
if (isPromise(n))
return {
tag: "async",
stripePromise: Promise.resolve(n).then(function(se) {
return validateStripe(se, ie);
})
};
var c = validateStripe(n, ie);
return c === null ? {
tag: "empty"
} : {
tag: "sync",
stripe: c
};
}, registerWithStripeJs = function(n) {
!n || !n._registerWrapper || !n.registerAppInfo || (n._registerWrapper({
name: "react-stripe-js",
version: "5.2.0"
}), n.registerAppInfo({
name: "react-stripe-js",
version: "5.2.0",
url: "https://stripe.com/docs/stripe-js/react"
}));
}, ElementsContext = /* @__PURE__ */ React__default.createContext(null);
ElementsContext.displayName = "ElementsContext";
var parseElementsContext = function(n, ie) {
if (!n)
throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(ie, " in an <Elements> provider."));
return n;
}, Elements = function(n) {
var ie = n.stripe, c = n.options, se = n.children, ae = React__default.useMemo(function() {
return parseStripeProp(ie);
}, [ie]), ue = React__default.useState(function() {
return {
stripe: ae.tag === "sync" ? ae.stripe : null,
elements: ae.tag === "sync" ? ae.stripe.elements(c) : null
};
}), le = _slicedToArray(ue, 2), ge = le[0], ye = le[1];
React__default.useEffect(function() {
var me = !0, ke = function(_e) {
ye(function(Pe) {
return Pe.stripe ? Pe : {
stripe: _e,
elements: _e.elements(c)
};
});
};
return ae.tag === "async" && !ge.stripe ? ae.stripePromise.then(function(Ne) {
Ne && me && ke(Ne);
}) : ae.tag === "sync" && !ge.stripe && ke(ae.stripe), function() {
me = !1;
};
}, [ae, ge, c]);
var Ie = usePrevious(ie);
React__default.useEffect(function() {
Ie !== null && Ie !== ie && console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.");
}, [Ie, ie]);
var Ae = usePrevious(c);
return React__default.useEffect(function() {
if (ge.elements) {
var me = extractAllowedOptionsUpdates(c, Ae, ["clientSecret", "fonts"]);
me && ge.elements.update(me);
}
}, [c, Ae, ge.elements]), React__default.useEffect(function() {
registerWithStripeJs(ge.stripe);
}, [ge.stripe]), /* @__PURE__ */ React__default.createElement(ElementsContext.Provider, {
value: ge
}, se);
};
Elements.propTypes = {
stripe: PropTypes.any,
options: PropTypes.object
};
var useElementsContextWithUseCase = function(n) {
var ie = React__default.useContext(ElementsContext);
return parseElementsContext(ie, n);
}, useElements = function() {
var n = useElementsContextWithUseCase("calls useElements()"), ie = n.elements;
return ie;
};
PropTypes.func.isRequired;
var CheckoutContext = /* @__PURE__ */ React__default.createContext(null);
CheckoutContext.displayName = "CheckoutContext";
PropTypes.any, PropTypes.shape({
clientSecret: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Promise)]).isRequired,
elementsOptions: PropTypes.object
}).isRequired;
var useElementsOrCheckoutContextWithUseCase = function(n) {
var ie = React__default.useContext(CheckoutContext), c = React__default.useContext(ElementsContext);
if (ie) {
if (c)
throw new Error("You cannot wrap the part of your app that ".concat(n, " in both <CheckoutProvider> and <Elements> providers."));
return ie;
} else
return parseElementsContext(c, n);
}, _excluded = ["mode"], capitalized = function(n) {
return n.charAt(0).toUpperCase() + n.slice(1);
}, createElementComponent = function(n, ie) {
var c = "".concat(capitalized(n), "Element"), se = function(ge) {
var ye = ge.id, Ie = ge.className, Ae = ge.options, me = Ae === void 0 ? {} : Ae, ke = ge.onBlur, Ne = ge.onFocus, _e = ge.onReady, Pe = ge.onChange, Ee = ge.onEscape, De = ge.onClick, Fe = ge.onLoadError, Se = ge.onLoaderStart, we = ge.onNetworksChange, fe = ge.onConfirm, Me = ge.onCancel, He = ge.onShippingAddressChange, qe = ge.onShippingRateChange, Qe = ge.onSavedPaymentMethodRemove, de = ge.onSavedPaymentMethodUpdate, he = useElementsOrCheckoutContextWithUseCase("mounts <".concat(c, ">")), be = "elements" in he ? he.elements : null, Ce = "checkoutState" in he ? he.checkoutState : null, Oe = Ce?.type === "success" || Ce?.type === "loading" ? Ce.sdk : null, Je = React__default.useState(null), Ue = _slicedToArray(Je, 2), Be = Ue[0], ce = Ue[1], pe = React__default.useRef(null), ve = React__default.useRef(null);
useAttachEvent(Be, "blur", ke), useAttachEvent(Be, "focus", Ne), useAttachEvent(Be, "escape", Ee), useAttachEvent(Be, "click", De), useAttachEvent(Be, "loaderror", Fe), useAttachEvent(Be, "loaderstart", Se), useAttachEvent(Be, "networkschange", we), useAttachEvent(Be, "confirm", fe), useAttachEvent(Be, "cancel", Me), useAttachEvent(Be, "shippingaddresschange", He), useAttachEvent(Be, "shippingratechange", qe), useAttachEvent(Be, "savedpaymentmethodremove", Qe), useAttachEvent(Be, "savedpaymentmethodupdate", de), useAttachEvent(Be, "change", Pe);
var Te;
_e && (n === "expressCheckout" ? Te = _e : Te = function() {
_e(Be);
}), useAttachEvent(Be, "ready", Te), React__default.useLayoutEffect(function() {
if (pe.current === null && ve.current !== null && (be || Oe)) {
var Le = null;
if (Oe)
switch (n) {
case "payment":
Le = Oe.createPaymentElement(me);
break;
case "address":
if ("mode" in me) {
var Ve = me.mode, Pt = _objectWithoutProperties(me, _excluded);
if (Ve === "shipping")
Le = Oe.createShippingAddressElement(Pt);
else if (Ve === "billing")
Le = Oe.createBillingAddressElement(Pt);
else
throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.");
} else
throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");
break;
case "expressCheckout":
Le = Oe.createExpressCheckoutElement(me);
break;
case "currencySelector":
Le = Oe.createCurrencySelectorElement();
break;
case "taxId":
Le = Oe.createTaxIdElement(me);
break;
default:
throw new Error("Invalid Element type ".concat(c, ". You must use either the <PaymentElement />, <AddressElement options={{mode: 'shipping'}} />, <AddressElement options={{mode: 'billing'}} />, or <ExpressCheckoutElement />."));
}
else be && (Le = be.create(n, me));
pe.current = Le, ce(Le), Le && Le.mount(ve.current);
}
}, [be, Oe, me]);
var Ge = usePrevious(me);
return React__default.useEffect(function() {
if (pe.current) {
var Le = extractAllowedOptionsUpdates(me, Ge, ["paymentRequest"]);
Le && "update" in pe.current && pe.current.update(Le);
}
}, [me, Ge]), React__default.useLayoutEffect(function() {
return function() {
if (pe.current && typeof pe.current.destroy == "function")
try {
pe.current.destroy(), pe.current = null;
} catch {
}
};
}, []), /* @__PURE__ */ React__default.createElement("div", {
id: ye,
className: Ie,
ref: ve
});
}, ae = function(ge) {
useElementsOrCheckoutContextWithUseCase("mounts <".concat(c, ">"));
var ye = ge.id, Ie = ge.className;
return /* @__PURE__ */ React__default.createElement("div", {
id: ye,
className: Ie
});
}, ue = ie ? ae : se;
return ue.propTypes = {
id: PropTypes.string,
className: PropTypes.string,
onChange: PropTypes.func,
onBlur: PropTypes.func,
onFocus: PropTypes.func,
onReady: PropTypes.func,
onEscape: PropTypes.func,
onClick: PropTypes.func,
onLoadError: PropTypes.func,
onLoaderStart: PropTypes.func,
onNetworksChange: PropTypes.func,
onConfirm: PropTypes.func,
onCancel: PropTypes.func,
onShippingAddressChange: PropTypes.func,
onShippingRateChange: PropTypes.func,
onSavedPaymentMethodRemove: PropTypes.func,
onSavedPaymentMethodUpdate: PropTypes.func,
options: PropTypes.object
}, ue.displayName = c, ue.__elementType = n, ue;
}, isServer = typeof window > "u", EmbeddedCheckoutContext = /* @__PURE__ */ React__default.createContext(null);
EmbeddedCheckoutContext.displayName = "EmbeddedCheckoutProviderContext";
var useStripe = function() {
var n = useElementsOrCheckoutContextWithUseCase("calls useStripe()"), ie = n.stripe;
return ie;
};
createElementComponent("auBankAccount", isServer);
createElementComponent("card", isServer);
createElementComponent("cardNumber", isServer);
createElementComponent("cardExpiry", isServer);
createElementComponent("cardCvc", isServer);
createElementComponent("iban", isServer);
var PaymentElement = createElementComponent("payment", isServer);
createElementComponent("expressCheckout", isServer);
createElementComponent("paymentRequestButton", isServer);
createElementComponent("linkAuthentication", isServer);
createEl