airbridge-react-native-sdk-restricted 4.4.0 → 4.5.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.
@@ -1,6 +1,8 @@
1
1
  name: release
2
2
 
3
3
  on:
4
+ workflow_dispatch:
5
+
4
6
  pull_request:
5
7
  types:
6
8
  - closed
@@ -10,8 +12,8 @@ on:
10
12
  jobs:
11
13
  release:
12
14
  runs-on: ubuntu-latest
13
- if: |
14
- github.event.pull_request.merged == true
15
+ if: github.event_name == 'workflow_dispatch'
16
+ || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
15
17
 
16
18
  steps:
17
19
  - name: Checkout
@@ -33,8 +35,8 @@ jobs:
33
35
 
34
36
  release-restricted:
35
37
  runs-on: ubuntu-latest
36
- if: |
37
- github.event.pull_request.merged == true
38
+ if: github.event_name == 'workflow_dispatch'
39
+ || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
38
40
 
39
41
  steps:
40
42
  - name: Checkout
@@ -56,3 +58,32 @@ jobs:
56
58
  env:
57
59
  NODE_AUTH_TOKEN: ${{ secrets.SDK_TEAM_NPM_AUTOMATION_TOKEN }}
58
60
  run: npm publish
61
+
62
+ deploy-release-note:
63
+ runs-on: ubuntu-latest
64
+ if: github.event_name == 'workflow_dispatch'
65
+ || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
66
+
67
+ needs:
68
+ - release
69
+ - release-restricted
70
+
71
+ steps:
72
+ - name: Checkout
73
+ uses: actions/checkout@v3
74
+
75
+ - name: Prepare changelog
76
+ id: prepare-changelog
77
+ run: |
78
+ {
79
+ echo 'value<<EOF'
80
+ cat CHANGELOG.md
81
+ echo 'EOF'
82
+ } >> $GITHUB_OUTPUT
83
+
84
+ - name: Deploy release note
85
+ uses: ab180/airbridge-sdk-tool/action/deploy-release-note@v1
86
+ with:
87
+ contentful-access-token: ${{ secrets.CONTENTFUL_ACCESS_TOKEN }}
88
+ contentful-entry-slug: release-note-react-native-sdk
89
+ changelog-content: ${{ steps.prepare-changelog.outputs.value }}
@@ -1,4 +1,4 @@
1
1
  {
2
- "ios_version": "4.4.2",
3
- "android_version": "4.4.1"
2
+ "ios_version": "4.5.0",
3
+ "android_version": "4.5.0"
4
4
  }
@@ -35,9 +35,6 @@ android {
35
35
  targetSdkVersion safeExtGet("targetSdkVersion", 34)
36
36
  versionCode 1
37
37
  versionName "${packageJson['version']}"
38
-
39
- buildConfigField("String", "AIRBRIDGE_REACT_NATIVE_NAME", "\"${packageJson['name']}\"")
40
- buildConfigField("String", "AIRBRIDGE_REACT_NATIVE_VERSION", "\"${packageJson['version']}\"")
41
38
  }
42
39
  }
43
40
 
@@ -56,3 +53,4 @@ dependencies {
56
53
  }
57
54
 
58
55
  apply from: 'copy-airbridge-json.gradle'
