@opencx/widget 2.6.0 → 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 (99) 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 +27 -19
  11. package/dist/core/client/config.d.ts +13 -3
  12. package/dist/core/client/contact.d.ts +2 -12
  13. package/dist/core/sdk/index.d.ts +11 -0
  14. package/dist/core/types/helpers.d.ts +3 -0
  15. package/dist/core/types/index.d.ts +6 -6
  16. package/dist/core/types/messages.d.ts +20 -9
  17. package/dist/core/types/schemas-v2.d.ts +10 -713
  18. package/dist/index-B5YLfjom.cjs +18 -0
  19. package/dist/index-B5YLfjom.cjs.map +1 -0
  20. package/dist/index-EZN9_jan.js +1219 -0
  21. package/dist/index-EZN9_jan.js.map +1 -0
  22. package/dist/index.cjs +1 -1
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.js +22 -1071
  25. package/dist/index.js.map +1 -1
  26. package/dist/react-web/core-integration/ChatProvider.d.ts +101 -0
  27. package/dist/react-web/core-integration/components.d.ts +11 -0
  28. package/dist/react-web/core-integration/hooks/useChatMessages.d.ts +64 -0
  29. package/dist/react-web/core-integration/hooks/useChatSession.d.ts +77 -0
  30. package/dist/react-web/core-integration/hooks/useConfig.d.ts +1 -0
  31. package/dist/react-web/core-integration/hooks/useContact.d.ts +11 -0
  32. package/dist/react-web/core-integration/hooks/useLocale.d.ts +4 -0
  33. package/dist/react-web/core-integration/hooks/usePreludeData.d.ts +36 -0
  34. package/dist/react-web/core-integration/hooks/usePubsub.d.ts +2 -0
  35. package/dist/react-web/{hooks → core-integration/hooks}/useUploadFiles.d.ts +2 -2
  36. package/dist/react-web/{hooks → core-integration/hooks}/useVote.d.ts +2 -2
  37. package/dist/react-web/core-integration/hooks.d.ts +9 -0
  38. package/dist/react-web/core-integration/index.d.ts +2 -0
  39. package/dist/react-web/index.d.ts +4 -10
  40. package/dist/react-web/types/components.d.ts +6 -3
  41. package/dist/react-web/types/index.d.ts +3 -2
  42. package/dist/react-web/types/options.d.ts +4 -30
  43. package/dist/react.cjs +1 -1
  44. package/dist/react.cjs.map +1 -1
  45. package/dist/react.js +10 -46
  46. package/dist/react.js.map +1 -1
  47. package/dist/src/@components/BotOrAgentMessageGroup.d.ts +1 -2
  48. package/dist/src/@components/BotOrAgentMessageWrapper.d.ts +2 -2
  49. package/dist/src/@components/ChatEvent.component.d.ts +3 -3
  50. package/dist/src/@components/Text.component.d.ts +1 -1
  51. package/dist/src/components/button.d.ts +1 -1
  52. package/dist/src/components/dialog.d.ts +9 -9
  53. package/dist/src/designs/basic/index.d.ts +1 -1
  54. package/dist/style.css +1 -1
  55. package/dist-embed/script.js +119 -124
  56. package/dist-embed/script.js.map +1 -1
  57. package/package.json +7 -4
  58. package/dist/core/tests/utils/create-fetch.test.d.ts +0 -1
  59. package/dist/core/types/schemas.d.ts +0 -543
  60. package/dist/core/utils/create-fetch.d.ts +0 -25
  61. package/dist/core/utils/genId.d.ts +0 -2
  62. package/dist/core/utils/history-to-widget-messages.d.ts +0 -4
  63. package/dist/genUuid-C12yFv3j.js +0 -137
  64. package/dist/genUuid-C12yFv3j.js.map +0 -1
  65. package/dist/genUuid-DdeSE04H.cjs +0 -2
  66. package/dist/genUuid-DdeSE04H.cjs.map +0 -1
  67. package/dist/index-C87obATS.js +0 -2616
  68. package/dist/index-C87obATS.js.map +0 -1
  69. package/dist/index-ChwS_h0D.cjs +0 -18
  70. package/dist/index-ChwS_h0D.cjs.map +0 -1
  71. package/dist/package.json.d.ts +0 -158
  72. package/dist/react-web/Root.d.ts +0 -6
  73. package/dist/react-web/hooks/index.d.ts +0 -6
  74. package/dist/react-web/hooks/use-sound.d.ts +0 -13
  75. package/dist/react-web/hooks/use-sound.test.d.ts +0 -1
  76. package/dist/react-web/hooks/use-sync-state.test.d.ts +0 -1
  77. package/dist/react-web/hooks/useAbstractChat.d.ts +0 -157
  78. package/dist/react-web/hooks/useAxiosInstance.d.ts +0 -190
  79. package/dist/react-web/hooks/useSyncState.d.ts +0 -4
  80. package/dist/react-web/hooks/useTimeoutState.d.ts +0 -3
  81. package/dist/react-web/providers/ChatProvider.d.ts +0 -143
  82. package/dist/react-web/providers/ConfigDataProvider.d.ts +0 -62
  83. package/dist/react-web/providers/ContactProvider.d.ts +0 -58
  84. package/dist/react-web/providers/LocalesProvider.d.ts +0 -11
  85. package/dist/react-web/providers/componentRegistry.d.ts +0 -13
  86. package/dist/react-web/providers/use-widget-sfx.d.ts +0 -7
  87. package/dist/react-web/providers/usePreludeData.d.ts +0 -2
  88. package/dist/react-web/utils/debug.d.ts +0 -2
  89. package/dist/react-web/utils/getters.d.ts +0 -24
  90. package/dist/react-web/utils/index.d.ts +0 -1
  91. package/dist/src/hooks/useShouldCollectData.d.ts +0 -3
  92. /package/dist/react-web/{locales → core-integration/locales}/ar.locale.d.ts +0 -0
  93. /package/dist/react-web/{locales → core-integration/locales}/de.locale.d.ts +0 -0
  94. /package/dist/react-web/{locales → core-integration/locales}/en.locale.d.ts +0 -0
  95. /package/dist/react-web/{locales → core-integration/locales}/fr.locale.d.ts +0 -0
  96. /package/dist/react-web/{locales → core-integration/locales}/helper.d.ts +0 -0
  97. /package/dist/react-web/{locales → core-integration/locales}/index.d.ts +0 -0
  98. /package/dist/react-web/{locales → core-integration/locales}/nl.locale.d.ts +0 -0
  99. /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
- };