@monei-js/components 1.7.6 → 1.7.8

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.
@@ -826,7 +826,7 @@ var loadScript = function loadScript(src, nonce, dataset, forceReload) {
826
826
  if (forceReload) {
827
827
  existingScript.remove();
828
828
  } else {
829
- resolve();
829
+ resolve(existingScript);
830
830
  return;
831
831
  }
832
832
  }
@@ -835,7 +835,7 @@ var loadScript = function loadScript(src, nonce, dataset, forceReload) {
835
835
  script.src = src;
836
836
 
837
837
  script.onload = function () {
838
- return resolve();
838
+ return resolve(script);
839
839
  };
840
840
 
841
841
  script.onerror = function (error) {
@@ -914,8 +914,34 @@ var getLanguage = function getLanguage() {
914
914
  return '';
915
915
  };
916
916
 
917
+ var safe = function safe(fn) {
918
+ try {
919
+ var _fn;
920
+
921
+ return String((_fn = fn()) != null ? _fn : '');
922
+ } catch (_unused) {
923
+ return '';
924
+ }
925
+ };
926
+
917
927
  var getClientEnv = function getClientEnv() {
918
- var env = [window.screen.colorDepth, window.screen.height, window.screen.width, new Date().getTimezoneOffset(), getLanguage()].join('|');
928
+ var env = [window.screen.colorDepth, window.screen.height, window.screen.width, new Date().getTimezoneOffset(), getLanguage(), safe(function () {
929
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
930
+ }), safe(function () {
931
+ return window.devicePixelRatio;
932
+ }), safe(function () {
933
+ return navigator.hardwareConcurrency;
934
+ }), safe(function () {
935
+ return navigator.deviceMemory;
936
+ }), safe(function () {
937
+ return navigator.maxTouchPoints;
938
+ }), safe(function () {
939
+ return navigator.platform;
940
+ }), safe(function () {
941
+ var _navigator$languages;
942
+
943
+ return (_navigator$languages = navigator.languages) == null ? void 0 : _navigator$languages.join(',');
944
+ })].join('|');
919
945
  return window.btoa(env);
920
946
  };
921
947
  var withError = /*#__PURE__*/function () {
@@ -1016,14 +1042,14 @@ var stageConfig = {
1016
1042
  cofidisLoanUrl: "http://localhost:3013/" + version + "/inner-cofidis-loan/",
1017
1043
  cofidisLoanButtonUrl: "http://localhost:3014/" + version + "/inner-cofidis-loan-button/",
1018
1044
  cofidisLoanWidgetUrl: "http://localhost:3015/" + version + "/inner-cofidis-loan-widget/",
1019
- apiUrl: 'https://api.monei.com/v1',
1020
- secureDomain: 'https://secure.monei.com',
1021
- rootDomain: 'monei.com'
1045
+ apiUrl: 'https://api.monei-dev.com/v1',
1046
+ secureDomain: 'https://secure.monei-dev.com',
1047
+ rootDomain: 'monei-dev.com'
1022
1048
  },
1023
1049
  dev: {
1024
- apiUrl: 'https://api.microapps-staging.com/v1',
1025
- secureDomain: 'https://secure.microapps-staging.com',
1026
- rootDomain: 'microapps-staging.com'
1050
+ apiUrl: 'https://api.monei-dev.com/v1',
1051
+ secureDomain: 'https://secure.monei-dev.com',
1052
+ rootDomain: 'monei-dev.com'
1027
1053
  },
1028
1054
  prod: {
1029
1055
  apiUrl: 'https://api.monei.com/v1',
@@ -1149,12 +1175,12 @@ var getPaymentMethods = /*#__PURE__*/function () {
1149
1175
  }();
1150
1176
  var createToken = /*#__PURE__*/function () {
1151
1177
  var _ref6 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(_ref5) {
1152
- var paymentMethod, paymentId, sessionId, amount, currency, accountId, body;
1178
+ var paymentMethod, paymentId, sessionId, amount, currency, accountId, transactionType, body;
1153
1179
  return runtime_1.wrap(function _callee3$(_context3) {
1154
1180
  while (1) {
1155
1181
  switch (_context3.prev = _context3.next) {
1156
1182
  case 0:
1157
- paymentMethod = _ref5.paymentMethod, paymentId = _ref5.paymentId, sessionId = _ref5.sessionId, amount = _ref5.amount, currency = _ref5.currency, accountId = _ref5.accountId;
1183
+ paymentMethod = _ref5.paymentMethod, paymentId = _ref5.paymentId, sessionId = _ref5.sessionId, amount = _ref5.amount, currency = _ref5.currency, accountId = _ref5.accountId, transactionType = _ref5.transactionType;
1158
1184
 
1159
1185
  if (!paymentId) {
1160
1186
  _context3.next = 5;
@@ -1179,7 +1205,8 @@ var createToken = /*#__PURE__*/function () {
1179
1205
  paymentMethod: paymentMethod,
1180
1206
  sessionId: sessionId,
1181
1207
  amount: amount,
1182
- currency: currency
1208
+ currency: currency,
1209
+ transactionType: transactionType
1183
1210
  };
1184
1211
  _context3.next = 10;
1185
1212
  break;
@@ -15161,7 +15188,7 @@ var namespace = 'monei-paypal';
15161
15188
 
15162
15189
  var onLoadPaypal = /*#__PURE__*/function () {
15163
15190
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(props, state, src) {
15164
- var defaultStyle, token;
15191
+ var script, defaultStyle, style, token;
15165
15192
  return runtime_1.wrap(function _callee2$(_context2) {
15166
15193
  while (1) {
15167
15194
  switch (_context2.prev = _context2.next) {
@@ -15173,12 +15200,20 @@ var onLoadPaypal = /*#__PURE__*/function () {
15173
15200
  }, true);
15174
15201
 
15175
15202
  case 2:
15203
+ script = _context2.sent;
15204
+ state.__scriptId = script.dataset.uidAuto;
15176
15205
  defaultStyle = {
15177
15206
  layout: 'horizontal',
15178
15207
  tagline: false
15179
15208
  };
15209
+ style = _extends({}, defaultStyle, props.style);
15210
+
15211
+ if (typeof style.height === 'string') {
15212
+ style.height = parseInt(style.height.replace('px', ''));
15213
+ }
15214
+
15180
15215
  props.onLoad == null ? void 0 : props.onLoad(true);
15181
- _context2.next = 6;
15216
+ _context2.next = 10;
15182
15217
  return window[namespace].Buttons({
15183
15218
  createOrder: function () {
15184
15219
  var _createOrder = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
@@ -15196,6 +15231,7 @@ var onLoadPaypal = /*#__PURE__*/function () {
15196
15231
  sessionId: props.sessionId,
15197
15232
  amount: props.amount,
15198
15233
  currency: props.currency,
15234
+ transactionType: props.transactionType,
15199
15235
  paymentMethod: {
15200
15236
  paypal: {}
15201
15237
  }
@@ -15244,10 +15280,10 @@ var onLoadPaypal = /*#__PURE__*/function () {
15244
15280
 
15245
15281
  if (!shouldOpen) return actions.reject();
15246
15282
  },
15247
- style: _extends({}, defaultStyle, props.style)
15283
+ style: style
15248
15284
  }).render(state.__container);
15249
15285
 
15250
- case 6:
15286
+ case 10:
15251
15287
  case "end":
15252
15288
  return _context2.stop();
15253
15289
  }
@@ -15287,6 +15323,15 @@ var options$2 = {
15287
15323
  window[namespace].Buttons.instances.forEach(function (instance) {
15288
15324
  instance.close();
15289
15325
  });
15326
+ var scriptId = params.state.__scriptId;
15327
+
15328
+ if (scriptId) {
15329
+ var script = document.querySelector("script[data-uid-auto=\"" + scriptId + "\"]");
15330
+
15331
+ if (script) {
15332
+ script.remove();
15333
+ }
15334
+ }
15290
15335
  });
15291
15336
  return container;
15292
15337
  },
@@ -15538,7 +15583,7 @@ var options$4 = {
15538
15583
  url: config.bizumButtonUrl,
15539
15584
  dimensions: {
15540
15585
  width: '100%',
15541
- height: '45px'
15586
+ height: 'auto'
15542
15587
  },
15543
15588
  autoResize: {
15544
15589
  width: false,
@@ -16490,7 +16535,7 @@ var options$c = {
16490
16535
  url: config.paymentRequestUrl,
16491
16536
  dimensions: {
16492
16537
  width: '100%',
16493
- height: '0'
16538
+ height: 'auto'
16494
16539
  },
16495
16540
  autoResize: {
16496
16541
  width: false,