56
+ apply from: 'create-library-info-json.gradle'
@@ -1,12 +1,20 @@
1
1
  def processAirbridgeJSON = {
2
- def content = '{}'.getBytes()
2
+ def env = getEnvSafe()
3
3
 
4
- def json = rootProject.file('../airbridge.json')
5
- if (json.exists()) {
6
- content = json.readBytes()
4
+ def content = null
5
+ if (env != "") {
6
+ content = getAirbridgeJSON("../airbridge.${env}.json")
7
+ }
8
+
9
+ if (content == null) {
10
+ content = getAirbridgeJSON("../airbridge.json")
7
11
  }
8
12
 
9
- def file = rootProject.file('app/src/main/assets/airbridge.json')
13
+ if (content == null) {
14
+ content = '{}'.getBytes()
15
+ }
16
+
17
+ def file = rootProject.file("app/src/main/assets/airbridge.json")
10
18
  if (!file.exists()) {
11
19
  file.getParentFile().mkdirs()
12
20
  file.createNewFile()
@@ -15,4 +23,18 @@ def processAirbridgeJSON = {
15
23
  file.write(new String(content))
16
24
  }
17
25
 
26
+ def getAirbridgeJSON(path) {
27
+ def json = rootProject.file(path)
28
+ if (json.exists()) {
29
+ return json.readBytes()
30
+ }
31
+
32
+ return null
33
+ }
34
+
35
+ def getEnvSafe() {
36
+ def env = (System.getenv("AIRBRIDGE_ENVIRONMENT") ?: "").toLowerCase()
37
+ return env.matches(/^[A-Za-z0-9\-_]*$/) ? env : ""
38
+ }
39
+
18
40
  preBuild.dependsOn processAirbridgeJSON
@@ -0,0 +1,30 @@
1
+ import groovy.json.JsonSlurper
2
+ import groovy.json.JsonOutput
3
+
4
+ def processLibraryInfoJSON = {
5
+ def currentDirectory = buildFile.parentFile.toPath()
6
+ def packageJson = new File(currentDirectory.resolve('../package.json').toString())
7
+ def name = "airbridge-react-native-sdk"
8
+ def version = ""
9
+
10
+ if (packageJson.exists()) {
11
+ def jsonObject = new JsonSlurper().parseText(packageJson.text)
12
+ name = jsonObject.name ?: name
13
+ version = jsonObject.version ?: version
14
+ }
15
+
16
+ def filteredJson = [
17
+ name : name,
18
+ version: version
19
+ ]
20
+
21
+ def file = rootProject.file('app/src/main/assets/libraryInfo.json')
22
+ if (!file.exists()) {
23
+ file.getParentFile().mkdirs()
24
+ file.createNewFile()
25
+ }
26
+
27
+ file.write(new String(JsonOutput.prettyPrint(JsonOutput.toJson(filteredJson))))
28
+ }
29
+
30
+ preBuild.dependsOn processLibraryInfoJSON
@@ -1,6 +1,7 @@
1
1
  package co.ab180.airbridge.reactnative
2
2
 
3
3
  import android.app.Application
4
+ import android.content.Context
4
5
  import android.content.Intent
5
6
  import android.util.Log
6
7
  import android.view.View
@@ -8,6 +9,9 @@ import co.ab180.airbridge.Airbridge
8
9
  import co.ab180.airbridge.AirbridgeOptionBuilder
9
10
  import co.ab180.airbridge.reactnative.common.AirbridgeJSON
10
11
  import co.ab180.airbridge.reactnative.common.AirbridgeLifecycleIntegration
12
+ import co.ab180.airbridge.reactnative.extension.consume
13
+ import co.ab180.airbridge.reactnative.extension.isConsumed
14
+ import co.ab180.airbridge.reactnative.extension.LibraryInfoJSON
11
15
  import co.ab180.airbridge.reactnative.extension.setAirbridgeJSON
12
16
  import co.ab180.airbridge.reactnative.extension.toMap
13
17
  import co.ab180.airbridge.reactnative.module.AttributionInteractor
@@ -58,7 +62,7 @@ class AirbridgeReactNative : ReactPackage {
58
62
  AirbridgeOptionBuilder(name, token)
59
63
  .setAirbridgeJSON(airbridgeJSON)
60
64
  .setSDKDevelopmentPlatform(getSDKDevelopmentPlatform())
61
- .setSDKAttributes(getSDKAttributes())
65
+ .setSDKAttributes(getSDKAttributes(app))
62
66
  .setSDKWrapperOption(getSDKWrapperOption())
63
67
  .setOnAttributionReceived {
64
68
  AttributionInteractor.onAttributionReceived(it)
@@ -88,6 +92,11 @@ class AirbridgeReactNative : ReactPackage {
88
92
  onFailure = { Log.d("AirbridgeReactNative", "Failure on Airbridge.handleDeeplink: error={${it.localizedMessage}}") }
89
93
  )
90
94
  if (handled || isHandleAirbridgeDeeplinkOnly) { return }
95
+ if (intent.isConsumed()) {
96
+ Log.d("AirbridgeReactNative", "intent was already consumed on AirbridgeReactNative.trackDeeplink")
97
+ return
98
+ }
99
+ intent.consume()
91
100
  intent.data?.also {
92
101
  DeeplinkInteractor.onDeeplinkReceived(it)
93
102
  }
@@ -119,11 +128,17 @@ class AirbridgeReactNative : ReactPackage {
119
128
  return subWrapperSDKDevelopmentPlatform ?: "react_native"
120
129
  }
121
130
 
122
- private fun getSDKAttributes(): Map<String, String> {
123
- return mutableMapOf(
124
- "wrapperName" to BuildConfig.AIRBRIDGE_REACT_NATIVE_NAME,
125
- "wrapperVersion" to BuildConfig.AIRBRIDGE_REACT_NATIVE_VERSION
126
- ).apply {
131
+ private fun getSDKAttributes(context: Context): Map<String, String> {
132
+ return LibraryInfoJSON.load(context).let {
133
+ if (it == null) {
134
+ mutableMapOf()
135
+ } else {
136
+ mutableMapOf(
137
+ "wrapperName" to it.getString("name"),
138
+ "wrapperVersion" to it.getString("version")
139
+ )
140
+ }
141
+ }.apply {
127
142
  subWrapperSDKAttributes?.let { putAll(it) }
128
143
  }
129
144
  }
@@ -0,0 +1,22 @@
1
+ package co.ab180.airbridge.reactnative.extension
2
+
3
+ import android.content.Intent
4
+ import android.net.Uri
5
+
6
+ private const val KEY_CONSUMED = "airbridge_consumed"
7
+
8
+ internal fun Intent.isConsumed(): Boolean {
9
+ return try {
10
+ getBooleanExtra(KEY_CONSUMED, false)
11
+ } catch (_: Exception) {
12
+ false
13
+ }
14
+ }
15
+
16
+ internal fun Intent.consume() {
17
+ try {
18
+ putExtra(KEY_CONSUMED, true)
19
+ } catch (_: Exception) {
20
+
21
+ }
22
+ }
@@ -0,0 +1,24 @@
1
+ package co.ab180.airbridge.reactnative.extension
2
+
3
+ import android.content.Context
4
+ import android.util.Log
5
+ import org.json.JSONException
6
+ import org.json.JSONObject
7
+ import java.io.IOException
8
+
9
+ object LibraryInfoJSON {
10
+ fun load(context: Context): JSONObject? {
11
+ try {
12
+ return context.assets.open("libraryInfo.json")
13
+ .bufferedReader()
14
+ .use { JSONObject(it.readText()) }
15
+ } catch (exception: IOException) {
16
+ Log.w("AirbridgeReactNative", "The file libraryInfo.json could not be read.", exception)
17
+ } catch (exception: JSONException) {
18
+ Log.w("AirbridgeReactNative", "The file libraryInfo.json is not in json format")
19
+ } catch (throwable: Throwable) {
20
+ Log.w("AirbridgeReactNative", "Unknown error processing libraryInfo.json", throwable)
21
+ }
22
+ return null
23
+ }
24
+ }
@@ -55,10 +55,9 @@ export declare const createDependency: {
55
55
  createWebInterfaceScript: (webToken: string, postMessageScript: string) => Promise<string | undefined>;
56
56
  handleWebInterfaceCommand: (command: string) => undefined;
57
57
  };
58
- };
58
+ } | undefined;
59
59
  };
60
60
  export declare class Airbridge {
61
- #private;
62
61
  /**
63
62
  * Sets a listener for receiving attribution of install event.
64
63
  * @param onReceived Map of attribution is delivered.
@@ -1,9 +1,4 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _a, _Airbridge_dependency;
1
+ import { NativeModules } from 'react-native';
7
2
  import { createAttributionModule } from './module/Attribution';
8
3
  import { createDeeplinkModule } from './module/Deeplink';
9
4
  import { createEventModule } from './module/Event';
@@ -12,17 +7,26 @@ import { createPlacementModule } from './module/Placement';
12
7
  import { createRegisterModule } from './module/Register';
13
8
  import { createSwitchModule } from './module/Switch';
14
9
  import { createWebInterfaceModule } from './module/WebInterface';
10
+ import { check } from './utility/check';
15
11
  export const createDependency = () => { };
16
- createDependency.Airbridge = () => ({
17
- attributionModule: createAttributionModule(),
18
- deeplinkModule: createDeeplinkModule(),
19
- eventModule: createEventModule(),
20
- fetchModule: createFetchModule(),
21
- placementModule: createPlacementModule(),
22
- registerModule: createRegisterModule(),
23
- switchModule: createSwitchModule(),
24
- webInterfaceModule: createWebInterfaceModule(),
25
- });
12
+ createDependency.Airbridge = () => {
13
+ if (!check.object(NativeModules.EventInteractor)) {
14
+ return undefined;
15
+ }
16
+ return ({
17
+ attributionModule: createAttributionModule(),
18
+ deeplinkModule: createDeeplinkModule(),
19
+ eventModule: createEventModule(),
20
+ fetchModule: createFetchModule(),
21
+ placementModule: createPlacementModule(),
22
+ registerModule: createRegisterModule(),
23
+ switchModule: createSwitchModule(),
24
+ webInterfaceModule: createWebInterfaceModule(),
25
+ });
26
+ };
27
+ class Dependency {
28
+ }
29
+ Dependency.instance = createDependency.Airbridge();
26
30
  export class Airbridge {
27
31
  // attribution
28
32
  /**
@@ -30,7 +34,8 @@ export class Airbridge {
30
34
  * @param onReceived Map of attribution is delivered.
31
35
  */
32
36
  static setOnAttributionReceived(onReceived) {
33
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).attributionModule.setOnAttributionReceived(onReceived);
37
+ var _a;
38
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.attributionModule.setOnAttributionReceived(onReceived);
34
39
  }
35
40
  // deeplink
36
41
  /**
@@ -38,7 +43,8 @@ export class Airbridge {
38
43
  * @param onReceived URL of deeplink is delivered.
39
44
  */
40
45
  static setOnDeeplinkReceived(onReceived) {
41
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).deeplinkModule.setOnDeeplinkReceived(onReceived);
46
+ var _a;
47
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.deeplinkModule.setOnDeeplinkReceived(onReceived);
42
48
  }
43
49
  // event
44
50
  /**
@@ -48,7 +54,8 @@ export class Airbridge {
48
54
  * @param customAttributes Additional attributes of the event.
49
55
  */
50
56
  static trackEvent(category, semanticAttributes, customAttributes) {
51
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).eventModule.trackEvent(category, semanticAttributes, customAttributes);
57
+ var _a;
58
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.eventModule.trackEvent(category, semanticAttributes, customAttributes);
52
59
  }
53
60
  // fetch
54
61
  /**
@@ -57,7 +64,8 @@ export class Airbridge {
57
64
  * @param onFailure Callback to be invoked when any error occurs.
58
65
  */
59
66
  static fetchDeviceUUID(onSuccess, onFailure) {
60
- return __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).fetchModule.fetchDeviceUUID(onSuccess, onFailure);
67
+ var _a, _b;
68
+ return (_b = (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.fetchModule.fetchDeviceUUID(onSuccess, onFailure)) !== null && _b !== void 0 ? _b : Promise.resolve(false);
61
69
  }
62
70
  /**
63
71
  * Fetch airbridgeGeneratedUUID of SDK.
@@ -65,14 +73,16 @@ export class Airbridge {
65
73
  * @param onFailure Callback to be invoked when any error occurs.
66
74
  */
67
75
  static fetchAirbridgeGeneratedUUID(onSuccess, onFailure) {
68
- return __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).fetchModule.fetchAirbridgeGeneratedUUID(onSuccess, onFailure);
76
+ var _a, _b;
77
+ return (_b = (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.fetchModule.fetchAirbridgeGeneratedUUID(onSuccess, onFailure)) !== null && _b !== void 0 ? _b : Promise.resolve(false);
69
78
  }
70
79
  /**
71
80
  * Indicates whether notification was sent by Airbridge to track uninstall of app.
72
81
  * @param notification The notification to check.
73
82
  */
74
83
  static isUninstallTrackingNotification(notification) {
75
- return __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).fetchModule.isUninstallTrackingNotification(notification);
84
+ var _a, _b;
85
+ return (_b = (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.fetchModule.isUninstallTrackingNotification(notification)) !== null && _b !== void 0 ? _b : false;
76
86
  }
77
87
  // placement
78
88
  /**
@@ -85,7 +95,8 @@ export class Airbridge {
85
95
  * - If tracking link is successfully handled.
86
96
  */
87
97
  static click(trackingLink, onSuccess, onFailure) {
88
- return __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).placementModule.click(trackingLink, onSuccess, onFailure);
98
+ var _a, _b;
99
+ return (_b = (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.placementModule.click(trackingLink, onSuccess, onFailure)) !== null && _b !== void 0 ? _b : Promise.resolve(false);
89
100
  }
90
101
  /**
91
102
  * Notifies that the in-app area within the app has been exposed to the user.
@@ -97,7 +108,8 @@ export class Airbridge {
97
108
  * - If tracking link is successfully handled.
98
109
  */
99
110
  static impression(trackingLink, onSuccess, onFailure) {
100
- return __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).placementModule.impression(trackingLink, onSuccess, onFailure);
111
+ var _a, _b;
112
+ return (_b = (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.placementModule.impression(trackingLink, onSuccess, onFailure)) !== null && _b !== void 0 ? _b : Promise.resolve(false);
101
113
  }
102
114
  // register
103
115
  /**
@@ -105,39 +117,45 @@ export class Airbridge {
105
117
  * @param id The user ID.
106
118
  */
107
119
  static setUserID(id) {
108
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.setUserID(id);
120
+ var _a;
121
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.setUserID(id);
109
122
  }
110
123
  /**
111
124
  * Clear the user ID.
112
125
  */
113
126
  static clearUserID() {
114
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.clearUserID();
127
+ var _a;
128
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.clearUserID();
115
129
  }
116
130
  /**
117
131
  * Sets the user email.
118
132
  * @param email The user email.
119
133
  */
120
134
  static setUserEmail(email) {
121
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.setUserEmail(email);
135
+ var _a;
136
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.setUserEmail(email);
122
137
  }
123
138
  /**
124
139
  * Clear the user email.
125
140
  */
126
141
  static clearUserEmail() {
127
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.clearUserEmail();
142
+ var _a;
143
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.clearUserEmail();
128
144
  }
129
145
  /**
130
146
  * Sets the user phone number.
131
147
  * @param phone The user phone number.
132
148
  */
133
149
  static setUserPhone(phone) {
134
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.setUserPhone(phone);
150
+ var _a;
151
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.setUserPhone(phone);
135
152
  }
136
153
  /**
137
154
  * Clear the user phone number.
138
155
  */
139
156
  static clearUserPhone() {
140
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.clearUserPhone();
157
+ var _a;
158
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.clearUserPhone();
141
159
  }
142
160
  /**
143
161
  * Sets the key, value pair to the user attribute.
@@ -145,20 +163,23 @@ export class Airbridge {
145
163
  * @param value The value to set for the user attribute.
146
164
  */
147
165
  static setUserAttribute(key, value) {
148
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.setUserAttribute(key, value);
166
+ var _a;
167
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.setUserAttribute(key, value);
149
168
  }
150
169
  /**
151
170
  * Removes the user attribute with the given key.
152
171
  * @param key The key that uniquely identifies the user attribute.
153
172
  */
154
173
  static removeUserAttribute(key) {
155
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.removeUserAttribute(key);
174
+ var _a;
175
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.removeUserAttribute(key);
156
176
  }
157
177
  /**
158
178
  * Clears all user attributes.
159
179
  */
160
180
  static clearUserAttributes() {
161
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.clearUserAttributes();
181
+ var _a;
182
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.clearUserAttributes();
162
183
  }
163
184
  /**
164
185
  * Sets the key, value pair to the user alias.
@@ -166,26 +187,30 @@ export class Airbridge {
166
187
  * @param value The value to set for the user alias.
167
188
  */
168
189
  static setUserAlias(key, value) {
169
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.setUserAlias(key, value);
190
+ var _a;
191
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.setUserAlias(key, value);
170
192
  }
171
193
  /**
172
194
  * Removes the user alias with the given key.
173
195
  * @param key The key that uniquely identifies the user alias.
174
196
  */
175
197
  static removeUserAlias(key) {
176
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.removeUserAlias(key);
198
+ var _a;
199
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.removeUserAlias(key);
177
200
  }
178
201
  /**
179
202
  * Clears all user aliases.
180
203
  */
181
204
  static clearUserAlias() {
182
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.clearUserAlias();
205
+ var _a;
206
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.clearUserAlias();
183
207
  }
184
208
  /**
185
209
  * Clears all user information.
186
210
  */
187
211
  static clearUser() {
188
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.clearUser();
212
+ var _a;
213
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.clearUser();
189
214
  }
190
215
  /**
191
216
  * Sets the key, value pair to the device alias.
@@ -193,66 +218,76 @@ export class Airbridge {
193
218
  * @param value The value to set for the device alias.
194
219
  */
195
220
  static setDeviceAlias(key, value) {
196
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.setDeviceAlias(key, value);
221
+ var _a;
222
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.setDeviceAlias(key, value);
197
223
  }
198
224
  /**
199
225
  * Removes the device alias with the given key.
200
226
  * @param key The key that uniquely identifies the device alias.
201
227
  */
202
228
  static removeDeviceAlias(key) {
203
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.removeDeviceAlias(key);
229
+ var _a;
230
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.removeDeviceAlias(key);
204
231
  }
205
232
  /**
206
233
  * Clears all device aliases.
207
234
  */
208
235
  static clearDeviceAlias() {
209
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.clearDeviceAlias();
236
+ var _a;
237
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.clearDeviceAlias();
210
238
  }
211
239
  /**
212
240
  * Registers the FCM or APNS registration token to track app uninstalls.
213
241
  * @param token The FCM or APNS registration token.
214
242
  */
215
243
  static registerPushToken(token) {
216
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).registerModule.registerPushToken(token);
244
+ var _a;
245
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.registerModule.registerPushToken(token);
217
246
  }
218
247
  // switch
219
248
  /**
220
249
  * Enables the SDK.
221
250
  */
222
251
  static enableSDK() {
223
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).switchModule.enableSDK();
252
+ var _a;
253
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.switchModule.enableSDK();
224
254
  }
