@savers_app/react-native-sdk 1.1.0 → 1.2.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/README.md CHANGED
@@ -19,9 +19,9 @@ React Native SDK that bridges host app features like maps, dialer, browser, devi
19
19
  - Install the library:
20
20
 
21
21
  ```bash
22
- npm install @saversapp/react-native-sdk
22
+ npm install @savers_app/react-native-sdk
23
23
  # or
24
- yarn add @saversapp/react-native-sdk
24
+ yarn add @savers_app/react-native-sdk
25
25
  ```
26
26
 
27
27
  - Install required peer dependencies:
@@ -96,7 +96,7 @@ Requirements for AES-GCM:
96
96
  Before using any other APIs, initialize the SDK with keys you receive from Savers:
97
97
 
98
98
  ```ts
99
- import { SaversAppSDK } from '@saversapp/react-native-sdk';
99
+ import { SaversAppSDK } from '@savers_app/react-native-sdk';
100
100
 
101
101
  SaversAppSDK.initialized({
102
102
  apiKey: 'YOUR_API_KEY',
@@ -114,13 +114,13 @@ import {
114
114
  getEncryptionKey,
115
115
  getPRefCode,
116
116
  getAuthMode,
117
- } from '@saversapp/react-native-sdk';
117
+ } from '@savers_app/react-native-sdk';
118
118
  ```
119
119
 
120
120
  ### 2. Generate URL
121
121
 
122
122
  ```ts
123
- import { generateUrl } from '@saversapp/react-native-sdk';
123
+ import { generateUrl } from '@savers_app/react-native-sdk';
124
124
 
125
125
  const url = await generateUrl({
126
126
  // Top-level UrlInput fields
@@ -187,7 +187,7 @@ One-time host app setup:
187
187
 
188
188
  ```tsx
189
189
  import { NavigationContainer } from '@react-navigation/native';
190
- import { navigationRef } from '@saversapp/react-native-sdk';
190
+ import { navigationRef } from '@savers_app/react-native-sdk';
191
191
 
192
192
  export function App() {
193
193
  return <NavigationContainer ref={navigationRef}>{/* ... */}</NavigationContainer>;
@@ -197,7 +197,7 @@ export function App() {
197
197
  SDK API:
198
198
 
199
199
  ```ts
200
- import { closeCurrentScreen, closeCurrentScreenSafe } from '@saversapp/react-native-sdk';
200
+ import { closeCurrentScreen, closeCurrentScreenSafe } from '@savers_app/react-native-sdk';
201
201
 
202
202
  closeCurrentScreen(); // returns boolean
203
203
  closeCurrentScreenSafe(); // Android-only fallback to exitApp if it can't goBack()
@@ -208,7 +208,7 @@ closeCurrentScreenSafe(); // Android-only fallback to exitApp if it can't goBack
208
208
  Trigger native actions from web & bind `onMessage` to a `WebView`:
209
209
 
210
210
  ```ts
211
- import { handleWebMessage } from '@saversapp/react-native-sdk';
211
+ import { handleWebMessage } from '@savers_app/react-native-sdk';
212
212
  import { WebView } from 'react-native-webview';
213
213
  ...
214
214
 
@@ -298,7 +298,7 @@ import {
298
298
  getEncryptionKey,
299
299
  getPRefCode,
300
300
  getAuthMode,
301
- } from '@saversapp/react-native-sdk';
301
+ } from '@savers_app/react-native-sdk';
302
302
  ```
303
303
 
304
304
  - `getDeviceId()`: uses `react-native-device-info` to resolve a unique device id and caches it in memory and AsyncStorage.
@@ -312,7 +312,7 @@ There are two ways to work with location:
312
312
  1. **Device location service** (geolocation + permissions):
313
313
 
314
314
  ```ts
315
- import { getDeviceLocation } from '@saversapp/react-native-sdk';
315
+ import { getDeviceLocation } from '@savers_app/react-native-sdk';
316
316
 
317
317
  const loc = await getDeviceLocation();
318
318
  // { lat, lng } or throws if unavailable / permission denied
@@ -329,7 +329,7 @@ There are two ways to work with location:
329
329
  import {
330
330
  setLocationCoordinates,
331
331
  getLocationCoordinates,
332
- } from '@saversapp/react-native-sdk';
332
+ } from '@savers_app/react-native-sdk';
333
333
 
