@fat-zebra/sdk 1.0.1 → 1.0.3

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.
Files changed (75) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +2 -5
  3. package/dist/react/VerifyCard.js +11 -17
  4. package/dist/react/index.js +2 -8
  5. package/dist/react/url.js +10 -14
  6. package/dist/react/useFatZebra.js +23 -63
  7. package/dist/sca/cardinal.d.ts +2 -1
  8. package/dist/sca/cardinal.js +22 -61
  9. package/dist/sca/eci-mappings.js +4 -8
  10. package/dist/sca/index.js +182 -296
  11. package/dist/sca/scenarios/enrollment.d.ts +2 -1
  12. package/dist/sca/scenarios/enrollment.js +25 -28
  13. package/dist/sca/scenarios/index.d.ts +4 -2
  14. package/dist/sca/scenarios/index.js +2 -7
  15. package/dist/sca/scenarios/validation.d.ts +2 -1
  16. package/dist/sca/scenarios/validation.js +16 -19
  17. package/dist/sca/types.d.ts +2 -1
  18. package/dist/sca/types.js +6 -8
  19. package/dist/shared/api-gateway-client.js +37 -81
  20. package/dist/shared/bridge-client.js +5 -8
  21. package/dist/shared/constants.js +6 -13
  22. package/dist/shared/event-manager.d.ts +2 -1
  23. package/dist/shared/event-manager.js +3 -9
  24. package/dist/shared/post-message-client.d.ts +2 -1
  25. package/dist/shared/post-message-client.js +38 -75
  26. package/dist/shared/types.d.ts +2 -1
  27. package/dist/shared/types.js +5 -7
  28. package/dist/shared/util.js +18 -31
  29. package/fat-zebra-sdk-1.0.2.tgz +0 -0
  30. package/package.json +2 -2
  31. package/tsconfig.json +6 -4
  32. package/dist/index.js.map +0 -1
  33. package/dist/react/VerifyCard.js.map +0 -1
  34. package/dist/react/index.js.map +0 -1
  35. package/dist/react/url.js.map +0 -1
  36. package/dist/react/useFatZebra.js.map +0 -1
  37. package/dist/sca/cardinal.js.map +0 -1
  38. package/dist/sca/eci-mappings.js.map +0 -1
  39. package/dist/sca/index.js.map +0 -1
  40. package/dist/sca/scenarios/enrollment.js.map +0 -1
  41. package/dist/sca/scenarios/index.js.map +0 -1
  42. package/dist/sca/scenarios/validation.js.map +0 -1
  43. package/dist/sca/types.js.map +0 -1
  44. package/dist/shared/api-gateway-client.js.map +0 -1
  45. package/dist/shared/bridge-client.js.map +0 -1
  46. package/dist/shared/constants.js.map +0 -1
  47. package/dist/shared/event-manager.js.map +0 -1
  48. package/dist/shared/post-message-client.js.map +0 -1
  49. package/dist/shared/types.js.map +0 -1
  50. package/dist/shared/util.js.map +0 -1
  51. package/src/index.ts +0 -9
  52. package/src/react/VerifyCard.tsx +0 -36
  53. package/src/react/index.ts +0 -3
  54. package/src/react/url.ts +0 -97
  55. package/src/react/useFatZebra.ts +0 -154
  56. package/src/sca/__tests__/eci-mappings.test.ts +0 -35
  57. package/src/sca/__tests__/index.test.ts +0 -514
  58. package/src/sca/cardinal.ts +0 -136
  59. package/src/sca/eci-mappings.ts +0 -63
  60. package/src/sca/index.ts +0 -329
  61. package/src/sca/scenarios/enrollment.ts +0 -164
  62. package/src/sca/scenarios/index.ts +0 -2
  63. package/src/sca/scenarios/validation.ts +0 -142
  64. package/src/sca/types.ts +0 -206
  65. package/src/shared/api-gateway-client.ts +0 -71
  66. package/src/shared/bridge-client.ts +0 -26
  67. package/src/shared/constants.ts +0 -19
  68. package/src/shared/event-manager.ts +0 -44
  69. package/src/shared/post-message-client.test.ts +0 -73
  70. package/src/shared/post-message-client.ts +0 -125
  71. package/src/shared/types.test.ts +0 -65
  72. package/src/shared/types.ts +0 -182
  73. package/src/shared/util.test.ts +0 -164
  74. package/src/shared/util.ts +0 -98
  75. package/tests/helpers/api-gateway-mock.ts +0 -46
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.enrollmentScenarios = void 0;
4
- var types_1 = require("../types");
5
- var enrollmentScenarios = [
1
+ import { ScaErrorCode, VEResEnrolled, PARes } from '../types';
2
+ const enrollmentScenarios = [
6
3
  /***************************************************************/
7
4
  /********************** 3DS2 scenarios *************************/
8
5
  /***************************************************************/
@@ -11,24 +8,24 @@ var enrollmentScenarios = [
11
8
  description: 'Bypassed Authentication',
12
9
  threedsVersion: '2',
13
10
  reasonCode: '100',
14
- veresEnrolled: types_1.VEResEnrolled.BYPASSED,
11
+ veresEnrolled: VEResEnrolled.BYPASSED,
15
12
  pares: null,
16
13
  outcome: {
17
14
  success: false,
18
15
  authenticationType: 'bypass',
19
- errorCode: types_1.ScaErrorCode.BYPASSED_AUTHENTICATION
16
+ errorCode: ScaErrorCode.BYPASSED_AUTHENTICATION
20
17
  },
21
18
  },
22
19
  {
23
- // Authentication not Available on Lookup
20
+ // Authentication not Available on Lookup
24
21
  description: 'Authentication not Available on Lookup ',
25
22
  threedsVersion: '2',
26
23
  reasonCode: '100',
27
- veresEnrolled: types_1.VEResEnrolled.UNABLE,
24
+ veresEnrolled: VEResEnrolled.UNABLE,
28
25
  pares: null,
29
26
  outcome: {
30
27
  success: false,
31
- errorCode: types_1.ScaErrorCode.AUTHENTICATION_NOT_AVAILABLE_ON_LOOKUP
28
+ errorCode: ScaErrorCode.AUTHENTICATION_NOT_AVAILABLE_ON_LOOKUP
32
29
  }
33
30
  },
34
31
  {
@@ -36,8 +33,8 @@ var enrollmentScenarios = [
36
33
  description: 'Attempts Processing Frictionless Authentication',
37
34
  threedsVersion: '2',
38
35
  reasonCode: '100',
39
- veresEnrolled: types_1.VEResEnrolled.ENROLLED,
40
- pares: types_1.PARes.ATTEMPTED,
36
+ veresEnrolled: VEResEnrolled.ENROLLED,
37
+ pares: PARes.ATTEMPTED,
41
38
  outcome: {
42
39
  authenticationType: 'frictionless',
43
40
  success: true
@@ -48,8 +45,8 @@ var enrollmentScenarios = [
48
45
  description: 'Successful Frictionless Authentication',
49
46
  threedsVersion: '2',
50
47
  reasonCode: '100',
51
- veresEnrolled: types_1.VEResEnrolled.ENROLLED,
52
- pares: types_1.PARes.SUCCESS,
48
+ veresEnrolled: VEResEnrolled.ENROLLED,
49
+ pares: PARes.SUCCESS,
53
50
  outcome: {
54
51
  authenticationType: 'frictionless',
55
52
  success: true
@@ -60,12 +57,12 @@ var enrollmentScenarios = [
60
57
  description: 'Unavailable Frictionless Authentication',
61
58
  threedsVersion: '2',
62
59
  reasonCode: '100',
63
- veresEnrolled: types_1.VEResEnrolled.ENROLLED,
64
- pares: types_1.PARes.NOT_COMPLETED,
60
+ veresEnrolled: VEResEnrolled.ENROLLED,
61
+ pares: PARes.NOT_COMPLETED,
65
62
  outcome: {
66
63
  authenticationType: 'frictionless',
67
64
  success: false,
68
- errorCode: types_1.ScaErrorCode.UNAVAILABLE_FRICTIONLESS_AUTHENTICATION
65
+ errorCode: ScaErrorCode.UNAVAILABLE_FRICTIONLESS_AUTHENTICATION
69
66
  }
70
67
  },
71
68
  {
@@ -73,7 +70,7 @@ var enrollmentScenarios = [
73
70
  description: 'Challenge. Continue with OTP prompt',
74
71
  threedsVersion: '2',
75
72
  reasonCode: '475',
76
- veresEnrolled: types_1.VEResEnrolled.ENROLLED,
73
+ veresEnrolled: VEResEnrolled.ENROLLED,
77
74
  pares: null,
78
75
  outcome: {
79
76
  authenticationType: 'challenge',
@@ -85,12 +82,12 @@ var enrollmentScenarios = [
85
82
  description: 'Unsuccessful Frictionless Authentication',
86
83
  threedsVersion: '2',
87
84
  reasonCode: '476',
88
- veresEnrolled: types_1.VEResEnrolled.ENROLLED,
89
- pares: types_1.PARes.CANCELED,
85
+ veresEnrolled: VEResEnrolled.ENROLLED,
86
+ pares: PARes.CANCELED,
90
87
  outcome: {
91
88
  authenticationType: 'frictionless',
92
89
  success: false,
93
- errorCode: types_1.ScaErrorCode.UNSUCCESSFUL_FRICTIONLESS_AUTHENTICATION
90
+ errorCode: ScaErrorCode.UNSUCCESSFUL_FRICTIONLESS_AUTHENTICATION
94
91
  }
95
92
  },
96
93
  {
@@ -98,12 +95,12 @@ var enrollmentScenarios = [
98
95
  description: 'Rejected Frictionless Authentication',
99
96
  threedsVersion: '2',
100
97
  reasonCode: '476',
101
- veresEnrolled: types_1.VEResEnrolled.ENROLLED,
102
- pares: types_1.PARes.REJECTED,
98
+ veresEnrolled: VEResEnrolled.ENROLLED,
99
+ pares: PARes.REJECTED,
103
100
  outcome: {
104
101
  authenticationType: 'frictionless',
105
102
  success: false,
106
- errorCode: types_1.ScaErrorCode.REJECTED_FRICTIONLESS_AUTHENTICATION
103
+ errorCode: ScaErrorCode.REJECTED_FRICTIONLESS_AUTHENTICATION
107
104
  }
108
105
  },
109
106
  /***************************************************************/
@@ -114,7 +111,7 @@ var enrollmentScenarios = [
114
111
  description: '*****',
115
112
  threedsVersion: '1',
116
113
  reasonCode: '475',
117
- veresEnrolled: types_1.VEResEnrolled.ENROLLED,
114
+ veresEnrolled: VEResEnrolled.ENROLLED,
118
115
  pares: null,
119
116
  outcome: {
120
117
  authenticationType: 'challenge',
@@ -126,7 +123,7 @@ var enrollmentScenarios = [
126
123
  description: 'Error; Unavailable Authentication',
127
124
  threedsVersion: '1',
128
125
  reasonCode: '100',
129
- veresEnrolled: types_1.VEResEnrolled.UNABLE,
126
+ veresEnrolled: VEResEnrolled.UNABLE,
130
127
  pares: null,
131
128
  outcome: {
132
129
  authenticationType: 'frictionless',
@@ -138,7 +135,7 @@ var enrollmentScenarios = [
138
135
  description: 'Not Enrolled',
139
136
  threedsVersion: '1',
140
137
  reasonCode: '100',
141
- veresEnrolled: types_1.VEResEnrolled.NOT_ENROLLED,
138
+ veresEnrolled: VEResEnrolled.NOT_ENROLLED,
142
139
  pares: null,
143
140
  outcome: {
144
141
  authenticationType: 'frictionless',
@@ -146,4 +143,4 @@ var enrollmentScenarios = [
146
143
  }
147
144
  },
148
145
  ];
149
- exports.enrollmentScenarios = enrollmentScenarios;
146
+ export { enrollmentScenarios };
@@ -1,2 +1,4 @@
1
- export { EnrollmentScenario, enrollmentScenarios } from './enrollment';
2
- export { ValidationScenario, validationScenarios } from './validation';
1
+ export { enrollmentScenarios } from './enrollment';
2
+ export type { EnrollmentScenario } from './enrollment';
3
+ export { validationScenarios } from './validation';
4
+ export type { ValidationScenario } from './validation';
@@ -1,7 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validationScenarios = exports.enrollmentScenarios = void 0;
4
- var enrollment_1 = require("./enrollment");
5
- Object.defineProperty(exports, "enrollmentScenarios", { enumerable: true, get: function () { return enrollment_1.enrollmentScenarios; } });
6
- var validation_1 = require("./validation");
7
- Object.defineProperty(exports, "validationScenarios", { enumerable: true, get: function () { return validation_1.validationScenarios; } });
1
+ export { enrollmentScenarios } from './enrollment';
2
+ export { validationScenarios } from './validation';
@@ -12,4 +12,5 @@ interface ValidationScenario {
12
12
  };
13
13
  }
14
14
  declare const validationScenarios: ValidationScenario[];
15
- export { ValidationScenario, validationScenarios };
15
+ export { validationScenarios };
16
+ export type { ValidationScenario };
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validationScenarios = void 0;
4
- var types_1 = require("../types");
5
- var validationScenarios = [
1
+ import { ScaErrorCode, PARes } from '../types';
2
+ const validationScenarios = [
6
3
  /***************************************************************/
7
4
  /********************** 3DS2 scenarios *************************/
8
5
  /***************************************************************/
@@ -12,7 +9,7 @@ var validationScenarios = [
12
9
  threedsVersion: '2',
13
10
  reasonCode: '100',
14
11
  veresEnrolled: null,
15
- pares: types_1.PARes.SUCCESS,
12
+ pares: PARes.SUCCESS,
16
13
  outcome: {
17
14
  authenticationType: 'challenge',
18
15
  success: true // liability shift
@@ -24,11 +21,11 @@ var validationScenarios = [
24
21
  threedsVersion: '2',
25
22
  reasonCode: '476',
26
23
  veresEnrolled: null,
27
- pares: types_1.PARes.CANCELED,
24
+ pares: PARes.CANCELED,
28
25
  outcome: {
29
26
  authenticationType: 'challenge',
30
27
  success: false,
31
- errorCode: types_1.ScaErrorCode.UNSUCCESSFUL_STEPUP_AUTHENTICATION
28
+ errorCode: ScaErrorCode.UNSUCCESSFUL_STEPUP_AUTHENTICATION
32
29
  }
33
30
  },
34
31
  {
@@ -37,11 +34,11 @@ var validationScenarios = [
37
34
  threedsVersion: '2',
38
35
  reasonCode: '100',
39
36
  veresEnrolled: null,
40
- pares: types_1.PARes.NOT_COMPLETED,
37
+ pares: PARes.NOT_COMPLETED,
41
38
  outcome: {
42
39
  authenticationType: 'challenge',
43
40
  success: false,
44
- errorCode: types_1.ScaErrorCode.UNAVAILABLE_STEPUP_AUTHENTICATION
41
+ errorCode: ScaErrorCode.UNAVAILABLE_STEPUP_AUTHENTICATION
45
42
  }
46
43
  },
47
44
  /***************************************************************/
@@ -53,7 +50,7 @@ var validationScenarios = [
53
50
  threedsVersion: '1',
54
51
  reasonCode: '100',
55
52
  veresEnrolled: null,
56
- pares: types_1.PARes.SUCCESS,
53
+ pares: PARes.SUCCESS,
57
54
  outcome: {
58
55
  authenticationType: 'challenge',
59
56
  success: true // liability shift
@@ -65,11 +62,11 @@ var validationScenarios = [
65
62
  threedsVersion: '1',
66
63
  reasonCode: '100',
67
64
  veresEnrolled: null,
68
- pares: types_1.PARes.NOT_COMPLETED,
65
+ pares: PARes.NOT_COMPLETED,
69
66
  outcome: {
70
67
  authenticationType: 'challenge',
71
68
  success: false,
72
- errorCode: types_1.ScaErrorCode.UNAVAILABLE_STEPUP_AUTHENTICATION
69
+ errorCode: ScaErrorCode.UNAVAILABLE_STEPUP_AUTHENTICATION
73
70
  }
74
71
  },
75
72
  {
@@ -78,7 +75,7 @@ var validationScenarios = [
78
75
  threedsVersion: '1',
79
76
  reasonCode: '100',
80
77
  veresEnrolled: null,
81
- pares: types_1.PARes.ATTEMPTED,
78
+ pares: PARes.ATTEMPTED,
82
79
  outcome: {
83
80
  authenticationType: 'challenge',
84
81
  success: true
@@ -90,11 +87,11 @@ var validationScenarios = [
90
87
  threedsVersion: '1',
91
88
  reasonCode: '476',
92
89
  veresEnrolled: null,
93
- pares: types_1.PARes.CANCELED,
90
+ pares: PARes.CANCELED,
94
91
  outcome: {
95
92
  authenticationType: 'challenge',
96
93
  success: false,
97
- errorCode: types_1.ScaErrorCode.UNSUCCESSFUL_STEPUP_AUTHENTICATION
94
+ errorCode: ScaErrorCode.UNSUCCESSFUL_STEPUP_AUTHENTICATION
98
95
  }
99
96
  },
100
97
  {
@@ -107,7 +104,7 @@ var validationScenarios = [
107
104
  outcome: {
108
105
  authenticationType: 'challenge',
109
106
  success: false,
110
- errorCode: types_1.ScaErrorCode.UNSUCCESSFUL_STEPUP_AUTHENTICATION
107
+ errorCode: ScaErrorCode.UNSUCCESSFUL_STEPUP_AUTHENTICATION
111
108
  }
112
109
  },
113
110
  {
@@ -120,8 +117,8 @@ var validationScenarios = [
120
117
  outcome: {
121
118
  authenticationType: 'challenge',
122
119
  success: false,
123
- errorCode: types_1.ScaErrorCode.UNSUCCESSFUL_STEPUP_AUTHENTICATION
120
+ errorCode: ScaErrorCode.UNSUCCESSFUL_STEPUP_AUTHENTICATION
124
121
  }
125
122
  },
126
123
  ];
127
- exports.validationScenarios = validationScenarios;
124
+ export { validationScenarios };
@@ -155,4 +155,5 @@ interface GetCardRequest {
155
155
  interface GetCardResponse {
156
156
  bin: string;
157
157
  }
158
- export { ScaErrorCode, ChallengeWindowSize, CreateSCASessionRequest, CreateSCASessionResponse, EnrollSCARequest, EnrollSCAResponse, CommerceIndicator, VEResEnrolled, PARes, ValidateSCARequest, ValidateSCAResponse, DecodeSCASessionRequest, DecodeSCASessionResponse, GetCardRequest, GetCardResponse, ThreedsData, };
158
+ export { ScaErrorCode, ChallengeWindowSize, CommerceIndicator, VEResEnrolled, PARes };
159
+ export type { CreateSCASessionRequest, CreateSCASessionResponse, EnrollSCARequest, EnrollSCAResponse, ValidateSCARequest, ValidateSCAResponse, DecodeSCASessionRequest, DecodeSCASessionResponse, GetCardRequest, GetCardResponse, ThreedsData };
package/dist/sca/types.js CHANGED
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PARes = exports.VEResEnrolled = exports.CommerceIndicator = exports.ChallengeWindowSize = exports.ScaErrorCode = void 0;
4
1
  var ScaErrorCode;
5
2
  (function (ScaErrorCode) {
6
3
  ScaErrorCode["BYPASSED_AUTHENTICATION"] = "001";
@@ -10,7 +7,7 @@ var ScaErrorCode;
10
7
  ScaErrorCode["REJECTED_FRICTIONLESS_AUTHENTICATION"] = "005";
11
8
  ScaErrorCode["UNSUCCESSFUL_STEPUP_AUTHENTICATION"] = "006";
12
9
  ScaErrorCode["UNAVAILABLE_STEPUP_AUTHENTICATION"] = "007";
13
- })(ScaErrorCode || (exports.ScaErrorCode = ScaErrorCode = {}));
10
+ })(ScaErrorCode || (ScaErrorCode = {}));
14
11
  var ChallengeWindowSize;
15
12
  (function (ChallengeWindowSize) {
16
13
  ChallengeWindowSize["SIZE_250X400"] = "01";
@@ -18,7 +15,7 @@ var ChallengeWindowSize;
18
15
  ChallengeWindowSize["SIZE_500X600"] = "03";
19
16
  ChallengeWindowSize["SIZE_600X400"] = "04";
20
17
  ChallengeWindowSize["SIZE_FULL_PAGE"] = "05";
21
- })(ChallengeWindowSize || (exports.ChallengeWindowSize = ChallengeWindowSize = {}));
18
+ })(ChallengeWindowSize || (ChallengeWindowSize = {}));
22
19
  var CommerceIndicator;
23
20
  (function (CommerceIndicator) {
24
21
  // Card not enrolled, or card type not supported by payer authentication. No liability shift.
@@ -33,7 +30,7 @@ var CommerceIndicator;
33
30
  CommerceIndicator["VBV_ATTEMPTED"] = "vbv_attempted";
34
31
  // For the payment processors Barclays, Streamline, AIBMS, or FDC Germany, you receive this result if Visa’s directory service is not available. No liability shift.
35
32
  CommerceIndicator["VBV_FAILURE"] = "vbv_failure";
36
- })(CommerceIndicator || (exports.CommerceIndicator = CommerceIndicator = {}));
33
+ })(CommerceIndicator || (CommerceIndicator = {}));
37
34
  var VEResEnrolled;
38
35
  (function (VEResEnrolled) {
39
36
  // Card enrolled. You must authenticate. Liability shift.
@@ -44,7 +41,7 @@ var VEResEnrolled;
44
41
  VEResEnrolled["UNABLE"] = "U";
45
42
  // Authentication was bypassed
46
43
  VEResEnrolled["BYPASSED"] = "B";
47
- })(VEResEnrolled || (exports.VEResEnrolled = VEResEnrolled = {}));
44
+ })(VEResEnrolled || (VEResEnrolled = {}));
48
45
  var PARes;
49
46
  (function (PARes) {
50
47
  PARes["ATTEMPTED"] = "A";
@@ -53,4 +50,5 @@ var PARes;
53
50
  PARes["REJECTED"] = "R";
54
51
  PARes["NOT_COMPLETED"] = "U";
55
52
  PARes["SUCCESS"] = "Y";
56
- })(PARes || (exports.PARes = PARes = {}));
53
+ })(PARes || (PARes = {}));
54
+ export { ScaErrorCode, ChallengeWindowSize, CommerceIndicator, VEResEnrolled, PARes };
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,98 +7,55 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- var constants_1 = require("./constants");
43
- var axios_1 = __importDefault(require("axios"));
44
- var util_1 = require("./util");
45
- var baseUrl = process.env.API_GATEWAY_URL;
46
- var GatewayClient = /** @class */ (function () {
47
- function GatewayClient(_a) {
48
- var accessToken = _a.accessToken, username = _a.username;
49
- var headers = {};
50
- headers["Authorization"] = "Bearer ".concat(accessToken);
51
- headers[constants_1.RequestHeaderSdkVersion] = (0, util_1.getSdkVersionNumber)();
52
- headers[constants_1.RequestHeaderMerchantUsername] = username;
53
- this.client = axios_1.default.create({
10
+ import { RequestHeaderSdkVersion, RequestHeaderMerchantUsername, RequestTimeout, } from "./constants";
11
+ import axios from "axios";
12
+ import { getSdkVersionNumber } from "./util";
13
+ const baseUrl = process.env.API_GATEWAY_URL;
14
+ class GatewayClient {
15
+ constructor({ accessToken, username }) {
16
+ const headers = {};
17
+ headers["Authorization"] = `Bearer ${accessToken}`;
18
+ headers[RequestHeaderSdkVersion] = getSdkVersionNumber();
19
+ headers[RequestHeaderMerchantUsername] = username;
20
+ this.client = axios.create({
54
21
  baseURL: baseUrl,
55
- timeout: constants_1.RequestTimeout,
56
- headers: headers,
22
+ timeout: RequestTimeout,
23
+ headers,
57
24
  responseType: "json",
58
25
  transformResponse: [
59
26
  function (response) {
60
- var _response = typeof response === "string" ? JSON.parse(response) : response;
27
+ const _response = typeof response === "string" ? JSON.parse(response) : response;
61
28
  return _response.data;
62
29
  },
63
30
  ],
64
31
  });
65
32
  }
66
33
  /**************** SCA/3DS2 /****************/
67
- GatewayClient.prototype.createSCASession = function (data) {
68
- return __awaiter(this, void 0, void 0, function () {
69
- return __generator(this, function (_a) {
70
- return [2 /*return*/, this.client.post("/sca/session", data)];
71
- });
34
+ createSCASession(data) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ return this.client.post("/sca/session", data);
72
37
  });
73
- };
74
- GatewayClient.prototype.decodeSCASession = function (data) {
75
- return __awaiter(this, void 0, void 0, function () {
76
- return __generator(this, function (_a) {
77
- // return requestBase(`${baseUrl}/sca/decode_session`, 'POST', data)
78
- return [2 /*return*/, this.client.post("/sca/decode_session", data)];
79
- });
38
+ }
39
+ decodeSCASession(data) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ // return requestBase(`${baseUrl}/sca/decode_session`, 'POST', data)
42
+ return this.client.post("/sca/decode_session", data);
80
43
  });
81
- };
82
- GatewayClient.prototype.enrolSCA = function (data) {
83
- return __awaiter(this, void 0, void 0, function () {
84
- return __generator(this, function (_a) {
85
- return [2 /*return*/, this.client.post("/sca/enrollment", data)];
86
- });
44
+ }
45
+ enrolSCA(data) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ return this.client.post("/sca/enrollment", data);
87
48
  });
88
- };
89
- GatewayClient.prototype.validateSCA = function (data) {
90
- return __awaiter(this, void 0, void 0, function () {
91
- return __generator(this, function (_a) {
92
- return [2 /*return*/, this.client.post("/sca/validation", data)];
93
- });
49
+ }
50
+ validateSCA(data) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ return this.client.post("/sca/validation", data);
94
53
  });
95
- };
96
- GatewayClient.prototype.getCard = function (data) {
97
- return __awaiter(this, void 0, void 0, function () {
98
- return __generator(this, function (_a) {
99
- return [2 /*return*/, this.client.get("/credit_cards/".concat(data.card_token))];
100
- });
54
+ }
55
+ getCard(data) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ return this.client.get(`/credit_cards/${data.card_token}`);
101
58
  });
102
- };
103
- return GatewayClient;
104
- }());
105
- exports.default = GatewayClient;
59
+ }
60
+ }
61
+ export default GatewayClient;
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.load = void 0;
4
- var headlessIframeId = 'fz-hl';
5
- var load = function (url) {
6
- var existing = document.getElementById(headlessIframeId);
1
+ const headlessIframeId = 'fz-hl';
2
+ const load = (url) => {
3
+ const existing = document.getElementById(headlessIframeId);
7
4
  if (existing) {
8
5
  return existing;
9
6
  }
10
- var headless = document.createElement('iframe');
7
+ const headless = document.createElement('iframe');
11
8
  headless.style.visibility = 'hidden';
12
9
  headless.style.position = 'absolute';
13
10
  headless.style.left = '0px';
@@ -20,4 +17,4 @@ var load = function (url) {
20
17
  document.body.appendChild(headless);
21
18
  return headless;
22
19
  };
23
- exports.load = load;
20
+ export { load };
@@ -1,18 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LongRequestTimeout = exports.RequestTimeout = exports.RequestHeaderMerchantUsername = exports.RequestHeaderSdkVersion = exports.LocalStorageAccessTokenKey = void 0;
4
1
  // Local storage key naming convension:
5
2
  // Hypen-separated string with all letters in lower case.
6
- var LocalStorageAccessTokenKey = 'fz-access-token';
7
- exports.LocalStorageAccessTokenKey = LocalStorageAccessTokenKey;
3
+ const LocalStorageAccessTokenKey = 'fz-access-token';
8
4
  // Request header naming convension:
9
5
  // Hyphen-separated string with capitalised 1st letter. Capitalise acronyms
10
6
  // See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
11
- var RequestHeaderSdkVersion = 'fz-sdk-version';
12
- exports.RequestHeaderSdkVersion = RequestHeaderSdkVersion;
13
- var RequestHeaderMerchantUsername = 'fz-merchant-username';
14
- exports.RequestHeaderMerchantUsername = RequestHeaderMerchantUsername;
15
- var RequestTimeout = 8000; // ms
16
- exports.RequestTimeout = RequestTimeout;
17
- var LongRequestTimeout = 15000; // ms
18
- exports.LongRequestTimeout = LongRequestTimeout;
7
+ const RequestHeaderSdkVersion = 'fz-sdk-version';
8
+ const RequestHeaderMerchantUsername = 'fz-merchant-username';
9
+ const RequestTimeout = 8000; // ms
10
+ const LongRequestTimeout = 15000; // ms
11
+ export { LocalStorageAccessTokenKey, RequestHeaderSdkVersion, RequestHeaderMerchantUsername, RequestTimeout, LongRequestTimeout };
@@ -25,4 +25,5 @@ interface ErrorEventDetail {
25
25
  }
26
26
  declare const emit: (event: PublicEvent, data: SuccessEventDetail | ErrorEventDetail, target?: HTMLElement | Window) => void;
27
27
  declare const on: (event: PublicEvent, callback: (e: any) => void, target?: HTMLElement | Window) => void;
28
- export { EventData, emit, on };
28
+ export { emit, on };
29
+ export type { EventData };
@@ -1,14 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.on = exports.emit = void 0;
4
1
  // TODO: CustomEvent requires polyfill for IE.
5
- var emit = function (event, data, target) {
6
- if (target === void 0) { target = window; }
2
+ const emit = (event, data, target = window) => {
7
3
  target.dispatchEvent(new CustomEvent(event, { detail: data }));
8
4
  };
9
- exports.emit = emit;
10
- var on = function (event, callback, target) {
11
- if (target === void 0) { target = window; }
5
+ const on = (event, callback, target = window) => {
12
6
  target.addEventListener(event, callback);
13
7
  };
14
- exports.on = on;
8
+ export { emit, on };
@@ -44,4 +44,5 @@ declare class PostMessageClient {
44
44
  setEventListenersLegacy(handlers: EventHandlers): void;
45
45
  send(message: PostMessage | PostMessageLegacy): void;
46
46
  }
47
- export { CreateCardTokenPostMessageData, CreatePurchasePostMessageData, PostMessage, PostMessageLegacy, PostMessageClient, PostMessageClientConfig, };
47
+ export { PostMessageClient };
48
+ export type { CreateCardTokenPostMessageData, CreatePurchasePostMessageData, PostMessage, PostMessageLegacy, PostMessageClientConfig };