@doorstepai/dropoff-sdk 1.0.31 → 2.0.0
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/android/build.gradle +2 -1
- package/android/src/main/java/com/doorstepai/dropoffsdk/DoorstepAIModule.kt +156 -8
- package/ios/DoorstepAI.mm +26 -1
- package/ios/DoorstepAI.swift +115 -5
- package/ios/DoorstepDropoffSDK.xcframework/Info.plist +5 -5
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Info.plist +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.abi.json +1907 -264
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +62 -8
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftinterface +62 -8
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +11 -11
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +1451 -791
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Info.plist +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +1907 -264
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +62 -8
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +62 -8
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1907 -264
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +62 -8
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +62 -8
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +21 -21
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +1451 -791
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +1446 -793
- package/lib/module/DoorstepAI.js +52 -26
- package/lib/module/DoorstepAI.js.map +1 -1
- package/lib/typescript/src/DoorstepAI.d.ts +6 -4
- package/lib/typescript/src/DoorstepAI.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/DoorstepAI.tsx +98 -26
package/android/build.gradle
CHANGED
|
@@ -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:
|
|
89
|
+
implementation("ai.doorstep.com:doorstepai-dropoff-sdk:2.0.0")
|
|
90
90
|
api "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1"
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
|
|
@@ -8,6 +8,7 @@ import com.facebook.react.bridge.ReactMethod
|
|
|
8
8
|
import com.facebook.react.bridge.Promise
|
|
9
9
|
import com.doorstepai.sdks.tracking.DoorstepAI
|
|
10
10
|
import com.doorstepai.sdks.tracking.AddressType
|
|
11
|
+
import com.doorstepai.sdks.tracking.DropoffType
|
|
11
12
|
import com.facebook.react.bridge.ReadableMap
|
|
12
13
|
import kotlinx.coroutines.Dispatchers
|
|
13
14
|
import kotlinx.coroutines.CoroutineScope
|
|
@@ -37,9 +38,14 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
@ReactMethod
|
|
40
|
-
fun startDeliveryByPlaceID(
|
|
41
|
+
fun startDeliveryByPlaceID(
|
|
42
|
+
placeID: String,
|
|
43
|
+
deliveryId: String,
|
|
44
|
+
timeoutSeconds: Double?,
|
|
45
|
+
promise: Promise
|
|
46
|
+
) {
|
|
41
47
|
try {
|
|
42
|
-
DoorstepAI.startDeliveryByPlaceID(placeID, deliveryId) { result ->
|
|
48
|
+
DoorstepAI.startDeliveryByPlaceID(placeID, deliveryId, timeoutSeconds) { result ->
|
|
43
49
|
result.onSuccess { sessionId ->
|
|
44
50
|
promise.resolve(sessionId)
|
|
45
51
|
}.onFailure { error ->
|
|
@@ -52,9 +58,14 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
|
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
@ReactMethod
|
|
55
|
-
fun startDeliveryByPlusCode(
|
|
61
|
+
fun startDeliveryByPlusCode(
|
|
62
|
+
plusCode: String,
|
|
63
|
+
deliveryId: String,
|
|
64
|
+
timeoutSeconds: Double?,
|
|
65
|
+
promise: Promise
|
|
66
|
+
) {
|
|
56
67
|
try {
|
|
57
|
-
DoorstepAI.startDeliveryByPlusCode(plusCode, deliveryId) { result ->
|
|
68
|
+
DoorstepAI.startDeliveryByPlusCode(plusCode, deliveryId, timeoutSeconds) { result ->
|
|
58
69
|
result.onSuccess { sessionId ->
|
|
59
70
|
promise.resolve(sessionId)
|
|
60
71
|
}.onFailure { error ->
|
|
@@ -66,10 +77,53 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
|
|
|
66
77
|
}
|
|
67
78
|
}
|
|
68
79
|
|
|
80
|
+
@ReactMethod
|
|
81
|
+
fun startDeliveryByAddressString(
|
|
82
|
+
address: String,
|
|
83
|
+
deliveryId: String,
|
|
84
|
+
timeoutSeconds: Double?,
|
|
85
|
+
promise: Promise
|
|
86
|
+
) {
|
|
87
|
+
try {
|
|
88
|
+
DoorstepAI.startDeliveryByAddressString(address, deliveryId, timeoutSeconds) { result ->
|
|
89
|
+
result.onSuccess { message ->
|
|
90
|
+
promise.resolve(message)
|
|
91
|
+
}.onFailure { error ->
|
|
92
|
+
promise.reject("DELIVERY_ERROR", error.message ?: "Promise Rejection: Failed to start delivery by address string")
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} catch (e: Exception) {
|
|
96
|
+
promise.reject("DELIVERY_ERROR", e.message ?: "Failed to start delivery by address string")
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@ReactMethod
|
|
101
|
+
fun startDeliveryByLatLng(
|
|
102
|
+
latitude: Double,
|
|
103
|
+
longitude: Double,
|
|
104
|
+
subUnit: String,
|
|
105
|
+
deliveryId: String,
|
|
106
|
+
timeoutSeconds: Double?,
|
|
107
|
+
promise: Promise
|
|
108
|
+
) {
|
|
109
|
+
try {
|
|
110
|
+
DoorstepAI.startDeliveryByLatLng(latitude, longitude, subUnit, deliveryId, timeoutSeconds) { result ->
|
|
111
|
+
result.onSuccess { message ->
|
|
112
|
+
promise.resolve(message)
|
|
113
|
+
}.onFailure { error ->
|
|
114
|
+
promise.reject("DELIVERY_ERROR", error.message ?: "Promise Rejection: Failed to start delivery by lat/lng")
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} catch (e: Exception) {
|
|
118
|
+
promise.reject("DELIVERY_ERROR", e.message ?: "Failed to start delivery by lat/lng")
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
69
122
|
@ReactMethod
|
|
70
123
|
fun startDeliveryByAddress(
|
|
71
124
|
addressMap: ReadableMap,
|
|
72
125
|
deliveryId: String,
|
|
126
|
+
timeoutSeconds: Double?,
|
|
73
127
|
promise: Promise
|
|
74
128
|
) {
|
|
75
129
|
try {
|
|
@@ -89,7 +143,7 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
|
|
|
89
143
|
postalCode = postalCode
|
|
90
144
|
)
|
|
91
145
|
|
|
92
|
-
DoorstepAI.startDeliveryByAddressType(address, deliveryId) { result ->
|
|
146
|
+
DoorstepAI.startDeliveryByAddressType(address, deliveryId, timeoutSeconds) { result ->
|
|
93
147
|
result.onSuccess { sessionId ->
|
|
94
148
|
promise.resolve(sessionId)
|
|
95
149
|
}.onFailure { error ->
|
|
@@ -111,6 +165,26 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
|
|
|
111
165
|
}
|
|
112
166
|
}
|
|
113
167
|
|
|
168
|
+
@ReactMethod
|
|
169
|
+
fun markDropoff(deliveryId: String, dropoffType: String, promise: Promise) {
|
|
170
|
+
CoroutineScope(Dispatchers.IO).launch {
|
|
171
|
+
try {
|
|
172
|
+
val type = when (dropoffType.uppercase()) {
|
|
173
|
+
"POD" -> DropoffType.POD
|
|
174
|
+
"NON_POD" -> DropoffType.NON_POD
|
|
175
|
+
else -> {
|
|
176
|
+
promise.reject("DROP_OFF_TYPE_ERROR", "Invalid dropoff type: $dropoffType")
|
|
177
|
+
return@launch
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
DoorstepAI.markDropoff(deliveryId, type)
|
|
181
|
+
promise.resolve(true)
|
|
182
|
+
} catch (e: Exception) {
|
|
183
|
+
promise.reject("DROP_OFF_ERROR", e.message ?: "Failed to mark dropoff")
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
114
188
|
@ReactMethod
|
|
115
189
|
fun stopDelivery(deliveryId: String, promise: Promise) {
|
|
116
190
|
try {
|
|
@@ -130,16 +204,90 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
|
|
|
130
204
|
fun enableDevMode(promise: Promise) {
|
|
131
205
|
CoroutineScope(Dispatchers.IO).launch {
|
|
132
206
|
try {
|
|
133
|
-
/*android.util.Log.i("DoorstepAI", "Attempting to enable dev mode...")
|
|
134
207
|
val result = DoorstepAI.enableDevMode()
|
|
135
|
-
|
|
136
|
-
promise.resolve(result)*/
|
|
208
|
+
promise.resolve(result)
|
|
137
209
|
} catch (e: Exception) {
|
|
138
210
|
promise.reject("DEV_MODE_ERROR", e.message ?: "Failed to enable dev mode")
|
|
139
211
|
}
|
|
140
212
|
}
|
|
141
213
|
}
|
|
142
214
|
|
|
215
|
+
@ReactMethod
|
|
216
|
+
fun validateDevModeAccess(promise: Promise) {
|
|
217
|
+
CoroutineScope(Dispatchers.IO).launch {
|
|
218
|
+
try {
|
|
219
|
+
val result = DoorstepAI.validateDevModeAccess()
|
|
220
|
+
promise.resolve(result)
|
|
221
|
+
} catch (e: Exception) {
|
|
222
|
+
promise.reject("DEV_MODE_VALIDATE_ERROR", e.message ?: "Failed to validate dev mode access")
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@ReactMethod
|
|
228
|
+
fun hasCachedData(promise: Promise) {
|
|
229
|
+
CoroutineScope(Dispatchers.IO).launch {
|
|
230
|
+
try {
|
|
231
|
+
val result = DoorstepAI.hasCachedData()
|
|
232
|
+
promise.resolve(result)
|
|
233
|
+
} catch (e: Exception) {
|
|
234
|
+
promise.reject("HAS_CACHED_DATA_ERROR", e.message ?: "Failed to check cached data")
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
@ReactMethod
|
|
240
|
+
fun waitForCachedDataCompletion(promise: Promise) {
|
|
241
|
+
CoroutineScope(Dispatchers.IO).launch {
|
|
242
|
+
try {
|
|
243
|
+
val result = DoorstepAI.waitForCachedDataCompletion()
|
|
244
|
+
promise.resolve(result)
|
|
245
|
+
} catch (e: Exception) {
|
|
246
|
+
promise.reject("WAIT_CACHED_DATA_ERROR", e.message ?: "Failed while waiting for cached data completion")
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
@ReactMethod
|
|
252
|
+
fun isCacheProcessingInProgress(promise: Promise) {
|
|
253
|
+
try {
|
|
254
|
+
val result = DoorstepAI.isCacheProcessingInProgress()
|
|
255
|
+
promise.resolve(result)
|
|
256
|
+
} catch (e: Exception) {
|
|
257
|
+
promise.reject("CACHE_PROCESSING_STATUS_ERROR", e.message ?: "Failed to check cache processing status")
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
@ReactMethod
|
|
262
|
+
fun hasPendingNetworkRequests(promise: Promise) {
|
|
263
|
+
try {
|
|
264
|
+
val result = DoorstepAI.hasPendingNetworkRequests()
|
|
265
|
+
promise.resolve(result)
|
|
266
|
+
} catch (e: Exception) {
|
|
267
|
+
promise.reject("PENDING_NETWORK_REQUESTS_ERROR", e.message ?: "Failed to check pending network requests")
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
@ReactMethod
|
|
272
|
+
fun getPendingNetworkRequestsCount(promise: Promise) {
|
|
273
|
+
try {
|
|
274
|
+
val result = DoorstepAI.getPendingNetworkRequestsCount()
|
|
275
|
+
promise.resolve(result)
|
|
276
|
+
} catch (e: Exception) {
|
|
277
|
+
promise.reject("PENDING_NETWORK_REQUESTS_COUNT_ERROR", e.message ?: "Failed to get pending network requests count")
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
@ReactMethod
|
|
282
|
+
fun disableDevMode(promise: Promise) {
|
|
283
|
+
try {
|
|
284
|
+
DoorstepAI.disableDevMode()
|
|
285
|
+
promise.resolve(true)
|
|
286
|
+
} catch (e: Exception) {
|
|
287
|
+
promise.reject("DEV_MODE_DISABLE_ERROR", e.message ?: "Failed to disable dev mode")
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
143
291
|
companion object {
|
|
144
292
|
const val NAME = "DoorstepAI"
|
|
145
293
|
}
|
package/ios/DoorstepAI.mm
CHANGED
|
@@ -3,25 +3,50 @@
|
|
|
3
3
|
@interface RCT_EXTERN_MODULE(DoorstepAI, NSObject)
|
|
4
4
|
|
|
5
5
|
RCT_EXTERN_METHOD(setApiKey:(NSString *)apiKey)
|
|
6
|
-
RCT_EXTERN_METHOD(
|
|
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
|
|
11
|
+
timeoutSeconds:(NSNumber *)timeoutSeconds
|
|
9
12
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
10
13
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
11
14
|
RCT_EXTERN_METHOD(startDeliveryByPlusCode:(NSString *)plusCode
|
|
12
15
|
deliveryId:(NSString *)deliveryId
|
|
16
|
+
timeoutSeconds:(NSNumber *)timeoutSeconds
|
|
13
17
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
14
18
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
15
19
|
RCT_EXTERN_METHOD(startDeliveryByAddress:(NSDictionary *)address
|
|
16
20
|
deliveryId:(NSString *)deliveryId
|
|
21
|
+
timeoutSeconds:(NSNumber *)timeoutSeconds
|
|
22
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
23
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
24
|
+
RCT_EXTERN_METHOD(startDeliveryByAddressString:(NSString *)address
|
|
25
|
+
deliveryId:(NSString *)deliveryId
|
|
26
|
+
timeoutSeconds:(NSNumber *)timeoutSeconds
|
|
27
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
28
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
29
|
+
RCT_EXTERN_METHOD(startDeliveryByLatLng:(nonnull NSNumber *)latitude
|
|
30
|
+
longitude:(nonnull NSNumber *)longitude
|
|
31
|
+
subUnit:(NSString *)subUnit
|
|
32
|
+
deliveryId:(NSString *)deliveryId
|
|
33
|
+
timeoutSeconds:(NSNumber *)timeoutSeconds
|
|
17
34
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
18
35
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
19
36
|
RCT_EXTERN_METHOD(newEvent:(NSString *)eventName
|
|
20
37
|
deliveryId:(NSString *)deliveryId
|
|
21
38
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
22
39
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
40
|
+
RCT_EXTERN_METHOD(markDropoff:(NSString *)deliveryId
|
|
41
|
+
dropoffType:(NSString *)dropoffType
|
|
42
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
43
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
23
44
|
RCT_EXTERN_METHOD(stopDelivery:(NSString *)deliveryId
|
|
24
45
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
25
46
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
47
|
+
RCT_EXTERN_METHOD(hasCachedData:(RCTPromiseResolveBlock)resolve
|
|
48
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
49
|
+
RCT_EXTERN_METHOD(waitForCacheDataCompletion:(RCTPromiseResolveBlock)resolve
|
|
50
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
26
51
|
|
|
27
52
|
@end
|
package/ios/DoorstepAI.swift
CHANGED
|
@@ -24,8 +24,13 @@ class DoorstepAIBridge: NSObject {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
@objc
|
|
27
|
-
func
|
|
28
|
-
|
|
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
|
|
@@ -36,12 +41,18 @@ class DoorstepAIBridge: NSObject {
|
|
|
36
41
|
@objc
|
|
37
42
|
func startDeliveryByPlaceID(_ placeID: NSString,
|
|
38
43
|
deliveryId: NSString,
|
|
44
|
+
timeoutSeconds: NSNumber?,
|
|
39
45
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
40
46
|
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
41
47
|
// Use Swift's concurrency support to call the async method.
|
|
42
48
|
Task {
|
|
43
49
|
do {
|
|
44
|
-
|
|
50
|
+
let timeout = timeoutSeconds?.doubleValue
|
|
51
|
+
try await DoorstepAI.startDeliveryByPlaceID(
|
|
52
|
+
placeID: placeID as String,
|
|
53
|
+
deliveryId: deliveryId as String,
|
|
54
|
+
timeoutSeconds: timeout
|
|
55
|
+
)
|
|
45
56
|
resolve(nil)
|
|
46
57
|
} catch {
|
|
47
58
|
reject("E_START_DELIVERY", "Failed to start delivery by Place ID: \(error.localizedDescription)", error)
|
|
@@ -52,11 +63,17 @@ class DoorstepAIBridge: NSObject {
|
|
|
52
63
|
@objc
|
|
53
64
|
func startDeliveryByPlusCode(_ plusCode: NSString,
|
|
54
65
|
deliveryId: NSString,
|
|
66
|
+
timeoutSeconds: NSNumber?,
|
|
55
67
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
56
68
|
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
57
69
|
Task {
|
|
58
70
|
do {
|
|
59
|
-
|
|
71
|
+
let timeout = timeoutSeconds?.doubleValue
|
|
72
|
+
try await DoorstepAI.startDeliveryByPlusCode(
|
|
73
|
+
plusCode: plusCode as String,
|
|
74
|
+
deliveryId: deliveryId as String,
|
|
75
|
+
timeoutSeconds: timeout
|
|
76
|
+
)
|
|
60
77
|
resolve(nil)
|
|
61
78
|
} catch {
|
|
62
79
|
reject("E_START_DELIVERY", "Failed to start delivery by Plus Code: \(error.localizedDescription)", error)
|
|
@@ -64,9 +81,56 @@ class DoorstepAIBridge: NSObject {
|
|
|
64
81
|
}
|
|
65
82
|
}
|
|
66
83
|
|
|
84
|
+
@objc
|
|
85
|
+
func startDeliveryByAddressString(_ address: NSString,
|
|
86
|
+
deliveryId: NSString,
|
|
87
|
+
timeoutSeconds: NSNumber?,
|
|
88
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
89
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
90
|
+
Task {
|
|
91
|
+
do {
|
|
92
|
+
let timeout = timeoutSeconds?.doubleValue
|
|
93
|
+
try await DoorstepAI.startDeliveryByAddressString(
|
|
94
|
+
address: address as String,
|
|
95
|
+
deliveryId: deliveryId as String,
|
|
96
|
+
timeoutSeconds: timeout
|
|
97
|
+
)
|
|
98
|
+
resolve(nil)
|
|
99
|
+
} catch {
|
|
100
|
+
reject("E_START_DELIVERY", "Failed to start delivery by Address String: \(error.localizedDescription)", error)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@objc
|
|
106
|
+
func startDeliveryByLatLng(_ latitude: NSNumber,
|
|
107
|
+
longitude: NSNumber,
|
|
108
|
+
subUnit: NSString,
|
|
109
|
+
deliveryId: NSString,
|
|
110
|
+
timeoutSeconds: NSNumber?,
|
|
111
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
112
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
113
|
+
Task {
|
|
114
|
+
do {
|
|
115
|
+
let timeout = timeoutSeconds?.doubleValue
|
|
116
|
+
try await DoorstepAI.startDeliveryByLatLng(
|
|
117
|
+
latitude: latitude.doubleValue,
|
|
118
|
+
longitude: longitude.doubleValue,
|
|
119
|
+
subUnit: subUnit as String,
|
|
120
|
+
deliveryId: deliveryId as String,
|
|
121
|
+
timeoutSeconds: timeout
|
|
122
|
+
)
|
|
123
|
+
resolve(nil)
|
|
124
|
+
} catch {
|
|
125
|
+
reject("E_START_DELIVERY", "Failed to start delivery by LatLng: \(error.localizedDescription)", error)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
67
130
|
@objc
|
|
68
131
|
func startDeliveryByAddress(_ address: [String: Any],
|
|
69
132
|
deliveryId: NSString,
|
|
133
|
+
timeoutSeconds: NSNumber?,
|
|
70
134
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
71
135
|
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
72
136
|
Task {
|
|
@@ -89,7 +153,12 @@ class DoorstepAIBridge: NSObject {
|
|
|
89
153
|
administrativeAreaLevel1: administrativeAreaLevel1,
|
|
90
154
|
postalCode: postalCode)
|
|
91
155
|
|
|
92
|
-
|
|
156
|
+
let timeout = timeoutSeconds?.doubleValue
|
|
157
|
+
try await DoorstepAI.startDeliveryByAddressType(
|
|
158
|
+
address: addressStruct,
|
|
159
|
+
deliveryId: deliveryId as String,
|
|
160
|
+
timeoutSeconds: timeout
|
|
161
|
+
)
|
|
93
162
|
resolve(nil)
|
|
94
163
|
} catch let error as DoorstepAIError {
|
|
95
164
|
reject("E_START_DELIVERY", "Failed to start delivery by address: \(error.localizedDescription)", error)
|
|
@@ -114,6 +183,32 @@ class DoorstepAIBridge: NSObject {
|
|
|
114
183
|
}
|
|
115
184
|
}
|
|
116
185
|
|
|
186
|
+
@objc
|
|
187
|
+
func markDropoff(_ deliveryId: NSString,
|
|
188
|
+
dropoffType: NSString,
|
|
189
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
190
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
191
|
+
Task {
|
|
192
|
+
do {
|
|
193
|
+
let normalized = (dropoffType as String).lowercased()
|
|
194
|
+
let type: DropoffType
|
|
195
|
+
switch normalized {
|
|
196
|
+
case "pod":
|
|
197
|
+
type = .pod
|
|
198
|
+
case "non_pod":
|
|
199
|
+
type = .non_pod
|
|
200
|
+
default:
|
|
201
|
+
reject("E_DROP_OFF_TYPE", "Invalid dropoff type: \(dropoffType)", nil)
|
|
202
|
+
return
|
|
203
|
+
}
|
|
204
|
+
try await DoorstepAI.markDropoff(deliveryId: deliveryId as String, dropoffType: type)
|
|
205
|
+
resolve(nil)
|
|
206
|
+
} catch {
|
|
207
|
+
reject("E_DROP_OFF", "Failed to mark dropoff: \(error.localizedDescription)", error)
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
117
212
|
@objc
|
|
118
213
|
func stopDelivery(_ deliveryId: NSString,
|
|
119
214
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
@@ -125,4 +220,19 @@ class DoorstepAIBridge: NSObject {
|
|
|
125
220
|
}
|
|
126
221
|
}
|
|
127
222
|
|
|
223
|
+
@objc
|
|
224
|
+
func hasCachedData(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
225
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
226
|
+
resolve(DoorstepAI.hasCachedData())
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
@objc
|
|
230
|
+
func waitForCacheDataCompletion(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
231
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
232
|
+
Task {
|
|
233
|
+
let result = await DoorstepAI.waitForCacheDataCompletion()
|
|
234
|
+
resolve(result)
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
128
238
|
}
|
|
@@ -10,15 +10,18 @@
|
|
|
10
10
|
<key>DebugSymbolsPath</key>
|
|
11
11
|
<string>dSYMs</string>
|
|
12
12
|
<key>LibraryIdentifier</key>
|
|
13
|
-
<string>ios-
|
|
13
|
+
<string>ios-arm64_x86_64-simulator</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>
|
|
19
20
|
</array>
|
|
20
21
|
<key>SupportedPlatform</key>
|
|
21
22
|
<string>ios</string>
|
|
23
|
+
<key>SupportedPlatformVariant</key>
|
|
24
|
+
<string>simulator</string>
|
|
22
25
|
</dict>
|
|
23
26
|
<dict>
|
|
24
27
|
<key>BinaryPath</key>
|
|
@@ -26,18 +29,15 @@
|
|
|
26
29
|
<key>DebugSymbolsPath</key>
|
|
27
30
|
<string>dSYMs</string>
|
|
28
31
|
<key>LibraryIdentifier</key>
|
|
29
|
-
<string>ios-
|
|
32
|
+
<string>ios-arm64</string>
|
|
30
33
|
<key>LibraryPath</key>
|
|
31
34
|
<string>DoorstepDropoffSDK.framework</string>
|
|
32
35
|
<key>SupportedArchitectures</key>
|
|
33
36
|
<array>
|
|
34
37
|
<string>arm64</string>
|
|
35
|
-
<string>x86_64</string>
|
|
36
38
|
</array>
|
|
37
39
|
<key>SupportedPlatform</key>
|
|
38
40
|
<string>ios</string>
|
|
39
|
-
<key>SupportedPlatformVariant</key>
|
|
40
|
-
<string>simulator</string>
|
|
41
41
|
</dict>
|
|
42
42
|
</array>
|
|
43
43
|
<key>CFBundlePackageType</key>
|