@alma/widgets 3.3.10 → 3.3.12
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/raw/widgets-wc.umd.js +3574 -6584
- package/dist/raw/widgets.js +748 -895
- package/dist/raw/widgets.js.map +1 -1
- package/dist/raw/widgets.m.js +750 -899
- package/dist/raw/widgets.m.js.map +1 -1
- package/dist/raw/widgets.modern.js +653 -758
- package/dist/raw/widgets.modern.js.map +1 -1
- package/dist/raw/widgets.umd.js +3574 -6584
- package/dist/raw/widgets.umd.js.map +1 -1
- package/dist/types/Widgets/EligibilityModal/index.d.ts +2 -2
- package/dist/types/hooks/useFetchEligibility.d.ts +2 -2
- package/dist/types/hooks/useSessionStorage.d.ts +20 -0
- package/dist/types/hooks/useSessionStorage.test.d.ts +1 -0
- package/dist/types/types.d.ts +1 -1
- package/dist/types/utils/utilsForStorage.d.ts +2 -0
- package/dist/types/utils/utilsForStorage.test.d.ts +1 -0
- package/dist/widgets-wc.umd.js +1 -1
- package/dist/widgets-wc.umd.js.map +1 -0
- package/dist/widgets.js +1 -1
- package/dist/widgets.js.map +1 -1
- package/dist/widgets.m.js +1 -1
- package/dist/widgets.m.js.map +1 -1
- package/dist/widgets.modern.js +1 -1
- package/dist/widgets.modern.js.map +1 -1
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,42 +16,37 @@ var fails = function (exec) {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
var functionBindNative = !fails(function () {
|
|
19
|
-
// eslint-disable-next-line es
|
|
20
|
-
var test = function () {
|
|
21
|
-
|
|
22
|
-
}.bind(); // eslint-disable-next-line no-prototype-builtins -- safe
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
20
|
+
var test = function () {/* empty */}.bind();
|
|
21
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
25
22
|
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
26
23
|
});
|
|
27
24
|
|
|
28
25
|
var FunctionPrototype = Function.prototype;
|
|
29
|
-
var bind = FunctionPrototype.bind;
|
|
30
26
|
var call = FunctionPrototype.call;
|
|
31
|
-
var
|
|
32
|
-
var functionUncurryThis = functionBindNative ? function (fn) {
|
|
33
|
-
return
|
|
34
|
-
} : function (fn) {
|
|
35
|
-
return fn && function () {
|
|
27
|
+
var uncurryThisWithBind = functionBindNative && FunctionPrototype.bind.bind(call, call);
|
|
28
|
+
var functionUncurryThis = functionBindNative ? uncurryThisWithBind : function (fn) {
|
|
29
|
+
return function () {
|
|
36
30
|
return call.apply(fn, arguments);
|
|
37
31
|
};
|
|
38
32
|
};
|
|
39
33
|
|
|
40
34
|
var ceil = Math.ceil;
|
|
41
|
-
var floor = Math.floor;
|
|
42
|
-
// https://tc39.es/ecma262/#sec-math.trunc
|
|
43
|
-
// eslint-disable-next-line es-x/no-math-trunc -- safe
|
|
35
|
+
var floor = Math.floor;
|
|
44
36
|
|
|
37
|
+
// `Math.trunc` method
|
|
38
|
+
// https://tc39.es/ecma262/#sec-math.trunc
|
|
39
|
+
// eslint-disable-next-line es/no-math-trunc -- safe
|
|
45
40
|
var mathTrunc = Math.trunc || function trunc(x) {
|
|
46
41
|
var n = +x;
|
|
47
42
|
return (n > 0 ? floor : ceil)(n);
|
|
48
43
|
};
|
|
49
44
|
|
|
45
|
+
// `ToIntegerOrInfinity` abstract operation
|
|
50
46
|
// https://tc39.es/ecma262/#sec-tointegerorinfinity
|
|
51
|
-
|
|
52
47
|
var toIntegerOrInfinity = function (argument) {
|
|
53
|
-
var number = +argument;
|
|
54
|
-
|
|
48
|
+
var number = +argument;
|
|
49
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
55
50
|
return number !== number || number === 0 ? 0 : mathTrunc(number);
|
|
56
51
|
};
|
|
57
52
|
|
|
@@ -72,19 +67,22 @@ function commonjsRequire () {
|
|
|
72
67
|
}
|
|
73
68
|
|
|
74
69
|
var check = function (it) {
|
|
75
|
-
return it && it.Math
|
|
76
|
-
};
|
|
77
|
-
|
|
70
|
+
return it && it.Math === Math && it;
|
|
71
|
+
};
|
|
78
72
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
74
|
+
var global_1 =
|
|
75
|
+
// eslint-disable-next-line es/no-global-this -- safe
|
|
76
|
+
check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) ||
|
|
77
|
+
// eslint-disable-next-line no-restricted-globals -- safe
|
|
78
|
+
check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
|
|
79
|
+
// eslint-disable-next-line no-new-func -- fallback
|
|
82
80
|
function () {
|
|
83
81
|
return this;
|
|
84
82
|
}() || Function('return this')();
|
|
85
83
|
|
|
84
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
86
85
|
var defineProperty = Object.defineProperty;
|
|
87
|
-
|
|
88
86
|
var defineGlobalProperty = function (key, value) {
|
|
89
87
|
try {
|
|
90
88
|
defineProperty(global_1, key, {
|
|
@@ -95,45 +93,54 @@ var defineGlobalProperty = function (key, value) {
|
|
|
95
93
|
} catch (error) {
|
|
96
94
|
global_1[key] = value;
|
|
97
95
|
}
|
|
98
|
-
|
|
99
96
|
return value;
|
|
100
97
|
};
|
|
101
98
|
|
|
102
|
-
var
|
|
103
|
-
var store = global_1[SHARED] || defineGlobalProperty(SHARED, {});
|
|
104
|
-
var sharedStore = store;
|
|
99
|
+
var sharedStore = createCommonjsModule(function (module) {
|
|
105
100
|
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
version: '3.22.8',
|
|
101
|
+
var SHARED = '__core-js_shared__';
|
|
102
|
+
var store = module.exports = global_1[SHARED] || defineGlobalProperty(SHARED, {});
|
|
103
|
+
(store.versions || (store.versions = [])).push({
|
|
104
|
+
version: '3.37.1',
|
|
111
105
|
mode: 'global',
|
|
112
|
-
copyright: '© 2014-
|
|
113
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
106
|
+
copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
|
|
107
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE',
|
|
114
108
|
source: 'https://github.com/zloirock/core-js'
|
|
115
109
|
});
|
|
116
110
|
});
|
|
117
111
|
|
|
118
|
-
var
|
|
119
|
-
|
|
112
|
+
var shared = function (key, value) {
|
|
113
|
+
return sharedStore[key] || (sharedStore[key] = value || {});
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// we can't use just `it == null` since of `document.all` special case
|
|
117
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
|
|
118
|
+
var isNullOrUndefined = function (it) {
|
|
119
|
+
return it === null || it === undefined;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
var $TypeError = TypeError;
|
|
120
123
|
|
|
124
|
+
// `RequireObjectCoercible` abstract operation
|
|
125
|
+
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
121
126
|
var requireObjectCoercible = function (it) {
|
|
122
|
-
if (it
|
|
127
|
+
if (isNullOrUndefined(it)) throw new $TypeError("Can't call method on " + it);
|
|
123
128
|
return it;
|
|
124
129
|
};
|
|
125
130
|
|
|
126
|
-
var $Object = Object;
|
|
127
|
-
// https://tc39.es/ecma262/#sec-toobject
|
|
131
|
+
var $Object = Object;
|
|
128
132
|
|
|
133
|
+
// `ToObject` abstract operation
|
|
134
|
+
// https://tc39.es/ecma262/#sec-toobject
|
|
129
135
|
var toObject = function (argument) {
|
|
130
136
|
return $Object(requireObjectCoercible(argument));
|
|
131
137
|
};
|
|
132
138
|
|
|
133
|
-
var hasOwnProperty = functionUncurryThis({}.hasOwnProperty);
|
|
134
|
-
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
135
|
-
// eslint-disable-next-line es-x/no-object-hasown -- safe
|
|
139
|
+
var hasOwnProperty = functionUncurryThis({}.hasOwnProperty);
|
|
136
140
|
|
|
141
|
+
// `HasOwnProperty` abstract operation
|
|
142
|
+
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
143
|
+
// eslint-disable-next-line es/no-object-hasown -- safe
|
|
137
144
|
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
138
145
|
return hasOwnProperty(toObject(it), key);
|
|
139
146
|
};
|
|
@@ -141,86 +148,62 @@ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
|
141
148
|
var id = 0;
|
|
142
149
|
var postfix = Math.random();
|
|
143
150
|
var toString = functionUncurryThis(1.0.toString);
|
|
144
|
-
|
|
145
151
|
var uid = function (key) {
|
|
146
152
|
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
|
|
147
153
|
};
|
|
148
154
|
|
|
149
|
-
|
|
150
|
-
// https://tc39.es/ecma262/#sec-iscallable
|
|
151
|
-
var isCallable = function (argument) {
|
|
152
|
-
return typeof argument == 'function';
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
var aFunction = function (argument) {
|
|
156
|
-
return isCallable(argument) ? argument : undefined;
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
var getBuiltIn = function (namespace, method) {
|
|
160
|
-
return arguments.length < 2 ? aFunction(global_1[namespace]) : global_1[namespace] && global_1[namespace][method];
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
|
|
155
|
+
var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
|
|
164
156
|
|
|
165
157
|
var process = global_1.process;
|
|
166
158
|
var Deno = global_1.Deno;
|
|
167
159
|
var versions = process && process.versions || Deno && Deno.version;
|
|
168
160
|
var v8 = versions && versions.v8;
|
|
169
161
|
var match, version;
|
|
170
|
-
|
|
171
162
|
if (v8) {
|
|
172
|
-
match = v8.split('.');
|
|
163
|
+
match = v8.split('.');
|
|
164
|
+
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
173
165
|
// but their correct versions are not interesting for us
|
|
174
|
-
|
|
175
166
|
version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
|
176
|
-
}
|
|
177
|
-
// so check `userAgent` even if `.v8` exists, but 0
|
|
178
|
-
|
|
167
|
+
}
|
|
179
168
|
|
|
169
|
+
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
170
|
+
// so check `userAgent` even if `.v8` exists, but 0
|
|
180
171
|
if (!version && engineUserAgent) {
|
|
181
172
|
match = engineUserAgent.match(/Edge\/(\d+)/);
|
|
182
|
-
|
|
183
173
|
if (!match || match[1] >= 74) {
|
|
184
174
|
match = engineUserAgent.match(/Chrome\/(\d+)/);
|
|
185
175
|
if (match) version = +match[1];
|
|
186
176
|
}
|
|
187
177
|
}
|
|
188
|
-
|
|
189
178
|
var engineV8Version = version;
|
|
190
179
|
|
|
191
|
-
/* eslint-disable es
|
|
192
|
-
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
|
|
180
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
193
181
|
|
|
194
|
-
var
|
|
195
|
-
var symbol = Symbol(); // Chrome 38 Symbol has incorrect toString conversion
|
|
196
|
-
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
182
|
+
var $String = global_1.String;
|
|
197
183
|
|
|
198
|
-
|
|
184
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
185
|
+
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
186
|
+
var symbol = Symbol('symbol detection');
|
|
187
|
+
// Chrome 38 Symbol has incorrect toString conversion
|
|
188
|
+
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
189
|
+
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
|
190
|
+
// of course, fail.
|
|
191
|
+
return !$String(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
192
|
+
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
199
193
|
!Symbol.sham && engineV8Version && engineV8Version < 41;
|
|
200
194
|
});
|
|
201
195
|
|
|
202
|
-
/* eslint-disable es
|
|
196
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
203
197
|
|
|
204
|
-
var useSymbolAsUid =
|
|
198
|
+
var useSymbolAsUid = symbolConstructorDetection && !Symbol.sham && typeof Symbol.iterator == 'symbol';
|
|
205
199
|
|
|
206
|
-
var WellKnownSymbolsStore = shared('wks');
|
|
207
200
|
var Symbol$1 = global_1.Symbol;
|
|
208
|
-
var
|
|
209
|
-
var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
|
|
210
|
-
|
|
201
|
+
var WellKnownSymbolsStore = shared('wks');
|
|
202
|
+
var createWellKnownSymbol = useSymbolAsUid ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
|
|
211
203
|
var wellKnownSymbol = function (name) {
|
|
212
|
-
if (!hasOwnProperty_1(WellKnownSymbolsStore, name)
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
if (nativeSymbol && hasOwnProperty_1(Symbol$1, name)) {
|
|
216
|
-
WellKnownSymbolsStore[name] = Symbol$1[name];
|
|
217
|
-
} else if (useSymbolAsUid && symbolFor) {
|
|
218
|
-
WellKnownSymbolsStore[name] = symbolFor(description);
|
|
219
|
-
} else {
|
|
220
|
-
WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
|
|
221
|
-
}
|
|
204
|
+
if (!hasOwnProperty_1(WellKnownSymbolsStore, name)) {
|
|
205
|
+
WellKnownSymbolsStore[name] = symbolConstructorDetection && hasOwnProperty_1(Symbol$1, name) ? Symbol$1[name] : createWellKnownSymbol('Symbol.' + name);
|
|
222
206
|
}
|
|
223
|
-
|
|
224
207
|
return WellKnownSymbolsStore[name];
|
|
225
208
|
};
|
|
226
209
|
|
|
@@ -229,48 +212,60 @@ var test = {};
|
|
|
229
212
|
test[TO_STRING_TAG] = 'z';
|
|
230
213
|
var toStringTagSupport = String(test) === '[object z]';
|
|
231
214
|
|
|
215
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
216
|
+
var documentAll = typeof document == 'object' && document.all;
|
|
217
|
+
|
|
218
|
+
// `IsCallable` abstract operation
|
|
219
|
+
// https://tc39.es/ecma262/#sec-iscallable
|
|
220
|
+
// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
|
|
221
|
+
var isCallable = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
|
|
222
|
+
return typeof argument == 'function' || argument === documentAll;
|
|
223
|
+
} : function (argument) {
|
|
224
|
+
return typeof argument == 'function';
|
|
225
|
+
};
|
|
226
|
+
|
|
232
227
|
var toString$1 = functionUncurryThis({}.toString);
|
|
233
228
|
var stringSlice = functionUncurryThis(''.slice);
|
|
234
|
-
|
|
235
229
|
var classofRaw = function (it) {
|
|
236
230
|
return stringSlice(toString$1(it), 8, -1);
|
|
237
231
|
};
|
|
238
232
|
|
|
239
233
|
var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
|
|
240
|
-
var $Object$1 = Object;
|
|
234
|
+
var $Object$1 = Object;
|
|
241
235
|
|
|
236
|
+
// ES3 wrong here
|
|
242
237
|
var CORRECT_ARGUMENTS = classofRaw(function () {
|
|
243
238
|
return arguments;
|
|
244
|
-
}())
|
|
239
|
+
}()) === 'Arguments';
|
|
245
240
|
|
|
241
|
+
// fallback for IE11 Script Access Denied error
|
|
246
242
|
var tryGet = function (it, key) {
|
|
247
243
|
try {
|
|
248
244
|
return it[key];
|
|
249
|
-
} catch (error) {
|
|
250
|
-
|
|
251
|
-
}
|
|
252
|
-
}; // getting tag from ES6+ `Object.prototype.toString`
|
|
253
|
-
|
|
245
|
+
} catch (error) {/* empty */}
|
|
246
|
+
};
|
|
254
247
|
|
|
248
|
+
// getting tag from ES6+ `Object.prototype.toString`
|
|
255
249
|
var classof = toStringTagSupport ? classofRaw : function (it) {
|
|
256
250
|
var O, tag, result;
|
|
257
|
-
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
258
|
-
|
|
259
|
-
:
|
|
260
|
-
|
|
251
|
+
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
252
|
+
// @@toStringTag case
|
|
253
|
+
: typeof (tag = tryGet(O = $Object$1(it), TO_STRING_TAG$1)) == 'string' ? tag
|
|
254
|
+
// builtinTag case
|
|
255
|
+
: CORRECT_ARGUMENTS ? classofRaw(O)
|
|
256
|
+
// ES3 arguments fallback
|
|
257
|
+
: (result = classofRaw(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result;
|
|
261
258
|
};
|
|
262
259
|
|
|
263
|
-
var $String = String;
|
|
264
|
-
|
|
260
|
+
var $String$1 = String;
|
|
265
261
|
var toString_1 = function (argument) {
|
|
266
|
-
if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
|
|
267
|
-
return $String(argument);
|
|
262
|
+
if (classof(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
|
|
263
|
+
return $String$1(argument);
|
|
268
264
|
};
|
|
269
265
|
|
|
270
266
|
var charAt = functionUncurryThis(''.charAt);
|
|
271
267
|
var charCodeAt = functionUncurryThis(''.charCodeAt);
|
|
272
268
|
var stringSlice$1 = functionUncurryThis(''.slice);
|
|
273
|
-
|
|
274
269
|
var createMethod = function (CONVERT_TO_STRING) {
|
|
275
270
|
return function ($this, pos) {
|
|
276
271
|
var S = toString_1(requireObjectCoercible($this));
|
|
@@ -282,7 +277,6 @@ var createMethod = function (CONVERT_TO_STRING) {
|
|
|
282
277
|
return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? charAt(S, position) : first : CONVERT_TO_STRING ? stringSlice$1(S, position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
283
278
|
};
|
|
284
279
|
};
|
|
285
|
-
|
|
286
280
|
var stringMultibyte = {
|
|
287
281
|
// `String.prototype.codePointAt` method
|
|
288
282
|
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
|
|
@@ -292,67 +286,57 @@ var stringMultibyte = {
|
|
|
292
286
|
charAt: createMethod(true)
|
|
293
287
|
};
|
|
294
288
|
|
|
295
|
-
var functionToString = functionUncurryThis(Function.toString); // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
296
|
-
|
|
297
|
-
if (!isCallable(sharedStore.inspectSource)) {
|
|
298
|
-
sharedStore.inspectSource = function (it) {
|
|
299
|
-
return functionToString(it);
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
var inspectSource = sharedStore.inspectSource;
|
|
304
|
-
|
|
305
289
|
var WeakMap = global_1.WeakMap;
|
|
306
|
-
var
|
|
290
|
+
var weakMapBasicDetection = isCallable(WeakMap) && /native code/.test(String(WeakMap));
|
|
307
291
|
|
|
308
292
|
var isObject = function (it) {
|
|
309
293
|
return typeof it == 'object' ? it !== null : isCallable(it);
|
|
310
294
|
};
|
|
311
295
|
|
|
296
|
+
// Detect IE8's incomplete defineProperty implementation
|
|
312
297
|
var descriptors = !fails(function () {
|
|
313
|
-
// eslint-disable-next-line es
|
|
298
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
314
299
|
return Object.defineProperty({}, 1, {
|
|
315
300
|
get: function () {
|
|
316
301
|
return 7;
|
|
317
302
|
}
|
|
318
|
-
})[1]
|
|
303
|
+
})[1] !== 7;
|
|
319
304
|
});
|
|
320
305
|
|
|
321
|
-
var document$1 = global_1.document;
|
|
322
|
-
|
|
306
|
+
var document$1 = global_1.document;
|
|
307
|
+
// typeof document.createElement is 'object' in old IE
|
|
323
308
|
var EXISTS = isObject(document$1) && isObject(document$1.createElement);
|
|
324
|
-
|
|
325
309
|
var documentCreateElement = function (it) {
|
|
326
310
|
return EXISTS ? document$1.createElement(it) : {};
|
|
327
311
|
};
|
|
328
312
|
|
|
313
|
+
// Thanks to IE8 for its funny defineProperty
|
|
329
314
|
var ie8DomDefine = !descriptors && !fails(function () {
|
|
330
|
-
// eslint-disable-next-line es
|
|
315
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
331
316
|
return Object.defineProperty(documentCreateElement('div'), 'a', {
|
|
332
317
|
get: function () {
|
|
333
318
|
return 7;
|
|
334
319
|
}
|
|
335
|
-
}).a
|
|
320
|
+
}).a !== 7;
|
|
336
321
|
});
|
|
337
322
|
|
|
323
|
+
// V8 ~ Chrome 36-
|
|
338
324
|
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
339
|
-
|
|
340
325
|
var v8PrototypeDefineBug = descriptors && fails(function () {
|
|
341
|
-
// eslint-disable-next-line es
|
|
342
|
-
return Object.defineProperty(function () {
|
|
343
|
-
/* empty */
|
|
344
|
-
}, 'prototype', {
|
|
326
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
327
|
+
return Object.defineProperty(function () {/* empty */}, 'prototype', {
|
|
345
328
|
value: 42,
|
|
346
329
|
writable: false
|
|
347
|
-
}).prototype
|
|
330
|
+
}).prototype !== 42;
|
|
348
331
|
});
|
|
349
332
|
|
|
350
|
-
var $String$
|
|
351
|
-
var $TypeError$1 = TypeError;
|
|
333
|
+
var $String$2 = String;
|
|
334
|
+
var $TypeError$1 = TypeError;
|
|
352
335
|
|
|
336
|
+
// `Assert: Type(argument) is Object`
|
|
353
337
|
var anObject = function (argument) {
|
|
354
338
|
if (isObject(argument)) return argument;
|
|
355
|
-
throw $TypeError$1($String$
|
|
339
|
+
throw new $TypeError$1($String$2(argument) + ' is not an object');
|
|
356
340
|
};
|
|
357
341
|
|
|
358
342
|
var call$1 = Function.prototype.call;
|
|
@@ -360,6 +344,13 @@ var functionCall = functionBindNative ? call$1.bind(call$1) : function () {
|
|
|
360
344
|
return call$1.apply(call$1, arguments);
|
|
361
345
|
};
|
|
362
346
|
|
|
347
|
+
var aFunction = function (argument) {
|
|
348
|
+
return isCallable(argument) ? argument : undefined;
|
|
349
|
+
};
|
|
350
|
+
var getBuiltIn = function (namespace, method) {
|
|
351
|
+
return arguments.length < 2 ? aFunction(global_1[namespace]) : global_1[namespace] && global_1[namespace][method];
|
|
352
|
+
};
|
|
353
|
+
|
|
363
354
|
var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
|
|
364
355
|
|
|
365
356
|
var $Object$2 = Object;
|
|
@@ -370,86 +361,85 @@ var isSymbol = useSymbolAsUid ? function (it) {
|
|
|
370
361
|
return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, $Object$2(it));
|
|
371
362
|
};
|
|
372
363
|
|
|
373
|
-
var $String$
|
|
374
|
-
|
|
364
|
+
var $String$3 = String;
|
|
375
365
|
var tryToString = function (argument) {
|
|
376
366
|
try {
|
|
377
|
-
return $String$
|
|
367
|
+
return $String$3(argument);
|
|
378
368
|
} catch (error) {
|
|
379
369
|
return 'Object';
|
|
380
370
|
}
|
|
381
371
|
};
|
|
382
372
|
|
|
383
|
-
var $TypeError$2 = TypeError;
|
|
373
|
+
var $TypeError$2 = TypeError;
|
|
384
374
|
|
|
375
|
+
// `Assert: IsCallable(argument) is true`
|
|
385
376
|
var aCallable = function (argument) {
|
|
386
377
|
if (isCallable(argument)) return argument;
|
|
387
|
-
throw $TypeError$2(tryToString(argument) + ' is not a function');
|
|
378
|
+
throw new $TypeError$2(tryToString(argument) + ' is not a function');
|
|
388
379
|
};
|
|
389
380
|
|
|
381
|
+
// `GetMethod` abstract operation
|
|
390
382
|
// https://tc39.es/ecma262/#sec-getmethod
|
|
391
|
-
|
|
392
383
|
var getMethod = function (V, P) {
|
|
393
384
|
var func = V[P];
|
|
394
|
-
return func
|
|
385
|
+
return isNullOrUndefined(func) ? undefined : aCallable(func);
|
|
395
386
|
};
|
|
396
387
|
|
|
397
|
-
var $TypeError$3 = TypeError;
|
|
398
|
-
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
388
|
+
var $TypeError$3 = TypeError;
|
|
399
389
|
|
|
390
|
+
// `OrdinaryToPrimitive` abstract operation
|
|
391
|
+
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
400
392
|
var ordinaryToPrimitive = function (input, pref) {
|
|
401
393
|
var fn, val;
|
|
402
394
|
if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) return val;
|
|
403
395
|
if (isCallable(fn = input.valueOf) && !isObject(val = functionCall(fn, input))) return val;
|
|
404
396
|
if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) return val;
|
|
405
|
-
throw $TypeError$3("Can't convert object to primitive value");
|
|
397
|
+
throw new $TypeError$3("Can't convert object to primitive value");
|
|
406
398
|
};
|
|
407
399
|
|
|
408
400
|
var $TypeError$4 = TypeError;
|
|
409
|
-
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
|
410
|
-
// https://tc39.es/ecma262/#sec-toprimitive
|
|
401
|
+
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
|
411
402
|
|
|
403
|
+
// `ToPrimitive` abstract operation
|
|
404
|
+
// https://tc39.es/ecma262/#sec-toprimitive
|
|
412
405
|
var toPrimitive = function (input, pref) {
|
|
413
406
|
if (!isObject(input) || isSymbol(input)) return input;
|
|
414
407
|
var exoticToPrim = getMethod(input, TO_PRIMITIVE);
|
|
415
408
|
var result;
|
|
416
|
-
|
|
417
409
|
if (exoticToPrim) {
|
|
418
410
|
if (pref === undefined) pref = 'default';
|
|
419
411
|
result = functionCall(exoticToPrim, input, pref);
|
|
420
412
|
if (!isObject(result) || isSymbol(result)) return result;
|
|
421
|
-
throw $TypeError$4("Can't convert object to primitive value");
|
|
413
|
+
throw new $TypeError$4("Can't convert object to primitive value");
|
|
422
414
|
}
|
|
423
|
-
|
|
424
415
|
if (pref === undefined) pref = 'number';
|
|
425
416
|
return ordinaryToPrimitive(input, pref);
|
|
426
417
|
};
|
|
427
418
|
|
|
419
|
+
// `ToPropertyKey` abstract operation
|
|
428
420
|
// https://tc39.es/ecma262/#sec-topropertykey
|
|
429
|
-
|
|
430
421
|
var toPropertyKey = function (argument) {
|
|
431
422
|
var key = toPrimitive(argument, 'string');
|
|
432
423
|
return isSymbol(key) ? key : key + '';
|
|
433
424
|
};
|
|
434
425
|
|
|
435
|
-
var $TypeError$5 = TypeError;
|
|
436
|
-
|
|
437
|
-
var $defineProperty = Object.defineProperty;
|
|
438
|
-
|
|
426
|
+
var $TypeError$5 = TypeError;
|
|
427
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
428
|
+
var $defineProperty = Object.defineProperty;
|
|
429
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
439
430
|
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
440
431
|
var ENUMERABLE = 'enumerable';
|
|
441
432
|
var CONFIGURABLE = 'configurable';
|
|
442
|
-
var WRITABLE = 'writable';
|
|
443
|
-
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
433
|
+
var WRITABLE = 'writable';
|
|
444
434
|
|
|
435
|
+
// `Object.defineProperty` method
|
|
436
|
+
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
445
437
|
var f = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
|
|
446
438
|
anObject(O);
|
|
447
439
|
P = toPropertyKey(P);
|
|
448
440
|
anObject(Attributes);
|
|
449
|
-
|
|
450
441
|
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
|
|
451
442
|
var current = $getOwnPropertyDescriptor(O, P);
|
|
452
|
-
|
|
453
443
|
if (current && current[WRITABLE]) {
|
|
454
444
|
O[P] = Attributes.value;
|
|
455
445
|
Attributes = {
|
|
@@ -459,7 +449,6 @@ var f = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attri
|
|
|
459
449
|
};
|
|
460
450
|
}
|
|
461
451
|
}
|
|
462
|
-
|
|
463
452
|
return $defineProperty(O, P, Attributes);
|
|
464
453
|
} : $defineProperty : function defineProperty(O, P, Attributes) {
|
|
465
454
|
anObject(O);
|
|
@@ -467,10 +456,8 @@ var f = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attri
|
|
|
467
456
|
anObject(Attributes);
|
|
468
457
|
if (ie8DomDefine) try {
|
|
469
458
|
return $defineProperty(O, P, Attributes);
|
|
470
|
-
} catch (error) {
|
|
471
|
-
|
|
472
|
-
}
|
|
473
|
-
if ('get' in Attributes || 'set' in Attributes) throw $TypeError$5('Accessors not supported');
|
|
459
|
+
} catch (error) {/* empty */}
|
|
460
|
+
if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$5('Accessors not supported');
|
|
474
461
|
if ('value' in Attributes) O[P] = Attributes.value;
|
|
475
462
|
return O;
|
|
476
463
|
};
|
|
@@ -495,7 +482,6 @@ var createNonEnumerableProperty = descriptors ? function (object, key, value) {
|
|
|
495
482
|
};
|
|
496
483
|
|
|
497
484
|
var keys = shared('keys');
|
|
498
|
-
|
|
499
485
|
var sharedKey = function (key) {
|
|
500
486
|
return keys[key] || (keys[key] = uid(key));
|
|
501
487
|
};
|
|
@@ -506,63 +492,53 @@ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
|
506
492
|
var TypeError$1 = global_1.TypeError;
|
|
507
493
|
var WeakMap$1 = global_1.WeakMap;
|
|
508
494
|
var set, get, has;
|
|
509
|
-
|
|
510
495
|
var enforce = function (it) {
|
|
511
496
|
return has(it) ? get(it) : set(it, {});
|
|
512
497
|
};
|
|
513
|
-
|
|
514
498
|
var getterFor = function (TYPE) {
|
|
515
499
|
return function (it) {
|
|
516
500
|
var state;
|
|
517
|
-
|
|
518
501
|
if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
|
519
|
-
throw TypeError$1('Incompatible receiver, ' + TYPE + ' required');
|
|
502
|
+
throw new TypeError$1('Incompatible receiver, ' + TYPE + ' required');
|
|
520
503
|
}
|
|
521
|
-
|
|
522
504
|
return state;
|
|
523
505
|
};
|
|
524
506
|
};
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
507
|
+
if (weakMapBasicDetection || sharedStore.state) {
|
|
508
|
+
var store = sharedStore.state || (sharedStore.state = new WeakMap$1());
|
|
509
|
+
/* eslint-disable no-self-assign -- prototype methods protection */
|
|
510
|
+
store.get = store.get;
|
|
511
|
+
store.has = store.has;
|
|
512
|
+
store.set = store.set;
|
|
513
|
+
/* eslint-enable no-self-assign -- prototype methods protection */
|
|
532
514
|
set = function (it, metadata) {
|
|
533
|
-
if (
|
|
515
|
+
if (store.has(it)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
534
516
|
metadata.facade = it;
|
|
535
|
-
|
|
517
|
+
store.set(it, metadata);
|
|
536
518
|
return metadata;
|
|
537
519
|
};
|
|
538
|
-
|
|
539
520
|
get = function (it) {
|
|
540
|
-
return
|
|
521
|
+
return store.get(it) || {};
|
|
541
522
|
};
|
|
542
|
-
|
|
543
523
|
has = function (it) {
|
|
544
|
-
return
|
|
524
|
+
return store.has(it);
|
|
545
525
|
};
|
|
546
526
|
} else {
|
|
547
527
|
var STATE = sharedKey('state');
|
|
548
528
|
hiddenKeys[STATE] = true;
|
|
549
|
-
|
|
550
529
|
set = function (it, metadata) {
|
|
551
530
|
if (hasOwnProperty_1(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
552
531
|
metadata.facade = it;
|
|
553
532
|
createNonEnumerableProperty(it, STATE, metadata);
|
|
554
533
|
return metadata;
|
|
555
534
|
};
|
|
556
|
-
|
|
557
535
|
get = function (it) {
|
|
558
536
|
return hasOwnProperty_1(it, STATE) ? it[STATE] : {};
|
|
559
537
|
};
|
|
560
|
-
|
|
561
538
|
has = function (it) {
|
|
562
539
|
return hasOwnProperty_1(it, STATE);
|
|
563
540
|
};
|
|
564
541
|
}
|
|
565
|
-
|
|
566
542
|
var internalState = {
|
|
567
543
|
set: set,
|
|
568
544
|
get: get,
|
|
@@ -571,15 +547,17 @@ var internalState = {
|
|
|
571
547
|
getterFor: getterFor
|
|
572
548
|
};
|
|
573
549
|
|
|
574
|
-
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
575
|
-
|
|
576
|
-
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
550
|
+
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
551
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
552
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
577
553
|
|
|
554
|
+
// Nashorn ~ JDK8 bug
|
|
578
555
|
var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({
|
|
579
556
|
1: 2
|
|
580
|
-
}, 1);
|
|
581
|
-
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
557
|
+
}, 1);
|
|
582
558
|
|
|
559
|
+
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
560
|
+
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
583
561
|
var f$1 = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
584
562
|
var descriptor = getOwnPropertyDescriptor(this, V);
|
|
585
563
|
return !!descriptor && descriptor.enumerable;
|
|
@@ -589,46 +567,46 @@ var objectPropertyIsEnumerable = {
|
|
|
589
567
|
};
|
|
590
568
|
|
|
591
569
|
var $Object$3 = Object;
|
|
592
|
-
var split = functionUncurryThis(''.split);
|
|
570
|
+
var split = functionUncurryThis(''.split);
|
|
593
571
|
|
|
572
|
+
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
594
573
|
var indexedObject = fails(function () {
|
|
595
574
|
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
596
575
|
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
597
576
|
return !$Object$3('z').propertyIsEnumerable(0);
|
|
598
577
|
}) ? function (it) {
|
|
599
|
-
return classofRaw(it)
|
|
578
|
+
return classofRaw(it) === 'String' ? split(it, '') : $Object$3(it);
|
|
600
579
|
} : $Object$3;
|
|
601
580
|
|
|
581
|
+
// toObject with fallback for non-array-like ES3 strings
|
|
582
|
+
|
|
602
583
|
var toIndexedObject = function (it) {
|
|
603
584
|
return indexedObject(requireObjectCoercible(it));
|
|
604
585
|
};
|
|
605
586
|
|
|
606
|
-
|
|
607
|
-
|
|
587
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
588
|
+
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
608
589
|
|
|
590
|
+
// `Object.getOwnPropertyDescriptor` method
|
|
591
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
609
592
|
var f$2 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
|
610
593
|
O = toIndexedObject(O);
|
|
611
594
|
P = toPropertyKey(P);
|
|
612
595
|
if (ie8DomDefine) try {
|
|
613
596
|
return $getOwnPropertyDescriptor$1(O, P);
|
|
614
|
-
} catch (error) {
|
|
615
|
-
/* empty */
|
|
616
|
-
}
|
|
597
|
+
} catch (error) {/* empty */}
|
|
617
598
|
if (hasOwnProperty_1(O, P)) return createPropertyDescriptor(!functionCall(objectPropertyIsEnumerable.f, O, P), O[P]);
|
|
618
599
|
};
|
|
619
600
|
var objectGetOwnPropertyDescriptor = {
|
|
620
601
|
f: f$2
|
|
621
602
|
};
|
|
622
603
|
|
|
623
|
-
var FunctionPrototype$1 = Function.prototype;
|
|
624
|
-
|
|
604
|
+
var FunctionPrototype$1 = Function.prototype;
|
|
605
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
625
606
|
var getDescriptor = descriptors && Object.getOwnPropertyDescriptor;
|
|
626
|
-
var EXISTS$1 = hasOwnProperty_1(FunctionPrototype$1, 'name');
|
|
627
|
-
|
|
628
|
-
var PROPER = EXISTS$1 && function something() {
|
|
629
|
-
/* empty */
|
|
630
|
-
}.name === 'something';
|
|
631
|
-
|
|
607
|
+
var EXISTS$1 = hasOwnProperty_1(FunctionPrototype$1, 'name');
|
|
608
|
+
// additional protection from minified / mangled / dropped function names
|
|
609
|
+
var PROPER = EXISTS$1 && function something() {/* empty */}.name === 'something';
|
|
632
610
|
var CONFIGURABLE$1 = EXISTS$1 && (!descriptors || descriptors && getDescriptor(FunctionPrototype$1, 'name').configurable);
|
|
633
611
|
var functionName = {
|
|
634
612
|
EXISTS: EXISTS$1,
|
|
@@ -636,63 +614,67 @@ var functionName = {
|
|
|
636
614
|
CONFIGURABLE: CONFIGURABLE$1
|
|
637
615
|
};
|
|
638
616
|
|
|
617
|
+
var functionToString = functionUncurryThis(Function.toString);
|
|
618
|
+
|
|
619
|
+
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
620
|
+
if (!isCallable(sharedStore.inspectSource)) {
|
|
621
|
+
sharedStore.inspectSource = function (it) {
|
|
622
|
+
return functionToString(it);
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
var inspectSource = sharedStore.inspectSource;
|
|
626
|
+
|
|
639
627
|
var makeBuiltIn_1 = createCommonjsModule(function (module) {
|
|
628
|
+
|
|
640
629
|
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
641
630
|
var enforceInternalState = internalState.enforce;
|
|
642
|
-
var getInternalState = internalState.get;
|
|
643
|
-
|
|
631
|
+
var getInternalState = internalState.get;
|
|
632
|
+
var $String = String;
|
|
633
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
644
634
|
var defineProperty = Object.defineProperty;
|
|
635
|
+
var stringSlice = functionUncurryThis(''.slice);
|
|
636
|
+
var replace = functionUncurryThis(''.replace);
|
|
637
|
+
var join = functionUncurryThis([].join);
|
|
645
638
|
var CONFIGURABLE_LENGTH = descriptors && !fails(function () {
|
|
646
|
-
return defineProperty(function () {
|
|
647
|
-
/* empty */
|
|
648
|
-
}, 'length', {
|
|
639
|
+
return defineProperty(function () {/* empty */}, 'length', {
|
|
649
640
|
value: 8
|
|
650
641
|
}).length !== 8;
|
|
651
642
|
});
|
|
652
643
|
var TEMPLATE = String(String).split('String');
|
|
653
|
-
|
|
654
644
|
var makeBuiltIn = module.exports = function (value, name, options) {
|
|
655
|
-
if (String(name)
|
|
656
|
-
name = '[' + String(name)
|
|
645
|
+
if (stringSlice($String(name), 0, 7) === 'Symbol(') {
|
|
646
|
+
name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
|
|
657
647
|
}
|
|
658
|
-
|
|
659
648
|
if (options && options.getter) name = 'get ' + name;
|
|
660
649
|
if (options && options.setter) name = 'set ' + name;
|
|
661
|
-
|
|
662
650
|
if (!hasOwnProperty_1(value, 'name') || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
|
|
663
|
-
defineProperty(value, 'name', {
|
|
651
|
+
if (descriptors) defineProperty(value, 'name', {
|
|
664
652
|
value: name,
|
|
665
653
|
configurable: true
|
|
666
|
-
});
|
|
654
|
+
});else value.name = name;
|
|
667
655
|
}
|
|
668
|
-
|
|
669
656
|
if (CONFIGURABLE_LENGTH && options && hasOwnProperty_1(options, 'arity') && value.length !== options.arity) {
|
|
670
657
|
defineProperty(value, 'length', {
|
|
671
658
|
value: options.arity
|
|
672
659
|
});
|
|
673
660
|
}
|
|
674
|
-
|
|
675
661
|
try {
|
|
676
662
|
if (options && hasOwnProperty_1(options, 'constructor') && options.constructor) {
|
|
677
663
|
if (descriptors) defineProperty(value, 'prototype', {
|
|
678
664
|
writable: false
|
|
679
|
-
});
|
|
665
|
+
});
|
|
666
|
+
// in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
|
|
680
667
|
} else if (value.prototype) value.prototype = undefined;
|
|
681
|
-
} catch (error) {
|
|
682
|
-
/* empty */
|
|
683
|
-
}
|
|
684
|
-
|
|
668
|
+
} catch (error) {/* empty */}
|
|
685
669
|
var state = enforceInternalState(value);
|
|
686
|
-
|
|
687
670
|
if (!hasOwnProperty_1(state, 'source')) {
|
|
688
|
-
state.source =
|
|
671
|
+
state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
|
|
689
672
|
}
|
|
690
|
-
|
|
691
673
|
return value;
|
|
692
|
-
};
|
|
693
|
-
// eslint-disable-next-line no-extend-native -- required
|
|
694
|
-
|
|
674
|
+
};
|
|
695
675
|
|
|
676
|
+
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
|
677
|
+
// eslint-disable-next-line no-extend-native -- required
|
|
696
678
|
Function.prototype.toString = makeBuiltIn(function toString() {
|
|
697
679
|
return isCallable(this) && getInternalState(this).source || inspectSource(this);
|
|
698
680
|
}, 'toString');
|
|
@@ -703,59 +685,69 @@ var defineBuiltIn = function (O, key, value, options) {
|
|
|
703
685
|
var simple = options.enumerable;
|
|
704
686
|
var name = options.name !== undefined ? options.name : key;
|
|
705
687
|
if (isCallable(value)) makeBuiltIn_1(value, name, options);
|
|
706
|
-
|
|
707
688
|
if (options.global) {
|
|
708
689
|
if (simple) O[key] = value;else defineGlobalProperty(key, value);
|
|
709
690
|
} else {
|
|
710
|
-
|
|
711
|
-
|
|
691
|
+
try {
|
|
692
|
+
if (!options.unsafe) delete O[key];else if (O[key]) simple = true;
|
|
693
|
+
} catch (error) {/* empty */}
|
|
694
|
+
if (simple) O[key] = value;else objectDefineProperty.f(O, key, {
|
|
695
|
+
value: value,
|
|
696
|
+
enumerable: false,
|
|
697
|
+
configurable: !options.nonConfigurable,
|
|
698
|
+
writable: !options.nonWritable
|
|
699
|
+
});
|
|
712
700
|
}
|
|
713
|
-
|
|
714
701
|
return O;
|
|
715
702
|
};
|
|
716
703
|
|
|
717
704
|
var max = Math.max;
|
|
718
|
-
var min = Math.min;
|
|
705
|
+
var min = Math.min;
|
|
706
|
+
|
|
707
|
+
// Helper for a popular repeating case of the spec:
|
|
719
708
|
// Let integer be ? ToInteger(index).
|
|
720
709
|
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
|
|
721
|
-
|
|
722
710
|
var toAbsoluteIndex = function (index, length) {
|
|
723
711
|
var integer = toIntegerOrInfinity(index);
|
|
724
712
|
return integer < 0 ? max(integer + length, 0) : min(integer, length);
|
|
725
713
|
};
|
|
726
714
|
|
|
727
|
-
var min$1 = Math.min;
|
|
728
|
-
// https://tc39.es/ecma262/#sec-tolength
|
|
715
|
+
var min$1 = Math.min;
|
|
729
716
|
|
|
717
|
+
// `ToLength` abstract operation
|
|
718
|
+
// https://tc39.es/ecma262/#sec-tolength
|
|
730
719
|
var toLength = function (argument) {
|
|
731
|
-
|
|
720
|
+
var len = toIntegerOrInfinity(argument);
|
|
721
|
+
return len > 0 ? min$1(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
|
732
722
|
};
|
|
733
723
|
|
|
724
|
+
// `LengthOfArrayLike` abstract operation
|
|
734
725
|
// https://tc39.es/ecma262/#sec-lengthofarraylike
|
|
735
|
-
|
|
736
726
|
var lengthOfArrayLike = function (obj) {
|
|
737
727
|
return toLength(obj.length);
|
|
738
728
|
};
|
|
739
729
|
|
|
730
|
+
// `Array.prototype.{ indexOf, includes }` methods implementation
|
|
740
731
|
var createMethod$1 = function (IS_INCLUDES) {
|
|
741
732
|
return function ($this, el, fromIndex) {
|
|
742
733
|
var O = toIndexedObject($this);
|
|
743
734
|
var length = lengthOfArrayLike(O);
|
|
735
|
+
if (length === 0) return !IS_INCLUDES && -1;
|
|
744
736
|
var index = toAbsoluteIndex(fromIndex, length);
|
|
745
|
-
var value;
|
|
737
|
+
var value;
|
|
738
|
+
// Array#includes uses SameValueZero equality algorithm
|
|
746
739
|
// eslint-disable-next-line no-self-compare -- NaN check
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
740
|
+
if (IS_INCLUDES && el !== el) while (length > index) {
|
|
741
|
+
value = O[index++];
|
|
742
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
743
|
+
if (value !== value) return true;
|
|
744
|
+
// Array#indexOf ignores holes, Array#includes - not
|
|
752
745
|
} else for (; length > index; index++) {
|
|
753
746
|
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
754
747
|
}
|
|
755
748
|
return !IS_INCLUDES && -1;
|
|
756
749
|
};
|
|
757
750
|
};
|
|
758
|
-
|
|
759
751
|
var arrayIncludes = {
|
|
760
752
|
// `Array.prototype.includes` method
|
|
761
753
|
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
@@ -767,46 +759,43 @@ var arrayIncludes = {
|
|
|
767
759
|
|
|
768
760
|
var indexOf = arrayIncludes.indexOf;
|
|
769
761
|
var push = functionUncurryThis([].push);
|
|
770
|
-
|
|
771
762
|
var objectKeysInternal = function (object, names) {
|
|
772
763
|
var O = toIndexedObject(object);
|
|
773
764
|
var i = 0;
|
|
774
765
|
var result = [];
|
|
775
766
|
var key;
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
767
|
+
for (key in O) !hasOwnProperty_1(hiddenKeys, key) && hasOwnProperty_1(O, key) && push(result, key);
|
|
768
|
+
// Don't enum bug & hidden keys
|
|
780
769
|
while (names.length > i) if (hasOwnProperty_1(O, key = names[i++])) {
|
|
781
770
|
~indexOf(result, key) || push(result, key);
|
|
782
771
|
}
|
|
783
|
-
|
|
784
772
|
return result;
|
|
785
773
|
};
|
|
786
774
|
|
|
787
775
|
// IE8- don't enum bug keys
|
|
788
776
|
var enumBugKeys = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'];
|
|
789
777
|
|
|
790
|
-
var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
|
|
791
|
-
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
792
|
-
// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
|
|
778
|
+
var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
|
|
793
779
|
|
|
780
|
+
// `Object.getOwnPropertyNames` method
|
|
781
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
782
|
+
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
|
794
783
|
var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
795
784
|
return objectKeysInternal(O, hiddenKeys$1);
|
|
796
785
|
};
|
|
797
|
-
|
|
798
786
|
var objectGetOwnPropertyNames = {
|
|
799
787
|
f: f$3
|
|
800
788
|
};
|
|
801
789
|
|
|
802
|
-
// eslint-disable-next-line es
|
|
790
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
|
803
791
|
var f$4 = Object.getOwnPropertySymbols;
|
|
804
792
|
var objectGetOwnPropertySymbols = {
|
|
805
793
|
f: f$4
|
|
806
794
|
};
|
|
807
795
|
|
|
808
|
-
var concat = functionUncurryThis([].concat);
|
|
796
|
+
var concat = functionUncurryThis([].concat);
|
|
809
797
|
|
|
798
|
+
// all object keys, includes non-enumerable and symbols
|
|
810
799
|
var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
811
800
|
var keys = objectGetOwnPropertyNames.f(anObject(it));
|
|
812
801
|
var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
|
|
@@ -817,10 +806,8 @@ var copyConstructorProperties = function (target, source, exceptions) {
|
|
|
817
806
|
var keys = ownKeys(source);
|
|
818
807
|
var defineProperty = objectDefineProperty.f;
|
|
819
808
|
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
820
|
-
|
|
821
809
|
for (var i = 0; i < keys.length; i++) {
|
|
822
810
|
var key = keys[i];
|
|
823
|
-
|
|
824
811
|
if (!hasOwnProperty_1(target, key) && !(exceptions && hasOwnProperty_1(exceptions, key))) {
|
|
825
812
|
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
826
813
|
}
|
|
@@ -828,22 +815,20 @@ var copyConstructorProperties = function (target, source, exceptions) {
|
|
|
828
815
|
};
|
|
829
816
|
|
|
830
817
|
var replacement = /#|\.prototype\./;
|
|
831
|
-
|
|
832
818
|
var isForced = function (feature, detection) {
|
|
833
819
|
var value = data[normalize(feature)];
|
|
834
|
-
return value
|
|
820
|
+
return value === POLYFILL ? true : value === NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
|
|
835
821
|
};
|
|
836
|
-
|
|
837
822
|
var normalize = isForced.normalize = function (string) {
|
|
838
823
|
return String(string).replace(replacement, '.').toLowerCase();
|
|
839
824
|
};
|
|
840
|
-
|
|
841
825
|
var data = isForced.data = {};
|
|
842
826
|
var NATIVE = isForced.NATIVE = 'N';
|
|
843
827
|
var POLYFILL = isForced.POLYFILL = 'P';
|
|
844
828
|
var isForced_1 = isForced;
|
|
845
829
|
|
|
846
830
|
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
|
831
|
+
|
|
847
832
|
/*
|
|
848
833
|
options.target - name of the target object
|
|
849
834
|
options.global - target is the global object
|
|
@@ -859,55 +844,48 @@ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
|
|
859
844
|
options.dontCallGetSet - prevent calling a getter on target
|
|
860
845
|
options.name - the .name of the function if it does not match the key
|
|
861
846
|
*/
|
|
862
|
-
|
|
863
847
|
var _export = function (options, source) {
|
|
864
848
|
var TARGET = options.target;
|
|
865
849
|
var GLOBAL = options.global;
|
|
866
850
|
var STATIC = options.stat;
|
|
867
851
|
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
868
|
-
|
|
869
852
|
if (GLOBAL) {
|
|
870
853
|
target = global_1;
|
|
871
854
|
} else if (STATIC) {
|
|
872
855
|
target = global_1[TARGET] || defineGlobalProperty(TARGET, {});
|
|
873
856
|
} else {
|
|
874
|
-
target =
|
|
857
|
+
target = global_1[TARGET] && global_1[TARGET].prototype;
|
|
875
858
|
}
|
|
876
|
-
|
|
877
859
|
if (target) for (key in source) {
|
|
878
860
|
sourceProperty = source[key];
|
|
879
|
-
|
|
880
861
|
if (options.dontCallGetSet) {
|
|
881
862
|
descriptor = getOwnPropertyDescriptor$1(target, key);
|
|
882
863
|
targetProperty = descriptor && descriptor.value;
|
|
883
864
|
} else targetProperty = target[key];
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
865
|
+
FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
|
866
|
+
// contained in target
|
|
887
867
|
if (!FORCED && targetProperty !== undefined) {
|
|
888
868
|
if (typeof sourceProperty == typeof targetProperty) continue;
|
|
889
869
|
copyConstructorProperties(sourceProperty, targetProperty);
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
|
|
870
|
+
}
|
|
871
|
+
// add a flag to not completely full polyfills
|
|
893
872
|
if (options.sham || targetProperty && targetProperty.sham) {
|
|
894
873
|
createNonEnumerableProperty(sourceProperty, 'sham', true);
|
|
895
874
|
}
|
|
896
|
-
|
|
897
875
|
defineBuiltIn(target, key, sourceProperty, options);
|
|
898
876
|
}
|
|
899
877
|
};
|
|
900
878
|
|
|
879
|
+
// `Object.keys` method
|
|
901
880
|
// https://tc39.es/ecma262/#sec-object.keys
|
|
902
|
-
// eslint-disable-next-line es
|
|
903
|
-
|
|
881
|
+
// eslint-disable-next-line es/no-object-keys -- safe
|
|
904
882
|
var objectKeys = Object.keys || function keys(O) {
|
|
905
883
|
return objectKeysInternal(O, enumBugKeys);
|
|
906
884
|
};
|
|
907
885
|
|
|
886
|
+
// `Object.defineProperties` method
|
|
908
887
|
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
909
|
-
// eslint-disable-next-line es
|
|
910
|
-
|
|
888
|
+
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
|
911
889
|
var f$5 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
912
890
|
anObject(O);
|
|
913
891
|
var props = toIndexedObject(Properties);
|
|
@@ -915,9 +893,7 @@ var f$5 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : funct
|
|
|
915
893
|
var length = keys.length;
|
|
916
894
|
var index = 0;
|
|
917
895
|
var key;
|
|
918
|
-
|
|
919
896
|
while (length > index) objectDefineProperty.f(O, key = keys[index++], props[key]);
|
|
920
|
-
|
|
921
897
|
return O;
|
|
922
898
|
};
|
|
923
899
|
var objectDefineProperties = {
|
|
@@ -933,142 +909,124 @@ var LT = '<';
|
|
|
933
909
|
var PROTOTYPE = 'prototype';
|
|
934
910
|
var SCRIPT = 'script';
|
|
935
911
|
var IE_PROTO = sharedKey('IE_PROTO');
|
|
936
|
-
|
|
937
|
-
var EmptyConstructor = function () {
|
|
938
|
-
/* empty */
|
|
939
|
-
};
|
|
940
|
-
|
|
912
|
+
var EmptyConstructor = function () {/* empty */};
|
|
941
913
|
var scriptTag = function (content) {
|
|
942
914
|
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
|
|
943
|
-
};
|
|
944
|
-
|
|
915
|
+
};
|
|
945
916
|
|
|
917
|
+
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
|
|
946
918
|
var NullProtoObjectViaActiveX = function (activeXDocument) {
|
|
947
919
|
activeXDocument.write(scriptTag(''));
|
|
948
920
|
activeXDocument.close();
|
|
949
921
|
var temp = activeXDocument.parentWindow.Object;
|
|
950
922
|
activeXDocument = null; // avoid memory leak
|
|
951
|
-
|
|
952
923
|
return temp;
|
|
953
|
-
};
|
|
954
|
-
|
|
924
|
+
};
|
|
955
925
|
|
|
926
|
+
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
|
956
927
|
var NullProtoObjectViaIFrame = function () {
|
|
957
928
|
// Thrash, waste and sodomy: IE GC bug
|
|
958
929
|
var iframe = documentCreateElement('iframe');
|
|
959
930
|
var JS = 'java' + SCRIPT + ':';
|
|
960
931
|
var iframeDocument;
|
|
961
932
|
iframe.style.display = 'none';
|
|
962
|
-
html.appendChild(iframe);
|
|
963
|
-
|
|
933
|
+
html.appendChild(iframe);
|
|
934
|
+
// https://github.com/zloirock/core-js/issues/475
|
|
964
935
|
iframe.src = String(JS);
|
|
965
936
|
iframeDocument = iframe.contentWindow.document;
|
|
966
937
|
iframeDocument.open();
|
|
967
938
|
iframeDocument.write(scriptTag('document.F=Object'));
|
|
968
939
|
iframeDocument.close();
|
|
969
940
|
return iframeDocument.F;
|
|
970
|
-
};
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
// Check for document.domain and active x support
|
|
971
944
|
// No need to use active x approach when document.domain is not set
|
|
972
945
|
// see https://github.com/es-shims/es5-shim/issues/150
|
|
973
946
|
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
|
|
974
947
|
// avoid IE GC bug
|
|
975
|
-
|
|
976
|
-
|
|
977
948
|
var activeXDocument;
|
|
978
|
-
|
|
979
949
|
var NullProtoObject = function () {
|
|
980
950
|
try {
|
|
981
951
|
activeXDocument = new ActiveXObject('htmlfile');
|
|
982
|
-
} catch (error) {
|
|
983
|
-
/* ignore */
|
|
984
|
-
}
|
|
985
|
-
|
|
952
|
+
} catch (error) {/* ignore */}
|
|
986
953
|
NullProtoObject = typeof document != 'undefined' ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) // old IE
|
|
987
954
|
: NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument); // WSH
|
|
988
|
-
|
|
989
955
|
var length = enumBugKeys.length;
|
|
990
|
-
|
|
991
956
|
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
|
|
992
|
-
|
|
993
957
|
return NullProtoObject();
|
|
994
958
|
};
|
|
959
|
+
hiddenKeys[IE_PROTO] = true;
|
|
995
960
|
|
|
996
|
-
|
|
961
|
+
// `Object.create` method
|
|
997
962
|
// https://tc39.es/ecma262/#sec-object.create
|
|
998
|
-
// eslint-disable-next-line es
|
|
999
|
-
|
|
963
|
+
// eslint-disable-next-line es/no-object-create -- safe
|
|
1000
964
|
var objectCreate = Object.create || function create(O, Properties) {
|
|
1001
965
|
var result;
|
|
1002
|
-
|
|
1003
966
|
if (O !== null) {
|
|
1004
967
|
EmptyConstructor[PROTOTYPE] = anObject(O);
|
|
1005
968
|
result = new EmptyConstructor();
|
|
1006
|
-
EmptyConstructor[PROTOTYPE] = null;
|
|
1007
|
-
|
|
969
|
+
EmptyConstructor[PROTOTYPE] = null;
|
|
970
|
+
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
1008
971
|
result[IE_PROTO] = O;
|
|
1009
972
|
} else result = NullProtoObject();
|
|
1010
|
-
|
|
1011
973
|
return Properties === undefined ? result : objectDefineProperties.f(result, Properties);
|
|
1012
974
|
};
|
|
1013
975
|
|
|
1014
976
|
var correctPrototypeGetter = !fails(function () {
|
|
1015
|
-
function F() {
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
F.prototype.constructor = null; // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
|
|
1020
|
-
|
|
977
|
+
function F() {/* empty */}
|
|
978
|
+
F.prototype.constructor = null;
|
|
979
|
+
// eslint-disable-next-line es/no-object-getprototypeof -- required for testing
|
|
1021
980
|
return Object.getPrototypeOf(new F()) !== F.prototype;
|
|
1022
981
|
});
|
|
1023
982
|
|
|
1024
983
|
var IE_PROTO$1 = sharedKey('IE_PROTO');
|
|
1025
984
|
var $Object$4 = Object;
|
|
1026
|
-
var ObjectPrototype = $Object$4.prototype;
|
|
1027
|
-
// https://tc39.es/ecma262/#sec-object.getprototypeof
|
|
1028
|
-
// eslint-disable-next-line es-x/no-object-getprototypeof -- safe
|
|
985
|
+
var ObjectPrototype = $Object$4.prototype;
|
|
1029
986
|
|
|
987
|
+
// `Object.getPrototypeOf` method
|
|
988
|
+
// https://tc39.es/ecma262/#sec-object.getprototypeof
|
|
989
|
+
// eslint-disable-next-line es/no-object-getprototypeof -- safe
|
|
1030
990
|
var objectGetPrototypeOf = correctPrototypeGetter ? $Object$4.getPrototypeOf : function (O) {
|
|
1031
991
|
var object = toObject(O);
|
|
1032
992
|
if (hasOwnProperty_1(object, IE_PROTO$1)) return object[IE_PROTO$1];
|
|
1033
993
|
var constructor = object.constructor;
|
|
1034
|
-
|
|
1035
994
|
if (isCallable(constructor) && object instanceof constructor) {
|
|
1036
995
|
return constructor.prototype;
|
|
1037
996
|
}
|
|
1038
|
-
|
|
1039
997
|
return object instanceof $Object$4 ? ObjectPrototype : null;
|
|
1040
998
|
};
|
|
1041
999
|
|
|
1042
1000
|
var ITERATOR = wellKnownSymbol('iterator');
|
|
1043
|
-
var BUGGY_SAFARI_ITERATORS = false;
|
|
1044
|
-
// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
|
|
1001
|
+
var BUGGY_SAFARI_ITERATORS = false;
|
|
1045
1002
|
|
|
1003
|
+
// `%IteratorPrototype%` object
|
|
1004
|
+
// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
|
|
1046
1005
|
var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
|
|
1047
|
-
/* eslint-disable es-x/no-array-prototype-keys -- safe */
|
|
1048
1006
|
|
|
1007
|
+
/* eslint-disable es/no-array-prototype-keys -- safe */
|
|
1049
1008
|
if ([].keys) {
|
|
1050
|
-
arrayIterator = [].keys();
|
|
1051
|
-
|
|
1009
|
+
arrayIterator = [].keys();
|
|
1010
|
+
// Safari 8 has buggy iterators w/o `next`
|
|
1052
1011
|
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;else {
|
|
1053
1012
|
PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
|
|
1054
1013
|
if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
|
|
1055
1014
|
}
|
|
1056
1015
|
}
|
|
1057
|
-
|
|
1058
|
-
var
|
|
1059
|
-
|
|
1060
|
-
|
|
1016
|
+
var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () {
|
|
1017
|
+
var test = {};
|
|
1018
|
+
// FF44- legacy iterators case
|
|
1061
1019
|
return IteratorPrototype[ITERATOR].call(test) !== test;
|
|
1062
1020
|
});
|
|
1063
|
-
if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
|
|
1064
|
-
// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
|
|
1021
|
+
if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
|
|
1065
1022
|
|
|
1023
|
+
// `%IteratorPrototype%[@@iterator]()` method
|
|
1024
|
+
// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
|
|
1066
1025
|
if (!isCallable(IteratorPrototype[ITERATOR])) {
|
|
1067
1026
|
defineBuiltIn(IteratorPrototype, ITERATOR, function () {
|
|
1068
1027
|
return this;
|
|
1069
1028
|
});
|
|
1070
1029
|
}
|
|
1071
|
-
|
|
1072
1030
|
var iteratorsCore = {
|
|
1073
1031
|
IteratorPrototype: IteratorPrototype,
|
|
1074
1032
|
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
|
|
@@ -1076,10 +1034,8 @@ var iteratorsCore = {
|
|
|
1076
1034
|
|
|
1077
1035
|
var defineProperty$1 = objectDefineProperty.f;
|
|
1078
1036
|
var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
|
|
1079
|
-
|
|
1080
1037
|
var setToStringTag = function (target, TAG, STATIC) {
|
|
1081
1038
|
if (target && !STATIC) target = target.prototype;
|
|
1082
|
-
|
|
1083
1039
|
if (target && !hasOwnProperty_1(target, TO_STRING_TAG$2)) {
|
|
1084
1040
|
defineProperty$1(target, TO_STRING_TAG$2, {
|
|
1085
1041
|
configurable: true,
|
|
@@ -1091,12 +1047,10 @@ var setToStringTag = function (target, TAG, STATIC) {
|
|
|
1091
1047
|
var iterators = {};
|
|
1092
1048
|
|
|
1093
1049
|
var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
|
|
1094
|
-
|
|
1095
1050
|
var returnThis = function () {
|
|
1096
1051
|
return this;
|
|
1097
1052
|
};
|
|
1098
|
-
|
|
1099
|
-
var createIteratorConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
|
|
1053
|
+
var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
|
|
1100
1054
|
var TO_STRING_TAG = NAME + ' Iterator';
|
|
1101
1055
|
IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, {
|
|
1102
1056
|
next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next)
|
|
@@ -1106,37 +1060,43 @@ var createIteratorConstructor = function (IteratorConstructor, NAME, next, ENUME
|
|
|
1106
1060
|
return IteratorConstructor;
|
|
1107
1061
|
};
|
|
1108
1062
|
|
|
1109
|
-
var
|
|
1110
|
-
|
|
1063
|
+
var functionUncurryThisAccessor = function (object, key, method) {
|
|
1064
|
+
try {
|
|
1065
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
1066
|
+
return functionUncurryThis(aCallable(Object.getOwnPropertyDescriptor(object, key)[method]));
|
|
1067
|
+
} catch (error) {/* empty */}
|
|
1068
|
+
};
|
|
1069
|
+
|
|
1070
|
+
var isPossiblePrototype = function (argument) {
|
|
1071
|
+
return isObject(argument) || argument === null;
|
|
1072
|
+
};
|
|
1111
1073
|
|
|
1074
|
+
var $String$4 = String;
|
|
1075
|
+
var $TypeError$6 = TypeError;
|
|
1112
1076
|
var aPossiblePrototype = function (argument) {
|
|
1113
|
-
if (
|
|
1114
|
-
throw $TypeError$6("Can't set " + $String$
|
|
1077
|
+
if (isPossiblePrototype(argument)) return argument;
|
|
1078
|
+
throw new $TypeError$6("Can't set " + $String$4(argument) + ' as a prototype');
|
|
1115
1079
|
};
|
|
1116
1080
|
|
|
1117
1081
|
/* eslint-disable no-proto -- safe */
|
|
1082
|
+
|
|
1118
1083
|
// `Object.setPrototypeOf` method
|
|
1119
1084
|
// https://tc39.es/ecma262/#sec-object.setprototypeof
|
|
1120
1085
|
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
1121
|
-
// eslint-disable-next-line es
|
|
1122
|
-
|
|
1086
|
+
// eslint-disable-next-line es/no-object-setprototypeof -- safe
|
|
1123
1087
|
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
|
1124
1088
|
var CORRECT_SETTER = false;
|
|
1125
1089
|
var test = {};
|
|
1126
1090
|
var setter;
|
|
1127
|
-
|
|
1128
1091
|
try {
|
|
1129
|
-
|
|
1130
|
-
setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
|
|
1092
|
+
setter = functionUncurryThisAccessor(Object.prototype, '__proto__', 'set');
|
|
1131
1093
|
setter(test, []);
|
|
1132
1094
|
CORRECT_SETTER = test instanceof Array;
|
|
1133
|
-
} catch (error) {
|
|
1134
|
-
/* empty */
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1095
|
+
} catch (error) {/* empty */}
|
|
1137
1096
|
return function setPrototypeOf(O, proto) {
|
|
1138
|
-
|
|
1097
|
+
requireObjectCoercible(O);
|
|
1139
1098
|
aPossiblePrototype(proto);
|
|
1099
|
+
if (!isObject(O)) return O;
|
|
1140
1100
|
if (CORRECT_SETTER) setter(O, proto);else O.__proto__ = proto;
|
|
1141
1101
|
return O;
|
|
1142
1102
|
};
|
|
@@ -1150,51 +1110,43 @@ var ITERATOR$1 = wellKnownSymbol('iterator');
|
|
|
1150
1110
|
var KEYS = 'keys';
|
|
1151
1111
|
var VALUES = 'values';
|
|
1152
1112
|
var ENTRIES = 'entries';
|
|
1153
|
-
|
|
1154
1113
|
var returnThis$1 = function () {
|
|
1155
1114
|
return this;
|
|
1156
1115
|
};
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
createIteratorConstructor(IteratorConstructor, NAME, next);
|
|
1160
|
-
|
|
1116
|
+
var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
|
|
1117
|
+
iteratorCreateConstructor(IteratorConstructor, NAME, next);
|
|
1161
1118
|
var getIterationMethod = function (KIND) {
|
|
1162
1119
|
if (KIND === DEFAULT && defaultIterator) return defaultIterator;
|
|
1163
|
-
if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
|
|
1164
|
-
|
|
1120
|
+
if (!BUGGY_SAFARI_ITERATORS$1 && KIND && KIND in IterablePrototype) return IterablePrototype[KIND];
|
|
1165
1121
|
switch (KIND) {
|
|
1166
1122
|
case KEYS:
|
|
1167
1123
|
return function keys() {
|
|
1168
1124
|
return new IteratorConstructor(this, KIND);
|
|
1169
1125
|
};
|
|
1170
|
-
|
|
1171
1126
|
case VALUES:
|
|
1172
1127
|
return function values() {
|
|
1173
1128
|
return new IteratorConstructor(this, KIND);
|
|
1174
1129
|
};
|
|
1175
|
-
|
|
1176
1130
|
case ENTRIES:
|
|
1177
1131
|
return function entries() {
|
|
1178
1132
|
return new IteratorConstructor(this, KIND);
|
|
1179
1133
|
};
|
|
1180
1134
|
}
|
|
1181
|
-
|
|
1182
1135
|
return function () {
|
|
1183
1136
|
return new IteratorConstructor(this);
|
|
1184
1137
|
};
|
|
1185
1138
|
};
|
|
1186
|
-
|
|
1187
1139
|
var TO_STRING_TAG = NAME + ' Iterator';
|
|
1188
1140
|
var INCORRECT_VALUES_NAME = false;
|
|
1189
1141
|
var IterablePrototype = Iterable.prototype;
|
|
1190
1142
|
var nativeIterator = IterablePrototype[ITERATOR$1] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
|
|
1191
1143
|
var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);
|
|
1192
|
-
var anyNativeIterator = NAME
|
|
1193
|
-
var CurrentIteratorPrototype, methods, KEY;
|
|
1144
|
+
var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
|
|
1145
|
+
var CurrentIteratorPrototype, methods, KEY;
|
|
1194
1146
|
|
|
1147
|
+
// fix native
|
|
1195
1148
|
if (anyNativeIterator) {
|
|
1196
1149
|
CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
|
|
1197
|
-
|
|
1198
1150
|
if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
|
|
1199
1151
|
if ( objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) {
|
|
1200
1152
|
if (objectSetPrototypeOf) {
|
|
@@ -1202,27 +1154,25 @@ var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
|
|
|
1202
1154
|
} else if (!isCallable(CurrentIteratorPrototype[ITERATOR$1])) {
|
|
1203
1155
|
defineBuiltIn(CurrentIteratorPrototype, ITERATOR$1, returnThis$1);
|
|
1204
1156
|
}
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1157
|
+
}
|
|
1158
|
+
// Set @@toStringTag to native iterators
|
|
1208
1159
|
setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
|
|
1209
1160
|
}
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1161
|
+
}
|
|
1212
1162
|
|
|
1213
|
-
|
|
1163
|
+
// fix Array.prototype.{ values, @@iterator }.name in V8 / FF
|
|
1164
|
+
if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
|
|
1214
1165
|
if ( CONFIGURABLE_FUNCTION_NAME) {
|
|
1215
1166
|
createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
|
|
1216
1167
|
} else {
|
|
1217
1168
|
INCORRECT_VALUES_NAME = true;
|
|
1218
|
-
|
|
1219
1169
|
defaultIterator = function values() {
|
|
1220
1170
|
return functionCall(nativeIterator, this);
|
|
1221
1171
|
};
|
|
1222
1172
|
}
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1173
|
+
}
|
|
1225
1174
|
|
|
1175
|
+
// export additional methods
|
|
1226
1176
|
if (DEFAULT) {
|
|
1227
1177
|
methods = {
|
|
1228
1178
|
values: getIterationMethod(VALUES),
|
|
@@ -1238,55 +1188,66 @@ var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
|
|
|
1238
1188
|
proto: true,
|
|
1239
1189
|
forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME
|
|
1240
1190
|
}, methods);
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1191
|
+
}
|
|
1243
1192
|
|
|
1193
|
+
// define iterator
|
|
1244
1194
|
if ( IterablePrototype[ITERATOR$1] !== defaultIterator) {
|
|
1245
1195
|
defineBuiltIn(IterablePrototype, ITERATOR$1, defaultIterator, {
|
|
1246
1196
|
name: DEFAULT
|
|
1247
1197
|
});
|
|
1248
1198
|
}
|
|
1249
|
-
|
|
1250
1199
|
iterators[NAME] = defaultIterator;
|
|
1251
1200
|
return methods;
|
|
1252
1201
|
};
|
|
1253
1202
|
|
|
1203
|
+
// `CreateIterResultObject` abstract operation
|
|
1204
|
+
// https://tc39.es/ecma262/#sec-createiterresultobject
|
|
1205
|
+
var createIterResultObject = function (value, done) {
|
|
1206
|
+
return {
|
|
1207
|
+
value: value,
|
|
1208
|
+
done: done
|
|
1209
|
+
};
|
|
1210
|
+
};
|
|
1211
|
+
|
|
1254
1212
|
var charAt$1 = stringMultibyte.charAt;
|
|
1255
1213
|
var STRING_ITERATOR = 'String Iterator';
|
|
1256
1214
|
var setInternalState = internalState.set;
|
|
1257
|
-
var getInternalState = internalState.getterFor(STRING_ITERATOR);
|
|
1258
|
-
// https://tc39.es/ecma262/#sec-string.prototype-@@iterator
|
|
1215
|
+
var getInternalState = internalState.getterFor(STRING_ITERATOR);
|
|
1259
1216
|
|
|
1260
|
-
|
|
1217
|
+
// `String.prototype[@@iterator]` method
|
|
1218
|
+
// https://tc39.es/ecma262/#sec-string.prototype-@@iterator
|
|
1219
|
+
iteratorDefine(String, 'String', function (iterated) {
|
|
1261
1220
|
setInternalState(this, {
|
|
1262
1221
|
type: STRING_ITERATOR,
|
|
1263
1222
|
string: toString_1(iterated),
|
|
1264
1223
|
index: 0
|
|
1265
|
-
});
|
|
1224
|
+
});
|
|
1225
|
+
// `%StringIteratorPrototype%.next` method
|
|
1266
1226
|
// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
|
|
1267
1227
|
}, function next() {
|
|
1268
1228
|
var state = getInternalState(this);
|
|
1269
1229
|
var string = state.string;
|
|
1270
1230
|
var index = state.index;
|
|
1271
1231
|
var point;
|
|
1272
|
-
if (index >= string.length) return
|
|
1273
|
-
value: undefined,
|
|
1274
|
-
done: true
|
|
1275
|
-
};
|
|
1232
|
+
if (index >= string.length) return createIterResultObject(undefined, true);
|
|
1276
1233
|
point = charAt$1(string, index);
|
|
1277
1234
|
state.index += point.length;
|
|
1278
|
-
return
|
|
1279
|
-
value: point,
|
|
1280
|
-
done: false
|
|
1281
|
-
};
|
|
1235
|
+
return createIterResultObject(point, false);
|
|
1282
1236
|
});
|
|
1283
1237
|
|
|
1284
|
-
var
|
|
1238
|
+
var functionUncurryThisClause = function (fn) {
|
|
1239
|
+
// Nashorn bug:
|
|
1240
|
+
// https://github.com/zloirock/core-js/issues/1128
|
|
1241
|
+
// https://github.com/zloirock/core-js/issues/1130
|
|
1242
|
+
if (classofRaw(fn) === 'Function') return functionUncurryThis(fn);
|
|
1243
|
+
};
|
|
1244
|
+
|
|
1245
|
+
var bind = functionUncurryThisClause(functionUncurryThisClause.bind);
|
|
1285
1246
|
|
|
1247
|
+
// optional / simple context binding
|
|
1286
1248
|
var functionBindContext = function (fn, that) {
|
|
1287
1249
|
aCallable(fn);
|
|
1288
|
-
return that === undefined ? fn : functionBindNative ? bind
|
|
1289
|
-
/* ...args */
|
|
1250
|
+
return that === undefined ? fn : functionBindNative ? bind(fn, that) : function /* ...args */
|
|
1290
1251
|
() {
|
|
1291
1252
|
return fn.apply(that, arguments);
|
|
1292
1253
|
};
|
|
@@ -1295,27 +1256,24 @@ var functionBindContext = function (fn, that) {
|
|
|
1295
1256
|
var iteratorClose = function (iterator, kind, value) {
|
|
1296
1257
|
var innerResult, innerError;
|
|
1297
1258
|
anObject(iterator);
|
|
1298
|
-
|
|
1299
1259
|
try {
|
|
1300
1260
|
innerResult = getMethod(iterator, 'return');
|
|
1301
|
-
|
|
1302
1261
|
if (!innerResult) {
|
|
1303
1262
|
if (kind === 'throw') throw value;
|
|
1304
1263
|
return value;
|
|
1305
1264
|
}
|
|
1306
|
-
|
|
1307
1265
|
innerResult = functionCall(innerResult, iterator);
|
|
1308
1266
|
} catch (error) {
|
|
1309
1267
|
innerError = true;
|
|
1310
1268
|
innerResult = error;
|
|
1311
1269
|
}
|
|
1312
|
-
|
|
1313
1270
|
if (kind === 'throw') throw value;
|
|
1314
1271
|
if (innerError) throw innerResult;
|
|
1315
1272
|
anObject(innerResult);
|
|
1316
1273
|
return value;
|
|
1317
1274
|
};
|
|
1318
1275
|
|
|
1276
|
+
// call something on iterator step with safe closing on error
|
|
1319
1277
|
var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
|
|
1320
1278
|
try {
|
|
1321
1279
|
return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
|
|
@@ -1325,43 +1283,35 @@ var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
|
|
|
1325
1283
|
};
|
|
1326
1284
|
|
|
1327
1285
|
var ITERATOR$2 = wellKnownSymbol('iterator');
|
|
1328
|
-
var ArrayPrototype = Array.prototype;
|
|
1286
|
+
var ArrayPrototype = Array.prototype;
|
|
1329
1287
|
|
|
1288
|
+
// check on default Array iterator
|
|
1330
1289
|
var isArrayIteratorMethod = function (it) {
|
|
1331
1290
|
return it !== undefined && (iterators.Array === it || ArrayPrototype[ITERATOR$2] === it);
|
|
1332
1291
|
};
|
|
1333
1292
|
|
|
1334
|
-
var noop = function () {
|
|
1335
|
-
/* empty */
|
|
1336
|
-
};
|
|
1337
|
-
|
|
1338
|
-
var empty = [];
|
|
1293
|
+
var noop = function () {/* empty */};
|
|
1339
1294
|
var construct = getBuiltIn('Reflect', 'construct');
|
|
1340
1295
|
var constructorRegExp = /^\s*(?:class|function)\b/;
|
|
1341
1296
|
var exec = functionUncurryThis(constructorRegExp.exec);
|
|
1342
|
-
var INCORRECT_TO_STRING = !constructorRegExp.
|
|
1343
|
-
|
|
1297
|
+
var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
|
|
1344
1298
|
var isConstructorModern = function isConstructor(argument) {
|
|
1345
1299
|
if (!isCallable(argument)) return false;
|
|
1346
|
-
|
|
1347
1300
|
try {
|
|
1348
|
-
construct(noop,
|
|
1301
|
+
construct(noop, [], argument);
|
|
1349
1302
|
return true;
|
|
1350
1303
|
} catch (error) {
|
|
1351
1304
|
return false;
|
|
1352
1305
|
}
|
|
1353
1306
|
};
|
|
1354
|
-
|
|
1355
1307
|
var isConstructorLegacy = function isConstructor(argument) {
|
|
1356
1308
|
if (!isCallable(argument)) return false;
|
|
1357
|
-
|
|
1358
1309
|
switch (classof(argument)) {
|
|
1359
1310
|
case 'AsyncFunction':
|
|
1360
1311
|
case 'GeneratorFunction':
|
|
1361
1312
|
case 'AsyncGeneratorFunction':
|
|
1362
1313
|
return false;
|
|
1363
1314
|
}
|
|
1364
|
-
|
|
1365
1315
|
try {
|
|
1366
1316
|
// we can't check .prototype since constructors produced by .bind haven't it
|
|
1367
1317
|
// `Function#toString` throws on some built-it function in some legacy engines
|
|
@@ -1371,10 +1321,10 @@ var isConstructorLegacy = function isConstructor(argument) {
|
|
|
1371
1321
|
return true;
|
|
1372
1322
|
}
|
|
1373
1323
|
};
|
|
1324
|
+
isConstructorLegacy.sham = true;
|
|
1374
1325
|
|
|
1375
|
-
|
|
1326
|
+
// `IsConstructor` abstract operation
|
|
1376
1327
|
// https://tc39.es/ecma262/#sec-isconstructor
|
|
1377
|
-
|
|
1378
1328
|
var isConstructor = !construct || fails(function () {
|
|
1379
1329
|
var called;
|
|
1380
1330
|
return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function () {
|
|
@@ -1383,30 +1333,26 @@ var isConstructor = !construct || fails(function () {
|
|
|
1383
1333
|
}) ? isConstructorLegacy : isConstructorModern;
|
|
1384
1334
|
|
|
1385
1335
|
var createProperty = function (object, key, value) {
|
|
1386
|
-
|
|
1387
|
-
if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));else object[propertyKey] = value;
|
|
1336
|
+
if (descriptors) objectDefineProperty.f(object, key, createPropertyDescriptor(0, value));else object[key] = value;
|
|
1388
1337
|
};
|
|
1389
1338
|
|
|
1390
1339
|
var ITERATOR$3 = wellKnownSymbol('iterator');
|
|
1391
|
-
|
|
1392
1340
|
var getIteratorMethod = function (it) {
|
|
1393
|
-
if (it
|
|
1341
|
+
if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR$3) || getMethod(it, '@@iterator') || iterators[classof(it)];
|
|
1394
1342
|
};
|
|
1395
1343
|
|
|
1396
1344
|
var $TypeError$7 = TypeError;
|
|
1397
|
-
|
|
1398
1345
|
var getIterator = function (argument, usingIterator) {
|
|
1399
1346
|
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
|
|
1400
1347
|
if (aCallable(iteratorMethod)) return anObject(functionCall(iteratorMethod, argument));
|
|
1401
|
-
throw $TypeError$7(tryToString(argument) + ' is not iterable');
|
|
1348
|
+
throw new $TypeError$7(tryToString(argument) + ' is not iterable');
|
|
1402
1349
|
};
|
|
1403
1350
|
|
|
1404
|
-
var $Array = Array;
|
|
1405
|
-
// https://tc39.es/ecma262/#sec-array.from
|
|
1351
|
+
var $Array = Array;
|
|
1406
1352
|
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
) {
|
|
1353
|
+
// `Array.from` method implementation
|
|
1354
|
+
// https://tc39.es/ecma262/#sec-array.from
|
|
1355
|
+
var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
|
|
1410
1356
|
var O = toObject(arrayLike);
|
|
1411
1357
|
var IS_CONSTRUCTOR = isConstructor(this);
|
|
1412
1358
|
var argumentsLength = arguments.length;
|
|
@@ -1415,13 +1361,12 @@ var arrayFrom = function from(arrayLike
|
|
|
1415
1361
|
if (mapping) mapfn = functionBindContext(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
|
|
1416
1362
|
var iteratorMethod = getIteratorMethod(O);
|
|
1417
1363
|
var index = 0;
|
|
1418
|
-
var length, result, step, iterator, next, value;
|
|
1419
|
-
|
|
1364
|
+
var length, result, step, iterator, next, value;
|
|
1365
|
+
// if the target is not iterable or it's an array with the default iterator - use a simple case
|
|
1420
1366
|
if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) {
|
|
1367
|
+
result = IS_CONSTRUCTOR ? new this() : [];
|
|
1421
1368
|
iterator = getIterator(O, iteratorMethod);
|
|
1422
1369
|
next = iterator.next;
|
|
1423
|
-
result = IS_CONSTRUCTOR ? new this() : [];
|
|
1424
|
-
|
|
1425
1370
|
for (; !(step = functionCall(next, iterator)).done; index++) {
|
|
1426
1371
|
value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
|
|
1427
1372
|
createProperty(result, index, value);
|
|
@@ -1429,20 +1374,17 @@ var arrayFrom = function from(arrayLike
|
|
|
1429
1374
|
} else {
|
|
1430
1375
|
length = lengthOfArrayLike(O);
|
|
1431
1376
|
result = IS_CONSTRUCTOR ? new this(length) : $Array(length);
|
|
1432
|
-
|
|
1433
1377
|
for (; length > index; index++) {
|
|
1434
1378
|
value = mapping ? mapfn(O[index], index) : O[index];
|
|
1435
1379
|
createProperty(result, index, value);
|
|
1436
1380
|
}
|
|
1437
1381
|
}
|
|
1438
|
-
|
|
1439
1382
|
result.length = index;
|
|
1440
1383
|
return result;
|
|
1441
1384
|
};
|
|
1442
1385
|
|
|
1443
1386
|
var ITERATOR$4 = wellKnownSymbol('iterator');
|
|
1444
1387
|
var SAFE_CLOSING = false;
|
|
1445
|
-
|
|
1446
1388
|
try {
|
|
1447
1389
|
var called = 0;
|
|
1448
1390
|
var iteratorWithReturn = {
|
|
@@ -1455,26 +1397,23 @@ try {
|
|
|
1455
1397
|
SAFE_CLOSING = true;
|
|
1456
1398
|
}
|
|
1457
1399
|
};
|
|
1458
|
-
|
|
1459
1400
|
iteratorWithReturn[ITERATOR$4] = function () {
|
|
1460
1401
|
return this;
|
|
1461
|
-
};
|
|
1462
|
-
|
|
1463
|
-
|
|
1402
|
+
};
|
|
1403
|
+
// eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
|
|
1464
1404
|
Array.from(iteratorWithReturn, function () {
|
|
1465
1405
|
throw 2;
|
|
1466
1406
|
});
|
|
1467
|
-
} catch (error) {
|
|
1468
|
-
/* empty */
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1407
|
+
} catch (error) {/* empty */}
|
|
1471
1408
|
var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
|
|
1472
|
-
|
|
1409
|
+
try {
|
|
1410
|
+
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
|
|
1411
|
+
} catch (error) {
|
|
1412
|
+
return false;
|
|
1413
|
+
} // workaround of old WebKit + `eval` bug
|
|
1473
1414
|
var ITERATION_SUPPORT = false;
|
|
1474
|
-
|
|
1475
1415
|
try {
|
|
1476
1416
|
var object = {};
|
|
1477
|
-
|
|
1478
1417
|
object[ITERATOR$4] = function () {
|
|
1479
1418
|
return {
|
|
1480
1419
|
next: function () {
|
|
@@ -1484,21 +1423,18 @@ var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
|
|
|
1484
1423
|
}
|
|
1485
1424
|
};
|
|
1486
1425
|
};
|
|
1487
|
-
|
|
1488
1426
|
exec(object);
|
|
1489
|
-
} catch (error) {
|
|
1490
|
-
/* empty */
|
|
1491
|
-
}
|
|
1492
|
-
|
|
1427
|
+
} catch (error) {/* empty */}
|
|
1493
1428
|
return ITERATION_SUPPORT;
|
|
1494
1429
|
};
|
|
1495
1430
|
|
|
1496
1431
|
var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
|
|
1497
|
-
// eslint-disable-next-line es
|
|
1432
|
+
// eslint-disable-next-line es/no-array-from -- required for testing
|
|
1498
1433
|
Array.from(iterable);
|
|
1499
|
-
});
|
|
1500
|
-
// https://tc39.es/ecma262/#sec-array.from
|
|
1434
|
+
});
|
|
1501
1435
|
|
|
1436
|
+
// `Array.from` method
|
|
1437
|
+
// https://tc39.es/ecma262/#sec-array.from
|
|
1502
1438
|
_export({
|
|
1503
1439
|
target: 'Array',
|
|
1504
1440
|
stat: true,
|
|
@@ -1508,22 +1444,17 @@ _export({
|
|
|
1508
1444
|
});
|
|
1509
1445
|
|
|
1510
1446
|
var widgetTypes;
|
|
1511
|
-
|
|
1512
1447
|
(function (widgetTypes) {
|
|
1513
1448
|
widgetTypes["PaymentPlans"] = "PaymentPlans";
|
|
1514
1449
|
widgetTypes["Modal"] = "Modal";
|
|
1515
1450
|
})(widgetTypes || (widgetTypes = {}));
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
apiStatus["FAILED"] = "failed";
|
|
1523
|
-
})(apiStatus || (apiStatus = {}));
|
|
1524
|
-
|
|
1451
|
+
var statusResponse;
|
|
1452
|
+
(function (statusResponse) {
|
|
1453
|
+
statusResponse["PENDING"] = "pending";
|
|
1454
|
+
statusResponse["SUCCESS"] = "success";
|
|
1455
|
+
statusResponse["FAILED"] = "failed";
|
|
1456
|
+
})(statusResponse || (statusResponse = {}));
|
|
1525
1457
|
var Locale;
|
|
1526
|
-
|
|
1527
1458
|
(function (Locale) {
|
|
1528
1459
|
Locale["en"] = "en";
|
|
1529
1460
|
Locale["fr-FR"] = "fr-FR";
|
|
@@ -1554,93 +1485,77 @@ const desktopWidth = 800;
|
|
|
1554
1485
|
const isP1X = plan => (plan == null ? void 0 : plan.installments_count) === 1 && (plan == null ? void 0 : plan.deferred_days) === 0 && (plan == null ? void 0 : plan.deferred_months) === 0;
|
|
1555
1486
|
|
|
1556
1487
|
/* eslint-disable */
|
|
1557
|
-
|
|
1558
1488
|
(function (ElementProto) {
|
|
1559
1489
|
if (typeof ElementProto.matches !== 'function') {
|
|
1560
1490
|
ElementProto.matches = ElementProto.msMatchesSelector || ElementProto.mozMatchesSelector || ElementProto.webkitMatchesSelector || function matches(selector) {
|
|
1561
1491
|
var element = this;
|
|
1562
1492
|
var elements = (element.document || element.ownerDocument).querySelectorAll(selector);
|
|
1563
1493
|
var index = 0;
|
|
1564
|
-
|
|
1565
1494
|
while (elements[index] && elements[index] !== element) {
|
|
1566
1495
|
++index;
|
|
1567
1496
|
}
|
|
1568
|
-
|
|
1569
1497
|
return Boolean(elements[index]);
|
|
1570
1498
|
};
|
|
1571
1499
|
}
|
|
1572
|
-
|
|
1573
1500
|
if (typeof ElementProto.closest !== 'function') {
|
|
1574
1501
|
ElementProto.closest = function closest(selector) {
|
|
1575
1502
|
var element = this;
|
|
1576
|
-
|
|
1577
1503
|
while (element && element.nodeType === 1) {
|
|
1578
1504
|
if (element.matches(selector)) {
|
|
1579
1505
|
return element;
|
|
1580
1506
|
}
|
|
1581
|
-
|
|
1582
1507
|
element = element.parentNode;
|
|
1583
1508
|
}
|
|
1584
|
-
|
|
1585
1509
|
return null;
|
|
1586
1510
|
};
|
|
1587
1511
|
}
|
|
1588
1512
|
})(window.Element.prototype);
|
|
1513
|
+
|
|
1589
1514
|
/*
|
|
1590
1515
|
* Element.prototype.classList polyfill
|
|
1591
1516
|
*/
|
|
1592
|
-
// 1. String.prototype.trim polyfill
|
|
1593
|
-
|
|
1594
1517
|
|
|
1518
|
+
// 1. String.prototype.trim polyfill
|
|
1595
1519
|
if (!''.trim) String.prototype.trim = function () {
|
|
1596
1520
|
return this.replace(/^[\s]+|[\s]+$/g, '');
|
|
1597
1521
|
};
|
|
1598
|
-
|
|
1599
1522
|
(function (window) {
|
|
1600
1523
|
|
|
1524
|
+
// prevent global namespace pollution
|
|
1601
1525
|
if (!window.DOMException) (DOMException = function (reason) {
|
|
1602
1526
|
this.message = reason;
|
|
1603
1527
|
}).prototype = new Error();
|
|
1604
|
-
|
|
1605
1528
|
var wsRE = /[\11\12\14\15\40]/,
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1529
|
+
wsIndex = 0,
|
|
1530
|
+
checkIfValidClassListEntry = function checkIfValidClassListEntry(O, V) {
|
|
1531
|
+
if (V === '') throw new DOMException("Failed to execute '" + O + "' on 'DOMTokenList': The token provided must not be empty.");
|
|
1532
|
+
if ((wsIndex = V.search(wsRE)) !== -1) throw new DOMException("Failed to execute '" + O + "' on 'DOMTokenList': " + "The token provided ('" + V[wsIndex] + "') contains HTML space characters, which are not valid in tokens.");
|
|
1533
|
+
};
|
|
1534
|
+
// 2. Implement the barebones DOMTokenList livelyness polyfill
|
|
1613
1535
|
if (typeof DOMTokenList !== 'function') (function (window) {
|
|
1614
1536
|
var document = window.document,
|
|
1615
|
-
|
|
1616
|
-
|
|
1537
|
+
Object = window.Object,
|
|
1538
|
+
hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1617
1539
|
var defineProperty = Object.defineProperty,
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1540
|
+
allowTokenListConstruction = 0,
|
|
1541
|
+
skipPropChange = 0;
|
|
1621
1542
|
var DOMTokenList = function DOMTokenList() {
|
|
1622
1543
|
if (!allowTokenListConstruction) throw TypeError('Illegal constructor'); // internally let it through
|
|
1623
1544
|
};
|
|
1624
|
-
|
|
1625
1545
|
DOMTokenList.prototype.toString = DOMTokenList.prototype.toLocaleString = function () {
|
|
1626
1546
|
return this.value;
|
|
1627
1547
|
};
|
|
1628
|
-
|
|
1629
1548
|
DOMTokenList.prototype.add = function () {
|
|
1630
1549
|
a: for (var v = 0, argLen = arguments.length, val = '', ele = this[' uCL'], proto = ele[' uCLp']; v !== argLen; ++v) {
|
|
1631
1550
|
val = arguments[v] + '', checkIfValidClassListEntry('add', val);
|
|
1632
|
-
|
|
1633
1551
|
for (var i = 0, Len = proto.length, resStr = val; i !== Len; ++i) if (this[i] === val) continue a;else resStr += ' ' + this[i];
|
|
1634
|
-
|
|
1635
1552
|
this[Len] = val, proto.length += 1, proto.value = resStr;
|
|
1636
1553
|
}
|
|
1637
1554
|
skipPropChange = 1, ele.className = proto.value, skipPropChange = 0;
|
|
1638
1555
|
};
|
|
1639
|
-
|
|
1640
1556
|
DOMTokenList.prototype.remove = function () {
|
|
1641
1557
|
for (var v = 0, argLen = arguments.length, val = '', ele = this[' uCL'], proto = ele[' uCLp']; v !== argLen; ++v) {
|
|
1642
1558
|
val = arguments[v] + '', checkIfValidClassListEntry('remove', val);
|
|
1643
|
-
|
|
1644
1559
|
for (var i = 0, Len = proto.length, resStr = '', is = 0; i !== Len; ++i) if (is) {
|
|
1645
1560
|
this[i - 1] = this[i];
|
|
1646
1561
|
} else {
|
|
@@ -1650,72 +1565,55 @@ if (!''.trim) String.prototype.trim = function () {
|
|
|
1650
1565
|
is = 1;
|
|
1651
1566
|
}
|
|
1652
1567
|
}
|
|
1653
|
-
|
|
1654
1568
|
if (!is) continue;
|
|
1655
1569
|
delete this[Len], proto.length -= 1, proto.value = resStr;
|
|
1656
1570
|
}
|
|
1657
1571
|
skipPropChange = 1, ele.className = proto.value, skipPropChange = 0;
|
|
1658
1572
|
};
|
|
1659
|
-
|
|
1660
1573
|
window.DOMTokenList = DOMTokenList;
|
|
1661
|
-
|
|
1662
1574
|
function whenPropChanges() {
|
|
1663
1575
|
var evt = window.event,
|
|
1664
|
-
|
|
1665
|
-
|
|
1576
|
+
prop = evt.propertyName;
|
|
1666
1577
|
if (!skipPropChange && (prop === 'className' || prop === 'classList' && !defineProperty)) {
|
|
1667
1578
|
var target = evt.srcElement,
|
|
1668
|
-
|
|
1669
|
-
|
|
1579
|
+
protoObjProto = target[' uCLp'],
|
|
1580
|
+
strval = '' + target[prop];
|
|
1670
1581
|
var tokens = strval.trim().split(wsRE),
|
|
1671
|
-
|
|
1582
|
+
resTokenList = target[prop === 'classList' ? ' uCL' : 'classList'];
|
|
1672
1583
|
var oldLen = protoObjProto.length;
|
|
1673
|
-
|
|
1674
1584
|
a: for (var cI = 0, cLen = protoObjProto.length = tokens.length, sub = 0; cI !== cLen; ++cI) {
|
|
1675
1585
|
for (var innerI = 0; innerI !== cI; ++innerI) if (tokens[innerI] === tokens[cI]) {
|
|
1676
1586
|
sub++;
|
|
1677
1587
|
continue a;
|
|
1678
1588
|
}
|
|
1679
|
-
|
|
1680
1589
|
resTokenList[cI - sub] = tokens[cI];
|
|
1681
1590
|
}
|
|
1682
|
-
|
|
1683
1591
|
for (var i = cLen - sub; i < oldLen; ++i) delete resTokenList[i]; //remove trailing indexs
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
1592
|
if (prop !== 'classList') return;
|
|
1687
1593
|
skipPropChange = 1, target.classList = resTokenList, target.className = strval;
|
|
1688
1594
|
skipPropChange = 0, resTokenList.length = tokens.length - sub;
|
|
1689
1595
|
}
|
|
1690
1596
|
}
|
|
1691
|
-
|
|
1692
1597
|
function polyfillClassList(ele) {
|
|
1693
1598
|
if (!ele || !('innerHTML' in ele)) throw TypeError('Illegal invocation');
|
|
1694
1599
|
ele.detachEvent('onpropertychange', whenPropChanges); // prevent duplicate handler infinite loop
|
|
1695
|
-
|
|
1696
1600
|
allowTokenListConstruction = 1;
|
|
1697
|
-
|
|
1698
1601
|
try {
|
|
1699
1602
|
var protoObj = function protoObj() {};
|
|
1700
|
-
|
|
1701
1603
|
protoObj.prototype = new DOMTokenList();
|
|
1702
1604
|
} finally {
|
|
1703
1605
|
allowTokenListConstruction = 0;
|
|
1704
1606
|
}
|
|
1705
|
-
|
|
1706
1607
|
var protoObjProto = protoObj.prototype,
|
|
1707
|
-
|
|
1708
|
-
|
|
1608
|
+
resTokenList = new protoObj();
|
|
1709
1609
|
a: for (var toks = ele.className.trim().split(wsRE), cI = 0, cLen = toks.length, sub = 0; cI !== cLen; ++cI) {
|
|
1710
1610
|
for (var innerI = 0; innerI !== cI; ++innerI) if (toks[innerI] === toks[cI]) {
|
|
1711
1611
|
sub++;
|
|
1712
1612
|
continue a;
|
|
1713
1613
|
}
|
|
1714
|
-
|
|
1715
1614
|
this[cI - sub] = toks[cI];
|
|
1716
1615
|
}
|
|
1717
1616
|
protoObjProto.length = cLen - sub, protoObjProto.value = ele.className, protoObjProto[' uCL'] = ele;
|
|
1718
|
-
|
|
1719
1617
|
if (defineProperty) {
|
|
1720
1618
|
defineProperty(ele, 'classList', {
|
|
1721
1619
|
// IE8 & IE9 allow defineProperty on the DOM
|
|
@@ -1727,19 +1625,15 @@ if (!''.trim) String.prototype.trim = function () {
|
|
|
1727
1625
|
set: function (newVal) {
|
|
1728
1626
|
skipPropChange = 1, ele.className = protoObjProto.value = newVal += '', skipPropChange = 0;
|
|
1729
1627
|
var toks = newVal.trim().split(wsRE),
|
|
1730
|
-
|
|
1731
|
-
|
|
1628
|
+
oldLen = protoObjProto.length;
|
|
1732
1629
|
a: for (var cI = 0, cLen = protoObjProto.length = toks.length, sub = 0; cI !== cLen; ++cI) {
|
|
1733
1630
|
for (var innerI = 0; innerI !== cI; ++innerI) if (toks[innerI] === toks[cI]) {
|
|
1734
1631
|
sub++;
|
|
1735
1632
|
continue a;
|
|
1736
1633
|
}
|
|
1737
|
-
|
|
1738
1634
|
resTokenList[cI - sub] = toks[cI];
|
|
1739
1635
|
}
|
|
1740
|
-
|
|
1741
1636
|
for (var i = cLen - sub; i < oldLen; ++i) delete resTokenList[i]; //remove trailing indexs
|
|
1742
|
-
|
|
1743
1637
|
}
|
|
1744
1638
|
});
|
|
1745
1639
|
defineProperty(ele, ' uCLp', {
|
|
@@ -1758,10 +1652,8 @@ if (!''.trim) String.prototype.trim = function () {
|
|
|
1758
1652
|
} else {
|
|
1759
1653
|
ele.classList = resTokenList, ele[' uCL'] = resTokenList, ele[' uCLp'] = protoObj.prototype;
|
|
1760
1654
|
}
|
|
1761
|
-
|
|
1762
1655
|
ele.attachEvent('onpropertychange', whenPropChanges);
|
|
1763
1656
|
}
|
|
1764
|
-
|
|
1765
1657
|
try {
|
|
1766
1658
|
// Much faster & cleaner version for IE8 & IE9:
|
|
1767
1659
|
// Should work in IE8 because Element.prototype instanceof Node is true according to the specs
|
|
@@ -1778,27 +1670,26 @@ if (!''.trim) String.prototype.trim = function () {
|
|
|
1778
1670
|
});
|
|
1779
1671
|
} catch (e) {
|
|
1780
1672
|
// Less performant fallback for older browsers (IE 6-8):
|
|
1781
|
-
window[' uCL'] = polyfillClassList;
|
|
1782
|
-
|
|
1783
|
-
document.documentElement.firstChild.appendChild(document.createElement('style')).styleSheet.cssText = '_*{x-uCLp:expression(!this.hasOwnProperty("classList")&&window[" uCL"](this))}' +
|
|
1673
|
+
window[' uCL'] = polyfillClassList;
|
|
1674
|
+
// the below code ensures polyfillClassList is applied to all current and future elements in the doc.
|
|
1675
|
+
document.documentElement.firstChild.appendChild(document.createElement('style')).styleSheet.cssText = '_*{x-uCLp:expression(!this.hasOwnProperty("classList")&&window[" uCL"](this))}' +
|
|
1676
|
+
// IE6
|
|
1784
1677
|
'[class]{x-uCLp/**/:expression(!this.hasOwnProperty("classList")&&window[" uCL"](this))}'; //IE7-8
|
|
1785
1678
|
}
|
|
1786
|
-
})(window)
|
|
1679
|
+
})(window)
|
|
1680
|
+
// 3. Patch in unsupported methods in DOMTokenList
|
|
1787
1681
|
;
|
|
1788
|
-
|
|
1789
1682
|
(function (DOMTokenListProto, testClass) {
|
|
1790
1683
|
if (!DOMTokenListProto.item) DOMTokenListProto.item = function (i) {
|
|
1791
1684
|
function NullCheck(n) {
|
|
1792
1685
|
return n === void 0 ? null : n;
|
|
1793
1686
|
}
|
|
1794
|
-
|
|
1795
1687
|
return NullCheck(this[i]);
|
|
1796
1688
|
};
|
|
1797
1689
|
if (!DOMTokenListProto.toggle || testClass.toggle('a', 0) !== false) DOMTokenListProto.toggle = function (val) {
|
|
1798
1690
|
if (arguments.length > 1) return this[arguments[1] ? 'add' : 'remove'](val), !!arguments[1];
|
|
1799
1691
|
var oldValue = this.value;
|
|
1800
|
-
return this.remove(oldValue), oldValue === this.value && (this.add(val), true);
|
|
1801
|
-
/*|| false*/
|
|
1692
|
+
return this.remove(oldValue), oldValue === this.value && (this.add(val), true); /*|| false*/
|
|
1802
1693
|
};
|
|
1803
1694
|
if (!DOMTokenListProto.replace || typeof testClass.replace('a', 'b') !== 'boolean') DOMTokenListProto.replace = function (oldToken, newToken) {
|
|
1804
1695
|
checkIfValidClassListEntry('replace', oldToken), checkIfValidClassListEntry('replace', newToken);
|
|
@@ -1807,7 +1698,6 @@ if (!''.trim) String.prototype.trim = function () {
|
|
|
1807
1698
|
};
|
|
1808
1699
|
if (!DOMTokenListProto.contains) DOMTokenListProto.contains = function (value) {
|
|
1809
1700
|
for (var i = 0, Len = this.length; i !== Len; ++i) if (this[i] === value) return true;
|
|
1810
|
-
|
|
1811
1701
|
return false;
|
|
1812
1702
|
};
|
|
1813
1703
|
if (!DOMTokenListProto.forEach) DOMTokenListProto.forEach = function (f) {
|
|
@@ -1815,7 +1705,7 @@ if (!''.trim) String.prototype.trim = function () {
|
|
|
1815
1705
|
};
|
|
1816
1706
|
if (!DOMTokenListProto.entries) DOMTokenListProto.entries = function () {
|
|
1817
1707
|
var nextIndex = 0,
|
|
1818
|
-
|
|
1708
|
+
that = this;
|
|
1819
1709
|
return {
|
|
1820
1710
|
next: function () {
|
|
1821
1711
|
return nextIndex < that.length ? {
|
|
@@ -1829,7 +1719,7 @@ if (!''.trim) String.prototype.trim = function () {
|
|
|
1829
1719
|
};
|
|
1830
1720
|
if (!DOMTokenListProto.values) DOMTokenListProto.values = function () {
|
|
1831
1721
|
var nextIndex = 0,
|
|
1832
|
-
|
|
1722
|
+
that = this;
|
|
1833
1723
|
return {
|
|
1834
1724
|
next: function () {
|
|
1835
1725
|
return nextIndex < that.length ? {
|
|
@@ -1843,7 +1733,7 @@ if (!''.trim) String.prototype.trim = function () {
|
|
|
1843
1733
|
};
|
|
1844
1734
|
if (!DOMTokenListProto.keys) DOMTokenListProto.keys = function () {
|
|
1845
1735
|
var nextIndex = 0,
|
|
1846
|
-
|
|
1736
|
+
that = this;
|
|
1847
1737
|
return {
|
|
1848
1738
|
next: function () {
|
|
1849
1739
|
return nextIndex < that.length ? {
|
|
@@ -1864,11 +1754,11 @@ var messagesDE = {
|
|
|
1864
1754
|
"credit-features.total-credit-cost": "Davon Kreditkosten",
|
|
1865
1755
|
"eligibility-modal.bullet-1": "Wählen Sie <strong>Alma</strong> beim Check-out. ",
|
|
1866
1756
|
"eligibility-modal.bullet-2": "Lassen Sie sich führen und bestätigen Sie Ihre Zahlung in <strong>2 Minuten.</strong>",
|
|
1867
|
-
"eligibility-modal.bullet-3": "<strong>
|
|
1757
|
+
"eligibility-modal.bullet-3": "<strong>Behalten Sie die Kontrolle</strong> , indem Sie Ihre Fälligkeitstermine in Ihrem eigenen Tempo vor- oder zurückverlegen.",
|
|
1868
1758
|
"eligibility-modal.no-eligibility": "Ups, die Prüfung hat anscheinend nicht funktioniert.",
|
|
1869
1759
|
"eligibility-modal.p1x-bullet-1": "Wählen Sie <strong>Alma - Jetzt bezahlen</strong> zum Zeitpunkt der Zahlung.",
|
|
1870
1760
|
"eligibility-modal.p1x-bullet-2": "Tragen Sie Ihre <strong>Kreditkarteninformationen ein.</strong>",
|
|
1871
|
-
"eligibility-modal.p1x-bullet-3": "<strong>
|
|
1761
|
+
"eligibility-modal.p1x-bullet-3": "<strong> Die Bestätigung </strong> Ihrer Zahlung erfolgt sofort !",
|
|
1872
1762
|
"eligibility-modal.title-deferred-plan": "Zahlen Sie mit Alma in Raten oder später.",
|
|
1873
1763
|
"eligibility-modal.title-normal": "Zahlen Sie mit Alma in mehreren Raten.",
|
|
1874
1764
|
"eligibility-modal.title-pay-now": "Bezahlen Sie auf einmal mit Alma per Kreditkarte.",
|
|
@@ -1894,11 +1784,11 @@ var messagesEN = {
|
|
|
1894
1784
|
"credit-features.total-credit-cost": "Of which cost of credit",
|
|
1895
1785
|
"eligibility-modal.bullet-1": "Choose <strong>Alma</strong> at checkout.",
|
|
1896
1786
|
"eligibility-modal.bullet-2": "Let us guide you and validate your payment in <strong>2 minutes.</strong>",
|
|
1897
|
-
"eligibility-modal.bullet-3": "<strong>Stay in control</strong> by
|
|
1787
|
+
"eligibility-modal.bullet-3": "<strong>Stay in control</strong> by advancing or postponing your deadlines at your own pace.",
|
|
1898
1788
|
"eligibility-modal.no-eligibility": "Oops, looks like the simulation didn't work.",
|
|
1899
1789
|
"eligibility-modal.p1x-bullet-1": "Choose <strong>Alma - Pay now</strong> at checkout.",
|
|
1900
|
-
"eligibility-modal.p1x-bullet-2": "
|
|
1901
|
-
"eligibility-modal.p1x-bullet-3": "<strong>
|
|
1790
|
+
"eligibility-modal.p1x-bullet-2": "Enter your <strong>credit card details.</strong>",
|
|
1791
|
+
"eligibility-modal.p1x-bullet-3": "<strong>Your payment is instantly validated at </strong> !",
|
|
1902
1792
|
"eligibility-modal.title-deferred-plan": "Pay in installments or later by credit card with Alma.",
|
|
1903
1793
|
"eligibility-modal.title-normal": "Pay in installments by credit card with Alma.",
|
|
1904
1794
|
"eligibility-modal.title-pay-now": "Pay cash by credit card with Alma.",
|
|
@@ -1924,10 +1814,10 @@ var messagesES = {
|
|
|
1924
1814
|
"credit-features.total-credit-cost": "Coste de crédito (incl. en el total)",
|
|
1925
1815
|
"eligibility-modal.bullet-1": "Elige <strong>Alma</strong> como método de pago.",
|
|
1926
1816
|
"eligibility-modal.bullet-2": "Déjate guiar y válida tu pago en <strong>2 minutos.</strong>",
|
|
1927
|
-
"eligibility-modal.bullet-3": "<strong>Mantén el control</strong> adelantando o
|
|
1817
|
+
"eligibility-modal.bullet-3": "<strong>Mantén el control</strong> adelantando o aplazando los plazos a su propio ritmo.",
|
|
1928
1818
|
"eligibility-modal.no-eligibility": "Uy, parece que la simulación no ha funcionado.",
|
|
1929
1819
|
"eligibility-modal.p1x-bullet-1": "Elije <strong>Alma - Pagar ahora</strong> al momento de la compra.",
|
|
1930
|
-
"eligibility-modal.p1x-bullet-2": "
|
|
1820
|
+
"eligibility-modal.p1x-bullet-2": "Introduce los datos de tu tarjeta bancaria en <strong>.</strong>",
|
|
1931
1821
|
"eligibility-modal.p1x-bullet-3": "<strong>¡La validación </strong> de tu pago es instantánea!",
|
|
1932
1822
|
"eligibility-modal.title-deferred-plan": "Paga a plazos o posteriormente con tarjeta bancaria con Alma.",
|
|
1933
1823
|
"eligibility-modal.title-normal": "Pagar a plazos con tarjeta bancaria con Alma.",
|
|
@@ -1988,7 +1878,7 @@ var messagesIT = {
|
|
|
1988
1878
|
"eligibility-modal.no-eligibility": "Ops, sembra che qualcosa non abbia funzionato.",
|
|
1989
1879
|
"eligibility-modal.p1x-bullet-1": "Scegli <strong>Alma - Paga ora</strong> alla cassa.",
|
|
1990
1880
|
"eligibility-modal.p1x-bullet-2": "Inserisci i dati della tua <strong>carta bancaria.</strong>",
|
|
1991
|
-
"eligibility-modal.p1x-bullet-3": "Ricevi la conferma di pagamento
|
|
1881
|
+
"eligibility-modal.p1x-bullet-3": "Ricevi la <strong>conferma di pagamento</strong> istantaneamente!",
|
|
1992
1882
|
"eligibility-modal.title-deferred-plan": "Paga a rate con Alma, senza registrazione.",
|
|
1993
1883
|
"eligibility-modal.title-normal": "Paga a rate con Alma, senza registrazione.",
|
|
1994
1884
|
"eligibility-modal.title-pay-now": "Paga ora con carta tramite Alma.",
|
|
@@ -2014,11 +1904,11 @@ var messagesNL = {
|
|
|
2014
1904
|
"credit-features.total-credit-cost": "Waarvan kredietkosten",
|
|
2015
1905
|
"eligibility-modal.bullet-1": "Kies <strong>Alma</strong> bij het afrekenen om de eerste termijnbetaling te voldoen. Dit kan gemakkelijk via jouw favoriete betaalmethode.",
|
|
2016
1906
|
"eligibility-modal.bullet-2": "Betaal gemakkelijk <strong>binnen 1 minuut </strong>. Je hebt hier geen account voor nodig.",
|
|
2017
|
-
"eligibility-modal.bullet-3": "<strong>
|
|
1907
|
+
"eligibility-modal.bullet-3": "<strong>Behoud de controle </strong> en bepaal je eigen tempo. Bij Alma schuif je de deadlines gemakkelijk vooruit of achteruit. Zonder bijkomende kosten.",
|
|
2018
1908
|
"eligibility-modal.no-eligibility": "Oeps, het lijkt erop dat de simulatie niet werkte.",
|
|
2019
1909
|
"eligibility-modal.p1x-bullet-1": "Kies <strong>Alma - Betaal nu</strong> bij het afrekenen om de eerste termijnbetaling te voldoen. Dit kan gemakkelijk via jouw favoriete betaalmethode.",
|
|
2020
|
-
"eligibility-modal.p1x-bullet-2": "Vul
|
|
2021
|
-
"eligibility-modal.p1x-bullet-3": "<strong>De bevestiging </strong> van jouw betaling is
|
|
1910
|
+
"eligibility-modal.p1x-bullet-2": "Vul je <strong>gegevens </strong> in",
|
|
1911
|
+
"eligibility-modal.p1x-bullet-3": "<strong>De bevestiging </strong> van jouw betaling is direct!",
|
|
2022
1912
|
"eligibility-modal.title-deferred-plan": "Betaal in termijnen bij Alma - helemaal rentevrij.",
|
|
2023
1913
|
"eligibility-modal.title-normal": "Betaal in termijnen bij Alma - helemaal rentevrij.",
|
|
2024
1914
|
"eligibility-modal.title-pay-now": "Betaal met iDEAL of per creditcard bij Alma.",
|
|
@@ -2072,26 +1962,19 @@ const getTranslationsByLocale = locale => {
|
|
|
2072
1962
|
// A CMS plugin can add LCID format like : 'fr-FR' instead of 'fr'.
|
|
2073
1963
|
// Instead of specifying all possibilities we just remove the last part of the string.
|
|
2074
1964
|
const merchantLocale = locale.slice(0, 2);
|
|
2075
|
-
|
|
2076
1965
|
switch (merchantLocale) {
|
|
2077
1966
|
case Locale.fr:
|
|
2078
1967
|
return messagesFR;
|
|
2079
|
-
|
|
2080
1968
|
case Locale.es:
|
|
2081
1969
|
return messagesES;
|
|
2082
|
-
|
|
2083
1970
|
case Locale.it:
|
|
2084
1971
|
return messagesIT;
|
|
2085
|
-
|
|
2086
1972
|
case Locale.de:
|
|
2087
1973
|
return messagesDE;
|
|
2088
|
-
|
|
2089
1974
|
case Locale.pt:
|
|
2090
1975
|
return messagesPT;
|
|
2091
|
-
|
|
2092
1976
|
case Locale.nl:
|
|
2093
1977
|
return messagesNL;
|
|
2094
|
-
|
|
2095
1978
|
case Locale.en:
|
|
2096
1979
|
default:
|
|
2097
1980
|
return messagesEN;
|
|
@@ -2101,42 +1984,29 @@ const getTranslationsByLocale = locale => {
|
|
|
2101
1984
|
const Provider = ({
|
|
2102
1985
|
children,
|
|
2103
1986
|
locale
|
|
2104
|
-
}) => /*#__PURE__*/React.createElement(IntlProvider, {
|
|
1987
|
+
}) => ( /*#__PURE__*/React.createElement(IntlProvider, {
|
|
2105
1988
|
messages: getTranslationsByLocale(locale),
|
|
2106
1989
|
locale: locale,
|
|
2107
1990
|
defaultLocale: "en"
|
|
2108
|
-
}, children);
|
|
1991
|
+
}, children));
|
|
2109
1992
|
|
|
2110
1993
|
function _extends() {
|
|
2111
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
2112
|
-
for (var
|
|
2113
|
-
var
|
|
2114
|
-
|
|
2115
|
-
for (var key in source) {
|
|
2116
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
2117
|
-
target[key] = source[key];
|
|
2118
|
-
}
|
|
2119
|
-
}
|
|
1994
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
1995
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
1996
|
+
var t = arguments[e];
|
|
1997
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
2120
1998
|
}
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
};
|
|
2124
|
-
return _extends.apply(this, arguments);
|
|
1999
|
+
return n;
|
|
2000
|
+
}, _extends.apply(null, arguments);
|
|
2125
2001
|
}
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
var
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
2134
|
-
key = sourceKeys[i];
|
|
2135
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
2136
|
-
target[key] = source[key];
|
|
2002
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
2003
|
+
if (null == r) return {};
|
|
2004
|
+
var t = {};
|
|
2005
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
2006
|
+
if (e.includes(n)) continue;
|
|
2007
|
+
t[n] = r[n];
|
|
2137
2008
|
}
|
|
2138
|
-
|
|
2139
|
-
return target;
|
|
2009
|
+
return t;
|
|
2140
2010
|
}
|
|
2141
2011
|
|
|
2142
2012
|
async function fetchFromApi(url = '', data, headers) {
|
|
@@ -2145,6 +2015,7 @@ async function fetchFromApi(url = '', data, headers) {
|
|
|
2145
2015
|
headers: _extends({
|
|
2146
2016
|
'Content-Type': 'application/json'
|
|
2147
2017
|
}, headers),
|
|
2018
|
+
cache: 'force-cache',
|
|
2148
2019
|
body: JSON.stringify(data)
|
|
2149
2020
|
});
|
|
2150
2021
|
return response.json();
|
|
@@ -2154,36 +2025,29 @@ const isPlanEligible = (plan, configPlan) => {
|
|
|
2154
2025
|
if (!plan.eligible) {
|
|
2155
2026
|
return false;
|
|
2156
2027
|
}
|
|
2157
|
-
|
|
2158
2028
|
return configPlan ? plan.purchase_amount >= (configPlan == null ? void 0 : configPlan.minAmount) && plan.purchase_amount <= (configPlan == null ? void 0 : configPlan.maxAmount) : false;
|
|
2159
2029
|
};
|
|
2160
|
-
|
|
2161
2030
|
const getPaymentPlanBoundaries = (plan, configPlan) => {
|
|
2162
2031
|
var _plan$constraints;
|
|
2163
|
-
|
|
2164
2032
|
// When the plan is not eligible, the purchase amount constraints is given from the merchant config
|
|
2165
2033
|
const purchaseAmountConstraints = (_plan$constraints = plan.constraints) == null ? void 0 : _plan$constraints.purchase_amount;
|
|
2166
|
-
|
|
2167
2034
|
if (purchaseAmountConstraints && configPlan) {
|
|
2168
2035
|
return {
|
|
2169
2036
|
minAmount: Math.max(configPlan.minAmount, purchaseAmountConstraints == null ? void 0 : purchaseAmountConstraints.minimum),
|
|
2170
2037
|
maxAmount: Math.min(configPlan.maxAmount, purchaseAmountConstraints == null ? void 0 : purchaseAmountConstraints.maximum)
|
|
2171
2038
|
};
|
|
2172
2039
|
}
|
|
2173
|
-
|
|
2174
2040
|
return configPlan != null ? configPlan : {};
|
|
2175
2041
|
};
|
|
2176
|
-
|
|
2177
2042
|
const filterEligibility = (eligibilities, configPlans) => {
|
|
2178
2043
|
// Remove P1X if no configuration is provided
|
|
2179
2044
|
if (!configPlans) {
|
|
2180
2045
|
return eligibilities.filter(plan => !(plan.installments_count === 1 && plan.deferred_days === 0 && plan.deferred_months === 0));
|
|
2181
|
-
}
|
|
2182
|
-
|
|
2183
|
-
|
|
2046
|
+
}
|
|
2047
|
+
// Else check if the plan is eligible regarding the related configPlan
|
|
2184
2048
|
return eligibilities.map(plan => {
|
|
2185
|
-
const eligibilityDeferredDays = (plan.deferred_months ? plan.deferred_months : 0) * 30 + (plan.deferred_days ? plan.deferred_days : 0);
|
|
2186
|
-
|
|
2049
|
+
const eligibilityDeferredDays = (plan.deferred_months ? plan.deferred_months : 0) * 30 + (plan.deferred_days ? plan.deferred_days : 0);
|
|
2050
|
+
// find the related configPlan
|
|
2187
2051
|
const relatedConfigPlan = configPlans.find(configPlan => {
|
|
2188
2052
|
const configPlanDeferredDays = (configPlan.deferredMonths ? configPlan.deferredMonths : 0) * 30 + (configPlan.deferredDays ? configPlan.deferredDays : 0);
|
|
2189
2053
|
return plan.installments_count === configPlan.installmentsCount && eligibilityDeferredDays === configPlanDeferredDays;
|
|
@@ -2194,51 +2058,136 @@ const filterEligibility = (eligibilities, configPlans) => {
|
|
|
2194
2058
|
});
|
|
2195
2059
|
};
|
|
2196
2060
|
|
|
2061
|
+
// Function to hash a string
|
|
2062
|
+
// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
|
|
2063
|
+
const hashStringForStorage = str => {
|
|
2064
|
+
return str
|
|
2065
|
+
// The input string is split into an array of characters.
|
|
2066
|
+
.split('')
|
|
2067
|
+
// The reduce function is used to apply a function against an accumulator and each element in the array (from left to right) to reduce it to a single output value.
|
|
2068
|
+
.reduce((a, b) => {
|
|
2069
|
+
// The accumulator (a) is shifted left by 5 bits (multiplied by 32), then subtracted by itself and added to the ASCII value of the current character (b).
|
|
2070
|
+
// The bitwise OR operation with 0 is used to ensure the result is a 32-bit integer.
|
|
2071
|
+
return (a << 5) - a + b.charCodeAt(0) | 0;
|
|
2072
|
+
}, 0) // The initial value of the accumulator is 0.
|
|
2073
|
+
.toString() // The result is then converted to a string.
|
|
2074
|
+
.replace('-', 'A'); // If the hash is negative (which is represented by a leading '-'), it's replaced with 'A' to ensure the hash is alphanumeric.
|
|
2075
|
+
};
|
|
2076
|
+
const isMoreThanOneHourAgo = date => {
|
|
2077
|
+
const ONE_HOUR_IN_MILLISECONDS = 1000 * 60 * 60;
|
|
2078
|
+
const currentTime = Date.now();
|
|
2079
|
+
const difference = currentTime - date;
|
|
2080
|
+
return difference >= ONE_HOUR_IN_MILLISECONDS;
|
|
2081
|
+
};
|
|
2082
|
+
|
|
2083
|
+
const useSessionStorage = () => {
|
|
2084
|
+
const setCache = (key, value) => {
|
|
2085
|
+
// Save data to sessionStorage and create timestamp
|
|
2086
|
+
const timestamp = Date.now();
|
|
2087
|
+
sessionStorage.setItem(key, JSON.stringify({
|
|
2088
|
+
value,
|
|
2089
|
+
timestamp
|
|
2090
|
+
}));
|
|
2091
|
+
};
|
|
2092
|
+
const getCache = key => {
|
|
2093
|
+
// Get saved data from sessionStorage
|
|
2094
|
+
const stringData = sessionStorage.getItem(key) || '';
|
|
2095
|
+
// Parse cached data to use it directly as an array of EligibilityPlan
|
|
2096
|
+
return stringData ? JSON.parse(stringData) : null;
|
|
2097
|
+
};
|
|
2098
|
+
const deleteCache = key => {
|
|
2099
|
+
// Remove saved data from sessionStorage
|
|
2100
|
+
sessionStorage.removeItem(key);
|
|
2101
|
+
};
|
|
2102
|
+
const clearCache = () => {
|
|
2103
|
+
// Remove all saved data from sessionStorage
|
|
2104
|
+
sessionStorage.clear();
|
|
2105
|
+
};
|
|
2106
|
+
const createKey = params => {
|
|
2107
|
+
const {
|
|
2108
|
+
purchaseAmount,
|
|
2109
|
+
plans,
|
|
2110
|
+
customerBillingCountry,
|
|
2111
|
+
customerShippingCountry
|
|
2112
|
+
} = params;
|
|
2113
|
+
const stringAmount = purchaseAmount.toString();
|
|
2114
|
+
const stringPlans = JSON.stringify(plans);
|
|
2115
|
+
return hashStringForStorage(`${stringAmount}${stringPlans}${customerBillingCountry}${customerShippingCountry}`);
|
|
2116
|
+
};
|
|
2117
|
+
return {
|
|
2118
|
+
setCache,
|
|
2119
|
+
getCache,
|
|
2120
|
+
clearCache,
|
|
2121
|
+
deleteCache,
|
|
2122
|
+
createKey
|
|
2123
|
+
};
|
|
2124
|
+
};
|
|
2125
|
+
|
|
2197
2126
|
const useFetchEligibility = (purchaseAmount, {
|
|
2198
2127
|
domain,
|
|
2199
2128
|
merchantId
|
|
2200
2129
|
}, plans, customerBillingCountry, customerShippingCountry) => {
|
|
2130
|
+
var _getCache, _getCache2;
|
|
2201
2131
|
const [eligibility, setEligibility] = useState([]);
|
|
2202
|
-
const [status, setStatus] = useState(
|
|
2132
|
+
const [status, setStatus] = useState(statusResponse.PENDING);
|
|
2133
|
+
// caching
|
|
2134
|
+
const {
|
|
2135
|
+
getCache,
|
|
2136
|
+
setCache,
|
|
2137
|
+
createKey
|
|
2138
|
+
} = useSessionStorage();
|
|
2139
|
+
const key = createKey({
|
|
2140
|
+
purchaseAmount,
|
|
2141
|
+
plans,
|
|
2142
|
+
customerBillingCountry,
|
|
2143
|
+
customerShippingCountry
|
|
2144
|
+
});
|
|
2145
|
+
const currentCache = (_getCache = getCache(key)) == null ? void 0 : _getCache.value;
|
|
2146
|
+
const lastCacheTimestamp = (_getCache2 = getCache(key)) == null ? void 0 : _getCache2.timestamp;
|
|
2147
|
+
// If the stored date is more than an hour ago, we should invalidate the cache
|
|
2148
|
+
const shouldInvalidate = lastCacheTimestamp && isMoreThanOneHourAgo(lastCacheTimestamp);
|
|
2203
2149
|
const configInstallments = plans == null ? void 0 : plans.map(plan => ({
|
|
2204
2150
|
installments_count: plan.installmentsCount,
|
|
2205
2151
|
deferred_days: plan == null ? void 0 : plan.deferredDays,
|
|
2206
2152
|
deferred_months: plan == null ? void 0 : plan.deferredMonths
|
|
2207
2153
|
}));
|
|
2208
2154
|
useEffect(() => {
|
|
2209
|
-
if (status ===
|
|
2155
|
+
if (status === statusResponse.PENDING) {
|
|
2210
2156
|
let billing_address = null;
|
|
2211
|
-
|
|
2212
2157
|
if (customerBillingCountry) {
|
|
2213
2158
|
billing_address = {
|
|
2214
2159
|
country: customerBillingCountry
|
|
2215
2160
|
};
|
|
2216
2161
|
}
|
|
2217
|
-
|
|
2218
2162
|
let shipping_address = null;
|
|
2219
|
-
|
|
2220
2163
|
if (customerShippingCountry) {
|
|
2221
2164
|
shipping_address = {
|
|
2222
2165
|
country: customerShippingCountry
|
|
2223
2166
|
};
|
|
2224
2167
|
}
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2168
|
+
if (currentCache && !shouldInvalidate) {
|
|
2169
|
+
setEligibility(currentCache);
|
|
2170
|
+
setStatus(statusResponse.SUCCESS);
|
|
2171
|
+
}
|
|
2172
|
+
if (!currentCache || shouldInvalidate) {
|
|
2173
|
+
fetchFromApi(domain + '/v2/payments/eligibility', {
|
|
2174
|
+
purchase_amount: purchaseAmount,
|
|
2175
|
+
queries: configInstallments,
|
|
2176
|
+
billing_address,
|
|
2177
|
+
shipping_address
|
|
2178
|
+
}, {
|
|
2179
|
+
Authorization: `Alma-Merchant-Auth ${merchantId}`,
|
|
2180
|
+
'X-Alma-Agent': `Alma Widget/${"v3.3.12"}`
|
|
2181
|
+
}).then(res => {
|
|
2182
|
+
setCache(key, res);
|
|
2183
|
+
setEligibility(res);
|
|
2184
|
+
setStatus(statusResponse.SUCCESS);
|
|
2185
|
+
}).catch(() => {
|
|
2186
|
+
setStatus(statusResponse.FAILED);
|
|
2187
|
+
});
|
|
2188
|
+
}
|
|
2240
2189
|
}
|
|
2241
|
-
}, [status]);
|
|
2190
|
+
}, [status, purchaseAmount, key]);
|
|
2242
2191
|
return [filterEligibility(eligibility, plans), status];
|
|
2243
2192
|
};
|
|
2244
2193
|
|
|
@@ -2252,7 +2201,6 @@ const prefix = 'alma-eligibility-modal';
|
|
|
2252
2201
|
* Class names for the **eligibility modale** widget.
|
|
2253
2202
|
* Those classes are intended to be used by the **merchant developer**.
|
|
2254
2203
|
*/
|
|
2255
|
-
|
|
2256
2204
|
const STATIC_CUSTOMISATION_CLASSES = {
|
|
2257
2205
|
desktopModal: prefix + '-desktop-modal',
|
|
2258
2206
|
mobileModal: prefix + '-mobile-modal',
|
|
@@ -2296,7 +2244,7 @@ const TotalBlock = ({
|
|
|
2296
2244
|
currency: "EUR"
|
|
2297
2245
|
})), /*#__PURE__*/React.createElement("div", {
|
|
2298
2246
|
className: cx(s.fees, STATIC_CUSTOMISATION_CLASSES.scheduleCredit)
|
|
2299
|
-
}, isCredit ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2247
|
+
}, isCredit ? ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2300
2248
|
id: "credit-features.total-credit-cost",
|
|
2301
2249
|
defaultMessage: "Dont co\u00FBt du cr\u00E9dit"
|
|
2302
2250
|
}), /*#__PURE__*/React.createElement("span", {
|
|
@@ -2314,7 +2262,7 @@ const TotalBlock = ({
|
|
|
2314
2262
|
maximumFractionDigits: 2
|
|
2315
2263
|
})
|
|
2316
2264
|
}
|
|
2317
|
-
}))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2265
|
+
})))) : ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2318
2266
|
id: "installments.total-fees",
|
|
2319
2267
|
defaultMessage: "Dont frais (TTC)",
|
|
2320
2268
|
tagName: "div"
|
|
@@ -2322,14 +2270,14 @@ const TotalBlock = ({
|
|
|
2322
2270
|
value: customerFees,
|
|
2323
2271
|
style: "currency",
|
|
2324
2272
|
currency: "EUR"
|
|
2325
|
-
})))));
|
|
2273
|
+
}))))));
|
|
2326
2274
|
};
|
|
2327
2275
|
|
|
2328
2276
|
var s$1 = {"loadingIndicator":"_31lrj","bounce":"_3NtDa"};
|
|
2329
2277
|
|
|
2330
2278
|
const LoadingIndicator = ({
|
|
2331
2279
|
className
|
|
2332
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
2280
|
+
}) => ( /*#__PURE__*/React.createElement("div", {
|
|
2333
2281
|
className: cx(s$1.loadingIndicator, className),
|
|
2334
2282
|
"data-testid": "loader"
|
|
2335
2283
|
}, /*#__PURE__*/React.createElement("svg", {
|
|
@@ -2341,7 +2289,7 @@ const LoadingIndicator = ({
|
|
|
2341
2289
|
}, /*#__PURE__*/React.createElement("path", {
|
|
2342
2290
|
d: "M83.8164 41.0325C79.1708 22.8241 69.3458 17 59.9939 17C50.642 17 40.8171 22.8241 36.1715 41.0325L16 117H35.8804C39.119 104.311 49.1016 97.2436 59.9939 97.2436C70.8863 97.2436 80.8689 104.324 84.1075 117H104L83.8164 41.0325ZM59.9939 79.5428C53.6623 79.5428 47.925 82.0552 43.6918 86.1283L55.0936 41.9207C56.1853 37.6953 57.7985 36.3503 60.0061 36.3503C62.2136 36.3503 63.8269 37.6953 64.9185 41.9207L76.3082 86.1283C72.075 82.0552 66.3256 79.5428 59.9939 79.5428Z",
|
|
2343
2291
|
fill: "#FA5022"
|
|
2344
|
-
})));
|
|
2292
|
+
}))));
|
|
2345
2293
|
|
|
2346
2294
|
var s$2 = {"modal":"_D8SjB","content":"_ocM9x","contentScrollable":"_1GP2F","overlay":"_1yxCb","header":"_12LLh","closeButton":"_3YRro"};
|
|
2347
2295
|
|
|
@@ -2363,18 +2311,16 @@ function CrossIcon({
|
|
|
2363
2311
|
}
|
|
2364
2312
|
|
|
2365
2313
|
const _excluded = ["children", "isOpen", "onClose", "className", "contentClassName", "scrollable"];
|
|
2366
|
-
|
|
2367
2314
|
const ControlledModal = _ref => {
|
|
2368
2315
|
let {
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2316
|
+
children,
|
|
2317
|
+
isOpen,
|
|
2318
|
+
onClose,
|
|
2319
|
+
className,
|
|
2320
|
+
contentClassName,
|
|
2321
|
+
scrollable = false
|
|
2322
|
+
} = _ref,
|
|
2323
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
2378
2324
|
/* istanbul ignore next */
|
|
2379
2325
|
Modal.setAppElement('body');
|
|
2380
2326
|
return /*#__PURE__*/React.createElement(Modal, Object.assign({
|
|
@@ -2409,14 +2355,12 @@ const paymentPlanShorthandName = payment => {
|
|
|
2409
2355
|
deferred_months,
|
|
2410
2356
|
installments_count: installmentsCount
|
|
2411
2357
|
} = payment;
|
|
2412
|
-
|
|
2413
2358
|
if (installmentsCount === 1 && !deferred_days && !deferred_months) {
|
|
2414
2359
|
return /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2415
2360
|
id: "payment-plan-strings.pay.now.button",
|
|
2416
2361
|
defaultMessage: "Payer maintenant"
|
|
2417
2362
|
});
|
|
2418
2363
|
}
|
|
2419
|
-
|
|
2420
2364
|
if (installmentsCount === 1 && deferred_days) {
|
|
2421
2365
|
return /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2422
2366
|
id: "payment-plan-strings.day-abbreviation",
|
|
@@ -2426,7 +2370,6 @@ const paymentPlanShorthandName = payment => {
|
|
|
2426
2370
|
}
|
|
2427
2371
|
});
|
|
2428
2372
|
}
|
|
2429
|
-
|
|
2430
2373
|
if (installmentsCount === 1 && deferred_months) {
|
|
2431
2374
|
return /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2432
2375
|
id: "payment-plan-strings.month-abbreviation",
|
|
@@ -2439,10 +2382,8 @@ const paymentPlanShorthandName = payment => {
|
|
|
2439
2382
|
return `${installmentsCount}x`;
|
|
2440
2383
|
}
|
|
2441
2384
|
};
|
|
2442
|
-
|
|
2443
2385
|
const withNoFee = payment => {
|
|
2444
2386
|
var _payment$payment_plan;
|
|
2445
|
-
|
|
2446
2387
|
if ((_payment$payment_plan = payment.payment_plan) != null && _payment$payment_plan.every(plan => plan.customer_fee === 0 && plan.customer_interest === 0)) {
|
|
2447
2388
|
return /*#__PURE__*/React.createElement(React.Fragment, null, ' ', /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2448
2389
|
id: "payment-plan-strings.no-fee",
|
|
@@ -2450,7 +2391,6 @@ const withNoFee = payment => {
|
|
|
2450
2391
|
}));
|
|
2451
2392
|
}
|
|
2452
2393
|
};
|
|
2453
|
-
|
|
2454
2394
|
const paymentPlanInfoText = payment => {
|
|
2455
2395
|
const {
|
|
2456
2396
|
deferred_days,
|
|
@@ -2463,29 +2403,28 @@ const paymentPlanInfoText = payment => {
|
|
|
2463
2403
|
payment_plan
|
|
2464
2404
|
} = payment;
|
|
2465
2405
|
const deferredDaysCount = deferred_days + deferred_months * 30;
|
|
2466
|
-
|
|
2467
2406
|
if (!eligible) {
|
|
2468
|
-
return purchaseAmount > maxAmount ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2407
|
+
return purchaseAmount > maxAmount ? ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2469
2408
|
id: "payment-plan-strings.ineligible-greater-than-max",
|
|
2470
2409
|
defaultMessage: "Jusqu'\u00E0 {maxAmount}",
|
|
2471
2410
|
values: {
|
|
2472
|
-
maxAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2411
|
+
maxAmount: ( /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2473
2412
|
value: priceFromCents(maxAmount),
|
|
2474
2413
|
style: "currency",
|
|
2475
2414
|
currency: "EUR"
|
|
2476
|
-
})
|
|
2415
|
+
}))
|
|
2477
2416
|
}
|
|
2478
|
-
}) : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2417
|
+
})) : ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2479
2418
|
id: "payment-plan-strings.ineligible-lower-than-min",
|
|
2480
2419
|
defaultMessage: "\u00C0 partir de {minAmount}",
|
|
2481
2420
|
values: {
|
|
2482
|
-
minAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2421
|
+
minAmount: ( /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2483
2422
|
value: priceFromCents(minAmount),
|
|
2484
2423
|
style: "currency",
|
|
2485
2424
|
currency: "EUR"
|
|
2486
|
-
})
|
|
2425
|
+
}))
|
|
2487
2426
|
}
|
|
2488
|
-
});
|
|
2427
|
+
}));
|
|
2489
2428
|
} else if (!payment_plan) {
|
|
2490
2429
|
/* This error should never happen. We added this condition to avoid a typescript warning on
|
|
2491
2430
|
payment_plan possibly undefined. As far as we know, it only happens when the plan is not
|
|
@@ -2496,71 +2435,67 @@ const paymentPlanInfoText = payment => {
|
|
|
2496
2435
|
id: "payment-plan-strings.deferred",
|
|
2497
2436
|
defaultMessage: "{totalAmount} \u00E0 payer le {dueDate}",
|
|
2498
2437
|
values: {
|
|
2499
|
-
totalAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2438
|
+
totalAmount: ( /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2500
2439
|
value: priceFromCents(payment_plan[0].total_amount),
|
|
2501
2440
|
style: "currency",
|
|
2502
2441
|
currency: "EUR"
|
|
2503
|
-
}),
|
|
2504
|
-
dueDate: /*#__PURE__*/React.createElement(FormattedDate, {
|
|
2442
|
+
})),
|
|
2443
|
+
dueDate: ( /*#__PURE__*/React.createElement(FormattedDate, {
|
|
2505
2444
|
value: secondsToMilliseconds(payment_plan[0].due_date),
|
|
2506
2445
|
day: "numeric",
|
|
2507
2446
|
month: "long",
|
|
2508
2447
|
year: "numeric"
|
|
2509
|
-
})
|
|
2448
|
+
}))
|
|
2510
2449
|
}
|
|
2511
2450
|
}), withNoFee(payment));
|
|
2512
2451
|
} else if (installmentsCount > 0) {
|
|
2513
2452
|
const areInstallmentsOfSameAmount = payment_plan == null ? void 0 : payment_plan.every((installment, index) => index === 0 || installment.total_amount === payment_plan[0].total_amount);
|
|
2514
|
-
|
|
2515
2453
|
if (isP1X(payment)) {
|
|
2516
2454
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2517
2455
|
id: "payment-plan-strings.pay-now",
|
|
2518
2456
|
defaultMessage: "Payer maintenant {totalAmount}",
|
|
2519
2457
|
values: {
|
|
2520
|
-
totalAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2458
|
+
totalAmount: ( /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2521
2459
|
value: priceFromCents(payment_plan[0].total_amount),
|
|
2522
2460
|
style: "currency",
|
|
2523
2461
|
currency: "EUR"
|
|
2524
|
-
}),
|
|
2462
|
+
})),
|
|
2525
2463
|
installmentsCount
|
|
2526
2464
|
}
|
|
2527
2465
|
}), withNoFee(payment));
|
|
2528
2466
|
}
|
|
2529
|
-
|
|
2530
2467
|
if (areInstallmentsOfSameAmount) {
|
|
2531
2468
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2532
2469
|
id: "payment-plan-strings.multiple-installments-same-amount",
|
|
2533
2470
|
defaultMessage: "{installmentsCount} x {totalAmount}",
|
|
2534
2471
|
values: {
|
|
2535
|
-
totalAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2472
|
+
totalAmount: ( /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2536
2473
|
value: priceFromCents(payment_plan[0].total_amount),
|
|
2537
2474
|
style: "currency",
|
|
2538
2475
|
currency: "EUR"
|
|
2539
|
-
}),
|
|
2476
|
+
})),
|
|
2540
2477
|
installmentsCount
|
|
2541
2478
|
}
|
|
2542
2479
|
}), withNoFee(payment));
|
|
2543
2480
|
}
|
|
2544
|
-
|
|
2545
2481
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2546
2482
|
id: "payment-plan-strings.multiple-installments",
|
|
2547
2483
|
defaultMessage: "{numberOfRemainingInstallments, plural, one {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}} other {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}}}",
|
|
2548
2484
|
values: {
|
|
2549
|
-
firstInstallmentAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2485
|
+
firstInstallmentAmount: ( /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2550
2486
|
value: priceFromCents(payment_plan[0].total_amount),
|
|
2551
2487
|
style: "currency",
|
|
2552
2488
|
currency: "EUR"
|
|
2553
|
-
}),
|
|
2489
|
+
})),
|
|
2554
2490
|
numberOfRemainingInstallments: installmentsCount - 1,
|
|
2555
|
-
othersInstallmentAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2491
|
+
othersInstallmentAmount: ( /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2556
2492
|
value: priceFromCents(payment_plan[1].total_amount),
|
|
2557
2493
|
style: "currency",
|
|
2558
2494
|
currency: "EUR"
|
|
2559
|
-
})
|
|
2495
|
+
}))
|
|
2560
2496
|
}
|
|
2561
2497
|
}), withNoFee(payment));
|
|
2562
2498
|
}
|
|
2563
|
-
|
|
2564
2499
|
return /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2565
2500
|
id: "payment-plan-strings.default-message",
|
|
2566
2501
|
defaultMessage: "Payez en plusieurs fois avec Alma"
|
|
@@ -2573,9 +2508,9 @@ const EligibilityPlansButtons = ({
|
|
|
2573
2508
|
eligibilityPlans,
|
|
2574
2509
|
currentPlanIndex,
|
|
2575
2510
|
setCurrentPlanIndex
|
|
2576
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
2511
|
+
}) => ( /*#__PURE__*/React.createElement("div", {
|
|
2577
2512
|
className: cx(s$3.buttons, STATIC_CUSTOMISATION_CLASSES.eligibilityOptions)
|
|
2578
|
-
}, eligibilityPlans.map((eligibilityPlan, index) => /*#__PURE__*/React.createElement("button", {
|
|
2513
|
+
}, eligibilityPlans.map((eligibilityPlan, index) => ( /*#__PURE__*/React.createElement("button", {
|
|
2579
2514
|
key: index,
|
|
2580
2515
|
className: cx({
|
|
2581
2516
|
[cx(s$3.active, STATIC_CUSTOMISATION_CLASSES.activeOption)]: index === currentPlanIndex
|
|
@@ -2583,7 +2518,7 @@ const EligibilityPlansButtons = ({
|
|
|
2583
2518
|
onClick: () => setCurrentPlanIndex(index)
|
|
2584
2519
|
}, /*#__PURE__*/React.createElement("span", {
|
|
2585
2520
|
className: s$3.textButton
|
|
2586
|
-
}, paymentPlanShorthandName(eligibilityPlan)))));
|
|
2521
|
+
}, paymentPlanShorthandName(eligibilityPlan)))))));
|
|
2587
2522
|
|
|
2588
2523
|
var s$4 = {"installment":"_z2Uiv","date":"_2lJQy","dot":"_1Z9wr","isCurrent":"_2Nmkl","bold":"_ezY-3"};
|
|
2589
2524
|
|
|
@@ -2600,16 +2535,16 @@ const Installment = ({
|
|
|
2600
2535
|
className: cx(s$4.dot, {
|
|
2601
2536
|
[s$4.isCurrent]: index === 0
|
|
2602
2537
|
})
|
|
2603
|
-
}), isToday(installment.due_date * 1000) ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2538
|
+
}), isToday(installment.due_date * 1000) ? ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2604
2539
|
id: "installments.today",
|
|
2605
2540
|
defaultMessage: "Aujourd'hui",
|
|
2606
2541
|
tagName: "strong"
|
|
2607
|
-
}) : /*#__PURE__*/React.createElement(FormattedDate, {
|
|
2542
|
+
})) : ( /*#__PURE__*/React.createElement(FormattedDate, {
|
|
2608
2543
|
value: installment.due_date * 1000,
|
|
2609
2544
|
day: "numeric",
|
|
2610
2545
|
month: "long",
|
|
2611
2546
|
year: "numeric"
|
|
2612
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
2547
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
2613
2548
|
className: cx({
|
|
2614
2549
|
[s$4.bold]: index === 0
|
|
2615
2550
|
})
|
|
@@ -2629,25 +2564,24 @@ const Schedule = ({
|
|
|
2629
2564
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
2630
2565
|
className: cx(s$5.schedule, STATIC_CUSTOMISATION_CLASSES.scheduleDetails),
|
|
2631
2566
|
"data-testid": "modal-installments-element"
|
|
2632
|
-
}, ((currentPlan == null ? void 0 : currentPlan.payment_plan) || []).map((installment, index) => /*#__PURE__*/React.createElement(Installment, {
|
|
2567
|
+
}, ((currentPlan == null ? void 0 : currentPlan.payment_plan) || []).map((installment, index) => ( /*#__PURE__*/React.createElement(Installment, {
|
|
2633
2568
|
key: installment.due_date * 1000,
|
|
2634
2569
|
installment: installment,
|
|
2635
2570
|
index: index
|
|
2636
|
-
})), isCredit && /*#__PURE__*/React.createElement("div", {
|
|
2571
|
+
}))), isCredit && ( /*#__PURE__*/React.createElement("div", {
|
|
2637
2572
|
className: s$5.creditInfo
|
|
2638
2573
|
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2639
2574
|
id: "credit-features.information",
|
|
2640
2575
|
defaultMessage: "Un cr\u00E9dit vous engage et doit \u00EAtre rembours\u00E9. V\u00E9rifiez vos capacit\u00E9s de remboursement avant de vous engager."
|
|
2641
|
-
}))));
|
|
2576
|
+
})))));
|
|
2642
2577
|
};
|
|
2643
2578
|
|
|
2644
2579
|
const _excluded$1 = ["color"];
|
|
2645
2580
|
const AlmaLogo = _ref => {
|
|
2646
2581
|
let {
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2582
|
+
color = '#FA5022'
|
|
2583
|
+
} = _ref,
|
|
2584
|
+
svgProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
2651
2585
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
|
2652
2586
|
width: "50",
|
|
2653
2587
|
height: "25",
|
|
@@ -2660,7 +2594,7 @@ const AlmaLogo = _ref => {
|
|
|
2660
2594
|
}));
|
|
2661
2595
|
};
|
|
2662
2596
|
|
|
2663
|
-
const AmexCard = () => /*#__PURE__*/React.createElement("svg", {
|
|
2597
|
+
const AmexCard = () => ( /*#__PURE__*/React.createElement("svg", {
|
|
2664
2598
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2665
2599
|
width: "24",
|
|
2666
2600
|
height: "16",
|
|
@@ -2691,9 +2625,9 @@ const AmexCard = () => /*#__PURE__*/React.createElement("svg", {
|
|
|
2691
2625
|
}), /*#__PURE__*/React.createElement("path", {
|
|
2692
2626
|
fillRule: "nonzero",
|
|
2693
2627
|
d: "M19.372 7.94l.735-.77 1.042-1.185h-1.287L18.697 7.23l-1.164-1.245h-3.985v3.97h3.923l1.226-1.303 1.165 1.304h1.287L20.107 8.71l-.735-.77zM16.92 9.186h-2.33v-.77h2.268v-.77H14.59v-.712h2.33L18.084 8 16.92 9.185z"
|
|
2694
|
-
}))));
|
|
2628
|
+
})))));
|
|
2695
2629
|
|
|
2696
|
-
const VisaCard = () => /*#__PURE__*/React.createElement("svg", {
|
|
2630
|
+
const VisaCard = () => ( /*#__PURE__*/React.createElement("svg", {
|
|
2697
2631
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2698
2632
|
width: "24",
|
|
2699
2633
|
height: "16",
|
|
@@ -2716,9 +2650,9 @@ const VisaCard = () => /*#__PURE__*/React.createElement("svg", {
|
|
|
2716
2650
|
}), /*#__PURE__*/React.createElement("path", {
|
|
2717
2651
|
fill: "#F4A428",
|
|
2718
2652
|
d: "M.063 13H24v1.8c0 .655-.625 1.2-1.375 1.2H1.375C.625 16 0 15.455 0 14.8V13h.063z"
|
|
2719
|
-
})));
|
|
2653
|
+
}))));
|
|
2720
2654
|
|
|
2721
|
-
const MasterCard = () => /*#__PURE__*/React.createElement("svg", {
|
|
2655
|
+
const MasterCard = () => ( /*#__PURE__*/React.createElement("svg", {
|
|
2722
2656
|
width: "24px",
|
|
2723
2657
|
height: "16px",
|
|
2724
2658
|
viewBox: "0 0 24 16",
|
|
@@ -2774,9 +2708,9 @@ const MasterCard = () => /*#__PURE__*/React.createElement("svg", {
|
|
|
2774
2708
|
cx: "5.05263158",
|
|
2775
2709
|
cy: "5.05263158",
|
|
2776
2710
|
r: "5.05263158"
|
|
2777
|
-
}))))));
|
|
2711
|
+
})))))));
|
|
2778
2712
|
|
|
2779
|
-
const CbCard = () => /*#__PURE__*/React.createElement("svg", {
|
|
2713
|
+
const CbCard = () => ( /*#__PURE__*/React.createElement("svg", {
|
|
2780
2714
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2781
2715
|
width: "24",
|
|
2782
2716
|
height: "16",
|
|
@@ -2803,7 +2737,7 @@ const CbCard = () => /*#__PURE__*/React.createElement("svg", {
|
|
|
2803
2737
|
fill: "#FFF"
|
|
2804
2738
|
}, /*#__PURE__*/React.createElement("path", {
|
|
2805
2739
|
d: "M19.094 4.03h-6.437V8h6.498c1.165 0 2.084-.889 2.084-2.015-.06-1.066-.98-1.955-2.145-1.955zM19.094 8.593h-6.437v3.97h6.498c1.165 0 2.084-.889 2.084-2.015-.06-1.067-.98-1.955-2.145-1.955zM7.017 8.06h4.966c-.245-2.371-2.391-4.267-4.966-4.267-2.758 0-5.027 2.074-5.027 4.681s2.269 4.682 5.027 4.682c2.698 0 4.904-2.015 5.027-4.563H7.017v-.534z"
|
|
2806
|
-
}))));
|
|
2740
|
+
})))));
|
|
2807
2741
|
|
|
2808
2742
|
var s$6 = {"cardContainer":"_1N3yO"};
|
|
2809
2743
|
|
|
@@ -2815,18 +2749,18 @@ const Cards = ({
|
|
|
2815
2749
|
return /*#__PURE__*/React.createElement("div", {
|
|
2816
2750
|
"data-testid": "card-logos",
|
|
2817
2751
|
className: cx(s$6.cardContainer, STATIC_CUSTOMISATION_CLASSES.cardContainer)
|
|
2818
|
-
}, uniqueCards.map(card => /*#__PURE__*/React.createElement("div", {
|
|
2752
|
+
}, uniqueCards.map(card => ( /*#__PURE__*/React.createElement("div", {
|
|
2819
2753
|
key: card,
|
|
2820
2754
|
className: s$6.card,
|
|
2821
2755
|
"data-testid": `card-logo-${card}`
|
|
2822
|
-
}, card === 'cb' && /*#__PURE__*/React.createElement(CbCard, null), card === 'amex' && /*#__PURE__*/React.createElement(AmexCard, null), card === 'mastercard' && /*#__PURE__*/React.createElement(MasterCard, null), card === 'visa' && /*#__PURE__*/React.createElement(VisaCard, null))));
|
|
2756
|
+
}, card === 'cb' && /*#__PURE__*/React.createElement(CbCard, null), card === 'amex' && /*#__PURE__*/React.createElement(AmexCard, null), card === 'mastercard' && /*#__PURE__*/React.createElement(MasterCard, null), card === 'visa' && /*#__PURE__*/React.createElement(VisaCard, null)))));
|
|
2823
2757
|
};
|
|
2824
2758
|
|
|
2825
2759
|
var s$7 = {"list":"_180ro","listItem":"_1HqCO","bullet":"_3B8wx"};
|
|
2826
2760
|
|
|
2827
2761
|
const Info = ({
|
|
2828
2762
|
isCurrentPlanP1X
|
|
2829
|
-
}) =>
|
|
2763
|
+
}) => (
|
|
2830
2764
|
/*#__PURE__*/
|
|
2831
2765
|
// TODO: refactor this component into subcomponent to factorise code and be cleaner
|
|
2832
2766
|
React.createElement("div", {
|
|
@@ -2838,74 +2772,74 @@ React.createElement("div", {
|
|
|
2838
2772
|
className: cx(s$7.bullet, STATIC_CUSTOMISATION_CLASSES.bullet)
|
|
2839
2773
|
}, "1"), /*#__PURE__*/React.createElement("div", {
|
|
2840
2774
|
className: STATIC_CUSTOMISATION_CLASSES.infoMessage
|
|
2841
|
-
}, isCurrentPlanP1X ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2775
|
+
}, isCurrentPlanP1X ? ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2842
2776
|
id: "eligibility-modal.p1x-bullet-1",
|
|
2843
2777
|
defaultMessage: "Choisissez <strong>Alma - Payer maintenant</strong> au moment du paiement.",
|
|
2844
2778
|
values: {
|
|
2845
2779
|
strong: (...chunks) => /*#__PURE__*/React.createElement("strong", null, chunks)
|
|
2846
2780
|
}
|
|
2847
|
-
}) : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2781
|
+
})) : ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2848
2782
|
id: "eligibility-modal.bullet-1",
|
|
2849
2783
|
defaultMessage: "Choisissez <strong>Alma</strong> au moment du paiement.",
|
|
2850
2784
|
values: {
|
|
2851
2785
|
strong: (...chunks) => /*#__PURE__*/React.createElement("strong", null, chunks)
|
|
2852
2786
|
}
|
|
2853
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
2787
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
2854
2788
|
className: s$7.listItem
|
|
2855
2789
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2856
2790
|
className: cx(s$7.bullet, STATIC_CUSTOMISATION_CLASSES.bullet)
|
|
2857
2791
|
}, "2"), /*#__PURE__*/React.createElement("div", {
|
|
2858
2792
|
className: STATIC_CUSTOMISATION_CLASSES.infoMessage
|
|
2859
|
-
}, isCurrentPlanP1X ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2793
|
+
}, isCurrentPlanP1X ? ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2860
2794
|
id: "eligibility-modal.p1x-bullet-2",
|
|
2861
2795
|
defaultMessage: "Renseignez les informations de votre <strong>carte bancaire.</strong>",
|
|
2862
2796
|
values: {
|
|
2863
2797
|
strong: (...chunks) => /*#__PURE__*/React.createElement("strong", null, chunks)
|
|
2864
2798
|
}
|
|
2865
|
-
}) : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2799
|
+
})) : ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2866
2800
|
id: "eligibility-modal.bullet-2",
|
|
2867
2801
|
defaultMessage: "Laissez-vous guider et validez votre paiement en <strong>2 minutes.</strong>",
|
|
2868
2802
|
values: {
|
|
2869
2803
|
strong: (...chunks) => /*#__PURE__*/React.createElement("strong", null, chunks)
|
|
2870
2804
|
}
|
|
2871
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
2805
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
2872
2806
|
className: s$7.listItem
|
|
2873
2807
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2874
2808
|
className: cx(s$7.bullet, STATIC_CUSTOMISATION_CLASSES.bullet)
|
|
2875
2809
|
}, "3"), /*#__PURE__*/React.createElement("div", {
|
|
2876
2810
|
className: STATIC_CUSTOMISATION_CLASSES.infoMessage
|
|
2877
|
-
}, isCurrentPlanP1X ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2811
|
+
}, isCurrentPlanP1X ? ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2878
2812
|
id: "eligibility-modal.p1x-bullet-3",
|
|
2879
2813
|
defaultMessage: "<strong>La validation </strong> de votre paiement est instantan\u00E9e !",
|
|
2880
2814
|
values: {
|
|
2881
2815
|
strong: (...chunks) => /*#__PURE__*/React.createElement("strong", null, chunks)
|
|
2882
2816
|
}
|
|
2883
|
-
}) : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2817
|
+
})) : ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2884
2818
|
id: "eligibility-modal.bullet-3",
|
|
2885
2819
|
defaultMessage: "<strong>Gardez le contr\u00F4le</strong> en avan\u00E7ant ou reculant vos \u00E9ch\u00E9ances \u00E0 votre rythme.",
|
|
2886
2820
|
values: {
|
|
2887
2821
|
strong: (...chunks) => /*#__PURE__*/React.createElement("strong", null, chunks)
|
|
2888
2822
|
}
|
|
2889
|
-
}))));
|
|
2823
|
+
}))))));
|
|
2890
2824
|
|
|
2891
2825
|
var s$8 = {"title":"_3ERx-"};
|
|
2892
2826
|
|
|
2893
2827
|
const Title = ({
|
|
2894
2828
|
isSomePlanDeferred,
|
|
2895
2829
|
isCurrentPlanP1X
|
|
2896
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
2830
|
+
}) => ( /*#__PURE__*/React.createElement("div", {
|
|
2897
2831
|
className: cx(s$8.title, STATIC_CUSTOMISATION_CLASSES.title),
|
|
2898
2832
|
"data-testid": "modal-title-element"
|
|
2899
|
-
}, isSomePlanDeferred ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2833
|
+
}, isSomePlanDeferred ? ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2900
2834
|
id: "eligibility-modal.title-deferred-plan",
|
|
2901
2835
|
defaultMessage: "Payez en plusieurs fois ou plus tard par carte bancaire avec Alma."
|
|
2902
|
-
}) : isCurrentPlanP1X ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2836
|
+
})) : isCurrentPlanP1X ? ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2903
2837
|
id: "eligibility-modal.title-pay-now",
|
|
2904
2838
|
defaultMessage: "Payez comptant par carte bancaire avec Alma."
|
|
2905
|
-
}) : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2839
|
+
})) : ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2906
2840
|
id: "eligibility-modal.title-normal",
|
|
2907
2841
|
defaultMessage: "Payez en plusieurs fois par carte bancaire avec Alma."
|
|
2908
|
-
}));
|
|
2842
|
+
}))));
|
|
2909
2843
|
|
|
2910
2844
|
var s$9 = {"container":"_21g6u","block":"_3zaP5","left":"_2SBRC","logo":"_xW3wt"};
|
|
2911
2845
|
|
|
@@ -2914,7 +2848,7 @@ const DesktopModal = ({
|
|
|
2914
2848
|
isSomePlanDeferred,
|
|
2915
2849
|
cards,
|
|
2916
2850
|
isCurrentPlanP1X
|
|
2917
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
2851
|
+
}) => ( /*#__PURE__*/React.createElement("div", {
|
|
2918
2852
|
className: cx(s$9.container, STATIC_CUSTOMISATION_CLASSES.desktopModal),
|
|
2919
2853
|
"data-testid": "modal-container"
|
|
2920
2854
|
}, /*#__PURE__*/React.createElement("aside", {
|
|
@@ -2931,7 +2865,7 @@ const DesktopModal = ({
|
|
|
2931
2865
|
width: "75"
|
|
2932
2866
|
})), /*#__PURE__*/React.createElement("div", {
|
|
2933
2867
|
className: cx(s$9.block, STATIC_CUSTOMISATION_CLASSES.rightSide)
|
|
2934
|
-
}, children));
|
|
2868
|
+
}, children)));
|
|
2935
2869
|
|
|
2936
2870
|
var s$a = {"noEligibility":"_17qNJ","loader":"_2oTJq","scheduleArea":"_2u9rj","verticalLine":"_VRdAU"};
|
|
2937
2871
|
|
|
@@ -2942,7 +2876,7 @@ const MobileModal = ({
|
|
|
2942
2876
|
isSomePlanDeferred,
|
|
2943
2877
|
cards,
|
|
2944
2878
|
isCurrentPlanP1X
|
|
2945
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
2879
|
+
}) => ( /*#__PURE__*/React.createElement("div", {
|
|
2946
2880
|
className: cx(s$b.container, STATIC_CUSTOMISATION_CLASSES.mobileModal),
|
|
2947
2881
|
"data-testid": "modal-container"
|
|
2948
2882
|
}, /*#__PURE__*/React.createElement(Title, {
|
|
@@ -2955,7 +2889,7 @@ const MobileModal = ({
|
|
|
2955
2889
|
}), /*#__PURE__*/React.createElement(AlmaLogo, {
|
|
2956
2890
|
className: s$b.logo,
|
|
2957
2891
|
width: "75"
|
|
2958
|
-
}));
|
|
2892
|
+
})));
|
|
2959
2893
|
|
|
2960
2894
|
const EligibilityModal = ({
|
|
2961
2895
|
initialPlanIndex,
|
|
@@ -2981,14 +2915,14 @@ const EligibilityModal = ({
|
|
|
2981
2915
|
isSomePlanDeferred: isSomePlanDeferred,
|
|
2982
2916
|
cards: cards,
|
|
2983
2917
|
isCurrentPlanP1X: isP1X(currentPlan)
|
|
2984
|
-
}, status ===
|
|
2918
|
+
}, status === statusResponse.PENDING && ( /*#__PURE__*/React.createElement("div", {
|
|
2985
2919
|
className: s$a.loader
|
|
2986
|
-
}, /*#__PURE__*/React.createElement(LoadingIndicator, null)), status ===
|
|
2920
|
+
}, /*#__PURE__*/React.createElement(LoadingIndicator, null))), status === statusResponse.SUCCESS && eligiblePlans.length === 0 && ( /*#__PURE__*/React.createElement("div", {
|
|
2987
2921
|
className: s$a.noEligibility
|
|
2988
2922
|
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2989
2923
|
id: "eligibility-modal.no-eligibility",
|
|
2990
2924
|
defaultMessage: "Oups, il semblerait que la simulation n'ait pas fonctionn\u00E9."
|
|
2991
|
-
})), status ===
|
|
2925
|
+
}))), status === statusResponse.SUCCESS && eligiblePlans.length >= 1 && ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EligibilityPlansButtons, {
|
|
2992
2926
|
eligibilityPlans: eligiblePlans,
|
|
2993
2927
|
currentPlanIndex: currentPlanIndex,
|
|
2994
2928
|
setCurrentPlanIndex: setCurrentPlanIndex
|
|
@@ -3000,13 +2934,12 @@ const EligibilityModal = ({
|
|
|
3000
2934
|
currentPlan: currentPlan
|
|
3001
2935
|
}), /*#__PURE__*/React.createElement(TotalBlock, {
|
|
3002
2936
|
currentPlan: currentPlan
|
|
3003
|
-
})))));
|
|
2937
|
+
}))))));
|
|
3004
2938
|
};
|
|
3005
2939
|
|
|
3006
2940
|
/**
|
|
3007
2941
|
* This component allows to display only the modal, without PaymentPlans.
|
|
3008
2942
|
*/
|
|
3009
|
-
|
|
3010
2943
|
const ModalContainer = ({
|
|
3011
2944
|
purchaseAmount,
|
|
3012
2945
|
apiData,
|
|
@@ -3047,11 +2980,9 @@ const useButtonAnimation = (iterateValues, transitionDelay) => {
|
|
|
3047
2980
|
useEffect(() => {
|
|
3048
2981
|
let timeout;
|
|
3049
2982
|
let isMounted = true;
|
|
3050
|
-
|
|
3051
2983
|
if (transitionDelay === -1) {
|
|
3052
2984
|
return;
|
|
3053
2985
|
}
|
|
3054
|
-
|
|
3055
2986
|
if (iterateValues.length !== 0) {
|
|
3056
2987
|
if (!iterateValues.includes(current) && update) setCurrent(iterateValues[0]);
|
|
3057
2988
|
timeout = setTimeout(() => {
|
|
@@ -3060,7 +2991,6 @@ const useButtonAnimation = (iterateValues, transitionDelay) => {
|
|
|
3060
2991
|
}
|
|
3061
2992
|
}, transitionDelay);
|
|
3062
2993
|
}
|
|
3063
|
-
|
|
3064
2994
|
return () => {
|
|
3065
2995
|
isMounted = false;
|
|
3066
2996
|
clearTimeout(timeout);
|
|
@@ -3090,20 +3020,18 @@ const getIndexOfActivePlan = ({
|
|
|
3090
3020
|
eligibilityPlans
|
|
3091
3021
|
}) => {
|
|
3092
3022
|
const suggestedPaymentPlanArray = Array.isArray(suggestedPaymentPlan) ? suggestedPaymentPlan : [suggestedPaymentPlan];
|
|
3093
|
-
|
|
3094
3023
|
for (const index in suggestedPaymentPlanArray) {
|
|
3095
3024
|
const installmentsCount = suggestedPaymentPlanArray[index];
|
|
3096
3025
|
const planFound = eligibilityPlans.findIndex(plan => {
|
|
3097
|
-
return plan.installments_count === installmentsCount && plan.eligible &&
|
|
3026
|
+
return plan.installments_count === installmentsCount && plan.eligible &&
|
|
3027
|
+
// Remove the PayLater plans from the plan to target, we will code a better solution later
|
|
3098
3028
|
// To differentiate P1X from PayLater while using the `suggestedPaymentPlan` property.
|
|
3099
3029
|
!plan.deferred_days && !plan.deferred_months;
|
|
3100
3030
|
});
|
|
3101
|
-
|
|
3102
3031
|
if (planFound !== -1) {
|
|
3103
3032
|
return planFound;
|
|
3104
3033
|
}
|
|
3105
3034
|
}
|
|
3106
|
-
|
|
3107
3035
|
return 0;
|
|
3108
3036
|
};
|
|
3109
3037
|
|
|
@@ -3115,7 +3043,6 @@ const prefix$1 = 'alma-payment-plans';
|
|
|
3115
3043
|
* Class names for the **payment plans** widget.
|
|
3116
3044
|
* Those classes are intended to be used by the **merchant developer**.
|
|
3117
3045
|
*/
|
|
3118
|
-
|
|
3119
3046
|
const STATIC_CUSTOMISATION_CLASSES$1 = {
|
|
3120
3047
|
container: prefix$1 + '-container',
|
|
3121
3048
|
eligibilityLine: prefix$1 + '-eligibility-line',
|
|
@@ -3129,7 +3056,6 @@ var s$d = {"widgetButton":"_TSkFv","logo":"_LJ4nZ","primaryContainer":"_bMClc","
|
|
|
3129
3056
|
|
|
3130
3057
|
const VERY_LONG_TIME_IN_MS = 1000 * 3600;
|
|
3131
3058
|
const DEFAULT_TRANSITION_TIME = 5500;
|
|
3132
|
-
|
|
3133
3059
|
const PaymentPlanWidget = ({
|
|
3134
3060
|
apiData,
|
|
3135
3061
|
configPlans,
|
|
@@ -3151,18 +3077,13 @@ const PaymentPlanWidget = ({
|
|
|
3151
3077
|
suggestedPaymentPlan: suggestedPaymentPlan != null ? suggestedPaymentPlan : 0
|
|
3152
3078
|
});
|
|
3153
3079
|
const isSuggestedPaymentPlanSpecified = suggestedPaymentPlan !== undefined; // 👈 The merchant decided to focus a tab
|
|
3154
|
-
|
|
3155
3080
|
const isTransitionSpecified = transitionDelay !== undefined; // 👈 The merchant has specified a transition time
|
|
3156
|
-
|
|
3157
3081
|
const [isOpen, setIsOpen] = useState(false);
|
|
3158
|
-
|
|
3159
3082
|
const openModal = () => setIsOpen(true);
|
|
3160
|
-
|
|
3161
3083
|
const closeModal = event => {
|
|
3162
3084
|
setIsOpen(false);
|
|
3163
3085
|
onModalClose && onModalClose(event);
|
|
3164
3086
|
};
|
|
3165
|
-
|
|
3166
3087
|
const eligiblePlanKeys = eligibilityPlans.reduce((acc, plan, index) => plan.eligible ? [...acc, index] : acc, []);
|
|
3167
3088
|
/**
|
|
3168
3089
|
* If merchand specify a suggestedPaymentPlan and no transition, we set a very long transition delay.
|
|
@@ -3170,19 +3091,15 @@ const PaymentPlanWidget = ({
|
|
|
3170
3091
|
* If none of those properties are specified, we set a default transition delay.
|
|
3171
3092
|
* @returns
|
|
3172
3093
|
*/
|
|
3173
|
-
|
|
3174
3094
|
const realTransitionTime = () => {
|
|
3175
3095
|
if (isTransitionSpecified) {
|
|
3176
3096
|
return transitionDelay != null ? transitionDelay : DEFAULT_TRANSITION_TIME;
|
|
3177
3097
|
}
|
|
3178
|
-
|
|
3179
3098
|
if (isSuggestedPaymentPlanSpecified) {
|
|
3180
3099
|
return VERY_LONG_TIME_IN_MS;
|
|
3181
3100
|
}
|
|
3182
|
-
|
|
3183
3101
|
return DEFAULT_TRANSITION_TIME;
|
|
3184
3102
|
};
|
|
3185
|
-
|
|
3186
3103
|
const {
|
|
3187
3104
|
current,
|
|
3188
3105
|
onHover,
|
|
@@ -3190,9 +3107,8 @@ const PaymentPlanWidget = ({
|
|
|
3190
3107
|
} = useButtonAnimation(eligiblePlanKeys, realTransitionTime());
|
|
3191
3108
|
useEffect(() => {
|
|
3192
3109
|
// When API has given a response AND the marchand set an active plan by default.
|
|
3193
|
-
if (status ===
|
|
3110
|
+
if (status === statusResponse.SUCCESS && isSuggestedPaymentPlanSpecified) {
|
|
3194
3111
|
onHover(activePlanIndex); // We select the first active plan possible
|
|
3195
|
-
|
|
3196
3112
|
onLeave(); // We need to call onLeave to reset the animation
|
|
3197
3113
|
}
|
|
3198
3114
|
}, [status]);
|
|
@@ -3202,30 +3118,24 @@ const PaymentPlanWidget = ({
|
|
|
3202
3118
|
* @param {number} planIndex - The index of the plan that the user has selected.
|
|
3203
3119
|
* @returns The index of the planKey in the eligiblePlanKeys array.
|
|
3204
3120
|
*/
|
|
3205
|
-
|
|
3206
3121
|
const getIndexWithinEligiblePlans = planIndex => {
|
|
3207
3122
|
const index = eligiblePlanKeys.findIndex(planKey => planKey === planIndex);
|
|
3208
3123
|
return index === -1 ? 0 : index;
|
|
3209
3124
|
};
|
|
3210
|
-
|
|
3211
|
-
if (status === apiStatus.PENDING) {
|
|
3125
|
+
if (status === statusResponse.PENDING) {
|
|
3212
3126
|
return /*#__PURE__*/React.createElement("div", {
|
|
3213
3127
|
className: cx(s$d.widgetButton, s$d.pending)
|
|
3214
3128
|
}, /*#__PURE__*/React.createElement(Loader, null));
|
|
3215
3129
|
}
|
|
3216
|
-
|
|
3217
|
-
if (hideIfNotEligible && eligiblePlans.length === 0 || eligibilityPlans.length === 0 || status === apiStatus.FAILED) {
|
|
3130
|
+
if (hideIfNotEligible && eligiblePlans.length === 0 || eligibilityPlans.length === 0 || status === statusResponse.FAILED) {
|
|
3218
3131
|
return null;
|
|
3219
3132
|
}
|
|
3220
|
-
|
|
3221
3133
|
const handleOpenModal = e => {
|
|
3222
3134
|
e.preventDefault();
|
|
3223
|
-
|
|
3224
3135
|
if (eligiblePlans.length > 0) {
|
|
3225
3136
|
openModal();
|
|
3226
3137
|
}
|
|
3227
3138
|
};
|
|
3228
|
-
|
|
3229
3139
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
3230
3140
|
onClick: handleOpenModal,
|
|
3231
3141
|
className: cx(s$d.widgetButton, {
|
|
@@ -3259,27 +3169,24 @@ const PaymentPlanWidget = ({
|
|
|
3259
3169
|
className: cx(s$d.info, {
|
|
3260
3170
|
[cx(s$d.notEligible, STATIC_CUSTOMISATION_CLASSES$1.notEligibleOption)]: eligibilityPlans[current] && !eligibilityPlans[current].eligible
|
|
3261
3171
|
}, STATIC_CUSTOMISATION_CLASSES$1.paymentInfo)
|
|
3262
|
-
}, eligibilityPlans.length !== 0 && paymentPlanInfoText(eligibilityPlans[current]))), isOpen && /*#__PURE__*/React.createElement(EligibilityModal, {
|
|
3172
|
+
}, eligibilityPlans.length !== 0 && paymentPlanInfoText(eligibilityPlans[current]))), isOpen && ( /*#__PURE__*/React.createElement(EligibilityModal, {
|
|
3263
3173
|
initialPlanIndex: getIndexWithinEligiblePlans(current),
|
|
3264
3174
|
onClose: closeModal,
|
|
3265
3175
|
eligibilityPlans: eligiblePlans,
|
|
3266
3176
|
status: status,
|
|
3267
3177
|
cards: cards
|
|
3268
|
-
}));
|
|
3178
|
+
})));
|
|
3269
3179
|
};
|
|
3270
3180
|
|
|
3271
3181
|
class WidgetsController {
|
|
3272
3182
|
constructor(apiData) {
|
|
3273
3183
|
this.apiData = apiData;
|
|
3274
3184
|
}
|
|
3275
|
-
|
|
3276
3185
|
add(widget, options) {
|
|
3277
3186
|
const containerDiv = document.querySelector(options.container);
|
|
3278
|
-
|
|
3279
3187
|
if (containerDiv) {
|
|
3280
3188
|
unmountComponentAtNode(containerDiv);
|
|
3281
3189
|
}
|
|
3282
|
-
|
|
3283
3190
|
if (widget === widgetTypes.PaymentPlans) {
|
|
3284
3191
|
const {
|
|
3285
3192
|
container,
|
|
@@ -3296,7 +3203,6 @@ class WidgetsController {
|
|
|
3296
3203
|
cards,
|
|
3297
3204
|
onModalClose
|
|
3298
3205
|
} = options;
|
|
3299
|
-
|
|
3300
3206
|
if (containerDiv) {
|
|
3301
3207
|
render( /*#__PURE__*/React.createElement(Provider, {
|
|
3302
3208
|
locale: locale
|
|
@@ -3316,7 +3222,6 @@ class WidgetsController {
|
|
|
3316
3222
|
})), document.querySelector(container));
|
|
3317
3223
|
}
|
|
3318
3224
|
}
|
|
3319
|
-
|
|
3320
3225
|
if (widget === widgetTypes.Modal) {
|
|
3321
3226
|
const {
|
|
3322
3227
|
container,
|
|
@@ -3329,13 +3234,11 @@ class WidgetsController {
|
|
|
3329
3234
|
cards,
|
|
3330
3235
|
onClose
|
|
3331
3236
|
} = options;
|
|
3332
|
-
|
|
3333
3237
|
const close = event => {
|
|
3334
3238
|
if (!containerDiv) return;
|
|
3335
3239
|
unmountComponentAtNode(containerDiv);
|
|
3336
3240
|
onClose && onClose(event);
|
|
3337
3241
|
};
|
|
3338
|
-
|
|
3339
3242
|
const renderModal = () => {
|
|
3340
3243
|
render( /*#__PURE__*/React.createElement(Provider, {
|
|
3341
3244
|
locale: locale
|
|
@@ -3348,33 +3251,28 @@ class WidgetsController {
|
|
|
3348
3251
|
onClose: close,
|
|
3349
3252
|
cards: cards
|
|
3350
3253
|
})), document.querySelector(container));
|
|
3351
|
-
};
|
|
3352
|
-
|
|
3353
|
-
|
|
3254
|
+
};
|
|
3255
|
+
// if clickableSelector is provided, add an onClick event handler to open the Modal.
|
|
3354
3256
|
if (clickableSelector) {
|
|
3355
3257
|
var _document$querySelect;
|
|
3356
|
-
|
|
3357
|
-
(_document$querySelect = document.querySelector(clickableSelector)) == null ? void 0 : _document$querySelect.addEventListener('click', renderModal, false);
|
|
3258
|
+
(_document$querySelect = document.querySelector(clickableSelector)) == null || _document$querySelect.addEventListener('click', renderModal, false);
|
|
3358
3259
|
}
|
|
3359
|
-
|
|
3360
3260
|
return {
|
|
3361
3261
|
open: renderModal,
|
|
3362
3262
|
close
|
|
3363
3263
|
};
|
|
3364
3264
|
}
|
|
3365
3265
|
}
|
|
3366
|
-
|
|
3367
3266
|
}
|
|
3368
3267
|
|
|
3369
3268
|
var ApiMode;
|
|
3370
|
-
|
|
3371
3269
|
(function (ApiMode) {
|
|
3372
3270
|
ApiMode["LIVE"] = "https://api.getalma.eu";
|
|
3373
3271
|
ApiMode["TEST"] = "https://api.sandbox.getalma.eu";
|
|
3374
3272
|
})(ApiMode || (ApiMode = {}));
|
|
3375
3273
|
|
|
3274
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
3376
3275
|
var Widgets;
|
|
3377
|
-
|
|
3378
3276
|
(function (Widgets) {
|
|
3379
3277
|
function initialize(merchantId, mode) {
|
|
3380
3278
|
return new WidgetsController({
|
|
@@ -3382,15 +3280,12 @@ var Widgets;
|
|
|
3382
3280
|
merchantId
|
|
3383
3281
|
});
|
|
3384
3282
|
}
|
|
3385
|
-
|
|
3386
3283
|
Widgets.initialize = initialize;
|
|
3387
3284
|
Widgets.PaymentPlans = widgetTypes.PaymentPlans;
|
|
3388
3285
|
Widgets.Modal = widgetTypes.Modal;
|
|
3389
|
-
})(Widgets || (Widgets = {}));
|
|
3390
|
-
|
|
3391
|
-
|
|
3286
|
+
})(Widgets || (Widgets = {}));
|
|
3287
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
3392
3288
|
var Utils;
|
|
3393
|
-
|
|
3394
3289
|
(function (Utils) {
|
|
3395
3290
|
Utils.priceToCents = priceToCents;
|
|
3396
3291
|
Utils.priceFromCents = priceFromCents;
|