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