@monei-js/components 1.7.7 → 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.
package/dist/api.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { CalculateFinancingRequest, CalculateFinancingResponse, CreateApplePaySessionRequest, CreatePaymentRequest, CreateTokenRequest, CreateTokenResponse, GetPaymentMethodsRequest, GetPaymentMethodsResponse, PaymentResult, SendPaymentReceiptRequest, ValidateBizumPhoneRequest } from './types';
2
1
  import { ConfirmPaymentParams } from './paymentModal';
2
+ import { CalculateFinancingRequest, CalculateFinancingResponse, CreateApplePaySessionRequest, CreatePaymentRequest, CreateTokenRequest, CreateTokenResponse, GetPaymentMethodsRequest, GetPaymentMethodsResponse, PaymentResult, SendPaymentReceiptRequest, ValidateBizumPhoneRequest } from './types';
3
3
  export declare const getPaymentMethods: ({ accountId, paymentId }: GetPaymentMethodsRequest) => Promise<GetPaymentMethodsResponse>;
4
- export declare const createToken: ({ paymentMethod, paymentId, sessionId, amount, currency, accountId }: CreateTokenRequest) => Promise<CreateTokenResponse>;
4
+ export declare const createToken: ({ paymentMethod, paymentId, sessionId, amount, currency, accountId, transactionType }: CreateTokenRequest) => Promise<CreateTokenResponse>;
5
5
  export declare const getPayment: (paymentId: string) => Promise<PaymentResult>;
6
6
  export declare const confirmPayment: ({ paymentId, ...body }: ConfirmPaymentParams) => Promise<PaymentResult>;
7
7
  export declare const createPayment: ({ signature, ...body }: CreatePaymentRequest) => Promise<PaymentResult>;
@@ -19,7 +19,7 @@ export interface BizumProps {
19
19
  onBeforeOpen?: () => boolean;
20
20
  onOpen?: () => void;
21
21
  style?: {
22
- height?: number;
22
+ height?: string | number;
23
23
  type?: 'pay' | 'plain';
24
24
  };
25
25
  }
@@ -918,8 +918,34 @@ var getLanguage = function getLanguage() {
918
918
  return '';
919
919
  };
920
920
 
921
+ var safe = function safe(fn) {
922
+ try {
923
+ var _fn;
924
+
925
+ return String((_fn = fn()) != null ? _fn : '');
926
+ } catch (_unused) {
927
+ return '';
928
+ }
929
+ };
930
+
921
931
  var getClientEnv = function getClientEnv() {
922
- var env = [window.screen.colorDepth, window.screen.height, window.screen.width, new Date().getTimezoneOffset(), getLanguage()].join('|');
932
+ var env = [window.screen.colorDepth, window.screen.height, window.screen.width, new Date().getTimezoneOffset(), getLanguage(), safe(function () {
933
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
934
+ }), safe(function () {
935
+ return window.devicePixelRatio;
936
+ }), safe(function () {
937
+ return navigator.hardwareConcurrency;
938
+ }), safe(function () {
939
+ return navigator.deviceMemory;
940
+ }), safe(function () {
941
+ return navigator.maxTouchPoints;
942
+ }), safe(function () {
943
+ return navigator.platform;
944
+ }), safe(function () {
945
+ var _navigator$languages;
946
+
947
+ return (_navigator$languages = navigator.languages) == null ? void 0 : _navigator$languages.join(',');
948
+ })].join('|');
923
949
  return window.btoa(env);
924
950
  };
