@opencx/widget 2.5.1 → 2.6.1

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.
Files changed (108) hide show
  1. package/dist/api-BwKgAJ6p.cjs +2 -0
  2. package/dist/api-BwKgAJ6p.cjs.map +1 -0
  3. package/dist/api-DRZ9vPwy.js +1360 -0
  4. package/dist/api-DRZ9vPwy.js.map +1 -0
  5. package/dist/basic.cjs +85 -85
  6. package/dist/basic.cjs.map +1 -1
  7. package/dist/basic.js +13350 -12831
  8. package/dist/basic.js.map +1 -1
  9. package/dist/core/client/api.d.ts +368 -40
  10. package/dist/core/client/chat.d.ts +55 -12
  11. package/dist/core/client/config.d.ts +13 -3
  12. package/dist/core/client/contact.d.ts +3 -13
  13. package/dist/core/errors/index.d.ts +6 -0
  14. package/dist/core/platform/audio.d.ts +38 -0
  15. package/dist/core/platform/index.d.ts +6 -2
  16. package/dist/core/platform/storage.d.ts +8 -2
  17. package/dist/core/sdk/index.d.ts +11 -0
  18. package/dist/core/tests/platform/logger.test.d.ts +1 -0
  19. package/dist/core/tests/platform/storage.test.d.ts +1 -0
  20. package/dist/core/tests/test-utils.d.ts +2 -0
  21. package/dist/core/tests/types/pub-sub.test.d.ts +1 -0
  22. package/dist/core/types/helpers.d.ts +5 -2
  23. package/dist/core/types/index.d.ts +6 -6
  24. package/dist/core/types/messages.d.ts +20 -9
  25. package/dist/core/types/pub-sub.d.ts +1 -0
  26. package/dist/core/types/schemas-v2.d.ts +10 -710
  27. package/dist/index-B5YLfjom.cjs +18 -0
  28. package/dist/index-B5YLfjom.cjs.map +1 -0
  29. package/dist/index-EZN9_jan.js +1219 -0
  30. package/dist/index-EZN9_jan.js.map +1 -0
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.js +22 -874
  34. package/dist/index.js.map +1 -1
  35. package/dist/react-web/core-integration/ChatProvider.d.ts +101 -0
  36. package/dist/react-web/core-integration/components.d.ts +11 -0
  37. package/dist/react-web/core-integration/hooks/useChatMessages.d.ts +64 -0
  38. package/dist/react-web/core-integration/hooks/useChatSession.d.ts +77 -0
  39. package/dist/react-web/core-integration/hooks/useConfig.d.ts +1 -0
  40. package/dist/react-web/core-integration/hooks/useContact.d.ts +11 -0
  41. package/dist/react-web/core-integration/hooks/useLocale.d.ts +4 -0
  42. package/dist/react-web/core-integration/hooks/usePreludeData.d.ts +36 -0
  43. package/dist/react-web/core-integration/hooks/usePubsub.d.ts +2 -0
  44. package/dist/react-web/{hooks → core-integration/hooks}/useUploadFiles.d.ts +2 -2
  45. package/dist/react-web/{hooks → core-integration/hooks}/useVote.d.ts +2 -2
  46. package/dist/react-web/core-integration/hooks.d.ts +9 -0
  47. package/dist/react-web/core-integration/index.d.ts +2 -0
  48. package/dist/react-web/index.d.ts +4 -10
  49. package/dist/react-web/types/components.d.ts +6 -3
  50. package/dist/react-web/types/index.d.ts +3 -2
  51. package/dist/react-web/types/options.d.ts +4 -30
  52. package/dist/react.cjs +1 -1
  53. package/dist/react.cjs.map +1 -1
  54. package/dist/react.js +10 -46
  55. package/dist/react.js.map +1 -1
  56. package/dist/src/@components/BotOrAgentMessageGroup.d.ts +1 -2
  57. package/dist/src/@components/BotOrAgentMessageWrapper.d.ts +2 -2
  58. package/dist/src/@components/ChatEvent.component.d.ts +3 -3
  59. package/dist/src/@components/Text.component.d.ts +1 -1
  60. package/dist/src/components/button.d.ts +1 -1
  61. package/dist/src/components/dialog.d.ts +9 -9
  62. package/dist/src/designs/basic/index.d.ts +1 -1
  63. package/dist/style.css +1 -1
  64. package/dist-embed/script.js +119 -124
  65. package/dist-embed/script.js.map +1 -1
  66. package/package.json +8 -4
  67. package/dist/core/types/schemas.d.ts +0 -543
  68. package/dist/core/utils/create-fetch.d.ts +0 -24
  69. package/dist/core/utils/genId.d.ts +0 -2
  70. package/dist/core/utils/history-to-widget-messages.d.ts +0 -4
  71. package/dist/genUuid-BkZtn1k9.cjs +0 -2
  72. package/dist/genUuid-BkZtn1k9.cjs.map +0 -1
  73. package/dist/genUuid-CDpI3ugS.js +0 -136
  74. package/dist/genUuid-CDpI3ugS.js.map +0 -1
  75. package/dist/index-1bY4_hBw.cjs +0 -18
  76. package/dist/index-1bY4_hBw.cjs.map +0 -1
  77. package/dist/index-D84Xc70r.js +0 -2609
  78. package/dist/index-D84Xc70r.js.map +0 -1
  79. package/dist/package.json.d.ts +0 -157
  80. package/dist/react-web/Root.d.ts +0 -6
  81. package/dist/react-web/hooks/index.d.ts +0 -6
  82. package/dist/react-web/hooks/use-sound.d.ts +0 -13
  83. package/dist/react-web/hooks/useAbstractChat.d.ts +0 -157
  84. package/dist/react-web/hooks/useAxiosInstance.d.ts +0 -190
  85. package/dist/react-web/hooks/useSyncState.d.ts +0 -4
  86. package/dist/react-web/hooks/useTimeoutState.d.ts +0 -3
  87. package/dist/react-web/providers/ChatProvider.d.ts +0 -143
  88. package/dist/react-web/providers/ConfigDataProvider.d.ts +0 -62
  89. package/dist/react-web/providers/ContactProvider.d.ts +0 -58
  90. package/dist/react-web/providers/LocalesProvider.d.ts +0 -11
  91. package/dist/react-web/providers/componentRegistry.d.ts +0 -13
  92. package/dist/react-web/providers/use-widget-sfx.d.ts +0 -7
  93. package/dist/react-web/providers/usePreludeData.d.ts +0 -2
  94. package/dist/react-web/utils/debug.d.ts +0 -2
  95. package/dist/react-web/utils/getters.d.ts +0 -24
  96. package/dist/react-web/utils/index.d.ts +0 -1
  97. package/dist/src/hooks/useShouldCollectData.d.ts +0 -3
  98. /package/dist/core/{utils/genId.test.d.ts → tests/client/integration-perisitance.test.d.ts} +0 -0
  99. /package/dist/{react-web/hooks/use-sound.test.d.ts → core/tests/client/integration.test.d.ts} +0 -0
  100. /package/dist/{react-web/hooks/use-sync-state.test.d.ts → core/tests/platform/audio.test.d.ts} +0 -0
  101. /package/dist/react-web/{locales → core-integration/locales}/ar.locale.d.ts +0 -0
  102. /package/dist/react-web/{locales → core-integration/locales}/de.locale.d.ts +0 -0
  103. /package/dist/react-web/{locales → core-integration/locales}/en.locale.d.ts +0 -0
  104. /package/dist/react-web/{locales → core-integration/locales}/fr.locale.d.ts +0 -0
  105. /package/dist/react-web/{locales → core-integration/locales}/helper.d.ts +0 -0
  106. /package/dist/react-web/{locales → core-integration/locales}/index.d.ts +0 -0
  107. /package/dist/react-web/{locales → core-integration/locales}/nl.locale.d.ts +0 -0
  108. /package/dist/react-web/{locales → core-integration/locales}/pt.locale.d.ts +0 -0
