@inno-isw/react-native-rtp 0.0.0-stage → 0.1.0
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/LICENSE +20 -0
- package/README.md +362 -2
- package/lib/module/client.js +218 -0
- package/lib/module/client.js.map +1 -0
- package/lib/module/constants.js +44 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/emitter.js +46 -0
- package/lib/module/emitter.js.map +1 -0
- package/lib/module/index.js +16 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/mock/makeRtpPayload.js +51 -0
- package/lib/module/mock/makeRtpPayload.js.map +1 -0
- package/lib/module/mock/mockTransport.js +82 -0
- package/lib/module/mock/mockTransport.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/push.js +96 -0
- package/lib/module/push.js.map +1 -0
- package/lib/module/react/RtpProvider.js +142 -0
- package/lib/module/react/RtpProvider.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/validate.js +80 -0
- package/lib/module/validate.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/client.d.ts +11 -0
- package/lib/typescript/src/client.d.ts.map +1 -0
- package/lib/typescript/src/constants.d.ts +45 -0
- package/lib/typescript/src/constants.d.ts.map +1 -0
- package/lib/typescript/src/emitter.d.ts +15 -0
- package/lib/typescript/src/emitter.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +14 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/mock/makeRtpPayload.d.ts +17 -0
- package/lib/typescript/src/mock/makeRtpPayload.d.ts.map +1 -0
- package/lib/typescript/src/mock/mockTransport.d.ts +29 -0
- package/lib/typescript/src/mock/mockTransport.d.ts.map +1 -0
- package/lib/typescript/src/push.d.ts +41 -0
- package/lib/typescript/src/push.d.ts.map +1 -0
- package/lib/typescript/src/react/RtpProvider.d.ts +56 -0
- package/lib/typescript/src/react/RtpProvider.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +142 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/validate.d.ts +22 -0
- package/lib/typescript/src/validate.d.ts.map +1 -0
- package/package.json +141 -4
- package/src/client.ts +239 -0
- package/src/constants.ts +49 -0
- package/src/emitter.ts +53 -0
- package/src/index.tsx +43 -0
- package/src/mock/makeRtpPayload.ts +66 -0
- package/src/mock/mockTransport.ts +103 -0
- package/src/push.ts +109 -0
- package/src/react/RtpProvider.tsx +200 -0
- package/src/types.ts +161 -0
- package/src/validate.ts +93 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { createRtpClient } from './client.js';
|
|
2
|
+
export { RTP_STATUS, RTP_EVENT, RTP_ERROR } from './constants.js';
|
|
3
|
+
export type { RtpStatus, RtpEvent, RtpError } from './constants.js';
|
|
4
|
+
export { isRtpPayload, findValidationErrors, toRtpRequest, isExpired, } from './validate.js';
|
|
5
|
+
export { mapPushToRtp } from './push.js';
|
|
6
|
+
export type { PushEnvelope } from './push.js';
|
|
7
|
+
export type { RtpPayload, RtpParty, RtpRequest, RtpCredential, RtpResult, RtpReceiveOutcome, RtpTransport, RtpStorage, RtpHttpResponse, RtpClient, RtpClientOptions, RtpEventMap, RtpUnsubscribe, } from './types.js';
|
|
8
|
+
export { RtpProvider, useRtp, RtpContext } from './react/RtpProvider.js';
|
|
9
|
+
export type { RtpProviderProps, RtpContextValue } from './react/RtpProvider.js';
|
|
10
|
+
export { createMockTransport } from './mock/mockTransport.js';
|
|
11
|
+
export type { MockTransport, MockTransportOptions, RecordedCall, } from './mock/mockTransport.js';
|
|
12
|
+
export { makeRtpPayload, makeExpiredPayload } from './mock/makeRtpPayload.js';
|
|
13
|
+
export type { MakeRtpPayloadOverrides } from './mock/makeRtpPayload.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAU,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAa,CAAC;AAC/D,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAa,CAAC;AACjE,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,YAAY,EACZ,SAAS,GACV,MAAM,eAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAQ,CAAC;AACtC,YAAY,EAAE,YAAY,EAAE,MAAM,WAAQ,CAAC;AAG3C,YAAY,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,cAAc,GACf,MAAM,YAAS,CAAC;AAGjB,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,wBAAqB,CAAC;AACtE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,wBAAqB,CAAC;AAG7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAsB,CAAC;AAC3D,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,YAAY,GACb,MAAM,yBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAAuB,CAAC;AAC3E,YAAY,EAAE,uBAAuB,EAAE,MAAM,0BAAuB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RtpPayload } from '../types.js';
|
|
2
|
+
export interface MakeRtpPayloadOverrides extends Partial<Omit<RtpPayload, 'type' | 'payer' | 'payee' | 'expiresAt'>> {
|
|
3
|
+
payer?: Partial<RtpPayload['payer']>;
|
|
4
|
+
payee?: Partial<RtpPayload['payee']>;
|
|
5
|
+
/** Milliseconds from `now` until expiry (negative = already expired). */
|
|
6
|
+
expiresInMs?: number;
|
|
7
|
+
/** Base time to compute expiry from. Defaults to Date.now(). */
|
|
8
|
+
from?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Build a valid RTP payload for tests, fixtures and the example app.
|
|
12
|
+
* Every field is overridable so edge cases are trivial to express.
|
|
13
|
+
*/
|
|
14
|
+
export declare function makeRtpPayload(overrides?: MakeRtpPayloadOverrides): RtpPayload;
|
|
15
|
+
/** A payload that has already expired. */
|
|
16
|
+
export declare function makeExpiredPayload(overrides?: MakeRtpPayloadOverrides): RtpPayload;
|
|
17
|
+
//# sourceMappingURL=makeRtpPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeRtpPayload.d.ts","sourceRoot":"","sources":["../../../../src/mock/makeRtpPayload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAU,CAAC;AAO3C,MAAM,WAAW,uBAAwB,SAAQ,OAAO,CACtD,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,CAAC,CAC3D;IACC,KAAK,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACrC,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,SAAS,GAAE,uBAA4B,GACtC,UAAU,CAkCZ;AAED,0CAA0C;AAC1C,wBAAgB,kBAAkB,CAChC,SAAS,GAAE,uBAA4B,GACtC,UAAU,CAEZ"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { RtpTransport } from '../types.js';
|
|
2
|
+
export interface MockTransportOptions {
|
|
3
|
+
/** Simulated network latency in ms. */
|
|
4
|
+
latencyMs?: number;
|
|
5
|
+
/** Simulate a network failure on accept. */
|
|
6
|
+
failAccept?: boolean;
|
|
7
|
+
/** Simulate a network failure on decline. */
|
|
8
|
+
failDecline?: boolean;
|
|
9
|
+
/** Backend status to return for accept. */
|
|
10
|
+
acceptStatus?: 'ACCEPTED' | 'DECLINED' | 'FAILED';
|
|
11
|
+
}
|
|
12
|
+
export interface RecordedCall {
|
|
13
|
+
method: 'post' | 'get';
|
|
14
|
+
path: string;
|
|
15
|
+
body?: unknown;
|
|
16
|
+
headers?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
export interface MockTransport {
|
|
19
|
+
transport: RtpTransport;
|
|
20
|
+
/** Recorded calls, for assertions in tests and the example app. */
|
|
21
|
+
calls: RecordedCall[];
|
|
22
|
+
/** Clear recorded calls. */
|
|
23
|
+
reset: () => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Deterministic in-memory transport. No real network calls are made.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createMockTransport(options?: MockTransportOptions): MockTransport;
|
|
29
|
+
//# sourceMappingURL=mockTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockTransport.d.ts","sourceRoot":"","sources":["../../../../src/mock/mockTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,YAAY,EAAE,MAAM,aAAU,CAAC;AAE9D,MAAM,WAAW,oBAAoB;IACnC,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;CACnD;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,YAAY,CAAC;IACxB,mEAAmE;IACnE,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAOD;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,oBAAyB,GACjC,aAAa,CAgEf"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { RtpPayload } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* A generic push notification envelope.
|
|
4
|
+
*
|
|
5
|
+
* The SDK does not know or care what a push looks like — every host platform
|
|
6
|
+
* has a different shape, and this is the single seam where that difference is
|
|
7
|
+
* absorbed. A Kotlin/Swift integration implements the equivalent of
|
|
8
|
+
* `mapPushToRtp` against the same `RtpPayload` contract.
|
|
9
|
+
*/
|
|
10
|
+
export interface PushEnvelope {
|
|
11
|
+
id?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
message?: string;
|
|
14
|
+
foreground?: boolean;
|
|
15
|
+
/** RTCP `onRemoteNotification` style payload. */
|
|
16
|
+
data?: Record<string, unknown>;
|
|
17
|
+
/** RTCP `onNotificationTapped` flattens the body to the top level. */
|
|
18
|
+
body?: string;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Extract an RTP payload from a push envelope, or return null if the push is
|
|
23
|
+
* not an RTP request.
|
|
24
|
+
*
|
|
25
|
+
* RTCP delivers two distinct shapes for the same notification:
|
|
26
|
+
*
|
|
27
|
+
* 1. `onRemoteNotification` (foreground/background):
|
|
28
|
+
* `{ data: { app_data: { type: 'RTP', ... } } }`
|
|
29
|
+
*
|
|
30
|
+
* 2. `onNotificationTapped`: scalars are stringified and the custom payload
|
|
31
|
+
* arrives as a JSON string:
|
|
32
|
+
* `{ data: { app_data: '{"type":"RTP",...}' } }`
|
|
33
|
+
*
|
|
34
|
+
* Both are normalized here so callers only ever deal with `RtpPayload`.
|
|
35
|
+
*
|
|
36
|
+
* `getData` is injectable so hosts that expose push data differently (e.g. a
|
|
37
|
+
* Map-like object on native) can plug in their accessor without changing the
|
|
38
|
+
* rest of the SDK.
|
|
39
|
+
*/
|
|
40
|
+
export declare function mapPushToRtp(envelope: PushEnvelope | null | undefined, getData?: (envelope: PushEnvelope) => Record<string, unknown> | undefined): RtpPayload | null;
|
|
41
|
+
//# sourceMappingURL=push.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../src/push.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAE1C;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,EACzC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACxE,UAAU,GAAG,IAAI,CAenB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { RtpClient, RtpCredential, RtpRequest, RtpResult } from '../types.js';
|
|
3
|
+
import type { RtpStatus } from '../constants.js';
|
|
4
|
+
/**
|
|
5
|
+
* A minimal persistence port for the provider. The host supplies its own
|
|
6
|
+
* storage (e.g. react-native-default-preference / AsyncStorage) so the SDK
|
|
7
|
+
* stays dependency-free. When omitted, persistence is in-memory only.
|
|
8
|
+
*/
|
|
9
|
+
export interface RtpProviderStorage {
|
|
10
|
+
getItem: (key: string) => Promise<string | null> | string | null;
|
|
11
|
+
setItem: (key: string, value: string) => Promise<void> | void;
|
|
12
|
+
removeItem: (key: string) => Promise<void> | void;
|
|
13
|
+
}
|
|
14
|
+
export interface RtpProviderProps {
|
|
15
|
+
/** The client created via `createRtpClient`. */
|
|
16
|
+
client: RtpClient;
|
|
17
|
+
/** Whether the user is currently authenticated. Drives the auth gate. */
|
|
18
|
+
isAuthenticated: boolean;
|
|
19
|
+
/** Optional persistence used to survive cold starts / logged-out flows. */
|
|
20
|
+
storage?: RtpProviderStorage;
|
|
21
|
+
/**
|
|
22
|
+
* Called with the raw decoded payload before it is fed to the client.
|
|
23
|
+
* Use this to persist the payload yourself, log it, etc.
|
|
24
|
+
*/
|
|
25
|
+
onIncomingPayload?: (payload: unknown) => void;
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
export interface RtpContextValue {
|
|
29
|
+
/** The active request, if any. */
|
|
30
|
+
request: RtpRequest | null;
|
|
31
|
+
/** The active request's normalized status. */
|
|
32
|
+
status: RtpStatus | null;
|
|
33
|
+
/** True when a request is ready for the user to act on. */
|
|
34
|
+
isReady: boolean;
|
|
35
|
+
/** Accept the active request with an opaque credential. */
|
|
36
|
+
accept: (credential?: RtpCredential) => Promise<RtpResult | undefined>;
|
|
37
|
+
/** Decline the active request. */
|
|
38
|
+
decline: (reason?: string) => Promise<RtpResult | undefined>;
|
|
39
|
+
/** Dismiss the active request from the UI. */
|
|
40
|
+
dismiss: () => void;
|
|
41
|
+
/** Feed a raw decoded payload into the client (for host push adapters). */
|
|
42
|
+
receive: (payload: unknown) => void;
|
|
43
|
+
/** Last terminal result, for rendering feedback. */
|
|
44
|
+
lastResult: RtpResult | null;
|
|
45
|
+
}
|
|
46
|
+
export declare const RtpContext: React.Context<RtpContextValue | null>;
|
|
47
|
+
/**
|
|
48
|
+
* Bridges the framework-agnostic RTP client into React. Owns no UI — hosts
|
|
49
|
+
* render their own bottom sheet / modal and react to `request` + `status`.
|
|
50
|
+
*/
|
|
51
|
+
export declare function RtpProvider({ client, isAuthenticated, storage, onIncomingPayload, children, }: RtpProviderProps): React.JSX.Element;
|
|
52
|
+
/**
|
|
53
|
+
* Access the RTP context. Throws when used outside of an `<RtpProvider>`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function useRtp(): RtpContextValue;
|
|
56
|
+
//# sourceMappingURL=RtpProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RtpProvider.d.ts","sourceRoot":"","sources":["../../../../src/react/RtpProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAU,CAAC;AAEhF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAc,CAAC;AAI9C;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;IACjE,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC9D,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACnD;AAED,MAAM,WAAW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
|
|
5
|
+
* IMPORTANT: this is the *decoded* payload, not a push notification envelope.
|
|
6
|
+
* Each host platform is responsible for mapping its own push shape (RTCP,
|
|
7
|
+
* raw FCM, APNs, etc.) into this structure via an adapter. This keeps the SDK
|
|
8
|
+
* portable across React Native, Kotlin and Swift.
|
|
9
|
+
*/
|
|
10
|
+
export interface RtpPayload {
|
|
11
|
+
/** Payload schema version. Unknown fields must be ignored, not rejected. */
|
|
12
|
+
version?: string;
|
|
13
|
+
/** Discriminator. Only `'RTP'` payloads are handled by this SDK. */
|
|
14
|
+
type: 'RTP';
|
|
15
|
+
/** Stable, unique id for the request (idempotency key). */
|
|
16
|
+
rtpId: string;
|
|
17
|
+
/** Amount in the currency's minor unit (e.g. kobo). Integer to avoid floats. */
|
|
18
|
+
amount: number;
|
|
19
|
+
/** ISO 4217 currency code. e.g. "NGN". */
|
|
20
|
+
currency: string;
|
|
21
|
+
/** Party being asked to pay. */
|
|
22
|
+
payer: RtpParty;
|
|
23
|
+
/** Party that will receive the money. */
|
|
24
|
+
payee: RtpParty;
|
|
25
|
+
/** Human-readable reason for the request. */
|
|
26
|
+
narration?: string;
|
|
27
|
+
/** Backend reference for the transaction. */
|
|
28
|
+
transactionRef?: string;
|
|
29
|
+
/** ISO 8601 timestamp after which the request can no longer be actioned. */
|
|
30
|
+
expiresAt: string;
|
|
31
|
+
/** Alias (phone/email) the request is addressed to, for identity matching. */
|
|
32
|
+
recipient?: string;
|
|
33
|
+
/** Arbitrary passthrough data. Ignored by the SDK. */
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
}
|
|
36
|
+
/** A party on either side of a request (payer or payee). */
|
|
37
|
+
export interface RtpParty {
|
|
38
|
+
name: string;
|
|
39
|
+
accountNumber?: string;
|
|
40
|
+
bank?: string;
|
|
41
|
+
/** Optional display URL for a logo/avatar. */
|
|
42
|
+
logoUrl?: string;
|
|
43
|
+
}
|
|
44
|
+
/** A normalized, validated request held by the SDK. */
|
|
45
|
+
export interface RtpRequest {
|
|
46
|
+
id: string;
|
|
47
|
+
amount: number;
|
|
48
|
+
currency: string;
|
|
49
|
+
payer: RtpParty;
|
|
50
|
+
payee: RtpParty;
|
|
51
|
+
narration?: string;
|
|
52
|
+
transactionRef?: string;
|
|
53
|
+
expiresAt: string;
|
|
54
|
+
recipient?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Credential produced by the host platform to authorise an accept.
|
|
58
|
+
* The SDK never inspects this — it is opaque and forwarded to the backend.
|
|
59
|
+
*
|
|
60
|
+
* For React Native this is typically `{ secureData, pinBlock, authData }`
|
|
61
|
+
* produced by the app's card/PIN service.
|
|
62
|
+
*/
|
|
63
|
+
export type RtpCredential = Record<string, unknown>;
|
|
64
|
+
export interface RtpResult {
|
|
65
|
+
id: string;
|
|
66
|
+
status: RtpStatus;
|
|
67
|
+
error?: RtpError | string;
|
|
68
|
+
data?: unknown;
|
|
69
|
+
}
|
|
70
|
+
/** Outcome of feeding a raw payload into the client. */
|
|
71
|
+
export interface RtpReceiveOutcome {
|
|
72
|
+
/** False when the payload was not an RTP payload. */
|
|
73
|
+
handled: boolean;
|
|
74
|
+
request?: RtpRequest;
|
|
75
|
+
status?: RtpStatus;
|
|
76
|
+
error?: RtpError | string;
|
|
77
|
+
}
|
|
78
|
+
export interface RtpHttpResponse<T = any> {
|
|
79
|
+
data?: T;
|
|
80
|
+
status?: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Minimal HTTP contract. Hosts inject an implementation backed by their own
|
|
84
|
+
* client (`ky`, `axios`, native, ...). The SDK never imports a network library.
|
|
85
|
+
*/
|
|
86
|
+
export interface RtpTransport {
|
|
87
|
+
post: <T = any>(path: string, body?: unknown, headers?: Record<string, string>) => Promise<RtpHttpResponse<T>>;
|
|
88
|
+
get: <T = any>(path: string, headers?: Record<string, string>) => Promise<RtpHttpResponse<T>>;
|
|
89
|
+
}
|
|
90
|
+
/** Key/value storage for persistence across cold starts and auth gates. */
|
|
91
|
+
export interface RtpStorage {
|
|
92
|
+
getItem: (key: string) => Promise<string | null> | string | null;
|
|
93
|
+
setItem: (key: string, value: string) => Promise<void> | void;
|
|
94
|
+
removeItem: (key: string) => Promise<void> | void;
|
|
95
|
+
}
|
|
96
|
+
export interface RtpClientOptions {
|
|
97
|
+
/** Injected HTTP client. */
|
|
98
|
+
transport: RtpTransport;
|
|
99
|
+
/**
|
|
100
|
+
* Returns auth headers for an outgoing request. Called per request so the
|
|
101
|
+
* host can refresh tokens / compute MACs.
|
|
102
|
+
*/
|
|
103
|
+
getAuthHeaders?: () => Promise<Record<string, string>> | Record<string, string>;
|
|
104
|
+
/**
|
|
105
|
+
* Returns the currently authenticated user's alias (phone/email), or null
|
|
106
|
+
* when logged out. Used for the auth gate and recipient matching.
|
|
107
|
+
*/
|
|
108
|
+
getCurrentUser?: () => string | null | undefined;
|
|
109
|
+
/** Injectable clock (ms since epoch) for deterministic expiry tests. */
|
|
110
|
+
now?: () => number;
|
|
111
|
+
/** Optional sink for diagnostics. */
|
|
112
|
+
logger?: (...args: unknown[]) => void;
|
|
113
|
+
/** Endpoint base path for RTP routes. Defaults to `/rtp`. */
|
|
114
|
+
basePath?: string;
|
|
115
|
+
}
|
|
116
|
+
export type RtpUnsubscribe = () => void;
|
|
117
|
+
export interface RtpEventMap {
|
|
118
|
+
request: (request: RtpRequest) => void;
|
|
119
|
+
state: (event: {
|
|
120
|
+
id: string;
|
|
121
|
+
status: RtpStatus;
|
|
122
|
+
}) => void;
|
|
123
|
+
result: (result: RtpResult) => void;
|
|
124
|
+
}
|
|
125
|
+
export interface RtpClient {
|
|
126
|
+
isRtp: (payload: unknown) => payload is RtpPayload;
|
|
127
|
+
receive: (payload: unknown) => Promise<RtpReceiveOutcome>;
|
|
128
|
+
resumeAuth: () => void;
|
|
129
|
+
accept: (params: {
|
|
130
|
+
id: string;
|
|
131
|
+
credential?: RtpCredential;
|
|
132
|
+
}) => Promise<RtpResult>;
|
|
133
|
+
decline: (params: {
|
|
134
|
+
id: string;
|
|
135
|
+
reason?: string;
|
|
136
|
+
}) => Promise<RtpResult>;
|
|
137
|
+
getStatus: (id: string) => RtpStatus | undefined;
|
|
138
|
+
getRequest: (id: string) => RtpRequest | undefined;
|
|
139
|
+
acknowledge: (id: string) => void;
|
|
140
|
+
on: <E extends keyof RtpEventMap>(event: E, handler: RtpEventMap[E]) => RtpUnsubscribe;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,gBAAa,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,IAAI,EAAE,KAAK,CAAC;IACZ,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,KAAK,EAAE,QAAQ,CAAC;IAChB,yCAAyC;IACzC,KAAK,EAAE,QAAQ,CAAC;IAChB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,4DAA4D;AAC5D,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CA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AE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,CAAA;KAAE,KAAK,IAAI,CAAC;IAC1D,MAAM,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,IAAI,UAAU,CAAC;IACnD,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC1D,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,EAAE,CAAC,MAAM,EAAE;QACf,EAAE,EAAE,MAAM,CAAC;QACX,UAAU,CAAC,EAAE,aAAa,CAAC;KAC5B,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IACzB,OAAO,EAAE,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IACzE,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,SAAS,GAAG,SAAS,CAAC;IACjD,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,CAAC;IACnD,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,EAAE,EAAE,CAAC,CAAC,SAAS,MAAM,WAAW,EAC9B,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,KACpB,cAAc,CAAC;CACrB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RtpPayload, RtpRequest } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Type guard for RTP payloads.
|
|
4
|
+
*
|
|
5
|
+
* NOTE: this intentionally inspects the *decoded* payload, not a push
|
|
6
|
+
* envelope. Hosts are responsible for extracting the payload from their own
|
|
7
|
+
* notification system first.
|
|
8
|
+
*
|
|
9
|
+
* `amount` is accepted as either a number (minor units) or a numeric string,
|
|
10
|
+
* because push payloads frequently stringify scalars in transit.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isRtpPayload(payload: unknown): payload is RtpPayload;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the list of missing/invalid required fields. Empty array means the
|
|
15
|
+
* payload is structurally valid.
|
|
16
|
+
*/
|
|
17
|
+
export declare function findValidationErrors(payload: RtpPayload): string[];
|
|
18
|
+
/** Map a validated payload into the normalized request held by the SDK. */
|
|
19
|
+
export declare function toRtpRequest(payload: RtpPayload): RtpRequest;
|
|
20
|
+
/** Pure expiry check. Re-evaluated on every transition, not just on receive. */
|
|
21
|
+
export declare function isExpired(request: RtpRequest, now: number): boolean;
|
|
22
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,UAAU,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAYhE;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,UAAU,CAMpE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,EAAE,CAyBlE;AAWD,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU,CAY5D;AAED,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAMnE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,143 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inno-isw/react-native-rtp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Request to Pay SDK for React Native",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"react-native-rtp-source": "./src/index.tsx",
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"android",
|
|
19
|
+
"ios",
|
|
20
|
+
"cpp",
|
|
21
|
+
"*.podspec",
|
|
22
|
+
"react-native.config.js",
|
|
23
|
+
"!ios/build",
|
|
24
|
+
"!android/build",
|
|
25
|
+
"!android/gradle",
|
|
26
|
+
"!android/gradlew",
|
|
27
|
+
"!android/gradlew.bat",
|
|
28
|
+
"!android/local.properties",
|
|
29
|
+
"!**/__tests__",
|
|
30
|
+
"!**/__fixtures__",
|
|
31
|
+
"!**/__mocks__",
|
|
32
|
+
"!**/.*"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"example": "yarn workspace react-native-rtp-example",
|
|
36
|
+
"clean": "del-cli lib",
|
|
37
|
+
"prepare": "bob build",
|
|
38
|
+
"typecheck": "tsc",
|
|
39
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
40
|
+
"test": "jest"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"react-native",
|
|
44
|
+
"ios",
|
|
45
|
+
"android",
|
|
46
|
+
"request-to-pay",
|
|
47
|
+
"rtp",
|
|
48
|
+
"payments"
|
|
49
|
+
],
|
|
50
|
+
"author": "Michael Chinweike",
|
|
51
|
+
"license": "MIT",
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"registry": "https://registry.npmjs.org/",
|
|
54
|
+
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@commitlint/config-conventional": "^21.2.0",
|
|
58
|
+
"@eslint/compat": "^2.1.0",
|
|
59
|
+
"@eslint/eslintrc": "^3.3.6",
|
|
60
|
+
"@eslint/js": "^9.39.5",
|
|
61
|
+
"@jest/globals": "^29.7.0",
|
|
62
|
+
"@react-native/babel-preset": "0.86.2",
|
|
63
|
+
"@react-native/eslint-config": "0.86.2",
|
|
64
|
+
"@react-native/jest-preset": "0.86.2",
|
|
65
|
+
"@types/react": "^19.2.0",
|
|
66
|
+
"commitlint": "^21.2.1",
|
|
67
|
+
"del-cli": "^7.0.0",
|
|
68
|
+
"eslint": "^9.39.5",
|
|
69
|
+
"eslint-config-prettier": "^10.1.8",
|
|
70
|
+
"eslint-plugin-ft-flow": "^3.0.11",
|
|
71
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
72
|
+
"jest": "^29.7.0",
|
|
73
|
+
"lefthook": "^2.1.10",
|
|
74
|
+
"prettier": "^3.9.6",
|
|
75
|
+
"react": "19.2.3",
|
|
76
|
+
"react-native": "0.86.3",
|
|
77
|
+
"react-native-builder-bob": "^0.43.2",
|
|
78
|
+
"turbo": "^2.10.8",
|
|
79
|
+
"typescript": "^6.0.3"
|
|
80
|
+
},
|
|
81
|
+
"peerDependencies": {
|
|
82
|
+
"react": "*",
|
|
83
|
+
"react-native": "*"
|
|
84
|
+
},
|
|
85
|
+
"workspaces": [
|
|
86
|
+
"example"
|
|
87
|
+
],
|
|
88
|
+
"packageManager": "yarn@4.11.0",
|
|
89
|
+
"react-native-builder-bob": {
|
|
90
|
+
"source": "src",
|
|
91
|
+
"output": "lib",
|
|
92
|
+
"targets": [
|
|
93
|
+
[
|
|
94
|
+
"module",
|
|
95
|
+
{
|
|
96
|
+
"esm": true
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
[
|
|
100
|
+
"typescript",
|
|
101
|
+
{
|
|
102
|
+
"project": "tsconfig.build.json"
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"prettier": {
|
|
108
|
+
"quoteProps": "consistent",
|
|
109
|
+
"singleQuote": true,
|
|
110
|
+
"tabWidth": 2,
|
|
111
|
+
"trailingComma": "es5",
|
|
112
|
+
"useTabs": false
|
|
113
|
+
},
|
|
114
|
+
"jest": {
|
|
115
|
+
"preset": "@react-native/jest-preset",
|
|
116
|
+
"testEnvironmentOptions": {
|
|
117
|
+
"customExportConditions": [
|
|
118
|
+
"require",
|
|
119
|
+
"react-native",
|
|
120
|
+
"react-native-rtp-source"
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"modulePathIgnorePatterns": [
|
|
124
|
+
"<rootDir>/example/node_modules",
|
|
125
|
+
"<rootDir>/lib/"
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
"commitlint": {
|
|
129
|
+
"extends": [
|
|
130
|
+
"@commitlint/config-conventional"
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
"create-react-native-library": {
|
|
134
|
+
"type": "library",
|
|
135
|
+
"languages": "js",
|
|
136
|
+
"tools": [
|
|
137
|
+
"eslint",
|
|
138
|
+
"jest",
|
|
139
|
+
"lefthook"
|
|
140
|
+
],
|
|
141
|
+
"version": "0.63.1"
|
|
142
|
+
}
|
|
143
|
+
}
|