@alma/widgets 3.4.0 → 4.0.0

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