@doorstepai/dropoff-sdk 1.0.30 → 1.0.32

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 (34) hide show
  1. package/android/build.gradle +2 -1
  2. package/android/src/main/java/com/doorstepai/dropoffsdk/DoorstepAIModule.kt +107 -3
  3. package/ios/DoorstepAI.mm +16 -1
  4. package/ios/DoorstepAI.swift +53 -2
  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 +306 -12
  9. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +14 -4
  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 +14 -4
  12. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +11 -11
  13. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
  14. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +816 -780
  15. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
  16. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Info.plist +0 -0
  17. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +306 -12
  18. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +14 -4
  19. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  20. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +14 -4
  21. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +306 -12
  22. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +14 -4
  23. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  24. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +14 -4
  25. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +21 -21
  26. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
  27. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +816 -780
  28. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +815 -782
  29. package/lib/module/DoorstepAI.js +64 -16
  30. package/lib/module/DoorstepAI.js.map +1 -1
  31. package/lib/typescript/src/DoorstepAI.d.ts +2 -1
  32. package/lib/typescript/src/DoorstepAI.d.ts.map +1 -1
  33. package/package.json +1 -1
  34. package/src/DoorstepAI.tsx +71 -16
@@ -86,7 +86,8 @@ 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:1.0.17")
89
+ implementation("ai.doorstep.com:doorstepai-dropoff-sdk:1.0.21")
90
90
  api "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1"
91
91
  }
92
92
 
93
+
@@ -66,6 +66,36 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
66
66
  }
67
67
  }
68
68
 
69
+ @ReactMethod
70
+ fun startDeliveryByAddressString(address: String, deliveryId: String, promise: Promise) {
71
+ try {
72
+ DoorstepAI.startDeliveryByAddressString(address, deliveryId) { result ->
73
+ result.onSuccess { message ->
74
+ promise.resolve(message)
75
+ }.onFailure { error ->
76
+ promise.reject("DELIVERY_ERROR", error.message ?: "Promise Rejection: Failed to start delivery by address string")
77
+ }
78
+ }
79
+ } catch (e: Exception) {
80
+ promise.reject("DELIVERY_ERROR", e.message ?: "Failed to start delivery by address string")
81
+ }
82
+ }
83
+
84
+ @ReactMethod
85
+ fun startDeliveryByLatLng(latitude: Double, longitude: Double, deliveryId: String, promise: Promise) {
86
+ try {
87
+ DoorstepAI.startDeliveryByLatLng(latitude, longitude, deliveryId) { result ->
88
+ result.onSuccess { message ->
89
+ promise.resolve(message)
90
+ }.onFailure { error ->
91
+ promise.reject("DELIVERY_ERROR", error.message ?: "Promise Rejection: Failed to start delivery by lat/lng")
92
+ }
93
+ }
94
+ } catch (e: Exception) {
95
+ promise.reject("DELIVERY_ERROR", e.message ?: "Failed to start delivery by lat/lng")
96
+ }
97
+ }
98
+
69
99
  @ReactMethod