225
255
  /**
226
256
  * Disables the SDK.
227
257
  */
228
258
  static disableSDK() {
229
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).switchModule.disableSDK();
259
+ var _a;
260
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.switchModule.disableSDK();
230
261
  }
231
262
  /**
232
263
  * Checks whether the SDK is currently enabled.
233
264
  * @return `true` if the SDK is enabled, `false` otherwise.
234
265
  */
235
266
  static isSDKEnabled() {
236
- return __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).switchModule.isSDKEnabled();
267
+ var _a, _b;
268
+ return (_b = (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.switchModule.isSDKEnabled()) !== null && _b !== void 0 ? _b : Promise.resolve(false);
237
269
  }
238
270
  /**
239
271
  * Start collecting and transferring events.
240
272
  */
241
273
  static startTracking() {
242
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).switchModule.startTracking();
274
+ var _a;
275
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.switchModule.startTracking();
243
276
  }
244
277
  /**
245
278
  * Stop collecting and transferring events.
246
279
  */
247
280
  static stopTracking() {
248
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).switchModule.stopTracking();
281
+ var _a;
282
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.switchModule.stopTracking();
249
283
  }
250
284
  /**
251
285
  * Checks whether the tracking feature of SDK is currently enabled.
252
286
  * @return `true` if the tracking feature of SDK tracking is enabled,`false` otherwise.
253
287
  */
