@embrace-io/react-native
Version:
A React Native wrapper for the Embrace SDK
58 lines (57 loc) • 1.69 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.packageJSON = exports.apiToken = exports.androidAppID = exports.iosAppID = void 0;
const asker_1 = require("../util/asker");
var Platform;
(function (Platform) {
Platform["Android"] = "Android";
Platform["IOS"] = "iOS";
})(Platform || (Platform = {}));
const appIDQuestion = (platform) => ({
name: `emb${platform}AppID`,
message: `What is your ${platform} Embrace App ID? (5-character value)`,
});
const apiTokenQuestion = () => ({
name: "embAPIToken",
message: "What is your Embrace API token? (32-digit hex number)",
});
const asker = new asker_1.default();
exports.iosAppID = {
name: "iOS App ID",
fetch: () => {
const question = appIDQuestion(Platform.IOS);
return asker
.ask(question)
.then((answers) => answers[question.name]);
},
};
exports.androidAppID = {
name: "Android App ID",
fetch: () => {
const question = appIDQuestion(Platform.Android);
return asker
.ask(question)
.then((answers) => answers[question.name]);
},
};
exports.apiToken = {
name: "API Token",
fetch: () => {
const question = apiTokenQuestion();
return asker
.ask(question)
.then((answers) => answers[question.name]);
},
};
exports.packageJSON = {
name: "app name",
fetch: () => {
try {
const packageJson = require("../../../../../../package.json");
return Promise.resolve(packageJson);
}
catch (_a) {
return Promise.reject("could not find package.json file");
}
},
};