@react-native-kakao/channel
Version:
React Native Kakao Channel SDK
72 lines (71 loc) • 3.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.openChatChannelUrl = exports.openAddChannelUrl = exports.getChatChannelUrl = exports.getAddChannelUrl = exports.followChannel = exports.default = exports.chatChannel = exports.channels = exports.addChannel = void 0;
var _core = require("@react-native-kakao/core");
var querystring = _interopRequireWildcard(require("querystring"));
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 && {}.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; }
const KakaoChannel = {
followChannel: channelPublicId => (0, _core.kRunWebAPI)(async () => {
const result = await Kakao.Channel.followChannel({
channelPublicId
});
if (result && channelPublicId === result.channel_public_id && result.status === 'success') {
return true;
}
return false;
}),
addChannel: channelPublicId => (0, _core.kRunWebAPI)(() => Kakao.Channel.addChannel({
channelPublicId
})),
getAddChannelUrl: () => (0, _core.kRunWebAPI)(() => {
throw {
message: 'Use addChannel directly in web'
};
}),
openAddChannelUrl: () => (0, _core.kRunWebAPI)(() => {
throw {
message: 'Use addChannel directly in web'
};
}),
chatChannel: channelPublicId => (0, _core.kRunWebAPI)(() => Kakao.Channel.chat({
channelPublicId
})),
getChatChannelUrl: () => (0, _core.kRunWebAPI)(() => {
throw {
message: 'Use chatChannel directly in web'
};
}),
openChatChannelUrl: () => (0, _core.kRunWebAPI)(() => {
throw {
message: 'Use chatChannel directly in web'
};
}),
channels: params => (0, _core.kRunWebAPI)(() => Kakao.API.request({
url: `/v1/api/talk/channels${params !== null && params !== void 0 && params.channelPublicIds ? `?${querystring.stringify({
channel_ids: params.channelPublicIds
})}` : ''}`
}))
};
const {
addChannel,
followChannel,
channels,
chatChannel,
getAddChannelUrl,
getChatChannelUrl,
openAddChannelUrl,
openChatChannelUrl
} = KakaoChannel;
exports.openChatChannelUrl = openChatChannelUrl;
exports.openAddChannelUrl = openAddChannelUrl;
exports.getChatChannelUrl = getChatChannelUrl;
exports.getAddChannelUrl = getAddChannelUrl;
exports.chatChannel = chatChannel;
exports.channels = channels;
exports.followChannel = followChannel;
exports.addChannel = addChannel;
var _default = exports.default = KakaoChannel;
//# sourceMappingURL=index.web.js.map