@pensasystems/pensa-react-native 0.1.0-beta-4 → 0.1.0-beta-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.
|
@@ -143,8 +143,8 @@ class PensaSdkReactNative: NSObject {
|
|
|
143
143
|
// metadata
|
|
144
144
|
if let metadata = status.metadata {
|
|
145
145
|
dict["metadata"] = [
|
|
146
|
-
"guid": metadata.guid ?? NSNull(),
|
|
147
|
-
"serverUploadStarted": metadata.serverUploadStarted ?? NSNull()
|
|
146
|
+
"guid": (metadata.guid as Any?) ?? NSNull(),
|
|
147
|
+
"serverUploadStarted": (metadata.serverUploadStarted as Any?) ?? NSNull()
|
|
148
148
|
]
|
|
149
149
|
} else {
|
|
150
150
|
dict["metadata"] = NSNull()
|
|
@@ -161,59 +161,69 @@ class PensaSdkReactNative: NSObject {
|
|
|
161
161
|
)
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
164
|
+
@objc(fetchOnDemandReports:projectId:withResolver:withRejecter:)
|
|
165
|
+
func fetchOnDemandReports(
|
|
166
|
+
scanId: NSNumber,
|
|
167
|
+
projectId: NSNumber?,
|
|
168
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
169
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
170
|
+
) {
|
|
171
|
+
|
|
172
|
+
Pensa.shared.fetchOnDemandReports(
|
|
173
|
+
scanId: scanId.intValue,
|
|
174
|
+
projectId: projectId?.intValue,
|
|
175
|
+
onSuccess: { report in
|
|
176
|
+
|
|
177
|
+
func rn(_ value: Any?) -> Any { value ?? NSNull() }
|
|
178
|
+
|
|
179
|
+
var result: [String: Any] = [
|
|
180
|
+
"shelfId": rn(report.shelfId),
|
|
181
|
+
"shelfName": rn(report.shelfName)
|
|
182
|
+
]
|
|
183
|
+
|
|
184
|
+
if let item = report.facingsSeen {
|
|
185
|
+
var itemDict: [String: Any] = [
|
|
186
|
+
"projectId": rn(item.projectId),
|
|
187
|
+
"projectName": rn(item.projectName),
|
|
188
|
+
"projectReportId": rn(item.projectReportId),
|
|
189
|
+
"projectReportName": rn(item.projectReportName)
|
|
190
|
+
]
|
|
191
|
+
|
|
192
|
+
if let bucket = item.report {
|
|
193
|
+
let products: [[String: Any]] = bucket.productList.map { product in
|
|
181
194
|
return [
|
|
182
|
-
"brand": product.brand
|
|
183
|
-
"brandId": product.brandId
|
|
184
|
-
"category": product.category
|
|
185
|
-
"categoryId": product.categoryId
|
|
186
|
-
"facings": product.facings
|
|
187
|
-
"manufacturer": product.manufacturer
|
|
188
|
-
"manufacturerId": product.manufacturerId
|
|
189
|
-
"product": product.product
|
|
190
|
-
"productId": product.productId
|
|
191
|
-
"upc": product.upc
|
|
195
|
+
"brand": rn(product.brand),
|
|
196
|
+
"brandId": rn(product.brandId),
|
|
197
|
+
"category": rn(product.category),
|
|
198
|
+
"categoryId": rn(product.categoryId),
|
|
199
|
+
"facings": rn(product.facings),
|
|
200
|
+
"manufacturer": rn(product.manufacturer),
|
|
201
|
+
"manufacturerId": rn(product.manufacturerId),
|
|
202
|
+
"product": rn(product.product),
|
|
203
|
+
"productId": rn(product.productId),
|
|
204
|
+
"upc": rn(product.upc)
|
|
192
205
|
]
|
|
193
206
|
}
|
|
194
207
|
|
|
195
|
-
|
|
208
|
+
itemDict["report"] = [
|
|
196
209
|
"productList": products
|
|
197
210
|
]
|
|
198
211
|
} else {
|
|
199
|
-
|
|
212
|
+
itemDict["report"] = NSNull()
|
|
200
213
|
}
|
|
201
214
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
result["
|
|
205
|
-
result["projectReportId"] = report.projectReportId as Any
|
|
206
|
-
result["projectReportName"] = report.projectReportName ?? NSNull()
|
|
207
|
-
result["shelfId"] = report.shelfId as Any
|
|
208
|
-
result["shelfName"] = report.shelfName ?? NSNull()
|
|
209
|
-
|
|
210
|
-
resolve(result)
|
|
211
|
-
},
|
|
212
|
-
onError: { error in
|
|
213
|
-
reject("FETCH_ON_DEMAND_REPORTS_FAILED", error.localizedDescription, error)
|
|
215
|
+
result["facingsSeen"] = itemDict
|
|
216
|
+
} else {
|
|
217
|
+
result["facingsSeen"] = NSNull()
|
|
214
218
|
}
|
|
215
|
-
|
|
216
|
-
|
|
219
|
+
|
|
220
|
+
resolve(result)
|
|
221
|
+
},
|
|
222
|
+
onError: { error in
|
|
223
|
+
reject("FETCH_ON_DEMAND_REPORTS_FAILED", error.localizedDescription, error)
|
|
224
|
+
}
|
|
225
|
+
)
|
|
226
|
+
}
|
|
217
227
|
|
|
218
228
|
@objc(fetchProductImageBase64:withResolver:withRejecter:)
|
|
219
229
|
func fetchProductImageBase64(productId: NSNumber,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pensasystems/pensa-react-native",
|
|
3
|
-
"version": "0.1.0-beta-
|
|
3
|
+
"version": "0.1.0-beta-5",
|
|
4
4
|
"description": "The Pensa Mobile App SDK is a developer toolkit designed to simplify adding Pensa’s capabilities to your mobile applications. It provides pre-built libraries, tools, and APIs to accelerate development and integration, offering streamlined SDK integration, easy initialization, and comprehensive functionality. With the Pensa SDK, you can enhance your app’s features or seamlessly integrate with other services for a cohesive user experience.",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/module/index.js",
|