@pensasystems/pensa-react-native 0.1.0-beta.1 → 0.1.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/src/index.tsx CHANGED
@@ -1,4 +1,11 @@
1
1
  import { NativeModules, Platform } from 'react-native';
2
+ import type {
3
+ PensaOnDemandReport,
4
+ PensaScanStatus,
5
+ PensaShelfItem,
6
+ PensaVisitScansStatus,
7
+ } from './types';
8
+ import { PensaReportType } from './types';
2
9
 
3
10
  const LINKING_ERROR =
4
11
  `The package 'pensa-sdk-react-native' doesn't seem to be linked. Make sure: \n\n` +
@@ -73,5 +80,54 @@ export const showStoreChecklist = (
73
80
  );
74
81
  };
75
82
 
83
+ export const showStoreChecklistWithGuid = (
84
+ globalStoreId: string,
85
+ guid: string
86
+ ): Promise<void> => {
87
+ return PensaSdkReactNative.showStoreChecklistWithGuid(globalStoreId, guid);
88
+ };
89
+
90
+ export const fetchScanStatuses = (
91
+ scanIds: number[]
92
+ ): Promise<PensaScanStatus[]> => {
93
+ return PensaSdkReactNative.fetchScanStatuses(scanIds);
94
+ };
95
+
96
+ export function fetchOnDemandReports(params: {
97
+ scanId?: number | null;
98
+ guid?: string | null;
99
+ projectId?: number | null;
100
+ reportTypes?: PensaReportType[];
101
+ }): Promise<PensaOnDemandReport> {
102
+ const finalReportTypes =
103
+ params.reportTypes && params.reportTypes.length > 0
104
+ ? params.reportTypes
105
+ : [PensaReportType.ITEMS_SEEN];
106
+
107
+ return PensaSdkReactNative.fetchOnDemandReports(
108
+ params.scanId ?? null,
109
+ params.guid ?? null,
110
+ params.projectId ?? null,
111
+ finalReportTypes
112
+ );
113
+ }
114
+
115
+ export const fetchVisitScansStatus = (
116
+ guid: string
117
+ ): Promise<PensaVisitScansStatus> => {
118
+ return PensaSdkReactNative.fetchVisitScansStatus(guid);
119
+ };
120
+
121
+ export const fetchProductImageBase64 = (productId: number): Promise<string> => {
122
+ return PensaSdkReactNative.fetchProductImageBase64(productId);
123
+ };
124
+
125
+ export const fetchShelves = (
126
+ globalStoreId: string
127
+ ): Promise<PensaShelfItem[]> => {
128
+ return PensaSdkReactNative.fetchShelves(globalStoreId);
129
+ };
130
+
76
131
  export * from './events';
77
132
  export * from './types';
133
+ export { PensaReportType } from './types';
package/src/types.ts CHANGED
@@ -21,9 +21,143 @@ export type OnCantScanReported = {
21
21
  reason: string;
22
22
  };
23
23
 
