@doorstepai/dropoff-sdk 2.0.2 → 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.
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/doorstepai/dropoffsdk/DoorstepAIModule.kt +16 -3
- package/ios/DoorstepAI.mm +2 -0
- package/ios/DoorstepAI.swift +15 -1
- 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 +931 -416
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +17 -19
- 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 +17 -19
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/PrivacyInfo.xcprivacy +39 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +22 -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 +1583 -1462
- 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 +931 -416
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +17 -19
- 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 +17 -19
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +931 -416
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +17 -19
- 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 +17 -19
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/PrivacyInfo.xcprivacy +39 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +32 -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 +1583 -1462
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +1578 -1457
- package/lib/module/DoorstepAI.js +5 -12
- package/lib/module/DoorstepAI.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/DoorstepAI.d.ts +7 -2
- package/lib/typescript/src/DoorstepAI.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/DoorstepAI.tsx +13 -9
- package/src/index.tsx +1 -0
package/android/build.gradle
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
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
|
-
|
|
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)
|
package/ios/DoorstepAI.swift
CHANGED
|
@@ -70,15 +70,18 @@ class DoorstepAIBridge: NSObject {
|
|
|
70
70
|
@objc
|
|
71
71
|
func startDeliveryByAddressString(_ address: NSString,
|
|
72
72
|
deliveryId: NSString,
|
|
73
|
+
coordinates: NSDictionary?,
|
|
73
74
|
timeoutSeconds: NSNumber?,
|
|
74
75
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
75
76
|
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
76
77
|
Task {
|
|
77
78
|
do {
|
|
78
79
|
let timeout = timeoutSeconds?.doubleValue
|
|
80
|
+
let coords = parseCoordinates(coordinates)
|
|
79
81
|
try await DoorstepAI.startDeliveryByAddressString(
|
|
80
82
|
address: address as String,
|
|
81
83
|
deliveryId: deliveryId as String,
|
|
84
|
+
coordinates: coords,
|
|
82
85
|
timeoutSeconds: timeout
|
|
83
86
|
)
|
|
84
87
|
resolve(nil)
|
|
@@ -116,11 +119,11 @@ class DoorstepAIBridge: NSObject {
|
|
|
116
119
|
@objc
|
|
117
120
|
func startDeliveryByAddress(_ address: [String: Any],
|
|
118
121
|
deliveryId: NSString,
|
|
122
|
+
coordinates: NSDictionary?,
|
|
119
123
|
timeoutSeconds: NSNumber?,
|
|
120
124
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
121
125
|
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
122
126
|
Task {
|
|
123
|
-
print("Starting delivery by address: \(address)")
|
|
124
127
|
do {
|
|
125
128
|
guard let streetNumber = address["streetNumber"] as? String,
|
|
126
129
|
let route = address["route"] as? String,
|
|
@@ -140,9 +143,11 @@ class DoorstepAIBridge: NSObject {
|
|
|
140
143
|
postalCode: postalCode)
|
|
141
144
|
|
|
142
145
|
let timeout = timeoutSeconds?.doubleValue
|
|
146
|
+
let coords = parseCoordinates(coordinates)
|
|
143
147
|
try await DoorstepAI.startDeliveryByAddressType(
|
|
144
148
|
address: addressStruct,
|
|
145
149
|
deliveryId: deliveryId as String,
|
|
150
|
+
coordinates: coords,
|
|
146
151
|
timeoutSeconds: timeout
|
|
147
152
|
)
|
|
148
153
|
resolve(nil)
|
|
@@ -221,4 +226,13 @@ class DoorstepAIBridge: NSObject {
|
|
|
221
226
|
}
|
|
222
227
|
}
|
|
223
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
|
+
|
|
224
238
|
}
|