@alma/widgets 2.2.8 → 2.3.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/raw/widgets.css +590 -0
  3. package/dist/raw/widgets.js +2616 -0
  4. package/dist/raw/widgets.js.map +1 -0
  5. package/dist/raw/widgets.m.js +2622 -0
  6. package/dist/raw/widgets.m.js.map +1 -0
  7. package/dist/raw/widgets.modern.js +2521 -0
  8. package/dist/raw/widgets.modern.js.map +1 -0
  9. package/dist/raw/widgets.umd.js +18494 -0
  10. package/dist/raw/widgets.umd.js.map +1 -0
  11. package/dist/types/Widgets/EligibilityModal/DesktopModal/index.d.ts +3 -0
  12. package/dist/types/Widgets/EligibilityModal/MobileModal/index.d.ts +3 -0
  13. package/dist/types/Widgets/EligibilityModal/ModalContainer.d.ts +13 -0
  14. package/dist/types/Widgets/{button.test.d.ts → EligibilityModal/ModalContainer.test.d.ts} +0 -0
  15. package/dist/types/Widgets/EligibilityModal/components/EligibilityPlansButtons/index.d.ts +8 -0
  16. package/dist/types/Widgets/EligibilityModal/components/Info/index.d.ts +3 -0
  17. package/dist/types/Widgets/EligibilityModal/components/Logo/index.d.ts +3 -0
  18. package/dist/types/Widgets/EligibilityModal/components/Schedule/index.d.ts +6 -0
  19. package/dist/types/Widgets/EligibilityModal/components/Title/index.d.ts +3 -0
  20. package/dist/types/Widgets/EligibilityModal/index.d.ts +2 -1
  21. package/dist/types/Widgets/PaymentPlans/PaymentPlans.test.d.ts +1 -0
  22. package/dist/types/Widgets/{PaymentPlan.d.ts → PaymentPlans/index.d.ts} +3 -2
  23. package/dist/types/Widgets/PaymentPlans/tests/SuggestedPaymentPlan.d.ts +1 -0
  24. package/dist/types/components/LoadingIndicator/index.d.ts +5 -0
  25. package/dist/types/hooks/useFetchEligibility.d.ts +2 -2
  26. package/dist/types/index.d.ts +1 -0
  27. package/dist/types/types.d.ts +12 -5
  28. package/dist/types/utils/merchantOrderPreferences.d.ts +14 -0
  29. package/dist/types/widgets_controller.d.ts +7 -2
  30. package/dist/widgets.css +12 -4
  31. package/dist/widgets.js +1 -1
  32. package/dist/widgets.js.map +1 -1
  33. package/dist/widgets.m.js +1 -1
  34. package/dist/widgets.m.js.map +1 -1
  35. package/dist/widgets.modern.js +1 -1
  36. package/dist/widgets.modern.js.map +1 -1
  37. package/dist/widgets.umd.js +1 -1
  38. package/dist/widgets.umd.js.map +1 -1
  39. package/package.json +6 -3
