diff --git a/README.md b/README.md index 3dcb51c..fecf5de 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,10 @@ GliaWidgets SDK is a simple and customisable framework built on top of GliaSDK. ## Installation -To install this package use: +To install version 1.0.0 of this package use: ```text -npm install git+https://github.com/salemove/widgets_sdk_ionic.git +npm install github:salemove/widgets_sdk_ionic#1.0.0 ``` # How to use GliaSDK in Ionic environment diff --git a/dist/docs.json b/dist/docs.json new file mode 100644 index 0000000..b11c593 --- /dev/null +++ b/dist/docs.json @@ -0,0 +1,283 @@ +{ + "api": { + "name": "GliaSdkPlugin", + "slug": "gliasdkplugin", + "docs": "", + "tags": [], + "methods": [ + { + "name": "configure", + "signature": "(options: { siteId: string; apiKey: ApiKey; region: Region; companyName: string; overrideLocale?: string; }) => Promise", + "parameters": [ + { + "name": "options", + "docs": "", + "type": "{ siteId: string; apiKey: ApiKey; region: Region; companyName: string; overrideLocale?: string | undefined; }" + } + ], + "returns": "Promise", + "tags": [], + "docs": "configures GliaWidgets SDK with credentials.\n\nNB! To make plugin work properly, use `create-visitor` credentials for Site APIKey only.", + "complexTypes": [ + "ApiKey", + "Region" + ], + "slug": "configure" + }, + { + "name": "startChat", + "signature": "(options: { queueIds?: string[]; }) => Promise", + "parameters": [ + { + "name": "options", + "docs": "", + "type": "{ queueIds?: string[] | undefined; }" + } + ], + "returns": "Promise", + "tags": [], + "docs": "Starts a new chat/text engagement with queue identifiers. If `queueIds` is null or empty, creates engagement for default queue.", + "complexTypes": [], + "slug": "startchat" + }, + { + "name": "startAudio", + "signature": "(options: { queueIds?: string[]; }) => Promise", + "parameters": [ + { + "name": "options", + "docs": "", + "type": "{ queueIds?: string[] | undefined; }" + } + ], + "returns": "Promise", + "tags": [], + "docs": "Starts a new audio engagement with queue identifiers. If `queueIds` is null or empty, creates engagement for default queue.", + "complexTypes": [], + "slug": "startaudio" + }, + { + "name": "startVideo", + "signature": "(options: { queueIds?: string[]; }) => Promise", + "parameters": [ + { + "name": "options", + "docs": "", + "type": "{ queueIds?: string[] | undefined; }" + } + ], + "returns": "Promise", + "tags": [], + "docs": "Starts a new video engagement for queue identifiers. If `queueIds` is null or empty, creates engagement for default queue.", + "complexTypes": [], + "slug": "startvideo" + }, + { + "name": "startSecureConversation", + "signature": "(options: { startScreen: SecureConversationStartScreen; }) => Promise", + "parameters": [ + { + "name": "options", + "docs": "", + "type": "{ startScreen: SecureConversationStartScreen; }" + } + ], + "returns": "Promise", + "tags": [], + "docs": "Starts Secure Conversation flow with passed `start screen`.\nSecure Conversation requires authentication/IdToken.", + "complexTypes": [ + "SecureConversationStartScreen" + ], + "slug": "startsecureconversation" + }, + { + "name": "clearVisitorSession", + "signature": "() => Promise", + "parameters": [], + "returns": "Promise", + "tags": [], + "docs": "Recreates currently used visitor in SDK.", + "complexTypes": [], + "slug": "clearvisitorsession" + }, + { + "name": "listQueues", + "signature": "() => Promise", + "parameters": [], + "returns": "Promise", + "tags": [], + "docs": "Fetches all queues with its info for current site.", + "complexTypes": [], + "slug": "listqueues" + }, + { + "name": "showVisitorCodeViewController", + "signature": "() => Promise", + "parameters": [], + "returns": "Promise", + "tags": [], + "docs": "Presents GliaWidgets UI with visitor code for sharing with operator to start an engagement.", + "complexTypes": [], + "slug": "showvisitorcodeviewcontroller" + }, + { + "name": "authenticate", + "signature": "(options: { behavior: AuthenticationBehavior; idToken: string; accessToken?: string; }) => Promise", + "parameters": [ + { + "name": "options", + "docs": "- Provides options for authentication such as behavior, idToken, and accessToken.", + "type": "{ behavior: AuthenticationBehavior; idToken: string; accessToken?: string | undefined; }" + } + ], + "returns": "Promise", + "tags": [ + { + "name": "param", + "text": "options - Provides options for authentication such as behavior, idToken, and accessToken." + } + ], + "docs": "Authenticates visitor.", + "complexTypes": [ + "AuthenticationBehavior" + ], + "slug": "authenticate" + }, + { + "name": "deauthenticate", + "signature": "() => Promise", + "parameters": [], + "returns": "Promise", + "tags": [], + "docs": "Deauthenticates visitor. Be aware that deauthentication process relies on `AuthenticationBehavior`", + "complexTypes": [], + "slug": "deauthenticate" + }, + { + "name": "isAuthenticated", + "signature": "() => Promise", + "parameters": [], + "returns": "Promise", + "tags": [], + "docs": "Provides current authentication state", + "complexTypes": [], + "slug": "isauthenticated" + }, + { + "name": "refreshAuthentication", + "signature": "(options: { idToken: string; accessToken?: string; }) => Promise", + "parameters": [ + { + "name": "options", + "docs": "", + "type": "{ idToken: string; accessToken?: string | undefined; }" + } + ], + "returns": "Promise", + "tags": [], + "docs": "Refreshes authentication access properties.", + "complexTypes": [], + "slug": "refreshauthentication" + }, + { + "name": "pauseLiveObservation", + "signature": "() => Promise", + "parameters": [], + "returns": "Promise", + "tags": [], + "docs": "Makes a pause for ongoing LiveObservation session.", + "complexTypes": [], + "slug": "pauseliveobservation" + }, + { + "name": "resumeLiveObservation", + "signature": "() => Promise", + "parameters": [], + "returns": "Promise", + "tags": [], + "docs": "Resumes ongoing LiveObservation session.", + "complexTypes": [], + "slug": "resumeliveobservation" + } + ], + "properties": [] + }, + "interfaces": [ + { + "name": "ApiKey", + "slug": "apikey", + "docs": "", + "tags": [], + "methods": [], + "properties": [ + { + "name": "id", + "tags": [], + "docs": "", + "complexTypes": [], + "type": "string" + }, + { + "name": "secret", + "tags": [], + "docs": "", + "complexTypes": [], + "type": "string" + } + ] + } + ], + "enums": [], + "typeAliases": [ + { + "name": "Region", + "slug": "region", + "docs": "Site's region.", + "types": [ + { + "text": "'us'", + "complexTypes": [] + }, + { + "text": "'eu'", + "complexTypes": [] + }, + { + "text": "'beta'", + "complexTypes": [] + } + ] + }, + { + "name": "SecureConversationStartScreen", + "slug": "secureconversationstartscreen", + "docs": "Start screen for Secure Conversation flow.", + "types": [ + { + "text": "'welcome'", + "complexTypes": [] + }, + { + "text": "'chatTranscript'", + "complexTypes": [] + } + ] + }, + { + "name": "AuthenticationBehavior", + "slug": "authenticationbehavior", + "docs": "Authentication (IdToken) behavior.\nforbiddenDuringEngagement - Prevent creation a new engagement if ongoing engagement exists. Default behavior.\nallowedDuringEngagement - Allows creation a new engagement if ongoing engagement exists. During this behavior original engagement will be ended and a new engagement engagement will be restarted with the same operator after authentication is succeded.", + "types": [ + { + "text": "'forbiddenDuringEngagement'", + "complexTypes": [] + }, + { + "text": "'allowedDuringEngagement'", + "complexTypes": [] + } + ] + } + ], + "pluginConfigs": [] +} \ No newline at end of file diff --git a/dist/esm/definitions.d.ts b/dist/esm/definitions.d.ts new file mode 100644 index 0000000..f44ef9b --- /dev/null +++ b/dist/esm/definitions.d.ts @@ -0,0 +1,101 @@ +export interface ApiKey { + id: string; + secret: string; +} +/** + * Site's region. + */ +export declare type Region = 'us' | 'eu' | 'beta'; +/** + * Authentication (IdToken) behavior. + * forbiddenDuringEngagement - Prevent creation a new engagement if ongoing engagement exists. Default behavior. + * allowedDuringEngagement - Allows creation a new engagement if ongoing engagement exists. During this behavior original engagement will be ended and a new engagement engagement will be restarted with the same operator after authentication is succeded. + */ +export declare type AuthenticationBehavior = 'forbiddenDuringEngagement' | 'allowedDuringEngagement'; +/** + * Start screen for Secure Conversation flow. + */ +export declare type SecureConversationStartScreen = 'welcome' | 'chatTranscript'; +export interface GliaSdkPlugin { + /** + * configures GliaWidgets SDK with credentials. + * + * NB! To make plugin work properly, use `create-visitor` credentials for Site APIKey only. + */ + configure(options: { + siteId: string; + apiKey: ApiKey; + region: Region; + companyName: string; + overrideLocale?: string; + }): Promise; + /** + * Starts a new chat/text engagement with queue identifiers. If `queueIds` is null or empty, creates engagement for default queue. + */ + startChat(options: { + queueIds?: string[]; + }): Promise; + /** + * Starts a new audio engagement with queue identifiers. If `queueIds` is null or empty, creates engagement for default queue. + */ + startAudio(options: { + queueIds?: string[]; + }): Promise; + /** + * Starts a new video engagement for queue identifiers. If `queueIds` is null or empty, creates engagement for default queue. + */ + startVideo(options: { + queueIds?: string[]; + }): Promise; + /** + * Starts Secure Conversation flow with passed `start screen`. + * Secure Conversation requires authentication/IdToken. + */ + startSecureConversation(options: { + startScreen: SecureConversationStartScreen; + }): Promise; + /** + * Recreates currently used visitor in SDK. + */ + clearVisitorSession(): Promise; + /** + * Fetches all queues with its info for current site. + */ + listQueues(): Promise; + /** + * Presents GliaWidgets UI with visitor code for sharing with operator to start an engagement. + */ + showVisitorCodeViewController(): Promise; + /** + * Authenticates visitor. + * @param options - Provides options for authentication such as behavior, idToken, and accessToken. + */ + authenticate(options: { + behavior: AuthenticationBehavior; + idToken: string; + accessToken?: string; + }): Promise; + /** + * Deauthenticates visitor. Be aware that deauthentication process relies on `AuthenticationBehavior` + */ + deauthenticate(): Promise; + /** + * Provides current authentication state + */ + isAuthenticated(): Promise; + /** + * Refreshes authentication access properties. + */ + refreshAuthentication(options: { + idToken: string; + accessToken?: string; + }): Promise; + /** + * Makes a pause for ongoing LiveObservation session. + */ + pauseLiveObservation(): Promise; + /** + * Resumes ongoing LiveObservation session. + */ + resumeLiveObservation(): Promise; +} diff --git a/dist/esm/definitions.js b/dist/esm/definitions.js new file mode 100644 index 0000000..497acb5 --- /dev/null +++ b/dist/esm/definitions.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=definitions.js.map \ No newline at end of file diff --git a/dist/esm/definitions.js.map b/dist/esm/definitions.js.map new file mode 100644 index 0000000..5fd9e10 --- /dev/null +++ b/dist/esm/definitions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface ApiKey {\n id: string;\n secret: string;\n}\n\n/**\n * Site's region.\n */\nexport type Region = 'us' | 'eu' | 'beta';\n\n/**\n * Authentication (IdToken) behavior.\n * forbiddenDuringEngagement - Prevent creation a new engagement if ongoing engagement exists. Default behavior.\n * allowedDuringEngagement - Allows creation a new engagement if ongoing engagement exists. During this behavior original engagement will be ended and a new engagement engagement will be restarted with the same operator after authentication is succeded.\n */\nexport type AuthenticationBehavior = 'forbiddenDuringEngagement' | 'allowedDuringEngagement';\n\n/**\n * Start screen for Secure Conversation flow.\n */\nexport type SecureConversationStartScreen = 'welcome' | 'chatTranscript';\nexport interface GliaSdkPlugin {\n /**\n * configures GliaWidgets SDK with credentials.\n *\n * NB! To make plugin work properly, use `create-visitor` credentials for Site APIKey only.\n */\n configure(options: {\n siteId: string;\n apiKey: ApiKey;\n region: Region;\n companyName: string;\n overrideLocale?: string;\n }): Promise;\n\n /**\n * Starts a new chat/text engagement with queue identifiers. If `queueIds` is null or empty, creates engagement for default queue.\n */\n startChat(options: { queueIds?: string[] }): Promise;\n /**\n * Starts a new audio engagement with queue identifiers. If `queueIds` is null or empty, creates engagement for default queue.\n */\n startAudio(options: { queueIds?: string[] }): Promise;\n /**\n * Starts a new video engagement for queue identifiers. If `queueIds` is null or empty, creates engagement for default queue.\n */\n startVideo(options: { queueIds?: string[] }): Promise;\n\n /**\n * Starts Secure Conversation flow with passed `start screen`.\n * Secure Conversation requires authentication/IdToken.\n */\n startSecureConversation(options: { startScreen: SecureConversationStartScreen }): Promise;\n\n /**\n * Recreates currently used visitor in SDK.\n */\n clearVisitorSession(): Promise;\n\n /**\n * Fetches all queues with its info for current site.\n */\n listQueues(): Promise;\n\n /**\n * Presents GliaWidgets UI with visitor code for sharing with operator to start an engagement.\n */\n showVisitorCodeViewController(): Promise;\n\n /**\n * Authenticates visitor.\n * @param options - Provides options for authentication such as behavior, idToken, and accessToken.\n */\n authenticate(options: { behavior: AuthenticationBehavior; idToken: string; accessToken?: string }): Promise;\n\n /**\n * Deauthenticates visitor. Be aware that deauthentication process relies on `AuthenticationBehavior`\n */\n deauthenticate(): Promise;\n\n /**\n * Provides current authentication state\n */\n isAuthenticated(): Promise;\n\n /**\n * Refreshes authentication access properties.\n */\n refreshAuthentication(options: { idToken: string; accessToken?: string }): Promise;\n\n /**\n * Makes a pause for ongoing LiveObservation session.\n */\n pauseLiveObservation(): Promise;\n /**\n * Resumes ongoing LiveObservation session.\n */\n resumeLiveObservation(): Promise;\n}\n"]} \ No newline at end of file diff --git a/dist/esm/index.d.ts b/dist/esm/index.d.ts new file mode 100644 index 0000000..bfe1570 --- /dev/null +++ b/dist/esm/index.d.ts @@ -0,0 +1,4 @@ +import type { GliaSdkPlugin } from './definitions'; +declare const GliaSdk: GliaSdkPlugin; +export * from './definitions'; +export { GliaSdk }; diff --git a/dist/esm/index.js b/dist/esm/index.js new file mode 100644 index 0000000..c7aeb68 --- /dev/null +++ b/dist/esm/index.js @@ -0,0 +1,7 @@ +import { registerPlugin } from '@capacitor/core'; +const GliaSdk = registerPlugin('GliaSdk', { +// web: () => import('./web').then((m) => new m.GliaSdkWeb()), +}); +export * from './definitions'; +export { GliaSdk }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/esm/index.js.map b/dist/esm/index.js.map new file mode 100644 index 0000000..e71dd0c --- /dev/null +++ b/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,OAAO,GAAG,cAAc,CAAgB,SAAS,EAAE;AACvD,8DAA8D;CAC/D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { GliaSdkPlugin } from './definitions';\n\nconst GliaSdk = registerPlugin('GliaSdk', {\n // web: () => import('./web').then((m) => new m.GliaSdkWeb()),\n});\n\nexport * from './definitions';\nexport { GliaSdk };\n"]} \ No newline at end of file diff --git a/dist/plugin.cjs.js b/dist/plugin.cjs.js new file mode 100644 index 0000000..f74758e --- /dev/null +++ b/dist/plugin.cjs.js @@ -0,0 +1,10 @@ +'use strict'; + +var core = require('@capacitor/core'); + +const GliaSdk = core.registerPlugin('GliaSdk', { +// web: () => import('./web').then((m) => new m.GliaSdkWeb()), +}); + +exports.GliaSdk = GliaSdk; +//# sourceMappingURL=plugin.cjs.js.map diff --git a/dist/plugin.cjs.js.map b/dist/plugin.cjs.js.map new file mode 100644 index 0000000..da8c33d --- /dev/null +++ b/dist/plugin.cjs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst GliaSdk = registerPlugin('GliaSdk', {\n// web: () => import('./web').then((m) => new m.GliaSdkWeb()),\n});\nexport * from './definitions';\nexport { GliaSdk };\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin"],"mappings":";;;;AACK,MAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS,EAAE;AAC1C;AACA,CAAC;;;;"} \ No newline at end of file diff --git a/dist/plugin.js b/dist/plugin.js new file mode 100644 index 0000000..15fc613 --- /dev/null +++ b/dist/plugin.js @@ -0,0 +1,13 @@ +var capacitorGliaSdk = (function (exports, core) { + 'use strict'; + + const GliaSdk = core.registerPlugin('GliaSdk', { + // web: () => import('./web').then((m) => new m.GliaSdkWeb()), + }); + + exports.GliaSdk = GliaSdk; + + return exports; + +})({}, capacitorExports); +//# sourceMappingURL=plugin.js.map diff --git a/dist/plugin.js.map b/dist/plugin.js.map new file mode 100644 index 0000000..de90c9c --- /dev/null +++ b/dist/plugin.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugin.js","sources":["esm/index.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst GliaSdk = registerPlugin('GliaSdk', {\n// web: () => import('./web').then((m) => new m.GliaSdkWeb()),\n});\nexport * from './definitions';\nexport { GliaSdk };\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin"],"mappings":";;;AACK,OAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS,EAAE;CAC1C;CACA,CAAC;;;;;;;;;;"} \ No newline at end of file