@alma/widgets 2.2.9 → 2.2.10

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 (32) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/raw/widgets.css +583 -0
  3. package/dist/raw/widgets.js +2563 -0
  4. package/dist/raw/widgets.js.map +1 -0
  5. package/dist/raw/widgets.m.js +2569 -0
  6. package/dist/raw/widgets.m.js.map +1 -0
  7. package/dist/raw/widgets.modern.js +2469 -0
  8. package/dist/raw/widgets.modern.js.map +1 -0
  9. package/dist/raw/widgets.umd.js +18441 -0
  10. package/dist/raw/widgets.umd.js.map +1 -0
  11. package/dist/types/Widgets/EligibilityModal/DesktopModal/index.d.ts +1 -8
  12. package/dist/types/Widgets/EligibilityModal/MobileModal/index.d.ts +1 -8
  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/index.d.ts +2 -1
  16. package/dist/types/Widgets/PaymentPlans/PaymentPlans.test.d.ts +1 -0
  17. package/dist/types/Widgets/{PaymentPlan.d.ts → PaymentPlans/index.d.ts} +0 -0
  18. package/dist/types/components/LoadingIndicator/index.d.ts +5 -0
  19. package/dist/types/hooks/useFetchEligibility.d.ts +2 -2
  20. package/dist/types/index.d.ts +1 -0
  21. package/dist/types/types.d.ts +11 -5
  22. package/dist/types/widgets_controller.d.ts +7 -2
  23. package/dist/widgets.css +9 -7
  24. package/dist/widgets.js +1 -1
  25. package/dist/widgets.js.map +1 -1
  26. package/dist/widgets.m.js +1 -1
  27. package/dist/widgets.m.js.map +1 -1
  28. package/dist/widgets.modern.js +1 -1
  29. package/dist/widgets.modern.js.map +1 -1
  30. package/dist/widgets.umd.js +1 -1
  31. package/dist/widgets.umd.js.map +1 -1
  32. package/package.json +4 -2
