@archbee/app-widget 1.1.23 → 1.1.25
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 +44 -39
- package/index.esm.d.ts +1 -0
- package/index.esm.js +1643 -0
- package/package.json +4 -44
- package/src/index.d.ts +3 -0
- package/src/lib/main.d.ts +26 -0
- package/src/lib/scripts/index.d.ts +4 -0
- package/src/lib/scripts/initScripts.d.ts +4 -0
- package/src/lib/scripts/proxy.d.ts +2 -0
- package/src/lib/scripts/render.d.ts +1 -0
- package/src/lib/scripts/widgetActions.d.ts +4 -0
- package/src/lib/types.d.ts +54 -0
- package/index.js +0 -525
- package/types.d.ts +0 -62
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archbee/app-widget",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.25",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": {
|
|
@@ -17,42 +17,6 @@
|
|
|
17
17
|
"publishConfig": {
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
22
|
-
"@craco/craco": "^7.1.0",
|
|
23
|
-
"@parcel/packager-ts": "^2.10.3",
|
|
24
|
-
"@parcel/transformer-typescript-types": "^2.10.3",
|
|
25
|
-
"@testing-library/jest-dom": "^5.17.0",
|
|
26
|
-
"@testing-library/react": "^13.4.0",
|
|
27
|
-
"@testing-library/user-event": "^13.5.0",
|
|
28
|
-
"@types/jest": "^29.5.3",
|
|
29
|
-
"@types/node": "^20.11.7",
|
|
30
|
-
"@types/react": "^18.2.15",
|
|
31
|
-
"@types/react-dom": "^18.2.7",
|
|
32
|
-
"@types/react-modal": "^3.16.0",
|
|
33
|
-
"autoprefixer": "^10.4.14",
|
|
34
|
-
"craco-plugin-env": "^1.0.5",
|
|
35
|
-
"mini-css-extract-plugin": "^2.7.6",
|
|
36
|
-
"parcel": "^2.10.3",
|
|
37
|
-
"parcel-resolver-ignore": "^2.1.5",
|
|
38
|
-
"postcss": "^8.4.26",
|
|
39
|
-
"prettier": "^3.0.0",
|
|
40
|
-
"ts-loader": "^9.4.1",
|
|
41
|
-
"typescript": "^4.9.5",
|
|
42
|
-
"web-vitals": "^2.1.4"
|
|
43
|
-
},
|
|
44
|
-
"scripts": {
|
|
45
|
-
"clean": "rm -rf dist build",
|
|
46
|
-
"start": "http-server dist/ -p 3002 -c-1",
|
|
47
|
-
"build": "npm run clean && npm run build:widget && npm run build:react",
|
|
48
|
-
"build:widget": "REACT_APP_SDK=true craco build && parcel build src/index.tsx --no-source-maps && mkdir -p build/v1 && cp dist/* build/v1/",
|
|
49
|
-
"build:react": "./react-build.script.sh",
|
|
50
|
-
"test": "craco test",
|
|
51
|
-
"format": "prettier --write src/**/*.ts{,x}",
|
|
52
|
-
"pub": "npm publish",
|
|
53
|
-
"prebuild": "npm run clean",
|
|
54
|
-
"eject": "craco eject"
|
|
55
|
-
},
|
|
56
20
|
"eslintConfig": {
|
|
57
21
|
"extends": [
|
|
58
22
|
"react-app",
|
|
@@ -71,11 +35,7 @@
|
|
|
71
35
|
"last 1 safari version"
|
|
72
36
|
]
|
|
73
37
|
},
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"main": "index.js"
|
|
77
|
-
"targets": {
|
|
78
|
-
"main": {},
|
|
79
|
-
"types": {}
|
|
80
|
-
}
|
|
38
|
+
"module": "./index.esm.js",
|
|
39
|
+
"type": "module",
|
|
40
|
+
"main": "./index.esm.js"
|
|
81
41
|
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AbWidgetRef, BubbleType, WidgetType } from './types';
|
|
2
|
+
type Props = {
|
|
3
|
+
spaceId: string;
|
|
4
|
+
docId?: string;
|
|
5
|
+
jwt?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
shareableToken?: string;
|
|
8
|
+
widgetType: WidgetType;
|
|
9
|
+
bubble?: BubbleType;
|
|
10
|
+
blockId?: string;
|
|
11
|
+
user?: {
|
|
12
|
+
id: string;
|
|
13
|
+
email?: string;
|
|
14
|
+
first_name?: string;
|
|
15
|
+
last_name?: string;
|
|
16
|
+
profile_image_url?: string;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
};
|
|
19
|
+
loadingStrategy?: 'eager' | 'lazy';
|
|
20
|
+
onWidgetOpen?: Function;
|
|
21
|
+
onWidgetClose?: Function;
|
|
22
|
+
};
|
|
23
|
+
export declare const ArchbeeAppWidget: import("react").ForwardRefExoticComponent<Props & {
|
|
24
|
+
children?: import("react").ReactNode;
|
|
25
|
+
} & import("react").RefAttributes<AbWidgetRef>>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BubbleType, LoadingStrategy } from '../types';
|
|
2
|
+
export declare const initScripts: () => void;
|
|
3
|
+
export declare const initJsScripts: (loadingStrategy: LoadingStrategy) => void;
|
|
4
|
+
export declare const createArchbeeWidget: (spaceId: string, jwt?: string, shareableToken?: string, loadingStrategy?: LoadingStrategy, bubble?: BubbleType) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const render: (component: JSX.Element, cb?: Function) => void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface ArchbeeWidgetInstance {
|
|
2
|
+
version: string;
|
|
3
|
+
widget: AbWidgetData;
|
|
4
|
+
queue: any;
|
|
5
|
+
push: Function;
|
|
6
|
+
}
|
|
7
|
+
export declare enum EVENT_TYPE_ENUM {
|
|
8
|
+
init = "init",
|
|
9
|
+
showWidget = "show-widget",
|
|
10
|
+
hideWidget = "hide-widget"
|
|
11
|
+
}
|
|
12
|
+
type WidgetEventType = EVENT_TYPE_ENUM.init | EVENT_TYPE_ENUM.showWidget | EVENT_TYPE_ENUM.hideWidget;
|
|
13
|
+
export declare const EVENT_TYPE_LIST: EVENT_TYPE_ENUM[];
|
|
14
|
+
export interface AbWidgetData {
|
|
15
|
+
eventType: WidgetEventType;
|
|
16
|
+
collectionId?: string;
|
|
17
|
+
spaceId?: string;
|
|
18
|
+
docId?: string;
|
|
19
|
+
blockId?: string;
|
|
20
|
+
isOpen: boolean;
|
|
21
|
+
selector: string;
|
|
22
|
+
origin?: string;
|
|
23
|
+
onRenderFinish?: Function;
|
|
24
|
+
hasExecuted: boolean;
|
|
25
|
+
jwt?: string;
|
|
26
|
+
shareableToken?: string;
|
|
27
|
+
widgetType?: WidgetType;
|
|
28
|
+
bubble?: BubbleType;
|
|
29
|
+
}
|
|
30
|
+
type AbWidgetActionType = 'ab-doc-open' | 'ab-doc-close';
|
|
31
|
+
export interface AbWidgetAction {
|
|
32
|
+
source: 'archbee-widget';
|
|
33
|
+
type: AbWidgetActionType;
|
|
34
|
+
metadata: any;
|
|
35
|
+
}
|
|
36
|
+
export interface AbWidgetOpenAction extends AbWidgetAction {
|
|
37
|
+
type: 'ab-doc-open';
|
|
38
|
+
metadata: AbWidgetData;
|
|
39
|
+
}
|
|
40
|
+
export interface AbWidgetCloseAction extends AbWidgetAction {
|
|
41
|
+
type: 'ab-doc-close';
|
|
42
|
+
metadata: undefined;
|
|
43
|
+
}
|
|
44
|
+
export type BubbleType = 'ask' | 'invisible';
|
|
45
|
+
export type WidgetType = 'docs' | 'search';
|
|
46
|
+
export type LoadingStrategy = 'lazy' | 'eager';
|
|
47
|
+
export interface AbWidgetRef {
|
|
48
|
+
open: () => void;
|
|
49
|
+
close: () => void;
|
|
50
|
+
instance: () => ArchbeeWidgetInstance;
|
|
51
|
+
}
|
|
52
|
+
export declare const showWidgetEvent: () => CustomEvent<AbWidgetData> | undefined;
|
|
53
|
+
export declare const hideWidgetEvent: () => CustomEvent<AbWidgetData> | undefined;
|
|
54
|
+
export {};
|