airbridge-react-native-sdk-restricted 2.5.2
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/.eslintrc.json +44 -0
- package/.gitattributes +1 -0
- package/airbridge-react-native-sdk.podspec +32 -0
- package/android/build/.transforms/08e8d929b7926845ebd25bc2ae9e2874/results.bin +1 -0
- package/android/build/.transforms/08e8d929b7926845ebd25bc2ae9e2874/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/14ea77658b61f201debed3d92aea1c0f/results.bin +1 -0
- package/android/build/.transforms/14ea77658b61f201debed3d92aea1c0f/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/33560bbaf5632b59753ef78fcd7b7f8d/results.bin +1 -0
- package/android/build/.transforms/33560bbaf5632b59753ef78fcd7b7f8d/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/38fa05fa6fd488a5dec6d7bdb333bfd1/results.bin +1 -0
- package/android/build/.transforms/38fa05fa6fd488a5dec6d7bdb333bfd1/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/405120ecc1eb36e3127f0c3846387eb6/results.bin +1 -0
- package/android/build/.transforms/405120ecc1eb36e3127f0c3846387eb6/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/61c549f58a941c195c4ffb5f43fed2ef/results.bin +1 -0
- package/android/build/.transforms/61c549f58a941c195c4ffb5f43fed2ef/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/75c8746e5247a4500eb6ae4ca2ef0a2e/results.bin +1 -0
- package/android/build/.transforms/75c8746e5247a4500eb6ae4ca2ef0a2e/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/85f88a3c5a226a3333c60b94378960e9/results.bin +1 -0
- package/android/build/.transforms/85f88a3c5a226a3333c60b94378960e9/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/8f01556cdda8590f3b7cee54078417e1/results.bin +1 -0
- package/android/build/.transforms/8f01556cdda8590f3b7cee54078417e1/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/905b1aa9b91e69e71e9ed75a0c99581c/results.bin +1 -0
- package/android/build/.transforms/905b1aa9b91e69e71e9ed75a0c99581c/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/983e33cb97b3d1caf80afe6b7ca652b3/results.bin +1 -0
- package/android/build/.transforms/983e33cb97b3d1caf80afe6b7ca652b3/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/b398922a5d6aaf33784a06f933228695/results.bin +1 -0
- package/android/build/.transforms/b398922a5d6aaf33784a06f933228695/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/b4ff5fb2fdb627c9a67ad50ae0347ece/results.bin +1 -0
- package/android/build/.transforms/b4ff5fb2fdb627c9a67ad50ae0347ece/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/d89a0ea59a0fb9c21321de6f1be36c2b/results.bin +1 -0
- package/android/build/.transforms/d89a0ea59a0fb9c21321de6f1be36c2b/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/dca3c4e952522adb6e9c477431cc0881/results.bin +1 -0
- package/android/build/.transforms/dca3c4e952522adb6e9c477431cc0881/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/e6b9f6a4f6dc26d29d4ac4172b428541/results.bin +1 -0
- package/android/build/.transforms/e6b9f6a4f6dc26d29d4ac4172b428541/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/e8ebcf4ab4a209e222c80ef37e9122e2/results.bin +1 -0
- package/android/build/.transforms/e8ebcf4ab4a209e222c80ef37e9122e2/transformed/classes/classes.dex +0 -0
- package/android/build/generated/source/buildConfig/debug/co/ab180/airbridge/reactnative/BuildConfig.java +10 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +10 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +18 -0
- package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +5 -0
- package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +1 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +1956 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
- package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +1 -0
- package/android/build/intermediates/incremental/packageDebugResources/merger.xml +2 -0
- package/android/build/intermediates/javac/debug/classes/co/ab180/airbridge/reactnative/AirbridgeAttribution.class +0 -0
- package/android/build/intermediates/javac/debug/classes/co/ab180/airbridge/reactnative/AirbridgeDeeplink$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/co/ab180/airbridge/reactnative/AirbridgeDeeplink.class +0 -0
- package/android/build/intermediates/javac/debug/classes/co/ab180/airbridge/reactnative/AirbridgeEvent.class +0 -0
- package/android/build/intermediates/javac/debug/classes/co/ab180/airbridge/reactnative/AirbridgePlacement.class +0 -0
- package/android/build/intermediates/javac/debug/classes/co/ab180/airbridge/reactnative/AirbridgeRN.class +0 -0
- package/android/build/intermediates/javac/debug/classes/co/ab180/airbridge/reactnative/AirbridgeState$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/co/ab180/airbridge/reactnative/AirbridgeState.class +0 -0
- package/android/build/intermediates/javac/debug/classes/co/ab180/airbridge/reactnative/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/classes/co/ab180/airbridge/reactnative/ConfigReader$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/co/ab180/airbridge/reactnative/ConfigReader$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/co/ab180/airbridge/reactnative/ConfigReader.class +0 -0
- package/android/build/intermediates/javac/debug/classes/co/ab180/airbridge/reactnative/Get.class +0 -0
- package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +2 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +15 -0
- package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +10 -0
- package/android/build/intermediates/navigation_json/debug/navigation.json +1 -0
- package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +18 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +1449 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +33 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build.gradle +27 -0
- package/android/copy-config.gradle +18 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/android/gradlew +172 -0
- package/android/gradlew.bat +84 -0
- package/android/src/main/AndroidManifest.xml +8 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeAttribution.java +78 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeDeeplink.java +97 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeEvent.java +76 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgePlacement.java +42 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeRN.java +82 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeState.java +174 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/ConfigReader.java +108 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/Get.java +84 -0
- package/changelog.md +56 -0
- package/index.d.ts +292 -0
- package/index.js +8 -0
- package/ios/AirbridgeRN/ARNConfigReader.h +19 -0
- package/ios/AirbridgeRN/ARNConfigReader.m +79 -0
- package/ios/AirbridgeRN/ARNGet.h +20 -0
- package/ios/AirbridgeRN/ARNGet.m +40 -0
- package/ios/AirbridgeRN/AirbridgeAttribution.h +19 -0
- package/ios/AirbridgeRN/AirbridgeAttribution.m +47 -0
- package/ios/AirbridgeRN/AirbridgeDeeplink.h +20 -0
- package/ios/AirbridgeRN/AirbridgeDeeplink.m +59 -0
- package/ios/AirbridgeRN/AirbridgeEvent.h +17 -0
- package/ios/AirbridgeRN/AirbridgeEvent.m +63 -0
- package/ios/AirbridgeRN/AirbridgePlacement.h +17 -0
- package/ios/AirbridgeRN/AirbridgePlacement.m +38 -0
- package/ios/AirbridgeRN/AirbridgeRN.h +71 -0
- package/ios/AirbridgeRN/AirbridgeRN.m +59 -0
- package/ios/AirbridgeRN/AirbridgeState.h +17 -0
- package/ios/AirbridgeRN/AirbridgeState.m +89 -0
- package/ios/AirbridgeRN.xcodeproj/project.pbxproj +409 -0
- package/ios/copy-config.rb +26 -0
- package/package.json +43 -0
- package/readme.md +11 -0
- package/src/Airbridge.js +82 -0
- package/src/Deeplink.js +75 -0
- package/src/Event.js +38 -0
- package/src/Placement.js +56 -0
- package/src/State.js +167 -0
- package/src/WebInterface.js +135 -0
- package/src/tool/Log.js +40 -0
- package/src/tool/_.js +56 -0
- package/src/type/AirbridgeAttributes.js +16 -0
- package/src/type/AirbridgeCategory.js +18 -0
- package/src/type/AirbridgeProduct.js +13 -0
- package/src/typedef/EventOption.js +9 -0
- package/src/typedef/Product.js +10 -0
- package/src/typedef/User.js +9 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
declare module "airbridge-react-native-sdk-restricted" {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* main class (singleton)
|
|
5
|
+
*/
|
|
6
|
+
class Airbridge {
|
|
7
|
+
event: Event;
|
|
8
|
+
deeplink: Deeplink;
|
|
9
|
+
state: State;
|
|
10
|
+
placement: Placement;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Set device alias
|
|
14
|
+
* @param {string} key - device alias key
|
|
15
|
+
* @param {string} value - device alias value
|
|
16
|
+
*/
|
|
17
|
+
setDeviceAlias(key: string, value: string): void;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Remove device alias
|
|
21
|
+
* @param {string} key - callback of attribution
|
|
22
|
+
*/
|
|
23
|
+
removeDeviceAlias(key: string): void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* clear device alias
|
|
27
|
+
*/
|
|
28
|
+
clearDeviceAlias(): void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Send event to server.
|
|
32
|
+
* @param {string} category event name
|
|
33
|
+
* @param {EventOption} [option={}] event options
|
|
34
|
+
*/
|
|
35
|
+
trackEvent(category: string, option?: EventOption): void;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* register push token
|
|
39
|
+
* @param {string} token - push token
|
|
40
|
+
*/
|
|
41
|
+
registerPushToken(token: string): void;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* create interface of webview
|
|
45
|
+
* @param webToken token for airbridge web sdk that using on webview
|
|
46
|
+
* @param postCommandFunction notify to interface how to post command to native
|
|
47
|
+
* @returns {WebInterface} Web Interface
|
|
48
|
+
*/
|
|
49
|
+
createWebInterface(
|
|
50
|
+
webToken: string,
|
|
51
|
+
postCommandFunction: (command: string) => string,
|
|
52
|
+
): WebInterface;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* class for interface of webview
|
|
57
|
+
*/
|
|
58
|
+
class WebInterface {
|
|
59
|
+
script: string;
|
|
60
|
+
/**
|
|
61
|
+
* handle command from webview
|
|
62
|
+
* @param {String} command command from webview
|
|
63
|
+
*/
|
|
64
|
+
handle(command: string): void;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @param deeplink - URL of deeplink
|
|
69
|
+
*/
|
|
70
|
+
type DeeplinkListener = (deeplink: string | null) => void;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* class for set SDK's deeplink behavior (singleton)
|
|
74
|
+
*/
|
|
75
|
+
class Deeplink {
|
|
76
|
+
/**
|
|
77
|
+
* Set DeeplinkListener (listen deeplink or deferred-deeplink)<br/>
|
|
78
|
+
* @param listener - callback of deeplink & deferred-deeplink
|
|
79
|
+
*/
|
|
80
|
+
setDeeplinkListener(listener: DeeplinkListener): void;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* class for send event (singleton)
|
|
85
|
+
*/
|
|
86
|
+
class Event {
|
|
87
|
+
/**
|
|
88
|
+
* Send event to server.
|
|
89
|
+
* @param {string} category event name
|
|
90
|
+
* @param {EventOption} [option={}] event options
|
|
91
|
+
*/
|
|
92
|
+
trackEvent(category: string, option?: EventOption): void;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* class for use SDK's placement function (singleton)
|
|
97
|
+
*/
|
|
98
|
+
class Placement {
|
|
99
|
+
/**
|
|
100
|
+
* 1. send +1 click statistics to server<br/>
|
|
101
|
+
* 2. get deeplink and fallback from server<br/>
|
|
102
|
+
* 3. open deeplink. when fail, open fallback<br/>
|
|
103
|
+
* 4. parameter's deeplink, fallback is spare for network-fail
|
|
104
|
+
* @param trackingLink - created on dashboard
|
|
105
|
+
*/
|
|
106
|
+
click(trackingLink: string): void;
|
|
107
|
+
/**
|
|
108
|
+
* send +1 impression statistics to server<br/>
|
|
109
|
+
* @param trackingLink - created on dashboard
|
|
110
|
+
*/
|
|
111
|
+
impression(trackingLink: string): void;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @param attribution - URL of attribution
|
|
116
|
+
*/
|
|
117
|
+
type AttributionListener = (attribution: {
|
|
118
|
+
[key: string]: string;
|
|
119
|
+
}) => void;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* class for manage SDK's state (singleton)
|
|
123
|
+
*/
|
|
124
|
+
class State {
|
|
125
|
+
/**
|
|
126
|
+
* set current user<br/>
|
|
127
|
+
*
|
|
128
|
+
* user.property is null, if input.property is null
|
|
129
|
+
* @param user - user infomation
|
|
130
|
+
*/
|
|
131
|
+
setUser(user: User): void;
|
|
132
|
+
/**
|
|
133
|
+
* update current user<br/>
|
|
134
|
+
*
|
|
135
|
+
* user.property not be changed, if input.property is null
|
|
136
|
+
* @param user - user infomation
|
|
137
|
+
*/
|
|
138
|
+
updateUser(user: User): void;
|
|
139
|
+
/**
|
|
140
|
+
* make airbridge start tracking
|
|
141
|
+
*/
|
|
142
|
+
startTracking(): void;
|
|
143
|
+
/**
|
|
144
|
+
* get deviceUUID of Airbridge SDK.
|
|
145
|
+
*/
|
|
146
|
+
deviceUUID(): Promise<string>;
|
|
147
|
+
/**
|
|
148
|
+
* Set AttributionListener (listen attribution)<br/>
|
|
149
|
+
* @param listener - callback of attribution
|
|
150
|
+
*/
|
|
151
|
+
setAttributionListener(listener: AttributionListener): void;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Set device alias
|
|
155
|
+
* @param {string} key - device alias key
|
|
156
|
+
* @param {string} value - device alias value
|
|
157
|
+
*/
|
|
158
|
+
setDeviceAlias(key: string, value: string): void;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Remove device alias
|
|
162
|
+
* @param {string} key - callback of attribution
|
|
163
|
+
*/
|
|
164
|
+
removeDeviceAlias(key: string): void;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* clear device alias
|
|
168
|
+
*/
|
|
169
|
+
clearDeviceAlias(): void;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* register push token
|
|
173
|
+
* @param {string} token - push token
|
|
174
|
+
*/
|
|
175
|
+
registerPushToken(token: string): void;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
class WebInterface {
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* handle command from webview
|
|
182
|
+
*/
|
|
183
|
+
public readonly script: string;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* handle command from webview
|
|
187
|
+
* @param {String} command command from webview
|
|
188
|
+
*/
|
|
189
|
+
handle(command: string): void;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @property {string} [action] event group name 1
|
|
194
|
+
* @property {string} [label] event group name 2
|
|
195
|
+
* @property {number} [value] event custom value
|
|
196
|
+
* @property {{}} [customAttributes] event custom attributes
|
|
197
|
+
* @property {{}} [semanticAttributes] event semantic attributes
|
|
198
|
+
*/
|
|
199
|
+
type EventOption = {
|
|
200
|
+
action?: string;
|
|
201
|
+
label?: string;
|
|
202
|
+
value?: number;
|
|
203
|
+
customAttributes?: {
|
|
204
|
+
[key: string]: string;
|
|
205
|
+
};
|
|
206
|
+
semanticAttributes?: {
|
|
207
|
+
[key: string]: any;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @property {string} [ID] - Product's unique identifier
|
|
213
|
+
* @property {string} [name] - Product's name
|
|
214
|
+
* @property {string} [currency] - currency in <a href='https://en.wikipedia.org/wiki/ISO_4217'>ISO 4217<a/>
|
|
215
|
+
* @property {number} [price] - Product's price
|
|
216
|
+
* @property {number} [quantity] - Purchased quantity
|
|
217
|
+
* @property {number} [position] - Product's index in list
|
|
218
|
+
*/
|
|
219
|
+
type Product = {
|
|
220
|
+
ID?: string;
|
|
221
|
+
name?: string;
|
|
222
|
+
currency?: string;
|
|
223
|
+
price?: number;
|
|
224
|
+
quantity?: number;
|
|
225
|
+
position?: number;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* @property {string} [ID] - User's ID (not allow empty string)
|
|
230
|
+
* @property {string} [email] - User's Email (not allow empty string)
|
|
231
|
+
* @property {string} [phone] - User's Phone Number (not allow empty string)
|
|
232
|
+
* @property {{}} [alias] - User's Alias
|
|
233
|
+
* @property {{}} [attributes] - User's Attributes
|
|
234
|
+
*/
|
|
235
|
+
type User = {
|
|
236
|
+
ID?: string;
|
|
237
|
+
email?: string;
|
|
238
|
+
phone?: string;
|
|
239
|
+
alias?: {
|
|
240
|
+
[key: string]: string;
|
|
241
|
+
};
|
|
242
|
+
attributes?: {
|
|
243
|
+
[key: string]: any;
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const AirbridgeCategory: {
|
|
248
|
+
SIGN_UP: string
|
|
249
|
+
SIGN_IN: string
|
|
250
|
+
SIGN_OUT: string
|
|
251
|
+
|
|
252
|
+
HOME_VIEW: string
|
|
253
|
+
SEARCH_RESULT_VIEW: string
|
|
254
|
+
PRODUCT_LIST_VIEW: string
|
|
255
|
+
PRODUCT_DETAILS_VIEW: string
|
|
256
|
+
|
|
257
|
+
ADD_TO_CART: string
|
|
258
|
+
ORDER_COMPLETED: string
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
const AirbridgeAttributes: {
|
|
262
|
+
QUERY: string
|
|
263
|
+
PRODUCT_LIST_ID: string
|
|
264
|
+
CART_ID: string
|
|
265
|
+
TRANSACTION_ID: string
|
|
266
|
+
PRODUCTS: string
|
|
267
|
+
IN_APP_PURCHASED: string
|
|
268
|
+
CURRENCY: string
|
|
269
|
+
TOTAL_VALUE: string
|
|
270
|
+
TOTAL_QUANTITY: string
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const AirbridgeProduct: {
|
|
274
|
+
PRODUCT_ID: string
|
|
275
|
+
NAME: string
|
|
276
|
+
CURRENCY: string
|
|
277
|
+
PRICE: string
|
|
278
|
+
QUANTITY: string
|
|
279
|
+
POSITION: string
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const airbridge: Airbridge;
|
|
283
|
+
|
|
284
|
+
export default airbridge;
|
|
285
|
+
|
|
286
|
+
export {
|
|
287
|
+
AirbridgeCategory,
|
|
288
|
+
AirbridgeAttributes,
|
|
289
|
+
AirbridgeProduct,
|
|
290
|
+
WebInterface,
|
|
291
|
+
}
|
|
292
|
+
}
|
package/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ARNConfigReader.h
|
|
3
|
+
// AirbridgeRN
|
|
4
|
+
//
|
|
5
|
+
// Created by WOF on 2020/06/22.
|
|
6
|
+
// Copyright © 2020 ab180. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
|
|
11
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
12
|
+
|
|
13
|
+
@interface ARNConfigReader : NSObject
|
|
14
|
+
|
|
15
|
+
+ (void) apply;
|
|
16
|
+
|
|
17
|
+
@end
|
|
18
|
+
|
|
19
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ARNConfigReader.m
|
|
3
|
+
// AirbridgeRN
|
|
4
|
+
//
|
|
5
|
+
// Created by WOF on 2020/06/22.
|
|
6
|
+
// Copyright © 2020 ab180. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "ARNConfigReader.h"
|
|
10
|
+
|
|
11
|
+
#import "AirbridgeAttribution.h"
|
|
12
|
+
#import "ARNGet.h"
|
|
13
|
+
|
|
14
|
+
#import <AirBridge/AirBridge.h>
|
|
15
|
+
|
|
16
|
+
@implementation ARNConfigReader
|
|
17
|
+
|
|
18
|
+
+ (void) apply {
|
|
19
|
+
NSString* path = [NSBundle.mainBundle pathForResource:@"airbridge" ofType:@"json"];
|
|
20
|
+
NSData* data = [NSData dataWithContentsOfFile:path];
|
|
21
|
+
NSDictionary* json = nil;
|
|
22
|
+
if (data != nil) {
|
|
23
|
+
json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
NSNumber* sessionTimeoutSeconds = [ARNGet type:NSNumber.class dictionary:json key:@"sessionTimeoutSeconds"];
|
|
27
|
+
if (sessionTimeoutSeconds != nil) {
|
|
28
|
+
[AirBridge setSessionTimeout:sessionTimeoutSeconds.intValue * 1000];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
NSNumber* autoStartTrackingEnabled = [ARNGet type:NSNumber.class dictionary:json key:@"autoStartTrackingEnabled"];
|
|
32
|
+
if (autoStartTrackingEnabled != nil) {
|
|
33
|
+
[AirBridge setAutoStartTrackingEnabled:autoStartTrackingEnabled.boolValue];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
NSNumber* userInfoHashEnabled = [ARNGet type:NSNumber.class dictionary:json key:@"userInfoHashEnabled"];
|
|
37
|
+
if (userInfoHashEnabled != nil) {
|
|
38
|
+
[AirBridge setIsUserInfoHashed:userInfoHashEnabled.boolValue];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
NSNumber* trackAirbridgeLinkOnly = [ARNGet type:NSNumber.class dictionary:json key:@"trackAirbridgeLinkOnly"];
|
|
42
|
+
if (trackAirbridgeLinkOnly != nil) {
|
|
43
|
+
[AirBridge setIsTrackAirbridgeDeeplinkOnly:trackAirbridgeLinkOnly.boolValue];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
NSNumber* facebookDeferredAppLinkEnabled = [ARNGet type:NSNumber.class dictionary:json key:@"facebookDeferredAppLinkEnabled"];
|
|
47
|
+
if (facebookDeferredAppLinkEnabled != nil) {
|
|
48
|
+
[AirBridge setIsFacebookDeferredAppLinkEnabled:facebookDeferredAppLinkEnabled.boolValue];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
NSNumber* trackingAuthorizeTimeoutSeconds = [ARNGet type:NSNumber.class dictionary:json key:@"trackingAuthorizeTimeoutSeconds"];
|
|
52
|
+
if (trackingAuthorizeTimeoutSeconds != nil) {
|
|
53
|
+
AirBridge.setting.trackingAuthorizeTimeout = trackingAuthorizeTimeoutSeconds.unsignedLongLongValue * 1000;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
NSString* secretID = [ARNGet type:NSString.class dictionary:json key:@"sdkSignatureSecretID"];
|
|
57
|
+
NSString* secretKey = [ARNGet type:NSString.class dictionary:json key:@"sdkSignatureSecret"];
|
|
58
|
+
if (secretID != nil && secretKey != nil) {
|
|
59
|
+
[AirBridge setSDKSignatureSecretWithID:secretID secret:secretKey];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
NSString* logLevel = [ARNGet type:NSString.class dictionary:json key:@"logLevel"] ?: @"";
|
|
63
|
+
[AirBridge setLogLevel:(
|
|
64
|
+
[@{
|
|
65
|
+
@"debug": @(AB_LOG_DEBUG),
|
|
66
|
+
@"info": @(AB_LOG_INFO),
|
|
67
|
+
@"warning": @(AB_LOG_WARNING),
|
|
68
|
+
@"error": @(AB_LOG_CRITICAL),
|
|
69
|
+
@"fault": @(AB_LOG_CRASH)
|
|
70
|
+
} objectForKey: [logLevel lowercaseString]
|
|
71
|
+
] ?: @(AB_LOG_WARNING)
|
|
72
|
+
)];
|
|
73
|
+
|
|
74
|
+
[AirBridge.state setSDKDevelopmentPlatform:@"react_native"];
|
|
75
|
+
|
|
76
|
+
[AirbridgeAttribution setInitialAttributionCallback];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ARNGet.h
|
|
3
|
+
// AirbridgeRN
|
|
4
|
+
//
|
|
5
|
+
// Created by WOF on 17/10/2019.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
|
|
10
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
11
|
+
|
|
12
|
+
@interface ARNGet : NSObject
|
|
13
|
+
|
|
14
|
+
+ (nullable id) type:(Class)type object:(nullable id)object;
|
|
15
|
+
+ (nullable id) type:(Class)type dictionary:(nullable NSDictionary*)dictionary key:(NSString*)key;
|
|
16
|
+
+ (nullable id) type:(Class)type array:(nullable NSArray*)array index:(int)index;
|
|
17
|
+
|
|
18
|
+
@end
|
|
19
|
+
|
|
20
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ARNGet.m
|
|
3
|
+
// AirbridgeRN
|
|
4
|
+
//
|
|
5
|
+
// Created by WOF on 17/10/2019.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import "ARNGet.h"
|
|
9
|
+
|
|
10
|
+
@implementation ARNGet
|
|
11
|
+
|
|
12
|
+
+ (nullable id) type:(Class)type object:(nullable id)object {
|
|
13
|
+
if (object == nil || [object isKindOfClass:type]) {
|
|
14
|
+
return object;
|
|
15
|
+
} else {
|
|
16
|
+
return nil;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
+ (nullable id) type:(Class)type dictionary:(nullable NSDictionary*)dictionary key:(NSString*)key {
|
|
21
|
+
if (dictionary == nil) {
|
|
22
|
+
return nil;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
NSObject* object = dictionary[key];
|
|
26
|
+
|
|
27
|
+
return [ARNGet type:type object:object];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
+ (nullable id) type:(Class)type array:(nullable NSArray*)array index:(int)index {
|
|
31
|
+
if (array == nil || index < 0 || index > array.count) {
|
|
32
|
+
return nil;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
NSObject* object = array[index];
|
|
36
|
+
|
|
37
|
+
return [ARNGet type:type object:object];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// AirbridgeAttribution.h
|
|
3
|
+
// AirbridgeRN
|
|
4
|
+
//
|
|
5
|
+
// Created by WOF on 2022/01/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <React/RCTBridgeModule.h>
|
|
9
|
+
#import <React/RCTEventEmitter.h>
|
|
10
|
+
|
|
11
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
12
|
+
|
|
13
|
+
@interface AirbridgeAttribution : RCTEventEmitter <RCTBridgeModule>
|
|
14
|
+
|
|
15
|
+
+ (void) setInitialAttributionCallback;
|
|
16
|
+
|
|
17
|
+
@end
|
|
18
|
+
|
|
19
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//
|
|
2
|
+
// AirbridgeAttribution.m
|
|
3
|
+
// AirbridgeRN
|
|
4
|
+
//
|
|
5
|
+
// Created by WOF on 2022/01/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import "AirbridgeAttribution.h"
|
|
9
|
+
|
|
10
|
+
#import <AirBridge/AirBridge.h>
|
|
11
|
+
|
|
12
|
+
@implementation AirbridgeAttribution
|
|
13
|
+
|
|
14
|
+
static NSDictionary* initialAttribution = nil;
|
|
15
|
+
|
|
16
|
+
+ (void) setInitialAttributionCallback {
|
|
17
|
+
AirBridge.setting.attributionCallback = ^(NSDictionary<NSString*, NSString*>* attribution) {
|
|
18
|
+
initialAttribution = attribution;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
RCT_EXPORT_MODULE();
|
|
23
|
+
|
|
24
|
+
RCT_EXPORT_METHOD(listen) {
|
|
25
|
+
if (initialAttribution != nil) {
|
|
26
|
+
[self sendEventWithName:@"airbridge.attribution" body:initialAttribution];
|
|
27
|
+
initialAttribution = nil;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
AirBridge.setting.attributionCallback = ^(NSDictionary<NSString*, NSString*>* attribution) {
|
|
31
|
+
[self sendEventWithName:@"airbridge.attribution" body:attribution];
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
36
|
+
return @[@"airbridge.attribution"];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
40
|
+
return YES;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
- (dispatch_queue_t)methodQueue {
|
|
44
|
+
return dispatch_get_main_queue();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// AirbridgeDeeplink.h
|
|
3
|
+
// AirbridgeRN
|
|
4
|
+
//
|
|
5
|
+
// Created by WOF on 15/04/2019.
|
|
6
|
+
// Copyright © 2019 ab180. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <React/RCTBridgeModule.h>
|
|
10
|
+
#import <React/RCTEventEmitter.h>
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
13
|
+
|
|
14
|
+
@interface AirbridgeDeeplink : RCTEventEmitter <RCTBridgeModule>
|
|
15
|
+
|
|
16
|
+
+ (void) setInitialDeeplinkCallback;
|
|
17
|
+
|
|
18
|
+
@end
|
|
19
|
+
|
|
20
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//
|
|
2
|
+
// AirbridgeDeeplink.m
|
|
3
|
+
// AirbridgeRN
|
|
4
|
+
//
|
|
5
|
+
// Created by WOF on 15/04/2019.
|
|
6
|
+
// Copyright © 2019 ab180. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "AirbridgeDeeplink.h"
|
|
10
|
+
|
|
11
|
+
// Airbridge
|
|
12
|
+
#import <AirBridge/AirBridge.h>
|
|
13
|
+
|
|
14
|
+
@implementation AirbridgeDeeplink
|
|
15
|
+
|
|
16
|
+
static NSString* initialDeeplink;
|
|
17
|
+
|
|
18
|
+
+ (void) setInitialDeeplinkCallback {
|
|
19
|
+
[AirBridge.deeplink setDeeplinkCallback:^(NSString* deeplink) {
|
|
20
|
+
initialDeeplink = deeplink;
|
|
21
|
+
}];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//
|
|
25
|
+
// react native method
|
|
26
|
+
//
|
|
27
|
+
|
|
28
|
+
RCT_EXPORT_MODULE();
|
|
29
|
+
|
|
30
|
+
RCT_EXPORT_METHOD(listen) {
|
|
31
|
+
__block AirbridgeDeeplink* _self = self;
|
|
32
|
+
|
|
33
|
+
if (initialDeeplink != nil) {
|
|
34
|
+
[_self sendEventWithName:@"airbridge.deeplink" body:initialDeeplink];
|
|
35
|
+
initialDeeplink = nil;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
[AirBridge.deeplink setDeeplinkCallback:^(NSString* deeplink) {
|
|
39
|
+
[_self sendEventWithName:@"airbridge.deeplink" body:deeplink];
|
|
40
|
+
}];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//
|
|
44
|
+
// override
|
|
45
|
+
//
|
|
46
|
+
|
|
47
|
+
- (NSArray<NSString*>*)supportedEvents {
|
|
48
|
+
return @[@"airbridge.deeplink"];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
52
|
+
return YES;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
- (dispatch_queue_t)methodQueue {
|
|
56
|
+
return dispatch_get_main_queue();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// AirbridgeEvent.h
|
|
3
|
+
// AirbridgeRN
|
|
4
|
+
//
|
|
5
|
+
// Created by WOF on 15/04/2019.
|
|
6
|
+
// Copyright © 2019 ab180. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <React/RCTBridgeModule.h>
|
|
10
|
+
|
|
11
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
12
|
+
|
|
13
|
+
@interface AirbridgeEvent : NSObject <RCTBridgeModule>
|
|
14
|
+
|
|
15
|
+
@end
|
|
16
|
+
|
|
17
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//
|
|
2
|
+
// AirbridgeEvent.m
|
|
3
|
+
// AirbridgeRN
|
|
4
|
+
//
|
|
5
|
+
// Created by WOF on 15/04/2019.
|
|
6
|
+
// Copyright © 2019 ab180. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "AirbridgeEvent.h"
|
|
10
|
+
|
|
11
|
+
// Airbridge
|
|
12
|
+
#import <AirBridge/AirBridge.h>
|
|
13
|
+
#import <AirBridge/ABUserEvent.h>
|
|
14
|
+
#import <AirBridge/ABEcommerceEvent.h>
|
|
15
|
+
// AB
|
|
16
|
+
#import "ARNGet.h"
|
|
17
|
+
|
|
18
|
+
@implementation AirbridgeEvent
|
|
19
|
+
|
|
20
|
+
//
|
|
21
|
+
// react native method
|
|
22
|
+
//
|
|
23
|
+
|
|
24
|
+
RCT_EXPORT_MODULE();
|
|
25
|
+
|
|
26
|
+
RCT_EXPORT_METHOD(trackEvent:(NSString*)category option:(nullable NSDictionary*)option) {
|
|
27
|
+
ABInAppEvent* event = [[ABInAppEvent alloc] init];
|
|
28
|
+
|
|
29
|
+
[event setCategory:category];
|
|
30
|
+
addOptionToEvent(event, option);
|
|
31
|
+
|
|
32
|
+
[event send];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//
|
|
36
|
+
// private - tool
|
|
37
|
+
//
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Add option infomation to event
|
|
41
|
+
* @discussion add nil when some data has unmatch type
|
|
42
|
+
* @param event
|
|
43
|
+
* target event
|
|
44
|
+
* @param option
|
|
45
|
+
* dictionary which has option infomation
|
|
46
|
+
*/
|
|
47
|
+
static void addOptionToEvent(ABInAppEvent* event, NSDictionary* __nullable option) {
|
|
48
|
+
if(option == nil) return;
|
|
49
|
+
|
|
50
|
+
NSString* action = [ARNGet type:NSString.class dictionary:option key:@"action"];
|
|
51
|
+
NSString* label = [ARNGet type:NSString.class dictionary:option key:@"label"];
|
|
52
|
+
NSNumber* value = [ARNGet type:NSNumber.class dictionary:option key:@"value"];
|
|
53
|
+
NSDictionary* attributes = [ARNGet type:NSDictionary.class dictionary:option key:@"customAttributes"];
|
|
54
|
+
NSDictionary* semantics = [ARNGet type:NSDictionary.class dictionary:option key:@"semanticAttributes"];
|
|
55
|
+
|
|
56
|
+
[event setAction:action];
|
|
57
|
+
[event setLabel:label];
|
|
58
|
+
[event setValue:value];
|
|
59
|
+
[event setCustoms:attributes];
|
|
60
|
+
[event setSemantics:semantics];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@end
|