@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
package/dist/raw/widgets.m.js
CHANGED
|
@@ -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
|
+
};
|
|
120
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;
|
|
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";
|
|
@@ -1556,178 +1487,135 @@ var isP1X = function isP1X(plan) {
|
|
|
1556
1487
|
};
|
|
1557
1488
|
|
|
1558
1489
|
/* eslint-disable */
|
|
1559
|
-
|
|
1560
1490
|
(function (ElementProto) {
|
|
1561
1491
|
if (typeof ElementProto.matches !== 'function') {
|
|
1562
1492
|
ElementProto.matches = ElementProto.msMatchesSelector || ElementProto.mozMatchesSelector || ElementProto.webkitMatchesSelector || function matches(selector) {
|
|
1563
1493
|
var element = this;
|
|
1564
1494
|
var elements = (element.document || element.ownerDocument).querySelectorAll(selector);
|
|
1565
1495
|
var index = 0;
|
|
1566
|
-
|
|
1567
1496
|
while (elements[index] && elements[index] !== element) {
|
|
1568
1497
|
++index;
|
|
1569
1498
|
}
|
|
1570
|
-
|
|
1571
1499
|
return Boolean(elements[index]);
|
|
1572
1500
|
};
|
|
1573
1501
|
}
|
|
1574
|
-
|
|
1575
1502
|
if (typeof ElementProto.closest !== 'function') {
|
|
1576
1503
|
ElementProto.closest = function closest(selector) {
|
|
1577
1504
|
var element = this;
|
|
1578
|
-
|
|
1579
1505
|
while (element && element.nodeType === 1) {
|
|
1580
1506
|
if (element.matches(selector)) {
|
|
1581
1507
|
return element;
|
|
1582
1508
|
}
|
|
1583
|
-
|
|
1584
1509
|
element = element.parentNode;
|
|
1585
1510
|
}
|
|
1586
|
-
|
|
1587
1511
|
return null;
|
|
1588
1512
|
};
|
|
1589
1513
|
}
|
|
1590
1514
|
})(window.Element.prototype);
|
|
1515
|
+
|
|
1591
1516
|
/*
|
|
1592
1517
|
* Element.prototype.classList polyfill
|
|
1593
1518
|
*/
|
|
1594
|
-
// 1. String.prototype.trim polyfill
|
|
1595
|
-
|
|
1596
1519
|
|
|
1520
|
+
// 1. String.prototype.trim polyfill
|
|
1597
1521
|
if (!''.trim) String.prototype.trim = function () {
|
|
1598
1522
|
return this.replace(/^[\s]+|[\s]+$/g, '');
|
|
1599
1523
|
};
|
|
1600
|
-
|
|
1601
1524
|
(function (window) {
|
|
1602
1525
|
|
|
1526
|
+
// prevent global namespace pollution
|
|
1603
1527
|
if (!window.DOMException) (DOMException = function DOMException(reason) {
|
|
1604
1528
|
this.message = reason;
|
|
1605
1529
|
}).prototype = new Error();
|
|
1606
|
-
|
|
1607
1530
|
var wsRE = /[\11\12\14\15\40]/,
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1531
|
+
wsIndex = 0,
|
|
1532
|
+
checkIfValidClassListEntry = function checkIfValidClassListEntry(O, V) {
|
|
1533
|
+
if (V === '') throw new DOMException("Failed to execute '" + O + "' on 'DOMTokenList': The token provided must not be empty.");
|
|
1534
|
+
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.");
|
|
1535
|
+
};
|
|
1536
|
+
// 2. Implement the barebones DOMTokenList livelyness polyfill
|
|
1615
1537
|
if (typeof DOMTokenList !== 'function') (function (window) {
|
|
1616
1538
|
var document = window.document,
|
|
1617
|
-
|
|
1618
|
-
|
|
1539
|
+
Object = window.Object,
|
|
1540
|
+
hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1619
1541
|
var defineProperty = Object.defineProperty,
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1542
|
+
allowTokenListConstruction = 0,
|
|
1543
|
+
skipPropChange = 0;
|
|
1623
1544
|
var DOMTokenList = function DOMTokenList() {
|
|
1624
1545
|
if (!allowTokenListConstruction) throw TypeError('Illegal constructor'); // internally let it through
|
|
1625
1546
|
};
|
|
1626
|
-
|
|
1627
1547
|
DOMTokenList.prototype.toString = DOMTokenList.prototype.toLocaleString = function () {
|
|
1628
1548
|
return this.value;
|
|
1629
1549
|
};
|
|
1630
|
-
|
|
1631
1550
|
DOMTokenList.prototype.add = function () {
|
|
1632
1551
|
a: for (var v = 0, argLen = arguments.length, val = '', ele = this[' uCL'], proto = ele[' uCLp']; v !== argLen; ++v) {
|
|
1633
1552
|
val = arguments[v] + '', checkIfValidClassListEntry('add', val);
|
|
1634
|
-
|
|
1635
|
-
for (var i = 0, Len = proto.length, resStr = val; i !== Len; ++i) {
|
|
1636
|
-
if (this[i] === val) continue a;else resStr += ' ' + this[i];
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1553
|
+
for (var i = 0, Len = proto.length, resStr = val; i !== Len; ++i) if (this[i] === val) continue a;else resStr += ' ' + this[i];
|
|
1639
1554
|
this[Len] = val, proto.length += 1, proto.value = resStr;
|
|
1640
1555
|
}
|
|
1641
1556
|
skipPropChange = 1, ele.className = proto.value, skipPropChange = 0;
|
|
1642
1557
|
};
|
|
1643
|
-
|
|
1644
1558
|
DOMTokenList.prototype.remove = function () {
|
|
1645
1559
|
for (var v = 0, argLen = arguments.length, val = '', ele = this[' uCL'], proto = ele[' uCLp']; v !== argLen; ++v) {
|
|
1646
1560
|
val = arguments[v] + '', checkIfValidClassListEntry('remove', val);
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1561
|
+
for (var i = 0, Len = proto.length, resStr = '', is = 0; i !== Len; ++i) if (is) {
|
|
1562
|
+
this[i - 1] = this[i];
|
|
1563
|
+
} else {
|
|
1564
|
+
if (this[i] !== val) {
|
|
1565
|
+
resStr += this[i] + ' ';
|
|
1651
1566
|
} else {
|
|
1652
|
-
|
|
1653
|
-
resStr += this[i] + ' ';
|
|
1654
|
-
} else {
|
|
1655
|
-
is = 1;
|
|
1656
|
-
}
|
|
1567
|
+
is = 1;
|
|
1657
1568
|
}
|
|
1658
1569
|
}
|
|
1659
|
-
|
|
1660
1570
|
if (!is) continue;
|
|
1661
1571
|
delete this[Len], proto.length -= 1, proto.value = resStr;
|
|
1662
1572
|
}
|
|
1663
1573
|
skipPropChange = 1, ele.className = proto.value, skipPropChange = 0;
|
|
1664
1574
|
};
|
|
1665
|
-
|
|
1666
1575
|
window.DOMTokenList = DOMTokenList;
|
|
1667
|
-
|
|
1668
1576
|
function whenPropChanges() {
|
|
1669
1577
|
var evt = window.event,
|
|
1670
|
-
|
|
1671
|
-
|
|
1578
|
+
prop = evt.propertyName;
|
|
1672
1579
|
if (!skipPropChange && (prop === 'className' || prop === 'classList' && !defineProperty)) {
|
|
1673
1580
|
var target = evt.srcElement,
|
|
1674
|
-
|
|
1675
|
-
|
|
1581
|
+
protoObjProto = target[' uCLp'],
|
|
1582
|
+
strval = '' + target[prop];
|
|
1676
1583
|
var tokens = strval.trim().split(wsRE),
|
|
1677
|
-
|
|
1584
|
+
resTokenList = target[prop === 'classList' ? ' uCL' : 'classList'];
|
|
1678
1585
|
var oldLen = protoObjProto.length;
|
|
1679
|
-
|
|
1680
1586
|
a: for (var cI = 0, cLen = protoObjProto.length = tokens.length, sub = 0; cI !== cLen; ++cI) {
|
|
1681
|
-
for (var innerI = 0; innerI !== cI; ++innerI) {
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
continue a;
|
|
1685
|
-
}
|
|
1587
|
+
for (var innerI = 0; innerI !== cI; ++innerI) if (tokens[innerI] === tokens[cI]) {
|
|
1588
|
+
sub++;
|
|
1589
|
+
continue a;
|
|
1686
1590
|
}
|
|
1687
|
-
|
|
1688
1591
|
resTokenList[cI - sub] = tokens[cI];
|
|
1689
1592
|
}
|
|
1690
|
-
|
|
1691
|
-
for (var i = cLen - sub; i < oldLen; ++i) {
|
|
1692
|
-
delete resTokenList[i];
|
|
1693
|
-
} //remove trailing indexs
|
|
1694
|
-
|
|
1695
|
-
|
|
1593
|
+
for (var i = cLen - sub; i < oldLen; ++i) delete resTokenList[i]; //remove trailing indexs
|
|
1696
1594
|
if (prop !== 'classList') return;
|
|
1697
1595
|
skipPropChange = 1, target.classList = resTokenList, target.className = strval;
|
|
1698
1596
|
skipPropChange = 0, resTokenList.length = tokens.length - sub;
|
|
1699
1597
|
}
|
|
1700
1598
|
}
|
|
1701
|
-
|
|
1702
1599
|
function polyfillClassList(ele) {
|
|
1703
1600
|
if (!ele || !('innerHTML' in ele)) throw TypeError('Illegal invocation');
|
|
1704
1601
|
ele.detachEvent('onpropertychange', whenPropChanges); // prevent duplicate handler infinite loop
|
|
1705
|
-
|
|
1706
1602
|
allowTokenListConstruction = 1;
|
|
1707
|
-
|
|
1708
1603
|
try {
|
|
1709
1604
|
var protoObj = function protoObj() {};
|
|
1710
|
-
|
|
1711
1605
|
protoObj.prototype = new DOMTokenList();
|
|
1712
1606
|
} finally {
|
|
1713
1607
|
allowTokenListConstruction = 0;
|
|
1714
1608
|
}
|
|
1715
|
-
|
|
1716
1609
|
var protoObjProto = protoObj.prototype,
|
|
1717
|
-
|
|
1718
|
-
|
|
1610
|
+
resTokenList = new protoObj();
|
|
1719
1611
|
a: for (var toks = ele.className.trim().split(wsRE), cI = 0, cLen = toks.length, sub = 0; cI !== cLen; ++cI) {
|
|
1720
|
-
for (var innerI = 0; innerI !== cI; ++innerI) {
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
continue a;
|
|
1724
|
-
}
|
|
1612
|
+
for (var innerI = 0; innerI !== cI; ++innerI) if (toks[innerI] === toks[cI]) {
|
|
1613
|
+
sub++;
|
|
1614
|
+
continue a;
|
|
1725
1615
|
}
|
|
1726
|
-
|
|
1727
1616
|
this[cI - sub] = toks[cI];
|
|
1728
1617
|
}
|
|
1729
1618
|
protoObjProto.length = cLen - sub, protoObjProto.value = ele.className, protoObjProto[' uCL'] = ele;
|
|
1730
|
-
|
|
1731
1619
|
if (defineProperty) {
|
|
1732
1620
|
defineProperty(ele, 'classList', {
|
|
1733
1621
|
// IE8 & IE9 allow defineProperty on the DOM
|
|
@@ -1739,23 +1627,15 @@ if (!''.trim) String.prototype.trim = function () {
|
|
|
1739
1627
|
set: function set(newVal) {
|
|
1740
1628
|
skipPropChange = 1, ele.className = protoObjProto.value = newVal += '', skipPropChange = 0;
|
|
1741
1629
|
var toks = newVal.trim().split(wsRE),
|
|
1742
|
-
|
|
1743
|
-
|
|
1630
|
+
oldLen = protoObjProto.length;
|
|
1744
1631
|
a: for (var cI = 0, cLen = protoObjProto.length = toks.length, sub = 0; cI !== cLen; ++cI) {
|
|
1745
|
-
for (var innerI = 0; innerI !== cI; ++innerI) {
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
continue a;
|
|
1749
|
-
}
|
|
1632
|
+
for (var innerI = 0; innerI !== cI; ++innerI) if (toks[innerI] === toks[cI]) {
|
|
1633
|
+
sub++;
|
|
1634
|
+
continue a;
|
|
1750
1635
|
}
|
|
1751
|
-
|
|
1752
1636
|
resTokenList[cI - sub] = toks[cI];
|
|
1753
1637
|
}
|
|
1754
|
-
|
|
1755
|
-
for (var i = cLen - sub; i < oldLen; ++i) {
|
|
1756
|
-
delete resTokenList[i];
|
|
1757
|
-
} //remove trailing indexs
|
|
1758
|
-
|
|
1638
|
+
for (var i = cLen - sub; i < oldLen; ++i) delete resTokenList[i]; //remove trailing indexs
|
|
1759
1639
|
}
|
|
1760
1640
|
});
|
|
1761
1641
|
defineProperty(ele, ' uCLp', {
|
|
@@ -1774,10 +1654,8 @@ if (!''.trim) String.prototype.trim = function () {
|
|
|
1774
1654
|
} else {
|
|
1775
1655
|
ele.classList = resTokenList, ele[' uCL'] = resTokenList, ele[' uCLp'] = protoObj.prototype;
|
|
1776
1656
|
}
|
|
1777
|
-
|
|
1778
1657
|
ele.attachEvent('onpropertychange', whenPropChanges);
|
|
1779
1658
|
}
|
|
1780
|
-
|
|
1781
1659
|
try {
|
|
1782
1660
|
// Much faster & cleaner version for IE8 & IE9:
|
|
1783
1661
|
// Should work in IE8 because Element.prototype instanceof Node is true according to the specs
|
|
@@ -1794,27 +1672,26 @@ if (!''.trim) String.prototype.trim = function () {
|
|
|
1794
1672
|
});
|
|
1795
1673
|
} catch (e) {
|
|
1796
1674
|
// Less performant fallback for older browsers (IE 6-8):
|
|
1797
|
-
window[' uCL'] = polyfillClassList;
|
|
1798
|
-
|
|
1799
|
-
document.documentElement.firstChild.appendChild(document.createElement('style')).styleSheet.cssText = '_*{x-uCLp:expression(!this.hasOwnProperty("classList")&&window[" uCL"](this))}' +
|
|
1675
|
+
window[' uCL'] = polyfillClassList;
|
|
1676
|
+
// the below code ensures polyfillClassList is applied to all current and future elements in the doc.
|
|
1677
|
+
document.documentElement.firstChild.appendChild(document.createElement('style')).styleSheet.cssText = '_*{x-uCLp:expression(!this.hasOwnProperty("classList")&&window[" uCL"](this))}' +
|
|
1678
|
+
// IE6
|
|
1800
1679
|
'[class]{x-uCLp/**/:expression(!this.hasOwnProperty("classList")&&window[" uCL"](this))}'; //IE7-8
|
|
1801
1680
|
}
|
|
1802
|
-
})(window)
|
|
1681
|
+
})(window)
|
|
1682
|
+
// 3. Patch in unsupported methods in DOMTokenList
|
|
1803
1683
|
;
|
|
1804
|
-
|
|
1805
1684
|
(function (DOMTokenListProto, testClass) {
|
|
1806
1685
|
if (!DOMTokenListProto.item) DOMTokenListProto.item = function (i) {
|
|
1807
1686
|
function NullCheck(n) {
|
|
1808
1687
|
return n === void 0 ? null : n;
|
|
1809
1688
|
}
|
|
1810
|
-
|
|
1811
1689
|
return NullCheck(this[i]);
|
|
1812
1690
|
};
|
|
1813
1691
|
if (!DOMTokenListProto.toggle || testClass.toggle('a', 0) !== false) DOMTokenListProto.toggle = function (val) {
|
|
1814
1692
|
if (arguments.length > 1) return this[arguments[1] ? 'add' : 'remove'](val), !!arguments[1];
|
|
1815
1693
|
var oldValue = this.value;
|
|
1816
|
-
return this.remove(oldValue), oldValue === this.value && (this.add(val), true);
|
|
1817
|
-
/*|| false*/
|
|
1694
|
+
return this.remove(oldValue), oldValue === this.value && (this.add(val), true); /*|| false*/
|
|
1818
1695
|
};
|
|
1819
1696
|
if (!DOMTokenListProto.replace || typeof testClass.replace('a', 'b') !== 'boolean') DOMTokenListProto.replace = function (oldToken, newToken) {
|
|
1820
1697
|
checkIfValidClassListEntry('replace', oldToken), checkIfValidClassListEntry('replace', newToken);
|
|
@@ -1822,22 +1699,15 @@ if (!''.trim) String.prototype.trim = function () {
|
|
|
1822
1699
|
return this.remove(oldToken), this.value !== oldValue && (this.add(newToken), true);
|
|
1823
1700
|
};
|
|
1824
1701
|
if (!DOMTokenListProto.contains) DOMTokenListProto.contains = function (value) {
|
|
1825
|
-
for (var i = 0, Len = this.length; i !== Len; ++i)
|
|
1826
|
-
if (this[i] === value) return true;
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1702
|
+
for (var i = 0, Len = this.length; i !== Len; ++i) if (this[i] === value) return true;
|
|
1829
1703
|
return false;
|
|
1830
1704
|
};
|
|
1831
1705
|
if (!DOMTokenListProto.forEach) DOMTokenListProto.forEach = function (f) {
|
|
1832
|
-
if (arguments.length === 1) for (var i = 0, Len = this.length; i !== Len; ++i)
|
|
1833
|
-
f(this[i], i, this);
|
|
1834
|
-
} else for (var i = 0, Len = this.length, tArg = arguments[1]; i !== Len; ++i) {
|
|
1835
|
-
f.call(tArg, this[i], i, this);
|
|
1836
|
-
}
|
|
1706
|
+
if (arguments.length === 1) for (var i = 0, Len = this.length; i !== Len; ++i) f(this[i], i, this);else for (var i = 0, Len = this.length, tArg = arguments[1]; i !== Len; ++i) f.call(tArg, this[i], i, this);
|
|
1837
1707
|
};
|
|
1838
1708
|
if (!DOMTokenListProto.entries) DOMTokenListProto.entries = function () {
|
|
1839
1709
|
var nextIndex = 0,
|
|
1840
|
-
|
|
1710
|
+
that = this;
|
|
1841
1711
|
return {
|
|
1842
1712
|
next: function next() {
|
|
1843
1713
|
return nextIndex < that.length ? {
|
|
@@ -1851,7 +1721,7 @@ if (!''.trim) String.prototype.trim = function () {
|
|
|
1851
1721
|
};
|
|
1852
1722
|
if (!DOMTokenListProto.values) DOMTokenListProto.values = function () {
|
|
1853
1723
|
var nextIndex = 0,
|
|
1854
|
-
|
|
1724
|
+
that = this;
|
|
1855
1725
|
return {
|
|
1856
1726
|
next: function next() {
|
|
1857
1727
|
return nextIndex < that.length ? {
|
|
@@ -1865,7 +1735,7 @@ if (!''.trim) String.prototype.trim = function () {
|
|
|
1865
1735
|
};
|
|
1866
1736
|
if (!DOMTokenListProto.keys) DOMTokenListProto.keys = function () {
|
|
1867
1737
|
var nextIndex = 0,
|
|
1868
|
-
|
|
1738
|
+
that = this;
|
|
1869
1739
|
return {
|
|
1870
1740
|
next: function next() {
|
|
1871
1741
|
return nextIndex < that.length ? {
|
|
@@ -1886,11 +1756,11 @@ var messagesDE = {
|
|
|
1886
1756
|
"credit-features.total-credit-cost": "Davon Kreditkosten",
|
|
1887
1757
|
"eligibility-modal.bullet-1": "Wählen Sie <strong>Alma</strong> beim Check-out. ",
|
|
1888
1758
|
"eligibility-modal.bullet-2": "Lassen Sie sich führen und bestätigen Sie Ihre Zahlung in <strong>2 Minuten.</strong>",
|
|
1889
|
-
"eligibility-modal.bullet-3": "<strong>
|
|
1759
|
+
"eligibility-modal.bullet-3": "<strong>Behalten Sie die Kontrolle</strong> , indem Sie Ihre Fälligkeitstermine in Ihrem eigenen Tempo vor- oder zurückverlegen.",
|
|
1890
1760
|
"eligibility-modal.no-eligibility": "Ups, die Prüfung hat anscheinend nicht funktioniert.",
|
|
1891
1761
|
"eligibility-modal.p1x-bullet-1": "Wählen Sie <strong>Alma - Jetzt bezahlen</strong> zum Zeitpunkt der Zahlung.",
|
|
1892
1762
|
"eligibility-modal.p1x-bullet-2": "Tragen Sie Ihre <strong>Kreditkarteninformationen ein.</strong>",
|
|
1893
|
-
"eligibility-modal.p1x-bullet-3": "<strong>
|
|
1763
|
+
"eligibility-modal.p1x-bullet-3": "<strong> Die Bestätigung </strong> Ihrer Zahlung erfolgt sofort !",
|
|
1894
1764
|
"eligibility-modal.title-deferred-plan": "Zahlen Sie mit Alma in Raten oder später.",
|
|
1895
1765
|
"eligibility-modal.title-normal": "Zahlen Sie mit Alma in mehreren Raten.",
|
|
1896
1766
|
"eligibility-modal.title-pay-now": "Bezahlen Sie auf einmal mit Alma per Kreditkarte.",
|
|
@@ -1916,11 +1786,11 @@ var messagesEN = {
|
|
|
1916
1786
|
"credit-features.total-credit-cost": "Of which cost of credit",
|
|
1917
1787
|
"eligibility-modal.bullet-1": "Choose <strong>Alma</strong> at checkout.",
|
|
1918
1788
|
"eligibility-modal.bullet-2": "Let us guide you and validate your payment in <strong>2 minutes.</strong>",
|
|
1919
|
-
"eligibility-modal.bullet-3": "<strong>Stay in control</strong> by
|
|
1789
|
+
"eligibility-modal.bullet-3": "<strong>Stay in control</strong> by advancing or postponing your deadlines at your own pace.",
|
|
1920
1790
|
"eligibility-modal.no-eligibility": "Oops, looks like the simulation didn't work.",
|
|
1921
1791
|
"eligibility-modal.p1x-bullet-1": "Choose <strong>Alma - Pay now</strong> at checkout.",
|
|
1922
|
-
"eligibility-modal.p1x-bullet-2": "
|
|
1923
|
-
"eligibility-modal.p1x-bullet-3": "<strong>
|
|
1792
|
+
"eligibility-modal.p1x-bullet-2": "Enter your <strong>credit card details.</strong>",
|
|
1793
|
+
"eligibility-modal.p1x-bullet-3": "<strong>Your payment is instantly validated at </strong> !",
|
|
1924
1794
|
"eligibility-modal.title-deferred-plan": "Pay in installments or later by credit card with Alma.",
|
|
1925
1795
|
"eligibility-modal.title-normal": "Pay in installments by credit card with Alma.",
|
|
1926
1796
|
"eligibility-modal.title-pay-now": "Pay cash by credit card with Alma.",
|
|
@@ -1946,10 +1816,10 @@ var messagesES = {
|
|
|
1946
1816
|
"credit-features.total-credit-cost": "Coste de crédito (incl. en el total)",
|
|
1947
1817
|
"eligibility-modal.bullet-1": "Elige <strong>Alma</strong> como método de pago.",
|
|
1948
1818
|
"eligibility-modal.bullet-2": "Déjate guiar y válida tu pago en <strong>2 minutos.</strong>",
|
|
1949
|
-
"eligibility-modal.bullet-3": "<strong>Mantén el control</strong> adelantando o
|
|
1819
|
+
"eligibility-modal.bullet-3": "<strong>Mantén el control</strong> adelantando o aplazando los plazos a su propio ritmo.",
|
|
1950
1820
|
"eligibility-modal.no-eligibility": "Uy, parece que la simulación no ha funcionado.",
|
|
1951
1821
|
"eligibility-modal.p1x-bullet-1": "Elije <strong>Alma - Pagar ahora</strong> al momento de la compra.",
|
|
1952
|
-
"eligibility-modal.p1x-bullet-2": "
|
|
1822
|
+
"eligibility-modal.p1x-bullet-2": "Introduce los datos de tu tarjeta bancaria en <strong>.</strong>",
|
|
1953
1823
|
"eligibility-modal.p1x-bullet-3": "<strong>¡La validación </strong> de tu pago es instantánea!",
|
|
1954
1824
|
"eligibility-modal.title-deferred-plan": "Paga a plazos o posteriormente con tarjeta bancaria con Alma.",
|
|
1955
1825
|
"eligibility-modal.title-normal": "Pagar a plazos con tarjeta bancaria con Alma.",
|
|
@@ -2010,7 +1880,7 @@ var messagesIT = {
|
|
|
2010
1880
|
"eligibility-modal.no-eligibility": "Ops, sembra che qualcosa non abbia funzionato.",
|
|
2011
1881
|
"eligibility-modal.p1x-bullet-1": "Scegli <strong>Alma - Paga ora</strong> alla cassa.",
|
|
2012
1882
|
"eligibility-modal.p1x-bullet-2": "Inserisci i dati della tua <strong>carta bancaria.</strong>",
|
|
2013
|
-
"eligibility-modal.p1x-bullet-3": "Ricevi la conferma di pagamento
|
|
1883
|
+
"eligibility-modal.p1x-bullet-3": "Ricevi la <strong>conferma di pagamento</strong> istantaneamente!",
|
|
2014
1884
|
"eligibility-modal.title-deferred-plan": "Paga a rate con Alma, senza registrazione.",
|
|
2015
1885
|
"eligibility-modal.title-normal": "Paga a rate con Alma, senza registrazione.",
|
|
2016
1886
|
"eligibility-modal.title-pay-now": "Paga ora con carta tramite Alma.",
|
|
@@ -2036,11 +1906,11 @@ var messagesNL = {
|
|
|
2036
1906
|
"credit-features.total-credit-cost": "Waarvan kredietkosten",
|
|
2037
1907
|
"eligibility-modal.bullet-1": "Kies <strong>Alma</strong> bij het afrekenen om de eerste termijnbetaling te voldoen. Dit kan gemakkelijk via jouw favoriete betaalmethode.",
|
|
2038
1908
|
"eligibility-modal.bullet-2": "Betaal gemakkelijk <strong>binnen 1 minuut </strong>. Je hebt hier geen account voor nodig.",
|
|
2039
|
-
"eligibility-modal.bullet-3": "<strong>
|
|
1909
|
+
"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.",
|
|
2040
1910
|
"eligibility-modal.no-eligibility": "Oeps, het lijkt erop dat de simulatie niet werkte.",
|
|
2041
1911
|
"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.",
|
|
2042
|
-
"eligibility-modal.p1x-bullet-2": "Vul
|
|
2043
|
-
"eligibility-modal.p1x-bullet-3": "<strong>De bevestiging </strong> van jouw betaling is
|
|
1912
|
+
"eligibility-modal.p1x-bullet-2": "Vul je <strong>gegevens </strong> in",
|
|
1913
|
+
"eligibility-modal.p1x-bullet-3": "<strong>De bevestiging </strong> van jouw betaling is direct!",
|
|
2044
1914
|
"eligibility-modal.title-deferred-plan": "Betaal in termijnen bij Alma - helemaal rentevrij.",
|
|
2045
1915
|
"eligibility-modal.title-normal": "Betaal in termijnen bij Alma - helemaal rentevrij.",
|
|
2046
1916
|
"eligibility-modal.title-pay-now": "Betaal met iDEAL of per creditcard bij Alma.",
|
|
@@ -2094,26 +1964,19 @@ var getTranslationsByLocale = function getTranslationsByLocale(locale) {
|
|
|
2094
1964
|
// A CMS plugin can add LCID format like : 'fr-FR' instead of 'fr'.
|
|
2095
1965
|
// Instead of specifying all possibilities we just remove the last part of the string.
|
|
2096
1966
|
var merchantLocale = locale.slice(0, 2);
|
|
2097
|
-
|
|
2098
1967
|
switch (merchantLocale) {
|
|
2099
1968
|
case Locale.fr:
|
|
2100
1969
|
return messagesFR;
|
|
2101
|
-
|
|
2102
1970
|
case Locale.es:
|
|
2103
1971
|
return messagesES;
|
|
2104
|
-
|
|
2105
1972
|
case Locale.it:
|
|
2106
1973
|
return messagesIT;
|
|
2107
|
-
|
|
2108
1974
|
case Locale.de:
|
|
2109
1975
|
return messagesDE;
|
|
2110
|
-
|
|
2111
1976
|
case Locale.pt:
|
|
2112
1977
|
return messagesPT;
|
|
2113
|
-
|
|
2114
1978
|
case Locale.nl:
|
|
2115
1979
|
return messagesNL;
|
|
2116
|
-
|
|
2117
1980
|
case Locale.en:
|
|
2118
1981
|
default:
|
|
2119
1982
|
return messagesEN;
|
|
@@ -2122,7 +1985,7 @@ var getTranslationsByLocale = function getTranslationsByLocale(locale) {
|
|
|
2122
1985
|
|
|
2123
1986
|
var Provider = function Provider(_ref) {
|
|
2124
1987
|
var children = _ref.children,
|
|
2125
|
-
|
|
1988
|
+
locale = _ref.locale;
|
|
2126
1989
|
return /*#__PURE__*/React.createElement(IntlProvider, {
|
|
2127
1990
|
messages: getTranslationsByLocale(locale),
|
|
2128
1991
|
locale: locale,
|
|
@@ -2131,48 +1994,35 @@ var Provider = function Provider(_ref) {
|
|
|
2131
1994
|
};
|
|
2132
1995
|
|
|
2133
1996
|
function _extends() {
|
|
2134
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
2135
|
-
for (var
|
|
2136
|
-
var
|
|
2137
|
-
|
|
2138
|
-
for (var key in source) {
|
|
2139
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
2140
|
-
target[key] = source[key];
|
|
2141
|
-
}
|
|
2142
|
-
}
|
|
1997
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
1998
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
1999
|
+
var t = arguments[e];
|
|
2000
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
2143
2001
|
}
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
};
|
|
2147
|
-
return _extends.apply(this, arguments);
|
|
2002
|
+
return n;
|
|
2003
|
+
}, _extends.apply(null, arguments);
|
|
2148
2004
|
}
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
var
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
2157
|
-
key = sourceKeys[i];
|
|
2158
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
2159
|
-
target[key] = source[key];
|
|
2005
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
2006
|
+
if (null == r) return {};
|
|
2007
|
+
var t = {};
|
|
2008
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
2009
|
+
if (e.includes(n)) continue;
|
|
2010
|
+
t[n] = r[n];
|
|
2160
2011
|
}
|
|
2161
|
-
|
|
2162
|
-
return target;
|
|
2012
|
+
return t;
|
|
2163
2013
|
}
|
|
2164
2014
|
|
|
2165
2015
|
var fetchFromApi = function fetchFromApi(url, data, headers) {
|
|
2166
2016
|
if (url === void 0) {
|
|
2167
2017
|
url = '';
|
|
2168
2018
|
}
|
|
2169
|
-
|
|
2170
2019
|
try {
|
|
2171
2020
|
return Promise.resolve(fetch(url, {
|
|
2172
2021
|
method: 'POST',
|
|
2173
2022
|
headers: _extends({
|
|
2174
2023
|
'Content-Type': 'application/json'
|
|
2175
2024
|
}, headers),
|
|
2025
|
+
cache: 'force-cache',
|
|
2176
2026
|
body: JSON.stringify(data)
|
|
2177
2027
|
})).then(function (response) {
|
|
2178
2028
|
return response.json();
|
|
@@ -2186,38 +2036,31 @@ var isPlanEligible = function isPlanEligible(plan, configPlan) {
|
|
|
2186
2036
|
if (!plan.eligible) {
|
|
2187
2037
|
return false;
|
|
2188
2038
|
}
|
|
2189
|
-
|
|
2190
2039
|
return configPlan ? plan.purchase_amount >= (configPlan == null ? void 0 : configPlan.minAmount) && plan.purchase_amount <= (configPlan == null ? void 0 : configPlan.maxAmount) : false;
|
|
2191
2040
|
};
|
|
2192
|
-
|
|
2193
2041
|
var getPaymentPlanBoundaries = function getPaymentPlanBoundaries(plan, configPlan) {
|
|
2194
2042
|
var _plan$constraints;
|
|
2195
|
-
|
|
2196
2043
|
// When the plan is not eligible, the purchase amount constraints is given from the merchant config
|
|
2197
2044
|
var purchaseAmountConstraints = (_plan$constraints = plan.constraints) == null ? void 0 : _plan$constraints.purchase_amount;
|
|
2198
|
-
|
|
2199
2045
|
if (purchaseAmountConstraints && configPlan) {
|
|
2200
2046
|
return {
|
|
2201
2047
|
minAmount: Math.max(configPlan.minAmount, purchaseAmountConstraints == null ? void 0 : purchaseAmountConstraints.minimum),
|
|
2202
2048
|
maxAmount: Math.min(configPlan.maxAmount, purchaseAmountConstraints == null ? void 0 : purchaseAmountConstraints.maximum)
|
|
2203
2049
|
};
|
|
2204
2050
|
}
|
|
2205
|
-
|
|
2206
2051
|
return configPlan != null ? configPlan : {};
|
|
2207
2052
|
};
|
|
2208
|
-
|
|
2209
2053
|
var filterEligibility = function filterEligibility(eligibilities, configPlans) {
|
|
2210
2054
|
// Remove P1X if no configuration is provided
|
|
2211
2055
|
if (!configPlans) {
|
|
2212
2056
|
return eligibilities.filter(function (plan) {
|
|
2213
2057
|
return !(plan.installments_count === 1 && plan.deferred_days === 0 && plan.deferred_months === 0);
|
|
2214
2058
|
});
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
|
-
|
|
2059
|
+
}
|
|
2060
|
+
// Else check if the plan is eligible regarding the related configPlan
|
|
2218
2061
|
return eligibilities.map(function (plan) {
|
|
2219
|
-
var eligibilityDeferredDays = (plan.deferred_months ? plan.deferred_months : 0) * 30 + (plan.deferred_days ? plan.deferred_days : 0);
|
|
2220
|
-
|
|
2062
|
+
var eligibilityDeferredDays = (plan.deferred_months ? plan.deferred_months : 0) * 30 + (plan.deferred_days ? plan.deferred_days : 0);
|
|
2063
|
+
// find the related configPlan
|
|
2221
2064
|
var relatedConfigPlan = configPlans.find(function (configPlan) {
|
|
2222
2065
|
var configPlanDeferredDays = (configPlan.deferredMonths ? configPlan.deferredMonths : 0) * 30 + (configPlan.deferredDays ? configPlan.deferredDays : 0);
|
|
2223
2066
|
return plan.installments_count === configPlan.installmentsCount && eligibilityDeferredDays === configPlanDeferredDays;
|
|
@@ -2228,18 +2071,94 @@ var filterEligibility = function filterEligibility(eligibilities, configPlans) {
|
|
|
2228
2071
|
});
|
|
2229
2072
|
};
|
|
2230
2073
|
|
|
2074
|
+
// Function to hash a string
|
|
2075
|
+
// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
|
|
2076
|
+
var hashStringForStorage = function hashStringForStorage(str) {
|
|
2077
|
+
return str
|
|
2078
|
+
// The input string is split into an array of characters.
|
|
2079
|
+
.split('')
|
|
2080
|
+
// 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.
|
|
2081
|
+
.reduce(function (a, b) {
|
|
2082
|
+
// 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).
|
|
2083
|
+
// The bitwise OR operation with 0 is used to ensure the result is a 32-bit integer.
|
|
2084
|
+
return (a << 5) - a + b.charCodeAt(0) | 0;
|
|
2085
|
+
}, 0) // The initial value of the accumulator is 0.
|
|
2086
|
+
.toString() // The result is then converted to a string.
|
|
2087
|
+
.replace('-', 'A'); // If the hash is negative (which is represented by a leading '-'), it's replaced with 'A' to ensure the hash is alphanumeric.
|
|
2088
|
+
};
|
|
2089
|
+
var isMoreThanOneHourAgo = function isMoreThanOneHourAgo(date) {
|
|
2090
|
+
var ONE_HOUR_IN_MILLISECONDS = 1000 * 60 * 60;
|
|
2091
|
+
var currentTime = Date.now();
|
|
2092
|
+
var difference = currentTime - date;
|
|
2093
|
+
return difference >= ONE_HOUR_IN_MILLISECONDS;
|
|
2094
|
+
};
|
|
2095
|
+
|
|
2096
|
+
var useSessionStorage = function useSessionStorage() {
|
|
2097
|
+
var setCache = function setCache(key, value) {
|
|
2098
|
+
// Save data to sessionStorage and create timestamp
|
|
2099
|
+
var timestamp = Date.now();
|
|
2100
|
+
sessionStorage.setItem(key, JSON.stringify({
|
|
2101
|
+
value: value,
|
|
2102
|
+
timestamp: timestamp
|
|
2103
|
+
}));
|
|
2104
|
+
};
|
|
2105
|
+
var getCache = function getCache(key) {
|
|
2106
|
+
// Get saved data from sessionStorage
|
|
2107
|
+
var stringData = sessionStorage.getItem(key) || '';
|
|
2108
|
+
// Parse cached data to use it directly as an array of EligibilityPlan
|
|
2109
|
+
return stringData ? JSON.parse(stringData) : null;
|
|
2110
|
+
};
|
|
2111
|
+
var deleteCache = function deleteCache(key) {
|
|
2112
|
+
// Remove saved data from sessionStorage
|
|
2113
|
+
sessionStorage.removeItem(key);
|
|
2114
|
+
};
|
|
2115
|
+
var clearCache = function clearCache() {
|
|
2116
|
+
// Remove all saved data from sessionStorage
|
|
2117
|
+
sessionStorage.clear();
|
|
2118
|
+
};
|
|
2119
|
+
var createKey = function createKey(params) {
|
|
2120
|
+
var purchaseAmount = params.purchaseAmount,
|
|
2121
|
+
plans = params.plans,
|
|
2122
|
+
customerBillingCountry = params.customerBillingCountry,
|
|
2123
|
+
customerShippingCountry = params.customerShippingCountry;
|
|
2124
|
+
var stringAmount = purchaseAmount.toString();
|
|
2125
|
+
var stringPlans = JSON.stringify(plans);
|
|
2126
|
+
return hashStringForStorage("" + stringAmount + stringPlans + customerBillingCountry + customerShippingCountry);
|
|
2127
|
+
};
|
|
2128
|
+
return {
|
|
2129
|
+
setCache: setCache,
|
|
2130
|
+
getCache: getCache,
|
|
2131
|
+
clearCache: clearCache,
|
|
2132
|
+
deleteCache: deleteCache,
|
|
2133
|
+
createKey: createKey
|
|
2134
|
+
};
|
|
2135
|
+
};
|
|
2136
|
+
|
|
2231
2137
|
var useFetchEligibility = function useFetchEligibility(purchaseAmount, _ref, plans, customerBillingCountry, customerShippingCountry) {
|
|
2138
|
+
var _getCache, _getCache2;
|
|
2232
2139
|
var domain = _ref.domain,
|
|
2233
|
-
|
|
2234
|
-
|
|
2140
|
+
merchantId = _ref.merchantId;
|
|
2235
2141
|
var _useState = useState([]),
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2142
|
+
eligibility = _useState[0],
|
|
2143
|
+
setEligibility = _useState[1];
|
|
2144
|
+
var _useState2 = useState(statusResponse.PENDING),
|
|
2145
|
+
status = _useState2[0],
|
|
2146
|
+
setStatus = _useState2[1];
|
|
2147
|
+
// caching
|
|
2148
|
+
var _useSessionStorage = useSessionStorage(),
|
|
2149
|
+
getCache = _useSessionStorage.getCache,
|
|
2150
|
+
setCache = _useSessionStorage.setCache,
|
|
2151
|
+
createKey = _useSessionStorage.createKey;
|
|
2152
|
+
var key = createKey({
|
|
2153
|
+
purchaseAmount: purchaseAmount,
|
|
2154
|
+
plans: plans,
|
|
2155
|
+
customerBillingCountry: customerBillingCountry,
|
|
2156
|
+
customerShippingCountry: customerShippingCountry
|
|
2157
|
+
});
|
|
2158
|
+
var currentCache = (_getCache = getCache(key)) == null ? void 0 : _getCache.value;
|
|
2159
|
+
var lastCacheTimestamp = (_getCache2 = getCache(key)) == null ? void 0 : _getCache2.timestamp;
|
|
2160
|
+
// If the stored date is more than an hour ago, we should invalidate the cache
|
|
2161
|
+
var shouldInvalidate = lastCacheTimestamp && isMoreThanOneHourAgo(lastCacheTimestamp);
|
|
2243
2162
|
var configInstallments = plans == null ? void 0 : plans.map(function (plan) {
|
|
2244
2163
|
return {
|
|
2245
2164
|
installments_count: plan.installmentsCount,
|
|
@@ -2248,39 +2167,42 @@ var useFetchEligibility = function useFetchEligibility(purchaseAmount, _ref, pla
|
|
|
2248
2167
|
};
|
|
2249
2168
|
});
|
|
2250
2169
|
useEffect(function () {
|
|
2251
|
-
if (status ===
|
|
2170
|
+
if (status === statusResponse.PENDING) {
|
|
2252
2171
|
var billing_address = null;
|
|
2253
|
-
|
|
2254
2172
|
if (customerBillingCountry) {
|
|
2255
2173
|
billing_address = {
|
|
2256
2174
|
country: customerBillingCountry
|
|
2257
2175
|
};
|
|
2258
2176
|
}
|
|
2259
|
-
|
|
2260
2177
|
var shipping_address = null;
|
|
2261
|
-
|
|
2262
2178
|
if (customerShippingCountry) {
|
|
2263
2179
|
shipping_address = {
|
|
2264
2180
|
country: customerShippingCountry
|
|
2265
2181
|
};
|
|
2266
2182
|
}
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2183
|
+
if (currentCache && !shouldInvalidate) {
|
|
2184
|
+
setEligibility(currentCache);
|
|
2185
|
+
setStatus(statusResponse.SUCCESS);
|
|
2186
|
+
}
|
|
2187
|
+
if (!currentCache || shouldInvalidate) {
|
|
2188
|
+
fetchFromApi(domain + '/v2/payments/eligibility', {
|
|
2189
|
+
purchase_amount: purchaseAmount,
|
|
2190
|
+
queries: configInstallments,
|
|
2191
|
+
billing_address: billing_address,
|
|
2192
|
+
shipping_address: shipping_address
|
|
2193
|
+
}, {
|
|
2194
|
+
Authorization: "Alma-Merchant-Auth " + merchantId,
|
|
2195
|
+
'X-Alma-Agent': "Alma Widget/" + "v3.3.12"
|
|
2196
|
+
}).then(function (res) {
|
|
2197
|
+
setCache(key, res);
|
|
2198
|
+
setEligibility(res);
|
|
2199
|
+
setStatus(statusResponse.SUCCESS);
|
|
2200
|
+
})["catch"](function () {
|
|
2201
|
+
setStatus(statusResponse.FAILED);
|
|
2202
|
+
});
|
|
2203
|
+
}
|
|
2282
2204
|
}
|
|
2283
|
-
}, [status]);
|
|
2205
|
+
}, [status, purchaseAmount, key]);
|
|
2284
2206
|
return [filterEligibility(eligibility, plans), status];
|
|
2285
2207
|
};
|
|
2286
2208
|
|
|
@@ -2294,7 +2216,6 @@ var prefix = 'alma-eligibility-modal';
|
|
|
2294
2216
|
* Class names for the **eligibility modale** widget.
|
|
2295
2217
|
* Those classes are intended to be used by the **merchant developer**.
|
|
2296
2218
|
*/
|
|
2297
|
-
|
|
2298
2219
|
var STATIC_CUSTOMISATION_CLASSES = {
|
|
2299
2220
|
desktopModal: prefix + '-desktop-modal',
|
|
2300
2221
|
mobileModal: prefix + '-mobile-modal',
|
|
@@ -2337,7 +2258,7 @@ var TotalBlock = function TotalBlock(_ref) {
|
|
|
2337
2258
|
currency: "EUR"
|
|
2338
2259
|
})), /*#__PURE__*/React.createElement("div", {
|
|
2339
2260
|
className: cx(s.fees, STATIC_CUSTOMISATION_CLASSES.scheduleCredit)
|
|
2340
|
-
}, isCredit ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2261
|
+
}, isCredit ? ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2341
2262
|
id: "credit-features.total-credit-cost",
|
|
2342
2263
|
defaultMessage: "Dont co\xFBt du cr\xE9dit"
|
|
2343
2264
|
}), /*#__PURE__*/React.createElement("span", {
|
|
@@ -2355,7 +2276,7 @@ var TotalBlock = function TotalBlock(_ref) {
|
|
|
2355
2276
|
maximumFractionDigits: 2
|
|
2356
2277
|
})
|
|
2357
2278
|
}
|
|
2358
|
-
}))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2279
|
+
})))) : ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2359
2280
|
id: "installments.total-fees",
|
|
2360
2281
|
defaultMessage: "Dont frais (TTC)",
|
|
2361
2282
|
tagName: "div"
|
|
@@ -2363,7 +2284,7 @@ var TotalBlock = function TotalBlock(_ref) {
|
|
|
2363
2284
|
value: customerFees,
|
|
2364
2285
|
style: "currency",
|
|
2365
2286
|
currency: "EUR"
|
|
2366
|
-
})))));
|
|
2287
|
+
}))))));
|
|
2367
2288
|
};
|
|
2368
2289
|
|
|
2369
2290
|
var s$1 = {"loadingIndicator":"_31lrj","bounce":"_3NtDa"};
|
|
@@ -2389,8 +2310,8 @@ var s$2 = {"modal":"_D8SjB","content":"_ocM9x","contentScrollable":"_1GP2F","ove
|
|
|
2389
2310
|
|
|
2390
2311
|
function CrossIcon(_ref) {
|
|
2391
2312
|
var _ref$color = _ref.color,
|
|
2392
|
-
|
|
2393
|
-
|
|
2313
|
+
color = _ref$color === void 0 ? '#fff' : _ref$color,
|
|
2314
|
+
className = _ref.className;
|
|
2394
2315
|
return /*#__PURE__*/React.createElement("svg", {
|
|
2395
2316
|
className: className,
|
|
2396
2317
|
width: "16",
|
|
@@ -2405,19 +2326,16 @@ function CrossIcon(_ref) {
|
|
|
2405
2326
|
}
|
|
2406
2327
|
|
|
2407
2328
|
var _excluded = ["children", "isOpen", "onClose", "className", "contentClassName", "scrollable"];
|
|
2408
|
-
|
|
2409
2329
|
var ControlledModal = function ControlledModal(_ref) {
|
|
2410
2330
|
var _cx;
|
|
2411
|
-
|
|
2412
2331
|
var children = _ref.children,
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2332
|
+
isOpen = _ref.isOpen,
|
|
2333
|
+
onClose = _ref.onClose,
|
|
2334
|
+
className = _ref.className,
|
|
2335
|
+
contentClassName = _ref.contentClassName,
|
|
2336
|
+
_ref$scrollable = _ref.scrollable,
|
|
2337
|
+
scrollable = _ref$scrollable === void 0 ? false : _ref$scrollable,
|
|
2338
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
2421
2339
|
/* istanbul ignore next */
|
|
2422
2340
|
Modal.setAppElement('body');
|
|
2423
2341
|
return /*#__PURE__*/React.createElement(Modal, Object.assign({
|
|
@@ -2446,16 +2364,14 @@ var ControlledModal = function ControlledModal(_ref) {
|
|
|
2446
2364
|
|
|
2447
2365
|
var paymentPlanShorthandName = function paymentPlanShorthandName(payment) {
|
|
2448
2366
|
var deferred_days = payment.deferred_days,
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2367
|
+
deferred_months = payment.deferred_months,
|
|
2368
|
+
installmentsCount = payment.installments_count;
|
|
2452
2369
|
if (installmentsCount === 1 && !deferred_days && !deferred_months) {
|
|
2453
2370
|
return /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2454
2371
|
id: "payment-plan-strings.pay.now.button",
|
|
2455
2372
|
defaultMessage: "Payer maintenant"
|
|
2456
2373
|
});
|
|
2457
2374
|
}
|
|
2458
|
-
|
|
2459
2375
|
if (installmentsCount === 1 && deferred_days) {
|
|
2460
2376
|
return /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2461
2377
|
id: "payment-plan-strings.day-abbreviation",
|
|
@@ -2465,7 +2381,6 @@ var paymentPlanShorthandName = function paymentPlanShorthandName(payment) {
|
|
|
2465
2381
|
}
|
|
2466
2382
|
});
|
|
2467
2383
|
}
|
|
2468
|
-
|
|
2469
2384
|
if (installmentsCount === 1 && deferred_months) {
|
|
2470
2385
|
return /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2471
2386
|
id: "payment-plan-strings.month-abbreviation",
|
|
@@ -2478,10 +2393,8 @@ var paymentPlanShorthandName = function paymentPlanShorthandName(payment) {
|
|
|
2478
2393
|
return installmentsCount + "x";
|
|
2479
2394
|
}
|
|
2480
2395
|
};
|
|
2481
|
-
|
|
2482
2396
|
var withNoFee = function withNoFee(payment) {
|
|
2483
2397
|
var _payment$payment_plan;
|
|
2484
|
-
|
|
2485
2398
|
if ((_payment$payment_plan = payment.payment_plan) != null && _payment$payment_plan.every(function (plan) {
|
|
2486
2399
|
return plan.customer_fee === 0 && plan.customer_interest === 0;
|
|
2487
2400
|
})) {
|
|
@@ -2491,42 +2404,40 @@ var withNoFee = function withNoFee(payment) {
|
|
|
2491
2404
|
}));
|
|
2492
2405
|
}
|
|
2493
2406
|
};
|
|
2494
|
-
|
|
2495
2407
|
var paymentPlanInfoText = function paymentPlanInfoText(payment) {
|
|
2496
2408
|
var deferred_days = payment.deferred_days,
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2409
|
+
deferred_months = payment.deferred_months,
|
|
2410
|
+
installmentsCount = payment.installments_count,
|
|
2411
|
+
eligible = payment.eligible,
|
|
2412
|
+
purchaseAmount = payment.purchase_amount,
|
|
2413
|
+
_payment$minAmount = payment.minAmount,
|
|
2414
|
+
minAmount = _payment$minAmount === void 0 ? 0 : _payment$minAmount,
|
|
2415
|
+
_payment$maxAmount = payment.maxAmount,
|
|
2416
|
+
maxAmount = _payment$maxAmount === void 0 ? 0 : _payment$maxAmount,
|
|
2417
|
+
payment_plan = payment.payment_plan;
|
|
2506
2418
|
var deferredDaysCount = deferred_days + deferred_months * 30;
|
|
2507
|
-
|
|
2508
2419
|
if (!eligible) {
|
|
2509
|
-
return purchaseAmount > maxAmount ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2420
|
+
return purchaseAmount > maxAmount ? ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2510
2421
|
id: "payment-plan-strings.ineligible-greater-than-max",
|
|
2511
2422
|
defaultMessage: "Jusqu'\xE0 {maxAmount}",
|
|
2512
2423
|
values: {
|
|
2513
|
-
maxAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2424
|
+
maxAmount: ( /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2514
2425
|
value: priceFromCents(maxAmount),
|
|
2515
2426
|
style: "currency",
|
|
2516
2427
|
currency: "EUR"
|
|
2517
|
-
})
|
|
2428
|
+
}))
|
|
2518
2429
|
}
|
|
2519
|
-
}) : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2430
|
+
})) : ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2520
2431
|
id: "payment-plan-strings.ineligible-lower-than-min",
|
|
2521
2432
|
defaultMessage: "\xC0 partir de {minAmount}",
|
|
2522
2433
|
values: {
|
|
2523
|
-
minAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2434
|
+
minAmount: ( /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2524
2435
|
value: priceFromCents(minAmount),
|
|
2525
2436
|
style: "currency",
|
|
2526
2437
|
currency: "EUR"
|
|
2527
|
-
})
|
|
2438
|
+
}))
|
|
2528
2439
|
}
|
|
2529
|
-
});
|
|
2440
|
+
}));
|
|
2530
2441
|
} else if (!payment_plan) {
|
|
2531
2442
|
/* This error should never happen. We added this condition to avoid a typescript warning on
|
|
2532
2443
|
payment_plan possibly undefined. As far as we know, it only happens when the plan is not
|
|
@@ -2537,73 +2448,69 @@ var paymentPlanInfoText = function paymentPlanInfoText(payment) {
|
|
|
2537
2448
|
id: "payment-plan-strings.deferred",
|
|
2538
2449
|
defaultMessage: "{totalAmount} \xE0 payer le {dueDate}",
|
|
2539
2450
|
values: {
|
|
2540
|
-
totalAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2451
|
+
totalAmount: ( /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2541
2452
|
value: priceFromCents(payment_plan[0].total_amount),
|
|
2542
2453
|
style: "currency",
|
|
2543
2454
|
currency: "EUR"
|
|
2544
|
-
}),
|
|
2545
|
-
dueDate: /*#__PURE__*/React.createElement(FormattedDate, {
|
|
2455
|
+
})),
|
|
2456
|
+
dueDate: ( /*#__PURE__*/React.createElement(FormattedDate, {
|
|
2546
2457
|
value: secondsToMilliseconds(payment_plan[0].due_date),
|
|
2547
2458
|
day: "numeric",
|
|
2548
2459
|
month: "long",
|
|
2549
2460
|
year: "numeric"
|
|
2550
|
-
})
|
|
2461
|
+
}))
|
|
2551
2462
|
}
|
|
2552
2463
|
}), withNoFee(payment));
|
|
2553
2464
|
} else if (installmentsCount > 0) {
|
|
2554
2465
|
var areInstallmentsOfSameAmount = payment_plan == null ? void 0 : payment_plan.every(function (installment, index) {
|
|
2555
2466
|
return index === 0 || installment.total_amount === payment_plan[0].total_amount;
|
|
2556
2467
|
});
|
|
2557
|
-
|
|
2558
2468
|
if (isP1X(payment)) {
|
|
2559
2469
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2560
2470
|
id: "payment-plan-strings.pay-now",
|
|
2561
2471
|
defaultMessage: "Payer maintenant {totalAmount}",
|
|
2562
2472
|
values: {
|
|
2563
|
-
totalAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2473
|
+
totalAmount: ( /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2564
2474
|
value: priceFromCents(payment_plan[0].total_amount),
|
|
2565
2475
|
style: "currency",
|
|
2566
2476
|
currency: "EUR"
|
|
2567
|
-
}),
|
|
2477
|
+
})),
|
|
2568
2478
|
installmentsCount: installmentsCount
|
|
2569
2479
|
}
|
|
2570
2480
|
}), withNoFee(payment));
|
|
2571
2481
|
}
|
|
2572
|
-
|
|
2573
2482
|
if (areInstallmentsOfSameAmount) {
|
|
2574
2483
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2575
2484
|
id: "payment-plan-strings.multiple-installments-same-amount",
|
|
2576
2485
|
defaultMessage: "{installmentsCount} x {totalAmount}",
|
|
2577
2486
|
values: {
|
|
2578
|
-
totalAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2487
|
+
totalAmount: ( /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2579
2488
|
value: priceFromCents(payment_plan[0].total_amount),
|
|
2580
2489
|
style: "currency",
|
|
2581
2490
|
currency: "EUR"
|
|
2582
|
-
}),
|
|
2491
|
+
})),
|
|
2583
2492
|
installmentsCount: installmentsCount
|
|
2584
2493
|
}
|
|
2585
2494
|
}), withNoFee(payment));
|
|
2586
2495
|
}
|
|
2587
|
-
|
|
2588
2496
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2589
2497
|
id: "payment-plan-strings.multiple-installments",
|
|
2590
2498
|
defaultMessage: "{numberOfRemainingInstallments, plural, one {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}} other {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}}}",
|
|
2591
2499
|
values: {
|
|
2592
|
-
firstInstallmentAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2500
|
+
firstInstallmentAmount: ( /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2593
2501
|
value: priceFromCents(payment_plan[0].total_amount),
|
|
2594
2502
|
style: "currency",
|
|
2595
2503
|
currency: "EUR"
|
|
2596
|
-
}),
|
|
2504
|
+
})),
|
|
2597
2505
|
numberOfRemainingInstallments: installmentsCount - 1,
|
|
2598
|
-
othersInstallmentAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2506
|
+
othersInstallmentAmount: ( /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2599
2507
|
value: priceFromCents(payment_plan[1].total_amount),
|
|
2600
2508
|
style: "currency",
|
|
2601
2509
|
currency: "EUR"
|
|
2602
|
-
})
|
|
2510
|
+
}))
|
|
2603
2511
|
}
|
|
2604
2512
|
}), withNoFee(payment));
|
|
2605
2513
|
}
|
|
2606
|
-
|
|
2607
2514
|
return /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2608
2515
|
id: "payment-plan-strings.default-message",
|
|
2609
2516
|
defaultMessage: "Payez en plusieurs fois avec Alma"
|
|
@@ -2614,13 +2521,12 @@ var s$3 = {"buttons":"_1l2Oa","active":"_3rue7","textButton":"_2T78a"};
|
|
|
2614
2521
|
|
|
2615
2522
|
var EligibilityPlansButtons = function EligibilityPlansButtons(_ref) {
|
|
2616
2523
|
var eligibilityPlans = _ref.eligibilityPlans,
|
|
2617
|
-
|
|
2618
|
-
|
|
2524
|
+
currentPlanIndex = _ref.currentPlanIndex,
|
|
2525
|
+
setCurrentPlanIndex = _ref.setCurrentPlanIndex;
|
|
2619
2526
|
return /*#__PURE__*/React.createElement("div", {
|
|
2620
2527
|
className: cx(s$3.buttons, STATIC_CUSTOMISATION_CLASSES.eligibilityOptions)
|
|
2621
2528
|
}, eligibilityPlans.map(function (eligibilityPlan, index) {
|
|
2622
2529
|
var _cx;
|
|
2623
|
-
|
|
2624
2530
|
return /*#__PURE__*/React.createElement("button", {
|
|
2625
2531
|
key: index,
|
|
2626
2532
|
className: cx((_cx = {}, _cx[cx(s$3.active, STATIC_CUSTOMISATION_CLASSES.activeOption)] = index === currentPlanIndex, _cx)),
|
|
@@ -2637,9 +2543,8 @@ var s$4 = {"installment":"_z2Uiv","date":"_2lJQy","dot":"_1Z9wr","isCurrent":"_2
|
|
|
2637
2543
|
|
|
2638
2544
|
var Installment = function Installment(_ref) {
|
|
2639
2545
|
var _cx, _cx2;
|
|
2640
|
-
|
|
2641
2546
|
var installment = _ref.installment,
|
|
2642
|
-
|
|
2547
|
+
index = _ref.index;
|
|
2643
2548
|
return /*#__PURE__*/React.createElement("div", {
|
|
2644
2549
|
className: s$4.installment,
|
|
2645
2550
|
"data-testid": "installment-" + index
|
|
@@ -2647,16 +2552,16 @@ var Installment = function Installment(_ref) {
|
|
|
2647
2552
|
className: s$4.date
|
|
2648
2553
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2649
2554
|
className: cx(s$4.dot, (_cx = {}, _cx[s$4.isCurrent] = index === 0, _cx))
|
|
2650
|
-
}), isToday(installment.due_date * 1000) ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2555
|
+
}), isToday(installment.due_date * 1000) ? ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2651
2556
|
id: "installments.today",
|
|
2652
2557
|
defaultMessage: "Aujourd'hui",
|
|
2653
2558
|
tagName: "strong"
|
|
2654
|
-
}) : /*#__PURE__*/React.createElement(FormattedDate, {
|
|
2559
|
+
})) : ( /*#__PURE__*/React.createElement(FormattedDate, {
|
|
2655
2560
|
value: installment.due_date * 1000,
|
|
2656
2561
|
day: "numeric",
|
|
2657
2562
|
month: "long",
|
|
2658
2563
|
year: "numeric"
|
|
2659
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
2564
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
2660
2565
|
className: cx((_cx2 = {}, _cx2[s$4.bold] = index === 0, _cx2))
|
|
2661
2566
|
}, /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2662
2567
|
value: installment.total_amount / 100,
|
|
@@ -2679,20 +2584,19 @@ var Schedule = function Schedule(_ref) {
|
|
|
2679
2584
|
installment: installment,
|
|
2680
2585
|
index: index
|
|
2681
2586
|
});
|
|
2682
|
-
}), isCredit && /*#__PURE__*/React.createElement("div", {
|
|
2587
|
+
}), isCredit && ( /*#__PURE__*/React.createElement("div", {
|
|
2683
2588
|
className: s$5.creditInfo
|
|
2684
2589
|
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2685
2590
|
id: "credit-features.information",
|
|
2686
2591
|
defaultMessage: "Un cr\xE9dit vous engage et doit \xEAtre rembours\xE9. V\xE9rifiez vos capacit\xE9s de remboursement avant de vous engager."
|
|
2687
|
-
}))));
|
|
2592
|
+
})))));
|
|
2688
2593
|
};
|
|
2689
2594
|
|
|
2690
2595
|
var _excluded$1 = ["color"];
|
|
2691
2596
|
var AlmaLogo = function AlmaLogo(_ref) {
|
|
2692
2597
|
var _ref$color = _ref.color,
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2598
|
+
color = _ref$color === void 0 ? '#FA5022' : _ref$color,
|
|
2599
|
+
svgProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
2696
2600
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
|
2697
2601
|
width: "50",
|
|
2698
2602
|
height: "25",
|
|
@@ -2892,7 +2796,7 @@ var Info = function Info(_ref) {
|
|
|
2892
2796
|
className: cx(s$7.bullet, STATIC_CUSTOMISATION_CLASSES.bullet)
|
|
2893
2797
|
}, "1"), /*#__PURE__*/React.createElement("div", {
|
|
2894
2798
|
className: STATIC_CUSTOMISATION_CLASSES.infoMessage
|
|
2895
|
-
}, isCurrentPlanP1X ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2799
|
+
}, isCurrentPlanP1X ? ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2896
2800
|
id: "eligibility-modal.p1x-bullet-1",
|
|
2897
2801
|
defaultMessage: "Choisissez <strong>Alma - Payer maintenant</strong> au moment du paiement.",
|
|
2898
2802
|
values: {
|
|
@@ -2900,7 +2804,7 @@ var Info = function Info(_ref) {
|
|
|
2900
2804
|
return /*#__PURE__*/React.createElement("strong", null, [].slice.call(arguments));
|
|
2901
2805
|
}
|
|
2902
2806
|
}
|
|
2903
|
-
}) : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2807
|
+
})) : ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2904
2808
|
id: "eligibility-modal.bullet-1",
|
|
2905
2809
|
defaultMessage: "Choisissez <strong>Alma</strong> au moment du paiement.",
|
|
2906
2810
|
values: {
|
|
@@ -2908,13 +2812,13 @@ var Info = function Info(_ref) {
|
|
|
2908
2812
|
return /*#__PURE__*/React.createElement("strong", null, [].slice.call(arguments));
|
|
2909
2813
|
}
|
|
2910
2814
|
}
|
|
2911
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
2815
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
2912
2816
|
className: s$7.listItem
|
|
2913
2817
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2914
2818
|
className: cx(s$7.bullet, STATIC_CUSTOMISATION_CLASSES.bullet)
|
|
2915
2819
|
}, "2"), /*#__PURE__*/React.createElement("div", {
|
|
2916
2820
|
className: STATIC_CUSTOMISATION_CLASSES.infoMessage
|
|
2917
|
-
}, isCurrentPlanP1X ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2821
|
+
}, isCurrentPlanP1X ? ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2918
2822
|
id: "eligibility-modal.p1x-bullet-2",
|
|
2919
2823
|
defaultMessage: "Renseignez les informations de votre <strong>carte bancaire.</strong>",
|
|
2920
2824
|
values: {
|
|
@@ -2922,7 +2826,7 @@ var Info = function Info(_ref) {
|
|
|
2922
2826
|
return /*#__PURE__*/React.createElement("strong", null, [].slice.call(arguments));
|
|
2923
2827
|
}
|
|
2924
2828
|
}
|
|
2925
|
-
}) : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2829
|
+
})) : ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2926
2830
|
id: "eligibility-modal.bullet-2",
|
|
2927
2831
|
defaultMessage: "Laissez-vous guider et validez votre paiement en <strong>2 minutes.</strong>",
|
|
2928
2832
|
values: {
|
|
@@ -2930,13 +2834,13 @@ var Info = function Info(_ref) {
|
|
|
2930
2834
|
return /*#__PURE__*/React.createElement("strong", null, [].slice.call(arguments));
|
|
2931
2835
|
}
|
|
2932
2836
|
}
|
|
2933
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
2837
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
2934
2838
|
className: s$7.listItem
|
|
2935
2839
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2936
2840
|
className: cx(s$7.bullet, STATIC_CUSTOMISATION_CLASSES.bullet)
|
|
2937
2841
|
}, "3"), /*#__PURE__*/React.createElement("div", {
|
|
2938
2842
|
className: STATIC_CUSTOMISATION_CLASSES.infoMessage
|
|
2939
|
-
}, isCurrentPlanP1X ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2843
|
+
}, isCurrentPlanP1X ? ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2940
2844
|
id: "eligibility-modal.p1x-bullet-3",
|
|
2941
2845
|
defaultMessage: "<strong>La validation </strong> de votre paiement est instantan\xE9e !",
|
|
2942
2846
|
values: {
|
|
@@ -2944,7 +2848,7 @@ var Info = function Info(_ref) {
|
|
|
2944
2848
|
return /*#__PURE__*/React.createElement("strong", null, [].slice.call(arguments));
|
|
2945
2849
|
}
|
|
2946
2850
|
}
|
|
2947
|
-
}) : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2851
|
+
})) : ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2948
2852
|
id: "eligibility-modal.bullet-3",
|
|
2949
2853
|
defaultMessage: "<strong>Gardez le contr\xF4le</strong> en avan\xE7ant ou reculant vos \xE9ch\xE9ances \xE0 votre rythme.",
|
|
2950
2854
|
values: {
|
|
@@ -2952,7 +2856,7 @@ var Info = function Info(_ref) {
|
|
|
2952
2856
|
return /*#__PURE__*/React.createElement("strong", null, [].slice.call(arguments));
|
|
2953
2857
|
}
|
|
2954
2858
|
}
|
|
2955
|
-
}))))
|
|
2859
|
+
})))))
|
|
2956
2860
|
);
|
|
2957
2861
|
};
|
|
2958
2862
|
|
|
@@ -2960,29 +2864,29 @@ var s$8 = {"title":"_3ERx-"};
|
|
|
2960
2864
|
|
|
2961
2865
|
var Title = function Title(_ref) {
|
|
2962
2866
|
var isSomePlanDeferred = _ref.isSomePlanDeferred,
|
|
2963
|
-
|
|
2867
|
+
isCurrentPlanP1X = _ref.isCurrentPlanP1X;
|
|
2964
2868
|
return /*#__PURE__*/React.createElement("div", {
|
|
2965
2869
|
className: cx(s$8.title, STATIC_CUSTOMISATION_CLASSES.title),
|
|
2966
2870
|
"data-testid": "modal-title-element"
|
|
2967
|
-
}, isSomePlanDeferred ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2871
|
+
}, isSomePlanDeferred ? ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2968
2872
|
id: "eligibility-modal.title-deferred-plan",
|
|
2969
2873
|
defaultMessage: "Payez en plusieurs fois ou plus tard par carte bancaire avec Alma."
|
|
2970
|
-
}) : isCurrentPlanP1X ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2874
|
+
})) : isCurrentPlanP1X ? ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2971
2875
|
id: "eligibility-modal.title-pay-now",
|
|
2972
2876
|
defaultMessage: "Payez comptant par carte bancaire avec Alma."
|
|
2973
|
-
}) : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2877
|
+
})) : ( /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2974
2878
|
id: "eligibility-modal.title-normal",
|
|
2975
2879
|
defaultMessage: "Payez en plusieurs fois par carte bancaire avec Alma."
|
|
2976
|
-
}));
|
|
2880
|
+
})));
|
|
2977
2881
|
};
|
|
2978
2882
|
|
|
2979
2883
|
var s$9 = {"container":"_21g6u","block":"_3zaP5","left":"_2SBRC","logo":"_xW3wt"};
|
|
2980
2884
|
|
|
2981
2885
|
var DesktopModal = function DesktopModal(_ref) {
|
|
2982
2886
|
var children = _ref.children,
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2887
|
+
isSomePlanDeferred = _ref.isSomePlanDeferred,
|
|
2888
|
+
cards = _ref.cards,
|
|
2889
|
+
isCurrentPlanP1X = _ref.isCurrentPlanP1X;
|
|
2986
2890
|
return /*#__PURE__*/React.createElement("div", {
|
|
2987
2891
|
className: cx(s$9.container, STATIC_CUSTOMISATION_CLASSES.desktopModal),
|
|
2988
2892
|
"data-testid": "modal-container"
|
|
@@ -3009,9 +2913,9 @@ var s$b = {"container":"_2G7Ch","logo":"_2779r"};
|
|
|
3009
2913
|
|
|
3010
2914
|
var MobileModal = function MobileModal(_ref) {
|
|
3011
2915
|
var children = _ref.children,
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
2916
|
+
isSomePlanDeferred = _ref.isSomePlanDeferred,
|
|
2917
|
+
cards = _ref.cards,
|
|
2918
|
+
isCurrentPlanP1X = _ref.isCurrentPlanP1X;
|
|
3015
2919
|
return /*#__PURE__*/React.createElement("div", {
|
|
3016
2920
|
className: cx(s$b.container, STATIC_CUSTOMISATION_CLASSES.mobileModal),
|
|
3017
2921
|
"data-testid": "modal-container"
|
|
@@ -3030,15 +2934,13 @@ var MobileModal = function MobileModal(_ref) {
|
|
|
3030
2934
|
|
|
3031
2935
|
var EligibilityModal = function EligibilityModal(_ref) {
|
|
3032
2936
|
var initialPlanIndex = _ref.initialPlanIndex,
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
2937
|
+
onClose = _ref.onClose,
|
|
2938
|
+
eligibilityPlans = _ref.eligibilityPlans,
|
|
2939
|
+
status = _ref.status,
|
|
2940
|
+
cards = _ref.cards;
|
|
3038
2941
|
var _useState = useState(initialPlanIndex || 0),
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
2942
|
+
currentPlanIndex = _useState[0],
|
|
2943
|
+
setCurrentPlanIndex = _useState[1];
|
|
3042
2944
|
var isBigScreen = useMediaQuery({
|
|
3043
2945
|
minWidth: desktopWidth
|
|
3044
2946
|
});
|
|
@@ -3059,14 +2961,14 @@ var EligibilityModal = function EligibilityModal(_ref) {
|
|
|
3059
2961
|
isSomePlanDeferred: isSomePlanDeferred,
|
|
3060
2962
|
cards: cards,
|
|
3061
2963
|
isCurrentPlanP1X: isP1X(currentPlan)
|
|
3062
|
-
}, status ===
|
|
2964
|
+
}, status === statusResponse.PENDING && ( /*#__PURE__*/React.createElement("div", {
|
|
3063
2965
|
className: s$a.loader
|
|
3064
|
-
}, /*#__PURE__*/React.createElement(LoadingIndicator, null)), status ===
|
|
2966
|
+
}, /*#__PURE__*/React.createElement(LoadingIndicator, null))), status === statusResponse.SUCCESS && eligiblePlans.length === 0 && ( /*#__PURE__*/React.createElement("div", {
|
|
3065
2967
|
className: s$a.noEligibility
|
|
3066
2968
|
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
3067
2969
|
id: "eligibility-modal.no-eligibility",
|
|
3068
2970
|
defaultMessage: "Oups, il semblerait que la simulation n'ait pas fonctionn\xE9."
|
|
3069
|
-
})), status ===
|
|
2971
|
+
}))), status === statusResponse.SUCCESS && eligiblePlans.length >= 1 && ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EligibilityPlansButtons, {
|
|
3070
2972
|
eligibilityPlans: eligiblePlans,
|
|
3071
2973
|
currentPlanIndex: currentPlanIndex,
|
|
3072
2974
|
setCurrentPlanIndex: setCurrentPlanIndex
|
|
@@ -3078,26 +2980,23 @@ var EligibilityModal = function EligibilityModal(_ref) {
|
|
|
3078
2980
|
currentPlan: currentPlan
|
|
3079
2981
|
}), /*#__PURE__*/React.createElement(TotalBlock, {
|
|
3080
2982
|
currentPlan: currentPlan
|
|
3081
|
-
})))));
|
|
2983
|
+
}))))));
|
|
3082
2984
|
};
|
|
3083
2985
|
|
|
3084
2986
|
/**
|
|
3085
2987
|
* This component allows to display only the modal, without PaymentPlans.
|
|
3086
2988
|
*/
|
|
3087
|
-
|
|
3088
2989
|
var ModalContainer = function ModalContainer(_ref) {
|
|
3089
2990
|
var purchaseAmount = _ref.purchaseAmount,
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
2991
|
+
apiData = _ref.apiData,
|
|
2992
|
+
configPlans = _ref.configPlans,
|
|
2993
|
+
customerBillingCountry = _ref.customerBillingCountry,
|
|
2994
|
+
customerShippingCountry = _ref.customerShippingCountry,
|
|
2995
|
+
onClose = _ref.onClose,
|
|
2996
|
+
cards = _ref.cards;
|
|
3097
2997
|
var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans, customerBillingCountry, customerShippingCountry),
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
2998
|
+
eligibilityPlans = _useFetchEligibility[0],
|
|
2999
|
+
status = _useFetchEligibility[1];
|
|
3101
3000
|
return /*#__PURE__*/React.createElement(EligibilityModal, {
|
|
3102
3001
|
initialPlanIndex: 0,
|
|
3103
3002
|
onClose: onClose,
|
|
@@ -3123,21 +3022,17 @@ var Loader = function Loader(_ref) {
|
|
|
3123
3022
|
|
|
3124
3023
|
var useButtonAnimation = function useButtonAnimation(iterateValues, transitionDelay) {
|
|
3125
3024
|
var _useState = useState(0),
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3025
|
+
current = _useState[0],
|
|
3026
|
+
setCurrent = _useState[1];
|
|
3129
3027
|
var _useState2 = useState(true),
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3028
|
+
update = _useState2[0],
|
|
3029
|
+
setUpdate = _useState2[1];
|
|
3133
3030
|
useEffect(function () {
|
|
3134
3031
|
var timeout;
|
|
3135
3032
|
var isMounted = true;
|
|
3136
|
-
|
|
3137
3033
|
if (transitionDelay === -1) {
|
|
3138
3034
|
return;
|
|
3139
3035
|
}
|
|
3140
|
-
|
|
3141
3036
|
if (iterateValues.length !== 0) {
|
|
3142
3037
|
if (!iterateValues.includes(current) && update) setCurrent(iterateValues[0]);
|
|
3143
3038
|
timeout = setTimeout(function () {
|
|
@@ -3146,7 +3041,6 @@ var useButtonAnimation = function useButtonAnimation(iterateValues, transitionDe
|
|
|
3146
3041
|
}
|
|
3147
3042
|
}, transitionDelay);
|
|
3148
3043
|
}
|
|
3149
|
-
|
|
3150
3044
|
return function () {
|
|
3151
3045
|
isMounted = false;
|
|
3152
3046
|
clearTimeout(timeout);
|
|
@@ -3173,30 +3067,27 @@ var useButtonAnimation = function useButtonAnimation(iterateValues, transitionDe
|
|
|
3173
3067
|
*/
|
|
3174
3068
|
var getIndexOfActivePlan = function getIndexOfActivePlan(_ref) {
|
|
3175
3069
|
var suggestedPaymentPlan = _ref.suggestedPaymentPlan,
|
|
3176
|
-
|
|
3070
|
+
eligibilityPlans = _ref.eligibilityPlans;
|
|
3177
3071
|
var suggestedPaymentPlanArray = Array.isArray(suggestedPaymentPlan) ? suggestedPaymentPlan : [suggestedPaymentPlan];
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
}
|
|
3191
|
-
}
|
|
3192
|
-
|
|
3193
|
-
|
|
3072
|
+
var _loop = function _loop() {
|
|
3073
|
+
var installmentsCount = suggestedPaymentPlanArray[index];
|
|
3074
|
+
var planFound = eligibilityPlans.findIndex(function (plan) {
|
|
3075
|
+
return plan.installments_count === installmentsCount && plan.eligible &&
|
|
3076
|
+
// Remove the PayLater plans from the plan to target, we will code a better solution later
|
|
3077
|
+
// To differentiate P1X from PayLater while using the `suggestedPaymentPlan` property.
|
|
3078
|
+
!plan.deferred_days && !plan.deferred_months;
|
|
3079
|
+
});
|
|
3080
|
+
if (planFound !== -1) {
|
|
3081
|
+
return {
|
|
3082
|
+
v: planFound
|
|
3083
|
+
};
|
|
3084
|
+
}
|
|
3085
|
+
},
|
|
3086
|
+
_ret;
|
|
3194
3087
|
for (var index in suggestedPaymentPlanArray) {
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
if (typeof _ret === "object") return _ret.v;
|
|
3088
|
+
_ret = _loop();
|
|
3089
|
+
if (_ret) return _ret.v;
|
|
3198
3090
|
}
|
|
3199
|
-
|
|
3200
3091
|
return 0;
|
|
3201
3092
|
};
|
|
3202
3093
|
|
|
@@ -3208,7 +3099,6 @@ var prefix$1 = 'alma-payment-plans';
|
|
|
3208
3099
|
* Class names for the **payment plans** widget.
|
|
3209
3100
|
* Those classes are intended to be used by the **merchant developer**.
|
|
3210
3101
|
*/
|
|
3211
|
-
|
|
3212
3102
|
var STATIC_CUSTOMISATION_CLASSES$1 = {
|
|
3213
3103
|
container: prefix$1 + '-container',
|
|
3214
3104
|
eligibilityLine: prefix$1 + '-eligibility-line',
|
|
@@ -3222,28 +3112,24 @@ var s$d = {"widgetButton":"_TSkFv","logo":"_LJ4nZ","primaryContainer":"_bMClc","
|
|
|
3222
3112
|
|
|
3223
3113
|
var VERY_LONG_TIME_IN_MS = 1000 * 3600;
|
|
3224
3114
|
var DEFAULT_TRANSITION_TIME = 5500;
|
|
3225
|
-
|
|
3226
3115
|
var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
3227
3116
|
var _cx, _cx3;
|
|
3228
|
-
|
|
3229
3117
|
var apiData = _ref.apiData,
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3118
|
+
configPlans = _ref.configPlans,
|
|
3119
|
+
hideIfNotEligible = _ref.hideIfNotEligible,
|
|
3120
|
+
monochrome = _ref.monochrome,
|
|
3121
|
+
purchaseAmount = _ref.purchaseAmount,
|
|
3122
|
+
suggestedPaymentPlan = _ref.suggestedPaymentPlan,
|
|
3123
|
+
cards = _ref.cards,
|
|
3124
|
+
customerBillingCountry = _ref.customerBillingCountry,
|
|
3125
|
+
customerShippingCountry = _ref.customerShippingCountry,
|
|
3126
|
+
transitionDelay = _ref.transitionDelay,
|
|
3127
|
+
_ref$hideBorder = _ref.hideBorder,
|
|
3128
|
+
hideBorder = _ref$hideBorder === void 0 ? false : _ref$hideBorder,
|
|
3129
|
+
onModalClose = _ref.onModalClose;
|
|
3243
3130
|
var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans, customerBillingCountry, customerShippingCountry),
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3131
|
+
eligibilityPlans = _useFetchEligibility[0],
|
|
3132
|
+
status = _useFetchEligibility[1];
|
|
3247
3133
|
var eligiblePlans = eligibilityPlans.filter(function (plan) {
|
|
3248
3134
|
return plan.eligible;
|
|
3249
3135
|
});
|
|
@@ -3252,22 +3138,17 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
3252
3138
|
suggestedPaymentPlan: suggestedPaymentPlan != null ? suggestedPaymentPlan : 0
|
|
3253
3139
|
});
|
|
3254
3140
|
var isSuggestedPaymentPlanSpecified = suggestedPaymentPlan !== undefined; // 👈 The merchant decided to focus a tab
|
|
3255
|
-
|
|
3256
3141
|
var isTransitionSpecified = transitionDelay !== undefined; // 👈 The merchant has specified a transition time
|
|
3257
|
-
|
|
3258
3142
|
var _useState = useState(false),
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3143
|
+
isOpen = _useState[0],
|
|
3144
|
+
setIsOpen = _useState[1];
|
|
3262
3145
|
var openModal = function openModal() {
|
|
3263
3146
|
return setIsOpen(true);
|
|
3264
3147
|
};
|
|
3265
|
-
|
|
3266
3148
|
var closeModal = function closeModal(event) {
|
|
3267
3149
|
setIsOpen(false);
|
|
3268
3150
|
onModalClose && onModalClose(event);
|
|
3269
3151
|
};
|
|
3270
|
-
|
|
3271
3152
|
var eligiblePlanKeys = eligibilityPlans.reduce(function (acc, plan, index) {
|
|
3272
3153
|
return plan.eligible ? [].concat(acc, [index]) : acc;
|
|
3273
3154
|
}, []);
|
|
@@ -3277,29 +3158,23 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
3277
3158
|
* If none of those properties are specified, we set a default transition delay.
|
|
3278
3159
|
* @returns
|
|
3279
3160
|
*/
|
|
3280
|
-
|
|
3281
3161
|
var realTransitionTime = function realTransitionTime() {
|
|
3282
3162
|
if (isTransitionSpecified) {
|
|
3283
3163
|
return transitionDelay != null ? transitionDelay : DEFAULT_TRANSITION_TIME;
|
|
3284
3164
|
}
|
|
3285
|
-
|
|
3286
3165
|
if (isSuggestedPaymentPlanSpecified) {
|
|
3287
3166
|
return VERY_LONG_TIME_IN_MS;
|
|
3288
3167
|
}
|
|
3289
|
-
|
|
3290
3168
|
return DEFAULT_TRANSITION_TIME;
|
|
3291
3169
|
};
|
|
3292
|
-
|
|
3293
3170
|
var _useButtonAnimation = useButtonAnimation(eligiblePlanKeys, realTransitionTime()),
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3171
|
+
current = _useButtonAnimation.current,
|
|
3172
|
+
onHover = _useButtonAnimation.onHover,
|
|
3173
|
+
onLeave = _useButtonAnimation.onLeave;
|
|
3298
3174
|
useEffect(function () {
|
|
3299
3175
|
// When API has given a response AND the marchand set an active plan by default.
|
|
3300
|
-
if (status ===
|
|
3176
|
+
if (status === statusResponse.SUCCESS && isSuggestedPaymentPlanSpecified) {
|
|
3301
3177
|
onHover(activePlanIndex); // We select the first active plan possible
|
|
3302
|
-
|
|
3303
3178
|
onLeave(); // We need to call onLeave to reset the animation
|
|
3304
3179
|
}
|
|
3305
3180
|
}, [status]);
|
|
@@ -3309,32 +3184,26 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
3309
3184
|
* @param {number} planIndex - The index of the plan that the user has selected.
|
|
3310
3185
|
* @returns The index of the planKey in the eligiblePlanKeys array.
|
|
3311
3186
|
*/
|
|
3312
|
-
|
|
3313
3187
|
var getIndexWithinEligiblePlans = function getIndexWithinEligiblePlans(planIndex) {
|
|
3314
3188
|
var index = eligiblePlanKeys.findIndex(function (planKey) {
|
|
3315
3189
|
return planKey === planIndex;
|
|
3316
3190
|
});
|
|
3317
3191
|
return index === -1 ? 0 : index;
|
|
3318
3192
|
};
|
|
3319
|
-
|
|
3320
|
-
if (status === apiStatus.PENDING) {
|
|
3193
|
+
if (status === statusResponse.PENDING) {
|
|
3321
3194
|
return /*#__PURE__*/React.createElement("div", {
|
|
3322
3195
|
className: cx(s$d.widgetButton, s$d.pending)
|
|
3323
3196
|
}, /*#__PURE__*/React.createElement(Loader, null));
|
|
3324
3197
|
}
|
|
3325
|
-
|
|
3326
|
-
if (hideIfNotEligible && eligiblePlans.length === 0 || eligibilityPlans.length === 0 || status === apiStatus.FAILED) {
|
|
3198
|
+
if (hideIfNotEligible && eligiblePlans.length === 0 || eligibilityPlans.length === 0 || status === statusResponse.FAILED) {
|
|
3327
3199
|
return null;
|
|
3328
3200
|
}
|
|
3329
|
-
|
|
3330
3201
|
var handleOpenModal = function handleOpenModal(e) {
|
|
3331
3202
|
e.preventDefault();
|
|
3332
|
-
|
|
3333
3203
|
if (eligiblePlans.length > 0) {
|
|
3334
3204
|
openModal();
|
|
3335
3205
|
}
|
|
3336
3206
|
};
|
|
3337
|
-
|
|
3338
3207
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
3339
3208
|
onClick: handleOpenModal,
|
|
3340
3209
|
className: cx(s$d.widgetButton, (_cx = {}, _cx[s$d.clickable] = eligiblePlans.length > 0, _cx[s$d.unClickable] = eligiblePlans.length === 0, _cx[s$d.hideBorder] = hideBorder, _cx), STATIC_CUSTOMISATION_CLASSES$1.container),
|
|
@@ -3348,7 +3217,6 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
3348
3217
|
className: cx(s$d.paymentPlans, STATIC_CUSTOMISATION_CLASSES$1.eligibilityOptions)
|
|
3349
3218
|
}, eligibilityPlans.map(function (eligibilityPlan, key) {
|
|
3350
3219
|
var _cx2;
|
|
3351
|
-
|
|
3352
3220
|
var isCurrent = key === current;
|
|
3353
3221
|
return /*#__PURE__*/React.createElement("div", {
|
|
3354
3222
|
key: key,
|
|
@@ -3364,49 +3232,43 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
3364
3232
|
}, paymentPlanShorthandName(eligibilityPlan));
|
|
3365
3233
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
3366
3234
|
className: cx(s$d.info, (_cx3 = {}, _cx3[cx(s$d.notEligible, STATIC_CUSTOMISATION_CLASSES$1.notEligibleOption)] = eligibilityPlans[current] && !eligibilityPlans[current].eligible, _cx3), STATIC_CUSTOMISATION_CLASSES$1.paymentInfo)
|
|
3367
|
-
}, eligibilityPlans.length !== 0 && paymentPlanInfoText(eligibilityPlans[current]))), isOpen && /*#__PURE__*/React.createElement(EligibilityModal, {
|
|
3235
|
+
}, eligibilityPlans.length !== 0 && paymentPlanInfoText(eligibilityPlans[current]))), isOpen && ( /*#__PURE__*/React.createElement(EligibilityModal, {
|
|
3368
3236
|
initialPlanIndex: getIndexWithinEligiblePlans(current),
|
|
3369
3237
|
onClose: closeModal,
|
|
3370
3238
|
eligibilityPlans: eligiblePlans,
|
|
3371
3239
|
status: status,
|
|
3372
3240
|
cards: cards
|
|
3373
|
-
}));
|
|
3241
|
+
})));
|
|
3374
3242
|
};
|
|
3375
3243
|
|
|
3376
3244
|
var WidgetsController = /*#__PURE__*/function () {
|
|
3377
3245
|
function WidgetsController(apiData) {
|
|
3378
3246
|
this.apiData = apiData;
|
|
3379
3247
|
}
|
|
3380
|
-
|
|
3381
3248
|
var _proto = WidgetsController.prototype;
|
|
3382
|
-
|
|
3383
3249
|
_proto.add = function add(widget, options) {
|
|
3384
3250
|
var _this = this;
|
|
3385
|
-
|
|
3386
3251
|
var containerDiv = document.querySelector(options.container);
|
|
3387
|
-
|
|
3388
3252
|
if (containerDiv) {
|
|
3389
3253
|
unmountComponentAtNode(containerDiv);
|
|
3390
3254
|
}
|
|
3391
|
-
|
|
3392
3255
|
if (widget === widgetTypes.PaymentPlans) {
|
|
3393
3256
|
var container = options.container,
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3257
|
+
purchaseAmount = options.purchaseAmount,
|
|
3258
|
+
plans = options.plans,
|
|
3259
|
+
transitionDelay = options.transitionDelay,
|
|
3260
|
+
hideIfNotEligible = options.hideIfNotEligible,
|
|
3261
|
+
_options$hideBorder = options.hideBorder,
|
|
3262
|
+
hideBorder = _options$hideBorder === void 0 ? false : _options$hideBorder,
|
|
3263
|
+
_options$monochrome = options.monochrome,
|
|
3264
|
+
monochrome = _options$monochrome === void 0 ? true : _options$monochrome,
|
|
3265
|
+
suggestedPaymentPlan = options.suggestedPaymentPlan,
|
|
3266
|
+
customerBillingCountry = options.customerBillingCountry,
|
|
3267
|
+
customerShippingCountry = options.customerShippingCountry,
|
|
3268
|
+
_options$locale = options.locale,
|
|
3269
|
+
locale = _options$locale === void 0 ? Locale.en : _options$locale,
|
|
3270
|
+
cards = options.cards,
|
|
3271
|
+
onModalClose = options.onModalClose;
|
|
3410
3272
|
if (containerDiv) {
|
|
3411
3273
|
render( /*#__PURE__*/React.createElement(Provider, {
|
|
3412
3274
|
locale: locale
|
|
@@ -3426,25 +3288,22 @@ var WidgetsController = /*#__PURE__*/function () {
|
|
|
3426
3288
|
})), document.querySelector(container));
|
|
3427
3289
|
}
|
|
3428
3290
|
}
|
|
3429
|
-
|
|
3430
3291
|
if (widget === widgetTypes.Modal) {
|
|
3431
3292
|
var _container = options.container,
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3293
|
+
clickableSelector = options.clickableSelector,
|
|
3294
|
+
_purchaseAmount = options.purchaseAmount,
|
|
3295
|
+
_plans = options.plans,
|
|
3296
|
+
_options$locale2 = options.locale,
|
|
3297
|
+
_locale = _options$locale2 === void 0 ? Locale.en : _options$locale2,
|
|
3298
|
+
_customerBillingCountry = options.customerBillingCountry,
|
|
3299
|
+
_customerShippingCountry = options.customerShippingCountry,
|
|
3300
|
+
_cards = options.cards,
|
|
3301
|
+
onClose = options.onClose;
|
|
3442
3302
|
var close = function close(event) {
|
|
3443
3303
|
if (!containerDiv) return;
|
|
3444
3304
|
unmountComponentAtNode(containerDiv);
|
|
3445
3305
|
onClose && onClose(event);
|
|
3446
3306
|
};
|
|
3447
|
-
|
|
3448
3307
|
var renderModal = function renderModal() {
|
|
3449
3308
|
render( /*#__PURE__*/React.createElement(Provider, {
|
|
3450
3309
|
locale: _locale
|
|
@@ -3457,34 +3316,29 @@ var WidgetsController = /*#__PURE__*/function () {
|
|
|
3457
3316
|
onClose: close,
|
|
3458
3317
|
cards: _cards
|
|
3459
3318
|
})), document.querySelector(_container));
|
|
3460
|
-
};
|
|
3461
|
-
|
|
3462
|
-
|
|
3319
|
+
};
|
|
3320
|
+
// if clickableSelector is provided, add an onClick event handler to open the Modal.
|
|
3463
3321
|
if (clickableSelector) {
|
|
3464
3322
|
var _document$querySelect;
|
|
3465
|
-
|
|
3466
|
-
(_document$querySelect = document.querySelector(clickableSelector)) == null ? void 0 : _document$querySelect.addEventListener('click', renderModal, false);
|
|
3323
|
+
(_document$querySelect = document.querySelector(clickableSelector)) == null || _document$querySelect.addEventListener('click', renderModal, false);
|
|
3467
3324
|
}
|
|
3468
|
-
|
|
3469
3325
|
return {
|
|
3470
3326
|
open: renderModal,
|
|
3471
3327
|
close: close
|
|
3472
3328
|
};
|
|
3473
3329
|
}
|
|
3474
3330
|
};
|
|
3475
|
-
|
|
3476
3331
|
return WidgetsController;
|
|
3477
3332
|
}();
|
|
3478
3333
|
|
|
3479
3334
|
var ApiMode;
|
|
3480
|
-
|
|
3481
3335
|
(function (ApiMode) {
|
|
3482
3336
|
ApiMode["LIVE"] = "https://api.getalma.eu";
|
|
3483
3337
|
ApiMode["TEST"] = "https://api.sandbox.getalma.eu";
|
|
3484
3338
|
})(ApiMode || (ApiMode = {}));
|
|
3485
3339
|
|
|
3340
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
3486
3341
|
var Widgets;
|
|
3487
|
-
|
|
3488
3342
|
(function (Widgets) {
|
|
3489
3343
|
function initialize(merchantId, mode) {
|
|
3490
3344
|
return new WidgetsController({
|
|
@@ -3492,15 +3346,12 @@ var Widgets;
|
|
|
3492
3346
|
merchantId: merchantId
|
|
3493
3347
|
});
|
|
3494
3348
|
}
|
|
3495
|
-
|
|
3496
3349
|
Widgets.initialize = initialize;
|
|
3497
3350
|
Widgets.PaymentPlans = widgetTypes.PaymentPlans;
|
|
3498
3351
|
Widgets.Modal = widgetTypes.Modal;
|
|
3499
|
-
})(Widgets || (Widgets = {}));
|
|
3500
|
-
|
|
3501
|
-
|
|
3352
|
+
})(Widgets || (Widgets = {}));
|
|
3353
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
3502
3354
|
var Utils;
|
|
3503
|
-
|
|
3504
3355
|
(function (Utils) {
|
|
3505
3356
|
Utils.priceToCents = priceToCents;
|
|
3506
3357
|
Utils.priceFromCents = priceFromCents;
|