@@ -0,0 +1,2569 @@
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 DOMException(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) {
1265
+ if (this[i] === val) continue a;else resStr += ' ' + this[i];
1266
+ }
1267
+
1268
+ this[Len] = val, proto.length += 1, proto.value = resStr;
1269
+ }
1270
+ skipPropChange = 1, ele.className = proto.value, skipPropChange = 0;
1271
+ };
1272
+
1273
+ DOMTokenList.prototype.remove = function () {
1274
+ for (var v = 0, argLen = arguments.length, val = '', ele = this[' uCL'], proto = ele[' uCLp']; v !== argLen; ++v) {
1275
+ val = arguments[v] + '', checkIfValidClassListEntry('remove', val);
1276
+
1277
+ for (var i = 0, Len = proto.length, resStr = '', is = 0; i !== Len; ++i) {
1278
+ if (is) {
1279
+ this[i - 1] = this[i];
1280
+ } else {
1281
+ if (this[i] !== val) {
1282
+ resStr += this[i] + ' ';
1283
+ } else {
1284
+ is = 1;
1285
+ }
1286
+ }
1287
+ }
1288
+
1289
+ if (!is) continue;
1290
+ delete this[Len], proto.length -= 1, proto.value = resStr;
1291
+ }
1292
+ skipPropChange = 1, ele.className = proto.value, skipPropChange = 0;
1293
+ };
1294
+
1295
+ window.DOMTokenList = DOMTokenList;
1296
+
1297
+ function whenPropChanges() {
1298
+ var evt = window.event,
1299
+ prop = evt.propertyName;
1300
+
1301
+ if (!skipPropChange && (prop === 'className' || prop === 'classList' && !defineProperty)) {
1302
+ var target = evt.srcElement,
1303
+ protoObjProto = target[' uCLp'],
1304
+ strval = '' + target[prop];
1305
+ var tokens = strval.trim().split(wsRE),
1306
+ resTokenList = target[prop === 'classList' ? ' uCL' : 'classList'];
1307
+ var oldLen = protoObjProto.length;
1308
+
1309
+ a: for (var cI = 0, cLen = protoObjProto.length = tokens.length, sub = 0; cI !== cLen; ++cI) {
1310
+ for (var innerI = 0; innerI !== cI; ++innerI) {
1311
+ if (tokens[innerI] === tokens[cI]) {
1312
+ sub++;
1313
+ continue a;
1314
+ }
1315
+ }
1316
+
1317
+ resTokenList[cI - sub] = tokens[cI];
1318
+ }
1319
+
1320
+ for (var i = cLen - sub; i < oldLen; ++i) {
1321
+ delete resTokenList[i];
1322
+ } //remove trailing indexs
1323
+
1324
+
1325
+ if (prop !== 'classList') return;
1326
+ skipPropChange = 1, target.classList = resTokenList, target.className = strval;
1327
+ skipPropChange = 0, resTokenList.length = tokens.length - sub;
1328
+ }
1329
+ }
1330
+
1331
+ function polyfillClassList(ele) {
1332
+ if (!ele || !('innerHTML' in ele)) throw TypeError('Illegal invocation');
1333
+ ele.detachEvent('onpropertychange', whenPropChanges); // prevent duplicate handler infinite loop
1334
+
1335
+ allowTokenListConstruction = 1;
1336
+
1337
+ try {
1338
+ var protoObj = function protoObj() {};
1339
+
1340
+ protoObj.prototype = new DOMTokenList();
1341
+ } finally {
1342
+ allowTokenListConstruction = 0;
1343
+ }
1344
+
1345
+ var protoObjProto = protoObj.prototype,
1346
+ resTokenList = new protoObj();
1347
+
1348
+ a: for (var toks = ele.className.trim().split(wsRE), cI = 0, cLen = toks.length, sub = 0; cI !== cLen; ++cI) {
1349
+ for (var innerI = 0; innerI !== cI; ++innerI) {
1350
+ if (toks[innerI] === toks[cI]) {
1351
+ sub++;
1352
+ continue a;
1353
+ }
1354
+ }
1355
+
1356
+ this[cI - sub] = toks[cI];
1357
+ }
1358
+ protoObjProto.length = cLen - sub, protoObjProto.value = ele.className, protoObjProto[' uCL'] = ele;
1359
+
1360
+ if (defineProperty) {
1361
+ defineProperty(ele, 'classList', {
1362
+ // IE8 & IE9 allow defineProperty on the DOM
1363
+ enumerable: 1,
1364
+ get: function get() {
1365
+ return resTokenList;
1366
+ },
1367
+ configurable: 0,
1368
+ set: function set(newVal) {
1369
+ skipPropChange = 1, ele.className = protoObjProto.value = newVal += '', skipPropChange = 0;
1370
+ var toks = newVal.trim().split(wsRE),
1371
+ oldLen = protoObjProto.length;
1372
+
1373
+ a: for (var cI = 0, cLen = protoObjProto.length = toks.length, sub = 0; cI !== cLen; ++cI) {
1374
+ for (var innerI = 0; innerI !== cI; ++innerI) {
1375
+ if (toks[innerI] === toks[cI]) {
1376
+ sub++;
1377
+ continue a;
1378
+ }
1379
+ }
1380
+
1381
+ resTokenList[cI - sub] = toks[cI];
1382
+ }
1383
+
1384
+ for (var i = cLen - sub; i < oldLen; ++i) {
1385
+ delete resTokenList[i];
1386
+ } //remove trailing indexs
1387
+
1388
+ }
1389
+ });
1390
+ defineProperty(ele, ' uCLp', {
1391
+ // for accessing the hidden prototype
1392
+ enumerable: 0,
1393
+ configurable: 0,
1394
+ writeable: 0,
1395
+ value: protoObj.prototype
1396
+ });
1397
+ defineProperty(protoObjProto, ' uCL', {
1398
+ enumerable: 0,
1399
+ configurable: 0,
1400
+ writeable: 0,
1401
+ value: ele
1402
+ });
1403
+ } else {
1404
+ ele.classList = resTokenList, ele[' uCL'] = resTokenList, ele[' uCLp'] = protoObj.prototype;
1405
+ }
1406
+
1407
+ ele.attachEvent('onpropertychange', whenPropChanges);
1408
+ }
1409
+
1410
+ try {
1411
+ // Much faster & cleaner version for IE8 & IE9:
1412
+ // Should work in IE8 because Element.prototype instanceof Node is true according to the specs
1413
+ window.Object.defineProperty(window.Element.prototype, 'classList', {
1414
+ enumerable: 1,
1415
+ get: function get(val) {
1416
+ if (!hasOwnProp.call(this, 'classList')) polyfillClassList(this);
1417
+ return this.classList;
1418
+ },
1419
+ configurable: 0,
1420
+ set: function set(val) {
1421
+ this.className = val;
1422
+ }
1423
+ });
1424
+ } catch (e) {
1425
+ // Less performant fallback for older browsers (IE 6-8):
1426
+ window[' uCL'] = polyfillClassList; // the below code ensures polyfillClassList is applied to all current and future elements in the doc.
1427
+
1428
+ document.documentElement.firstChild.appendChild(document.createElement('style')).styleSheet.cssText = '_*{x-uCLp:expression(!this.hasOwnProperty("classList")&&window[" uCL"](this))}' + // IE6
1429
+ '[class]{x-uCLp/**/:expression(!this.hasOwnProperty("classList")&&window[" uCL"](this))}'; //IE7-8
1430
+ }
1431
+ })(window) // 3. Patch in unsupported methods in DOMTokenList
1432
+ ;
1433
+
1434
+ (function (DOMTokenListProto, testClass) {
1435
+ if (!DOMTokenListProto.item) DOMTokenListProto.item = function (i) {
1436
+ function NullCheck(n) {
1437
+ return n === void 0 ? null : n;
1438
+ }
1439
+
1440
+ return NullCheck(this[i]);
1441
+ };
1442
+ if (!DOMTokenListProto.toggle || testClass.toggle('a', 0) !== false) DOMTokenListProto.toggle = function (val) {
1443
+ if (arguments.length > 1) return this[arguments[1] ? 'add' : 'remove'](val), !!arguments[1];
1444
+ var oldValue = this.value;
1445
+ return this.remove(oldValue), oldValue === this.value && (this.add(val), true);
1446
+ /*|| false*/
1447
+ };
1448
+ if (!DOMTokenListProto.replace || typeof testClass.replace('a', 'b') !== 'boolean') DOMTokenListProto.replace = function (oldToken, newToken) {
1449
+ checkIfValidClassListEntry('replace', oldToken), checkIfValidClassListEntry('replace', newToken);
1450
+ var oldValue = this.value;
1451
+ return this.remove(oldToken), this.value !== oldValue && (this.add(newToken), true);
1452
+ };
1453
+ if (!DOMTokenListProto.contains) DOMTokenListProto.contains = function (value) {
1454
+ for (var i = 0, Len = this.length; i !== Len; ++i) {
1455
+ if (this[i] === value) return true;
1456
+ }
1457
+
1458
+ return false;
1459
+ };
1460
+ if (!DOMTokenListProto.forEach) DOMTokenListProto.forEach = function (f) {
1461
+ if (arguments.length === 1) for (var i = 0, Len = this.length; i !== Len; ++i) {
1462
+ f(this[i], i, this);
1463
+ } else for (var i = 0, Len = this.length, tArg = arguments[1]; i !== Len; ++i) {
1464
+ f.call(tArg, this[i], i, this);
1465
+ }
1466
+ };
1467
+ if (!DOMTokenListProto.entries) DOMTokenListProto.entries = function () {
1468
+ var nextIndex = 0,
1469
+ that = this;
1470
+ return {
1471
+ next: function next() {
1472
+ return nextIndex < that.length ? {
1473
+ value: [nextIndex, that[nextIndex]],
1474
+ done: false
1475
+ } : {
1476
+ done: true
1477
+ };
1478
+ }
1479
+ };
1480
+ };
1481
+ if (!DOMTokenListProto.values) DOMTokenListProto.values = function () {
1482
+ var nextIndex = 0,
1483
+ that = this;
1484
+ return {
1485
+ next: function next() {
1486
+ return nextIndex < that.length ? {
1487
+ value: that[nextIndex],
1488
+ done: false
1489
+ } : {
1490
+ done: true
1491
+ };
1492
+ }
1493
+ };
1494
+ };
1495
+ if (!DOMTokenListProto.keys) DOMTokenListProto.keys = function () {
1496
+ var nextIndex = 0,
1497
+ that = this;
1498
+ return {
1499
+ next: function next() {
1500
+ return nextIndex < that.length ? {
1501
+ value: nextIndex,
1502
+ done: false
1503
+ } : {
1504
+ done: true
1505
+ };
1506
+ }
1507
+ };
1508
+ };
1509
+ })(window.DOMTokenList.prototype, window.document.createElement('div').classList);
1510
+ })(window);
1511
+
1512
+ var messagesDE = {
1513
+ "eligibility-modal.bullet-1": "Wählen Sie an der Kasse <strong>Alma</strong> .",
1514
+ "eligibility-modal.bullet-2": "Füllen Sie die <strong>angeforderten</strong> Informationen aus.",
1515
+ "eligibility-modal.bullet-3": "Die Bestätigung Ihrer Zahlung <strong>sofort</strong> !",
1516
+ "eligibility-modal.cost": "Davon Kosten",
1517
+ "eligibility-modal.credit-commitment": "Ein Kredit verpflichtet Sie und muss zurückgezahlt werden. Prüfen Sie Ihre Rückzahlungsfähigkeit, bevor Sie sich verpflichten.",
1518
+ "eligibility-modal.credit-cost": "Davon Kreditkosten",
1519
+ "eligibility-modal.credit-cost-amount": "{creditCost} (APR {TAEG})",
1520
+ "eligibility-modal.no-eligibility": "Ups, die Simulation scheint nicht funktioniert zu haben.",
1521
+ "eligibility-modal.title": "<highlighted>Bezahlen Sie in Raten</highlighted> oder später per Kreditkarte mit Alma.",
1522
+ "eligibility-modal.total": "Insgesamt",
1523
+ "installments.today": "Heutzutage",
1524
+ "payment-plan-strings.day-abbreviation": "J{numberOfDeferredDays}",
1525
+ "payment-plan-strings.default-message": "Bezahlen Sie in Raten mit Alma",
1526
+ "payment-plan-strings.deferred": "{totalAmount} zu zahlen am {dueDate}",
1527
+ "payment-plan-strings.ineligible-greater-than-max": "Bis zu {maxAmount}",
1528
+ "payment-plan-strings.ineligible-lower-than-min": "Ab {minAmount}",
1529
+ "payment-plan-strings.multiple-installments": "{firstInstallmentAmount} dann {numberOfRemainingInstallments} x {othersInstallmentAmount}",
1530
+ "payment-plan-strings.multiple-installments-same-amount": "{installmentsCount} x {totalAmount}",
1531
+ "payment-plan-strings.no-fee": "(gebührenfrei)"
1532
+ };
1533
+
1534
+ var messagesEN = {
1535
+ "eligibility-modal.bullet-1": "Choose <strong>Alma</strong> at checkout.",
1536
+ "eligibility-modal.bullet-2": "Fill in the <strong>information</strong> requested.",
1537
+ "eligibility-modal.bullet-3": "Validation of your payment <strong>instantaneous</strong>!",
1538
+ "eligibility-modal.cost": "Of which costs",
1539
+ "eligibility-modal.credit-commitment": "A loan commits you and must be repaid. Check your ability to repay before committing yourself.",
1540
+ "eligibility-modal.credit-cost": "Of which cost of credit",
1541
+ "eligibility-modal.credit-cost-amount": "{creditCost} (APR {TAEG})",
1542
+ "eligibility-modal.no-eligibility": "Oops, looks like the simulation didn't work.",
1543
+ "eligibility-modal.title": "<highlighted>Pay in installments</highlighted> or later by credit card with Alma.",
1544
+ "eligibility-modal.total": "Total",
1545
+ "installments.today": "Today",
1546
+ "payment-plan-strings.day-abbreviation": "T{numberOfDeferredDays}",
1547
+ "payment-plan-strings.default-message": "Pay in installments with Alma",
1548
+ "payment-plan-strings.deferred": "{totalAmount} to be paid on {dueDate}",
1549
+ "payment-plan-strings.ineligible-greater-than-max": "Until {maxAmount}",
1550
+ "payment-plan-strings.ineligible-lower-than-min": "From {minAmount}",
1551
+ "payment-plan-strings.multiple-installments": "{firstInstallmentAmount} then {numberOfRemainingInstallments} x {othersInstallmentAmount}",
1552
+ "payment-plan-strings.multiple-installments-same-amount": "{installmentsCount} x {totalAmount}",
1553
+ "payment-plan-strings.no-fee": "(free of charge)"
1554
+ };
1555
+
1556
+ var messagesES = {
1557
+ "eligibility-modal.bullet-1": "Elige <strong>Alma</strong> como método de pago.",
1558
+ "eligibility-modal.bullet-2": "Completa la <strong>información</strong> solicitada.",
1559
+ "eligibility-modal.bullet-3": "¡Validación <strong>inmediata</strong> de tu pago!",
1560
+ "eligibility-modal.cost": "Gastos (incl. en el total)",
1561
+ "eligibility-modal.credit-commitment": "Un préstamo te compromete y debe ser devuelto. Comprueba tu capacidad financiera antes de comprometerte.",
1562
+ "eligibility-modal.credit-cost": "Coste de crédito (incl. en el total)",
1563
+ "eligibility-modal.credit-cost-amount": "{creditCost} (TAE {TAEG})",
1564
+ "eligibility-modal.no-eligibility": "Uy, parece que la simulación no ha funcionado.",
1565
+ "eligibility-modal.title": "<highlighted>Paga a plazos</highlighted> o más adelante con tu tarjeta, a través de Alma.",
1566
+ "eligibility-modal.total": "Total",
1567
+ "installments.today": "Hoy",
1568
+ "payment-plan-strings.day-abbreviation": "D{numberOfDeferredDays}",
1569
+ "payment-plan-strings.default-message": "Pagar a plazos con Alma",
1570
+ "payment-plan-strings.deferred": "{totalAmount} a pagar el {dueDate}",
1571
+ "payment-plan-strings.ineligible-greater-than-max": "Hasta {maxAmount}",
1572
+ "payment-plan-strings.ineligible-lower-than-min": "Desde {minAmount}",
1573
+ "payment-plan-strings.multiple-installments": "{firstInstallmentAmount} hoy, después {numberOfRemainingInstallments, plural, one {# mensualidad} other {# mensualidades}} de {othersInstallmentAmount}",
1574
+ "payment-plan-strings.multiple-installments-same-amount": "{installmentsCount} plazos de {totalAmount}",
1575
+ "payment-plan-strings.no-fee": "(sin intereses)"
1576
+ };
1577
+
1578
+ var messagesFR = {
1579
+ "eligibility-modal.bullet-1": "Choisissez <strong>Alma</strong> au moment du paiement.",
1580
+ "eligibility-modal.bullet-2": "Renseignez les <strong>informations</strong> demandées.",
1581
+ "eligibility-modal.bullet-3": "La validation de votre paiement <strong>instantanée</strong> !",
1582
+ "eligibility-modal.cost": "Dont frais",
1583
+ "eligibility-modal.credit-commitment": "Un crédit vous engage et doit être remboursé. Vérifiez vos capacités de remboursement avant de vous engager.",
1584
+ "eligibility-modal.credit-cost": "Dont coût du crédit",
1585
+ "eligibility-modal.credit-cost-amount": "{creditCost} (TAEG {TAEG})",
1586
+ "eligibility-modal.no-eligibility": "Oups, il semblerait que la simulation n'aie pas fonctionné.",
1587
+ "eligibility-modal.title": "<highlighted>Payez en plusieurs fois</highlighted> ou plus tard par carte bancaire avec Alma.",
1588
+ "eligibility-modal.total": "Total",
1589
+ "installments.today": "Aujourd'hui",
1590
+ "payment-plan-strings.day-abbreviation": "J{numberOfDeferredDays}",
1591
+ "payment-plan-strings.default-message": "Payez en plusieurs fois avec Alma",
1592
+ "payment-plan-strings.deferred": "{totalAmount} à payer le {dueDate}",
1593
+ "payment-plan-strings.ineligible-greater-than-max": "Jusqu'à {maxAmount}",
1594
+ "payment-plan-strings.ineligible-lower-than-min": "À partir de {minAmount}",
1595
+ "payment-plan-strings.multiple-installments": "{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}",
1596
+ "payment-plan-strings.multiple-installments-same-amount": "{installmentsCount} x {totalAmount}",
1597
+ "payment-plan-strings.no-fee": "(sans frais)"
1598
+ };
1599
+
1600
+ var messagesIT = {
1601
+ "eligibility-modal.bullet-1": "Scegli <strong>Alma</strong> alla cassa.",
1602
+ "eligibility-modal.bullet-2": "Compila le informazioni <strong></strong> richieste.",
1603
+ "eligibility-modal.bullet-3": "Convalida del tuo pagamento <strong>istantanea</strong>!",
1604
+ "eligibility-modal.cost": "Di cui commissioni",
1605
+ "eligibility-modal.credit-commitment": "Un pagamento rateale ti impegna e deve essere ripagato. Verifica la tua capacità di rimborso prima di impegnarti.",
1606
+ "eligibility-modal.credit-cost": "Di cui commissioni",
1607
+ "eligibility-modal.credit-cost-amount": "{creditCost} (TAEG {TAEG})",
1608
+ "eligibility-modal.no-eligibility": "Ops, sembra che la simulazione non abbia funzionato.",
1609
+ "eligibility-modal.title": "<highlighted>Paga a rate</highlighted> e posticipa il pagamento con Alma, senza interessi.",
1610
+ "eligibility-modal.total": "Totale",
1611
+ "installments.today": "Oggi",
1612
+ "payment-plan-strings.day-abbreviation": "G{numberOfDeferredDays}",
1613
+ "payment-plan-strings.default-message": "Paga a rate con Alma",
1614
+ "payment-plan-strings.deferred": "{totalAmount} da pagare il {dueDate}",
1615
+ "payment-plan-strings.ineligible-greater-than-max": "Disponibile fino a {maxAmount}",
1616
+ "payment-plan-strings.ineligible-lower-than-min": "Pagamento rateale disponibile a partire da {minAmount}",
1617
+ "payment-plan-strings.multiple-installments": "Oggi paghi {firstInstallmentAmount} poi {numberOfRemainingInstallments} rate mensili di {othersInstallmentAmount}",
1618
+ "payment-plan-strings.multiple-installments-same-amount": "In {installmentsCount} rate mensili di {totalAmount}",
1619
+ "payment-plan-strings.no-fee": "(senza interessi)"
1620
+ };
1621
+
1622
+ var messagesNL = {
1623
+ "eligibility-modal.bullet-1": "Kies <strong>Alma</strong> bij het afrekenen.",
1624
+ "eligibility-modal.bullet-2": "Vul de <strong>gevraagde informatie</strong> in.",
1625
+ "eligibility-modal.bullet-3": "Validatie van uw betaling <strong>onmiddellijk</strong>!",
1626
+ "eligibility-modal.cost": "Waarvan kosten",
1627
+ "eligibility-modal.credit-commitment": "Een lening bindt je en moet worden terugbetaald. Ga na of u kunt terugbetalen voordat u zich vastlegt.",
1628
+ "eligibility-modal.credit-cost": "Waarvan kosten van krediet",
1629
+ "eligibility-modal.credit-cost-amount": "{creditCost} (APR {TAEG})",
1630
+ "eligibility-modal.no-eligibility": "Oeps, het lijkt erop dat de simulatie niet werkte.",
1631
+ "eligibility-modal.title": "<highlighted>Betaal in termijnen</highlighted> of later per credit card met Alma.",
1632
+ "eligibility-modal.total": "Totaal",
1633
+ "installments.today": "Tegenwoordig",
1634
+ "payment-plan-strings.day-abbreviation": "J{numberOfDeferredDays}",
1635
+ "payment-plan-strings.default-message": "Betaal in termijnen met Alma",
1636
+ "payment-plan-strings.deferred": "{totalAmount} te betalen op {dueDate}",
1637
+ "payment-plan-strings.ineligible-greater-than-max": "Tot {maxAmount}",
1638
+ "payment-plan-strings.ineligible-lower-than-min": "Van {minAmount}",
1639
+ "payment-plan-strings.multiple-installments": "{firstInstallmentAmount} dan {numberOfRemainingInstallments} x {othersInstallmentAmount}",
1640
+ "payment-plan-strings.multiple-installments-same-amount": "{installmentsCount} x {totalAmount}",
1641
+ "payment-plan-strings.no-fee": "(gratis)"
1642
+ };
1643
+
1644
+ var getTranslationsByLocale = function getTranslationsByLocale(locale) {
1645
+ switch (locale) {
1646
+ case Locale.fr:
1647
+ return messagesFR;
1648
+
1649
+ case Locale.en:
1650
+ return messagesEN;
1651
+
1652
+ case Locale.es:
1653
+ return messagesES;
1654
+
1655
+ case Locale.it:
1656
+ return messagesIT;
1657
+
1658
+ case Locale.de:
1659
+ return messagesDE;
1660
+
1661
+ case Locale.nl:
1662
+ case Locale['nl-BE']:
1663
+ case Locale['nl-NL']:
1664
+ return messagesNL;
1665
+
1666
+ default:
1667
+ return messagesEN;
1668
+ }
1669
+ };
1670
+
1671
+ var Provider = function Provider(_ref) {
1672
+ var children = _ref.children,
1673
+ locale = _ref.locale;
1674
+ return /*#__PURE__*/React.createElement(IntlProvider, {
1675
+ messages: getTranslationsByLocale(locale),
1676
+ locale: locale,
1677
+ defaultLocale: "en"
1678
+ }, children);
1679
+ };
1680
+
1681
+ function _extends() {
1682
+ _extends = Object.assign || function (target) {
1683
+ for (var i = 1; i < arguments.length; i++) {
1684
+ var source = arguments[i];
1685
+
1686
+ for (var key in source) {
1687
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1688
+ target[key] = source[key];
1689
+ }
1690
+ }
1691
+ }
1692
+
1693
+ return target;
1694
+ };
1695
+
1696
+ return _extends.apply(this, arguments);
1697
+ }
1698
+
1699
+ function _objectWithoutPropertiesLoose(source, excluded) {
1700
+ if (source == null) return {};
1701
+ var target = {};
1702
+ var sourceKeys = Object.keys(source);
1703
+ var key, i;
1704
+
1705
+ for (i = 0; i < sourceKeys.length; i++) {
1706
+ key = sourceKeys[i];
1707
+ if (excluded.indexOf(key) >= 0) continue;
1708
+ target[key] = source[key];
1709
+ }
1710
+
1711
+ return target;
1712
+ }
1713
+
1714
+ var fetchFromApi = function fetchFromApi(url, data, headers) {
1715
+ if (url === void 0) {
1716
+ url = '';
1717
+ }
1718
+
1719
+ try {
1720
+ return Promise.resolve(fetch(url, {
1721
+ method: 'POST',
1722
+ headers: _extends({
1723
+ 'Content-Type': 'application/json'
1724
+ }, headers),
1725
+ body: JSON.stringify(data)
1726
+ })).then(function (response) {
1727
+ return response.json();
1728
+ });
1729
+ } catch (e) {
1730
+ return Promise.reject(e);
1731
+ }
1732
+ };
1733
+
1734
+ var filterELigibility = function filterELigibility(eligibilities, configPlans) {
1735
+ // Remove p1x
1736
+ var filteredEligibilityPlans = eligibilities.filter(function (plan) {
1737
+ return !(plan.installments_count === 1 && plan.deferred_days === 0 && plan.deferred_months === 0);
1738
+ }); // If no configPlans was provided, return eligibility response
1739
+
1740
+ if (!configPlans) {
1741
+ return filteredEligibilityPlans;
1742
+ } // Else check if the plan is eligible regarding the related configPlan
1743
+
1744
+
1745
+ return filteredEligibilityPlans.map(function (plan) {
1746
+ var eligibilityDeferredDays = (plan.deferred_months ? plan.deferred_months : 0) * 30 + (plan.deferred_days ? plan.deferred_days : 0); // find the related configPlan
1747
+
1748
+ var relatedConfigPlan = configPlans.find(function (configPlan) {
1749
+ var configPlanDeferredDays = (configPlan.deferredMonths ? configPlan.deferredMonths : 0) * 30 + (configPlan.deferredDays ? configPlan.deferredDays : 0);
1750
+ return plan.installments_count === configPlan.installmentsCount && eligibilityDeferredDays === configPlanDeferredDays;
1751
+ });
1752
+ return _extends({}, plan, {
1753
+ eligible: relatedConfigPlan ? plan.purchase_amount >= (relatedConfigPlan == null ? void 0 : relatedConfigPlan.minAmount) && plan.purchase_amount <= (relatedConfigPlan == null ? void 0 : relatedConfigPlan.maxAmount) : false,
1754
+ minAmount: relatedConfigPlan == null ? void 0 : relatedConfigPlan.minAmount,
1755
+ maxAmount: relatedConfigPlan == null ? void 0 : relatedConfigPlan.maxAmount
1756
+ });
1757
+ });
1758
+ };
1759
+
1760
+ var useFetchEligibility = function useFetchEligibility(purchaseAmount, _ref, plans) {
1761
+ var domain = _ref.domain,
1762
+ merchantId = _ref.merchantId;
1763
+
1764
+ var _useState = useState([]),
1765
+ eligibility = _useState[0],
1766
+ setEligibility = _useState[1];
1767
+
1768
+ var _useState2 = useState(apiStatus.PENDING),
1769
+ status = _useState2[0],
1770
+ setStatus = _useState2[1];
1771
+
1772
+ var configInstallments = plans == null ? void 0 : plans.map(function (plan) {
1773
+ return {
1774
+ installments_count: plan.installmentsCount,
1775
+ deferred_days: plan == null ? void 0 : plan.deferredDays,
1776
+ deferred_months: plan == null ? void 0 : plan.deferredMonths
1777
+ };
1778
+ });
1779
+ useEffect(function () {
1780
+ if (status === apiStatus.PENDING) {
1781
+ fetchFromApi(domain + '/v2/payments/eligibility', {
1782
+ purchase_amount: purchaseAmount,
1783
+ queries: configInstallments
1784
+ }, {
1785
+ Authorization: "Alma-Merchant-Auth " + merchantId
1786
+ }).then(function (res) {
1787
+ setStatus(apiStatus.SUCCESS);
1788
+ setEligibility(res);
1789
+ })["catch"](function () {
1790
+ setStatus(apiStatus.FAILED);
1791
+ });
1792
+ }
1793
+ }, [status]);
1794
+ return [filterELigibility(eligibility, plans), status];
1795
+ };
1796
+
1797
+ var s = {"loadingIndicator":"_31lrj","letter":"_2p94X","loading-indicator-letter":"_229P7","bar":"_1k0PM","loading-indicator-bar":"_2cX7o"};
1798
+
1799
+ var LoadingIndicator = function LoadingIndicator(_ref) {
1800
+ var className = _ref.className;
1801
+ return /*#__PURE__*/React.createElement("div", {
1802
+ className: cx(s.loadingIndicator, className),
1803
+ "data-testid": "loader"
1804
+ }, /*#__PURE__*/React.createElement("div", {
1805
+ className: s.letter
1806
+ }, "a"), /*#__PURE__*/React.createElement("div", {
1807
+ className: s.bar
1808
+ }));
1809
+ };
1810
+
1811
+ var s$1 = {"modal":"_D8SjB","content":"_ocM9x","contentScrollable":"_1GP2F","overlay":"_1yxCb","header":"_12LLh","closeButton":"_3YRro"};
1812
+
1813
+ function CrossIcon(_ref) {
1814
+ var _ref$color = _ref.color,
1815
+ color = _ref$color === void 0 ? '#fff' : _ref$color,
1816
+ className = _ref.className;
1817
+ return /*#__PURE__*/React.createElement("svg", {
1818
+ className: className,
1819
+ width: "16",
1820
+ height: "16",
1821
+ viewBox: "0 0 16 16",
1822
+ fill: "none",
1823
+ xmlns: "http://www.w3.org/2000/svg"
1824
+ }, /*#__PURE__*/React.createElement("path", {
1825
+ 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",
1826
+ fill: color
1827
+ }));
1828
+ }
1829
+
1830
+ var ControlledModal = function ControlledModal(_ref) {
1831
+ var _cx;
1832
+
1833
+ var children = _ref.children,
1834
+ isOpen = _ref.isOpen,
1835
+ onClose = _ref.onClose,
1836
+ className = _ref.className,
1837
+ contentClassName = _ref.contentClassName,
1838
+ _ref$scrollable = _ref.scrollable,
1839
+ scrollable = _ref$scrollable === void 0 ? false : _ref$scrollable,
1840
+ props = _objectWithoutPropertiesLoose(_ref, ["children", "isOpen", "onClose", "className", "contentClassName", "scrollable"]);
1841
+
1842
+ Modal.setAppElement('body');
1843
+ return /*#__PURE__*/React.createElement(Modal, Object.assign({
1844
+ className: cx(s$1.modal, className),
1845
+ overlayClassName: s$1.overlay,
1846
+ onAfterOpen: function onAfterOpen() {
1847
+ noScroll.on();
1848
+ },
1849
+ onAfterClose: function onAfterClose() {
1850
+ noScroll.off();
1851
+ },
1852
+ onRequestClose: onClose,
1853
+ isOpen: isOpen,
1854
+ shouldCloseOnOverlayClick: true,
1855
+ shouldCloseOnEsc: true
1856
+ }, props), /*#__PURE__*/React.createElement("div", {
1857
+ className: s$1.header
1858
+ }, /*#__PURE__*/React.createElement("button", {
1859
+ onClick: onClose,
1860
+ className: s$1.closeButton,
1861
+ "data-testid": "modal-close-button"
1862
+ }, /*#__PURE__*/React.createElement(CrossIcon, null))), /*#__PURE__*/React.createElement("div", {
1863
+ className: cx(s$1.content, contentClassName, (_cx = {}, _cx[s$1.contentScrollable] = scrollable, _cx))
1864
+ }, children));
1865
+ };
1866
+
1867
+ var paymentPlanShorthandName = function paymentPlanShorthandName(payment) {
1868
+ var deferred_days = payment.deferred_days,
1869
+ deferred_months = payment.deferred_months,
1870
+ installmentsCount = payment.installments_count;
1871
+ var deferredDaysCount = deferred_days + deferred_months * 30;
1872
+
1873
+ if (installmentsCount === 1) {
1874
+ return /*#__PURE__*/React.createElement(FormattedMessage, {
1875
+ id: "payment-plan-strings.day-abbreviation",
1876
+ defaultMessage: "J{numberOfDeferredDays}",
1877
+ values: {
1878
+ numberOfDeferredDays: deferredDaysCount > 0 ? "+" + deferredDaysCount : ''
1879
+ }
1880
+ });
1881
+ } else {
1882
+ return installmentsCount + "x";
1883
+ }
1884
+ };
1885
+ var paymentPlanInfoText = function paymentPlanInfoText(payment) {
1886
+ var deferred_days = payment.deferred_days,
1887
+ deferred_months = payment.deferred_months,
1888
+ installmentsCount = payment.installments_count,
1889
+ eligible = payment.eligible,
1890
+ purchaseAmount = payment.purchase_amount,
1891
+ _payment$minAmount = payment.minAmount,
1892
+ minAmount = _payment$minAmount === void 0 ? 0 : _payment$minAmount,
1893
+ _payment$maxAmount = payment.maxAmount,
1894
+ maxAmount = _payment$maxAmount === void 0 ? 0 : _payment$maxAmount;
1895
+ var deferredDaysCount = deferred_days + deferred_months * 30;
1896
+
1897
+ var withNoFee = function withNoFee() {
1898
+ if (payment.payment_plan.every(function (plan) {
1899
+ return plan.customer_fee === 0 && plan.customer_interest === 0;
1900
+ })) {
1901
+ return /*#__PURE__*/React.createElement(React.Fragment, null, ' ', /*#__PURE__*/React.createElement(FormattedMessage, {
1902
+ id: "payment-plan-strings.no-fee",
1903
+ defaultMessage: '(sans frais)'
1904
+ }));
1905
+ }
1906
+ };
1907
+
1908
+ if (!eligible) {
1909
+ return purchaseAmount > maxAmount ? /*#__PURE__*/React.createElement(FormattedMessage, {
1910
+ id: "payment-plan-strings.ineligible-greater-than-max",
1911
+ defaultMessage: "Jusqu'\xE0 {maxAmount}",
1912
+ values: {
1913
+ maxAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
1914
+ value: priceFromCents(maxAmount),
1915
+ style: "currency",
1916
+ currency: "EUR"
1917
+ })
1918
+ }
1919
+ }) : /*#__PURE__*/React.createElement(FormattedMessage, {
1920
+ id: "payment-plan-strings.ineligible-lower-than-min",
1921
+ defaultMessage: "\xC0 partir de {minAmount}",
1922
+ values: {
1923
+ minAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
1924
+ value: priceFromCents(minAmount),
1925
+ style: "currency",
1926
+ currency: "EUR"
1927
+ })
1928
+ }
1929
+ });
1930
+ } else if (deferredDaysCount !== 0 && installmentsCount === 1) {
1931
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
1932
+ id: "payment-plan-strings.deferred",
1933
+ defaultMessage: "{totalAmount} \xE0 payer le {dueDate}",
1934
+ values: {
1935
+ totalAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
1936
+ value: priceFromCents(payment.payment_plan[0].total_amount),
1937
+ style: "currency",
1938
+ currency: "EUR"
1939
+ }),
1940
+ dueDate: /*#__PURE__*/React.createElement(FormattedDate, {
1941
+ value: secondsToMilliseconds(payment.payment_plan[0].due_date),
1942
+ day: "numeric",
1943
+ month: "long",
1944
+ year: "numeric"
1945
+ })
1946
+ }
1947
+ }), withNoFee());
1948
+ } else if (installmentsCount > 0) {
1949
+ var areInstallmentsOfSameAmount = payment.payment_plan.every(function (installment, index) {
1950
+ return index === 0 || installment.total_amount === payment.payment_plan[0].total_amount;
1951
+ });
1952
+
1953
+ if (areInstallmentsOfSameAmount) {
1954
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
1955
+ id: "payment-plan-strings.multiple-installments-same-amount",
1956
+ defaultMessage: "{installmentsCount} x {totalAmount}",
1957
+ values: {
1958
+ totalAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
1959
+ value: priceFromCents(payment.payment_plan[0].total_amount),
1960
+ style: "currency",
1961
+ currency: "EUR"
1962
+ }),
1963
+ installmentsCount: installmentsCount
1964
+ }
1965
+ }), withNoFee());
1966
+ }
1967
+
1968
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
1969
+ id: "payment-plan-strings.multiple-installments",
1970
+ defaultMessage: "{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}",
1971
+ values: {
1972
+ firstInstallmentAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
1973
+ value: priceFromCents(payment.payment_plan[0].total_amount),
1974
+ style: "currency",
1975
+ currency: "EUR"
1976
+ }),
1977
+ numberOfRemainingInstallments: installmentsCount - 1,
1978
+ othersInstallmentAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
1979
+ value: priceFromCents(payment.payment_plan[1].total_amount),
1980
+ style: "currency",
1981
+ currency: "EUR"
1982
+ })
1983
+ }
1984
+ }), withNoFee());
1985
+ }
1986
+
1987
+ return /*#__PURE__*/React.createElement(FormattedMessage, {
1988
+ id: "payment-plan-strings.default-message",
1989
+ defaultMessage: "Payez en plusieurs fois avec Alma"
1990
+ });
1991
+ };
1992
+
1993
+ var s$2 = {"buttons":"_1l2Oa","active":"_3rue7"};
1994
+
1995
+ var EligibilityPlansButtons = function EligibilityPlansButtons(_ref) {
1996
+ var eligibilityPlans = _ref.eligibilityPlans,
1997
+ currentPlanIndex = _ref.currentPlanIndex,
1998
+ setCurrentPlanIndex = _ref.setCurrentPlanIndex;
1999
+ return /*#__PURE__*/React.createElement("div", {
2000
+ className: s$2.buttons
2001
+ }, eligibilityPlans.map(function (eligibilityPlan, index) {
2002
+ var _cx;
2003
+
2004
+ return /*#__PURE__*/React.createElement("button", {
2005
+ key: index,
2006
+ className: cx((_cx = {}, _cx[s$2.active] = index === currentPlanIndex, _cx)),
2007
+ onClick: function onClick() {
2008
+ return setCurrentPlanIndex(index);
2009
+ }
2010
+ }, paymentPlanShorthandName(eligibilityPlan));
2011
+ }));
2012
+ };
2013
+
2014
+ var s$3 = {"schedule":"_MPKjS","scheduleLine":"_1A7Qv","total":"_14Ejo","creditCost":"_1ZIgu","creditMessage":"_1BUr8"};
2015
+
2016
+ var Schedule = function Schedule(_ref) {
2017
+ var currentPlan = _ref.currentPlan;
2018
+ var total = currentPlan && priceFromCents(currentPlan.purchase_amount + currentPlan.customer_total_cost_amount);
2019
+ var creditCost = currentPlan ? priceFromCents(currentPlan.customer_total_cost_amount) : 0;
2020
+ var TAEG = (currentPlan == null ? void 0 : currentPlan.annual_interest_rate) && currentPlan.annual_interest_rate / 10000;
2021
+ var customerFees = priceFromCents(currentPlan ? currentPlan.customer_total_cost_amount : 0);
2022
+ var isCredit = currentPlan && currentPlan.installments_count > 4;
2023
+ var intl = useIntl();
2024
+ return /*#__PURE__*/React.createElement("div", {
2025
+ className: s$3.schedule,
2026
+ "data-testid": "modal-installments-element"
2027
+ }, /*#__PURE__*/React.createElement("div", {
2028
+ className: cx(s$3.scheduleLine, s$3.total)
2029
+ }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedMessage, {
2030
+ id: "eligibility-modal.total",
2031
+ defaultMessage: "Total"
2032
+ })), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedNumber, {
2033
+ value: total,
2034
+ style: "currency",
2035
+ currency: "EUR"
2036
+ }))), /*#__PURE__*/React.createElement("div", {
2037
+ className: cx(s$3.scheduleLine, s$3.creditCost)
2038
+ }, isCredit ? /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedMessage, {
2039
+ id: "eligibility-modal.credit-cost",
2040
+ defaultMessage: "Dont co\xFBt du cr\xE9dit"
2041
+ })) : /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedMessage, {
2042
+ id: "eligibility-modal.cost",
2043
+ defaultMessage: "Dont frais"
2044
+ })), /*#__PURE__*/React.createElement("span", null, isCredit ? /*#__PURE__*/React.createElement(FormattedMessage, {
2045
+ id: "eligibility-modal.credit-cost-amount",
2046
+ defaultMessage: "{creditCost} (TAEG {TAEG})",
2047
+ values: {
2048
+ creditCost: intl.formatNumber(creditCost, {
2049
+ style: 'currency',
2050
+ currency: 'EUR'
2051
+ }),
2052
+ TAEG: intl.formatNumber(TAEG != null ? TAEG : 0, {
2053
+ style: 'percent',
2054
+ maximumFractionDigits: 2
2055
+ })
2056
+ }
2057
+ }) : /*#__PURE__*/React.createElement(FormattedNumber, {
2058
+ value: customerFees,
2059
+ style: "currency",
2060
+ currency: "EUR"
2061
+ }))), ((currentPlan == null ? void 0 : currentPlan.payment_plan) || []).map(function (installment, index) {
2062
+ return /*#__PURE__*/React.createElement("div", {
2063
+ className: s$3.scheduleLine,
2064
+ key: index
2065
+ }, /*#__PURE__*/React.createElement("span", null, isToday(installment.due_date * 1000) ? /*#__PURE__*/React.createElement(FormattedMessage, {
2066
+ id: "installments.today",
2067
+ defaultMessage: "Aujourd'hui"
2068
+ }) : /*#__PURE__*/React.createElement(FormattedDate, {
2069
+ value: installment.due_date * 1000,
2070
+ day: "numeric",
2071
+ month: "long",
2072
+ year: "numeric"
2073
+ })), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedNumber, {
2074
+ value: priceFromCents(installment.total_amount),
2075
+ style: "currency",
2076
+ currency: "EUR"
2077
+ })));
2078
+ }), isCredit && /*#__PURE__*/React.createElement("p", {
2079
+ className: s$3.creditMessage
2080
+ }, /*#__PURE__*/React.createElement(FormattedMessage, {
2081
+ id: "eligibility-modal.credit-commitment",
2082
+ defaultMessage: "Un cr\xE9dit vous engage et doit \xEAtre rembours\xE9. V\xE9rifiez vos capacit\xE9s de remboursement\n avant de vous engager."
2083
+ })));
2084
+ };
2085
+
2086
+ var s$4 = {"list":"_180ro","listItem":"_1HqCO","bullet":"_3B8wx"};
2087
+
2088
+ var Info = function Info() {
2089
+ return /*#__PURE__*/React.createElement("div", {
2090
+ className: s$4.list,
2091
+ "data-testid": "modal-info-element"
2092
+ }, /*#__PURE__*/React.createElement("div", {
2093
+ className: s$4.listItem
2094
+ }, /*#__PURE__*/React.createElement("div", {
2095
+ className: s$4.bullet
2096
+ }, "1"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FormattedMessage, {
2097
+ id: "eligibility-modal.bullet-1",
2098
+ defaultMessage: "Choisissez <strong>Alma</strong> au moment du paiement.",
2099
+ values: {
2100
+ strong: function strong() {
2101
+ return /*#__PURE__*/React.createElement("strong", null, [].slice.call(arguments));
2102
+ }
2103
+ }
2104
+ }))), /*#__PURE__*/React.createElement("div", {
2105
+ className: s$4.listItem
2106
+ }, /*#__PURE__*/React.createElement("div", {
2107
+ className: s$4.bullet
2108
+ }, "2"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FormattedMessage, {
2109
+ id: "eligibility-modal.bullet-2",
2110
+ defaultMessage: "Renseignez les <strong>informations</strong> demand\xE9es.",
2111
+ values: {
2112
+ strong: function strong() {
2113
+ return /*#__PURE__*/React.createElement("strong", null, [].slice.call(arguments));
2114
+ }
2115
+ }
2116
+ }))), /*#__PURE__*/React.createElement("div", {
2117
+ className: s$4.listItem
2118
+ }, /*#__PURE__*/React.createElement("div", {
2119
+ className: s$4.bullet
2120
+ }, "3"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FormattedMessage, {
2121
+ id: "eligibility-modal.bullet-3",
2122
+ defaultMessage: "La validation de votre paiement <strong>instantan\xE9e</strong> !",
2123
+ values: {
2124
+ strong: function strong() {
2125
+ return /*#__PURE__*/React.createElement("strong", null, [].slice.call(arguments));
2126
+ }
2127
+ }
2128
+ }))));
2129
+ };
2130
+
2131
+ function LogoIcon(_ref) {
2132
+ var _ref$color = _ref.color,
2133
+ color = _ref$color === void 0 ? '#00425D' : _ref$color,
2134
+ _ref$underlineColor = _ref.underlineColor,
2135
+ underlineColor = _ref$underlineColor === void 0 ? '#00425D' : _ref$underlineColor,
2136
+ className = _ref.className;
2137
+ return /*#__PURE__*/React.createElement("svg", {
2138
+ className: className,
2139
+ width: "35",
2140
+ height: "23",
2141
+ viewBox: "0 0 40 23",
2142
+ fill: "none",
2143
+ xmlns: "http://www.w3.org/2000/svg"
2144
+ }, /*#__PURE__*/React.createElement("path", {
2145
+ 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",
2146
+ fill: color
2147
+ }), /*#__PURE__*/React.createElement("path", {
2148
+ 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",
2149
+ fill: color
2150
+ }), /*#__PURE__*/React.createElement("path", {
2151
+ 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",
2152
+ fill: color
2153
+ }), /*#__PURE__*/React.createElement("path", {
2154
+ 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",
2155
+ fill: color
2156
+ }), /*#__PURE__*/React.createElement("rect", {
2157
+ y: "20",
2158
+ width: "40",
2159
+ height: "3",
2160
+ fill: underlineColor
2161
+ }));
2162
+ }
2163
+
2164
+ var s$5 = {"logo":"_3Oyv_"};
2165
+
2166
+ var Logo = function Logo() {
2167
+ return /*#__PURE__*/React.createElement("div", {
2168
+ className: s$5.logo
2169
+ }, /*#__PURE__*/React.createElement(LogoIcon, {
2170
+ underlineColor: "#FF414D"
2171
+ }));
2172
+ };
2173
+
2174
+ var s$6 = {"title":"_3ERx-"};
2175
+
2176
+ var Title = function Title() {
2177
+ return /*#__PURE__*/React.createElement("div", {
2178
+ className: s$6.title,
2179
+ "data-testid": "modal-title-element"
2180
+ }, /*#__PURE__*/React.createElement(FormattedMessage, {
2181
+ id: "eligibility-modal.title",
2182
+ defaultMessage: "<highlighted>Payez en plusieurs fois</highlighted> ou plus tard par carte bancaire avec Alma.",
2183
+ values: {
2184
+ highlighted: function highlighted() {
2185
+ return /*#__PURE__*/React.createElement("span", null, [].slice.call(arguments));
2186
+ }
2187
+ }
2188
+ }));
2189
+ };
2190
+
2191
+ var s$7 = {"container":"_21g6u","block":"_3zaP5","left":"_2SBRC"};
2192
+
2193
+ var DesktopModal = function DesktopModal(_ref) {
2194
+ var children = _ref.children;
2195
+ return /*#__PURE__*/React.createElement("div", {
2196
+ className: s$7.container,
2197
+ "data-testid": "modal-container"
2198
+ }, /*#__PURE__*/React.createElement("div", {
2199
+ className: cx([s$7.block, s$7.left])
2200
+ }, /*#__PURE__*/React.createElement(Title, null), /*#__PURE__*/React.createElement(Info, null), /*#__PURE__*/React.createElement(Logo, null)), /*#__PURE__*/React.createElement("div", {
2201
+ className: s$7.block
2202
+ }, children));
2203
+ };
2204
+
2205
+ var s$8 = {"noEligibility":"_17qNJ","loader":"_2oTJq"};
2206
+
2207
+ var s$9 = {"container":"_2G7Ch"};
2208
+
2209
+ var MobileModal = function MobileModal(_ref) {
2210
+ var children = _ref.children;
2211
+ return /*#__PURE__*/React.createElement("div", {
2212
+ className: s$9.container,
2213
+ "data-testid": "modal-container"
2214
+ }, /*#__PURE__*/React.createElement(Title, null), children, /*#__PURE__*/React.createElement(Info, null), /*#__PURE__*/React.createElement(Logo, null));
2215
+ };
2216
+
2217
+ var EligibilityModal = function EligibilityModal(_ref) {
2218
+ var initialPlanIndex = _ref.initialPlanIndex,
2219
+ onClose = _ref.onClose,
2220
+ eligibilityPlans = _ref.eligibilityPlans,
2221
+ status = _ref.status;
2222
+
2223
+ var _useState = useState(initialPlanIndex || 0),
2224
+ currentPlanIndex = _useState[0],
2225
+ setCurrentPlanIndex = _useState[1];
2226
+
2227
+ var isBigScreen = useMediaQuery({
2228
+ minWidth: 800
2229
+ });
2230
+ var ModalComponent = isBigScreen ? DesktopModal : MobileModal;
2231
+ var eligiblePlans = eligibilityPlans.filter(function (plan) {
2232
+ return plan.eligible;
2233
+ });
2234
+ var currentPlan = eligiblePlans[currentPlanIndex];
2235
+ var modalProps = {
2236
+ eligibilityPlans: eligiblePlans,
2237
+ currentPlanIndex: currentPlanIndex,
2238
+ setCurrentPlanIndex: setCurrentPlanIndex,
2239
+ currentPlan: currentPlan,
2240
+ status: status
2241
+ };
2242
+ return /*#__PURE__*/React.createElement(ControlledModal, {
2243
+ onClose: onClose,
2244
+ ariaHideApp: false,
2245
+ scrollable: true,
2246
+ isOpen: true
2247
+ }, /*#__PURE__*/React.createElement(ModalComponent, Object.assign({}, modalProps), status === apiStatus.PENDING && /*#__PURE__*/React.createElement("div", {
2248
+ className: s$8.loader
2249
+ }, /*#__PURE__*/React.createElement(LoadingIndicator, null)), status === apiStatus.SUCCESS && eligiblePlans.length === 0 && /*#__PURE__*/React.createElement("div", {
2250
+ className: s$8.noEligibility
2251
+ }, /*#__PURE__*/React.createElement(FormattedMessage, {
2252
+ id: "eligibility-modal.no-eligibility",
2253
+ defaultMessage: "Oups, il semblerait que la simulation n'aie pas fonctionn\xE9."
2254
+ })), status === apiStatus.SUCCESS && eligiblePlans.length >= 1 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EligibilityPlansButtons, {
2255
+ eligibilityPlans: eligiblePlans,
2256
+ currentPlanIndex: currentPlanIndex,
2257
+ setCurrentPlanIndex: setCurrentPlanIndex
2258
+ }), /*#__PURE__*/React.createElement(Schedule, {
2259
+ currentPlan: currentPlan
2260
+ }))));
2261
+ };
2262
+
2263
+ /**
2264
+ * This component allows to display only the modal, without PaymentPlans.
2265
+ */
2266
+
2267
+ var ModalContainer = function ModalContainer(_ref) {
2268
+ var purchaseAmount = _ref.purchaseAmount,
2269
+ apiData = _ref.apiData,
2270
+ configPlans = _ref.configPlans,
2271
+ onClose = _ref.onClose;
2272
+
2273
+ var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans),
2274
+ eligibilityPlans = _useFetchEligibility[0],
2275
+ status = _useFetchEligibility[1];
2276
+
2277
+ return /*#__PURE__*/React.createElement(EligibilityModal, {
2278
+ initialPlanIndex: 0,
2279
+ onClose: onClose,
2280
+ eligibilityPlans: eligibilityPlans,
2281
+ status: status
2282
+ });
2283
+ };
2284
+
2285
+ var s$a = {"loadingIndicator":"_2SwwZ","line1":"_2qODo","line2":"_2YO01"};
2286
+
2287
+ var Loader = function Loader(_ref) {
2288
+ var className = _ref.className;
2289
+ return /*#__PURE__*/React.createElement("div", {
2290
+ className: cx(s$a.loadingIndicator, className),
2291
+ "data-testid": "loader"
2292
+ }, /*#__PURE__*/React.createElement("div", {
2293
+ className: s$a.line1
2294
+ }), /*#__PURE__*/React.createElement("div", {
2295
+ className: s$a.line2
2296
+ }));
2297
+ };
2298
+
2299
+ var useButtonAnimation = function useButtonAnimation(iterateValues, transitionDelay) {
2300
+ var _useState = useState(0),
2301
+ current = _useState[0],
2302
+ setCurrent = _useState[1];
2303
+
2304
+ var _useState2 = useState(true),
2305
+ update = _useState2[0],
2306
+ setUpdate = _useState2[1];
2307
+
2308
+ useEffect(function () {
2309
+ var isMounted = true;
2310
+
2311
+ if (iterateValues.length !== 0) {
2312
+ if (!iterateValues.includes(current) && update) setCurrent(iterateValues[0]);
2313
+ setTimeout(function () {
2314
+ if (update && isMounted) {
2315
+ setCurrent(iterateValues[iterateValues.includes(current) ? (iterateValues.indexOf(current) + 1) % iterateValues.length : 0]);
2316
+ }
2317
+ }, transitionDelay);
2318
+ }
2319
+
2320
+ return function () {
2321
+ isMounted = false;
2322
+ };
2323
+ }, [iterateValues, current]);
2324
+ return {
2325
+ current: current,
2326
+ onHover: function onHover(current) {
2327
+ setCurrent(current);
2328
+ setUpdate(false);
2329
+ },
2330
+ onLeave: function onLeave() {
2331
+ setUpdate(true);
2332
+ }
2333
+ };
2334
+ };
2335
+
2336
+ 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"};
2337
+
2338
+ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
2339
+ var _cx2;
2340
+
2341
+ var purchaseAmount = _ref.purchaseAmount,
2342
+ apiData = _ref.apiData,
2343
+ configPlans = _ref.configPlans,
2344
+ transitionDelay = _ref.transitionDelay,
2345
+ hideIfNotEligible = _ref.hideIfNotEligible;
2346
+
2347
+ var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans),
2348
+ eligibilityPlans = _useFetchEligibility[0],
2349
+ status = _useFetchEligibility[1];
2350
+
2351
+ var eligiblePlans = eligibilityPlans.filter(function (plan) {
2352
+ return plan.eligible;
2353
+ });
2354
+
2355
+ var _useState = useState(false),
2356
+ isOpen = _useState[0],
2357
+ setIsOpen = _useState[1];
2358
+
2359
+ var _useState2 = useState(0),
2360
+ initialPlanIndex = _useState2[0],
2361
+ setInitialPlanIndex = _useState2[1];
2362
+
2363
+ var openModal = function openModal() {
2364
+ return setIsOpen(true);
2365
+ };
2366
+
2367
+ var closeModal = function closeModal() {
2368
+ return setIsOpen(false);
2369
+ };
2370
+
2371
+ var eligiblePlanKeys = eligibilityPlans.reduce(function (acc, plan, index) {
2372
+ return plan.eligible ? [].concat(acc, [index]) : acc;
2373
+ }, []);
2374
+
2375
+ var _useButtonAnimation = useButtonAnimation(eligiblePlanKeys, transitionDelay ? transitionDelay : 5500),
2376
+ current = _useButtonAnimation.current,
2377
+ onHover = _useButtonAnimation.onHover,
2378
+ onLeave = _useButtonAnimation.onLeave; // This hook is needed to update the initial plan index when useButtonAnimation
2379
+ // updates the `current` value (i.e. without any hover / click callback).
2380
+
2381
+
2382
+ useEffect(function () {
2383
+ if (current !== initialPlanIndex) {
2384
+ setInitialPlanIndex(current);
2385
+ }
2386
+ }, [current, initialPlanIndex]);
2387
+
2388
+ if (status === apiStatus.PENDING) {
2389
+ return /*#__PURE__*/React.createElement("div", {
2390
+ className: cx(s$b.widgetButton, s$b.pending)
2391
+ }, /*#__PURE__*/React.createElement(Loader, null));
2392
+ }
2393
+
2394
+ if (hideIfNotEligible && eligiblePlans.length == 0 || eligibilityPlans.length === 0) {
2395
+ return null;
2396
+ }
2397
+
2398
+ if (status === apiStatus.FAILED) {
2399
+ return null;
2400
+ }
2401
+
2402
+ var handleOpenModal = function handleOpenModal(e) {
2403
+ e.preventDefault();
2404
+
2405
+ if (eligiblePlans.length > 0) {
2406
+ openModal();
2407
+ }
2408
+ };
2409
+
2410
+ var handleHoverAndClick = function handleHoverAndClick(key, newInitialPlanIndex) {
2411
+ // This is needed to update the initial plan index and button style when hovering (desktop) or clicking (mobile).
2412
+ // The actual modal opening is triggered by a click on the highest parent div in `handleOpenModal`.
2413
+ onHover(key);
2414
+ setInitialPlanIndex(newInitialPlanIndex);
2415
+ };
2416
+
2417
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
2418
+ onClick: handleOpenModal,
2419
+ className: s$b.widgetButton,
2420
+ style: {
2421
+ cursor: eligiblePlans.length > 0 ? 'pointer' : 'initial'
2422
+ },
2423
+ "data-testid": "widget-button"
2424
+ }, /*#__PURE__*/React.createElement("div", {
2425
+ className: s$b.primaryContainer
2426
+ }, /*#__PURE__*/React.createElement(LogoIcon, {
2427
+ className: s$b.logo
2428
+ }), /*#__PURE__*/React.createElement("div", {
2429
+ className: s$b.paymentPlans
2430
+ }, eligibilityPlans.map(function (eligibilityPlan, key) {
2431
+ var _cx;
2432
+
2433
+ var newInitialPlanIndex = eligiblePlanKeys.includes(key) ? eligiblePlanKeys.findIndex(function (planKey) {
2434
+ return planKey === key;
2435
+ }) : 0;
2436
+ return /*#__PURE__*/React.createElement("div", {
2437
+ onMouseEnter: function onMouseEnter() {
2438
+ handleHoverAndClick(key, newInitialPlanIndex);
2439
+ },
2440
+ onMouseOut: function onMouseOut() {
2441
+ onLeave();
2442
+ },
2443
+ onClick: function onClick() {
2444
+ handleHoverAndClick(key, newInitialPlanIndex);
2445
+ },
2446
+ key: key,
2447
+ className: cx(s$b.plan, (_cx = {}, _cx[s$b.active] = current === key, _cx[s$b.notEligible] = !eligibilityPlan.eligible, _cx))
2448
+ }, paymentPlanShorthandName(eligibilityPlan));
2449
+ }))), /*#__PURE__*/React.createElement("div", {
2450
+ className: cx(s$b.info, (_cx2 = {}, _cx2[s$b.notEligible] = eligibilityPlans[current] && !eligibilityPlans[current].eligible, _cx2))
2451
+ }, eligibilityPlans.length !== 0 && paymentPlanInfoText(eligibilityPlans[current]))), isOpen && /*#__PURE__*/React.createElement(EligibilityModal, {
2452
+ initialPlanIndex: initialPlanIndex,
2453
+ onClose: closeModal,
2454
+ eligibilityPlans: eligiblePlans,
2455
+ status: status
2456
+ }));
2457
+ };
2458
+
2459
+ var WidgetsController = /*#__PURE__*/function () {
2460
+ function WidgetsController(apiData) {
2461
+ this.apiData = apiData;
2462
+ }
2463
+
2464
+ var _proto = WidgetsController.prototype;
2465
+
2466
+ _proto.add = function add(widget, options) {
2467
+ var _this = this;
2468
+
2469
+ var containerDiv = document.querySelector(options.container);
2470
+
2471
+ if (containerDiv) {
2472
+ unmountComponentAtNode(containerDiv);
2473
+ }
2474
+
2475
+ if (widget === widgetTypes.PaymentPlans) {
2476
+ var container = options.container,
2477
+ purchaseAmount = options.purchaseAmount,
2478
+ plans = options.plans,
2479
+ transitionDelay = options.transitionDelay,
2480
+ hideIfNotEligible = options.hideIfNotEligible,
2481
+ _options$locale = options.locale,
2482
+ locale = _options$locale === void 0 ? Locale.en : _options$locale;
2483
+
2484
+ if (containerDiv) {
2485
+ render( /*#__PURE__*/React.createElement(Provider, {
2486
+ locale: locale
2487
+ }, /*#__PURE__*/React.createElement(PaymentPlanWidget, {
2488
+ purchaseAmount: purchaseAmount,
2489
+ apiData: this.apiData,
2490
+ configPlans: plans,
2491
+ transitionDelay: transitionDelay,
2492
+ hideIfNotEligible: hideIfNotEligible
2493
+ })), document.querySelector(container));
2494
+ }
2495
+ }
2496
+
2497
+ if (widget === widgetTypes.Modal) {
2498
+ var _container = options.container,
2499
+ clickableSelector = options.clickableSelector,
2500
+ _purchaseAmount = options.purchaseAmount,
2501
+ _plans = options.plans,
2502
+ _options$locale2 = options.locale,
2503
+ _locale = _options$locale2 === void 0 ? Locale.en : _options$locale2;
2504
+
2505
+ var close = function close() {
2506
+ return containerDiv && unmountComponentAtNode(containerDiv);
2507
+ };
2508
+
2509
+ var renderModal = function renderModal() {
2510
+ render( /*#__PURE__*/React.createElement(Provider, {
2511
+ locale: _locale
2512
+ }, /*#__PURE__*/React.createElement(ModalContainer, {
2513
+ purchaseAmount: _purchaseAmount,
2514
+ apiData: _this.apiData,
2515
+ configPlans: _plans,
2516
+ onClose: close
2517
+ })), document.querySelector(_container));
2518
+ }; // if clickableSelector is provided, add an onClick event handler to open the Modal.
2519
+
2520
+
2521
+ if (clickableSelector) {
2522
+ var _document$querySelect;
2523
+
2524
+ (_document$querySelect = document.querySelector(clickableSelector)) == null ? void 0 : _document$querySelect.addEventListener('click', renderModal, false);
2525
+ }
2526
+
2527
+ return {
2528
+ open: renderModal,
2529
+ close: close
2530
+ };
2531
+ }
2532
+ };
2533
+
2534
+ return WidgetsController;
2535
+ }();
2536
+
2537
+ var ApiMode;
2538
+
2539
+ (function (ApiMode) {
2540
+ ApiMode["LIVE"] = "https://api.getalma.eu";
2541
+ ApiMode["TEST"] = "https://api.sandbox.getalma.eu";
2542
+ })(ApiMode || (ApiMode = {}));
2543
+
2544
+ var Widgets;
2545
+
2546
+ (function (Widgets) {
2547
+ function initialize(merchantId, mode) {
2548
+ return new WidgetsController({
2549
+ domain: mode,
2550
+ merchantId: merchantId
2551
+ });
2552
+ }
2553
+
2554
+ Widgets.initialize = initialize;
2555
+ Widgets.PaymentPlans = widgetTypes.PaymentPlans;
2556
+ Widgets.Modal = widgetTypes.Modal;
2557
+ })(Widgets || (Widgets = {})); // eslint-disable-next-line @typescript-eslint/no-namespace
2558
+
2559
+
2560
+ var Utils;
2561
+
2562
+ (function (Utils) {
2563
+ Utils.priceToCents = priceToCents;
2564
+ Utils.priceFromCents = priceFromCents;
2565
+ Utils.formatCents = formatCents;
2566
+ })(Utils || (Utils = {}));
2567
+
2568
+ export { ApiMode, Utils, Widgets };
2569
+ //# sourceMappingURL=widgets.m.js.map