@braze/expo-plugin
Version:
Config plugin for @braze/react-native-sdk package
35 lines (34 loc) • 1.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const config_plugins_1 = require("expo/config-plugins");
const withBrazeAndroid_1 = require("./withBrazeAndroid");
const withBrazeiOS_1 = require("./withBrazeiOS");
function warningForDeprecatedProps(props) {
if (!props) {
return;
}
const used = [];
if (props.androidApiKey) {
used.push("androidApiKey");
}
if (props.iosApiKey) {
used.push("iosApiKey");
}
if (props.baseUrl) {
used.push("baseUrl");
}
if (used.length === 0) {
return;
}
console.warn(`The configuration options are deprecated: ${used.join(", ")}. ` +
"Configure the credentials with `Braze.initialize()` instead. ");
}
const withBraze = (config, _props) => {
const props = _props ?? {};
warningForDeprecatedProps(props);
config = (0, withBrazeAndroid_1.withAndroidBrazeSdk)(config, props);
config = (0, withBrazeiOS_1.withIOSBrazeSdk)(config, props);
return config;
};
const pkg = require("../package.json");
exports.default = (0, config_plugins_1.createRunOncePlugin)(withBraze, pkg.name, pkg.version);