react-native-crisp-chat-sdk
Version:
React-Native bridge for Crisp chat iOS and Android SDK's
84 lines (83 loc) • 4.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.show = exports.setUserPhone = exports.setUserNickname = exports.setUserEmail = exports.setUserAvatar = exports.setTokenId = exports.setSessionString = exports.setSessionSegment = exports.setSessionInt = exports.setSessionBool = exports.resetSession = exports.pushSessionEvent = exports.default = exports.configure = exports.CrispSessionEventColors = void 0;
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
let CrispSessionEventColors = exports.CrispSessionEventColors = /*#__PURE__*/function (CrispSessionEventColors) {
CrispSessionEventColors[CrispSessionEventColors["RED"] = 0] = "RED";
CrispSessionEventColors[CrispSessionEventColors["ORANGE"] = 1] = "ORANGE";
CrispSessionEventColors[CrispSessionEventColors["YELLOW"] = 2] = "YELLOW";
CrispSessionEventColors[CrispSessionEventColors["GREEN"] = 3] = "GREEN";
CrispSessionEventColors[CrispSessionEventColors["BLUE"] = 4] = "BLUE";
CrispSessionEventColors[CrispSessionEventColors["PURPLE"] = 5] = "PURPLE";
CrispSessionEventColors[CrispSessionEventColors["PINK"] = 6] = "PINK";
CrispSessionEventColors[CrispSessionEventColors["BROWN"] = 7] = "BROWN";
CrispSessionEventColors[CrispSessionEventColors["GREY"] = 8] = "GREY";
CrispSessionEventColors[CrispSessionEventColors["BLACK"] = 9] = "BLACK";
return CrispSessionEventColors;
}({});
const CrispChatSdk = _reactNative.NativeModules.CrispChatSdk;
const CrispChat = () => {
React.useEffect(() => {
CrispChatSdk.show();
}, []);
return /*#__PURE__*/React.createElement(_reactNative.View, null);
};
var _default = exports.default = CrispChat;
const configure = websiteId => {
CrispChatSdk.configure(String(websiteId));
};
exports.configure = configure;
const setTokenId = id => {
CrispChatSdk.setTokenId(String(id));
};
exports.setTokenId = setTokenId;
const setUserEmail = email => {
CrispChatSdk.setUserEmail(String(email));
};
exports.setUserEmail = setUserEmail;
const setUserNickname = name => {
CrispChatSdk.setUserNickname(String(name));
};
exports.setUserNickname = setUserNickname;
const setUserPhone = phone => {
CrispChatSdk.setUserPhone(String(phone));
};
exports.setUserPhone = setUserPhone;
const setUserAvatar = url => {
CrispChatSdk.setUserAvatar(String(url));
};
exports.setUserAvatar = setUserAvatar;
const setSessionSegment = segment => {
CrispChatSdk.setSessionSegment(String(segment));
};
exports.setSessionSegment = setSessionSegment;
const setSessionString = (key, value) => {
CrispChatSdk.setSessionString(String(key), String(value));
};
exports.setSessionString = setSessionString;
const setSessionBool = (key, value) => {
CrispChatSdk.setSessionBool(String(key), Boolean(value));
};
exports.setSessionBool = setSessionBool;
const setSessionInt = (key, value) => {
CrispChatSdk.setSessionInt(String(key), Number(value));
};
exports.setSessionInt = setSessionInt;
const pushSessionEvent = (name, color) => {
CrispChatSdk.pushSessionEvent(String(name), color);
};
exports.pushSessionEvent = pushSessionEvent;
const resetSession = () => {
CrispChatSdk.resetSession();
};
exports.resetSession = resetSession;
const show = () => {
CrispChatSdk.show();
};
exports.show = show;
//# sourceMappingURL=index.js.map