@doorstepai/dropoff-sdk 2.0.1 → 2.0.3

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.
Files changed (40) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/doorstepai/dropoffsdk/DoorstepAIModule.kt +16 -3
  3. package/ios/DoorstepAI.mm +2 -0
  4. package/ios/DoorstepAI.swift +15 -15
  5. package/ios/DoorstepDropoffSDK.xcframework/Info.plist +5 -5
  6. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
  7. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Info.plist +0 -0
  8. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.abi.json +959 -430
  9. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +17 -19
  10. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  11. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftinterface +17 -19
  12. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/PrivacyInfo.xcprivacy +39 -0
  13. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +22 -11
  14. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
  15. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +1583 -1451
  16. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
  17. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Info.plist +0 -0
  18. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +959 -430
  19. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +17 -19
  20. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  21. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +17 -19
  22. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +959 -430
  23. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +17 -19
  24. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  25. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +17 -19
  26. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/PrivacyInfo.xcprivacy +39 -0
  27. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +32 -21
  28. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
  29. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +1583 -1451
  30. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +1578 -1446
  31. package/lib/module/DoorstepAI.js +5 -12
  32. package/lib/module/DoorstepAI.js.map +1 -1
  33. package/lib/module/index.js.map +1 -1
  34. package/lib/typescript/src/DoorstepAI.d.ts +7 -2
  35. package/lib/typescript/src/DoorstepAI.d.ts.map +1 -1
  36. package/lib/typescript/src/index.d.ts +1 -0
  37. package/lib/typescript/src/index.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/src/DoorstepAI.tsx +13 -9
  40. package/src/index.tsx +1 -0
@@ -86,7 +86,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
86
86
  dependencies {
87
87
  implementation "com.facebook.react:react-android"
88
88
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
89
- implementation("ai.doorstep.com:doorstepai-dropoff-sdk:2.0.0")
89
+ implementation("ai.doorstep.com:doorstepai-dropoff-sdk:2.0.3")
90
90
  api "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1"
91
91
  }
92
92
 
@@ -9,6 +9,7 @@ import com.facebook.react.bridge.Promise
9
9
  import com.doorstepai.sdks.tracking.DoorstepAI
10
10
  import com.doorstepai.sdks.tracking.AddressType
11
11
  import com.doorstepai.sdks.tracking.DropoffType
12
+ import com.doorstepai.sdks.tracking.LatLngObject
12
13
  import com.facebook.react.bridge.ReadableMap
13
14
  import kotlinx.coroutines.Dispatchers
14
15
  import kotlinx.coroutines.CoroutineScope
