@dropby/vue 0.4.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/LICENSE +21 -0
- package/README.md +188 -0
- package/dist/chunks/chat-attachment-types-BG8VFQj5.d.ts +56 -0
- package/dist/chunks/chat-attachments-BeJa4tEd.js +20 -0
- package/dist/chunks/public-component-A2rcQYAZ.d.ts +10 -0
- package/dist/chunks/use-drop-by-4B6MMMx1.js +33 -0
- package/dist/chunks/use-feature-BQHA7pdn.js +68 -0
- package/dist/components/chat-attachments/index.d.ts +9 -0
- package/dist/components/chat-attachments/index.js +87 -0
- package/dist/components/index.d.ts +402 -0
- package/dist/components/index.js +1125 -0
- package/dist/index.d.ts +123 -0
- package/dist/index.js +33 -0
- package/package.json +53 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { t as PublicComponent } from "./chunks/public-component-A2rcQYAZ.js";
|
|
2
|
+
import { ExtractPublicPropTypes, MaybeRefOrGetter, PropType, Ref, VNode } from "vue";
|
|
3
|
+
import { AsksActions, AsksActions as AsksActions$1, AsyncResource, BootstrapState, CapabilityState, ChatActions, ChatActions as ChatActions$1, ChatHistoryLoadState, ChatThread, ChatThreadActions, ChatThreadActions as ChatThreadActions$1, ChatThreadsCollection, ChatUnread, ConnectionState, DropBy, DropById, DropByOptions, FlagValue, Idea, IdeasActions, IdeasActions as IdeasActions$1, IdeasState, PagedCollection, PendingAsksCollection, ResolvedFeatureConfig } from "@dropby/browser";
|
|
4
|
+
/**
|
|
5
|
+
* The props `DropByProvider` takes: the `options` to create an instance from,
|
|
6
|
+
* or an instance of your own, not both.
|
|
7
|
+
*/
|
|
8
|
+
type DropByProviderProps = {
|
|
9
|
+
/** An instance you created; you start and destroy it. */
|
|
10
|
+
dropby: DropBy;
|
|
11
|
+
/** Pass `options` or `dropby`, not both. */
|
|
12
|
+
options?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
/** Options for the instance the provider creates, starts and destroys. Read once. */
|
|
15
|
+
options: DropByOptions;
|
|
16
|
+
/** Pass `options` or `dropby`, not both. */
|
|
17
|
+
dropby?: undefined;
|
|
18
|
+
};
|
|
19
|
+
declare const dropByProviderProps: {
|
|
20
|
+
/** An instance you created; you start and destroy it. */
|
|
21
|
+
readonly dropby: {
|
|
22
|
+
readonly type: PropType<DropBy>;
|
|
23
|
+
readonly default: undefined;
|
|
24
|
+
};
|
|
25
|
+
/** Options for the instance the provider creates, starts and destroys. Read once. */
|
|
26
|
+
readonly options: {
|
|
27
|
+
readonly type: PropType<DropByOptions>;
|
|
28
|
+
readonly default: undefined;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
interface DropByProviderSlots {
|
|
32
|
+
/** The part of your app that uses DropBy. */
|
|
33
|
+
default?: () => VNode[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Makes a DropBy instance available to the composables and components below it.
|
|
37
|
+
* With `options` it creates the instance, starts it once mounted and destroys it
|
|
38
|
+
* with its scope; give it a `:key` of the signed-in user's and account's ids so
|
|
39
|
+
* a new identity gets a new instance. With `dropby` it only provides yours.
|
|
40
|
+
*/
|
|
41
|
+
export declare const DropByProvider: PublicComponent<ExtractPublicPropTypes<typeof dropByProviderProps>, DropByProviderSlots>;
|
|
42
|
+
/** The DropBy instance from the nearest `DropByProvider`. Throws outside one. */
|
|
43
|
+
export declare function useDropBy(): DropBy;
|
|
44
|
+
/** The instance's live state, from `useDropByState`. */
|
|
45
|
+
interface UseDropByStateResult {
|
|
46
|
+
/** How live updates arrive. */
|
|
47
|
+
connection: Readonly<Ref<ConnectionState>>;
|
|
48
|
+
/** What the session may do, with your team's widget settings applied. */
|
|
49
|
+
capabilities: Readonly<Ref<CapabilityState>>;
|
|
50
|
+
/** The signed-in session, with its feature flags. */
|
|
51
|
+
bootstrap: Readonly<Ref<BootstrapState>>;
|
|
52
|
+
}
|
|
53
|
+
/** The instance's connection, capabilities and session, each a read-only ref. */
|
|
54
|
+
export declare function useDropByState(): UseDropByStateResult;
|
|
55
|
+
/** What `useChatThreads` returns. */
|
|
56
|
+
interface UseChatThreadsResult {
|
|
57
|
+
/** The conversation list, as a read-only ref. */
|
|
58
|
+
data: Readonly<Ref<ChatThreadsCollection>>;
|
|
59
|
+
/** Chat's actions; the same object for the component's life. */
|
|
60
|
+
actions: ChatActions$1;
|
|
61
|
+
}
|
|
62
|
+
/** The conversation list and chat's actions. Load it with `actions.listThreads()`. */
|
|
63
|
+
export declare function useChatThreads(): UseChatThreadsResult;
|
|
64
|
+
/** What `useChatThread` returns. */
|
|
65
|
+
interface UseChatThreadResult {
|
|
66
|
+
/** The load of older messages, once one started. */
|
|
67
|
+
olderMessages: Readonly<Ref<ChatHistoryLoadState | undefined>>;
|
|
68
|
+
/** The load of the newest messages, once one started. */
|
|
69
|
+
latestMessages: Readonly<Ref<ChatHistoryLoadState | undefined>>;
|
|
70
|
+
/** The conversation as loaded, as a read-only ref. */
|
|
71
|
+
data: Readonly<Ref<AsyncResource<ChatThread> | undefined>>;
|
|
72
|
+
/** The conversation's actions, its id bound. */
|
|
73
|
+
actions: ChatThreadActions$1;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* One conversation and its actions. Load it with `actions.open()`; its live
|
|
77
|
+
* updates are applied while the component is mounted. The id may be a ref or a
|
|
78
|
+
* getter, and everything follows it when it changes.
|
|
79
|
+
*/
|
|
80
|
+
export declare function useChatThread(id: MaybeRefOrGetter<DropById<"thr_">>): UseChatThreadResult;
|
|
81
|
+
/**
|
|
82
|
+
* Unread replies across the user's conversations, and chat's actions. Load with
|
|
83
|
+
* `actions.refreshUnread()`.
|
|
84
|
+
*/
|
|
85
|
+
export declare function useChatUnread(): {
|
|
86
|
+
data: Readonly<Ref<AsyncResource<ChatUnread>>>;
|
|
87
|
+
actions: ChatActions$1;
|
|
88
|
+
};
|
|
89
|
+
/** What `useIdeas` returns. */
|
|
90
|
+
interface UseIdeasResult<Data = PagedCollection<Idea>> {
|
|
91
|
+
/** The ideas list, or what your selector picked, as a read-only ref. */
|
|
92
|
+
data: Readonly<Ref<Data>>;
|
|
93
|
+
/** The board's actions; the same object for the component's life. */
|
|
94
|
+
actions: IdeasActions$1;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The ideas list and the board's actions. It loads nothing itself: list with
|
|
98
|
+
* `actions.list({ view })`. Pass a selector to read another part of the board's
|
|
99
|
+
* state, such as the idea opened.
|
|
100
|
+
*/
|
|
101
|
+
export declare function useIdeas(): UseIdeasResult;
|
|
102
|
+
export declare function useIdeas<Selected>(selector: (state: IdeasState) => Selected, isEqual?: (a: Selected, b: Selected) => boolean): UseIdeasResult<Selected>;
|
|
103
|
+
/** What `usePendingAsks` returns. */
|
|
104
|
+
interface UsePendingAsksResult {
|
|
105
|
+
/** The asks waiting for the user, as a read-only ref. */
|
|
106
|
+
data: Readonly<Ref<PendingAsksCollection>>;
|
|
107
|
+
/** The asks' actions; the same object for the component's life. */
|
|
108
|
+
actions: AsksActions$1;
|
|
109
|
+
}
|
|
110
|
+
/** The asks waiting for the user, and their actions. Load them with `actions.listPending()`. */
|
|
111
|
+
export declare function usePendingAsks(): UsePendingAsksResult;
|
|
112
|
+
/**
|
|
113
|
+
* Every feature flag for the signed-in user, as a read-only ref; empty until the
|
|
114
|
+
* session has loaded.
|
|
115
|
+
*/
|
|
116
|
+
export declare function useFeatureConfig(): Readonly<Ref<ResolvedFeatureConfig>>;
|
|
117
|
+
/**
|
|
118
|
+
* One feature flag's value, as a read-only ref that changes only with it;
|
|
119
|
+
* undefined for a flag that does not exist or until the session has loaded. The
|
|
120
|
+
* name may be a ref or a getter.
|
|
121
|
+
*/
|
|
122
|
+
export declare function useFeatureFlag(key: MaybeRefOrGetter<string>): Readonly<Ref<FlagValue | undefined>>;
|
|
123
|
+
export type { AsksActions, ChatActions, ChatThreadActions, DropByProviderProps, IdeasActions, UseChatThreadResult, UseChatThreadsResult, UseDropByStateResult, UseIdeasResult, UsePendingAsksResult };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { i as dropByKey, n as useDropByState, t as useDropBy } from "./chunks/use-drop-by-4B6MMMx1.js";
|
|
2
|
+
import { a as useChatThread, i as useIdeas, n as useFeatureFlag, o as useChatThreads, r as usePendingAsks, s as useChatUnread, t as useFeatureConfig } from "./chunks/use-feature-BQHA7pdn.js";
|
|
3
|
+
import { defineComponent, markRaw, onMounted, onScopeDispose, provide, toRaw } from "vue";
|
|
4
|
+
import { createDropBy } from "@dropby/browser";
|
|
5
|
+
const DropByProvider = defineComponent({
|
|
6
|
+
name: "DropByProvider",
|
|
7
|
+
slots: Object,
|
|
8
|
+
props: {
|
|
9
|
+
dropby: {
|
|
10
|
+
type: Object,
|
|
11
|
+
default: void 0
|
|
12
|
+
},
|
|
13
|
+
options: {
|
|
14
|
+
type: Object,
|
|
15
|
+
default: void 0
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
setup(props, { slots }) {
|
|
19
|
+
provide(dropByKey, resolveCore(props));
|
|
20
|
+
return () => slots.default?.();
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
function resolveCore(props) {
|
|
24
|
+
if (props.dropby) return toRaw(props.dropby);
|
|
25
|
+
if (props.options) {
|
|
26
|
+
const core = markRaw(createDropBy(props.options));
|
|
27
|
+
onMounted(() => core.start());
|
|
28
|
+
onScopeDispose(() => core.destroy());
|
|
29
|
+
return core;
|
|
30
|
+
}
|
|
31
|
+
throw new Error("DropByProvider requires either a `dropby` or an `options` prop.");
|
|
32
|
+
}
|
|
33
|
+
export { DropByProvider, useChatThread, useChatThreads, useChatUnread, useDropBy, useDropByState, useFeatureConfig, useFeatureFlag, useIdeas, usePendingAsks };
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dropby/vue",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Vue bindings for DropBy: a provider, composables and components for chat, ideas and asks.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"dropby",
|
|
8
|
+
"vue",
|
|
9
|
+
"customer-support",
|
|
10
|
+
"chat",
|
|
11
|
+
"feedback",
|
|
12
|
+
"feature-requests",
|
|
13
|
+
"surveys",
|
|
14
|
+
"sdk"
|
|
15
|
+
],
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "Simpllyf Software",
|
|
18
|
+
"homepage": "https://dropby.chat",
|
|
19
|
+
"type": "module",
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./components": {
|
|
28
|
+
"types": "./dist/components/index.d.ts",
|
|
29
|
+
"import": "./dist/components/index.js",
|
|
30
|
+
"default": "./dist/components/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./components/chat-attachments": {
|
|
33
|
+
"types": "./dist/components/chat-attachments/index.d.ts",
|
|
34
|
+
"import": "./dist/components/chat-attachments/index.js",
|
|
35
|
+
"default": "./dist/components/chat-attachments/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"vue": "^3.4"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@dropby/browser": "0.4.0"
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"dist"
|
|
46
|
+
],
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"gitHead": "714b80e34a96081832e3c6e66ede69b925c9b851",
|
|
51
|
+
"types": "./dist/index.d.ts",
|
|
52
|
+
"main": "./dist/index.js"
|
|
53
|
+
}
|