70
100
  fun startDeliveryByAddress(
71
101
  addressMap: ReadableMap,
@@ -130,16 +160,90 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
130
160
  fun enableDevMode(promise: Promise) {
131
161
  CoroutineScope(Dispatchers.IO).launch {
132
162
  try {
133
- /*android.util.Log.i("DoorstepAI", "Attempting to enable dev mode...")
134
163
  val result = DoorstepAI.enableDevMode()
135
- android.util.Log.i("DoorstepAI", "Dev mode enabled: $result")
136
- promise.resolve(result)*/
164
+ promise.resolve(result)
137
165
  } catch (e: Exception) {
138
166
  promise.reject("DEV_MODE_ERROR", e.message ?: "Failed to enable dev mode")
139
167
  }
140
168
  }
141
169
  }
142
170
 
171
+ @ReactMethod
172
+ fun validateDevModeAccess(promise: Promise) {
173
+ CoroutineScope(Dispatchers.IO).launch {
174
+ try {
175
+ val result = DoorstepAI.validateDevModeAccess()
176
+ promise.resolve(result)
177
+ } catch (e: Exception) {
178
+ promise.reject("DEV_MODE_VALIDATE_ERROR", e.message ?: "Failed to validate dev mode access")
179
+ }
180
+ }
181
+ }
182
+
183
+ @ReactMethod
184
+ fun hasCachedData(promise: Promise) {
185
+ CoroutineScope(Dispatchers.IO).launch {
186
+ try {
187
+ val result = DoorstepAI.hasCachedData()
188
+ promise.resolve(result)
189
+ } catch (e: Exception) {
190
+ promise.reject("HAS_CACHED_DATA_ERROR", e.message ?: "Failed to check cached data")
191
+ }
192
+ }
193
+ }
194
+
195
+ @ReactMethod
196
+ fun waitForCachedDataCompletion(promise: Promise) {
197
+ CoroutineScope(Dispatchers.IO).launch {
198
+ try {
199
+ val result = DoorstepAI.waitForCachedDataCompletion()
200
+ promise.resolve(result)
201
+ } catch (e: Exception) {
202
+ promise.reject("WAIT_CACHED_DATA_ERROR", e.message ?: "Failed while waiting for cached data completion")
203
+ }
204
+ }
205
+ }
206
+
207
+ @ReactMethod
208
+ fun isCacheProcessingInProgress(promise: Promise) {
209
+ try {
210
+ val result = DoorstepAI.isCacheProcessingInProgress()
211
+ promise.resolve(result)
212
+ } catch (e: Exception) {
213
+ promise.reject("CACHE_PROCESSING_STATUS_ERROR", e.message ?: "Failed to check cache processing status")
214
+ }
215
+ }
216
+
217
+ @ReactMethod
218
+ fun hasPendingNetworkRequests(promise: Promise) {
219
+ try {
220
+ val result = DoorstepAI.hasPendingNetworkRequests()
221
+ promise.resolve(result)
222
+ } catch (e: Exception) {
223
+ promise.reject("PENDING_NETWORK_REQUESTS_ERROR", e.message ?: "Failed to check pending network requests")
224
+ }
225
+ }
226
+
227
+ @ReactMethod
228
+ fun getPendingNetworkRequestsCount(promise: Promise) {
229
+ try {
230
+ val result = DoorstepAI.getPendingNetworkRequestsCount()
231
+ promise.resolve(result)
232
+ } catch (e: Exception) {
233
+ promise.reject("PENDING_NETWORK_REQUESTS_COUNT_ERROR", e.message ?: "Failed to get pending network requests count")
234
+ }
235
+ }
236
+
237
+ @ReactMethod
238
+ fun disableDevMode(promise: Promise) {
239
+ try {
240
+ DoorstepAI.disableDevMode()
241
+ promise.resolve(true)
242
+ } catch (e: Exception) {
243
+ promise.reject("DEV_MODE_DISABLE_ERROR", e.message ?: "Failed to disable dev mode")
244
+ }
245
+ }
246
+
143
247
  companion object {
144
248
  const val NAME = "DoorstepAI"
145
249
  }
package/ios/DoorstepAI.mm CHANGED
@@ -3,7 +3,9 @@
3
3
  @interface RCT_EXTERN_MODULE(DoorstepAI, NSObject)
4
4
 
5
5
  RCT_EXTERN_METHOD(setApiKey:(NSString *)apiKey)
6
- RCT_EXTERN_METHOD(setDevMode:(BOOL)devModeEnabled)
6
+ RCT_EXTERN_METHOD(enableDevMode:(NSString *)apiKey
7
+ resolver:(RCTPromiseResolveBlock)resolve
8
+ rejecter:(RCTPromiseRejectBlock)reject)
7
9
  RCT_EXTERN_METHOD(startDeliveryByPlaceID:(NSString *)placeID
8
10
  deliveryId:(NSString *)deliveryId
9
11
  resolver:(RCTPromiseResolveBlock)resolve
@@ -16,6 +18,15 @@ RCT_EXTERN_METHOD(startDeliveryByAddress:(NSDictionary *)address
16
18
  deliveryId:(NSString *)deliveryId
17
19
  resolver:(RCTPromiseResolveBlock)resolve
18
20
  rejecter:(RCTPromiseRejectBlock)reject)
21
+ RCT_EXTERN_METHOD(startDeliveryByAddressString:(NSString *)address
22
+ deliveryId:(NSString *)deliveryId
23
+ resolver:(RCTPromiseResolveBlock)resolve
24
+ rejecter:(RCTPromiseRejectBlock)reject)
25
+ RCT_EXTERN_METHOD(startDeliveryByLatLng:(nonnull NSNumber *)latitude
26
+ longitude:(nonnull NSNumber *)longitude
27
+ deliveryId:(NSString *)deliveryId
28
+ resolver:(RCTPromiseResolveBlock)resolve
29
+ rejecter:(RCTPromiseRejectBlock)reject)
19
30
  RCT_EXTERN_METHOD(newEvent:(NSString *)eventName
20
31
  deliveryId:(NSString *)deliveryId
21
32
  resolver:(RCTPromiseResolveBlock)resolve
@@ -23,5 +34,9 @@ RCT_EXTERN_METHOD(newEvent:(NSString *)eventName
23
34
  RCT_EXTERN_METHOD(stopDelivery:(NSString *)deliveryId
24
35
  resolver:(RCTPromiseResolveBlock)resolve
25
36
  rejecter:(RCTPromiseRejectBlock)reject)
37
+ RCT_EXTERN_METHOD(hasCachedData:(RCTPromiseResolveBlock)resolve
38
+ rejecter:(RCTPromiseRejectBlock)reject)
39
+ RCT_EXTERN_METHOD(waitForCacheDataCompletion:(RCTPromiseResolveBlock)resolve
40
+ rejecter:(RCTPromiseRejectBlock)reject)
26
41
 
27
42
  @end
@@ -24,8 +24,13 @@ class DoorstepAIBridge: NSObject {
24
24
  }
25
25
 
26
26
  @objc
27
- func setDevMode(_ devModeEnabled: Bool) {
28
- DoorstepAI.enableDevMode()
27
+ func enableDevMode(_ apiKey: NSString,
28
+ resolver resolve: @escaping RCTPromiseResolveBlock,
29
+ rejecter reject: @escaping RCTPromiseRejectBlock) {
30
+ Task {
31
+ await DoorstepAI.enableDevMode(apiKey: apiKey as String)
32
+ resolve(nil)
33
+ }
29
34
  }
30
35
 
31
36
  @objc
@@ -64,6 +69,37 @@ class DoorstepAIBridge: NSObject {
64
69
  }
65
70
  }
66
71
 
72
+ @objc
73
+ func startDeliveryByAddressString(_ address: NSString,
74
+ deliveryId: NSString,
75
+ resolver resolve: @escaping RCTPromiseResolveBlock,
76
+ rejecter reject: @escaping RCTPromiseRejectBlock) {
77
+ Task {
78
+ do {
79
+ try await DoorstepAI.startDeliveryByAddressString(address: address as String, deliveryId: deliveryId as String)
80
+ resolve(nil)
81
+ } catch {
82
+ reject("E_START_DELIVERY", "Failed to start delivery by Address String: \(error.localizedDescription)", error)
83
+ }
84
+ }
85
+ }
86
+
87
+ @objc
88
+ func startDeliveryByLatLng(_ latitude: NSNumber,
89
+ longitude: NSNumber,
90
+ deliveryId: NSString,
91
+ resolver resolve: @escaping RCTPromiseResolveBlock,
92
+ rejecter reject: @escaping RCTPromiseRejectBlock) {
93
+ Task {
94
+ do {
95
+ try await DoorstepAI.startDeliveryByLatLng(latitude: latitude.doubleValue, longitude: longitude.doubleValue, deliveryId: deliveryId as String)
96
+ resolve(nil)
97
+ } catch {
98
+ reject("E_START_DELIVERY", "Failed to start delivery by LatLng: \(error.localizedDescription)", error)
99
+ }
100
+ }
101
+ }
102
+
67
103
  @objc
68
104
  func startDeliveryByAddress(_ address: [String: Any],
69
105
  deliveryId: NSString,
@@ -125,4 +161,19 @@ class DoorstepAIBridge: NSObject {
125
161
  }
126
162
  }
127
163
 
164
+ @objc
165
+ func hasCachedData(_ resolve: @escaping RCTPromiseResolveBlock,
166
+ rejecter reject: @escaping RCTPromiseRejectBlock) {
167
+ resolve(DoorstepAI.hasCachedData())
168
+ }
169
+
170
+ @objc
171
+ func waitForCacheDataCompletion(_ resolve: @escaping RCTPromiseResolveBlock,
172
+ rejecter reject: @escaping RCTPromiseRejectBlock) {
173
+ Task {
174
+ let result = await DoorstepAI.waitForCacheDataCompletion()
175
+ resolve(result)
176
+ }
177
+ }
178
+
128
179
  }
@@ -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>