24
+ export type OnScanCompletedWithGuid = {
25
+ guid: string | null;
26
+ tdlinxId: string;
27
+ scanId: number;
28
+ };
29
+
24
30
  export type PensaEventPayloads = {
25
31
  onScanUploadProgressUpdate: OnScanUploadProgressUpdate;
26
32
  onScanUploadCompleted: OnScanUploadCompleted;
27
33
  onScanUploadFailed: OnScanUploadFailed;
28
34
  onCantScanReported: OnCantScanReported;
35
+ onScanCompletedWithGuid: OnScanCompletedWithGuid;
36
+ };
37
+
38
+ export type PensaScanMetadata = {
39
+ guid: string | null;
40
+ serverUploadStarted: string | null;
41
+ };
42
+
43
+ export type PensaScanStatus = {
44
+ created: string | null;
45
+ fastStatus: string | null;
46
+ id: number;
47
+ metadata: PensaScanMetadata | null;
48
+ scanTimestamp: string | null;
49
+ scannerId: string | null;
50
+ status: string | null;
51
+ };
52
+
53
+ export type PensaOnDemandProduct = {
54
+ brand: string | null;
55
+ brandId: number | null;
56
+ category: string | null;
57
+ categoryId: number | null;
58
+ expectedFacings: number | null;
59
+ facings: number | null;
60
+ manufacturer: string | null;
61
+ manufacturerId: number | null;
62
+ product: string | null;
63
+ productId: number | null;
64
+ upc: string | null;
65
+ };
66
+
67
+ export type PensaOnDemandReportBucket = {
68
+ productList: PensaOnDemandProduct[];
69
+ };
70
+
71
+ export type PensaOnDemandScan = {
72
+ facingsSeen: PensaOnDemandReportBucket | null;
73
+ fullFacings: PensaOnDemandReportBucket | null;
74
+ fullFacingsAndProductPositions: PensaOnDemandReportBucket | null;
75
+ itemsSeen: PensaOnDemandReportBucket | null;
76
+ newProducts: PensaOnDemandReportBucket | null;
77
+ newProductPackaging: PensaOnDemandReportBucket | null;
78
+ missingPriceTag: PensaOnDemandReportBucket | null;
79
+ noOos: PensaOnDemandReportBucket | null;
80
+ oos: PensaOnDemandReportBucket | null;
81
+ productPositions: PensaOnDemandReportBucket | null;
82
+ scanFailed: PensaOnDemandReportBucket | null;
83
+ scanRejected: PensaOnDemandReportBucket | null;
84
+ scanSkipped: PensaOnDemandReportBucket | null;
85
+ projectId: number | null;
86
+ projectName: string | null;
87
+ projectReportId: number | null;
88
+ projectReportName: string | null;
89
+ realogramSignedUrl: string | null;
90
+ scanId: number | null;
91
+ shelfId: number | null;
92
+ shelfName: string | null;
93
+ status: string | null;
94
+ };
95
+
96
+ export type PensaOnDemandVisit = {
97
+ endTime: string | null;
98
+ identifier: string | null;
99
+ startTime: string | null;
100
+ storeName: string | null;
101
+ storeTdlinx: string | null;
102
+ };
103
+
104
+ export type PensaOnDemandReport = {
105
+ facingsSeen: PensaOnDemandReportBucket | null;
106
+ fullFacings: PensaOnDemandReportBucket | null;
107
+ fullFacingsAndProductPositions: PensaOnDemandReportBucket | null;
108
+ itemsSeen: PensaOnDemandReportBucket | null;
109
+ newProducts: PensaOnDemandReportBucket | null;
110
+ newProductPackaging: PensaOnDemandReportBucket | null;
111
+ missingPriceTag: PensaOnDemandReportBucket | null;
112
+ noOos: PensaOnDemandReportBucket | null;
113
+ oos: PensaOnDemandReportBucket | null;
114
+ productPositions: PensaOnDemandReportBucket | null;
115
+ scanFailed: PensaOnDemandReportBucket | null;
116
+ scanRejected: PensaOnDemandReportBucket | null;
117
+ scanSkipped: PensaOnDemandReportBucket | null;
118
+ projectId: number | null;
119
+ projectName: string | null;
120
+ projectReportId: number | null;
121
+ projectReportName: string | null;
122
+ realogramSignedUrl: string | null;
123
+ shelfId: number | null;
124
+ shelfName: string | null;
125
+ status: string | null;
126
+ scans: PensaOnDemandScan[] | null;
127
+ visit: PensaOnDemandVisit | null;
128
+ };
129
+
130
+ export type PensaVisitScanItem = {
131
+ created: string | null;
132
+ fastStatus: string | null;
133
+ scanId: number | null;
134
+ status: string | null;
135
+ uploadCompleted: boolean | null;
136
+ };
137
+
138
+ export type PensaVisitScansStatus = {
139
+ guid: string | null;
140
+ scans: PensaVisitScanItem[] | null;
141
+ visitStatus: string | null;
142
+ };
143
+
144
+ export enum PensaReportType {
145
+ FACINGS_SEEN = 'FACINGS_SEEN',
146
+ FULL_FACINGS = 'FULL_FACINGS',
147
+ FULL_FACINGS_AND_PRODUCT_POSITIONS = 'FULL_FACINGS_AND_PRODUCT_POSITIONS',
148
+ ITEMS_SEEN = 'ITEMS_SEEN',
149
+ NEW_PRODUCTS = 'NEW_PRODUCTS',
150
+ NEW_PRODUCT_PACKAGING = 'NEW_PRODUCT_PACKAGING',
151
+ MISSING_PRICE_TAG = 'MISSING_PRICE_TAG',
152
+ NO_OOS = 'NO_OOS',
153
+ OOS = 'OOS',
154
+ PRODUCT_POSITIONS = 'PRODUCT_POSITIONS',
155
+ SCAN_FAILED = 'SCAN_FAILED',
156
+ SCAN_REJECTED = 'SCAN_REJECTED',
157
+ SCAN_SKIPPED = 'SCAN_SKIPPED',
158
+ }
159
+
160
+ export type PensaShelfItem = {
161
+ id: number;
162
+ name: string | null;
29
163
  };