@monei-js/components 1.4.0 → 1.5.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.
@@ -974,6 +974,9 @@ var globalConfig = {
974
974
  cofidisUrl: domain + "/" + version + "/inner-cofidis/",
975
975
  cofidisButtonUrl: domain + "/" + version + "/inner-cofidis-button/",
976
976
  cofidisWidgetUrl: domain + "/" + version + "/inner-cofidis-widget/",
977
+ cofidisLoanUrl: domain + "/" + version + "/inner-cofidis-loan/",
978
+ cofidisLoanButtonUrl: domain + "/" + version + "/inner-cofidis-loan-button/",
979
+ cofidisLoanWidgetUrl: domain + "/" + version + "/inner-cofidis-loan-widget/",
977
980
  googlePayUrl: domain + "/" + version + "/inner-google-pay/",
978
981
  paymentRequestUrl: domain + "/" + version + "/inner-payment-request/",
979
982
  click2PayUrl: domain + "/" + version + "/inner-click2pay/",
@@ -995,6 +998,9 @@ var stageConfig = {
995
998
  cofidisUrl: "http://192.168.18.3:3010/" + version + "/inner-cofidis/",
996
999
  cofidisButtonUrl: "http://192.168.18.3:3011/" + version + "/inner-cofidis-button/",
997
1000
  cofidisWidgetUrl: "http://192.168.18.3:3012/" + version + "/inner-cofidis-widget/",
1001
+ cofidisLoanUrl: "http://192.168.18.3:3013/" + version + "/inner-cofidis-loan/",
1002
+ cofidisLoanButtonUrl: "http://192.168.18.3:3014/" + version + "/inner-cofidis-loan-button/",
1003
+ cofidisLoanWidgetUrl: "http://192.168.18.3:3015/" + version + "/inner-cofidis-loan-widget/",
998
1004
  apiUrl: 'https://api.microapps-staging.com/v1',
999
1005
  secureDomain: 'https://secure.microapps-staging.com'
1000
1006
  },
@@ -14987,6 +14993,10 @@ var options$6 = {
14987
14993
  return 'es';
14988
14994
  }
14989
14995
  },
