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