diff --git a/CHANGELOG.md b/CHANGELOG.md index 998dd8a..3d3d37a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,23 @@ All notable changes to this project will be documented in this file. +## [0.24.0] - 2024-10-07 + +### Fixed +- [iOS] Some potential issues with possible database corruption. +- [Android] Notification callback issue when app was in foreground. + +### Added +- `Synerise.Settings.inAppMessaging.contentBaseUrl` option in settings to let you set the base URL to use for all relative URLs in an in-app message's creation. +- `Synerise.Client.updateAccountBasicInformation(context, onSuccess, onError)` method. The new method updates anonymous users. +- `ClientAccountUpdateBasicInformationContext` model correlated with the new `Synerise.Client.updateAccountBasicInformation(context, onSuccess, onError)` method. + +### Changed +- [Android] Fresco library is now updated to 3.2.0. +- Optimization of the In-app messaging module (variants are no longer assigned once more when the profile's UUID changes). +- Improvements to stability. + + ## [0.23.1] - 2024-09-16 ### Fixed @@ -43,7 +60,7 @@ The SDK version 0.21.0 has been omitted for technical reasons. - [iOS] Some potential issues with retrieving system push consent by the SDK. The SDK set the constent to false when the general consent for the application was enabled, but at least one of the following options was disabled: alerts, sounds, badges. ### Added -- `Synerise.settings.tracker.eventsTriggeringFlush` option in settings to let you set the list of event actions which will trigger instant sending of all events in the queue. The default array contains only push event's actions. +- `Synerise.Settings.tracker.eventsTriggeringFlush` option in settings to let you set the list of event actions which will trigger instant sending of all events in the queue. The default array contains only push event's actions. ### Changed - All events connected with push campaigns will flush the queue and send events immediately. @@ -62,7 +79,7 @@ The SDK version 0.21.0 has been omitted for technical reasons. ### Added - Global Control Group support for in-app messages. From now on, you can use this feature in in-app messaging communication. This lets you take your marketing efforts to the next level and provides a solid foundation for accurate measurement of campaign effectiveness. Read more at https://hub.synerise.com/docs/settings/configuration/global-control-group/. -- [iOS] `Synerise.settings.sdk.localizable` option in settings to let you localize some strings displayed by the SDK. +- [iOS] `Synerise.Settings.sdk.localizable` option in settings to let you localize some strings displayed by the SDK. ### Changed - Improved mechanism for checking capping in in-app messages. The number of views no longer resets when the account's UUID changes. @@ -278,14 +295,14 @@ https://hub.synerise.com//developers/mobile-sdk/campaigns/action-handling/ ### Added - Information about device root is moved to AppStarted event. -- New option to set whether events should be sent when server time synchronization has failed - `Synerise.settings.tracker.isBackendTimeSyncRequired`. +- New option to set whether events should be sent when server time synchronization has failed - `Synerise.Settings.tracker.isBackendTimeSyncRequired`. - `Client.deleteAccountByIdentityProvider` method. ## [0.9.14] - 2020-10-15 ### Added -- Support for encrypted notifications (enabled by `Synerise.settings.notifications.encryption`). [1] +- Support for encrypted notifications (enabled by `Synerise.Settings.notifications.encryption`). [1] [1] Please read full documentation: iOS: https://help.synerise.com/developers/ios-sdk/configure-notifications/#configuring-notification-encryption @@ -308,7 +325,7 @@ Android: https://help.synerise.com/developers/android-sdk/configure-notification - `Synerise.Injector.authenticateByOAuthIfRegistered` method. - `Synerise.Injector.deleteAccountByOAuth` method. - `Synerise.Injector.deleteAccountByAppleSignIn` method. -- `Synerise.settings.sdk.sdk.shouldDestroySessionOnApiKeyChange` option in settings. +- `Synerise.Settings.sdk.shouldDestroySessionOnApiKeyChange` option in settings. ## [0.9.11] - 2020-05-18 @@ -336,7 +353,7 @@ Android: https://help.synerise.com/developers/android-sdk/configure-notification ### Fixed -- `Synerise.settings` module issues. +- `Synerise.Settings` module issues. ## [0.9.7] - 2020-03-02 @@ -345,7 +362,7 @@ Android: https://help.synerise.com/developers/android-sdk/configure-notification - OAuth/Facebook authentication. - Walkthrough campaign. - Walkthrough listener in `Synerise.Injector` module. -- `Synerise.settings.injector.automatic` option in settings. +- `Synerise.Settings.injector.automatic` option in settings. - Vouchers methods in `Synerise.Promotions` module. - `Synerise.changeClientApiKey` method. diff --git a/README.md b/README.md index 3e27045..5479695 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Synerise React Native SDK (react-native-synerise-sdk) (0.23.1) +# Synerise React Native SDK (react-native-synerise-sdk) (0.24.0) [![Platform](https://img.shields.io/badge/platform-iOS-orange.svg)](https://github.com/synerise/ios-sdk) [![Platform](https://img.shields.io/badge/platform-Android-orange.svg)](https://github.com/synerise/android-sdk) diff --git a/android/build.gradle b/android/build.gradle index 21edec8..4b33c7e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -4,8 +4,8 @@ ext.versions = [ 'minSdk' : 21, 'compileSdk' : 33, 'targetSdk' : 33, - 'versionCode': 38, - 'versionName': "0.23.1" + 'versionCode': 40, + 'versionName': "0.24.0" ] buildscript { @@ -58,7 +58,7 @@ repositories { dependencies { implementation 'com.facebook.react:react-native:+' implementation "com.squareup.okhttp3:logging-interceptor:4.9.1" - api 'com.synerise.sdk:synerise-mobile-sdk:5.20.1' + api 'com.synerise.sdk:synerise-mobile-sdk:5.22.0' } //apply from: 'publish.gradle' \ No newline at end of file diff --git a/android/src/main/java/com/synerise/sdk/react/RNClient.java b/android/src/main/java/com/synerise/sdk/react/RNClient.java index 06c03a0..769ac1a 100644 --- a/android/src/main/java/com/synerise/sdk/react/RNClient.java +++ b/android/src/main/java/com/synerise/sdk/react/RNClient.java @@ -24,6 +24,7 @@ import com.synerise.sdk.client.Client; import com.synerise.sdk.client.model.GetAccountInformation; import com.synerise.sdk.client.model.UpdateAccountInformation; +import com.synerise.sdk.client.model.UpdateAccountBasicInformation; import com.synerise.sdk.client.model.client.Agreements; import com.synerise.sdk.client.model.client.Attributes; import com.synerise.sdk.client.model.client.RegisterClient; @@ -556,7 +557,6 @@ public void onDataAction(GetAccountInformation getAccountInformation) { accountMap.putBoolean("anonymous", getAccountInformation.getAnonymous()); accountMap.putMap("agreements", agreements); accountMap.putMap("attributes", MapUtil.stringMapToWritableMap(getAccountInformation.getAttributes())); - accountMap.putArray("tags", ArrayUtil.toWritableArray(getAccountInformation.getTags())); if (getAccountInformation.getLastActivityDate() != null) { accountMap.putDouble("lastActivityDate", getAccountInformation.getLastActivityDate().getTime()); } @@ -571,6 +571,46 @@ public void onDataAction(ApiError apiError) { }); } + //updateAccountBasicInformation(context: ClientAccountUpdateBasicInformationContext, onSuccess: () => void, onError: (error: Error) => void) + @ReactMethod + public void updateAccountBasicInformation(ReadableMap map, Callback callback) { + UpdateAccountBasicInformation updateAccountBasicInformation = new UpdateAccountBasicInformation(); + updateAccountBasicInformation.setFirstName(map.hasKey("firstName") ? map.getString("firstName") : null); + updateAccountBasicInformation.setLastName(map.hasKey("lastName") ? map.getString("lastName") : null); + updateAccountBasicInformation.setDisplayName(map.hasKey("displayName") ? map.getString("displayName") : null); + if (map.hasKey("sex")) { + updateAccountBasicInformation.setSex(Sex.getSex(map.getString("sex"))); + } + updateAccountBasicInformation.setPhoneNumber(map.hasKey("phone") ? map.getString("phone") : null); + updateAccountBasicInformation.setBirthDate(map.hasKey("birthDate") ? map.getString("birthDate") : null); + updateAccountBasicInformation.setAvatarUrl(map.hasKey("avatarUrl") ? map.getString("avatarUrl") : null); + updateAccountBasicInformation.setCompany(map.hasKey("company") ? map.getString("company") : null); + updateAccountBasicInformation.setAddress(map.hasKey("address") ? map.getString("address") : null); + updateAccountBasicInformation.setCity(map.hasKey("city") ? map.getString("city") : null); + updateAccountBasicInformation.setProvince(map.hasKey("province") ? map.getString("province") : null); + updateAccountBasicInformation.setZipCode(map.hasKey("zipCode") ? map.getString("zipCode") : null); + updateAccountBasicInformation.setCountryCode(map.hasKey("countryCode") ? map.getString("countryCode") : null); + + if (map.hasKey("attributes")) { + Attributes attributes = attributesMapper(map.getMap("attributes").toHashMap()); + updateAccountBasicInformation.setAttributes(attributes); + } + + if (map.hasKey("agreements")) { + Agreements agreements = agreementsMapper(map.getMap("agreements")); + updateAccountBasicInformation.setAgreements(agreements); + } + + if (updateAccountCall != null) updateAccountCall.cancel(); + updateAccountCall = Client.updateAccountBasicInformation(updateAccountBasicInformation); + updateAccountCall.execute(() -> executeSuccessCallbackResponse(callback, null, null), new DataActionListener() { + @Override + public void onDataAction(ApiError apiError) { + executeFailureCallbackResponse(callback, null, apiError); + } + }); + } + //updateAccount(context: ClientAccountUpdateContext, onSuccess: () => void, onError: (error: Error) => void) @ReactMethod public void updateAccount(ReadableMap map, Callback callback) { diff --git a/android/src/main/java/com/synerise/sdk/react/RNSettings.java b/android/src/main/java/com/synerise/sdk/react/RNSettings.java index 0f362cb..61b1ee0 100644 --- a/android/src/main/java/com/synerise/sdk/react/RNSettings.java +++ b/android/src/main/java/com/synerise/sdk/react/RNSettings.java @@ -39,6 +39,7 @@ public class RNSettings extends RNBaseModule { public static final String RN_SETTINGS_INJECTOR_AUTOMATIC = "INJECTOR_AUTOMATIC"; public static final String RN_SETTINGS_IN_APP_CHECK_GLOBAL_CONTROL_GROUPS_ON_DEFINITIONS_FETCH = "IN_APP_CHECK_GLOBAL_CONTROL_GROUPS_ON_DEFINITIONS_FETCH"; public static final String RN_SETTINGS_IN_APP_MAX_DEFINITION_UPDATE_INTERVAL_LIMIT = "IN_APP_MAX_DEFINITION_UPDATE_INTERVAL_LIMIT"; + public static final String RN_SETTINGS_IN_APP_MESSAGING_CONTENT_BASE_URL = "IN_APP_MESSAGING_CONTENT_BASE_URL"; public static final String RN_SETTINGS_IN_APP_MESSAGING_RENDERING_TIMEOUT = "IN_APP_MESSAGING_RENDERING_TIMEOUT"; public static final String RN_SETTINGS_IN_APP_MESSAGING_SHOULD_SEND_IN_APP_CAPPING_EVENT = "IN_APP_MESSAGING_SHOULD_SEND_IN_APP_CAPPING_EVENT"; @@ -69,6 +70,7 @@ public Map getConstants() { constants.put(RN_SETTINGS_SHOULD_DESTROY_SESSION_ON_API_KEY_CHANGE, RN_SETTINGS_SHOULD_DESTROY_SESSION_ON_API_KEY_CHANGE); constants.put(RN_SETTINGS_IN_APP_CHECK_GLOBAL_CONTROL_GROUPS_ON_DEFINITIONS_FETCH, RN_SETTINGS_IN_APP_CHECK_GLOBAL_CONTROL_GROUPS_ON_DEFINITIONS_FETCH); constants.put(RN_SETTINGS_IN_APP_MAX_DEFINITION_UPDATE_INTERVAL_LIMIT, RN_SETTINGS_IN_APP_MAX_DEFINITION_UPDATE_INTERVAL_LIMIT); + constants.put(RN_SETTINGS_IN_APP_MESSAGING_CONTENT_BASE_URL, RN_SETTINGS_IN_APP_MESSAGING_CONTENT_BASE_URL); constants.put(RN_SETTINGS_IN_APP_MESSAGING_RENDERING_TIMEOUT, RN_SETTINGS_IN_APP_MESSAGING_RENDERING_TIMEOUT); constants.put(RN_SETTINGS_IN_APP_MESSAGING_SHOULD_SEND_IN_APP_CAPPING_EVENT, RN_SETTINGS_IN_APP_MESSAGING_SHOULD_SEND_IN_APP_CAPPING_EVENT); return constants; @@ -85,6 +87,9 @@ public WritableMap getOne(String key) { if (settings.get(key) instanceof Integer) { setting.putInt(key, (int) settings.get(key)); } + if (settings.get(key) instanceof String) { + setting.putString(key, (String) settings.get(key)); + } if (settings.get(key) instanceof List) { List eventsTriggeringFlush = (List) settings.get(key); WritableArray writableArray = Arguments.createArray(); @@ -110,6 +115,9 @@ public void setOne(ReadableMap settingMap) { case Number: matchSetting(key, settingMap.getInt("value")); break; + case String: + matchSetting(key, settingMap.getString("value")); + break; case Array: matchSetting(key, settingMap.getArray("value")); break; @@ -131,6 +139,9 @@ public void setMany(ReadableMap newSettings) { case Number: matchSetting(key, newSettings.getInt(key)); break; + case String: + matchSetting(key, newSettings.getString(key)); + break; case Array: matchSetting(key, newSettings.getArray(key)); break; @@ -206,7 +217,10 @@ private void matchSetting(String key, Object value) { if (value instanceof Integer) { Settings.getInstance().inAppMessaging.setMaxDefinitionUpdateIntervalLimit((int) value); } - + case RN_SETTINGS_IN_APP_MESSAGING_CONTENT_BASE_URL: + if (value instanceof String) { + Settings.getInstance().inAppMessaging.setContentBaseUrl((String) value); + } case RN_SETTINGS_IN_APP_MESSAGING_RENDERING_TIMEOUT: if (value instanceof Integer) { Settings.getInstance().inAppMessaging.renderingTimeout = ((int) value) * 1000; @@ -233,6 +247,7 @@ private Map settingsDictionary() { settings.put(RN_SETTINGS_NOTIFICATIONS_ENCRYPTION, Synerise.settings.notifications.getEncryption()); settings.put(RN_SETTINGS_SHOULD_DESTROY_SESSION_ON_API_KEY_CHANGE, Synerise.settings.sdk.shouldDestroySessionOnApiKeyChange); settings.put(RN_SETTINGS_IN_APP_CHECK_GLOBAL_CONTROL_GROUPS_ON_DEFINITIONS_FETCH, Synerise.settings.inAppMessaging.checkGlobalControlGroupsOnDefinitionsFetch); + settings.put(RN_SETTINGS_IN_APP_MESSAGING_CONTENT_BASE_URL, Synerise.settings.inAppMessaging.getContentBaseUrl()); settings.put(RN_SETTINGS_IN_APP_MESSAGING_RENDERING_TIMEOUT, Synerise.settings.inAppMessaging.renderingTimeout / 1000); settings.put(RN_SETTINGS_IN_APP_MAX_DEFINITION_UPDATE_INTERVAL_LIMIT, Synerise.settings.inAppMessaging.getMaxDefinitionUpdateIntervalLimit()); settings.put(RN_SETTINGS_IN_APP_MESSAGING_SHOULD_SEND_IN_APP_CAPPING_EVENT, Synerise.settings.inAppMessaging.shouldSendInAppCappingEvent); diff --git a/android/src/main/java/com/synerise/sdk/react/RNSyneriseInitializer.java b/android/src/main/java/com/synerise/sdk/react/RNSyneriseInitializer.java index ee1fb5a..1c18afa 100644 --- a/android/src/main/java/com/synerise/sdk/react/RNSyneriseInitializer.java +++ b/android/src/main/java/com/synerise/sdk/react/RNSyneriseInitializer.java @@ -17,7 +17,7 @@ public class RNSyneriseInitializer { public Boolean isCrashHandlingEnabled; public static volatile boolean isInitialized = false; - public static final String SDK_PLUGIN_VERSION = "0.23.1"; + public static final String SDK_PLUGIN_VERSION = "0.24.0"; public void initialize(Application app) { if (isInitialized == false) { diff --git a/ios/ReactNativeSynerise/Main/RNSyneriseInitializer.m b/ios/ReactNativeSynerise/Main/RNSyneriseInitializer.m index 55ae242..39a0e4f 100644 --- a/ios/ReactNativeSynerise/Main/RNSyneriseInitializer.m +++ b/ios/ReactNativeSynerise/Main/RNSyneriseInitializer.m @@ -8,7 +8,7 @@ #import "RNSyneriseInitializer.h" -NSString * const SNRSyneriseSDKPluginVersion = @"0.23.1"; +NSString * const SNRSyneriseSDKPluginVersion = @"0.24.0"; @implementation RNSyneriseInitializer diff --git a/ios/ReactNativeSynerise/Modules/RNClient.m b/ios/ReactNativeSynerise/Modules/RNClient.m index 6355b54..e44cf94 100644 --- a/ios/ReactNativeSynerise/Modules/RNClient.m +++ b/ios/ReactNativeSynerise/Modules/RNClient.m @@ -201,6 +201,34 @@ - (nullable SNRClientSimpleAuthenticationData *)modelClientSimpleAuthenticationD return nil; } +- (nullable SNRClientUpdateAccountBasicInformationContext *)modelClientUpdateAccountBasicInformationContextWithDictionary:(nullable NSDictionary *)dictionary { + if (dictionary != nil) { + SNRClientUpdateAccountBasicInformationContext *model = [SNRClientUpdateAccountContext new]; + model.firstName = [dictionary getStringForKey:@"firstName"]; + model.lastName = [dictionary getStringForKey:@"lastName"]; + model.displayName = [dictionary getStringForKey:@"displayName"]; + model.sex = SNR_StringToClientSex([dictionary getStringForKey:@"sex"]); + model.phone = [dictionary getStringForKey:@"phone"]; + model.birthDate = [dictionary getStringForKey:@"birthDate"]; + model.avatarUrl = [dictionary getStringForKey:@"avatarUrl"]; + + model.company = [dictionary getStringForKey:@"company"]; + model.address = [dictionary getStringForKey:@"address"]; + model.city = [dictionary getStringForKey:@"city"]; + model.province = [dictionary getStringForKey:@"province"]; + model.zipCode = [dictionary getStringForKey:@"zipCode"]; + model.countryCode = [dictionary getStringForKey:@"countryCode"]; + + model.agreements = [self modelClientAgreementsWithDictionary:[dictionary getDictionaryForKey:@"agreements"]]; + + model.attributes = [dictionary getDictionaryForKey:@"attributes"]; + + return model; + } + + return nil; +} + - (nullable SNRClientUpdateAccountContext *)modelClientUpdateAccountContextWithDictionary:(nullable NSDictionary *)dictionary { if (dictionary != nil) { SNRClientUpdateAccountContext *model = [SNRClientUpdateAccountContext new]; @@ -723,13 +751,29 @@ - (NSDictionary *)constantsToExport }]; } +//updateAccountBasicInformation(context: ClientAccountUpdateBasicInformationContext, onSuccess: () => void, onError: (error: Error) => void) + +RCT_EXPORT_METHOD(updateAccountBasicInformation:(NSDictionary *)dictionary response:(RCTResponseSenderBlock)response) +{ + SNRClientUpdateAccountBasicInformationContext *context = [self modelClientUpdateAccountBasicInformationContextWithDictionary:dictionary]; + if (context != nil) { + [SNRClient updateAccountBasicInformation:context success:^(BOOL isSuccess) { + [self executeSuccessCallbackResponse:response data:@1]; + } failure:^(NSError *error) { + [self executeFailureCallbackResponse:response error:error]; + }]; + } else { + [self executeDefaultFailureCallbackResponse:response]; + } +} + //updateAccount(context: ClientAccountUpdateContext, onSuccess: () => void, onError: (error: Error) => void) RCT_EXPORT_METHOD(updateAccount:(NSDictionary *)dictionary response:(RCTResponseSenderBlock)response) { - SNRClientUpdateAccountContext *clientUpdateAccountContext = [self modelClientUpdateAccountContextWithDictionary:dictionary]; - if (clientUpdateAccountContext != nil) { - [SNRClient updateAccount:clientUpdateAccountContext success:^(BOOL isSuccess) { + SNRClientUpdateAccountContext *context = [self modelClientUpdateAccountContextWithDictionary:dictionary]; + if (context != nil) { + [SNRClient updateAccount:context success:^(BOOL isSuccess) { [self executeSuccessCallbackResponse:response data:@1]; } failure:^(NSError *error) { [self executeFailureCallbackResponse:response error:error]; diff --git a/ios/ReactNativeSynerise/Modules/RNSettings.m b/ios/ReactNativeSynerise/Modules/RNSettings.m index 25b6357..a99e2ed 100644 --- a/ios/ReactNativeSynerise/Modules/RNSettings.m +++ b/ios/ReactNativeSynerise/Modules/RNSettings.m @@ -27,6 +27,7 @@ static NSString * const RNSettingsInAppMessagingCheckGlobalControlGroupsOnDefinitionsFetch = @"IN_APP_CHECK_GLOBAL_CONTROL_GROUPS_ON_DEFINITIONS_FETCH"; static NSString * const RNSettingsInAppMessagingMaxDefinitionUpdateIntervalLimit = @"IN_APP_MAX_DEFINITION_UPDATE_INTERVAL_LIMIT"; +static NSString * const RNSettingsInAppMessagingContentBaseUrl = @"IN_APP_MESSAGING_CONTENT_BASE_URL"; static NSString * const RNSettingsInAppMessagingRenderingTimeout = @"IN_APP_MESSAGING_RENDERING_TIMEOUT"; static NSString * const RNSettingsInAppMessagingShouldSendInAppCappingEvent = @"IN_APP_MESSAGING_SHOULD_SEND_IN_APP_CAPPING_EVENT"; @@ -80,6 +81,7 @@ - (void)updateSettingsWithDictionary:(NSDictionary *)dictionary { [self updateSettingsKeyPath:@"inAppMessaging.checkGlobalControlGroupsOnDefinitionsFetch" expectedClass:[NSNumber class] object:dictionary[RNSettingsInAppMessagingCheckGlobalControlGroupsOnDefinitionsFetch]]; [self updateSettingsKeyPath:@"inAppMessaging.maxDefinitionUpdateIntervalLimit" expectedClass:[NSNumber class] object:dictionary[RNSettingsInAppMessagingMaxDefinitionUpdateIntervalLimit]]; + [self updateSettingsKeyPath:@"inAppMessaging.contentBaseUrl" expectedClass:[NSString class] object:dictionary[RNSettingsInAppMessagingContentBaseUrl]]; [self updateSettingsKeyPath:@"inAppMessaging.renderingTimeout" expectedClass:[NSNumber class] object:dictionary[RNSettingsInAppMessagingRenderingTimeout]]; [self updateSettingsKeyPath:@"inAppMessaging.shouldSendInAppCappingEvent" expectedClass:[NSNumber class] object:dictionary[RNSettingsInAppMessagingShouldSendInAppCappingEvent]]; @@ -114,12 +116,12 @@ - (NSDictionary *)normalizeSDKLocalizableDictionary:(nullable NSDictionary *)dic NSString *localizableKeyOK = dictionary[JSLocalizableKeyOK]; if (localizableKeyOK != nil) { - newDictionary[SNR_LOCALIZABLE_STRING_KEY_OK] = localizableKeyOK; + newDictionary[_SNR_Constants.LOCALIZABLE_STRING_KEY_OK] = localizableKeyOK; } NSString *localizableKeyCancel = dictionary[JSLocalizableKeyCancel]; if (localizableKeyCancel != nil) { - newDictionary[SNR_LOCALIZABLE_STRING_KEY_CANCEL] = localizableKeyCancel; + newDictionary[_SNR_Constants.LOCALIZABLE_STRING_KEY_CANCEL] = localizableKeyCancel; } if ([newDictionary count] == 0 ){ @@ -153,6 +155,7 @@ - (NSDictionary *)settingsDictionary { dictionary[RNSettingsInAppMessagingCheckGlobalControlGroupsOnDefinitionsFetch] = [NSNumber numberWithBool:SNRSynerise.settings.inAppMessaging.checkGlobalControlGroupsOnDefinitionsFetch]; dictionary[RNSettingsInAppMessagingMaxDefinitionUpdateIntervalLimit] = [NSNumber numberWithDouble:SNRSynerise.settings.inAppMessaging.maxDefinitionUpdateIntervalLimit]; + dictionary[RNSettingsInAppMessagingContentBaseUrl] = SNRSynerise.settings.inAppMessaging.contentBaseUrl ?: [NSNull null]; dictionary[RNSettingsInAppMessagingRenderingTimeout] = [NSNumber numberWithDouble:SNRSynerise.settings.inAppMessaging.renderingTimeout]; dictionary[RNSettingsInAppMessagingShouldSendInAppCappingEvent] = [NSNumber numberWithBool:SNRSynerise.settings.inAppMessaging.shouldSendInAppCappingEvent]; @@ -185,6 +188,7 @@ - (NSDictionary *)constantsToExport RNSettingsInAppMessagingCheckGlobalControlGroupsOnDefinitionsFetch: RNSettingsInAppMessagingCheckGlobalControlGroupsOnDefinitionsFetch, RNSettingsInAppMessagingMaxDefinitionUpdateIntervalLimit: RNSettingsInAppMessagingMaxDefinitionUpdateIntervalLimit, + RNSettingsInAppMessagingContentBaseUrl: RNSettingsInAppMessagingContentBaseUrl, RNSettingsInAppMessagingRenderingTimeout: RNSettingsInAppMessagingRenderingTimeout, RNSettingsInAppMessagingShouldSendInAppCappingEvent: RNSettingsInAppMessagingShouldSendInAppCappingEvent, diff --git a/ios/react-native-synerise-sdk.podspec b/ios/react-native-synerise-sdk.podspec index f99bcb0..0c6fc44 100644 --- a/ios/react-native-synerise-sdk.podspec +++ b/ios/react-native-synerise-sdk.podspec @@ -2,7 +2,7 @@ require 'json' package = JSON.parse(File.read('./../package.json')) -SYNERISE_SDK_FRAMEWORK_VERSION = '4.19.1' +SYNERISE_SDK_FRAMEWORK_VERSION = '4.23.1' Pod::Spec.new do |s| s.name = package['name'] diff --git a/lib/classes/models/Client/ClientAccountUpdateBasicInformationContext.d.ts b/lib/classes/models/Client/ClientAccountUpdateBasicInformationContext.d.ts new file mode 100644 index 0000000..1e486df --- /dev/null +++ b/lib/classes/models/Client/ClientAccountUpdateBasicInformationContext.d.ts @@ -0,0 +1,40 @@ +import { BaseModel } from './../BaseModel'; +import { ClientSex } from './../Client/ClientSex'; +import { IClientAgreements, ClientAgreements } from './../Client/ClientAgreements'; +interface IClientAccountUpdateBasicInformationContext { + firstName?: string; + lastName?: string; + displayName?: string; + sex?: ClientSex; + phone?: string; + birthDate?: string; + avatarUrl?: string; + company?: string; + address?: string; + city?: string; + province?: string; + zipCode?: string; + countryCode?: string; + agreements?: IClientAgreements; + attributes?: object; +} +declare class ClientAccountUpdateBasicInformationContext extends BaseModel { + firstName?: string; + lastName?: string; + displayName?: string; + sex?: ClientSex; + phone?: string; + birthDate?: string; + avatarUrl?: string; + company?: string; + address?: string; + city?: string; + province?: string; + zipCode?: string; + countryCode?: string; + agreements: ClientAgreements; + attributes?: object; + constructor(modelObject?: IClientAccountUpdateBasicInformationContext); + toObject(): object; +} +export { IClientAccountUpdateBasicInformationContext, ClientAccountUpdateBasicInformationContext }; diff --git a/lib/classes/models/Client/ClientAccountUpdateBasicInformationContext.js b/lib/classes/models/Client/ClientAccountUpdateBasicInformationContext.js new file mode 100644 index 0000000..be5b2d0 --- /dev/null +++ b/lib/classes/models/Client/ClientAccountUpdateBasicInformationContext.js @@ -0,0 +1,60 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ClientAccountUpdateBasicInformationContext = void 0; +var BaseModel_1 = require("./../BaseModel"); +var ClientAgreements_1 = require("./../Client/ClientAgreements"); +var ClientAccountUpdateBasicInformationContext = /** @class */ (function (_super) { + __extends(ClientAccountUpdateBasicInformationContext, _super); + function ClientAccountUpdateBasicInformationContext(modelObject) { + var _this = _super.call(this) || this; + _this.firstName = modelObject === null || modelObject === void 0 ? void 0 : modelObject.firstName; + _this.lastName = modelObject === null || modelObject === void 0 ? void 0 : modelObject.lastName; + _this.displayName = modelObject === null || modelObject === void 0 ? void 0 : modelObject.displayName; + _this.sex = modelObject === null || modelObject === void 0 ? void 0 : modelObject.sex; + _this.phone = modelObject === null || modelObject === void 0 ? void 0 : modelObject.phone; + _this.birthDate = modelObject === null || modelObject === void 0 ? void 0 : modelObject.birthDate; + _this.avatarUrl = modelObject === null || modelObject === void 0 ? void 0 : modelObject.avatarUrl; + _this.company = modelObject === null || modelObject === void 0 ? void 0 : modelObject.company; + _this.address = modelObject === null || modelObject === void 0 ? void 0 : modelObject.address; + _this.province = modelObject === null || modelObject === void 0 ? void 0 : modelObject.province; + _this.zipCode = modelObject === null || modelObject === void 0 ? void 0 : modelObject.zipCode; + _this.countryCode = modelObject === null || modelObject === void 0 ? void 0 : modelObject.countryCode; + _this.agreements = new ClientAgreements_1.ClientAgreements(modelObject === null || modelObject === void 0 ? void 0 : modelObject.agreements); + _this.attributes = modelObject === null || modelObject === void 0 ? void 0 : modelObject.attributes; + return _this; + } + ClientAccountUpdateBasicInformationContext.prototype.toObject = function () { + return { + firstName: this.firstName, + lastName: this.lastName, + displayName: this.displayName, + sex: this.sex, + phone: this.phone, + birthDate: this.birthDate, + avatarUrl: this.avatarUrl, + company: this.company, + address: this.address, + city: this.city, + province: this.province, + zipCode: this.zipCode, + countryCode: this.countryCode, + agreements: this.agreements.toObjectIfNotEmpty(), + attributes: this.attributes, + }; + }; + return ClientAccountUpdateBasicInformationContext; +}(BaseModel_1.BaseModel)); +exports.ClientAccountUpdateBasicInformationContext = ClientAccountUpdateBasicInformationContext; diff --git a/lib/config/import_models.d.ts b/lib/config/import_models.d.ts index 3a8ee82..5effaf4 100644 --- a/lib/config/import_models.d.ts +++ b/lib/config/import_models.d.ts @@ -5,6 +5,7 @@ export { IClientAppleSignInAuthenticationContext, ClientAppleSignInAuthenticatio export { IClientSimpleAuthenticationData, ClientSimpleAuthenticationData } from './../classes/models/Client/ClientSimpleAuthenticationData'; export { ClientAccountInformation } from './../classes/models/Client/ClientAccountInformation'; export { IClientAccountRegisterContext, ClientAccountRegisterContext } from './../classes/models/Client/ClientAccountRegisterContext'; +export { IClientAccountUpdateBasicInformationContext, ClientAccountUpdateBasicInformationContext } from './../classes/models/Client/ClientAccountUpdateBasicInformationContext'; export { IClientAccountUpdateContext, ClientAccountUpdateContext } from './../classes/models/Client/ClientAccountUpdateContext'; export { IClientAgreements, ClientAgreements } from './../classes/models/Client/ClientAgreements'; export { ClientSex, ClientSexFromString, ClientSexToString } from './../classes/models/Client/ClientSex'; diff --git a/lib/config/import_models.js b/lib/config/import_models.js index 5662789..c8f9ecf 100644 --- a/lib/config/import_models.js +++ b/lib/config/import_models.js @@ -15,6 +15,8 @@ var ClientAccountInformation_1 = require("./../classes/models/Client/ClientAccou Object.defineProperty(exports, "ClientAccountInformation", { enumerable: true, get: function () { return ClientAccountInformation_1.ClientAccountInformation; } }); var ClientAccountRegisterContext_1 = require("./../classes/models/Client/ClientAccountRegisterContext"); Object.defineProperty(exports, "ClientAccountRegisterContext", { enumerable: true, get: function () { return ClientAccountRegisterContext_1.ClientAccountRegisterContext; } }); +var ClientAccountUpdateBasicInformationContext_1 = require("./../classes/models/Client/ClientAccountUpdateBasicInformationContext"); +Object.defineProperty(exports, "ClientAccountUpdateBasicInformationContext", { enumerable: true, get: function () { return ClientAccountUpdateBasicInformationContext_1.ClientAccountUpdateBasicInformationContext; } }); var ClientAccountUpdateContext_1 = require("./../classes/models/Client/ClientAccountUpdateContext"); Object.defineProperty(exports, "ClientAccountUpdateContext", { enumerable: true, get: function () { return ClientAccountUpdateContext_1.ClientAccountUpdateContext; } }); var ClientAgreements_1 = require("./../classes/models/Client/ClientAgreements"); diff --git a/lib/main/modules/ClientModule.d.ts b/lib/main/modules/ClientModule.d.ts index d8f5de3..fac257d 100644 --- a/lib/main/modules/ClientModule.d.ts +++ b/lib/main/modules/ClientModule.d.ts @@ -1,5 +1,6 @@ import { BaseModule as Module } from './BaseModule'; import { ClientAccountRegisterContext } from './../../classes/models/Client/ClientAccountRegisterContext'; +import { ClientAccountUpdateBasicInformationContext } from './../../classes/models/Client/ClientAccountUpdateBasicInformationContext'; import { ClientAccountUpdateContext } from './../../classes/models/Client/ClientAccountUpdateContext'; import { ClientAccountInformation } from './../../classes/models/Client/ClientAccountInformation'; import { ClientAuthContext } from '../../classes/models/Client/ClientAuthContext'; @@ -250,6 +251,14 @@ declare class ClientModule extends Module { * @param onError Function to be executed when the operation finishes unsuccessfully */ getAccount(onSuccess: (clientAccountInformation: ClientAccountInformation) => void, onError: (error: Error) => void): void; + /** + * This method updates a customer’s account basic information. + * + * @param context Object with customer’s first name, phone, and other optional data + * @param onSuccess Function to be executed when the operation finishes successfully + * @param onError Function to be executed when the operation finishes unsuccessfully + */ + updateAccountBasicInformation(context: ClientAccountUpdateBasicInformationContext, onSuccess: () => void, onError: (error: Error) => void): void; /** * This method updates a customer’s account information. * diff --git a/lib/main/modules/ClientModule.js b/lib/main/modules/ClientModule.js index b3a0530..24eca4e 100644 --- a/lib/main/modules/ClientModule.js +++ b/lib/main/modules/ClientModule.js @@ -350,6 +350,17 @@ var ClientModule = /** @class */ (function (_super) { ClientModule.prototype.getAccount = function (onSuccess, onError) { SyneriseModuleConnector_1.SyneriseModuleConnector.invokeMethodWithCallback(RNClient.getAccount, [], onSuccess, onError, BaseModel_1.ModelMapper.make(ClientAccountInformation_1.ClientAccountInformation)); }; + /** + * This method updates a customer’s account basic information. + * + * @param context Object with customer’s first name, phone, and other optional data + * @param onSuccess Function to be executed when the operation finishes successfully + * @param onError Function to be executed when the operation finishes unsuccessfully + */ + ClientModule.prototype.updateAccountBasicInformation = function (context, onSuccess, onError) { + var contextObject = context.toObject(); + SyneriseModuleConnector_1.SyneriseModuleConnector.invokeMethodWithCallback(RNClient.updateAccountBasicInformation, [contextObject], onSuccess, onError); + }; /** * This method updates a customer’s account information. * diff --git a/lib/main/modules/SettingsModule.d.ts b/lib/main/modules/SettingsModule.d.ts index 15056f6..c77e48a 100644 --- a/lib/main/modules/SettingsModule.d.ts +++ b/lib/main/modules/SettingsModule.d.ts @@ -25,6 +25,7 @@ interface ISettingsOptions { inAppMessaging?: { checkGlobalControlGroupsOnDefinitionsFetch?: boolean; maxDefinitionUpdateIntervalLimit?: number; + contentBaseUrl?: string; renderingTimeout?: number; shouldSendInAppCappingEvent?: boolean; }; @@ -57,6 +58,7 @@ declare class SettingsModule extends Module { inAppMessaging: { checkGlobalControlGroupsOnDefinitionsFetch: any; maxDefinitionUpdateIntervalLimit: any; + contentBaseUrl: any; renderingTimeout: any; shouldSendInAppCappingEvent: any; }; diff --git a/lib/main/modules/SettingsModule.js b/lib/main/modules/SettingsModule.js index d482596..c978de1 100644 --- a/lib/main/modules/SettingsModule.js +++ b/lib/main/modules/SettingsModule.js @@ -47,6 +47,7 @@ function mapSettingsOptionsForNativeModule(settingsOptions) { NOTIFICATIONS_DISABLE_IN_APP_ALERTS: settingsOptions.notifications && settingsOptions.notifications.disableInAppAlerts, IN_APP_CHECK_GLOBAL_CONTROL_GROUPS_ON_DEFINITIONS_FETCH: settingsOptions.inAppMessaging && settingsOptions.inAppMessaging.checkGlobalControlGroupsOnDefinitionsFetch, IN_APP_MAX_DEFINITION_UPDATE_INTERVAL_LIMIT: settingsOptions.inAppMessaging && settingsOptions.inAppMessaging.maxDefinitionUpdateIntervalLimit, + IN_APP_MESSAGING_CONTENT_BASE_URL: settingsOptions.inAppMessaging && settingsOptions.inAppMessaging.contentBaseUrl, IN_APP_MESSAGING_RENDERING_TIMEOUT: settingsOptions.inAppMessaging && settingsOptions.inAppMessaging.renderingTimeout, IN_APP_MESSAGING_SHOULD_SEND_IN_APP_CAPPING_EVENT: settingsOptions.inAppMessaging && settingsOptions.inAppMessaging.shouldSendInAppCappingEvent, INJECTOR_AUTOMATIC: settingsOptions.injector && settingsOptions.injector.automatic, @@ -198,6 +199,12 @@ var SettingsModule = /** @class */ (function (_super) { set maxDefinitionUpdateIntervalLimit(value) { setOne(RNSettings.IN_APP_MAX_DEFINITION_UPDATE_INTERVAL_LIMIT, value); }, + get contentBaseUrl() { + return getOne(RNSettings.IN_APP_MESSAGING_CONTENT_BASE_URL); + }, + set contentBaseUrl(value) { + setOne(RNSettings.IN_APP_MESSAGING_CONTENT_BASE_URL, value); + }, get renderingTimeout() { return getOne(RNSettings.IN_APP_MESSAGING_RENDERING_TIMEOUT); }, diff --git a/package.json b/package.json index b8ae631..63aee41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-synerise-sdk", - "version": "0.23.1", + "version": "0.24.0", "description": "React Native wrapper for Synerise SDK", "author": { "name": "Synerise", diff --git a/react-native-synerise-sdk.podspec b/react-native-synerise-sdk.podspec index e3b0dc6..14809f7 100644 --- a/react-native-synerise-sdk.podspec +++ b/react-native-synerise-sdk.podspec @@ -2,7 +2,7 @@ require 'json' package = JSON.parse(File.read('./package.json')) -SYNERISE_SDK_FRAMEWORK_VERSION = '4.19.1' +SYNERISE_SDK_FRAMEWORK_VERSION = '4.23.1' Pod::Spec.new do |s| s.name = package['name']