@tap-payments/connect 2.5.2-test → 2.5.3-test

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.
@@ -1,2 +1,4 @@
1
+ import { GetResult } from '@fingerprintjs/fingerprintjs';
1
2
  import { TokenParams } from '../@types';
3
+ export declare const getFingerPrint: () => Promise<GetResult>;
2
4
  export declare const generateConfigToken: (data: TokenParams) => Promise<any>;
@@ -35,27 +35,51 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  }
36
36
  };
37
37
  import axios from 'axios';
38
+ import FingerprintJS from '@fingerprintjs/fingerprintjs';
38
39
  import { CONNECT_MW_URL } from '../constants';
40
+ export var getFingerPrint = function () {
41
+ return FingerprintJS.load().then(function (fp) {
42
+ return fp.get().then(function (result) {
43
+ return result;
44
+ });
45
+ });
46
+ };
39
47
  export var generateConfigToken = function (data) { return __awaiter(void 0, void 0, void 0, function () {
40
- var response, error_1;
48
+ var visitorId, response, error_1;
41
49
  return __generator(this, function (_a) {
42
50
  switch (_a.label) {
43
51
  case 0:
44
- _a.trys.push([0, 2, , 3]);
52
+ _a.trys.push([0, 4, , 5]);
53
+ return [4, getFingerPrint()];
54
+ case 1:
55
+ visitorId = (_a.sent()).visitorId;
56
+ return [4, axios.post("".concat(CONNECT_MW_URL, "init"), data, {
57
+ headers: {
58
+ 'Content-Type': 'application/json',
59
+ 'Access-Control-Allow-Headers': true,
60
+ authorization: data.public_key,
61
+ bi: visitorId || '',
62
+ mdn: window.location.origin
63
+ }
64
+ })];
65
+ case 2:
66
+ _a.sent();
45
67
  return [4, axios.post("".concat(CONNECT_MW_URL, "connect"), data, {
46
68
  headers: {
47
69
  'Content-Type': 'application/json',
48
70
  'Access-Control-Allow-Headers': true,
49
- authorization: data.public_key
71
+ authorization: data.public_key,
72
+ bi: visitorId || '',
73
+ mdn: window.location.origin
50
74
  }
51
75
  })];
52
- case 1:
76
+ case 3:
53
77
  response = _a.sent();
54
78
  return [2, response.data];
55
- case 2:
79
+ case 4:
56
80
  error_1 = _a.sent();
57
81
  return [2, { error: error_1 }];
58
- case 3: return [2];
82
+ case 5: return [2];
59
83
  }
60
84
  });
61
85
  }); };
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { ConnectProps as ConnectAttrs } from '../../@types';
3
3
  export type ConnectProps = Omit<ConnectAttrs, 'elementId'>;
4
- export declare const TapConnect: React.MemoExoticComponent<(props: ConnectAttrs) => JSX.Element>;
4
+ export declare const TapConnect: React.MemoExoticComponent<(props: ConnectAttrs) => import("react/jsx-runtime").JSX.Element>;
5
5
  export declare const renderTapConnect: (props: ConnectProps, elementId: string) => Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/connect",
3
- "version": "2.5.2-test",
3
+ "version": "2.5.3-test",
4
4
  "description": "Tap Connect",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.js",
@@ -72,6 +72,7 @@
72
72
  "webpack-merge": "^5.8.0"
73
73
  },
74
74
  "dependencies": {
75
+ "@fingerprintjs/fingerprintjs": "^3.4.1",
75
76
  "axios": "^1.4.0",
76
77
  "react": "^18.2.0",
77
78
  "react-dom": "^18.2.0"