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