@savers_app/react-native-sdk 1.2.3 → 1.2.5
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/README.md +51 -27
- package/lib/module/core/runtime.js +3 -0
- package/lib/module/core/runtime.js.map +1 -1
- package/lib/module/data/models/tokenModel.js +25 -0
- package/lib/module/data/models/tokenModel.js.map +1 -0
- package/lib/module/data/network/apiClient.js +2 -2
- package/lib/module/data/network/apiClient.js.map +1 -1
- package/lib/module/data/network/apiEndpoints.js +2 -1
- package/lib/module/data/network/apiEndpoints.js.map +1 -1
- package/lib/module/data/network/apiRepository.js +20 -6
- package/lib/module/data/network/apiRepository.js.map +1 -1
- package/lib/module/data/network/apiService.js +36 -0
- package/lib/module/data/network/apiService.js.map +1 -1
- package/lib/module/data/network/interceptors/authInterceptor.js +6 -3
- package/lib/module/data/network/interceptors/authInterceptor.js.map +1 -1
- package/lib/module/data/storage/reactRefManager.js +22 -0
- package/lib/module/data/storage/reactRefManager.js.map +1 -0
- package/lib/module/services/navigation/goBackNavigation.js +5 -7
- package/lib/module/services/navigation/goBackNavigation.js.map +1 -1
- package/lib/module/services/url/urlGenerator.js +7 -3
- package/lib/module/services/url/urlGenerator.js.map +1 -1
- package/lib/module/services/webview/messageHandler.js +5 -2
- package/lib/module/services/webview/messageHandler.js.map +1 -1
- package/lib/module/utils/config.js +34 -0
- package/lib/module/utils/config.js.map +1 -0
- package/lib/typescript/src/core/runtime.d.ts +1 -0
- package/lib/typescript/src/core/runtime.d.ts.map +1 -1
- package/lib/typescript/src/data/models/tokenModel.d.ts +15 -0
- package/lib/typescript/src/data/models/tokenModel.d.ts.map +1 -0
- package/lib/typescript/src/data/network/apiEndpoints.d.ts +2 -1
- package/lib/typescript/src/data/network/apiEndpoints.d.ts.map +1 -1
- package/lib/typescript/src/data/network/apiRepository.d.ts +2 -0
- package/lib/typescript/src/data/network/apiRepository.d.ts.map +1 -1
- package/lib/typescript/src/data/network/apiService.d.ts +6 -0
- package/lib/typescript/src/data/network/apiService.d.ts.map +1 -1
- package/lib/typescript/src/data/network/interceptors/authInterceptor.d.ts +2 -0
- package/lib/typescript/src/data/network/interceptors/authInterceptor.d.ts.map +1 -1
- package/lib/typescript/src/data/storage/reactRefManager.d.ts +11 -0
- package/lib/typescript/src/data/storage/reactRefManager.d.ts.map +1 -0
- package/lib/typescript/src/services/navigation/goBackNavigation.d.ts +0 -1
- package/lib/typescript/src/services/navigation/goBackNavigation.d.ts.map +1 -1
- package/lib/typescript/src/services/url/urlGenerator.d.ts +1 -0
- package/lib/typescript/src/services/url/urlGenerator.d.ts.map +1 -1
- package/lib/typescript/src/services/webview/messageHandler.d.ts.map +1 -1
- package/lib/typescript/src/utils/config.d.ts +5 -0
- package/lib/typescript/src/utils/config.d.ts.map +1 -0
- package/package.json +8 -2
- package/src/core/runtime.ts +4 -0
- package/src/data/models/tokenModel.ts +43 -0
- package/src/data/network/apiClient.ts +2 -2
- package/src/data/network/apiEndpoints.ts +2 -1
- package/src/data/network/apiRepository.ts +30 -6
- package/src/data/network/apiService.ts +41 -0
- package/src/data/network/interceptors/authInterceptor.ts +12 -3
- package/src/data/storage/reactRefManager.ts +25 -0
- package/src/services/navigation/goBackNavigation.ts +6 -8
- package/src/services/url/urlGenerator.ts +9 -1
- package/src/services/webview/messageHandler.ts +5 -8
- package/src/utils/config.ts +35 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["injectedEnv","DEFAULT_ENVIRONMENT","ENV_URLS","sandbox","production","currentEnvironment","BASE_URL","setEnvironment","env","getEnvironment","getBaseUrl"],"sourceRoot":"../../../src","sources":["utils/config.ts"],"mappings":";;AAAA;;AAIA;AACA,MAAMA,WAAW,GAAG,YAAsB;AAC1C,MAAMC,mBAAgC,GACpCD,WAAW,KAAK,YAAY,GAAG,YAAY,GAAG,SAAS;AAEzD,MAAME,QAAqC,GAAG;EAC5CC,OAAO,EAAE,8BAA8B;EACvCC,UAAU,EAAE;AACd,CAAC;;AAED;AACA,IAAIC,kBAA+B,GAAGJ,mBAAmB;;AAEzD;AACA,IAAIK,QAAgB,GAAGJ,QAAQ,CAACG,kBAAkB,CAAC;;AAEnD;AACA,OAAO,MAAME,cAAc,GAAIC,GAAgB,IAAK;EAClDH,kBAAkB,GAAGG,GAAG;EACxBF,QAAQ,GAAGJ,QAAQ,CAACM,GAAG,CAAC;AAC1B,CAAC;;AAED;AACA,OAAO,MAAMC,cAAc,GAAGA,CAAA,KAAmB;EAC/C,OAAOJ,kBAAkB;AAC3B,CAAC;;AAED;AACA,OAAO,MAAMK,UAAU,GAAGA,CAAA,KAAc;EACtC,OAAOJ,QAAQ;AACjB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/core/runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/core/runtime.ts"],"names":[],"mappings":"AAiBA,wBAAgB,aAAa,CAAC,YAAY,EAAE;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,GAAG,CAAC;CACpB,QAwDA;AAED,eAAO,MAAM,YAAY;;CAExB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type TokenResponse = {
|
|
2
|
+
token?: string | null;
|
|
3
|
+
statusCode?: number | null;
|
|
4
|
+
error?: string | null;
|
|
5
|
+
messages?: string[] | null;
|
|
6
|
+
};
|
|
7
|
+
export declare function tokenResponseFromJson(json: any): TokenResponse;
|
|
8
|
+
export declare const token: (d?: TokenResponse | null) => string | null;
|
|
9
|
+
export declare const hasToken: (d?: TokenResponse | null) => boolean;
|
|
10
|
+
export declare const isValid: (d?: TokenResponse | null) => boolean;
|
|
11
|
+
export declare const status: (d?: TokenResponse | null) => number | null;
|
|
12
|
+
export declare const error: (d?: TokenResponse | null) => string | null;
|
|
13
|
+
export declare const messages: (d?: TokenResponse | null) => string[] | null;
|
|
14
|
+
export declare const hasError: (d?: TokenResponse | null) => boolean;
|
|
15
|
+
//# sourceMappingURL=tokenModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenModel.d.ts","sourceRoot":"","sources":["../../../../../src/data/models/tokenModel.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,GAAG,aAAa,CAqB9D;AAED,eAAO,MAAM,KAAK,GAAI,IAAI,aAAa,GAAG,IAAI,KAAG,MAAM,GAAG,IACxC,CAAC;AACnB,eAAO,MAAM,QAAQ,GAAI,IAAI,aAAa,GAAG,IAAI,KAAG,OAChB,CAAC;AACrC,eAAO,MAAM,OAAO,GAAI,IAAI,aAAa,GAAG,IAAI,KAAG,OAAsB,CAAC;AAC1E,eAAO,MAAM,MAAM,GAAI,IAAI,aAAa,GAAG,IAAI,KAAG,MAAM,GAAG,IACpC,CAAC;AACxB,eAAO,MAAM,KAAK,GAAI,IAAI,aAAa,GAAG,IAAI,KAAG,MAAM,GAAG,IACxC,CAAC;AACnB,eAAO,MAAM,QAAQ,GAAI,IAAI,aAAa,GAAG,IAAI,KAAG,MAAM,EAAE,GAAG,IAC1C,CAAC;AACtB,eAAO,MAAM,QAAQ,GAAI,IAAI,aAAa,GAAG,IAAI,KAAG,OACqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiEndpoints.d.ts","sourceRoot":"","sources":["../../../../../src/data/network/apiEndpoints.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"apiEndpoints.d.ts","sourceRoot":"","sources":["../../../../../src/data/network/apiEndpoints.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;CAGf,CAAC"}
|
|
@@ -13,6 +13,8 @@ export declare class ApiRepository {
|
|
|
13
13
|
cacheStrategy?: CacheStrategy;
|
|
14
14
|
params?: Record<string, any>;
|
|
15
15
|
storageKeyPrefix?: string;
|
|
16
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
17
|
+
body?: any;
|
|
16
18
|
}): AsyncGenerator<ApiResponse<T | null>, void, unknown>;
|
|
17
19
|
private fetchFromNetwork;
|
|
18
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiRepository.d.ts","sourceRoot":"","sources":["../../../../../src/data/network/apiRepository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AASzD,oBAAY,aAAa;IACvB,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,SAAS,EAAE,SAAS;IAIzB,OAAO,CAAC,CAAC,EACd,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE;QACL,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"apiRepository.d.ts","sourceRoot":"","sources":["../../../../../src/data/network/apiRepository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AASzD,oBAAY,aAAa;IACvB,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,SAAS,EAAE,SAAS;IAIzB,OAAO,CAAC,CAAC,EACd,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE;QACL,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;QAC3C,IAAI,CAAC,EAAE,GAAG,CAAC;KACZ,GACA,cAAc,CAAC,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC;YAgEzC,gBAAgB;CA6B/B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ApiResponse } from '../models/apiResponse';
|
|
2
2
|
import { type OnBoardingData } from '../models/onboardingModel';
|
|
3
|
+
import { type TokenResponse } from '../models/tokenModel';
|
|
3
4
|
import { CacheStrategy } from './apiRepository';
|
|
4
5
|
import { Environment } from './apiClient';
|
|
5
6
|
export declare class ApiService {
|
|
@@ -11,6 +12,11 @@ export declare class ApiService {
|
|
|
11
12
|
getOnBoarding(opts?: {
|
|
12
13
|
cacheStrategy?: CacheStrategy;
|
|
13
14
|
}): AsyncGenerator<ApiResponse<OnBoardingData | null>, void, unknown>;
|
|
15
|
+
getNonce({ cacheStrategy, extUserId, partnerCode, }: {
|
|
16
|
+
cacheStrategy?: CacheStrategy | undefined;
|
|
17
|
+
extUserId?: string | undefined;
|
|
18
|
+
partnerCode?: string | undefined;
|
|
19
|
+
}): AsyncGenerator<TokenResponse, void, unknown>;
|
|
14
20
|
/**
|
|
15
21
|
* Clear all cached data
|
|
16
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiService.d.ts","sourceRoot":"","sources":["../../../../../src/data/network/apiService.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"apiService.d.ts","sourceRoot":"","sources":["../../../../../src/data/network/apiService.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,sBAAsB,CAAC;AAO9B,OAAO,EAAiB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAa,MAAM,aAAa,CAAC;AAErD,qBAAa,UAAU;IACrB,OAAO,CAAC,UAAU,CAAgB;gBAEtB,WAAW,GAAE,WAAoC;IAM7D;;OAEG;IACI,aAAa,CAAC,IAAI,CAAC,EAAE;QAC1B,aAAa,CAAC,EAAE,aAAa,CAAC;KAC/B,GAAG,cAAc,CAAC,WAAW,CAAC,cAAc,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC;IAgC9D,QAAQ,CAAC,EACd,aAAqC,EACrC,SAAc,EACd,WAAgB,GACjB;;;;KAAA,GAAG,cAAc,CAAC,aAAa,EAAE,IAAI,EAAE,OAAO,CAAC;IAiChD;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAIlC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare class AuthInterceptor {
|
|
2
|
+
private static readonly xApiKey;
|
|
2
3
|
private static readonly oauthSubIdKey;
|
|
3
4
|
private static readonly bodyMethods;
|
|
4
5
|
private static readonly excludedApis;
|
|
@@ -7,6 +8,7 @@ export declare class AuthInterceptor {
|
|
|
7
8
|
private addToQueryParameters;
|
|
8
9
|
private addToQueryParametersAndBody;
|
|
9
10
|
private addToRequestBody;
|
|
11
|
+
private addApiKeyHeader;
|
|
10
12
|
private shouldExcludeApi;
|
|
11
13
|
private getCurrentUserId;
|
|
12
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authInterceptor.d.ts","sourceRoot":"","sources":["../../../../../../src/data/network/interceptors/authInterceptor.ts"],"names":[],"mappings":"AAKA,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAgB;IACrD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAqC;IACxE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAqB;IAEnD,SAAS,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"authInterceptor.d.ts","sourceRoot":"","sources":["../../../../../../src/data/network/interceptors/authInterceptor.ts"],"names":[],"mappings":"AAKA,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAe;IAC9C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAgB;IACrD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAqC;IACxE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAqB;IAEnD,SAAS,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAuB3C,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,2BAA2B;IAKnC,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,gBAAgB;YAUV,gBAAgB;CAQ/B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare class ReactRefManager {
|
|
2
|
+
private ref;
|
|
3
|
+
setRef(ref: any): void;
|
|
4
|
+
getRef(): any | null;
|
|
5
|
+
}
|
|
6
|
+
export declare const reactRefManager: ReactRefManager;
|
|
7
|
+
export declare const setReactRef: (ref: any) => Promise<void>;
|
|
8
|
+
export declare function getReactRef(): Promise<any | null>;
|
|
9
|
+
export declare function getReactRefSync(): any | null;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=reactRefManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactRefManager.d.ts","sourceRoot":"","sources":["../../../../../src/data/storage/reactRefManager.ts"],"names":[],"mappings":"AAAA,cAAM,eAAe;IACnB,OAAO,CAAC,GAAG,CAAoB;IAE/B,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI;IAItB,MAAM,IAAI,GAAG,GAAG,IAAI;CAGrB;AAED,eAAO,MAAM,eAAe,iBAAwB,CAAC;AAErD,eAAO,MAAM,WAAW,GAAU,KAAK,GAAG,KAAG,OAAO,CAAC,IAAI,CAExD,CAAC;AAEF,wBAAsB,WAAW,IAAI,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAEvD;AAED,wBAAgB,eAAe,IAAI,GAAG,GAAG,IAAI,CAE5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goBackNavigation.d.ts","sourceRoot":"","sources":["../../../../../src/services/navigation/goBackNavigation.ts"],"names":[],"mappings":"AAIA,wBAAgB,
|
|
1
|
+
{"version":3,"file":"goBackNavigation.d.ts","sourceRoot":"","sources":["../../../../../src/services/navigation/goBackNavigation.ts"],"names":[],"mappings":"AAIA,wBAAgB,kBAAkB,IAAI,OAAO,CAO5C;AAED,wBAAgB,sBAAsB,IAAI,IAAI,CAK7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlGenerator.d.ts","sourceRoot":"","sources":["../../../../../src/services/url/urlGenerator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"urlGenerator.d.ts","sourceRoot":"","sources":["../../../../../src/services/url/urlGenerator.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,SAAS,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AACvD,MAAM,MAAM,MAAM,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAA;CAAE,CAAC;AACjE,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IACf,EAAE,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,CAAC;AACtD,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AACF,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,GAAG;IAC9C,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAoCA;AAED,wBAAsB,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAwDlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageHandler.d.ts","sourceRoot":"","sources":["../../../../../src/services/webview/messageHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"messageHandler.d.ts","sourceRoot":"","sources":["../../../../../src/services/webview/messageHandler.ts"],"names":[],"mappings":"AAMA,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,QAsC3E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/utils/config.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,YAAY,CAAC;AAmBnD,eAAO,MAAM,cAAc,GAAI,KAAK,WAAW,SAG9C,CAAC;AAGF,eAAO,MAAM,cAAc,QAAO,WAEjC,CAAC;AAGF,eAAO,MAAM,UAAU,QAAO,MAE7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savers_app/react-native-sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Cross-platform React Native SDK exposing native features (maps, dial pad, browser), device ID/location and session utilities, a URL generator, and a WebView message bridge to trigger actions from web content.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"react-native": "./src/index.tsx",
|
|
@@ -37,6 +37,10 @@
|
|
|
37
37
|
"run:ios": "yarn workspace @saversapp/react-native-sdk-example ios",
|
|
38
38
|
"clean": "del-cli lib",
|
|
39
39
|
"prepare": "bob build",
|
|
40
|
+
"set:sandbox": "cross-env SDK_ENV=sandbox SDK_PACKAGE=@savers_app/react-native-sandbox-sdk node scripts/replace-config.js",
|
|
41
|
+
"set:production": "cross-env SDK_ENV=production SDK_PACKAGE=@savers_app/react-native-sdk node scripts/replace-config.js",
|
|
42
|
+
"prepare:sandbox": "yarn set:sandbox && yarn install && yarn prepare",
|
|
43
|
+
"prepare:production": "yarn set:production && yarn install && yarn prepare",
|
|
40
44
|
"typecheck": "tsc",
|
|
41
45
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
42
46
|
"test": "jest",
|
|
@@ -73,12 +77,13 @@
|
|
|
73
77
|
"@types/jest": "^29.5.14",
|
|
74
78
|
"@types/react": "^19.1.12",
|
|
75
79
|
"commitlint": "^19.8.1",
|
|
80
|
+
"cross-env": "^7.0.3",
|
|
76
81
|
"del-cli": "^6.0.0",
|
|
77
82
|
"eslint": "^9.35.0",
|
|
78
83
|
"eslint-config-prettier": "^10.1.8",
|
|
79
84
|
"eslint-plugin-prettier": "^5.5.4",
|
|
80
85
|
"jest": "^29.7.0",
|
|
81
|
-
"lefthook": "2.1.
|
|
86
|
+
"lefthook-darwin-arm64": "^2.1.3",
|
|
82
87
|
"prettier": "^3.8.1",
|
|
83
88
|
"react": "19.1.0",
|
|
84
89
|
"react-native": "0.81.5",
|
|
@@ -133,6 +138,7 @@
|
|
|
133
138
|
],
|
|
134
139
|
"moduleNameMapper": {
|
|
135
140
|
"^@savers_app/react-native-sdk$": "<rootDir>/src/index.tsx",
|
|
141
|
+
"^@savers_app/react-native-sandbox-sdk$": "<rootDir>/src/index.tsx",
|
|
136
142
|
"^react-native-device-info$": "<rootDir>/src/__mocks__/react-native-device-info.ts",
|
|
137
143
|
"^@react-native-community/geolocation$": "<rootDir>/src/__mocks__/@react-native-community__geolocation.ts",
|
|
138
144
|
"^@react-native-async-storage/async-storage$": "<rootDir>/src/__mocks__/@react-native-async-storage__async-storage.ts"
|
package/src/core/runtime.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
setAuthMode,
|
|
11
11
|
} from '../data/storage/keysManager';
|
|
12
12
|
import { getDeviceId } from '../data/storage/deviceIdManager';
|
|
13
|
+
import { setReactRef } from '../data/storage/reactRefManager';
|
|
13
14
|
|
|
14
15
|
// Services
|
|
15
16
|
// import { getDeviceLocation } from '../services/device/location';
|
|
@@ -19,6 +20,7 @@ export function initializeSDK(providedKeys: {
|
|
|
19
20
|
encryptionKey: string;
|
|
20
21
|
pRefCode: string;
|
|
21
22
|
authMode: string;
|
|
23
|
+
navigationRef: any;
|
|
22
24
|
}) {
|
|
23
25
|
const keys = providedKeys;
|
|
24
26
|
const missing: string[] = [];
|
|
@@ -26,6 +28,7 @@ export function initializeSDK(providedKeys: {
|
|
|
26
28
|
if (!keys.encryptionKey) missing.push('encryptionKey');
|
|
27
29
|
if (!keys.pRefCode) missing.push('pRefCode');
|
|
28
30
|
if (!keys.authMode) missing.push('authMode');
|
|
31
|
+
if (!keys.navigationRef) missing.push('navigationRef');
|
|
29
32
|
|
|
30
33
|
if (missing.length) {
|
|
31
34
|
const msg = `[SDK] Missing required keys: ${missing.join(', ')}`;
|
|
@@ -36,6 +39,7 @@ export function initializeSDK(providedKeys: {
|
|
|
36
39
|
setEncryptionKey(keys.encryptionKey);
|
|
37
40
|
setPRefCode(keys.pRefCode);
|
|
38
41
|
setAuthMode(keys.authMode);
|
|
42
|
+
setReactRef(keys.navigationRef);
|
|
39
43
|
|
|
40
44
|
getDeviceId()
|
|
41
45
|
.then((id) => {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type TokenResponse = {
|
|
2
|
+
token?: string | null;
|
|
3
|
+
statusCode?: number | null;
|
|
4
|
+
error?: string | null;
|
|
5
|
+
messages?: string[] | null;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function tokenResponseFromJson(json: any): TokenResponse {
|
|
9
|
+
const map = { ...(json as Record<string, any>) };
|
|
10
|
+
const token =
|
|
11
|
+
typeof map.token === 'string' && map.token.length > 0 ? map.token : null;
|
|
12
|
+
const statusCode =
|
|
13
|
+
typeof map.statusCode === 'number'
|
|
14
|
+
? map.statusCode
|
|
15
|
+
: typeof map.statusCode === 'string'
|
|
16
|
+
? Number(map.statusCode)
|
|
17
|
+
: null;
|
|
18
|
+
const error =
|
|
19
|
+
typeof map.error === 'string' && map.error.length > 0 ? map.error : null;
|
|
20
|
+
const messages = Array.isArray(map.message)
|
|
21
|
+
? (map.message.filter((m: any) => typeof m === 'string') as string[])
|
|
22
|
+
: null;
|
|
23
|
+
return {
|
|
24
|
+
token: token ?? null,
|
|
25
|
+
statusCode: statusCode ?? null,
|
|
26
|
+
error: error ?? null,
|
|
27
|
+
messages: messages && messages.length > 0 ? messages : null,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const token = (d?: TokenResponse | null): string | null =>
|
|
32
|
+
d?.token ?? null;
|
|
33
|
+
export const hasToken = (d?: TokenResponse | null): boolean =>
|
|
34
|
+
!!(d?.token && d.token.length > 0);
|
|
35
|
+
export const isValid = (d?: TokenResponse | null): boolean => hasToken(d);
|
|
36
|
+
export const status = (d?: TokenResponse | null): number | null =>
|
|
37
|
+
d?.statusCode ?? null;
|
|
38
|
+
export const error = (d?: TokenResponse | null): string | null =>
|
|
39
|
+
d?.error ?? null;
|
|
40
|
+
export const messages = (d?: TokenResponse | null): string[] | null =>
|
|
41
|
+
d?.messages ?? null;
|
|
42
|
+
export const hasError = (d?: TokenResponse | null): boolean =>
|
|
43
|
+
!!(d?.error || (d?.messages && d.messages.length > 0) || d?.statusCode);
|
|
@@ -17,8 +17,8 @@ export enum Environment {
|
|
|
17
17
|
|
|
18
18
|
export class ApiClient {
|
|
19
19
|
private static readonly baseUrls: Record<Environment, string> = {
|
|
20
|
-
[Environment.production]: 'https
|
|
21
|
-
[Environment.staging]: 'https
|
|
20
|
+
[Environment.production]: 'https://devapi.saversapp.com/clo/v1/',
|
|
21
|
+
[Environment.staging]: 'https://devapi.saversapp.com/clo/v1/',
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
private baseUrl: string;
|
|
@@ -31,13 +31,19 @@ export class ApiRepository {
|
|
|
31
31
|
cacheStrategy?: CacheStrategy;
|
|
32
32
|
params?: Record<string, any>;
|
|
33
33
|
storageKeyPrefix?: string;
|
|
34
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
35
|
+
body?: any;
|
|
34
36
|
}
|
|
35
37
|
): AsyncGenerator<ApiResponse<T | null>, void, unknown> {
|
|
36
38
|
const cacheStrategy = opts?.cacheStrategy ?? CacheStrategy.normal;
|
|
37
39
|
const cacheKey =
|
|
38
40
|
(opts?.storageKeyPrefix ?? '') +
|
|
39
41
|
endpoint +
|
|
40
|
-
JSON.stringify(
|
|
42
|
+
JSON.stringify({
|
|
43
|
+
params: opts?.params ?? {},
|
|
44
|
+
method: opts?.method ?? 'GET',
|
|
45
|
+
body: opts?.body ?? null,
|
|
46
|
+
});
|
|
41
47
|
|
|
42
48
|
if (cacheStrategy === CacheStrategy.cache) {
|
|
43
49
|
const cached = await storageGet(cacheKey);
|
|
@@ -47,7 +53,9 @@ export class ApiRepository {
|
|
|
47
53
|
const res = await this.fetchFromNetwork<T>(
|
|
48
54
|
endpoint,
|
|
49
55
|
opts?.params,
|
|
50
|
-
cacheKey
|
|
56
|
+
cacheKey,
|
|
57
|
+
opts?.method,
|
|
58
|
+
opts?.body
|
|
51
59
|
);
|
|
52
60
|
yield res;
|
|
53
61
|
}
|
|
@@ -68,7 +76,9 @@ export class ApiRepository {
|
|
|
68
76
|
const res = await this.fetchFromNetwork<T>(
|
|
69
77
|
endpoint,
|
|
70
78
|
opts?.params,
|
|
71
|
-
cacheKey
|
|
79
|
+
cacheKey,
|
|
80
|
+
opts?.method,
|
|
81
|
+
opts?.body
|
|
72
82
|
);
|
|
73
83
|
yield res;
|
|
74
84
|
return;
|
|
@@ -81,7 +91,9 @@ export class ApiRepository {
|
|
|
81
91
|
const res = await this.fetchFromNetwork<T>(
|
|
82
92
|
endpoint,
|
|
83
93
|
opts?.params,
|
|
84
|
-
cacheKey
|
|
94
|
+
cacheKey,
|
|
95
|
+
opts?.method,
|
|
96
|
+
opts?.body
|
|
85
97
|
);
|
|
86
98
|
yield res;
|
|
87
99
|
}
|
|
@@ -89,10 +101,22 @@ export class ApiRepository {
|
|
|
89
101
|
private async fetchFromNetwork<T>(
|
|
90
102
|
endpoint: string,
|
|
91
103
|
params?: Record<string, any>,
|
|
92
|
-
cacheKey?: string
|
|
104
|
+
cacheKey?: string,
|
|
105
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE',
|
|
106
|
+
body?: any
|
|
93
107
|
): Promise<ApiResponse<T | null>> {
|
|
94
108
|
try {
|
|
95
|
-
const
|
|
109
|
+
const m = (method || 'GET').toUpperCase();
|
|
110
|
+
let response: any;
|
|
111
|
+
if (m === 'POST') {
|
|
112
|
+
response = await this.apiClient.post(endpoint, body, params);
|
|
113
|
+
} else if (m === 'PUT') {
|
|
114
|
+
response = await this.apiClient.put(endpoint, body, params);
|
|
115
|
+
} else if (m === 'DELETE') {
|
|
116
|
+
response = await this.apiClient.delete(endpoint, body, params);
|
|
117
|
+
} else {
|
|
118
|
+
response = await this.apiClient.get(endpoint, params);
|
|
119
|
+
}
|
|
96
120
|
const data = response?.data ?? null;
|
|
97
121
|
const message = response?.message ?? response?.statusText ?? 'No message';
|
|
98
122
|
if (data !== null && cacheKey) {
|
|
@@ -7,6 +7,10 @@ import {
|
|
|
7
7
|
type OnBoardingData,
|
|
8
8
|
onBoardingDataFromJson,
|
|
9
9
|
} from '../models/onboardingModel';
|
|
10
|
+
import {
|
|
11
|
+
type TokenResponse,
|
|
12
|
+
tokenResponseFromJson,
|
|
13
|
+
} from '../models/tokenModel';
|
|
10
14
|
|
|
11
15
|
// Storage
|
|
12
16
|
import { clearAll as storageClearAll } from '../storage/storageManager';
|
|
@@ -62,6 +66,43 @@ export class ApiService {
|
|
|
62
66
|
}
|
|
63
67
|
}
|
|
64
68
|
|
|
69
|
+
async *getNonce({
|
|
70
|
+
cacheStrategy = CacheStrategy.network,
|
|
71
|
+
extUserId = '',
|
|
72
|
+
partnerCode = '',
|
|
73
|
+
}): AsyncGenerator<TokenResponse, void, unknown> {
|
|
74
|
+
const generator = this.repository.getData<any>(ApiEndpoints.get_nonce, {
|
|
75
|
+
cacheStrategy,
|
|
76
|
+
method: 'POST',
|
|
77
|
+
body: {
|
|
78
|
+
extUserId,
|
|
79
|
+
partnerCode,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
for await (const response of generator) {
|
|
84
|
+
if (response.data) {
|
|
85
|
+
try {
|
|
86
|
+
yield tokenResponseFromJson(response.data);
|
|
87
|
+
} catch (e) {
|
|
88
|
+
yield {
|
|
89
|
+
token: null,
|
|
90
|
+
statusCode: null,
|
|
91
|
+
error: `Failed to parse nonce: ${e}`,
|
|
92
|
+
messages: null,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
yield {
|
|
97
|
+
token: null,
|
|
98
|
+
statusCode: null,
|
|
99
|
+
error: response.message ?? 'Failed to load nonce',
|
|
100
|
+
messages: null,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
65
106
|
/**
|
|
66
107
|
* Clear all cached data
|
|
67
108
|
*/
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { logger } from '../../../utils/logger';
|
|
5
5
|
|
|
6
6
|
export class AuthInterceptor {
|
|
7
|
+
private static readonly xApiKey = 'x-api-key';
|
|
7
8
|
private static readonly oauthSubIdKey = 'oauthSubId';
|
|
8
9
|
private static readonly bodyMethods = new Set(['POST', 'PUT', 'PATCH']);
|
|
9
10
|
private static readonly excludedApis = new Set<string>();
|
|
@@ -14,6 +15,12 @@ export class AuthInterceptor {
|
|
|
14
15
|
return options;
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
this.addApiKeyHeader(
|
|
19
|
+
options,
|
|
20
|
+
AuthInterceptor.xApiKey,
|
|
21
|
+
'3xqpYp6CPn899166YXbEB1YLJIhfdj08BbCdfQdg'
|
|
22
|
+
);
|
|
23
|
+
|
|
17
24
|
const userId = await this.getCurrentUserId();
|
|
18
25
|
if (userId) {
|
|
19
26
|
this.addAuthenticationData(options, userId);
|
|
@@ -53,6 +60,11 @@ export class AuthInterceptor {
|
|
|
53
60
|
}
|
|
54
61
|
}
|
|
55
62
|
|
|
63
|
+
private addApiKeyHeader(options: any, key: string, value: string) {
|
|
64
|
+
options.headers = options.headers || {};
|
|
65
|
+
options.headers[key] = value;
|
|
66
|
+
}
|
|
67
|
+
|
|
56
68
|
private shouldExcludeApi(apiPath: string): boolean {
|
|
57
69
|
if (!apiPath) return false;
|
|
58
70
|
for (const excludedPath of AuthInterceptor.excludedApis) {
|
|
@@ -65,9 +77,6 @@ export class AuthInterceptor {
|
|
|
65
77
|
|
|
66
78
|
private async getCurrentUserId(): Promise<string | null> {
|
|
67
79
|
try {
|
|
68
|
-
// Placeholder for Keycloak integration
|
|
69
|
-
// const currentUser = KeycloakWebViewManager.instance.currentUser;
|
|
70
|
-
// return currentUser?.email;
|
|
71
80
|
return null;
|
|
72
81
|
} catch (e) {
|
|
73
82
|
logger.error('Failed to get current user ID:', e);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
class ReactRefManager {
|
|
2
|
+
private ref: any | null = null;
|
|
3
|
+
|
|
4
|
+
setRef(ref: any): void {
|
|
5
|
+
this.ref = ref;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
getRef(): any | null {
|
|
9
|
+
return this.ref;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const reactRefManager = new ReactRefManager();
|
|
14
|
+
|
|
15
|
+
export const setReactRef = async (ref: any): Promise<void> => {
|
|
16
|
+
reactRefManager.setRef(ref);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export async function getReactRef(): Promise<any | null> {
|
|
20
|
+
return reactRefManager.getRef();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getReactRefSync(): any | null {
|
|
24
|
+
return reactRefManager.getRef();
|
|
25
|
+
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
// React Native Core
|
|
2
2
|
import { BackHandler, Platform } from 'react-native';
|
|
3
|
-
|
|
4
|
-
let goBackFn: (() => boolean) | null = null;
|
|
5
|
-
export function setGoBackImpl(fn: () => boolean) {
|
|
6
|
-
goBackFn = fn;
|
|
7
|
-
}
|
|
3
|
+
import { getReactRefSync } from '../../data/storage/reactRefManager';
|
|
8
4
|
|
|
9
5
|
export function closeCurrentScreen(): boolean {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
if (getReactRefSync().isReady() && getReactRefSync().canGoBack()) {
|
|
7
|
+
getReactRefSync().goBack();
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
|
|
13
11
|
return false;
|
|
14
12
|
}
|
|
15
13
|
|
|
@@ -8,6 +8,8 @@ import { getSessionId } from '../../data/storage/sessionManager';
|
|
|
8
8
|
import { getLocationCoordinates } from '../../data/storage/locationManager';
|
|
9
9
|
import { getEncryptionKey, getPRefCode } from '../../data/storage/keysManager';
|
|
10
10
|
|
|
11
|
+
import { getBaseUrl } from '../../utils/config';
|
|
12
|
+
|
|
11
13
|
export type Attribute = { key: string; value: string };
|
|
12
14
|
export type Screen = { name?: string; attributes?: Attribute[] };
|
|
13
15
|
export type Profile = {
|
|
@@ -36,6 +38,7 @@ export type UrlInput = {
|
|
|
36
38
|
authType?: AuthType;
|
|
37
39
|
deviceInfo?: DeviceInfo;
|
|
38
40
|
sessionId?: string;
|
|
41
|
+
nonce: string;
|
|
39
42
|
};
|
|
40
43
|
export function validateInput(input: UrlInput): {
|
|
41
44
|
ok: boolean;
|
|
@@ -46,6 +49,8 @@ export function validateInput(input: UrlInput): {
|
|
|
46
49
|
if (!input.profile) errors.push('profile is mandatory');
|
|
47
50
|
if (!input.profile?.userId) errors.push('userId is mandatory');
|
|
48
51
|
if (!input.profile?.email) errors.push('email is mandatory');
|
|
52
|
+
if (!input.nonce) errors.push('nonce is mandatory');
|
|
53
|
+
|
|
49
54
|
const pv = input.profile?.pv;
|
|
50
55
|
const ev = input.profile?.ev;
|
|
51
56
|
if (typeof pv !== 'undefined' && pv !== '0' && pv !== '1') {
|
|
@@ -89,12 +94,14 @@ export async function generateUrl(input: UrlInput): Promise<string> {
|
|
|
89
94
|
const normalized: Required<Pick<UrlInput, 'profile'>> &
|
|
90
95
|
Pick<UrlInput, 'screen' | 'authType' | 'sessionId'> & {
|
|
91
96
|
deviceInfo: DeviceInfo;
|
|
97
|
+
nonce: string;
|
|
92
98
|
} = {
|
|
93
99
|
profile: input.profile,
|
|
94
100
|
screen: input.screen,
|
|
95
101
|
authType: input.authType ?? 'PHONE',
|
|
96
102
|
sessionId: sessionId ?? '',
|
|
97
103
|
deviceInfo,
|
|
104
|
+
nonce: input.nonce,
|
|
98
105
|
};
|
|
99
106
|
|
|
100
107
|
const validation = validateInput({
|
|
@@ -111,6 +118,7 @@ export async function generateUrl(input: UrlInput): Promise<string> {
|
|
|
111
118
|
authType: normalized.authType,
|
|
112
119
|
deviceInfo: normalized.deviceInfo,
|
|
113
120
|
sessionId: normalized.sessionId,
|
|
121
|
+
nonce: normalized.nonce,
|
|
114
122
|
};
|
|
115
123
|
|
|
116
124
|
const json = JSON.stringify(payload);
|
|
@@ -126,7 +134,7 @@ export async function generateUrl(input: UrlInput): Promise<string> {
|
|
|
126
134
|
if (!programCode || programCode === '-') {
|
|
127
135
|
throw new SDKError('pRefCode is mandatory. Initialize SDK with pRefCode.');
|
|
128
136
|
}
|
|
129
|
-
return
|
|
137
|
+
return `${getBaseUrl()}?pRefCode=${encodeURIComponent(
|
|
130
138
|
programCode
|
|
131
139
|
)}&qP=${encodeURIComponent(encoded)}`;
|
|
132
140
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
closeCurrentScreenSafe,
|
|
7
|
-
setSessionId,
|
|
8
|
-
} from '@savers_app/react-native-sdk';
|
|
1
|
+
import { openMap } from '../navigation/openMap';
|
|
2
|
+
import { openDialPad } from '../navigation/dialPad';
|
|
3
|
+
import { openBrowser } from '../navigation/openBrowser';
|
|
4
|
+
import { closeCurrentScreenSafe } from '../navigation/goBackNavigation';
|
|
5
|
+
import { setSessionId } from '../../data/storage/sessionManager';
|
|
9
6
|
|
|
10
7
|
export function handleWebMessage(raw: string, postBack?: (data: any) => void) {
|
|
11
8
|
let msg: { action?: string; payload?: any };
|