925
951
  var withError = /*#__PURE__*/function () {
@@ -1020,14 +1046,14 @@ var stageConfig = {
1020
1046
  cofidisLoanUrl: "http://localhost:3013/" + version + "/inner-cofidis-loan/",
1021
1047
  cofidisLoanButtonUrl: "http://localhost:3014/" + version + "/inner-cofidis-loan-button/",
1022
1048
  cofidisLoanWidgetUrl: "http://localhost:3015/" + version + "/inner-cofidis-loan-widget/",
1023
- apiUrl: 'https://api.monei.com/v1',
1024
- secureDomain: 'https://secure.monei.com',
1025
- rootDomain: 'monei.com'
1049
+ apiUrl: 'https://api.monei-dev.com/v1',
1050
+ secureDomain: 'https://secure.monei-dev.com',
1051
+ rootDomain: 'monei-dev.com'
1026
1052
  },
1027
1053
  dev: {
1028
- apiUrl: 'https://api.microapps-staging.com/v1',
1029
- secureDomain: 'https://secure.microapps-staging.com',
1030
- rootDomain: 'microapps-staging.com'
1054
+ apiUrl: 'https://api.monei-dev.com/v1',
1055
+ secureDomain: 'https://secure.monei-dev.com',
1056
+ rootDomain: 'monei-dev.com'
1031
1057
  },
1032
1058
  prod: {
1033
1059
  apiUrl: 'https://api.monei.com/v1',
@@ -1153,12 +1179,12 @@ var getPaymentMethods = /*#__PURE__*/function () {
1153
1179
  }();
1154
1180
  var createToken = /*#__PURE__*/function () {
1155
1181
  var _ref6 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(_ref5) {
1156
- var paymentMethod, paymentId, sessionId, amount, currency, accountId, body;
1182
+ var paymentMethod, paymentId, sessionId, amount, currency, accountId, transactionType, body;
1157
1183
  return runtime_1.wrap(function _callee3$(_context3) {
1158
1184
  while (1) {
1159
1185
  switch (_context3.prev = _context3.next) {
1160
1186
  case 0:
1161
- paymentMethod = _ref5.paymentMethod, paymentId = _ref5.paymentId, sessionId = _ref5.sessionId, amount = _ref5.amount, currency = _ref5.currency, accountId = _ref5.accountId;
1187
+ paymentMethod = _ref5.paymentMethod, paymentId = _ref5.paymentId, sessionId = _ref5.sessionId, amount = _ref5.amount, currency = _ref5.currency, accountId = _ref5.accountId, transactionType = _ref5.transactionType;
1162
1188
 
1163
1189
  if (!paymentId) {
1164
1190
  _context3.next = 5;
@@ -1183,7 +1209,8 @@ var createToken = /*#__PURE__*/function () {
1183
1209
  paymentMethod: paymentMethod,
1184
1210
  sessionId: sessionId,
1185
1211
  amount: amount,
1186
- currency: currency
1212
+ currency: currency,
1213
+ transactionType: transactionType
1187
1214
  };
1188
1215
  _context3.next = 10;
1189
1216
  break;
@@ -15165,7 +15192,7 @@ var namespace = 'monei-paypal';
15165
15192
 
15166
15193
  var onLoadPaypal = /*#__PURE__*/function () {
15167
15194
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(props, state, src) {
15168
- var script, defaultStyle, token;
15195
+ var script, defaultStyle, style, token;
15169
15196
  return runtime_1.wrap(function _callee2$(_context2) {
15170
15197
  while (1) {
15171
15198
  switch (_context2.prev = _context2.next) {
@@ -15183,8 +15210,14 @@ var onLoadPaypal = /*#__PURE__*/function () {
15183
15210
  layout: 'horizontal',
15184
15211
  tagline: false
15185
15212
  };
15213
+ style = _extends({}, defaultStyle, props.style);
15214
+
15215
+ if (typeof style.height === 'string') {
15216
+ style.height = parseInt(style.height.replace('px', ''));
15217
+ }
15218
+
15186
15219
  props.onLoad == null ? void 0 : props.onLoad(true);
15187
- _context2.next = 8;
15220
+ _context2.next = 10;
15188
15221
  return window[namespace].Buttons({
15189
15222
  createOrder: function () {
15190
15223
  var _createOrder = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
@@ -15202,6 +15235,7 @@ var onLoadPaypal = /*#__PURE__*/function () {
15202
15235
  sessionId: props.sessionId,
15203
15236
  amount: props.amount,
15204
15237
  currency: props.currency,
15238
+ transactionType: props.transactionType,
15205
15239
  paymentMethod: {
15206
15240
  paypal: {}
15207
15241
  }
@@ -15250,10 +15284,10 @@ var onLoadPaypal = /*#__PURE__*/function () {
15250
15284
 
15251
15285
  if (!shouldOpen) return actions.reject();
15252
15286
  },
15253
- style: _extends({}, defaultStyle, props.style)
15287
+ style: style
15254
15288
  }).render(state.__container);
15255
15289
 
15256
- case 8:
15290
+ case 10:
15257
15291
  case "end":
15258
15292
  return _context2.stop();
15259
15293
  }
@@ -15281,9 +15315,6 @@ var options$2 = {
15281
15315
  return undefined;
15282
15316
  },
15283
15317
  containerTemplate: function containerTemplate$1(params) {
15284
- console.log({
15285
- params: params
15286
- });
15287
15318
  params.state.__container = params.container;
15288
15319
 
15289
15320
  if (!params.props.accountId && !params.props.paymentId) {
@@ -15293,7 +15324,6 @@ var options$2 = {
15293
15324
  var container = containerTemplate(params);
15294
15325
 
15295
15326
  params.event.on(zoid.EVENT.DESTROY, function () {
15296
- console.log('destroy');
15297
15327
  window[namespace].Buttons.instances.forEach(function (instance) {
15298
15328
  instance.close();
15299
15329
  });
@@ -15557,7 +15587,7 @@ var options$4 = {
15557
15587
  url: config.bizumButtonUrl,
15558
15588
  dimensions: {
15559
15589
  width: '100%',
15560
- height: '45px'
15590
+ height: 'auto'
15561
15591
  },
15562
15592
  autoResize: {
15563
15593
  width: false,
@@ -16509,7 +16539,7 @@ var options$c = {
16509
16539
  url: config.paymentRequestUrl,
16510
16540
  dimensions: {
16511
16541
  width: '100%',
16512
- height: '0'
16542
+ height: 'auto'
16513
16543
  },
16514
16544
  autoResize: {
16515
16545
  width: false,