@@ -1,62 +0,0 @@
1
- import { default as React, ReactNode } from 'react';
2
- import { WidgetOptions, WidgetThemeOptions } from '../types';
3
- import { useAxiosInstance } from '../hooks';
4
- import { ComponentRegistry } from './componentRegistry';
5
- declare function useNormalizeOptions(data: WidgetOptions): {
6
- bot: {
7
- id: string | null;
8
- name: string;
9
- is_ai: boolean;
10
- profile_picture?: string | null | undefined;
11
- };
12
- apiUrl: string;
13
- socketUrl: string;
14
- language: "en" | "ar" | "nl" | "fr" | "de" | "pt";
15
- botToken: string;
16
- headers: Record<string, string>;
17
- pathParams: Record<string, string>;
18
- queryParams: Record<string, string>;
19
- user: import('../types').UserObject;
20
- theme: WidgetThemeOptions & Partial<WidgetThemeOptions>;
21
- soundEffectFiles: {
22
- messageArrived: string;
23
- };
24
- collectUserData: boolean;
25
- defaultSettings: {
26
- persistSession: boolean;
27
- useSoundEffects: boolean;
28
- };
29
- token: string;
30
- initialMessages: string[];
31
- settings?: {
32
- persistSession?: boolean;
33
- useSoundEffects?: boolean;
34
- };
35
- debug?: boolean;
36
- assets?: {
37
- organizationLogo?: string;
38
- };
39
- components?: import('../types').ComponentType[];
40
- };
41
- export type NormalizedWidgetOptions = ReturnType<typeof useNormalizeOptions>;
42
- type WidgetSettings = {
43
- persistSession: boolean;
44
- useSoundEffects: boolean;
45
- };
46
- interface ConfigData extends ReturnType<typeof useNormalizeOptions> {
47
- http: ReturnType<typeof useAxiosInstance>;
48
- botToken: string;
49
- componentStore: ComponentRegistry;
50
- widgetSettings: WidgetSettings | null;
51
- setSettings: (settings: Partial<WidgetSettings>) => void;
52
- defaultSettings: WidgetSettings;
53
- soundEffectFiles: {
54
- messageArrived: string;
55
- };
56
- }
57
- declare const useConfigData: () => ConfigData;
58
- export declare function ConfigDataProvider({ children, data, }: {
59
- data: WidgetOptions;
60
- children: ReactNode;
61
- }): React.JSX.Element;
62
- export { useConfigData };
@@ -1,58 +0,0 @@
1
- import { default as React, ReactNode } from 'react';
2
- import { UserObject } from '../types';
3
- declare const useContact: () => {
4
- creatingContactState: {
5
- loading: boolean;
6
- error?: undefined;
7
- value?: undefined;
8
- } | {
9
- loading: false;
10
- error: Error;
11
- value?: undefined;
12
- } | {
13
- loading: true;
14
- error?: Error | undefined;
15
- value?: {
16
- id: string;
17
- name: string | null;
18
- email: string | null;
19
- avatar_url: string | null;
20
- created_at: string;
21
- } | null | undefined;
22
- } | {
23
- loading: false;
24
- error?: undefined;
25
- value: {
26
- id: string;
27
- name: string | null;
28
- email: string | null;
29
- avatar_url: string | null;
30
- created_at: string;
31
- } | null;
32
- };
33
- createContactAsync: (user: UserObject) => Promise<{
34
- id: string;
35
- name: string | null;
36
- email: string | null;
37
- avatar_url: string | null;
38
- created_at: string;
39
- } | null>;
40
- contact: {
41
- id: string;
42
- name: string | null;
43
- email: string | null;
44
- avatar_url: string | null;
45
- created_at: string;
46
- } | null;
47
- shouldCollectData: {
48
- should: boolean;
49
- reason: string;
50
- } | {
51
- should: boolean;
52
- reason?: undefined;
53
- };
54
- };
55
- declare function ContactProvider({ children }: {
56
- children: ReactNode;
57
- }): React.JSX.Element;
58
- export { ContactProvider, useContact };
@@ -1,11 +0,0 @@
1
- import { LangType } from '../locales';
2
- import { TranslationKeysType } from '@react/locales/en.locale';
3
- import { default as React } from 'react';
4
- declare const useLocale: () => {
5
- get: (key: TranslationKeysType, pfx?: string) => string;
6
- lang: LangType;
7
- };
8
- declare function LocaleProvider({ children }: {
9
- children: React.ReactNode;
10
- }): React.JSX.Element;
11
- export { LocaleProvider, useLocale };
@@ -1,13 +0,0 @@
1
- import { ComponentType, OptionsType } from '../types';
2
- /**
3
- * this a singleton class helps me to easily control the components present/available in the widget.
4
- * it also manages the various types of components to be added along the way.
5
- */
6
- export declare class ComponentRegistry {
7
- components: ComponentType[];
8
- constructor(opts: OptionsType);
9
- register(com: ComponentType): this;
10
- private get;
11
- private getOrFallback;
12
- getComponent(key: string, getFallback?: boolean): import('react').ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
13
- }
@@ -1,7 +0,0 @@
1
- declare function useWidgetSoundEffects(): {
2
- messageArrivedSound: {
3
- play: () => void;
4
- stop: () => void;
5
- };
6
- };
7
- export { useWidgetSoundEffects };
@@ -1,2 +0,0 @@
1
- declare function usePreludeData(): import('swr').SWRResponse<import('../../core/types/prelude').PreludeData | undefined, any, any>;
2
- export { usePreludeData };
@@ -1,2 +0,0 @@
1
- declare function debug(...args: unknown[]): void;
2
- export { debug };
@@ -1,24 +0,0 @@
1
- import { ChatHistoryMessageType } from '@core/types/schemas';
2
- interface DayOfficeHours {
3
- from: string;
4
- to: string;
5
- }
6
- export declare const workingDays: readonly ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday", "WeekDays", "Everyday"];
7
- export type PreludeData = {
8
- initial_questions: string[];
9
- ai_enabled: boolean;
10
- office_hours: WorkingHours;
11
- office_hours_timezone: string;
12
- organization_name: string;
13
- };
14
- type Day = (typeof workingDays)[number];
15
- export type WorkingHours = {
16
- [K in Day]: DayOfficeHours;
17
- };
18
- export type InitialData = {
19
- logo: string;
20
- faq: [];
21
- initial_questions: string[];
22
- history: ChatHistoryMessageType[];
23
- };
24
- export {};
@@ -1 +0,0 @@
1
- export * from './getters';
@@ -1,3 +0,0 @@
1
- export declare function useShouldCollectUserData(): {
2
- shouldCollectDataFirst: boolean;
3
- };