254
288
  static isTrackingEnabled() {
255
- return __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).switchModule.isTrackingEnabled();
289
+ var _a, _b;
290
+ return (_b = (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.switchModule.isTrackingEnabled()) !== null && _b !== void 0 ? _b : Promise.resolve(false);
256
291
  }
257
292
  // web interface
258
293
  /**
@@ -262,14 +297,16 @@ export class Airbridge {
262
297
  * @return web interface script
263
298
  */
264
299
  static createWebInterfaceScript(webToken, postMessageScript) {
265
- return __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).webInterfaceModule.createWebInterfaceScript(webToken, postMessageScript);
300
+ var _a, _b;
301
+ return (_b = (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.webInterfaceModule.createWebInterfaceScript(webToken, postMessageScript)) !== null && _b !== void 0 ? _b : Promise.resolve(undefined);
266
302
  }
267
303
  /**
268
304
  * Handles commands from the web interface.
269
305
  * @param command The command to handle.
270
306
  */
271
307
  static handleWebInterfaceCommand(command) {
272
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).webInterfaceModule.handleWebInterfaceCommand(command);
308
+ var _a;
309
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.webInterfaceModule.handleWebInterfaceCommand(command);
273
310
  }
274
311
  /**
275
312
  * Creates a tracking-link using airbridge-server that move user
@@ -281,21 +318,24 @@ export class Airbridge {
281
318
  * @param onFailure Error is delivered if failed.
282
319
  */