334
334
  await setLocationCoordinates(37.7749, -122.4194);
335
335
  const coords = await getLocationCoordinates(); // { lat, lng } | null
@@ -345,7 +345,7 @@ import {
345
345
  openDialPad,
346
346
  callPhone,
347
347
  openBrowser,
348
- } from '@saversapp/react-native-sdk';
348
+ } from '@savers_app/react-native-sdk';
349
349
  ```
350
350
 
351
351
  - `openMap(lat, lng, label?)`: opens the native maps app if available, otherwise falls back to browser (Apple Maps / Google Maps).
@@ -360,7 +360,7 @@ Use the `ApiService` to make network requests with unified error handling, cachi
360
360
  ### ApiService Overview
361
361
 
362
362
  ```ts
363
- import { ApiService } from '@saversapp/react-native-sdk';
363
+ import { ApiService } from '@savers_app/react-native-sdk';
364
364
 
365
365
  const apiService = new ApiService(); // defaults to production base URL
366
366
  ```
@@ -374,7 +374,7 @@ const apiService = new ApiService(); // defaults to production base URL
374
374
  ### Onboarding Example
375
375
 
376
376
  ```ts
377
- import { ApiService } from '@saversapp/react-native-sdk';
377
+ import { ApiService } from '@savers_app/react-native-sdk';
378
378
 
379
379
  const apiService = new ApiService();
