obi-sdk 0.18.19 → 0.18.20

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.
@@ -0,0 +1,84 @@
1
+ import { EventEmitter } from "eventemitter3";
2
+ import type { Identity } from "@obi/obi-client";
3
+ import { ObiClient } from "@obi/obi-client";
4
+ import { Command, CommandType, Config } from "./types";
5
+ export declare const PLAN_URL_PARAM = "49206C6F7665204F6269_session";
6
+ export declare const STORAGE_KEY = "obi-url-params";
7
+ export type ObiSDKEvents = {
8
+ initialised: () => void;
9
+ error: (err: Error) => void;
10
+ showMenu: (showMenu: boolean) => void;
11
+ configUpdated: () => void;
12
+ };
13
+ export type InitialiseArgs = {
14
+ queuedCommands?: Command[];
15
+ };
16
+ export declare class ObiSDK extends EventEmitter<ObiSDKEvents> {
17
+ client: ObiClient | null;
18
+ isActive: boolean;
19
+ primaryColour: string;
20
+ passivePlanUuid: string | null;
21
+ private commandQueue;
22
+ /** HACK: Need to prevent initialisation from being called if resumed. */
23
+ private _resumed;
24
+ /**
25
+ * Creates a client that should persist for the lifetime of the SDK.
26
+ * Resumes an ongoing session if one exists.
27
+ */
28
+ constructor(appToken?: string);
29
+ createClient(appToken: string): Promise<void>;
30
+ initialise(args?: InitialiseArgs): Promise<void>;
31
+ /**
32
+ * Update the SDK configuration. This is typically called before a plan starts,
33
+ * but it is possible to update the configuration during a plan.
34
+ */
35
+ updateConfig(config: Config): Promise<void>;
36
+ updateAppToken(appToken?: string): Promise<void>;
37
+ /**
38
+ * Update the SDK activity state. Activity controls whether the SDK is continuously
39
+ * visible or not.
40
+ * Ignores updates if the active state is undefined or the same as the current active state.
41
+ */
42
+ updateActive(isActive?: boolean): void;
43
+ /**
44
+ * Update the SDK primary colour. This is typically called before a plan starts,
45
+ * but it is possible to update the primary colour during a plan.
46
+ * Ignores updates if the primary colour is undefined or the same as the current primary colour.
47
+ */
48
+ updatePrimaryColour(primaryColour?: string): void;
49
+ /**
50
+ * Update the identity of the onboardee. This is typically called before a plan starts,
51
+ * but it is possible to update the identity during a plan.
52
+ * Ignores updates if the identity is undefined or the same as the current identity.
53
+ */
54
+ updateIdentity(identity?: Identity | null): Promise<void>;
55
+ updateShowMenu(showMenu?: boolean): void;
56
+ /**
57
+ * Say a message to the onboardee.
58
+ */
59
+ say(message: string): Promise<void>;
60
+ /**
61
+ * Start a new session.
62
+ */
63
+ startSession(): Promise<void>;
64
+ /**
65
+ * Dispatch all queued commands in the order they were added.
66
+ * TODO: Passing in the planuuid is not cool.
67
+ */
68
+ dispatchCommandQueue(): void;
69
+ /**
70
+ * This gets set on the window object by the loader script. It is used as an abstraction to allow
71
+ * users to call commands without having to wait for the client to be ready. This works in tandem
72
+ * with the loader script, which will queue any commands that are called before the client is ready.
73
+ */
74
+ dispatchCommand: (commandType: CommandType, args: any) => void;
75
+ /**
76
+ * Parse passive initiation parameters from the URL and/or local storage.
77
+ * Passive initiation parameters are values that indicate a plan & app token to use immediately.
78
+ */
79
+ parsePassiveParams(): null | undefined;
80
+ mountWidget(): void;
81
+ captureScreen(): Promise<string>;
82
+ save(): void;
83
+ load(): string | null;
84
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obi-sdk",
3
- "version": "0.18.19",
3
+ "version": "0.18.20",
4
4
  "description": "JavaScript SDK for Obi",
5
5
  "type": "module",
6
6
  "main": "dist/obi-sdk.umd.js",
@@ -41,8 +41,8 @@
41
41
  "ts-pattern": "^5.7.0",
42
42
  "zod": "^3.22.0",
43
43
  "@obi/obi-client": "0.7.0",
44
- "@obi/obi-components": "0.1.0",
45
- "@obi/utils": "0.2.0"
44
+ "@obi/utils": "0.2.0",
45
+ "@obi/obi-components": "0.1.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@chromatic-com/storybook": "^4.0.0-0",