@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,15 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
import DoorstepDropoffSDK
|
|
3
|
+
|
|
4
|
+
@objc(RootDoorstepAIViewManager)
|
|
5
|
+
class RootDoorstepAIViewManager: RCTViewManager {
|
|
6
|
+
override func view() -> UIView! {
|
|
7
|
+
let hostingController = UIHostingController(rootView: DoorstepAIRoot())
|
|
8
|
+
return hostingController.view
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
override static func requiresMainQueueSetup() -> Bool {
|
|
12
|
+
return true
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeModules, Platform } from 'react-native';
|
|
4
|
+
const {
|
|
5
|
+
DoorstepAI
|
|
6
|
+
} = NativeModules;
|
|
7
|
+
class DoorstepAIModule {
|
|
8
|
+
static isInitialized = false;
|
|
9
|
+
static async init() {
|
|
10
|
+
if (Platform.OS === 'android') {
|
|
11
|
+
if (this.isInitialized) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
await DoorstepAI.init();
|
|
16
|
+
console.log("DoorstepAI initialized");
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.error("Failed to initialize DoorstepAI:", error);
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
static setApiKey(apiKey) {
|
|
24
|
+
console.log("DOORSTEPAI MODULE: ", DoorstepAIModule);
|
|
25
|
+
console.log("setting api key");
|
|
26
|
+
console.log(DoorstepAI);
|
|
27
|
+
DoorstepAI.setApiKey(apiKey);
|
|
28
|
+
}
|
|
29
|
+
static async startDeliveryByPlaceID(placeID) {
|
|
30
|
+
await DoorstepAI.startDeliveryByPlaceID(placeID).then(() => {
|
|
31
|
+
console.log("Delivery started successfully");
|
|
32
|
+
}).catch(error => {
|
|
33
|
+
console.error("Failed to start delivery:", error);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
static startDeliveryByPlusCode(plusCode) {
|
|
37
|
+
DoorstepAI.startDeliveryByPlusCode(plusCode).then(() => {
|
|
38
|
+
console.log("Delivery started successfully");
|
|
39
|
+
}).catch(error => {
|
|
40
|
+
console.error("Failed to start delivery:", error);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
static startDeliveryByAddress(address) {
|
|
44
|
+
DoorstepAI.startDeliveryByAddress(address).then(() => {
|
|
45
|
+
console.log("Delivery started successfully");
|
|
46
|
+
}).catch(error => {
|
|
47
|
+
console.error("Failed to start delivery:", error);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
static stopDelivery() {
|
|
51
|
+
DoorstepAI.stopDelivery().then(() => {
|
|
52
|
+
console.log("Delivery stopped successfully");
|
|
53
|
+
}).catch(error => {
|
|
54
|
+
console.error("Failed to stop delivery:", error);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
static newEvent(eventName) {
|
|
58
|
+
DoorstepAI.newEvent(eventName).then(() => {
|
|
59
|
+
console.log("Event sent successfully");
|
|
60
|
+
}).catch(error => {
|
|
61
|
+
console.error("Failed to send event:", error);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export { DoorstepAIModule as DoorstepAI };
|
|
66
|
+
//# sourceMappingURL=DoorstepAI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","DoorstepAI","DoorstepAIModule","isInitialized","init","OS","console","log","error","setApiKey","apiKey","startDeliveryByPlaceID","placeID","then","catch","startDeliveryByPlusCode","plusCode","startDeliveryByAddress","address","stopDelivery","newEvent","eventName"],"sourceRoot":"../../src","sources":["DoorstepAI.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,MAAM;EAACC;AAAU,CAAC,GAAGF,aAAa;AAUlC,MAAMG,gBAAgB,CAAC;EACnB,OAAOC,aAAa,GAAG,KAAK;EAE5B,aAAaC,IAAIA,CAAA,EAAkB;IAC/B,IAAIJ,QAAQ,CAACK,EAAE,KAAK,SAAS,EAAE;MAC3B,IAAI,IAAI,CAACF,aAAa,EAAE;QACpB;MACJ;MACA,IAAI;QACA,MAAMF,UAAU,CAACG,IAAI,CAAC,CAAC;QACvBE,OAAO,CAACC,GAAG,CAAC,wBAAwB,CAAC;MACzC,CAAC,CAAC,OAAOC,KAAK,EAAE;QACZF,OAAO,CAACE,KAAK,CAAC,kCAAkC,EAAEA,KAAK,CAAC;QACxD,MAAMA,KAAK;MACf;IACJ;EAEJ;EAEA,OAAOC,SAASA,CAACC,MAAc,EAAE;IAC7BJ,OAAO,CAACC,GAAG,CAAC,qBAAqB,EAAEL,gBAAgB,CAAC;IACpDI,OAAO,CAACC,GAAG,CAAC,iBAAiB,CAAC;IAC9BD,OAAO,CAACC,GAAG,CAACN,UAAU,CAAC;IACvBA,UAAU,CAACQ,SAAS,CAACC,MAAM,CAAC;EAChC;EAEA,aAAaC,sBAAsBA,CAACC,OAAe,EAAE;IACjD,MAAMX,UAAU,CAACU,sBAAsB,CAACC,OAAO,CAAC,CAC3CC,IAAI,CAAC,MAAM;MACRP,OAAO,CAACC,GAAG,CAAC,+BAA+B,CAAC;IAChD,CAAC,CAAC,CACDO,KAAK,CAAEN,KAAU,IAAK;MACnBF,OAAO,CAACE,KAAK,CAAC,2BAA2B,EAAEA,KAAK,CAAC;IACrD,CAAC,CAAC;EACV;EAEA,OAAOO,uBAAuBA,CAACC,QAAgB,EAAE;IAC7Cf,UAAU,CAACc,uBAAuB,CAACC,QAAQ,CAAC,CACvCH,IAAI,CAAC,MAAM;MACRP,OAAO,CAACC,GAAG,CAAC,+BAA+B,CAAC;IAChD,CAAC,CAAC,CACDO,KAAK,CAAEN,KAAU,IAAK;MACnBF,OAAO,CAACE,KAAK,CAAC,2BAA2B,EAAEA,KAAK,CAAC;IACrD,CAAC,CAAC;EACV;EAEA,OAAOS,sBAAsBA,CAACC,OAAoB,EAAE;IAChDjB,UAAU,CAACgB,sBAAsB,CAACC,OAAO,CAAC,CACrCL,IAAI,CAAC,MAAM;MACRP,OAAO,CAACC,GAAG,CAAC,+BAA+B,CAAC;IAChD,CAAC,CAAC,CACDO,KAAK,CAAEN,KAAU,IAAK;MACnBF,OAAO,CAACE,KAAK,CAAC,2BAA2B,EAAEA,KAAK,CAAC;IACrD,CAAC,CAAC;EACV;EAEA,OAAOW,YAAYA,CAAA,EAAG;IAClBlB,UAAU,CAACkB,YAAY,CAAC,CAAC,CACpBN,IAAI,CAAC,MAAM;MACRP,OAAO,CAACC,GAAG,CAAC,+BAA+B,CAAC;IAChD,CAAC,CAAC,CACDO,KAAK,CAAEN,KAAU,IAAK;MACnBF,OAAO,CAACE,KAAK,CAAC,0BAA0B,EAAEA,KAAK,CAAC;IACpD,CAAC,CAAC;EACV;EAEA,OAAOY,QAAQA,CAACC,SAAiB,EAAE;IAC/BpB,UAAU,CAACmB,QAAQ,CAACC,SAAS,CAAC,CACzBR,IAAI,CAAC,MAAM;MACRP,OAAO,CAACC,GAAG,CAAC,yBAAyB,CAAC;IAC1C,CAAC,CAAC,CACDO,KAAK,CAAEN,KAAU,IAAK;MACnBF,OAAO,CAACE,KAAK,CAAC,uBAAuB,EAAEA,KAAK,CAAC;IACjD,CAAC,CAAC;EACV;AAEJ;AAEA,SACIN,gBAAgB,IAAID,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { requireNativeComponent, View, Platform } from 'react-native';
|
|
4
|
+
import { useEffect } from 'react';
|
|
5
|
+
import { DoorstepAI } from "./DoorstepAI.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const DoorstepAIView = requireNativeComponent('RootDoorstepAIView');
|
|
8
|
+
export function RootDoorstepAI(props) {
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
(async () => {
|
|
11
|
+
if (Platform.OS === 'android') {
|
|
12
|
+
await DoorstepAI.init();
|
|
13
|
+
}
|
|
14
|
+
DoorstepAI.setApiKey(props.apiKey);
|
|
15
|
+
})();
|
|
16
|
+
}, []);
|
|
17
|
+
return /*#__PURE__*/_jsx(View, {
|
|
18
|
+
style: {
|
|
19
|
+
height: 0,
|
|
20
|
+
width: 0
|
|
21
|
+
},
|
|
22
|
+
children: Platform.OS === 'ios' ? /*#__PURE__*/_jsx(DoorstepAIView, {}) : null
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=RootDoorstepAI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["requireNativeComponent","View","Platform","useEffect","DoorstepAI","jsx","_jsx","DoorstepAIView","RootDoorstepAI","props","OS","init","setApiKey","apiKey","style","height","width","children"],"sourceRoot":"../../src","sources":["RootDoorstepAI.tsx"],"mappings":";;AAAA,SACIA,sBAAsB,EACtBC,IAAI,EACJC,QAAQ,QACL,cAAc;AAErB,SACIC,SAAS,QACN,OAAO;AAEd,SAASC,UAAU,QAAQ,iBAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1C,MAAMC,cAAc,GAAGP,sBAAsB,CAAC,oBAAoB,CAAC;AACnE,OAAO,SAASQ,cAAcA,CAACC,KAAyB,EAAE;EAEtDN,SAAS,CAAC,MAAM;IACZ,CAAC,YAAY;MACT,IAAID,QAAQ,CAACQ,EAAE,KAAK,SAAS,EAAE;QAC3B,MAAMN,UAAU,CAACO,IAAI,CAAC,CAAC;MAC3B;MACAP,UAAU,CAACQ,SAAS,CAACH,KAAK,CAACI,MAAM,CAAC;IACtC,CAAC,EAAE,CAAC;EAER,CAAC,EAAE,EAAE,CAAC;EACN,oBACIP,IAAA,CAACL,IAAI;IAACa,KAAK,EAAE;MAACC,MAAM,EAAE,CAAC;MAAEC,KAAK,EAAE;IAAC,CAAE;IAAAC,QAAA,EAC9Bf,QAAQ,CAACQ,EAAE,KAAK,KAAK,gBAAGJ,IAAA,CAACC,cAAc,IAAE,CAAC,GAAG;EAAI,CAChD,CAAC;AAEf","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["RootDoorstepAI","DoorstepAI"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAAQA,cAAc,QAAO,qBAAkB;AAC/C,SAASC,UAAU,QAAQ,iBAAc;AAEzC,SACEA,UAAU,EACVD,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type AddressType = {
|
|
2
|
+
streetNumber: string;
|
|
3
|
+
route: string;
|
|
4
|
+
locality: string;
|
|
5
|
+
administrativeAreaLevel1: string;
|
|
6
|
+
postalCode: string;
|
|
7
|
+
};
|
|
8
|
+
declare class DoorstepAIModule {
|
|
9
|
+
static isInitialized: boolean;
|
|
10
|
+
static init(): Promise<void>;
|
|
11
|
+
static setApiKey(apiKey: string): void;
|
|
12
|
+
static startDeliveryByPlaceID(placeID: string): Promise<void>;
|
|
13
|
+
static startDeliveryByPlusCode(plusCode: string): void;
|
|
14
|
+
static startDeliveryByAddress(address: AddressType): void;
|
|
15
|
+
static stopDelivery(): void;
|
|
16
|
+
static newEvent(eventName: string): void;
|
|
17
|
+
}
|
|
18
|
+
export { DoorstepAIModule as DoorstepAI };
|
|
19
|
+
//# sourceMappingURL=DoorstepAI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/DoorstepAI.tsx"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB,EAAE,MAAM,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACtB,CAAA;AAED,cAAM,gBAAgB;IAClB,MAAM,CAAC,aAAa,UAAS;WAEhB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBlC,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM;WAOlB,sBAAsB,CAAC,OAAO,EAAE,MAAM;IAUnD,MAAM,CAAC,uBAAuB,CAAC,QAAQ,EAAE,MAAM;IAU/C,MAAM,CAAC,sBAAsB,CAAC,OAAO,EAAE,WAAW;IAUlD,MAAM,CAAC,YAAY;IAUnB,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM;CAUpC;AAED,OAAO,EACH,gBAAgB,IAAI,UAAU,EACjC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RootDoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/RootDoorstepAI.tsx"],"names":[],"mappings":"AAaA,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,2CAgBvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EACL,UAAU,EACV,cAAc,EACf,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@doorstepai/dropoff-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "doorstep.ai dropoff sdk",
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/module/index.js",
|
|
7
|
+
"private": false,
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"android",
|
|
19
|
+
"ios",
|
|
20
|
+
"cpp",
|
|
21
|
+
"*.podspec",
|
|
22
|
+
"react-native.config.js",
|
|
23
|
+
"!ios/build",
|
|
24
|
+
"!android/build",
|
|
25
|
+
"!android/gradle",
|
|
26
|
+
"!android/gradlew",
|
|
27
|
+
"!android/gradlew.bat",
|
|
28
|
+
"!android/local.properties",
|
|
29
|
+
"!**/__tests__",
|
|
30
|
+
"!**/__fixtures__",
|
|
31
|
+
"!**/__mocks__",
|
|
32
|
+
"!**/.*"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"example": "yarn workspace @doorstepai/dropoff-sdk-example",
|
|
36
|
+
"test": "jest",
|
|
37
|
+
"typecheck": "tsc",
|
|
38
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
39
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
40
|
+
"prepare": "bob build",
|
|
41
|
+
"release": "release-it"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"react-native",
|
|
45
|
+
"ios",
|
|
46
|
+
"android"
|
|
47
|
+
],
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/sheelpatel0118/doorstepai-dropoff-sdk.git"
|
|
51
|
+
},
|
|
52
|
+
"author": "Sheel Patel <sheel@doorstep.ai> (https://github.com/sheelpatel0118)",
|
|
53
|
+
"license": "MIT",
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/sheelpatel0118/doorstepai-dropoff-sdk/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/sheelpatel0118/doorstepai-dropoff-sdk#readme",
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"registry": "https://registry.npmjs.org/"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
63
|
+
"@eslint/compat": "^1.2.7",
|
|
64
|
+
"@eslint/eslintrc": "^3.3.0",
|
|
65
|
+
"@eslint/js": "^9.22.0",
|
|
66
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
67
|
+
"@react-native/eslint-config": "^0.78.0",
|
|
68
|
+
"@release-it/conventional-changelog": "^9.0.2",
|
|
69
|
+
"@types/jest": "^29.5.5",
|
|
70
|
+
"@types/react": "^19.0.0",
|
|
71
|
+
"commitlint": "^19.6.1",
|
|
72
|
+
"del-cli": "^5.1.0",
|
|
73
|
+
"eslint": "^9.22.0",
|
|
74
|
+
"eslint-config-prettier": "^10.1.1",
|
|
75
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
76
|
+
"esm": "^3.2.25",
|
|
77
|
+
"jest": "^29.7.0",
|
|
78
|
+
"patch-package": "^8.0.0",
|
|
79
|
+
"postinstall-postinstall": "^2.1.0",
|
|
80
|
+
"prettier": "^3.0.3",
|
|
81
|
+
"react": "19.0.0",
|
|
82
|
+
"react-native": "0.79.1",
|
|
83
|
+
"react-native-builder-bob": "0.39.1",
|
|
84
|
+
"release-it": "^17.10.0",
|
|
85
|
+
"turbo": "^1.10.7",
|
|
86
|
+
"typescript": "^5.2.2"
|
|
87
|
+
},
|
|
88
|
+
"peerDependencies": {
|
|
89
|
+
"react": "*",
|
|
90
|
+
"react-native": "*"
|
|
91
|
+
},
|
|
92
|
+
"workspaces": [
|
|
93
|
+
"example"
|
|
94
|
+
],
|
|
95
|
+
"packageManager": "yarn@3.6.1",
|
|
96
|
+
"jest": {
|
|
97
|
+
"preset": "react-native",
|
|
98
|
+
"modulePathIgnorePatterns": [
|
|
99
|
+
"<rootDir>/example/node_modules",
|
|
100
|
+
"<rootDir>/lib/"
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
"commitlint": {
|
|
104
|
+
"extends": [
|
|
105
|
+
"@commitlint/config-conventional"
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
"release-it": {
|
|
109
|
+
"git": {
|
|
110
|
+
"commitMessage": "chore: release ${version}",
|
|
111
|
+
"tagName": "v${version}"
|
|
112
|
+
},
|
|
113
|
+
"npm": {
|
|
114
|
+
"publish": true
|
|
115
|
+
},
|
|
116
|
+
"github": {
|
|
117
|
+
"release": true
|
|
118
|
+
},
|
|
119
|
+
"plugins": {
|
|
120
|
+
"@release-it/conventional-changelog": {
|
|
121
|
+
"preset": {
|
|
122
|
+
"name": "angular"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"prettier": {
|
|
128
|
+
"quoteProps": "consistent",
|
|
129
|
+
"singleQuote": true,
|
|
130
|
+
"tabWidth": 2,
|
|
131
|
+
"trailingComma": "es5",
|
|
132
|
+
"useTabs": false
|
|
133
|
+
},
|
|
134
|
+
"react-native-builder-bob": {
|
|
135
|
+
"source": "src",
|
|
136
|
+
"output": "lib",
|
|
137
|
+
"targets": [
|
|
138
|
+
[
|
|
139
|
+
"module",
|
|
140
|
+
{
|
|
141
|
+
"esm": true
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
[
|
|
145
|
+
"typescript",
|
|
146
|
+
{
|
|
147
|
+
"project": "tsconfig.build.json"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
"create-react-native-library": {
|
|
153
|
+
"type": "legacy-module",
|
|
154
|
+
"languages": "kotlin-swift",
|
|
155
|
+
"version": "0.49.2"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
const {DoorstepAI} = NativeModules;
|
|
3
|
+
|
|
4
|
+
type AddressType = {
|
|
5
|
+
streetNumber: string;
|
|
6
|
+
route: string;
|
|
7
|
+
locality: string;
|
|
8
|
+
administrativeAreaLevel1: string;
|
|
9
|
+
postalCode: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
class DoorstepAIModule {
|
|
13
|
+
static isInitialized = false;
|
|
14
|
+
|
|
15
|
+
static async init(): Promise<void> {
|
|
16
|
+
if (Platform.OS === 'android') {
|
|
17
|
+
if (this.isInitialized) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
await DoorstepAI.init();
|
|
22
|
+
console.log("DoorstepAI initialized");
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.error("Failed to initialize DoorstepAI:", error);
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static setApiKey(apiKey: string) {
|
|
32
|
+
console.log("DOORSTEPAI MODULE: ", DoorstepAIModule)
|
|
33
|
+
console.log("setting api key");
|
|
34
|
+
console.log(DoorstepAI);
|
|
35
|
+
DoorstepAI.setApiKey(apiKey);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static async startDeliveryByPlaceID(placeID: string) {
|
|
39
|
+
await DoorstepAI.startDeliveryByPlaceID(placeID)
|
|
40
|
+
.then(() => {
|
|
41
|
+
console.log("Delivery started successfully");
|
|
42
|
+
})
|
|
43
|
+
.catch((error: any) => {
|
|
44
|
+
console.error("Failed to start delivery:", error);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static startDeliveryByPlusCode(plusCode: string) {
|
|
49
|
+
DoorstepAI.startDeliveryByPlusCode(plusCode)
|
|
50
|
+
.then(() => {
|
|
51
|
+
console.log("Delivery started successfully");
|
|
52
|
+
})
|
|
53
|
+
.catch((error: any) => {
|
|
54
|
+
console.error("Failed to start delivery:", error);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static startDeliveryByAddress(address: AddressType) {
|
|
59
|
+
DoorstepAI.startDeliveryByAddress(address)
|
|
60
|
+
.then(() => {
|
|
61
|
+
console.log("Delivery started successfully");
|
|
62
|
+
})
|
|
63
|
+
.catch((error: any) => {
|
|
64
|
+
console.error("Failed to start delivery:", error);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static stopDelivery() {
|
|
69
|
+
DoorstepAI.stopDelivery()
|
|
70
|
+
.then(() => {
|
|
71
|
+
console.log("Delivery stopped successfully");
|
|
72
|
+
})
|
|
73
|
+
.catch((error: any) => {
|
|
74
|
+
console.error("Failed to stop delivery:", error);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static newEvent(eventName: string) {
|
|
79
|
+
DoorstepAI.newEvent(eventName)
|
|
80
|
+
.then(() => {
|
|
81
|
+
console.log("Event sent successfully");
|
|
82
|
+
})
|
|
83
|
+
.catch((error: any) => {
|
|
84
|
+
console.error("Failed to send event:", error);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export {
|
|
91
|
+
DoorstepAIModule as DoorstepAI
|
|
92
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
requireNativeComponent,
|
|
3
|
+
View,
|
|
4
|
+
Platform
|
|
5
|
+
} from 'react-native';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
useEffect,
|
|
9
|
+
} from 'react';
|
|
10
|
+
|
|
11
|
+
import { DoorstepAI } from './DoorstepAI';
|
|
12
|
+
|
|
13
|
+
const DoorstepAIView = requireNativeComponent('RootDoorstepAIView');
|
|
14
|
+
export function RootDoorstepAI(props: { apiKey: string }) {
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
(async () => {
|
|
18
|
+
if (Platform.OS === 'android') {
|
|
19
|
+
await DoorstepAI.init();
|
|
20
|
+
}
|
|
21
|
+
DoorstepAI.setApiKey(props.apiKey);
|
|
22
|
+
})()
|
|
23
|
+
|
|
24
|
+
}, [])
|
|
25
|
+
return (
|
|
26
|
+
<View style={{height: 0, width: 0}} >
|
|
27
|
+
{Platform.OS === 'ios' ? <DoorstepAIView /> : null}
|
|
28
|
+
</View>
|
|
29
|
+
)
|
|
30
|
+
}
|