380
380
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  // Screens / SDKs / External packages
4
- import { openMap, openDialPad, openBrowser, closeCurrentScreenSafe, setSessionId } from '@saversapp/react-native-sdk';
4
+ import { openMap, openDialPad, openBrowser, closeCurrentScreenSafe, setSessionId } from '@savers_app/react-native-sdk';
5
5
  export function handleWebMessage(raw, postBack) {
6
6
  let msg;
7
7
  try {
@@ -1 +1 @@
1
- {"version":3,"names":["openMap","openDialPad","openBrowser","closeCurrentScreenSafe","setSessionId","handleWebMessage","raw","postBack","msg","JSON","parse","action","payload","reply","data","lat","lng","label","ok","number","url","sessionId","id","error","e","message","String"],"sourceRoot":"../../../../src","sources":["services/webview/messageHandler.ts"],"mappings":";;AAAA;AACA,SACEA,OAAO,EACPC,WAAW,EACXC,WAAW,EACXC,sBAAsB,EACtBC,YAAY,QACP,6BAA6B;AAEpC,OAAO,SAASC,gBAAgBA,CAACC,GAAW,EAAEC,QAA8B,EAAE;EAC5E,IAAIC,GAAuC;EAC3C,IAAI;IACFA,GAAG,GAAGC,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;EACvB,CAAC,CAAC,MAAM;IACN;EACF;EACA,MAAMK,MAAM,GAAGH,GAAG,EAAEG,MAAM;EAC1B,MAAMC,OAAO,GAAGJ,GAAG,EAAEI,OAAO;EAE5B,MAAMC,KAAK,GAAIC,IAAS,IAAKP,QAAQ,GAAG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EAAEC,OAAO,IAAIC,MAAM,CAACF,CAAC,CAAC;QAAEb;MAAO,CAAC,CAAC;IAC9D;EACF,CAAC,EAAE,CAAC;AACN","ignoreList":[]}
1
+ {"version":3,"names":["openMap","openDialPad","openBrowser","closeCurrentScreenSafe","setSessionId","handleWebMessage","raw","postBack","msg","JSON","parse","action","payload","reply","data","lat","lng","label","ok","number","url","sessionId","id","error","e","message","String"],"sourceRoot":"../../../../src","sources":["services/webview/messageHandler.ts"],"mappings":";;AAAA;AACA,SACEA,OAAO,EACPC,WAAW,EACXC,WAAW,EACXC,sBAAsB,EACtBC,YAAY,QACP,8BAA8B;AAErC,OAAO,SAASC,gBAAgBA,CAACC,GAAW,EAAEC,QAA8B,EAAE;EAC5E,IAAIC,GAAuC;EAC3C,IAAI;IACFA,GAAG,GAAGC,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;EACvB,CAAC,CAAC,MAAM;IACN;EACF;EACA,MAAMK,MAAM,GAAGH,GAAG,EAAEG,MAAM;EAC1B,MAAMC,OAAO,GAAGJ,GAAG,EAAEI,OAAO;EAE5B,MAAMC,KAAK,GAAIC,IAAS,IAAKP,QAAQ,GAAGO,IAAI,CAAC;EAE7C,CAAC,YAAY;IACX,IAAI;MACF,IAAIH,MAAM,KAAK,UAAU,EAAE;QACzB,MAAM;UAAEI,GAAG;UAAEC,GAAG;UAAEC;QAAM,CAAC,GAAGL,OAAO,IAAI,CAAC,CAAC;QACzC,MAAMZ,OAAO,CAACe,GAAG,EAAEC,GAAG,EAAEC,KAAK,CAAC;QAC9BJ,KAAK,CAAC;UAAEK,EAAE,EAAE,IAAI;UAAEP;QAAO,CAAC,CAAC;MAC7B,CAAC,MAAM,IAAIA,MAAM,KAAK,eAAe,EAAE;QACrC,MAAMV,WAAW,CAACW,OAAO,EAAEO,MAAM,CAAC;QAClCN,KAAK,CAAC;UAAEK,EAAE,EAAE,IAAI;UAAEP;QAAO,CAAC,CAAC;MAC7B,CAAC,MAAM,IAAIA,MAAM,KAAK,0BAA0B,EAAE;QAChD,MAAMT,WAAW,CAACU,OAAO,EAAEQ,GAAG,CAAC;QAC/BP,KAAK,CAAC;UAAEK,EAAE,EAAE,IAAI;UAAEP;QAAO,CAAC,CAAC;MAC7B,CAAC,MAAM,IAAIA,MAAM,KAAK,YAAY,EAAE;QAClC,MAAM;UAAEU;QAAU,CAAC,GAAGT,OAAO,IAAI,CAAC,CAAC;QACnC,MAAMU,EAAE,GAAG,MAAMlB,YAAY,CAACiB,SAAS,CAAC;QACxCR,KAAK,CAAC;UAAEK,EAAE,EAAE,IAAI;UAAEP,MAAM;UAAEU,SAAS,EAAEC;QAAG,CAAC,CAAC;MAC5C,CAAC,MAAM,IAAIX,MAAM,KAAK,aAAa,EAAE;QACnCR,sBAAsB,CAAC,CAAC;QACxB;MACF,CAAC,MAAM;QACLU,KAAK,CAAC;UAAEK,EAAE,EAAE,KAAK;UAAEK,KAAK,EAAE,gBAAgB;UAAEZ;QAAO,CAAC,CAAC;MACvD;IACF,CAAC,CAAC,OAAOa,CAAM,EAAE;MACfX,KAAK,CAAC;QAAEK,EAAE,EAAE,KAAK;QAAEK,KAAK,EAAEC,CAAC,EAAEC,OAAO,IAAIC,MAAM,CAACF,CAAC,CAAC;QAAEb;MAAO,CAAC,CAAC;IAC9D;EACF,CAAC,EAAE,CAAC;AACN","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@savers_app/react-native-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
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",
@@ -132,7 +132,7 @@
132
132
  "<rootDir>/lib/"
133
133
  ],
134
134
  "moduleNameMapper": {
135
- "^@saversapp/react-native-sdk$": "<rootDir>/src/index.tsx",
135
+ "^@savers_app/react-native-sdk$": "<rootDir>/src/index.tsx",
136
136
  "^react-native-device-info$": "<rootDir>/src/__mocks__/react-native-device-info.ts",
137
137
  "^@react-native-community/geolocation$": "<rootDir>/src/__mocks__/@react-native-community__geolocation.ts",
138
138
  "^@react-native-async-storage/async-storage$": "<rootDir>/src/__mocks__/@react-native-async-storage__async-storage.ts"
@@ -5,7 +5,7 @@ import {
5
5
  openBrowser,
6
6
  closeCurrentScreenSafe,
7
7
  setSessionId,
8
- } from '@saversapp/react-native-sdk';
8
+ } from '@savers_app/react-native-sdk';
9
9
 
10
10
  export function handleWebMessage(raw: string, postBack?: (data: any) => void) {
11
11
  let msg: { action?: string; payload?: any };