@alma/widgets 3.3.11 → 3.4.0
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 +3711 -6657
- package/dist/raw/widgets-wc.umd.js.map +0 -0
- package/dist/raw/widgets.css +26 -6
- package/dist/raw/widgets.js +864 -947
- package/dist/raw/widgets.js.map +1 -1
- package/dist/raw/widgets.m.js +865 -950
- package/dist/raw/widgets.m.js.map +1 -1
- package/dist/raw/widgets.modern.js +776 -817
- package/dist/raw/widgets.modern.js.map +1 -1
- package/dist/raw/widgets.umd.js +3711 -6657
- 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.css +4 -3
- 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
|
+
};
|
|
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
|
+
};
|
|
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
|
+
};
|
|
1114
1072
|
|
|
1073
|
+
var isPossiblePrototype = function (argument) {
|
|
1074
|
+
return isObject(argument) || argument === null;
|
|
1075
|
+
};
|
|
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))) {
|
|
1424
|
-
iterator = getIterator(O, iteratorMethod);
|
|
1425
|
-
next = iterator.next;
|
|
1426
1370
|
result = IS_CONSTRUCTOR ? new this() : [];
|
|
1427
|
-
|
|
1371
|
+
iterator = getIterator(O, iteratorMethod);
|
|
1372
|
+
next = iterator.next;
|
|
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 ? {
|
|
@@ -1885,7 +1755,9 @@ if (!''.trim) String.prototype.trim = function () {
|
|
|
1885
1755
|
|
|
1886
1756
|
var messagesDE = {
|
|
1887
1757
|
"credit-features.credit-cost-display": "{creditCost} (APR {taegPercentage})",
|
|
1888
|
-
"credit-features.information": "
|
|
1758
|
+
"credit-features.information": "Überprüfen Sie Ihre Rückzahlungsmöglichkeiten, bevor Sie eine Verpflichtung eingehen.",
|
|
1759
|
+
"credit-features.information.title": "Ein Kredit verpflichtet Sie und muss zurückgezahlt werden.",
|
|
1760
|
+
"credit-features.legal-text": "Kredit in Höhe von {totalWithoutFirstInstallment} zu einem festen Sollzinssatz von {taegPercentage} über eine Laufzeit von {installmeentsCountWithoutFirst} Monaten. Ermöglicht, zusätzlich zu einer Anzahlung von {firstInstallmentAmount}, die Finanzierung eines Kaufs in Höhe von {productPriceWithoutCreditCost}. Vorbehaltlich der Prüfung und Annahme durch Alma. Gesetzliche Widerrufsfrist von 14 Tagen. Simulation präsentiert von Alma, eingetragen im RCS Nanterre unter der Nummer 839 100 575, Zahlungsinstitut und Finanzierungsgesellschaft, zugelassen von der ACPR unter der Nummer 17408 (IPC-Nummer / Bankcode).",
|
|
1889
1761
|
"credit-features.total-credit-cost": "Davon Kreditkosten",
|
|
1890
1762
|
"eligibility-modal.bullet-1": "Wählen Sie <strong>Alma</strong> beim Check-out. ",
|
|
1891
1763
|
"eligibility-modal.bullet-2": "Lassen Sie sich führen und bestätigen Sie Ihre Zahlung in <strong>2 Minuten.</strong>",
|
|
@@ -1900,6 +1772,7 @@ var messagesDE = {
|
|
|
1900
1772
|
"installments.today": "Heute",
|
|
1901
1773
|
"installments.total-amount": "Gesamtsumme",
|
|
1902
1774
|
"installments.total-fees": "Davon Kosten",
|
|
1775
|
+
"payment-plan-strings.credit": "Klicken Sie, um mehr zu erfahren",
|
|
1903
1776
|
"payment-plan-strings.day-abbreviation": "T{deferredDays}",
|
|
1904
1777
|
"payment-plan-strings.default-message": "Bezahlen Sie zinsfrei in mehreren Raten mit Alma.",
|
|
1905
1778
|
"payment-plan-strings.deferred": "{totalAmount} zu zahlen am {dueDate}",
|
|
@@ -1915,7 +1788,9 @@ var messagesDE = {
|
|
|
1915
1788
|
|
|
1916
1789
|
var messagesEN = {
|
|
1917
1790
|
"credit-features.credit-cost-display": "{creditCost} (APR {taegPercentage})",
|
|
1918
|
-
"credit-features.information": "
|
|
1791
|
+
"credit-features.information": "Check your repayment capacity before committing yourself.",
|
|
1792
|
+
"credit-features.information.title": "Credit is a commitment and must be repaid.",
|
|
1793
|
+
"credit-features.legal-text": "Loan of {totalWithoutFirstInstallment} at a fixed interest rate of {taegPercentage} over a period of {installmeentsCountWithoutFirst} months. In addition to a down payment of {firstInstallmentAmount}, this loan can be used to finance a purchase of {productPriceWithoutCreditCost}. Subject to review and acceptance by Alma. Legal cooling-off period of 14 days. Simulation presented by Alma, registered with the RCS Nanterre under number 839 100 575, payment and finance company approved by the ACPR under number 17408 (CIB number / Bank code).",
|
|
1919
1794
|
"credit-features.total-credit-cost": "Of which cost of credit",
|
|
1920
1795
|
"eligibility-modal.bullet-1": "Choose <strong>Alma</strong> at checkout.",
|
|
1921
1796
|
"eligibility-modal.bullet-2": "Let us guide you and validate your payment in <strong>2 minutes.</strong>",
|
|
@@ -1930,6 +1805,7 @@ var messagesEN = {
|
|
|
1930
1805
|
"installments.today": "Today",
|
|
1931
1806
|
"installments.total-amount": "Total",
|
|
1932
1807
|
"installments.total-fees": "Of which costs (incl. VAT)",
|
|
1808
|
+
"payment-plan-strings.credit": "Click to find out more",
|
|
1933
1809
|
"payment-plan-strings.day-abbreviation": "D{deferredDays}",
|
|
1934
1810
|
"payment-plan-strings.default-message": "Pay in installments with Alma",
|
|
1935
1811
|
"payment-plan-strings.deferred": "{totalAmount} to pay the {dueDate}",
|
|
@@ -1945,7 +1821,9 @@ var messagesEN = {
|
|
|
1945
1821
|
|
|
1946
1822
|
var messagesES = {
|
|
1947
1823
|
"credit-features.credit-cost-display": "{creditCost} (TAE {taegPercentage})",
|
|
1948
|
-
"credit-features.information": "
|
|
1824
|
+
"credit-features.information": "Compruebe tu capacidad de reembolso antes de comprometerte.",
|
|
1825
|
+
"credit-features.information.title": "El crédito y/o pago a plazos es un compromiso y debe devolverse.",
|
|
1826
|
+
"credit-features.legal-text": "{totalWithoutFirstInstallment} {taegPercentage} {installmeentsCountWithoutFirst} Préstamo de a un tipo deudor fijo de a lo largo de un periodo de meses. {firstInstallmentAmount} {productPriceWithoutCreditCost}Además de un depósito de , esto le permitirá financiar una compra de . Sujeto a revisión y aceptación por parte de Alma. Plazo legal de retractación de 14 días. Simulación presentada por Alma, inscrita en el Registro Mercantil de Nanterre con el número 839 100 575, sociedad de pago y financiación autorizada por la ACPR con el número 17408 (número CIB / código bancario).",
|
|
1949
1827
|
"credit-features.total-credit-cost": "Coste de crédito (incl. en el total)",
|
|
1950
1828
|
"eligibility-modal.bullet-1": "Elige <strong>Alma</strong> como método de pago.",
|
|
1951
1829
|
"eligibility-modal.bullet-2": "Déjate guiar y válida tu pago en <strong>2 minutos.</strong>",
|
|
@@ -1960,6 +1838,7 @@ var messagesES = {
|
|
|
1960
1838
|
"installments.today": "Hoy",
|
|
1961
1839
|
"installments.total-amount": "Total",
|
|
1962
1840
|
"installments.total-fees": "De los cuales, costes (IVA incluido)",
|
|
1841
|
+
"payment-plan-strings.credit": "Haz click para más información",
|
|
1963
1842
|
"payment-plan-strings.day-abbreviation": "D{deferredDays}",
|
|
1964
1843
|
"payment-plan-strings.default-message": "Pagar a plazos con Alma",
|
|
1965
1844
|
"payment-plan-strings.deferred": "{totalAmount} a pagar el {dueDate}",
|
|
@@ -1975,7 +1854,9 @@ var messagesES = {
|
|
|
1975
1854
|
|
|
1976
1855
|
var messagesFR = {
|
|
1977
1856
|
"credit-features.credit-cost-display": "{creditCost} (TAEG {taegPercentage})",
|
|
1978
|
-
"credit-features.information": "
|
|
1857
|
+
"credit-features.information": "Vérifiez vos capacités de remboursement avant de vous engager.",
|
|
1858
|
+
"credit-features.information.title": "Un crédit vous engage et doit être remboursé.",
|
|
1859
|
+
"credit-features.legal-text": "Crédit d'un montant de {totalWithoutFirstInstallment} au taux débiteur fixe de {taegPercentage} sur une durée de {installmeentsCountWithoutFirst} mois. Permettant, en complément d'un acompte de {firstInstallmentAmount}, de financer un achat d'un montant de {productPriceWithoutCreditCost}. Sous réserve d'étude et d'acceptation par Alma. Délai légal de rétractation de 14 jours. Simulation présentée par Alma, immatriculée au RCS Nanterre sous le numéro 839 100 575, établissement de paiement et société de financement agréée par l’ACPR sous le n° 17408 (numéro CIB / Code banque).",
|
|
1979
1860
|
"credit-features.total-credit-cost": "Dont coût du crédit",
|
|
1980
1861
|
"eligibility-modal.bullet-1": "Choisissez <strong>Alma</strong> au moment du paiement.",
|
|
1981
1862
|
"eligibility-modal.bullet-2": "Laissez-vous guider et validez votre paiement en <strong>2 minutes.</strong>",
|
|
@@ -1990,6 +1871,7 @@ var messagesFR = {
|
|
|
1990
1871
|
"installments.today": "Aujourd'hui",
|
|
1991
1872
|
"installments.total-amount": "Total",
|
|
1992
1873
|
"installments.total-fees": "Dont frais (TTC)",
|
|
1874
|
+
"payment-plan-strings.credit": "Cliquez pour en savoir plus",
|
|
1993
1875
|
"payment-plan-strings.day-abbreviation": "J{deferredDays}",
|
|
1994
1876
|
"payment-plan-strings.default-message": "Payez en plusieurs fois avec Alma",
|
|
1995
1877
|
"payment-plan-strings.deferred": "{totalAmount} à payer le {dueDate}",
|
|
@@ -2005,7 +1887,9 @@ var messagesFR = {
|
|
|
2005
1887
|
|
|
2006
1888
|
var messagesIT = {
|
|
2007
1889
|
"credit-features.credit-cost-display": "{creditCost} (TAEG {taegPercentage})",
|
|
2008
|
-
"credit-features.information": "
|
|
1890
|
+
"credit-features.information": "Verificate la vostra capacità di rimborso prima di prendere un impegno.",
|
|
1891
|
+
"credit-features.information.title": "Il credito è un impegno e deve essere ripagato.",
|
|
1892
|
+
"credit-features.legal-text": "{totalWithoutFirstInstallment} {taegPercentage} {installmeentsCountWithoutFirst} Prestito a tasso fisso per un periodo di mesi. {firstInstallmentAmount} {productPriceWithoutCreditCost}Oltre a un deposito di , questo vi permetterà di finanziare un acquisto di . Soggetto a revisione e accettazione da parte di Alma. Periodo di recesso legale di 14 giorni. Simulazione presentata da Alma, iscritta al Registro del Commercio e delle Imprese di Nanterre con il numero 839 100 575, società di pagamento e di finanziamento approvata dall'ACPR con il numero 17408 (numero CIB / codice bancario).",
|
|
2009
1893
|
"credit-features.total-credit-cost": "Di cui commissioni",
|
|
2010
1894
|
"eligibility-modal.bullet-1": "Seleziona <strong>Alma</strong> come metodo di pagamento.",
|
|
2011
1895
|
"eligibility-modal.bullet-2": "Segui le istruzioni e completa l'acquisto <strong>in meno di 2 minuti.</strong>",
|
|
@@ -2020,6 +1904,7 @@ var messagesIT = {
|
|
|
2020
1904
|
"installments.today": "Oggi",
|
|
2021
1905
|
"installments.total-amount": "Totale",
|
|
2022
1906
|
"installments.total-fees": "Di cui commissioni",
|
|
1907
|
+
"payment-plan-strings.credit": "Clicca qui per saperne di più",
|
|
2023
1908
|
"payment-plan-strings.day-abbreviation": "G{deferredDays}",
|
|
2024
1909
|
"payment-plan-strings.default-message": "Paga a rate con Alma, senza registrazione.",
|
|
2025
1910
|
"payment-plan-strings.deferred": "{totalAmount} da pagare il {dueDate}",
|
|
@@ -2035,7 +1920,9 @@ var messagesIT = {
|
|
|
2035
1920
|
|
|
2036
1921
|
var messagesNL = {
|
|
2037
1922
|
"credit-features.credit-cost-display": "{creditCost} (gemiddeld rente percentage {taegPercentage})",
|
|
2038
|
-
"credit-features.information": "
|
|
1923
|
+
"credit-features.information": "Controleer uw terugbetalingscapaciteit voordat u een toezegging doet.",
|
|
1924
|
+
"credit-features.information.title": "Krediet is een verplichting en moet worden terugbetaald.",
|
|
1925
|
+
"credit-features.legal-text": "{totalWithoutFirstInstallment} {taegPercentage} {installmeentsCountWithoutFirst} Lening van tegen een vaste rentevoet van over een periode van maanden. {firstInstallmentAmount} {productPriceWithoutCreditCost}Naast een aanbetaling van , kun je hiermee een aankoop financieren van . Onder voorbehoud van beoordeling en aanvaarding door Alma. Wettelijke herroepingstermijn van 14 dagen. Simulatie aangeboden door Alma, ingeschreven in het handels- en bedrijvenregister van Nanterre onder nummer 839 100 575, betalings- en financieringsmaatschappij erkend door de ACPR onder nummer 17408 (CIB-nummer / bankcode).",
|
|
2039
1926
|
"credit-features.total-credit-cost": "Waarvan kredietkosten",
|
|
2040
1927
|
"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
1928
|
"eligibility-modal.bullet-2": "Betaal gemakkelijk <strong>binnen 1 minuut </strong>. Je hebt hier geen account voor nodig.",
|
|
@@ -2050,6 +1937,7 @@ var messagesNL = {
|
|
|
2050
1937
|
"installments.today": "Vandaag",
|
|
2051
1938
|
"installments.total-amount": "Totaal",
|
|
2052
1939
|
"installments.total-fees": "Waarvan kosten (incl. BTW)",
|
|
1940
|
+
"payment-plan-strings.credit": "Klik hier voor meer informatie",
|
|
2053
1941
|
"payment-plan-strings.day-abbreviation": "D{deferredDays}",
|
|
2054
1942
|
"payment-plan-strings.default-message": "Betaal in termijnen bij Alma - helemaal rentevrij",
|
|
2055
1943
|
"payment-plan-strings.deferred": "{totalAmount} te betalen op {dueDate}",
|
|
@@ -2065,7 +1953,9 @@ var messagesNL = {
|
|
|
2065
1953
|
|
|
2066
1954
|
var messagesPT = {
|
|
2067
1955
|
"credit-features.credit-cost-display": "{creditCost} (TAEG {taegPercentage})",
|
|
2068
|
-
"credit-features.information": "
|
|
1956
|
+
"credit-features.information": "Verifique a sua capacidade de reembolso antes de assumir um compromisso.",
|
|
1957
|
+
"credit-features.information.title": "O crédito é um compromisso e deve ser reembolsado.",
|
|
1958
|
+
"credit-features.legal-text": "{totalWithoutFirstInstallment} {taegPercentage} {installmeentsCountWithoutFirst} Empréstimo de a uma taxa de juro fixa de durante um período de meses. {firstInstallmentAmount} {productPriceWithoutCreditCost}Para além de um depósito de , isto permitir-lhe-á financiar uma compra de . Sujeito a análise e aceitação pela Alma. Prazo legal de retratação de 14 dias. Simulação apresentada pela Alma, inscrita na Conservatória do Registo Comercial e das Sociedades de Nanterre sob o número 839 100 575, sociedade de pagamento e de financiamento aprovada pela ACPR sob o número 17408 (número CIB / código bancário).",
|
|
2069
1959
|
"credit-features.total-credit-cost": "Incluindo comissões de crédito",
|
|
2070
1960
|
"eligibility-modal.bullet-1": "Seleccionar <strong>Alma - Pay Now</strong> no final da compra.",
|
|
2071
1961
|
"eligibility-modal.bullet-2": "Siga as instruções e valide o seu pagamento em <strong>2 minutos.</strong>",
|
|
@@ -2080,6 +1970,7 @@ var messagesPT = {
|
|
|
2080
1970
|
"installments.today": "Hoje",
|
|
2081
1971
|
"installments.total-amount": "Total",
|
|
2082
1972
|
"installments.total-fees": "Das quais comissões (incl. IVA)",
|
|
1973
|
+
"payment-plan-strings.credit": "Clique aqui para saber mais",
|
|
2083
1974
|
"payment-plan-strings.day-abbreviation": "D{deferredDays}",
|
|
2084
1975
|
"payment-plan-strings.default-message": "Pagamento em prestações com a Alma",
|
|
2085
1976
|
"payment-plan-strings.deferred": "{totalAmount} a pagar em {dueDate}",
|
|
@@ -2097,26 +1988,19 @@ var getTranslationsByLocale = function getTranslationsByLocale(locale) {
|
|
|
2097
1988
|
// A CMS plugin can add LCID format like : 'fr-FR' instead of 'fr'.
|
|
2098
1989
|
// Instead of specifying all possibilities we just remove the last part of the string.
|
|
2099
1990
|
var merchantLocale = locale.slice(0, 2);
|
|
2100
|
-
|
|
2101
1991
|
switch (merchantLocale) {
|
|
2102
1992
|
case Locale.fr:
|
|
2103
1993
|
return messagesFR;
|
|
2104
|
-
|
|
2105
1994
|
case Locale.es:
|
|
2106
1995
|
return messagesES;
|
|
2107
|
-
|
|
2108
1996
|
case Locale.it:
|
|
2109
1997
|
return messagesIT;
|
|
2110
|
-
|
|
2111
1998
|
case Locale.de:
|
|
2112
1999
|
return messagesDE;
|
|
2113
|
-
|
|
2114
2000
|
case Locale.pt:
|
|
2115
2001
|
return messagesPT;
|
|
2116
|
-
|
|
2117
2002
|
case Locale.nl:
|
|
2118
2003
|
return messagesNL;
|
|
2119
|
-
|
|
2120
2004
|
case Locale.en:
|
|
2121
2005
|
default:
|
|
2122
2006
|
return messagesEN;
|
|
@@ -2125,7 +2009,7 @@ var getTranslationsByLocale = function getTranslationsByLocale(locale) {
|
|
|
2125
2009
|
|
|
2126
2010
|
var Provider = function Provider(_ref) {
|
|
2127
2011
|
var children = _ref.children,
|
|
2128
|
-
|
|
2012
|
+
locale = _ref.locale;
|
|
2129
2013
|
return /*#__PURE__*/React__default.createElement(reactIntl.IntlProvider, {
|
|
2130
2014
|
messages: getTranslationsByLocale(locale),
|
|
2131
2015
|
locale: locale,
|
|
@@ -2134,48 +2018,35 @@ var Provider = function Provider(_ref) {
|
|
|
2134
2018
|
};
|
|
2135
2019
|
|
|
2136
2020
|
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
|
-
}
|
|
2021
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
2022
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
2023
|
+
var t = arguments[e];
|
|
2024
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
2146
2025
|
}
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
};
|
|
2150
|
-
return _extends.apply(this, arguments);
|
|
2026
|
+
return n;
|
|
2027
|
+
}, _extends.apply(null, arguments);
|
|
2151
2028
|
}
|
|
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];
|
|
2029
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
2030
|
+
if (null == r) return {};
|
|
2031
|
+
var t = {};
|
|
2032
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
2033
|
+
if (e.includes(n)) continue;
|
|
2034
|
+
t[n] = r[n];
|
|
2163
2035
|
}
|
|
2164
|
-
|
|
2165
|
-
return target;
|
|
2036
|
+
return t;
|
|
2166
2037
|
}
|
|
2167
2038
|
|
|
2168
2039
|
var fetchFromApi = function fetchFromApi(url, data, headers) {
|
|
2169
2040
|
if (url === void 0) {
|
|
2170
2041
|
url = '';
|
|
2171
2042
|
}
|
|
2172
|
-
|
|
2173
2043
|
try {
|
|
2174
2044
|
return Promise.resolve(fetch(url, {
|
|
2175
2045
|
method: 'POST',
|
|
2176
2046
|
headers: _extends({
|
|
2177
2047
|
'Content-Type': 'application/json'
|
|
2178
2048
|
}, headers),
|
|
2049
|
+
cache: 'force-cache',
|
|
2179
2050
|
body: JSON.stringify(data)
|
|
2180
2051
|
})).then(function (response) {
|
|
2181
2052
|
return response.json();
|
|
@@ -2189,38 +2060,31 @@ var isPlanEligible = function isPlanEligible(plan, configPlan) {
|
|
|
2189
2060
|
if (!plan.eligible) {
|
|
2190
2061
|
return false;
|
|
2191
2062
|
}
|
|
2192
|
-
|
|
2193
2063
|
return configPlan ? plan.purchase_amount >= (configPlan == null ? void 0 : configPlan.minAmount) && plan.purchase_amount <= (configPlan == null ? void 0 : configPlan.maxAmount) : false;
|
|
2194
2064
|
};
|
|
2195
|
-
|
|
2196
2065
|
var getPaymentPlanBoundaries = function getPaymentPlanBoundaries(plan, configPlan) {
|
|
2197
2066
|
var _plan$constraints;
|
|
2198
|
-
|
|
2199
2067
|
// When the plan is not eligible, the purchase amount constraints is given from the merchant config
|
|
2200
2068
|
var purchaseAmountConstraints = (_plan$constraints = plan.constraints) == null ? void 0 : _plan$constraints.purchase_amount;
|
|
2201
|
-
|
|
2202
2069
|
if (purchaseAmountConstraints && configPlan) {
|
|
2203
2070
|
return {
|
|
2204
2071
|
minAmount: Math.max(configPlan.minAmount, purchaseAmountConstraints == null ? void 0 : purchaseAmountConstraints.minimum),
|
|
2205
2072
|
maxAmount: Math.min(configPlan.maxAmount, purchaseAmountConstraints == null ? void 0 : purchaseAmountConstraints.maximum)
|
|
2206
2073
|
};
|
|
2207
2074
|
}
|
|
2208
|
-
|
|
2209
2075
|
return configPlan != null ? configPlan : {};
|
|
2210
2076
|
};
|
|
2211
|
-
|
|
2212
2077
|
var filterEligibility = function filterEligibility(eligibilities, configPlans) {
|
|
2213
2078
|
// Remove P1X if no configuration is provided
|
|
2214
2079
|
if (!configPlans) {
|
|
2215
2080
|
return eligibilities.filter(function (plan) {
|
|
2216
2081
|
return !(plan.installments_count === 1 && plan.deferred_days === 0 && plan.deferred_months === 0);
|
|
2217
2082
|
});
|
|
2218
|
-
}
|
|
2219
|
-
|
|
2220
|
-
|
|
2083
|
+
}
|
|
2084
|
+
// Else check if the plan is eligible regarding the related configPlan
|
|
2221
2085
|
return eligibilities.map(function (plan) {
|
|
2222
|
-
var eligibilityDeferredDays = (plan.deferred_months ? plan.deferred_months : 0) * 30 + (plan.deferred_days ? plan.deferred_days : 0);
|
|
2223
|
-
|
|
2086
|
+
var eligibilityDeferredDays = (plan.deferred_months ? plan.deferred_months : 0) * 30 + (plan.deferred_days ? plan.deferred_days : 0);
|
|
2087
|
+
// find the related configPlan
|
|
2224
2088
|
var relatedConfigPlan = configPlans.find(function (configPlan) {
|
|
2225
2089
|
var configPlanDeferredDays = (configPlan.deferredMonths ? configPlan.deferredMonths : 0) * 30 + (configPlan.deferredDays ? configPlan.deferredDays : 0);
|
|
2226
2090
|
return plan.installments_count === configPlan.installmentsCount && eligibilityDeferredDays === configPlanDeferredDays;
|
|
@@ -2231,18 +2095,94 @@ var filterEligibility = function filterEligibility(eligibilities, configPlans) {
|
|
|
2231
2095
|
});
|
|
2232
2096
|
};
|
|
2233
2097
|
|
|
2098
|
+
// Function to hash a string
|
|
2099
|
+
// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
|
|
2100
|
+
var hashStringForStorage = function hashStringForStorage(str) {
|
|
2101
|
+
return str
|
|
2102
|
+
// The input string is split into an array of characters.
|
|
2103
|
+
.split('')
|
|
2104
|
+
// 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.
|
|
2105
|
+
.reduce(function (a, b) {
|
|
2106
|
+
// 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).
|
|
2107
|
+
// The bitwise OR operation with 0 is used to ensure the result is a 32-bit integer.
|
|
2108
|
+
return (a << 5) - a + b.charCodeAt(0) | 0;
|
|
2109
|
+
}, 0) // The initial value of the accumulator is 0.
|
|
2110
|
+
.toString() // The result is then converted to a string.
|
|
2111
|
+
.replace('-', 'A'); // If the hash is negative (which is represented by a leading '-'), it's replaced with 'A' to ensure the hash is alphanumeric.
|
|
2112
|
+
};
|
|
2113
|
+
var isMoreThanOneHourAgo = function isMoreThanOneHourAgo(date) {
|
|
2114
|
+
var ONE_HOUR_IN_MILLISECONDS = 1000 * 60 * 60;
|
|
2115
|
+
var currentTime = Date.now();
|
|
2116
|
+
var difference = currentTime - date;
|
|
2117
|
+
return difference >= ONE_HOUR_IN_MILLISECONDS;
|
|
2118
|
+
};
|
|
2119
|
+
|
|
2120
|
+
var useSessionStorage = function useSessionStorage() {
|
|
2121
|
+
var setCache = function setCache(key, value) {
|
|
2122
|
+
// Save data to sessionStorage and create timestamp
|
|
2123
|
+
var timestamp = Date.now();
|
|
2124
|
+
sessionStorage.setItem(key, JSON.stringify({
|
|
2125
|
+
value: value,
|
|
2126
|
+
timestamp: timestamp
|
|
2127
|
+
}));
|
|
2128
|
+
};
|
|
2129
|
+
var getCache = function getCache(key) {
|
|
2130
|
+
// Get saved data from sessionStorage
|
|
2131
|
+
var stringData = sessionStorage.getItem(key) || '';
|
|
2132
|
+
// Parse cached data to use it directly as an array of EligibilityPlan
|
|
2133
|
+
return stringData ? JSON.parse(stringData) : null;
|
|
2134
|
+
};
|
|
2135
|
+
var deleteCache = function deleteCache(key) {
|
|
2136
|
+
// Remove saved data from sessionStorage
|
|
2137
|
+
sessionStorage.removeItem(key);
|
|
2138
|
+
};
|
|
2139
|
+
var clearCache = function clearCache() {
|
|
2140
|
+
// Remove all saved data from sessionStorage
|
|
2141
|
+
sessionStorage.clear();
|
|
2142
|
+
};
|
|
2143
|
+
var createKey = function createKey(params) {
|
|
2144
|
+
var purchaseAmount = params.purchaseAmount,
|
|
2145
|
+
plans = params.plans,
|
|
2146
|
+
customerBillingCountry = params.customerBillingCountry,
|
|
2147
|
+
customerShippingCountry = params.customerShippingCountry;
|
|
2148
|
+
var stringAmount = purchaseAmount.toString();
|
|
2149
|
+
var stringPlans = JSON.stringify(plans);
|
|
2150
|
+
return hashStringForStorage("" + stringAmount + stringPlans + customerBillingCountry + customerShippingCountry);
|
|
2151
|
+
};
|
|
2152
|
+
return {
|
|
2153
|
+
setCache: setCache,
|
|
2154
|
+
getCache: getCache,
|
|
2155
|
+
clearCache: clearCache,
|
|
2156
|
+
deleteCache: deleteCache,
|
|
2157
|
+
createKey: createKey
|
|
2158
|
+
};
|
|
2159
|
+
};
|
|
2160
|
+
|
|
2234
2161
|
var useFetchEligibility = function useFetchEligibility(purchaseAmount, _ref, plans, customerBillingCountry, customerShippingCountry) {
|
|
2162
|
+
var _getCache, _getCache2;
|
|
2235
2163
|
var domain = _ref.domain,
|
|
2236
|
-
|
|
2237
|
-
|
|
2164
|
+
merchantId = _ref.merchantId;
|
|
2238
2165
|
var _useState = React.useState([]),
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2166
|
+
eligibility = _useState[0],
|
|
2167
|
+
setEligibility = _useState[1];
|
|
2168
|
+
var _useState2 = React.useState(statusResponse.PENDING),
|
|
2169
|
+
status = _useState2[0],
|
|
2170
|
+
setStatus = _useState2[1];
|
|
2171
|
+
// caching
|
|
2172
|
+
var _useSessionStorage = useSessionStorage(),
|
|
2173
|
+
getCache = _useSessionStorage.getCache,
|
|
2174
|
+
setCache = _useSessionStorage.setCache,
|
|
2175
|
+
createKey = _useSessionStorage.createKey;
|
|
2176
|
+
var key = createKey({
|
|
2177
|
+
purchaseAmount: purchaseAmount,
|
|
2178
|
+
plans: plans,
|
|
2179
|
+
customerBillingCountry: customerBillingCountry,
|
|
2180
|
+
customerShippingCountry: customerShippingCountry
|
|
2181
|
+
});
|
|
2182
|
+
var currentCache = (_getCache = getCache(key)) == null ? void 0 : _getCache.value;
|
|
2183
|
+
var lastCacheTimestamp = (_getCache2 = getCache(key)) == null ? void 0 : _getCache2.timestamp;
|
|
2184
|
+
// If the stored date is more than an hour ago, we should invalidate the cache
|
|
2185
|
+
var shouldInvalidate = lastCacheTimestamp && isMoreThanOneHourAgo(lastCacheTimestamp);
|
|
2246
2186
|
var configInstallments = plans == null ? void 0 : plans.map(function (plan) {
|
|
2247
2187
|
return {
|
|
2248
2188
|
installments_count: plan.installmentsCount,
|
|
@@ -2251,43 +2191,46 @@ var useFetchEligibility = function useFetchEligibility(purchaseAmount, _ref, pla
|
|
|
2251
2191
|
};
|
|
2252
2192
|
});
|
|
2253
2193
|
React.useEffect(function () {
|
|
2254
|
-
if (status ===
|
|
2194
|
+
if (status === statusResponse.PENDING) {
|
|
2255
2195
|
var billing_address = null;
|
|
2256
|
-
|
|
2257
2196
|
if (customerBillingCountry) {
|
|
2258
2197
|
billing_address = {
|
|
2259
2198
|
country: customerBillingCountry
|
|
2260
2199
|
};
|
|
2261
2200
|
}
|
|
2262
|
-
|
|
2263
2201
|
var shipping_address = null;
|
|
2264
|
-
|
|
2265
2202
|
if (customerShippingCountry) {
|
|
2266
2203
|
shipping_address = {
|
|
2267
2204
|
country: customerShippingCountry
|
|
2268
2205
|
};
|
|
2269
2206
|
}
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2207
|
+
if (currentCache && !shouldInvalidate) {
|
|
2208
|
+
setEligibility(currentCache);
|
|
2209
|
+
setStatus(statusResponse.SUCCESS);
|
|
2210
|
+
}
|
|
2211
|
+
if (!currentCache || shouldInvalidate) {
|
|
2212
|
+
fetchFromApi(domain + '/v2/payments/eligibility', {
|
|
2213
|
+
purchase_amount: purchaseAmount,
|
|
2214
|
+
queries: configInstallments,
|
|
2215
|
+
billing_address: billing_address,
|
|
2216
|
+
shipping_address: shipping_address
|
|
2217
|
+
}, {
|
|
2218
|
+
Authorization: "Alma-Merchant-Auth " + merchantId,
|
|
2219
|
+
'X-Alma-Agent': "Alma Widget/" + "v3.4.0"
|
|
2220
|
+
}).then(function (res) {
|
|
2221
|
+
setCache(key, res);
|
|
2222
|
+
setEligibility(res);
|
|
2223
|
+
setStatus(statusResponse.SUCCESS);
|
|
2224
|
+
})["catch"](function () {
|
|
2225
|
+
setStatus(statusResponse.FAILED);
|
|
2226
|
+
});
|
|
2227
|
+
}
|
|
2285
2228
|
}
|
|
2286
|
-
}, [status]);
|
|
2229
|
+
}, [status, purchaseAmount, key]);
|
|
2287
2230
|
return [filterEligibility(eligibility, plans), status];
|
|
2288
2231
|
};
|
|
2289
2232
|
|
|
2290
|
-
var s = {"container":"_GTTk7","total":"_34s2g","fees":"_W7qIA","creditCost":"_24KmE"};
|
|
2233
|
+
var s = {"container":"_GTTk7","total":"_34s2g","creditInfo":"_15KNd","creditInfoTitle":"_3T0mA","fees":"_W7qIA","creditCost":"_24KmE","creditInfoLegalText":"_2e3lw"};
|
|
2291
2234
|
|
|
2292
2235
|
/**
|
|
2293
2236
|
* Prefix classes to avoid name collisions.
|
|
@@ -2297,7 +2240,6 @@ var prefix = 'alma-eligibility-modal';
|
|
|
2297
2240
|
* Class names for the **eligibility modale** widget.
|
|
2298
2241
|
* Those classes are intended to be used by the **merchant developer**.
|
|
2299
2242
|
*/
|
|
2300
|
-
|
|
2301
2243
|
var STATIC_CUSTOMISATION_CLASSES = {
|
|
2302
2244
|
desktopModal: prefix + '-desktop-modal',
|
|
2303
2245
|
mobileModal: prefix + '-mobile-modal',
|
|
@@ -2318,6 +2260,7 @@ var STATIC_CUSTOMISATION_CLASSES = {
|
|
|
2318
2260
|
};
|
|
2319
2261
|
|
|
2320
2262
|
var TotalBlock = function TotalBlock(_ref) {
|
|
2263
|
+
var _currentPlan$payment_, _currentPlan$payment_2, _currentPlan$payment_3, _currentPlan$payment_4;
|
|
2321
2264
|
var currentPlan = _ref.currentPlan;
|
|
2322
2265
|
var intl = reactIntl.useIntl();
|
|
2323
2266
|
var total = priceFromCents(currentPlan.purchase_amount + currentPlan.customer_total_cost_amount);
|
|
@@ -2325,7 +2268,20 @@ var TotalBlock = function TotalBlock(_ref) {
|
|
|
2325
2268
|
var TAEG = (currentPlan == null ? void 0 : currentPlan.annual_interest_rate) && currentPlan.annual_interest_rate / 10000 || 0;
|
|
2326
2269
|
var customerFees = priceFromCents(currentPlan.customer_total_cost_amount);
|
|
2327
2270
|
var isCredit = currentPlan.installments_count > 4;
|
|
2328
|
-
|
|
2271
|
+
var firstInstallmentAmount = priceFromCents((_currentPlan$payment_ = (_currentPlan$payment_2 = currentPlan.payment_plan) == null || (_currentPlan$payment_2 = _currentPlan$payment_2[0]) == null ? void 0 : _currentPlan$payment_2.total_amount) != null ? _currentPlan$payment_ : 0);
|
|
2272
|
+
// For totalWithoutFirstInstallment, we need to get the total price and add the credit cost, before removing the first installment, to get the rest of the amount to pay.
|
|
2273
|
+
var totalWithoutFirstInstallment = priceFromCents(currentPlan.purchase_amount + currentPlan.customer_total_cost_amount - ((_currentPlan$payment_3 = (_currentPlan$payment_4 = currentPlan.payment_plan) == null || (_currentPlan$payment_4 = _currentPlan$payment_4[0]) == null ? void 0 : _currentPlan$payment_4.total_amount) != null ? _currentPlan$payment_3 : 0));
|
|
2274
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isCredit && ( /*#__PURE__*/React__default.createElement("div", {
|
|
2275
|
+
className: s.creditInfo
|
|
2276
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
2277
|
+
className: s.creditInfoTitle
|
|
2278
|
+
}, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2279
|
+
id: "credit-features.information.title",
|
|
2280
|
+
defaultMessage: "Un cr\xE9dit vous engage et doit \xEAtre rembours\xE9."
|
|
2281
|
+
})), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2282
|
+
id: "credit-features.information",
|
|
2283
|
+
defaultMessage: "V\xE9rifiez vos capacit\xE9s de remboursement avant de vous engager."
|
|
2284
|
+
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
2329
2285
|
className: cx(s.container, STATIC_CUSTOMISATION_CLASSES.summary),
|
|
2330
2286
|
"data-testid": "modal-summary"
|
|
2331
2287
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -2340,7 +2296,7 @@ var TotalBlock = function TotalBlock(_ref) {
|
|
|
2340
2296
|
currency: "EUR"
|
|
2341
2297
|
})), /*#__PURE__*/React__default.createElement("div", {
|
|
2342
2298
|
className: cx(s.fees, STATIC_CUSTOMISATION_CLASSES.scheduleCredit)
|
|
2343
|
-
}, isCredit ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2299
|
+
}, isCredit ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2344
2300
|
id: "credit-features.total-credit-cost",
|
|
2345
2301
|
defaultMessage: "Dont co\xFBt du cr\xE9dit"
|
|
2346
2302
|
}), /*#__PURE__*/React__default.createElement("span", {
|
|
@@ -2358,7 +2314,7 @@ var TotalBlock = function TotalBlock(_ref) {
|
|
|
2358
2314
|
maximumFractionDigits: 2
|
|
2359
2315
|
})
|
|
2360
2316
|
}
|
|
2361
|
-
}))) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2317
|
+
})))) : ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2362
2318
|
id: "installments.total-fees",
|
|
2363
2319
|
defaultMessage: "Dont frais (TTC)",
|
|
2364
2320
|
tagName: "div"
|
|
@@ -2366,6 +2322,30 @@ var TotalBlock = function TotalBlock(_ref) {
|
|
|
2366
2322
|
value: customerFees,
|
|
2367
2323
|
style: "currency",
|
|
2368
2324
|
currency: "EUR"
|
|
2325
|
+
}))))), isCredit && ( /*#__PURE__*/React__default.createElement("div", {
|
|
2326
|
+
className: s.creditInfoLegalText
|
|
2327
|
+
}, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2328
|
+
id: "credit-features.legal-text",
|
|
2329
|
+
defaultMessage: "Cr\xE9dit d'un montant de {totalWithoutFirstInstallment} au taux d\xE9biteur fixe de {taegPercentage} sur une dur\xE9e de {installmeentsCountWithoutFirst} mois. Permettant, en compl\xE9ment d'un acompte de {firstInstallmentAmount}, de financer un achat d'un montant de {productPriceWithoutCreditCost}. Sous r\xE9serve d'\xE9tude et d'acceptation par Alma. D\xE9lai l\xE9gal de r\xE9tractation de 14 jours. Simulation pr\xE9sent\xE9e par Alma, immatricul\xE9e au RCS Nanterre sous le num\xE9ro 839 100 575, \xE9tablissement de paiement\xA0et soci\xE9t\xE9 de financement agr\xE9\xE9e par l\u2019ACPR sous le n\xB0 17408 (num\xE9ro CIB / Code banque).",
|
|
2330
|
+
values: {
|
|
2331
|
+
totalWithoutFirstInstallment: intl.formatNumber(totalWithoutFirstInstallment, {
|
|
2332
|
+
style: 'currency',
|
|
2333
|
+
currency: 'EUR'
|
|
2334
|
+
}),
|
|
2335
|
+
taegPercentage: intl.formatNumber(TAEG, {
|
|
2336
|
+
style: 'percent',
|
|
2337
|
+
maximumFractionDigits: 2
|
|
2338
|
+
}),
|
|
2339
|
+
installmeentsCountWithoutFirst: currentPlan.installments_count - 1,
|
|
2340
|
+
firstInstallmentAmount: intl.formatNumber(firstInstallmentAmount, {
|
|
2341
|
+
style: 'currency',
|
|
2342
|
+
currency: 'EUR'
|
|
2343
|
+
}),
|
|
2344
|
+
productPriceWithoutCreditCost: intl.formatNumber(total - creditCost, {
|
|
2345
|
+
style: 'currency',
|
|
2346
|
+
currency: 'EUR'
|
|
2347
|
+
})
|
|
2348
|
+
}
|
|
2369
2349
|
})))));
|
|
2370
2350
|
};
|
|
2371
2351
|
|
|
@@ -2392,8 +2372,8 @@ var s$2 = {"modal":"_D8SjB","content":"_ocM9x","contentScrollable":"_1GP2F","ove
|
|
|
2392
2372
|
|
|
2393
2373
|
function CrossIcon(_ref) {
|
|
2394
2374
|
var _ref$color = _ref.color,
|
|
2395
|
-
|
|
2396
|
-
|
|
2375
|
+
color = _ref$color === void 0 ? '#fff' : _ref$color,
|
|
2376
|
+
className = _ref.className;
|
|
2397
2377
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
2398
2378
|
className: className,
|
|
2399
2379
|
width: "16",
|
|
@@ -2408,19 +2388,16 @@ function CrossIcon(_ref) {
|
|
|
2408
2388
|
}
|
|
2409
2389
|
|
|
2410
2390
|
var _excluded = ["children", "isOpen", "onClose", "className", "contentClassName", "scrollable"];
|
|
2411
|
-
|
|
2412
2391
|
var ControlledModal = function ControlledModal(_ref) {
|
|
2413
2392
|
var _cx;
|
|
2414
|
-
|
|
2415
2393
|
var children = _ref.children,
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2394
|
+
isOpen = _ref.isOpen,
|
|
2395
|
+
onClose = _ref.onClose,
|
|
2396
|
+
className = _ref.className,
|
|
2397
|
+
contentClassName = _ref.contentClassName,
|
|
2398
|
+
_ref$scrollable = _ref.scrollable,
|
|
2399
|
+
scrollable = _ref$scrollable === void 0 ? false : _ref$scrollable,
|
|
2400
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
2424
2401
|
/* istanbul ignore next */
|
|
2425
2402
|
Modal.setAppElement('body');
|
|
2426
2403
|
return /*#__PURE__*/React__default.createElement(Modal, Object.assign({
|
|
@@ -2447,18 +2424,18 @@ var ControlledModal = function ControlledModal(_ref) {
|
|
|
2447
2424
|
}, children));
|
|
2448
2425
|
};
|
|
2449
2426
|
|
|
2427
|
+
var s$3 = {"openModalInfo":"_bplXm"};
|
|
2428
|
+
|
|
2450
2429
|
var paymentPlanShorthandName = function paymentPlanShorthandName(payment) {
|
|
2451
2430
|
var deferred_days = payment.deferred_days,
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2431
|
+
deferred_months = payment.deferred_months,
|
|
2432
|
+
installmentsCount = payment.installments_count;
|
|
2455
2433
|
if (installmentsCount === 1 && !deferred_days && !deferred_months) {
|
|
2456
2434
|
return /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2457
2435
|
id: "payment-plan-strings.pay.now.button",
|
|
2458
2436
|
defaultMessage: "Payer maintenant"
|
|
2459
2437
|
});
|
|
2460
2438
|
}
|
|
2461
|
-
|
|
2462
2439
|
if (installmentsCount === 1 && deferred_days) {
|
|
2463
2440
|
return /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2464
2441
|
id: "payment-plan-strings.day-abbreviation",
|
|
@@ -2468,7 +2445,6 @@ var paymentPlanShorthandName = function paymentPlanShorthandName(payment) {
|
|
|
2468
2445
|
}
|
|
2469
2446
|
});
|
|
2470
2447
|
}
|
|
2471
|
-
|
|
2472
2448
|
if (installmentsCount === 1 && deferred_months) {
|
|
2473
2449
|
return /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2474
2450
|
id: "payment-plan-strings.month-abbreviation",
|
|
@@ -2481,10 +2457,8 @@ var paymentPlanShorthandName = function paymentPlanShorthandName(payment) {
|
|
|
2481
2457
|
return installmentsCount + "x";
|
|
2482
2458
|
}
|
|
2483
2459
|
};
|
|
2484
|
-
|
|
2485
2460
|
var withNoFee = function withNoFee(payment) {
|
|
2486
2461
|
var _payment$payment_plan;
|
|
2487
|
-
|
|
2488
2462
|
if ((_payment$payment_plan = payment.payment_plan) != null && _payment$payment_plan.every(function (plan) {
|
|
2489
2463
|
return plan.customer_fee === 0 && plan.customer_interest === 0;
|
|
2490
2464
|
})) {
|
|
@@ -2494,42 +2468,40 @@ var withNoFee = function withNoFee(payment) {
|
|
|
2494
2468
|
}));
|
|
2495
2469
|
}
|
|
2496
2470
|
};
|
|
2497
|
-
|
|
2498
2471
|
var paymentPlanInfoText = function paymentPlanInfoText(payment) {
|
|
2499
2472
|
var deferred_days = payment.deferred_days,
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2473
|
+
deferred_months = payment.deferred_months,
|
|
2474
|
+
installmentsCount = payment.installments_count,
|
|
2475
|
+
eligible = payment.eligible,
|
|
2476
|
+
purchaseAmount = payment.purchase_amount,
|
|
2477
|
+
_payment$minAmount = payment.minAmount,
|
|
2478
|
+
minAmount = _payment$minAmount === void 0 ? 0 : _payment$minAmount,
|
|
2479
|
+
_payment$maxAmount = payment.maxAmount,
|
|
2480
|
+
maxAmount = _payment$maxAmount === void 0 ? 0 : _payment$maxAmount,
|
|
2481
|
+
payment_plan = payment.payment_plan;
|
|
2509
2482
|
var deferredDaysCount = deferred_days + deferred_months * 30;
|
|
2510
|
-
|
|
2511
2483
|
if (!eligible) {
|
|
2512
|
-
return purchaseAmount > maxAmount ? /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2484
|
+
return purchaseAmount > maxAmount ? ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2513
2485
|
id: "payment-plan-strings.ineligible-greater-than-max",
|
|
2514
2486
|
defaultMessage: "Jusqu'\xE0 {maxAmount}",
|
|
2515
2487
|
values: {
|
|
2516
|
-
maxAmount: /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2488
|
+
maxAmount: ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2517
2489
|
value: priceFromCents(maxAmount),
|
|
2518
2490
|
style: "currency",
|
|
2519
2491
|
currency: "EUR"
|
|
2520
|
-
})
|
|
2492
|
+
}))
|
|
2521
2493
|
}
|
|
2522
|
-
}) : /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2494
|
+
})) : ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2523
2495
|
id: "payment-plan-strings.ineligible-lower-than-min",
|
|
2524
2496
|
defaultMessage: "\xC0 partir de {minAmount}",
|
|
2525
2497
|
values: {
|
|
2526
|
-
minAmount: /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2498
|
+
minAmount: ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2527
2499
|
value: priceFromCents(minAmount),
|
|
2528
2500
|
style: "currency",
|
|
2529
2501
|
currency: "EUR"
|
|
2530
|
-
})
|
|
2502
|
+
}))
|
|
2531
2503
|
}
|
|
2532
|
-
});
|
|
2504
|
+
}));
|
|
2533
2505
|
} else if (!payment_plan) {
|
|
2534
2506
|
/* This error should never happen. We added this condition to avoid a typescript warning on
|
|
2535
2507
|
payment_plan possibly undefined. As far as we know, it only happens when the plan is not
|
|
@@ -2540,127 +2512,130 @@ var paymentPlanInfoText = function paymentPlanInfoText(payment) {
|
|
|
2540
2512
|
id: "payment-plan-strings.deferred",
|
|
2541
2513
|
defaultMessage: "{totalAmount} \xE0 payer le {dueDate}",
|
|
2542
2514
|
values: {
|
|
2543
|
-
totalAmount: /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2515
|
+
totalAmount: ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2544
2516
|
value: priceFromCents(payment_plan[0].total_amount),
|
|
2545
2517
|
style: "currency",
|
|
2546
2518
|
currency: "EUR"
|
|
2547
|
-
}),
|
|
2548
|
-
dueDate: /*#__PURE__*/React__default.createElement(reactIntl.FormattedDate, {
|
|
2519
|
+
})),
|
|
2520
|
+
dueDate: ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedDate, {
|
|
2549
2521
|
value: dateFns.secondsToMilliseconds(payment_plan[0].due_date),
|
|
2550
2522
|
day: "numeric",
|
|
2551
2523
|
month: "long",
|
|
2552
2524
|
year: "numeric"
|
|
2553
|
-
})
|
|
2525
|
+
}))
|
|
2554
2526
|
}
|
|
2555
2527
|
}), withNoFee(payment));
|
|
2556
2528
|
} else if (installmentsCount > 0) {
|
|
2557
2529
|
var areInstallmentsOfSameAmount = payment_plan == null ? void 0 : payment_plan.every(function (installment, index) {
|
|
2558
2530
|
return index === 0 || installment.total_amount === payment_plan[0].total_amount;
|
|
2559
2531
|
});
|
|
2560
|
-
|
|
2532
|
+
if (installmentsCount > 4) {
|
|
2533
|
+
return /*#__PURE__*/React__default.createElement("span", {
|
|
2534
|
+
className: s$3.openModalInfo
|
|
2535
|
+
}, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2536
|
+
id: "payment-plan-strings.credit",
|
|
2537
|
+
defaultMessage: "Cliquez pour en savoir plus",
|
|
2538
|
+
description: "Link to credit details"
|
|
2539
|
+
}));
|
|
2540
|
+
}
|
|
2561
2541
|
if (isP1X(payment)) {
|
|
2562
2542
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2563
2543
|
id: "payment-plan-strings.pay-now",
|
|
2564
2544
|
defaultMessage: "Payer maintenant {totalAmount}",
|
|
2565
2545
|
values: {
|
|
2566
|
-
totalAmount: /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2546
|
+
totalAmount: ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2567
2547
|
value: priceFromCents(payment_plan[0].total_amount),
|
|
2568
2548
|
style: "currency",
|
|
2569
2549
|
currency: "EUR"
|
|
2570
|
-
}),
|
|
2550
|
+
})),
|
|
2571
2551
|
installmentsCount: installmentsCount
|
|
2572
2552
|
}
|
|
2573
2553
|
}), withNoFee(payment));
|
|
2574
2554
|
}
|
|
2575
|
-
|
|
2576
2555
|
if (areInstallmentsOfSameAmount) {
|
|
2577
2556
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2578
2557
|
id: "payment-plan-strings.multiple-installments-same-amount",
|
|
2579
2558
|
defaultMessage: "{installmentsCount} x {totalAmount}",
|
|
2580
2559
|
values: {
|
|
2581
|
-
totalAmount: /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2560
|
+
totalAmount: ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2582
2561
|
value: priceFromCents(payment_plan[0].total_amount),
|
|
2583
2562
|
style: "currency",
|
|
2584
2563
|
currency: "EUR"
|
|
2585
|
-
}),
|
|
2564
|
+
})),
|
|
2586
2565
|
installmentsCount: installmentsCount
|
|
2587
2566
|
}
|
|
2588
2567
|
}), withNoFee(payment));
|
|
2589
2568
|
}
|
|
2590
|
-
|
|
2591
2569
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2592
2570
|
id: "payment-plan-strings.multiple-installments",
|
|
2593
2571
|
defaultMessage: "{numberOfRemainingInstallments, plural, one {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}} other {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}}}",
|
|
2594
2572
|
values: {
|
|
2595
|
-
firstInstallmentAmount: /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2573
|
+
firstInstallmentAmount: ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2596
2574
|
value: priceFromCents(payment_plan[0].total_amount),
|
|
2597
2575
|
style: "currency",
|
|
2598
2576
|
currency: "EUR"
|
|
2599
|
-
}),
|
|
2577
|
+
})),
|
|
2600
2578
|
numberOfRemainingInstallments: installmentsCount - 1,
|
|
2601
|
-
othersInstallmentAmount: /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2579
|
+
othersInstallmentAmount: ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2602
2580
|
value: priceFromCents(payment_plan[1].total_amount),
|
|
2603
2581
|
style: "currency",
|
|
2604
2582
|
currency: "EUR"
|
|
2605
|
-
})
|
|
2583
|
+
}))
|
|
2606
2584
|
}
|
|
2607
2585
|
}), withNoFee(payment));
|
|
2608
2586
|
}
|
|
2609
|
-
|
|
2610
2587
|
return /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2611
2588
|
id: "payment-plan-strings.default-message",
|
|
2612
2589
|
defaultMessage: "Payez en plusieurs fois avec Alma"
|
|
2613
2590
|
});
|
|
2614
2591
|
};
|
|
2615
2592
|
|
|
2616
|
-
var s$
|
|
2593
|
+
var s$4 = {"buttons":"_1l2Oa","active":"_3rue7","textButton":"_2T78a"};
|
|
2617
2594
|
|
|
2618
2595
|
var EligibilityPlansButtons = function EligibilityPlansButtons(_ref) {
|
|
2619
2596
|
var eligibilityPlans = _ref.eligibilityPlans,
|
|
2620
|
-
|
|
2621
|
-
|
|
2597
|
+
currentPlanIndex = _ref.currentPlanIndex,
|
|
2598
|
+
setCurrentPlanIndex = _ref.setCurrentPlanIndex;
|
|
2622
2599
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2623
|
-
className: cx(s$
|
|
2600
|
+
className: cx(s$4.buttons, STATIC_CUSTOMISATION_CLASSES.eligibilityOptions)
|
|
2624
2601
|
}, eligibilityPlans.map(function (eligibilityPlan, index) {
|
|
2625
2602
|
var _cx;
|
|
2626
|
-
|
|
2627
2603
|
return /*#__PURE__*/React__default.createElement("button", {
|
|
2628
2604
|
key: index,
|
|
2629
|
-
className: cx((_cx = {}, _cx[cx(s$
|
|
2605
|
+
className: cx((_cx = {}, _cx[cx(s$4.active, STATIC_CUSTOMISATION_CLASSES.activeOption)] = index === currentPlanIndex, _cx)),
|
|
2630
2606
|
onClick: function onClick() {
|
|
2631
2607
|
return setCurrentPlanIndex(index);
|
|
2632
2608
|
}
|
|
2633
2609
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
2634
|
-
className: s$
|
|
2610
|
+
className: s$4.textButton
|
|
2635
2611
|
}, paymentPlanShorthandName(eligibilityPlan)));
|
|
2636
2612
|
}));
|
|
2637
2613
|
};
|
|
2638
2614
|
|
|
2639
|
-
var s$
|
|
2615
|
+
var s$5 = {"installment":"_z2Uiv","date":"_2lJQy","dot":"_1Z9wr","isCurrent":"_2Nmkl","bold":"_ezY-3"};
|
|
2640
2616
|
|
|
2641
2617
|
var Installment = function Installment(_ref) {
|
|
2642
2618
|
var _cx, _cx2;
|
|
2643
|
-
|
|
2644
2619
|
var installment = _ref.installment,
|
|
2645
|
-
|
|
2620
|
+
index = _ref.index;
|
|
2646
2621
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2647
|
-
className: s$
|
|
2622
|
+
className: s$5.installment,
|
|
2648
2623
|
"data-testid": "installment-" + index
|
|
2649
2624
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2650
|
-
className: s$
|
|
2625
|
+
className: s$5.date
|
|
2651
2626
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2652
|
-
className: cx(s$
|
|
2653
|
-
}), dateFns.isToday(installment.due_date * 1000) ? /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2627
|
+
className: cx(s$5.dot, (_cx = {}, _cx[s$5.isCurrent] = index === 0, _cx))
|
|
2628
|
+
}), dateFns.isToday(installment.due_date * 1000) ? ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2654
2629
|
id: "installments.today",
|
|
2655
2630
|
defaultMessage: "Aujourd'hui",
|
|
2656
2631
|
tagName: "strong"
|
|
2657
|
-
}) : /*#__PURE__*/React__default.createElement(reactIntl.FormattedDate, {
|
|
2632
|
+
})) : ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedDate, {
|
|
2658
2633
|
value: installment.due_date * 1000,
|
|
2659
2634
|
day: "numeric",
|
|
2660
2635
|
month: "long",
|
|
2661
2636
|
year: "numeric"
|
|
2662
|
-
})), /*#__PURE__*/React__default.createElement("div", {
|
|
2663
|
-
className: cx((_cx2 = {}, _cx2[s$
|
|
2637
|
+
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
2638
|
+
className: cx((_cx2 = {}, _cx2[s$5.bold] = index === 0, _cx2))
|
|
2664
2639
|
}, /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2665
2640
|
value: installment.total_amount / 100,
|
|
2666
2641
|
style: "currency",
|
|
@@ -2668,13 +2643,12 @@ var Installment = function Installment(_ref) {
|
|
|
2668
2643
|
})));
|
|
2669
2644
|
};
|
|
2670
2645
|
|
|
2671
|
-
var s$
|
|
2646
|
+
var s$6 = {"schedule":"_MPKjS"};
|
|
2672
2647
|
|
|
2673
2648
|
var Schedule = function Schedule(_ref) {
|
|
2674
2649
|
var currentPlan = _ref.currentPlan;
|
|
2675
|
-
var isCredit = currentPlan.installments_count > 4;
|
|
2676
2650
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
2677
|
-
className: cx(s$
|
|
2651
|
+
className: cx(s$6.schedule, STATIC_CUSTOMISATION_CLASSES.scheduleDetails),
|
|
2678
2652
|
"data-testid": "modal-installments-element"
|
|
2679
2653
|
}, ((currentPlan == null ? void 0 : currentPlan.payment_plan) || []).map(function (installment, index) {
|
|
2680
2654
|
return /*#__PURE__*/React__default.createElement(Installment, {
|
|
@@ -2682,20 +2656,14 @@ var Schedule = function Schedule(_ref) {
|
|
|
2682
2656
|
installment: installment,
|
|
2683
2657
|
index: index
|
|
2684
2658
|
});
|
|
2685
|
-
})
|
|
2686
|
-
className: s$5.creditInfo
|
|
2687
|
-
}, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2688
|
-
id: "credit-features.information",
|
|
2689
|
-
defaultMessage: "Un cr\xE9dit vous engage et doit \xEAtre rembours\xE9. V\xE9rifiez vos capacit\xE9s de remboursement avant de vous engager."
|
|
2690
|
-
}))));
|
|
2659
|
+
})));
|
|
2691
2660
|
};
|
|
2692
2661
|
|
|
2693
2662
|
var _excluded$1 = ["color"];
|
|
2694
2663
|
var AlmaLogo = function AlmaLogo(_ref) {
|
|
2695
2664
|
var _ref$color = _ref.color,
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2665
|
+
color = _ref$color === void 0 ? '#FA5022' : _ref$color,
|
|
2666
|
+
svgProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
2699
2667
|
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
2700
2668
|
width: "50",
|
|
2701
2669
|
height: "25",
|
|
@@ -2861,7 +2829,7 @@ var CbCard = function CbCard() {
|
|
|
2861
2829
|
}))));
|
|
2862
2830
|
};
|
|
2863
2831
|
|
|
2864
|
-
var s$
|
|
2832
|
+
var s$7 = {"cardContainer":"_1N3yO"};
|
|
2865
2833
|
|
|
2866
2834
|
var Cards = function Cards(_ref) {
|
|
2867
2835
|
var cards = _ref.cards;
|
|
@@ -2869,17 +2837,17 @@ var Cards = function Cards(_ref) {
|
|
|
2869
2837
|
var uniqueCards = Array.from(new Set(cards));
|
|
2870
2838
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2871
2839
|
"data-testid": "card-logos",
|
|
2872
|
-
className: cx(s$
|
|
2840
|
+
className: cx(s$7.cardContainer, STATIC_CUSTOMISATION_CLASSES.cardContainer)
|
|
2873
2841
|
}, uniqueCards.map(function (card) {
|
|
2874
2842
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2875
2843
|
key: card,
|
|
2876
|
-
className: s$
|
|
2844
|
+
className: s$7.card,
|
|
2877
2845
|
"data-testid": "card-logo-" + card
|
|
2878
2846
|
}, card === 'cb' && /*#__PURE__*/React__default.createElement(CbCard, null), card === 'amex' && /*#__PURE__*/React__default.createElement(AmexCard, null), card === 'mastercard' && /*#__PURE__*/React__default.createElement(MasterCard, null), card === 'visa' && /*#__PURE__*/React__default.createElement(VisaCard, null));
|
|
2879
2847
|
}));
|
|
2880
2848
|
};
|
|
2881
2849
|
|
|
2882
|
-
var s$
|
|
2850
|
+
var s$8 = {"list":"_180ro","listItem":"_1HqCO","bullet":"_3B8wx"};
|
|
2883
2851
|
|
|
2884
2852
|
var Info = function Info(_ref) {
|
|
2885
2853
|
var isCurrentPlanP1X = _ref.isCurrentPlanP1X;
|
|
@@ -2887,15 +2855,15 @@ var Info = function Info(_ref) {
|
|
|
2887
2855
|
/*#__PURE__*/
|
|
2888
2856
|
// TODO: refactor this component into subcomponent to factorise code and be cleaner
|
|
2889
2857
|
React__default.createElement("div", {
|
|
2890
|
-
className: cx(s$
|
|
2858
|
+
className: cx(s$8.list, STATIC_CUSTOMISATION_CLASSES.info),
|
|
2891
2859
|
"data-testid": "modal-info-element"
|
|
2892
2860
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2893
|
-
className: s$
|
|
2861
|
+
className: s$8.listItem
|
|
2894
2862
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2895
|
-
className: cx(s$
|
|
2863
|
+
className: cx(s$8.bullet, STATIC_CUSTOMISATION_CLASSES.bullet)
|
|
2896
2864
|
}, "1"), /*#__PURE__*/React__default.createElement("div", {
|
|
2897
2865
|
className: STATIC_CUSTOMISATION_CLASSES.infoMessage
|
|
2898
|
-
}, isCurrentPlanP1X ? /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2866
|
+
}, isCurrentPlanP1X ? ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2899
2867
|
id: "eligibility-modal.p1x-bullet-1",
|
|
2900
2868
|
defaultMessage: "Choisissez <strong>Alma - Payer maintenant</strong> au moment du paiement.",
|
|
2901
2869
|
values: {
|
|
@@ -2903,7 +2871,7 @@ var Info = function Info(_ref) {
|
|
|
2903
2871
|
return /*#__PURE__*/React__default.createElement("strong", null, [].slice.call(arguments));
|
|
2904
2872
|
}
|
|
2905
2873
|
}
|
|
2906
|
-
}) : /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2874
|
+
})) : ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2907
2875
|
id: "eligibility-modal.bullet-1",
|
|
2908
2876
|
defaultMessage: "Choisissez <strong>Alma</strong> au moment du paiement.",
|
|
2909
2877
|
values: {
|
|
@@ -2911,13 +2879,13 @@ var Info = function Info(_ref) {
|
|
|
2911
2879
|
return /*#__PURE__*/React__default.createElement("strong", null, [].slice.call(arguments));
|
|
2912
2880
|
}
|
|
2913
2881
|
}
|
|
2914
|
-
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
2915
|
-
className: s$
|
|
2882
|
+
})))), /*#__PURE__*/React__default.createElement("div", {
|
|
2883
|
+
className: s$8.listItem
|
|
2916
2884
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2917
|
-
className: cx(s$
|
|
2885
|
+
className: cx(s$8.bullet, STATIC_CUSTOMISATION_CLASSES.bullet)
|
|
2918
2886
|
}, "2"), /*#__PURE__*/React__default.createElement("div", {
|
|
2919
2887
|
className: STATIC_CUSTOMISATION_CLASSES.infoMessage
|
|
2920
|
-
}, isCurrentPlanP1X ? /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2888
|
+
}, isCurrentPlanP1X ? ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2921
2889
|
id: "eligibility-modal.p1x-bullet-2",
|
|
2922
2890
|
defaultMessage: "Renseignez les informations de votre <strong>carte bancaire.</strong>",
|
|
2923
2891
|
values: {
|
|
@@ -2925,7 +2893,7 @@ var Info = function Info(_ref) {
|
|
|
2925
2893
|
return /*#__PURE__*/React__default.createElement("strong", null, [].slice.call(arguments));
|
|
2926
2894
|
}
|
|
2927
2895
|
}
|
|
2928
|
-
}) : /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2896
|
+
})) : ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2929
2897
|
id: "eligibility-modal.bullet-2",
|
|
2930
2898
|
defaultMessage: "Laissez-vous guider et validez votre paiement en <strong>2 minutes.</strong>",
|
|
2931
2899
|
values: {
|
|
@@ -2933,13 +2901,13 @@ var Info = function Info(_ref) {
|
|
|
2933
2901
|
return /*#__PURE__*/React__default.createElement("strong", null, [].slice.call(arguments));
|
|
2934
2902
|
}
|
|
2935
2903
|
}
|
|
2936
|
-
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
2937
|
-
className: s$
|
|
2904
|
+
})))), /*#__PURE__*/React__default.createElement("div", {
|
|
2905
|
+
className: s$8.listItem
|
|
2938
2906
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2939
|
-
className: cx(s$
|
|
2907
|
+
className: cx(s$8.bullet, STATIC_CUSTOMISATION_CLASSES.bullet)
|
|
2940
2908
|
}, "3"), /*#__PURE__*/React__default.createElement("div", {
|
|
2941
2909
|
className: STATIC_CUSTOMISATION_CLASSES.infoMessage
|
|
2942
|
-
}, isCurrentPlanP1X ? /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2910
|
+
}, isCurrentPlanP1X ? ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2943
2911
|
id: "eligibility-modal.p1x-bullet-3",
|
|
2944
2912
|
defaultMessage: "<strong>La validation </strong> de votre paiement est instantan\xE9e !",
|
|
2945
2913
|
values: {
|
|
@@ -2947,7 +2915,7 @@ var Info = function Info(_ref) {
|
|
|
2947
2915
|
return /*#__PURE__*/React__default.createElement("strong", null, [].slice.call(arguments));
|
|
2948
2916
|
}
|
|
2949
2917
|
}
|
|
2950
|
-
}) : /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2918
|
+
})) : ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2951
2919
|
id: "eligibility-modal.bullet-3",
|
|
2952
2920
|
defaultMessage: "<strong>Gardez le contr\xF4le</strong> en avan\xE7ant ou reculant vos \xE9ch\xE9ances \xE0 votre rythme.",
|
|
2953
2921
|
values: {
|
|
@@ -2955,42 +2923,42 @@ var Info = function Info(_ref) {
|
|
|
2955
2923
|
return /*#__PURE__*/React__default.createElement("strong", null, [].slice.call(arguments));
|
|
2956
2924
|
}
|
|
2957
2925
|
}
|
|
2958
|
-
}))))
|
|
2926
|
+
})))))
|
|
2959
2927
|
);
|
|
2960
2928
|
};
|
|
2961
2929
|
|
|
2962
|
-
var s$
|
|
2930
|
+
var s$9 = {"title":"_3ERx-"};
|
|
2963
2931
|
|
|
2964
2932
|
var Title = function Title(_ref) {
|
|
2965
2933
|
var isSomePlanDeferred = _ref.isSomePlanDeferred,
|
|
2966
|
-
|
|
2934
|
+
isCurrentPlanP1X = _ref.isCurrentPlanP1X;
|
|
2967
2935
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2968
|
-
className: cx(s$
|
|
2936
|
+
className: cx(s$9.title, STATIC_CUSTOMISATION_CLASSES.title),
|
|
2969
2937
|
"data-testid": "modal-title-element"
|
|
2970
|
-
}, isSomePlanDeferred ? /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2938
|
+
}, isSomePlanDeferred ? ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2971
2939
|
id: "eligibility-modal.title-deferred-plan",
|
|
2972
2940
|
defaultMessage: "Payez en plusieurs fois ou plus tard par carte bancaire avec Alma."
|
|
2973
|
-
}) : isCurrentPlanP1X ? /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2941
|
+
})) : isCurrentPlanP1X ? ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2974
2942
|
id: "eligibility-modal.title-pay-now",
|
|
2975
2943
|
defaultMessage: "Payez comptant par carte bancaire avec Alma."
|
|
2976
|
-
}) : /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2944
|
+
})) : ( /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2977
2945
|
id: "eligibility-modal.title-normal",
|
|
2978
2946
|
defaultMessage: "Payez en plusieurs fois par carte bancaire avec Alma."
|
|
2979
|
-
}));
|
|
2947
|
+
})));
|
|
2980
2948
|
};
|
|
2981
2949
|
|
|
2982
|
-
var s$
|
|
2950
|
+
var s$a = {"container":"_21g6u","block":"_3zaP5","left":"_2SBRC","logo":"_xW3wt"};
|
|
2983
2951
|
|
|
2984
2952
|
var DesktopModal = function DesktopModal(_ref) {
|
|
2985
2953
|
var children = _ref.children,
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2954
|
+
isSomePlanDeferred = _ref.isSomePlanDeferred,
|
|
2955
|
+
cards = _ref.cards,
|
|
2956
|
+
isCurrentPlanP1X = _ref.isCurrentPlanP1X;
|
|
2989
2957
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2990
|
-
className: cx(s$
|
|
2958
|
+
className: cx(s$a.container, STATIC_CUSTOMISATION_CLASSES.desktopModal),
|
|
2991
2959
|
"data-testid": "modal-container"
|
|
2992
2960
|
}, /*#__PURE__*/React__default.createElement("aside", {
|
|
2993
|
-
className: cx([s$
|
|
2961
|
+
className: cx([s$a.block, s$a.left, STATIC_CUSTOMISATION_CLASSES.leftSide])
|
|
2994
2962
|
}, /*#__PURE__*/React__default.createElement(Title, {
|
|
2995
2963
|
isSomePlanDeferred: isSomePlanDeferred,
|
|
2996
2964
|
isCurrentPlanP1X: isCurrentPlanP1X
|
|
@@ -2999,24 +2967,24 @@ var DesktopModal = function DesktopModal(_ref) {
|
|
|
2999
2967
|
}), cards && /*#__PURE__*/React__default.createElement(Cards, {
|
|
3000
2968
|
cards: cards
|
|
3001
2969
|
}), /*#__PURE__*/React__default.createElement(AlmaLogo, {
|
|
3002
|
-
className: s$
|
|
2970
|
+
className: s$a.logo,
|
|
3003
2971
|
width: "75"
|
|
3004
2972
|
})), /*#__PURE__*/React__default.createElement("div", {
|
|
3005
|
-
className: cx(s$
|
|
2973
|
+
className: cx(s$a.block, STATIC_CUSTOMISATION_CLASSES.rightSide)
|
|
3006
2974
|
}, children));
|
|
3007
2975
|
};
|
|
3008
2976
|
|
|
3009
|
-
var s$
|
|
2977
|
+
var s$b = {"noEligibility":"_17qNJ","loader":"_2oTJq","scheduleArea":"_2u9rj","verticalLine":"_VRdAU"};
|
|
3010
2978
|
|
|
3011
|
-
var s$
|
|
2979
|
+
var s$c = {"container":"_2G7Ch","logo":"_2779r"};
|
|
3012
2980
|
|
|
3013
2981
|
var MobileModal = function MobileModal(_ref) {
|
|
3014
2982
|
var children = _ref.children,
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
2983
|
+
isSomePlanDeferred = _ref.isSomePlanDeferred,
|
|
2984
|
+
cards = _ref.cards,
|
|
2985
|
+
isCurrentPlanP1X = _ref.isCurrentPlanP1X;
|
|
3018
2986
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
3019
|
-
className: cx(s$
|
|
2987
|
+
className: cx(s$c.container, STATIC_CUSTOMISATION_CLASSES.mobileModal),
|
|
3020
2988
|
"data-testid": "modal-container"
|
|
3021
2989
|
}, /*#__PURE__*/React__default.createElement(Title, {
|
|
3022
2990
|
isSomePlanDeferred: isSomePlanDeferred,
|
|
@@ -3026,22 +2994,20 @@ var MobileModal = function MobileModal(_ref) {
|
|
|
3026
2994
|
}), cards && /*#__PURE__*/React__default.createElement(Cards, {
|
|
3027
2995
|
cards: cards
|
|
3028
2996
|
}), /*#__PURE__*/React__default.createElement(AlmaLogo, {
|
|
3029
|
-
className: s$
|
|
2997
|
+
className: s$c.logo,
|
|
3030
2998
|
width: "75"
|
|
3031
2999
|
}));
|
|
3032
3000
|
};
|
|
3033
3001
|
|
|
3034
3002
|
var EligibilityModal = function EligibilityModal(_ref) {
|
|
3035
3003
|
var initialPlanIndex = _ref.initialPlanIndex,
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3004
|
+
onClose = _ref.onClose,
|
|
3005
|
+
eligibilityPlans = _ref.eligibilityPlans,
|
|
3006
|
+
status = _ref.status,
|
|
3007
|
+
cards = _ref.cards;
|
|
3041
3008
|
var _useState = React.useState(initialPlanIndex || 0),
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3009
|
+
currentPlanIndex = _useState[0],
|
|
3010
|
+
setCurrentPlanIndex = _useState[1];
|
|
3045
3011
|
var isBigScreen = reactResponsive.useMediaQuery({
|
|
3046
3012
|
minWidth: desktopWidth
|
|
3047
3013
|
});
|
|
@@ -3062,45 +3028,42 @@ var EligibilityModal = function EligibilityModal(_ref) {
|
|
|
3062
3028
|
isSomePlanDeferred: isSomePlanDeferred,
|
|
3063
3029
|
cards: cards,
|
|
3064
3030
|
isCurrentPlanP1X: isP1X(currentPlan)
|
|
3065
|
-
}, status ===
|
|
3066
|
-
className: s$
|
|
3067
|
-
}, /*#__PURE__*/React__default.createElement(LoadingIndicator, null)), status ===
|
|
3068
|
-
className: s$
|
|
3031
|
+
}, status === statusResponse.PENDING && ( /*#__PURE__*/React__default.createElement("div", {
|
|
3032
|
+
className: s$b.loader
|
|
3033
|
+
}, /*#__PURE__*/React__default.createElement(LoadingIndicator, null))), status === statusResponse.SUCCESS && eligiblePlans.length === 0 && ( /*#__PURE__*/React__default.createElement("div", {
|
|
3034
|
+
className: s$b.noEligibility
|
|
3069
3035
|
}, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
3070
3036
|
id: "eligibility-modal.no-eligibility",
|
|
3071
3037
|
defaultMessage: "Oups, il semblerait que la simulation n'ait pas fonctionn\xE9."
|
|
3072
|
-
})), status ===
|
|
3038
|
+
}))), status === statusResponse.SUCCESS && eligiblePlans.length >= 1 && ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(EligibilityPlansButtons, {
|
|
3073
3039
|
eligibilityPlans: eligiblePlans,
|
|
3074
3040
|
currentPlanIndex: currentPlanIndex,
|
|
3075
3041
|
setCurrentPlanIndex: setCurrentPlanIndex
|
|
3076
3042
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
3077
|
-
className: s$
|
|
3043
|
+
className: s$b.scheduleArea
|
|
3078
3044
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
3079
|
-
className: s$
|
|
3045
|
+
className: s$b.verticalLine
|
|
3080
3046
|
}), /*#__PURE__*/React__default.createElement(Schedule, {
|
|
3081
3047
|
currentPlan: currentPlan
|
|
3082
3048
|
}), /*#__PURE__*/React__default.createElement(TotalBlock, {
|
|
3083
3049
|
currentPlan: currentPlan
|
|
3084
|
-
})))));
|
|
3050
|
+
}))))));
|
|
3085
3051
|
};
|
|
3086
3052
|
|
|
3087
3053
|
/**
|
|
3088
3054
|
* This component allows to display only the modal, without PaymentPlans.
|
|
3089
3055
|
*/
|
|
3090
|
-
|
|
3091
3056
|
var ModalContainer = function ModalContainer(_ref) {
|
|
3092
3057
|
var purchaseAmount = _ref.purchaseAmount,
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3058
|
+
apiData = _ref.apiData,
|
|
3059
|
+
configPlans = _ref.configPlans,
|
|
3060
|
+
customerBillingCountry = _ref.customerBillingCountry,
|
|
3061
|
+
customerShippingCountry = _ref.customerShippingCountry,
|
|
3062
|
+
onClose = _ref.onClose,
|
|
3063
|
+
cards = _ref.cards;
|
|
3100
3064
|
var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans, customerBillingCountry, customerShippingCountry),
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3065
|
+
eligibilityPlans = _useFetchEligibility[0],
|
|
3066
|
+
status = _useFetchEligibility[1];
|
|
3104
3067
|
return /*#__PURE__*/React__default.createElement(EligibilityModal, {
|
|
3105
3068
|
initialPlanIndex: 0,
|
|
3106
3069
|
onClose: onClose,
|
|
@@ -3110,37 +3073,33 @@ var ModalContainer = function ModalContainer(_ref) {
|
|
|
3110
3073
|
});
|
|
3111
3074
|
};
|
|
3112
3075
|
|
|
3113
|
-
var s$
|
|
3076
|
+
var s$d = {"loadingIndicator":"_2SwwZ","line1":"_2qODo","line2":"_2YO01"};
|
|
3114
3077
|
|
|
3115
3078
|
var Loader = function Loader(_ref) {
|
|
3116
3079
|
var className = _ref.className;
|
|
3117
3080
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
3118
|
-
className: cx(s$
|
|
3081
|
+
className: cx(s$d.loadingIndicator, className),
|
|
3119
3082
|
"data-testid": "loader"
|
|
3120
3083
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
3121
|
-
className: s$
|
|
3084
|
+
className: s$d.line1
|
|
3122
3085
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
3123
|
-
className: s$
|
|
3086
|
+
className: s$d.line2
|
|
3124
3087
|
}));
|
|
3125
3088
|
};
|
|
3126
3089
|
|
|
3127
3090
|
var useButtonAnimation = function useButtonAnimation(iterateValues, transitionDelay) {
|
|
3128
3091
|
var _useState = React.useState(0),
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3092
|
+
current = _useState[0],
|
|
3093
|
+
setCurrent = _useState[1];
|
|
3132
3094
|
var _useState2 = React.useState(true),
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3095
|
+
update = _useState2[0],
|
|
3096
|
+
setUpdate = _useState2[1];
|
|
3136
3097
|
React.useEffect(function () {
|
|
3137
3098
|
var timeout;
|
|
3138
3099
|
var isMounted = true;
|
|
3139
|
-
|
|
3140
3100
|
if (transitionDelay === -1) {
|
|
3141
3101
|
return;
|
|
3142
3102
|
}
|
|
3143
|
-
|
|
3144
3103
|
if (iterateValues.length !== 0) {
|
|
3145
3104
|
if (!iterateValues.includes(current) && update) setCurrent(iterateValues[0]);
|
|
3146
3105
|
timeout = setTimeout(function () {
|
|
@@ -3149,7 +3108,6 @@ var useButtonAnimation = function useButtonAnimation(iterateValues, transitionDe
|
|
|
3149
3108
|
}
|
|
3150
3109
|
}, transitionDelay);
|
|
3151
3110
|
}
|
|
3152
|
-
|
|
3153
3111
|
return function () {
|
|
3154
3112
|
isMounted = false;
|
|
3155
3113
|
clearTimeout(timeout);
|
|
@@ -3176,30 +3134,27 @@ var useButtonAnimation = function useButtonAnimation(iterateValues, transitionDe
|
|
|
3176
3134
|
*/
|
|
3177
3135
|
var getIndexOfActivePlan = function getIndexOfActivePlan(_ref) {
|
|
3178
3136
|
var suggestedPaymentPlan = _ref.suggestedPaymentPlan,
|
|
3179
|
-
|
|
3137
|
+
eligibilityPlans = _ref.eligibilityPlans;
|
|
3180
3138
|
var suggestedPaymentPlanArray = Array.isArray(suggestedPaymentPlan) ? suggestedPaymentPlan : [suggestedPaymentPlan];
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
}
|
|
3194
|
-
}
|
|
3195
|
-
|
|
3196
|
-
|
|
3139
|
+
var _loop = function _loop() {
|
|
3140
|
+
var installmentsCount = suggestedPaymentPlanArray[index];
|
|
3141
|
+
var planFound = eligibilityPlans.findIndex(function (plan) {
|
|
3142
|
+
return plan.installments_count === installmentsCount && plan.eligible &&
|
|
3143
|
+
// Remove the PayLater plans from the plan to target, we will code a better solution later
|
|
3144
|
+
// To differentiate P1X from PayLater while using the `suggestedPaymentPlan` property.
|
|
3145
|
+
!plan.deferred_days && !plan.deferred_months;
|
|
3146
|
+
});
|
|
3147
|
+
if (planFound !== -1) {
|
|
3148
|
+
return {
|
|
3149
|
+
v: planFound
|
|
3150
|
+
};
|
|
3151
|
+
}
|
|
3152
|
+
},
|
|
3153
|
+
_ret;
|
|
3197
3154
|
for (var index in suggestedPaymentPlanArray) {
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
if (typeof _ret === "object") return _ret.v;
|
|
3155
|
+
_ret = _loop();
|
|
3156
|
+
if (_ret) return _ret.v;
|
|
3201
3157
|
}
|
|
3202
|
-
|
|
3203
3158
|
return 0;
|
|
3204
3159
|
};
|
|
3205
3160
|
|
|
@@ -3211,7 +3166,6 @@ var prefix$1 = 'alma-payment-plans';
|
|
|
3211
3166
|
* Class names for the **payment plans** widget.
|
|
3212
3167
|
* Those classes are intended to be used by the **merchant developer**.
|
|
3213
3168
|
*/
|
|
3214
|
-
|
|
3215
3169
|
var STATIC_CUSTOMISATION_CLASSES$1 = {
|
|
3216
3170
|
container: prefix$1 + '-container',
|
|
3217
3171
|
eligibilityLine: prefix$1 + '-eligibility-line',
|
|
@@ -3221,32 +3175,28 @@ var STATIC_CUSTOMISATION_CLASSES$1 = {
|
|
|
3221
3175
|
activeOption: prefix$1 + '-active-option'
|
|
3222
3176
|
};
|
|
3223
3177
|
|
|
3224
|
-
var s$
|
|
3178
|
+
var s$e = {"widgetButton":"_TSkFv","logo":"_LJ4nZ","primaryContainer":"_bMClc","paymentPlans":"_17c_S","plan":"_2Kqjn","active":"_3dG_J","monochrome":"_2hx83","notEligible":"_3O1bg","hideBorder":"_3_qcn","info":"_25GrF","loader":"_30j1O","pending":"_1ZDMS","clickable":"_UksZa","unClickable":"_1lr-q"};
|
|
3225
3179
|
|
|
3226
3180
|
var VERY_LONG_TIME_IN_MS = 1000 * 3600;
|
|
3227
3181
|
var DEFAULT_TRANSITION_TIME = 5500;
|
|
3228
|
-
|
|
3229
3182
|
var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
3230
3183
|
var _cx, _cx3;
|
|
3231
|
-
|
|
3232
3184
|
var apiData = _ref.apiData,
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3185
|
+
configPlans = _ref.configPlans,
|
|
3186
|
+
hideIfNotEligible = _ref.hideIfNotEligible,
|
|
3187
|
+
monochrome = _ref.monochrome,
|
|
3188
|
+
purchaseAmount = _ref.purchaseAmount,
|
|
3189
|
+
suggestedPaymentPlan = _ref.suggestedPaymentPlan,
|
|
3190
|
+
cards = _ref.cards,
|
|
3191
|
+
customerBillingCountry = _ref.customerBillingCountry,
|
|
3192
|
+
customerShippingCountry = _ref.customerShippingCountry,
|
|
3193
|
+
transitionDelay = _ref.transitionDelay,
|
|
3194
|
+
_ref$hideBorder = _ref.hideBorder,
|
|
3195
|
+
hideBorder = _ref$hideBorder === void 0 ? false : _ref$hideBorder,
|
|
3196
|
+
onModalClose = _ref.onModalClose;
|
|
3246
3197
|
var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans, customerBillingCountry, customerShippingCountry),
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3198
|
+
eligibilityPlans = _useFetchEligibility[0],
|
|
3199
|
+
status = _useFetchEligibility[1];
|
|
3250
3200
|
var eligiblePlans = eligibilityPlans.filter(function (plan) {
|
|
3251
3201
|
return plan.eligible;
|
|
3252
3202
|
});
|
|
@@ -3255,22 +3205,17 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
3255
3205
|
suggestedPaymentPlan: suggestedPaymentPlan != null ? suggestedPaymentPlan : 0
|
|
3256
3206
|
});
|
|
3257
3207
|
var isSuggestedPaymentPlanSpecified = suggestedPaymentPlan !== undefined; // 👈 The merchant decided to focus a tab
|
|
3258
|
-
|
|
3259
3208
|
var isTransitionSpecified = transitionDelay !== undefined; // 👈 The merchant has specified a transition time
|
|
3260
|
-
|
|
3261
3209
|
var _useState = React.useState(false),
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3210
|
+
isOpen = _useState[0],
|
|
3211
|
+
setIsOpen = _useState[1];
|
|
3265
3212
|
var openModal = function openModal() {
|
|
3266
3213
|
return setIsOpen(true);
|
|
3267
3214
|
};
|
|
3268
|
-
|
|
3269
3215
|
var closeModal = function closeModal(event) {
|
|
3270
3216
|
setIsOpen(false);
|
|
3271
3217
|
onModalClose && onModalClose(event);
|
|
3272
3218
|
};
|
|
3273
|
-
|
|
3274
3219
|
var eligiblePlanKeys = eligibilityPlans.reduce(function (acc, plan, index) {
|
|
3275
3220
|
return plan.eligible ? [].concat(acc, [index]) : acc;
|
|
3276
3221
|
}, []);
|
|
@@ -3280,29 +3225,23 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
3280
3225
|
* If none of those properties are specified, we set a default transition delay.
|
|
3281
3226
|
* @returns
|
|
3282
3227
|
*/
|
|
3283
|
-
|
|
3284
3228
|
var realTransitionTime = function realTransitionTime() {
|
|
3285
3229
|
if (isTransitionSpecified) {
|
|
3286
3230
|
return transitionDelay != null ? transitionDelay : DEFAULT_TRANSITION_TIME;
|
|
3287
3231
|
}
|
|
3288
|
-
|
|
3289
3232
|
if (isSuggestedPaymentPlanSpecified) {
|
|
3290
3233
|
return VERY_LONG_TIME_IN_MS;
|
|
3291
3234
|
}
|
|
3292
|
-
|
|
3293
3235
|
return DEFAULT_TRANSITION_TIME;
|
|
3294
3236
|
};
|
|
3295
|
-
|
|
3296
3237
|
var _useButtonAnimation = useButtonAnimation(eligiblePlanKeys, realTransitionTime()),
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3238
|
+
current = _useButtonAnimation.current,
|
|
3239
|
+
onHover = _useButtonAnimation.onHover,
|
|
3240
|
+
onLeave = _useButtonAnimation.onLeave;
|
|
3301
3241
|
React.useEffect(function () {
|
|
3302
3242
|
// When API has given a response AND the marchand set an active plan by default.
|
|
3303
|
-
if (status ===
|
|
3243
|
+
if (status === statusResponse.SUCCESS && isSuggestedPaymentPlanSpecified) {
|
|
3304
3244
|
onHover(activePlanIndex); // We select the first active plan possible
|
|
3305
|
-
|
|
3306
3245
|
onLeave(); // We need to call onLeave to reset the animation
|
|
3307
3246
|
}
|
|
3308
3247
|
}, [status]);
|
|
@@ -3312,46 +3251,39 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
3312
3251
|
* @param {number} planIndex - The index of the plan that the user has selected.
|
|
3313
3252
|
* @returns The index of the planKey in the eligiblePlanKeys array.
|
|
3314
3253
|
*/
|
|
3315
|
-
|
|
3316
3254
|
var getIndexWithinEligiblePlans = function getIndexWithinEligiblePlans(planIndex) {
|
|
3317
3255
|
var index = eligiblePlanKeys.findIndex(function (planKey) {
|
|
3318
3256
|
return planKey === planIndex;
|
|
3319
3257
|
});
|
|
3320
3258
|
return index === -1 ? 0 : index;
|
|
3321
3259
|
};
|
|
3322
|
-
|
|
3323
|
-
if (status === apiStatus.PENDING) {
|
|
3260
|
+
if (status === statusResponse.PENDING) {
|
|
3324
3261
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
3325
|
-
className: cx(s$
|
|
3262
|
+
className: cx(s$e.widgetButton, s$e.pending)
|
|
3326
3263
|
}, /*#__PURE__*/React__default.createElement(Loader, null));
|
|
3327
3264
|
}
|
|
3328
|
-
|
|
3329
|
-
if (hideIfNotEligible && eligiblePlans.length === 0 || eligibilityPlans.length === 0 || status === apiStatus.FAILED) {
|
|
3265
|
+
if (hideIfNotEligible && eligiblePlans.length === 0 || eligibilityPlans.length === 0 || status === statusResponse.FAILED) {
|
|
3330
3266
|
return null;
|
|
3331
3267
|
}
|
|
3332
|
-
|
|
3333
3268
|
var handleOpenModal = function handleOpenModal(e) {
|
|
3334
3269
|
e.preventDefault();
|
|
3335
|
-
|
|
3336
3270
|
if (eligiblePlans.length > 0) {
|
|
3337
3271
|
openModal();
|
|
3338
3272
|
}
|
|
3339
3273
|
};
|
|
3340
|
-
|
|
3341
3274
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
3342
3275
|
onClick: handleOpenModal,
|
|
3343
|
-
className: cx(s$
|
|
3276
|
+
className: cx(s$e.widgetButton, (_cx = {}, _cx[s$e.clickable] = eligiblePlans.length > 0, _cx[s$e.unClickable] = eligiblePlans.length === 0, _cx[s$e.hideBorder] = hideBorder, _cx), STATIC_CUSTOMISATION_CLASSES$1.container),
|
|
3344
3277
|
"data-testid": "widget-button"
|
|
3345
3278
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
3346
|
-
className: cx(s$
|
|
3279
|
+
className: cx(s$e.primaryContainer, STATIC_CUSTOMISATION_CLASSES$1.eligibilityLine)
|
|
3347
3280
|
}, /*#__PURE__*/React__default.createElement(AlmaLogo, {
|
|
3348
|
-
className: s$
|
|
3281
|
+
className: s$e.logo,
|
|
3349
3282
|
color: monochrome ? 'var(--off-black)' : undefined
|
|
3350
3283
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
3351
|
-
className: cx(s$
|
|
3284
|
+
className: cx(s$e.paymentPlans, STATIC_CUSTOMISATION_CLASSES$1.eligibilityOptions)
|
|
3352
3285
|
}, eligibilityPlans.map(function (eligibilityPlan, key) {
|
|
3353
3286
|
var _cx2;
|
|
3354
|
-
|
|
3355
3287
|
var isCurrent = key === current;
|
|
3356
3288
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
3357
3289
|
key: key,
|
|
@@ -3363,53 +3295,47 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
3363
3295
|
},
|
|
3364
3296
|
onMouseOut: onLeave,
|
|
3365
3297
|
onTouchEnd: onLeave,
|
|
3366
|
-
className: cx(s$
|
|
3298
|
+
className: cx(s$e.plan, (_cx2 = {}, _cx2[cx(s$e.active, STATIC_CUSTOMISATION_CLASSES$1.activeOption)] = isCurrent, _cx2[s$e.monochrome] = monochrome && isCurrent, _cx2[cx(s$e.notEligible, STATIC_CUSTOMISATION_CLASSES$1.notEligibleOption)] = !eligibilityPlan.eligible, _cx2))
|
|
3367
3299
|
}, paymentPlanShorthandName(eligibilityPlan));
|
|
3368
3300
|
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
3369
|
-
className: cx(s$
|
|
3370
|
-
}, eligibilityPlans.length !== 0 && paymentPlanInfoText(eligibilityPlans[current]))), isOpen && /*#__PURE__*/React__default.createElement(EligibilityModal, {
|
|
3301
|
+
className: cx(s$e.info, (_cx3 = {}, _cx3[cx(s$e.notEligible, STATIC_CUSTOMISATION_CLASSES$1.notEligibleOption)] = eligibilityPlans[current] && !eligibilityPlans[current].eligible, _cx3), STATIC_CUSTOMISATION_CLASSES$1.paymentInfo)
|
|
3302
|
+
}, eligibilityPlans.length !== 0 && paymentPlanInfoText(eligibilityPlans[current]))), isOpen && ( /*#__PURE__*/React__default.createElement(EligibilityModal, {
|
|
3371
3303
|
initialPlanIndex: getIndexWithinEligiblePlans(current),
|
|
3372
3304
|
onClose: closeModal,
|
|
3373
3305
|
eligibilityPlans: eligiblePlans,
|
|
3374
3306
|
status: status,
|
|
3375
3307
|
cards: cards
|
|
3376
|
-
}));
|
|
3308
|
+
})));
|
|
3377
3309
|
};
|
|
3378
3310
|
|
|
3379
3311
|
var WidgetsController = /*#__PURE__*/function () {
|
|
3380
3312
|
function WidgetsController(apiData) {
|
|
3381
3313
|
this.apiData = apiData;
|
|
3382
3314
|
}
|
|
3383
|
-
|
|
3384
3315
|
var _proto = WidgetsController.prototype;
|
|
3385
|
-
|
|
3386
3316
|
_proto.add = function add(widget, options) {
|
|
3387
3317
|
var _this = this;
|
|
3388
|
-
|
|
3389
3318
|
var containerDiv = document.querySelector(options.container);
|
|
3390
|
-
|
|
3391
3319
|
if (containerDiv) {
|
|
3392
3320
|
reactDom.unmountComponentAtNode(containerDiv);
|
|
3393
3321
|
}
|
|
3394
|
-
|
|
3395
3322
|
if (widget === widgetTypes.PaymentPlans) {
|
|
3396
3323
|
var container = options.container,
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3324
|
+
purchaseAmount = options.purchaseAmount,
|
|
3325
|
+
plans = options.plans,
|
|
3326
|
+
transitionDelay = options.transitionDelay,
|
|
3327
|
+
hideIfNotEligible = options.hideIfNotEligible,
|
|
3328
|
+
_options$hideBorder = options.hideBorder,
|
|
3329
|
+
hideBorder = _options$hideBorder === void 0 ? false : _options$hideBorder,
|
|
3330
|
+
_options$monochrome = options.monochrome,
|
|
3331
|
+
monochrome = _options$monochrome === void 0 ? true : _options$monochrome,
|
|
3332
|
+
suggestedPaymentPlan = options.suggestedPaymentPlan,
|
|
3333
|
+
customerBillingCountry = options.customerBillingCountry,
|
|
3334
|
+
customerShippingCountry = options.customerShippingCountry,
|
|
3335
|
+
_options$locale = options.locale,
|
|
3336
|
+
locale = _options$locale === void 0 ? Locale.en : _options$locale,
|
|
3337
|
+
cards = options.cards,
|
|
3338
|
+
onModalClose = options.onModalClose;
|
|
3413
3339
|
if (containerDiv) {
|
|
3414
3340
|
reactDom.render( /*#__PURE__*/React__default.createElement(Provider, {
|
|
3415
3341
|
locale: locale
|
|
@@ -3429,25 +3355,22 @@ var WidgetsController = /*#__PURE__*/function () {
|
|
|
3429
3355
|
})), document.querySelector(container));
|
|
3430
3356
|
}
|
|
3431
3357
|
}
|
|
3432
|
-
|
|
3433
3358
|
if (widget === widgetTypes.Modal) {
|
|
3434
3359
|
var _container = options.container,
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3360
|
+
clickableSelector = options.clickableSelector,
|
|
3361
|
+
_purchaseAmount = options.purchaseAmount,
|
|
3362
|
+
_plans = options.plans,
|
|
3363
|
+
_options$locale2 = options.locale,
|
|
3364
|
+
_locale = _options$locale2 === void 0 ? Locale.en : _options$locale2,
|
|
3365
|
+
_customerBillingCountry = options.customerBillingCountry,
|
|
3366
|
+
_customerShippingCountry = options.customerShippingCountry,
|
|
3367
|
+
_cards = options.cards,
|
|
3368
|
+
onClose = options.onClose;
|
|
3445
3369
|
var close = function close(event) {
|
|
3446
3370
|
if (!containerDiv) return;
|
|
3447
3371
|
reactDom.unmountComponentAtNode(containerDiv);
|
|
3448
3372
|
onClose && onClose(event);
|
|
3449
3373
|
};
|
|
3450
|
-
|
|
3451
3374
|
var renderModal = function renderModal() {
|
|
3452
3375
|
reactDom.render( /*#__PURE__*/React__default.createElement(Provider, {
|
|
3453
3376
|
locale: _locale
|
|
@@ -3460,22 +3383,18 @@ var WidgetsController = /*#__PURE__*/function () {
|
|
|
3460
3383
|
onClose: close,
|
|
3461
3384
|
cards: _cards
|
|
3462
3385
|
})), document.querySelector(_container));
|
|
3463
|
-
};
|
|
3464
|
-
|
|
3465
|
-
|
|
3386
|
+
};
|
|
3387
|
+
// if clickableSelector is provided, add an onClick event handler to open the Modal.
|
|
3466
3388
|
if (clickableSelector) {
|
|
3467
3389
|
var _document$querySelect;
|
|
3468
|
-
|
|
3469
|
-
(_document$querySelect = document.querySelector(clickableSelector)) == null ? void 0 : _document$querySelect.addEventListener('click', renderModal, false);
|
|
3390
|
+
(_document$querySelect = document.querySelector(clickableSelector)) == null || _document$querySelect.addEventListener('click', renderModal, false);
|
|
3470
3391
|
}
|
|
3471
|
-
|
|
3472
3392
|
return {
|
|
3473
3393
|
open: renderModal,
|
|
3474
3394
|
close: close
|
|
3475
3395
|
};
|
|
3476
3396
|
}
|
|
3477
3397
|
};
|
|
3478
|
-
|
|
3479
3398
|
return WidgetsController;
|
|
3480
3399
|
}();
|
|
3481
3400
|
|
|
@@ -3491,12 +3410,10 @@ var WidgetsController = /*#__PURE__*/function () {
|
|
|
3491
3410
|
merchantId: merchantId
|
|
3492
3411
|
});
|
|
3493
3412
|
}
|
|
3494
|
-
|
|
3495
3413
|
Widgets.initialize = initialize;
|
|
3496
3414
|
Widgets.PaymentPlans = widgetTypes.PaymentPlans;
|
|
3497
3415
|
Widgets.Modal = widgetTypes.Modal;
|
|
3498
|
-
})(exports.Widgets || (exports.Widgets = {}));
|
|
3499
|
-
|
|
3416
|
+
})(exports.Widgets || (exports.Widgets = {}));
|
|
3500
3417
|
(function (Utils) {
|
|
3501
3418
|
Utils.priceToCents = priceToCents;
|
|
3502
3419
|
Utils.priceFromCents = priceFromCents;
|