283
320
  static createTrackingLink(channel, option, onSuccess, onFailure) {
284
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).placementModule.createTrackingLink(channel, option, onSuccess, onFailure);
321
+ var _a;
322
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.placementModule.createTrackingLink(channel, option, onSuccess, onFailure);
285
323
  }
286
324
  /**
287
325
  * Starts tracking event automatically for each user
288
326
  * purchases product through in-app-purchase.
289
327
  */
290
328
  static startInAppPurchaseTracking() {
291
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).switchModule.startInAppPurchaseTracking();
329
+ var _a;
330
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.switchModule.startInAppPurchaseTracking();
292
331
  }
293
332
  /**
294
333
  * Stops tracking event automatically for each user
295
334
  * purchases product through in-app-purchase.
296
335
  */
297
336
  static stopInAppPurchaseTracking() {
298
- __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).switchModule.stopInAppPurchaseTracking();
337
+ var _a;
338
+ (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.switchModule.stopInAppPurchaseTracking();
299
339
  }
300
340
  /**
301
341
  * Indicates that SDK can track event automatically for each user
@@ -304,9 +344,8 @@ export class Airbridge {
304
344
  * @return `true` if the SDK is enabled for in-app-purchase tracking, `false` otherwise.
305
345
  */
306
346
  static isInAppPurchaseTrackingEnabled() {
307
- return __classPrivateFieldGet(this, _a, "f", _Airbridge_dependency).switchModule.isInAppPurchaseTrackingEnabled();
347
+ var _a, _b;
348
+ return (_b = (_a = Dependency.instance) === null || _a === void 0 ? void 0 : _a.switchModule.isInAppPurchaseTrackingEnabled()) !== null && _b !== void 0 ? _b : Promise.resolve(false);
308
349
  }
309
350
  }
310
- _a = Airbridge;
311
- _Airbridge_dependency = { value: createDependency.Airbridge() };
312
351
  //# sourceMappingURL=Airbridge.js.map