@dobrodesk/widget 0.1.0 → 0.2.0
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/README.md +2 -0
- package/dist/index.js +4 -0
- package/dist/types.d.ts +4 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ import { createDobroDeskWidget } from "@dobrodesk/widget";
|
|
|
21
21
|
const widget = createDobroDeskWidget({
|
|
22
22
|
integrationId: "acme-support",
|
|
23
23
|
locale: "auto",
|
|
24
|
+
launcher: "hidden",
|
|
24
25
|
});
|
|
25
26
|
|
|
26
27
|
await widget.ready;
|
|
@@ -28,6 +29,7 @@ widget.open();
|
|
|
28
29
|
```
|
|
29
30
|
|
|
30
31
|
`integrationId` is the Widget ID from DobroDesk Admin. Initialize the SDK in browser-side code.
|
|
32
|
+
Use `launcher: "hidden"` when your own button opens the widget with `widget.open()`.
|
|
31
33
|
|
|
32
34
|
Full setup, API and localization instructions:
|
|
33
35
|
[dobrodesk.com/help/initialize-dobrodesk-widget-programmatically](https://dobrodesk.com/help/initialize-dobrodesk-widget-programmatically).
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,7 @@ var createDobroDeskWidget = (options) => {
|
|
|
35
35
|
script.src = loaderUrl;
|
|
36
36
|
script.dataset.dobrodeskIntegration = integrationId;
|
|
37
37
|
script.dataset.dobrodeskLocale = locale;
|
|
38
|
+
script.dataset.dobrodeskLauncher = options.launcher || "default";
|
|
38
39
|
script.dataset.dobrodeskLoader = "true";
|
|
39
40
|
if (options.prefill) {
|
|
40
41
|
queueCommand("prefill", options.prefill);
|
|
@@ -75,11 +76,14 @@ var createDobroDeskWidget = (options) => {
|
|
|
75
76
|
toggle: () => queueCommand("toggle"),
|
|
76
77
|
hide: () => queueCommand("hide"),
|
|
77
78
|
show: () => queueCommand("show"),
|
|
79
|
+
setLauncherVisibility: (visible) => queueCommand("setLauncherVisibility", visible),
|
|
78
80
|
prefill: (value) => queueCommand("prefill", value),
|
|
79
81
|
setLocale: (value) => queueCommand("setLocale", value),
|
|
80
82
|
destroy: () => {
|
|
81
83
|
queueCommand("destroy");
|
|
82
84
|
script.remove();
|
|
85
|
+
delete window.DobroDeskWidget;
|
|
86
|
+
activeClient = null;
|
|
83
87
|
}
|
|
84
88
|
};
|
|
85
89
|
activeClient = client;
|
package/dist/types.d.ts
CHANGED
|
@@ -8,12 +8,13 @@ export type DobroDeskWidgetPrefill = {
|
|
|
8
8
|
export type DobroDeskWidgetOptions = {
|
|
9
9
|
readonly integrationId: string;
|
|
10
10
|
readonly locale?: string;
|
|
11
|
+
readonly launcher?: "default" | "hidden";
|
|
11
12
|
readonly loaderUrl?: string;
|
|
12
13
|
readonly prefill?: DobroDeskWidgetPrefill;
|
|
13
14
|
readonly openOnReady?: boolean;
|
|
14
15
|
};
|
|
15
|
-
export type DobroDeskWidgetCommand = "open" | "close" | "toggle" | "hide" | "show" | "prefill" | "setLocale" | "destroy";
|
|
16
|
-
export type DobroDeskWidgetCommandFunction = (command: DobroDeskWidgetCommand, value?: DobroDeskWidgetPrefill | string) => void;
|
|
16
|
+
export type DobroDeskWidgetCommand = "open" | "close" | "toggle" | "hide" | "show" | "setLauncherVisibility" | "prefill" | "setLocale" | "destroy";
|
|
17
|
+
export type DobroDeskWidgetCommandFunction = (command: DobroDeskWidgetCommand, value?: DobroDeskWidgetPrefill | string | boolean) => void;
|
|
17
18
|
export type DobroDeskWidgetClient = {
|
|
18
19
|
readonly ready: Promise<void>;
|
|
19
20
|
readonly open: () => void;
|
|
@@ -21,6 +22,7 @@ export type DobroDeskWidgetClient = {
|
|
|
21
22
|
readonly toggle: () => void;
|
|
22
23
|
readonly hide: () => void;
|
|
23
24
|
readonly show: () => void;
|
|
25
|
+
readonly setLauncherVisibility: (visible: boolean) => void;
|
|
24
26
|
readonly prefill: (value: DobroDeskWidgetPrefill) => void;
|
|
25
27
|
readonly setLocale: (locale: string) => void;
|
|
26
28
|
readonly destroy: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dobrodesk/widget",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Programmatic browser SDK for the DobroDesk website support widget.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"customer-support",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"author": "Comstudio",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "https://github.com/comstud-io/dobrodesk.git",
|
|
14
|
+
"url": "git+https://github.com/comstud-io/dobrodesk.git",
|
|
15
15
|
"directory": "packages/widget-sdk"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|