@pensasystems/pensa-react-native 0.1.0-beta-5 → 0.1.0-beta-6

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.
@@ -21,5 +21,5 @@ Pod::Spec.new do |s|
21
21
  s.dependency "React-Core"
22
22
  end
23
23
 
24
- s.dependency "PensaSdk", "~> 1.0.6"
24
+ s.dependency "PensaSdk", "~> 1.0.7"
25
25
  end
@@ -161,69 +161,60 @@ class PensaSdkReactNative: NSObject {
161
161
  )
162
162
  }
163
163
 
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)
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
+ "projectId": rn(report.projectId),
183
+ "projectName": rn(report.projectName),
184
+ "projectReportId": rn(report.projectReportId),
185
+ "projectReportName": rn(report.projectReportName)
186
+ ]
187
+
188
+ if let bucket = report.facingsSeen?.report {
189
+ let products: [[String: Any]] = bucket.productList.map { product in
190
+ return [
191
+ "brand": rn(product.brand),
192
+ "brandId": rn(product.brandId),
193
+ "category": rn(product.category),
194
+ "categoryId": rn(product.categoryId),
195
+ "facings": rn(product.facings),
196
+ "manufacturer": rn(product.manufacturer),
197
+ "manufacturerId": rn(product.manufacturerId),
198
+ "product": rn(product.product),
199
+ "productId": rn(product.productId),
200
+ "upc": rn(product.upc)
190
201
  ]
191
-
192
- if let bucket = item.report {
193
- let products: [[String: Any]] = bucket.productList.map { product in
194
- return [
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)
205
- ]
206
- }
207
-
208
- itemDict["report"] = [
209
- "productList": products
210
- ]
211
- } else {
212
- itemDict["report"] = NSNull()
213
- }
214
-
215
- result["facingsSeen"] = itemDict
216
- } else {
217
- result["facingsSeen"] = NSNull()
218
202
  }
219
203
 
220
- resolve(result)
221
- },
222
- onError: { error in
223
- reject("FETCH_ON_DEMAND_REPORTS_FAILED", error.localizedDescription, error)
204
+ result["facingsSeen"] = [
205
+ "productList": products
206
+ ]
207
+ } else {
208
+ result["facingsSeen"] = NSNull()
224
209
  }
225
- )
226
- }
210
+
211
+ resolve(result)
212
+ },
213
+ onError: { error in
214
+ reject("FETCH_ON_DEMAND_REPORTS_FAILED", error.localizedDescription, error)
215
+ }
216
+ )
217
+ }
227
218
 
228
219
  @objc(fetchProductImageBase64:withResolver:withRejecter:)
229
220
  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-5",
3
+ "version": "0.1.0-beta-6",
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",