@@ -81,11 +82,13 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
81
82
  fun startDeliveryByAddressString(
82
83
  address: String,
83
84
  deliveryId: String,
85
+ coordinates: ReadableMap?,
84
86
  timeoutSeconds: Double?,
85
87
  promise: Promise
86
88
  ) {
87
89
  try {
88
- DoorstepAI.startDeliveryByAddressString(address, deliveryId, timeoutSeconds) { result ->
90
+ val coords = parseCoordinates(coordinates)
91
+ DoorstepAI.startDeliveryByAddressString(address, deliveryId, coords, timeoutSeconds) { result ->
89
92
  result.onSuccess { message ->
90
93
  promise.resolve(message)
91
94
  }.onFailure { error ->
@@ -123,6 +126,7 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
123
126
  fun startDeliveryByAddress(
124
127
  addressMap: ReadableMap,
125
128
  deliveryId: String,
129
+ coordinates: ReadableMap?,
126
130
  timeoutSeconds: Double?,
127
131
  promise: Promise
128
132
  ) {
@@ -143,7 +147,8 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
143
147
  postalCode = postalCode
144
148
  )
145
149
 
146
- DoorstepAI.startDeliveryByAddressType(address, deliveryId, timeoutSeconds) { result ->
150
+ val coords = parseCoordinates(coordinates)
151
+ DoorstepAI.startDeliveryByAddressType(address, deliveryId, coords, timeoutSeconds) { result ->
147
152
  result.onSuccess { sessionId ->
148
153
  promise.resolve(sessionId)
149
154
  }.onFailure { error ->
@@ -196,8 +201,9 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
196
201
  }
197
202
 
198
203
  @ReactMethod(isBlockingSynchronousMethod = true)
199
- fun setApiKey(key: String) {
204
+ fun setApiKey(key: String): Boolean {
200
205
  DoorstepAI.setAPIKey(key)
206
+ return true
201
207
  }
202
208
 
203
209
  @ReactMethod
@@ -288,6 +294,13 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
288
294
  }
289
295
  }
290
296
 
297
+ private fun parseCoordinates(map: ReadableMap?): LatLngObject? {
298
+ if (map == null) return null
299
+ val lat = if (map.hasKey("lat")) map.getDouble("lat") else return null
300
+ val lng = if (map.hasKey("lng")) map.getDouble("lng") else return null
301
+ return LatLngObject(lat = lat, lng = lng)
302
+ }
303
+
291
304
  companion object {
292
305
  const val NAME = "DoorstepAI"
293
306
  }
package/ios/DoorstepAI.mm CHANGED
@@ -18,11 +18,13 @@ RCT_EXTERN_METHOD(startDeliveryByPlusCode:(nonnull NSString *)plusCode
18
18
  rejecter:(RCTPromiseRejectBlock)reject)
19
19
  RCT_EXTERN_METHOD(startDeliveryByAddress:(nonnull NSDictionary *)address
20
20
  deliveryId:(nonnull NSString *)deliveryId
21
+ coordinates:(nullable NSDictionary *)coordinates
21
22
  timeoutSeconds:(nullable NSNumber *)timeoutSeconds
22
23
  resolver:(RCTPromiseResolveBlock)resolve
23
24
  rejecter:(RCTPromiseRejectBlock)reject)
24
25
  RCT_EXTERN_METHOD(startDeliveryByAddressString:(nonnull NSString *)address
25
26
  deliveryId:(nonnull NSString *)deliveryId
27
+ coordinates:(nullable NSDictionary *)coordinates
26
28
  timeoutSeconds:(nullable NSNumber *)timeoutSeconds
27
29
  resolver:(RCTPromiseResolveBlock)resolve
28
30
  rejecter:(RCTPromiseRejectBlock)reject)
@@ -1,23 +1,9 @@
1
1
  import Foundation
2
2
  import React
3
3
  import DoorstepDropoffSDK
4
- import CoreLocation
5
4
 
6
5
  @objc(DoorstepAI)
7
6
  class DoorstepAIBridge: NSObject {
8
- private let locationManager = CLLocationManager()
9
-
10
- override init() {
11
- super.init()
12
- locationManager.showsBackgroundLocationIndicator = true
13
- locationManager.allowsBackgroundLocationUpdates = true
14
- locationManager.pausesLocationUpdatesAutomatically = false
15
-
16
- // Request authorization
17
- locationManager.requestAlwaysAuthorization()
18
-
19
- }
20
-
21
7
  @objc
22
8
  static func requiresMainQueueSetup() -> Bool {
23
9
  return true
@@ -84,15 +70,18 @@ class DoorstepAIBridge: NSObject {
84
70
  @objc
85
71
  func startDeliveryByAddressString(_ address: NSString,
86
72
  deliveryId: NSString,
73
+ coordinates: NSDictionary?,
87
74
  timeoutSeconds: NSNumber?,
88
75
  resolver resolve: @escaping RCTPromiseResolveBlock,
89
76
  rejecter reject: @escaping RCTPromiseRejectBlock) {
90
77
  Task {
91
78
  do {
92
79
  let timeout = timeoutSeconds?.doubleValue
80
+ let coords = parseCoordinates(coordinates)
93
81
  try await DoorstepAI.startDeliveryByAddressString(
94
82
  address: address as String,
95
83
  deliveryId: deliveryId as String,
84
+ coordinates: coords,
96
85
  timeoutSeconds: timeout
97
86
  )
98
87
  resolve(nil)
@@ -130,11 +119,11 @@ class DoorstepAIBridge: NSObject {
130
119
  @objc
131
120
  func startDeliveryByAddress(_ address: [String: Any],
132
121
  deliveryId: NSString,
122
+ coordinates: NSDictionary?,
133
123
  timeoutSeconds: NSNumber?,
134
124
  resolver resolve: @escaping RCTPromiseResolveBlock,
135
125
  rejecter reject: @escaping RCTPromiseRejectBlock) {
136
126
  Task {
137
- print("Starting delivery by address: \(address)")
138
127
  do {
139
128
  guard let streetNumber = address["streetNumber"] as? String,
140
129
  let route = address["route"] as? String,
@@ -154,9 +143,11 @@ class DoorstepAIBridge: NSObject {
154
143
  postalCode: postalCode)
155
144
 
156
145
  let timeout = timeoutSeconds?.doubleValue
146
+ let coords = parseCoordinates(coordinates)
157
147
  try await DoorstepAI.startDeliveryByAddressType(
158
148
  address: addressStruct,
159
149
  deliveryId: deliveryId as String,
150
+ coordinates: coords,
160
151
  timeoutSeconds: timeout
161
152
  )
162
153
  resolve(nil)
@@ -235,4 +226,13 @@ class DoorstepAIBridge: NSObject {
235
226
  }
236
227
  }
237
228
 
229
+ private func parseCoordinates(_ raw: NSDictionary?) -> LatLngObject? {
230
+ guard let coordinates = raw as? [String: Any],
231
+ let lat = coordinates["lat"] as? Double,
232
+ let lng = coordinates["lng"] as? Double else {
233
+ return nil
234
+ }
235
+ return LatLngObject(lat: lat, lng: lng)
236
+ }
237
+
238
238
  }
@@ -10,18 +10,15 @@
10
10
  <key>DebugSymbolsPath</key>
11
11
  <string>dSYMs</string>
12
12
  <key>LibraryIdentifier</key>
13
- <string>ios-arm64_x86_64-simulator</string>
13
+ <string>ios-arm64</string>
14
14
  <key>LibraryPath</key>
15
15
  <string>DoorstepDropoffSDK.framework</string>
16
16
  <key>SupportedArchitectures</key>
17
17
  <array>
18
18
  <string>arm64</string>
19
- <string>x86_64</string>
20
19
  </array>
21
20
  <key>SupportedPlatform</key>
22
21
  <string>ios</string>
23
- <key>SupportedPlatformVariant</key>
24
- <string>simulator</string>
25
22
  </dict>
26
23
  <dict>
27
24
  <key>BinaryPath</key>
@@ -29,15 +26,18 @@
29
26
  <key>DebugSymbolsPath</key>
30
27
  <string>dSYMs</string>
31
28
  <key>LibraryIdentifier</key>
32
- <string>ios-arm64</string>
29
+ <string>ios-arm64_x86_64-simulator</string>
33
30
  <key>LibraryPath</key>
34
31
  <string>DoorstepDropoffSDK.framework</string>
35
32
  <key>SupportedArchitectures</key>
36
33
  <array>
37
34
  <string>arm64</string>
35
+ <string>x86_64</string>
38
36
  </array>
39
37
  <key>SupportedPlatform</key>
40
38
  <string>ios</string>
39
+ <key>SupportedPlatformVariant</key>
40
+ <string>simulator</string>
41
41
  </dict>
42
42
  </array>
43
43
  <key>CFBundlePackageType</key>