@@ -0,0 +1,2521 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { IntlProvider, FormattedMessage, FormattedNumber, FormattedDate, useIntl } from 'react-intl';
3
+ import { unmountComponentAtNode, render } from 'react-dom';
4
+ import cx from 'classnames';
5
+ import Modal from 'react-modal';
6
+ import noScroll from 'no-scroll';
7
+ import { useMediaQuery } from 'react-responsive';
8
+ import { secondsToMilliseconds, isToday } from 'date-fns';
9
+
10
+ var ceil = Math.ceil;
11
+ var floor = Math.floor; // `ToInteger` abstract operation
12
+ // https://tc39.github.io/ecma262/#sec-tointeger
13
+
14
+ var toInteger = function (argument) {
15
+ return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
16
+ };
17
+
18
+ // `RequireObjectCoercible` abstract operation
19
+ // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
20
+ var requireObjectCoercible = function (it) {
21
+ if (it == undefined) throw TypeError("Can't call method on " + it);
22
+ return it;
23
+ };
24
+
25
+ var createMethod = function (CONVERT_TO_STRING) {
26
+ return function ($this, pos) {
27
+ var S = String(requireObjectCoercible($this));
28
+ var position = toInteger(pos);
29
+ var size = S.length;
30
+ var first, second;
31
+ if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
32
+ first = S.charCodeAt(position);
33
+ return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? S.charAt(position) : first : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
34
+ };
35
+ };
36
+
37
+ var stringMultibyte = {
38
+ // `String.prototype.codePointAt` method
39
+ // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
40
+ codeAt: createMethod(false),
41
+ // `String.prototype.at` method
42
+ // https://github.com/mathiasbynens/String.prototype.at
43
+ charAt: createMethod(true)
44
+ };
45
+
46
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
47
+
48
+ function createCommonjsModule(fn, basedir, module) {
49
+ return module = {
50
+ path: basedir,
51
+ exports: {},
52
+ require: function (path, base) {
53
+ return commonjsRequire();
54
+ }
55
+ }, fn(module, module.exports), module.exports;
56
+ }
57
+
58
+ function commonjsRequire () {
59
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
60
+ }
61
+
62
+ var check = function (it) {
63
+ return it && it.Math == Math && it;
64
+ }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
65
+
66
+
67
+ var global_1 = // eslint-disable-next-line no-undef
68
+ check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func
69
+ function () {
70
+ return this;
71
+ }() || Function('return this')();
72
+
73
+ var fails = function (exec) {
74
+ try {
75
+ return !!exec();
76
+ } catch (error) {
77
+ return true;
78
+ }
79
+ };
80
+
81
+ var descriptors = !fails(function () {
82
+ return Object.defineProperty({}, 1, {
83
+ get: function () {
84
+ return 7;
85
+ }
86
+ })[1] != 7;
87
+ });
88
+
89
+ var isObject = function (it) {
90
+ return typeof it === 'object' ? it !== null : typeof it === 'function';
91
+ };
92
+
93
+ var document$1 = global_1.document; // typeof document.createElement is 'object' in old IE
94
+
95
+ var EXISTS = isObject(document$1) && isObject(document$1.createElement);
96
+
97
+ var documentCreateElement = function (it) {
98
+ return EXISTS ? document$1.createElement(it) : {};
99
+ };
100
+
101
+ var ie8DomDefine = !descriptors && !fails(function () {
102
+ return Object.defineProperty(documentCreateElement('div'), 'a', {
103
+ get: function () {
104
+ return 7;
105
+ }
106
+ }).a != 7;
107
+ });
108
+
109
+ var anObject = function (it) {
110
+ if (!isObject(it)) {
111
+ throw TypeError(String(it) + ' is not an object');
112
+ }
113
+
114
+ return it;
115
+ };
116
+
117
+ // https://tc39.github.io/ecma262/#sec-toprimitive
118
+ // instead of the ES6 spec version, we didn't implement @@toPrimitive case
119
+ // and the second argument - flag - preferred type is a string
120
+
121
+ var toPrimitive = function (input, PREFERRED_STRING) {
122
+ if (!isObject(input)) return input;
123
+ var fn, val;
124
+ if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
125
+ if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
126
+ if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
127
+ throw TypeError("Can't convert object to primitive value");
128
+ };
129
+
130
+ var nativeDefineProperty = Object.defineProperty; // `Object.defineProperty` method
131
+ // https://tc39.github.io/ecma262/#sec-object.defineproperty
132
+
133
+ var f = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
134
+ anObject(O);
135
+ P = toPrimitive(P, true);
136
+ anObject(Attributes);
137
+ if (ie8DomDefine) try {
138
+ return nativeDefineProperty(O, P, Attributes);
139
+ } catch (error) {
140
+ /* empty */
141
+ }
142
+ if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
143
+ if ('value' in Attributes) O[P] = Attributes.value;
144
+ return O;
145
+ };
146
+ var objectDefineProperty = {
147
+ f: f
148
+ };
149
+
150
+ var createPropertyDescriptor = function (bitmap, value) {
151
+ return {
152
+ enumerable: !(bitmap & 1),
153
+ configurable: !(bitmap & 2),
154
+ writable: !(bitmap & 4),
155
+ value: value
156
+ };
157
+ };
158
+
159
+ var createNonEnumerableProperty = descriptors ? function (object, key, value) {
160
+ return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
161
+ } : function (object, key, value) {
162
+ object[key] = value;
163
+ return object;
164
+ };
165
+
166
+ var setGlobal = function (key, value) {
167
+ try {
168
+ createNonEnumerableProperty(global_1, key, value);
169
+ } catch (error) {
170
+ global_1[key] = value;
171
+ }
172
+
173
+ return value;
174
+ };
175
+
176
+ var SHARED = '__core-js_shared__';
177
+ var store = global_1[SHARED] || setGlobal(SHARED, {});
178
+ var sharedStore = store;
179
+
180
+ var functionToString = Function.toString; // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
181
+
182
+ if (typeof sharedStore.inspectSource != 'function') {
183
+ sharedStore.inspectSource = function (it) {
184
+ return functionToString.call(it);
185
+ };
186
+ }
187
+
188
+ var inspectSource = sharedStore.inspectSource;
189
+
190
+ var WeakMap = global_1.WeakMap;
191
+ var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
192
+
193
+ var hasOwnProperty = {}.hasOwnProperty;
194
+
195
+ var has = function (it, key) {
196
+ return hasOwnProperty.call(it, key);
197
+ };
198
+
199
+ var shared = createCommonjsModule(function (module) {
200
+ (module.exports = function (key, value) {
201
+ return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
202
+ })('versions', []).push({
203
+ version: '3.8.1',
204
+ mode: 'global',
205
+ copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
206
+ });
207
+ });
208
+
209
+ var id = 0;
210
+ var postfix = Math.random();
211
+
212
+ var uid = function (key) {
213
+ return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
214
+ };
215
+
216
+ var keys = shared('keys');
217
+
218
+ var sharedKey = function (key) {
219
+ return keys[key] || (keys[key] = uid(key));
220
+ };
221
+
222
+ var hiddenKeys = {};
223
+
224
+ var WeakMap$1 = global_1.WeakMap;
225
+ var set, get, has$1;
226
+
227
+ var enforce = function (it) {
228
+ return has$1(it) ? get(it) : set(it, {});
229
+ };
230
+
231
+ var getterFor = function (TYPE) {
232
+ return function (it) {
233
+ var state;
234
+
235
+ if (!isObject(it) || (state = get(it)).type !== TYPE) {
236
+ throw TypeError('Incompatible receiver, ' + TYPE + ' required');
237
+ }
238
+
239
+ return state;
240
+ };
241
+ };
242
+
243
+ if (nativeWeakMap) {
244
+ var store$1 = sharedStore.state || (sharedStore.state = new WeakMap$1());
245
+ var wmget = store$1.get;
246
+ var wmhas = store$1.has;
247
+ var wmset = store$1.set;
248
+
249
+ set = function (it, metadata) {
250
+ metadata.facade = it;
251
+ wmset.call(store$1, it, metadata);
252
+ return metadata;
253
+ };
254
+
255
+ get = function (it) {
256
+ return wmget.call(store$1, it) || {};
257
+ };
258
+
259
+ has$1 = function (it) {
260
+ return wmhas.call(store$1, it);
261
+ };
262
+ } else {
263
+ var STATE = sharedKey('state');
264
+ hiddenKeys[STATE] = true;
265
+
266
+ set = function (it, metadata) {
267
+ metadata.facade = it;
268
+ createNonEnumerableProperty(it, STATE, metadata);
269
+ return metadata;
270
+ };
271
+
272
+ get = function (it) {
273
+ return has(it, STATE) ? it[STATE] : {};
274
+ };
275
+
276
+ has$1 = function (it) {
277
+ return has(it, STATE);
278
+ };
279
+ }
280
+
281
+ var internalState = {
282
+ set: set,
283
+ get: get,
284
+ has: has$1,
285
+ enforce: enforce,
286
+ getterFor: getterFor
287
+ };
288
+
289
+ var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
290
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug
291
+
292
+ var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({
293
+ 1: 2
294
+ }, 1); // `Object.prototype.propertyIsEnumerable` method implementation
295
+ // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
296
+
297
+ var f$1 = NASHORN_BUG ? function propertyIsEnumerable(V) {
298
+ var descriptor = getOwnPropertyDescriptor(this, V);
299
+ return !!descriptor && descriptor.enumerable;
300
+ } : nativePropertyIsEnumerable;
301
+ var objectPropertyIsEnumerable = {
302
+ f: f$1
303
+ };
304
+
305
+ var toString = {}.toString;
306
+
307
+ var classofRaw = function (it) {
308
+ return toString.call(it).slice(8, -1);
309
+ };
310
+
311
+ var split = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings
312
+
313
+ var indexedObject = fails(function () {
314
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
315
+ // eslint-disable-next-line no-prototype-builtins
316
+ return !Object('z').propertyIsEnumerable(0);
317
+ }) ? function (it) {
318
+ return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
319
+ } : Object;
320
+
321
+ var toIndexedObject = function (it) {
322
+ return indexedObject(requireObjectCoercible(it));
323
+ };
324
+
325
+ var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method
326
+ // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
327
+
328
+ var f$2 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
329
+ O = toIndexedObject(O);
330
+ P = toPrimitive(P, true);
331
+ if (ie8DomDefine) try {
332
+ return nativeGetOwnPropertyDescriptor(O, P);
333
+ } catch (error) {
334
+ /* empty */
335
+ }
336
+ if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
337
+ };
338
+ var objectGetOwnPropertyDescriptor = {
339
+ f: f$2
340
+ };
341
+
342
+ var redefine = createCommonjsModule(function (module) {
343
+ var getInternalState = internalState.get;
344
+ var enforceInternalState = internalState.enforce;
345
+ var TEMPLATE = String(String).split('String');
346
+ (module.exports = function (O, key, value, options) {
347
+ var unsafe = options ? !!options.unsafe : false;
348
+ var simple = options ? !!options.enumerable : false;
349
+ var noTargetGet = options ? !!options.noTargetGet : false;
350
+ var state;
351
+
352
+ if (typeof value == 'function') {
353
+ if (typeof key == 'string' && !has(value, 'name')) {
354
+ createNonEnumerableProperty(value, 'name', key);
355
+ }
356
+
357
+ state = enforceInternalState(value);
358
+
359
+ if (!state.source) {
360
+ state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
361
+ }
362
+ }
363
+
364
+ if (O === global_1) {
365
+ if (simple) O[key] = value;else setGlobal(key, value);
366
+ return;
367
+ } else if (!unsafe) {
368
+ delete O[key];
369
+ } else if (!noTargetGet && O[key]) {
370
+ simple = true;
371
+ }
372
+
373
+ if (simple) O[key] = value;else createNonEnumerableProperty(O, key, value); // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
374
+ })(Function.prototype, 'toString', function toString() {
375
+ return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
376
+ });
377
+ });
378
+
379
+ var path = global_1;
380
+
381
+ var aFunction = function (variable) {
382
+ return typeof variable == 'function' ? variable : undefined;
383
+ };
384
+
385
+ var getBuiltIn = function (namespace, method) {
386
+ return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace]) : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
387
+ };
388
+
389
+ var min = Math.min; // `ToLength` abstract operation
390
+ // https://tc39.github.io/ecma262/#sec-tolength
391
+
392
+ var toLength = function (argument) {
393
+ return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
394
+ };
395
+
396
+ var max = Math.max;
397
+ var min$1 = Math.min; // Helper for a popular repeating case of the spec:
398
+ // Let integer be ? ToInteger(index).
399
+ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
400
+
401
+ var toAbsoluteIndex = function (index, length) {
402
+ var integer = toInteger(index);
403
+ return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
404
+ };
405
+
406
+ var createMethod$1 = function (IS_INCLUDES) {
407
+ return function ($this, el, fromIndex) {
408
+ var O = toIndexedObject($this);
409
+ var length = toLength(O.length);
410
+ var index = toAbsoluteIndex(fromIndex, length);
411
+ var value; // Array#includes uses SameValueZero equality algorithm
412
+ // eslint-disable-next-line no-self-compare
413
+
414
+ if (IS_INCLUDES && el != el) while (length > index) {
415
+ value = O[index++]; // eslint-disable-next-line no-self-compare
416
+
417
+ if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not
418
+ } else for (; length > index; index++) {
419
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
420
+ }
421
+ return !IS_INCLUDES && -1;
422
+ };
423
+ };
424
+
425
+ var arrayIncludes = {
426
+ // `Array.prototype.includes` method
427
+ // https://tc39.github.io/ecma262/#sec-array.prototype.includes
428
+ includes: createMethod$1(true),
429
+ // `Array.prototype.indexOf` method
430
+ // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
431
+ indexOf: createMethod$1(false)
432
+ };
433
+
434
+ var indexOf = arrayIncludes.indexOf;
435
+
436
+ var objectKeysInternal = function (object, names) {
437
+ var O = toIndexedObject(object);
438
+ var i = 0;
439
+ var result = [];
440
+ var key;
441
+
442
+ for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key); // Don't enum bug & hidden keys
443
+
444
+
445
+ while (names.length > i) if (has(O, key = names[i++])) {
446
+ ~indexOf(result, key) || result.push(key);
447
+ }
448
+
449
+ return result;
450
+ };
451
+
452
+ // IE8- don't enum bug keys
453
+ var enumBugKeys = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'];
454
+
455
+ var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method
456
+ // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
457
+
458
+ var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
459
+ return objectKeysInternal(O, hiddenKeys$1);
460
+ };
461
+
462
+ var objectGetOwnPropertyNames = {
463
+ f: f$3
464
+ };
465
+
466
+ var f$4 = Object.getOwnPropertySymbols;
467
+ var objectGetOwnPropertySymbols = {
468
+ f: f$4
469
+ };
470
+
471
+ var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
472
+ var keys = objectGetOwnPropertyNames.f(anObject(it));
473
+ var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
474
+ return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
475
+ };
476
+
477
+ var copyConstructorProperties = function (target, source) {
478
+ var keys = ownKeys(source);
479
+ var defineProperty = objectDefineProperty.f;
480
+ var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
481
+
482
+ for (var i = 0; i < keys.length; i++) {
483
+ var key = keys[i];
484
+ if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
485
+ }
486
+ };
487
+
488
+ var replacement = /#|\.prototype\./;
489
+
490
+ var isForced = function (feature, detection) {
491
+ var value = data[normalize(feature)];
492
+ return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails(detection) : !!detection;
493
+ };
494
+
495
+ var normalize = isForced.normalize = function (string) {
496
+ return String(string).replace(replacement, '.').toLowerCase();
497
+ };
498
+
499
+ var data = isForced.data = {};
500
+ var NATIVE = isForced.NATIVE = 'N';
501
+ var POLYFILL = isForced.POLYFILL = 'P';
502
+ var isForced_1 = isForced;
503
+
504
+ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
505
+ /*
506
+ options.target - name of the target object
507
+ options.global - target is the global object
508
+ options.stat - export as static methods of target
509
+ options.proto - export as prototype methods of target
510
+ options.real - real prototype method for the `pure` version
511
+ options.forced - export even if the native feature is available
512
+ options.bind - bind methods to the target, required for the `pure` version
513
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
514
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
515
+ options.sham - add a flag to not completely full polyfills
516
+ options.enumerable - export as enumerable property
517
+ options.noTargetGet - prevent calling a getter on target
518
+ */
519
+
520
+ var _export = function (options, source) {
521
+ var TARGET = options.target;
522
+ var GLOBAL = options.global;
523
+ var STATIC = options.stat;
524
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
525
+
526
+ if (GLOBAL) {
527
+ target = global_1;
528
+ } else if (STATIC) {
529
+ target = global_1[TARGET] || setGlobal(TARGET, {});
530
+ } else {
531
+ target = (global_1[TARGET] || {}).prototype;
532
+ }
533
+
534
+ if (target) for (key in source) {
535
+ sourceProperty = source[key];
536
+
537
+ if (options.noTargetGet) {
538
+ descriptor = getOwnPropertyDescriptor$1(target, key);
539
+ targetProperty = descriptor && descriptor.value;
540
+ } else targetProperty = target[key];
541
+
542
+ FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contained in target
543
+
544
+ if (!FORCED && targetProperty !== undefined) {
545
+ if (typeof sourceProperty === typeof targetProperty) continue;
546
+ copyConstructorProperties(sourceProperty, targetProperty);
547
+ } // add a flag to not completely full polyfills
548
+
549
+
550
+ if (options.sham || targetProperty && targetProperty.sham) {
551
+ createNonEnumerableProperty(sourceProperty, 'sham', true);
552
+ } // extend global
553
+
554
+
555
+ redefine(target, key, sourceProperty, options);
556
+ }
557
+ };
558
+
559
+ // https://tc39.github.io/ecma262/#sec-toobject
560
+
561
+ var toObject = function (argument) {
562
+ return Object(requireObjectCoercible(argument));
563
+ };
564
+
565
+ var correctPrototypeGetter = !fails(function () {
566
+ function F() {
567
+ /* empty */
568
+ }
569
+
570
+ F.prototype.constructor = null;
571
+ return Object.getPrototypeOf(new F()) !== F.prototype;
572
+ });
573
+
574
+ var IE_PROTO = sharedKey('IE_PROTO');
575
+ var ObjectPrototype = Object.prototype; // `Object.getPrototypeOf` method
576
+ // https://tc39.github.io/ecma262/#sec-object.getprototypeof
577
+
578
+ var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
579
+ O = toObject(O);
580
+ if (has(O, IE_PROTO)) return O[IE_PROTO];
581
+
582
+ if (typeof O.constructor == 'function' && O instanceof O.constructor) {
583
+ return O.constructor.prototype;
584
+ }
585
+
586
+ return O instanceof Object ? ObjectPrototype : null;
587
+ };
588
+
589
+ var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
590
+ // Chrome 38 Symbol has incorrect toString conversion
591
+ // eslint-disable-next-line no-undef
592
+ return !String(Symbol());
593
+ });
594
+
595
+ var useSymbolAsUid = nativeSymbol // eslint-disable-next-line no-undef
596
+ && !Symbol.sham // eslint-disable-next-line no-undef
597
+ && typeof Symbol.iterator == 'symbol';
598
+
599
+ var WellKnownSymbolsStore = shared('wks');
600
+ var Symbol$1 = global_1.Symbol;
601
+ var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
602
+
603
+ var wellKnownSymbol = function (name) {
604
+ if (!has(WellKnownSymbolsStore, name)) {
605
+ if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
606
+ }
607
+
608
+ return WellKnownSymbolsStore[name];
609
+ };
610
+
611
+ var ITERATOR = wellKnownSymbol('iterator');
612
+ var BUGGY_SAFARI_ITERATORS = false;
613
+
614
+ var returnThis = function () {
615
+ return this;
616
+ }; // `%IteratorPrototype%` object
617
+ // https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
618
+
619
+
620
+ var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
621
+
622
+ if ([].keys) {
623
+ arrayIterator = [].keys(); // Safari 8 has buggy iterators w/o `next`
624
+
625
+ if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;else {
626
+ PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
627
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
628
+ }
629
+ }
630
+
631
+ if (IteratorPrototype == undefined) IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
632
+
633
+ if ( !has(IteratorPrototype, ITERATOR)) {
634
+ createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
635
+ }
636
+
637
+ var iteratorsCore = {
638
+ IteratorPrototype: IteratorPrototype,
639
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
640
+ };
641
+
642
+ // https://tc39.github.io/ecma262/#sec-object.keys
643
+
644
+ var objectKeys = Object.keys || function keys(O) {
645
+ return objectKeysInternal(O, enumBugKeys);
646
+ };
647
+
648
+ // https://tc39.github.io/ecma262/#sec-object.defineproperties
649
+
650
+ var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
651
+ anObject(O);
652
+ var keys = objectKeys(Properties);
653
+ var length = keys.length;
654
+ var index = 0;
655
+ var key;
656
+
657
+ while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
658
+
659
+ return O;
660
+ };
661
+
662
+ var html = getBuiltIn('document', 'documentElement');
663
+
664
+ var GT = '>';
665
+ var LT = '<';
666
+ var PROTOTYPE = 'prototype';
667
+ var SCRIPT = 'script';
668
+ var IE_PROTO$1 = sharedKey('IE_PROTO');
669
+
670
+ var EmptyConstructor = function () {
671
+ /* empty */
672
+ };
673
+
674
+ var scriptTag = function (content) {
675
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
676
+ }; // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
677
+
678
+
679
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
680
+ activeXDocument.write(scriptTag(''));
681
+ activeXDocument.close();
682
+ var temp = activeXDocument.parentWindow.Object;
683
+ activeXDocument = null; // avoid memory leak
684
+
685
+ return temp;
686
+ }; // Create object with fake `null` prototype: use iframe Object with cleared prototype
687
+
688
+
689
+ var NullProtoObjectViaIFrame = function () {
690
+ // Thrash, waste and sodomy: IE GC bug
691
+ var iframe = documentCreateElement('iframe');
692
+ var JS = 'java' + SCRIPT + ':';
693
+ var iframeDocument;
694
+ iframe.style.display = 'none';
695
+ html.appendChild(iframe); // https://github.com/zloirock/core-js/issues/475
696
+
697
+ iframe.src = String(JS);
698
+ iframeDocument = iframe.contentWindow.document;
699
+ iframeDocument.open();
700
+ iframeDocument.write(scriptTag('document.F=Object'));
701
+ iframeDocument.close();
702
+ return iframeDocument.F;
703
+ }; // Check for document.domain and active x support
704
+ // No need to use active x approach when document.domain is not set
705
+ // see https://github.com/es-shims/es5-shim/issues/150
706
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
707
+ // avoid IE GC bug
708
+
709
+
710
+ var activeXDocument;
711
+
712
+ var NullProtoObject = function () {
713
+ try {
714
+ /* global ActiveXObject */
715
+ activeXDocument = document.domain && new ActiveXObject('htmlfile');
716
+ } catch (error) {
717
+ /* ignore */
718
+ }
719
+
720
+ NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
721
+ var length = enumBugKeys.length;
722
+
723
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
724
+
725
+ return NullProtoObject();
726
+ };
727
+
728
+ hiddenKeys[IE_PROTO$1] = true; // `Object.create` method
729
+ // https://tc39.github.io/ecma262/#sec-object.create
730
+
731
+ var objectCreate = Object.create || function create(O, Properties) {
732
+ var result;
733
+
734
+ if (O !== null) {
735
+ EmptyConstructor[PROTOTYPE] = anObject(O);
736
+ result = new EmptyConstructor();
737
+ EmptyConstructor[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill
738
+
739
+ result[IE_PROTO$1] = O;
740
+ } else result = NullProtoObject();
741
+
742
+ return Properties === undefined ? result : objectDefineProperties(result, Properties);
743
+ };
744
+
745
+ var defineProperty = objectDefineProperty.f;
746
+ var TO_STRING_TAG = wellKnownSymbol('toStringTag');
747
+
748
+ var setToStringTag = function (it, TAG, STATIC) {
749
+ if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
750
+ defineProperty(it, TO_STRING_TAG, {
751
+ configurable: true,
752
+ value: TAG
753
+ });
754
+ }
755
+ };
756
+
757
+ var iterators = {};
758
+
759
+ var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
760
+
761
+ var returnThis$1 = function () {
762
+ return this;
763
+ };
764
+
765
+ var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
766
+ var TO_STRING_TAG = NAME + ' Iterator';
767
+ IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, {
768
+ next: createPropertyDescriptor(1, next)
769
+ });
770
+ setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
771
+ iterators[TO_STRING_TAG] = returnThis$1;
772
+ return IteratorConstructor;
773
+ };
774
+
775
+ var aPossiblePrototype = function (it) {
776
+ if (!isObject(it) && it !== null) {
777
+ throw TypeError("Can't set " + String(it) + ' as a prototype');
778
+ }
779
+
780
+ return it;
781
+ };
782
+
783
+ // https://tc39.github.io/ecma262/#sec-object.setprototypeof
784
+ // Works with __proto__ only. Old v8 can't work with null proto objects.
785
+
786
+ /* eslint-disable no-proto */
787
+
788
+ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
789
+ var CORRECT_SETTER = false;
790
+ var test = {};
791
+ var setter;
792
+
793
+ try {
794
+ setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
795
+ setter.call(test, []);
796
+ CORRECT_SETTER = test instanceof Array;
797
+ } catch (error) {
798
+ /* empty */
799
+ }
800
+
801
+ return function setPrototypeOf(O, proto) {
802
+ anObject(O);
803
+ aPossiblePrototype(proto);
804
+ if (CORRECT_SETTER) setter.call(O, proto);else O.__proto__ = proto;
805
+ return O;
806
+ };
807
+ }() : undefined);
808
+
809
+ var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
810
+ var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;
811
+ var ITERATOR$1 = wellKnownSymbol('iterator');
812
+ var KEYS = 'keys';
813
+ var VALUES = 'values';
814
+ var ENTRIES = 'entries';
815
+
816
+ var returnThis$2 = function () {
817
+ return this;
818
+ };
819
+
820
+ var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
821
+ createIteratorConstructor(IteratorConstructor, NAME, next);
822
+
823
+ var getIterationMethod = function (KIND) {
824
+ if (KIND === DEFAULT && defaultIterator) return defaultIterator;
825
+ if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
826
+
827
+ switch (KIND) {
828
+ case KEYS:
829
+ return function keys() {
830
+ return new IteratorConstructor(this, KIND);
831
+ };
832
+
833
+ case VALUES:
834
+ return function values() {
835
+ return new IteratorConstructor(this, KIND);
836
+ };
837
+
838
+ case ENTRIES:
839
+ return function entries() {
840
+ return new IteratorConstructor(this, KIND);
841
+ };
842
+ }
843
+
844
+ return function () {
845
+ return new IteratorConstructor(this);
846
+ };
847
+ };
848
+
849
+ var TO_STRING_TAG = NAME + ' Iterator';
850
+ var INCORRECT_VALUES_NAME = false;
851
+ var IterablePrototype = Iterable.prototype;
852
+ var nativeIterator = IterablePrototype[ITERATOR$1] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
853
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);
854
+ var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
855
+ var CurrentIteratorPrototype, methods, KEY; // fix native
856
+
857
+ if (anyNativeIterator) {
858
+ CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
859
+
860
+ if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {
861
+ if ( objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) {
862
+ if (objectSetPrototypeOf) {
863
+ objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2);
864
+ } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {
865
+ createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR$1, returnThis$2);
866
+ }
867
+ } // Set @@toStringTag to native iterators
868
+
869
+
870
+ setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
871
+ }
872
+ } // fix Array#{values, @@iterator}.name in V8 / FF
873
+
874
+
875
+ if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
876
+ INCORRECT_VALUES_NAME = true;
877
+
878
+ defaultIterator = function values() {
879
+ return nativeIterator.call(this);
880
+ };
881
+ } // define iterator
882
+
883
+
884
+ if ( IterablePrototype[ITERATOR$1] !== defaultIterator) {
885
+ createNonEnumerableProperty(IterablePrototype, ITERATOR$1, defaultIterator);
886
+ }
887
+
888
+ iterators[NAME] = defaultIterator; // export additional methods
889
+
890
+ if (DEFAULT) {
891
+ methods = {
892
+ values: getIterationMethod(VALUES),
893
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
894
+ entries: getIterationMethod(ENTRIES)
895
+ };
896
+ if (FORCED) for (KEY in methods) {
897
+ if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
898
+ redefine(IterablePrototype, KEY, methods[KEY]);
899
+ }
900
+ } else _export({
901
+ target: NAME,
902
+ proto: true,
903
+ forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME
904
+ }, methods);
905
+ }
906
+
907
+ return methods;
908
+ };
909
+
910
+ var charAt = stringMultibyte.charAt;
911
+ var STRING_ITERATOR = 'String Iterator';
912
+ var setInternalState = internalState.set;
913
+ var getInternalState = internalState.getterFor(STRING_ITERATOR); // `String.prototype[@@iterator]` method
914
+ // https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
915
+
916
+ defineIterator(String, 'String', function (iterated) {
917
+ setInternalState(this, {
918
+ type: STRING_ITERATOR,
919
+ string: String(iterated),
920
+ index: 0
921
+ }); // `%StringIteratorPrototype%.next` method
922
+ // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
923
+ }, function next() {
924
+ var state = getInternalState(this);
925
+ var string = state.string;
926
+ var index = state.index;
927
+ var point;
928
+ if (index >= string.length) return {
929
+ value: undefined,
930
+ done: true
931
+ };
932
+ point = charAt(string, index);
933
+ state.index += point.length;
934
+ return {
935
+ value: point,
936
+ done: false
937
+ };
938
+ });
939
+
940
+ var aFunction$1 = function (it) {
941
+ if (typeof it != 'function') {
942
+ throw TypeError(String(it) + ' is not a function');
943
+ }
944
+
945
+ return it;
946
+ };
947
+
948
+ var functionBindContext = function (fn, that, length) {
949
+ aFunction$1(fn);
950
+ if (that === undefined) return fn;
951
+
952
+ switch (length) {
953
+ case 0:
954
+ return function () {
955
+ return fn.call(that);
956
+ };
957
+
958
+ case 1:
959
+ return function (a) {
960
+ return fn.call(that, a);
961
+ };
962
+
963
+ case 2:
964
+ return function (a, b) {
965
+ return fn.call(that, a, b);
966
+ };
967
+
968
+ case 3:
969
+ return function (a, b, c) {
970
+ return fn.call(that, a, b, c);
971
+ };
972
+ }
973
+
974
+ return function ()
975
+ /* ...args */
976
+ {
977
+ return fn.apply(that, arguments);
978
+ };
979
+ };
980
+
981
+ var iteratorClose = function (iterator) {
982
+ var returnMethod = iterator['return'];
983
+
984
+ if (returnMethod !== undefined) {
985
+ return anObject(returnMethod.call(iterator)).value;
986
+ }
987
+ };
988
+
989
+ var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
990
+ try {
991
+ return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion)
992
+ } catch (error) {
993
+ iteratorClose(iterator);
994
+ throw error;
995
+ }
996
+ };
997
+
998
+ var ITERATOR$2 = wellKnownSymbol('iterator');
999
+ var ArrayPrototype = Array.prototype; // check on default Array iterator
1000
+
1001
+ var isArrayIteratorMethod = function (it) {
1002
+ return it !== undefined && (iterators.Array === it || ArrayPrototype[ITERATOR$2] === it);
1003
+ };
1004
+
1005
+ var createProperty = function (object, key, value) {
1006
+ var propertyKey = toPrimitive(key);
1007
+ if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));else object[propertyKey] = value;
1008
+ };
1009
+
1010
+ var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
1011
+ var test = {};
1012
+ test[TO_STRING_TAG$1] = 'z';
1013
+ var toStringTagSupport = String(test) === '[object z]';
1014
+
1015
+ var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag'); // ES3 wrong here
1016
+
1017
+ var CORRECT_ARGUMENTS = classofRaw(function () {
1018
+ return arguments;
1019
+ }()) == 'Arguments'; // fallback for IE11 Script Access Denied error
1020
+
1021
+ var tryGet = function (it, key) {
1022
+ try {
1023
+ return it[key];
1024
+ } catch (error) {
1025
+ /* empty */
1026
+ }
1027
+ }; // getting tag from ES6+ `Object.prototype.toString`
1028
+
1029
+
1030
+ var classof = toStringTagSupport ? classofRaw : function (it) {
1031
+ var O, tag, result;
1032
+ return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case
1033
+ : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$2)) == 'string' ? tag // builtinTag case
1034
+ : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback
1035
+ : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
1036
+ };
1037
+
1038
+ var ITERATOR$3 = wellKnownSymbol('iterator');
1039
+
1040
+ var getIteratorMethod = function (it) {
1041
+ if (it != undefined) return it[ITERATOR$3] || it['@@iterator'] || iterators[classof(it)];
1042
+ };
1043
+
1044
+ // https://tc39.github.io/ecma262/#sec-array.from
1045
+
1046
+
1047
+ var arrayFrom = function from(arrayLike
1048
+ /* , mapfn = undefined, thisArg = undefined */
1049
+ ) {
1050
+ var O = toObject(arrayLike);
1051
+ var C = typeof this == 'function' ? this : Array;
1052
+ var argumentsLength = arguments.length;
1053
+ var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
1054
+ var mapping = mapfn !== undefined;
1055
+ var iteratorMethod = getIteratorMethod(O);
1056
+ var index = 0;
1057
+ var length, result, step, iterator, next, value;
1058
+ if (mapping) mapfn = functionBindContext(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2); // if the target is not iterable or it's an array with the default iterator - use a simple case
1059
+
1060
+ if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
1061
+ iterator = iteratorMethod.call(O);
1062
+ next = iterator.next;
1063
+ result = new C();
1064
+
1065
+ for (; !(step = next.call(iterator)).done; index++) {
1066
+ value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
1067
+ createProperty(result, index, value);
1068
+ }
1069
+ } else {
1070
+ length = toLength(O.length);
1071
+ result = new C(length);
1072
+
1073
+ for (; length > index; index++) {
1074
+ value = mapping ? mapfn(O[index], index) : O[index];
1075
+ createProperty(result, index, value);
1076
+ }
1077
+ }
1078
+
1079
+ result.length = index;
1080
+ return result;
1081
+ };
1082
+
1083
+ var ITERATOR$4 = wellKnownSymbol('iterator');
1084
+ var SAFE_CLOSING = false;
1085
+
1086
+ try {
1087
+ var called = 0;
1088
+ var iteratorWithReturn = {
1089
+ next: function () {
1090
+ return {
1091
+ done: !!called++
1092
+ };
1093
+ },
1094
+ 'return': function () {
1095
+ SAFE_CLOSING = true;
1096
+ }
1097
+ };
1098
+
1099
+ iteratorWithReturn[ITERATOR$4] = function () {
1100
+ return this;
1101
+ }; // eslint-disable-next-line no-throw-literal
1102
+
1103
+
1104
+ Array.from(iteratorWithReturn, function () {
1105
+ throw 2;
1106
+ });
1107
+ } catch (error) {
1108
+ /* empty */
1109
+ }
1110
+
1111
+ var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
1112
+ if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
1113
+ var ITERATION_SUPPORT = false;
1114
+
1115
+ try {
1116
+ var object = {};
1117
+
1118
+ object[ITERATOR$4] = function () {
1119
+ return {
1120
+ next: function () {
1121
+ return {
1122
+ done: ITERATION_SUPPORT = true
1123
+ };
1124
+ }
1125
+ };
1126
+ };
1127
+
1128
+ exec(object);
1129
+ } catch (error) {
1130
+ /* empty */
1131
+ }
1132
+
1133
+ return ITERATION_SUPPORT;
1134
+ };
1135
+
1136
+ var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
1137
+ Array.from(iterable);
1138
+ }); // `Array.from` method
1139
+ // https://tc39.github.io/ecma262/#sec-array.from
1140
+
1141
+ _export({
1142
+ target: 'Array',
1143
+ stat: true,
1144
+ forced: INCORRECT_ITERATION
1145
+ }, {
1146
+ from: arrayFrom
1147
+ });
1148
+
1149
+ var widgetTypes;
1150
+
1151
+ (function (widgetTypes) {
1152
+ widgetTypes["PaymentPlans"] = "PaymentPlans";
1153
+ widgetTypes["Modal"] = "Modal";
1154
+ })(widgetTypes || (widgetTypes = {}));
1155
+
1156
+ var apiStatus;
1157
+
1158
+ (function (apiStatus) {
1159
+ apiStatus["PENDING"] = "pending";
1160
+ apiStatus["SUCCESS"] = "success";
1161
+ apiStatus["FAILED"] = "failed";
1162
+ })(apiStatus || (apiStatus = {}));
1163
+
1164
+ var Locale;
1165
+
1166
+ (function (Locale) {
1167
+ Locale["en"] = "en";
1168
+ Locale["fr"] = "fr";
1169
+ Locale["de"] = "de";
1170
+ Locale["it"] = "it";
1171
+ Locale["es"] = "es";
1172
+ Locale["nl"] = "nl";
1173
+ Locale["nl-NL"] = "nl-NL";
1174
+ Locale["nl-BE"] = "nl-BE";
1175
+ })(Locale || (Locale = {}));
1176
+
1177
+ function priceToCents(price) {
1178
+ return Math.round(price * 100);
1179
+ }
1180
+ function priceFromCents(cents) {
1181
+ return Number((cents / 100).toFixed(2));
1182
+ }
1183
+ function formatCents(cents) {
1184
+ return String(priceFromCents(cents)).replace('.', ',');
1185
+ }
1186
+
1187
+ /* eslint-disable */
1188
+
1189
+ (function (ElementProto) {
1190
+ if (typeof ElementProto.matches !== 'function') {
1191
+ ElementProto.matches = ElementProto.msMatchesSelector || ElementProto.mozMatchesSelector || ElementProto.webkitMatchesSelector || function matches(selector) {
1192
+ var element = this;
1193
+ var elements = (element.document || element.ownerDocument).querySelectorAll(selector);
1194
+ var index = 0;
1195
+
1196
+ while (elements[index] && elements[index] !== element) {
1197
+ ++index;
1198
+ }
1199
+
1200
+ return Boolean(elements[index]);
1201
+ };
1202
+ }
1203
+
1204
+ if (typeof ElementProto.closest !== 'function') {
1205
+ ElementProto.closest = function closest(selector) {
1206
+ var element = this;
1207
+
1208
+ while (element && element.nodeType === 1) {
1209
+ if (element.matches(selector)) {
1210
+ return element;
1211
+ }
1212
+
1213
+ element = element.parentNode;
1214
+ }
1215
+
1216
+ return null;
1217
+ };
1218
+ }
1219
+ })(window.Element.prototype);
1220
+ /*
1221
+ * Element.prototype.classList polyfill
1222
+ */
1223
+ // 1. String.prototype.trim polyfill
1224
+
1225
+
1226
+ if (!''.trim) String.prototype.trim = function () {
1227
+ return this.replace(/^[\s]+|[\s]+$/g, '');
1228
+ };
1229
+
1230
+ (function (window) {
1231
+
1232
+ if (!window.DOMException) (DOMException = function (reason) {
1233
+ this.message = reason;
1234
+ }).prototype = new Error();
1235
+
1236
+ var wsRE = /[\11\12\14\15\40]/,
1237
+ wsIndex = 0,
1238
+ checkIfValidClassListEntry = function checkIfValidClassListEntry(O, V) {
1239
+ if (V === '') throw new DOMException("Failed to execute '" + O + "' on 'DOMTokenList': The token provided must not be empty.");
1240
+ 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.");
1241
+ }; // 2. Implement the barebones DOMTokenList livelyness polyfill
1242
+
1243
+
1244
+ if (typeof DOMTokenList !== 'function') (function (window) {
1245
+ var document = window.document,
1246
+ Object = window.Object,
1247
+ hasOwnProp = Object.prototype.hasOwnProperty;
1248
+ var defineProperty = Object.defineProperty,
1249
+ allowTokenListConstruction = 0,
1250
+ skipPropChange = 0;
1251
+
1252
+ var DOMTokenList = function DOMTokenList() {
1253
+ if (!allowTokenListConstruction) throw TypeError('Illegal constructor'); // internally let it through
1254
+ };
1255
+
1256
+ DOMTokenList.prototype.toString = DOMTokenList.prototype.toLocaleString = function () {
1257
+ return this.value;
1258
+ };
1259
+
1260
+ DOMTokenList.prototype.add = function () {
1261
+ a: for (var v = 0, argLen = arguments.length, val = '', ele = this[' uCL'], proto = ele[' uCLp']; v !== argLen; ++v) {
1262
+ val = arguments[v] + '', checkIfValidClassListEntry('add', val);
1263
+
1264
+ for (var i = 0, Len = proto.length, resStr = val; i !== Len; ++i) if (this[i] === val) continue a;else resStr += ' ' + this[i];
1265
+
1266
+ this[Len] = val, proto.length += 1, proto.value = resStr;
1267
+ }
1268
+ skipPropChange = 1, ele.className = proto.value, skipPropChange = 0;
1269
+ };
1270
+
1271
+ DOMTokenList.prototype.remove = function () {
1272
+ for (var v = 0, argLen = arguments.length, val = '', ele = this[' uCL'], proto = ele[' uCLp']; v !== argLen; ++v) {
1273
+ val = arguments[v] + '', checkIfValidClassListEntry('remove', val);
1274
+
1275
+ for (var i = 0, Len = proto.length, resStr = '', is = 0; i !== Len; ++i) if (is) {
1276
+ this[i - 1] = this[i];
1277
+ } else {
1278
+ if (this[i] !== val) {
1279
+ resStr += this[i] + ' ';
1280
+ } else {
1281
+ is = 1;
1282
+ }
1283
+ }
1284
+
1285
+ if (!is) continue;
1286
+ delete this[Len], proto.length -= 1, proto.value = resStr;
1287
+ }
1288
+ skipPropChange = 1, ele.className = proto.value, skipPropChange = 0;
1289
+ };
1290
+
1291
+ window.DOMTokenList = DOMTokenList;
1292
+
1293
+ function whenPropChanges() {
1294
+ var evt = window.event,
1295
+ prop = evt.propertyName;
1296
+
1297
+ if (!skipPropChange && (prop === 'className' || prop === 'classList' && !defineProperty)) {
1298
+ var target = evt.srcElement,
1299
+ protoObjProto = target[' uCLp'],
1300
+ strval = '' + target[prop];
1301
+ var tokens = strval.trim().split(wsRE),
1302
+ resTokenList = target[prop === 'classList' ? ' uCL' : 'classList'];
1303
+ var oldLen = protoObjProto.length;
1304
+
1305
+ a: for (var cI = 0, cLen = protoObjProto.length = tokens.length, sub = 0; cI !== cLen; ++cI) {
1306
+ for (var innerI = 0; innerI !== cI; ++innerI) if (tokens[innerI] === tokens[cI]) {
1307
+ sub++;
1308
+ continue a;
1309
+ }
1310
+
1311
+ resTokenList[cI - sub] = tokens[cI];
1312
+ }
1313
+
1314
+ for (var i = cLen - sub; i < oldLen; ++i) delete resTokenList[i]; //remove trailing indexs
1315
+
1316
+
1317
+ if (prop !== 'classList') return;
1318
+ skipPropChange = 1, target.classList = resTokenList, target.className = strval;
1319
+ skipPropChange = 0, resTokenList.length = tokens.length - sub;
1320
+ }
1321
+ }
1322
+
1323
+ function polyfillClassList(ele) {
1324
+ if (!ele || !('innerHTML' in ele)) throw TypeError('Illegal invocation');
1325
+ ele.detachEvent('onpropertychange', whenPropChanges); // prevent duplicate handler infinite loop
1326
+
1327
+ allowTokenListConstruction = 1;
1328
+
1329
+ try {
1330
+ var protoObj = function protoObj() {};
1331
+
1332
+ protoObj.prototype = new DOMTokenList();
1333
+ } finally {
1334
+ allowTokenListConstruction = 0;
1335
+ }
1336
+
1337
+ var protoObjProto = protoObj.prototype,
1338
+ resTokenList = new protoObj();
1339
+
1340
+ a: for (var toks = ele.className.trim().split(wsRE), cI = 0, cLen = toks.length, sub = 0; cI !== cLen; ++cI) {
1341
+ for (var innerI = 0; innerI !== cI; ++innerI) if (toks[innerI] === toks[cI]) {
1342
+ sub++;
1343
+ continue a;
1344
+ }
1345
+
1346
+ this[cI - sub] = toks[cI];
1347
+ }
1348
+ protoObjProto.length = cLen - sub, protoObjProto.value = ele.className, protoObjProto[' uCL'] = ele;
1349
+
1350
+ if (defineProperty) {
1351
+ defineProperty(ele, 'classList', {
1352
+ // IE8 & IE9 allow defineProperty on the DOM
1353
+ enumerable: 1,
1354
+ get: function () {
1355
+ return resTokenList;
1356
+ },
1357
+ configurable: 0,
1358
+ set: function (newVal) {
1359
+ skipPropChange = 1, ele.className = protoObjProto.value = newVal += '', skipPropChange = 0;
1360
+ var toks = newVal.trim().split(wsRE),
1361
+ oldLen = protoObjProto.length;
1362
+
1363
+ a: for (var cI = 0, cLen = protoObjProto.length = toks.length, sub = 0; cI !== cLen; ++cI) {
1364
+ for (var innerI = 0; innerI !== cI; ++innerI) if (toks[innerI] === toks[cI]) {
1365
+ sub++;
1366
+ continue a;
1367
+ }
1368
+
1369
+ resTokenList[cI - sub] = toks[cI];
1370
+ }
1371
+
1372
+ for (var i = cLen - sub; i < oldLen; ++i) delete resTokenList[i]; //remove trailing indexs
1373
+
1374
+ }
1375
+ });
1376
+ defineProperty(ele, ' uCLp', {
1377
+ // for accessing the hidden prototype
1378
+ enumerable: 0,
1379
+ configurable: 0,
1380
+ writeable: 0,
1381
+ value: protoObj.prototype
1382
+ });
1383
+ defineProperty(protoObjProto, ' uCL', {
1384
+ enumerable: 0,
1385
+ configurable: 0,
1386
+ writeable: 0,
1387
+ value: ele
1388
+ });
1389
+ } else {
1390
+ ele.classList = resTokenList, ele[' uCL'] = resTokenList, ele[' uCLp'] = protoObj.prototype;
1391
+ }
1392
+
1393
+ ele.attachEvent('onpropertychange', whenPropChanges);
1394
+ }
1395
+
1396
+ try {
1397
+ // Much faster & cleaner version for IE8 & IE9:
1398
+ // Should work in IE8 because Element.prototype instanceof Node is true according to the specs
1399
+ window.Object.defineProperty(window.Element.prototype, 'classList', {
1400
+ enumerable: 1,
1401
+ get: function (val) {
1402
+ if (!hasOwnProp.call(this, 'classList')) polyfillClassList(this);
1403
+ return this.classList;
1404
+ },
1405
+ configurable: 0,
1406
+ set: function (val) {
1407
+ this.className = val;
1408
+ }
1409
+ });
1410
+ } catch (e) {
1411
+ // Less performant fallback for older browsers (IE 6-8):
1412
+ window[' uCL'] = polyfillClassList; // the below code ensures polyfillClassList is applied to all current and future elements in the doc.
1413
+
1414
+ document.documentElement.firstChild.appendChild(document.createElement('style')).styleSheet.cssText = '_*{x-uCLp:expression(!this.hasOwnProperty("classList")&&window[" uCL"](this))}' + // IE6
1415
+ '[class]{x-uCLp/**/:expression(!this.hasOwnProperty("classList")&&window[" uCL"](this))}'; //IE7-8
1416
+ }
1417
+ })(window) // 3. Patch in unsupported methods in DOMTokenList
1418
+ ;
1419
+
1420
+ (function (DOMTokenListProto, testClass) {
1421
+ if (!DOMTokenListProto.item) DOMTokenListProto.item = function (i) {
1422
+ function NullCheck(n) {
1423
+ return n === void 0 ? null : n;
1424
+ }
1425
+
1426
+ return NullCheck(this[i]);
1427
+ };
1428
+ if (!DOMTokenListProto.toggle || testClass.toggle('a', 0) !== false) DOMTokenListProto.toggle = function (val) {
1429
+ if (arguments.length > 1) return this[arguments[1] ? 'add' : 'remove'](val), !!arguments[1];
1430
+ var oldValue = this.value;
1431
+ return this.remove(oldValue), oldValue === this.value && (this.add(val), true);
1432
+ /*|| false*/
1433
+ };
1434
+ if (!DOMTokenListProto.replace || typeof testClass.replace('a', 'b') !== 'boolean') DOMTokenListProto.replace = function (oldToken, newToken) {
1435
+ checkIfValidClassListEntry('replace', oldToken), checkIfValidClassListEntry('replace', newToken);
1436
+ var oldValue = this.value;
1437
+ return this.remove(oldToken), this.value !== oldValue && (this.add(newToken), true);
1438
+ };
1439
+ if (!DOMTokenListProto.contains) DOMTokenListProto.contains = function (value) {
1440
+ for (var i = 0, Len = this.length; i !== Len; ++i) if (this[i] === value) return true;
1441
+
1442
+ return false;
1443
+ };
1444
+ if (!DOMTokenListProto.forEach) DOMTokenListProto.forEach = function (f) {
1445
+ if (arguments.length === 1) for (var i = 0, Len = this.length; i !== Len; ++i) f(this[i], i, this);else for (var i = 0, Len = this.length, tArg = arguments[1]; i !== Len; ++i) f.call(tArg, this[i], i, this);
1446
+ };
1447
+ if (!DOMTokenListProto.entries) DOMTokenListProto.entries = function () {
1448
+ var nextIndex = 0,
1449
+ that = this;
1450
+ return {
1451
+ next: function () {
1452
+ return nextIndex < that.length ? {
1453
+ value: [nextIndex, that[nextIndex]],
1454
+ done: false
1455
+ } : {
1456
+ done: true
1457
+ };
1458
+ }
1459
+ };
1460
+ };
1461
+ if (!DOMTokenListProto.values) DOMTokenListProto.values = function () {
1462
+ var nextIndex = 0,
1463
+ that = this;
1464
+ return {
1465
+ next: function () {
1466
+ return nextIndex < that.length ? {
1467
+ value: that[nextIndex],
1468
+ done: false
1469
+ } : {
1470
+ done: true
1471
+ };
1472
+ }
1473
+ };
1474
+ };
1475
+ if (!DOMTokenListProto.keys) DOMTokenListProto.keys = function () {
1476
+ var nextIndex = 0,
1477
+ that = this;
1478
+ return {
1479
+ next: function () {
1480
+ return nextIndex < that.length ? {
1481
+ value: nextIndex,
1482
+ done: false
1483
+ } : {
1484
+ done: true
1485
+ };
1486
+ }
1487
+ };
1488
+ };
1489
+ })(window.DOMTokenList.prototype, window.document.createElement('div').classList);
1490
+ })(window);
1491
+
1492
+ var messagesDE = {
1493
+ "eligibility-modal.bullet-1": "Wählen Sie an der Kasse <strong>Alma</strong> .",
1494
+ "eligibility-modal.bullet-2": "Füllen Sie die <strong>angeforderten</strong> Informationen aus.",
1495
+ "eligibility-modal.bullet-3": "Die Bestätigung Ihrer Zahlung <strong>sofort</strong> !",
1496
+ "eligibility-modal.cost": "Davon Kosten",
1497
+ "eligibility-modal.credit-commitment": "Ein Kredit verpflichtet Sie und muss zurückgezahlt werden. Prüfen Sie Ihre Rückzahlungsfähigkeit, bevor Sie sich verpflichten.",
1498
+ "eligibility-modal.credit-cost": "Davon Kreditkosten",
1499
+ "eligibility-modal.credit-cost-amount": "{creditCost} (APR {TAEG})",
1500
+ "eligibility-modal.no-eligibility": "Ups, die Simulation scheint nicht funktioniert zu haben.",
1501
+ "eligibility-modal.title": "<highlighted>Bezahlen Sie in Raten</highlighted> oder später per Kreditkarte mit Alma.",
1502
+ "eligibility-modal.total": "Insgesamt",
1503
+ "installments.today": "Heutzutage",
1504
+ "payment-plan-strings.day-abbreviation": "J{numberOfDeferredDays}",
1505
+ "payment-plan-strings.default-message": "Bezahlen Sie in Raten mit Alma",
1506
+ "payment-plan-strings.deferred": "{totalAmount} zu zahlen am {dueDate}",
1507
+ "payment-plan-strings.ineligible-greater-than-max": "Bis zu {maxAmount}",
1508
+ "payment-plan-strings.ineligible-lower-than-min": "Ab {minAmount}",
1509
+ "payment-plan-strings.multiple-installments": "{numberOfRemainingInstallments, plural, one {{firstInstallmentAmount} dann {numberOfRemainingInstallments} x {othersInstallmentAmount}} other {{firstInstallmentAmount} dann {numberOfRemainingInstallments} x {othersInstallmentAmount}}}",
1510
+ "payment-plan-strings.multiple-installments-same-amount": "{installmentsCount} x {totalAmount}",
1511
+ "payment-plan-strings.no-fee": "(gebührenfrei)"
1512
+ };
1513
+
1514
+ var messagesEN = {
1515
+ "eligibility-modal.bullet-1": "Choose <strong>Alma</strong> at checkout.",
1516
+ "eligibility-modal.bullet-2": "Fill in the <strong>information</strong> requested.",
1517
+ "eligibility-modal.bullet-3": "Validation of your payment <strong>instantaneous</strong>!",
1518
+ "eligibility-modal.cost": "Of which costs",
1519
+ "eligibility-modal.credit-commitment": "A loan commits you and must be repaid. Check your ability to repay before committing yourself.",
1520
+ "eligibility-modal.credit-cost": "Of which cost of credit",
1521
+ "eligibility-modal.credit-cost-amount": "{creditCost} (APR {TAEG})",
1522
+ "eligibility-modal.no-eligibility": "Oops, looks like the simulation didn't work.",
1523
+ "eligibility-modal.title": "<highlighted>Pay in installments</highlighted> or later by credit card with Alma.",
1524
+ "eligibility-modal.total": "Total",
1525
+ "installments.today": "Today",
1526
+ "payment-plan-strings.day-abbreviation": "T{numberOfDeferredDays}",
1527
+ "payment-plan-strings.default-message": "Pay in installments with Alma",
1528
+ "payment-plan-strings.deferred": "{totalAmount} to be paid on {dueDate}",
1529
+ "payment-plan-strings.ineligible-greater-than-max": "Until {maxAmount}",
1530
+ "payment-plan-strings.ineligible-lower-than-min": "From {minAmount}",
1531
+ "payment-plan-strings.multiple-installments": "{numberOfRemainingInstallments, plural, one {{firstInstallmentAmount} then {numberOfRemainingInstallments} x {othersInstallmentAmount}} other {{firstInstallmentAmount} then {numberOfRemainingInstallments} x {othersInstallmentAmount}}}",
1532
+ "payment-plan-strings.multiple-installments-same-amount": "{installmentsCount} x {totalAmount}",
1533
+ "payment-plan-strings.no-fee": "(free of charge)"
1534
+ };
1535
+
1536
+ var messagesES = {
1537
+ "eligibility-modal.bullet-1": "Elige <strong>Alma</strong> como método de pago.",
1538
+ "eligibility-modal.bullet-2": "Completa la <strong>información</strong> solicitada.",
1539
+ "eligibility-modal.bullet-3": "¡Validación <strong>inmediata</strong> de tu pago!",
1540
+ "eligibility-modal.cost": "Gastos (incl. en el total)",
1541
+ "eligibility-modal.credit-commitment": "Un préstamo te compromete y debe ser devuelto. Comprueba tu capacidad financiera antes de comprometerte.",
1542
+ "eligibility-modal.credit-cost": "Coste de crédito (incl. en el total)",
1543
+ "eligibility-modal.credit-cost-amount": "{creditCost} (TAE {TAEG})",
1544
+ "eligibility-modal.no-eligibility": "Uy, parece que la simulación no ha funcionado.",
1545
+ "eligibility-modal.title": "<highlighted>Paga a plazos</highlighted> o más adelante con tu tarjeta, a través de Alma.",
1546
+ "eligibility-modal.total": "Total",
1547
+ "installments.today": "Hoy",
1548
+ "payment-plan-strings.day-abbreviation": "D{numberOfDeferredDays}",
1549
+ "payment-plan-strings.default-message": "Pagar a plazos con Alma",
1550
+ "payment-plan-strings.deferred": "{totalAmount} a pagar el {dueDate}",
1551
+ "payment-plan-strings.ineligible-greater-than-max": "Hasta {maxAmount}",
1552
+ "payment-plan-strings.ineligible-lower-than-min": "Desde {minAmount}",
1553
+ "payment-plan-strings.multiple-installments": "{numberOfRemainingInstallments, plural, one {{firstInstallmentAmount} hoy, después {numberOfRemainingInstallments} mensualidad de {othersInstallmentAmount}} other {{firstInstallmentAmount} hoy, después {numberOfRemainingInstallments} de {othersInstallmentAmount} mensualidades }}",
1554
+ "payment-plan-strings.multiple-installments-same-amount": "{installmentsCount} plazos de {totalAmount}",
1555
+ "payment-plan-strings.no-fee": "(sin intereses)"
1556
+ };
1557
+
1558
+ var messagesFR = {
1559
+ "eligibility-modal.bullet-1": "Choisissez <strong>Alma</strong> au moment du paiement.",
1560
+ "eligibility-modal.bullet-2": "Renseignez les <strong>informations</strong> demandées.",
1561
+ "eligibility-modal.bullet-3": "La validation de votre paiement <strong>instantanée</strong> !",
1562
+ "eligibility-modal.cost": "Dont frais",
1563
+ "eligibility-modal.credit-commitment": "Un crédit vous engage et doit être remboursé. Vérifiez vos capacités de remboursement avant de vous engager.",
1564
+ "eligibility-modal.credit-cost": "Dont coût du crédit",
1565
+ "eligibility-modal.credit-cost-amount": "{creditCost} (TAEG {TAEG})",
1566
+ "eligibility-modal.no-eligibility": "Oups, il semblerait que la simulation n'aie pas fonctionné.",
1567
+ "eligibility-modal.title": "<highlighted>Payez en plusieurs fois</highlighted> ou plus tard par carte bancaire avec Alma.",
1568
+ "eligibility-modal.total": "Total",
1569
+ "installments.today": "Aujourd'hui",
1570
+ "payment-plan-strings.day-abbreviation": "J{numberOfDeferredDays}",
1571
+ "payment-plan-strings.default-message": "Payez en plusieurs fois avec Alma",
1572
+ "payment-plan-strings.deferred": "{totalAmount} à payer le {dueDate}",
1573
+ "payment-plan-strings.ineligible-greater-than-max": "Jusqu'à {maxAmount}",
1574
+ "payment-plan-strings.ineligible-lower-than-min": "À partir de {minAmount}",
1575
+ "payment-plan-strings.multiple-installments": "{numberOfRemainingInstallments, plural, one {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}} other {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}}}",
1576
+ "payment-plan-strings.multiple-installments-same-amount": "{installmentsCount} x {totalAmount}",
1577
+ "payment-plan-strings.no-fee": "(sans frais)"
1578
+ };
1579
+
1580
+ var messagesIT = {
1581
+ "eligibility-modal.bullet-1": "Scegli <strong>Alma</strong> alla cassa.",
1582
+ "eligibility-modal.bullet-2": "Compila le informazioni <strong></strong> richieste.",
1583
+ "eligibility-modal.bullet-3": "Convalida del tuo pagamento <strong>istantanea</strong>!",
1584
+ "eligibility-modal.cost": "Di cui commissioni",
1585
+ "eligibility-modal.credit-commitment": "Un pagamento rateale ti impegna e deve essere ripagato. Verifica la tua capacità di rimborso prima di impegnarti.",
1586
+ "eligibility-modal.credit-cost": "Di cui commissioni",
1587
+ "eligibility-modal.credit-cost-amount": "{creditCost} (TAEG {TAEG})",
1588
+ "eligibility-modal.no-eligibility": "Ops, sembra che la simulazione non abbia funzionato.",
1589
+ "eligibility-modal.title": "<highlighted>Paga a rate</highlighted> e posticipa il pagamento con Alma, senza interessi.",
1590
+ "eligibility-modal.total": "Totale",
1591
+ "installments.today": "Oggi",
1592
+ "payment-plan-strings.day-abbreviation": "G{numberOfDeferredDays}",
1593
+ "payment-plan-strings.default-message": "Paga a rate con Alma",
1594
+ "payment-plan-strings.deferred": "{totalAmount} da pagare il {dueDate}",
1595
+ "payment-plan-strings.ineligible-greater-than-max": "Disponibile fino a {maxAmount}",
1596
+ "payment-plan-strings.ineligible-lower-than-min": "Pagamento rateale disponibile a partire da {minAmount}",
1597
+ "payment-plan-strings.multiple-installments": "{numberOfRemainingInstallments, plural, one {Oggi paghi {firstInstallmentAmount} poi {numberOfRemainingInstallments} rata mensile di {othersInstallmentAmount}} other {Oggi paghi {firstInstallmentAmount} poi {numberOfRemainingInstallments} rate mensili di {othersInstallmentAmount}}}",
1598
+ "payment-plan-strings.multiple-installments-same-amount": "In {installmentsCount} rate mensili di {totalAmount}",
1599
+ "payment-plan-strings.no-fee": "(senza interessi)"
1600
+ };
1601
+
1602
+ var messagesNL = {
1603
+ "eligibility-modal.bullet-1": "Kies <strong>Alma</strong> bij het afrekenen.",
1604
+ "eligibility-modal.bullet-2": "Vul de <strong>gevraagde informatie</strong> in.",
1605
+ "eligibility-modal.bullet-3": "Validatie van uw betaling <strong>onmiddellijk</strong>!",
1606
+ "eligibility-modal.cost": "Waarvan kosten",
1607
+ "eligibility-modal.credit-commitment": "Een lening bindt je en moet worden terugbetaald. Ga na of u kunt terugbetalen voordat u zich vastlegt.",
1608
+ "eligibility-modal.credit-cost": "Waarvan kosten van krediet",
1609
+ "eligibility-modal.credit-cost-amount": "{creditCost} (APR {TAEG})",
1610
+ "eligibility-modal.no-eligibility": "Oeps, het lijkt erop dat de simulatie niet werkte.",
1611
+ "eligibility-modal.title": "<highlighted>Betaal in termijnen</highlighted> of later per credit card met Alma.",
1612
+ "eligibility-modal.total": "Totaal",
1613
+ "installments.today": "Tegenwoordig",
1614
+ "payment-plan-strings.day-abbreviation": "J{numberOfDeferredDays}",
1615
+ "payment-plan-strings.default-message": "Betaal in termijnen met Alma",
1616
+ "payment-plan-strings.deferred": "{totalAmount} te betalen op {dueDate}",
1617
+ "payment-plan-strings.ineligible-greater-than-max": "Tot {maxAmount}",
1618
+ "payment-plan-strings.ineligible-lower-than-min": "Van {minAmount}",
1619
+ "payment-plan-strings.multiple-installments": "{numberOfRemainingInstallments, plural, one {{firstInstallmentAmount} dan {numberOfRemainingInstallments} x {othersInstallmentAmount}} other {{firstInstallmentAmount} dan {numberOfRemainingInstallments} x {othersInstallmentAmount}}}",
1620
+ "payment-plan-strings.multiple-installments-same-amount": "{installmentsCount} x {totalAmount}",
1621
+ "payment-plan-strings.no-fee": "(gratis)"
1622
+ };
1623
+
1624
+ const getTranslationsByLocale = locale => {
1625
+ switch (locale) {
1626
+ case Locale.fr:
1627
+ return messagesFR;
1628
+
1629
+ case Locale.en:
1630
+ return messagesEN;
1631
+
1632
+ case Locale.es:
1633
+ return messagesES;
1634
+
1635
+ case Locale.it:
1636
+ return messagesIT;
1637
+
1638
+ case Locale.de:
1639
+ return messagesDE;
1640
+
1641
+ case Locale.nl:
1642
+ case Locale['nl-BE']:
1643
+ case Locale['nl-NL']:
1644
+ return messagesNL;
1645
+
1646
+ default:
1647
+ return messagesEN;
1648
+ }
1649
+ };
1650
+
1651
+ const Provider = ({
1652
+ children,
1653
+ locale
1654
+ }) => /*#__PURE__*/React.createElement(IntlProvider, {
1655
+ messages: getTranslationsByLocale(locale),
1656
+ locale: locale,
1657
+ defaultLocale: "en"
1658
+ }, children);
1659
+
1660
+ function _extends() {
1661
+ _extends = Object.assign || function (target) {
1662
+ for (var i = 1; i < arguments.length; i++) {
1663
+ var source = arguments[i];
1664
+
1665
+ for (var key in source) {
1666
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1667
+ target[key] = source[key];
1668
+ }
1669
+ }
1670
+ }
1671
+
1672
+ return target;
1673
+ };
1674
+
1675
+ return _extends.apply(this, arguments);
1676
+ }
1677
+
1678
+ function _objectWithoutPropertiesLoose(source, excluded) {
1679
+ if (source == null) return {};
1680
+ var target = {};
1681
+ var sourceKeys = Object.keys(source);
1682
+ var key, i;
1683
+
1684
+ for (i = 0; i < sourceKeys.length; i++) {
1685
+ key = sourceKeys[i];
1686
+ if (excluded.indexOf(key) >= 0) continue;
1687
+ target[key] = source[key];
1688
+ }
1689
+
1690
+ return target;
1691
+ }
1692
+
1693
+ async function fetchFromApi(url = '', data, headers) {
1694
+ const response = await fetch(url, {
1695
+ method: 'POST',
1696
+ headers: _extends({
1697
+ 'Content-Type': 'application/json'
1698
+ }, headers),
1699
+ body: JSON.stringify(data)
1700
+ });
1701
+ return response.json();
1702
+ }
1703
+
1704
+ const filterELigibility = (eligibilities, configPlans) => {
1705
+ // Remove p1x
1706
+ const filteredEligibilityPlans = eligibilities.filter(plan => !(plan.installments_count === 1 && plan.deferred_days === 0 && plan.deferred_months === 0)); // If no configPlans was provided, return eligibility response
1707
+
1708
+ if (!configPlans) {
1709
+ return filteredEligibilityPlans;
1710
+ } // Else check if the plan is eligible regarding the related configPlan
1711
+
1712
+
1713
+ return filteredEligibilityPlans.map(plan => {
1714
+ const eligibilityDeferredDays = (plan.deferred_months ? plan.deferred_months : 0) * 30 + (plan.deferred_days ? plan.deferred_days : 0); // find the related configPlan
1715
+
1716
+ const relatedConfigPlan = configPlans.find(configPlan => {
1717
+ const configPlanDeferredDays = (configPlan.deferredMonths ? configPlan.deferredMonths : 0) * 30 + (configPlan.deferredDays ? configPlan.deferredDays : 0);
1718
+ return plan.installments_count === configPlan.installmentsCount && eligibilityDeferredDays === configPlanDeferredDays;
1719
+ });
1720
+ return _extends({}, plan, {
1721
+ eligible: relatedConfigPlan ? plan.purchase_amount >= (relatedConfigPlan == null ? void 0 : relatedConfigPlan.minAmount) && plan.purchase_amount <= (relatedConfigPlan == null ? void 0 : relatedConfigPlan.maxAmount) : false,
1722
+ minAmount: relatedConfigPlan == null ? void 0 : relatedConfigPlan.minAmount,
1723
+ maxAmount: relatedConfigPlan == null ? void 0 : relatedConfigPlan.maxAmount
1724
+ });
1725
+ });
1726
+ };
1727
+
1728
+ const useFetchEligibility = (purchaseAmount, {
1729
+ domain,
1730
+ merchantId
1731
+ }, plans) => {
1732
+ const [eligibility, setEligibility] = useState([]);
1733
+ const [status, setStatus] = useState(apiStatus.PENDING);
1734
+ const configInstallments = plans == null ? void 0 : plans.map(plan => ({
1735
+ installments_count: plan.installmentsCount,
1736
+ deferred_days: plan == null ? void 0 : plan.deferredDays,
1737
+ deferred_months: plan == null ? void 0 : plan.deferredMonths
1738
+ }));
1739
+ useEffect(() => {
1740
+ if (status === apiStatus.PENDING) {
1741
+ fetchFromApi(domain + '/v2/payments/eligibility', {
1742
+ purchase_amount: purchaseAmount,
1743
+ queries: configInstallments
1744
+ }, {
1745
+ Authorization: `Alma-Merchant-Auth ${merchantId}`
1746
+ }).then(res => {
1747
+ setEligibility(res);
1748
+ setStatus(apiStatus.SUCCESS);
1749
+ }).catch(() => {
1750
+ setStatus(apiStatus.FAILED);
1751
+ });
1752
+ }
1753
+ }, [status]);
1754
+ return [filterELigibility(eligibility, plans), status];
1755
+ };
1756
+
1757
+ var s = {"loadingIndicator":"_31lrj","letter":"_2p94X","loading-indicator-letter":"_229P7","bar":"_1k0PM","loading-indicator-bar":"_2cX7o"};
1758
+
1759
+ const LoadingIndicator = ({
1760
+ className
1761
+ }) => {
1762
+ return /*#__PURE__*/React.createElement("div", {
1763
+ className: cx(s.loadingIndicator, className),
1764
+ "data-testid": "loader"
1765
+ }, /*#__PURE__*/React.createElement("div", {
1766
+ className: s.letter
1767
+ }, "a"), /*#__PURE__*/React.createElement("div", {
1768
+ className: s.bar
1769
+ }));
1770
+ };
1771
+
1772
+ var s$1 = {"modal":"_D8SjB","content":"_ocM9x","contentScrollable":"_1GP2F","overlay":"_1yxCb","header":"_12LLh","closeButton":"_3YRro"};
1773
+
1774
+ function CrossIcon({
1775
+ color = '#fff',
1776
+ className
1777
+ }) {
1778
+ return /*#__PURE__*/React.createElement("svg", {
1779
+ className: className,
1780
+ width: "16",
1781
+ height: "16",
1782
+ viewBox: "0 0 16 16",
1783
+ fill: "none",
1784
+ xmlns: "http://www.w3.org/2000/svg"
1785
+ }, /*#__PURE__*/React.createElement("path", {
1786
+ d: "M12.5964 11.404L9.41445 8.22205L12.5964 5.04007C12.7732 4.86329 12.7732 4.50974 12.5964 4.33296L11.8893 3.62585C11.6904 3.42698 11.359 3.44908 11.1822 3.62585L8.00023 6.80783L4.81825 3.62585C4.61938 3.42698 4.28792 3.44908 4.11114 3.62585L3.40404 4.33296C3.20516 4.53183 3.20516 4.84119 3.40404 5.04007L6.58602 8.22205L3.40404 11.404C3.20516 11.6029 3.20517 11.9123 3.40404 12.1111L4.11115 12.8182C4.28792 12.995 4.61938 13.0171 4.81825 12.8182L8.00023 9.63626L11.1822 12.8182C11.359 12.995 11.6904 13.0171 11.8893 12.8182L12.5964 12.1111C12.7732 11.9344 12.7732 11.5808 12.5964 11.404Z",
1787
+ fill: color
1788
+ }));
1789
+ }
1790
+
1791
+ const ControlledModal = (_ref) => {
1792
+ let {
1793
+ children,
1794
+ isOpen,
1795
+ onClose,
1796
+ className,
1797
+ contentClassName,
1798
+ scrollable = false
1799
+ } = _ref,
1800
+ props = _objectWithoutPropertiesLoose(_ref, ["children", "isOpen", "onClose", "className", "contentClassName", "scrollable"]);
1801
+
1802
+ Modal.setAppElement('body');
1803
+ return /*#__PURE__*/React.createElement(Modal, Object.assign({
1804
+ className: cx(s$1.modal, className),
1805
+ overlayClassName: s$1.overlay,
1806
+ onAfterOpen: () => {
1807
+ noScroll.on();
1808
+ },
1809
+ onAfterClose: () => {
1810
+ noScroll.off();
1811
+ },
1812
+ onRequestClose: onClose,
1813
+ isOpen: isOpen,
1814
+ shouldCloseOnOverlayClick: true,
1815
+ shouldCloseOnEsc: true
1816
+ }, props), /*#__PURE__*/React.createElement("div", {
1817
+ className: s$1.header
1818
+ }, /*#__PURE__*/React.createElement("button", {
1819
+ onClick: onClose,
1820
+ className: s$1.closeButton,
1821
+ "data-testid": "modal-close-button"
1822
+ }, /*#__PURE__*/React.createElement(CrossIcon, null))), /*#__PURE__*/React.createElement("div", {
1823
+ className: cx(s$1.content, contentClassName, {
1824
+ [s$1.contentScrollable]: scrollable
1825
+ })
1826
+ }, children));
1827
+ };
1828
+
1829
+ const paymentPlanShorthandName = payment => {
1830
+ const {
1831
+ deferred_days,
1832
+ deferred_months,
1833
+ installments_count: installmentsCount
1834
+ } = payment;
1835
+ const deferredDaysCount = deferred_days + deferred_months * 30;
1836
+
1837
+ if (installmentsCount === 1) {
1838
+ return /*#__PURE__*/React.createElement(FormattedMessage, {
1839
+ id: "payment-plan-strings.day-abbreviation",
1840
+ defaultMessage: "J{numberOfDeferredDays}",
1841
+ values: {
1842
+ numberOfDeferredDays: deferredDaysCount > 0 ? `+${deferredDaysCount}` : ''
1843
+ }
1844
+ });
1845
+ } else {
1846
+ return `${installmentsCount}x`;
1847
+ }
1848
+ };
1849
+ const paymentPlanInfoText = payment => {
1850
+ const {
1851
+ deferred_days,
1852
+ deferred_months,
1853
+ installments_count: installmentsCount,
1854
+ eligible,
1855
+ purchase_amount: purchaseAmount,
1856
+ minAmount = 0,
1857
+ maxAmount = 0
1858
+ } = payment;
1859
+ const deferredDaysCount = deferred_days + deferred_months * 30;
1860
+
1861
+ const withNoFee = () => {
1862
+ if (payment.payment_plan.every(plan => plan.customer_fee === 0 && plan.customer_interest === 0)) {
1863
+ return /*#__PURE__*/React.createElement(React.Fragment, null, ' ', /*#__PURE__*/React.createElement(FormattedMessage, {
1864
+ id: "payment-plan-strings.no-fee",
1865
+ defaultMessage: '(sans frais)'
1866
+ }));
1867
+ }
1868
+ };
1869
+
1870
+ if (!eligible) {
1871
+ return purchaseAmount > maxAmount ? /*#__PURE__*/React.createElement(FormattedMessage, {
1872
+ id: "payment-plan-strings.ineligible-greater-than-max",
1873
+ defaultMessage: "Jusqu'\u00E0 {maxAmount}",
1874
+ values: {
1875
+ maxAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
1876
+ value: priceFromCents(maxAmount),
1877
+ style: "currency",
1878
+ currency: "EUR"
1879
+ })
1880
+ }
1881
+ }) : /*#__PURE__*/React.createElement(FormattedMessage, {
1882
+ id: "payment-plan-strings.ineligible-lower-than-min",
1883
+ defaultMessage: "\u00C0 partir de {minAmount}",
1884
+ values: {
1885
+ minAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
1886
+ value: priceFromCents(minAmount),
1887
+ style: "currency",
1888
+ currency: "EUR"
1889
+ })
1890
+ }
1891
+ });
1892
+ } else if (deferredDaysCount !== 0 && installmentsCount === 1) {
1893
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
1894
+ id: "payment-plan-strings.deferred",
1895
+ defaultMessage: "{totalAmount} \u00E0 payer le {dueDate}",
1896
+ values: {
1897
+ totalAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
1898
+ value: priceFromCents(payment.payment_plan[0].total_amount),
1899
+ style: "currency",
1900
+ currency: "EUR"
1901
+ }),
1902
+ dueDate: /*#__PURE__*/React.createElement(FormattedDate, {
1903
+ value: secondsToMilliseconds(payment.payment_plan[0].due_date),
1904
+ day: "numeric",
1905
+ month: "long",
1906
+ year: "numeric"
1907
+ })
1908
+ }
1909
+ }), withNoFee());
1910
+ } else if (installmentsCount > 0) {
1911
+ const areInstallmentsOfSameAmount = payment.payment_plan.every((installment, index) => index === 0 || installment.total_amount === payment.payment_plan[0].total_amount);
1912
+
1913
+ if (areInstallmentsOfSameAmount) {
1914
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
1915
+ id: "payment-plan-strings.multiple-installments-same-amount",
1916
+ defaultMessage: "{installmentsCount} x {totalAmount}",
1917
+ values: {
1918
+ totalAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
1919
+ value: priceFromCents(payment.payment_plan[0].total_amount),
1920
+ style: "currency",
1921
+ currency: "EUR"
1922
+ }),
1923
+ installmentsCount
1924
+ }
1925
+ }), withNoFee());
1926
+ }
1927
+
1928
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
1929
+ id: "payment-plan-strings.multiple-installments",
1930
+ defaultMessage: "{numberOfRemainingInstallments, plural, one {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}} other {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}}}",
1931
+ values: {
1932
+ firstInstallmentAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
1933
+ value: priceFromCents(payment.payment_plan[0].total_amount),
1934
+ style: "currency",
1935
+ currency: "EUR"
1936
+ }),
1937
+ numberOfRemainingInstallments: installmentsCount - 1,
1938
+ othersInstallmentAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
1939
+ value: priceFromCents(payment.payment_plan[1].total_amount),
1940
+ style: "currency",
1941
+ currency: "EUR"
1942
+ })
1943
+ }
1944
+ }), withNoFee());
1945
+ }
1946
+
1947
+ return /*#__PURE__*/React.createElement(FormattedMessage, {
1948
+ id: "payment-plan-strings.default-message",
1949
+ defaultMessage: "Payez en plusieurs fois avec Alma"
1950
+ });
1951
+ };
1952
+
1953
+ var s$2 = {"buttons":"_1l2Oa","active":"_3rue7"};
1954
+
1955
+ const EligibilityPlansButtons = ({
1956
+ eligibilityPlans,
1957
+ currentPlanIndex,
1958
+ setCurrentPlanIndex
1959
+ }) => /*#__PURE__*/React.createElement("div", {
1960
+ className: s$2.buttons
1961
+ }, eligibilityPlans.map((eligibilityPlan, index) => /*#__PURE__*/React.createElement("button", {
1962
+ key: index,
1963
+ className: cx({
1964
+ [s$2.active]: index === currentPlanIndex
1965
+ }),
1966
+ onClick: () => setCurrentPlanIndex(index)
1967
+ }, paymentPlanShorthandName(eligibilityPlan))));
1968
+
1969
+ var s$3 = {"schedule":"_MPKjS","scheduleLine":"_1A7Qv","total":"_14Ejo","creditCost":"_1ZIgu","creditMessage":"_1BUr8"};
1970
+
1971
+ const Schedule = ({
1972
+ currentPlan
1973
+ }) => {
1974
+ const total = currentPlan && priceFromCents(currentPlan.purchase_amount + currentPlan.customer_total_cost_amount);
1975
+ const creditCost = currentPlan ? priceFromCents(currentPlan.customer_total_cost_amount) : 0;
1976
+ const TAEG = (currentPlan == null ? void 0 : currentPlan.annual_interest_rate) && currentPlan.annual_interest_rate / 10000;
1977
+ const customerFees = priceFromCents(currentPlan ? currentPlan.customer_total_cost_amount : 0);
1978
+ const isCredit = currentPlan && currentPlan.installments_count > 4;
1979
+ const intl = useIntl();
1980
+ return /*#__PURE__*/React.createElement("div", {
1981
+ className: s$3.schedule,
1982
+ "data-testid": "modal-installments-element"
1983
+ }, /*#__PURE__*/React.createElement("div", {
1984
+ className: cx(s$3.scheduleLine, s$3.total)
1985
+ }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedMessage, {
1986
+ id: "eligibility-modal.total",
1987
+ defaultMessage: "Total"
1988
+ })), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedNumber, {
1989
+ value: total,
1990
+ style: "currency",
1991
+ currency: "EUR"
1992
+ }))), /*#__PURE__*/React.createElement("div", {
1993
+ className: cx(s$3.scheduleLine, s$3.creditCost)
1994
+ }, isCredit ? /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedMessage, {
1995
+ id: "eligibility-modal.credit-cost",
1996
+ defaultMessage: "Dont co\u00FBt du cr\u00E9dit"
1997
+ })) : /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedMessage, {
1998
+ id: "eligibility-modal.cost",
1999
+ defaultMessage: "Dont frais"
2000
+ })), /*#__PURE__*/React.createElement("span", null, isCredit ? /*#__PURE__*/React.createElement(FormattedMessage, {
2001
+ id: "eligibility-modal.credit-cost-amount",
2002
+ defaultMessage: "{creditCost} (TAEG {TAEG})",
2003
+ values: {
2004
+ creditCost: intl.formatNumber(creditCost, {
2005
+ style: 'currency',
2006
+ currency: 'EUR'
2007
+ }),
2008
+ TAEG: intl.formatNumber(TAEG != null ? TAEG : 0, {
2009
+ style: 'percent',
2010
+ maximumFractionDigits: 2
2011
+ })
2012
+ }
2013
+ }) : /*#__PURE__*/React.createElement(FormattedNumber, {
2014
+ value: customerFees,
2015
+ style: "currency",
2016
+ currency: "EUR"
2017
+ }))), ((currentPlan == null ? void 0 : currentPlan.payment_plan) || []).map((installment, index) => /*#__PURE__*/React.createElement("div", {
2018
+ className: s$3.scheduleLine,
2019
+ key: index
2020
+ }, /*#__PURE__*/React.createElement("span", null, isToday(installment.due_date * 1000) ? /*#__PURE__*/React.createElement(FormattedMessage, {
2021
+ id: "installments.today",
2022
+ defaultMessage: "Aujourd'hui"
2023
+ }) : /*#__PURE__*/React.createElement(FormattedDate, {
2024
+ value: installment.due_date * 1000,
2025
+ day: "numeric",
2026
+ month: "long",
2027
+ year: "numeric"
2028
+ })), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedNumber, {
2029
+ value: priceFromCents(installment.total_amount),
2030
+ style: "currency",
2031
+ currency: "EUR"
2032
+ })))), isCredit && /*#__PURE__*/React.createElement("p", {
2033
+ className: s$3.creditMessage
2034
+ }, /*#__PURE__*/React.createElement(FormattedMessage, {
2035
+ id: "eligibility-modal.credit-commitment",
2036
+ defaultMessage: "Un cr\u00E9dit vous engage et doit \u00EAtre rembours\u00E9. V\u00E9rifiez vos capacit\u00E9s de remboursement\n avant de vous engager."
2037
+ })));
2038
+ };
2039
+
2040
+ var s$4 = {"list":"_180ro","listItem":"_1HqCO","bullet":"_3B8wx"};
2041
+
2042
+ const Info = () => /*#__PURE__*/React.createElement("div", {
2043
+ className: s$4.list,
2044
+ "data-testid": "modal-info-element"
2045
+ }, /*#__PURE__*/React.createElement("div", {
2046
+ className: s$4.listItem
2047
+ }, /*#__PURE__*/React.createElement("div", {
2048
+ className: s$4.bullet
2049
+ }, "1"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FormattedMessage, {
2050
+ id: "eligibility-modal.bullet-1",
2051
+ defaultMessage: "Choisissez <strong>Alma</strong> au moment du paiement.",
2052
+ values: {
2053
+ strong: (...chunks) => /*#__PURE__*/React.createElement("strong", null, chunks)
2054
+ }
2055
+ }))), /*#__PURE__*/React.createElement("div", {
2056
+ className: s$4.listItem
2057
+ }, /*#__PURE__*/React.createElement("div", {
2058
+ className: s$4.bullet
2059
+ }, "2"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FormattedMessage, {
2060
+ id: "eligibility-modal.bullet-2",
2061
+ defaultMessage: "Renseignez les <strong>informations</strong> demand\u00E9es.",
2062
+ values: {
2063
+ strong: (...chunks) => /*#__PURE__*/React.createElement("strong", null, chunks)
2064
+ }
2065
+ }))), /*#__PURE__*/React.createElement("div", {
2066
+ className: s$4.listItem
2067
+ }, /*#__PURE__*/React.createElement("div", {
2068
+ className: s$4.bullet
2069
+ }, "3"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FormattedMessage, {
2070
+ id: "eligibility-modal.bullet-3",
2071
+ defaultMessage: "La validation de votre paiement <strong>instantan\u00E9e</strong> !",
2072
+ values: {
2073
+ strong: (...chunks) => /*#__PURE__*/React.createElement("strong", null, chunks)
2074
+ }
2075
+ }))));
2076
+
2077
+ function LogoIcon({
2078
+ color = '#00425D',
2079
+ underlineColor = '#00425D',
2080
+ className
2081
+ }) {
2082
+ return /*#__PURE__*/React.createElement("svg", {
2083
+ className: className,
2084
+ width: "35",
2085
+ height: "23",
2086
+ viewBox: "0 0 40 23",
2087
+ fill: "none",
2088
+ xmlns: "http://www.w3.org/2000/svg"
2089
+ }, /*#__PURE__*/React.createElement("path", {
2090
+ d: "M6.38546 10.1313V10.029H4.92542C4.23835 10.029 3.72877 10.0972 3.39668 10.2337C3.07605 10.3587 2.91573 10.6374 2.91573 11.0695C2.91573 11.7177 3.37378 12.0418 4.28988 12.0418C5.05711 12.0418 5.59532 11.8826 5.9045 11.5642C6.22514 11.2344 6.38546 10.7568 6.38546 10.1313ZM3.72304 13.9182C2.64663 13.9182 1.85076 13.6567 1.33546 13.1335C0.820153 12.599 0.5625 11.911 0.5625 11.0695C0.5625 10.0574 0.894586 9.32958 1.55876 8.88606C2.22293 8.43118 3.23636 8.20374 4.59906 8.20374H6.38546V7.82846C6.38546 6.98693 5.84725 6.56616 4.77083 6.56616C3.80893 6.56616 3.27644 6.93007 3.17338 7.65788H0.768622C0.848781 6.78223 1.21522 6.04873 1.86794 5.45738C2.52066 4.86603 3.50547 4.57036 4.82236 4.57036C6.1278 4.57036 7.11261 4.86035 7.77678 5.44032C8.44095 6.0203 8.77304 6.83909 8.77304 7.89669V13.7135H6.60875V12.7241C6.09345 13.5202 5.13155 13.9182 3.72304 13.9182Z",
2091
+ fill: color
2092
+ }), /*#__PURE__*/React.createElement("path", {
2093
+ d: "M14.2554 11.6324V13.6965C14.0149 13.7306 13.763 13.7476 13.4996 13.7476C12.5492 13.7476 11.8736 13.5486 11.4728 13.1506C11.072 12.7412 10.8716 12.0873 10.8716 11.1889V0.919922H13.3107V11.0183C13.3107 11.2344 13.3508 11.3936 13.4309 11.496C13.5111 11.5983 13.6771 11.6495 13.929 11.6495C13.9863 11.6495 14.0493 11.6495 14.118 11.6495C14.1982 11.6381 14.244 11.6324 14.2554 11.6324Z",
2094
+ fill: color
2095
+ }), /*#__PURE__*/React.createElement("path", {
2096
+ d: "M23.8943 8.63019V13.7135H21.4552V8.40844C21.4552 7.23711 20.9742 6.65145 20.0123 6.65145C19.4512 6.65145 19.0161 6.82203 18.7069 7.16319C18.4092 7.50436 18.2603 7.9763 18.2603 8.57902V13.7135H15.8212V4.77506H18.0714V5.86678C18.5409 5.0025 19.4054 4.57036 20.6651 4.57036C21.856 4.57036 22.7263 4.99113 23.2759 5.83266C24.0432 4.99113 25.0394 4.57036 26.2647 4.57036C27.3182 4.57036 28.1255 4.89446 28.6867 5.54267C29.2478 6.19088 29.5283 7.05516 29.5283 8.13551V13.7135H27.0892V8.40844C27.0892 7.23711 26.6083 6.65145 25.6464 6.65145C25.0738 6.65145 24.6386 6.82772 24.3409 7.18025C24.0432 7.52141 23.8943 8.00473 23.8943 8.63019Z",
2097
+ fill: color
2098
+ }), /*#__PURE__*/React.createElement("path", {
2099
+ d: "M37.0321 10.1313V10.029H35.572C34.885 10.029 34.3754 10.0972 34.0433 10.2337C33.7227 10.3587 33.5623 10.6374 33.5623 11.0695C33.5623 11.7177 34.0204 12.0418 34.9365 12.0418C35.7037 12.0418 36.2419 11.8826 36.5511 11.5642C36.8717 11.2344 37.0321 10.7568 37.0321 10.1313ZM34.3696 13.9182C33.2932 13.9182 32.4974 13.6567 31.9821 13.1335C31.4668 12.599 31.2091 11.911 31.2091 11.0695C31.2091 10.0574 31.5412 9.32958 32.2054 8.88606C32.8695 8.43118 33.883 8.20374 35.2457 8.20374H37.0321V7.82846C37.0321 6.98693 36.4939 6.56616 35.4174 6.56616C34.4555 6.56616 33.923 6.93007 33.82 7.65788H31.4152C31.4954 6.78223 31.8618 6.04873 32.5145 5.45738C33.1673 4.86603 34.1521 4.57036 35.469 4.57036C36.7744 4.57036 37.7592 4.86035 38.4234 5.44032C39.0876 6.0203 39.4196 6.83909 39.4196 7.89669V13.7135H37.2554V12.7241C36.7401 13.5202 35.7781 13.9182 34.3696 13.9182Z",
2100
+ fill: color
2101
+ }), /*#__PURE__*/React.createElement("rect", {
2102
+ y: "20",
2103
+ width: "40",
2104
+ height: "3",
2105
+ fill: underlineColor
2106
+ }));
2107
+ }
2108
+
2109
+ var s$5 = {"logo":"_3Oyv_"};
2110
+
2111
+ const Logo = () => /*#__PURE__*/React.createElement("div", {
2112
+ className: s$5.logo
2113
+ }, /*#__PURE__*/React.createElement(LogoIcon, {
2114
+ underlineColor: "#FF414D"
2115
+ }));
2116
+
2117
+ var s$6 = {"title":"_3ERx-"};
2118
+
2119
+ const Title = () => /*#__PURE__*/React.createElement("div", {
2120
+ className: s$6.title,
2121
+ "data-testid": "modal-title-element"
2122
+ }, /*#__PURE__*/React.createElement(FormattedMessage, {
2123
+ id: "eligibility-modal.title",
2124
+ defaultMessage: "<highlighted>Payez en plusieurs fois</highlighted> ou plus tard par carte bancaire avec Alma.",
2125
+ values: {
2126
+ highlighted: (...chunks) => /*#__PURE__*/React.createElement("span", null, chunks)
2127
+ }
2128
+ }));
2129
+
2130
+ var s$7 = {"container":"_21g6u","block":"_3zaP5","left":"_2SBRC"};
2131
+
2132
+ const DesktopModal = ({
2133
+ children
2134
+ }) => /*#__PURE__*/React.createElement("div", {
2135
+ className: s$7.container,
2136
+ "data-testid": "modal-container"
2137
+ }, /*#__PURE__*/React.createElement("div", {
2138
+ className: cx([s$7.block, s$7.left])
2139
+ }, /*#__PURE__*/React.createElement(Title, null), /*#__PURE__*/React.createElement(Info, null), /*#__PURE__*/React.createElement(Logo, null)), /*#__PURE__*/React.createElement("div", {
2140
+ className: s$7.block
2141
+ }, children));
2142
+
2143
+ var s$8 = {"noEligibility":"_17qNJ","loader":"_2oTJq"};
2144
+
2145
+ var s$9 = {"container":"_2G7Ch"};
2146
+
2147
+ const MobileModal = ({
2148
+ children
2149
+ }) => /*#__PURE__*/React.createElement("div", {
2150
+ className: s$9.container,
2151
+ "data-testid": "modal-container"
2152
+ }, /*#__PURE__*/React.createElement(Title, null), children, /*#__PURE__*/React.createElement(Info, null), /*#__PURE__*/React.createElement(Logo, null));
2153
+
2154
+ const EligibilityModal = ({
2155
+ initialPlanIndex,
2156
+ onClose,
2157
+ eligibilityPlans,
2158
+ status
2159
+ }) => {
2160
+ const [currentPlanIndex, setCurrentPlanIndex] = useState(initialPlanIndex || 0);
2161
+ const isBigScreen = useMediaQuery({
2162
+ minWidth: 800
2163
+ });
2164
+ const ModalComponent = isBigScreen ? DesktopModal : MobileModal;
2165
+ const eligiblePlans = eligibilityPlans.filter(plan => plan.eligible);
2166
+ const currentPlan = eligiblePlans[currentPlanIndex];
2167
+ const modalProps = {
2168
+ eligibilityPlans: eligiblePlans,
2169
+ currentPlanIndex,
2170
+ setCurrentPlanIndex,
2171
+ currentPlan,
2172
+ status
2173
+ };
2174
+ return /*#__PURE__*/React.createElement(ControlledModal, {
2175
+ onClose: onClose,
2176
+ ariaHideApp: false,
2177
+ scrollable: true,
2178
+ isOpen: true
2179
+ }, /*#__PURE__*/React.createElement(ModalComponent, Object.assign({}, modalProps), status === apiStatus.PENDING && /*#__PURE__*/React.createElement("div", {
2180
+ className: s$8.loader
2181
+ }, /*#__PURE__*/React.createElement(LoadingIndicator, null)), status === apiStatus.SUCCESS && eligiblePlans.length === 0 && /*#__PURE__*/React.createElement("div", {
2182
+ className: s$8.noEligibility
2183
+ }, /*#__PURE__*/React.createElement(FormattedMessage, {
2184
+ id: "eligibility-modal.no-eligibility",
2185
+ defaultMessage: "Oups, il semblerait que la simulation n'aie pas fonctionn\u00E9."
2186
+ })), status === apiStatus.SUCCESS && eligiblePlans.length >= 1 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EligibilityPlansButtons, {
2187
+ eligibilityPlans: eligiblePlans,
2188
+ currentPlanIndex: currentPlanIndex,
2189
+ setCurrentPlanIndex: setCurrentPlanIndex
2190
+ }), /*#__PURE__*/React.createElement(Schedule, {
2191
+ currentPlan: currentPlan
2192
+ }))));
2193
+ };
2194
+
2195
+ /**
2196
+ * This component allows to display only the modal, without PaymentPlans.
2197
+ */
2198
+
2199
+ const ModalContainer = ({
2200
+ purchaseAmount,
2201
+ apiData,
2202
+ configPlans,
2203
+ onClose
2204
+ }) => {
2205
+ const [eligibilityPlans, status] = useFetchEligibility(purchaseAmount, apiData, configPlans);
2206
+ return /*#__PURE__*/React.createElement(EligibilityModal, {
2207
+ initialPlanIndex: 0,
2208
+ onClose: onClose,
2209
+ eligibilityPlans: eligibilityPlans,
2210
+ status: status
2211
+ });
2212
+ };
2213
+
2214
+ var s$a = {"loadingIndicator":"_2SwwZ","line1":"_2qODo","line2":"_2YO01"};
2215
+
2216
+ const Loader = ({
2217
+ className
2218
+ }) => {
2219
+ return /*#__PURE__*/React.createElement("div", {
2220
+ className: cx(s$a.loadingIndicator, className),
2221
+ "data-testid": "loader"
2222
+ }, /*#__PURE__*/React.createElement("div", {
2223
+ className: s$a.line1
2224
+ }), /*#__PURE__*/React.createElement("div", {
2225
+ className: s$a.line2
2226
+ }));
2227
+ };
2228
+
2229
+ const useButtonAnimation = (iterateValues, transitionDelay) => {
2230
+ const [current, setCurrent] = useState(0);
2231
+ const [update, setUpdate] = useState(true);
2232
+ useEffect(() => {
2233
+ let isMounted = true;
2234
+
2235
+ if (iterateValues.length !== 0) {
2236
+ if (!iterateValues.includes(current) && update) setCurrent(iterateValues[0]);
2237
+ setTimeout(() => {
2238
+ if (update && isMounted) {
2239
+ setCurrent(iterateValues[iterateValues.includes(current) ? (iterateValues.indexOf(current) + 1) % iterateValues.length : 0]);
2240
+ }
2241
+ }, transitionDelay);
2242
+ }
2243
+
2244
+ return () => {
2245
+ isMounted = false;
2246
+ };
2247
+ }, [iterateValues, current]);
2248
+ return {
2249
+ current,
2250
+ onHover: current => {
2251
+ setCurrent(current);
2252
+ setUpdate(false);
2253
+ },
2254
+ onLeave: () => {
2255
+ setUpdate(true);
2256
+ }
2257
+ };
2258
+ };
2259
+
2260
+ /**
2261
+ * It returns the **index** of the **first eligible plan** that matches the default installments count
2262
+ *
2263
+ * @param {number | number[]} suggestedPaymentPlan
2264
+ * @param {EligibilityPlan[]} eligibilityPlans
2265
+ * @returns number (index of the first eligible plan that matches the default installments count)
2266
+ */
2267
+ const getIndexOfActivePlan = ({
2268
+ suggestedPaymentPlan,
2269
+ eligibilityPlans
2270
+ }) => {
2271
+ const suggestedPaymentPlanArray = Array.isArray(suggestedPaymentPlan) ? suggestedPaymentPlan : [suggestedPaymentPlan];
2272
+
2273
+ for (const index in suggestedPaymentPlanArray) {
2274
+ const installmentsCount = suggestedPaymentPlanArray[index];
2275
+ const planFound = eligibilityPlans.findIndex(plan => {
2276
+ return plan.installments_count === installmentsCount && plan.eligible;
2277
+ });
2278
+
2279
+ if (planFound !== -1) {
2280
+ return planFound;
2281
+ }
2282
+ }
2283
+
2284
+ return 0;
2285
+ };
2286
+
2287
+ var s$b = {"widgetButton":"_TSkFv","logo":"_LJ4nZ","primaryContainer":"_bMClc","paymentPlans":"_17c_S","plan":"_2Kqjn","active":"_3dG_J","notEligible":"_3O1bg","info":"_25GrF","loader":"_30j1O","error":"_R0YlN","errorText":"_2kGhu","errorButton":"_73d_Y","pending":"_1ZDMS","clickable":"_UksZa","unClickable":"_1lr-q"};
2288
+
2289
+ const VERY_LONG_TIME_IN_MS = 1000 * 3600 * 24 * 365;
2290
+ const DEFAULT_TRANSITION_TIME = 5500;
2291
+
2292
+ const PaymentPlanWidget = ({
2293
+ purchaseAmount,
2294
+ apiData,
2295
+ configPlans,
2296
+ transitionDelay,
2297
+ hideIfNotEligible,
2298
+ suggestedPaymentPlan
2299
+ }) => {
2300
+ const [eligibilityPlans, status] = useFetchEligibility(purchaseAmount, apiData, configPlans);
2301
+ const eligiblePlans = eligibilityPlans.filter(plan => plan.eligible);
2302
+ const activePlanIndex = getIndexOfActivePlan({
2303
+ eligibilityPlans,
2304
+ suggestedPaymentPlan: suggestedPaymentPlan != null ? suggestedPaymentPlan : 0
2305
+ });
2306
+ const isSuggestedPaymentPlanSpecified = suggestedPaymentPlan !== undefined; // 👈 The merchant decided to focus a tab and remove animated transition.
2307
+
2308
+ const isTransitionSpecified = transitionDelay !== undefined; // 👈 The merchant has specified a transition time
2309
+
2310
+ const [isOpen, setIsOpen] = useState(false);
2311
+
2312
+ const openModal = () => setIsOpen(true);
2313
+
2314
+ const closeModal = () => setIsOpen(false);
2315
+
2316
+ const eligiblePlanKeys = eligibilityPlans.reduce((acc, plan, index) => plan.eligible ? [...acc, index] : acc, []);
2317
+ /**
2318
+ * If merchand specify a suggestedPaymentPlan and no transition, we set a very long transition delay.
2319
+ * Otherwise, we set the transition delay specified by the merchant.
2320
+ * If none of those properties are specified, we set a default transition delay.
2321
+ * @returns
2322
+ */
2323
+
2324
+ const realTransitionTime = () => {
2325
+ if (isTransitionSpecified) {
2326
+ return transitionDelay != null ? transitionDelay : DEFAULT_TRANSITION_TIME;
2327
+ }
2328
+
2329
+ if (isSuggestedPaymentPlanSpecified) {
2330
+ return VERY_LONG_TIME_IN_MS;
2331
+ }
2332
+
2333
+ return DEFAULT_TRANSITION_TIME;
2334
+ };
2335
+
2336
+ const {
2337
+ current,
2338
+ onHover,
2339
+ onLeave
2340
+ } = useButtonAnimation(eligiblePlanKeys, realTransitionTime());
2341
+ useEffect(() => {
2342
+ // When API has given a response AND the marchand set an active plan by default.
2343
+ if (status === apiStatus.SUCCESS && isSuggestedPaymentPlanSpecified) {
2344
+ onHover(activePlanIndex); // We select the first active plan possible
2345
+
2346
+ onLeave(); // We need to call onLeave to reset the animation
2347
+ }
2348
+ }, [status]);
2349
+ /**
2350
+ * It takes a plan index and returns the index of that plan within the eligible plans
2351
+ *
2352
+ * @param {number} planIndex - The index of the plan that the user has selected.
2353
+ * @returns The index of the planKey in the eligiblePlanKeys array.
2354
+ */
2355
+
2356
+ const getIndexWithinEligiblePlans = planIndex => {
2357
+ const index = eligiblePlanKeys.findIndex(planKey => planKey === planIndex);
2358
+ return index === -1 ? 0 : index;
2359
+ };
2360
+
2361
+ if (status === apiStatus.PENDING) {
2362
+ return /*#__PURE__*/React.createElement("div", {
2363
+ className: cx(s$b.widgetButton, s$b.pending)
2364
+ }, /*#__PURE__*/React.createElement(Loader, null));
2365
+ }
2366
+
2367
+ if (hideIfNotEligible && eligiblePlans.length === 0 || eligibilityPlans.length === 0 || status === apiStatus.FAILED) {
2368
+ return null;
2369
+ }
2370
+
2371
+ const handleOpenModal = e => {
2372
+ e.preventDefault();
2373
+
2374
+ if (eligiblePlans.length > 0) {
2375
+ openModal();
2376
+ }
2377
+ };
2378
+
2379
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
2380
+ onClick: handleOpenModal,
2381
+ className: cx(s$b.widgetButton, {
2382
+ [s$b.clickable]: eligiblePlans.length > 0,
2383
+ [s$b.unClickable]: eligiblePlans.length === 0
2384
+ }),
2385
+ "data-testid": "widget-button"
2386
+ }, /*#__PURE__*/React.createElement("div", {
2387
+ className: s$b.primaryContainer
2388
+ }, /*#__PURE__*/React.createElement(LogoIcon, {
2389
+ className: s$b.logo
2390
+ }), /*#__PURE__*/React.createElement("div", {
2391
+ className: s$b.paymentPlans
2392
+ }, eligibilityPlans.map((eligibilityPlan, key) => {
2393
+ return /*#__PURE__*/React.createElement("div", {
2394
+ key: key,
2395
+ onMouseEnter: () => onHover(key),
2396
+ onMouseOut: onLeave,
2397
+ className: cx(s$b.plan, {
2398
+ [s$b.active]: current === key,
2399
+ [s$b.notEligible]: !eligibilityPlan.eligible
2400
+ })
2401
+ }, paymentPlanShorthandName(eligibilityPlan));
2402
+ }))), /*#__PURE__*/React.createElement("div", {
2403
+ className: cx(s$b.info, {
2404
+ [s$b.notEligible]: eligibilityPlans[current] && !eligibilityPlans[current].eligible
2405
+ })
2406
+ }, eligibilityPlans.length !== 0 && paymentPlanInfoText(eligibilityPlans[current]))), isOpen && /*#__PURE__*/React.createElement(EligibilityModal, {
2407
+ initialPlanIndex: getIndexWithinEligiblePlans(current),
2408
+ onClose: closeModal,
2409
+ eligibilityPlans: eligiblePlans,
2410
+ status: status
2411
+ }));
2412
+ };
2413
+
2414
+ class WidgetsController {
2415
+ constructor(apiData) {
2416
+ this.apiData = apiData;
2417
+ }
2418
+
2419
+ add(widget, options) {
2420
+ const containerDiv = document.querySelector(options.container);
2421
+
2422
+ if (containerDiv) {
2423
+ unmountComponentAtNode(containerDiv);
2424
+ }
2425
+
2426
+ if (widget === widgetTypes.PaymentPlans) {
2427
+ const {
2428
+ container,
2429
+ purchaseAmount,
2430
+ plans,
2431
+ transitionDelay,
2432
+ hideIfNotEligible,
2433
+ suggestedPaymentPlan,
2434
+ locale = Locale.en
2435
+ } = options;
2436
+
2437
+ if (containerDiv) {
2438
+ render( /*#__PURE__*/React.createElement(Provider, {
2439
+ locale: locale
2440
+ }, /*#__PURE__*/React.createElement(PaymentPlanWidget, {
2441
+ purchaseAmount: purchaseAmount,
2442
+ apiData: this.apiData,
2443
+ configPlans: plans,
2444
+ transitionDelay: transitionDelay,
2445
+ hideIfNotEligible: hideIfNotEligible,
2446
+ suggestedPaymentPlan: suggestedPaymentPlan
2447
+ })), document.querySelector(container));
2448
+ }
2449
+ }
2450
+
2451
+ if (widget === widgetTypes.Modal) {
2452
+ const {
2453
+ container,
2454
+ clickableSelector,
2455
+ purchaseAmount,
2456
+ plans,
2457
+ locale = Locale.en
2458
+ } = options;
2459
+
2460
+ const close = () => containerDiv && unmountComponentAtNode(containerDiv);
2461
+
2462
+ const renderModal = () => {
2463
+ render( /*#__PURE__*/React.createElement(Provider, {
2464
+ locale: locale
2465
+ }, /*#__PURE__*/React.createElement(ModalContainer, {
2466
+ purchaseAmount: purchaseAmount,
2467
+ apiData: this.apiData,
2468
+ configPlans: plans,
2469
+ onClose: close
2470
+ })), document.querySelector(container));
2471
+ }; // if clickableSelector is provided, add an onClick event handler to open the Modal.
2472
+
2473
+
2474
+ if (clickableSelector) {
2475
+ var _document$querySelect;
2476
+
2477
+ (_document$querySelect = document.querySelector(clickableSelector)) == null ? void 0 : _document$querySelect.addEventListener('click', renderModal, false);
2478
+ }
2479
+
2480
+ return {
2481
+ open: renderModal,
2482
+ close
2483
+ };
2484
+ }
2485
+ }
2486
+
2487
+ }
2488
+
2489
+ var ApiMode;
2490
+
2491
+ (function (ApiMode) {
2492
+ ApiMode["LIVE"] = "https://api.getalma.eu";
2493
+ ApiMode["TEST"] = "https://api.sandbox.getalma.eu";
2494
+ })(ApiMode || (ApiMode = {}));
2495
+
2496
+ var Widgets;
2497
+
2498
+ (function (Widgets) {
2499
+ function initialize(merchantId, mode) {
2500
+ return new WidgetsController({
2501
+ domain: mode,
2502
+ merchantId
2503
+ });
2504
+ }
2505
+
2506
+ Widgets.initialize = initialize;
2507
+ Widgets.PaymentPlans = widgetTypes.PaymentPlans;
2508
+ Widgets.Modal = widgetTypes.Modal;
2509
+ })(Widgets || (Widgets = {})); // eslint-disable-next-line @typescript-eslint/no-namespace
2510
+
2511
+
2512
+ var Utils;
2513
+
2514
+ (function (Utils) {
2515
+ Utils.priceToCents = priceToCents;
2516
+ Utils.priceFromCents = priceFromCents;
2517
+ Utils.formatCents = formatCents;
2518
+ })(Utils || (Utils = {}));
2519
+
2520
+ export { ApiMode, Utils, Widgets };
2521
+ //# sourceMappingURL=widgets.modern.js.map