@doorstepai/dropoff-sdk 0.1.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/DropoffSdk.podspec +27 -0
- package/LICENSE +20 -0
- package/README.md +33 -0
- package/android/build.gradle +93 -0
- package/android/gradle.properties +5 -0
- package/android/libs/doorstepai-tracking-sdk-api-prod-release.aar +0 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/doorstepai/dropoffsdk/DoorstepAIModule.kt +126 -0
- package/android/src/main/java/com/doorstepai/dropoffsdk/DropoffSdkPackage.kt +20 -0
- package/ios/DoorstepAI.mm +21 -0
- package/ios/DoorstepAI.swift +108 -0
- package/ios/DoorstepDropoffSDK.xcframework/Info.plist +48 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Headers/DoorstepDropoffSDK.h +18 -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 +1779 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +66 -0
- 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 +66 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/module.modulemap +6 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +179 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Info.plist +20 -0
- 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 +705 -0
- 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/Headers/DoorstepDropoffSDK.h +18 -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 +1779 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +66 -0
- 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 +66 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1779 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +66 -0
- 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 +66 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/module.modulemap +6 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +234 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Info.plist +20 -0
- 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 +705 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +704 -0
- package/ios/DropoffSdk-Bridging-Header.h +2 -0
- package/ios/RootDoorstepAIViewManager.mm +5 -0
- package/ios/RootDoorstepAIViewManager.swift +15 -0
- package/lib/module/DoorstepAI.js +66 -0
- package/lib/module/DoorstepAI.js.map +1 -0
- package/lib/module/RootDoorstepAI.js +25 -0
- package/lib/module/RootDoorstepAI.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/DoorstepAI.d.ts +19 -0
- package/lib/typescript/src/DoorstepAI.d.ts.map +1 -0
- package/lib/typescript/src/RootDoorstepAI.d.ts +4 -0
- package/lib/typescript/src/RootDoorstepAI.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +157 -0
- package/src/DoorstepAI.tsx +92 -0
- package/src/RootDoorstepAI.tsx +30 -0
- package/src/index.tsx +8 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "DropoffSdk"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.source = { :git => "https://github.com/sheelpatel0118/doorstepai-dropoff-sdk.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
17
|
+
|
|
18
|
+
s.vendored_frameworks = "ios/DoorstepDropoffSDK.xcframework"
|
|
19
|
+
|
|
20
|
+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
21
|
+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
22
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
23
|
+
install_modules_dependencies(s)
|
|
24
|
+
else
|
|
25
|
+
s.dependency "React-Core"
|
|
26
|
+
end
|
|
27
|
+
end
|
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Sheel Patel
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @doorstepai/dropoff-sdk
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @doorstepai/dropoff-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import { multiply } from '@doorstepai/dropoff-sdk';
|
|
16
|
+
|
|
17
|
+
// ...
|
|
18
|
+
|
|
19
|
+
const result = await multiply(3, 7);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Contributing
|
|
24
|
+
|
|
25
|
+
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
MIT
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['DropoffSdk_' + name]
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
repositories {
|
|
7
|
+
google()
|
|
8
|
+
mavenCentral()
|
|
9
|
+
flatDir {
|
|
10
|
+
dirs 'libs'
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
dependencies {
|
|
15
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
16
|
+
// noinspection DifferentKotlinGradleVersion
|
|
17
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
18
|
+
classpath "org.jetbrains.kotlin:kotlin-serialization:${getExtOrDefault('kotlinVersion')}"
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
apply plugin: "com.android.library"
|
|
25
|
+
apply plugin: "kotlin-android"
|
|
26
|
+
apply plugin: 'kotlinx-serialization'
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def getExtOrIntegerDefault(name) {
|
|
30
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["DropoffSdk_" + name]).toInteger()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
def supportsNamespace() {
|
|
34
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
35
|
+
def major = parsed[0].toInteger()
|
|
36
|
+
def minor = parsed[1].toInteger()
|
|
37
|
+
|
|
38
|
+
// Namespace support was added in 7.3.0
|
|
39
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
android {
|
|
43
|
+
if (supportsNamespace()) {
|
|
44
|
+
namespace "com.doorstepai.dropoffsdk"
|
|
45
|
+
|
|
46
|
+
sourceSets {
|
|
47
|
+
main {
|
|
48
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
54
|
+
|
|
55
|
+
defaultConfig {
|
|
56
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
57
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
buildTypes {
|
|
61
|
+
release {
|
|
62
|
+
minifyEnabled false
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
lintOptions {
|
|
67
|
+
disable "GradleCompatible"
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
compileOptions {
|
|
71
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
72
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
repositories {
|
|
77
|
+
mavenCentral()
|
|
78
|
+
google()
|
|
79
|
+
flatDir {
|
|
80
|
+
dirs 'libs'
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
85
|
+
|
|
86
|
+
dependencies {
|
|
87
|
+
implementation "com.facebook.react:react-android"
|
|
88
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
89
|
+
// implementation(name: "doorstepai-tracking-sdk-api-dev-debug", ext: "aar")
|
|
90
|
+
implementation fileTree(dir: 'libs', include: ['*.aar'])
|
|
91
|
+
api "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1"
|
|
92
|
+
}
|
|
93
|
+
|
|
Binary file
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
package com.doorstepai.dropoffsdk
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.NativeModule
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.bridge.ReactContext
|
|
6
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
7
|
+
import com.facebook.react.bridge.ReactMethod
|
|
8
|
+
import com.facebook.react.bridge.Promise
|
|
9
|
+
import com.doorstepai.sdks.tracking.DoorstepAI
|
|
10
|
+
import com.doorstepai.sdks.tracking.AddressType
|
|
11
|
+
|
|
12
|
+
class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
|
|
13
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
14
|
+
|
|
15
|
+
override fun getName(): String {
|
|
16
|
+
return NAME
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@ReactMethod
|
|
20
|
+
fun init(promise: Promise) {
|
|
21
|
+
try {
|
|
22
|
+
DoorstepAI.init(reactContext) { result ->
|
|
23
|
+
result.onSuccess {
|
|
24
|
+
promise.resolve(true)
|
|
25
|
+
}.onFailure { error ->
|
|
26
|
+
promise.reject("INIT_ERROR", error.message ?: "Promise Rejection: Failed to initialize DoorstepAI")
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
} catch (e: Exception) {
|
|
30
|
+
promise.reject("INIT_ERROR", e.message ?: "Failed to initialize DoorstepAI")
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@ReactMethod
|
|
35
|
+
fun startDeliveryByPlaceID(placeID: String, promise: Promise) {
|
|
36
|
+
try {
|
|
37
|
+
DoorstepAI.startDeliveryByPlaceID(placeID) { result ->
|
|
38
|
+
result.onSuccess {
|
|
39
|
+
promise.resolve(true)
|
|
40
|
+
}.onFailure { error ->
|
|
41
|
+
promise.reject("DELIVERY_ERROR", error.message ?: "Promise Rejection: Failed to start delivery")
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
} catch (e: Exception) {
|
|
45
|
+
promise.reject("DELIVERY_ERROR", e.message ?: "Failed to start delivery")
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@ReactMethod
|
|
50
|
+
fun startDeliveryByPlusCode(plusCode: String, promise: Promise) {
|
|
51
|
+
try {
|
|
52
|
+
DoorstepAI.startDeliveryByPlusCode(plusCode) { result ->
|
|
53
|
+
result.onSuccess {
|
|
54
|
+
promise.resolve(true)
|
|
55
|
+
}.onFailure { error ->
|
|
56
|
+
promise.reject("DELIVERY_ERROR", error.message ?: "Promise Rejection: Failed to start delivery")
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
} catch (e: Exception) {
|
|
60
|
+
promise.reject("DELIVERY_ERROR", e.message ?: "Failed to start delivery")
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@ReactMethod
|
|
65
|
+
fun startDeliveryByAddress(
|
|
66
|
+
streetNumber: String,
|
|
67
|
+
route: String,
|
|
68
|
+
locality: String,
|
|
69
|
+
administrativeAreaLevel1: String,
|
|
70
|
+
postalCode: String,
|
|
71
|
+
promise: Promise
|
|
72
|
+
) {
|
|
73
|
+
try {
|
|
74
|
+
val address = AddressType(
|
|
75
|
+
streetNumber = streetNumber,
|
|
76
|
+
route = route,
|
|
77
|
+
locality = locality,
|
|
78
|
+
administrativeAreaLevel1 = administrativeAreaLevel1,
|
|
79
|
+
postalCode = postalCode
|
|
80
|
+
)
|
|
81
|
+
DoorstepAI.startDeliveryByAddressType(address) { result ->
|
|
82
|
+
result.onSuccess {
|
|
83
|
+
promise.resolve(true)
|
|
84
|
+
}.onFailure { error ->
|
|
85
|
+
promise.reject("DELIVERY_ERROR", error.message ?: "Promise Rejection: Failed to start delivery by address")
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
} catch (e: Exception) {
|
|
89
|
+
promise.reject("DELIVERY_ERROR", e.message ?: "Failed to start delivery by address")
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@ReactMethod
|
|
94
|
+
fun newEvent(eventName: String, promise: Promise) {
|
|
95
|
+
try {
|
|
96
|
+
DoorstepAI.newEvent(eventName) { result ->
|
|
97
|
+
result.onSuccess {
|
|
98
|
+
promise.resolve(true)
|
|
99
|
+
}.onFailure { error ->
|
|
100
|
+
promise.reject("EVENT CREATION ERROR", error.message ?: "Promise Rejection: Failed to save event")
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
} catch (e: Exception) {
|
|
104
|
+
promise.reject("EVENT CREATION ERROR", e.message ?: "Failed to save event")
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@ReactMethod
|
|
109
|
+
fun stopDelivery(promise: Promise) {
|
|
110
|
+
try {
|
|
111
|
+
DoorstepAI.stopDelivery()
|
|
112
|
+
promise.resolve(true)
|
|
113
|
+
} catch (e: Exception) {
|
|
114
|
+
promise.reject("DELIVERY STOP", e.message ?: "Failed to stop delivery")
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
119
|
+
fun setApiKey(key: String) {
|
|
120
|
+
DoorstepAI.setAPIKey(key)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
companion object {
|
|
124
|
+
const val NAME = "DoorstepAI"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
package com.doorstepai.dropoffsdk
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.uimanager.ViewManager
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class DropoffSdkPackage : ReactPackage {
|
|
10
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
11
|
+
return listOf(
|
|
12
|
+
DoorstepAIModule(reactContext)
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
17
|
+
return emptyList()
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
|
|
3
|
+
@interface RCT_EXTERN_MODULE(DoorstepAI, NSObject)
|
|
4
|
+
|
|
5
|
+
RCT_EXTERN_METHOD(setApiKey:(NSString *)apiKey)
|
|
6
|
+
RCT_EXTERN_METHOD(startDeliveryByPlaceID:(NSString *)placeID
|
|
7
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
8
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
9
|
+
RCT_EXTERN_METHOD(startDeliveryByPlusCode:(NSString *)plusCode
|
|
10
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
11
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
12
|
+
RCT_EXTERN_METHOD(startDeliveryByAddress:(NSString *)addressJSON
|
|
13
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
14
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
15
|
+
RCT_EXTERN_METHOD(newEvent:(NSString *)eventName
|
|
16
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
17
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
18
|
+
RCT_EXTERN_METHOD(stopDelivery:(RCTPromiseResolveBlock)resolve
|
|
19
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
20
|
+
|
|
21
|
+
@end
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import React
|
|
3
|
+
import DoorstepDropoffSDK
|
|
4
|
+
|
|
5
|
+
@objc(DoorstepAI)
|
|
6
|
+
class DoorstepAIBridge: NSObject {
|
|
7
|
+
|
|
8
|
+
@objc
|
|
9
|
+
static func requiresMainQueueSetup() -> Bool {
|
|
10
|
+
return true
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@objc
|
|
14
|
+
func setApiKey(_ apiKey: String) {
|
|
15
|
+
DoorstepAI.setApiKey(key: apiKey)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@objc
|
|
19
|
+
func startDeliveryByPlaceID(_ placeID: NSString,
|
|
20
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
21
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
22
|
+
// Use Swift's concurrency support to call the async method.
|
|
23
|
+
Task {
|
|
24
|
+
do {
|
|
25
|
+
try await DoorstepAI.startDeliveryByPlaceID(placeID: placeID as String)
|
|
26
|
+
resolve(nil)
|
|
27
|
+
} catch {
|
|
28
|
+
reject("E_START_DELIVERY", "Failed to start delivery by Place ID: \(error.localizedDescription)", error)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@objc
|
|
34
|
+
func startDeliveryByPlusCode(_ plusCode: NSString,
|
|
35
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
36
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
37
|
+
Task {
|
|
38
|
+
do {
|
|
39
|
+
try await DoorstepAI.startDeliveryByPlusCode(plusCode: plusCode as String)
|
|
40
|
+
resolve(nil)
|
|
41
|
+
} catch {
|
|
42
|
+
reject("E_START_DELIVERY", "Failed to start delivery by Plus Code: \(error.localizedDescription)", error)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@objc
|
|
48
|
+
func startDeliveryByAddress(_ addressJSON: NSString,
|
|
49
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
50
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
51
|
+
guard let data = (addressJSON as String).data(using: .utf8) else {
|
|
52
|
+
reject("E_INVALID_ADDRESS", "Invalid JSON string format.", nil)
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
Task {
|
|
57
|
+
do {
|
|
58
|
+
guard let jsonObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any],
|
|
59
|
+
let streetNumber = jsonObject["streetNumber"] as? String,
|
|
60
|
+
let route = jsonObject["route"] as? String,
|
|
61
|
+
let locality = jsonObject["locality"] as? String,
|
|
62
|
+
let administrativeAreaLevel1 = jsonObject["administrativeAreaLevel1"] as? String,
|
|
63
|
+
let postalCode = jsonObject["postalCode"] as? String else {
|
|
64
|
+
reject("E_INVALID_ADDRESS", "Missing or invalid fields in address JSON.", nil)
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
let address = AddressType(streetNumber: streetNumber,
|
|
69
|
+
route: route,
|
|
70
|
+
locality: locality,
|
|
71
|
+
administrativeAreaLevel1: administrativeAreaLevel1,
|
|
72
|
+
postalCode: postalCode)
|
|
73
|
+
|
|
74
|
+
try await DoorstepAI.startDeliveryByAddressType(address: address)
|
|
75
|
+
resolve(nil)
|
|
76
|
+
} catch let error as DoorstepAIError {
|
|
77
|
+
reject("E_START_DELIVERY", "Failed to start delivery by address: \(error.localizedDescription)", error)
|
|
78
|
+
} catch {
|
|
79
|
+
reject("E_JSON_PARSING", "Failed to parse address JSON: \(error.localizedDescription)", error)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@objc
|
|
85
|
+
func newEvent(_ eventName: NSString,
|
|
86
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
87
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
88
|
+
Task {
|
|
89
|
+
do {
|
|
90
|
+
try await DoorstepAI.newEvent(eventName: eventName as String)
|
|
91
|
+
resolve(nil)
|
|
92
|
+
} catch {
|
|
93
|
+
reject("E_NEW_EVENT", "Failed to send event: \(error.localizedDescription)", error)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@objc
|
|
99
|
+
func stopDelivery(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
100
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
101
|
+
Task {
|
|
102
|
+
// stopDelivery does not throw so we simply await its completion
|
|
103
|
+
await DoorstepAI.stopDelivery()
|
|
104
|
+
resolve(nil)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>AvailableLibraries</key>
|
|
6
|
+
<array>
|
|
7
|
+
<dict>
|
|
8
|
+
<key>BinaryPath</key>
|
|
9
|
+
<string>DoorstepDropoffSDK.framework/DoorstepDropoffSDK</string>
|
|
10
|
+
<key>DebugSymbolsPath</key>
|
|
11
|
+
<string>dSYMs</string>
|
|
12
|
+
<key>LibraryIdentifier</key>
|
|
13
|
+
<string>ios-arm64</string>
|
|
14
|
+
<key>LibraryPath</key>
|
|
15
|
+
<string>DoorstepDropoffSDK.framework</string>
|
|
16
|
+
<key>SupportedArchitectures</key>
|
|
17
|
+
<array>
|
|
18
|
+
<string>arm64</string>
|
|
19
|
+
</array>
|
|
20
|
+
<key>SupportedPlatform</key>
|
|
21
|
+
<string>ios</string>
|
|
22
|
+
</dict>
|
|
23
|
+
<dict>
|
|
24
|
+
<key>BinaryPath</key>
|
|
25
|
+
<string>DoorstepDropoffSDK.framework/DoorstepDropoffSDK</string>
|
|
26
|
+
<key>DebugSymbolsPath</key>
|
|
27
|
+
<string>dSYMs</string>
|
|
28
|
+
<key>LibraryIdentifier</key>
|
|
29
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
30
|
+
<key>LibraryPath</key>
|
|
31
|
+
<string>DoorstepDropoffSDK.framework</string>
|
|
32
|
+
<key>SupportedArchitectures</key>
|
|
33
|
+
<array>
|
|
34
|
+
<string>arm64</string>
|
|
35
|
+
<string>x86_64</string>
|
|
36
|
+
</array>
|
|
37
|
+
<key>SupportedPlatform</key>
|
|
38
|
+
<string>ios</string>
|
|
39
|
+
<key>SupportedPlatformVariant</key>
|
|
40
|
+
<string>simulator</string>
|
|
41
|
+
</dict>
|
|
42
|
+
</array>
|
|
43
|
+
<key>CFBundlePackageType</key>
|
|
44
|
+
<string>XFWK</string>
|
|
45
|
+
<key>XCFrameworkFormatVersion</key>
|
|
46
|
+
<string>1.0</string>
|
|
47
|
+
</dict>
|
|
48
|
+
</plist>
|
package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/DoorstepDropoffSDK
ADDED
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// DoorstepDropoffSDK.h
|
|
3
|
+
// DoorstepDropoffSDK
|
|
4
|
+
//
|
|
5
|
+
// Created by Sheel Patel on 3/13/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
|
|
10
|
+
//! Project version number for DoorstepDropoffSDK.
|
|
11
|
+
FOUNDATION_EXPORT double DoorstepDropoffSDKVersionNumber;
|
|
12
|
+
|
|
13
|
+
//! Project version string for DoorstepDropoffSDK.
|
|
14
|
+
FOUNDATION_EXPORT const unsigned char DoorstepDropoffSDKVersionString[];
|
|
15
|
+
|
|
16
|
+
// In this header, you should import all the public headers of your framework using statements like #import <DoorstepDropoffSDK/PublicHeader.h>
|
|
17
|
+
|
|
18
|
+
|