@finteqhub/sdk-js 0.13.0 → 0.14.0-beta.6

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/CHANGELOG.md ADDED
@@ -0,0 +1,49 @@
1
+ # Changelog
2
+
3
+ Notable changes to `@finteqhub/sdk-js`. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
4
+
5
+ ## 0.14.0
6
+
7
+ ### Breaking changes
8
+
9
+ - `transactionType` was removed from the `SubmitData` type. It was declared on two of the three variants (the saved-card variant with `customerAccountId` and the generic `Record<string, string>` one) but never read by the SDK: `submitForm` spreads the data straight into the request body. TypeScript callers that pass `transactionType` in an object literal now hit the excess property check and need to drop it; JavaScript callers are unaffected, since the spread still forwards whatever the caller supplies.
10
+
11
+ `transactionType` is unchanged on `OperationSession`, where the API returns it as part of the session. `TxType` is also unchanged: it is unused inside the SDK, but it is re-exported from the package root and stays part of the public API.
12
+
13
+ ## 0.13.1
14
+
15
+ ### Changed
16
+
17
+ - `CHANGELOG.md` is now included in the published npm package (previously only `dist/` and `README.md` shipped).
18
+ - Added `repository`, `homepage` and `bugs` fields to `package.json`, so the npm page links to the GitHub repository, relative links in the README resolve there, and dependency bots can find the release notes.
19
+
20
+ No code changes: the SDK behaves exactly as in 0.13.0 (only the version reported in the `x-pgw-sdk` header differs).
21
+
22
+ ## 0.13.0
23
+
24
+ ### Breaking changes
25
+
26
+ - The SDK identification header sent with every request was renamed from `X-Finteqhub-SDK` to `x-pgw-sdk`, now spelled in lower case to match the other headers the SDK sends. Header names are case-insensitive, so only the name itself changed; the value format (`sdk-js/<version>`) is unchanged.
27
+
28
+ ## 0.12.0
29
+
30
+ ### Breaking changes
31
+
32
+ - The constructor validates its arguments and throws a `TypeError` when `apiUrl`, `fingerprintVisitorId`, `merchantId` or `sessionId` is missing, empty or not a string, when `isSecure` is not a boolean, or when `retryOptions` is malformed (not an object, `retryCount` not a non-negative integer, `retryStatusCode` not a function). Previously invalid arguments were accepted silently.
33
+ - Failed requests now reject with a `RequestError` (subclass of `Error`) instead of a plain `Error`. Existing `catch` blocks keep working, but error messages changed for some failure classes:
34
+ - network failures reject with `request to <url> failed after N attempt(s): <reason>` (previously the raw `fetch` error, e.g. `Failed to fetch`);
35
+ - non-200 responses without an `error` field in the body reject with `unexpected response status <code>` (previously the message was empty);
36
+ - responses with a non-JSON body reject with `request to <url> returned invalid JSON (status <code>)` (previously the raw `JSON.parse` error).
37
+
38
+ Code that matches on `error.message` for these cases needs updating; code that only reads `error.message` for display keeps working.
39
+
40
+ - To keep the 0.11.0 behaviour of a single request per call, pass `{ retryCount: 0 }` as the sixth constructor argument. The `RequestError` type, the changed error messages and the `console.error` dump apply regardless of whether retries are enabled.
41
+
42
+ ### Added
43
+
44
+ - Failed HTTP requests are retried automatically with exponential backoff (`100ms → 200ms → 500ms → 1000ms → 2000ms`), 5 retries by default. Network errors are always retried; responses are retried when the status is `< 200`, `408`, or `>= 500` (400 is not retried: the API returns it for deterministic validation failures and duplicate-submit rejections). Configurable via the new optional `retryOptions` constructor argument (`retryCount`, `retryStatusCode`), passed after `isSecure` — see the README for details.
45
+ - `RequestError.diagnostics` carries a full diagnostic payload: failure kind (`network` / `http_error` / `invalid_json`), SDK version, request info with a per-attempt log, sanitized response body for non-200 responses (truncated, digit runs masked), the `error` field of the response body, and environment info (`navigator.onLine`, `document.visibilityState`, `navigator.connection`). The same payload is logged with `console.error` together with the error message; each retry is reported with `console.warn`.
46
+ - New exports: `RequestError`, `RetryOptions`, `RequestDiagnostics`, `RequestAttempt`.
47
+ - `publish-beta` GitHub workflow: publishes `<version>-beta.<run number>` to npm under the `beta` dist-tag without touching `latest`.
48
+
49
+ Releases before 0.12.0 are not backfilled here — see the git history.
@@ -118,7 +118,6 @@ export declare type SubmitData = {
118
118
  payer: Payer;
119
119
  };
120
120
  paymentMethod: string;
121
- transactionType: string;
122
121
  } | {
123
122
  credentials: {
124
123
  billingAddress: Address;
@@ -129,7 +128,6 @@ export declare type SubmitData = {
129
128
  } | {
130
129
  credentials: Record<string, string>;
131
130
  paymentMethod: string;
132
- transactionType: string;
133
131
  };
134
132
  export declare type ProcessOperationRedirectResponse = {
135
133
  type: "redirect";
@@ -1,3 +1,3 @@
1
1
  export declare const SDK_HEADER_NAME = "x-pgw-sdk";
2
- export declare const SDK_VERSION = "0.13.0";
2
+ export declare const SDK_VERSION = "0.14.0-beta.6";
3
3
  export declare const SDK_HEADER_VALUE: string;
@@ -1,3 +1,3 @@
1
1
  export const SDK_HEADER_NAME = "x-pgw-sdk";
2
- export const SDK_VERSION = "0.13.0";
2
+ export const SDK_VERSION = "0.14.0-beta.6";
3
3
  export const SDK_HEADER_VALUE = `sdk-js/${SDK_VERSION}`;
package/package.json CHANGED
@@ -1,13 +1,22 @@
1
1
  {
2
2
  "name": "@finteqhub/sdk-js",
3
- "version": "0.13.0",
3
+ "version": "0.14.0-beta.6",
4
4
  "description": "SDK for interacting with FinteqHub processing API",
5
5
  "main": "./dist/index.js",
6
6
  "typings": "./dist/index.d.ts",
7
7
  "files": [
8
- "dist/*"
8
+ "dist/*",
9
+ "CHANGELOG.md"
9
10
  ],
10
11
  "author": "FinteqHub",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/finteqhub/sdk-js.git"
15
+ },
16
+ "homepage": "https://github.com/finteqhub/sdk-js#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/finteqhub/sdk-js/issues"
19
+ },
11
20
  "devDependencies": {
12
21
  "@types/jest": "^29.1.1",
13
22
  "jest": "^29.1.2",