Skip to content

Commit

Permalink
Release 1.8.0 (#57)
Browse files Browse the repository at this point in the history
Co-authored-by: Ivan Kudinov <[email protected]>
  • Loading branch information
ikudinov and Ivan Kudinov authored Jun 10, 2024
1 parent 989a440 commit c3ba614
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 15 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@expressms/smartapp-sdk",
"version": "1.8.0-alpha.2",
"version": "1.8.0",
"description": "Smartapp SDK",
"main": "build/main/index.js",
"typings": "build/main/index.d.ts",
Expand Down Expand Up @@ -38,7 +38,7 @@
"typescript": "^4.9.5"
},
"dependencies": {
"@expressms/smartapp-bridge": "1.3.0-alpha.0"
"@expressms/smartapp-bridge": "1.3.0"
},
"files": [
"build/main",
Expand Down
109 changes: 96 additions & 13 deletions src/types/bridge.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { EmitterEventPayload } from '@expressms/smartapp-bridge/build/main/types/eventEmitter'


export enum METHODS {
READY = 'ready',
ROUTING_CHANGED = 'routing_changes',
Expand Down Expand Up @@ -47,16 +46,100 @@ export enum ERROR_CODES {
SUBSCRIPTION_NOT_FOUND = 'subscription_not_found',
}

export type ReadyEventResponse = ({
ref: string,
status: STATUS.SUCCESS,
payload: {
logsEnabled?: boolean,
isMain?: boolean,
type: string,
openSmartAppMeta?: object,
},
}) | undefined
export interface InitialData {
initiator: string
meta?: object | string
}

export interface InitialDataEmail extends InitialData {
initiator: 'email_link'
meta: string
}

export interface InitialDataProfileAction extends InitialData {
initiator: 'profile_action'
meta: {
action: string
profile: {
user_huid: string
name: string
avatar?: string
avatar_preview?: string
company?: string
company_position?: string
department?: string
office?: string
manager?: string
manager_huid?: string
email?: string
description?: string
other_phone?: string
ip_phone?: string
other_ip_phone?: string
}
}
}

export interface InitialDataPush extends InitialData {
initiator: 'push'
meta?: object
}

export interface InitialDataDeeplink extends InitialData {
initiator: 'deeplink'
meta?: object
}

export type MentionDataType = {
mentionType: 'user' | 'contact' | 'chat' | 'channel' | 'all'
mentionId: string
mentionData: {
connType: 'cts' | 'rts' | 'hybrid'
userHuid?: string
name: string
groupChatId?: string
}
}

export interface InitialDataMenuAction extends InitialData {
initiator: 'menu_action'
meta: {
action: string
sender: {
user_huid: string
name: string
avatar?: string
avatar_preview?: string
company?: string
company_position?: string
email?: string
}
message: {
body: string
timestamp: number
mentions: Array<MentionDataType>
}
}
}

export type ReadyEventResponse =
| {
ref: string
status: STATUS.SUCCESS
payload: {
logsEnabled?: boolean
isMain?: boolean
type: string
openSmartAppMeta?: object
initialData?:
| InitialDataEmail
| InitialDataProfileAction
| InitialDataPush
| InitialDataDeeplink
| InitialDataMenuAction
}
}
| undefined

export interface File {
type: string | null
Expand All @@ -77,6 +160,6 @@ export interface File {
export interface StatusResponse extends EmitterEventPayload {
payload: {
status: STATUS
errorCode?: string | null,
errorCode?: string | null
}
}
}

0 comments on commit c3ba614

Please sign in to comment.