Skip to content

Commit

Permalink
chore(method-annotation): fix annotation for right references
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-tbd committed Oct 10, 2023
1 parent f784271 commit c83a5ef
Showing 1 changed file with 36 additions and 17 deletions.
53 changes: 36 additions & 17 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface User {
/**
* - The number of important notifications that the user has not read.
* - It is displayed as a number on the channel button.
* @see https://developers.channel.io/docs/glossary#channel-button
* @see https://developers.channel.io/docs/web-user-object#alert
*/
alert: number
/** The avatar image URL of a user. */
Expand All @@ -31,43 +31,50 @@ export interface User {
* - Set by updateUser and language of boot option.
* - Following 32 languages supported.
* - 'de'(German), 'hi'(Hindi), 'no'(Norwegian), 'ru'(Russian), 'fi'(Finnish), 'pt'(Portuguese), 'hr'(Croatian), 'fr'(French), 'hu'(Hungarian), 'uk'(Ukrainian), 'sk'(Slovak), 'ca'(Catalan), 'sv'(Swedish), 'ko'(Korean), 'id'(Indonesian), 'ms'(Malay), 'el'(Greek), 'en'(English), 'it'(Italian), 'es'(Spanish), 'he'(Hebrew), 'zh'(Chinese), 'cs'(Czech), 'ar'(Arabic), 'vi'(Vietnamese),'th'(Thai), 'ja'(Japanese), 'pl'(Polish), 'ro'(Romanian), 'da'(Danish), 'nl'(Dutch), 'tr'(Turkish)
* @see https://developers.channel.io/docs/web-user-object#language
*/
language: string;
/**
* - The id used for identifying a member user.
* - If you set memberId in the boot option, the user is regarded as a member user.
* @see https://developers.channel.io/docs/web-user-object#memberid
*/
memberId: string;
/**
* - The name of a user
* - Set by updateUser
* @see https://developers.channel.io/docs/web-user-object#name
*/
name?: string;
/**
* - A user's profile information.
* - Set by updateUser or profile of boot option.
* @see https://developers.channel.io/docs/web-user-object#profile
*/
profile?: Profile | null;
/**
* - The tags of a user.
* - Always lowercase.
* - Set by updateUser, addTags, or removeTags.
* @see https://developers.channel.io/docs/web-user-object#tags
*/
tags?: string[] | null;
/**
* - The number of all unread notifications the user has not read.
* - It includes the number of alert. It is displayed as a red dot on the channel button.
* @see https://developers.channel.io/docs/glossary#channel-button
* @see https://developers.channel.io/docs/web-user-object#unread
*/
unread: number;
/**
* - Whether to unsubscribe the marketing email.
* - Set by updateUser or unsubscribeEmail of boot option.
* @see https://developers.channel.io/docs/web-user-object#unsubscribeemail
*/
unsubscribeEmail: boolean;
/**
* - Whether to unsubscribe the marketing email.
* - Set by updateUser or unsubscribeTexting of boot option.
* @see https://developers.channel.io/docs/web-user-object#unsubscribetexting
*/
unsubscribeTexting: boolean;
}
Expand All @@ -81,6 +88,7 @@ export type Callback = (error: Error | null, user: User | null) => void;
/**
* - A User’s profile information.
* - Set by updateUser or profile of boot option.
* @see https://developers.channel.io/docs/web-user-object#profile
*/
export interface Profile {
[key: string]: string | number | boolean | null;
Expand All @@ -91,6 +99,7 @@ export interface Profile {
* - dark: Use the dark theme.
* - system: Follow the System theme.
* - null: Follow the desk's theme setting.
* @see https://developers.channel.io/docs/web-boot-option#appearance
*/
export type Appearance = 'light' | 'dark' | 'system' | null;

Expand Down Expand Up @@ -153,7 +162,7 @@ export interface BootOption {
/**
* - string The CSS Selector to select custom launcher.
* - Use when you customize default chat button.
* @see https://developers.channel.io/docs/web-customization
* @see https://developers.channel.io/docs/web-boot-option#customlauncherselector
*/
customLauncherSelector?: string;
/**
Expand All @@ -171,36 +180,36 @@ export interface BootOption {
* - Texts differ based on the language.
* - When a user is created newly, the user’s language is set as the language.
* - language doesn’t change the user’s language already created.
* @see https://developers.channel.io/docs/web-boot-option#language
*/
language?: 'en' | 'ko' | 'ja';
/** Set the hashed value of the memberId using HMAC-SHA256. */
memberHash?: string;
/**
* The id of member user.
* @see https://developers.channel.io/docs/glossary#member-user
* @see https://developers.channel.io/docs/web-boot-option#memberid
*/
memberId?: string;
/**
* The plugin key of your channel.
* @see https://developers.channel.io/docs/sdk#get-a-plugin-key
* @see https://developers.channel.io/docs/web-boot-option#pluginkey
*/
pluginKey: string;
/**
* Set the user’s profile.
* @see https://developers.channel.io/docs/web-user-object#profile
* @see https://developers.channel.io/docs/web-boot-option#profile
*/
profile?: Profile;
/**
* - Set whether to track the default event(PageView) or not.
* - The default value is true.
* @see https://developers.channel.io/docs/event
* @see https://developers.channel.io/docs/web-boot-option#trackdefaultevent
*/
trackDefaultEvent?: boolean;
/**
* - Set whether to track the UTM source and referrer or not.
* - The default value is true.
* @see https://support.google.com/analytics/answer/1033863#zippy=%2Cin-this-article
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer
* @see https://developers.channel.io/docs/web-boot-option#trackutmsource
*/
trackUtmSource?: boolean;
/**
Expand All @@ -222,7 +231,7 @@ export interface BootOption {
* - Set the z-index of the elements made by the SDK.
* - Applied at chat button, messenger, and marketing pop-up.
* - The default value is 10000000.
* @see https://developers.channel.io/docs/glossary#messenger
* @see https://developers.channel.io/docs/web-boot-option#zindex
*/
zIndex?: number;
}
Expand Down Expand Up @@ -265,6 +274,7 @@ export function shutdown() {

/**
* Show the messenger.
* @see https://developers.channel.io/docs/web-channelio#showmessenger
* @see https://developers.channel.io/docs/glossary#messenger
*/
export function showMessenger() {
Expand All @@ -281,6 +291,7 @@ export function showMessenger() {

/**
* Hide the messenger.
* @see https://developers.channel.io/docs/web-channelio#hidemessenger
* @see https://developers.channel.io/docs/glossary#messenger
*/
export function hideMessenger() {
Expand All @@ -302,6 +313,7 @@ export function hideMessenger() {
* - If you use openChat outside of the click event handler, it may not work properly in the Safari browser on the mobile device.
* @param {string | number | undefined} chatId
* @param {string | undefined} message - Message to enter in the input
* @see https://developers.channel.io/docs/web-channelio#openchat
*/
export function openChat(chatId?: string | number, message?: string) {
if(isSSR) {
Expand All @@ -324,6 +336,7 @@ export interface EventProperty {
* - It takes a few minutes to a few hours to see the event at the desk.
* @param {string} eventName - The name of the event. Max 30 characters are allowed.
* @param {EventProperty | undefined} eventProperty - The property of the event.
* @see https://developers.channel.io/docs/web-channelio#track
* @see https://developers.channel.io/docs/event
*/
export function track(eventName: string, eventProperty?: EventProperty) {
Expand Down Expand Up @@ -373,12 +386,14 @@ export function onHideMessenger(callback: () => void) {
/**
* @param {number} unread - unread is the number of all unread notifications the user has not read. It includes the number of alert. It is displayed as a red dot on the channel button.
* @param {number} alert - alert is the number of important notifications that the user has not read. It is displayed as a number on the channel button.
* @see https://developers.channel.io/docs/web-channelio#onbadgechanged
* @see https://developers.channel.io/docs/web-customization
*/
export type BadgeChangedCallback = (unread: number, alert: number) => void;
/**
* Register a callback invoked when the count of messages that the user has not yet read.
* @param {BadgeChangedCallback} callback
* @see https://developers.channel.io/docs/web-channelio#onbadgechanged
* @see https://developers.channel.io/docs/glossary#channel-button
* @see https://developers.channel.io/docs/web-customization
*/
Expand Down Expand Up @@ -422,6 +437,7 @@ export type FollowUpChangedCallback = (profile: FollowUpProfile) => void;
/**
* Register a callback invoked when the user changes the user’s profile.
* @param {FollowUpChangedCallback} callback - The callback invoked when the user changes the user’s profile. It receives the profile object as the argument.
* @see https://developers.channel.io/docs/web-channelio#onfollowupchanged
*/
export function onFollowUpChanged(callback: FollowUpChangedCallback) {
if(isSSR) {
Expand All @@ -443,6 +459,7 @@ export type UrlClickedCallback = (url: string) => void;
* - Link button/text in marketing pop-up
* - Link button/text sent by manager in chat
* @param {UrlClickedCallback} callback - The callback invoked when the user clicks a link. It receives the URL of the link as the argument.
* @see https://developers.channel.io/docs/web-channelio#onurlclicked
*/
export function onUrlClicked(callback: UrlClickedCallback) {
if(isSSR) {
Expand All @@ -464,6 +481,7 @@ export function onUrlClicked(callback: UrlClickedCallback) {
* - onChatCreated
* - onFollowUpChanged
* - onUrlClicked
* @see https://developers.channel.io/docs/web-channelio#clearcallbacks
*/
export function clearCallbacks() {
if(isSSR) {
Expand All @@ -477,6 +495,7 @@ export function clearCallbacks() {
window.ChannelIO('clearCallbacks');
}

/** @see https://developers.channel.io/docs/web-channelio#updateuser */
export interface UpdateUserInfo {
/**
* - If language is ‘ko’ or ‘ja’, UI text inside ChannelTalk changes with that language.
Expand Down Expand Up @@ -514,7 +533,7 @@ export interface UpdateUserInfo {
* Update user’s information.
* @param {UpdateUserInfo} userInfo - Object with user’s information.
* @param {Callback} callback - When it fails, the callback passes an error object at the first argument, null at the second argument. When it succeeds, the callback passes null at the first argument, an user object at the second argument.
* @see https://developers.channel.io/docs/web-user-object
* @see https://developers.channel.io/docs/web-channelio#updateuser
*/
export function updateUser(userInfo: UpdateUserInfo, callback?: Callback) {
if(isSSR) {
Expand All @@ -532,7 +551,7 @@ export function updateUser(userInfo: UpdateUserInfo, callback?: Callback) {
* Add a user’s tags.
* @param {string[]} tags - If the same tag exists, only one tag is added. Max 10 tags allowed. Always lowercase.
* @param {Callback} callback - If it fails, the callback passes an error object at the first argument, null at the second argument. If it succeeds, the callback passes null at the first argument, a user object at the second argument.
* @see https://developers.channel.io/docs/web-user-object
* @see https://developers.channel.io/docs/web-channelio#addtags
*/
export function addTags(tags: string[], callback?: Callback) {
if(isSSR) {
Expand All @@ -550,7 +569,7 @@ export function addTags(tags: string[], callback?: Callback) {
* Remove a user’s tags.
* @param {string[]} tags - If the corresponding tag don’t exist, that tag is ignored. null or an empty array([]) not allowed.
* @param {Callback} callback - If fails, the callback passes an error object at the first argument, null at the second argument. If succeeds, the callback passes null at the first argument, a user object at the second argument.
* @see https://developers.channel.io/docs/web-user-object
* @see https://developers.channel.io/docs/web-channelio#removetags
*/
export function removeTags(tags: string[], callback?: Callback) {
if(isSSR) {
Expand All @@ -568,6 +587,7 @@ export function removeTags(tags: string[], callback?: Callback) {
* - Set page.
* - Page can be used instead of canonical URL.
* @param {string} page - The page value to change. Don’t pass null or undefined to page. To reset the page, use resetPage.
* @see https://developers.channel.io/docs/web-channelio#setpage
* @see https://developers.channel.io/docs/page
* @see https://developers.channel.io/docs/canonical-url
*/
Expand All @@ -586,8 +606,7 @@ export function setPage(page: string) {
/**
* - Reset the page value set by setPage.
* - If you use resetPage, the canonical URL is used as the page value.
* @see https://developers.channel.io/docs/page
* @see https://developers.channel.io/docs/canonical-url
* @see https://developers.channel.io/docs/web-channelio#resetpage
*/
export function resetPage() {
if(isSSR) {
Expand All @@ -605,7 +624,7 @@ export function resetPage() {
* - Show the channel button.
* - After boot, channel button shows without showChannelButton.
* - Only when you set hideChannelButtonOnBoot to true or call hideChannelButton, you should manually execute showChannelButton.
* @see https://developers.channel.io/docs/glossary#channel-button
* @see https://developers.channel.io/docs/web-channelio#showchannelbutton
*/
export function showChannelButton() {
if(isSSR) {
Expand All @@ -621,7 +640,7 @@ export function showChannelButton() {

/**
* Hide the channel button.
* @see https://developers.channel.io/docs/glossary#channel-button
* @see https://developers.channel.io/docs/web-channelio#hidechannelbutton
*/
export function hideChannelButton() {
if(isSSR) {
Expand Down

0 comments on commit c83a5ef

Please sign in to comment.