@novu/react 3.15.0 → 3.16.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/dist/cjs/components/NovuUI.cjs.map +1 -1
- package/dist/cjs/components/NovuUI.d.cts +2 -2
- package/dist/cjs/components/connect-chat/ConnectChat.cjs +63 -0
- package/dist/cjs/components/connect-chat/ConnectChat.cjs.map +1 -0
- package/dist/cjs/components/connect-chat/ConnectChat.d.cts +12 -0
- package/dist/cjs/components/connect-chat/DefaultConnectChat.cjs +83 -0
- package/dist/cjs/components/connect-chat/DefaultConnectChat.cjs.map +1 -0
- package/dist/cjs/components/connect-chat/DefaultConnectChat.d.cts +7 -0
- package/dist/cjs/components/index.cjs +4 -0
- package/dist/cjs/components/index.cjs.map +1 -1
- package/dist/cjs/components/index.d.cts +5 -1
- package/dist/cjs/components/slack-connect-button/DefaultSlackConnectButton.cjs +89 -0
- package/dist/cjs/components/slack-connect-button/DefaultSlackConnectButton.cjs.map +1 -0
- package/dist/cjs/components/slack-connect-button/DefaultSlackConnectButton.d.cts +7 -0
- package/dist/cjs/components/slack-connect-button/SlackConnectButton.cjs +63 -0
- package/dist/cjs/components/slack-connect-button/SlackConnectButton.cjs.map +1 -0
- package/dist/cjs/components/slack-connect-button/SlackConnectButton.d.cts +12 -0
- package/dist/cjs/components/slack-link-user/DefaultSlackLinkUser.cjs +80 -0
- package/dist/cjs/components/slack-link-user/DefaultSlackLinkUser.cjs.map +1 -0
- package/dist/cjs/components/slack-link-user/DefaultSlackLinkUser.d.cts +7 -0
- package/dist/cjs/components/slack-link-user/SlackLinkUser.cjs +63 -0
- package/dist/cjs/components/slack-link-user/SlackLinkUser.cjs.map +1 -0
- package/dist/cjs/components/slack-link-user/SlackLinkUser.d.cts +12 -0
- package/dist/cjs/hooks/NovuProvider.cjs +34 -22
- package/dist/cjs/hooks/NovuProvider.cjs.map +1 -1
- package/dist/cjs/hooks/NovuProvider.d.cts +13 -2
- package/dist/cjs/hooks/index.cjs +10 -0
- package/dist/cjs/hooks/index.cjs.map +1 -1
- package/dist/cjs/hooks/index.d.cts +5 -0
- package/dist/cjs/hooks/internal/useBrowserTabsChannel.cjs +5 -2
- package/dist/cjs/hooks/internal/useBrowserTabsChannel.cjs.map +1 -1
- package/dist/cjs/hooks/internal/useBrowserTabsChannel.d.cts +2 -1
- package/dist/cjs/hooks/internal/useWebsocketEvent.cjs +6 -3
- package/dist/cjs/hooks/internal/useWebsocketEvent.cjs.map +1 -1
- package/dist/cjs/hooks/internal/useWebsocketEvent.d.cts +2 -1
- package/dist/cjs/hooks/useChannelConnection.cjs +107 -0
- package/dist/cjs/hooks/useChannelConnection.cjs.map +1 -0
- package/dist/cjs/hooks/useChannelConnection.d.cts +20 -0
- package/dist/cjs/hooks/useChannelConnections.cjs +85 -0
- package/dist/cjs/hooks/useChannelConnections.cjs.map +1 -0
- package/dist/cjs/hooks/useChannelConnections.d.cts +24 -0
- package/dist/cjs/hooks/useChannelEndpoint.cjs +110 -0
- package/dist/cjs/hooks/useChannelEndpoint.cjs.map +1 -0
- package/dist/cjs/hooks/useChannelEndpoint.d.cts +20 -0
- package/dist/cjs/hooks/useCounts.cjs +5 -1
- package/dist/cjs/hooks/useCounts.cjs.map +1 -1
- package/dist/cjs/hooks/useCounts.d.cts +18 -0
- package/dist/cjs/hooks/useCreateChannelEndpoint.cjs +61 -0
- package/dist/cjs/hooks/useCreateChannelEndpoint.cjs.map +1 -0
- package/dist/cjs/hooks/useCreateChannelEndpoint.d.cts +17 -0
- package/dist/cjs/hooks/useDeleteChannelEndpoint.cjs +69 -0
- package/dist/cjs/hooks/useDeleteChannelEndpoint.cjs.map +1 -0
- package/dist/cjs/hooks/useDeleteChannelEndpoint.d.cts +17 -0
- package/dist/cjs/hooks/useNotifications.cjs +4 -0
- package/dist/cjs/hooks/useNotifications.cjs.map +1 -1
- package/dist/cjs/hooks/useNotifications.d.cts +18 -0
- package/dist/cjs/index.cjs +14 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +11 -2
- package/dist/cjs/internal/index.d.cts +1 -0
- package/dist/cjs/themes/index.d.cts +0 -1
- package/dist/cjs/utils/appearance.cjs.map +1 -1
- package/dist/cjs/utils/appearance.d.cts +2 -2
- package/dist/cjs/utils/types.d.cts +1 -1
- package/dist/esm/components/NovuUI.d.ts +2 -2
- package/dist/esm/components/NovuUI.js.map +1 -1
- package/dist/esm/components/connect-chat/ConnectChat.d.ts +12 -0
- package/dist/esm/components/connect-chat/ConnectChat.js +28 -0
- package/dist/esm/components/connect-chat/ConnectChat.js.map +1 -0
- package/dist/esm/components/connect-chat/DefaultConnectChat.d.ts +7 -0
- package/dist/esm/components/connect-chat/DefaultConnectChat.js +58 -0
- package/dist/esm/components/connect-chat/DefaultConnectChat.js.map +1 -0
- package/dist/esm/components/index.d.ts +5 -1
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/components/slack-connect-button/DefaultSlackConnectButton.d.ts +7 -0
- package/dist/esm/components/slack-connect-button/DefaultSlackConnectButton.js +64 -0
- package/dist/esm/components/slack-connect-button/DefaultSlackConnectButton.js.map +1 -0
- package/dist/esm/components/slack-connect-button/SlackConnectButton.d.ts +12 -0
- package/dist/esm/components/slack-connect-button/SlackConnectButton.js +28 -0
- package/dist/esm/components/slack-connect-button/SlackConnectButton.js.map +1 -0
- package/dist/esm/components/slack-link-user/DefaultSlackLinkUser.d.ts +7 -0
- package/dist/esm/components/slack-link-user/DefaultSlackLinkUser.js +55 -0
- package/dist/esm/components/slack-link-user/DefaultSlackLinkUser.js.map +1 -0
- package/dist/esm/components/slack-link-user/SlackLinkUser.d.ts +12 -0
- package/dist/esm/components/slack-link-user/SlackLinkUser.js +28 -0
- package/dist/esm/components/slack-link-user/SlackLinkUser.js.map +1 -0
- package/dist/esm/hooks/NovuProvider.d.ts +13 -2
- package/dist/esm/hooks/NovuProvider.js +33 -22
- package/dist/esm/hooks/NovuProvider.js.map +1 -1
- package/dist/esm/hooks/index.d.ts +5 -0
- package/dist/esm/hooks/index.js +5 -0
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/internal/useBrowserTabsChannel.d.ts +2 -1
- package/dist/esm/hooks/internal/useBrowserTabsChannel.js +5 -2
- package/dist/esm/hooks/internal/useBrowserTabsChannel.js.map +1 -1
- package/dist/esm/hooks/internal/useWebsocketEvent.d.ts +2 -1
- package/dist/esm/hooks/internal/useWebsocketEvent.js +6 -3
- package/dist/esm/hooks/internal/useWebsocketEvent.js.map +1 -1
- package/dist/esm/hooks/useChannelConnection.d.ts +20 -0
- package/dist/esm/hooks/useChannelConnection.js +81 -0
- package/dist/esm/hooks/useChannelConnection.js.map +1 -0
- package/dist/esm/hooks/useChannelConnections.d.ts +24 -0
- package/dist/esm/hooks/useChannelConnections.js +60 -0
- package/dist/esm/hooks/useChannelConnections.js.map +1 -0
- package/dist/esm/hooks/useChannelEndpoint.d.ts +20 -0
- package/dist/esm/hooks/useChannelEndpoint.js +83 -0
- package/dist/esm/hooks/useChannelEndpoint.js.map +1 -0
- package/dist/esm/hooks/useCounts.d.ts +18 -0
- package/dist/esm/hooks/useCounts.js +6 -2
- package/dist/esm/hooks/useCounts.js.map +1 -1
- package/dist/esm/hooks/useCreateChannelEndpoint.d.ts +17 -0
- package/dist/esm/hooks/useCreateChannelEndpoint.js +36 -0
- package/dist/esm/hooks/useCreateChannelEndpoint.js.map +1 -0
- package/dist/esm/hooks/useDeleteChannelEndpoint.d.ts +17 -0
- package/dist/esm/hooks/useDeleteChannelEndpoint.js +43 -0
- package/dist/esm/hooks/useDeleteChannelEndpoint.js.map +1 -0
- package/dist/esm/hooks/useNotifications.d.ts +18 -0
- package/dist/esm/hooks/useNotifications.js +5 -1
- package/dist/esm/hooks/useNotifications.js.map +1 -1
- package/dist/esm/index.d.ts +11 -2
- package/dist/esm/index.js +14 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/appearance.d.ts +2 -2
- package/dist/esm/utils/appearance.js.map +1 -1
- package/dist/esm/utils/types.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/appearance.ts"],"sourcesContent":["import type { AllAppearance, AllIconKey, AllIconOverrides } from '@novu/js/ui';\nimport { MountedElement } from '../context/RendererContext';\nimport type { ReactIconRenderer, ReactInboxAppearance, ReactSubscriptionAppearance } from './types';\n\nexport function adaptAppearanceForJs(\n appearance: ReactInboxAppearance | ReactSubscriptionAppearance,\n mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void\n): AllAppearance | undefined {\n if (!appearance) {\n return undefined;\n }\n const { icons, ...restAppearance } = appearance;\n const jsAppearance = { ...restAppearance } as AllAppearance;\n\n if (icons) {\n const jsIcons: AllIconOverrides = {};\n const iconKeys = Object.keys(icons) as Array<AllIconKey>;\n\n for (const iconKey of iconKeys) {\n // @ts-expect-error: cant easily fix this type error\n const reactRenderer = icons[iconKey] as ReactIconRenderer;\n\n if (reactRenderer) {\n jsIcons[iconKey] = (el: HTMLDivElement, props: { class?: string }) => {\n return mountElement(el, reactRenderer(props));\n };\n }\n }\n\n // JsAppearance also has .icons directly (from JsTheme part of JsAppearance)\n jsAppearance.icons = jsIcons;\n } else {\n // If original didn't have icons, ensure the clone doesn't either\n delete jsAppearance.icons;\n }\n\n return jsAppearance;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,SAAS,qBACd,YACA,cAC2B;AAC3B,MAAI,CAAC,YAAY;AACf,WAAO;AAAA,EACT;AACA,QAAM,EAAE,OAAO,GAAG,eAAe,IAAI;AACrC,QAAM,eAAe,EAAE,GAAG,eAAe;AAEzC,MAAI,OAAO;AACT,UAAM,UAA4B,CAAC;AACnC,UAAM,WAAW,OAAO,KAAK,KAAK;AAElC,eAAW,WAAW,UAAU;AAE9B,YAAM,gBAAgB,MAAM,OAAO;AAEnC,UAAI,eAAe;AACjB,gBAAQ,OAAO,IAAI,CAAC,IAAoB,UAA8B;AACpE,iBAAO,aAAa,IAAI,cAAc,KAAK,CAAC;AAAA,QAC9C;AAAA,MACF;AAAA,IACF;AAGA,iBAAa,QAAQ;AAAA,EACvB,OAAO;AAEL,WAAO,aAAa;AAAA,EACtB;AAEA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/appearance.ts"],"sourcesContent":["import type { AllAppearance, AllIconKey, AllIconOverrides } from '@novu/js/ui';\nimport { MountedElement } from '../context/RendererContext';\nimport type { ReactAllAppearance, ReactIconRenderer, ReactInboxAppearance, ReactSubscriptionAppearance } from './types';\n\nexport function adaptAppearanceForJs(\n appearance: ReactInboxAppearance | ReactSubscriptionAppearance | ReactAllAppearance,\n mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void\n): AllAppearance | undefined {\n if (!appearance) {\n return undefined;\n }\n const { icons, ...restAppearance } = appearance;\n const jsAppearance = { ...restAppearance } as AllAppearance;\n\n if (icons) {\n const jsIcons: AllIconOverrides = {};\n const iconKeys = Object.keys(icons) as Array<AllIconKey>;\n\n for (const iconKey of iconKeys) {\n // @ts-expect-error: cant easily fix this type error\n const reactRenderer = icons[iconKey] as ReactIconRenderer;\n\n if (reactRenderer) {\n jsIcons[iconKey] = (el: HTMLDivElement, props: { class?: string }) => {\n return mountElement(el, reactRenderer(props));\n };\n }\n }\n\n // JsAppearance also has .icons directly (from JsTheme part of JsAppearance)\n jsAppearance.icons = jsIcons;\n } else {\n // If original didn't have icons, ensure the clone doesn't either\n delete jsAppearance.icons;\n }\n\n return jsAppearance;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,SAAS,qBACd,YACA,cAC2B;AAC3B,MAAI,CAAC,YAAY;AACf,WAAO;AAAA,EACT;AACA,QAAM,EAAE,OAAO,GAAG,eAAe,IAAI;AACrC,QAAM,eAAe,EAAE,GAAG,eAAe;AAEzC,MAAI,OAAO;AACT,UAAM,UAA4B,CAAC;AACnC,UAAM,WAAW,OAAO,KAAK,KAAK;AAElC,eAAW,WAAW,UAAU;AAE9B,YAAM,gBAAgB,MAAM,OAAO;AAEnC,UAAI,eAAe;AACjB,gBAAQ,OAAO,IAAI,CAAC,IAAoB,UAA8B;AACpE,iBAAO,aAAa,IAAI,cAAc,KAAK,CAAC;AAAA,QAC9C;AAAA,MACF;AAAA,IACF;AAGA,iBAAa,QAAQ;AAAA,EACvB,OAAO;AAEL,WAAO,aAAa;AAAA,EACtB;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AllAppearance } from '@novu/js/ui';
|
|
2
2
|
import { MountedElement } from '../context/RendererContext.cjs';
|
|
3
|
-
import { ReactInboxAppearance, ReactSubscriptionAppearance } from './types.cjs';
|
|
3
|
+
import { ReactInboxAppearance, ReactSubscriptionAppearance, ReactAllAppearance } from './types.cjs';
|
|
4
4
|
import 'react/jsx-runtime';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '@novu/js';
|
|
7
7
|
|
|
8
|
-
declare function adaptAppearanceForJs(appearance: ReactInboxAppearance | ReactSubscriptionAppearance, mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void): AllAppearance | undefined;
|
|
8
|
+
declare function adaptAppearanceForJs(appearance: ReactInboxAppearance | ReactSubscriptionAppearance | ReactAllAppearance, mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void): AllAppearance | undefined;
|
|
9
9
|
|
|
10
10
|
export { adaptAppearanceForJs };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NovuSocketOptions, DefaultSchedule, Context, Subscriber, UnreadCount } from '@novu/js';
|
|
2
|
-
import { InboxTheme, InboxIconKey, InboxLocalization, Tab, PreferencesFilter, PreferenceGroups, PreferencesSort, RouterPush, Notification, NotificationClickHandler, NotificationActionClickHandler, InboxProps,
|
|
2
|
+
import { InboxTheme, InboxIconKey, InboxLocalization, Tab, PreferencesFilter, PreferenceGroups, PreferencesSort, RouterPush, Notification, NotificationClickHandler, NotificationActionClickHandler, InboxProps, AllTheme, AllIconKey, SubscriptionTheme, SubscriptionIconKey } from '@novu/js/ui';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
type NotificationsRenderer = (notification: Notification) => React.ReactNode;
|
|
@@ -2,10 +2,10 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { Novu } from '@novu/js';
|
|
3
3
|
import { NovuUIOptions as NovuUIOptions$1 } from '@novu/js/ui';
|
|
4
4
|
import React__default from 'react';
|
|
5
|
-
import { ReactInboxAppearance, ReactSubscriptionAppearance } from '../utils/types.js';
|
|
5
|
+
import { ReactInboxAppearance, ReactSubscriptionAppearance, ReactAllAppearance } from '../utils/types.js';
|
|
6
6
|
|
|
7
7
|
type NovuUIOptions = Omit<NovuUIOptions$1, 'appearance'> & {
|
|
8
|
-
appearance?: ReactInboxAppearance | ReactSubscriptionAppearance;
|
|
8
|
+
appearance?: ReactInboxAppearance | ReactSubscriptionAppearance | ReactAllAppearance;
|
|
9
9
|
};
|
|
10
10
|
type NovuUIProps = React__default.PropsWithChildren<{
|
|
11
11
|
options: NovuUIOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/NovuUI.tsx"],"sourcesContent":["import { Novu } from '@novu/js';\nimport type { NovuUIOptions as JsNovuUIOptions } from '@novu/js/ui';\nimport { NovuUI as NovuUIClass } from '@novu/js/ui';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { NovuUIProvider } from '../context/NovuUIContext';\nimport { useRenderer } from '../context/RendererContext';\nimport { useDataRef } from '../hooks/internal/useDataRef';\nimport { adaptAppearanceForJs } from '../utils/appearance';\nimport type { ReactInboxAppearance, ReactSubscriptionAppearance } from '../utils/types';\nimport { ShadowRootDetector } from './ShadowRootDetector';\n\nexport type NovuUIOptions = Omit<JsNovuUIOptions, 'appearance'> & {\n appearance?: ReactInboxAppearance | ReactSubscriptionAppearance;\n};\n\ntype NovuUIProps = React.PropsWithChildren<{\n options: NovuUIOptions;\n novu: Novu;\n}>;\n\nconst findParentShadowRoot = (child?: HTMLDivElement | null): Node | null => {\n if (!child) {\n return null;\n }\n\n let node: Node | null = child;\n\n while (node) {\n if (node instanceof Element && node.shadowRoot) {\n return node.shadowRoot;\n }\n\n if (node instanceof ShadowRoot) {\n return node;\n }\n\n node = node.parentNode;\n\n if (!node || node === document) {\n break;\n }\n }\n\n return null;\n};\n\nexport const NovuUI = ({ options, novu, children }: NovuUIProps) => {\n const shadowRootDetector = useRef<HTMLDivElement>(null);\n const { mountElement } = useRenderer();\n\n const adaptedAppearanceForUpdate = useMemo(\n () => adaptAppearanceForJs(options.appearance || {}, mountElement),\n [options.appearance, mountElement]\n );\n\n const adaptedOptions = useMemo(() => {\n return {\n ...options,\n appearance: adaptedAppearanceForUpdate,\n novu,\n };\n }, [options, novu, adaptedAppearanceForUpdate]);\n\n const optionsRef = useDataRef(adaptedOptions);\n const [novuUI, setNovuUI] = useState<NovuUIClass | undefined>();\n\n useEffect(() => {\n const parentShadowRoot = findParentShadowRoot(shadowRootDetector.current);\n const instance = new NovuUIClass({\n ...optionsRef.current,\n container: optionsRef.current.container ?? parentShadowRoot,\n });\n setNovuUI(instance);\n\n return () => {\n instance.unmount();\n };\n }, []);\n\n useEffect(() => {\n if (!novuUI) {\n return;\n }\n\n const parentShadowRoot = findParentShadowRoot(shadowRootDetector.current);\n novuUI.updateContainer(options.container ?? parentShadowRoot);\n novuUI.updateAppearance(adaptedAppearanceForUpdate);\n novuUI.updateLocalization(options.localization);\n novuUI.updateTabs(options.tabs);\n novuUI.updateOptions(options.options);\n novuUI.updateRouterPush(options.routerPush);\n novuUI.updateNovu(novu);\n }, [\n shadowRootDetector,\n novuUI,\n adaptedAppearanceForUpdate,\n options.localization,\n options.tabs,\n options.options,\n options.routerPush,\n novu,\n ]);\n\n return (\n <>\n <ShadowRootDetector ref={shadowRootDetector} />\n {novuUI && <NovuUIProvider value={{ novuUI }}>{children}</NovuUIProvider>}\n </>\n );\n};\n"],"mappings":";AAEA,SAAS,UAAU,mBAAmB;AACtC,SAAgB,WAAW,SAAS,QAAQ,gBAAgB;AAC5D,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,4BAA4B;AAErC,SAAS,0BAA0B;AA+F/B,mBACE,KADF;AApFJ,IAAM,uBAAuB,CAAC,UAA+C;AAC3E,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AAEA,MAAI,OAAoB;AAExB,SAAO,MAAM;AACX,QAAI,gBAAgB,WAAW,KAAK,YAAY;AAC9C,aAAO,KAAK;AAAA,IACd;AAEA,QAAI,gBAAgB,YAAY;AAC9B,aAAO;AAAA,IACT;AAEA,WAAO,KAAK;AAEZ,QAAI,CAAC,QAAQ,SAAS,UAAU;AAC9B;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEO,IAAM,SAAS,CAAC,EAAE,SAAS,MAAM,SAAS,MAAmB;AAClE,QAAM,qBAAqB,OAAuB,IAAI;AACtD,QAAM,EAAE,aAAa,IAAI,YAAY;AAErC,QAAM,6BAA6B;AAAA,IACjC,MAAM,qBAAqB,QAAQ,cAAc,CAAC,GAAG,YAAY;AAAA,IACjE,CAAC,QAAQ,YAAY,YAAY;AAAA,EACnC;AAEA,QAAM,iBAAiB,QAAQ,MAAM;AACnC,WAAO;AAAA,MACL,GAAG;AAAA,MACH,YAAY;AAAA,MACZ;AAAA,IACF;AAAA,EACF,GAAG,CAAC,SAAS,MAAM,0BAA0B,CAAC;AAE9C,QAAM,aAAa,WAAW,cAAc;AAC5C,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAkC;AAE9D,YAAU,MAAM;AACd,UAAM,mBAAmB,qBAAqB,mBAAmB,OAAO;AACxE,UAAM,WAAW,IAAI,YAAY;AAAA,MAC/B,GAAG,WAAW;AAAA,MACd,WAAW,WAAW,QAAQ,aAAa;AAAA,IAC7C,CAAC;AACD,cAAU,QAAQ;AAElB,WAAO,MAAM;AACX,eAAS,QAAQ;AAAA,IACnB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,QAAI,CAAC,QAAQ;AACX;AAAA,IACF;AAEA,UAAM,mBAAmB,qBAAqB,mBAAmB,OAAO;AACxE,WAAO,gBAAgB,QAAQ,aAAa,gBAAgB;AAC5D,WAAO,iBAAiB,0BAA0B;AAClD,WAAO,mBAAmB,QAAQ,YAAY;AAC9C,WAAO,WAAW,QAAQ,IAAI;AAC9B,WAAO,cAAc,QAAQ,OAAO;AACpC,WAAO,iBAAiB,QAAQ,UAAU;AAC1C,WAAO,WAAW,IAAI;AAAA,EACxB,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR;AAAA,EACF,CAAC;AAED,SACE,iCACE;AAAA,wBAAC,sBAAmB,KAAK,oBAAoB;AAAA,IAC5C,UAAU,oBAAC,kBAAe,OAAO,EAAE,OAAO,GAAI,UAAS;AAAA,KAC1D;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/NovuUI.tsx"],"sourcesContent":["import { Novu } from '@novu/js';\nimport type { NovuUIOptions as JsNovuUIOptions } from '@novu/js/ui';\nimport { NovuUI as NovuUIClass } from '@novu/js/ui';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { NovuUIProvider } from '../context/NovuUIContext';\nimport { useRenderer } from '../context/RendererContext';\nimport { useDataRef } from '../hooks/internal/useDataRef';\nimport { adaptAppearanceForJs } from '../utils/appearance';\nimport type { ReactAllAppearance, ReactInboxAppearance, ReactSubscriptionAppearance } from '../utils/types';\nimport { ShadowRootDetector } from './ShadowRootDetector';\n\nexport type NovuUIOptions = Omit<JsNovuUIOptions, 'appearance'> & {\n appearance?: ReactInboxAppearance | ReactSubscriptionAppearance | ReactAllAppearance;\n};\n\ntype NovuUIProps = React.PropsWithChildren<{\n options: NovuUIOptions;\n novu: Novu;\n}>;\n\nconst findParentShadowRoot = (child?: HTMLDivElement | null): Node | null => {\n if (!child) {\n return null;\n }\n\n let node: Node | null = child;\n\n while (node) {\n if (node instanceof Element && node.shadowRoot) {\n return node.shadowRoot;\n }\n\n if (node instanceof ShadowRoot) {\n return node;\n }\n\n node = node.parentNode;\n\n if (!node || node === document) {\n break;\n }\n }\n\n return null;\n};\n\nexport const NovuUI = ({ options, novu, children }: NovuUIProps) => {\n const shadowRootDetector = useRef<HTMLDivElement>(null);\n const { mountElement } = useRenderer();\n\n const adaptedAppearanceForUpdate = useMemo(\n () => adaptAppearanceForJs(options.appearance || {}, mountElement),\n [options.appearance, mountElement]\n );\n\n const adaptedOptions = useMemo(() => {\n return {\n ...options,\n appearance: adaptedAppearanceForUpdate,\n novu,\n };\n }, [options, novu, adaptedAppearanceForUpdate]);\n\n const optionsRef = useDataRef(adaptedOptions);\n const [novuUI, setNovuUI] = useState<NovuUIClass | undefined>();\n\n useEffect(() => {\n const parentShadowRoot = findParentShadowRoot(shadowRootDetector.current);\n const instance = new NovuUIClass({\n ...optionsRef.current,\n container: optionsRef.current.container ?? parentShadowRoot,\n });\n setNovuUI(instance);\n\n return () => {\n instance.unmount();\n };\n }, []);\n\n useEffect(() => {\n if (!novuUI) {\n return;\n }\n\n const parentShadowRoot = findParentShadowRoot(shadowRootDetector.current);\n novuUI.updateContainer(options.container ?? parentShadowRoot);\n novuUI.updateAppearance(adaptedAppearanceForUpdate);\n novuUI.updateLocalization(options.localization);\n novuUI.updateTabs(options.tabs);\n novuUI.updateOptions(options.options);\n novuUI.updateRouterPush(options.routerPush);\n novuUI.updateNovu(novu);\n }, [\n shadowRootDetector,\n novuUI,\n adaptedAppearanceForUpdate,\n options.localization,\n options.tabs,\n options.options,\n options.routerPush,\n novu,\n ]);\n\n return (\n <>\n <ShadowRootDetector ref={shadowRootDetector} />\n {novuUI && <NovuUIProvider value={{ novuUI }}>{children}</NovuUIProvider>}\n </>\n );\n};\n"],"mappings":";AAEA,SAAS,UAAU,mBAAmB;AACtC,SAAgB,WAAW,SAAS,QAAQ,gBAAgB;AAC5D,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,4BAA4B;AAErC,SAAS,0BAA0B;AA+F/B,mBACE,KADF;AApFJ,IAAM,uBAAuB,CAAC,UAA+C;AAC3E,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AAEA,MAAI,OAAoB;AAExB,SAAO,MAAM;AACX,QAAI,gBAAgB,WAAW,KAAK,YAAY;AAC9C,aAAO,KAAK;AAAA,IACd;AAEA,QAAI,gBAAgB,YAAY;AAC9B,aAAO;AAAA,IACT;AAEA,WAAO,KAAK;AAEZ,QAAI,CAAC,QAAQ,SAAS,UAAU;AAC9B;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEO,IAAM,SAAS,CAAC,EAAE,SAAS,MAAM,SAAS,MAAmB;AAClE,QAAM,qBAAqB,OAAuB,IAAI;AACtD,QAAM,EAAE,aAAa,IAAI,YAAY;AAErC,QAAM,6BAA6B;AAAA,IACjC,MAAM,qBAAqB,QAAQ,cAAc,CAAC,GAAG,YAAY;AAAA,IACjE,CAAC,QAAQ,YAAY,YAAY;AAAA,EACnC;AAEA,QAAM,iBAAiB,QAAQ,MAAM;AACnC,WAAO;AAAA,MACL,GAAG;AAAA,MACH,YAAY;AAAA,MACZ;AAAA,IACF;AAAA,EACF,GAAG,CAAC,SAAS,MAAM,0BAA0B,CAAC;AAE9C,QAAM,aAAa,WAAW,cAAc;AAC5C,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAkC;AAE9D,YAAU,MAAM;AACd,UAAM,mBAAmB,qBAAqB,mBAAmB,OAAO;AACxE,UAAM,WAAW,IAAI,YAAY;AAAA,MAC/B,GAAG,WAAW;AAAA,MACd,WAAW,WAAW,QAAQ,aAAa;AAAA,IAC7C,CAAC;AACD,cAAU,QAAQ;AAElB,WAAO,MAAM;AACX,eAAS,QAAQ;AAAA,IACnB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,QAAI,CAAC,QAAQ;AACX;AAAA,IACF;AAEA,UAAM,mBAAmB,qBAAqB,mBAAmB,OAAO;AACxE,WAAO,gBAAgB,QAAQ,aAAa,gBAAgB;AAC5D,WAAO,iBAAiB,0BAA0B;AAClD,WAAO,mBAAmB,QAAQ,YAAY;AAC9C,WAAO,WAAW,QAAQ,IAAI;AAC9B,WAAO,cAAc,QAAQ,OAAO;AACpC,WAAO,iBAAiB,QAAQ,UAAU;AAC1C,WAAO,WAAW,IAAI;AAAA,EACxB,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR;AAAA,EACF,CAAC;AAED,SACE,iCACE;AAAA,wBAAC,sBAAmB,KAAK,oBAAoB;AAAA,IAC5C,UAAU,oBAAC,kBAAe,OAAO,EAAE,OAAO,GAAI,UAAS;AAAA,KAC1D;AAEJ;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { NovuUIOptions } from '../NovuUI.js';
|
|
4
|
+
import { DefaultConnectChatProps } from './DefaultConnectChat.js';
|
|
5
|
+
import '@novu/js';
|
|
6
|
+
import '@novu/js/ui';
|
|
7
|
+
import '../../utils/types.js';
|
|
8
|
+
|
|
9
|
+
type ConnectChatProps = DefaultConnectChatProps & Pick<NovuUIOptions, 'container' | 'appearance'>;
|
|
10
|
+
declare const ConnectChat: React__default.MemoExoticComponent<(props: ConnectChatProps) => react_jsx_runtime.JSX.Element>;
|
|
11
|
+
|
|
12
|
+
export { ConnectChat, type ConnectChatProps };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/components/connect-chat/ConnectChat.tsx
|
|
2
|
+
import React, { useMemo } from "react";
|
|
3
|
+
import { useNovu } from "../../hooks/NovuProvider.js";
|
|
4
|
+
import { NovuUI } from "../NovuUI.js";
|
|
5
|
+
import { withRenderer } from "../Renderer.js";
|
|
6
|
+
import { DefaultConnectChat } from "./DefaultConnectChat.js";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var ConnectChatInternal = withRenderer((props) => {
|
|
9
|
+
const { container, appearance, ...defaultProps } = props;
|
|
10
|
+
const novu = useNovu();
|
|
11
|
+
const options = useMemo(() => {
|
|
12
|
+
return {
|
|
13
|
+
container,
|
|
14
|
+
appearance,
|
|
15
|
+
options: novu.options
|
|
16
|
+
};
|
|
17
|
+
}, [container, appearance, novu.options]);
|
|
18
|
+
return /* @__PURE__ */ jsx(NovuUI, { options, novu, children: /* @__PURE__ */ jsx(DefaultConnectChat, { ...defaultProps }) });
|
|
19
|
+
});
|
|
20
|
+
ConnectChatInternal.displayName = "ConnectChatInternal";
|
|
21
|
+
var ConnectChat = React.memo((props) => {
|
|
22
|
+
return /* @__PURE__ */ jsx(ConnectChatInternal, { ...props });
|
|
23
|
+
});
|
|
24
|
+
ConnectChat.displayName = "ConnectChat";
|
|
25
|
+
export {
|
|
26
|
+
ConnectChat
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=ConnectChat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/connect-chat/ConnectChat.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultConnectChat, DefaultConnectChatProps } from './DefaultConnectChat';\n\nexport type ConnectChatProps = DefaultConnectChatProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst ConnectChatInternal = withRenderer<ConnectChatProps>((props) => {\n const { container, appearance, ...defaultProps } = props;\n const novu = useNovu();\n\n const options: NovuUIOptions = useMemo(() => {\n return {\n container,\n appearance,\n options: novu.options,\n };\n }, [container, appearance, novu.options]);\n\n return (\n <NovuUI options={options} novu={novu}>\n <DefaultConnectChat {...defaultProps} />\n </NovuUI>\n );\n});\n\nConnectChatInternal.displayName = 'ConnectChatInternal';\n\nexport const ConnectChat = React.memo((props: ConnectChatProps) => {\n return <ConnectChatInternal {...props} />;\n});\n\nConnectChat.displayName = 'ConnectChat';\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,0BAAmD;AAkBtD;AAdN,IAAM,sBAAsB,aAA+B,CAAC,UAAU;AACpE,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,OAAO,QAAQ;AAErB,QAAM,UAAyB,QAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,oBAAC,UAAO,SAAkB,MACxB,8BAAC,sBAAoB,GAAG,cAAc,GACxC;AAEJ,CAAC;AAED,oBAAoB,cAAc;AAE3B,IAAM,cAAc,MAAM,KAAK,CAAC,UAA4B;AACjE,SAAO,oBAAC,uBAAqB,GAAG,OAAO;AACzC,CAAC;AAED,YAAY,cAAc;","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ConnectChatProps } from '@novu/js/ui';
|
|
3
|
+
|
|
4
|
+
type DefaultConnectChatProps = Pick<ConnectChatProps, 'integrationIdentifier' | 'connectionIdentifier' | 'subscriberId' | 'context' | 'scope' | 'connectionMode' | 'onConnectSuccess' | 'onConnectError' | 'onDisconnectSuccess' | 'onDisconnectError'>;
|
|
5
|
+
declare const DefaultConnectChat: (props: DefaultConnectChatProps) => react_jsx_runtime.JSX.Element;
|
|
6
|
+
|
|
7
|
+
export { DefaultConnectChat, type DefaultConnectChatProps };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// src/components/connect-chat/DefaultConnectChat.tsx
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { useNovuUI } from "../../context/NovuUIContext.js";
|
|
4
|
+
import { Mounter } from "../Mounter.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
var DefaultConnectChat = (props) => {
|
|
7
|
+
const {
|
|
8
|
+
integrationIdentifier,
|
|
9
|
+
connectionIdentifier,
|
|
10
|
+
subscriberId,
|
|
11
|
+
context,
|
|
12
|
+
scope,
|
|
13
|
+
connectionMode,
|
|
14
|
+
onConnectSuccess,
|
|
15
|
+
onConnectError,
|
|
16
|
+
onDisconnectSuccess,
|
|
17
|
+
onDisconnectError
|
|
18
|
+
} = props;
|
|
19
|
+
const { novuUI } = useNovuUI();
|
|
20
|
+
const mount = useCallback(
|
|
21
|
+
(element) => {
|
|
22
|
+
return novuUI.mountComponent({
|
|
23
|
+
name: "ConnectChat",
|
|
24
|
+
props: {
|
|
25
|
+
integrationIdentifier,
|
|
26
|
+
connectionIdentifier,
|
|
27
|
+
subscriberId,
|
|
28
|
+
context,
|
|
29
|
+
scope,
|
|
30
|
+
connectionMode,
|
|
31
|
+
onConnectSuccess,
|
|
32
|
+
onConnectError,
|
|
33
|
+
onDisconnectSuccess,
|
|
34
|
+
onDisconnectError
|
|
35
|
+
},
|
|
36
|
+
element
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
[
|
|
40
|
+
novuUI,
|
|
41
|
+
integrationIdentifier,
|
|
42
|
+
connectionIdentifier,
|
|
43
|
+
subscriberId,
|
|
44
|
+
context,
|
|
45
|
+
scope,
|
|
46
|
+
connectionMode,
|
|
47
|
+
onConnectSuccess,
|
|
48
|
+
onConnectError,
|
|
49
|
+
onDisconnectSuccess,
|
|
50
|
+
onDisconnectError
|
|
51
|
+
]
|
|
52
|
+
);
|
|
53
|
+
return /* @__PURE__ */ jsx(Mounter, { mount });
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
DefaultConnectChat
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=DefaultConnectChat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/connect-chat/DefaultConnectChat.tsx"],"sourcesContent":["import { ConnectChatProps } from '@novu/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultConnectChatProps = Pick<\n ConnectChatProps,\n | 'integrationIdentifier'\n | 'connectionIdentifier'\n | 'subscriberId'\n | 'context'\n | 'scope'\n | 'connectionMode'\n | 'onConnectSuccess'\n | 'onConnectError'\n | 'onDisconnectSuccess'\n | 'onDisconnectError'\n>;\n\nexport const DefaultConnectChat = (props: DefaultConnectChatProps) => {\n const {\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n scope,\n connectionMode,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n } = props;\n const { novuUI } = useNovuUI();\n\n const mount = useCallback(\n (element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'ConnectChat',\n props: {\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n scope,\n connectionMode,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n },\n element,\n });\n },\n [\n novuUI,\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n scope,\n connectionMode,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n ]\n );\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";AACA,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAiEf;AAjDF,IAAM,qBAAqB,CAAC,UAAmC;AACpE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,QAAM,QAAQ;AAAA,IACZ,CAAC,YAAyB;AACxB,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export { InternalNovuProvider, NovuProvider, NovuProviderProps, useNovu, useUnsafeNovu } from '../hooks/NovuProvider.js';
|
|
1
|
+
export { InternalNovuProvider, NovuProvider, NovuProviderProps, useNovu, useRealtime, useUnsafeNovu } from '../hooks/NovuProvider.js';
|
|
2
2
|
export { Bell, BellProps } from './Bell.js';
|
|
3
3
|
export { Inbox, InboxProps } from './Inbox.js';
|
|
4
4
|
export { InboxContent, InboxContentProps } from './InboxContent.js';
|
|
5
5
|
export { NotificationProps, Notifications } from './Notifications.js';
|
|
6
6
|
export { Preferences } from './Preferences.js';
|
|
7
|
+
export { SlackConnectButton, SlackConnectButtonProps } from './slack-connect-button/SlackConnectButton.js';
|
|
8
|
+
export { SlackLinkUser, SlackLinkUserProps } from './slack-link-user/SlackLinkUser.js';
|
|
7
9
|
export { Subscription, SubscriptionProps } from './subscription/Subscription.js';
|
|
8
10
|
export { SubscriptionButton, SubscriptionButtonProps } from './subscription/SubscriptionButton.js';
|
|
9
11
|
export { SubscriptionPreferences, SubscriptionPreferencesProps } from './subscription/SubscriptionPreferences.js';
|
|
@@ -13,4 +15,6 @@ import 'react';
|
|
|
13
15
|
import '../utils/types.js';
|
|
14
16
|
import '@novu/js/ui';
|
|
15
17
|
import './NovuUI.js';
|
|
18
|
+
import './slack-connect-button/DefaultSlackConnectButton.js';
|
|
19
|
+
import './slack-link-user/DefaultSlackLinkUser.js';
|
|
16
20
|
import './subscription/DefaultSubscription.js';
|
|
@@ -5,6 +5,8 @@ export * from "./Inbox.js";
|
|
|
5
5
|
export * from "./InboxContent.js";
|
|
6
6
|
export * from "./Notifications.js";
|
|
7
7
|
export * from "./Preferences.js";
|
|
8
|
+
export * from "./slack-connect-button/SlackConnectButton.js";
|
|
9
|
+
export * from "./slack-link-user/SlackLinkUser.js";
|
|
8
10
|
export * from "./subscription/Subscription.js";
|
|
9
11
|
export * from "./subscription/SubscriptionButton.js";
|
|
10
12
|
export * from "./subscription/SubscriptionPreferences.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from '../hooks/NovuProvider';\nexport * from './Bell';\nexport * from './Inbox';\nexport * from './InboxContent';\nexport * from './Notifications';\nexport * from './Preferences';\nexport * from './subscription/Subscription';\nexport * from './subscription/SubscriptionButton';\nexport * from './subscription/SubscriptionPreferences';\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from '../hooks/NovuProvider';\nexport * from './Bell';\nexport * from './Inbox';\nexport * from './InboxContent';\nexport * from './Notifications';\nexport * from './Preferences';\nexport * from './slack-connect-button/SlackConnectButton';\nexport * from './slack-link-user/SlackLinkUser';\nexport * from './subscription/Subscription';\nexport * from './subscription/SubscriptionButton';\nexport * from './subscription/SubscriptionPreferences';\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { SlackConnectButtonProps } from '@novu/js/ui';
|
|
3
|
+
|
|
4
|
+
type DefaultSlackConnectButtonProps = Pick<SlackConnectButtonProps, 'integrationIdentifier' | 'connectionIdentifier' | 'subscriberId' | 'context' | 'scope' | 'connectionMode' | 'onConnectSuccess' | 'onConnectError' | 'onDisconnectSuccess' | 'onDisconnectError' | 'connectLabel' | 'connectedLabel'>;
|
|
5
|
+
declare const DefaultSlackConnectButton: (props: DefaultSlackConnectButtonProps) => react_jsx_runtime.JSX.Element;
|
|
6
|
+
|
|
7
|
+
export { DefaultSlackConnectButton, type DefaultSlackConnectButtonProps };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// src/components/slack-connect-button/DefaultSlackConnectButton.tsx
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { useNovuUI } from "../../context/NovuUIContext.js";
|
|
4
|
+
import { Mounter } from "../Mounter.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
var DefaultSlackConnectButton = (props) => {
|
|
7
|
+
const {
|
|
8
|
+
integrationIdentifier,
|
|
9
|
+
connectionIdentifier,
|
|
10
|
+
subscriberId,
|
|
11
|
+
context,
|
|
12
|
+
scope,
|
|
13
|
+
connectionMode,
|
|
14
|
+
onConnectSuccess,
|
|
15
|
+
onConnectError,
|
|
16
|
+
onDisconnectSuccess,
|
|
17
|
+
onDisconnectError,
|
|
18
|
+
connectLabel,
|
|
19
|
+
connectedLabel
|
|
20
|
+
} = props;
|
|
21
|
+
const { novuUI } = useNovuUI();
|
|
22
|
+
const mount = useCallback(
|
|
23
|
+
(element) => {
|
|
24
|
+
return novuUI.mountComponent({
|
|
25
|
+
name: "SlackConnectButton",
|
|
26
|
+
props: {
|
|
27
|
+
integrationIdentifier,
|
|
28
|
+
connectionIdentifier,
|
|
29
|
+
subscriberId,
|
|
30
|
+
context,
|
|
31
|
+
scope,
|
|
32
|
+
connectionMode,
|
|
33
|
+
onConnectSuccess,
|
|
34
|
+
onConnectError,
|
|
35
|
+
onDisconnectSuccess,
|
|
36
|
+
onDisconnectError,
|
|
37
|
+
connectLabel,
|
|
38
|
+
connectedLabel
|
|
39
|
+
},
|
|
40
|
+
element
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
[
|
|
44
|
+
novuUI,
|
|
45
|
+
integrationIdentifier,
|
|
46
|
+
connectionIdentifier,
|
|
47
|
+
subscriberId,
|
|
48
|
+
context,
|
|
49
|
+
scope,
|
|
50
|
+
connectionMode,
|
|
51
|
+
onConnectSuccess,
|
|
52
|
+
onConnectError,
|
|
53
|
+
onDisconnectSuccess,
|
|
54
|
+
onDisconnectError,
|
|
55
|
+
connectLabel,
|
|
56
|
+
connectedLabel
|
|
57
|
+
]
|
|
58
|
+
);
|
|
59
|
+
return /* @__PURE__ */ jsx(Mounter, { mount });
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
DefaultSlackConnectButton
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=DefaultSlackConnectButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/slack-connect-button/DefaultSlackConnectButton.tsx"],"sourcesContent":["import { SlackConnectButtonProps } from '@novu/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultSlackConnectButtonProps = Pick<\n SlackConnectButtonProps,\n | 'integrationIdentifier'\n | 'connectionIdentifier'\n | 'subscriberId'\n | 'context'\n | 'scope'\n | 'connectionMode'\n | 'onConnectSuccess'\n | 'onConnectError'\n | 'onDisconnectSuccess'\n | 'onDisconnectError'\n | 'connectLabel'\n | 'connectedLabel'\n>;\n\nexport const DefaultSlackConnectButton = (props: DefaultSlackConnectButtonProps) => {\n const {\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n scope,\n connectionMode,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n } = props;\n const { novuUI } = useNovuUI();\n\n const mount = useCallback(\n (element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'SlackConnectButton',\n props: {\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n scope,\n connectionMode,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n },\n element,\n });\n },\n [\n novuUI,\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n scope,\n connectionMode,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n ]\n );\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";AACA,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAyEf;AAvDF,IAAM,4BAA4B,CAAC,UAA0C;AAClF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,QAAM,QAAQ;AAAA,IACZ,CAAC,YAAyB;AACxB,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { NovuUIOptions } from '../NovuUI.js';
|
|
4
|
+
import { DefaultSlackConnectButtonProps } from './DefaultSlackConnectButton.js';
|
|
5
|
+
import '@novu/js';
|
|
6
|
+
import '@novu/js/ui';
|
|
7
|
+
import '../../utils/types.js';
|
|
8
|
+
|
|
9
|
+
type SlackConnectButtonProps = DefaultSlackConnectButtonProps & Pick<NovuUIOptions, 'container' | 'appearance'>;
|
|
10
|
+
declare const SlackConnectButton: React__default.MemoExoticComponent<(props: SlackConnectButtonProps) => react_jsx_runtime.JSX.Element>;
|
|
11
|
+
|
|
12
|
+
export { SlackConnectButton, type SlackConnectButtonProps };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/components/slack-connect-button/SlackConnectButton.tsx
|
|
2
|
+
import React, { useMemo } from "react";
|
|
3
|
+
import { useNovu } from "../../hooks/NovuProvider.js";
|
|
4
|
+
import { NovuUI } from "../NovuUI.js";
|
|
5
|
+
import { withRenderer } from "../Renderer.js";
|
|
6
|
+
import { DefaultSlackConnectButton } from "./DefaultSlackConnectButton.js";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var SlackConnectButtonInternal = withRenderer((props) => {
|
|
9
|
+
const { container, appearance, ...defaultProps } = props;
|
|
10
|
+
const novu = useNovu();
|
|
11
|
+
const options = useMemo(() => {
|
|
12
|
+
return {
|
|
13
|
+
container,
|
|
14
|
+
appearance,
|
|
15
|
+
options: novu.options
|
|
16
|
+
};
|
|
17
|
+
}, [container, appearance, novu.options]);
|
|
18
|
+
return /* @__PURE__ */ jsx(NovuUI, { options, novu, children: /* @__PURE__ */ jsx(DefaultSlackConnectButton, { ...defaultProps }) });
|
|
19
|
+
});
|
|
20
|
+
SlackConnectButtonInternal.displayName = "SlackConnectButtonInternal";
|
|
21
|
+
var SlackConnectButton = React.memo((props) => {
|
|
22
|
+
return /* @__PURE__ */ jsx(SlackConnectButtonInternal, { ...props });
|
|
23
|
+
});
|
|
24
|
+
SlackConnectButton.displayName = "SlackConnectButton";
|
|
25
|
+
export {
|
|
26
|
+
SlackConnectButton
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=SlackConnectButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/slack-connect-button/SlackConnectButton.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultSlackConnectButton, DefaultSlackConnectButtonProps } from './DefaultSlackConnectButton';\n\nexport type SlackConnectButtonProps = DefaultSlackConnectButtonProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst SlackConnectButtonInternal = withRenderer<SlackConnectButtonProps>((props) => {\n const { container, appearance, ...defaultProps } = props;\n const novu = useNovu();\n\n const options: NovuUIOptions = useMemo(() => {\n return {\n container,\n appearance,\n options: novu.options,\n };\n }, [container, appearance, novu.options]);\n\n return (\n <NovuUI options={options} novu={novu}>\n <DefaultSlackConnectButton {...defaultProps} />\n </NovuUI>\n );\n});\n\nSlackConnectButtonInternal.displayName = 'SlackConnectButtonInternal';\n\nexport const SlackConnectButton = React.memo((props: SlackConnectButtonProps) => {\n return <SlackConnectButtonInternal {...props} />;\n});\n\nSlackConnectButton.displayName = 'SlackConnectButton';\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,iCAAiE;AAkBpE;AAdN,IAAM,6BAA6B,aAAsC,CAAC,UAAU;AAClF,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,OAAO,QAAQ;AAErB,QAAM,UAAyB,QAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,oBAAC,UAAO,SAAkB,MACxB,8BAAC,6BAA2B,GAAG,cAAc,GAC/C;AAEJ,CAAC;AAED,2BAA2B,cAAc;AAElC,IAAM,qBAAqB,MAAM,KAAK,CAAC,UAAmC;AAC/E,SAAO,oBAAC,8BAA4B,GAAG,OAAO;AAChD,CAAC;AAED,mBAAmB,cAAc;","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { SlackLinkUserProps } from '@novu/js/ui';
|
|
3
|
+
|
|
4
|
+
type DefaultSlackLinkUserProps = Pick<SlackLinkUserProps, 'integrationIdentifier' | 'connectionIdentifier' | 'context' | 'onLinkSuccess' | 'onLinkError' | 'onUnlinkSuccess' | 'onUnlinkError' | 'linkLabel' | 'unlinkLabel'>;
|
|
5
|
+
declare const DefaultSlackLinkUser: (props: DefaultSlackLinkUserProps) => react_jsx_runtime.JSX.Element;
|
|
6
|
+
|
|
7
|
+
export { DefaultSlackLinkUser, type DefaultSlackLinkUserProps };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// src/components/slack-link-user/DefaultSlackLinkUser.tsx
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { useNovuUI } from "../../context/NovuUIContext.js";
|
|
4
|
+
import { Mounter } from "../Mounter.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
var DefaultSlackLinkUser = (props) => {
|
|
7
|
+
const {
|
|
8
|
+
integrationIdentifier,
|
|
9
|
+
connectionIdentifier,
|
|
10
|
+
context,
|
|
11
|
+
onLinkSuccess,
|
|
12
|
+
onLinkError,
|
|
13
|
+
onUnlinkSuccess,
|
|
14
|
+
onUnlinkError,
|
|
15
|
+
linkLabel,
|
|
16
|
+
unlinkLabel
|
|
17
|
+
} = props;
|
|
18
|
+
const { novuUI } = useNovuUI();
|
|
19
|
+
const mount = useCallback(
|
|
20
|
+
(element) => {
|
|
21
|
+
return novuUI.mountComponent({
|
|
22
|
+
name: "SlackLinkUser",
|
|
23
|
+
props: {
|
|
24
|
+
integrationIdentifier,
|
|
25
|
+
connectionIdentifier,
|
|
26
|
+
context,
|
|
27
|
+
onLinkSuccess,
|
|
28
|
+
onLinkError,
|
|
29
|
+
onUnlinkSuccess,
|
|
30
|
+
onUnlinkError,
|
|
31
|
+
linkLabel,
|
|
32
|
+
unlinkLabel
|
|
33
|
+
},
|
|
34
|
+
element
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
[
|
|
38
|
+
novuUI,
|
|
39
|
+
integrationIdentifier,
|
|
40
|
+
connectionIdentifier,
|
|
41
|
+
context,
|
|
42
|
+
onLinkSuccess,
|
|
43
|
+
onLinkError,
|
|
44
|
+
onUnlinkSuccess,
|
|
45
|
+
onUnlinkError,
|
|
46
|
+
linkLabel,
|
|
47
|
+
unlinkLabel
|
|
48
|
+
]
|
|
49
|
+
);
|
|
50
|
+
return /* @__PURE__ */ jsx(Mounter, { mount });
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
DefaultSlackLinkUser
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=DefaultSlackLinkUser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/slack-link-user/DefaultSlackLinkUser.tsx"],"sourcesContent":["import { SlackLinkUserProps } from '@novu/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultSlackLinkUserProps = Pick<\n SlackLinkUserProps,\n | 'integrationIdentifier'\n | 'connectionIdentifier'\n | 'context'\n | 'onLinkSuccess'\n | 'onLinkError'\n | 'onUnlinkSuccess'\n | 'onUnlinkError'\n | 'linkLabel'\n | 'unlinkLabel'\n>;\n\nexport const DefaultSlackLinkUser = (props: DefaultSlackLinkUserProps) => {\n const {\n integrationIdentifier,\n connectionIdentifier,\n context,\n onLinkSuccess,\n onLinkError,\n onUnlinkSuccess,\n onUnlinkError,\n linkLabel,\n unlinkLabel,\n } = props;\n const { novuUI } = useNovuUI();\n\n const mount = useCallback(\n (element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'SlackLinkUser',\n props: {\n integrationIdentifier,\n connectionIdentifier,\n context,\n onLinkSuccess,\n onLinkError,\n onUnlinkSuccess,\n onUnlinkError,\n linkLabel,\n unlinkLabel,\n },\n element,\n });\n },\n [\n novuUI,\n integrationIdentifier,\n connectionIdentifier,\n context,\n onLinkSuccess,\n onLinkError,\n onUnlinkSuccess,\n onUnlinkError,\n linkLabel,\n unlinkLabel,\n ]\n );\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";AACA,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AA6Df;AA9CF,IAAM,uBAAuB,CAAC,UAAqC;AACxE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,QAAM,QAAQ;AAAA,IACZ,CAAC,YAAyB;AACxB,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { NovuUIOptions } from '../NovuUI.js';
|
|
4
|
+
import { DefaultSlackLinkUserProps } from './DefaultSlackLinkUser.js';
|
|
5
|
+
import '@novu/js';
|
|
6
|
+
import '@novu/js/ui';
|
|
7
|
+
import '../../utils/types.js';
|
|
8
|
+
|
|
9
|
+
type SlackLinkUserProps = DefaultSlackLinkUserProps & Pick<NovuUIOptions, 'container' | 'appearance'>;
|
|
10
|
+
declare const SlackLinkUser: React__default.MemoExoticComponent<(props: SlackLinkUserProps) => react_jsx_runtime.JSX.Element>;
|
|
11
|
+
|
|
12
|
+
export { SlackLinkUser, type SlackLinkUserProps };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/components/slack-link-user/SlackLinkUser.tsx
|
|
2
|
+
import React, { useMemo } from "react";
|
|
3
|
+
import { useNovu } from "../../hooks/NovuProvider.js";
|
|
4
|
+
import { NovuUI } from "../NovuUI.js";
|
|
5
|
+
import { withRenderer } from "../Renderer.js";
|
|
6
|
+
import { DefaultSlackLinkUser } from "./DefaultSlackLinkUser.js";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var SlackLinkUserInternal = withRenderer((props) => {
|
|
9
|
+
const { container, appearance, ...defaultProps } = props;
|
|
10
|
+
const novu = useNovu();
|
|
11
|
+
const options = useMemo(() => {
|
|
12
|
+
return {
|
|
13
|
+
container,
|
|
14
|
+
appearance,
|
|
15
|
+
options: novu.options
|
|
16
|
+
};
|
|
17
|
+
}, [container, appearance, novu.options]);
|
|
18
|
+
return /* @__PURE__ */ jsx(NovuUI, { options, novu, children: /* @__PURE__ */ jsx(DefaultSlackLinkUser, { ...defaultProps }) });
|
|
19
|
+
});
|
|
20
|
+
SlackLinkUserInternal.displayName = "SlackLinkUserInternal";
|
|
21
|
+
var SlackLinkUser = React.memo((props) => {
|
|
22
|
+
return /* @__PURE__ */ jsx(SlackLinkUserInternal, { ...props });
|
|
23
|
+
});
|
|
24
|
+
SlackLinkUser.displayName = "SlackLinkUser";
|
|
25
|
+
export {
|
|
26
|
+
SlackLinkUser
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=SlackLinkUser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/slack-link-user/SlackLinkUser.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultSlackLinkUser, DefaultSlackLinkUserProps } from './DefaultSlackLinkUser';\n\nexport type SlackLinkUserProps = DefaultSlackLinkUserProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst SlackLinkUserInternal = withRenderer<SlackLinkUserProps>((props) => {\n const { container, appearance, ...defaultProps } = props;\n const novu = useNovu();\n\n const options: NovuUIOptions = useMemo(() => {\n return {\n container,\n appearance,\n options: novu.options,\n };\n }, [container, appearance, novu.options]);\n\n return (\n <NovuUI options={options} novu={novu}>\n <DefaultSlackLinkUser {...defaultProps} />\n </NovuUI>\n );\n});\n\nSlackLinkUserInternal.displayName = 'SlackLinkUserInternal';\n\nexport const SlackLinkUser = React.memo((props: SlackLinkUserProps) => {\n return <SlackLinkUserInternal {...props} />;\n});\n\nSlackLinkUser.displayName = 'SlackLinkUser';\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,4BAAuD;AAkB1D;AAdN,IAAM,wBAAwB,aAAiC,CAAC,UAAU;AACxE,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,OAAO,QAAQ;AAErB,QAAM,UAAyB,QAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,oBAAC,UAAO,SAAkB,MACxB,8BAAC,wBAAsB,GAAG,cAAc,GAC1C;AAEJ,CAAC;AAED,sBAAsB,cAAc;AAE7B,IAAM,gBAAgB,MAAM,KAAK,CAAC,UAA8B;AACrE,SAAO,oBAAC,yBAAuB,GAAG,OAAO;AAC3C,CAAC;AAED,cAAc,cAAc;","names":[]}
|
|
@@ -3,6 +3,16 @@ import { NovuOptions, Novu } from '@novu/js';
|
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
type NovuProviderProps = NovuOptions & {
|
|
6
|
+
/**
|
|
7
|
+
* When `false`, disables the WebSocket subscription that auto-injects
|
|
8
|
+
* newly received notifications into the list and subscription that auto-resync
|
|
9
|
+
* notification counts. Built-in mutations like
|
|
10
|
+
* `readAll`, `seenAll`, `archiveAll`, and `archiveAllRead` continue to
|
|
11
|
+
* update local state. Use this when you want to drive new-notification updates yourself (e.g.
|
|
12
|
+
* via your own `novu.on('notifications.notification_received', ...)`
|
|
13
|
+
* handler combined with `refetch()`). Defaults to `true`.
|
|
14
|
+
*/
|
|
15
|
+
realtime?: boolean;
|
|
6
16
|
children: ReactNode;
|
|
7
17
|
};
|
|
8
18
|
declare const NovuProvider: (props: NovuProviderProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -11,6 +21,7 @@ declare const NovuProvider: (props: NovuProviderProps) => react_jsx_runtime.JSX.
|
|
|
11
21
|
*/
|
|
12
22
|
declare const InternalNovuProvider: (props: NovuProviderProps) => react_jsx_runtime.JSX.Element;
|
|
13
23
|
declare const useNovu: () => Novu;
|
|
14
|
-
declare const useUnsafeNovu: () => Novu
|
|
24
|
+
declare const useUnsafeNovu: () => Novu;
|
|
25
|
+
declare const useRealtime: () => boolean;
|
|
15
26
|
|
|
16
|
-
export { InternalNovuProvider, NovuProvider, type NovuProviderProps, useNovu, useUnsafeNovu };
|
|
27
|
+
export { InternalNovuProvider, NovuProvider, type NovuProviderProps, useNovu, useRealtime, useUnsafeNovu };
|
|
@@ -3,9 +3,9 @@ import { Novu } from "@novu/js";
|
|
|
3
3
|
import { buildSubscriber } from "@novu/js/internal";
|
|
4
4
|
import { createContext, useContext, useMemo } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
var NovuContext = createContext(void 0);
|
|
6
|
+
var NovuContext = createContext({ novu: void 0, realtime: true });
|
|
7
7
|
var NovuProvider = (props) => {
|
|
8
|
-
const { subscriberId, ...propsWithoutSubscriberId } = props;
|
|
8
|
+
const { subscriberId, realtime = true, ...propsWithoutSubscriberId } = props;
|
|
9
9
|
const subscriberObj = useMemo(
|
|
10
10
|
() => buildSubscriber({ subscriberId, subscriber: props.subscriber }),
|
|
11
11
|
[subscriberId, props.subscriber]
|
|
@@ -14,7 +14,8 @@ var NovuProvider = (props) => {
|
|
|
14
14
|
const providerProps = {
|
|
15
15
|
...propsWithoutSubscriberId,
|
|
16
16
|
applicationIdentifier,
|
|
17
|
-
subscriber: subscriberObj
|
|
17
|
+
subscriber: subscriberObj,
|
|
18
|
+
realtime
|
|
18
19
|
};
|
|
19
20
|
return /* @__PURE__ */ jsx(InternalNovuProvider, { ...providerProps, applicationIdentifier, children: props.children });
|
|
20
21
|
};
|
|
@@ -34,21 +35,25 @@ var InternalNovuProvider = (props) => {
|
|
|
34
35
|
socketOptions,
|
|
35
36
|
useCache,
|
|
36
37
|
defaultSchedule,
|
|
37
|
-
context
|
|
38
|
+
context,
|
|
39
|
+
realtime = true
|
|
38
40
|
} = props;
|
|
39
|
-
const
|
|
40
|
-
() =>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
const value = useMemo(
|
|
42
|
+
() => ({
|
|
43
|
+
novu: new Novu({
|
|
44
|
+
applicationIdentifier,
|
|
45
|
+
subscriberHash,
|
|
46
|
+
contextHash,
|
|
47
|
+
backendUrl,
|
|
48
|
+
apiUrl,
|
|
49
|
+
socketUrl,
|
|
50
|
+
socketOptions,
|
|
51
|
+
useCache,
|
|
52
|
+
subscriber: subscriberObj,
|
|
53
|
+
defaultSchedule,
|
|
54
|
+
context
|
|
55
|
+
}),
|
|
56
|
+
realtime
|
|
52
57
|
}),
|
|
53
58
|
[
|
|
54
59
|
applicationIdentifier,
|
|
@@ -60,26 +65,32 @@ var InternalNovuProvider = (props) => {
|
|
|
60
65
|
apiUrl,
|
|
61
66
|
socketUrl,
|
|
62
67
|
socketOptions,
|
|
63
|
-
useCache
|
|
68
|
+
useCache,
|
|
69
|
+
realtime
|
|
64
70
|
]
|
|
65
71
|
);
|
|
66
|
-
return /* @__PURE__ */ jsx(NovuContext.Provider, { value
|
|
72
|
+
return /* @__PURE__ */ jsx(NovuContext.Provider, { value, children });
|
|
67
73
|
};
|
|
68
74
|
var useNovu = () => {
|
|
69
75
|
const context = useContext(NovuContext);
|
|
70
|
-
if (!context) {
|
|
76
|
+
if (!context.novu) {
|
|
71
77
|
throw new Error("useNovu must be used within a <NovuProvider />");
|
|
72
78
|
}
|
|
73
|
-
return context;
|
|
79
|
+
return context.novu;
|
|
74
80
|
};
|
|
75
81
|
var useUnsafeNovu = () => {
|
|
76
82
|
const context = useContext(NovuContext);
|
|
77
|
-
return context;
|
|
83
|
+
return context.novu;
|
|
84
|
+
};
|
|
85
|
+
var useRealtime = () => {
|
|
86
|
+
const context = useContext(NovuContext);
|
|
87
|
+
return context.realtime;
|
|
78
88
|
};
|
|
79
89
|
export {
|
|
80
90
|
InternalNovuProvider,
|
|
81
91
|
NovuProvider,
|
|
82
92
|
useNovu,
|
|
93
|
+
useRealtime,
|
|
83
94
|
useUnsafeNovu
|
|
84
95
|
};
|
|
85
96
|
//# sourceMappingURL=NovuProvider.js.map
|