klaviyo-react-native-sdk
Version:
Official Klaviyo React Native SDK
66 lines (65 loc) • 1.96 kB
JavaScript
;
import { KlaviyoReactNativeSdk } from "./KlaviyoReactNativeSdk.js";
import { formatProfile } from "./Profile.js";
/**
* Implementation of the {@link KlaviyoInterface}
*/
export const Klaviyo = {
initialize(apiKey) {
KlaviyoReactNativeSdk.initialize(apiKey);
},
setProfile(profile) {
KlaviyoReactNativeSdk.setProfile(formatProfile(profile));
},
setExternalId(externalId) {
KlaviyoReactNativeSdk.setExternalId(externalId);
},
getExternalId(callback) {
return KlaviyoReactNativeSdk.getExternalId(callback);
},
setEmail(email) {
KlaviyoReactNativeSdk.setEmail(email);
},
getEmail(callback) {
return KlaviyoReactNativeSdk.getEmail(callback);
},
setPhoneNumber(phoneNumber) {
KlaviyoReactNativeSdk.setPhoneNumber(phoneNumber);
},
getPhoneNumber(callback) {
return KlaviyoReactNativeSdk.getPhoneNumber(callback);
},
setProfileAttribute(propertyKey, value) {
KlaviyoReactNativeSdk.setProfileAttribute(propertyKey, value);
},
setBadgeCount(count) {
// checking if method exists since this is iOS only and don't want a
// runtime error on android
if (KlaviyoReactNativeSdk.setBadgeCount) {
KlaviyoReactNativeSdk.setBadgeCount(count);
} else {
console.log('setBadgeCount is not available on this platform');
}
},
resetProfile() {
KlaviyoReactNativeSdk.resetProfile();
},
setPushToken(token) {
KlaviyoReactNativeSdk.setPushToken(token);
},
getPushToken(callback) {
return KlaviyoReactNativeSdk.getPushToken(callback);
},
createEvent(event) {
KlaviyoReactNativeSdk.createEvent(event);
},
registerForInAppForms(configuration) {
KlaviyoReactNativeSdk.registerForInAppForms(configuration);
},
unregisterFromInAppForms: () => {
KlaviyoReactNativeSdk.unregisterFromInAppForms();
}
};
export { EventName } from "./Event.js";
export { ProfileProperty } from "./Profile.js";
//# sourceMappingURL=index.js.map