@react-native-kakao/channel 3.0.0 → 3.1.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/RNCKakaoChannel.podspec +0 -1
- package/android/build.gradle +0 -2
- package/android/src/main/java/net/mjstudio/rnkakao/channel/RNCKakaoChannelModule.kt +5 -5
- package/lib/commonjs/index.web.js +34 -28
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/module/index.web.js +35 -27
- package/lib/module/index.web.js.map +1 -1
- package/package.json +5 -5
- package/src/index.web.ts +45 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 3.1.0-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 61c270a: Remove unused React Native module dependencies so Channel, Social, and Share can each be installed with Core alone. Declare Share's Android Talk SDK dependency directly.
|
|
8
|
+
- Updated dependencies [d5c5fb8]
|
|
9
|
+
- Updated dependencies [3027207]
|
|
10
|
+
- Updated dependencies [dfd32ca]
|
|
11
|
+
- Updated dependencies [2b223bf]
|
|
12
|
+
- Updated dependencies [67cd4e2]
|
|
13
|
+
- Updated dependencies [d81f9b7]
|
|
14
|
+
- @react-native-kakao/core@3.1.0-next.1
|
|
15
|
+
|
|
16
|
+
## 3.1.0-next.0
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- 4772981: Use `reactApplicationContext.currentActivity` in the Android modules instead of the bare `currentActivity` getter, so they compile on React Native releases where `ReactContextBaseJavaModule` no longer exposes it to Kotlin subclasses.
|
|
21
|
+
- 71700aa: Align web SDK options, response shapes, timestamps, and session errors with native APIs.
|
|
22
|
+
- Updated dependencies [20c253b]
|
|
23
|
+
- Updated dependencies [3260517]
|
|
24
|
+
- Updated dependencies [71700aa]
|
|
25
|
+
- @react-native-kakao/core@3.1.0-next.0
|
|
26
|
+
|
|
3
27
|
## 3.0.0
|
|
4
28
|
|
|
5
29
|
### Major Changes
|
package/RNCKakaoChannel.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
apply from: file('./../../core/android/package-json.gradle')
|
|
2
2
|
def Versions = project.ext.RNCKakaoSdkVersions
|
|
3
3
|
Project coreProject = project.ext.getWorkspaceProject("core")
|
|
4
|
-
Project userProject = project.ext.getWorkspaceProject("user")
|
|
5
4
|
|
|
6
5
|
project.ext.applyPlugins()
|
|
7
6
|
|
|
@@ -40,6 +39,5 @@ dependencies {
|
|
|
40
39
|
implementation "com.facebook.react:react-android"
|
|
41
40
|
|
|
42
41
|
api coreProject
|
|
43
|
-
api userProject
|
|
44
42
|
implementation "com.kakao.sdk:v2-talk:${Versions.talk}"
|
|
45
43
|
}
|
|
@@ -27,7 +27,7 @@ class RNCKakaoChannelModule internal constructor(
|
|
|
27
27
|
promise: Promise,
|
|
28
28
|
) = onMain {
|
|
29
29
|
val context =
|
|
30
|
-
currentActivity ?: run {
|
|
30
|
+
reactApplicationContext.currentActivity ?: run {
|
|
31
31
|
promise.rejectWith(ActivityNotFoundException())
|
|
32
32
|
return@onMain
|
|
33
33
|
}
|
|
@@ -49,7 +49,7 @@ class RNCKakaoChannelModule internal constructor(
|
|
|
49
49
|
promise: Promise,
|
|
50
50
|
) = onMain {
|
|
51
51
|
val context =
|
|
52
|
-
currentActivity ?: run {
|
|
52
|
+
reactApplicationContext.currentActivity ?: run {
|
|
53
53
|
promise.rejectWith(ActivityNotFoundException())
|
|
54
54
|
return@onMain
|
|
55
55
|
}
|
|
@@ -82,7 +82,7 @@ class RNCKakaoChannelModule internal constructor(
|
|
|
82
82
|
promise: Promise,
|
|
83
83
|
) = onMain {
|
|
84
84
|
val context =
|
|
85
|
-
currentActivity ?: run {
|
|
85
|
+
reactApplicationContext.currentActivity ?: run {
|
|
86
86
|
promise.rejectWith(ActivityNotFoundException())
|
|
87
87
|
return@onMain
|
|
88
88
|
}
|
|
@@ -101,7 +101,7 @@ class RNCKakaoChannelModule internal constructor(
|
|
|
101
101
|
promise: Promise,
|
|
102
102
|
) = onMain {
|
|
103
103
|
val context =
|
|
104
|
-
currentActivity ?: run {
|
|
104
|
+
reactApplicationContext.currentActivity ?: run {
|
|
105
105
|
promise.rejectWith(ActivityNotFoundException())
|
|
106
106
|
return@onMain
|
|
107
107
|
}
|
|
@@ -134,7 +134,7 @@ class RNCKakaoChannelModule internal constructor(
|
|
|
134
134
|
promise: Promise,
|
|
135
135
|
) = onMain {
|
|
136
136
|
val context =
|
|
137
|
-
currentActivity ?: run {
|
|
137
|
+
reactApplicationContext.currentActivity ?: run {
|
|
138
138
|
promise.rejectWith(ActivityNotFoundException())
|
|
139
139
|
return@onMain
|
|
140
140
|
}
|
|
@@ -5,9 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.openChatChannelUrl = exports.openAddChannelUrl = exports.getChatChannelUrl = exports.getAddChannelUrl = exports.followChannel = exports.default = exports.chatChannel = exports.channels = exports.addChannel = void 0;
|
|
7
7
|
var _core = require("@react-native-kakao/core");
|
|
8
|
-
var querystring = _interopRequireWildcard(require("querystring"));
|
|
9
|
-
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); }
|
|
10
|
-
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; }
|
|
11
8
|
const KakaoChannel = {
|
|
12
9
|
followChannel: channelPublicId => (0, _core.kRunWebAPI)(async () => {
|
|
13
10
|
const result = await Kakao.Channel.followChannel({
|
|
@@ -21,35 +18,44 @@ const KakaoChannel = {
|
|
|
21
18
|
addChannel: channelPublicId => (0, _core.kRunWebAPI)(() => Kakao.Channel.addChannel({
|
|
22
19
|
channelPublicId
|
|
23
20
|
})),
|
|
24
|
-
getAddChannelUrl:
|
|
25
|
-
|
|
26
|
-
message: 'Use addChannel directly in web'
|
|
27
|
-
};
|
|
28
|
-
}),
|
|
29
|
-
openAddChannelUrl: () => (0, _core.kRunWebAPI)(() => {
|
|
30
|
-
throw {
|
|
31
|
-
message: 'Use addChannel directly in web'
|
|
32
|
-
};
|
|
33
|
-
}),
|
|
21
|
+
getAddChannelUrl: channelPublicId => (0, _core.kRunWebAPI)(() => getChannelUrl(channelPublicId, 'friend')),
|
|
22
|
+
openAddChannelUrl: channelPublicId => openChannelUrl(channelPublicId, 'friend'),
|
|
34
23
|
chatChannel: channelPublicId => (0, _core.kRunWebAPI)(() => Kakao.Channel.chat({
|
|
35
24
|
channelPublicId
|
|
36
25
|
})),
|
|
37
|
-
getChatChannelUrl:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
26
|
+
getChatChannelUrl: channelPublicId => (0, _core.kRunWebAPI)(() => getChannelUrl(channelPublicId, 'chat')),
|
|
27
|
+
openChatChannelUrl: channelPublicId => openChannelUrl(channelPublicId, 'chat'),
|
|
28
|
+
channels: ({
|
|
29
|
+
channelPublicIds = []
|
|
30
|
+
} = {}) => (0, _core.kRunWebAPI)(async () => {
|
|
31
|
+
const response = await Kakao.API.request({
|
|
32
|
+
url: '/v2/api/talk/channels',
|
|
33
|
+
data: channelPublicIds.length ? {
|
|
34
|
+
channel_ids: channelPublicIds.join(','),
|
|
35
|
+
channel_id_type: 'channel_public_id'
|
|
36
|
+
} : undefined
|
|
37
|
+
});
|
|
38
|
+
return (response.channels ?? []).map(channel => ({
|
|
39
|
+
uuid: channel.channel_uuid,
|
|
40
|
+
encodedId: channel.channel_public_id,
|
|
41
|
+
relation: channel.relation.toLowerCase(),
|
|
42
|
+
updatedAt: channel.updated_at ? Date.parse(channel.updated_at) / 1000 : undefined
|
|
43
|
+
}));
|
|
44
|
+
})
|
|
52
45
|
};
|
|
46
|
+
function getChannelUrl(channelPublicId, action) {
|
|
47
|
+
(0, _core.kAssert)(channelPublicId, 'channelPublicId is missing');
|
|
48
|
+
return `https://pf.kakao.com/${encodeURIComponent(channelPublicId)}/${action}`;
|
|
49
|
+
}
|
|
50
|
+
function openChannelUrl(channelPublicId, action) {
|
|
51
|
+
return (0, _core.kRunWebAPI)(() => {
|
|
52
|
+
const url = getChannelUrl(channelPublicId, action);
|
|
53
|
+
const popup = window.open(url, '_blank');
|
|
54
|
+
(0, _core.kAssert)(!!popup, 'The channel popup was blocked by the browser');
|
|
55
|
+
popup.opener = null;
|
|
56
|
+
return url;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
53
59
|
const {
|
|
54
60
|
addChannel,
|
|
55
61
|
followChannel,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_core","require","
|
|
1
|
+
{"version":3,"names":["_core","require","KakaoChannel","followChannel","channelPublicId","kRunWebAPI","result","Kakao","Channel","channel_public_id","status","addChannel","getAddChannelUrl","getChannelUrl","openAddChannelUrl","openChannelUrl","chatChannel","chat","getChatChannelUrl","openChatChannelUrl","channels","channelPublicIds","response","API","request","url","data","length","channel_ids","join","channel_id_type","undefined","map","channel","uuid","channel_uuid","encodedId","relation","toLowerCase","updatedAt","updated_at","Date","parse","action","kAssert","encodeURIComponent","popup","window","open","opener","exports","_default","default"],"sourceRoot":"../../src","sources":["index.web.ts"],"mappings":";;;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AACF,CAAC,GAAGjB,YAAY;AAACgD,OAAA,CAAA/B,kBAAA,GAAAA,kBAAA;AAAA+B,OAAA,CAAApC,iBAAA,GAAAA,iBAAA;AAAAoC,OAAA,CAAAhC,iBAAA,GAAAA,iBAAA;AAAAgC,OAAA,CAAAtC,gBAAA,GAAAA,gBAAA;AAAAsC,OAAA,CAAAlC,WAAA,GAAAA,WAAA;AAAAkC,OAAA,CAAA9B,QAAA,GAAAA,QAAA;AAAA8B,OAAA,CAAA/C,aAAA,GAAAA,aAAA;AAAA+C,OAAA,CAAAvC,UAAA,GAAAA,UAAA;AAAA,IAAAwC,QAAA,GAAAD,OAAA,CAAAE,OAAA,GACFlD,YAAY","ignoreList":[]}
|
package/lib/module/index.web.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { kRunWebAPI } from '@react-native-kakao/core';
|
|
4
|
-
import * as querystring from 'querystring';
|
|
3
|
+
import { kAssert, kRunWebAPI } from '@react-native-kakao/core';
|
|
5
4
|
const KakaoChannel = {
|
|
6
5
|
followChannel: channelPublicId => kRunWebAPI(async () => {
|
|
7
6
|
const result = await Kakao.Channel.followChannel({
|
|
@@ -15,35 +14,44 @@ const KakaoChannel = {
|
|
|
15
14
|
addChannel: channelPublicId => kRunWebAPI(() => Kakao.Channel.addChannel({
|
|
16
15
|
channelPublicId
|
|
17
16
|
})),
|
|
18
|
-
getAddChannelUrl:
|
|
19
|
-
|
|
20
|
-
message: 'Use addChannel directly in web'
|
|
21
|
-
};
|
|
22
|
-
}),
|
|
23
|
-
openAddChannelUrl: () => kRunWebAPI(() => {
|
|
24
|
-
throw {
|
|
25
|
-
message: 'Use addChannel directly in web'
|
|
26
|
-
};
|
|
27
|
-
}),
|
|
17
|
+
getAddChannelUrl: channelPublicId => kRunWebAPI(() => getChannelUrl(channelPublicId, 'friend')),
|
|
18
|
+
openAddChannelUrl: channelPublicId => openChannelUrl(channelPublicId, 'friend'),
|
|
28
19
|
chatChannel: channelPublicId => kRunWebAPI(() => Kakao.Channel.chat({
|
|
29
20
|
channelPublicId
|
|
30
21
|
})),
|
|
31
|
-
getChatChannelUrl:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
22
|
+
getChatChannelUrl: channelPublicId => kRunWebAPI(() => getChannelUrl(channelPublicId, 'chat')),
|
|
23
|
+
openChatChannelUrl: channelPublicId => openChannelUrl(channelPublicId, 'chat'),
|
|
24
|
+
channels: ({
|
|
25
|
+
channelPublicIds = []
|
|
26
|
+
} = {}) => kRunWebAPI(async () => {
|
|
27
|
+
const response = await Kakao.API.request({
|
|
28
|
+
url: '/v2/api/talk/channels',
|
|
29
|
+
data: channelPublicIds.length ? {
|
|
30
|
+
channel_ids: channelPublicIds.join(','),
|
|
31
|
+
channel_id_type: 'channel_public_id'
|
|
32
|
+
} : undefined
|
|
33
|
+
});
|
|
34
|
+
return (response.channels ?? []).map(channel => ({
|
|
35
|
+
uuid: channel.channel_uuid,
|
|
36
|
+
encodedId: channel.channel_public_id,
|
|
37
|
+
relation: channel.relation.toLowerCase(),
|
|
38
|
+
updatedAt: channel.updated_at ? Date.parse(channel.updated_at) / 1000 : undefined
|
|
39
|
+
}));
|
|
40
|
+
})
|
|
46
41
|
};
|
|
42
|
+
function getChannelUrl(channelPublicId, action) {
|
|
43
|
+
kAssert(channelPublicId, 'channelPublicId is missing');
|
|
44
|
+
return `https://pf.kakao.com/${encodeURIComponent(channelPublicId)}/${action}`;
|
|
45
|
+
}
|
|
46
|
+
function openChannelUrl(channelPublicId, action) {
|
|
47
|
+
return kRunWebAPI(() => {
|
|
48
|
+
const url = getChannelUrl(channelPublicId, action);
|
|
49
|
+
const popup = window.open(url, '_blank');
|
|
50
|
+
kAssert(!!popup, 'The channel popup was blocked by the browser');
|
|
51
|
+
popup.opener = null;
|
|
52
|
+
return url;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
47
55
|
export const {
|
|
48
56
|
addChannel,
|
|
49
57
|
followChannel,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["kAssert","kRunWebAPI","KakaoChannel","followChannel","channelPublicId","result","Kakao","Channel","channel_public_id","status","addChannel","getAddChannelUrl","getChannelUrl","openAddChannelUrl","openChannelUrl","chatChannel","chat","getChatChannelUrl","openChatChannelUrl","channels","channelPublicIds","response","API","request","url","data","length","channel_ids","join","channel_id_type","undefined","map","channel","uuid","channel_uuid","encodedId","relation","toLowerCase","updatedAt","updated_at","Date","parse","action","encodeURIComponent","popup","window","open","opener"],"sourceRoot":"../../src","sources":["index.web.ts"],"mappings":";;AAAA,SAASA,OAAO,EAAEC,UAAU,QAAQ,0BAA0B;AAe9D,MAAMC,YAA6B,GAAG;EACpCC,aAAa,EAAGC,eAAuB,IACrCH,UAAU,CAAC,YAAY;IACrB,MAAMI,MAAM,GAAG,MAAMC,KAAK,CAACC,OAAO,CAACJ,aAAa,CAAC;MAAEC;IAAgB,CAAC,CAAC;IAErE,IAAIC,MAAM,IAAID,eAAe,KAAKC,MAAM,CAACG,iBAAiB,IAAIH,MAAM,CAACI,MAAM,KAAK,SAAS,EAAE;MACzF,OAAO,IAAI;IACb;IAEA,OAAO,KAAK;EACd,CAAC,CAAC;EACJC,UAAU,EAAGN,eAAuB,IAClCH,UAAU,CAAC,MAAMK,KAAK,CAACC,OAAO,CAACG,UAAU,CAAC;IAAEN;EAAgB,CAAC,CAAC,CAAC;EACjEO,gBAAgB,EAAGP,eAAe,IAAKH,UAAU,CAAC,MAAMW,aAAa,CAACR,eAAe,EAAE,QAAQ,CAAC,CAAC;EACjGS,iBAAiB,EAAGT,eAAe,IAAKU,cAAc,CAACV,eAAe,EAAE,QAAQ,CAAC;EACjFW,WAAW,EAAGX,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AAcA,CAACV,eAAuB,EAAEsC,MAAyB,EAAE;EAC1E,OAAOzC,UAAU,CAAC,MAAM;IACtB,MAAMuB,GAAG,GAAGZ,aAAa,CAACR,eAAe,EAAEsC,MAAM,CAAC;IAClD,MAAME,KAAK,GAAGC,MAAM,CAACC,IAAI,CAACtB,GAAG,EAAE,QAAQ,CAAC;IACxCxB,OAAO,CAAC,CAAC,CAAC4C,KAAK,EAAE,8CAA8C,CAAC;IAChEA,KAAK,CAAEG,MAAM,GAAG,IAAI;IAEpB,OAAOvB,GAAG;EACZ,CAAC,CAAC;AACJ;AAEA,OAAO,MAAM;EACXd,UAAU;EACVP,aAAa;EACbgB,QAAQ;EACRJ,WAAW;EACXJ,gBAAgB;EAChBM,iBAAiB;EACjBJ,iBAAiB;EACjBK;AACF,CAAC,GAAGhB,YAAY;AAChB,eAAeA,YAAY","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-kakao/channel",
|
|
3
3
|
"description": "React Native Kakao Channel SDK",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.1.0-next.1",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
7
7
|
"types": "lib/typescript/src/index.d.ts",
|
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@react-native-kakao/core": "3.0.
|
|
60
|
+
"@react-native-kakao/core": "3.1.0-next.1",
|
|
61
61
|
"@types/invariant": "^2",
|
|
62
62
|
"@types/react": "~19.2.2",
|
|
63
63
|
"del-cli": "^5.1.0",
|
|
64
|
-
"react": "19.
|
|
65
|
-
"react-native": "0.
|
|
64
|
+
"react": "19.3.0",
|
|
65
|
+
"react-native": "0.88.0",
|
|
66
66
|
"react-native-builder-bob": "0.40.7",
|
|
67
67
|
"typescript": "~6.0.3"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@react-native-kakao/core": "3.0.
|
|
70
|
+
"@react-native-kakao/core": "3.1.0-next.1",
|
|
71
71
|
"react": "*",
|
|
72
72
|
"react-native": ">=0.76.0"
|
|
73
73
|
},
|
package/src/index.web.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { kRunWebAPI } from '@react-native-kakao/core';
|
|
2
|
-
import * as querystring from 'querystring';
|
|
1
|
+
import { kAssert, kRunWebAPI } from '@react-native-kakao/core';
|
|
3
2
|
|
|
4
|
-
import type { KakaoChannelAPI } from './index';
|
|
3
|
+
import type { KakaoChannel as KakaoChannelInfo, KakaoChannelAPI } from './index';
|
|
5
4
|
|
|
6
5
|
declare const Kakao: {
|
|
7
6
|
Channel: {
|
|
@@ -27,32 +26,54 @@ const KakaoChannel: KakaoChannelAPI = {
|
|
|
27
26
|
}),
|
|
28
27
|
addChannel: (channelPublicId: string): Promise<void> =>
|
|
29
28
|
kRunWebAPI(() => Kakao.Channel.addChannel({ channelPublicId })),
|
|
30
|
-
getAddChannelUrl: ()
|
|
31
|
-
|
|
32
|
-
throw { message: 'Use addChannel directly in web' };
|
|
33
|
-
}),
|
|
34
|
-
openAddChannelUrl: (): Promise<string> =>
|
|
35
|
-
kRunWebAPI(() => {
|
|
36
|
-
throw { message: 'Use addChannel directly in web' };
|
|
37
|
-
}),
|
|
29
|
+
getAddChannelUrl: (channelPublicId) => kRunWebAPI(() => getChannelUrl(channelPublicId, 'friend')),
|
|
30
|
+
openAddChannelUrl: (channelPublicId) => openChannelUrl(channelPublicId, 'friend'),
|
|
38
31
|
chatChannel: (channelPublicId: string): Promise<void> =>
|
|
39
32
|
kRunWebAPI(() => Kakao.Channel.chat({ channelPublicId })),
|
|
40
|
-
getChatChannelUrl: ()
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
getChatChannelUrl: (channelPublicId) => kRunWebAPI(() => getChannelUrl(channelPublicId, 'chat')),
|
|
34
|
+
openChatChannelUrl: (channelPublicId) => openChannelUrl(channelPublicId, 'chat'),
|
|
35
|
+
channels: ({ channelPublicIds = [] } = {}) =>
|
|
36
|
+
kRunWebAPI(async () => {
|
|
37
|
+
const response: {
|
|
38
|
+
channels?: {
|
|
39
|
+
channel_uuid: string;
|
|
40
|
+
channel_public_id: string;
|
|
41
|
+
relation: string;
|
|
42
|
+
updated_at?: string;
|
|
43
|
+
}[];
|
|
44
|
+
} = await Kakao.API.request({
|
|
45
|
+
url: '/v2/api/talk/channels',
|
|
46
|
+
data: channelPublicIds.length
|
|
47
|
+
? { channel_ids: channelPublicIds.join(','), channel_id_type: 'channel_public_id' }
|
|
48
|
+
: undefined,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return (response.channels ?? []).map((channel) => ({
|
|
52
|
+
uuid: channel.channel_uuid,
|
|
53
|
+
encodedId: channel.channel_public_id,
|
|
54
|
+
relation: channel.relation.toLowerCase() as KakaoChannelInfo['relation'],
|
|
55
|
+
updatedAt: channel.updated_at ? Date.parse(channel.updated_at) / 1000 : undefined,
|
|
56
|
+
}));
|
|
47
57
|
}),
|
|
48
|
-
channels: (params) =>
|
|
49
|
-
kRunWebAPI(() =>
|
|
50
|
-
Kakao.API.request({
|
|
51
|
-
url: `/v1/api/talk/channels${params?.channelPublicIds ? `?${querystring.stringify({ channel_ids: params.channelPublicIds })}` : ''}`,
|
|
52
|
-
}),
|
|
53
|
-
),
|
|
54
58
|
};
|
|
55
59
|
|
|
60
|
+
function getChannelUrl(channelPublicId: string, action: 'friend' | 'chat') {
|
|
61
|
+
kAssert(channelPublicId, 'channelPublicId is missing');
|
|
62
|
+
|
|
63
|
+
return `https://pf.kakao.com/${encodeURIComponent(channelPublicId)}/${action}`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function openChannelUrl(channelPublicId: string, action: 'friend' | 'chat') {
|
|
67
|
+
return kRunWebAPI(() => {
|
|
68
|
+
const url = getChannelUrl(channelPublicId, action);
|
|
69
|
+
const popup = window.open(url, '_blank');
|
|
70
|
+
kAssert(!!popup, 'The channel popup was blocked by the browser');
|
|
71
|
+
popup!.opener = null;
|
|
72
|
+
|
|
73
|
+
return url;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
56
77
|
export const {
|
|
57
78
|
addChannel,
|
|
58
79
|
followChannel,
|