14996
+ showLogo: {
14997
+ type: zoid.PROP_TYPE.BOOLEAN,
14998
+ required: false
14999
+ },
14990
15000
  style: {
14991
15001
  type: zoid.PROP_TYPE.OBJECT,
14992
15002
  alias: 'innerStyle',
@@ -15119,8 +15129,310 @@ var options$7 = {
15119
15129
  };
15120
15130
  var Cofidis = /*#__PURE__*/zoid.create(options$7);
15121
15131
 
15132
+ var EVENT$2;
15133
+
15134
+ (function (EVENT) {
15135
+ EVENT["BEFORE_CLOSE"] = "BEFORE_CLOSE";
15136
+ })(EVENT$2 || (EVENT$2 = {}));
15137
+
15138
+ function containerTemplate$3(_ref) {
15139
+ var uid = _ref.uid,
15140
+ frame = _ref.frame,
15141
+ prerenderFrame = _ref.prerenderFrame,
15142
+ doc = _ref.doc,
15143
+ props = _ref.props,
15144
+ event = _ref.event,
15145
+ _ref$dimensions = _ref.dimensions,
15146
+ width = _ref$dimensions.width,
15147
+ height = _ref$dimensions.height;
15148
+
15149
+ if (!frame || !prerenderFrame) {
15150
+ return;
15151
+ }
15152
+
15153
+ var div = doc.createElement('div');
15154
+ var backdrop = doc.createElement('div');
15155
+ div.setAttribute('id', uid);
15156
+ backdrop.classList.add('backdrop');
15157
+ div.appendChild(backdrop);
15158
+ var style = doc.createElement('style');
15159
+
15160
+ if (props.cspNonce) {
15161
+ style.setAttribute('nonce', props.cspNonce);
15162
+ }
15163
+
15164
+ style.appendChild(doc.createTextNode("\n #" + uid + " {\n position: fixed;\n overflow: hidden;\n display: block;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n width: " + width + ";\n height: " + height + ";\n z-index: 99999;\n }\n #" + uid + " > .backdrop {\n position: fixed;\n display: block;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(40, 40, 40, 0.7);\n transition: opacity 0.35s ease-in-out;\n opacity: 0;\n will-change: opacity;\n }\n #" + uid + " > .backdrop." + CLASS.VISIBLE + " {\n opacity: 1;\n }\n #" + uid + " > iframe {\n display: inline-block;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n transition: all .2s ease-in-out;\n }\n #" + uid + " > iframe." + CLASS.INVISIBLE + " {\n opacity: 0;\n }\n #" + uid + " > iframe." + CLASS.VISIBLE + " {\n opacity: 1;\n }\n "));
15165
+ div.appendChild(frame);
15166
+ div.appendChild(prerenderFrame);
15167
+ div.appendChild(style);
15168
+ prerenderFrame.classList.add(CLASS.VISIBLE);
15169
+ frame.classList.add(CLASS.INVISIBLE);
15170
+ setTimeout(function () {
15171
+ backdrop.classList.add(CLASS.VISIBLE);
15172
+ }, 1);
15173
+ event.on(zoid.EVENT.RENDERED, function () {
15174
+ prerenderFrame.classList.remove(CLASS.VISIBLE);
15175
+ prerenderFrame.classList.add(CLASS.INVISIBLE);
15176
+ frame.classList.remove(CLASS.INVISIBLE);
15177
+ frame.classList.add(CLASS.VISIBLE);
15178
+ setTimeout(function () {
15179
+ belter$3.destroyElement(prerenderFrame);
15180
+ }, 1);
15181
+ });
15182
+ event.on(EVENT$2.BEFORE_CLOSE, function () {
15183
+ backdrop.classList.remove(CLASS.VISIBLE);
15184
+ });
15185
+ event.on(zoid.EVENT.RESIZE, function (_ref2) {
15186
+ var newWidth = _ref2.width,
15187
+ newHeight = _ref2.height;
15188
+
15189
+ if (typeof newWidth === 'number') {
15190
+ div.style.width = belter$3.toCSS(newWidth);
15191
+ }
15192
+
15193
+ if (typeof newHeight === 'number') {
15194
+ div.style.height = belter$3.toCSS(newHeight);
15195
+ }
15196
+ });
15197
+ return div;
15198
+ }
15199
+
15122
15200
  // @ts-ignore
15123
15201
  var options$8 = {
15202
+ tag: 'monei-cofidis-loan',
15203
+ url: config.cofidisLoanUrl,
15204
+ dimensions: {
15205
+ width: '100%',
15206
+ height: '100%'
15207
+ },
15208
+ autoResize: {
15209
+ width: false,
15210
+ height: false
15211
+ },
15212
+ prerenderTemplate: function prerenderTemplate() {
15213
+ return undefined;
15214
+ },
15215
+ containerTemplate: containerTemplate$3,
15216
+ props: {
15217
+ paymentId: {
15218
+ type: zoid.PROP_TYPE.STRING,
15219
+ required: false
15220
+ },
15221
+ amount: {
15222
+ type: zoid.PROP_TYPE.NUMBER,
15223
+ required: false
15224
+ },
15225
+ currency: {
15226
+ type: zoid.PROP_TYPE.STRING,
15227
+ required: false
15228
+ },
15229
+ language: {
15230
+ type: zoid.PROP_TYPE.STRING,
15231
+ required: false
15232
+ },
15233
+ onError: {
15234
+ type: zoid.PROP_TYPE.FUNCTION,
15235
+ required: false
15236
+ },
15237
+ onLoad: {
15238
+ type: zoid.PROP_TYPE.FUNCTION,
15239
+ required: false
15240
+ },
15241
+ onSubmit: {
15242
+ type: zoid.PROP_TYPE.FUNCTION,
15243
+ required: false
15244
+ },
15245
+ onOpen: {
15246
+ type: zoid.PROP_TYPE.FUNCTION,
15247
+ required: false
15248
+ },
15249
+ onBeforeClose: {
15250
+ type: zoid.PROP_TYPE.FUNCTION,
15251
+ required: false,
15252
+ "default": function _default(_ref) {
15253
+ var event = _ref.event;
15254
+ return function () {
15255
+ event.trigger(EVENT$2.BEFORE_CLOSE);
15256
+ };
15257
+ }
15258
+ }
15259
+ }
15260
+ };
15261
+ var CofidisLoanModal = /*#__PURE__*/zoid.create(options$8);
15262
+
15263
+ // @ts-ignore
15264
+ var options$9 = {
15265
+ tag: 'monei-cofidis-loan-widget',
15266
+ url: config.cofidisLoanWidgetUrl,
15267
+ dimensions: {
15268
+ width: '100%',
15269
+ height: '46px'
15270
+ },
15271
+ autoResize: {
15272
+ width: false,
15273
+ height: true
15274
+ },
15275
+ prerenderTemplate: function prerenderTemplate() {
15276
+ return undefined;
15277
+ },
15278
+ props: {
15279
+ accountId: {
15280
+ type: zoid.PROP_TYPE.STRING,
15281
+ required: true
15282
+ },
15283
+ amount: {
15284
+ type: zoid.PROP_TYPE.NUMBER,
15285
+ required: false
15286
+ },
15287
+ amountInt: {
15288
+ type: zoid.PROP_TYPE.NUMBER,
15289
+ required: false
15290
+ },
15291
+ language: {
15292
+ type: zoid.PROP_TYPE.STRING,
15293
+ required: false,
15294
+ "default": function _default() {
15295
+ return 'es';
15296
+ }
15297
+ },
15298
+ showLogo: {
15299
+ type: zoid.PROP_TYPE.BOOLEAN,
15300
+ required: false
15301
+ },
15302
+ style: {
15303
+ type: zoid.PROP_TYPE.OBJECT,
15304
+ alias: 'innerStyle',
15305
+ required: false
15306
+ },
15307
+ onError: {
15308
+ type: zoid.PROP_TYPE.FUNCTION,
15309
+ required: false
15310
+ },
15311
+ onLoad: {
15312
+ type: zoid.PROP_TYPE.FUNCTION,
15313
+ required: false
15314
+ },
15315
+ __onClick: {
15316
+ type: zoid.PROP_TYPE.FUNCTION,
15317
+ required: false,
15318
+ value: function value() {
15319
+ return function (url) {
15320
+ window.open(url, '_blank');
15321
+ };
15322
+ }
15323
+ }
15324
+ }
15325
+ };
15326
+ var CofidisLoanWidget = /*#__PURE__*/zoid.create(options$9);
15327
+
15328
+ var options$a = {
15329
+ tag: 'monei-cofidis-loan-button',
15330
+ url: config.cofidisLoanButtonUrl,
15331
+ dimensions: {
15332
+ width: '100%',
15333
+ height: '45px'
15334
+ },
15335
+ autoResize: {
15336
+ width: false,
15337
+ height: true
15338
+ },
15339
+ validate: validateComponentProps,
15340
+ containerTemplate: containerTemplate,
15341
+ prerenderTemplate: function prerenderTemplate() {
15342
+ return undefined;
15343
+ },
15344
+ props: {
15345
+ paymentId: {
15346
+ type: zoid.PROP_TYPE.STRING,
15347
+ required: false
15348
+ },
15349
+ language: {
15350
+ type: zoid.PROP_TYPE.STRING,
15351
+ required: false
15352
+ },
15353
+ hint: {
15354
+ type: zoid.PROP_TYPE.BOOLEAN,
15355
+ "default": function _default() {
15356
+ return true;
15357
+ },
15358
+ required: false
15359
+ },
15360
+ onError: {
15361
+ type: zoid.PROP_TYPE.FUNCTION,
15362
+ required: false
15363
+ },
15364
+ onLoad: {
15365
+ type: zoid.PROP_TYPE.FUNCTION,
15366
+ required: false
15367
+ },
15368
+ onOpen: {
15369
+ type: zoid.PROP_TYPE.FUNCTION,
15370
+ required: false
15371
+ },
15372
+ style: {
15373
+ type: zoid.PROP_TYPE.OBJECT,
15374
+ alias: 'innerStyle',
15375
+ required: false
15376
+ },
15377
+ __getConfig: {
15378
+ type: zoid.PROP_TYPE.FUNCTION,
15379
+ required: false,
15380
+ value: function value(_ref) {
15381
+ var props = _ref.props;
15382
+ return getPaymentMethods.bind(null, props);
15383
+ }
15384
+ },
15385
+ __onHintClick: {
15386
+ type: zoid.PROP_TYPE.FUNCTION,
15387
+ required: false,
15388
+ value: function value() {
15389
+ return function (url) {
15390
+ window.open(url, '_blank');
15391
+ };
15392
+ }
15393
+ },
15394
+ __onClick: {
15395
+ type: zoid.PROP_TYPE.FUNCTION,
15396
+ required: false,
15397
+ value: function value(_ref2) {
15398
+ var props = _ref2.props;
15399
+ var rootNode = document.createElement('div');
15400
+ document.body.appendChild(rootNode);
15401
+ return function (_ref3) {
15402
+ var amount = _ref3.amount,
15403
+ currency = _ref3.currency,
15404
+ accountId = _ref3.accountId;
15405
+ var cofidisModal = new CofidisLoanModal(_extends({}, props, {
15406
+ amount: amount,
15407
+ currency: currency,
15408
+ accountId: accountId,
15409
+ onClose: function onClose() {
15410
+ window.onpopstate = null;
15411
+ document.body.style.overflow = '';
15412
+ },
15413
+ isOpen: true
15414
+ }));
15415
+ window.history.pushState(null, '', window.location.href);
15416
+
15417
+ window.onpopstate = function () {
15418
+ return cofidisModal.updateProps({
15419
+ isOpen: false
15420
+ });
15421
+ };
15422
+
15423
+ Object.assign(document.body.style, {
15424
+ overflow: 'hidden'
15425
+ });
15426
+ return cofidisModal.render(rootNode);
15427
+ };
15428
+ }
15429
+ }
15430
+ }
15431
+ };
15432
+ var CofidisLoan = /*#__PURE__*/zoid.create(options$a);
15433
+
15434
+ // @ts-ignore
15435
+ var options$b = {
15124
15436
  tag: 'monei-google-pay',
15125
15437
  url: config.googlePayUrl,
15126
15438
  dimensions: {
@@ -15192,7 +15504,7 @@ var options$8 = {
15192
15504
  }
15193
15505
  }
15194
15506
  };
15195
- var GooglePay = /*#__PURE__*/zoid.create(options$8);
15507
+ var GooglePay = /*#__PURE__*/zoid.create(options$b);
15196
15508
 
15197
15509
  var onApplePayButtonClicked = /*#__PURE__*/function () {
15198
15510
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(props, request, context) {
@@ -15310,7 +15622,7 @@ var onApplePayButtonClicked = /*#__PURE__*/function () {
15310
15622
  };
15311
15623
  }();
15312
15624
 
15313
- var options$9 = {
15625
+ var options$c = {
15314
15626
  tag: 'monei-payment-request',
15315
15627
  url: config.paymentRequestUrl,
15316
15628
  dimensions: {
@@ -15403,7 +15715,7 @@ var options$9 = {
15403
15715
  }
15404
15716
  }
15405
15717
  };
15406
- var PaymentRequest = /*#__PURE__*/zoid.create(options$9);
15718
+ var PaymentRequest = /*#__PURE__*/zoid.create(options$c);
15407
15719
 
15408
15720
  var NextActionType;
15409
15721
 
@@ -15417,5 +15729,5 @@ var NextActionType;
15417
15729
  var api = _api;
15418
15730
  var utils = _utils;
15419
15731
 
15420
- export { Bizum, BizumModal, CardInput, Cofidis, CofidisModal, CofidisWidget, GooglePay, NextActionType, PayPal, PaymentModal, PaymentRequest, api, config, confirmPayment$1 as confirmPayment, createToken$1 as createToken, utils };
15732
+ export { Bizum, BizumModal, CardInput, Cofidis, CofidisLoan, CofidisLoanModal, CofidisLoanWidget, CofidisModal, CofidisWidget, GooglePay, NextActionType, PayPal, PaymentModal, PaymentRequest, api, config, confirmPayment$1 as confirmPayment, createToken$1 as createToken, utils };
15421
15733
  //# sourceMappingURL=components.esm.js.map