@cossistant/core 0.0.13 → 0.0.16
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/checks.d.ts.map +1 -1
- package/conversation.d.ts +13 -13
- package/conversation.d.ts.map +1 -1
- package/core.d.ts.map +1 -1
- package/errors.d.ts.map +1 -1
- package/index.d.ts +2 -2
- package/package.json +1 -1
- package/realtime-events.d.ts +7 -7
- package/schemas.d.ts.map +1 -1
- package/schemas3.d.ts +3 -3
- package/store/support-store.d.ts +40 -24
- package/store/support-store.d.ts.map +1 -1
- package/store/support-store.js +5 -10
- package/store/support-store.js.map +1 -1
- package/timeline-item.d.ts +8 -8
- package/timeline-item.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"support-store.js","names":["data: PersistedState"],"sources":["../../src/store/support-store.ts"],"sourcesContent":["import { createStore, type Store } from \"./create-store\";\n\nexport type NavigationState =\n\t| { page: \"HOME\"; params?: undefined }\n\t| { page: \"ARTICLES\"; params?: undefined }\n\t| {\n\t\t\tpage: \"CONVERSATION\";\n\t\t\tparams: { conversationId: string; initialMessage?: string };\n\t }\n\t| { page: \"CONVERSATION_HISTORY\"; params?: undefined };\n\nexport type SUPPORT_PAGES = NavigationState[\"page\"];\n\nexport type SupportNavigation = {\n\tpreviousPages: NavigationState[];\n\tcurrent: NavigationState;\n};\n\nexport type SupportConfig = {\n\tsize: \"normal\" | \"larger\";\n\tisOpen: boolean;\n\tcontent: {\n\t\thome?: {\n\t\t\theader?: string;\n\t\t\tsubheader?: string;\n\t\t\tctaLabel?: string;\n\t\t};\n\t};\n};\n\nexport type SupportStoreState = {\n\tnavigation: SupportNavigation;\n\tconfig: SupportConfig;\n};\n\nexport type SupportStoreActions = {\n\tnavigate(state: NavigationState): void;\n\treplace(state: NavigationState): void;\n\tgoBack(): void;\n\topen(): void;\n\tclose(): void;\n\ttoggle(): void;\n\tupdateConfig(config: Partial<SupportConfig>): void;\n\treset(): void;\n};\n\nexport type SupportStoreStorage = {\n\tgetItem(key: string): string | null;\n\tsetItem(key: string, value: string): void;\n\tremoveItem(key: string): void;\n};\n\nexport type SupportStoreOptions = {\n\tstorage?: SupportStoreStorage;\n\tstorageKey?: string;\n};\n\nexport type SupportStore = Store<SupportStoreState> & SupportStoreActions;\n\nconst STORAGE_KEY = \"cossistant-support-store\";\n\ntype PersistedConfig = Pick<SupportConfig, \"size\" | \"isOpen\">;\n\ntype PersistedState = {\n\tnavigation?: SupportNavigation;\n\tconfig?: PersistedConfig;\n};\n\nfunction createDefaultNavigation(): SupportNavigation {\n\treturn {\n\t\tcurrent: { page: \"HOME\" },\n\t\tpreviousPages: [],\n\t};\n}\n\nfunction createDefaultConfig(): SupportConfig {\n\treturn {\n\t\tsize: \"normal\",\n\t\tcontent: {},\n\t\tisOpen: false,\n\t};\n}\n\nfunction createDefaultState(): SupportStoreState {\n\treturn {\n\t\tnavigation: createDefaultNavigation(),\n\t\tconfig: createDefaultConfig(),\n\t};\n}\n\nfunction cloneNavigationState(state: NavigationState): NavigationState {\n\tswitch (state.page) {\n\t\tcase \"CONVERSATION\":\n\t\t\treturn {\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: { ...state.params },\n\t\t\t};\n\t\tdefault:\n\t\t\treturn { page: state.page, params: state.params } as NavigationState;\n\t}\n}\n\nfunction parsePersistedState(\n\tpersisted: PersistedState | null | undefined,\n\tfallback: SupportStoreState\n): SupportStoreState {\n\tif (!persisted) {\n\t\treturn fallback;\n\t}\n\n\tconst persistedNavigation = persisted.navigation;\n\tconst navigation: SupportNavigation = {\n\t\tcurrent: persistedNavigation?.current\n\t\t\t? cloneNavigationState(persistedNavigation.current)\n\t\t\t: cloneNavigationState(fallback.navigation.current),\n\t\tpreviousPages: (\n\t\t\tpersistedNavigation?.previousPages ?? fallback.navigation.previousPages\n\t\t).map((page) => cloneNavigationState(page)),\n\t};\n\n\tconst config: SupportConfig = {\n\t\t...fallback.config,\n\t\t...persisted.config,\n\t};\n\n\treturn {\n\t\tnavigation,\n\t\tconfig,\n\t};\n}\n\nfunction getInitialState(options: SupportStoreOptions): SupportStoreState {\n\tconst fallback = createDefaultState();\n\tconst storage = options.storage;\n\tif (!storage) {\n\t\treturn fallback;\n\t}\n\n\ttry {\n\t\tconst raw = storage.getItem(options.storageKey ?? STORAGE_KEY);\n\t\tif (!raw) {\n\t\t\treturn fallback;\n\t\t}\n\n\t\tconst parsed = JSON.parse(raw) as PersistedState;\n\t\treturn parsePersistedState(parsed, fallback);\n\t} catch (error) {\n\t\tconsole.warn(\"[SupportStore] Failed to read persisted state\", error);\n\t\treturn fallback;\n\t}\n}\n\nfunction persistState(\n\tstate: SupportStoreState,\n\toptions: SupportStoreOptions\n): void {\n\tconst storage = options.storage;\n\tif (!storage) {\n\t\treturn;\n\t}\n\n\tconst data: PersistedState = {\n\t\tnavigation: {\n\t\t\tcurrent: state.navigation.current,\n\t\t\tpreviousPages: [...state.navigation.previousPages],\n\t\t},\n\t\tconfig: {\n\t\t\tsize: state.config.size,\n\t\t\tisOpen: state.config.isOpen,\n\t\t},\n\t};\n\n\ttry {\n\t\tstorage.setItem(options.storageKey ?? STORAGE_KEY, JSON.stringify(data));\n\t} catch (error) {\n\t\tconsole.warn(\"[SupportStore] Failed to persist state\", error);\n\t}\n}\n\nexport function createSupportStore(\n\toptions: SupportStoreOptions = {}\n): SupportStore {\n\tconst initialState = getInitialState(options);\n\tconst store = createStore<SupportStoreState>(initialState);\n\n\tconst commit = (updater: (state: SupportStoreState) => SupportStoreState) => {\n\t\tconst previous = store.getState();\n\t\tstore.setState(updater);\n\t\tconst next = store.getState();\n\t\tif (next !== previous) {\n\t\t\tpersistState(next, options);\n\t\t}\n\t};\n\n\treturn {\n\t\t...store,\n\t\tnavigate(state) {\n\t\t\tcommit((current) => ({\n\t\t\t\tnavigation: {\n\t\t\t\t\tpreviousPages: [\n\t\t\t\t\t\t...current.navigation.previousPages,\n\t\t\t\t\t\tcurrent.navigation.current,\n\t\t\t\t\t],\n\t\t\t\t\tcurrent: state,\n\t\t\t\t},\n\t\t\t\tconfig: current.config,\n\t\t\t}));\n\t\t},\n\t\treplace(state) {\n\t\t\tcommit((current) => ({\n\t\t\t\tnavigation: {\n\t\t\t\t\t...current.navigation,\n\t\t\t\t\tcurrent: state,\n\t\t\t\t},\n\t\t\t\tconfig: current.config,\n\t\t\t}));\n\t\t},\n\t\tgoBack() {\n\t\t\tcommit((current) => {\n\t\t\t\tconst { previousPages } = current.navigation;\n\t\t\t\tif (previousPages.length === 0) {\n\t\t\t\t\treturn current;\n\t\t\t\t}\n\n\t\t\t\tconst nextPrevious = previousPages.slice(0, -1);\n\t\t\t\tconst previous = previousPages.at(-1);\n\n\t\t\t\tif (!previous) {\n\t\t\t\t\treturn current;\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tnavigation: {\n\t\t\t\t\t\tpreviousPages: nextPrevious,\n\t\t\t\t\t\tcurrent: previous,\n\t\t\t\t\t},\n\t\t\t\t\tconfig: current.config,\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t\topen() {\n\t\t\tcommit((current) => ({\n\t\t\t\tnavigation: current.navigation,\n\t\t\t\tconfig: { ...current.config, isOpen: true },\n\t\t\t}));\n\t\t},\n\t\tclose() {\n\t\t\tcommit((current) => ({\n\t\t\t\tnavigation: current.navigation,\n\t\t\t\tconfig: { ...current.config, isOpen: false },\n\t\t\t}));\n\t\t},\n\t\ttoggle() {\n\t\t\tcommit((current) => ({\n\t\t\t\tnavigation: current.navigation,\n\t\t\t\tconfig: { ...current.config, isOpen: !current.config.isOpen },\n\t\t\t}));\n\t\t},\n\t\tupdateConfig(config) {\n\t\t\tcommit((current) => ({\n\t\t\t\tnavigation: current.navigation,\n\t\t\t\tconfig: { ...current.config, ...config },\n\t\t\t}));\n\t\t},\n\t\treset() {\n\t\t\tcommit(() => createDefaultState());\n\t\t},\n\t};\n}\n"],"mappings":";;;AA2DA,MAAM,cAAc;AASpB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IACpB,QAAQ;KAAE,GAAG,QAAQ;KAAQ,QAAQ;KAAO;IAC5C,EAAE;;EAEJ,SAAS;AACR,WAAQ,aAAa;IACpB,YAAY,QAAQ;IACpB,QAAQ;KAAE,GAAG,QAAQ;KAAQ,QAAQ,CAAC,QAAQ,OAAO;KAAQ;IAC7D,EAAE;;EAEJ,aAAa,QAAQ;AACpB,WAAQ,aAAa;IACpB,YAAY,QAAQ;IACpB,QAAQ;KAAE,GAAG,QAAQ;KAAQ,GAAG;KAAQ;IACxC,EAAE;;EAEJ,QAAQ;AACP,gBAAa,oBAAoB,CAAC;;EAEnC"}
|
|
1
|
+
{"version":3,"file":"support-store.js","names":["data: PersistedState<Routes>"],"sources":["../../src/store/support-store.ts"],"sourcesContent":["import { createStore, type Store } from \"./create-store\";\n\n/**\n * Built-in routes with their parameter types.\n */\nexport type DefaultRoutes = {\n\tHOME: undefined;\n\tARTICLES: undefined;\n\tCONVERSATION: { conversationId: string; initialMessage?: string };\n\tCONVERSATION_HISTORY: undefined;\n};\n\n/**\n * Extensible route registry via module augmentation.\n *\n * @example\n * declare module '@cossistant/core' {\n * interface RouteRegistry {\n * SETTINGS: { tab: string };\n * }\n * }\n */\nexport interface RouteRegistry extends DefaultRoutes {}\n\n// Build discriminated union from route registry\nexport type NavigationState<\n\tRoutes extends Record<string, unknown> = RouteRegistry,\n> = {\n\t[K in keyof Routes]: Routes[K] extends undefined\n\t\t? { page: K; params?: undefined }\n\t\t: { page: K; params: Routes[K] };\n}[keyof Routes];\n\n// Extract page names as string union\nexport type SupportPage<\n\tRoutes extends Record<string, unknown> = RouteRegistry,\n> = keyof Routes & string;\n\n// Keep backward compatibility\nexport type SUPPORT_PAGES = SupportPage;\n\n// Typed navigation\nexport type SupportNavigation<\n\tRoutes extends Record<string, unknown> = RouteRegistry,\n> = {\n\tpreviousPages: NavigationState<Routes>[];\n\tcurrent: NavigationState<Routes>;\n};\n\nexport type SupportConfig = {\n\tsize: \"normal\" | \"larger\";\n\tisOpen: boolean;\n\tcontent: {\n\t\thome?: {\n\t\t\theader?: string;\n\t\t\tsubheader?: string;\n\t\t\tctaLabel?: string;\n\t\t};\n\t};\n};\n\nexport type SupportStoreState<\n\tRoutes extends Record<string, unknown> = RouteRegistry,\n> = {\n\tnavigation: SupportNavigation<Routes>;\n\tconfig: SupportConfig;\n};\n\nexport type SupportStoreActions<\n\tRoutes extends Record<string, unknown> = RouteRegistry,\n> = {\n\tnavigate(state: NavigationState<Routes>): void;\n\treplace(state: NavigationState<Routes>): void;\n\tgoBack(): void;\n\topen(): void;\n\tclose(): void;\n\ttoggle(): void;\n\tupdateConfig(config: Partial<SupportConfig>): void;\n\treset(): void;\n};\n\nexport type SupportStoreStorage = {\n\tgetItem(key: string): string | null;\n\tsetItem(key: string, value: string): void;\n\tremoveItem(key: string): void;\n};\n\nexport type SupportStoreOptions = {\n\tstorage?: SupportStoreStorage;\n\tstorageKey?: string;\n};\n\nexport type SupportStore<\n\tRoutes extends Record<string, unknown> = RouteRegistry,\n> = Store<SupportStoreState<Routes>> & SupportStoreActions<Routes>;\n\nconst STORAGE_KEY = \"cossistant-support-store\";\n\ntype PersistedConfig = Pick<SupportConfig, \"size\" | \"isOpen\">;\n\ntype PersistedState<Routes extends Record<string, unknown> = RouteRegistry> = {\n\tnavigation?: SupportNavigation<Routes>;\n\tconfig?: PersistedConfig;\n};\n\nfunction createDefaultNavigation<\n\tRoutes extends Record<string, unknown> = RouteRegistry,\n>(): SupportNavigation<Routes> {\n\treturn {\n\t\tcurrent: { page: \"HOME\" } as NavigationState<Routes>,\n\t\tpreviousPages: [],\n\t};\n}\n\nfunction createDefaultConfig(): SupportConfig {\n\treturn {\n\t\tsize: \"normal\",\n\t\tcontent: {},\n\t\tisOpen: false,\n\t};\n}\n\nfunction createDefaultState<\n\tRoutes extends Record<string, unknown> = RouteRegistry,\n>(): SupportStoreState<Routes> {\n\treturn {\n\t\tnavigation: createDefaultNavigation<Routes>(),\n\t\tconfig: createDefaultConfig(),\n\t};\n}\n\nfunction cloneNavigationState<\n\tRoutes extends Record<string, unknown> = RouteRegistry,\n>(state: NavigationState<Routes>): NavigationState<Routes> {\n\t// Type-safe cloning with params if they exist\n\tif (\"params\" in state && state.params !== undefined) {\n\t\treturn {\n\t\t\t...state,\n\t\t\tparams: { ...state.params },\n\t\t} as NavigationState<Routes>;\n\t}\n\treturn { ...state } as NavigationState<Routes>;\n}\n\nfunction parsePersistedState<\n\tRoutes extends Record<string, unknown> = RouteRegistry,\n>(\n\tpersisted: PersistedState<Routes> | null | undefined,\n\tfallback: SupportStoreState<Routes>\n): SupportStoreState<Routes> {\n\tif (!persisted) {\n\t\treturn fallback;\n\t}\n\n\tconst persistedNavigation = persisted.navigation;\n\tconst navigation: SupportNavigation<Routes> = {\n\t\tcurrent: persistedNavigation?.current\n\t\t\t? cloneNavigationState<Routes>(persistedNavigation.current)\n\t\t\t: cloneNavigationState<Routes>(fallback.navigation.current),\n\t\tpreviousPages: (\n\t\t\tpersistedNavigation?.previousPages ?? fallback.navigation.previousPages\n\t\t).map((page) => cloneNavigationState<Routes>(page)),\n\t};\n\n\tconst config: SupportConfig = {\n\t\t...fallback.config,\n\t\t...persisted.config,\n\t};\n\n\treturn {\n\t\tnavigation,\n\t\tconfig,\n\t};\n}\n\nfunction getInitialState<\n\tRoutes extends Record<string, unknown> = RouteRegistry,\n>(options: SupportStoreOptions): SupportStoreState<Routes> {\n\tconst fallback = createDefaultState<Routes>();\n\tconst storage = options.storage;\n\tif (!storage) {\n\t\treturn fallback;\n\t}\n\n\ttry {\n\t\tconst raw = storage.getItem(options.storageKey ?? STORAGE_KEY);\n\t\tif (!raw) {\n\t\t\treturn fallback;\n\t\t}\n\n\t\tconst parsed = JSON.parse(raw) as PersistedState<Routes>;\n\t\treturn parsePersistedState<Routes>(parsed, fallback);\n\t} catch (error) {\n\t\tconsole.warn(\"[SupportStore] Failed to read persisted state\", error);\n\t\treturn fallback;\n\t}\n}\n\nfunction persistState<Routes extends Record<string, unknown> = RouteRegistry>(\n\tstate: SupportStoreState<Routes>,\n\toptions: SupportStoreOptions\n): void {\n\tconst storage = options.storage;\n\tif (!storage) {\n\t\treturn;\n\t}\n\n\tconst data: PersistedState<Routes> = {\n\t\tnavigation: {\n\t\t\tcurrent: state.navigation.current,\n\t\t\tpreviousPages: [...state.navigation.previousPages],\n\t\t},\n\t\tconfig: {\n\t\t\tsize: state.config.size,\n\t\t\tisOpen: state.config.isOpen,\n\t\t},\n\t};\n\n\ttry {\n\t\tstorage.setItem(options.storageKey ?? STORAGE_KEY, JSON.stringify(data));\n\t} catch (error) {\n\t\tconsole.warn(\"[SupportStore] Failed to persist state\", error);\n\t}\n}\n\nexport function createSupportStore<\n\tRoutes extends Record<string, unknown> = RouteRegistry,\n>(options: SupportStoreOptions = {}): SupportStore<Routes> {\n\tconst initialState = getInitialState<Routes>(options);\n\tconst store = createStore<SupportStoreState<Routes>>(initialState);\n\n\tconst commit = (\n\t\tupdater: (state: SupportStoreState<Routes>) => SupportStoreState<Routes>\n\t) => {\n\t\tconst previous = store.getState();\n\t\tstore.setState(updater);\n\t\tconst next = store.getState();\n\t\tif (next !== previous) {\n\t\t\tpersistState(next, options);\n\t\t}\n\t};\n\n\treturn {\n\t\t...store,\n\t\tnavigate(state) {\n\t\t\tcommit((current) => ({\n\t\t\t\tnavigation: {\n\t\t\t\t\tpreviousPages: [\n\t\t\t\t\t\t...current.navigation.previousPages,\n\t\t\t\t\t\tcurrent.navigation.current,\n\t\t\t\t\t],\n\t\t\t\t\tcurrent: state,\n\t\t\t\t},\n\t\t\t\tconfig: current.config,\n\t\t\t}));\n\t\t},\n\t\treplace(state) {\n\t\t\tcommit((current) => ({\n\t\t\t\tnavigation: {\n\t\t\t\t\t...current.navigation,\n\t\t\t\t\tcurrent: state,\n\t\t\t\t},\n\t\t\t\tconfig: current.config,\n\t\t\t}));\n\t\t},\n\t\tgoBack() {\n\t\t\tcommit((current) => {\n\t\t\t\tconst { previousPages } = current.navigation;\n\t\t\t\tif (previousPages.length === 0) {\n\t\t\t\t\treturn current;\n\t\t\t\t}\n\n\t\t\t\tconst nextPrevious = previousPages.slice(0, -1);\n\t\t\t\tconst previous = previousPages.at(-1);\n\n\t\t\t\tif (!previous) {\n\t\t\t\t\treturn current;\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tnavigation: {\n\t\t\t\t\t\tpreviousPages: nextPrevious,\n\t\t\t\t\t\tcurrent: previous,\n\t\t\t\t\t},\n\t\t\t\t\tconfig: current.config,\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t\topen() {\n\t\t\tcommit((current) => ({\n\t\t\t\tnavigation: current.navigation,\n\t\t\t\tconfig: { ...current.config, isOpen: true },\n\t\t\t}));\n\t\t},\n\t\tclose() {\n\t\t\tcommit((current) => ({\n\t\t\t\tnavigation: current.navigation,\n\t\t\t\tconfig: { ...current.config, isOpen: false },\n\t\t\t}));\n\t\t},\n\t\ttoggle() {\n\t\t\tcommit((current) => ({\n\t\t\t\tnavigation: current.navigation,\n\t\t\t\tconfig: { ...current.config, isOpen: !current.config.isOpen },\n\t\t\t}));\n\t\t},\n\t\tupdateConfig(config) {\n\t\t\tcommit((current) => ({\n\t\t\t\tnavigation: current.navigation,\n\t\t\t\tconfig: { ...current.config, ...config },\n\t\t\t}));\n\t\t},\n\t\treset() {\n\t\t\tcommit(() => createDefaultState<Routes>());\n\t\t},\n\t};\n}\n"],"mappings":";;;AAgGA,MAAM,cAAc;AASpB,SAAS,0BAEsB;AAC9B,QAAO;EACN,SAAS,EAAE,MAAM,QAAQ;EACzB,eAAe,EAAE;EACjB;;AAGF,SAAS,sBAAqC;AAC7C,QAAO;EACN,MAAM;EACN,SAAS,EAAE;EACX,QAAQ;EACR;;AAGF,SAAS,qBAEsB;AAC9B,QAAO;EACN,YAAY,yBAAiC;EAC7C,QAAQ,qBAAqB;EAC7B;;AAGF,SAAS,qBAEP,OAAyD;AAE1D,KAAI,YAAY,SAAS,MAAM,WAAW,OACzC,QAAO;E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,gBAAa,oBAA4B,CAAC;;EAE3C"}
|
package/timeline-item.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ declare const timelineItemSchema: ZodObject<{
|
|
|
15
15
|
private: "private";
|
|
16
16
|
}>;
|
|
17
17
|
type: ZodEnum<{
|
|
18
|
-
message: "message";
|
|
19
18
|
event: "event";
|
|
19
|
+
message: "message";
|
|
20
20
|
identification: "identification";
|
|
21
21
|
}>;
|
|
22
22
|
text: ZodNullable<ZodString>;
|
|
@@ -27,7 +27,6 @@ declare const timelineItemSchema: ZodObject<{
|
|
|
27
27
|
}, $strip>, ZodObject<{
|
|
28
28
|
type: ZodLiteral<"event">;
|
|
29
29
|
eventType: ZodEnum<{
|
|
30
|
-
resolved: "resolved";
|
|
31
30
|
assigned: "assigned";
|
|
32
31
|
unassigned: "unassigned";
|
|
33
32
|
participant_requested: "participant_requested";
|
|
@@ -37,6 +36,7 @@ declare const timelineItemSchema: ZodObject<{
|
|
|
37
36
|
priority_changed: "priority_changed";
|
|
38
37
|
tag_added: "tag_added";
|
|
39
38
|
tag_removed: "tag_removed";
|
|
39
|
+
resolved: "resolved";
|
|
40
40
|
reopened: "reopened";
|
|
41
41
|
visitor_blocked: "visitor_blocked";
|
|
42
42
|
visitor_unblocked: "visitor_unblocked";
|
|
@@ -85,8 +85,8 @@ declare const getConversationTimelineItemsResponseSchema: ZodObject<{
|
|
|
85
85
|
private: "private";
|
|
86
86
|
}>;
|
|
87
87
|
type: ZodEnum<{
|
|
88
|
-
message: "message";
|
|
89
88
|
event: "event";
|
|
89
|
+
message: "message";
|
|
90
90
|
identification: "identification";
|
|
91
91
|
}>;
|
|
92
92
|
text: ZodNullable<ZodString>;
|
|
@@ -97,7 +97,6 @@ declare const getConversationTimelineItemsResponseSchema: ZodObject<{
|
|
|
97
97
|
}, $strip>, ZodObject<{
|
|
98
98
|
type: ZodLiteral<"event">;
|
|
99
99
|
eventType: ZodEnum<{
|
|
100
|
-
resolved: "resolved";
|
|
101
100
|
assigned: "assigned";
|
|
102
101
|
unassigned: "unassigned";
|
|
103
102
|
participant_requested: "participant_requested";
|
|
@@ -107,6 +106,7 @@ declare const getConversationTimelineItemsResponseSchema: ZodObject<{
|
|
|
107
106
|
priority_changed: "priority_changed";
|
|
108
107
|
tag_added: "tag_added";
|
|
109
108
|
tag_removed: "tag_removed";
|
|
109
|
+
resolved: "resolved";
|
|
110
110
|
reopened: "reopened";
|
|
111
111
|
visitor_blocked: "visitor_blocked";
|
|
112
112
|
visitor_unblocked: "visitor_unblocked";
|
|
@@ -147,8 +147,8 @@ declare const sendTimelineItemRequestSchema: ZodObject<{
|
|
|
147
147
|
item: ZodObject<{
|
|
148
148
|
id: ZodOptional<ZodString>;
|
|
149
149
|
type: ZodDefault<ZodEnum<{
|
|
150
|
-
message: "message";
|
|
151
150
|
event: "event";
|
|
151
|
+
message: "message";
|
|
152
152
|
}>>;
|
|
153
153
|
text: ZodString;
|
|
154
154
|
parts: ZodOptional<ZodArray<ZodUnion<readonly [ZodObject<{
|
|
@@ -157,7 +157,6 @@ declare const sendTimelineItemRequestSchema: ZodObject<{
|
|
|
157
157
|
}, $strip>, ZodObject<{
|
|
158
158
|
type: ZodLiteral<"event">;
|
|
159
159
|
eventType: ZodEnum<{
|
|
160
|
-
resolved: "resolved";
|
|
161
160
|
assigned: "assigned";
|
|
162
161
|
unassigned: "unassigned";
|
|
163
162
|
participant_requested: "participant_requested";
|
|
@@ -167,6 +166,7 @@ declare const sendTimelineItemRequestSchema: ZodObject<{
|
|
|
167
166
|
priority_changed: "priority_changed";
|
|
168
167
|
tag_added: "tag_added";
|
|
169
168
|
tag_removed: "tag_removed";
|
|
169
|
+
resolved: "resolved";
|
|
170
170
|
reopened: "reopened";
|
|
171
171
|
visitor_blocked: "visitor_blocked";
|
|
172
172
|
visitor_unblocked: "visitor_unblocked";
|
|
@@ -214,8 +214,8 @@ declare const sendTimelineItemResponseSchema: ZodObject<{
|
|
|
214
214
|
private: "private";
|
|
215
215
|
}>;
|
|
216
216
|
type: ZodEnum<{
|
|
217
|
-
message: "message";
|
|
218
217
|
event: "event";
|
|
218
|
+
message: "message";
|
|
219
219
|
identification: "identification";
|
|
220
220
|
}>;
|
|
221
221
|
text: ZodNullable<ZodString>;
|
|
@@ -226,7 +226,6 @@ declare const sendTimelineItemResponseSchema: ZodObject<{
|
|
|
226
226
|
}, $strip>, ZodObject<{
|
|
227
227
|
type: ZodLiteral<"event">;
|
|
228
228
|
eventType: ZodEnum<{
|
|
229
|
-
resolved: "resolved";
|
|
230
229
|
assigned: "assigned";
|
|
231
230
|
unassigned: "unassigned";
|
|
232
231
|
participant_requested: "participant_requested";
|
|
@@ -236,6 +235,7 @@ declare const sendTimelineItemResponseSchema: ZodObject<{
|
|
|
236
235
|
priority_changed: "priority_changed";
|
|
237
236
|
tag_added: "tag_added";
|
|
238
237
|
tag_removed: "tag_removed";
|
|
238
|
+
resolved: "resolved";
|
|
239
239
|
reopened: "reopened";
|
|
240
240
|
visitor_blocked: "visitor_blocked";
|
|
241
241
|
visitor_unblocked: "visitor_unblocked";
|
package/timeline-item.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline-item.d.ts","names":[],"sources":["../../types/src/api/timeline-item.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAgMY,cA9EC,kBA8ED,EA9EmB,SA8EgB,CAAA;EAIlC,EAAA,aAAA,UAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA9BD,kBAAA,GAAqB,cAAe;KAEpC,YAAA,GAAe,cAAe;cAS7B,2CAAyC;;;;AAmBC,KAJ3C,mCAAA,GAAsC,MAIK,CAAA,OAH/C,yCAG+C,CAAA;AAAA,cAA1C,0CAA0C,EAAA,SAAA,CAAA;EAiB3C,KAAA,UAAA,UAAA,CAAA;IAKC,EAAA,aAAA,UAkDV,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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