@fat-zebra/sdk 2.0.8-beta.1 → 2.0.8-beta.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.
@@ -1,5 +1,6 @@
1
1
  import axios from "axios";
2
2
  import { getFlowId, getIsReactSdk, getLoggerUsername, getTransactionReference } from "./logger-context";
3
+ import { getSdkCommitHash } from "../shared/util";
3
4
  let loggerConfig = {};
4
5
  export function configureLogger(config) {
5
6
  loggerConfig = config;
@@ -44,6 +45,7 @@ export function instrumentFunction(methodName, fn, opts = {}) {
44
45
  className: opts.className,
45
46
  method: methodName,
46
47
  arguments: mappedArgs,
48
+ sdkCommitHash: getSdkCommitHash(),
47
49
  timestamp: new Date().toISOString(),
48
50
  };
49
51
  sendLog(endpoint, payload);
package/dist/main.d.ts CHANGED
@@ -48,6 +48,7 @@ export default class FatZebra {
48
48
  private reportRequestThreedsEnabledTimeout;
49
49
  private reportTokenizeCardResponse;
50
50
  checkout(): void;
51
+ reportVerifyCardValidationErrors(errors: string[]): void;
51
52
  on(event: PublicEvent, callback: (e: any) => void): void;
52
53
  off(event: PublicEvent, callback: (e: any) => void): void;
53
54
  onOnce(event: PublicEvent, callback: (e: any) => void): void;
package/dist/main.js CHANGED
@@ -154,8 +154,10 @@ class FatZebra {
154
154
  console.log('verifyCard');
155
155
  const valid = validateVerifyCardParams(params);
156
156
  if (!valid) {
157
+ const errors = toHumanizedErrors(validateVerifyCardParams.errors);
158
+ this.reportVerifyCardValidationErrors(errors);
157
159
  emit(PublicEvent.VALIDATION_ERROR, {
158
- errors: toHumanizedErrors(validateVerifyCardParams.errors),
160
+ errors,
159
161
  data: null,
160
162
  });
161
163
  return;
@@ -317,6 +319,8 @@ class FatZebra {
317
319
  checkout() {
318
320
  window.HPP.purchase();
319
321
  }
322
+ reportVerifyCardValidationErrors(errors) {
323
+ }
320
324
  on(event, callback) {
321
325
  on(event, callback);
322
326
  }
@@ -401,4 +405,7 @@ __decorate([
401
405
  __decorate([
402
406
  logMethod()
403
407
  ], FatZebra.prototype, "checkout", null);
408
+ __decorate([
409
+ logMethod()
410
+ ], FatZebra.prototype, "reportVerifyCardValidationErrors", null);
404
411
  export { FatZebra, };
@@ -3,4 +3,5 @@ declare const toSnakeCase: (s: string) => string;
3
3
  declare const toObjectWithSnakeCaseKeys: (o: any) => any;
4
4
  declare const toObjectWithCamelCaseKeys: (o: any) => any;
5
5
  declare const getSdkVersionNumber: () => string;
6
- export { toCamelCase, toSnakeCase, toObjectWithCamelCaseKeys, toObjectWithSnakeCaseKeys, getSdkVersionNumber, };
6
+ declare const getSdkCommitHash: () => string | undefined;
7
+ export { toCamelCase, toSnakeCase, toObjectWithCamelCaseKeys, toObjectWithSnakeCaseKeys, getSdkVersionNumber, getSdkCommitHash, };
@@ -1,4 +1,4 @@
1
- import { version } from '../version';
1
+ import { version, commitHash } from '../version';
2
2
  const toCamelCase = (s) => {
3
3
  return s.replace(/_([a-z])/g, (g) => g[1].toUpperCase());
4
4
  };
@@ -79,4 +79,9 @@ const toObjectWithCamelCaseKeys = (o) => {
79
79
  const getSdkVersionNumber = () => {
80
80
  return version;
81
81
  };
82
- export { toCamelCase, toSnakeCase, toObjectWithCamelCaseKeys, toObjectWithSnakeCaseKeys, getSdkVersionNumber, };
82
+ // Returns the commit hash stamped into the bundle at build time, or undefined when
83
+ // the placeholder hasn't been replaced (a real hash never starts with the `__` prefix).
84
+ const getSdkCommitHash = () => {
85
+ return commitHash.startsWith('__') ? undefined : commitHash;
86
+ };
87
+ export { toCamelCase, toSnakeCase, toObjectWithCamelCaseKeys, toObjectWithSnakeCaseKeys, getSdkVersionNumber, getSdkCommitHash, };
@@ -72,7 +72,7 @@ class ThreeDSecure {
72
72
  handlers[BridgeEvent.THREE_D_SECURE_FAILURE_RESPONSE] = (data) => {
73
73
  if (data.flow_id !== this.flowId)
74
74
  return;
75
- emit(PublicEvent.SCA_ERROR, { errors: [data.errors], data });
75
+ this.reportFailure(data.errors, data);
76
76
  };
77
77
  return handlers;
78
78
  }
@@ -14,6 +14,7 @@ declare class ThreeDSecureChallengeWindow {
14
14
  cardToken: string;
15
15
  challengeWindowSize?: ChallengeWindowSize;
16
16
  }): void;
17
+ private static reportChallengeIframeLoaded;
17
18
  private static reportChallengeIframeError;
18
19
  }
19
20
  export default ThreeDSecureChallengeWindow;
@@ -140,7 +140,7 @@ class ThreeDSecureChallengeWindow {
140
140
  iframe.height = "100%";
141
141
  Object.assign(iframe.style, { border: "0", display: "block" });
142
142
  iframe.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms allow-popups allow-top-navigation-by-user-activation");
143
- iframe.addEventListener("load", () => console.log("✅ step-up iframe loaded"));
143
+ iframe.addEventListener("load", ThreeDSecureChallengeWindow.reportChallengeIframeLoaded, { once: true });
144
144
  iframe.addEventListener("error", ThreeDSecureChallengeWindow.reportChallengeIframeError);
145
145
  frameWrap.appendChild(iframe);
146
146
  // Hidden POST form -> targets the iframe
@@ -169,6 +169,9 @@ class ThreeDSecureChallengeWindow {
169
169
  overlay.style.display = "flex";
170
170
  form.submit();
171
171
  }
172
+ static reportChallengeIframeLoaded() {
173
+ console.log("✅ step-up iframe loaded");
174
+ }
172
175
  static reportChallengeIframeError() {
173
176
  console.log("❌ step-up iframe error");
174
177
  }
@@ -181,6 +184,9 @@ ThreeDSecureChallengeWindow.CHALLENGE_FORM_ID = "three_d_secure_challenge_form";
181
184
  __decorate([
182
185
  logMethod()
183
186
  ], ThreeDSecureChallengeWindow, "showChallengeIframe", null);
187
+ __decorate([
188
+ logMethod()
189
+ ], ThreeDSecureChallengeWindow, "reportChallengeIframeLoaded", null);
184
190
  __decorate([
185
191
  logMethod()
186
192
  ], ThreeDSecureChallengeWindow, "reportChallengeIframeError", null);
package/dist/version.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export declare const version = "1.5.9";
2
+ export declare const commitHash = "__SDK_COMMIT_HASH__";
package/dist/version.js CHANGED
@@ -1 +1,5 @@
1
1
  export const version = '1.5.9';
2
+ // Placeholder replaced at build time by .github/scripts/stamp-version.js with the
3
+ // deployed commit hash (`git rev-parse HEAD`). Stays as the placeholder for builds
4
+ // that don't run the stamp step (e.g. local/package builds).
5
+ export const commitHash = '__SDK_COMMIT_HASH__';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fat-zebra/sdk",
3
- "version": "2.0.8-beta.1",
3
+ "version": "2.0.8-beta.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {