@pelcro/react-pelcro-js 4.0.0-alpha.55 → 4.0.0-alpha.57
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/dist/index.cjs.js +1702 -1991
- package/dist/index.esm.js +1703 -1989
- package/dist/pelcro.css +51 -71
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -3,23 +3,23 @@ import React__default, { useContext, useState, useRef, useEffect, useReducer, us
|
|
|
3
3
|
import ReactDOM, { render as render$1 } from 'react-dom';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
|
|
6
|
-
function _typeof$
|
|
6
|
+
function _typeof$4(obj) {
|
|
7
7
|
"@babel/helpers - typeof";
|
|
8
8
|
|
|
9
9
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
10
|
-
_typeof$
|
|
10
|
+
_typeof$4 = function _typeof(obj) {
|
|
11
11
|
return typeof obj;
|
|
12
12
|
};
|
|
13
13
|
} else {
|
|
14
|
-
_typeof$
|
|
14
|
+
_typeof$4 = function _typeof(obj) {
|
|
15
15
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
return _typeof$
|
|
19
|
+
return _typeof$4(obj);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
function _defineProperty$
|
|
22
|
+
function _defineProperty$6(obj, key, value) {
|
|
23
23
|
if (key in obj) {
|
|
24
24
|
Object.defineProperty(obj, key, {
|
|
25
25
|
value: value,
|
|
@@ -46,7 +46,7 @@ function _objectSpread$7(target) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
ownKeys.forEach(function (key) {
|
|
49
|
-
_defineProperty$
|
|
49
|
+
_defineProperty$6(target, key, source[key]);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -110,7 +110,7 @@ module.exports = _typeof;
|
|
|
110
110
|
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
-
var _typeof$
|
|
113
|
+
var _typeof$3 = unwrapExports(_typeof_1);
|
|
114
114
|
|
|
115
115
|
function _assertThisInitialized$1(self) {
|
|
116
116
|
if (self === void 0) {
|
|
@@ -121,7 +121,7 @@ function _assertThisInitialized$1(self) {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
function _possibleConstructorReturn$1(self, call) {
|
|
124
|
-
if (call && (_typeof$
|
|
124
|
+
if (call && (_typeof$3(call) === "object" || typeof call === "function")) {
|
|
125
125
|
return call;
|
|
126
126
|
}
|
|
127
127
|
|
|
@@ -690,7 +690,7 @@ var Translator = function (_EventEmitter) {
|
|
|
690
690
|
value: function translate(keys, options, lastKey) {
|
|
691
691
|
var _this2 = this;
|
|
692
692
|
|
|
693
|
-
if (_typeof$
|
|
693
|
+
if (_typeof$4(options) !== 'object' && this.options.overloadTranslationOptionHandler) {
|
|
694
694
|
options = this.options.overloadTranslationOptionHandler(arguments);
|
|
695
695
|
}
|
|
696
696
|
|
|
@@ -1876,11 +1876,11 @@ function get() {
|
|
|
1876
1876
|
appendNamespaceToCIMode: false,
|
|
1877
1877
|
overloadTranslationOptionHandler: function handle(args) {
|
|
1878
1878
|
var ret = {};
|
|
1879
|
-
if (_typeof$
|
|
1879
|
+
if (_typeof$4(args[1]) === 'object') ret = args[1];
|
|
1880
1880
|
if (typeof args[1] === 'string') ret.defaultValue = args[1];
|
|
1881
1881
|
if (typeof args[2] === 'string') ret.tDescription = args[2];
|
|
1882
1882
|
|
|
1883
|
-
if (_typeof$
|
|
1883
|
+
if (_typeof$4(args[2]) === 'object' || _typeof$4(args[3]) === 'object') {
|
|
1884
1884
|
var options = args[3] || args[2];
|
|
1885
1885
|
Object.keys(options).forEach(function (key) {
|
|
1886
1886
|
ret[key] = options[key];
|
|
@@ -2268,7 +2268,7 @@ var I18n = function (_EventEmitter) {
|
|
|
2268
2268
|
var fixedT = function fixedT(key, opts) {
|
|
2269
2269
|
var options;
|
|
2270
2270
|
|
|
2271
|
-
if (_typeof$
|
|
2271
|
+
if (_typeof$4(opts) !== 'object') {
|
|
2272
2272
|
for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
|
2273
2273
|
rest[_key3 - 2] = arguments[_key3];
|
|
2274
2274
|
}
|
|
@@ -2520,7 +2520,7 @@ module.exports = _defineProperty;
|
|
|
2520
2520
|
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
2521
2521
|
});
|
|
2522
2522
|
|
|
2523
|
-
var _defineProperty$
|
|
2523
|
+
var _defineProperty$5 = unwrapExports(defineProperty);
|
|
2524
2524
|
|
|
2525
2525
|
/**
|
|
2526
2526
|
* This file automatically generated from `pre-publish.js`.
|
|
@@ -2582,9 +2582,9 @@ module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
|
2582
2582
|
|
|
2583
2583
|
var _createClass$1 = unwrapExports(createClass);
|
|
2584
2584
|
|
|
2585
|
-
function ownKeys$
|
|
2585
|
+
function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
2586
2586
|
|
|
2587
|
-
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$
|
|
2587
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty$5(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2588
2588
|
var defaultOptions$1 = {
|
|
2589
2589
|
bindI18n: 'languageChanged',
|
|
2590
2590
|
bindI18nStore: '',
|
|
@@ -2709,9 +2709,9 @@ function getDisplayName(Component) {
|
|
|
2709
2709
|
return Component.displayName || Component.name || (typeof Component === 'string' && Component.length > 0 ? Component : 'Unknown');
|
|
2710
2710
|
}
|
|
2711
2711
|
|
|
2712
|
-
function ownKeys$
|
|
2712
|
+
function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
2713
2713
|
|
|
2714
|
-
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$
|
|
2714
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty$5(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2715
2715
|
|
|
2716
2716
|
function hasChildren$1(node, checkLength) {
|
|
2717
2717
|
if (!node) return false;
|
|
@@ -2770,7 +2770,7 @@ function nodesToString(children, i18nOptions) {
|
|
|
2770
2770
|
}
|
|
2771
2771
|
} else if (child === null) {
|
|
2772
2772
|
warn$1("Trans: the passed in value is invalid - seems you passed in a null child.");
|
|
2773
|
-
} else if (_typeof$
|
|
2773
|
+
} else if (_typeof$3(child) === 'object') {
|
|
2774
2774
|
var format = child.format,
|
|
2775
2775
|
clone = _objectWithoutProperties$2(child, ["format"]);
|
|
2776
2776
|
|
|
@@ -2800,7 +2800,7 @@ function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts) {
|
|
|
2800
2800
|
var childrenArray = getAsArray(childs);
|
|
2801
2801
|
childrenArray.forEach(function (child) {
|
|
2802
2802
|
if (typeof child === 'string') return;
|
|
2803
|
-
if (hasChildren$1(child)) getData(getChildren(child));else if (_typeof$
|
|
2803
|
+
if (hasChildren$1(child)) getData(getChildren(child));else if (_typeof$3(child) === 'object' && !React__default.isValidElement(child)) Object.assign(data, child);
|
|
2804
2804
|
});
|
|
2805
2805
|
}
|
|
2806
2806
|
|
|
@@ -2836,8 +2836,8 @@ function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts) {
|
|
|
2836
2836
|
}, tmp) : tmp;
|
|
2837
2837
|
var isElement = React__default.isValidElement(child);
|
|
2838
2838
|
var isValidTranslationWithChildren = isElement && hasChildren$1(node, true) && !node.voidElement;
|
|
2839
|
-
var isEmptyTransWithHTML = emptyChildrenButNeedsHandling && _typeof$
|
|
2840
|
-
var isKnownComponent = _typeof$
|
|
2839
|
+
var isEmptyTransWithHTML = emptyChildrenButNeedsHandling && _typeof$3(child) === 'object' && child.dummy && !isElement;
|
|
2840
|
+
var isKnownComponent = _typeof$3(children) === 'object' && children !== null && Object.hasOwnProperty.call(children, node.name);
|
|
2841
2841
|
|
|
2842
2842
|
if (typeof child === 'string') {
|
|
2843
2843
|
mem.push(child);
|
|
@@ -2874,7 +2874,7 @@ function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts) {
|
|
|
2874
2874
|
|
|
2875
2875
|
mem.push("<".concat(node.name, ">").concat(_inner4, "</").concat(node.name, ">"));
|
|
2876
2876
|
}
|
|
2877
|
-
} else if (_typeof$
|
|
2877
|
+
} else if (_typeof$3(child) === 'object' && !isElement) {
|
|
2878
2878
|
var content = node.children[0] ? translationContent : null;
|
|
2879
2879
|
if (content) mem.push(content);
|
|
2880
2880
|
} else if (node.children.length === 1 && translationContent) {
|
|
@@ -3067,11 +3067,11 @@ module.exports = _slicedToArray;
|
|
|
3067
3067
|
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
3068
3068
|
});
|
|
3069
3069
|
|
|
3070
|
-
var _slicedToArray = unwrapExports(slicedToArray);
|
|
3070
|
+
var _slicedToArray$1 = unwrapExports(slicedToArray);
|
|
3071
3071
|
|
|
3072
|
-
function ownKeys$
|
|
3072
|
+
function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
3073
3073
|
|
|
3074
|
-
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$
|
|
3074
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty$5(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
3075
3075
|
function useTranslation(ns) {
|
|
3076
3076
|
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3077
3077
|
var i18nFromProps = props.i18n;
|
|
@@ -3114,7 +3114,7 @@ function useTranslation(ns) {
|
|
|
3114
3114
|
}
|
|
3115
3115
|
|
|
3116
3116
|
var _useState = useState(getT),
|
|
3117
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
3117
|
+
_useState2 = _slicedToArray$1(_useState, 2),
|
|
3118
3118
|
t = _useState2[0],
|
|
3119
3119
|
setT = _useState2[1];
|
|
3120
3120
|
|
|
@@ -3167,9 +3167,9 @@ function useTranslation(ns) {
|
|
|
3167
3167
|
});
|
|
3168
3168
|
}
|
|
3169
3169
|
|
|
3170
|
-
function ownKeys$
|
|
3170
|
+
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
3171
3171
|
|
|
3172
|
-
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$
|
|
3172
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty$5(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
3173
3173
|
function withTranslation(ns) {
|
|
3174
3174
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3175
3175
|
return function Extend(WrappedComponent) {
|
|
@@ -3178,7 +3178,7 @@ function withTranslation(ns) {
|
|
|
3178
3178
|
rest = _objectWithoutProperties$2(_ref, ["forwardedRef"]);
|
|
3179
3179
|
|
|
3180
3180
|
var _useTranslation = useTranslation(ns, rest),
|
|
3181
|
-
_useTranslation2 = _slicedToArray(_useTranslation, 3),
|
|
3181
|
+
_useTranslation2 = _slicedToArray$1(_useTranslation, 3),
|
|
3182
3182
|
t = _useTranslation2[0],
|
|
3183
3183
|
i18n = _useTranslation2[1],
|
|
3184
3184
|
ready = _useTranslation2[2];
|
|
@@ -3900,7 +3900,7 @@ var labels$V = {
|
|
|
3900
3900
|
addresses: "Addresses",
|
|
3901
3901
|
myProfile: "My Profile",
|
|
3902
3902
|
basicData: "Basic Data",
|
|
3903
|
-
paymentSource: "Payment
|
|
3903
|
+
paymentSource: "Payment methods",
|
|
3904
3904
|
addCard: "Add Card",
|
|
3905
3905
|
actions: "Actions",
|
|
3906
3906
|
expiresOn: "Ends",
|
|
@@ -7433,7 +7433,7 @@ middleware.devtools;
|
|
|
7433
7433
|
var middleware_3 = middleware.persist;
|
|
7434
7434
|
middleware.redux;
|
|
7435
7435
|
|
|
7436
|
-
function _defineProperty$
|
|
7436
|
+
function _defineProperty$4(obj, key, value) {
|
|
7437
7437
|
if (key in obj) {
|
|
7438
7438
|
Object.defineProperty(obj, key, {
|
|
7439
7439
|
value: value,
|
|
@@ -7499,11 +7499,11 @@ function warn(s) {
|
|
|
7499
7499
|
console.warn('[react-ga]', s);
|
|
7500
7500
|
}
|
|
7501
7501
|
|
|
7502
|
-
function _typeof$
|
|
7502
|
+
function _typeof$2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$2 = function _typeof(obj) { return typeof obj; }; } else { _typeof$2 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$2(obj); }
|
|
7503
7503
|
|
|
7504
|
-
function ownKeys$
|
|
7504
|
+
function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
7505
7505
|
|
|
7506
|
-
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$
|
|
7506
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(source, true).forEach(function (key) { _defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7507
7507
|
|
|
7508
7508
|
function _objectWithoutProperties$1(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$2(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
7509
7509
|
|
|
@@ -7515,7 +7515,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
7515
7515
|
|
|
7516
7516
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
7517
7517
|
|
|
7518
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof$
|
|
7518
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof$2(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
7519
7519
|
|
|
7520
7520
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
7521
7521
|
|
|
@@ -7525,7 +7525,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
7525
7525
|
|
|
7526
7526
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
7527
7527
|
|
|
7528
|
-
function _defineProperty$
|
|
7528
|
+
function _defineProperty$3(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7529
7529
|
var NEWTAB = '_blank';
|
|
7530
7530
|
var MIDDLECLICK = 1;
|
|
7531
7531
|
|
|
@@ -7547,7 +7547,7 @@ function (_Component) {
|
|
|
7547
7547
|
|
|
7548
7548
|
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(OutboundLink)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
|
7549
7549
|
|
|
7550
|
-
_defineProperty$
|
|
7550
|
+
_defineProperty$3(_assertThisInitialized(_this), "handleClick", function (event) {
|
|
7551
7551
|
var _this$props = _this.props,
|
|
7552
7552
|
target = _this$props.target,
|
|
7553
7553
|
eventLabel = _this$props.eventLabel,
|
|
@@ -7602,11 +7602,11 @@ function (_Component) {
|
|
|
7602
7602
|
return OutboundLink;
|
|
7603
7603
|
}(Component);
|
|
7604
7604
|
|
|
7605
|
-
_defineProperty$
|
|
7605
|
+
_defineProperty$3(OutboundLink$1, "trackLink", function () {
|
|
7606
7606
|
warn('ga tracking not enabled');
|
|
7607
7607
|
});
|
|
7608
7608
|
|
|
7609
|
-
_defineProperty$
|
|
7609
|
+
_defineProperty$3(OutboundLink$1, "propTypes", {
|
|
7610
7610
|
eventLabel: PropTypes.string.isRequired,
|
|
7611
7611
|
target: PropTypes.string,
|
|
7612
7612
|
to: PropTypes.string,
|
|
@@ -7614,7 +7614,7 @@ _defineProperty$2(OutboundLink$1, "propTypes", {
|
|
|
7614
7614
|
trackerNames: PropTypes.arrayOf(PropTypes.string)
|
|
7615
7615
|
});
|
|
7616
7616
|
|
|
7617
|
-
_defineProperty$
|
|
7617
|
+
_defineProperty$3(OutboundLink$1, "defaultProps", {
|
|
7618
7618
|
target: null,
|
|
7619
7619
|
to: null,
|
|
7620
7620
|
onClick: null,
|
|
@@ -7725,13 +7725,13 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
7725
7725
|
|
|
7726
7726
|
function _objectWithoutPropertiesLoose$1(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7727
7727
|
|
|
7728
|
-
function ownKeys$
|
|
7728
|
+
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
7729
7729
|
|
|
7730
|
-
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$
|
|
7730
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(source, true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7731
7731
|
|
|
7732
|
-
function _defineProperty$
|
|
7732
|
+
function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7733
7733
|
|
|
7734
|
-
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
7734
|
+
function _typeof$1(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
|
|
7735
7735
|
|
|
7736
7736
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
7737
7737
|
|
|
@@ -7826,7 +7826,7 @@ function initialize(configsOrTrackingId, options) {
|
|
|
7826
7826
|
|
|
7827
7827
|
if (Array.isArray(configsOrTrackingId)) {
|
|
7828
7828
|
configsOrTrackingId.forEach(function (config) {
|
|
7829
|
-
if (_typeof(config) !== 'object') {
|
|
7829
|
+
if (_typeof$1(config) !== 'object') {
|
|
7830
7830
|
warn('All configs must be an object');
|
|
7831
7831
|
return;
|
|
7832
7832
|
}
|
|
@@ -7873,7 +7873,7 @@ function set(fieldsObject, trackerNames) {
|
|
|
7873
7873
|
return;
|
|
7874
7874
|
}
|
|
7875
7875
|
|
|
7876
|
-
if (_typeof(fieldsObject) !== 'object') {
|
|
7876
|
+
if (_typeof$1(fieldsObject) !== 'object') {
|
|
7877
7877
|
warn('Expected `fieldsObject` arg to be an Object');
|
|
7878
7878
|
return;
|
|
7879
7879
|
}
|
|
@@ -8168,7 +8168,7 @@ var plugin = {
|
|
|
8168
8168
|
var requireString = trackerName ? "".concat(trackerName, ".require") : 'require'; // Optional Fields
|
|
8169
8169
|
|
|
8170
8170
|
if (options) {
|
|
8171
|
-
if (_typeof(options) !== 'object') {
|
|
8171
|
+
if (_typeof$1(options) !== 'object') {
|
|
8172
8172
|
warn('Expected `options` arg to be an Object');
|
|
8173
8173
|
return;
|
|
8174
8174
|
}
|
|
@@ -8338,11 +8338,11 @@ var Defaults = /*#__PURE__*/Object.freeze({
|
|
|
8338
8338
|
'default': core
|
|
8339
8339
|
});
|
|
8340
8340
|
|
|
8341
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
8341
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
8342
8342
|
|
|
8343
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8343
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(source, true).forEach(function (key) { _defineProperty$1(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8344
8344
|
|
|
8345
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8345
|
+
function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8346
8346
|
OutboundLink$1.origTrackLink = OutboundLink$1.trackLink;
|
|
8347
8347
|
OutboundLink$1.trackLink = outboundLink;
|
|
8348
8348
|
var OutboundLink = OutboundLink$1;
|
|
@@ -8887,7 +8887,7 @@ dist.ReactGAImplementation;
|
|
|
8887
8887
|
|
|
8888
8888
|
class PelcroActions {
|
|
8889
8889
|
constructor(storeSetter, storeGetter) {
|
|
8890
|
-
_defineProperty$
|
|
8890
|
+
_defineProperty$4(this, "resetState", () => {
|
|
8891
8891
|
const {
|
|
8892
8892
|
view,
|
|
8893
8893
|
cartItems,
|
|
@@ -8896,7 +8896,7 @@ class PelcroActions {
|
|
|
8896
8896
|
this.set(otherStateFields);
|
|
8897
8897
|
});
|
|
8898
8898
|
|
|
8899
|
-
_defineProperty$
|
|
8899
|
+
_defineProperty$4(this, "switchView", view => {
|
|
8900
8900
|
var _window$Pelcro$site$r;
|
|
8901
8901
|
|
|
8902
8902
|
// view switching guards
|
|
@@ -8929,7 +8929,7 @@ class PelcroActions {
|
|
|
8929
8929
|
});
|
|
8930
8930
|
});
|
|
8931
8931
|
|
|
8932
|
-
_defineProperty$
|
|
8932
|
+
_defineProperty$4(this, "resetView", () => {
|
|
8933
8933
|
const {
|
|
8934
8934
|
switchView,
|
|
8935
8935
|
resetState
|
|
@@ -8938,7 +8938,7 @@ class PelcroActions {
|
|
|
8938
8938
|
resetState();
|
|
8939
8939
|
});
|
|
8940
8940
|
|
|
8941
|
-
_defineProperty$
|
|
8941
|
+
_defineProperty$4(this, "switchToPaymentView", () => {
|
|
8942
8942
|
const {
|
|
8943
8943
|
switchView,
|
|
8944
8944
|
resetView,
|
|
@@ -8960,7 +8960,7 @@ class PelcroActions {
|
|
|
8960
8960
|
return resetView();
|
|
8961
8961
|
});
|
|
8962
8962
|
|
|
8963
|
-
_defineProperty$
|
|
8963
|
+
_defineProperty$4(this, "switchToCheckoutForm", () => {
|
|
8964
8964
|
const {
|
|
8965
8965
|
switchView,
|
|
8966
8966
|
product,
|
|
@@ -8986,7 +8986,7 @@ class PelcroActions {
|
|
|
8986
8986
|
}
|
|
8987
8987
|
});
|
|
8988
8988
|
|
|
8989
|
-
_defineProperty$
|
|
8989
|
+
_defineProperty$4(this, "switchToAddressView", () => {
|
|
8990
8990
|
const {
|
|
8991
8991
|
switchView
|
|
8992
8992
|
} = this.get();
|
|
@@ -8998,7 +8998,7 @@ class PelcroActions {
|
|
|
8998
8998
|
}
|
|
8999
8999
|
});
|
|
9000
9000
|
|
|
9001
|
-
_defineProperty$
|
|
9001
|
+
_defineProperty$4(this, "setProduct", id => {
|
|
9002
9002
|
const product = window.Pelcro.product.getById(id);
|
|
9003
9003
|
if (!product) return console.error("invalid product id");
|
|
9004
9004
|
this.set({
|
|
@@ -9006,7 +9006,7 @@ class PelcroActions {
|
|
|
9006
9006
|
});
|
|
9007
9007
|
});
|
|
9008
9008
|
|
|
9009
|
-
_defineProperty$
|
|
9009
|
+
_defineProperty$4(this, "setPlan", id => {
|
|
9010
9010
|
const plan = window.Pelcro.plan.getById(id);
|
|
9011
9011
|
if (!plan) return console.error("invalid plan id");
|
|
9012
9012
|
this.set({
|
|
@@ -9014,7 +9014,7 @@ class PelcroActions {
|
|
|
9014
9014
|
});
|
|
9015
9015
|
});
|
|
9016
9016
|
|
|
9017
|
-
_defineProperty$
|
|
9017
|
+
_defineProperty$4(this, "setSubscriptionToCancel", id => {
|
|
9018
9018
|
var _window$Pelcro$subscr;
|
|
9019
9019
|
|
|
9020
9020
|
const subscriptions = (_window$Pelcro$subscr = window.Pelcro.subscription.list()) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
|
|
@@ -9029,7 +9029,7 @@ class PelcroActions {
|
|
|
9029
9029
|
});
|
|
9030
9030
|
});
|
|
9031
9031
|
|
|
9032
|
-
_defineProperty$
|
|
9032
|
+
_defineProperty$4(this, "setSubscriptionToSuspend", id => {
|
|
9033
9033
|
var _window$Pelcro$subscr2;
|
|
9034
9034
|
|
|
9035
9035
|
const subscriptions = (_window$Pelcro$subscr2 = window.Pelcro.subscription.list()) !== null && _window$Pelcro$subscr2 !== void 0 ? _window$Pelcro$subscr2 : [];
|
|
@@ -9044,7 +9044,7 @@ class PelcroActions {
|
|
|
9044
9044
|
});
|
|
9045
9045
|
});
|
|
9046
9046
|
|
|
9047
|
-
_defineProperty$
|
|
9047
|
+
_defineProperty$4(this, "setSubscriptionToManageMembers", id => {
|
|
9048
9048
|
var _window$Pelcro$subscr3, _subscriptionToManage;
|
|
9049
9049
|
|
|
9050
9050
|
const subscriptions = (_window$Pelcro$subscr3 = window.Pelcro.subscription.list()) !== null && _window$Pelcro$subscr3 !== void 0 ? _window$Pelcro$subscr3 : [];
|
|
@@ -9064,7 +9064,7 @@ class PelcroActions {
|
|
|
9064
9064
|
return true;
|
|
9065
9065
|
});
|
|
9066
9066
|
|
|
9067
|
-
_defineProperty$
|
|
9067
|
+
_defineProperty$4(this, "setInvoice", id => {
|
|
9068
9068
|
var _window$Pelcro$invoic;
|
|
9069
9069
|
|
|
9070
9070
|
const invoices = (_window$Pelcro$invoic = window.Pelcro.invoice.list()) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
@@ -9081,7 +9081,7 @@ class PelcroActions {
|
|
|
9081
9081
|
return true;
|
|
9082
9082
|
});
|
|
9083
9083
|
|
|
9084
|
-
_defineProperty$
|
|
9084
|
+
_defineProperty$4(this, "setSelectedMembership", id => {
|
|
9085
9085
|
var _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
9086
9086
|
|
|
9087
9087
|
const memberships = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.memberships) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
|
|
@@ -9098,14 +9098,14 @@ class PelcroActions {
|
|
|
9098
9098
|
return true;
|
|
9099
9099
|
});
|
|
9100
9100
|
|
|
9101
|
-
_defineProperty$
|
|
9101
|
+
_defineProperty$4(this, "setCouponCode", couponCode => {
|
|
9102
9102
|
if (!couponCode) return console.error("invalid coupon code");
|
|
9103
9103
|
this.set({
|
|
9104
9104
|
couponCode
|
|
9105
9105
|
});
|
|
9106
9106
|
});
|
|
9107
9107
|
|
|
9108
|
-
_defineProperty$
|
|
9108
|
+
_defineProperty$4(this, "logout", (displayLogin = true) => {
|
|
9109
9109
|
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
9110
9110
|
|
|
9111
9111
|
const {
|
|
@@ -9142,7 +9142,7 @@ class PelcroActions {
|
|
|
9142
9142
|
}
|
|
9143
9143
|
});
|
|
9144
9144
|
|
|
9145
|
-
_defineProperty$
|
|
9145
|
+
_defineProperty$4(this, "addToCart", itemSkuId => {
|
|
9146
9146
|
const itemToAdd = window.Pelcro.ecommerce.products.getBySkuId(Number(itemSkuId));
|
|
9147
9147
|
|
|
9148
9148
|
if (!itemToAdd) {
|
|
@@ -9184,7 +9184,7 @@ class PelcroActions {
|
|
|
9184
9184
|
return true;
|
|
9185
9185
|
});
|
|
9186
9186
|
|
|
9187
|
-
_defineProperty$
|
|
9187
|
+
_defineProperty$4(this, "removeFromCart", itemSkuId => {
|
|
9188
9188
|
const {
|
|
9189
9189
|
cartItems
|
|
9190
9190
|
} = this.get();
|
|
@@ -9222,7 +9222,7 @@ class PelcroActions {
|
|
|
9222
9222
|
return true;
|
|
9223
9223
|
});
|
|
9224
9224
|
|
|
9225
|
-
_defineProperty$
|
|
9225
|
+
_defineProperty$4(this, "purchaseItem", itemSkuId => {
|
|
9226
9226
|
const quickPurchaseItem = window.Pelcro.ecommerce.products.getBySkuId(Number(itemSkuId));
|
|
9227
9227
|
|
|
9228
9228
|
if (!quickPurchaseItem) {
|
|
@@ -9258,7 +9258,7 @@ class PelcroActions {
|
|
|
9258
9258
|
switchToAddressView();
|
|
9259
9259
|
});
|
|
9260
9260
|
|
|
9261
|
-
_defineProperty$
|
|
9261
|
+
_defineProperty$4(this, "setPaymentMethodToEdit", id => {
|
|
9262
9262
|
window.Pelcro.paymentMethods.getPaymentMethod({
|
|
9263
9263
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
9264
9264
|
payment_method_id: id
|
|
@@ -9276,7 +9276,7 @@ class PelcroActions {
|
|
|
9276
9276
|
});
|
|
9277
9277
|
});
|
|
9278
9278
|
|
|
9279
|
-
_defineProperty$
|
|
9279
|
+
_defineProperty$4(this, "setPaymentMethodToDelete", id => {
|
|
9280
9280
|
window.Pelcro.paymentMethods.getPaymentMethod({
|
|
9281
9281
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
9282
9282
|
payment_method_id: id
|
|
@@ -9306,7 +9306,7 @@ class PelcroActions {
|
|
|
9306
9306
|
|
|
9307
9307
|
class PelcroCallbacks {
|
|
9308
9308
|
constructor() {
|
|
9309
|
-
_defineProperty$
|
|
9309
|
+
_defineProperty$4(this, "whenSiteReady", callback => {
|
|
9310
9310
|
var _window$Pelcro$site$r;
|
|
9311
9311
|
|
|
9312
9312
|
if ((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.settings) {
|
|
@@ -9318,7 +9318,7 @@ class PelcroCallbacks {
|
|
|
9318
9318
|
}
|
|
9319
9319
|
});
|
|
9320
9320
|
|
|
9321
|
-
_defineProperty$
|
|
9321
|
+
_defineProperty$4(this, "whenUserReady", (callback, listenerOptions) => {
|
|
9322
9322
|
var _window$Pelcro$user$r;
|
|
9323
9323
|
|
|
9324
9324
|
if ((_window$Pelcro$user$r = window.Pelcro.user.read()) !== null && _window$Pelcro$user$r !== void 0 && _window$Pelcro$user$r.id) {
|
|
@@ -9330,7 +9330,7 @@ class PelcroCallbacks {
|
|
|
9330
9330
|
}
|
|
9331
9331
|
});
|
|
9332
9332
|
|
|
9333
|
-
_defineProperty$
|
|
9333
|
+
_defineProperty$4(this, "whenEcommerceLoaded", callback => {
|
|
9334
9334
|
var _window$Pelcro$ecomme;
|
|
9335
9335
|
|
|
9336
9336
|
if ((_window$Pelcro$ecomme = window.Pelcro.ecommerce.products.read()) !== null && _window$Pelcro$ecomme !== void 0 && _window$Pelcro$ecomme.length) {
|
|
@@ -9533,6 +9533,17 @@ const userHasAddress = () => {
|
|
|
9533
9533
|
const addresses = (_window$Pelcro$user$r2 = (_window$Pelcro$user$r3 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.addresses) !== null && _window$Pelcro$user$r2 !== void 0 ? _window$Pelcro$user$r2 : [];
|
|
9534
9534
|
return addresses.length > 0;
|
|
9535
9535
|
};
|
|
9536
|
+
/** check wether or not the user have any billing addresses
|
|
9537
|
+
* @return {boolean} true if the user have at least one billing address, false otherwise
|
|
9538
|
+
*/
|
|
9539
|
+
|
|
9540
|
+
const userHasBillingAddress = () => {
|
|
9541
|
+
var _window$Pelcro$user$r4, _window$Pelcro$user$r5;
|
|
9542
|
+
|
|
9543
|
+
const addresses = (_window$Pelcro$user$r4 = (_window$Pelcro$user$r5 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.addresses) !== null && _window$Pelcro$user$r4 !== void 0 ? _window$Pelcro$user$r4 : [];
|
|
9544
|
+
const billingAddresses = addresses.filter(address => address.type == "billing");
|
|
9545
|
+
return billingAddresses.length > 0;
|
|
9546
|
+
};
|
|
9536
9547
|
const calcAndFormatItemsTotal = (items, currency) => {
|
|
9537
9548
|
if (!Array.isArray(items)) return;
|
|
9538
9549
|
let totalWithoutDividingBy100 = 0;
|
|
@@ -9573,9 +9584,9 @@ const isValidViewFromURL = viewID => {
|
|
|
9573
9584
|
const queryParamEmail = window.Pelcro.helpers.getURLParameter("email");
|
|
9574
9585
|
|
|
9575
9586
|
if (queryParamEmail && window.Pelcro.user.isAuthenticated()) {
|
|
9576
|
-
var _window$Pelcro$user$
|
|
9587
|
+
var _window$Pelcro$user$r6;
|
|
9577
9588
|
|
|
9578
|
-
if (queryParamEmail !== ((_window$Pelcro$user$
|
|
9589
|
+
if (queryParamEmail !== ((_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.email)) {
|
|
9579
9590
|
console.error("email query parameter and user account email are different, url email query parameter must match user email if user is logged in");
|
|
9580
9591
|
return false;
|
|
9581
9592
|
}
|
|
@@ -9618,7 +9629,7 @@ const disableScroll = () => {
|
|
|
9618
9629
|
}
|
|
9619
9630
|
};
|
|
9620
9631
|
const trackSubscriptionOnGA = () => {
|
|
9621
|
-
var _window, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro$user$
|
|
9632
|
+
var _window, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro$user$r7, _window$Pelcro$user$r8;
|
|
9622
9633
|
|
|
9623
9634
|
const {
|
|
9624
9635
|
product,
|
|
@@ -9640,7 +9651,7 @@ const trackSubscriptionOnGA = () => {
|
|
|
9640
9651
|
return;
|
|
9641
9652
|
}
|
|
9642
9653
|
|
|
9643
|
-
const currencyCode = (_window$Pelcro$user$
|
|
9654
|
+
const currencyCode = (_window$Pelcro$user$r7 = (_window$Pelcro$user$r8 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r8 === void 0 ? void 0 : _window$Pelcro$user$r8.currency) !== null && _window$Pelcro$user$r7 !== void 0 ? _window$Pelcro$user$r7 : plan.currency;
|
|
9644
9655
|
|
|
9645
9656
|
if (enableReactGA4) {
|
|
9646
9657
|
ReactGA4.event("purchase", {
|
|
@@ -9694,9 +9705,9 @@ const trackSubscriptionOnGA = () => {
|
|
|
9694
9705
|
*/
|
|
9695
9706
|
|
|
9696
9707
|
const userHasPaymentMethod = () => {
|
|
9697
|
-
var _window$Pelcro$user$
|
|
9708
|
+
var _window$Pelcro$user$r9, _window$Pelcro$user$r10;
|
|
9698
9709
|
|
|
9699
|
-
const sources = (_window$Pelcro$user$
|
|
9710
|
+
const sources = (_window$Pelcro$user$r9 = (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.sources) !== null && _window$Pelcro$user$r9 !== void 0 ? _window$Pelcro$user$r9 : [];
|
|
9700
9711
|
return sources.length > 0;
|
|
9701
9712
|
};
|
|
9702
9713
|
/**
|
|
@@ -9747,6 +9758,14 @@ const getPaymentCardIcon = name => {
|
|
|
9747
9758
|
}), /*#__PURE__*/React__default.createElement("path", {
|
|
9748
9759
|
fill: "#FFF",
|
|
9749
9760
|
d: "M22.255 20l-2.113 4.683L18.039 20h-2.695v6.726L12.341 20h-2.274L7 26.981h1.815l.671-1.558h3.432l.682 1.558h3.465v-5.185l2.299 5.185h1.563l2.351-5.095v5.095H25V20H22.255zM10.135 23.915l1.026-2.44 1.066 2.44H10.135zM37.883 23.413L41 20.018h-2.217l-1.994 2.164L34.86 20H28v6.982h6.635l2.092-2.311L38.767 27h2.21L37.883 23.413zM33.728 25.516h-4.011v-1.381h3.838v-1.323h-3.838v-1.308l4.234.012 1.693 1.897L33.728 25.516z"
|
|
9761
|
+
})),
|
|
9762
|
+
bacs_debit: /*#__PURE__*/React__default.createElement("svg", {
|
|
9763
|
+
className: "plc-w-12 plc-text-gray-500",
|
|
9764
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9765
|
+
viewBox: "0 0 512 512"
|
|
9766
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
9767
|
+
fill: "currentColor",
|
|
9768
|
+
d: "M243.4 2.6l-224 96c-14 6-21.8 21-18.7 35.8S16.8 160 32 160v8c0 13.3 10.7 24 24 24H456c13.3 0 24-10.7 24-24v-8c15.2 0 28.3-10.7 31.3-25.6s-4.8-29.9-18.7-35.8l-224-96c-8-3.4-17.2-3.4-25.2 0zM128 224H64V420.3c-.6 .3-1.2 .7-1.8 1.1l-48 32c-11.7 7.8-17 22.4-12.9 35.9S17.9 512 32 512H480c14.1 0 26.5-9.2 30.6-22.7s-1.1-28.1-12.9-35.9l-48-32c-.6-.4-1.2-.7-1.8-1.1V224H384V416H344V224H280V416H232V224H168V416H128V224zM256 64a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"
|
|
9750
9769
|
}))
|
|
9751
9770
|
};
|
|
9752
9771
|
return (_icons$name$toLowerCa = icons[name.toLowerCase()]) !== null && _icons$name$toLowerCa !== void 0 ? _icons$name$toLowerCa : /*#__PURE__*/React__default.createElement("svg", {
|
|
@@ -9774,10 +9793,10 @@ function getDateWithoutTime(dateObject) {
|
|
|
9774
9793
|
return date;
|
|
9775
9794
|
}
|
|
9776
9795
|
function userMustVerifyEmail() {
|
|
9777
|
-
var _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro$user$
|
|
9796
|
+
var _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro$user$r11, _window$Pelcro$user$r12;
|
|
9778
9797
|
|
|
9779
9798
|
const isEmailVerificationEnabled = (_window$Pelcro$site$r3 = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.email_verify_enabled) !== null && _window$Pelcro$site$r3 !== void 0 ? _window$Pelcro$site$r3 : false;
|
|
9780
|
-
const isUserEmailVerified = (_window$Pelcro$user$
|
|
9799
|
+
const isUserEmailVerified = (_window$Pelcro$user$r11 = (_window$Pelcro$user$r12 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r12 === void 0 ? void 0 : _window$Pelcro$user$r12.email_confirm) !== null && _window$Pelcro$user$r11 !== void 0 ? _window$Pelcro$user$r11 : false;
|
|
9781
9800
|
return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
|
|
9782
9801
|
}
|
|
9783
9802
|
function notifyBugsnag(callback, startOptions) {
|
|
@@ -9986,13 +10005,13 @@ var _onClick = /*#__PURE__*/new WeakMap();
|
|
|
9986
10005
|
|
|
9987
10006
|
class SaveToMetadataButtonClass {
|
|
9988
10007
|
constructor() {
|
|
9989
|
-
_defineProperty$
|
|
10008
|
+
_defineProperty$4(this, "authenticated", () => {
|
|
9990
10009
|
_classPrivateFieldGet(this, _onClick).call(this, _classPrivateFieldGet(this, _saveToMetadata));
|
|
9991
10010
|
|
|
9992
10011
|
_classPrivateFieldGet(this, _markAllSavedButtons).call(this);
|
|
9993
10012
|
});
|
|
9994
10013
|
|
|
9995
|
-
_defineProperty$
|
|
10014
|
+
_defineProperty$4(this, "unauthenticated", () => {
|
|
9996
10015
|
const {
|
|
9997
10016
|
switchView
|
|
9998
10017
|
} = usePelcro.getStore();
|
|
@@ -11086,6 +11105,9 @@ const Notification = ({
|
|
|
11086
11105
|
}) => {
|
|
11087
11106
|
return /*#__PURE__*/React__default.createElement(Toaster, Object.assign({
|
|
11088
11107
|
containerClassName: "pelcro-notification-container",
|
|
11108
|
+
containerStyle: {
|
|
11109
|
+
zIndex: 9999999
|
|
11110
|
+
},
|
|
11089
11111
|
toastOptions: {
|
|
11090
11112
|
success: {
|
|
11091
11113
|
className: "pelcro-notification-success",
|
|
@@ -11169,10 +11191,10 @@ toast.confirm = (onConfirm, {
|
|
|
11169
11191
|
className: "plc-space-y-2 sm:plc-space-y-0 sm:plc-space-x-2"
|
|
11170
11192
|
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
11171
11193
|
variant: "solid",
|
|
11172
|
-
className: "plc-text-xs plc-bg-red-500 hover:plc-bg-red-600",
|
|
11194
|
+
className: "plc-text-xs plc-bg-red-500 hover:plc-bg-red-600 plc-min-h-0",
|
|
11173
11195
|
onClick: onConfirmClick
|
|
11174
11196
|
}, confirmButtonLabel !== null && confirmButtonLabel !== void 0 ? confirmButtonLabel : translations.labels.confirm), /*#__PURE__*/React__default.createElement(Button, {
|
|
11175
|
-
className: "plc-text-xs",
|
|
11197
|
+
className: "plc-text-xs plc-min-h-0",
|
|
11176
11198
|
variant: "outline",
|
|
11177
11199
|
onClick: () => toast.dismiss(t.id)
|
|
11178
11200
|
}, closeButtonLabel !== null && closeButtonLabel !== void 0 ? closeButtonLabel : translations.labels.close))), {
|
|
@@ -11659,175 +11681,6 @@ function shouldBlurContent(entitlements) {
|
|
|
11659
11681
|
return entitlements.every(entitlement => !window.Pelcro.user.isEntitledTo(entitlement));
|
|
11660
11682
|
}
|
|
11661
11683
|
|
|
11662
|
-
var pure$1 = createCommonjsModule(function (module, exports) {
|
|
11663
|
-
|
|
11664
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11665
|
-
|
|
11666
|
-
function _typeof(obj) {
|
|
11667
|
-
"@babel/helpers - typeof";
|
|
11668
|
-
|
|
11669
|
-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
11670
|
-
_typeof = function (obj) {
|
|
11671
|
-
return typeof obj;
|
|
11672
|
-
};
|
|
11673
|
-
} else {
|
|
11674
|
-
_typeof = function (obj) {
|
|
11675
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
11676
|
-
};
|
|
11677
|
-
}
|
|
11678
|
-
|
|
11679
|
-
return _typeof(obj);
|
|
11680
|
-
}
|
|
11681
|
-
|
|
11682
|
-
var V3_URL = 'https://js.stripe.com/v3';
|
|
11683
|
-
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
11684
|
-
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';
|
|
11685
|
-
var findScript = function findScript() {
|
|
11686
|
-
var scripts = document.querySelectorAll("script[src^=\"".concat(V3_URL, "\"]"));
|
|
11687
|
-
|
|
11688
|
-
for (var i = 0; i < scripts.length; i++) {
|
|
11689
|
-
var script = scripts[i];
|
|
11690
|
-
|
|
11691
|
-
if (!V3_URL_REGEX.test(script.src)) {
|
|
11692
|
-
continue;
|
|
11693
|
-
}
|
|
11694
|
-
|
|
11695
|
-
return script;
|
|
11696
|
-
}
|
|
11697
|
-
|
|
11698
|
-
return null;
|
|
11699
|
-
};
|
|
11700
|
-
|
|
11701
|
-
var injectScript = function injectScript(params) {
|
|
11702
|
-
var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';
|
|
11703
|
-
var script = document.createElement('script');
|
|
11704
|
-
script.src = "".concat(V3_URL).concat(queryString);
|
|
11705
|
-
var headOrBody = document.head || document.body;
|
|
11706
|
-
|
|
11707
|
-
if (!headOrBody) {
|
|
11708
|
-
throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');
|
|
11709
|
-
}
|
|
11710
|
-
|
|
11711
|
-
headOrBody.appendChild(script);
|
|
11712
|
-
return script;
|
|
11713
|
-
};
|
|
11714
|
-
|
|
11715
|
-
var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
11716
|
-
if (!stripe || !stripe._registerWrapper) {
|
|
11717
|
-
return;
|
|
11718
|
-
}
|
|
11719
|
-
|
|
11720
|
-
stripe._registerWrapper({
|
|
11721
|
-
name: 'stripe-js',
|
|
11722
|
-
version: "1.21.1",
|
|
11723
|
-
startTime: startTime
|
|
11724
|
-
});
|
|
11725
|
-
};
|
|
11726
|
-
|
|
11727
|
-
var stripePromise = null;
|
|
11728
|
-
var loadScript = function loadScript(params) {
|
|
11729
|
-
// Ensure that we only attempt to load Stripe.js at most once
|
|
11730
|
-
if (stripePromise !== null) {
|
|
11731
|
-
return stripePromise;
|
|
11732
|
-
}
|
|
11733
|
-
|
|
11734
|
-
stripePromise = new Promise(function (resolve, reject) {
|
|
11735
|
-
if (typeof window === 'undefined') {
|
|
11736
|
-
// Resolve to null when imported server side. This makes the module
|
|
11737
|
-
// safe to import in an isomorphic code base.
|
|
11738
|
-
resolve(null);
|
|
11739
|
-
return;
|
|
11740
|
-
}
|
|
11741
|
-
|
|
11742
|
-
if (window.Stripe && params) {
|
|
11743
|
-
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
11744
|
-
}
|
|
11745
|
-
|
|
11746
|
-
if (window.Stripe) {
|
|
11747
|
-
resolve(window.Stripe);
|
|
11748
|
-
return;
|
|
11749
|
-
}
|
|
11750
|
-
|
|
11751
|
-
try {
|
|
11752
|
-
var script = findScript();
|
|
11753
|
-
|
|
11754
|
-
if (script && params) {
|
|
11755
|
-
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
11756
|
-
} else if (!script) {
|
|
11757
|
-
script = injectScript(params);
|
|
11758
|
-
}
|
|
11759
|
-
|
|
11760
|
-
script.addEventListener('load', function () {
|
|
11761
|
-
if (window.Stripe) {
|
|
11762
|
-
resolve(window.Stripe);
|
|
11763
|
-
} else {
|
|
11764
|
-
reject(new Error('Stripe.js not available'));
|
|
11765
|
-
}
|
|
11766
|
-
});
|
|
11767
|
-
script.addEventListener('error', function () {
|
|
11768
|
-
reject(new Error('Failed to load Stripe.js'));
|
|
11769
|
-
});
|
|
11770
|
-
} catch (error) {
|
|
11771
|
-
reject(error);
|
|
11772
|
-
return;
|
|
11773
|
-
}
|
|
11774
|
-
});
|
|
11775
|
-
return stripePromise;
|
|
11776
|
-
};
|
|
11777
|
-
var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
11778
|
-
if (maybeStripe === null) {
|
|
11779
|
-
return null;
|
|
11780
|
-
}
|
|
11781
|
-
|
|
11782
|
-
var stripe = maybeStripe.apply(undefined, args);
|
|
11783
|
-
registerWrapper(stripe, startTime);
|
|
11784
|
-
return stripe;
|
|
11785
|
-
};
|
|
11786
|
-
var validateLoadParams = function validateLoadParams(params) {
|
|
11787
|
-
var errorMessage = "invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(params), "\n");
|
|
11788
|
-
|
|
11789
|
-
if (params === null || _typeof(params) !== 'object') {
|
|
11790
|
-
throw new Error(errorMessage);
|
|
11791
|
-
}
|
|
11792
|
-
|
|
11793
|
-
if (Object.keys(params).length === 1 && typeof params.advancedFraudSignals === 'boolean') {
|
|
11794
|
-
return params;
|
|
11795
|
-
}
|
|
11796
|
-
|
|
11797
|
-
throw new Error(errorMessage);
|
|
11798
|
-
};
|
|
11799
|
-
|
|
11800
|
-
var loadParams;
|
|
11801
|
-
var loadStripeCalled = false;
|
|
11802
|
-
var loadStripe = function loadStripe() {
|
|
11803
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11804
|
-
args[_key] = arguments[_key];
|
|
11805
|
-
}
|
|
11806
|
-
|
|
11807
|
-
loadStripeCalled = true;
|
|
11808
|
-
var startTime = Date.now();
|
|
11809
|
-
return loadScript(loadParams).then(function (maybeStripe) {
|
|
11810
|
-
return initStripe(maybeStripe, args, startTime);
|
|
11811
|
-
});
|
|
11812
|
-
};
|
|
11813
|
-
|
|
11814
|
-
loadStripe.setLoadParameters = function (params) {
|
|
11815
|
-
if (loadStripeCalled) {
|
|
11816
|
-
throw new Error('You cannot change load parameters after calling loadStripe');
|
|
11817
|
-
}
|
|
11818
|
-
|
|
11819
|
-
loadParams = validateLoadParams(params);
|
|
11820
|
-
};
|
|
11821
|
-
|
|
11822
|
-
exports.loadStripe = loadStripe;
|
|
11823
|
-
});
|
|
11824
|
-
|
|
11825
|
-
unwrapExports(pure$1);
|
|
11826
|
-
pure$1.loadStripe;
|
|
11827
|
-
|
|
11828
|
-
var pure = pure$1;
|
|
11829
|
-
var pure_1 = pure.loadStripe;
|
|
11830
|
-
|
|
11831
11684
|
/**
|
|
11832
11685
|
* Extracts error message from the response error object
|
|
11833
11686
|
* @param {Object} error Error object
|
|
@@ -12006,16 +11859,14 @@ const initPaywalls = () => {
|
|
|
12006
11859
|
};
|
|
12007
11860
|
const loadPaymentSDKs = () => {
|
|
12008
11861
|
// Lazy load stripe's SDK
|
|
12009
|
-
const {
|
|
12010
|
-
whenUserReady
|
|
12011
|
-
} = usePelcro.getStore();
|
|
11862
|
+
// const { whenUserReady } = usePelcro.getStore();
|
|
12012
11863
|
const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
|
|
12013
|
-
const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
|
|
12017
|
-
|
|
12018
|
-
|
|
11864
|
+
const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings); // whenUserReady(() => {
|
|
11865
|
+
// if (!window.Stripe && !supportsVantiv && !supportsTap) {
|
|
11866
|
+
// loadStripe(window.Pelcro.environment.stripe);
|
|
11867
|
+
// }
|
|
11868
|
+
// });
|
|
11869
|
+
|
|
12019
11870
|
window.Pelcro.helpers.loadSDK("https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js", "apple-pay-sdk"); // Load PayPal SDKs
|
|
12020
11871
|
|
|
12021
11872
|
const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
|
|
@@ -19894,7 +19745,7 @@ class SelectModal extends Component {
|
|
|
19894
19745
|
|
|
19895
19746
|
super(props);
|
|
19896
19747
|
|
|
19897
|
-
_defineProperty$
|
|
19748
|
+
_defineProperty$4(this, "componentDidMount", () => {
|
|
19898
19749
|
if (this.props.product) {
|
|
19899
19750
|
const {
|
|
19900
19751
|
product
|
|
@@ -19979,15 +19830,15 @@ class SelectModal extends Component {
|
|
|
19979
19830
|
}
|
|
19980
19831
|
});
|
|
19981
19832
|
|
|
19982
|
-
_defineProperty$
|
|
19833
|
+
_defineProperty$4(this, "componentWillUnmount", () => {
|
|
19983
19834
|
document.removeEventListener("keydown", this.handleSubmit);
|
|
19984
19835
|
});
|
|
19985
19836
|
|
|
19986
|
-
_defineProperty$
|
|
19837
|
+
_defineProperty$4(this, "handleSubmit", e => {
|
|
19987
19838
|
if (e.key === "Enter" && !this.state.disabled) this.submitOption();
|
|
19988
19839
|
});
|
|
19989
19840
|
|
|
19990
|
-
_defineProperty$
|
|
19841
|
+
_defineProperty$4(this, "onProductChange", e => {
|
|
19991
19842
|
const product = window.Pelcro.product.list()[e.target.selectedIndex];
|
|
19992
19843
|
this.setState({
|
|
19993
19844
|
product: product,
|
|
@@ -19995,19 +19846,19 @@ class SelectModal extends Component {
|
|
|
19995
19846
|
});
|
|
19996
19847
|
});
|
|
19997
19848
|
|
|
19998
|
-
_defineProperty$
|
|
19849
|
+
_defineProperty$4(this, "onPlanChange", e => {
|
|
19999
19850
|
this.setState({
|
|
20000
19851
|
plan: this.state.product.plans[e.target.selectedIndex]
|
|
20001
19852
|
});
|
|
20002
19853
|
});
|
|
20003
19854
|
|
|
20004
|
-
_defineProperty$
|
|
19855
|
+
_defineProperty$4(this, "onIsGiftChange", e => {
|
|
20005
19856
|
this.setState({
|
|
20006
19857
|
isGift: e.target.checked
|
|
20007
19858
|
});
|
|
20008
19859
|
});
|
|
20009
19860
|
|
|
20010
|
-
_defineProperty$
|
|
19861
|
+
_defineProperty$4(this, "countStartPrice", arr => {
|
|
20011
19862
|
let startingPlan = arr[0];
|
|
20012
19863
|
|
|
20013
19864
|
for (const plan of arr) {
|
|
@@ -20025,7 +19876,7 @@ class SelectModal extends Component {
|
|
|
20025
19876
|
}, "/", " ", startingPlan.interval_count > 1 ? `${startingPlan.interval_count} ${startingPlan.interval_translated}` : `${startingPlan.interval_translated}`));
|
|
20026
19877
|
});
|
|
20027
19878
|
|
|
20028
|
-
_defineProperty$
|
|
19879
|
+
_defineProperty$4(this, "renderOneProduct", (product, index, options) => {
|
|
20029
19880
|
var _product$description, _product$description2;
|
|
20030
19881
|
|
|
20031
19882
|
const isPlanMode = Boolean(this.state.mode === "plan");
|
|
@@ -20091,7 +19942,7 @@ class SelectModal extends Component {
|
|
|
20091
19942
|
}, productButtonLabel)));
|
|
20092
19943
|
});
|
|
20093
19944
|
|
|
20094
|
-
_defineProperty$
|
|
19945
|
+
_defineProperty$4(this, "renderProducts", () => {
|
|
20095
19946
|
const isPlanMode = Boolean(this.state.mode === "plan");
|
|
20096
19947
|
|
|
20097
19948
|
if (isPlanMode) {
|
|
@@ -20107,21 +19958,21 @@ class SelectModal extends Component {
|
|
|
20107
19958
|
}, items);
|
|
20108
19959
|
});
|
|
20109
19960
|
|
|
20110
|
-
_defineProperty$
|
|
19961
|
+
_defineProperty$4(this, "handleScrollLeft", () => {
|
|
20111
19962
|
this.productsTabRef.current.scrollLeft -= 100; // Adjust the scroll value as needed
|
|
20112
19963
|
});
|
|
20113
19964
|
|
|
20114
|
-
_defineProperty$
|
|
19965
|
+
_defineProperty$4(this, "handleScrollRight", () => {
|
|
20115
19966
|
this.productsTabRef.current.scrollLeft += 100; // Adjust the scroll value as needed
|
|
20116
19967
|
});
|
|
20117
19968
|
|
|
20118
|
-
_defineProperty$
|
|
19969
|
+
_defineProperty$4(this, "toggleProdDescExpanded", () => {
|
|
20119
19970
|
this.setState({
|
|
20120
19971
|
prodDescExpanded: !this.state.prodDescExpanded
|
|
20121
19972
|
});
|
|
20122
19973
|
});
|
|
20123
19974
|
|
|
20124
|
-
_defineProperty$
|
|
19975
|
+
_defineProperty$4(this, "renderProductTabs", () => {
|
|
20125
19976
|
const {
|
|
20126
19977
|
prodDescExpanded
|
|
20127
19978
|
} = this.state;
|
|
@@ -20178,7 +20029,7 @@ class SelectModal extends Component {
|
|
|
20178
20029
|
}, "Read more"))))));
|
|
20179
20030
|
});
|
|
20180
20031
|
|
|
20181
|
-
_defineProperty$
|
|
20032
|
+
_defineProperty$4(this, "renderMatchingProductsFirst", () => {
|
|
20182
20033
|
const isPlanMode = Boolean(this.state.mode === "plan");
|
|
20183
20034
|
|
|
20184
20035
|
if (isPlanMode) {
|
|
@@ -20202,7 +20053,7 @@ class SelectModal extends Component {
|
|
|
20202
20053
|
}, this.locale("labels.restrictiveArticles.or")), allProductsMinusMatched.map((product, index) => this.renderOneProduct(product, index))));
|
|
20203
20054
|
});
|
|
20204
20055
|
|
|
20205
|
-
_defineProperty$
|
|
20056
|
+
_defineProperty$4(this, "renderPlans", () => {
|
|
20206
20057
|
const {
|
|
20207
20058
|
disableGifting
|
|
20208
20059
|
} = this.props;
|
|
@@ -20252,7 +20103,7 @@ class SelectModal extends Component {
|
|
|
20252
20103
|
}, items);
|
|
20253
20104
|
});
|
|
20254
20105
|
|
|
20255
|
-
_defineProperty$
|
|
20106
|
+
_defineProperty$4(this, "selectProduct", e => {
|
|
20256
20107
|
const id = e.target.dataset.key;
|
|
20257
20108
|
|
|
20258
20109
|
for (const product of this.state.productList) {
|
|
@@ -20279,7 +20130,7 @@ class SelectModal extends Component {
|
|
|
20279
20130
|
}
|
|
20280
20131
|
});
|
|
20281
20132
|
|
|
20282
|
-
_defineProperty$
|
|
20133
|
+
_defineProperty$4(this, "selectPlan", (e, isGift) => {
|
|
20283
20134
|
const id = e.target.dataset.key;
|
|
20284
20135
|
|
|
20285
20136
|
for (const plan of this.state.planList) {
|
|
@@ -20294,7 +20145,7 @@ class SelectModal extends Component {
|
|
|
20294
20145
|
}
|
|
20295
20146
|
});
|
|
20296
20147
|
|
|
20297
|
-
_defineProperty$
|
|
20148
|
+
_defineProperty$4(this, "goBack", () => {
|
|
20298
20149
|
this.setState({
|
|
20299
20150
|
disabled: true,
|
|
20300
20151
|
mode: "product",
|
|
@@ -20302,7 +20153,7 @@ class SelectModal extends Component {
|
|
|
20302
20153
|
});
|
|
20303
20154
|
});
|
|
20304
20155
|
|
|
20305
|
-
_defineProperty$
|
|
20156
|
+
_defineProperty$4(this, "submitOption", (product, isGift) => {
|
|
20306
20157
|
const {
|
|
20307
20158
|
setView
|
|
20308
20159
|
} = this.props;
|
|
@@ -20327,7 +20178,7 @@ class SelectModal extends Component {
|
|
|
20327
20178
|
return switchToPaymentView();
|
|
20328
20179
|
});
|
|
20329
20180
|
|
|
20330
|
-
_defineProperty$
|
|
20181
|
+
_defineProperty$4(this, "displayLoginView", () => {
|
|
20331
20182
|
this.props.setView("login");
|
|
20332
20183
|
});
|
|
20333
20184
|
|
|
@@ -20413,1143 +20264,975 @@ class SelectModal extends Component {
|
|
|
20413
20264
|
|
|
20414
20265
|
const SelectModalWithTrans = withTranslation("select")(SelectModal);
|
|
20415
20266
|
|
|
20416
|
-
|
|
20417
|
-
|
|
20418
|
-
Object.defineProperty(exports, "__esModule", {
|
|
20419
|
-
value: true
|
|
20420
|
-
});
|
|
20421
|
-
exports.providerContextTypes = undefined;
|
|
20422
|
-
|
|
20267
|
+
function ownKeys(object, enumerableOnly) {
|
|
20268
|
+
var keys = Object.keys(object);
|
|
20423
20269
|
|
|
20270
|
+
if (Object.getOwnPropertySymbols) {
|
|
20271
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
20424
20272
|
|
|
20425
|
-
|
|
20426
|
-
|
|
20427
|
-
|
|
20428
|
-
|
|
20429
|
-
|
|
20430
|
-
|
|
20431
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20273
|
+
if (enumerableOnly) {
|
|
20274
|
+
symbols = symbols.filter(function (sym) {
|
|
20275
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
20276
|
+
});
|
|
20277
|
+
}
|
|
20432
20278
|
|
|
20433
|
-
|
|
20279
|
+
keys.push.apply(keys, symbols);
|
|
20280
|
+
}
|
|
20434
20281
|
|
|
20435
|
-
|
|
20282
|
+
return keys;
|
|
20283
|
+
}
|
|
20436
20284
|
|
|
20437
|
-
function
|
|
20285
|
+
function _objectSpread2(target) {
|
|
20286
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
20287
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
20438
20288
|
|
|
20439
|
-
|
|
20289
|
+
if (i % 2) {
|
|
20290
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
20291
|
+
_defineProperty(target, key, source[key]);
|
|
20292
|
+
});
|
|
20293
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
20294
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
20295
|
+
} else {
|
|
20296
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
20297
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
20298
|
+
});
|
|
20299
|
+
}
|
|
20300
|
+
}
|
|
20440
20301
|
|
|
20441
|
-
|
|
20442
|
-
|
|
20443
|
-
var providerContextTypes = exports.providerContextTypes = {
|
|
20444
|
-
tag: _propTypes2.default.string.isRequired,
|
|
20445
|
-
stripe: _propTypes2.default.object,
|
|
20446
|
-
addStripeLoadListener: _propTypes2.default.func
|
|
20447
|
-
};
|
|
20302
|
+
return target;
|
|
20303
|
+
}
|
|
20448
20304
|
|
|
20449
|
-
|
|
20450
|
-
|
|
20451
|
-
* Note that this is not meant to be a generic memoization solution.
|
|
20452
|
-
* This is specifically a solution for `StripeProvider`s being initialized
|
|
20453
|
-
* and destroyed regularly (with the same set of props) when users only
|
|
20454
|
-
* use `StripeProvider` for the subtree that contains their checkout form.
|
|
20455
|
-
*/
|
|
20456
|
-
window.Stripe.__cachedInstances = window.Stripe.__cachedInstances || {};
|
|
20457
|
-
var cacheKey = 'key=' + apiKey + ' options=' + JSON.stringify(options);
|
|
20305
|
+
function _typeof(obj) {
|
|
20306
|
+
"@babel/helpers - typeof";
|
|
20458
20307
|
|
|
20459
|
-
|
|
20460
|
-
|
|
20308
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
20309
|
+
_typeof = function (obj) {
|
|
20310
|
+
return typeof obj;
|
|
20311
|
+
};
|
|
20312
|
+
} else {
|
|
20313
|
+
_typeof = function (obj) {
|
|
20314
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
20315
|
+
};
|
|
20316
|
+
}
|
|
20461
20317
|
|
|
20462
|
-
return
|
|
20463
|
-
}
|
|
20318
|
+
return _typeof(obj);
|
|
20319
|
+
}
|
|
20464
20320
|
|
|
20465
|
-
|
|
20466
|
-
if (
|
|
20467
|
-
|
|
20321
|
+
function _defineProperty(obj, key, value) {
|
|
20322
|
+
if (key in obj) {
|
|
20323
|
+
Object.defineProperty(obj, key, {
|
|
20324
|
+
value: value,
|
|
20325
|
+
enumerable: true,
|
|
20326
|
+
configurable: true,
|
|
20327
|
+
writable: true
|
|
20328
|
+
});
|
|
20468
20329
|
} else {
|
|
20469
|
-
|
|
20330
|
+
obj[key] = value;
|
|
20470
20331
|
}
|
|
20471
|
-
};
|
|
20472
20332
|
|
|
20473
|
-
|
|
20474
|
-
|
|
20333
|
+
return obj;
|
|
20334
|
+
}
|
|
20475
20335
|
|
|
20476
|
-
|
|
20477
|
-
|
|
20478
|
-
|
|
20336
|
+
function _slicedToArray(arr, i) {
|
|
20337
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest();
|
|
20338
|
+
}
|
|
20479
20339
|
|
|
20480
|
-
|
|
20340
|
+
function _arrayWithHoles(arr) {
|
|
20341
|
+
if (Array.isArray(arr)) return arr;
|
|
20342
|
+
}
|
|
20481
20343
|
|
|
20482
|
-
|
|
20483
|
-
|
|
20484
|
-
} else if (_this.props.apiKey) {
|
|
20485
|
-
if (!window.Stripe) {
|
|
20486
|
-
throw new Error("Please load Stripe.js (https://js.stripe.com/v3/) on this page to use react-stripe-elements. If Stripe.js isn't available yet (it's loading asynchronously, or you're using server-side rendering), see https://github.com/stripe/react-stripe-elements#advanced-integrations");
|
|
20487
|
-
} else {
|
|
20488
|
-
var _this$props = _this.props,
|
|
20489
|
-
_apiKey = _this$props.apiKey;
|
|
20490
|
-
_this$props.children;
|
|
20491
|
-
var options = _objectWithoutProperties(_this$props, ['apiKey', 'children']);
|
|
20492
|
-
|
|
20493
|
-
var _stripe = getOrCreateStripe(_apiKey, options);
|
|
20494
|
-
_this._meta = { tag: 'sync', stripe: _stripe };
|
|
20495
|
-
_this._register();
|
|
20496
|
-
}
|
|
20497
|
-
} else if (_this.props.stripe) {
|
|
20498
|
-
// If we already have a stripe instance (in the constructor), we can behave synchronously.
|
|
20499
|
-
var _stripe2 = ensureStripeShape(_this.props.stripe);
|
|
20500
|
-
_this._meta = { tag: 'sync', stripe: _stripe2 };
|
|
20501
|
-
_this._register();
|
|
20502
|
-
} else if (_this.props.stripe === null) {
|
|
20503
|
-
_this._meta = {
|
|
20504
|
-
tag: 'async',
|
|
20505
|
-
stripe: null
|
|
20506
|
-
};
|
|
20507
|
-
} else {
|
|
20508
|
-
throw new Error("Please pass either 'apiKey' or 'stripe' to StripeProvider. If you're using 'stripe' but don't have a Stripe instance yet, pass 'null' explicitly.");
|
|
20509
|
-
}
|
|
20344
|
+
function _iterableToArrayLimit(arr, i) {
|
|
20345
|
+
var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]);
|
|
20510
20346
|
|
|
20511
|
-
|
|
20512
|
-
|
|
20513
|
-
|
|
20514
|
-
|
|
20515
|
-
}
|
|
20516
|
-
// Even though we're using flow, also use PropTypes so we can take advantage of developer warnings.
|
|
20347
|
+
if (_i == null) return;
|
|
20348
|
+
var _arr = [];
|
|
20349
|
+
var _n = true;
|
|
20350
|
+
var _d = false;
|
|
20517
20351
|
|
|
20352
|
+
var _s, _e;
|
|
20518
20353
|
|
|
20519
|
-
|
|
20520
|
-
|
|
20354
|
+
try {
|
|
20355
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
20356
|
+
_arr.push(_s.value);
|
|
20521
20357
|
|
|
20522
|
-
|
|
20523
|
-
// the initial state.
|
|
20524
|
-
//
|
|
20525
|
-
// However, context doesn't update in respnse to state changes like you
|
|
20526
|
-
// might expect: context is pulled by the child, not pushed by the parent.
|
|
20527
|
-
if (this._meta.tag === 'sync') {
|
|
20528
|
-
return {
|
|
20529
|
-
tag: 'sync',
|
|
20530
|
-
stripe: this._meta.stripe
|
|
20531
|
-
};
|
|
20532
|
-
} else {
|
|
20533
|
-
return {
|
|
20534
|
-
tag: 'async',
|
|
20535
|
-
addStripeLoadListener: function addStripeLoadListener(fn) {
|
|
20536
|
-
if (_this2._meta.stripe) {
|
|
20537
|
-
fn(_this2._meta.stripe);
|
|
20538
|
-
} else {
|
|
20539
|
-
_this2._listeners.push(fn);
|
|
20540
|
-
}
|
|
20541
|
-
}
|
|
20542
|
-
};
|
|
20358
|
+
if (i && _arr.length === i) break;
|
|
20543
20359
|
}
|
|
20544
|
-
}
|
|
20545
|
-
|
|
20546
|
-
|
|
20547
|
-
|
|
20548
|
-
|
|
20549
|
-
|
|
20550
|
-
|
|
20551
|
-
|
|
20552
|
-
// eslint-disable-next-line no-console
|
|
20553
|
-
console.error('StripeProvider does not support changing the apiKey parameter.');
|
|
20554
|
-
return;
|
|
20360
|
+
} catch (err) {
|
|
20361
|
+
_d = true;
|
|
20362
|
+
_e = err;
|
|
20363
|
+
} finally {
|
|
20364
|
+
try {
|
|
20365
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
20366
|
+
} finally {
|
|
20367
|
+
if (_d) throw _e;
|
|
20555
20368
|
}
|
|
20369
|
+
}
|
|
20556
20370
|
|
|
20557
|
-
|
|
20558
|
-
|
|
20559
|
-
this._didWakeUpListeners = true;
|
|
20560
|
-
var _stripe3 = ensureStripeShape(this.props.stripe);
|
|
20561
|
-
this._meta.stripe = _stripe3;
|
|
20562
|
-
this._register();
|
|
20563
|
-
this._listeners.forEach(function (fn) {
|
|
20564
|
-
fn(_stripe3);
|
|
20565
|
-
});
|
|
20566
|
-
}
|
|
20567
|
-
};
|
|
20371
|
+
return _arr;
|
|
20372
|
+
}
|
|
20568
20373
|
|
|
20569
|
-
|
|
20570
|
-
|
|
20374
|
+
function _unsupportedIterableToArray$1(o, minLen) {
|
|
20375
|
+
if (!o) return;
|
|
20376
|
+
if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
|
|
20377
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
20378
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
20379
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
20380
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
|
|
20381
|
+
}
|
|
20571
20382
|
|
|
20383
|
+
function _arrayLikeToArray$1(arr, len) {
|
|
20384
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
20572
20385
|
|
|
20573
|
-
|
|
20574
|
-
return;
|
|
20575
|
-
}
|
|
20386
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
20576
20387
|
|
|
20577
|
-
|
|
20578
|
-
|
|
20579
|
-
version: '6.1.2'
|
|
20580
|
-
});
|
|
20581
|
-
};
|
|
20388
|
+
return arr2;
|
|
20389
|
+
}
|
|
20582
20390
|
|
|
20583
|
-
|
|
20584
|
-
|
|
20585
|
-
|
|
20391
|
+
function _nonIterableRest() {
|
|
20392
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
20393
|
+
}
|
|
20586
20394
|
|
|
20587
|
-
|
|
20588
|
-
|
|
20395
|
+
var usePrevious = function usePrevious(value) {
|
|
20396
|
+
var ref = React__default.useRef(value);
|
|
20397
|
+
React__default.useEffect(function () {
|
|
20398
|
+
ref.current = value;
|
|
20399
|
+
}, [value]);
|
|
20400
|
+
return ref.current;
|
|
20401
|
+
};
|
|
20589
20402
|
|
|
20590
|
-
|
|
20591
|
-
|
|
20592
|
-
// PropTypes.object is the only way we can accept a Stripe instance
|
|
20593
|
-
// eslint-disable-next-line react/forbid-prop-types
|
|
20594
|
-
stripe: _propTypes2.default.object,
|
|
20595
|
-
children: _propTypes2.default.node
|
|
20403
|
+
var isUnknownObject = function isUnknownObject(raw) {
|
|
20404
|
+
return raw !== null && _typeof(raw) === 'object';
|
|
20596
20405
|
};
|
|
20597
|
-
|
|
20598
|
-
|
|
20599
|
-
|
|
20600
|
-
|
|
20601
|
-
|
|
20406
|
+
var isPromise = function isPromise(raw) {
|
|
20407
|
+
return isUnknownObject(raw) && typeof raw.then === 'function';
|
|
20408
|
+
}; // We are using types to enforce the `stripe` prop in this lib,
|
|
20409
|
+
// but in an untyped integration `stripe` could be anything, so we need
|
|
20410
|
+
// to do some sanity validation to prevent type errors.
|
|
20411
|
+
|
|
20412
|
+
var isStripe = function isStripe(raw) {
|
|
20413
|
+
return isUnknownObject(raw) && typeof raw.elements === 'function' && typeof raw.createToken === 'function' && typeof raw.createPaymentMethod === 'function' && typeof raw.confirmCardPayment === 'function';
|
|
20602
20414
|
};
|
|
20603
|
-
exports.default = Provider;
|
|
20604
|
-
});
|
|
20605
20415
|
|
|
20606
|
-
|
|
20607
|
-
|
|
20416
|
+
var PLAIN_OBJECT_STR = '[object Object]';
|
|
20417
|
+
var isEqual = function isEqual(left, right) {
|
|
20418
|
+
if (!isUnknownObject(left) || !isUnknownObject(right)) {
|
|
20419
|
+
return left === right;
|
|
20420
|
+
}
|
|
20608
20421
|
|
|
20609
|
-
var
|
|
20422
|
+
var leftArray = Array.isArray(left);
|
|
20423
|
+
var rightArray = Array.isArray(right);
|
|
20424
|
+
if (leftArray !== rightArray) return false;
|
|
20425
|
+
var leftPlainObject = Object.prototype.toString.call(left) === PLAIN_OBJECT_STR;
|
|
20426
|
+
var rightPlainObject = Object.prototype.toString.call(right) === PLAIN_OBJECT_STR;
|
|
20427
|
+
if (leftPlainObject !== rightPlainObject) return false; // not sure what sort of special object this is (regexp is one option), so
|
|
20428
|
+
// fallback to reference check.
|
|
20610
20429
|
|
|
20611
|
-
|
|
20612
|
-
|
|
20613
|
-
|
|
20614
|
-
|
|
20430
|
+
if (!leftPlainObject && !leftArray) return left === right;
|
|
20431
|
+
var leftKeys = Object.keys(left);
|
|
20432
|
+
var rightKeys = Object.keys(right);
|
|
20433
|
+
if (leftKeys.length !== rightKeys.length) return false;
|
|
20434
|
+
var keySet = {};
|
|
20615
20435
|
|
|
20616
|
-
|
|
20436
|
+
for (var i = 0; i < leftKeys.length; i += 1) {
|
|
20437
|
+
keySet[leftKeys[i]] = true;
|
|
20438
|
+
}
|
|
20617
20439
|
|
|
20440
|
+
for (var _i = 0; _i < rightKeys.length; _i += 1) {
|
|
20441
|
+
keySet[rightKeys[_i]] = true;
|
|
20442
|
+
}
|
|
20618
20443
|
|
|
20444
|
+
var allKeys = Object.keys(keySet);
|
|
20619
20445
|
|
|
20620
|
-
|
|
20446
|
+
if (allKeys.length !== leftKeys.length) {
|
|
20447
|
+
return false;
|
|
20448
|
+
}
|
|
20621
20449
|
|
|
20450
|
+
var l = left;
|
|
20451
|
+
var r = right;
|
|
20622
20452
|
|
|
20453
|
+
var pred = function pred(key) {
|
|
20454
|
+
return isEqual(l[key], r[key]);
|
|
20455
|
+
};
|
|
20623
20456
|
|
|
20624
|
-
|
|
20457
|
+
return allKeys.every(pred);
|
|
20458
|
+
};
|
|
20625
20459
|
|
|
20460
|
+
var extractAllowedOptionsUpdates = function extractAllowedOptionsUpdates(options, prevOptions, immutableKeys) {
|
|
20461
|
+
if (!isUnknownObject(options)) {
|
|
20462
|
+
return null;
|
|
20463
|
+
}
|
|
20626
20464
|
|
|
20465
|
+
return Object.keys(options).reduce(function (newOptions, key) {
|
|
20466
|
+
var isUpdated = !isUnknownObject(prevOptions) || !isEqual(options[key], prevOptions[key]);
|
|
20627
20467
|
|
|
20628
|
-
|
|
20468
|
+
if (immutableKeys.includes(key)) {
|
|
20469
|
+
if (isUpdated) {
|
|
20470
|
+
console.warn("Unsupported prop change: options.".concat(key, " is not a mutable property."));
|
|
20471
|
+
}
|
|
20629
20472
|
|
|
20630
|
-
|
|
20473
|
+
return newOptions;
|
|
20474
|
+
}
|
|
20631
20475
|
|
|
20632
|
-
|
|
20476
|
+
if (!isUpdated) {
|
|
20477
|
+
return newOptions;
|
|
20478
|
+
}
|
|
20633
20479
|
|
|
20634
|
-
|
|
20480
|
+
return _objectSpread2(_objectSpread2({}, newOptions || {}), {}, _defineProperty({}, key, options[key]));
|
|
20481
|
+
}, null);
|
|
20482
|
+
};
|
|
20635
20483
|
|
|
20636
|
-
|
|
20484
|
+
var INVALID_STRIPE_ERROR = '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.'; // We are using types to enforce the `stripe` prop in this lib, but in a real
|
|
20485
|
+
// integration `stripe` could be anything, so we need to do some sanity
|
|
20486
|
+
// validation to prevent type errors.
|
|
20637
20487
|
|
|
20638
|
-
|
|
20488
|
+
var validateStripe = function validateStripe(maybeStripe) {
|
|
20489
|
+
var errorMsg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : INVALID_STRIPE_ERROR;
|
|
20639
20490
|
|
|
20640
|
-
|
|
20641
|
-
|
|
20642
|
-
|
|
20643
|
-
};
|
|
20491
|
+
if (maybeStripe === null || isStripe(maybeStripe)) {
|
|
20492
|
+
return maybeStripe;
|
|
20493
|
+
}
|
|
20644
20494
|
|
|
20645
|
-
|
|
20646
|
-
addElementsLoadListener: _propTypes2.default.func.isRequired,
|
|
20647
|
-
registerElement: _propTypes2.default.func.isRequired,
|
|
20648
|
-
unregisterElement: _propTypes2.default.func.isRequired
|
|
20495
|
+
throw new Error(errorMsg);
|
|
20649
20496
|
};
|
|
20650
20497
|
|
|
20651
|
-
var
|
|
20652
|
-
|
|
20653
|
-
|
|
20654
|
-
function Elements(props, context) {
|
|
20655
|
-
_classCallCheck(this, Elements);
|
|
20498
|
+
var parseStripeProp = function parseStripeProp(raw) {
|
|
20499
|
+
var errorMsg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : INVALID_STRIPE_ERROR;
|
|
20656
20500
|
|
|
20657
|
-
|
|
20501
|
+
if (isPromise(raw)) {
|
|
20502
|
+
return {
|
|
20503
|
+
tag: 'async',
|
|
20504
|
+
stripePromise: Promise.resolve(raw).then(function (result) {
|
|
20505
|
+
return validateStripe(result, errorMsg);
|
|
20506
|
+
})
|
|
20507
|
+
};
|
|
20508
|
+
}
|
|
20658
20509
|
|
|
20659
|
-
|
|
20510
|
+
var stripe = validateStripe(raw, errorMsg);
|
|
20660
20511
|
|
|
20661
|
-
|
|
20662
|
-
|
|
20663
|
-
|
|
20664
|
-
registeredElements: [].concat(_toConsumableArray(prevState.registeredElements), [_extends({
|
|
20665
|
-
element: element
|
|
20666
|
-
}, impliedTokenType ? { impliedTokenType: impliedTokenType } : {}, impliedSourceType ? { impliedSourceType: impliedSourceType } : {}, impliedPaymentMethodType ? { impliedPaymentMethodType: impliedPaymentMethodType } : {})])
|
|
20667
|
-
};
|
|
20668
|
-
});
|
|
20512
|
+
if (stripe === null) {
|
|
20513
|
+
return {
|
|
20514
|
+
tag: 'empty'
|
|
20669
20515
|
};
|
|
20516
|
+
}
|
|
20670
20517
|
|
|
20671
|
-
|
|
20672
|
-
|
|
20673
|
-
|
|
20674
|
-
|
|
20675
|
-
|
|
20676
|
-
return element !== el;
|
|
20677
|
-
})
|
|
20678
|
-
};
|
|
20679
|
-
});
|
|
20680
|
-
};
|
|
20518
|
+
return {
|
|
20519
|
+
tag: 'sync',
|
|
20520
|
+
stripe: stripe
|
|
20521
|
+
};
|
|
20522
|
+
};
|
|
20681
20523
|
|
|
20682
|
-
|
|
20683
|
-
|
|
20684
|
-
|
|
20524
|
+
var registerWithStripeJs = function registerWithStripeJs(stripe) {
|
|
20525
|
+
if (!stripe || !stripe._registerWrapper || !stripe.registerAppInfo) {
|
|
20526
|
+
return;
|
|
20527
|
+
}
|
|
20685
20528
|
|
|
20686
|
-
|
|
20687
|
-
|
|
20688
|
-
|
|
20529
|
+
stripe._registerWrapper({
|
|
20530
|
+
name: 'react-stripe-js',
|
|
20531
|
+
version: "2.5.0"
|
|
20532
|
+
});
|
|
20689
20533
|
|
|
20690
|
-
|
|
20691
|
-
|
|
20692
|
-
|
|
20693
|
-
|
|
20534
|
+
stripe.registerAppInfo({
|
|
20535
|
+
name: 'react-stripe-js',
|
|
20536
|
+
version: "2.5.0",
|
|
20537
|
+
url: 'https://stripe.com/docs/stripe-js/react'
|
|
20538
|
+
});
|
|
20539
|
+
};
|
|
20540
|
+
var CustomCheckoutSdkContext = /*#__PURE__*/React__default.createContext(null);
|
|
20541
|
+
CustomCheckoutSdkContext.displayName = 'CustomCheckoutSdkContext';
|
|
20542
|
+
var parseCustomCheckoutSdkContext = function parseCustomCheckoutSdkContext(ctx, useCase) {
|
|
20543
|
+
if (!ctx) {
|
|
20544
|
+
throw new Error("Could not find CustomCheckoutProvider context; You need to wrap the part of your app that ".concat(useCase, " in an <CustomCheckoutProvider> provider."));
|
|
20694
20545
|
}
|
|
20695
20546
|
|
|
20696
|
-
|
|
20697
|
-
|
|
20547
|
+
return ctx;
|
|
20548
|
+
};
|
|
20549
|
+
var CustomCheckoutContext = /*#__PURE__*/React__default.createContext(null);
|
|
20550
|
+
CustomCheckoutContext.displayName = 'CustomCheckoutContext';
|
|
20551
|
+
({
|
|
20552
|
+
stripe: PropTypes.any,
|
|
20553
|
+
options: PropTypes.shape({
|
|
20554
|
+
clientSecret: PropTypes.string.isRequired,
|
|
20555
|
+
elementsOptions: PropTypes.object
|
|
20556
|
+
}).isRequired
|
|
20557
|
+
});
|
|
20558
|
+
var useElementsOrCustomCheckoutSdkContextWithUseCase = function useElementsOrCustomCheckoutSdkContextWithUseCase(useCaseString) {
|
|
20559
|
+
var customCheckoutSdkContext = React__default.useContext(CustomCheckoutSdkContext);
|
|
20560
|
+
var elementsContext = React__default.useContext(ElementsContext);
|
|
20698
20561
|
|
|
20699
|
-
|
|
20700
|
-
|
|
20701
|
-
|
|
20702
|
-
if (_this2.context.tag === 'sync') {
|
|
20703
|
-
// This is impossible, but we need to make flow happy.
|
|
20704
|
-
if (!_this2._elements) {
|
|
20705
|
-
throw new Error('Expected elements to be instantiated but it was not.');
|
|
20706
|
-
}
|
|
20562
|
+
if (customCheckoutSdkContext && elementsContext) {
|
|
20563
|
+
throw new Error("You cannot wrap the part of your app that ".concat(useCaseString, " in both <CustomCheckoutProvider> and <Elements> providers."));
|
|
20564
|
+
}
|
|
20707
20565
|
|
|
20708
|
-
|
|
20709
|
-
|
|
20710
|
-
|
|
20711
|
-
if (_this2._elements) {
|
|
20712
|
-
fn(_this2._elements);
|
|
20713
|
-
} else {
|
|
20714
|
-
var _props = _this2.props;
|
|
20715
|
-
_props.children;
|
|
20716
|
-
var options = _objectWithoutProperties(_props, ['children']);
|
|
20566
|
+
if (customCheckoutSdkContext) {
|
|
20567
|
+
return parseCustomCheckoutSdkContext(customCheckoutSdkContext, useCaseString);
|
|
20568
|
+
}
|
|
20717
20569
|
|
|
20718
|
-
|
|
20719
|
-
|
|
20720
|
-
}
|
|
20721
|
-
});
|
|
20722
|
-
}
|
|
20723
|
-
},
|
|
20724
|
-
registerElement: this.handleRegisterElement,
|
|
20725
|
-
unregisterElement: this.handleUnregisterElement,
|
|
20726
|
-
getRegisteredElements: function getRegisteredElements() {
|
|
20727
|
-
return _this2.state.registeredElements;
|
|
20728
|
-
},
|
|
20729
|
-
elements: this._elements
|
|
20730
|
-
};
|
|
20731
|
-
};
|
|
20570
|
+
return parseElementsContext(elementsContext, useCaseString);
|
|
20571
|
+
};
|
|
20732
20572
|
|
|
20733
|
-
|
|
20734
|
-
|
|
20735
|
-
|
|
20573
|
+
var ElementsContext = /*#__PURE__*/React__default.createContext(null);
|
|
20574
|
+
ElementsContext.displayName = 'ElementsContext';
|
|
20575
|
+
var parseElementsContext = function parseElementsContext(ctx, useCase) {
|
|
20576
|
+
if (!ctx) {
|
|
20577
|
+
throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(useCase, " in an <Elements> provider."));
|
|
20578
|
+
}
|
|
20736
20579
|
|
|
20737
|
-
return
|
|
20738
|
-
}
|
|
20580
|
+
return ctx;
|
|
20581
|
+
};
|
|
20582
|
+
var CartElementContext = /*#__PURE__*/React__default.createContext(null);
|
|
20583
|
+
CartElementContext.displayName = 'CartElementContext';
|
|
20584
|
+
var parseCartElementContext = function parseCartElementContext(ctx, useCase) {
|
|
20585
|
+
if (!ctx) {
|
|
20586
|
+
throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(useCase, " in an <Elements> provider."));
|
|
20587
|
+
}
|
|
20739
20588
|
|
|
20740
|
-
|
|
20741
|
-
Elements.contextTypes = Provider_1.providerContextTypes;
|
|
20742
|
-
Elements.defaultProps = {
|
|
20743
|
-
children: null
|
|
20589
|
+
return ctx;
|
|
20744
20590
|
};
|
|
20745
|
-
|
|
20746
|
-
|
|
20591
|
+
/**
|
|
20592
|
+
* The `Elements` provider allows you to use [Element components](https://stripe.com/docs/stripe-js/react#element-components) and access the [Stripe object](https://stripe.com/docs/js/initializing) in any nested component.
|
|
20593
|
+
* Render an `Elements` provider at the root of your React app so that it is available everywhere you need it.
|
|
20594
|
+
*
|
|
20595
|
+
* To use the `Elements` provider, call `loadStripe` from `@stripe/stripe-js` with your publishable key.
|
|
20596
|
+
* The `loadStripe` function will asynchronously load the Stripe.js script and initialize a `Stripe` object.
|
|
20597
|
+
* Pass the returned `Promise` to `Elements`.
|
|
20598
|
+
*
|
|
20599
|
+
* @docs https://stripe.com/docs/stripe-js/react#elements-provider
|
|
20600
|
+
*/
|
|
20747
20601
|
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
|
|
20602
|
+
var Elements = function Elements(_ref) {
|
|
20603
|
+
var rawStripeProp = _ref.stripe,
|
|
20604
|
+
options = _ref.options,
|
|
20605
|
+
children = _ref.children;
|
|
20606
|
+
var parsed = React__default.useMemo(function () {
|
|
20607
|
+
return parseStripeProp(rawStripeProp);
|
|
20608
|
+
}, [rawStripeProp]);
|
|
20751
20609
|
|
|
20752
|
-
var
|
|
20610
|
+
var _React$useState = React__default.useState(null),
|
|
20611
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
20612
|
+
cart = _React$useState2[0],
|
|
20613
|
+
setCart = _React$useState2[1];
|
|
20753
20614
|
|
|
20754
|
-
|
|
20755
|
-
|
|
20756
|
-
|
|
20615
|
+
var _React$useState3 = React__default.useState(null),
|
|
20616
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
20617
|
+
cartState = _React$useState4[0],
|
|
20618
|
+
setCartState = _React$useState4[1]; // For a sync stripe instance, initialize into context
|
|
20757
20619
|
|
|
20758
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
20759
20620
|
|
|
20760
|
-
var
|
|
20621
|
+
var _React$useState5 = React__default.useState(function () {
|
|
20622
|
+
return {
|
|
20623
|
+
stripe: parsed.tag === 'sync' ? parsed.stripe : null,
|
|
20624
|
+
elements: parsed.tag === 'sync' ? parsed.stripe.elements(options) : null
|
|
20625
|
+
};
|
|
20626
|
+
}),
|
|
20627
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
20628
|
+
ctx = _React$useState6[0],
|
|
20629
|
+
setContext = _React$useState6[1];
|
|
20761
20630
|
|
|
20631
|
+
React__default.useEffect(function () {
|
|
20632
|
+
var isMounted = true;
|
|
20762
20633
|
|
|
20634
|
+
var safeSetContext = function safeSetContext(stripe) {
|
|
20635
|
+
setContext(function (ctx) {
|
|
20636
|
+
// no-op if we already have a stripe instance (https://github.com/stripe/react-stripe-js/issues/296)
|
|
20637
|
+
if (ctx.stripe) return ctx;
|
|
20638
|
+
return {
|
|
20639
|
+
stripe: stripe,
|
|
20640
|
+
elements: stripe.elements(options)
|
|
20641
|
+
};
|
|
20642
|
+
});
|
|
20643
|
+
}; // For an async stripePromise, store it in context once resolved
|
|
20763
20644
|
|
|
20764
|
-
var _react2 = _interopRequireDefault(React__default);
|
|
20765
20645
|
|
|
20646
|
+
if (parsed.tag === 'async' && !ctx.stripe) {
|
|
20647
|
+
parsed.stripePromise.then(function (stripe) {
|
|
20648
|
+
if (stripe && isMounted) {
|
|
20649
|
+
// Only update Elements context if the component is still mounted
|
|
20650
|
+
// and stripe is not null. We allow stripe to be null to make
|
|
20651
|
+
// handling SSR easier.
|
|
20652
|
+
safeSetContext(stripe);
|
|
20653
|
+
}
|
|
20654
|
+
});
|
|
20655
|
+
} else if (parsed.tag === 'sync' && !ctx.stripe) {
|
|
20656
|
+
// Or, handle a sync stripe instance going from null -> populated
|
|
20657
|
+
safeSetContext(parsed.stripe);
|
|
20658
|
+
}
|
|
20659
|
+
|
|
20660
|
+
return function () {
|
|
20661
|
+
isMounted = false;
|
|
20662
|
+
};
|
|
20663
|
+
}, [parsed, ctx, options]); // Warn on changes to stripe prop
|
|
20766
20664
|
|
|
20665
|
+
var prevStripe = usePrevious(rawStripeProp);
|
|
20666
|
+
React__default.useEffect(function () {
|
|
20667
|
+
if (prevStripe !== null && prevStripe !== rawStripeProp) {
|
|
20668
|
+
console.warn('Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.');
|
|
20669
|
+
}
|
|
20670
|
+
}, [prevStripe, rawStripeProp]); // Apply updates to elements when options prop has relevant changes
|
|
20767
20671
|
|
|
20672
|
+
var prevOptions = usePrevious(options);
|
|
20673
|
+
React__default.useEffect(function () {
|
|
20674
|
+
if (!ctx.elements) {
|
|
20675
|
+
return;
|
|
20676
|
+
}
|
|
20768
20677
|
|
|
20678
|
+
var updates = extractAllowedOptionsUpdates(options, prevOptions, ['clientSecret', 'fonts']);
|
|
20769
20679
|
|
|
20770
|
-
|
|
20680
|
+
if (updates) {
|
|
20681
|
+
ctx.elements.update(updates);
|
|
20682
|
+
}
|
|
20683
|
+
}, [options, prevOptions, ctx.elements]); // Attach react-stripe-js version to stripe.js instance
|
|
20771
20684
|
|
|
20772
|
-
function
|
|
20685
|
+
React__default.useEffect(function () {
|
|
20686
|
+
registerWithStripeJs(ctx.stripe);
|
|
20687
|
+
}, [ctx.stripe]);
|
|
20688
|
+
return /*#__PURE__*/React__default.createElement(ElementsContext.Provider, {
|
|
20689
|
+
value: ctx
|
|
20690
|
+
}, /*#__PURE__*/React__default.createElement(CartElementContext.Provider, {
|
|
20691
|
+
value: {
|
|
20692
|
+
cart: cart,
|
|
20693
|
+
setCart: setCart,
|
|
20694
|
+
cartState: cartState,
|
|
20695
|
+
setCartState: setCartState
|
|
20696
|
+
}
|
|
20697
|
+
}, children));
|
|
20698
|
+
};
|
|
20699
|
+
Elements.propTypes = {
|
|
20700
|
+
stripe: PropTypes.any,
|
|
20701
|
+
options: PropTypes.object
|
|
20702
|
+
};
|
|
20703
|
+
var useElementsContextWithUseCase = function useElementsContextWithUseCase(useCaseMessage) {
|
|
20704
|
+
var ctx = React__default.useContext(ElementsContext);
|
|
20705
|
+
return parseElementsContext(ctx, useCaseMessage);
|
|
20706
|
+
};
|
|
20707
|
+
var DUMMY_CART_ELEMENT_CONTEXT = {
|
|
20708
|
+
cart: null,
|
|
20709
|
+
cartState: null,
|
|
20710
|
+
setCart: function setCart() {},
|
|
20711
|
+
setCartState: function setCartState() {}
|
|
20712
|
+
};
|
|
20713
|
+
var useCartElementContextWithUseCase = function useCartElementContextWithUseCase(useCaseMessage) {
|
|
20714
|
+
var isInCustomCheckout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
20715
|
+
var ctx = React__default.useContext(CartElementContext);
|
|
20773
20716
|
|
|
20774
|
-
|
|
20717
|
+
if (isInCustomCheckout) {
|
|
20718
|
+
return DUMMY_CART_ELEMENT_CONTEXT;
|
|
20719
|
+
}
|
|
20775
20720
|
|
|
20776
|
-
|
|
20721
|
+
return parseCartElementContext(ctx, useCaseMessage);
|
|
20722
|
+
};
|
|
20723
|
+
/**
|
|
20724
|
+
* @docs https://stripe.com/docs/stripe-js/react#useelements-hook
|
|
20725
|
+
*/
|
|
20777
20726
|
|
|
20778
|
-
|
|
20727
|
+
var useElements = function useElements() {
|
|
20728
|
+
var _useElementsContextWi = useElementsContextWithUseCase('calls useElements()'),
|
|
20729
|
+
elements = _useElementsContextWi.elements;
|
|
20779
20730
|
|
|
20780
|
-
|
|
20781
|
-
|
|
20782
|
-
|
|
20783
|
-
|
|
20731
|
+
return elements;
|
|
20732
|
+
};
|
|
20733
|
+
/**
|
|
20734
|
+
* @docs https://stripe.com/docs/stripe-js/react#usestripe-hook
|
|
20735
|
+
*/
|
|
20784
20736
|
|
|
20785
|
-
|
|
20786
|
-
var
|
|
20787
|
-
|
|
20737
|
+
var useStripe = function useStripe() {
|
|
20738
|
+
var _useElementsOrCustomC = useElementsOrCustomCheckoutSdkContextWithUseCase('calls useStripe()'),
|
|
20739
|
+
stripe = _useElementsOrCustomC.stripe;
|
|
20788
20740
|
|
|
20741
|
+
return stripe;
|
|
20742
|
+
};
|
|
20743
|
+
({
|
|
20744
|
+
children: PropTypes.func.isRequired
|
|
20745
|
+
});
|
|
20789
20746
|
|
|
20790
|
-
|
|
20791
|
-
|
|
20747
|
+
var useAttachEvent = function useAttachEvent(element, event, cb) {
|
|
20748
|
+
var cbDefined = !!cb;
|
|
20749
|
+
var cbRef = React__default.useRef(cb); // In many integrations the callback prop changes on each render.
|
|
20750
|
+
// Using a ref saves us from calling element.on/.off every render.
|
|
20792
20751
|
|
|
20793
|
-
|
|
20794
|
-
|
|
20752
|
+
React__default.useEffect(function () {
|
|
20753
|
+
cbRef.current = cb;
|
|
20754
|
+
}, [cb]);
|
|
20755
|
+
React__default.useEffect(function () {
|
|
20756
|
+
if (!cbDefined || !element) {
|
|
20757
|
+
return function () {};
|
|
20758
|
+
}
|
|
20795
20759
|
|
|
20796
|
-
|
|
20797
|
-
|
|
20760
|
+
var decoratedCb = function decoratedCb() {
|
|
20761
|
+
if (cbRef.current) {
|
|
20762
|
+
cbRef.current.apply(cbRef, arguments);
|
|
20798
20763
|
}
|
|
20764
|
+
};
|
|
20799
20765
|
|
|
20800
|
-
|
|
20801
|
-
|
|
20802
|
-
|
|
20803
|
-
|
|
20804
|
-
|
|
20766
|
+
element.on(event, decoratedCb);
|
|
20767
|
+
return function () {
|
|
20768
|
+
element.off(event, decoratedCb);
|
|
20769
|
+
};
|
|
20770
|
+
}, [cbDefined, event, element, cbRef]);
|
|
20771
|
+
};
|
|
20805
20772
|
|
|
20806
|
-
|
|
20807
|
-
|
|
20808
|
-
|
|
20809
|
-
return e[filterBy];
|
|
20810
|
-
});
|
|
20811
|
-
var matchingElements = specifiedType === 'auto' ? filteredElements : filteredElements.filter(function (e) {
|
|
20812
|
-
return e[filterBy] === specifiedType;
|
|
20813
|
-
});
|
|
20773
|
+
var capitalized = function capitalized(str) {
|
|
20774
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
20775
|
+
};
|
|
20814
20776
|
|
|
20815
|
-
|
|
20816
|
-
|
|
20817
|
-
|
|
20818
|
-
|
|
20819
|
-
|
|
20820
|
-
|
|
20821
|
-
|
|
20777
|
+
var createElementComponent = function createElementComponent(type, isServer) {
|
|
20778
|
+
var displayName = "".concat(capitalized(type), "Element");
|
|
20779
|
+
|
|
20780
|
+
var ClientElement = function ClientElement(_ref) {
|
|
20781
|
+
var id = _ref.id,
|
|
20782
|
+
className = _ref.className,
|
|
20783
|
+
_ref$options = _ref.options,
|
|
20784
|
+
options = _ref$options === void 0 ? {} : _ref$options,
|
|
20785
|
+
onBlur = _ref.onBlur,
|
|
20786
|
+
onFocus = _ref.onFocus,
|
|
20787
|
+
onReady = _ref.onReady,
|
|
20788
|
+
onChange = _ref.onChange,
|
|
20789
|
+
onEscape = _ref.onEscape,
|
|
20790
|
+
onClick = _ref.onClick,
|
|
20791
|
+
onLoadError = _ref.onLoadError,
|
|
20792
|
+
onLoaderStart = _ref.onLoaderStart,
|
|
20793
|
+
onNetworksChange = _ref.onNetworksChange,
|
|
20794
|
+
onCheckout = _ref.onCheckout,
|
|
20795
|
+
onLineItemClick = _ref.onLineItemClick,
|
|
20796
|
+
onConfirm = _ref.onConfirm,
|
|
20797
|
+
onCancel = _ref.onCancel,
|
|
20798
|
+
onShippingAddressChange = _ref.onShippingAddressChange,
|
|
20799
|
+
onShippingRateChange = _ref.onShippingRateChange;
|
|
20800
|
+
var ctx = useElementsOrCustomCheckoutSdkContextWithUseCase("mounts <".concat(displayName, ">"));
|
|
20801
|
+
var elements = 'elements' in ctx ? ctx.elements : null;
|
|
20802
|
+
var customCheckoutSdk = 'customCheckoutSdk' in ctx ? ctx.customCheckoutSdk : null;
|
|
20803
|
+
|
|
20804
|
+
var _React$useState = React__default.useState(null),
|
|
20805
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
20806
|
+
element = _React$useState2[0],
|
|
20807
|
+
setElement = _React$useState2[1];
|
|
20808
|
+
|
|
20809
|
+
var elementRef = React__default.useRef(null);
|
|
20810
|
+
var domNode = React__default.useRef(null);
|
|
20811
|
+
|
|
20812
|
+
var _useCartElementContex = useCartElementContextWithUseCase("mounts <".concat(displayName, ">"), 'customCheckoutSdk' in ctx),
|
|
20813
|
+
setCart = _useCartElementContex.setCart,
|
|
20814
|
+
setCartState = _useCartElementContex.setCartState; // For every event where the merchant provides a callback, call element.on
|
|
20815
|
+
// with that callback. If the merchant ever changes the callback, removes
|
|
20816
|
+
// the old callback with element.off and then call element.on with the new one.
|
|
20817
|
+
|
|
20818
|
+
|
|
20819
|
+
useAttachEvent(element, 'blur', onBlur);
|
|
20820
|
+
useAttachEvent(element, 'focus', onFocus);
|
|
20821
|
+
useAttachEvent(element, 'escape', onEscape);
|
|
20822
|
+
useAttachEvent(element, 'click', onClick);
|
|
20823
|
+
useAttachEvent(element, 'loaderror', onLoadError);
|
|
20824
|
+
useAttachEvent(element, 'loaderstart', onLoaderStart);
|
|
20825
|
+
useAttachEvent(element, 'networkschange', onNetworksChange);
|
|
20826
|
+
useAttachEvent(element, 'lineitemclick', onLineItemClick);
|
|
20827
|
+
useAttachEvent(element, 'confirm', onConfirm);
|
|
20828
|
+
useAttachEvent(element, 'cancel', onCancel);
|
|
20829
|
+
useAttachEvent(element, 'shippingaddresschange', onShippingAddressChange);
|
|
20830
|
+
useAttachEvent(element, 'shippingratechange', onShippingRateChange);
|
|
20831
|
+
var readyCallback;
|
|
20832
|
+
|
|
20833
|
+
if (type === 'cart') {
|
|
20834
|
+
readyCallback = function readyCallback(event) {
|
|
20835
|
+
setCartState(event);
|
|
20836
|
+
onReady && onReady(event);
|
|
20822
20837
|
};
|
|
20838
|
+
} else if (onReady) {
|
|
20839
|
+
if (type === 'expressCheckout') {
|
|
20840
|
+
// Passes through the event, which includes visible PM types
|
|
20841
|
+
readyCallback = onReady;
|
|
20842
|
+
} else {
|
|
20843
|
+
// For other Elements, pass through the Element itself.
|
|
20844
|
+
readyCallback = function readyCallback() {
|
|
20845
|
+
onReady(element);
|
|
20846
|
+
};
|
|
20847
|
+
}
|
|
20848
|
+
}
|
|
20823
20849
|
|
|
20824
|
-
|
|
20825
|
-
|
|
20826
|
-
|
|
20827
|
-
|
|
20828
|
-
|
|
20829
|
-
|
|
20850
|
+
useAttachEvent(element, 'ready', readyCallback);
|
|
20851
|
+
var changeCallback = type === 'cart' ? function (event) {
|
|
20852
|
+
setCartState(event);
|
|
20853
|
+
onChange && onChange(event);
|
|
20854
|
+
} : onChange;
|
|
20855
|
+
useAttachEvent(element, 'change', changeCallback);
|
|
20856
|
+
var checkoutCallback = type === 'cart' ? function (event) {
|
|
20857
|
+
setCartState(event);
|
|
20858
|
+
onCheckout && onCheckout(event);
|
|
20859
|
+
} : onCheckout;
|
|
20860
|
+
useAttachEvent(element, 'checkout', checkoutCallback);
|
|
20861
|
+
React__default.useLayoutEffect(function () {
|
|
20862
|
+
if (elementRef.current === null && domNode.current !== null && (elements || customCheckoutSdk)) {
|
|
20863
|
+
var newElement = null;
|
|
20864
|
+
|
|
20865
|
+
if (customCheckoutSdk) {
|
|
20866
|
+
newElement = customCheckoutSdk.createElement(type, options);
|
|
20867
|
+
} else if (elements) {
|
|
20868
|
+
newElement = elements.create(type, options);
|
|
20830
20869
|
}
|
|
20831
|
-
};
|
|
20832
20870
|
|
|
20833
|
-
|
|
20834
|
-
|
|
20835
|
-
|
|
20836
|
-
|
|
20837
|
-
|
|
20838
|
-
if (tokenTypeOrOptions && (typeof tokenTypeOrOptions === 'undefined' ? 'undefined' : _typeof(tokenTypeOrOptions)) === 'object') {
|
|
20839
|
-
// First argument is options; infer the Element and tokenize
|
|
20840
|
-
var opts = tokenTypeOrOptions;
|
|
20841
|
-
|
|
20842
|
-
var tokenType = opts.type,
|
|
20843
|
-
rest = _objectWithoutProperties(opts, ['type']);
|
|
20844
|
-
|
|
20845
|
-
var specifiedType = typeof tokenType === 'string' ? tokenType : 'auto';
|
|
20846
|
-
// Since only options were passed in, a corresponding Element must exist
|
|
20847
|
-
// for the tokenization to succeed -- thus we call requireElement.
|
|
20848
|
-
var element = _this.requireElement('impliedTokenType', specifiedType);
|
|
20849
|
-
return stripe.createToken(element, rest);
|
|
20850
|
-
} else if (typeof tokenTypeOrOptions === 'string') {
|
|
20851
|
-
// First argument is token type; tokenize with token type and options
|
|
20852
|
-
var _tokenType = tokenTypeOrOptions;
|
|
20853
|
-
return stripe.createToken(_tokenType, options);
|
|
20854
|
-
} else {
|
|
20855
|
-
// If a bad value was passed in for options, throw an error.
|
|
20856
|
-
throw new Error('Invalid options passed to createToken. Expected an object, got ' + (typeof tokenTypeOrOptions === 'undefined' ? 'undefined' : _typeof(tokenTypeOrOptions)) + '.');
|
|
20857
|
-
}
|
|
20858
|
-
};
|
|
20859
|
-
};
|
|
20871
|
+
if (type === 'cart' && setCart) {
|
|
20872
|
+
// we know that elements.create return value must be of type StripeCartElement if type is 'cart',
|
|
20873
|
+
// we need to cast because typescript is not able to infer which overloaded method is used based off param type
|
|
20874
|
+
setCart(newElement);
|
|
20875
|
+
} // Store element in a ref to ensure it's _immediately_ available in cleanup hooks in StrictMode
|
|
20860
20876
|
|
|
20861
|
-
_this.wrappedCreateSource = function (stripe) {
|
|
20862
|
-
return function () {
|
|
20863
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
20864
20877
|
|
|
20865
|
-
|
|
20866
|
-
if (typeof options.type !== 'string') {
|
|
20867
|
-
throw new Error('Invalid Source type passed to createSource. Expected string, got ' + _typeof(options.type) + '.');
|
|
20868
|
-
}
|
|
20878
|
+
elementRef.current = newElement; // Store element in state to facilitate event listener attachment
|
|
20869
20879
|
|
|
20870
|
-
|
|
20871
|
-
if (element) {
|
|
20872
|
-
// If an Element exists for the source type, use that to create the
|
|
20873
|
-
// corresponding source.
|
|
20874
|
-
//
|
|
20875
|
-
// NOTE: this prevents users from independently creating sources of
|
|
20876
|
-
// type `foo` if an Element that can create `foo` sources exists in
|
|
20877
|
-
// the current <Elements /> context.
|
|
20878
|
-
return stripe.createSource(element, options);
|
|
20879
|
-
} else {
|
|
20880
|
-
// If no Element exists for the source type, directly create a source.
|
|
20881
|
-
return stripe.createSource(options);
|
|
20882
|
-
}
|
|
20883
|
-
} else {
|
|
20884
|
-
// If a bad value was passed in for options, throw an error.
|
|
20885
|
-
throw new Error('Invalid options passed to createSource. Expected an object, got ' + (typeof options === 'undefined' ? 'undefined' : _typeof(options)) + '.');
|
|
20886
|
-
}
|
|
20887
|
-
};
|
|
20888
|
-
};
|
|
20880
|
+
setElement(newElement);
|
|
20889
20881
|
|
|
20890
|
-
|
|
20891
|
-
|
|
20892
|
-
|
|
20893
|
-
|
|
20894
|
-
|
|
20882
|
+
if (newElement) {
|
|
20883
|
+
newElement.mount(domNode.current);
|
|
20884
|
+
}
|
|
20885
|
+
}
|
|
20886
|
+
}, [elements, customCheckoutSdk, options, setCart]);
|
|
20887
|
+
var prevOptions = usePrevious(options);
|
|
20888
|
+
React__default.useEffect(function () {
|
|
20889
|
+
if (!elementRef.current) {
|
|
20890
|
+
return;
|
|
20891
|
+
}
|
|
20895
20892
|
|
|
20896
|
-
|
|
20897
|
-
|
|
20893
|
+
var updates = extractAllowedOptionsUpdates(options, prevOptions, ['paymentRequest']);
|
|
20894
|
+
|
|
20895
|
+
if (updates) {
|
|
20896
|
+
elementRef.current.update(updates);
|
|
20897
|
+
}
|
|
20898
|
+
}, [options, prevOptions]);
|
|
20899
|
+
React__default.useLayoutEffect(function () {
|
|
20900
|
+
return function () {
|
|
20901
|
+
if (elementRef.current && typeof elementRef.current.destroy === 'function') {
|
|
20902
|
+
try {
|
|
20903
|
+
elementRef.current.destroy();
|
|
20904
|
+
elementRef.current = null;
|
|
20905
|
+
} catch (error) {// Do nothing
|
|
20898
20906
|
}
|
|
20907
|
+
}
|
|
20908
|
+
};
|
|
20909
|
+
}, []);
|
|
20910
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
20911
|
+
id: id,
|
|
20912
|
+
className: className,
|
|
20913
|
+
ref: domNode
|
|
20914
|
+
});
|
|
20915
|
+
}; // Only render the Element wrapper in a server environment.
|
|
20899
20916
|
|
|
20900
|
-
var elementOrDataResult = _this.parseElementOrData(elementOrData);
|
|
20901
20917
|
|
|
20902
|
-
|
|
20903
|
-
|
|
20904
|
-
|
|
20918
|
+
var ServerElement = function ServerElement(props) {
|
|
20919
|
+
// Validate that we are in the right context by calling useElementsContextWithUseCase.
|
|
20920
|
+
var ctx = useElementsOrCustomCheckoutSdkContextWithUseCase("mounts <".concat(displayName, ">"));
|
|
20921
|
+
useCartElementContextWithUseCase("mounts <".concat(displayName, ">"), 'customCheckoutSdk' in ctx);
|
|
20922
|
+
var id = props.id,
|
|
20923
|
+
className = props.className;
|
|
20924
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
20925
|
+
id: id,
|
|
20926
|
+
className: className
|
|
20927
|
+
});
|
|
20928
|
+
};
|
|
20929
|
+
|
|
20930
|
+
var Element = isServer ? ServerElement : ClientElement;
|
|
20931
|
+
Element.propTypes = {
|
|
20932
|
+
id: PropTypes.string,
|
|
20933
|
+
className: PropTypes.string,
|
|
20934
|
+
onChange: PropTypes.func,
|
|
20935
|
+
onBlur: PropTypes.func,
|
|
20936
|
+
onFocus: PropTypes.func,
|
|
20937
|
+
onReady: PropTypes.func,
|
|
20938
|
+
onEscape: PropTypes.func,
|
|
20939
|
+
onClick: PropTypes.func,
|
|
20940
|
+
onLoadError: PropTypes.func,
|
|
20941
|
+
onLoaderStart: PropTypes.func,
|
|
20942
|
+
onNetworksChange: PropTypes.func,
|
|
20943
|
+
onCheckout: PropTypes.func,
|
|
20944
|
+
onLineItemClick: PropTypes.func,
|
|
20945
|
+
onConfirm: PropTypes.func,
|
|
20946
|
+
onCancel: PropTypes.func,
|
|
20947
|
+
onShippingAddressChange: PropTypes.func,
|
|
20948
|
+
onShippingRateChange: PropTypes.func,
|
|
20949
|
+
options: PropTypes.object
|
|
20950
|
+
};
|
|
20951
|
+
Element.displayName = displayName;
|
|
20952
|
+
Element.__elementType = type;
|
|
20953
|
+
return Element;
|
|
20954
|
+
};
|
|
20955
|
+
|
|
20956
|
+
var isServer = typeof window === 'undefined';
|
|
20957
|
+
|
|
20958
|
+
var EmbeddedCheckoutContext = /*#__PURE__*/React__default.createContext(null);
|
|
20959
|
+
EmbeddedCheckoutContext.displayName = 'EmbeddedCheckoutProviderContext';
|
|
20905
20960
|
|
|
20906
|
-
|
|
20907
|
-
|
|
20908
|
-
|
|
20909
|
-
|
|
20910
|
-
|
|
20911
|
-
|
|
20961
|
+
/**
|
|
20962
|
+
* Requires beta access:
|
|
20963
|
+
* Contact [Stripe support](https://support.stripe.com/) for more information.
|
|
20964
|
+
*
|
|
20965
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
20966
|
+
*/
|
|
20912
20967
|
|
|
20913
|
-
|
|
20914
|
-
|
|
20968
|
+
createElementComponent('auBankAccount', isServer);
|
|
20969
|
+
/**
|
|
20970
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
20971
|
+
*/
|
|
20915
20972
|
|
|
20916
|
-
|
|
20973
|
+
createElementComponent('card', isServer);
|
|
20974
|
+
/**
|
|
20975
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
20976
|
+
*/
|
|
20917
20977
|
|
|
20918
|
-
|
|
20919
|
-
|
|
20920
|
-
|
|
20978
|
+
createElementComponent('cardNumber', isServer);
|
|
20979
|
+
/**
|
|
20980
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
20981
|
+
*/
|
|
20921
20982
|
|
|
20922
|
-
|
|
20923
|
-
|
|
20924
|
-
|
|
20925
|
-
|
|
20926
|
-
} else {
|
|
20927
|
-
// If a bad value was passed in for data, throw an error.
|
|
20928
|
-
throw new Error('Invalid data passed to createPaymentMethod. Expected an object, got ' + (typeof data === 'undefined' ? 'undefined' : _typeof(data)) + '.');
|
|
20929
|
-
}
|
|
20930
|
-
};
|
|
20931
|
-
};
|
|
20983
|
+
createElementComponent('cardExpiry', isServer);
|
|
20984
|
+
/**
|
|
20985
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
20986
|
+
*/
|
|
20932
20987
|
|
|
20933
|
-
|
|
20934
|
-
|
|
20935
|
-
|
|
20936
|
-
|
|
20937
|
-
throw new Error('Invalid PaymentIntent client secret passed to handleCardPayment. Expected string, got ' + (typeof clientSecret === 'undefined' ? 'undefined' : _typeof(clientSecret)) + '.');
|
|
20938
|
-
}
|
|
20988
|
+
createElementComponent('cardCvc', isServer);
|
|
20989
|
+
/**
|
|
20990
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
20991
|
+
*/
|
|
20939
20992
|
|
|
20940
|
-
|
|
20993
|
+
createElementComponent('fpxBank', isServer);
|
|
20994
|
+
/**
|
|
20995
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
20996
|
+
*/
|
|
20941
20997
|
|
|
20942
|
-
|
|
20943
|
-
|
|
20944
|
-
|
|
20998
|
+
createElementComponent('iban', isServer);
|
|
20999
|
+
/**
|
|
21000
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
21001
|
+
*/
|
|
20945
21002
|
|
|
20946
|
-
|
|
20947
|
-
|
|
20948
|
-
|
|
20949
|
-
|
|
20950
|
-
}
|
|
20951
|
-
}
|
|
20952
|
-
|
|
20953
|
-
// Second argument is data or undefined; see if we can find a mounted Element
|
|
20954
|
-
// that can create card PaymentMethods
|
|
20955
|
-
var data = elementOrDataResult.data;
|
|
20956
|
-
|
|
20957
|
-
var element = _this.findElement('impliedPaymentMethodType', 'card');
|
|
20958
|
-
|
|
20959
|
-
if (element) {
|
|
20960
|
-
// If an Element exists that can create card PaymentMethods use it. Otherwise
|
|
20961
|
-
// assume that we must be calling with data only.
|
|
20962
|
-
//
|
|
20963
|
-
// NOTE: this prevents users from using handleCard* with an existing
|
|
20964
|
-
// Source or PaymentMethod if an Element that can create card PaymentMethods
|
|
20965
|
-
// exists in the current <Elements /> context.
|
|
20966
|
-
if (data) {
|
|
20967
|
-
return stripe[method](clientSecret, element, data);
|
|
20968
|
-
} else {
|
|
20969
|
-
return stripe[method](clientSecret, element);
|
|
20970
|
-
}
|
|
20971
|
-
} else if (data) {
|
|
20972
|
-
// if no element exists call handleCard* directly (with data)
|
|
20973
|
-
return stripe[method](clientSecret, data);
|
|
20974
|
-
} else {
|
|
20975
|
-
// if no element exists call handleCard* directly (with only the clientSecret)
|
|
20976
|
-
return stripe[method](clientSecret);
|
|
20977
|
-
}
|
|
20978
|
-
};
|
|
20979
|
-
};
|
|
20980
|
-
|
|
20981
|
-
if (_this.context.tag === 'sync') {
|
|
20982
|
-
_this.state = {
|
|
20983
|
-
stripe: _this.stripeProps(_this.context.stripe)
|
|
20984
|
-
};
|
|
20985
|
-
} else {
|
|
20986
|
-
_this.state = {
|
|
20987
|
-
stripe: null
|
|
20988
|
-
};
|
|
20989
|
-
}
|
|
20990
|
-
return _this;
|
|
20991
|
-
}
|
|
20992
|
-
|
|
20993
|
-
_class.prototype.componentDidMount = function componentDidMount() {
|
|
20994
|
-
var _this2 = this;
|
|
21003
|
+
createElementComponent('idealBank', isServer);
|
|
21004
|
+
/**
|
|
21005
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
21006
|
+
*/
|
|
20995
21007
|
|
|
20996
|
-
|
|
20997
|
-
|
|
20998
|
-
|
|
20999
|
-
|
|
21000
|
-
});
|
|
21001
|
-
});
|
|
21002
|
-
}
|
|
21003
|
-
};
|
|
21008
|
+
createElementComponent('p24Bank', isServer);
|
|
21009
|
+
/**
|
|
21010
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
21011
|
+
*/
|
|
21004
21012
|
|
|
21005
|
-
|
|
21006
|
-
|
|
21007
|
-
|
|
21008
|
-
|
|
21009
|
-
|
|
21010
|
-
};
|
|
21013
|
+
createElementComponent('epsBank', isServer);
|
|
21014
|
+
var PaymentElement = createElementComponent('payment', isServer);
|
|
21015
|
+
/**
|
|
21016
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
21017
|
+
*/
|
|
21011
21018
|
|
|
21012
|
-
|
|
21013
|
-
|
|
21014
|
-
|
|
21015
|
-
|
|
21016
|
-
createSource: this.wrappedCreateSource(stripe),
|
|
21017
|
-
createPaymentMethod: this.wrappedCreatePaymentMethod(stripe),
|
|
21018
|
-
handleCardPayment: this.wrappedHandleCardX(stripe, 'handleCardPayment'),
|
|
21019
|
-
handleCardSetup: this.wrappedHandleCardX(stripe, 'handleCardSetup')
|
|
21020
|
-
});
|
|
21021
|
-
};
|
|
21019
|
+
createElementComponent('expressCheckout', isServer);
|
|
21020
|
+
/**
|
|
21021
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
21022
|
+
*/
|
|
21022
21023
|
|
|
21023
|
-
|
|
21024
|
-
|
|
21024
|
+
var PaymentRequestButtonElement = createElementComponent('paymentRequestButton', isServer);
|
|
21025
|
+
/**
|
|
21026
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
21027
|
+
*/
|
|
21025
21028
|
|
|
21029
|
+
createElementComponent('linkAuthentication', isServer);
|
|
21030
|
+
/**
|
|
21031
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
21032
|
+
*/
|
|
21026
21033
|
|
|
21027
|
-
|
|
21028
|
-
|
|
21034
|
+
createElementComponent('address', isServer);
|
|
21035
|
+
/**
|
|
21036
|
+
* @deprecated
|
|
21037
|
+
* Use `AddressElement` instead.
|
|
21038
|
+
*
|
|
21039
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
21040
|
+
*/
|
|
21029
21041
|
|
|
21042
|
+
createElementComponent('shippingAddress', isServer);
|
|
21043
|
+
/**
|
|
21044
|
+
* Requires beta access:
|
|
21045
|
+
* Contact [Stripe support](https://support.stripe.com/) for more information.
|
|
21046
|
+
*
|
|
21047
|
+
* @docs https://stripe.com/docs/elements/cart-element
|
|
21048
|
+
*/
|
|
21030
21049
|
|
|
21031
|
-
|
|
21050
|
+
createElementComponent('cart', isServer);
|
|
21051
|
+
/**
|
|
21052
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
21053
|
+
*/
|
|
21032
21054
|
|
|
21055
|
+
createElementComponent('paymentMethodMessaging', isServer);
|
|
21056
|
+
/**
|
|
21057
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
21058
|
+
*/
|
|
21033
21059
|
|
|
21034
|
-
|
|
21035
|
-
|
|
21060
|
+
createElementComponent('affirmMessage', isServer);
|
|
21061
|
+
/**
|
|
21062
|
+
* @docs https://stripe.com/docs/stripe-js/react#element-components
|
|
21063
|
+
*/
|
|
21036
21064
|
|
|
21065
|
+
createElementComponent('afterpayClearpayMessage', isServer);
|
|
21037
21066
|
|
|
21038
|
-
|
|
21039
|
-
|
|
21067
|
+
var V3_URL = 'https://js.stripe.com/v3';
|
|
21068
|
+
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
21069
|
+
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';
|
|
21070
|
+
var findScript = function findScript() {
|
|
21071
|
+
var scripts = document.querySelectorAll("script[src^=\"".concat(V3_URL, "\"]"));
|
|
21040
21072
|
|
|
21073
|
+
for (var i = 0; i < scripts.length; i++) {
|
|
21074
|
+
var script = scripts[i];
|
|
21041
21075
|
|
|
21042
|
-
|
|
21043
|
-
|
|
21076
|
+
if (!V3_URL_REGEX.test(script.src)) {
|
|
21077
|
+
continue;
|
|
21078
|
+
}
|
|
21044
21079
|
|
|
21045
|
-
|
|
21046
|
-
|
|
21047
|
-
elements: this.context.elements,
|
|
21048
|
-
ref: withRef ? function (c) {
|
|
21049
|
-
_this3.wrappedInstance = c;
|
|
21050
|
-
} : null
|
|
21051
|
-
}));
|
|
21052
|
-
};
|
|
21080
|
+
return script;
|
|
21081
|
+
}
|
|
21053
21082
|
|
|
21054
|
-
|
|
21055
|
-
}(_react2.default.Component), _class.contextTypes = _extends({}, Provider_1.providerContextTypes, Elements_1.injectContextTypes), _class.displayName = 'InjectStripe(' + (WrappedComponent.displayName || WrappedComponent.name || 'Component') + ')', _temp;
|
|
21083
|
+
return null;
|
|
21056
21084
|
};
|
|
21057
21085
|
|
|
21058
|
-
|
|
21059
|
-
|
|
21060
|
-
|
|
21061
|
-
|
|
21062
|
-
|
|
21063
|
-
var isEqual_1 = createCommonjsModule(function (module, exports) {
|
|
21064
|
-
|
|
21065
|
-
Object.defineProperty(exports, "__esModule", {
|
|
21066
|
-
value: true
|
|
21067
|
-
});
|
|
21068
|
-
|
|
21069
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
21070
|
-
|
|
21071
|
-
var PLAIN_OBJECT_STR = '[object Object]';
|
|
21086
|
+
var injectScript = function injectScript(params) {
|
|
21087
|
+
var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';
|
|
21088
|
+
var script = document.createElement('script');
|
|
21089
|
+
script.src = "".concat(V3_URL).concat(queryString);
|
|
21090
|
+
var headOrBody = document.head || document.body;
|
|
21072
21091
|
|
|
21073
|
-
|
|
21074
|
-
|
|
21075
|
-
return left === right;
|
|
21092
|
+
if (!headOrBody) {
|
|
21093
|
+
throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');
|
|
21076
21094
|
}
|
|
21077
21095
|
|
|
21078
|
-
|
|
21079
|
-
|
|
21080
|
-
|
|
21081
|
-
var rightArray = Array.isArray(right);
|
|
21082
|
-
|
|
21083
|
-
if (leftArray !== rightArray) return false;
|
|
21084
|
-
|
|
21085
|
-
var leftPlainObject = Object.prototype.toString.call(left) === PLAIN_OBJECT_STR;
|
|
21086
|
-
var rightPlainObject = Object.prototype.toString.call(right) === PLAIN_OBJECT_STR;
|
|
21087
|
-
|
|
21088
|
-
if (leftPlainObject !== rightPlainObject) return false;
|
|
21089
|
-
|
|
21090
|
-
if (!leftPlainObject && !leftArray) return false;
|
|
21091
|
-
|
|
21092
|
-
var leftKeys = Object.keys(left);
|
|
21093
|
-
var rightKeys = Object.keys(right);
|
|
21094
|
-
|
|
21095
|
-
if (leftKeys.length !== rightKeys.length) return false;
|
|
21096
|
+
headOrBody.appendChild(script);
|
|
21097
|
+
return script;
|
|
21098
|
+
};
|
|
21096
21099
|
|
|
21097
|
-
|
|
21098
|
-
|
|
21099
|
-
|
|
21100
|
-
}
|
|
21101
|
-
for (var _i = 0; _i < rightKeys.length; _i += 1) {
|
|
21102
|
-
keySet[rightKeys[_i]] = true;
|
|
21103
|
-
}
|
|
21104
|
-
var allKeys = Object.keys(keySet);
|
|
21105
|
-
if (allKeys.length !== leftKeys.length) {
|
|
21106
|
-
return false;
|
|
21100
|
+
var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
21101
|
+
if (!stripe || !stripe._registerWrapper) {
|
|
21102
|
+
return;
|
|
21107
21103
|
}
|
|
21108
21104
|
|
|
21109
|
-
|
|
21110
|
-
|
|
21111
|
-
|
|
21112
|
-
|
|
21113
|
-
};
|
|
21114
|
-
|
|
21115
|
-
return allKeys.every(pred);
|
|
21105
|
+
stripe._registerWrapper({
|
|
21106
|
+
name: 'stripe-js',
|
|
21107
|
+
version: "3.0.4",
|
|
21108
|
+
startTime: startTime
|
|
21109
|
+
});
|
|
21116
21110
|
};
|
|
21117
21111
|
|
|
21118
|
-
|
|
21119
|
-
|
|
21120
|
-
|
|
21121
|
-
unwrapExports(isEqual_1);
|
|
21122
|
-
|
|
21123
|
-
var Element_1 = createCommonjsModule(function (module, exports) {
|
|
21124
|
-
|
|
21125
|
-
Object.defineProperty(exports, "__esModule", {
|
|
21126
|
-
value: true
|
|
21127
|
-
});
|
|
21128
|
-
|
|
21129
|
-
|
|
21130
|
-
|
|
21131
|
-
var _react2 = _interopRequireDefault(React__default);
|
|
21132
|
-
|
|
21133
|
-
|
|
21134
|
-
|
|
21135
|
-
var _propTypes2 = _interopRequireDefault(PropTypes);
|
|
21136
|
-
|
|
21137
|
-
|
|
21138
|
-
|
|
21139
|
-
var _isEqual2 = _interopRequireDefault(isEqual_1);
|
|
21140
|
-
|
|
21141
|
-
|
|
21142
|
-
|
|
21143
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21144
|
-
|
|
21145
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21146
|
-
|
|
21147
|
-
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
21148
|
-
|
|
21149
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
21150
|
-
|
|
21151
|
-
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
21152
|
-
|
|
21153
|
-
var noop = function noop() {};
|
|
21154
|
-
|
|
21155
|
-
var _extractOptions = function _extractOptions(props) {
|
|
21156
|
-
props.id;
|
|
21157
|
-
props.className;
|
|
21158
|
-
props.onChange;
|
|
21159
|
-
props.onFocus;
|
|
21160
|
-
props.onBlur;
|
|
21161
|
-
props.onReady;
|
|
21162
|
-
var options = _objectWithoutProperties(props, ['id', 'className', 'onChange', 'onFocus', 'onBlur', 'onReady']);
|
|
21112
|
+
var stripePromise = null;
|
|
21113
|
+
var onErrorListener = null;
|
|
21114
|
+
var onLoadListener = null;
|
|
21163
21115
|
|
|
21164
|
-
|
|
21116
|
+
var onError = function onError(reject) {
|
|
21117
|
+
return function () {
|
|
21118
|
+
reject(new Error('Failed to load Stripe.js'));
|
|
21119
|
+
};
|
|
21165
21120
|
};
|
|
21166
21121
|
|
|
21167
|
-
var
|
|
21168
|
-
return
|
|
21122
|
+
var onLoad = function onLoad(resolve, reject) {
|
|
21123
|
+
return function () {
|
|
21124
|
+
if (window.Stripe) {
|
|
21125
|
+
resolve(window.Stripe);
|
|
21126
|
+
} else {
|
|
21127
|
+
reject(new Error('Stripe.js not available'));
|
|
21128
|
+
}
|
|
21129
|
+
};
|
|
21169
21130
|
};
|
|
21170
21131
|
|
|
21171
|
-
var
|
|
21172
|
-
|
|
21173
|
-
|
|
21174
|
-
|
|
21175
|
-
|
|
21176
|
-
_inherits(_class, _React$Component);
|
|
21177
|
-
|
|
21178
|
-
function _class(props, context) {
|
|
21179
|
-
_classCallCheck(this, _class);
|
|
21180
|
-
|
|
21181
|
-
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
|
21182
|
-
|
|
21183
|
-
_this.handleRef = function (ref) {
|
|
21184
|
-
_this._ref = ref;
|
|
21185
|
-
};
|
|
21186
|
-
|
|
21187
|
-
_this._element = null;
|
|
21132
|
+
var loadScript = function loadScript(params) {
|
|
21133
|
+
// Ensure that we only attempt to load Stripe.js at most once
|
|
21134
|
+
if (stripePromise !== null) {
|
|
21135
|
+
return stripePromise;
|
|
21136
|
+
}
|
|
21188
21137
|
|
|
21189
|
-
|
|
21190
|
-
|
|
21191
|
-
//
|
|
21192
|
-
|
|
21193
|
-
|
|
21138
|
+
stripePromise = new Promise(function (resolve, reject) {
|
|
21139
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
21140
|
+
// Resolve to null when imported server side. This makes the module
|
|
21141
|
+
// safe to import in an isomorphic code base.
|
|
21142
|
+
resolve(null);
|
|
21143
|
+
return;
|
|
21194
21144
|
}
|
|
21195
21145
|
|
|
21196
|
-
|
|
21197
|
-
|
|
21198
|
-
|
|
21199
|
-
this.context.addElementsLoadListener(function (elements) {
|
|
21200
|
-
if (!_this2._ref) {
|
|
21201
|
-
return;
|
|
21202
|
-
}
|
|
21203
|
-
|
|
21204
|
-
var element = elements.create(type, _this2._options);
|
|
21205
|
-
_this2._element = element;
|
|
21146
|
+
if (window.Stripe && params) {
|
|
21147
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
21148
|
+
}
|
|
21206
21149
|
|
|
21207
|
-
|
|
21150
|
+
if (window.Stripe) {
|
|
21151
|
+
resolve(window.Stripe);
|
|
21152
|
+
return;
|
|
21153
|
+
}
|
|
21208
21154
|
|
|
21209
|
-
|
|
21155
|
+
try {
|
|
21156
|
+
var script = findScript();
|
|
21210
21157
|
|
|
21211
|
-
|
|
21212
|
-
|
|
21213
|
-
})
|
|
21214
|
-
|
|
21158
|
+
if (script && params) {
|
|
21159
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
21160
|
+
} else if (!script) {
|
|
21161
|
+
script = injectScript(params);
|
|
21162
|
+
} else if (script && onLoadListener !== null && onErrorListener !== null) {
|
|
21163
|
+
var _script$parentNode;
|
|
21215
21164
|
|
|
21216
|
-
|
|
21217
|
-
|
|
21218
|
-
|
|
21219
|
-
|
|
21220
|
-
if (this._element) {
|
|
21221
|
-
this._element.update(options);
|
|
21222
|
-
}
|
|
21223
|
-
}
|
|
21224
|
-
};
|
|
21165
|
+
// remove event listeners
|
|
21166
|
+
script.removeEventListener('load', onLoadListener);
|
|
21167
|
+
script.removeEventListener('error', onErrorListener); // if script exists, but we are reloading due to an error,
|
|
21168
|
+
// reload script to trigger 'load' event
|
|
21225
21169
|
|
|
21226
|
-
|
|
21227
|
-
|
|
21228
|
-
var element = this._element;
|
|
21229
|
-
element.destroy();
|
|
21230
|
-
this.context.unregisterElement(element);
|
|
21170
|
+
(_script$parentNode = script.parentNode) === null || _script$parentNode === void 0 ? void 0 : _script$parentNode.removeChild(script);
|
|
21171
|
+
script = injectScript(params);
|
|
21231
21172
|
}
|
|
21232
|
-
};
|
|
21233
|
-
|
|
21234
|
-
_class.prototype._setupEventListeners = function _setupEventListeners(element) {
|
|
21235
|
-
var _this3 = this;
|
|
21236
|
-
|
|
21237
|
-
element.on('ready', function () {
|
|
21238
|
-
_this3.props.onReady(_this3._element);
|
|
21239
|
-
});
|
|
21240
|
-
|
|
21241
|
-
element.on('change', function (change) {
|
|
21242
|
-
_this3.props.onChange(change);
|
|
21243
|
-
});
|
|
21244
|
-
|
|
21245
|
-
element.on('blur', function () {
|
|
21246
|
-
var _props;
|
|
21247
21173
|
|
|
21248
|
-
|
|
21249
|
-
|
|
21250
|
-
|
|
21251
|
-
|
|
21252
|
-
|
|
21253
|
-
|
|
21254
|
-
|
|
21255
|
-
}
|
|
21256
|
-
|
|
21257
|
-
_class.prototype.render = function render() {
|
|
21258
|
-
return _react2.default.createElement('div', {
|
|
21259
|
-
id: this.props.id,
|
|
21260
|
-
className: this.props.className,
|
|
21261
|
-
ref: this.handleRef
|
|
21262
|
-
});
|
|
21263
|
-
};
|
|
21264
|
-
|
|
21265
|
-
return _class;
|
|
21266
|
-
}(_react2.default.Component), _class.propTypes = {
|
|
21267
|
-
id: _propTypes2.default.string,
|
|
21268
|
-
className: _propTypes2.default.string,
|
|
21269
|
-
onChange: _propTypes2.default.func,
|
|
21270
|
-
onBlur: _propTypes2.default.func,
|
|
21271
|
-
onFocus: _propTypes2.default.func,
|
|
21272
|
-
onReady: _propTypes2.default.func
|
|
21273
|
-
}, _class.defaultProps = {
|
|
21274
|
-
id: undefined,
|
|
21275
|
-
className: undefined,
|
|
21276
|
-
onChange: noop,
|
|
21277
|
-
onBlur: noop,
|
|
21278
|
-
onFocus: noop,
|
|
21279
|
-
onReady: noop
|
|
21280
|
-
}, _class.contextTypes = Elements_1.elementContextTypes, _class.displayName = capitalized(type) + 'Element', _temp;
|
|
21281
|
-
};
|
|
21282
|
-
|
|
21283
|
-
exports.default = Element;
|
|
21284
|
-
});
|
|
21285
|
-
|
|
21286
|
-
unwrapExports(Element_1);
|
|
21287
|
-
|
|
21288
|
-
var shallowEqual_1 = createCommonjsModule(function (module, exports) {
|
|
21289
|
-
|
|
21290
|
-
Object.defineProperty(exports, "__esModule", {
|
|
21291
|
-
value: true
|
|
21292
|
-
});
|
|
21293
|
-
var shallowEqual = function shallowEqual(a, b) {
|
|
21294
|
-
var keysA = Object.keys(a);
|
|
21295
|
-
var keysB = Object.keys(b);
|
|
21174
|
+
onLoadListener = onLoad(resolve, reject);
|
|
21175
|
+
onErrorListener = onError(reject);
|
|
21176
|
+
script.addEventListener('load', onLoadListener);
|
|
21177
|
+
script.addEventListener('error', onErrorListener);
|
|
21178
|
+
} catch (error) {
|
|
21179
|
+
reject(error);
|
|
21180
|
+
return;
|
|
21181
|
+
}
|
|
21182
|
+
}); // Resets stripePromise on error
|
|
21296
21183
|
|
|
21297
|
-
return
|
|
21298
|
-
|
|
21184
|
+
return stripePromise["catch"](function (error) {
|
|
21185
|
+
stripePromise = null;
|
|
21186
|
+
return Promise.reject(error);
|
|
21299
21187
|
});
|
|
21300
21188
|
};
|
|
21301
|
-
|
|
21302
|
-
|
|
21303
|
-
|
|
21304
|
-
|
|
21305
|
-
unwrapExports(shallowEqual_1);
|
|
21306
|
-
|
|
21307
|
-
var PaymentRequestButtonElement_1 = createCommonjsModule(function (module, exports) {
|
|
21308
|
-
|
|
21309
|
-
Object.defineProperty(exports, "__esModule", {
|
|
21310
|
-
value: true
|
|
21311
|
-
});
|
|
21312
|
-
|
|
21313
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
21314
|
-
|
|
21315
|
-
|
|
21316
|
-
|
|
21317
|
-
var _react2 = _interopRequireDefault(React__default);
|
|
21318
|
-
|
|
21319
|
-
|
|
21320
|
-
|
|
21321
|
-
var _propTypes2 = _interopRequireDefault(PropTypes);
|
|
21322
|
-
|
|
21323
|
-
|
|
21324
|
-
|
|
21325
|
-
var _shallowEqual2 = _interopRequireDefault(shallowEqual_1);
|
|
21326
|
-
|
|
21327
|
-
|
|
21328
|
-
|
|
21329
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21330
|
-
|
|
21331
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21332
|
-
|
|
21333
|
-
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
21334
|
-
|
|
21335
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
21336
|
-
|
|
21337
|
-
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
21338
|
-
|
|
21339
|
-
var noop = function noop() {};
|
|
21340
|
-
|
|
21341
|
-
var _extractOptions = function _extractOptions(props) {
|
|
21342
|
-
props.id;
|
|
21343
|
-
props.className;
|
|
21344
|
-
props.onBlur;
|
|
21345
|
-
props.onClick;
|
|
21346
|
-
props.onFocus;
|
|
21347
|
-
props.onReady;
|
|
21348
|
-
props.paymentRequest;
|
|
21349
|
-
var options = _objectWithoutProperties(props, ['id', 'className', 'onBlur', 'onClick', 'onFocus', 'onReady', 'paymentRequest']);
|
|
21350
|
-
|
|
21351
|
-
return options;
|
|
21352
|
-
};
|
|
21353
|
-
|
|
21354
|
-
var PaymentRequestButtonElement = function (_React$Component) {
|
|
21355
|
-
_inherits(PaymentRequestButtonElement, _React$Component);
|
|
21356
|
-
|
|
21357
|
-
function PaymentRequestButtonElement(props, context) {
|
|
21358
|
-
_classCallCheck(this, PaymentRequestButtonElement);
|
|
21359
|
-
|
|
21360
|
-
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
|
21361
|
-
|
|
21362
|
-
_this.handleRef = function (ref) {
|
|
21363
|
-
_this._ref = ref;
|
|
21364
|
-
};
|
|
21365
|
-
|
|
21366
|
-
var options = _extractOptions(props);
|
|
21367
|
-
// We keep track of the extracted options on this._options to avoid re-rendering.
|
|
21368
|
-
// (We would unnecessarily re-render if we were tracking them with state.)
|
|
21369
|
-
_this._options = options;
|
|
21370
|
-
return _this;
|
|
21189
|
+
var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
21190
|
+
if (maybeStripe === null) {
|
|
21191
|
+
return null;
|
|
21371
21192
|
}
|
|
21372
21193
|
|
|
21373
|
-
|
|
21374
|
-
|
|
21375
|
-
|
|
21376
|
-
|
|
21377
|
-
_this2._element = elements.create('paymentRequestButton', _extends({
|
|
21378
|
-
paymentRequest: _this2.props.paymentRequest
|
|
21379
|
-
}, _this2._options));
|
|
21380
|
-
_this2._element.on('ready', function () {
|
|
21381
|
-
_this2.props.onReady(_this2._element);
|
|
21382
|
-
});
|
|
21383
|
-
_this2._element.on('focus', function () {
|
|
21384
|
-
var _props;
|
|
21385
|
-
|
|
21386
|
-
return (_props = _this2.props).onFocus.apply(_props, arguments);
|
|
21387
|
-
});
|
|
21388
|
-
_this2._element.on('click', function () {
|
|
21389
|
-
var _props2;
|
|
21390
|
-
|
|
21391
|
-
return (_props2 = _this2.props).onClick.apply(_props2, arguments);
|
|
21392
|
-
});
|
|
21393
|
-
_this2._element.on('blur', function () {
|
|
21394
|
-
var _props3;
|
|
21395
|
-
|
|
21396
|
-
return (_props3 = _this2.props).onBlur.apply(_props3, arguments);
|
|
21397
|
-
});
|
|
21398
|
-
_this2._element.mount(_this2._ref);
|
|
21399
|
-
});
|
|
21400
|
-
};
|
|
21401
|
-
|
|
21402
|
-
PaymentRequestButtonElement.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
21403
|
-
if (this.props.paymentRequest !== prevProps.paymentRequest) {
|
|
21404
|
-
console.warn('Unsupported prop change: paymentRequest is not a customizable property.');
|
|
21405
|
-
}
|
|
21406
|
-
var options = _extractOptions(this.props);
|
|
21407
|
-
if (Object.keys(options).length !== 0 && !(0, _shallowEqual2.default)(options, this._options)) {
|
|
21408
|
-
this._options = options;
|
|
21409
|
-
this._element.update(options);
|
|
21410
|
-
}
|
|
21411
|
-
};
|
|
21412
|
-
|
|
21413
|
-
PaymentRequestButtonElement.prototype.componentWillUnmount = function componentWillUnmount() {
|
|
21414
|
-
this._element.destroy();
|
|
21415
|
-
};
|
|
21416
|
-
|
|
21417
|
-
PaymentRequestButtonElement.prototype.render = function render() {
|
|
21418
|
-
return _react2.default.createElement('div', {
|
|
21419
|
-
id: this.props.id,
|
|
21420
|
-
className: this.props.className,
|
|
21421
|
-
ref: this.handleRef
|
|
21422
|
-
});
|
|
21423
|
-
};
|
|
21424
|
-
|
|
21425
|
-
return PaymentRequestButtonElement;
|
|
21426
|
-
}(_react2.default.Component);
|
|
21427
|
-
|
|
21428
|
-
PaymentRequestButtonElement.propTypes = {
|
|
21429
|
-
id: _propTypes2.default.string,
|
|
21430
|
-
className: _propTypes2.default.string,
|
|
21431
|
-
onBlur: _propTypes2.default.func,
|
|
21432
|
-
onClick: _propTypes2.default.func,
|
|
21433
|
-
onFocus: _propTypes2.default.func,
|
|
21434
|
-
onReady: _propTypes2.default.func,
|
|
21435
|
-
paymentRequest: _propTypes2.default.shape({
|
|
21436
|
-
canMakePayment: _propTypes2.default.func.isRequired,
|
|
21437
|
-
on: _propTypes2.default.func.isRequired,
|
|
21438
|
-
show: _propTypes2.default.func.isRequired
|
|
21439
|
-
}).isRequired
|
|
21440
|
-
};
|
|
21441
|
-
PaymentRequestButtonElement.defaultProps = {
|
|
21442
|
-
id: undefined,
|
|
21443
|
-
className: undefined,
|
|
21444
|
-
onBlur: noop,
|
|
21445
|
-
onClick: noop,
|
|
21446
|
-
onFocus: noop,
|
|
21447
|
-
onReady: noop
|
|
21448
|
-
};
|
|
21449
|
-
PaymentRequestButtonElement.contextTypes = Elements_1.elementContextTypes;
|
|
21450
|
-
exports.default = PaymentRequestButtonElement;
|
|
21451
|
-
});
|
|
21452
|
-
|
|
21453
|
-
unwrapExports(PaymentRequestButtonElement_1);
|
|
21454
|
-
|
|
21455
|
-
var es = createCommonjsModule(function (module, exports) {
|
|
21456
|
-
|
|
21457
|
-
Object.defineProperty(exports, "__esModule", {
|
|
21458
|
-
value: true
|
|
21459
|
-
});
|
|
21460
|
-
exports.AuBankAccountElement = exports.FpxBankElement = exports.IdealBankElement = exports.IbanElement = exports.PaymentRequestButtonElement = exports.CardCVCElement = exports.CardCvcElement = exports.CardExpiryElement = exports.CardNumberElement = exports.CardElement = exports.Elements = exports.injectStripe = exports.StripeProvider = undefined;
|
|
21461
|
-
|
|
21462
|
-
|
|
21463
|
-
|
|
21464
|
-
var _Provider2 = _interopRequireDefault(Provider_1);
|
|
21465
|
-
|
|
21466
|
-
|
|
21467
|
-
|
|
21468
|
-
var _inject2 = _interopRequireDefault(inject_1);
|
|
21469
|
-
|
|
21470
|
-
|
|
21471
|
-
|
|
21472
|
-
var _Elements2 = _interopRequireDefault(Elements_1);
|
|
21473
|
-
|
|
21474
|
-
|
|
21475
|
-
|
|
21476
|
-
var _Element2 = _interopRequireDefault(Element_1);
|
|
21477
|
-
|
|
21478
|
-
|
|
21479
|
-
|
|
21480
|
-
var _PaymentRequestButtonElement2 = _interopRequireDefault(PaymentRequestButtonElement_1);
|
|
21194
|
+
var stripe = maybeStripe.apply(undefined, args);
|
|
21195
|
+
registerWrapper(stripe, startTime);
|
|
21196
|
+
return stripe;
|
|
21197
|
+
}; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
21481
21198
|
|
|
21482
|
-
|
|
21199
|
+
var stripePromise$1;
|
|
21200
|
+
var loadCalled = false;
|
|
21483
21201
|
|
|
21484
|
-
|
|
21485
|
-
|
|
21202
|
+
var getStripePromise = function getStripePromise() {
|
|
21203
|
+
if (stripePromise$1) {
|
|
21204
|
+
return stripePromise$1;
|
|
21205
|
+
}
|
|
21486
21206
|
|
|
21487
|
-
|
|
21488
|
-
|
|
21489
|
-
|
|
21490
|
-
|
|
21491
|
-
|
|
21492
|
-
|
|
21207
|
+
stripePromise$1 = loadScript(null)["catch"](function (error) {
|
|
21208
|
+
// clear cache on error
|
|
21209
|
+
stripePromise$1 = null;
|
|
21210
|
+
return Promise.reject(error);
|
|
21211
|
+
});
|
|
21212
|
+
return stripePromise$1;
|
|
21213
|
+
}; // Execute our own script injection after a tick to give users time to do their
|
|
21214
|
+
// own script injection.
|
|
21493
21215
|
|
|
21494
|
-
// Split Fields
|
|
21495
|
-
// Note: we only register the CardNumberElement for split fields so that we have
|
|
21496
|
-
// a unique Element to infer when calling `wrappedCreateToken` or `wrappedCreateSource`.
|
|
21497
21216
|
|
|
21498
|
-
|
|
21499
|
-
|
|
21500
|
-
|
|
21501
|
-
|
|
21502
|
-
|
|
21503
|
-
|
|
21504
|
-
var CardCvcElement = (0, _Element2.default)('cardCvc');
|
|
21505
|
-
var CardCVCElement = CardCvcElement; // deprecated in favor of CardCvcElement which better matches Elements API
|
|
21506
|
-
|
|
21507
|
-
// IBAN
|
|
21508
|
-
var IbanElement = (0, _Element2.default)('iban', {
|
|
21509
|
-
impliedTokenType: 'bank_account',
|
|
21510
|
-
impliedSourceType: 'sepa_debit'
|
|
21217
|
+
Promise.resolve().then(function () {
|
|
21218
|
+
return getStripePromise();
|
|
21219
|
+
})["catch"](function (error) {
|
|
21220
|
+
if (!loadCalled) {
|
|
21221
|
+
console.warn(error);
|
|
21222
|
+
}
|
|
21511
21223
|
});
|
|
21224
|
+
var loadStripe = function loadStripe() {
|
|
21225
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21226
|
+
args[_key] = arguments[_key];
|
|
21227
|
+
}
|
|
21512
21228
|
|
|
21513
|
-
|
|
21514
|
-
var
|
|
21515
|
-
|
|
21516
|
-
// fpx Bank
|
|
21517
|
-
var FpxBankElement = (0, _Element2.default)('fpxBank');
|
|
21518
|
-
|
|
21519
|
-
// auBankAccount
|
|
21520
|
-
// Requires beta access. Contact Stripe support for more information:
|
|
21521
|
-
// https://support.stripe.com
|
|
21522
|
-
var AuBankAccountElement = (0, _Element2.default)('auBankAccount');
|
|
21523
|
-
|
|
21524
|
-
exports.StripeProvider = _Provider2.default;
|
|
21525
|
-
exports.injectStripe = _inject2.default;
|
|
21526
|
-
exports.Elements = _Elements2.default;
|
|
21527
|
-
exports.CardElement = CardElement;
|
|
21528
|
-
exports.CardNumberElement = CardNumberElement;
|
|
21529
|
-
exports.CardExpiryElement = CardExpiryElement;
|
|
21530
|
-
exports.CardCvcElement = CardCvcElement;
|
|
21531
|
-
exports.CardCVCElement = CardCVCElement;
|
|
21532
|
-
exports.PaymentRequestButtonElement = _PaymentRequestButtonElement2.default;
|
|
21533
|
-
exports.IbanElement = IbanElement;
|
|
21534
|
-
exports.IdealBankElement = IdealBankElement;
|
|
21535
|
-
exports.FpxBankElement = FpxBankElement;
|
|
21536
|
-
exports.AuBankAccountElement = AuBankAccountElement;
|
|
21537
|
-
});
|
|
21229
|
+
loadCalled = true;
|
|
21230
|
+
var startTime = Date.now(); // if previous attempts are unsuccessful, will re-load script
|
|
21538
21231
|
|
|
21539
|
-
|
|
21540
|
-
|
|
21541
|
-
|
|
21542
|
-
|
|
21543
|
-
es.IbanElement;
|
|
21544
|
-
var es_5 = es.PaymentRequestButtonElement;
|
|
21545
|
-
var es_6 = es.CardCVCElement;
|
|
21546
|
-
es.CardCvcElement;
|
|
21547
|
-
var es_8 = es.CardExpiryElement;
|
|
21548
|
-
var es_9 = es.CardNumberElement;
|
|
21549
|
-
es.CardElement;
|
|
21550
|
-
var es_11 = es.Elements;
|
|
21551
|
-
var es_12 = es.injectStripe;
|
|
21552
|
-
var es_13 = es.StripeProvider;
|
|
21232
|
+
return getStripePromise().then(function (maybeStripe) {
|
|
21233
|
+
return initStripe(maybeStripe, args, startTime);
|
|
21234
|
+
});
|
|
21235
|
+
};
|
|
21553
21236
|
|
|
21554
21237
|
/**
|
|
21555
21238
|
* @TODO: All payment related business logic should end up moving
|
|
@@ -21579,7 +21262,7 @@ class Payment {
|
|
|
21579
21262
|
* @param {(StripeGateway|PaypalGateway|VantivGateway|TapGateway|CybersourceGateway)} paymentGateway
|
|
21580
21263
|
*/
|
|
21581
21264
|
constructor(paymentGateway) {
|
|
21582
|
-
_defineProperty$
|
|
21265
|
+
_defineProperty$4(this, "execute", (options, callback) => {
|
|
21583
21266
|
if (!this.paymentGateway) {
|
|
21584
21267
|
callback(_classPrivateFieldGet(this, _generateUserError).call(this), null);
|
|
21585
21268
|
return console.error("No payment gateway provided");
|
|
@@ -21685,7 +21368,7 @@ class StripeGateway {
|
|
|
21685
21368
|
value: PAYMENT_GATEWAYS_ENUM["stripe"]
|
|
21686
21369
|
});
|
|
21687
21370
|
|
|
21688
|
-
_defineProperty$
|
|
21371
|
+
_defineProperty$4(this, "execute", (options, callback) => {
|
|
21689
21372
|
const types = PAYMENT_TYPES;
|
|
21690
21373
|
|
|
21691
21374
|
switch (options.type) {
|
|
@@ -21891,7 +21574,7 @@ class PaypalGateway {
|
|
|
21891
21574
|
value: PAYMENT_GATEWAYS_ENUM["paypal"]
|
|
21892
21575
|
});
|
|
21893
21576
|
|
|
21894
|
-
_defineProperty$
|
|
21577
|
+
_defineProperty$4(this, "execute", (options, callback) => {
|
|
21895
21578
|
const types = PAYMENT_TYPES;
|
|
21896
21579
|
|
|
21897
21580
|
switch (options.type) {
|
|
@@ -22008,7 +21691,7 @@ class VantivGateway {
|
|
|
22008
21691
|
value: PAYMENT_GATEWAYS_ENUM["vantiv"]
|
|
22009
21692
|
});
|
|
22010
21693
|
|
|
22011
|
-
_defineProperty$
|
|
21694
|
+
_defineProperty$4(this, "execute", (options, callback) => {
|
|
22012
21695
|
const types = PAYMENT_TYPES;
|
|
22013
21696
|
|
|
22014
21697
|
switch (options.type) {
|
|
@@ -22243,7 +21926,7 @@ class TapGateway {
|
|
|
22243
21926
|
value: PAYMENT_GATEWAYS_ENUM["tap"]
|
|
22244
21927
|
});
|
|
22245
21928
|
|
|
22246
|
-
_defineProperty$
|
|
21929
|
+
_defineProperty$4(this, "execute", (options, callback) => {
|
|
22247
21930
|
const types = PAYMENT_TYPES;
|
|
22248
21931
|
|
|
22249
21932
|
switch (options.type) {
|
|
@@ -22481,7 +22164,7 @@ class CybersourceGateway {
|
|
|
22481
22164
|
value: PAYMENT_GATEWAYS_ENUM["cybersource"]
|
|
22482
22165
|
});
|
|
22483
22166
|
|
|
22484
|
-
_defineProperty$
|
|
22167
|
+
_defineProperty$4(this, "execute", (options, callback) => {
|
|
22485
22168
|
const types = PAYMENT_TYPES;
|
|
22486
22169
|
|
|
22487
22170
|
switch (options.type) {
|
|
@@ -22755,7 +22438,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
22755
22438
|
style,
|
|
22756
22439
|
className = "",
|
|
22757
22440
|
children,
|
|
22758
|
-
stripe,
|
|
22759
22441
|
type,
|
|
22760
22442
|
onSuccess = () => {},
|
|
22761
22443
|
onGiftRenewalSuccess = () => {},
|
|
@@ -22764,6 +22446,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
22764
22446
|
}) => {
|
|
22765
22447
|
var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice, _window$Pelcro, _window$Pelcro$uiSett;
|
|
22766
22448
|
|
|
22449
|
+
// Get a reference to Stripe or Elements using hooks.
|
|
22450
|
+
const stripe = useStripe();
|
|
22451
|
+
const elements = useElements();
|
|
22767
22452
|
const [vantivPaymentRequest, setVantivPaymentRequest] = useState(null);
|
|
22768
22453
|
const [updatedCouponCode, setUpdatedCouponCode] = useState("");
|
|
22769
22454
|
const {
|
|
@@ -22808,7 +22493,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
22808
22493
|
type: INIT_CONTAINER
|
|
22809
22494
|
});
|
|
22810
22495
|
updateTotalAmountWithTax();
|
|
22811
|
-
}, []);
|
|
22496
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
22497
|
+
|
|
22812
22498
|
/* ====== Start Cybersource integration ======== */
|
|
22813
22499
|
|
|
22814
22500
|
const cybersourceErrorHandle = err => {
|
|
@@ -23073,6 +22759,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23073
22759
|
const {
|
|
23074
22760
|
key: jwk
|
|
23075
22761
|
} = res; // SETUP MICROFORM
|
|
22762
|
+
// eslint-disable-next-line no-undef
|
|
23076
22763
|
|
|
23077
22764
|
FLEX.microform({
|
|
23078
22765
|
keyId: jwk.kid,
|
|
@@ -23742,13 +23429,15 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23742
23429
|
}
|
|
23743
23430
|
});
|
|
23744
23431
|
}
|
|
23745
|
-
}, [selectedPaymentMethodId]); //
|
|
23432
|
+
}, [selectedPaymentMethodId]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
23433
|
+
// Trigger the handleVantivPayment method when a vantivPaymentRequest is present
|
|
23746
23434
|
|
|
23747
23435
|
useEffect(() => {
|
|
23748
23436
|
if (vantivPaymentRequest) {
|
|
23749
23437
|
handleVantivPayment(vantivPaymentRequest, updatedCouponCode);
|
|
23750
23438
|
}
|
|
23751
|
-
}, [vantivPaymentRequest]);
|
|
23439
|
+
}, [vantivPaymentRequest]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
23440
|
+
|
|
23752
23441
|
useEffect(() => {
|
|
23753
23442
|
whenUserReady(() => {
|
|
23754
23443
|
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
@@ -23780,7 +23469,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23780
23469
|
appendCybersourceFingerprintScripts();
|
|
23781
23470
|
}
|
|
23782
23471
|
});
|
|
23783
|
-
}, [selectedPaymentMethodId]);
|
|
23472
|
+
}, [selectedPaymentMethodId]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
23473
|
+
|
|
23474
|
+
/* ====== Start Stripe integration ======== */
|
|
23784
23475
|
|
|
23785
23476
|
const initPaymentRequest = (state, dispatch) => {
|
|
23786
23477
|
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
@@ -23848,257 +23539,16 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23848
23539
|
console.log("Google Pay/Apple pay isn't available/supported in this country");
|
|
23849
23540
|
}
|
|
23850
23541
|
};
|
|
23851
|
-
/**
|
|
23852
|
-
* Updates the total amount after adding taxes only if site taxes are enabled
|
|
23853
|
-
*/
|
|
23854
|
-
|
|
23855
|
-
|
|
23856
|
-
const updateTotalAmountWithTax = () => {
|
|
23857
|
-
var _window$Pelcro$site$r8;
|
|
23858
|
-
|
|
23859
|
-
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
23860
|
-
const taxesEnabled = (_window$Pelcro$site$r8 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r8 === void 0 ? void 0 : _window$Pelcro$site$r8.taxes_enabled;
|
|
23861
|
-
|
|
23862
|
-
if (taxesEnabled && type === "createPayment") {
|
|
23863
|
-
dispatch({
|
|
23864
|
-
type: DISABLE_SUBMIT,
|
|
23865
|
-
payload: true
|
|
23866
|
-
});
|
|
23867
|
-
resolveTaxCalculation().then(res => {
|
|
23868
|
-
if (res) {
|
|
23869
|
-
dispatch({
|
|
23870
|
-
type: SET_TAX_AMOUNT,
|
|
23871
|
-
payload: res.taxAmount
|
|
23872
|
-
});
|
|
23873
|
-
dispatch({
|
|
23874
|
-
type: SET_UPDATED_PRICE,
|
|
23875
|
-
payload: res.totalAmountWithTax
|
|
23876
|
-
});
|
|
23877
|
-
dispatch({
|
|
23878
|
-
type: UPDATE_PAYMENT_REQUEST
|
|
23879
|
-
});
|
|
23880
|
-
}
|
|
23881
|
-
}).catch(error => {
|
|
23882
|
-
handlePaymentError(error);
|
|
23883
|
-
}).finally(() => {
|
|
23884
|
-
dispatch({
|
|
23885
|
-
type: DISABLE_SUBMIT,
|
|
23886
|
-
payload: false
|
|
23887
|
-
});
|
|
23888
|
-
});
|
|
23889
|
-
}
|
|
23890
|
-
};
|
|
23891
|
-
|
|
23892
|
-
const onApplyCouponCode = (state, dispatch) => {
|
|
23893
|
-
const {
|
|
23894
|
-
couponCode
|
|
23895
|
-
} = state;
|
|
23896
|
-
|
|
23897
|
-
const handleCouponResponse = (err, res) => {
|
|
23898
|
-
var _res$data$coupon;
|
|
23899
|
-
|
|
23900
|
-
dispatch({
|
|
23901
|
-
type: DISABLE_COUPON_BUTTON,
|
|
23902
|
-
payload: false
|
|
23903
|
-
});
|
|
23904
|
-
|
|
23905
|
-
if (err) {
|
|
23906
|
-
onFailure(err); // reset the coupon code in local state
|
|
23907
|
-
|
|
23908
|
-
setUpdatedCouponCode("");
|
|
23909
|
-
dispatch({
|
|
23910
|
-
type: SET_COUPON_ERROR,
|
|
23911
|
-
payload: getErrorMessages(err)
|
|
23912
|
-
}); // remove current coupon
|
|
23913
|
-
|
|
23914
|
-
dispatch({
|
|
23915
|
-
type: SET_COUPON,
|
|
23916
|
-
payload: null
|
|
23917
|
-
});
|
|
23918
|
-
dispatch({
|
|
23919
|
-
type: SET_PERCENT_OFF,
|
|
23920
|
-
payload: ""
|
|
23921
|
-
});
|
|
23922
|
-
dispatch({
|
|
23923
|
-
type: SET_UPDATED_PRICE,
|
|
23924
|
-
payload: null
|
|
23925
|
-
});
|
|
23926
|
-
dispatch({
|
|
23927
|
-
type: SET_TAX_AMOUNT,
|
|
23928
|
-
payload: null
|
|
23929
|
-
});
|
|
23930
|
-
const {
|
|
23931
|
-
currentPlan
|
|
23932
|
-
} = state;
|
|
23933
|
-
|
|
23934
|
-
if (currentPlan) {
|
|
23935
|
-
var _currentPlan$quantity;
|
|
23936
|
-
|
|
23937
|
-
const quantity = (_currentPlan$quantity = currentPlan.quantity) !== null && _currentPlan$quantity !== void 0 ? _currentPlan$quantity : 1;
|
|
23938
|
-
const price = currentPlan.amount;
|
|
23939
|
-
dispatch({
|
|
23940
|
-
type: SET_UPDATED_PRICE,
|
|
23941
|
-
// set original plan price
|
|
23942
|
-
payload: price * quantity
|
|
23943
|
-
});
|
|
23944
|
-
dispatch({
|
|
23945
|
-
type: UPDATE_PAYMENT_REQUEST
|
|
23946
|
-
}); // update the new amount with taxes if site has taxes enabled
|
|
23947
|
-
|
|
23948
|
-
updateTotalAmountWithTax();
|
|
23949
|
-
}
|
|
23950
|
-
|
|
23951
|
-
return;
|
|
23952
|
-
}
|
|
23953
|
-
|
|
23954
|
-
dispatch({
|
|
23955
|
-
type: SET_COUPON_ERROR,
|
|
23956
|
-
payload: ""
|
|
23957
|
-
});
|
|
23958
|
-
dispatch({
|
|
23959
|
-
type: SHOW_ALERT,
|
|
23960
|
-
payload: {
|
|
23961
|
-
type: "error",
|
|
23962
|
-
content: ""
|
|
23963
|
-
}
|
|
23964
|
-
});
|
|
23965
|
-
dispatch({
|
|
23966
|
-
type: SET_COUPON,
|
|
23967
|
-
payload: res.data.coupon
|
|
23968
|
-
}); // set the coupon code in local state to be able to use with Vantiv
|
|
23969
|
-
|
|
23970
|
-
setUpdatedCouponCode(res.data.coupon.code);
|
|
23971
|
-
dispatch({
|
|
23972
|
-
type: SET_PERCENT_OFF,
|
|
23973
|
-
payload: `${(_res$data$coupon = res.data.coupon) === null || _res$data$coupon === void 0 ? void 0 : _res$data$coupon.percent_off}%`
|
|
23974
|
-
});
|
|
23975
|
-
dispatch({
|
|
23976
|
-
type: SET_TAX_AMOUNT,
|
|
23977
|
-
payload: res.data.taxes
|
|
23978
|
-
});
|
|
23979
|
-
dispatch({
|
|
23980
|
-
type: SET_UPDATED_PRICE,
|
|
23981
|
-
payload: res.data.total
|
|
23982
|
-
});
|
|
23983
|
-
dispatch({
|
|
23984
|
-
type: UPDATE_PAYMENT_REQUEST
|
|
23985
|
-
});
|
|
23986
|
-
};
|
|
23987
|
-
|
|
23988
|
-
if ((couponCode === null || couponCode === void 0 ? void 0 : couponCode.trim()) === "") {
|
|
23989
|
-
dispatch({
|
|
23990
|
-
type: SET_COUPON,
|
|
23991
|
-
payload: null
|
|
23992
|
-
});
|
|
23993
|
-
dispatch({
|
|
23994
|
-
type: SET_PERCENT_OFF,
|
|
23995
|
-
payload: ""
|
|
23996
|
-
});
|
|
23997
|
-
dispatch({
|
|
23998
|
-
type: SET_UPDATED_PRICE,
|
|
23999
|
-
payload: null
|
|
24000
|
-
});
|
|
24001
|
-
dispatch({
|
|
24002
|
-
type: SET_TAX_AMOUNT,
|
|
24003
|
-
payload: null
|
|
24004
|
-
});
|
|
24005
|
-
dispatch({
|
|
24006
|
-
type: UPDATE_PAYMENT_REQUEST
|
|
24007
|
-
});
|
|
24008
|
-
updateTotalAmountWithTax();
|
|
24009
|
-
}
|
|
24010
|
-
|
|
24011
|
-
if (couponCode !== null && couponCode !== void 0 && couponCode.trim()) {
|
|
24012
|
-
dispatch({
|
|
24013
|
-
type: DISABLE_COUPON_BUTTON,
|
|
24014
|
-
payload: true
|
|
24015
|
-
});
|
|
24016
|
-
|
|
24017
|
-
if (type === "createPayment") {
|
|
24018
|
-
window.Pelcro.order.create({
|
|
24019
|
-
auth_token: window.Pelcro.user.read().auth_token,
|
|
24020
|
-
plan_id: plan.id,
|
|
24021
|
-
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
24022
|
-
coupon_code: couponCode,
|
|
24023
|
-
address_id: selectedAddressId
|
|
24024
|
-
}, handleCouponResponse);
|
|
24025
|
-
} else if (type === "orderCreate") {
|
|
24026
|
-
const isQuickPurchase = !Array.isArray(order);
|
|
24027
|
-
const mappedOrderItems = isQuickPurchase ? [{
|
|
24028
|
-
sku_id: order.id,
|
|
24029
|
-
quantity: order.quantity
|
|
24030
|
-
}] : order.map(item => ({
|
|
24031
|
-
sku_id: item.id,
|
|
24032
|
-
quantity: item.quantity
|
|
24033
|
-
}));
|
|
24034
|
-
window.Pelcro.ecommerce.order.createSummary({
|
|
24035
|
-
items: mappedOrderItems,
|
|
24036
|
-
coupon_code: couponCode
|
|
24037
|
-
}, handleCouponResponse);
|
|
24038
|
-
}
|
|
24039
|
-
}
|
|
24040
|
-
};
|
|
24041
|
-
|
|
24042
|
-
const debouncedApplyCouponCode = useRef(debounce$1(onApplyCouponCode, 1000)).current;
|
|
24043
|
-
|
|
24044
|
-
const removeAppliedCoupon = state => {
|
|
24045
|
-
state.couponCode = ""; // reset the coupon code in local state
|
|
24046
|
-
|
|
24047
|
-
setUpdatedCouponCode("");
|
|
24048
|
-
dispatch({
|
|
24049
|
-
type: SET_COUPON_ERROR,
|
|
24050
|
-
payload: ""
|
|
24051
|
-
});
|
|
24052
|
-
dispatch({
|
|
24053
|
-
type: SHOW_COUPON_FIELD,
|
|
24054
|
-
payload: false
|
|
24055
|
-
});
|
|
24056
|
-
dispatch({
|
|
24057
|
-
type: SET_COUPON,
|
|
24058
|
-
payload: null
|
|
24059
|
-
});
|
|
24060
|
-
dispatch({
|
|
24061
|
-
type: SET_PERCENT_OFF,
|
|
24062
|
-
payload: ""
|
|
24063
|
-
});
|
|
24064
|
-
dispatch({
|
|
24065
|
-
type: SET_UPDATED_PRICE,
|
|
24066
|
-
payload: null
|
|
24067
|
-
});
|
|
24068
|
-
dispatch({
|
|
24069
|
-
type: SET_TAX_AMOUNT,
|
|
24070
|
-
payload: null
|
|
24071
|
-
});
|
|
24072
|
-
const {
|
|
24073
|
-
currentPlan
|
|
24074
|
-
} = state;
|
|
24075
|
-
|
|
24076
|
-
if (currentPlan) {
|
|
24077
|
-
var _currentPlan$quantity2;
|
|
24078
|
-
|
|
24079
|
-
const quantity = (_currentPlan$quantity2 = currentPlan.quantity) !== null && _currentPlan$quantity2 !== void 0 ? _currentPlan$quantity2 : 1;
|
|
24080
|
-
const price = currentPlan.amount;
|
|
24081
|
-
dispatch({
|
|
24082
|
-
type: SET_UPDATED_PRICE,
|
|
24083
|
-
// set original plan price
|
|
24084
|
-
payload: price * quantity
|
|
24085
|
-
});
|
|
24086
|
-
dispatch({
|
|
24087
|
-
type: UPDATE_PAYMENT_REQUEST
|
|
24088
|
-
}); // update the new amount with taxes if site has taxes enabled
|
|
24089
|
-
|
|
24090
|
-
updateTotalAmountWithTax();
|
|
24091
|
-
}
|
|
24092
|
-
};
|
|
24093
23542
|
/**
|
|
24094
23543
|
* Attempt to confirm a Stripe card payment via it's PaymentIntent.
|
|
24095
23544
|
* Only trigger method if PaymentIntent status is `requires_action`.
|
|
24096
23545
|
*
|
|
24097
23546
|
* @see https://stripe.com/docs/payments/intents#intent-statuses
|
|
24098
23547
|
*
|
|
24099
|
-
* @param response
|
|
24100
|
-
* @param error
|
|
24101
|
-
* @
|
|
23548
|
+
* @param {Object} response
|
|
23549
|
+
* @param {Object} error
|
|
23550
|
+
* @param {boolean} isSubCreate
|
|
23551
|
+
* @return {*}
|
|
24102
23552
|
*/
|
|
24103
23553
|
|
|
24104
23554
|
|
|
@@ -24403,90 +23853,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24403
23853
|
|
|
24404
23854
|
return false;
|
|
24405
23855
|
};
|
|
24406
|
-
/**
|
|
24407
|
-
* Handles subscriptions from PayPal gateway
|
|
24408
|
-
* @param {PaymentStateType} state
|
|
24409
|
-
* @param {string} paypalNonce
|
|
24410
|
-
* @return {void}
|
|
24411
|
-
*/
|
|
24412
|
-
|
|
24413
|
-
|
|
24414
|
-
const handlePaypalSubscription = (state, paypalNonce) => {
|
|
24415
|
-
const payment = new Payment(new PaypalGateway());
|
|
24416
|
-
const {
|
|
24417
|
-
couponCode
|
|
24418
|
-
} = state;
|
|
24419
|
-
/**
|
|
24420
|
-
* @TODO: Add flags for types instead of testing by properties
|
|
24421
|
-
*/
|
|
24422
|
-
|
|
24423
|
-
if (giftRecipient) {
|
|
24424
|
-
return payment.execute({
|
|
24425
|
-
type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
|
|
24426
|
-
token: paypalNonce,
|
|
24427
|
-
quantity: plan.quantity,
|
|
24428
|
-
plan,
|
|
24429
|
-
couponCode,
|
|
24430
|
-
product,
|
|
24431
|
-
giftRecipient,
|
|
24432
|
-
addressId: selectedAddressId
|
|
24433
|
-
}, (err, res) => {
|
|
24434
|
-
dispatch({
|
|
24435
|
-
type: DISABLE_SUBMIT,
|
|
24436
|
-
payload: false
|
|
24437
|
-
});
|
|
24438
|
-
dispatch({
|
|
24439
|
-
type: LOADING,
|
|
24440
|
-
payload: false
|
|
24441
|
-
});
|
|
24442
|
-
|
|
24443
|
-
if (err) {
|
|
24444
|
-
onFailure(err);
|
|
24445
|
-
return dispatch({
|
|
24446
|
-
type: SHOW_ALERT,
|
|
24447
|
-
payload: {
|
|
24448
|
-
type: "error",
|
|
24449
|
-
content: getErrorMessages(err)
|
|
24450
|
-
}
|
|
24451
|
-
});
|
|
24452
|
-
}
|
|
24453
|
-
|
|
24454
|
-
onSuccess(res);
|
|
24455
|
-
});
|
|
24456
|
-
}
|
|
24457
|
-
|
|
24458
|
-
return payment.execute({
|
|
24459
|
-
type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
|
|
24460
|
-
token: paypalNonce,
|
|
24461
|
-
quantity: plan.quantity,
|
|
24462
|
-
plan,
|
|
24463
|
-
couponCode,
|
|
24464
|
-
product,
|
|
24465
|
-
addressId: selectedAddressId
|
|
24466
|
-
}, (err, res) => {
|
|
24467
|
-
dispatch({
|
|
24468
|
-
type: DISABLE_SUBMIT,
|
|
24469
|
-
payload: false
|
|
24470
|
-
});
|
|
24471
|
-
dispatch({
|
|
24472
|
-
type: LOADING,
|
|
24473
|
-
payload: false
|
|
24474
|
-
});
|
|
24475
|
-
|
|
24476
|
-
if (err) {
|
|
24477
|
-
onFailure(err);
|
|
24478
|
-
return dispatch({
|
|
24479
|
-
type: SHOW_ALERT,
|
|
24480
|
-
payload: {
|
|
24481
|
-
type: "error",
|
|
24482
|
-
content: getErrorMessages(err)
|
|
24483
|
-
}
|
|
24484
|
-
});
|
|
24485
|
-
}
|
|
24486
|
-
|
|
24487
|
-
onSuccess(res);
|
|
24488
|
-
});
|
|
24489
|
-
};
|
|
24490
23856
|
|
|
24491
23857
|
const purchase = (gatewayService, gatewayToken, state, dispatch) => {
|
|
24492
23858
|
const isQuickPurchase = !Array.isArray(order);
|
|
@@ -24583,67 +23949,73 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24583
23949
|
});
|
|
24584
23950
|
};
|
|
24585
23951
|
|
|
24586
|
-
const createPaymentSource = (state, dispatch) => {
|
|
24587
|
-
|
|
24588
|
-
|
|
24589
|
-
|
|
24590
|
-
|
|
24591
|
-
error
|
|
24592
|
-
}) => {
|
|
24593
|
-
if (error) {
|
|
24594
|
-
return handlePaymentError(error);
|
|
24595
|
-
} // We don't support source creation for 3D secure yet
|
|
24596
|
-
// if (source?.card?.three_d_secure === "required") {
|
|
24597
|
-
// return handlePaymentError({
|
|
24598
|
-
// error: {
|
|
24599
|
-
// message: t("messages.cardAuthNotSupported")
|
|
24600
|
-
// }
|
|
24601
|
-
// });
|
|
24602
|
-
// }
|
|
23952
|
+
const createPaymentSource = async (state, dispatch) => {
|
|
23953
|
+
// Trigger form validation and wallet collection
|
|
23954
|
+
const {
|
|
23955
|
+
error: submitError
|
|
23956
|
+
} = await elements.submit();
|
|
24603
23957
|
|
|
23958
|
+
if (submitError) {
|
|
23959
|
+
handlePaymentError(submitError);
|
|
23960
|
+
return;
|
|
23961
|
+
}
|
|
24604
23962
|
|
|
24605
|
-
|
|
24606
|
-
|
|
24607
|
-
|
|
24608
|
-
|
|
24609
|
-
|
|
23963
|
+
return stripe.createPaymentMethod({
|
|
23964
|
+
elements
|
|
23965
|
+
}).then(result => {
|
|
23966
|
+
if (result.error) {
|
|
23967
|
+
return handlePaymentError(result.error);
|
|
23968
|
+
}
|
|
24610
23969
|
|
|
24611
|
-
|
|
24612
|
-
|
|
24613
|
-
|
|
24614
|
-
|
|
24615
|
-
|
|
24616
|
-
|
|
24617
|
-
|
|
24618
|
-
payload: false
|
|
24619
|
-
});
|
|
24620
|
-
onFailure(err);
|
|
24621
|
-
return dispatch({
|
|
24622
|
-
type: SHOW_ALERT,
|
|
24623
|
-
payload: {
|
|
24624
|
-
type: "error",
|
|
24625
|
-
content: getErrorMessages(err)
|
|
24626
|
-
}
|
|
24627
|
-
});
|
|
24628
|
-
}
|
|
23970
|
+
if (result.paymentMethod) {
|
|
23971
|
+
console.log(result.paymentMethod);
|
|
23972
|
+
window.Pelcro.paymentMethods.create({
|
|
23973
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
23974
|
+
token: result.paymentMethod.id
|
|
23975
|
+
}, (err, res) => {
|
|
23976
|
+
var _res$data, _res$data$setup_inten, _res$data2, _res$data2$setup_inte;
|
|
24629
23977
|
|
|
24630
|
-
|
|
24631
|
-
|
|
24632
|
-
|
|
24633
|
-
|
|
24634
|
-
|
|
24635
|
-
|
|
24636
|
-
|
|
24637
|
-
|
|
24638
|
-
|
|
24639
|
-
|
|
24640
|
-
|
|
24641
|
-
|
|
24642
|
-
|
|
24643
|
-
|
|
24644
|
-
|
|
24645
|
-
|
|
24646
|
-
|
|
23978
|
+
if (err) {
|
|
23979
|
+
dispatch({
|
|
23980
|
+
type: DISABLE_SUBMIT,
|
|
23981
|
+
payload: false
|
|
23982
|
+
});
|
|
23983
|
+
dispatch({
|
|
23984
|
+
type: LOADING,
|
|
23985
|
+
payload: false
|
|
23986
|
+
});
|
|
23987
|
+
onFailure(err);
|
|
23988
|
+
return dispatch({
|
|
23989
|
+
type: SHOW_ALERT,
|
|
23990
|
+
payload: {
|
|
23991
|
+
type: "error",
|
|
23992
|
+
content: getErrorMessages(err)
|
|
23993
|
+
}
|
|
23994
|
+
});
|
|
23995
|
+
}
|
|
23996
|
+
|
|
23997
|
+
if (result.paymentMethod.type == "bacs_debit") {
|
|
23998
|
+
createBillingAddress(result.paymentMethod.billing_details);
|
|
23999
|
+
}
|
|
24000
|
+
|
|
24001
|
+
if (((_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$setup_inten = _res$data.setup_intent) === null || _res$data$setup_inten === void 0 ? void 0 : _res$data$setup_inten.status) === "requires_action" || ((_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : (_res$data2$setup_inte = _res$data2.setup_intent) === null || _res$data2$setup_inte === void 0 ? void 0 : _res$data2$setup_inte.status) === "requires_confirmation") {
|
|
24002
|
+
confirmStripeIntentSetup(res, "create");
|
|
24003
|
+
} else {
|
|
24004
|
+
dispatch({
|
|
24005
|
+
type: LOADING,
|
|
24006
|
+
payload: false
|
|
24007
|
+
});
|
|
24008
|
+
dispatch({
|
|
24009
|
+
type: SHOW_ALERT,
|
|
24010
|
+
payload: {
|
|
24011
|
+
type: "success",
|
|
24012
|
+
content: t("messages.sourceCreated")
|
|
24013
|
+
}
|
|
24014
|
+
});
|
|
24015
|
+
onSuccess(res);
|
|
24016
|
+
}
|
|
24017
|
+
});
|
|
24018
|
+
}
|
|
24647
24019
|
});
|
|
24648
24020
|
};
|
|
24649
24021
|
|
|
@@ -24701,78 +24073,83 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24701
24073
|
});
|
|
24702
24074
|
};
|
|
24703
24075
|
|
|
24704
|
-
const replacePaymentSource = (state, dispatch) => {
|
|
24076
|
+
const replacePaymentSource = async (state, dispatch) => {
|
|
24705
24077
|
const {
|
|
24706
24078
|
id: paymentMethodId
|
|
24707
|
-
} = paymentMethodToDelete;
|
|
24708
|
-
return stripe.createSource({
|
|
24709
|
-
type: "card"
|
|
24710
|
-
}).then(({
|
|
24711
|
-
source,
|
|
24712
|
-
error
|
|
24713
|
-
}) => {
|
|
24714
|
-
if (error) {
|
|
24715
|
-
return handlePaymentError(error);
|
|
24716
|
-
} // We don't support source creation for 3D secure yet
|
|
24717
|
-
// if (source?.card?.three_d_secure === "required") {
|
|
24718
|
-
// return handlePaymentError({
|
|
24719
|
-
// error: {
|
|
24720
|
-
// message: t("messages.cardAuthNotSupported")
|
|
24721
|
-
// }
|
|
24722
|
-
// });
|
|
24723
|
-
// }
|
|
24079
|
+
} = paymentMethodToDelete; // Trigger form validation and wallet collection
|
|
24724
24080
|
|
|
24081
|
+
const {
|
|
24082
|
+
error: submitError
|
|
24083
|
+
} = await elements.submit();
|
|
24725
24084
|
|
|
24726
|
-
|
|
24727
|
-
|
|
24728
|
-
|
|
24729
|
-
|
|
24730
|
-
var _res$data5, _res$data5$setup_inte, _res$data6, _res$data6$setup_inte;
|
|
24085
|
+
if (submitError) {
|
|
24086
|
+
handlePaymentError(submitError);
|
|
24087
|
+
return;
|
|
24088
|
+
}
|
|
24731
24089
|
|
|
24732
|
-
|
|
24733
|
-
|
|
24734
|
-
|
|
24735
|
-
|
|
24736
|
-
|
|
24737
|
-
|
|
24738
|
-
content: getErrorMessages(err)
|
|
24739
|
-
}
|
|
24740
|
-
});
|
|
24741
|
-
}
|
|
24090
|
+
return stripe.createPaymentMethod({
|
|
24091
|
+
elements
|
|
24092
|
+
}).then(result => {
|
|
24093
|
+
if (result.error) {
|
|
24094
|
+
return handlePaymentError(result.error);
|
|
24095
|
+
}
|
|
24742
24096
|
|
|
24743
|
-
|
|
24744
|
-
|
|
24745
|
-
|
|
24746
|
-
|
|
24747
|
-
|
|
24748
|
-
|
|
24749
|
-
payment_method_id: paymentMethodId
|
|
24750
|
-
}, (err, res) => {
|
|
24751
|
-
dispatch({
|
|
24752
|
-
type: DISABLE_SUBMIT,
|
|
24753
|
-
payload: false
|
|
24754
|
-
});
|
|
24755
|
-
dispatch({
|
|
24756
|
-
type: LOADING,
|
|
24757
|
-
payload: false
|
|
24758
|
-
});
|
|
24097
|
+
if (result.paymentMethod) {
|
|
24098
|
+
window.Pelcro.paymentMethods.create({
|
|
24099
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
24100
|
+
token: result.paymentMethod.id
|
|
24101
|
+
}, (err, res) => {
|
|
24102
|
+
var _res$data5, _res$data5$setup_inte, _res$data6, _res$data6$setup_inte;
|
|
24759
24103
|
|
|
24760
|
-
|
|
24761
|
-
|
|
24762
|
-
|
|
24763
|
-
|
|
24764
|
-
|
|
24765
|
-
|
|
24766
|
-
|
|
24767
|
-
}
|
|
24768
|
-
});
|
|
24104
|
+
if (err) {
|
|
24105
|
+
onFailure(err);
|
|
24106
|
+
return dispatch({
|
|
24107
|
+
type: SHOW_ALERT,
|
|
24108
|
+
payload: {
|
|
24109
|
+
type: "error",
|
|
24110
|
+
content: getErrorMessages(err)
|
|
24769
24111
|
}
|
|
24770
|
-
|
|
24771
|
-
onSuccess(res);
|
|
24772
24112
|
});
|
|
24773
|
-
}
|
|
24774
|
-
|
|
24775
|
-
|
|
24113
|
+
}
|
|
24114
|
+
|
|
24115
|
+
if (result.paymentMethod.type == "bacs_debit") {
|
|
24116
|
+
createBillingAddress(result.paymentMethod.billing_details);
|
|
24117
|
+
}
|
|
24118
|
+
|
|
24119
|
+
if (((_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : (_res$data5$setup_inte = _res$data5.setup_intent) === null || _res$data5$setup_inte === void 0 ? void 0 : _res$data5$setup_inte.status) === "requires_action" || ((_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : (_res$data6$setup_inte = _res$data6.setup_intent) === null || _res$data6$setup_inte === void 0 ? void 0 : _res$data6$setup_inte.status) === "requires_confirmation") {
|
|
24120
|
+
confirmStripeIntentSetup(res, "replace", paymentMethodId);
|
|
24121
|
+
} else {
|
|
24122
|
+
setTimeout(() => {
|
|
24123
|
+
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
24124
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
24125
|
+
payment_method_id: paymentMethodId
|
|
24126
|
+
}, (err, res) => {
|
|
24127
|
+
dispatch({
|
|
24128
|
+
type: DISABLE_SUBMIT,
|
|
24129
|
+
payload: false
|
|
24130
|
+
});
|
|
24131
|
+
dispatch({
|
|
24132
|
+
type: LOADING,
|
|
24133
|
+
payload: false
|
|
24134
|
+
});
|
|
24135
|
+
|
|
24136
|
+
if (err) {
|
|
24137
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
24138
|
+
return dispatch({
|
|
24139
|
+
type: SHOW_ALERT,
|
|
24140
|
+
payload: {
|
|
24141
|
+
type: "error",
|
|
24142
|
+
content: getErrorMessages(err)
|
|
24143
|
+
}
|
|
24144
|
+
});
|
|
24145
|
+
}
|
|
24146
|
+
|
|
24147
|
+
onSuccess(res);
|
|
24148
|
+
});
|
|
24149
|
+
}, 2000);
|
|
24150
|
+
}
|
|
24151
|
+
});
|
|
24152
|
+
}
|
|
24776
24153
|
});
|
|
24777
24154
|
};
|
|
24778
24155
|
|
|
@@ -24787,7 +24164,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24787
24164
|
});
|
|
24788
24165
|
};
|
|
24789
24166
|
|
|
24790
|
-
const submitPayment = (state, dispatch) => {
|
|
24167
|
+
const submitPayment = async (state, dispatch) => {
|
|
24791
24168
|
if (skipPayment && props !== null && props !== void 0 && props.freeOrders) {
|
|
24792
24169
|
const isQuickPurchase = !Array.isArray(order);
|
|
24793
24170
|
const mappedOrderItems = isQuickPurchase ? [{
|
|
@@ -24811,88 +24188,116 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24811
24188
|
return onSuccess(res);
|
|
24812
24189
|
});
|
|
24813
24190
|
return;
|
|
24814
|
-
}
|
|
24191
|
+
} // Trigger form validation and wallet collection
|
|
24815
24192
|
|
|
24816
|
-
stripe.createSource({
|
|
24817
|
-
type: "card"
|
|
24818
|
-
}).then(({
|
|
24819
|
-
source,
|
|
24820
|
-
error
|
|
24821
|
-
}) => {
|
|
24822
|
-
var _ref4, _ref5, _state$updatedPrice2;
|
|
24823
|
-
|
|
24824
|
-
if (error) {
|
|
24825
|
-
return handlePaymentError(error);
|
|
24826
|
-
}
|
|
24827
24193
|
|
|
24828
|
-
|
|
24829
|
-
|
|
24830
|
-
|
|
24831
|
-
}
|
|
24194
|
+
const {
|
|
24195
|
+
error: submitError
|
|
24196
|
+
} = await elements.submit();
|
|
24832
24197
|
|
|
24833
|
-
|
|
24198
|
+
if (submitError) {
|
|
24199
|
+
handlePaymentError(submitError);
|
|
24200
|
+
return;
|
|
24201
|
+
}
|
|
24834
24202
|
|
|
24835
|
-
|
|
24836
|
-
|
|
24837
|
-
|
|
24203
|
+
stripe.createPaymentMethod({
|
|
24204
|
+
elements
|
|
24205
|
+
}).then(result => {
|
|
24206
|
+
if (result.error) {
|
|
24207
|
+
return handlePaymentError(result.error);
|
|
24208
|
+
}
|
|
24838
24209
|
|
|
24839
|
-
|
|
24840
|
-
|
|
24210
|
+
if (result.paymentMethod) {
|
|
24211
|
+
if (result.paymentMethod.type == "bacs_debit") {
|
|
24212
|
+
createBillingAddress(result.paymentMethod.billing_details);
|
|
24841
24213
|
}
|
|
24842
24214
|
|
|
24843
|
-
return
|
|
24844
|
-
|
|
24845
|
-
}, 0);
|
|
24846
|
-
};
|
|
24847
|
-
|
|
24848
|
-
(_ref4 = (_ref5 = (_state$updatedPrice2 = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice2 !== void 0 ? _state$updatedPrice2 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref5 !== void 0 ? _ref5 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref4 !== void 0 ? _ref4 : getOrderItemsTotal();
|
|
24849
|
-
return handlePayment(source);
|
|
24215
|
+
return handlePayment(result.paymentMethod);
|
|
24216
|
+
}
|
|
24850
24217
|
}).catch(error => {
|
|
24851
24218
|
return handlePaymentError(error);
|
|
24852
24219
|
});
|
|
24853
24220
|
};
|
|
24854
|
-
/**
|
|
24855
|
-
* Resolves with the total & tax amount incase taxes enabled by site
|
|
24856
|
-
* @return {Promise}
|
|
24857
|
-
*/
|
|
24858
24221
|
|
|
24222
|
+
const handlePayment = stripeSource => {
|
|
24223
|
+
if (stripeSource && type === "createPayment") {
|
|
24224
|
+
subscribe(stripeSource, state, dispatch);
|
|
24225
|
+
} else if (stripeSource && type === "orderCreate") {
|
|
24226
|
+
purchase(new StripeGateway(), stripeSource.id, state, dispatch);
|
|
24227
|
+
} else if (stripeSource && type === "invoicePayment") {
|
|
24228
|
+
payInvoice(new StripeGateway(), stripeSource.id);
|
|
24229
|
+
}
|
|
24230
|
+
};
|
|
24859
24231
|
|
|
24860
|
-
const
|
|
24861
|
-
var
|
|
24232
|
+
const handlePaymentError = error => {
|
|
24233
|
+
var _getErrorMessages;
|
|
24862
24234
|
|
|
24863
|
-
|
|
24864
|
-
return new Promise(resolve => resolve());
|
|
24865
|
-
}
|
|
24235
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
24866
24236
|
|
|
24867
|
-
|
|
24868
|
-
|
|
24869
|
-
|
|
24870
|
-
if (!taxesEnabled) {
|
|
24871
|
-
return resolve(null);
|
|
24872
|
-
}
|
|
24237
|
+
if (error.type === "validation_error" && // Subscription creation & renewal
|
|
24238
|
+
type === "createPayment") {
|
|
24239
|
+
var _state$couponObject;
|
|
24873
24240
|
|
|
24874
|
-
|
|
24875
|
-
|
|
24876
|
-
|
|
24877
|
-
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
24878
|
-
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
24879
|
-
address_id: selectedAddressId
|
|
24880
|
-
}, (error, res) => {
|
|
24881
|
-
var _res$data7, _res$data8;
|
|
24241
|
+
const {
|
|
24242
|
+
updatedPrice
|
|
24243
|
+
} = state; // When price is 0, we allow submitting without card info
|
|
24882
24244
|
|
|
24883
|
-
|
|
24884
|
-
|
|
24885
|
-
|
|
24245
|
+
if (updatedPrice === 0 && ((_state$couponObject = state.couponObject) === null || _state$couponObject === void 0 ? void 0 : _state$couponObject.duration) === "forever") {
|
|
24246
|
+
return subscribe({}, state, dispatch);
|
|
24247
|
+
}
|
|
24248
|
+
}
|
|
24886
24249
|
|
|
24887
|
-
|
|
24888
|
-
|
|
24889
|
-
|
|
24890
|
-
|
|
24891
|
-
|
|
24892
|
-
|
|
24893
|
-
}
|
|
24250
|
+
onFailure(error);
|
|
24251
|
+
dispatch({
|
|
24252
|
+
type: SHOW_ALERT,
|
|
24253
|
+
payload: {
|
|
24254
|
+
type: "error",
|
|
24255
|
+
content: (_getErrorMessages = getErrorMessages(error)) !== null && _getErrorMessages !== void 0 ? _getErrorMessages : error === null || error === void 0 ? void 0 : error.message
|
|
24256
|
+
}
|
|
24257
|
+
});
|
|
24258
|
+
dispatch({
|
|
24259
|
+
type: DISABLE_SUBMIT,
|
|
24260
|
+
payload: false
|
|
24261
|
+
});
|
|
24262
|
+
dispatch({
|
|
24263
|
+
type: LOADING,
|
|
24264
|
+
payload: false
|
|
24894
24265
|
});
|
|
24895
24266
|
};
|
|
24267
|
+
|
|
24268
|
+
const createBillingAddress = billingDetails => {
|
|
24269
|
+
const hasBillingAddress = userHasBillingAddress();
|
|
24270
|
+
if (hasBillingAddress) return;
|
|
24271
|
+
const {
|
|
24272
|
+
name,
|
|
24273
|
+
address
|
|
24274
|
+
} = billingDetails;
|
|
24275
|
+
const [firstName, lastName] = name ? name === null || name === void 0 ? void 0 : name.split(" ") : [];
|
|
24276
|
+
window.Pelcro.address.create({
|
|
24277
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
24278
|
+
type: "billing",
|
|
24279
|
+
first_name: firstName,
|
|
24280
|
+
last_name: lastName,
|
|
24281
|
+
line1: address === null || address === void 0 ? void 0 : address.line1,
|
|
24282
|
+
line2: address === null || address === void 0 ? void 0 : address.line2,
|
|
24283
|
+
city: address === null || address === void 0 ? void 0 : address.city,
|
|
24284
|
+
state: address === null || address === void 0 ? void 0 : address.state,
|
|
24285
|
+
country: address === null || address === void 0 ? void 0 : address.country,
|
|
24286
|
+
postal_code: address === null || address === void 0 ? void 0 : address.postal_code,
|
|
24287
|
+
is_default: true
|
|
24288
|
+
}, (err, res) => {
|
|
24289
|
+
if (err) {
|
|
24290
|
+
console.error(err);
|
|
24291
|
+
}
|
|
24292
|
+
|
|
24293
|
+
if (res) {
|
|
24294
|
+
console.log(res);
|
|
24295
|
+
}
|
|
24296
|
+
});
|
|
24297
|
+
}; // TODO: Refactor deprecated stripe implementation
|
|
24298
|
+
|
|
24299
|
+
/* Start Stripe deprecated functions */
|
|
24300
|
+
|
|
24896
24301
|
/**
|
|
24897
24302
|
* Resolves with a generated stripe 3DSecure source
|
|
24898
24303
|
* @param {Object} source stripe's source object
|
|
@@ -24933,52 +24338,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24933
24338
|
});
|
|
24934
24339
|
};
|
|
24935
24340
|
|
|
24936
|
-
const handlePayment = stripeSource => {
|
|
24937
|
-
if (stripeSource && type === "createPayment") {
|
|
24938
|
-
subscribe(stripeSource, state, dispatch);
|
|
24939
|
-
} else if (stripeSource && type === "orderCreate") {
|
|
24940
|
-
purchase(new StripeGateway(), stripeSource.id, state, dispatch);
|
|
24941
|
-
} else if (stripeSource && type === "invoicePayment") {
|
|
24942
|
-
payInvoice(new StripeGateway(), stripeSource.id);
|
|
24943
|
-
}
|
|
24944
|
-
};
|
|
24945
|
-
|
|
24946
|
-
const handlePaymentError = error => {
|
|
24947
|
-
var _getErrorMessages;
|
|
24948
|
-
|
|
24949
|
-
toggleAuthenticationSuccessPendingView(false);
|
|
24950
|
-
|
|
24951
|
-
if (error.type === "validation_error" && // Subscription creation & renewal
|
|
24952
|
-
type === "createPayment") {
|
|
24953
|
-
var _state$couponObject;
|
|
24954
|
-
|
|
24955
|
-
const {
|
|
24956
|
-
updatedPrice
|
|
24957
|
-
} = state; // When price is 0, we allow submitting without card info
|
|
24958
|
-
|
|
24959
|
-
if (updatedPrice === 0 && ((_state$couponObject = state.couponObject) === null || _state$couponObject === void 0 ? void 0 : _state$couponObject.duration) === "forever") {
|
|
24960
|
-
return subscribe({}, state, dispatch);
|
|
24961
|
-
}
|
|
24962
|
-
}
|
|
24963
|
-
|
|
24964
|
-
onFailure(error);
|
|
24965
|
-
dispatch({
|
|
24966
|
-
type: SHOW_ALERT,
|
|
24967
|
-
payload: {
|
|
24968
|
-
type: "error",
|
|
24969
|
-
content: (_getErrorMessages = getErrorMessages(error)) !== null && _getErrorMessages !== void 0 ? _getErrorMessages : error === null || error === void 0 ? void 0 : error.message
|
|
24970
|
-
}
|
|
24971
|
-
});
|
|
24972
|
-
dispatch({
|
|
24973
|
-
type: DISABLE_SUBMIT,
|
|
24974
|
-
payload: false
|
|
24975
|
-
});
|
|
24976
|
-
dispatch({
|
|
24977
|
-
type: LOADING,
|
|
24978
|
-
payload: false
|
|
24979
|
-
});
|
|
24980
|
-
};
|
|
24981
|
-
|
|
24982
24341
|
const retrieveSource = async (sourceId, clientSecret, paymentHandler) => {
|
|
24983
24342
|
try {
|
|
24984
24343
|
const {
|
|
@@ -25038,6 +24397,386 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
25038
24397
|
iframe.style = "position: absolute; width: 100%; height: 100%; left: 0; top: 0; bottom: 0; z-index: 10;";
|
|
25039
24398
|
cardAuthContainer === null || cardAuthContainer === void 0 ? void 0 : cardAuthContainer.appendChild(iframe);
|
|
25040
24399
|
};
|
|
24400
|
+
/* End Stripe deprecated functions */
|
|
24401
|
+
|
|
24402
|
+
/* ====== End Stripe integration ======== */
|
|
24403
|
+
|
|
24404
|
+
/* ====== Start PayPal integration ======== */
|
|
24405
|
+
|
|
24406
|
+
/**
|
|
24407
|
+
* Handles subscriptions from PayPal gateway
|
|
24408
|
+
* @param {PaymentStateType} state
|
|
24409
|
+
* @param {string} paypalNonce
|
|
24410
|
+
* @return {void}
|
|
24411
|
+
*/
|
|
24412
|
+
|
|
24413
|
+
|
|
24414
|
+
const handlePaypalSubscription = (state, paypalNonce) => {
|
|
24415
|
+
const payment = new Payment(new PaypalGateway());
|
|
24416
|
+
const {
|
|
24417
|
+
couponCode
|
|
24418
|
+
} = state;
|
|
24419
|
+
/**
|
|
24420
|
+
* @TODO: Add flags for types instead of testing by properties
|
|
24421
|
+
*/
|
|
24422
|
+
|
|
24423
|
+
if (giftRecipient) {
|
|
24424
|
+
return payment.execute({
|
|
24425
|
+
type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
|
|
24426
|
+
token: paypalNonce,
|
|
24427
|
+
quantity: plan.quantity,
|
|
24428
|
+
plan,
|
|
24429
|
+
couponCode,
|
|
24430
|
+
product,
|
|
24431
|
+
giftRecipient,
|
|
24432
|
+
addressId: selectedAddressId
|
|
24433
|
+
}, (err, res) => {
|
|
24434
|
+
dispatch({
|
|
24435
|
+
type: DISABLE_SUBMIT,
|
|
24436
|
+
payload: false
|
|
24437
|
+
});
|
|
24438
|
+
dispatch({
|
|
24439
|
+
type: LOADING,
|
|
24440
|
+
payload: false
|
|
24441
|
+
});
|
|
24442
|
+
|
|
24443
|
+
if (err) {
|
|
24444
|
+
onFailure(err);
|
|
24445
|
+
return dispatch({
|
|
24446
|
+
type: SHOW_ALERT,
|
|
24447
|
+
payload: {
|
|
24448
|
+
type: "error",
|
|
24449
|
+
content: getErrorMessages(err)
|
|
24450
|
+
}
|
|
24451
|
+
});
|
|
24452
|
+
}
|
|
24453
|
+
|
|
24454
|
+
onSuccess(res);
|
|
24455
|
+
});
|
|
24456
|
+
}
|
|
24457
|
+
|
|
24458
|
+
return payment.execute({
|
|
24459
|
+
type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
|
|
24460
|
+
token: paypalNonce,
|
|
24461
|
+
quantity: plan.quantity,
|
|
24462
|
+
plan,
|
|
24463
|
+
couponCode,
|
|
24464
|
+
product,
|
|
24465
|
+
addressId: selectedAddressId
|
|
24466
|
+
}, (err, res) => {
|
|
24467
|
+
dispatch({
|
|
24468
|
+
type: DISABLE_SUBMIT,
|
|
24469
|
+
payload: false
|
|
24470
|
+
});
|
|
24471
|
+
dispatch({
|
|
24472
|
+
type: LOADING,
|
|
24473
|
+
payload: false
|
|
24474
|
+
});
|
|
24475
|
+
|
|
24476
|
+
if (err) {
|
|
24477
|
+
onFailure(err);
|
|
24478
|
+
return dispatch({
|
|
24479
|
+
type: SHOW_ALERT,
|
|
24480
|
+
payload: {
|
|
24481
|
+
type: "error",
|
|
24482
|
+
content: getErrorMessages(err)
|
|
24483
|
+
}
|
|
24484
|
+
});
|
|
24485
|
+
}
|
|
24486
|
+
|
|
24487
|
+
onSuccess(res);
|
|
24488
|
+
});
|
|
24489
|
+
};
|
|
24490
|
+
/* ====== End PayPal integration ======== */
|
|
24491
|
+
|
|
24492
|
+
/* ====== General Functions Start ======== */
|
|
24493
|
+
|
|
24494
|
+
/**
|
|
24495
|
+
* Updates the total amount after adding taxes only if site taxes are enabled
|
|
24496
|
+
*/
|
|
24497
|
+
|
|
24498
|
+
|
|
24499
|
+
const updateTotalAmountWithTax = () => {
|
|
24500
|
+
var _window$Pelcro$site$r8;
|
|
24501
|
+
|
|
24502
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
24503
|
+
const taxesEnabled = (_window$Pelcro$site$r8 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r8 === void 0 ? void 0 : _window$Pelcro$site$r8.taxes_enabled;
|
|
24504
|
+
|
|
24505
|
+
if (taxesEnabled && type === "createPayment") {
|
|
24506
|
+
dispatch({
|
|
24507
|
+
type: DISABLE_SUBMIT,
|
|
24508
|
+
payload: true
|
|
24509
|
+
});
|
|
24510
|
+
resolveTaxCalculation().then(res => {
|
|
24511
|
+
if (res) {
|
|
24512
|
+
dispatch({
|
|
24513
|
+
type: SET_TAX_AMOUNT,
|
|
24514
|
+
payload: res.taxAmount
|
|
24515
|
+
});
|
|
24516
|
+
dispatch({
|
|
24517
|
+
type: SET_UPDATED_PRICE,
|
|
24518
|
+
payload: res.totalAmountWithTax
|
|
24519
|
+
});
|
|
24520
|
+
dispatch({
|
|
24521
|
+
type: UPDATE_PAYMENT_REQUEST
|
|
24522
|
+
});
|
|
24523
|
+
}
|
|
24524
|
+
}).catch(error => {
|
|
24525
|
+
handlePaymentError(error);
|
|
24526
|
+
}).finally(() => {
|
|
24527
|
+
dispatch({
|
|
24528
|
+
type: DISABLE_SUBMIT,
|
|
24529
|
+
payload: false
|
|
24530
|
+
});
|
|
24531
|
+
});
|
|
24532
|
+
}
|
|
24533
|
+
};
|
|
24534
|
+
|
|
24535
|
+
const onApplyCouponCode = (state, dispatch) => {
|
|
24536
|
+
const {
|
|
24537
|
+
couponCode
|
|
24538
|
+
} = state;
|
|
24539
|
+
|
|
24540
|
+
const handleCouponResponse = (err, res) => {
|
|
24541
|
+
var _res$data$coupon;
|
|
24542
|
+
|
|
24543
|
+
dispatch({
|
|
24544
|
+
type: DISABLE_COUPON_BUTTON,
|
|
24545
|
+
payload: false
|
|
24546
|
+
});
|
|
24547
|
+
|
|
24548
|
+
if (err) {
|
|
24549
|
+
onFailure(err); // reset the coupon code in local state
|
|
24550
|
+
|
|
24551
|
+
setUpdatedCouponCode("");
|
|
24552
|
+
dispatch({
|
|
24553
|
+
type: SET_COUPON_ERROR,
|
|
24554
|
+
payload: getErrorMessages(err)
|
|
24555
|
+
}); // remove current coupon
|
|
24556
|
+
|
|
24557
|
+
dispatch({
|
|
24558
|
+
type: SET_COUPON,
|
|
24559
|
+
payload: null
|
|
24560
|
+
});
|
|
24561
|
+
dispatch({
|
|
24562
|
+
type: SET_PERCENT_OFF,
|
|
24563
|
+
payload: ""
|
|
24564
|
+
});
|
|
24565
|
+
dispatch({
|
|
24566
|
+
type: SET_UPDATED_PRICE,
|
|
24567
|
+
payload: null
|
|
24568
|
+
});
|
|
24569
|
+
dispatch({
|
|
24570
|
+
type: SET_TAX_AMOUNT,
|
|
24571
|
+
payload: null
|
|
24572
|
+
});
|
|
24573
|
+
const {
|
|
24574
|
+
currentPlan
|
|
24575
|
+
} = state;
|
|
24576
|
+
|
|
24577
|
+
if (currentPlan) {
|
|
24578
|
+
var _currentPlan$quantity;
|
|
24579
|
+
|
|
24580
|
+
const quantity = (_currentPlan$quantity = currentPlan.quantity) !== null && _currentPlan$quantity !== void 0 ? _currentPlan$quantity : 1;
|
|
24581
|
+
const price = currentPlan.amount;
|
|
24582
|
+
dispatch({
|
|
24583
|
+
type: SET_UPDATED_PRICE,
|
|
24584
|
+
// set original plan price
|
|
24585
|
+
payload: price * quantity
|
|
24586
|
+
});
|
|
24587
|
+
dispatch({
|
|
24588
|
+
type: UPDATE_PAYMENT_REQUEST
|
|
24589
|
+
}); // update the new amount with taxes if site has taxes enabled
|
|
24590
|
+
|
|
24591
|
+
updateTotalAmountWithTax();
|
|
24592
|
+
}
|
|
24593
|
+
|
|
24594
|
+
return;
|
|
24595
|
+
}
|
|
24596
|
+
|
|
24597
|
+
dispatch({
|
|
24598
|
+
type: SET_COUPON_ERROR,
|
|
24599
|
+
payload: ""
|
|
24600
|
+
});
|
|
24601
|
+
dispatch({
|
|
24602
|
+
type: SHOW_ALERT,
|
|
24603
|
+
payload: {
|
|
24604
|
+
type: "error",
|
|
24605
|
+
content: ""
|
|
24606
|
+
}
|
|
24607
|
+
});
|
|
24608
|
+
dispatch({
|
|
24609
|
+
type: SET_COUPON,
|
|
24610
|
+
payload: res.data.coupon
|
|
24611
|
+
}); // set the coupon code in local state to be able to use with Vantiv
|
|
24612
|
+
|
|
24613
|
+
setUpdatedCouponCode(res.data.coupon.code);
|
|
24614
|
+
dispatch({
|
|
24615
|
+
type: SET_PERCENT_OFF,
|
|
24616
|
+
payload: `${(_res$data$coupon = res.data.coupon) === null || _res$data$coupon === void 0 ? void 0 : _res$data$coupon.percent_off}%`
|
|
24617
|
+
});
|
|
24618
|
+
dispatch({
|
|
24619
|
+
type: SET_TAX_AMOUNT,
|
|
24620
|
+
payload: res.data.taxes
|
|
24621
|
+
});
|
|
24622
|
+
dispatch({
|
|
24623
|
+
type: SET_UPDATED_PRICE,
|
|
24624
|
+
payload: res.data.total
|
|
24625
|
+
});
|
|
24626
|
+
dispatch({
|
|
24627
|
+
type: UPDATE_PAYMENT_REQUEST
|
|
24628
|
+
});
|
|
24629
|
+
};
|
|
24630
|
+
|
|
24631
|
+
if ((couponCode === null || couponCode === void 0 ? void 0 : couponCode.trim()) === "") {
|
|
24632
|
+
dispatch({
|
|
24633
|
+
type: SET_COUPON,
|
|
24634
|
+
payload: null
|
|
24635
|
+
});
|
|
24636
|
+
dispatch({
|
|
24637
|
+
type: SET_PERCENT_OFF,
|
|
24638
|
+
payload: ""
|
|
24639
|
+
});
|
|
24640
|
+
dispatch({
|
|
24641
|
+
type: SET_UPDATED_PRICE,
|
|
24642
|
+
payload: null
|
|
24643
|
+
});
|
|
24644
|
+
dispatch({
|
|
24645
|
+
type: SET_TAX_AMOUNT,
|
|
24646
|
+
payload: null
|
|
24647
|
+
});
|
|
24648
|
+
dispatch({
|
|
24649
|
+
type: UPDATE_PAYMENT_REQUEST
|
|
24650
|
+
});
|
|
24651
|
+
updateTotalAmountWithTax();
|
|
24652
|
+
}
|
|
24653
|
+
|
|
24654
|
+
if (couponCode !== null && couponCode !== void 0 && couponCode.trim()) {
|
|
24655
|
+
dispatch({
|
|
24656
|
+
type: DISABLE_COUPON_BUTTON,
|
|
24657
|
+
payload: true
|
|
24658
|
+
});
|
|
24659
|
+
|
|
24660
|
+
if (type === "createPayment") {
|
|
24661
|
+
window.Pelcro.order.create({
|
|
24662
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
24663
|
+
plan_id: plan.id,
|
|
24664
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
24665
|
+
coupon_code: couponCode,
|
|
24666
|
+
address_id: selectedAddressId
|
|
24667
|
+
}, handleCouponResponse);
|
|
24668
|
+
} else if (type === "orderCreate") {
|
|
24669
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
24670
|
+
const mappedOrderItems = isQuickPurchase ? [{
|
|
24671
|
+
sku_id: order.id,
|
|
24672
|
+
quantity: order.quantity
|
|
24673
|
+
}] : order.map(item => ({
|
|
24674
|
+
sku_id: item.id,
|
|
24675
|
+
quantity: item.quantity
|
|
24676
|
+
}));
|
|
24677
|
+
window.Pelcro.ecommerce.order.createSummary({
|
|
24678
|
+
items: mappedOrderItems,
|
|
24679
|
+
coupon_code: couponCode
|
|
24680
|
+
}, handleCouponResponse);
|
|
24681
|
+
}
|
|
24682
|
+
}
|
|
24683
|
+
};
|
|
24684
|
+
|
|
24685
|
+
const debouncedApplyCouponCode = useRef(debounce$1(onApplyCouponCode, 1000)).current;
|
|
24686
|
+
|
|
24687
|
+
const removeAppliedCoupon = state => {
|
|
24688
|
+
state.couponCode = ""; // reset the coupon code in local state
|
|
24689
|
+
|
|
24690
|
+
setUpdatedCouponCode("");
|
|
24691
|
+
dispatch({
|
|
24692
|
+
type: SET_COUPON_ERROR,
|
|
24693
|
+
payload: ""
|
|
24694
|
+
});
|
|
24695
|
+
dispatch({
|
|
24696
|
+
type: SHOW_COUPON_FIELD,
|
|
24697
|
+
payload: false
|
|
24698
|
+
});
|
|
24699
|
+
dispatch({
|
|
24700
|
+
type: SET_COUPON,
|
|
24701
|
+
payload: null
|
|
24702
|
+
});
|
|
24703
|
+
dispatch({
|
|
24704
|
+
type: SET_PERCENT_OFF,
|
|
24705
|
+
payload: ""
|
|
24706
|
+
});
|
|
24707
|
+
dispatch({
|
|
24708
|
+
type: SET_UPDATED_PRICE,
|
|
24709
|
+
payload: null
|
|
24710
|
+
});
|
|
24711
|
+
dispatch({
|
|
24712
|
+
type: SET_TAX_AMOUNT,
|
|
24713
|
+
payload: null
|
|
24714
|
+
});
|
|
24715
|
+
const {
|
|
24716
|
+
currentPlan
|
|
24717
|
+
} = state;
|
|
24718
|
+
|
|
24719
|
+
if (currentPlan) {
|
|
24720
|
+
var _currentPlan$quantity2;
|
|
24721
|
+
|
|
24722
|
+
const quantity = (_currentPlan$quantity2 = currentPlan.quantity) !== null && _currentPlan$quantity2 !== void 0 ? _currentPlan$quantity2 : 1;
|
|
24723
|
+
const price = currentPlan.amount;
|
|
24724
|
+
dispatch({
|
|
24725
|
+
type: SET_UPDATED_PRICE,
|
|
24726
|
+
// set original plan price
|
|
24727
|
+
payload: price * quantity
|
|
24728
|
+
});
|
|
24729
|
+
dispatch({
|
|
24730
|
+
type: UPDATE_PAYMENT_REQUEST
|
|
24731
|
+
}); // update the new amount with taxes if site has taxes enabled
|
|
24732
|
+
|
|
24733
|
+
updateTotalAmountWithTax();
|
|
24734
|
+
}
|
|
24735
|
+
};
|
|
24736
|
+
/**
|
|
24737
|
+
* Resolves with the total & tax amount incase taxes enabled by site
|
|
24738
|
+
* @return {Promise}
|
|
24739
|
+
*/
|
|
24740
|
+
|
|
24741
|
+
|
|
24742
|
+
const resolveTaxCalculation = () => {
|
|
24743
|
+
var _window$Pelcro$site$r9;
|
|
24744
|
+
|
|
24745
|
+
if (type === "invoicePayment") {
|
|
24746
|
+
return new Promise(resolve => resolve());
|
|
24747
|
+
}
|
|
24748
|
+
|
|
24749
|
+
const taxesEnabled = (_window$Pelcro$site$r9 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r9 === void 0 ? void 0 : _window$Pelcro$site$r9.taxes_enabled;
|
|
24750
|
+
return new Promise((resolve, reject) => {
|
|
24751
|
+
// resolve early if taxes isn't enabled
|
|
24752
|
+
if (!taxesEnabled) {
|
|
24753
|
+
return resolve(null);
|
|
24754
|
+
}
|
|
24755
|
+
|
|
24756
|
+
window.Pelcro.order.create({
|
|
24757
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
24758
|
+
plan_id: plan.id,
|
|
24759
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
24760
|
+
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
24761
|
+
address_id: selectedAddressId
|
|
24762
|
+
}, (error, res) => {
|
|
24763
|
+
var _res$data7, _res$data8;
|
|
24764
|
+
|
|
24765
|
+
if (error) {
|
|
24766
|
+
return reject(error);
|
|
24767
|
+
}
|
|
24768
|
+
|
|
24769
|
+
const taxAmount = (_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : _res$data7.taxes;
|
|
24770
|
+
const totalAmountWithTax = (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.total;
|
|
24771
|
+
resolve({
|
|
24772
|
+
totalAmountWithTax,
|
|
24773
|
+
taxAmount
|
|
24774
|
+
});
|
|
24775
|
+
});
|
|
24776
|
+
});
|
|
24777
|
+
};
|
|
24778
|
+
/* ====== General Functions End ======== */
|
|
24779
|
+
|
|
25041
24780
|
|
|
25042
24781
|
const [state, dispatch] = useReducerWithSideEffects((state, action) => {
|
|
25043
24782
|
switch (action.type) {
|
|
@@ -25078,7 +24817,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
25078
24817
|
isLoading: true
|
|
25079
24818
|
}, (state, dispatch) => {
|
|
25080
24819
|
if (skipPayment && props !== null && props !== void 0 && props.freeOrders) {
|
|
25081
|
-
return submitPayment(
|
|
24820
|
+
return submitPayment();
|
|
25082
24821
|
}
|
|
25083
24822
|
|
|
25084
24823
|
if (getSiteCardProcessor() === "vantiv") {
|
|
@@ -25113,7 +24852,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
25113
24852
|
return replacePaymentSource(state, dispatch);
|
|
25114
24853
|
}
|
|
25115
24854
|
|
|
25116
|
-
submitPayment(
|
|
24855
|
+
submitPayment();
|
|
25117
24856
|
});
|
|
25118
24857
|
|
|
25119
24858
|
case HANDLE_PAYPAL_SUBSCRIPTION:
|
|
@@ -25269,14 +25008,42 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
25269
25008
|
})));
|
|
25270
25009
|
};
|
|
25271
25010
|
|
|
25272
|
-
const UnwrappedForm = es_12(PaymentMethodContainerWithoutStripe);
|
|
25273
|
-
|
|
25274
25011
|
const PaymentMethodContainer = props => {
|
|
25275
25012
|
const [isStripeLoaded, setIsStripeLoaded] = useState(Boolean(window.Stripe));
|
|
25276
25013
|
const {
|
|
25277
25014
|
whenUserReady
|
|
25278
25015
|
} = usePelcro.getStore();
|
|
25279
|
-
const cardProcessor = getSiteCardProcessor();
|
|
25016
|
+
const cardProcessor = getSiteCardProcessor(); // Create the Stripe object
|
|
25017
|
+
|
|
25018
|
+
const stripePromise = cardProcessor === "stripe" ? loadStripe(window.Pelcro.environment.stripe, {
|
|
25019
|
+
stripeAccount: window.Pelcro.site.read().account_id
|
|
25020
|
+
}) : null;
|
|
25021
|
+
const [clientSecret, setClientSecret] = useState();
|
|
25022
|
+
const appearance = {
|
|
25023
|
+
theme: "stripe"
|
|
25024
|
+
};
|
|
25025
|
+
const options = {
|
|
25026
|
+
clientSecret,
|
|
25027
|
+
paymentMethodCreation: "manual",
|
|
25028
|
+
appearance,
|
|
25029
|
+
loader: "always"
|
|
25030
|
+
};
|
|
25031
|
+
useEffect(() => {
|
|
25032
|
+
if (isStripeLoaded) {
|
|
25033
|
+
window.Pelcro.user.createSetupIntent({
|
|
25034
|
+
auth_token: window.Pelcro.user.read().auth_token
|
|
25035
|
+
}, (err, res) => {
|
|
25036
|
+
if (err) {
|
|
25037
|
+
console.error(err);
|
|
25038
|
+
}
|
|
25039
|
+
|
|
25040
|
+
if (res) {
|
|
25041
|
+
setClientSecret(res.data.client_secret);
|
|
25042
|
+
}
|
|
25043
|
+
});
|
|
25044
|
+
}
|
|
25045
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
25046
|
+
|
|
25280
25047
|
useEffect(() => {
|
|
25281
25048
|
whenUserReady(() => {
|
|
25282
25049
|
if (!window.Stripe && cardProcessor === "stripe") {
|
|
@@ -25285,16 +25052,15 @@ const PaymentMethodContainer = props => {
|
|
|
25285
25052
|
});
|
|
25286
25053
|
}
|
|
25287
25054
|
});
|
|
25288
|
-
}, []);
|
|
25055
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
25289
25056
|
|
|
25290
25057
|
if (isStripeLoaded) {
|
|
25291
|
-
return /*#__PURE__*/React__default.createElement(
|
|
25292
|
-
|
|
25293
|
-
|
|
25294
|
-
|
|
25295
|
-
}, /*#__PURE__*/React__default.createElement(es_11, null, /*#__PURE__*/React__default.createElement(UnwrappedForm, Object.assign({
|
|
25058
|
+
return /*#__PURE__*/React__default.createElement("div", null, clientSecret ? /*#__PURE__*/React__default.createElement(Elements, {
|
|
25059
|
+
options: options,
|
|
25060
|
+
stripe: stripePromise
|
|
25061
|
+
}, /*#__PURE__*/React__default.createElement(PaymentMethodContainerWithoutStripe, Object.assign({
|
|
25296
25062
|
store: store$m
|
|
25297
|
-
}, props))));
|
|
25063
|
+
}, props))) : /*#__PURE__*/React__default.createElement(Loader, null));
|
|
25298
25064
|
} else if (cardProcessor !== "stripe") {
|
|
25299
25065
|
return /*#__PURE__*/React__default.createElement(PaymentMethodContainerWithoutStripe, Object.assign({
|
|
25300
25066
|
store: store$m
|
|
@@ -25418,53 +25184,6 @@ function YearSelect({
|
|
|
25418
25184
|
}, placeholder), createYearsItems);
|
|
25419
25185
|
}
|
|
25420
25186
|
|
|
25421
|
-
const StripeInputStyle = {
|
|
25422
|
-
base: "plc-w-full plc-p-3 plc-border plc-border-gray-300 plc-appearance-none plc-outline-none plc-rounded plc-bg-white pelcro-input-input",
|
|
25423
|
-
focus: "plc-ring-2 plc-ring-primary-400",
|
|
25424
|
-
invalid: "plc-ring-2 plc-ring-red-300 pelcro-input-invalid"
|
|
25425
|
-
};
|
|
25426
|
-
const PelcroCardNumber = props => {
|
|
25427
|
-
const {
|
|
25428
|
-
t
|
|
25429
|
-
} = useTranslation("checkoutForm");
|
|
25430
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
25431
|
-
className: "plc-relative"
|
|
25432
|
-
}, /*#__PURE__*/React__default.createElement(es_9, Object.assign({
|
|
25433
|
-
id: "pelcro-input-card-number",
|
|
25434
|
-
classes: StripeInputStyle
|
|
25435
|
-
}, props)), /*#__PURE__*/React__default.createElement("label", {
|
|
25436
|
-
htmlFor: "pelcro-input-card-number",
|
|
25437
|
-
className: "pelcro-input-card-number-label"
|
|
25438
|
-
}, t("labels.card"), " *"));
|
|
25439
|
-
};
|
|
25440
|
-
const PelcroCardCVC = props => {
|
|
25441
|
-
const {
|
|
25442
|
-
t
|
|
25443
|
-
} = useTranslation("checkoutForm");
|
|
25444
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
25445
|
-
className: "plc-relative"
|
|
25446
|
-
}, /*#__PURE__*/React__default.createElement(es_6, Object.assign({
|
|
25447
|
-
id: "pelcro-input-cvc-number",
|
|
25448
|
-
classes: StripeInputStyle
|
|
25449
|
-
}, props)), /*#__PURE__*/React__default.createElement("label", {
|
|
25450
|
-
htmlFor: "pelcro-input-cvc-number",
|
|
25451
|
-
className: "pelcro-input-cvc-number-label"
|
|
25452
|
-
}, t("labels.CVC"), " *"));
|
|
25453
|
-
};
|
|
25454
|
-
const PelcroCardExpiry = props => {
|
|
25455
|
-
const {
|
|
25456
|
-
t
|
|
25457
|
-
} = useTranslation("checkoutForm");
|
|
25458
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
25459
|
-
className: "plc-relative"
|
|
25460
|
-
}, /*#__PURE__*/React__default.createElement(es_8, Object.assign({
|
|
25461
|
-
id: "pelcro-input-expiry-date",
|
|
25462
|
-
classes: StripeInputStyle
|
|
25463
|
-
}, props)), /*#__PURE__*/React__default.createElement("label", {
|
|
25464
|
-
htmlFor: "pelcro-input-expiry-date",
|
|
25465
|
-
className: "pelcro-input-expiry-date-label"
|
|
25466
|
-
}, t("labels.date"), " *"));
|
|
25467
|
-
};
|
|
25468
25187
|
const PelcroPaymentRequestButton = props => {
|
|
25469
25188
|
const {
|
|
25470
25189
|
state: {
|
|
@@ -25486,7 +25205,7 @@ const PelcroPaymentRequestButton = props => {
|
|
|
25486
25205
|
};
|
|
25487
25206
|
|
|
25488
25207
|
if (canMakePayment) {
|
|
25489
|
-
return /*#__PURE__*/React__default.createElement(
|
|
25208
|
+
return /*#__PURE__*/React__default.createElement(PaymentRequestButtonElement, Object.assign({
|
|
25490
25209
|
className: "StripeElement stripe-payment-request-btn",
|
|
25491
25210
|
onClick: updatePaymentRequest,
|
|
25492
25211
|
paymentRequest: paymentRequest,
|
|
@@ -25504,11 +25223,43 @@ const PelcroPaymentRequestButton = props => {
|
|
|
25504
25223
|
const CheckoutForm = ({
|
|
25505
25224
|
type
|
|
25506
25225
|
}) => {
|
|
25226
|
+
var _window$Pelcro$user$r, _window, _window$Pelcro, _window$Pelcro$user, _window$Pelcro$user$r2, _window$Pelcro$user$r3, _window2, _window2$Pelcro, _window2$Pelcro$user, _window2$Pelcro$user$, _window3, _window3$Pelcro, _window3$Pelcro$user, _window3$Pelcro$user$, _window4, _window4$Pelcro, _window4$Pelcro$user, _window4$Pelcro$user$, _defaultAddress$line, _defaultAddress$line2, _defaultAddress$city, _defaultAddress$state, _defaultAddress$count, _defaultAddress$posta;
|
|
25227
|
+
|
|
25507
25228
|
const {
|
|
25508
25229
|
selectedPaymentMethodId,
|
|
25509
25230
|
paymentMethodToEdit
|
|
25510
25231
|
} = usePelcro();
|
|
25511
25232
|
const cardProcessor = getSiteCardProcessor();
|
|
25233
|
+
const defaultAddress = (_window$Pelcro$user$r = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : (_window$Pelcro$user$r2 = _window$Pelcro$user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : (_window$Pelcro$user$r3 = _window$Pelcro$user$r2.addresses) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.find(address => address.type == "billing" && address.is_default)) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
|
|
25234
|
+
const billingDetails = {
|
|
25235
|
+
name: (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Pelcro = _window2.Pelcro) === null || _window2$Pelcro === void 0 ? void 0 : (_window2$Pelcro$user = _window2$Pelcro.user) === null || _window2$Pelcro$user === void 0 ? void 0 : (_window2$Pelcro$user$ = _window2$Pelcro$user.read()) === null || _window2$Pelcro$user$ === void 0 ? void 0 : _window2$Pelcro$user$.name,
|
|
25236
|
+
email: (_window3 = window) === null || _window3 === void 0 ? void 0 : (_window3$Pelcro = _window3.Pelcro) === null || _window3$Pelcro === void 0 ? void 0 : (_window3$Pelcro$user = _window3$Pelcro.user) === null || _window3$Pelcro$user === void 0 ? void 0 : (_window3$Pelcro$user$ = _window3$Pelcro$user.read()) === null || _window3$Pelcro$user$ === void 0 ? void 0 : _window3$Pelcro$user$.email,
|
|
25237
|
+
phone: (_window4 = window) === null || _window4 === void 0 ? void 0 : (_window4$Pelcro = _window4.Pelcro) === null || _window4$Pelcro === void 0 ? void 0 : (_window4$Pelcro$user = _window4$Pelcro.user) === null || _window4$Pelcro$user === void 0 ? void 0 : (_window4$Pelcro$user$ = _window4$Pelcro$user.read()) === null || _window4$Pelcro$user$ === void 0 ? void 0 : _window4$Pelcro$user$.phone,
|
|
25238
|
+
address: {
|
|
25239
|
+
line1: (_defaultAddress$line = defaultAddress === null || defaultAddress === void 0 ? void 0 : defaultAddress.line1) !== null && _defaultAddress$line !== void 0 ? _defaultAddress$line : null,
|
|
25240
|
+
line2: (_defaultAddress$line2 = defaultAddress === null || defaultAddress === void 0 ? void 0 : defaultAddress.line2) !== null && _defaultAddress$line2 !== void 0 ? _defaultAddress$line2 : null,
|
|
25241
|
+
city: (_defaultAddress$city = defaultAddress === null || defaultAddress === void 0 ? void 0 : defaultAddress.city) !== null && _defaultAddress$city !== void 0 ? _defaultAddress$city : null,
|
|
25242
|
+
state: (_defaultAddress$state = defaultAddress === null || defaultAddress === void 0 ? void 0 : defaultAddress.state) !== null && _defaultAddress$state !== void 0 ? _defaultAddress$state : null,
|
|
25243
|
+
country: (_defaultAddress$count = defaultAddress === null || defaultAddress === void 0 ? void 0 : defaultAddress.country) !== null && _defaultAddress$count !== void 0 ? _defaultAddress$count : null,
|
|
25244
|
+
postal_code: (_defaultAddress$posta = defaultAddress === null || defaultAddress === void 0 ? void 0 : defaultAddress.postal_code) !== null && _defaultAddress$posta !== void 0 ? _defaultAddress$posta : null
|
|
25245
|
+
}
|
|
25246
|
+
};
|
|
25247
|
+
const paymentElementOptions = {
|
|
25248
|
+
layout: {
|
|
25249
|
+
type: "tabs",
|
|
25250
|
+
// or accordion
|
|
25251
|
+
defaultCollapsed: false
|
|
25252
|
+
},
|
|
25253
|
+
defaultValues: {
|
|
25254
|
+
billingDetails: billingDetails
|
|
25255
|
+
},
|
|
25256
|
+
terms: {
|
|
25257
|
+
applePay: "never",
|
|
25258
|
+
card: "never",
|
|
25259
|
+
googlePay: "never",
|
|
25260
|
+
paypal: "never"
|
|
25261
|
+
}
|
|
25262
|
+
};
|
|
25512
25263
|
|
|
25513
25264
|
if (selectedPaymentMethodId) {
|
|
25514
25265
|
return null;
|
|
@@ -25570,56 +25321,10 @@ const CheckoutForm = ({
|
|
|
25570
25321
|
}))));
|
|
25571
25322
|
}
|
|
25572
25323
|
|
|
25573
|
-
return /*#__PURE__*/React__default.createElement(
|
|
25574
|
-
|
|
25575
|
-
|
|
25576
|
-
|
|
25577
|
-
}, /*#__PURE__*/React__default.createElement(PelcroCardNumber, {
|
|
25578
|
-
autoFocus: true
|
|
25579
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
25580
|
-
// alt="credit_cards"
|
|
25581
|
-
className: "plc-w-auto plc-h-8 plc-absolute plc-right-2 plc-top-1 plc-flex" // src="https://js.pelcro.com/ui/plugin/main/images/credit_cards.png"
|
|
25582
|
-
|
|
25583
|
-
}, /*#__PURE__*/React__default.createElement("svg", {
|
|
25584
|
-
className: "plc-w-8",
|
|
25585
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
25586
|
-
viewBox: "0 0 48 48"
|
|
25587
|
-
}, /*#__PURE__*/React__default.createElement("path", {
|
|
25588
|
-
fill: "#1565C0",
|
|
25589
|
-
d: "M15.186 19l-2.626 7.832c0 0-.667-3.313-.733-3.729-1.495-3.411-3.701-3.221-3.701-3.221L10.726 30v-.002h3.161L18.258 19H15.186zM17.689 30L20.56 30 22.296 19 19.389 19zM38.008 19h-3.021l-4.71 11h2.852l.588-1.571h3.596L37.619 30h2.613L38.008 19zM34.513 26.328l1.563-4.157.818 4.157H34.513zM26.369 22.206c0-.606.498-1.057 1.926-1.057.928 0 1.991.674 1.991.674l.466-2.309c0 0-1.358-.515-2.691-.515-3.019 0-4.576 1.444-4.576 3.272 0 3.306 3.979 2.853 3.979 4.551 0 .291-.231.964-1.888.964-1.662 0-2.759-.609-2.759-.609l-.495 2.216c0 0 1.063.606 3.117.606 2.059 0 4.915-1.54 4.915-3.752C30.354 23.586 26.369 23.394 26.369 22.206z"
|
|
25590
|
-
}), /*#__PURE__*/React__default.createElement("path", {
|
|
25591
|
-
fill: "#FFC107",
|
|
25592
|
-
d: "M12.212,24.945l-0.966-4.748c0,0-0.437-1.029-1.573-1.029c-1.136,0-4.44,0-4.44,0S10.894,20.84,12.212,24.945z"
|
|
25593
|
-
})), /*#__PURE__*/React__default.createElement("svg", {
|
|
25594
|
-
className: "plc-w-8",
|
|
25595
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
25596
|
-
viewBox: "0 0 48 48"
|
|
25597
|
-
}, /*#__PURE__*/React__default.createElement("path", {
|
|
25598
|
-
fill: "#ff9800",
|
|
25599
|
-
d: "M32 10A14 14 0 1 0 32 38A14 14 0 1 0 32 10Z"
|
|
25600
|
-
}), /*#__PURE__*/React__default.createElement("path", {
|
|
25601
|
-
fill: "#d50000",
|
|
25602
|
-
d: "M16 10A14 14 0 1 0 16 38A14 14 0 1 0 16 10Z"
|
|
25603
|
-
}), /*#__PURE__*/React__default.createElement("path", {
|
|
25604
|
-
fill: "#ff3d00",
|
|
25605
|
-
d: "M18,24c0,4.755,2.376,8.95,6,11.48c3.624-2.53,6-6.725,6-11.48s-2.376-8.95-6-11.48 C20.376,15.05,18,19.245,18,24z"
|
|
25606
|
-
})), /*#__PURE__*/React__default.createElement("svg", {
|
|
25607
|
-
className: "plc-w-8",
|
|
25608
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
25609
|
-
viewBox: "0 0 48 48"
|
|
25610
|
-
}, /*#__PURE__*/React__default.createElement("path", {
|
|
25611
|
-
fill: "#1976D2",
|
|
25612
|
-
d: "M45,35c0,2.209-1.791,4-4,4H7c-2.209,0-4-1.791-4-4V13c0-2.209,1.791-4,4-4h34c2.209,0,4,1.791,4,4V35z"
|
|
25613
|
-
}), /*#__PURE__*/React__default.createElement("path", {
|
|
25614
|
-
fill: "#FFF",
|
|
25615
|
-
d: "M22.255 20l-2.113 4.683L18.039 20h-2.695v6.726L12.341 20h-2.274L7 26.981h1.815l.671-1.558h3.432l.682 1.558h3.465v-5.185l2.299 5.185h1.563l2.351-5.095v5.095H25V20H22.255zM10.135 23.915l1.026-2.44 1.066 2.44H10.135zM37.883 23.413L41 20.018h-2.217l-1.994 2.164L34.86 20H28v6.982h6.635l2.092-2.311L38.767 27h2.21L37.883 23.413zM33.728 25.516h-4.011v-1.381h3.838v-1.323h-3.838v-1.308l4.234.012 1.693 1.897L33.728 25.516z"
|
|
25616
|
-
})))), /*#__PURE__*/React__default.createElement("div", {
|
|
25617
|
-
className: "plc-flex plc-items-end plc-justify-between plc-my-4"
|
|
25618
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
25619
|
-
className: "plc-w-6/12 plc-pr-1"
|
|
25620
|
-
}, /*#__PURE__*/React__default.createElement(PelcroCardExpiry, null)), /*#__PURE__*/React__default.createElement("div", {
|
|
25621
|
-
className: "plc-w-6/12 plc-pl-1"
|
|
25622
|
-
}, /*#__PURE__*/React__default.createElement(PelcroCardCVC, null))));
|
|
25324
|
+
return /*#__PURE__*/React__default.createElement(PaymentElement, {
|
|
25325
|
+
id: "payment-element",
|
|
25326
|
+
options: paymentElementOptions
|
|
25327
|
+
});
|
|
25623
25328
|
}
|
|
25624
25329
|
|
|
25625
25330
|
return null;
|
|
@@ -25893,7 +25598,7 @@ class PaypalClient {
|
|
|
25893
25598
|
* @param {paypalConstructorOptions} paypalClientConfig
|
|
25894
25599
|
*/
|
|
25895
25600
|
constructor(paypalClientConfig) {
|
|
25896
|
-
_defineProperty$
|
|
25601
|
+
_defineProperty$4(this, "build", async () => {
|
|
25897
25602
|
if (!this.isPaypalEnabled) {
|
|
25898
25603
|
console.error("Braintree/Paypal integration is currently not enabled on this site's config");
|
|
25899
25604
|
return;
|
|
@@ -25913,7 +25618,7 @@ class PaypalClient {
|
|
|
25913
25618
|
this.client = paypalClient;
|
|
25914
25619
|
});
|
|
25915
25620
|
|
|
25916
|
-
_defineProperty$
|
|
25621
|
+
_defineProperty$4(this, "createPayment", options => {
|
|
25917
25622
|
var _this$config$locale, _this$config$style;
|
|
25918
25623
|
|
|
25919
25624
|
if (!this.client) {
|
|
@@ -25974,7 +25679,7 @@ class PaypalClient {
|
|
|
25974
25679
|
});
|
|
25975
25680
|
});
|
|
25976
25681
|
|
|
25977
|
-
_defineProperty$
|
|
25682
|
+
_defineProperty$4(this, "render", () => {
|
|
25978
25683
|
var _this$config$buttonEl;
|
|
25979
25684
|
|
|
25980
25685
|
if (!this.paypalButton) {
|
|
@@ -26077,7 +25782,7 @@ class PaypalClient {
|
|
|
26077
25782
|
|
|
26078
25783
|
}
|
|
26079
25784
|
|
|
26080
|
-
_defineProperty$
|
|
25785
|
+
_defineProperty$4(PaypalClient, "isPaypalEnabled", () => Boolean(window.Pelcro.site.read().braintree_tokenization));
|
|
26081
25786
|
|
|
26082
25787
|
/**
|
|
26083
25788
|
* PaypalSubscribeButton component
|
|
@@ -26213,7 +25918,7 @@ function SvgLock(props) {
|
|
|
26213
25918
|
}
|
|
26214
25919
|
|
|
26215
25920
|
const SelectedPaymentMethod = () => {
|
|
26216
|
-
var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window$Pelcro$user$r3, _paymentMethod$proper, _paymentMethod$proper2, _paymentMethod$proper3, _paymentMethod$proper4;
|
|
25921
|
+
var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window$Pelcro$user$r3, _paymentMethod$proper, _paymentMethod$proper2, _paymentMethod$proper3, _paymentMethod$proper4, _paymentMethod$proper5;
|
|
26217
25922
|
|
|
26218
25923
|
const {
|
|
26219
25924
|
t
|
|
@@ -26244,9 +25949,9 @@ const SelectedPaymentMethod = () => {
|
|
|
26244
25949
|
className: "plc-flex plc-flex-col plc-text-lg pelcro-payment-method-details"
|
|
26245
25950
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
26246
25951
|
className: "plc-font-semibold"
|
|
26247
|
-
},
|
|
25952
|
+
}, (paymentMethod === null || paymentMethod === void 0 ? void 0 : (_paymentMethod$proper2 = paymentMethod.properties) === null || _paymentMethod$proper2 === void 0 ? void 0 : _paymentMethod$proper2.brand) === "bacs_debit" ? "••••" : "•••• •••• ••••", " ", (_paymentMethod$proper3 = paymentMethod.properties) === null || _paymentMethod$proper3 === void 0 ? void 0 : _paymentMethod$proper3.last4), paymentMethod.properties.brand !== "bacs_debit" && /*#__PURE__*/React__default.createElement("p", {
|
|
26248
25953
|
className: "plc-text-sm plc-text-gray-500"
|
|
26249
|
-
}, t("select.expires"), " ", (_paymentMethod$
|
|
25954
|
+
}, t("select.expires"), " ", (_paymentMethod$proper4 = paymentMethod.properties) === null || _paymentMethod$proper4 === void 0 ? void 0 : _paymentMethod$proper4.exp_month, "/", (_paymentMethod$proper5 = paymentMethod.properties) === null || _paymentMethod$proper5 === void 0 ? void 0 : _paymentMethod$proper5.exp_year))), /*#__PURE__*/React__default.createElement(Button, {
|
|
26250
25955
|
onClick: () => switchView("payment-method-select"),
|
|
26251
25956
|
disabled: isLoading,
|
|
26252
25957
|
variant: "ghost",
|
|
@@ -27859,27 +27564,27 @@ class DefaultNewsLetter extends Component {
|
|
|
27859
27564
|
|
|
27860
27565
|
super(props);
|
|
27861
27566
|
|
|
27862
|
-
_defineProperty$
|
|
27567
|
+
_defineProperty$4(this, "componentDidMount", () => {
|
|
27863
27568
|
document.addEventListener("keydown", this.handleSubmit);
|
|
27864
27569
|
});
|
|
27865
27570
|
|
|
27866
|
-
_defineProperty$
|
|
27571
|
+
_defineProperty$4(this, "componentWillUnmount", () => {
|
|
27867
27572
|
document.removeEventListener("keydown", this.handleSubmit);
|
|
27868
27573
|
});
|
|
27869
27574
|
|
|
27870
|
-
_defineProperty$
|
|
27575
|
+
_defineProperty$4(this, "handleSubmit", e => {
|
|
27871
27576
|
if (e.key === "Enter" && !this.state.disableSubmit) this.submitNewsletter();
|
|
27872
27577
|
});
|
|
27873
27578
|
|
|
27874
|
-
_defineProperty$
|
|
27579
|
+
_defineProperty$4(this, "displayLoginView", () => {
|
|
27875
27580
|
this.props.setView("login");
|
|
27876
27581
|
});
|
|
27877
27582
|
|
|
27878
|
-
_defineProperty$
|
|
27583
|
+
_defineProperty$4(this, "displaySelectView", () => {
|
|
27879
27584
|
this.props.setView("plan-select");
|
|
27880
27585
|
});
|
|
27881
27586
|
|
|
27882
|
-
_defineProperty$
|
|
27587
|
+
_defineProperty$4(this, "submitNewsletter", () => {
|
|
27883
27588
|
this.setState({
|
|
27884
27589
|
disableSubmit: true
|
|
27885
27590
|
});
|
|
@@ -27922,30 +27627,30 @@ class DefaultNewsLetter extends Component {
|
|
|
27922
27627
|
});
|
|
27923
27628
|
});
|
|
27924
27629
|
|
|
27925
|
-
_defineProperty$
|
|
27630
|
+
_defineProperty$4(this, "postSubmit", () => {
|
|
27926
27631
|
window.Pelcro.paywall.setNewsletterExtraVisits(true);
|
|
27927
27632
|
this.props.setView("meter");
|
|
27928
27633
|
});
|
|
27929
27634
|
|
|
27930
|
-
_defineProperty$
|
|
27635
|
+
_defineProperty$4(this, "onEmailChange", event => {
|
|
27931
27636
|
this.setState({
|
|
27932
27637
|
email: event.target.value
|
|
27933
27638
|
});
|
|
27934
27639
|
});
|
|
27935
27640
|
|
|
27936
|
-
_defineProperty$
|
|
27641
|
+
_defineProperty$4(this, "onFirstNameChange", event => {
|
|
27937
27642
|
this.setState({
|
|
27938
27643
|
firstName: event.target.value
|
|
27939
27644
|
});
|
|
27940
27645
|
});
|
|
27941
27646
|
|
|
27942
|
-
_defineProperty$
|
|
27647
|
+
_defineProperty$4(this, "onLastNameChange", event => {
|
|
27943
27648
|
this.setState({
|
|
27944
27649
|
lastName: event.target.value
|
|
27945
27650
|
});
|
|
27946
27651
|
});
|
|
27947
27652
|
|
|
27948
|
-
_defineProperty$
|
|
27653
|
+
_defineProperty$4(this, "onPostalCodeChange", event => {
|
|
27949
27654
|
this.setState({
|
|
27950
27655
|
postalCode: event.target.value
|
|
27951
27656
|
});
|
|
@@ -28531,7 +28236,7 @@ const SubscriptionManageMembersContainer = ({
|
|
|
28531
28236
|
} = usePelcro();
|
|
28532
28237
|
const subscription_id = subscriptionToManageMembers === null || subscriptionToManageMembers === void 0 ? void 0 : subscriptionToManageMembers.id;
|
|
28533
28238
|
|
|
28534
|
-
const handleListMembers = (
|
|
28239
|
+
const handleListMembers = (state, dispatch) => {
|
|
28535
28240
|
var _window$Pelcro, _window$Pelcro$user, _window$Pelcro$user$r;
|
|
28536
28241
|
|
|
28537
28242
|
window.Pelcro.subscription.listMembers({
|
|
@@ -33813,7 +33518,7 @@ const PaymentMethodSelectList = () => {
|
|
|
33813
33518
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
33814
33519
|
className: "plc-px-3 plc-py-2 plc-space-y-4 plc-overflow-y-scroll plc-max-h-80 pelcro-payment-method-select-wrapper"
|
|
33815
33520
|
}, paymentMethods.map(paymentMethod => {
|
|
33816
|
-
var _paymentMethod$proper, _paymentMethod$proper2, _paymentMethod$proper3, _paymentMethod$proper4;
|
|
33521
|
+
var _paymentMethod$proper, _paymentMethod$proper2, _paymentMethod$proper3, _paymentMethod$proper4, _paymentMethod$proper5;
|
|
33817
33522
|
|
|
33818
33523
|
const isSelected = selectedPaymentMethodId === String(paymentMethod.id);
|
|
33819
33524
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -33831,9 +33536,9 @@ const PaymentMethodSelectList = () => {
|
|
|
33831
33536
|
className: "plc-flex plc-flex-col plc-text-lg pelcro-payment-method-details"
|
|
33832
33537
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
33833
33538
|
className: "plc-font-semibold"
|
|
33834
|
-
},
|
|
33539
|
+
}, (paymentMethod === null || paymentMethod === void 0 ? void 0 : (_paymentMethod$proper2 = paymentMethod.properties) === null || _paymentMethod$proper2 === void 0 ? void 0 : _paymentMethod$proper2.brand) === "bacs_debit" ? "••••" : "•••• •••• ••••", " ", paymentMethod === null || paymentMethod === void 0 ? void 0 : (_paymentMethod$proper3 = paymentMethod.properties) === null || _paymentMethod$proper3 === void 0 ? void 0 : _paymentMethod$proper3.last4), paymentMethod.properties.brand !== "bacs_debit" && /*#__PURE__*/React__default.createElement("p", {
|
|
33835
33540
|
className: "plc-text-sm plc-text-gray-500"
|
|
33836
|
-
}, t("select.expires"), " ", (_paymentMethod$
|
|
33541
|
+
}, t("select.expires"), " ", (_paymentMethod$proper4 = paymentMethod.properties) === null || _paymentMethod$proper4 === void 0 ? void 0 : _paymentMethod$proper4.exp_month, "/", (_paymentMethod$proper5 = paymentMethod.properties) === null || _paymentMethod$proper5 === void 0 ? void 0 : _paymentMethod$proper5.exp_year))));
|
|
33837
33542
|
}));
|
|
33838
33543
|
};
|
|
33839
33544
|
|
|
@@ -34179,7 +33884,7 @@ const PaymentMethodDeleteList = props => {
|
|
|
34179
33884
|
}) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, paymentMethods && deleteOption === "select" && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
|
|
34180
33885
|
className: "plc-px-3 plc-py-2 plc-space-y-4 plc-overflow-y-scroll no-scrollbar plc-max-h-80 pelcro-payment-method-select-wrapper plc-mb-4"
|
|
34181
33886
|
}, paymentMethods.filter(paymentMethod => (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id) !== (paymentMethodToDelete === null || paymentMethodToDelete === void 0 ? void 0 : paymentMethodToDelete.id)).map(paymentMethod => {
|
|
34182
|
-
var _paymentMethod$proper, _paymentMethod$proper2, _paymentMethod$proper3, _paymentMethod$proper4;
|
|
33887
|
+
var _paymentMethod$proper, _paymentMethod$proper2, _paymentMethod$proper3, _paymentMethod$proper4, _paymentMethod$proper5;
|
|
34183
33888
|
|
|
34184
33889
|
const isSelected = selectedPaymentMethodId === String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id);
|
|
34185
33890
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -34197,9 +33902,9 @@ const PaymentMethodDeleteList = props => {
|
|
|
34197
33902
|
className: "plc-flex plc-flex-col plc-text-lg pelcro-payment-method-details"
|
|
34198
33903
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
34199
33904
|
className: "plc-font-semibold"
|
|
34200
|
-
}, "
|
|
33905
|
+
}, (paymentMethod === null || paymentMethod === void 0 ? void 0 : (_paymentMethod$proper2 = paymentMethod.properties) === null || _paymentMethod$proper2 === void 0 ? void 0 : _paymentMethod$proper2.brand) === "bacs_debit" ? "••••" : "•••• •••• ••••", " ", (_paymentMethod$proper3 = paymentMethod.properties) === null || _paymentMethod$proper3 === void 0 ? void 0 : _paymentMethod$proper3.last4), paymentMethod.properties.brand !== "bacs_debit" && /*#__PURE__*/React__default.createElement("p", {
|
|
34201
33906
|
className: "plc-text-sm plc-text-gray-500"
|
|
34202
|
-
}, t("select.expires"), " ", (_paymentMethod$
|
|
33907
|
+
}, t("select.expires"), " ", (_paymentMethod$proper4 = paymentMethod.properties) === null || _paymentMethod$proper4 === void 0 ? void 0 : _paymentMethod$proper4.exp_month, "/", (_paymentMethod$proper5 = paymentMethod.properties) === null || _paymentMethod$proper5 === void 0 ? void 0 : _paymentMethod$proper5.exp_year))));
|
|
34203
33908
|
})), /*#__PURE__*/React__default.createElement("div", {
|
|
34204
33909
|
className: "plc-px-3"
|
|
34205
33910
|
}, /*#__PURE__*/React__default.createElement(PaymentMethodDeleteSubmit, null))), deleteOption === "add" && /*#__PURE__*/React__default.createElement(PaymentMethodView, {
|
|
@@ -34552,7 +34257,6 @@ const DashboardContainer = ({
|
|
|
34552
34257
|
type: SET_DISABLESUBMIT,
|
|
34553
34258
|
payload: false
|
|
34554
34259
|
});
|
|
34555
|
-
onClose();
|
|
34556
34260
|
|
|
34557
34261
|
if (err) {
|
|
34558
34262
|
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
@@ -36053,7 +35757,6 @@ const SubscriptionsItems = ({
|
|
|
36053
35757
|
return switchView("email-verify");
|
|
36054
35758
|
}
|
|
36055
35759
|
|
|
36056
|
-
switchView(null);
|
|
36057
35760
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
36058
35761
|
notify.confirm((onSuccess, onFailure) => {
|
|
36059
35762
|
dispatch({
|
|
@@ -37099,12 +36802,14 @@ const PaymentCardsMenu = props => {
|
|
|
37099
36802
|
setPaymentMethodToEdit,
|
|
37100
36803
|
setPaymentMethodToDelete
|
|
37101
36804
|
} = usePelcro();
|
|
37102
|
-
const [sources, setSources] = useState([]);
|
|
37103
|
-
|
|
36805
|
+
const [sources, setSources] = useState([]);
|
|
36806
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
37104
36807
|
useEffect(() => {
|
|
37105
36808
|
window.Pelcro.paymentMethods.list({
|
|
37106
36809
|
auth_token: window.Pelcro.user.read().auth_token
|
|
37107
36810
|
}, (err, res) => {
|
|
36811
|
+
setIsLoading(false);
|
|
36812
|
+
|
|
37108
36813
|
if (err) {
|
|
37109
36814
|
return console.error(err);
|
|
37110
36815
|
}
|
|
@@ -37161,9 +36866,9 @@ const PaymentCardsMenu = props => {
|
|
|
37161
36866
|
|
|
37162
36867
|
return /*#__PURE__*/React__default.createElement(Card, {
|
|
37163
36868
|
id: "pelcro-dashboard-payment-menu",
|
|
37164
|
-
className: "plc-max-w-100% md:plc-max-w-60% plc-m-auto",
|
|
36869
|
+
className: "plc-max-w-100% md:plc-max-w-60% plc-m-auto plc-relative",
|
|
37165
36870
|
title: t("labels.paymentSource")
|
|
37166
|
-
}, /*#__PURE__*/React__default.createElement(PaymentCardsItems, {
|
|
36871
|
+
}, isLoading ? /*#__PURE__*/React__default.createElement(Loader, null) : /*#__PURE__*/React__default.createElement(PaymentCardsItems, {
|
|
37167
36872
|
displaySourceEdit: displaySourceEdit,
|
|
37168
36873
|
onDeletePaymentMethodClick: onDeletePaymentMethodClick,
|
|
37169
36874
|
sources: sources
|
|
@@ -37174,39 +36879,48 @@ const PaymentCardsMenu = props => {
|
|
|
37174
36879
|
};
|
|
37175
36880
|
|
|
37176
36881
|
const PaymentCardsItems = props => {
|
|
37177
|
-
|
|
37178
|
-
|
|
37179
|
-
|
|
36882
|
+
const {
|
|
36883
|
+
t
|
|
36884
|
+
} = useTranslation("dashboard");
|
|
37180
36885
|
|
|
37181
|
-
|
|
37182
|
-
|
|
37183
|
-
|
|
37184
|
-
|
|
37185
|
-
|
|
37186
|
-
|
|
37187
|
-
|
|
37188
|
-
|
|
37189
|
-
|
|
37190
|
-
|
|
37191
|
-
|
|
37192
|
-
|
|
37193
|
-
|
|
37194
|
-
|
|
37195
|
-
|
|
37196
|
-
"
|
|
37197
|
-
|
|
37198
|
-
|
|
37199
|
-
|
|
37200
|
-
|
|
37201
|
-
|
|
37202
|
-
|
|
37203
|
-
|
|
37204
|
-
|
|
37205
|
-
|
|
37206
|
-
|
|
37207
|
-
|
|
37208
|
-
|
|
37209
|
-
|
|
36886
|
+
if (props.sources.length > 0) {
|
|
36887
|
+
return props.sources.sort((a, b) => a.is_default === b.is_default ? 0 : a.is_default ? -1 : 1).map((source, index) => {
|
|
36888
|
+
var _source$properties, _source$properties2, _source$properties3, _source$properties4;
|
|
36889
|
+
|
|
36890
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
36891
|
+
key: "dashboard-source-" + source.id,
|
|
36892
|
+
className: "plc-relative plc-py-4 plc-px-6 plc-mt-5 plc-flex plc-items-center plc-justify-between last:plc-mb-0 plc-rounded plc-text-gray-900 plc-bg-white plc-shadow-md_dark"
|
|
36893
|
+
}, source.is_default && /*#__PURE__*/React__default.createElement("span", {
|
|
36894
|
+
className: "plc-absolute plc--top-3 plc-right-3 plc-rounded-full plc-bg-gray-800 plc-text-white plc-inline-flex plc-h-7 plc-my-auto plc-items-start plc-py-1 plc-px-4 plc-text-sm"
|
|
36895
|
+
}, t("labels.default")), /*#__PURE__*/React__default.createElement("div", {
|
|
36896
|
+
className: "plc-flex plc-items-center"
|
|
36897
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
36898
|
+
className: "plc-mr-6"
|
|
36899
|
+
}, getPaymentCardIcon(source === null || source === void 0 ? void 0 : (_source$properties = source.properties) === null || _source$properties === void 0 ? void 0 : _source$properties.brand)), /*#__PURE__*/React__default.createElement("p", {
|
|
36900
|
+
className: "plc-ml-1 plc-text-lg plc-tracking-widest"
|
|
36901
|
+
}, (source === null || source === void 0 ? void 0 : (_source$properties2 = source.properties) === null || _source$properties2 === void 0 ? void 0 : _source$properties2.brand) === "bacs_debit" ? "••••" : "•••• •••• ••••", " ", source === null || source === void 0 ? void 0 : (_source$properties3 = source.properties) === null || _source$properties3 === void 0 ? void 0 : _source$properties3.last4)), /*#__PURE__*/React__default.createElement("span", {
|
|
36902
|
+
className: "plc-flex-grow"
|
|
36903
|
+
}), (source === null || source === void 0 ? void 0 : (_source$properties4 = source.properties) === null || _source$properties4 === void 0 ? void 0 : _source$properties4.brand) !== "bacs_debit" && /*#__PURE__*/React__default.createElement(Button, {
|
|
36904
|
+
id: "pelcro-button-update-source-" + index,
|
|
36905
|
+
variant: "icon",
|
|
36906
|
+
className: "plc-text-gray-500",
|
|
36907
|
+
"data-key": source.id,
|
|
36908
|
+
icon: /*#__PURE__*/React__default.createElement(SvgEdit, null),
|
|
36909
|
+
onClick: props === null || props === void 0 ? void 0 : props.displaySourceEdit
|
|
36910
|
+
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
36911
|
+
id: "pelcro-button-update-source-" + index,
|
|
36912
|
+
variant: "icon",
|
|
36913
|
+
className: "plc-text-gray-500",
|
|
36914
|
+
"data-key": source.id,
|
|
36915
|
+
icon: /*#__PURE__*/React__default.createElement(SvgTrashCan, null),
|
|
36916
|
+
onClick: () => {
|
|
36917
|
+
props === null || props === void 0 ? void 0 : props.onDeletePaymentMethodClick(source);
|
|
36918
|
+
}
|
|
36919
|
+
}));
|
|
36920
|
+
});
|
|
36921
|
+
} else {
|
|
36922
|
+
return /*#__PURE__*/React__default.createElement("div", null, "you didn't add payment methods yet");
|
|
36923
|
+
}
|
|
37210
36924
|
};
|
|
37211
36925
|
|
|
37212
36926
|
var mode = {
|
|
@@ -42214,4 +41928,4 @@ const QrCodeModal = ({
|
|
|
42214
41928
|
};
|
|
42215
41929
|
QrCodeModal.viewId = "qrcode";
|
|
42216
41930
|
|
|
42217
|
-
export { AddNew, AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplePayButton, ApplyCouponButton, Auth0LoginButton, Badge, BankRedirection, Button, Card, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, Dashboard, DashboardAddresses, DashboardContainer, DashboardContent, DashboardDonations, DashboardGifts, DashboardHeading, DashboardInvoices, DashboardLink, DashboardMemberships, DashboardNewsletters, DashboardOpenButton, DashboardOrders, DashboardPasswordChange, DashboardPaymentCards, DashboardProfile, DashboardQRCode, DashboardSavedItems, DashboardSubscriptions, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, ModalHeader, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateFreeButton, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodCreateContainer, PaymentMethodCreateModal, PaymentMethodCreateView, PaymentMethodDeleteContainer, PaymentMethodDeleteList, PaymentMethodDeleteModal, PaymentMethodDeleteOptions, PaymentMethodDeleteSubmit, PaymentMethodDeleteView, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateSetDefault, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton,
|
|
41931
|
+
export { AddNew, AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplePayButton, ApplyCouponButton, Auth0LoginButton, Badge, BankRedirection, Button, Card, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, Dashboard, DashboardAddresses, DashboardContainer, DashboardContent, DashboardDonations, DashboardGifts, DashboardHeading, DashboardInvoices, DashboardLink, DashboardMemberships, DashboardNewsletters, DashboardOpenButton, DashboardOrders, DashboardPasswordChange, DashboardPaymentCards, DashboardProfile, DashboardQRCode, DashboardSavedItems, DashboardSubscriptions, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, ModalHeader, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateFreeButton, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodCreateContainer, PaymentMethodCreateModal, PaymentMethodCreateView, PaymentMethodDeleteContainer, PaymentMethodDeleteList, PaymentMethodDeleteModal, PaymentMethodDeleteOptions, PaymentMethodDeleteSubmit, PaymentMethodDeleteView, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateSetDefault, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionManageMembersButton, SubscriptionManageMembersContainer, SubscriptionManageMembersEmails, SubscriptionManageMembersList, SubscriptionManageMembersModal, SubscriptionManageMembersView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserNameInput, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateUsername, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };
|