@pensasystems/pensa-react-native 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/LICENSE +20 -0
- package/PensaSdkReactNative.podspec +25 -0
- package/README.md +279 -0
- package/android/build.gradle +90 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/pensasdkreactnative/PensaEventEmitterModule.kt +21 -0
- package/android/src/main/java/com/pensasdkreactnative/PensaListeners.kt +44 -0
- package/android/src/main/java/com/pensasdkreactnative/PensaSdkReactNativeModule.kt +172 -0
- package/android/src/main/java/com/pensasdkreactnative/PensaSdkReactNativePackage.kt +20 -0
- package/ios/PensaEventEmitter.swift +26 -0
- package/ios/PensaListeners.swift +37 -0
- package/ios/PensaSdkReactNative-Bridging-Header.h +43 -0
- package/ios/PensaSdkReactNative.mm +48 -0
- package/ios/PensaSdkReactNative.swift +121 -0
- package/ios/Podfile +35 -0
- package/lib/module/events.js +11 -0
- package/lib/module/events.js.map +1 -0
- package/lib/module/index.js +42 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/events.d.ts +7 -0
- package/lib/typescript/src/events.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +16 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +26 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +154 -0
- package/src/events.ts +16 -0
- package/src/index.tsx +77 -0
- package/src/types.ts +29 -0
package/src/index.tsx
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
const LINKING_ERROR =
|
|
4
|
+
`The package 'pensa-sdk-react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
6
|
+
'- You rebuilt the app after installing the package\n' +
|
|
7
|
+
'- You are not using Expo Go\n';
|
|
8
|
+
|
|
9
|
+
const PensaSdkReactNative = NativeModules.PensaSdkReactNative
|
|
10
|
+
? NativeModules.PensaSdkReactNative
|
|
11
|
+
: new Proxy(
|
|
12
|
+
{},
|
|
13
|
+
{
|
|
14
|
+
get() {
|
|
15
|
+
throw new Error(LINKING_ERROR);
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const initPensa = (config: {
|
|
21
|
+
clientId: string;
|
|
22
|
+
clientSecret: string;
|
|
23
|
+
isLoggingEnabled?: boolean;
|
|
24
|
+
}): Promise<void> => {
|
|
25
|
+
return PensaSdkReactNative.initPensa(config);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const isPensaStarted = (): Promise<boolean> => {
|
|
29
|
+
return PensaSdkReactNative.isPensaStarted();
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const showShelfScans = (): Promise<void> => {
|
|
33
|
+
return PensaSdkReactNative.showShelfScans();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const showProductScans = (): Promise<void> => {
|
|
37
|
+
return PensaSdkReactNative.showProductScans();
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const showStoreSearchView = (): Promise<void> => {
|
|
41
|
+
return PensaSdkReactNative.showStoreSearchView();
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const showStoresScreen = (): Promise<void> => {
|
|
45
|
+
return PensaSdkReactNative.showStoresScreen();
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const showScanArea = (
|
|
49
|
+
scanId: number,
|
|
50
|
+
storeId?: number,
|
|
51
|
+
globalStoreId?: string
|
|
52
|
+
): Promise<void> => {
|
|
53
|
+
return PensaSdkReactNative.showScanArea(
|
|
54
|
+
scanId,
|
|
55
|
+
storeId ?? null,
|
|
56
|
+
globalStoreId ?? null
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const showStockingScreen = (): Promise<void> => {
|
|
61
|
+
return PensaSdkReactNative.showStockingScreen();
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const showStoreChecklist = (
|
|
65
|
+
globalStoreId: string,
|
|
66
|
+
guid?: string,
|
|
67
|
+
sectionKey?: string
|
|
68
|
+
): Promise<void> => {
|
|
69
|
+
return PensaSdkReactNative.showStoreChecklist(
|
|
70
|
+
globalStoreId,
|
|
71
|
+
guid,
|
|
72
|
+
sectionKey
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export * from './events';
|
|
77
|
+
export * from './types';
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type OnScanUploadProgressUpdate = {
|
|
2
|
+
tdlinxId: string;
|
|
3
|
+
scanAreaId: string;
|
|
4
|
+
progress: number;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type OnScanUploadCompleted = {
|
|
8
|
+
tdlinxId: string;
|
|
9
|
+
scanAreaId: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type OnScanUploadFailed = {
|
|
13
|
+
tdlinxId: string;
|
|
14
|
+
scanAreaId: string;
|
|
15
|
+
error?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type OnCantScanReported = {
|
|
19
|
+
tdlinxId: string;
|
|
20
|
+
scanAreaId: string;
|
|
21
|
+
reason: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type PensaEventPayloads = {
|
|
25
|
+
onScanUploadProgressUpdate: OnScanUploadProgressUpdate;
|
|
26
|
+
onScanUploadCompleted: OnScanUploadCompleted;
|
|
27
|
+
onScanUploadFailed: OnScanUploadFailed;
|
|
28
|
+
onCantScanReported: OnCantScanReported;
|
|
29
|
+
};
|