@monei-js/components 1.3.0 → 1.5.1

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.
@@ -971,6 +971,12 @@ var globalConfig = {
971
971
  paypalUrl: domain + "/" + version + "/inner-paypal/",
972
972
  bizumUrl: domain + "/" + version + "/inner-bizum/",
973
973
  bizumButtonUrl: domain + "/" + version + "/inner-bizum-button/",
974
+ cofidisUrl: domain + "/" + version + "/inner-cofidis/",
975
+ cofidisButtonUrl: domain + "/" + version + "/inner-cofidis-button/",
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/",
974
980
  googlePayUrl: domain + "/" + version + "/inner-google-pay/",
975
981
  paymentRequestUrl: domain + "/" + version + "/inner-payment-request/",
976
982
  click2PayUrl: domain + "/" + version + "/inner-click2pay/",
@@ -981,14 +987,20 @@ var stageConfig = {
981
987
  paymentPageUrl: "http://192.168.18.3:8080/",
982
988
  posPaymentPageUrl: "http://192.168.18.3:8080/",
983
989
  cardInputUrl: "http://192.168.18.3:3001/" + version + "/inner-card-input/",
984
- paymentModalUrl: "https://monei-payment-modal.eu.ngrok.io/" + version + "/inner-payment-modal/",
990
+ paymentModalUrl: "http://192.168.18.3:3002/" + version + "/inner-payment-modal/",
985
991
  paypalUrl: "http://192.168.18.3:3003/" + version + "/inner-paypal/",
986
992
  bizumUrl: "http://192.168.18.3:3004/" + version + "/inner-bizum/",
987
993
  bizumButtonUrl: "http://192.168.18.3:3005/" + version + "/inner-bizum-button/",
988
994
  googlePayUrl: "http://192.168.18.3:3006/" + version + "/inner-google-pay/",
989
995
  paymentRequestUrl: "https://monei-payment-request.eu.ngrok.io/" + version + "/inner-payment-request/",
990
- click2PayUrl: "http://192.168.18.3:3007/inner-click2pay/",
991
- click2PayButtonUrl: "http://192.168.18.3:3008/inner-click2pay-button/",
996
+ click2PayUrl: "http://192.168.18.3:3008/inner-click2pay/",
997
+ click2PayButtonUrl: "http://192.168.18.3:3009/inner-click2pay-button/",
998
+ cofidisUrl: "http://192.168.18.3:3010/" + version + "/inner-cofidis/",
999
+ cofidisButtonUrl: "http://192.168.18.3:3011/" + version + "/inner-cofidis-button/",
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/",
992
1004
  apiUrl: 'https://api.microapps-staging.com/v1',
993
1005
  secureDomain: 'https://secure.microapps-staging.com'
994
1006
  },
@@ -1307,6 +1319,52 @@ var createApplePaySession = /*#__PURE__*/function () {
1307
1319
  return _ref14.apply(this, arguments);
1308
1320
  };
1309
1321
  }();
1322
+ var calculateFinancing = /*#__PURE__*/function () {
1323
+ var _ref15 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(req) {
1324
+ return runtime_1.wrap(function _callee9$(_context9) {
1325
+ while (1) {
1326
+ switch (_context9.prev = _context9.next) {
1327
+ case 0:
1328
+ return _context9.abrupt("return", request("/cofidis/calculate-financing", {
1329
+ method: 'POST',
1330
+ body: req
1331
+ }));
1332
+
1333
+ case 1:
1334
+ case "end":
1335
+ return _context9.stop();
1336
+ }
1337
+ }
1338
+ }, _callee9);
1339
+ }));
1340
+
1341
+ return function calculateFinancing(_x10) {
1342
+ return _ref15.apply(this, arguments);
1343
+ };
1344
+ }();
1345
+ var validateBizumPhone = /*#__PURE__*/function () {
1346
+ var _ref16 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(req) {
1347
+ return runtime_1.wrap(function _callee10$(_context10) {
1348
+ while (1) {
1349
+ switch (_context10.prev = _context10.next) {
1350
+ case 0:
1351
+ return _context10.abrupt("return", request("/bizum/validate-phone", {
1352
+ method: 'POST',
1353
+ body: req
1354
+ }));
1355
+
1356
+ case 1:
1357
+ case "end":
1358
+ return _context10.stop();
1359
+ }
1360
+ }
1361
+ }, _callee10);
1362
+ }));
1363
+
1364
+ return function validateBizumPhone(_x11) {
1365
+ return _ref16.apply(this, arguments);
1366
+ };
1367
+ }();
1310
1368
 
