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