@spare-technologies/spare-link 0.1.0-beta.0 → 0.1.0-beta.1

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 CHANGED
@@ -1,10 +1,20 @@
1
1
  # @spare-technologies/spare-link
2
2
 
3
+ ## 0.1.0-beta.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4](https://github.com/spare-technologies/link-rn/pull/4) [`af05ad2`](https://github.com/spare-technologies/link-rn/commit/af05ad2372b2c96c619f7fc9c06c9085768a406b) Thanks [@bkmehata](https://github.com/bkmehata)! - Clean up published docs and package metadata.
8
+
9
+ - Fix the `LICENSE` link in the README so it resolves inside the published package.
10
+ - Remove README references to an internal-only test package that consumers can't install, plus a stale changelog section describing a removed API.
11
+ - Drop an internal, dev-only entry from the published `package.json` dependency list.
12
+
3
13
  ## 0.1.0-beta.0
4
14
 
5
15
  ### Minor Changes
6
16
 
7
- - [#1](https://github.com/spare-technologies/link-rn/pull/1) [`bc3040c`](https://github.com/spare-technologies/link-rn/commit/bc3040c58ab63934d81f1ead0083293f2e0ed164) Thanks [@bdspare](https://github.com/bdspare)! - Initial public beta of `@spare-technologies/spare-link` — the React Native SDK for Spare Link open-banking payments (port of the Flutter `spare_link` SDK, with byte-for-byte parity on retry/timeout/state-machine semantics).
17
+ - [#1](https://github.com/spare-technologies/link-rn/pull/1) [`bc3040c`](https://github.com/spare-technologies/link-rn/commit/bc3040c58ab63934d81f1ead0083293f2e0ed164) Thanks [@bdspare](https://github.com/bdspare)! - Initial public beta of `@spare-technologies/spare-link` — the React Native SDK for Spare Link open-banking payments.
8
18
 
9
19
  - Instance-based API: construct one `SpareLink`, mount one `<SpareLinkHost>`, and call `spareLink.start({ linkToken })` — `session.result` resolves to a discriminated `PaymentResult` (`success | cancelled | failed | abandoned`).
10
20
  - 9-phase `PaymentFlowController` with a 5-minute awaiting-callback timeout, single/multi-payment (mandate) and international consent UIs, and Confirmation-of-Payee gating.
@@ -13,54 +23,3 @@
13
23
  - Deep-link wiring via `useSpareLinkDeepLinks(spareLink)` and `spareLink.handleRedirect(uri)`.
14
24
  - Expo config plugin (`@spare-technologies/spare-link/expo-plugin`) shipping iOS + Android permission and deep-link setup.
15
25
  - Ships compiled CommonJS + ESM + TypeScript declarations, with `src` retained for Metro consumers.
16
- - Companion `@spare-technologies/link-test-harness` MSW mock Link server for TDD.
17
-
18
- ## Unreleased
19
-
20
- ### Changed
21
-
22
- - Package name finalized as `@spare-technologies/spare-link`, aligned with the Flutter `spare_link` package. Earlier pre-release development used a different scope and a `link-rn` suffix; nothing was published under those names, so no consumer action is required.
23
-
24
- ### Fixed
25
-
26
- - Payment flow recovery now buffers bank-return URIs on cold start, clears pending sessions on completion, and polls `/link/status` every 10s while awaiting the bank (production + sandbox).
27
- - Sandbox auto-success on status poll only applies after `callback_received` (bank returned), not while still `redirected` — fixes false success on app restart before bank authorization.
28
- - Failed-screen copy is sanitized via `userFriendlyMessageFor` — raw backend messages are no longer shown.
29
- - Cancel during bank processing now shows a confirmation dialog (Flutter parity).
30
-
31
- ### Added
32
-
33
- - Instance-based `SpareLink` + `SpareLinkHost` API (Flutter-aligned: one instance, one host), replacing the earlier static `SpareLink.start`/`SpareLinkProvider` shape.
34
- - `spareLink.resumeIfNeeded()` returning typed `RecoveryResult` (`recovered` | `awaitingUser` | `none`).
35
- - `merchantRef` on `PaymentSuccess` when present in the bank callback URI.
36
- - `abandoned` lifecycle event when the modal dismiss control is used mid-flow.
37
- - Corrected CTA copy: `Proceed using Altareq` / `Pay using Altareq` (was `AlTareq` on some screens).
38
- - Accordion section headers, chevron color, and dividers now match Flutter consent UI.
39
- - Payment setup card border radius aligned with Flutter (12px).
40
-
41
- ### Added
42
-
43
- - MetroSans font assets loaded automatically by `SpareLinkHost`.
44
- - `showDismissButton` prop on `SpareLinkHost` (default `true`; merchant demo sets `false` for Flutter parity).
45
- - Multi-payment (mandate) consent UI for all six schedule types, porting Flutter `spare_link` parity.
46
- - International payment consent UI with read-only charge bearer display.
47
- - `MandateSetupSuccessScreen` recap before the success callback for mandate flows.
48
- - `summaryFromState()` returning discriminated `ConsentSummaryData` (`singlePayment` | `international` | `multiPayment`).
49
- - CoP skipped for international payments.
50
- - Test harness scenarios `multipaymentFixedOnDemand`, `multipaymentFixedDefinedSchedule`, and `internationalPayment`.
51
-
52
- ## 0.1.0-beta.1
53
-
54
- ### Initial public beta
55
-
56
- - `SpareLink.start({ config, callbacks? })` — launches the native Link payment Modal and resolves with a `PaymentResult`.
57
- - `SpareLink.handleRedirect(uri)` — forwards bank-return URIs to the active flow.
58
- - `SpareLink.resumeIfNeeded({ config, callbacks? })` — recovers in-flight sessions on cold-start; auto-fails after `kMaxRecoveryAttempts` (3).
59
- - `SpareLink.delegate` swap point for tests.
60
- - `SpareLinkProvider` host component mounting the SDK Modal + delegating `start/handleRedirect/resumeIfNeeded`.
61
- - `useSpareLinkDeepLinks()` hook wiring `Linking` to `SpareLink.handleRedirect`.
62
- - `SecureStorePendingSessionStore` backed by `expo-secure-store`.
63
- - Expo config plugin (`@spare-technologies/spare-link/expo-plugin`) injecting iOS location permission + URL scheme + Android permissions + intent-filters.
64
- - 9-phase `PaymentFlowController` with 5-minute awaiting-callback timeout.
65
- - `LinkApiClient` with header parity, retry/timeout, and stable Idempotency-Key for POST `/link/consent`.
66
- - 34 jest tests + 25 harness tests at green.
package/README.md CHANGED
@@ -10,9 +10,8 @@ npm i @spare-technologies/spare-link
10
10
 
11
11
  ## Quickstart
12
12
 
13
- The SDK is instance-based (mirrors the Flutter `spare_link` API): create one `SpareLink`
14
- instance, mount one `SpareLinkHost` near your app root, and pass that instance to every
15
- screen that starts a payment.
13
+ The SDK is instance-based: create one `SpareLink` instance, mount one `SpareLinkHost` near
14
+ your app root, and pass that instance to every screen that starts a payment.
16
15
 
17
16
  ```tsx
18
17
  import { SpareLink, SpareLinkHost, useSpareLinkDeepLinks } from '@spare-technologies/spare-link';
@@ -53,7 +52,7 @@ plugins: [
53
52
  '@spare-technologies/spare-link/expo-plugin',
54
53
  {
55
54
  locationUsageDescription: 'We use your location to verify the payment.',
56
- merchantScheme: 'sparemerchantrn',
55
+ merchantScheme: 'myapp',
57
56
  merchantHost: 'callback',
58
57
  },
59
58
  ],
@@ -62,8 +61,8 @@ plugins: [
62
61
 
63
62
  The plugin injects:
64
63
 
65
- - **iOS**: `NSLocationWhenInUseUsageDescription` + `CFBundleURLSchemes` entry for the merchant scheme.
66
- - **Android**: `ACCESS_FINE_LOCATION` permission + intent-filter for `sparemerchantrn://callback` (and an optional `autoVerify=true` App Link for the Spare universal-link host).
64
+ - **iOS**: `NSLocationWhenInUseUsageDescription` + `CFBundleURLSchemes` entry for your app scheme.
65
+ - **Android**: `ACCESS_FINE_LOCATION` permission + intent-filter for `myapp://callback` (and an optional `autoVerify=true` App Link for the Spare universal-link host).
67
66
 
68
67
  ## Deep-link handling
69
68
 
@@ -107,23 +106,6 @@ AppState.addEventListener('change', (state) => {
107
106
 
108
107
  After `kMaxRecoveryAttempts` (3) non-terminal attempts the SDK resolves `PaymentFailed('recovery_exhausted')` and clears the record.
109
108
 
110
- ## Testing with the harness
111
-
112
- Add `@spare-technologies/link-test-harness` as a dev dep — it ships a stateful MSW mock Link API with tofa-accurate `{ data }` envelopes:
113
-
114
- ```ts
115
- import { setupMockLinkApi } from '@spare-technologies/link-test-harness';
116
-
117
- const server = setupMockLinkApi({ scenario: 'happyPath' });
118
- beforeAll(() => server.start());
119
- afterAll(() => server.stop());
120
- afterEach(() => server.reset());
121
- ```
122
-
123
- Available scenarios: `happyPath`, `sessionAlreadyInitialized`, `networkTimeout`, `consentRetry`, `sessionTimeout`, `recoveryViaStatus`, `appReturn`, `terminalCompleted | Failed | Cancelled | Expired`, `tenantMismatch`, `providerUnavailable`, `multipaymentFixedOnDemand`, `multipaymentFixedDefinedSchedule`, `internationalPayment`.
124
-
125
- For tests that don't want to mount `SpareLinkHost`, drive the instance's internal host delegate directly (see `SpareLink._attachHost` usage in the SDK's own `spare-link-instance.test.ts` for the pattern), or stub the app-level function that wraps `spareLink.start(...)` in your own integration layer.
126
-
127
109
  ## API reference
128
110
 
129
111
  ### `new SpareLink(options)`
@@ -170,4 +152,4 @@ type SpareLinkEventType =
170
152
 
171
153
  ## License
172
154
 
173
- MIT — see [LICENSE](../../LICENSE).
155
+ MIT — see [LICENSE](./LICENSE).
@@ -5,10 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.SDK_VERSION = void 0;
7
7
  /**
8
- * SDK version reported in telemetry and the default User-Agent. This file is
9
- * regenerated from `package.json` by the root `version` npm script on every
10
- * release bump (see the `version` script in the repo-root package.json), so it
11
- * always matches the published version — do not edit the literal by hand.
8
+ * SDK version reported in telemetry and the default User-Agent.
9
+ *
10
+ * GENERATED FILE — do not edit by hand. Written from package.json by
11
+ * scripts/sync-sdk-version.mjs (run by the root `version` npm script after
12
+ * `changeset version`). The src/index.ts smoke test asserts this matches
13
+ * package.json's version.
12
14
  */
13
- const SDK_VERSION = exports.SDK_VERSION = '0.1.0-beta.0';
15
+ const SDK_VERSION = exports.SDK_VERSION = '0.1.0-beta.1';
14
16
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SDK_VERSION","exports"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,cAAuB","ignoreList":[]}
1
+ {"version":3,"names":["SDK_VERSION","exports"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,cAAuB","ignoreList":[]}
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  /**
4
- * SDK version reported in telemetry and the default User-Agent. This file is
5
- * regenerated from `package.json` by the root `version` npm script on every
6
- * release bump (see the `version` script in the repo-root package.json), so it
7
- * always matches the published version — do not edit the literal by hand.
4
+ * SDK version reported in telemetry and the default User-Agent.
5
+ *
6
+ * GENERATED FILE — do not edit by hand. Written from package.json by
7
+ * scripts/sync-sdk-version.mjs (run by the root `version` npm script after
8
+ * `changeset version`). The src/index.ts smoke test asserts this matches
9
+ * package.json's version.
8
10
  */
9
- export const SDK_VERSION = '0.1.0-beta.0';
11
+ export const SDK_VERSION = '0.1.0-beta.1';
10
12
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SDK_VERSION"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,GAAG,cAAuB","ignoreList":[]}
1
+ {"version":3,"names":["SDK_VERSION"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,GAAG,cAAuB","ignoreList":[]}
@@ -1,8 +1,10 @@
1
1
  /**
2
- * SDK version reported in telemetry and the default User-Agent. This file is
3
- * regenerated from `package.json` by the root `version` npm script on every
4
- * release bump (see the `version` script in the repo-root package.json), so it
5
- * always matches the published version — do not edit the literal by hand.
2
+ * SDK version reported in telemetry and the default User-Agent.
3
+ *
4
+ * GENERATED FILE — do not edit by hand. Written from package.json by
5
+ * scripts/sync-sdk-version.mjs (run by the root `version` npm script after
6
+ * `changeset version`). The src/index.ts smoke test asserts this matches
7
+ * package.json's version.
6
8
  */
7
- export declare const SDK_VERSION: "0.1.0-beta.0";
9
+ export declare const SDK_VERSION: "0.1.0-beta.1";
8
10
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAG,cAAuB,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAG,cAAuB,CAAC"}
@@ -1,8 +1,10 @@
1
1
  /**
2
- * SDK version reported in telemetry and the default User-Agent. This file is
3
- * regenerated from `package.json` by the root `version` npm script on every
4
- * release bump (see the `version` script in the repo-root package.json), so it
5
- * always matches the published version — do not edit the literal by hand.
2
+ * SDK version reported in telemetry and the default User-Agent.
3
+ *
4
+ * GENERATED FILE — do not edit by hand. Written from package.json by
5
+ * scripts/sync-sdk-version.mjs (run by the root `version` npm script after
6
+ * `changeset version`). The src/index.ts smoke test asserts this matches
7
+ * package.json's version.
6
8
  */
7
- export declare const SDK_VERSION: "0.1.0-beta.0";
9
+ export declare const SDK_VERSION: "0.1.0-beta.1";
8
10
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAG,cAAuB,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAG,cAAuB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spare-technologies/spare-link",
3
- "version": "0.1.0-beta.0",
3
+ "version": "0.1.0-beta.1",
4
4
  "description": "React Native SDK for Spare Link — open banking payments via a native checkout sheet.",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -97,7 +97,6 @@
97
97
  "react-native-svg": "15.8.0"
98
98
  },
99
99
  "devDependencies": {
100
- "@spare-technologies/link-test-harness": "workspace:*",
101
100
  "@testing-library/jest-native": "^5.4.3",
102
101
  "@testing-library/react-native": "^13.0.0",
103
102
  "@types/jest": "^29.5.13",
package/src/version.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  /**
2
- * SDK version reported in telemetry and the default User-Agent. This file is
3
- * regenerated from `package.json` by the root `version` npm script on every
4
- * release bump (see the `version` script in the repo-root package.json), so it
5
- * always matches the published version — do not edit the literal by hand.
2
+ * SDK version reported in telemetry and the default User-Agent.
3
+ *
4
+ * GENERATED FILE — do not edit by hand. Written from package.json by
5
+ * scripts/sync-sdk-version.mjs (run by the root `version` npm script after
6
+ * `changeset version`). The src/index.ts smoke test asserts this matches
7
+ * package.json's version.
6
8
  */
7
- export const SDK_VERSION = '0.1.0-beta.0' as const;
9
+ export const SDK_VERSION = '0.1.0-beta.1' as const;