1311
1369
  var _api = {
1312
1370
  __proto__: null,
@@ -1316,7 +1374,9 @@ var _api = {
1316
1374
  confirmPayment: confirmPayment,
1317
1375
  createPayment: createPayment,
1318
1376
  sendPaymentReceipt: sendPaymentReceipt,
1319
- createApplePaySession: createApplePaySession
1377
+ createApplePaySession: createApplePaySession,
1378
+ calculateFinancing: calculateFinancing,
1379
+ validateBizumPhone: validateBizumPhone
1320
1380
  };
1321
1381
 
1322
1382
  var postRobot = createCommonjsModule(function (module, exports) {
@@ -14664,7 +14724,7 @@ var options$3 = {
14664
14724
  type: zoid.PROP_TYPE.FUNCTION,
14665
14725
  required: false
14666
14726
  },
14667
- onSuccess: {
14727
+ onSubmit: {
14668
14728
  type: zoid.PROP_TYPE.FUNCTION,
14669
14729
  required: false
14670
14730
  },
@@ -14763,8 +14823,12 @@ var options$4 = {
14763
14823
  var props = _ref2.props;
14764
14824
  var rootNode = document.createElement('div');
14765
14825
  document.body.appendChild(rootNode);
14766
- return function () {
14826
+ return function (_ref3) {
14827
+ var amount = _ref3.amount,
14828
+ currency = _ref3.currency;
14767
14829
  var bizumModal = new BizumModal(_extends({}, props, {
14830
+ amount: amount,
14831
+ currency: currency,
14768
14832
  onClose: function onClose() {
14769
14833
  window.onpopstate = null;
14770
14834
  document.body.style.overflow = '';
@@ -14790,46 +14854,179 @@ var options$4 = {
14790
14854
  };
14791
14855
  var Bizum = /*#__PURE__*/zoid.create(options$4);
14792
14856
 
14857
+ var EVENT$1;
14858
+
14859
+ (function (EVENT) {
14860
+ EVENT["BEFORE_CLOSE"] = "BEFORE_CLOSE";
14861
+ })(EVENT$1 || (EVENT$1 = {}));
14862
+
14863
+ function containerTemplate$2(_ref) {
14864
+ var uid = _ref.uid,
14865
+ frame = _ref.frame,
14866
+ prerenderFrame = _ref.prerenderFrame,
14867
+ doc = _ref.doc,
14868
+ props = _ref.props,
14869
+ event = _ref.event,
14870
+ _ref$dimensions = _ref.dimensions,
14871
+ width = _ref$dimensions.width,
14872
+ height = _ref$dimensions.height;
14873
+
14874
+ if (!frame || !prerenderFrame) {
14875
+ return;
14876
+ }
14877
+
14878
+ var div = doc.createElement('div');
14879
+ var backdrop = doc.createElement('div');
14880
+ div.setAttribute('id', uid);
14881
+ backdrop.classList.add('backdrop');
14882
+ div.appendChild(backdrop);
14883
+ var style = doc.createElement('style');
14884
+
14885
+ if (props.cspNonce) {
14886
+ style.setAttribute('nonce', props.cspNonce);
14887
+ }
14888
+
14889
+ 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 "));
14890
+ div.appendChild(frame);
14891
+ div.appendChild(prerenderFrame);
14892
+ div.appendChild(style);
14893
+ prerenderFrame.classList.add(CLASS.VISIBLE);
14894
+ frame.classList.add(CLASS.INVISIBLE);
14895
+ setTimeout(function () {
14896
+ backdrop.classList.add(CLASS.VISIBLE);
14897
+ }, 1);
14898
+ event.on(zoid.EVENT.RENDERED, function () {
14899
+ prerenderFrame.classList.remove(CLASS.VISIBLE);
14900
+ prerenderFrame.classList.add(CLASS.INVISIBLE);
14901
+ frame.classList.remove(CLASS.INVISIBLE);
14902
+ frame.classList.add(CLASS.VISIBLE);
14903
+ setTimeout(function () {
14904
+ belter$3.destroyElement(prerenderFrame);
14905
+ }, 1);
14906
+ });
14907
+ event.on(EVENT$1.BEFORE_CLOSE, function () {
14908
+ backdrop.classList.remove(CLASS.VISIBLE);
14909
+ });
14910
+ event.on(zoid.EVENT.RESIZE, function (_ref2) {
14911
+ var newWidth = _ref2.width,
14912
+ newHeight = _ref2.height;
14913
+
14914
+ if (typeof newWidth === 'number') {
14915
+ div.style.width = belter$3.toCSS(newWidth);
14916
+ }
14917
+
14918
+ if (typeof newHeight === 'number') {
14919
+ div.style.height = belter$3.toCSS(newHeight);
14920
+ }
14921
+ });
14922
+ return div;
14923
+ }
14924
+
14793
14925
  // @ts-ignore
14794
14926
  var options$5 = {
14795
- tag: 'monei-google-pay',
14796
- url: config.googlePayUrl,
14927
+ tag: 'monei-cofidis',
14928
+ url: config.cofidisUrl,
14797
14929
  dimensions: {
14798
14930
  width: '100%',
14799
- height: '0'
14931
+ height: '100%'
14800
14932
  },
14801
14933
  autoResize: {
14802
14934
  width: false,
14803
- height: true
14935
+ height: false
14804
14936
  },
14805
- validate: validateComponentProps,
14806
- containerTemplate: containerTemplate,
14807
14937
  prerenderTemplate: function prerenderTemplate() {
14808
14938
  return undefined;
14809
14939
  },
14940
+ containerTemplate: containerTemplate$2,
14810
14941
  props: {
14811
- accountId: {
14942
+ paymentId: {
14812
14943
  type: zoid.PROP_TYPE.STRING,
14813
14944
  required: false
14814
14945
  },
14815
- sessionId: {
14946
+ amount: {
14947
+ type: zoid.PROP_TYPE.NUMBER,
14948
+ required: false
14949
+ },
14950
+ currency: {
14816
14951
  type: zoid.PROP_TYPE.STRING,
14817
14952
  required: false
14818
14953
  },
14819
- paymentId: {
14954
+ language: {
14820
14955
  type: zoid.PROP_TYPE.STRING,
14821
14956
  required: false
14822
14957
  },
14958
+ onError: {
14959
+ type: zoid.PROP_TYPE.FUNCTION,
14960
+ required: false
14961
+ },
14962
+ onLoad: {
14963
+ type: zoid.PROP_TYPE.FUNCTION,
14964
+ required: false
14965
+ },
14966
+ onSubmit: {
14967
+ type: zoid.PROP_TYPE.FUNCTION,
14968
+ required: false
14969
+ },
14970
+ onOpen: {
14971
+ type: zoid.PROP_TYPE.FUNCTION,
14972
+ required: false
14973
+ },
14974
+ onBeforeClose: {
14975
+ type: zoid.PROP_TYPE.FUNCTION,
14976
+ required: false,
14977
+ "default": function _default(_ref) {
14978
+ var event = _ref.event;
14979
+ return function () {
14980
+ event.trigger(EVENT$1.BEFORE_CLOSE);
14981
+ };
14982
+ }
14983
+ }
14984
+ }
14985
+ };
14986
+ var CofidisModal = /*#__PURE__*/zoid.create(options$5);
14987
+
14988
+ // @ts-ignore
14989
+ var options$6 = {
14990
+ tag: 'monei-cofidis-widget',
14991
+ url: config.cofidisWidgetUrl,
14992
+ dimensions: {
14993
+ width: '100%',
14994
+ height: '46px'
14995
+ },
14996
+ autoResize: {
14997
+ width: false,
14998
+ height: true
14999
+ },
15000
+ prerenderTemplate: function prerenderTemplate() {
15001
+ return undefined;
15002
+ },
15003
+ props: {
15004
+ accountId: {
15005
+ type: zoid.PROP_TYPE.STRING,
15006
+ required: true
15007
+ },
14823
15008
  amount: {
14824
15009
  type: zoid.PROP_TYPE.NUMBER,
14825
15010
  required: false
14826
15011
  },
14827
- currency: {
14828
- type: zoid.PROP_TYPE.STRING,
15012
+ amountInt: {
15013
+ type: zoid.PROP_TYPE.NUMBER,
14829
15014
  required: false
14830
15015
  },
14831
15016
  language: {
14832
15017
  type: zoid.PROP_TYPE.STRING,
15018
+ required: false,
15019
+ "default": function _default() {
15020
+ return 'es';
15021
+ }
15022
+ },
15023
+ showLogo: {
15024
+ type: zoid.PROP_TYPE.BOOLEAN,
15025
+ required: false
15026
+ },
15027
+ style: {
15028
+ type: zoid.PROP_TYPE.OBJECT,
15029
+ alias: 'innerStyle',
14833
15030
  required: false
14834
15031
  },
14835
15032
  onError: {
@@ -14840,11 +15037,60 @@ var options$5 = {
14840
15037
  type: zoid.PROP_TYPE.FUNCTION,
14841
15038
  required: false
14842
15039
  },
14843
- onSubmit: {
15040
+ __onClick: {
15041
+ type: zoid.PROP_TYPE.FUNCTION,
15042
+ required: false,
15043
+ value: function value() {
15044
+ return function (url) {
15045
+ window.open(url, '_blank');
15046
+ };
15047
+ }
15048
+ }
15049
+ }
15050
+ };
15051
+ var CofidisWidget = /*#__PURE__*/zoid.create(options$6);
15052
+
15053
+ var options$7 = {
15054
+ tag: 'monei-cofidis-button',
15055
+ url: config.cofidisButtonUrl,
15056
+ dimensions: {
15057
+ width: '100%',
15058
+ height: '45px'
15059
+ },
15060
+ autoResize: {
15061
+ width: false,
15062
+ height: true
15063
+ },
15064
+ validate: validateComponentProps,
15065
+ containerTemplate: containerTemplate,
15066
+ prerenderTemplate: function prerenderTemplate() {
15067
+ return undefined;
15068
+ },
15069
+ props: {
15070
+ paymentId: {
15071
+ type: zoid.PROP_TYPE.STRING,
15072
+ required: false
15073
+ },
15074
+ language: {
15075
+ type: zoid.PROP_TYPE.STRING,
15076
+ required: false
15077
+ },
15078
+ hint: {
15079
+ type: zoid.PROP_TYPE.BOOLEAN,
15080
+ "default": function _default() {
15081
+ return true;
15082
+ },
15083
+ required: false
15084
+ },
15085
+ onError: {
14844
15086
  type: zoid.PROP_TYPE.FUNCTION,
14845
15087
  required: false
14846
15088
  },
14847
- onBeforeSubmit: {
15089
+ onLoad: {
15090
+ type: zoid.PROP_TYPE.FUNCTION,
15091
+ required: false
15092
+ },
15093
+ onOpen: {
14848
15094
  type: zoid.PROP_TYPE.FUNCTION,
14849
15095
  required: false
14850
15096
  },
@@ -14860,25 +15106,450 @@ var options$5 = {
14860
15106
  var props = _ref.props;
14861
15107
  return getPaymentMethods.bind(null, props);
14862
15108
  }
15109
+ },
15110
+ __onHintClick: {
15111
+ type: zoid.PROP_TYPE.FUNCTION,
15112
+ required: false,
15113
+ value: function value() {
15114
+ return function (url) {
15115
+ window.open(url, '_blank');
15116
+ };
15117
+ }
15118
+ },
15119
+ __onClick: {
15120
+ type: zoid.PROP_TYPE.FUNCTION,
15121
+ required: false,
15122
+ value: function value(_ref2) {
15123
+ var props = _ref2.props;
15124
+ var rootNode = document.createElement('div');
15125
+ document.body.appendChild(rootNode);
15126
+ return function (_ref3) {
15127
+ var amount = _ref3.amount,
15128
+ currency = _ref3.currency,
15129
+ accountId = _ref3.accountId;
15130
+ var cofidisModal = new CofidisModal(_extends({}, props, {
15131
+ amount: amount,
15132
+ currency: currency,
15133
+ accountId: accountId,
15134
+ onClose: function onClose() {
15135
+ window.onpopstate = null;
15136
+ document.body.style.overflow = '';
15137
+ },
15138
+ isOpen: true
15139
+ }));
15140
+ window.history.pushState(null, '', window.location.href);
15141
+
15142
+ window.onpopstate = function () {
15143
+ return cofidisModal.updateProps({
15144
+ isOpen: false
15145
+ });
15146
+ };
15147
+
15148
+ Object.assign(document.body.style, {
15149
+ overflow: 'hidden'
15150
+ });
15151
+ return cofidisModal.render(rootNode);
15152
+ };
15153
+ }
14863
15154
  }
14864
15155
  }
14865
15156
  };
14866
- var GooglePay = /*#__PURE__*/zoid.create(options$5);
15157
+ var Cofidis = /*#__PURE__*/zoid.create(options$7);
14867
15158
 
14868
- var onApplePayButtonClicked = /*#__PURE__*/function () {
14869
- var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(props, request, context) {
14870
- var session;
14871
- return runtime_1.wrap(function _callee3$(_context3) {
14872
- while (1) {
14873
- switch (_context3.prev = _context3.next) {
14874
- case 0:
14875
- session = new window.ApplePaySession(3, request);
15159
+ var EVENT$2;
14876
15160
 
14877
- session.onvalidatemerchant = /*#__PURE__*/function () {
14878
- var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(event) {
14879
- var merchantSession;
14880
- return runtime_1.wrap(function _callee$(_context) {
14881
- while (1) {
15161
+ (function (EVENT) {
15162
+ EVENT["BEFORE_CLOSE"] = "BEFORE_CLOSE";
15163
+ })(EVENT$2 || (EVENT$2 = {}));
15164
+
15165
+ function containerTemplate$3(_ref) {
15166
+ var uid = _ref.uid,
15167
+ frame = _ref.frame,
15168
+ prerenderFrame = _ref.prerenderFrame,
15169
+ doc = _ref.doc,
15170
+ props = _ref.props,
15171
+ event = _ref.event,
15172
+ _ref$dimensions = _ref.dimensions,
15173
+ width = _ref$dimensions.width,
15174
+ height = _ref$dimensions.height;
15175
+
15176
+ if (!frame || !prerenderFrame) {
15177
+ return;
15178
+ }
15179
+
15180
+ var div = doc.createElement('div');
15181
+ var backdrop = doc.createElement('div');
15182
+ div.setAttribute('id', uid);
15183
+ backdrop.classList.add('backdrop');
15184
+ div.appendChild(backdrop);
15185
+ var style = doc.createElement('style');
15186
+
15187
+ if (props.cspNonce) {
15188
+ style.setAttribute('nonce', props.cspNonce);
15189
+ }
15190
+
15191
+ 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 "));
15192
+ div.appendChild(frame);
15193
+ div.appendChild(prerenderFrame);
15194
+ div.appendChild(style);
15195
+ prerenderFrame.classList.add(CLASS.VISIBLE);
15196
+ frame.classList.add(CLASS.INVISIBLE);
15197
+ setTimeout(function () {
15198
+ backdrop.classList.add(CLASS.VISIBLE);
15199
+ }, 1);
15200
+ event.on(zoid.EVENT.RENDERED, function () {
15201
+ prerenderFrame.classList.remove(CLASS.VISIBLE);
15202
+ prerenderFrame.classList.add(CLASS.INVISIBLE);
15203
+ frame.classList.remove(CLASS.INVISIBLE);
15204
+ frame.classList.add(CLASS.VISIBLE);
15205
+ setTimeout(function () {
15206
+ belter$3.destroyElement(prerenderFrame);
15207
+ }, 1);
15208
+ });
15209
+ event.on(EVENT$2.BEFORE_CLOSE, function () {
15210
+ backdrop.classList.remove(CLASS.VISIBLE);
15211
+ });
15212
+ event.on(zoid.EVENT.RESIZE, function (_ref2) {
15213
+ var newWidth = _ref2.width,
15214
+ newHeight = _ref2.height;
15215
+
15216
+ if (typeof newWidth === 'number') {
15217
+ div.style.width = belter$3.toCSS(newWidth);
15218
+ }
15219
+
15220
+ if (typeof newHeight === 'number') {
15221
+ div.style.height = belter$3.toCSS(newHeight);
15222
+ }
15223
+ });
15224
+ return div;
15225
+ }
15226
+
15227
+ // @ts-ignore
15228
+ var options$8 = {
15229
+ tag: 'monei-cofidis-loan',
15230
+ url: config.cofidisLoanUrl,
15231
+ dimensions: {
15232
+ width: '100%',
15233
+ height: '100%'
15234
+ },
15235
+ autoResize: {
15236
+ width: false,
15237
+ height: false
15238
+ },
15239
+ prerenderTemplate: function prerenderTemplate() {
15240
+ return undefined;
15241
+ },
15242
+ containerTemplate: containerTemplate$3,
15243
+ props: {
15244
+ paymentId: {
15245
+ type: zoid.PROP_TYPE.STRING,
15246
+ required: false
15247
+ },
15248
+ amount: {
15249
+ type: zoid.PROP_TYPE.NUMBER,
15250
+ required: false
15251
+ },
15252
+ currency: {
15253
+ type: zoid.PROP_TYPE.STRING,
15254
+ required: false
15255
+ },
15256
+ language: {
15257
+ type: zoid.PROP_TYPE.STRING,
15258
+ required: false
15259
+ },
15260
+ onError: {
15261
+ type: zoid.PROP_TYPE.FUNCTION,
15262
+ required: false
15263
+ },
15264
+ onLoad: {
15265
+ type: zoid.PROP_TYPE.FUNCTION,
15266
+ required: false
15267
+ },
15268
+ onSubmit: {
15269
+ type: zoid.PROP_TYPE.FUNCTION,
15270
+ required: false
15271
+ },
15272
+ onOpen: {
15273
+ type: zoid.PROP_TYPE.FUNCTION,
15274
+ required: false
15275
+ },
15276
+ onBeforeClose: {
15277
+ type: zoid.PROP_TYPE.FUNCTION,
15278
+ required: false,
15279
+ "default": function _default(_ref) {
15280
+ var event = _ref.event;
15281
+ return function () {
15282
+ event.trigger(EVENT$2.BEFORE_CLOSE);
15283
+ };
15284
+ }
15285
+ }
15286
+ }
15287
+ };
15288
+ var CofidisLoanModal = /*#__PURE__*/zoid.create(options$8);
15289
+ var CofidisPayModal = CofidisLoanModal;
15290
+
15291
+ // @ts-ignore
15292
+ var options$9 = {
15293
+ tag: 'monei-cofidis-loan-widget',
15294
+ url: config.cofidisLoanWidgetUrl,
15295
+ dimensions: {
15296
+ width: '100%',
15297
+ height: '46px'
15298
+ },
15299
+ autoResize: {
15300
+ width: false,
15301
+ height: true
15302
+ },
15303
+ prerenderTemplate: function prerenderTemplate() {
15304
+ return undefined;
15305
+ },
15306
+ props: {
15307
+ accountId: {
15308
+ type: zoid.PROP_TYPE.STRING,
15309
+ required: true
15310
+ },
15311
+ amount: {
15312
+ type: zoid.PROP_TYPE.NUMBER,
15313
+ required: false
15314
+ },
15315
+ amountInt: {
15316
+ type: zoid.PROP_TYPE.NUMBER,
15317
+ required: false
15318
+ },
15319
+ language: {
15320
+ type: zoid.PROP_TYPE.STRING,
15321
+ required: false,
15322
+ "default": function _default() {
15323
+ return 'es';
15324
+ }
15325
+ },
15326
+ showLogo: {
15327
+ type: zoid.PROP_TYPE.BOOLEAN,
15328
+ required: false
15329
+ },
15330
+ style: {
15331
+ type: zoid.PROP_TYPE.OBJECT,
15332
+ alias: 'innerStyle',
15333
+ required: false
15334
+ },
15335
+ onError: {
15336
+ type: zoid.PROP_TYPE.FUNCTION,
15337
+ required: false
15338
+ },
15339
+ onLoad: {
15340
+ type: zoid.PROP_TYPE.FUNCTION,
15341
+ required: false
15342
+ },
15343
+ __onClick: {
15344
+ type: zoid.PROP_TYPE.FUNCTION,
15345
+ required: false,
15346
+ value: function value() {
15347
+ return function (url) {
15348
+ window.open(url, '_blank');
15349
+ };
15350
+ }
15351
+ }
15352
+ }
15353
+ };
15354
+ var CofidisLoanWidget = /*#__PURE__*/zoid.create(options$9);
15355
+ var CofidisPayWidget = CofidisLoanWidget;
15356
+
15357
+ var options$a = {
15358
+ tag: 'monei-cofidis-loan-button',
15359
+ url: config.cofidisLoanButtonUrl,
15360
+ dimensions: {
15361
+ width: '100%',
15362
+ height: '45px'
15363
+ },
15364
+ autoResize: {
15365
+ width: false,
15366
+ height: true
15367
+ },
15368
+ validate: validateComponentProps,
15369
+ containerTemplate: containerTemplate,
15370
+ prerenderTemplate: function prerenderTemplate() {
15371
+ return undefined;
15372
+ },
15373
+ props: {
15374
+ paymentId: {
15375
+ type: zoid.PROP_TYPE.STRING,
15376
+ required: false
15377
+ },
15378
+ language: {
15379
+ type: zoid.PROP_TYPE.STRING,
15380
+ required: false
15381
+ },
15382
+ hint: {
15383
+ type: zoid.PROP_TYPE.BOOLEAN,
15384
+ "default": function _default() {
15385
+ return true;
15386
+ },
15387
+ required: false
15388
+ },
15389
+ onError: {
15390
+ type: zoid.PROP_TYPE.FUNCTION,
15391
+ required: false
15392
+ },
15393
+ onLoad: {
15394
+ type: zoid.PROP_TYPE.FUNCTION,
15395
+ required: false
15396
+ },
15397
+ onOpen: {
15398
+ type: zoid.PROP_TYPE.FUNCTION,
15399
+ required: false
15400
+ },
15401
+ style: {
15402
+ type: zoid.PROP_TYPE.OBJECT,
15403
+ alias: 'innerStyle',
15404
+ required: false
15405
+ },
15406
+ __getConfig: {
15407
+ type: zoid.PROP_TYPE.FUNCTION,
15408
+ required: false,
15409
+ value: function value(_ref) {
15410
+ var props = _ref.props;
15411
+ return getPaymentMethods.bind(null, props);
15412
+ }
15413
+ },
15414
+ __onHintClick: {
15415
+ type: zoid.PROP_TYPE.FUNCTION,
15416
+ required: false,
15417
+ value: function value() {
15418
+ return function (url) {
15419
+ window.open(url, '_blank');
15420
+ };
15421
+ }
15422
+ },
15423
+ __onClick: {
15424
+ type: zoid.PROP_TYPE.FUNCTION,
15425
+ required: false,
15426
+ value: function value(_ref2) {
15427
+ var props = _ref2.props;
15428
+ var rootNode = document.createElement('div');
15429
+ document.body.appendChild(rootNode);
15430
+ return function (_ref3) {
15431
+ var amount = _ref3.amount,
15432
+ currency = _ref3.currency,
15433
+ accountId = _ref3.accountId;
15434
+ var cofidisModal = new CofidisLoanModal(_extends({}, props, {
15435
+ amount: amount,
15436
+ currency: currency,
15437
+ accountId: accountId,
15438
+ onClose: function onClose() {
15439
+ window.onpopstate = null;
15440
+ document.body.style.overflow = '';
15441
+ },
15442
+ isOpen: true
15443
+ }));
15444
+ window.history.pushState(null, '', window.location.href);
15445
+
15446
+ window.onpopstate = function () {
15447
+ return cofidisModal.updateProps({
15448
+ isOpen: false
15449
+ });
15450
+ };
15451
+
15452
+ Object.assign(document.body.style, {
15453
+ overflow: 'hidden'
15454
+ });
15455
+ return cofidisModal.render(rootNode);
15456
+ };
15457
+ }
15458
+ }
15459
+ }
15460
+ };
15461
+ var CofidisLoan = /*#__PURE__*/zoid.create(options$a);
15462
+ var CofidisPay = CofidisLoan;
15463
+
15464
+ // @ts-ignore
15465
+ var options$b = {
15466
+ tag: 'monei-google-pay',
15467
+ url: config.googlePayUrl,
15468
+ dimensions: {
15469
+ width: '100%',
15470
+ height: '0'
15471
+ },
15472
+ autoResize: {
15473
+ width: false,
15474
+ height: true
15475
+ },
15476
+ validate: validateComponentProps,
15477
+ containerTemplate: containerTemplate,
15478
+ prerenderTemplate: function prerenderTemplate() {
15479
+ return undefined;
15480
+ },
15481
+ props: {
15482
+ accountId: {
15483
+ type: zoid.PROP_TYPE.STRING,
15484
+ required: false
15485
+ },
15486
+ sessionId: {
15487
+ type: zoid.PROP_TYPE.STRING,
15488
+ required: false
15489
+ },
15490
+ paymentId: {
15491
+ type: zoid.PROP_TYPE.STRING,
15492
+ required: false
15493
+ },
15494
+ amount: {
15495
+ type: zoid.PROP_TYPE.NUMBER,
15496
+ required: false
15497
+ },
15498
+ currency: {
15499
+ type: zoid.PROP_TYPE.STRING,
15500
+ required: false
15501
+ },
15502
+ language: {
15503
+ type: zoid.PROP_TYPE.STRING,
15504
+ required: false
15505
+ },
15506
+ onError: {
15507
+ type: zoid.PROP_TYPE.FUNCTION,
15508
+ required: false
15509
+ },
15510
+ onLoad: {
15511
+ type: zoid.PROP_TYPE.FUNCTION,
15512
+ required: false
15513
+ },
15514
+ onSubmit: {
15515
+ type: zoid.PROP_TYPE.FUNCTION,
15516
+ required: false
15517
+ },
15518
+ onBeforeSubmit: {
15519
+ type: zoid.PROP_TYPE.FUNCTION,
15520
+ required: false
15521
+ },
15522
+ style: {
15523
+ type: zoid.PROP_TYPE.OBJECT,
15524
+ alias: 'innerStyle',
15525
+ required: false
15526
+ },
15527
+ __getConfig: {
15528
+ type: zoid.PROP_TYPE.FUNCTION,
15529
+ required: false,
15530
+ value: function value(_ref) {
15531
+ var props = _ref.props;
15532
+ return getPaymentMethods.bind(null, props);
15533
+ }
15534
+ }
15535
+ }
15536
+ };
15537
+ var GooglePay = /*#__PURE__*/zoid.create(options$b);
15538
+
15539
+ var onApplePayButtonClicked = /*#__PURE__*/function () {
15540
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(props, request, context) {
15541
+ var session;
15542
+ return runtime_1.wrap(function _callee3$(_context3) {
15543
+ while (1) {
15544
+ switch (_context3.prev = _context3.next) {
15545
+ case 0:
15546
+ session = new window.ApplePaySession(3, request);
15547
+
15548
+ session.onvalidatemerchant = /*#__PURE__*/function () {
15549
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(event) {
15550
+ var merchantSession;
15551
+ return runtime_1.wrap(function _callee$(_context) {
15552
+ while (1) {
14882
15553
  switch (_context.prev = _context.next) {
14883
15554
  case 0:
14884
15555
  _context.prev = 0;
@@ -14981,7 +15652,7 @@ var onApplePayButtonClicked = /*#__PURE__*/function () {
14981
15652
  };
14982
15653
  }();
14983
15654
 
14984
- var options$6 = {
15655
+ var options$c = {
14985
15656
  tag: 'monei-payment-request',
14986
15657
  url: config.paymentRequestUrl,
14987
15658
  dimensions: {
@@ -15074,7 +15745,7 @@ var options$6 = {
15074
15745
  }
15075
15746
  }
15076
15747
  };
15077
- var PaymentRequest = /*#__PURE__*/zoid.create(options$6);
15748
+ var PaymentRequest = /*#__PURE__*/zoid.create(options$c);
15078
15749
 
15079
15750
  var NextActionType;
15080
15751
 
@@ -15088,5 +15759,5 @@ var NextActionType;
15088
15759
  var api = _api;
15089
15760
  var utils = _utils;
15090
15761
 
15091
- export { Bizum, BizumModal, CardInput, GooglePay, NextActionType, PayPal, PaymentModal, PaymentRequest, api, config, confirmPayment$1 as confirmPayment, createToken$1 as createToken, utils };
15762
+ export { Bizum, BizumModal, CardInput, Cofidis, CofidisLoan, CofidisLoanModal, CofidisLoanWidget, CofidisModal, CofidisPay, CofidisPayModal, CofidisPayWidget, CofidisWidget, GooglePay, NextActionType, PayPal, PaymentModal, PaymentRequest, api, config, confirmPayment$1 as confirmPayment, createToken$1 as createToken, utils };
15092
15763
  //# sourceMappingURL=components.esm.js.map