@inngageregistry/inngage-react 3.3.1 → 3.3.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Inngage.ts +14 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inngageregistry/inngage-react",
3
- "version": "3.3.1",
3
+ "version": "3.3.2",
4
4
  "description": "Inngage Plugin for React Native applications for marketing campaign optimization using Push Notification.",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.d.ts",
package/src/Inngage.ts CHANGED
@@ -109,16 +109,13 @@ const Inngage = {
109
109
  try {
110
110
  const respToken = await getFirebaseAccess()
111
111
 
112
- const locales = RNLocalize.getLocales();
113
-
114
- const os_locale = locales ? locales[0].countryCode : ''
115
- const os_language = locales && locales.length ? locales[0].languageCode : ''
116
- const device_manufacturer = await DeviceInfo.getManufacturer();
112
+ const { countryCode: osLocale, languageCode: osLanguage } = RNLocalize.getLocales()[0] || {};
113
+ const deviceManufacturer = await DeviceInfo.getManufacturer();
117
114
  const installTime = await DeviceInfo.getFirstInstallTime();
118
115
  const lastUpdateTime = await DeviceInfo.getLastUpdateTime();
119
116
  const uuid = await DeviceInfo.getUniqueId();
120
- const app_installed_in = formatDate(installTime);
121
- const app_updated_in = formatDate(lastUpdateTime);
117
+ const appInstalledIn = formatDate(installTime);
118
+ const appUpdatedIn = formatDate(lastUpdateTime);
122
119
 
123
120
  const rawRequest = {
124
121
  registerSubscriberRequest: {
@@ -126,18 +123,18 @@ const Inngage = {
126
123
  identifier: friendlyIdentifier,
127
124
  registration: respToken,
128
125
  platform: DeviceInfo.getSystemName(),
129
- sdk: DeviceInfo.getBuildNumber(),
126
+ sdk: "3.3.2",
130
127
  device_model: DeviceInfo.getModel(),
131
- device_manufacturer,
132
- os_locale,
133
- os_language,
134
- os_version: DeviceInfo.getReadableVersion(),
135
- app_version: DeviceInfo.getBuildNumber(),
136
- app_installed_in,
137
- app_updated_in,
128
+ device_manufacturer: deviceManufacturer,
129
+ os_locale: osLanguage + "_" + osLocale,
130
+ os_language: osLanguage + "_" + osLocale,
131
+ os_version: DeviceInfo.getSystemVersion(),
132
+ app_version: DeviceInfo.getReadableVersion(),
133
+ app_installed_in: appInstalledIn,
134
+ app_updated_in: appUpdatedIn,
138
135
  uuid,
139
- phone_Number: phoneNumber,
140
- email: email,
136
+ phone_number: phoneNumber ?? "",
137
+ email: email ?? "",
141
138
  }
142
139
  };
143
140