@notiflyio/react
Advanced tools
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/Bell.tsx"],"sourcesContent":["import React from 'react';\r\nimport { useNovuUI } from '../context/NovuUIContext';\r\nimport { useRenderer } from '../context/RendererContext';\r\nimport { BellRenderer } from '../utils/types';\r\nimport { Mounter } from './Mounter';\r\nimport { withRenderer } from './Renderer';\r\n\r\nexport type BellProps = {\r\n renderBell?: BellRenderer;\r\n};\r\n\r\nconst _Bell = React.memo((props: BellProps) => {\r\n const { renderBell } = props;\r\n const { novuUI } = useNovuUI();\r\n const { mountElement } = useRenderer();\r\n\r\n const mount = React.useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'Bell',\r\n element,\r\n props: renderBell\r\n ? {\r\n renderBell: (el, unreadCount) => mountElement(el, renderBell(unreadCount)),\r\n }\r\n : undefined,\r\n });\r\n },\r\n [renderBell, mountElement, novuUI]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n});\r\n\r\nexport const Bell = withRenderer(_Bell);\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,2BAA0B;AAC1B,6BAA4B;AAE5B,qBAAwB;AACxB,sBAA6B;AA0BpB;AApBT,IAAM,QAAQ,aAAAA,QAAM,KAAK,CAAC,UAAqB;AAC7C,QAAM,EAAE,WAAW,IAAI;AACvB,QAAM,EAAE,OAAO,QAAI,gCAAU;AAC7B,QAAM,EAAE,aAAa,QAAI,oCAAY;AAErC,QAAM,QAAQ,aAAAA,QAAM;AAAA,IAClB,CAAC,YAAyB;AACxB,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN;AAAA,QACA,OAAO,aACH;AAAA,UACE,YAAY,CAAC,IAAI,gBAAgB,aAAa,IAAI,WAAW,WAAW,CAAC;AAAA,QAC3E,IACA;AAAA,MACN,CAAC;AAAA,IACH;AAAA,IACA,CAAC,YAAY,cAAc,MAAM;AAAA,EACnC;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC,CAAC;AAEM,IAAM,WAAO,8BAAa,KAAK;","names":["React"]} | ||
| {"version":3,"sources":["../../../src/components/Bell.tsx"],"sourcesContent":["import React from 'react';\nimport { useNovuUI } from '../context/NovuUIContext';\nimport { useRenderer } from '../context/RendererContext';\nimport { BellRenderer } from '../utils/types';\nimport { Mounter } from './Mounter';\nimport { withRenderer } from './Renderer';\n\nexport type BellProps = {\n renderBell?: BellRenderer;\n};\n\nconst _Bell = React.memo((props: BellProps) => {\n const { renderBell } = props;\n const { novuUI } = useNovuUI();\n const { mountElement } = useRenderer();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'Bell',\n element,\n props: renderBell\n ? {\n renderBell: (el, unreadCount) => mountElement(el, renderBell(unreadCount)),\n }\n : undefined,\n });\n },\n [renderBell, mountElement, novuUI]\n );\n\n return <Mounter mount={mount} />;\n});\n\nexport const Bell = withRenderer(_Bell);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,2BAA0B;AAC1B,6BAA4B;AAE5B,qBAAwB;AACxB,sBAA6B;AA0BpB;AApBT,IAAM,QAAQ,aAAAA,QAAM,KAAK,CAAC,UAAqB;AAC7C,QAAM,EAAE,WAAW,IAAI;AACvB,QAAM,EAAE,OAAO,QAAI,gCAAU;AAC7B,QAAM,EAAE,aAAa,QAAI,oCAAY;AAErC,QAAM,QAAQ,aAAAA,QAAM;AAAA,IAClB,CAAC,YAAyB;AACxB,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN;AAAA,QACA,OAAO,aACH;AAAA,UACE,YAAY,CAAC,IAAI,gBAAgB,aAAa,IAAI,WAAW,WAAW,CAAC;AAAA,QAC3E,IACA;AAAA,MACN,CAAC;AAAA,IACH;AAAA,IACA,CAAC,YAAY,cAAc,MAAM;AAAA,EACnC;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC,CAAC;AAEM,IAAM,WAAO,8BAAa,KAAK;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/connect-chat/ConnectChat.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\nimport { useNovu } from '../../hooks/NovuProvider';\r\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\r\nimport { withRenderer } from '../Renderer';\r\nimport { DefaultConnectChat, DefaultConnectChatProps } from './DefaultConnectChat';\r\n\r\nexport type ConnectChatProps = DefaultConnectChatProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\r\n\r\nconst ConnectChatInternal = withRenderer<ConnectChatProps>((props) => {\r\n const { container, appearance, ...defaultProps } = props;\r\n const novu = useNovu();\r\n\r\n const options: NovuUIOptions = useMemo(() => {\r\n return {\r\n container,\r\n appearance,\r\n options: novu.options,\r\n };\r\n }, [container, appearance, novu.options]);\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultConnectChat {...defaultProps} />\r\n </NovuUI>\r\n );\r\n});\r\n\r\nConnectChatInternal.displayName = 'ConnectChatInternal';\r\n\r\nexport const ConnectChat = React.memo((props: ConnectChatProps) => {\r\n return <ConnectChatInternal {...props} />;\r\n});\r\n\r\nConnectChat.displayName = 'ConnectChat';\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,0BAAwB;AACxB,oBAAsC;AACtC,sBAA6B;AAC7B,gCAA4D;AAkBtD;AAdN,IAAM,0BAAsB,8BAA+B,CAAC,UAAU;AACpE,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,WAAO,6BAAQ;AAErB,QAAM,cAAyB,sBAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,4CAAC,wBAAO,SAAkB,MACxB,sDAAC,gDAAoB,GAAG,cAAc,GACxC;AAEJ,CAAC;AAED,oBAAoB,cAAc;AAE3B,IAAM,cAAc,aAAAA,QAAM,KAAK,CAAC,UAA4B;AACjE,SAAO,4CAAC,uBAAqB,GAAG,OAAO;AACzC,CAAC;AAED,YAAY,cAAc;","names":["React"]} | ||
| {"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;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,0BAAwB;AACxB,oBAAsC;AACtC,sBAA6B;AAC7B,gCAA4D;AAkBtD;AAdN,IAAM,0BAAsB,8BAA+B,CAAC,UAAU;AACpE,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,WAAO,6BAAQ;AAErB,QAAM,cAAyB,sBAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,4CAAC,wBAAO,SAAkB,MACxB,sDAAC,gDAAoB,GAAG,cAAc,GACxC;AAEJ,CAAC;AAED,oBAAoB,cAAc;AAE3B,IAAM,cAAc,aAAAA,QAAM,KAAK,CAAC,UAA4B;AACjE,SAAO,4CAAC,uBAAqB,GAAG,OAAO;AACzC,CAAC;AAED,YAAY,cAAc;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/connect-chat/DefaultConnectChat.tsx"],"sourcesContent":["import { ConnectChatProps } from '@notiflyio/js/ui';\r\nimport { useCallback } from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type DefaultConnectChatProps = Pick<\r\n ConnectChatProps,\r\n | 'integrationIdentifier'\r\n | 'connectionIdentifier'\r\n | 'subscriberId'\r\n | 'context'\r\n | 'scope'\r\n | 'connectionMode'\r\n | 'onConnectSuccess'\r\n | 'onConnectError'\r\n | 'onDisconnectSuccess'\r\n | 'onDisconnectError'\r\n>;\r\n\r\nexport const DefaultConnectChat = (props: DefaultConnectChatProps) => {\r\n const {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'ConnectChat',\r\n props: {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n },\r\n element,\r\n });\r\n },\r\n [\r\n novuUI,\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAC5B,2BAA0B;AAC1B,qBAAwB;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,QAAI,gCAAU;AAE7B,QAAM,YAAQ;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,4CAAC,0BAAQ,OAAc;AAChC;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/connect-chat/DefaultConnectChat.tsx"],"sourcesContent":["import { ConnectChatProps } from '@notiflyio/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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAC5B,2BAA0B;AAC1B,qBAAwB;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,QAAI,gCAAU;AAE7B,QAAM,YAAQ;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,4CAAC,0BAAQ,OAAc;AAChC;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/Inbox.tsx"],"sourcesContent":["import { StandardNovuOptions } from '@notiflyio/js';\r\nimport { buildSubscriber } from '@notiflyio/js/internal';\r\nimport React, { useMemo } from 'react';\r\nimport { useNovuUI } from '../context/NovuUIContext';\r\nimport { useRenderer } from '../context/RendererContext';\r\nimport { InternalNovuProvider, useNovu, useUnsafeNovu } from '../hooks/NovuProvider';\r\nimport { DefaultInboxProps, DefaultProps, WithChildrenProps } from '../utils/types';\r\nimport { Mounter } from './Mounter';\r\nimport { NovuUI } from './NovuUI';\r\nimport { withRenderer } from './Renderer';\r\n\r\nexport type InboxProps = DefaultProps | WithChildrenProps;\r\n\r\nconst DefaultInbox = (props: DefaultInboxProps) => {\r\n const {\r\n open,\r\n renderNotification,\r\n renderAvatar,\r\n renderSubject,\r\n renderBody,\r\n renderDefaultActions,\r\n renderCustomActions,\r\n renderBell,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n placement,\r\n placementOffset,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n const { mountElement } = useRenderer();\r\n\r\n const mount = React.useCallback(\r\n (element: HTMLElement) => {\r\n if (renderNotification) {\r\n return novuUI.mountComponent({\r\n name: 'Inbox',\r\n props: {\r\n open,\r\n renderNotification: renderNotification\r\n ? (el, notification) => mountElement(el, renderNotification(notification))\r\n : undefined,\r\n renderBell: renderBell ? (el, unreadCount) => mountElement(el, renderBell(unreadCount)) : undefined,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n placementOffset,\r\n placement,\r\n },\r\n element,\r\n });\r\n }\r\n\r\n return novuUI.mountComponent({\r\n name: 'Inbox',\r\n props: {\r\n open,\r\n renderAvatar: renderAvatar ? (el, notification) => mountElement(el, renderAvatar(notification)) : undefined,\r\n renderSubject: renderSubject\r\n ? (el, notification) => mountElement(el, renderSubject(notification))\r\n : undefined,\r\n renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : undefined,\r\n renderDefaultActions: renderDefaultActions\r\n ? (el, notification) => mountElement(el, renderDefaultActions(notification))\r\n : undefined,\r\n renderCustomActions: renderCustomActions\r\n ? (el, notification) => mountElement(el, renderCustomActions(notification))\r\n : undefined,\r\n renderBell: renderBell ? (el, unreadCount) => mountElement(el, renderBell(unreadCount)) : undefined,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n placementOffset,\r\n placement,\r\n },\r\n element,\r\n });\r\n },\r\n [\r\n open,\r\n renderNotification,\r\n renderAvatar,\r\n renderSubject,\r\n renderBody,\r\n renderDefaultActions,\r\n renderCustomActions,\r\n renderBell,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n\r\nexport const Inbox = React.memo((props: InboxProps) => {\r\n const { subscriberId, ...propsWithoutSubscriberId } = props;\r\n const subscriber = useMemo(\r\n () => buildSubscriber({ subscriberId: props.subscriberId, subscriber: props.subscriber }),\r\n [props.subscriberId, props.subscriber]\r\n );\r\n const applicationIdentifier = props.applicationIdentifier ? props.applicationIdentifier : ''; // for keyless we provide an empty string, the api will generate a identifier\r\n const novu = useUnsafeNovu();\r\n\r\n if (novu) {\r\n return (\r\n <InboxChild {...propsWithoutSubscriberId} applicationIdentifier={applicationIdentifier} subscriber={subscriber} />\r\n );\r\n }\r\n\r\n const providerProps = {\r\n applicationIdentifier,\r\n subscriberHash: props.subscriberHash,\r\n contextHash: props.contextHash,\r\n backendUrl: props.backendUrl,\r\n socketUrl: props.socketUrl,\r\n socketOptions: props.socketOptions,\r\n subscriber,\r\n defaultSchedule: props.defaultSchedule,\r\n context: props.context,\r\n } satisfies StandardNovuOptions;\r\n\r\n return (\r\n <InternalNovuProvider {...providerProps}>\r\n <InboxChild {...propsWithoutSubscriberId} applicationIdentifier={applicationIdentifier} subscriber={subscriber} />\r\n </InternalNovuProvider>\r\n );\r\n});\r\n\r\nconst InboxChild = withRenderer(\r\n React.memo((props: InboxProps) => {\r\n const {\r\n localization,\r\n appearance,\r\n tabs,\r\n preferencesFilter,\r\n preferenceGroups,\r\n preferencesSort,\r\n routerPush,\r\n applicationIdentifier = '', // for keyless we provide an empty string, the api will generate a identifier\r\n subscriberId,\r\n subscriberHash,\r\n contextHash,\r\n backendUrl,\r\n socketUrl,\r\n socketOptions,\r\n subscriber,\r\n defaultSchedule,\r\n context,\r\n } = props;\r\n const novu = useNovu();\r\n\r\n const options = useMemo(() => {\r\n return {\r\n localization,\r\n appearance,\r\n tabs,\r\n preferencesFilter,\r\n preferenceGroups,\r\n preferencesSort,\r\n routerPush,\r\n options: {\r\n applicationIdentifier,\r\n subscriberHash,\r\n contextHash,\r\n backendUrl,\r\n socketUrl,\r\n socketOptions,\r\n subscriber: buildSubscriber({ subscriberId, subscriber }),\r\n defaultSchedule,\r\n context,\r\n },\r\n };\r\n }, [\r\n localization,\r\n appearance,\r\n tabs,\r\n preferencesFilter,\r\n preferenceGroups,\r\n preferencesSort,\r\n applicationIdentifier,\r\n subscriberId,\r\n subscriberHash,\r\n contextHash,\r\n backendUrl,\r\n socketUrl,\r\n socketOptions,\r\n subscriber,\r\n context,\r\n ]);\r\n\r\n if (isWithChildrenProps(props)) {\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n {props.children}\r\n </NovuUI>\r\n );\r\n }\r\n\r\n const {\r\n open,\r\n renderNotification,\r\n renderAvatar,\r\n renderSubject,\r\n renderBody,\r\n renderDefaultActions,\r\n renderCustomActions,\r\n renderBell,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n placementOffset,\r\n placement,\r\n } = props;\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultInbox\r\n open={open}\r\n renderNotification={renderNotification}\r\n renderAvatar={renderAvatar}\r\n renderSubject={renderSubject}\r\n renderBody={renderBody}\r\n renderDefaultActions={renderDefaultActions}\r\n renderCustomActions={renderCustomActions}\r\n renderBell={renderBell}\r\n onNotificationClick={onNotificationClick}\r\n onPrimaryActionClick={onPrimaryActionClick}\r\n onSecondaryActionClick={onSecondaryActionClick}\r\n placement={placement}\r\n placementOffset={placementOffset}\r\n />\r\n </NovuUI>\r\n );\r\n })\r\n);\r\n\r\nInboxChild.displayName = 'InboxChild';\r\n\r\nfunction isWithChildrenProps(props: InboxProps): props is WithChildrenProps {\r\n return 'children' in props;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAgC;AAChC,mBAA+B;AAC/B,2BAA0B;AAC1B,6BAA4B;AAC5B,0BAA6D;AAE7D,qBAAwB;AACxB,oBAAuB;AACvB,sBAA6B;AAoFpB;AAhFT,IAAM,eAAe,CAAC,UAA6B;AACjD,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,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,OAAO,QAAI,gCAAU;AAC7B,QAAM,EAAE,aAAa,QAAI,oCAAY;AAErC,QAAM,QAAQ,aAAAA,QAAM;AAAA,IAClB,CAAC,YAAyB;AACxB,UAAI,oBAAoB;AACtB,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN,OAAO;AAAA,YACL;AAAA,YACA,oBAAoB,qBAChB,CAAC,IAAI,iBAAiB,aAAa,IAAI,mBAAmB,YAAY,CAAC,IACvE;AAAA,YACJ,YA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ACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,QAAI,oBAAoB,KAAK,GAAG;AAC9B,aACE,4CAAC,wBAAO,SAAkB,MACvB,gBAAM,UACT;AAAA,IAEJ;AAEA,UAAM;AAAA,MACJ;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,IAAI;AAEJ,WACE,4CAAC,wBAAO,SAAkB,MACxB;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF,GACF;AAAA,EAEJ,CAAC;AACH;AAEA,WAAW,cAAc;AAEzB,SAAS,oBAAoB,OAA+C;AAC1E,SAAO,cAAc;AACvB;","names":["React"]} | ||
| {"version":3,"sources":["../../../src/components/Inbox.tsx"],"sourcesContent":["import { StandardNovuOptions } from '@notiflyio/js';\nimport { buildSubscriber } from '@notiflyio/js/internal';\nimport React, { useMemo } from 'react';\nimport { useNovuUI } from '../context/NovuUIContext';\nimport { useRenderer } from '../context/RendererContext';\nimport { InternalNovuProvider, useNovu, useUnsafeNovu } from '../hooks/NovuProvider';\nimport { DefaultInboxProps, DefaultProps, WithChildrenProps } from '../utils/types';\nimport { Mounter } from './Mounter';\nimport { NovuUI } from './NovuUI';\nimport { withRenderer } from './Renderer';\n\nexport type InboxProps = DefaultProps | WithChildrenProps;\n\nconst DefaultInbox = (props: DefaultInboxProps) => {\n const {\n open,\n renderNotification,\n renderAvatar,\n renderSubject,\n renderBody,\n renderDefaultActions,\n renderCustomActions,\n renderBell,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n placement,\n placementOffset,\n } = props;\n const { novuUI } = useNovuUI();\n const { mountElement } = useRenderer();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n if (renderNotification) {\n return novuUI.mountComponent({\n name: 'Inbox',\n props: {\n open,\n renderNotification: renderNotification\n ? (el, notification) => mountElement(el, renderNotification(notification))\n : undefined,\n renderBell: renderBell ? (el, unreadCount) => mountElement(el, renderBell(unreadCount)) : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n placementOffset,\n placement,\n },\n element,\n });\n }\n\n return novuUI.mountComponent({\n name: 'Inbox',\n props: {\n open,\n renderAvatar: renderAvatar ? (el, notification) => mountElement(el, renderAvatar(notification)) : undefined,\n renderSubject: renderSubject\n ? (el, notification) => mountElement(el, renderSubject(notification))\n : undefined,\n renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : undefined,\n renderDefaultActions: renderDefaultActions\n ? (el, notification) => mountElement(el, renderDefaultActions(notification))\n : undefined,\n renderCustomActions: renderCustomActions\n ? (el, notification) => mountElement(el, renderCustomActions(notification))\n : undefined,\n renderBell: renderBell ? (el, unreadCount) => mountElement(el, renderBell(unreadCount)) : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n placementOffset,\n placement,\n },\n element,\n });\n },\n [\n open,\n renderNotification,\n renderAvatar,\n renderSubject,\n renderBody,\n renderDefaultActions,\n renderCustomActions,\n renderBell,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n ]\n );\n\n return <Mounter mount={mount} />;\n};\n\nexport const Inbox = React.memo((props: InboxProps) => {\n const { subscriberId, ...propsWithoutSubscriberId } = props;\n const subscriber = useMemo(\n () => buildSubscriber({ subscriberId: props.subscriberId, subscriber: props.subscriber }),\n [props.subscriberId, props.subscriber]\n );\n const applicationIdentifier = props.applicationIdentifier ? props.applicationIdentifier : ''; // for keyless we provide an empty string, the api will generate a identifier\n const novu = useUnsafeNovu();\n\n if (novu) {\n return (\n <InboxChild {...propsWithoutSubscriberId} applicationIdentifier={applicationIdentifier} subscriber={subscriber} />\n );\n }\n\n const providerProps = {\n applicationIdentifier,\n subscriberHash: props.subscriberHash,\n contextHash: props.contextHash,\n backendUrl: props.backendUrl,\n socketUrl: props.socketUrl,\n socketOptions: props.socketOptions,\n subscriber,\n defaultSchedule: props.defaultSchedule,\n context: props.context,\n } satisfies StandardNovuOptions;\n\n return (\n <InternalNovuProvider {...providerProps}>\n <InboxChild {...propsWithoutSubscriberId} applicationIdentifier={applicationIdentifier} subscriber={subscriber} />\n </InternalNovuProvider>\n );\n});\n\nconst InboxChild = withRenderer(\n React.memo((props: InboxProps) => {\n const {\n localization,\n appearance,\n tabs,\n preferencesFilter,\n preferenceGroups,\n preferencesSort,\n routerPush,\n applicationIdentifier = '', // for keyless we provide an empty string, the api will generate a identifier\n subscriberId,\n subscriberHash,\n contextHash,\n backendUrl,\n socketUrl,\n socketOptions,\n subscriber,\n defaultSchedule,\n context,\n } = props;\n const novu = useNovu();\n\n const options = useMemo(() => {\n return {\n localization,\n appearance,\n tabs,\n preferencesFilter,\n preferenceGroups,\n preferencesSort,\n routerPush,\n options: {\n applicationIdentifier,\n subscriberHash,\n contextHash,\n backendUrl,\n socketUrl,\n socketOptions,\n subscriber: buildSubscriber({ subscriberId, subscriber }),\n defaultSchedule,\n context,\n },\n };\n }, [\n localization,\n appearance,\n tabs,\n preferencesFilter,\n preferenceGroups,\n preferencesSort,\n applicationIdentifier,\n subscriberId,\n subscriberHash,\n contextHash,\n backendUrl,\n socketUrl,\n socketOptions,\n subscriber,\n context,\n ]);\n\n if (isWithChildrenProps(props)) {\n return (\n <NovuUI options={options} novu={novu}>\n {props.children}\n </NovuUI>\n );\n }\n\n const {\n open,\n renderNotification,\n renderAvatar,\n renderSubject,\n renderBody,\n renderDefaultActions,\n renderCustomActions,\n renderBell,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n placementOffset,\n placement,\n } = props;\n\n return (\n <NovuUI options={options} novu={novu}>\n <DefaultInbox\n open={open}\n renderNotification={renderNotification}\n renderAvatar={renderAvatar}\n renderSubject={renderSubject}\n renderBody={renderBody}\n renderDefaultActions={renderDefaultActions}\n renderCustomActions={renderCustomActions}\n renderBell={renderBell}\n onNotificationClick={onNotificationClick}\n onPrimaryActionClick={onPrimaryActionClick}\n onSecondaryActionClick={onSecondaryActionClick}\n placement={placement}\n placementOffset={placementOffset}\n />\n </NovuUI>\n );\n })\n);\n\nInboxChild.displayName = 'InboxChild';\n\nfunction isWithChildrenProps(props: InboxProps): props is WithChildrenProps {\n return 'children' in props;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAgC;AAChC,mBAA+B;AAC/B,2BAA0B;AAC1B,6BAA4B;AAC5B,0BAA6D;AAE7D,qBAAwB;AACxB,oBAAuB;AACvB,sBAA6B;AAoFpB;AAhFT,IAAM,eAAe,CAAC,UAA6B;AACjD,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,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,OAAO,QAAI,gCAAU;AAC7B,QAAM,EAAE,aAAa,QAAI,oCAAY;AAErC,QAAM,QAAQ,aAAAA,QAAM;AAAA,IAClB,CAAC,YAAyB;AACxB,UAAI,oBAAoB;AACtB,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN,OAAO;AAAA,YACL;AAAA,YACA,oBAAoB,qBAChB,CAAC,IAAI,iBAAiB,aAAa,IAAI,mBAAmB,YAAY,CAAC,IACvE;AAAA,YACJ,YAAY,aAAa,CAAC,IAAI,gBAAgB,aAAa,IAAI,WAAW,WAAW,CAAC,IAAI;AAAA,YAC1F;AAAA,YACA;AAAA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,MACA;AAAA,IACF,CAAC;AAED,QAAI,oBAAoB,KAAK,GAAG;AAC9B,aACE,4CAAC,wBAAO,SAAkB,MACvB,gBAAM,UACT;AAAA,IAEJ;AAEA,UAAM;AAAA,MACJ;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,IAAI;AAEJ,WACE,4CAAC,wBAAO,SAAkB,MACxB;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF,GACF;AAAA,EAEJ,CAAC;AACH;AAEA,WAAW,cAAc;AAEzB,SAAS,oBAAoB,OAA+C;AAC1E,SAAO,cAAc;AACvB;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/InboxContent.tsx"],"sourcesContent":["import type { InboxPage, NotificationActionClickHandler, NotificationClickHandler } from '@notiflyio/js/ui';\r\nimport React from 'react';\r\nimport { useNovuUI } from '../context/NovuUIContext';\r\nimport { useRenderer } from '../context/RendererContext';\r\nimport { NoRendererProps, NotificationRendererProps, SubjectBodyRendererProps } from '../utils/types';\r\nimport { Mounter } from './Mounter';\r\nimport { withRenderer } from './Renderer';\r\n\r\nexport type InboxContentProps = {\r\n onNotificationClick?: NotificationClickHandler;\r\n onPrimaryActionClick?: NotificationActionClickHandler;\r\n onSecondaryActionClick?: NotificationActionClickHandler;\r\n initialPage?: InboxPage;\r\n hideNav?: boolean;\r\n} & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);\r\n\r\nconst _InboxContent = React.memo((props: InboxContentProps) => {\r\n const {\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n renderNotification,\r\n renderAvatar,\r\n renderSubject,\r\n renderBody,\r\n renderDefaultActions,\r\n renderCustomActions,\r\n onSecondaryActionClick,\r\n initialPage,\r\n hideNav,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n const { mountElement } = useRenderer();\r\n\r\n const mount = React.useCallback(\r\n (element: HTMLElement) => {\r\n if (renderNotification) {\r\n return novuUI.mountComponent({\r\n name: 'InboxContent',\r\n element,\r\n props: {\r\n renderNotification: renderNotification\r\n ? (el, notification) => mountElement(el, renderNotification(notification))\r\n : undefined,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n initialPage,\r\n hideNav,\r\n },\r\n });\r\n }\r\n\r\n return novuUI.mountComponent({\r\n name: 'InboxContent',\r\n element,\r\n props: {\r\n renderAvatar: renderAvatar ? (el, notification) => mountElement(el, renderAvatar(notification)) : undefined,\r\n renderSubject: renderSubject\r\n ? (el, notification) => mountElement(el, renderSubject(notification))\r\n : undefined,\r\n renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : undefined,\r\n renderDefaultActions: renderDefaultActions\r\n ? (el, notification) => mountElement(el, renderDefaultActions(notification))\r\n : undefined,\r\n renderCustomActions: renderCustomActions\r\n ? (el, notification) => mountElement(el, renderCustomActions(notification))\r\n : undefined,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n initialPage,\r\n hideNav,\r\n },\r\n });\r\n },\r\n [\r\n renderNotification,\r\n renderAvatar,\r\n renderSubject,\r\n renderBody,\r\n renderDefaultActions,\r\n renderCustomActions,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n});\r\n\r\nexport const InboxContent = withRenderer(_InboxContent);\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,2BAA0B;AAC1B,6BAA4B;AAE5B,qBAAwB;AACx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A,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC,CAAC;AAEM,IAAM,mBAAe,8BAAa,aAAa;","names":["React"]} | ||
| {"version":3,"sources":["../../../src/components/InboxContent.tsx"],"sourcesContent":["import type { InboxPage, NotificationActionClickHandler, NotificationClickHandler } from '@notiflyio/js/ui';\nimport React from 'react';\nimport { useNovuUI } from '../context/NovuUIContext';\nimport { useRenderer } from '../context/RendererContext';\nimport { NoRendererProps, NotificationRendererProps, SubjectBodyRendererProps } from '../utils/types';\nimport { Mounter } from './Mounter';\nimport { withRenderer } from './Renderer';\n\nexport type InboxContentProps = {\n onNotificationClick?: NotificationClickHandler;\n onPrimaryActionClick?: NotificationActionClickHandler;\n onSecondaryActionClick?: NotificationActionClickHandler;\n initialPage?: InboxPage;\n hideNav?: boolean;\n} & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);\n\nconst _InboxContent = React.memo((props: InboxContentProps) => {\n const {\n onNotificationClick,\n onPrimaryActionClick,\n renderNotification,\n renderAvatar,\n renderSubject,\n renderBody,\n renderDefaultActions,\n renderCustomActions,\n onSecondaryActionClick,\n initialPage,\n hideNav,\n } = props;\n const { novuUI } = useNovuUI();\n const { mountElement } = useRenderer();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n if (renderNotification) {\n return novuUI.mountComponent({\n name: 'InboxContent',\n element,\n props: {\n renderNotification: renderNotification\n ? (el, notification) => mountElement(el, renderNotification(notification))\n : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n initialPage,\n hideNav,\n },\n });\n }\n\n return novuUI.mountComponent({\n name: 'InboxContent',\n element,\n props: {\n renderAvatar: renderAvatar ? (el, notification) => mountElement(el, renderAvatar(notification)) : undefined,\n renderSubject: renderSubject\n ? (el, notification) => mountElement(el, renderSubject(notification))\n : undefined,\n renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : undefined,\n renderDefaultActions: renderDefaultActions\n ? (el, notification) => mountElement(el, renderDefaultActions(notification))\n : undefined,\n renderCustomActions: renderCustomActions\n ? (el, notification) => mountElement(el, renderCustomActions(notification))\n : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n initialPage,\n hideNav,\n },\n });\n },\n [\n renderNotification,\n renderAvatar,\n renderSubject,\n renderBody,\n renderDefaultActions,\n renderCustomActions,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n ]\n );\n\n return <Mounter mount={mount} />;\n});\n\nexport const InboxContent = withRenderer(_InboxContent);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,2BAA0B;AAC1B,6BAA4B;AAE5B,qBAAwB;AACxB,sBAA6B;AAkFpB;AAxET,IAAM,gBAAgB,aAAAA,QAAM,KAAK,CAAC,UAA6B;AAC7D,QAAM;AAAA,IACJ;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,QAAI,gCAAU;AAC7B,QAAM,EAAE,aAAa,QAAI,oCAAY;AAErC,QAAM,QAAQ,aAAAA,QAAM;AAAA,IAClB,CAAC,YAAyB;AACxB,UAAI,oBAAoB;AACtB,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA,OAAO;AAAA,YACL,oBAAoB,qBAChB,CAAC,IAAI,iBAAiB,aAAa,IAAI,mBAAmB,YAAY,CAAC,IACvE;AAAA,YACJ;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAEA,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN;AAAA,QACA,OAAO;AAAA,UACL,cAAc,eAAe,CAAC,IAAI,iBAAiB,aAAa,IAAI,aAAa,YAAY,CAAC,IAAI;AAAA,UAClG,eAAe,gBACX,CAAC,IAAI,iBAAiB,aAAa,IAAI,cAAc,YAAY,CAAC,IAClE;AAAA,UACJ,YAAY,aAAa,CAAC,IAAI,iBAAiB,aAAa,IAAI,WAAW,YAAY,CAAC,IAAI;AAAA,UAC5F,sBAAsB,uBAClB,CAAC,IAAI,iBAAiB,aAAa,IAAI,qBAAqB,YAAY,CAAC,IACzE;AAAA,UACJ,qBAAqB,sBACjB,CAAC,IAAI,iBAAiB,aAAa,IAAI,oBAAoB,YAAY,CAAC,IACxE;AAAA,UACJ;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;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,IACF;AAAA,EACF;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC,CAAC;AAEM,IAAM,mBAAe,8BAAa,aAAa;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from '../hooks/NovuProvider';\r\nexport * from './Bell';\r\nexport * from './Inbox';\r\nexport * from './InboxContent';\r\nexport * from './msteams-connect-button/MsTeamsConnectButton';\r\nexport * from './msteams-link-user/MsTeamsLinkUser';\r\nexport * from './Notifications';\r\nexport * from './Preferences';\r\nexport * from './slack-connect-button/SlackConnectButton';\r\nexport * from './slack-link-user/SlackLinkUser';\r\nexport * from './subscription/Subscription';\r\nexport * from './subscription/SubscriptionButton';\r\nexport * from './subscription/SubscriptionPreferences';\r\nexport * from './telegram-connect-button/TelegramConnectButton';\r\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,sCAAd;AACA,+BAAc,uBADd;AAEA,+BAAc,wBAFd;AAGA,+BAAc,+BAHd;AAIA,+BAAc,8DAJd;AAKA,+BAAc,oDALd;AAMA,+BAAc,gCANd;AAOA,+BAAc,8BAPd;AAQA,+BAAc,0DARd;AASA,+BAAc,gDATd;AAUA,+BAAc,4CAVd;AAWA,+BAAc,kDAXd;AAYA,+BAAc,uDAZd;AAaA,+BAAc,gEAbd;","names":[]} | ||
| {"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from '../hooks/NovuProvider';\nexport * from './Bell';\nexport * from './Inbox';\nexport * from './InboxContent';\nexport * from './msteams-connect-button/MsTeamsConnectButton';\nexport * from './msteams-link-user/MsTeamsLinkUser';\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';\nexport * from './telegram-connect-button/TelegramConnectButton';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,sCAAd;AACA,+BAAc,uBADd;AAEA,+BAAc,wBAFd;AAGA,+BAAc,+BAHd;AAIA,+BAAc,8DAJd;AAKA,+BAAc,oDALd;AAMA,+BAAc,gCANd;AAOA,+BAAc,8BAPd;AAQA,+BAAc,0DARd;AASA,+BAAc,gDATd;AAUA,+BAAc,4CAVd;AAWA,+BAAc,kDAXd;AAYA,+BAAc,uDAZd;AAaA,+BAAc,gEAbd;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/Mounter.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\r\n\r\ntype MounterProps = {\r\n mount: (node: HTMLElement) => ((node: HTMLElement) => void) | void;\r\n};\r\n\r\n/**\r\n * Mounter allows you to mount a component to a DOM node.\r\n */\r\nexport function Mounter({ mount }: MounterProps) {\r\n const ref = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n let unmount: (node: HTMLDivElement) => void | undefined;\r\n const element = ref.current;\r\n if (element && mount) {\r\n const possibleUnmount = mount(element);\r\n if (possibleUnmount) {\r\n unmount = possibleUnmount;\r\n }\r\n }\r\n\r\n return () => {\r\n if (element && unmount) {\r\n unmount(element);\r\n }\r\n };\r\n }, [ref, mount]);\r\n\r\n return <div ref={ref} />;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkC;AA6BzB;AApBF,SAAS,QAAQ,EAAE,MAAM,GAAiB;AAC/C,QAAM,UAAM,qBAAuB,IAAI;AAEvC,8BAAU,MAAM;AACd,QAAI;AACJ,UAAM,UAAU,IAAI;AACpB,QAAI,WAAW,OAAO;AACpB,YAAM,kBAAkB,MAAM,OAAO;AACrC,UAAI,iBAAiB;AACnB,kBAAU;AAAA,MACZ;AAAA,IACF;AAEA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,gBAAQ,OAAO;AAAA,MACjB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,KAAK,KAAK,CAAC;AAEf,SAAO,4CAAC,SAAI,KAAU;AACxB;","names":[]} | ||
| {"version":3,"sources":["../../../src/components/Mounter.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\ntype MounterProps = {\n mount: (node: HTMLElement) => ((node: HTMLElement) => void) | void;\n};\n\n/**\n * Mounter allows you to mount a component to a DOM node.\n */\nexport function Mounter({ mount }: MounterProps) {\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n let unmount: (node: HTMLDivElement) => void | undefined;\n const element = ref.current;\n if (element && mount) {\n const possibleUnmount = mount(element);\n if (possibleUnmount) {\n unmount = possibleUnmount;\n }\n }\n\n return () => {\n if (element && unmount) {\n unmount(element);\n }\n };\n }, [ref, mount]);\n\n return <div ref={ref} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkC;AA6BzB;AApBF,SAAS,QAAQ,EAAE,MAAM,GAAiB;AAC/C,QAAM,UAAM,qBAAuB,IAAI;AAEvC,8BAAU,MAAM;AACd,QAAI;AACJ,UAAM,UAAU,IAAI;AACpB,QAAI,WAAW,OAAO;AACpB,YAAM,kBAAkB,MAAM,OAAO;AACrC,UAAI,iBAAiB;AACnB,kBAAU;AAAA,MACZ;AAAA,IACF;AAEA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,gBAAQ,OAAO;AAAA,MACjB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,KAAK,KAAK,CAAC;AAEf,SAAO,4CAAC,SAAI,KAAU;AACxB;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/msteams-connect-button/DefaultMsTeamsConnectButton.tsx"],"sourcesContent":["import { MsTeamsConnectButtonProps } from '@notiflyio/js/ui';\r\nimport { useCallback } from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type DefaultMsTeamsConnectButtonProps = Pick<\r\n MsTeamsConnectButtonProps,\r\n | 'integrationIdentifier'\r\n | 'connectionIdentifier'\r\n | 'subscriberId'\r\n | 'context'\r\n | 'scope'\r\n | 'connectionMode'\r\n | 'autoLinkUser'\r\n | 'onConnectSuccess'\r\n | 'onConnectError'\r\n | 'onDisconnectSuccess'\r\n | 'onDisconnectError'\r\n | 'connectLabel'\r\n | 'connectedLabel'\r\n>;\r\n\r\nexport const DefaultMsTeamsConnectButton = (props: DefaultMsTeamsConnectButtonProps) => {\r\n const {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n autoLinkUser,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'MsTeamsConnectButton',\r\n props: {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n autoLinkUser,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n },\r\n element,\r\n });\r\n },\r\n [\r\n novuUI,\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n autoLinkUser,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAC5B,2BAA0B;AAC1B,qBAAwB;AA6Ef;AA1DF,IAAM,8BAA8B,CAAC,UAA4C;AACtF,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,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,OAAO,QAAI,gCAAU;AAE7B,QAAM,YAAQ;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,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,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/msteams-connect-button/DefaultMsTeamsConnectButton.tsx"],"sourcesContent":["import { MsTeamsConnectButtonProps } from '@notiflyio/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultMsTeamsConnectButtonProps = Pick<\n MsTeamsConnectButtonProps,\n | 'integrationIdentifier'\n | 'connectionIdentifier'\n | 'subscriberId'\n | 'context'\n | 'scope'\n | 'connectionMode'\n | 'autoLinkUser'\n | 'onConnectSuccess'\n | 'onConnectError'\n | 'onDisconnectSuccess'\n | 'onDisconnectError'\n | 'connectLabel'\n | 'connectedLabel'\n>;\n\nexport const DefaultMsTeamsConnectButton = (props: DefaultMsTeamsConnectButtonProps) => {\n const {\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n scope,\n connectionMode,\n autoLinkUser,\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: 'MsTeamsConnectButton',\n props: {\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n scope,\n connectionMode,\n autoLinkUser,\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 autoLinkUser,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n ]\n );\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAC5B,2BAA0B;AAC1B,qBAAwB;AA6Ef;AA1DF,IAAM,8BAA8B,CAAC,UAA4C;AACtF,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,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,OAAO,QAAI,gCAAU;AAE7B,QAAM,YAAQ;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,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,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/msteams-connect-button/MsTeamsConnectButton.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\nimport { useNovu } from '../../hooks/NovuProvider';\r\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\r\nimport { withRenderer } from '../Renderer';\r\nimport { DefaultMsTeamsConnectButton, DefaultMsTeamsConnectButtonProps } from './DefaultMsTeamsConnectButton';\r\n\r\nexport type MsTeamsConnectButtonProps = DefaultMsTeamsConnectButtonProps &\r\n Pick<NovuUIOptions, 'container' | 'appearance'>;\r\n\r\nconst MsTeamsConnectButtonInternal = withRenderer<MsTeamsConnectButtonProps>((props) => {\r\n const { container, appearance, ...defaultProps } = props;\r\n const novu = useNovu();\r\n\r\n const options: NovuUIOptions = useMemo(() => {\r\n return {\r\n container,\r\n appearance,\r\n options: novu.options,\r\n };\r\n }, [container, appearance, novu.options]);\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultMsTeamsConnectButton {...defaultProps} />\r\n </NovuUI>\r\n );\r\n});\r\n\r\nMsTeamsConnectButtonInternal.displayName = 'MsTeamsConnectButtonInternal';\r\n\r\nexport const MsTeamsConnectButton = React.memo((props: MsTeamsConnectButtonProps) => {\r\n return <MsTeamsConnectButtonInternal {...props} />;\r\n});\r\n\r\nMsTeamsConnectButton.displayName = 'MsTeamsConnectButton';\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,0BAAwB;AACxB,oBAAsC;AACtC,sBAA6B;AAC7B,yCAA8E;AAmBxE;AAdN,IAAM,mCAA+B,8BAAwC,CAAC,UAAU;AACtF,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,WAAO,6BAAQ;AAErB,QAAM,cAAyB,sBAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,4CAAC,wBAAO,SAAkB,MACxB,sDAAC,kEAA6B,GAAG,cAAc,GACjD;AAEJ,CAAC;AAED,6BAA6B,cAAc;AAEpC,IAAM,uBAAuB,aAAAA,QAAM,KAAK,CAAC,UAAqC;AACnF,SAAO,4CAAC,gCAA8B,GAAG,OAAO;AAClD,CAAC;AAED,qBAAqB,cAAc;","names":["React"]} | ||
| {"version":3,"sources":["../../../../src/components/msteams-connect-button/MsTeamsConnectButton.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultMsTeamsConnectButton, DefaultMsTeamsConnectButtonProps } from './DefaultMsTeamsConnectButton';\n\nexport type MsTeamsConnectButtonProps = DefaultMsTeamsConnectButtonProps &\n Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst MsTeamsConnectButtonInternal = withRenderer<MsTeamsConnectButtonProps>((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 <DefaultMsTeamsConnectButton {...defaultProps} />\n </NovuUI>\n );\n});\n\nMsTeamsConnectButtonInternal.displayName = 'MsTeamsConnectButtonInternal';\n\nexport const MsTeamsConnectButton = React.memo((props: MsTeamsConnectButtonProps) => {\n return <MsTeamsConnectButtonInternal {...props} />;\n});\n\nMsTeamsConnectButton.displayName = 'MsTeamsConnectButton';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,0BAAwB;AACxB,oBAAsC;AACtC,sBAA6B;AAC7B,yCAA8E;AAmBxE;AAdN,IAAM,mCAA+B,8BAAwC,CAAC,UAAU;AACtF,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,WAAO,6BAAQ;AAErB,QAAM,cAAyB,sBAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,4CAAC,wBAAO,SAAkB,MACxB,sDAAC,kEAA6B,GAAG,cAAc,GACjD;AAEJ,CAAC;AAED,6BAA6B,cAAc;AAEpC,IAAM,uBAAuB,aAAAA,QAAM,KAAK,CAAC,UAAqC;AACnF,SAAO,4CAAC,gCAA8B,GAAG,OAAO;AAClD,CAAC;AAED,qBAAqB,cAAc;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/msteams-link-user/DefaultMsTeamsLinkUser.tsx"],"sourcesContent":["import { MsTeamsLinkUserProps } from '@notiflyio/js/ui';\r\nimport { useCallback } from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type DefaultMsTeamsLinkUserProps = Pick<\r\n MsTeamsLinkUserProps,\r\n | 'integrationIdentifier'\r\n | 'connectionIdentifier'\r\n | 'context'\r\n | 'onLinkSuccess'\r\n | 'onLinkError'\r\n | 'onUnlinkSuccess'\r\n | 'onUnlinkError'\r\n | 'linkLabel'\r\n | 'unlinkLabel'\r\n>;\r\n\r\nexport const DefaultMsTeamsLinkUser = (props: DefaultMsTeamsLinkUserProps) => {\r\n const {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n context,\r\n onLinkSuccess,\r\n onLinkError,\r\n onUnlinkSuccess,\r\n onUnlinkError,\r\n linkLabel,\r\n unlinkLabel,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'MsTeamsLinkUser',\r\n props: {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n context,\r\n onLinkSuccess,\r\n onLinkError,\r\n onUnlinkSuccess,\r\n onUnlinkError,\r\n linkLabel,\r\n unlinkLabel,\r\n },\r\n element,\r\n });\r\n },\r\n [\r\n novuUI,\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n context,\r\n onLinkSuccess,\r\n onLinkError,\r\n onUnlinkSuccess,\r\n onUnlinkError,\r\n linkLabel,\r\n unlinkLabel,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAC5B,2BAA0B;AAC1B,qBAAwB;AA6Df;AA9CF,IAAM,yBAAyB,CAAC,UAAuC;AAC5E,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,QAAI,gCAAU;AAE7B,QAAM,YAAQ;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,4CAAC,0BAAQ,OAAc;AAChC;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/msteams-link-user/DefaultMsTeamsLinkUser.tsx"],"sourcesContent":["import { MsTeamsLinkUserProps } from '@notiflyio/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultMsTeamsLinkUserProps = Pick<\n MsTeamsLinkUserProps,\n | 'integrationIdentifier'\n | 'connectionIdentifier'\n | 'context'\n | 'onLinkSuccess'\n | 'onLinkError'\n | 'onUnlinkSuccess'\n | 'onUnlinkError'\n | 'linkLabel'\n | 'unlinkLabel'\n>;\n\nexport const DefaultMsTeamsLinkUser = (props: DefaultMsTeamsLinkUserProps) => {\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: 'MsTeamsLinkUser',\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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAC5B,2BAA0B;AAC1B,qBAAwB;AA6Df;AA9CF,IAAM,yBAAyB,CAAC,UAAuC;AAC5E,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,QAAI,gCAAU;AAE7B,QAAM,YAAQ;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,4CAAC,0BAAQ,OAAc;AAChC;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/msteams-link-user/MsTeamsLinkUser.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\nimport { useNovu } from '../../hooks/NovuProvider';\r\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\r\nimport { withRenderer } from '../Renderer';\r\nimport { DefaultMsTeamsLinkUser, DefaultMsTeamsLinkUserProps } from './DefaultMsTeamsLinkUser';\r\n\r\nexport type MsTeamsLinkUserProps = DefaultMsTeamsLinkUserProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\r\n\r\nconst MsTeamsLinkUserInternal = withRenderer<MsTeamsLinkUserProps>((props) => {\r\n const { container, appearance, ...defaultProps } = props;\r\n const novu = useNovu();\r\n\r\n const options: NovuUIOptions = useMemo(() => {\r\n return {\r\n container,\r\n appearance,\r\n options: novu.options,\r\n };\r\n }, [container, appearance, novu.options]);\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultMsTeamsLinkUser {...defaultProps} />\r\n </NovuUI>\r\n );\r\n});\r\n\r\nMsTeamsLinkUserInternal.displayName = 'MsTeamsLinkUserInternal';\r\n\r\nexport const MsTeamsLinkUser = React.memo((props: MsTeamsLinkUserProps) => {\r\n return <MsTeamsLinkUserInternal {...props} />;\r\n});\r\n\r\nMsTeamsLinkUser.displayName = 'MsTeamsLinkUser';\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,0BAAwB;AACxB,oBAAsC;AACtC,sBAA6B;AAC7B,oCAAoE;AAkB9D;AAdN,IAAM,8BAA0B,8BAAmC,CAAC,UAAU;AAC5E,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,WAAO,6BAAQ;AAErB,QAAM,cAAyB,sBAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,4CAAC,wBAAO,SAAkB,MACxB,sDAAC,wDAAwB,GAAG,cAAc,GAC5C;AAEJ,CAAC;AAED,wBAAwB,cAAc;AAE/B,IAAM,kBAAkB,aAAAA,QAAM,KAAK,CAAC,UAAgC;AACzE,SAAO,4CAAC,2BAAyB,GAAG,OAAO;AAC7C,CAAC;AAED,gBAAgB,cAAc;","names":["React"]} | ||
| {"version":3,"sources":["../../../../src/components/msteams-link-user/MsTeamsLinkUser.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultMsTeamsLinkUser, DefaultMsTeamsLinkUserProps } from './DefaultMsTeamsLinkUser';\n\nexport type MsTeamsLinkUserProps = DefaultMsTeamsLinkUserProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst MsTeamsLinkUserInternal = withRenderer<MsTeamsLinkUserProps>((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 <DefaultMsTeamsLinkUser {...defaultProps} />\n </NovuUI>\n );\n});\n\nMsTeamsLinkUserInternal.displayName = 'MsTeamsLinkUserInternal';\n\nexport const MsTeamsLinkUser = React.memo((props: MsTeamsLinkUserProps) => {\n return <MsTeamsLinkUserInternal {...props} />;\n});\n\nMsTeamsLinkUser.displayName = 'MsTeamsLinkUser';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,0BAAwB;AACxB,oBAAsC;AACtC,sBAA6B;AAC7B,oCAAoE;AAkB9D;AAdN,IAAM,8BAA0B,8BAAmC,CAAC,UAAU;AAC5E,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,WAAO,6BAAQ;AAErB,QAAM,cAAyB,sBAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,4CAAC,wBAAO,SAAkB,MACxB,sDAAC,wDAAwB,GAAG,cAAc,GAC5C;AAEJ,CAAC;AAED,wBAAwB,cAAc;AAE/B,IAAM,kBAAkB,aAAAA,QAAM,KAAK,CAAC,UAAgC;AACzE,SAAO,4CAAC,2BAAyB,GAAG,OAAO;AAC7C,CAAC;AAED,gBAAgB,cAAc;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/Notifications.tsx"],"sourcesContent":["import type { NotificationActionClickHandler, NotificationClickHandler } from '@notiflyio/js/ui';\r\nimport React from 'react';\r\nimport { useNovuUI } from '../context/NovuUIContext';\r\nimport { useRenderer } from '../context/RendererContext';\r\nimport { NoRendererProps, NotificationRendererProps, SubjectBodyRendererProps } from '../utils/types';\r\nimport { Mounter } from './Mounter';\r\nimport { withRenderer } from './Renderer';\r\n\r\nexport type NotificationProps = {\r\n onNotificationClick?: NotificationClickHandler;\r\n onPrimaryActionClick?: NotificationActionClickHandler;\r\n onSecondaryActionClick?: NotificationActionClickHandler;\r\n} & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);\r\n\r\nconst _Notifications = React.memo((props: NotificationProps) => {\r\n const {\r\n renderNotification,\r\n renderAvatar,\r\n renderSubject,\r\n renderBody,\r\n renderDefaultActions,\r\n renderCustomActions,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n const { mountElement } = useRenderer();\r\n\r\n const mount = React.useCallback(\r\n (element: HTMLElement) => {\r\n if (renderNotification) {\r\n return novuUI.mountComponent({\r\n name: 'Notifications',\r\n element,\r\n props: {\r\n renderNotification: renderNotification\r\n ? (el, notification) => mountElement(el, renderNotification(notification))\r\n : undefined,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n },\r\n });\r\n }\r\n\r\n return novuUI.mountComponent({\r\n name: 'Notifications',\r\n element,\r\n props: {\r\n renderAvatar: renderAvatar ? (el, notification) => mountElement(el, renderAvatar(notification)) : undefined,\r\n renderSubject: renderSubject\r\n ? (el, notification) => mountElement(el, renderSubject(notification))\r\n : undefined,\r\n renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : undefined,\r\n renderDefaultActions: renderDefaultActions\r\n ? (el, notification) => mountElement(el, renderDefaultActions(notification))\r\n : undefined,\r\n renderCustomActions: renderCustomActions\r\n ? (el, notification) => mountElement(el, renderCustomActions(notification))\r\n : undefined,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n },\r\n });\r\n },\r\n [\r\n renderNotification,\r\n renderAvatar,\r\n renderSubject,\r\n renderBody,\r\n renderDefaultActions,\r\n renderCustomActions,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n});\r\n\r\nexport const Notifications = withRenderer(_Notifications);\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,2BAA0B;AAC1B,6BAA4B;AAE5B,qBAAwB;AACxB,sBAA6B;AA0EpB;AAlET,IAAM,iBAAiB,aAAAA,QAAM,KAAK,CAAC,UAA6B;AAC9D,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,QAAI,gCAAU;AAC7B,QAAM,EAAE,aAAa,QAAI,oCAAY;AAErC,QAAM,QAAQ,aAAAA,QAAM;AAAA,IAClB,CAAC,YAAyB;AACxB,UAAI,oBAAoB;AACtB,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA,OAAO;AAAA,YACL,oBAAoB,qBAChB,CAAC,IAAI,iBAAiB,aAAa,IAAI,mBAAmB,YAAY,CAAC,IACvE;AAAA,YACJ;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAEA,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN;AAAA,QACA,OAAO;AAAA,UACL,cAAc,eAAe,CAAC,IAAI,iBAAiB,aAAa,IAAI,aAAa,YAAY,CAAC,IAAI;AAAA,UAClG,eAAe,gBACX,CAAC,IAAI,iBAAiB,aAAa,IAAI,cAAc,YAAY,CAAC,IAClE;AAAA,UACJ,YAAY,aAAa,CAAC,IAAI,iBAAiB,aAAa,IAAI,WAAW,YAAY,CAAC,IAAI;AAAA,UAC5F,sBAAsB,uBAClB,CAAC,IAAI,iBAAiB,aAAa,IAAI,qBAAqB,YAAY,CAAC,IACzE;AAAA,UACJ,qBAAqB,sBACjB,CAAC,IAAI,iBAAiB,aAAa,IAAI,oBAAoB,YAAY,CAAC,IACxE;AAAA,UACJ;AAAA,UACA;AAAA,UACA;AAAA,QACF;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,IACF;AAAA,EACF;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC,CAAC;AAEM,IAAM,oBAAgB,8BAAa,cAAc;","names":["React"]} | ||
| {"version":3,"sources":["../../../src/components/Notifications.tsx"],"sourcesContent":["import type { NotificationActionClickHandler, NotificationClickHandler } from '@notiflyio/js/ui';\nimport React from 'react';\nimport { useNovuUI } from '../context/NovuUIContext';\nimport { useRenderer } from '../context/RendererContext';\nimport { NoRendererProps, NotificationRendererProps, SubjectBodyRendererProps } from '../utils/types';\nimport { Mounter } from './Mounter';\nimport { withRenderer } from './Renderer';\n\nexport type NotificationProps = {\n onNotificationClick?: NotificationClickHandler;\n onPrimaryActionClick?: NotificationActionClickHandler;\n onSecondaryActionClick?: NotificationActionClickHandler;\n} & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);\n\nconst _Notifications = React.memo((props: NotificationProps) => {\n const {\n renderNotification,\n renderAvatar,\n renderSubject,\n renderBody,\n renderDefaultActions,\n renderCustomActions,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n } = props;\n const { novuUI } = useNovuUI();\n const { mountElement } = useRenderer();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n if (renderNotification) {\n return novuUI.mountComponent({\n name: 'Notifications',\n element,\n props: {\n renderNotification: renderNotification\n ? (el, notification) => mountElement(el, renderNotification(notification))\n : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n },\n });\n }\n\n return novuUI.mountComponent({\n name: 'Notifications',\n element,\n props: {\n renderAvatar: renderAvatar ? (el, notification) => mountElement(el, renderAvatar(notification)) : undefined,\n renderSubject: renderSubject\n ? (el, notification) => mountElement(el, renderSubject(notification))\n : undefined,\n renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : undefined,\n renderDefaultActions: renderDefaultActions\n ? (el, notification) => mountElement(el, renderDefaultActions(notification))\n : undefined,\n renderCustomActions: renderCustomActions\n ? (el, notification) => mountElement(el, renderCustomActions(notification))\n : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n },\n });\n },\n [\n renderNotification,\n renderAvatar,\n renderSubject,\n renderBody,\n renderDefaultActions,\n renderCustomActions,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n ]\n );\n\n return <Mounter mount={mount} />;\n});\n\nexport const Notifications = withRen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AAAA,UACA;AAAA,UACA;AAAA,QACF;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,IACF;AAAA,EACF;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC,CAAC;AAEM,IAAM,oBAAgB,8BAAa,cAAc;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/NovuUI.tsx"],"sourcesContent":["import { Novu } from '@notiflyio/js';\r\nimport type { NovuUIOptions as JsNovuUIOptions } from '@notiflyio/js/ui';\r\nimport { NovuUI as NovuUIClass } from '@notiflyio/js/ui';\r\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\r\nimport { NovuUIProvider } from '../context/NovuUIContext';\r\nimport { useRenderer } from '../context/RendererContext';\r\nimport { useDataRef } from '../hooks/internal/useDataRef';\r\nimport { adaptAppearanceForJs } from '../utils/appearance';\r\nimport type { ReactAllAppearance, ReactInboxAppearance, ReactSubscriptionAppearance } from '../utils/types';\r\nimport { ShadowRootDetector } from './ShadowRootDetector';\r\n\r\nexport type NovuUIOptions = Omit<JsNovuUIOptions, 'appearance'> & {\r\n appearance?: ReactInboxAppearance | ReactSubscriptionAppearance | ReactAllAppearance;\r\n};\r\n\r\ntype NovuUIProps = React.PropsWithChildren<{\r\n options: NovuUIOptions;\r\n novu: Novu;\r\n}>;\r\n\r\nconst findParentShadowRoot = (child?: HTMLDivElement | null): Node | null => {\r\n if (!child) {\r\n return null;\r\n }\r\n\r\n let node: Node | null = child;\r\n\r\n while (node) {\r\n if (node instanceof Element && node.shadowRoot) {\r\n return node.shadowRoot;\r\n }\r\n\r\n if (node instanceof ShadowRoot) {\r\n return node;\r\n }\r\n\r\n node = node.parentNode;\r\n\r\n if (!node || node === document) {\r\n break;\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\nexport const NovuUI = ({ options, novu, children }: NovuUIProps) => {\r\n const shadowRootDetector = useRef<HTMLDivElement>(null);\r\n const { mountElement } = useRenderer();\r\n\r\n const adaptedAppearanceForUpdate = useMemo(\r\n () => adaptAppearanceForJs(options.appearance || {}, mountElement),\r\n [options.appearance, mountElement]\r\n );\r\n\r\n const adaptedOptions = useMemo(() => {\r\n return {\r\n ...options,\r\n appearance: adaptedAppearanceForUpdate,\r\n novu,\r\n };\r\n }, [options, novu, adaptedAppearanceForUpdate]);\r\n\r\n const optionsRef = useDataRef(adaptedOptions);\r\n const [novuUI, setNovuUI] = useState<NovuUIClass | undefined>();\r\n\r\n useEffect(() => {\r\n const parentShadowRoot = findParentShadowRoot(shadowRootDetector.current);\r\n const instance = new NovuUIClass({\r\n ...optionsRef.current,\r\n container: optionsRef.current.container ?? parentShadowRoot,\r\n });\r\n setNovuUI(instance);\r\n\r\n return () => {\r\n instance.unmount();\r\n };\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (!novuUI) {\r\n return;\r\n }\r\n\r\n const parentShadowRoot = findParentShadowRoot(shadowRootDetector.current);\r\n novuUI.updateContainer(options.container ?? parentShadowRoot);\r\n novuUI.updateAppearance(adaptedAppearanceForUpdate);\r\n novuUI.updateLocalization(options.localization);\r\n novuUI.updateTabs(options.tabs);\r\n novuUI.updateOptions(options.options);\r\n novuUI.updateRouterPush(options.routerPush);\r\n novuUI.updateNovu(novu);\r\n }, [\r\n shadowRootDetector,\r\n novuUI,\r\n adaptedAppearanceForUpdate,\r\n options.localization,\r\n options.tabs,\r\n options.options,\r\n options.routerPush,\r\n novu,\r\n ]);\r\n\r\n return (\r\n <>\r\n <ShadowRootDetector ref={shadowRootDetector} />\r\n {novuUI && <NovuUIProvider value={{ novuUI }}>{children}</NovuUIProvider>}\r\n </>\r\n );\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,gBAAsC;AACtC,mBAA4D;AAC5D,2BAA+B;AAC/B,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AAM,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,4EACE;AAAA,gDAAC,gDAAmB,KAAK,oBAAoB;AAAA,IAC5C,UAAU,4CAAC,uCAAe,OAAO,EAAE,OAAO,GAAI,UAAS;AAAA,KAC1D;AAEJ;","names":["NovuUIClass"]} | ||
| {"version":3,"sources":["../../../src/components/NovuUI.tsx"],"sourcesContent":["import { Novu } from '@notiflyio/js';\nimport type { NovuUIOptions as JsNovuUIOptions } from '@notiflyio/js/ui';\nimport { NovuUI as NovuUIClass } from '@notiflyio/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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,gBAAsC;AACtC,mBAA4D;AAC5D,2BAA+B;AAC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A,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,4EACE;AAAA,gDAAC,gDAAmB,KAAK,oBAAoB;AAAA,IAC5C,UAAU,4CAAC,uCAAe,OAAO,EAAE,OAAO,GAAI,UAAS;AAAA,KAC1D;AAEJ;","names":["NovuUIClass"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/Preferences.tsx"],"sourcesContent":["import React from 'react';\r\nimport { useNovuUI } from '../context/NovuUIContext';\r\nimport { Mounter } from './Mounter';\r\n\r\nexport const Preferences = () => {\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = React.useCallback((element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'Preferences',\r\n element,\r\n });\r\n }, []);\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,2BAA0B;AAC1B,qBAAwB;AAYf;AAVF,IAAM,cAAc,MAAM;AAC/B,QAAM,EAAE,OAAO,QAAI,gCAAU;AAE7B,QAAM,QAAQ,aAAAA,QAAM,YAAY,CAAC,YAAyB;AACxD,WAAO,OAAO,eAAe;AAAA,MAC3B,MAAM;AAAA,MACN;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,SAAO,4CAAC,0BAAQ,OAAc;AAChC;","names":["React"]} | ||
| {"version":3,"sources":["../../../src/components/Preferences.tsx"],"sourcesContent":["import React from 'react';\nimport { useNovuUI } from '../context/NovuUIContext';\nimport { Mounter } from './Mounter';\n\nexport const Preferences = () => {\n const { novuUI } = useNovuUI();\n\n const mount = React.useCallback((element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'Preferences',\n element,\n });\n }, []);\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,2BAA0B;AAC1B,qBAAwB;AAYf;AAVF,IAAM,cAAc,MAAM;AAC/B,QAAM,EAAE,OAAO,QAAI,gCAAU;AAE7B,QAAM,QAAQ,aAAAA,QAAM,YAAY,CAAC,YAAyB;AACxD,WAAO,OAAO,eAAe;AAAA,MAC3B,MAAM;AAAA,MACN;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,SAAO,4CAAC,0BAAQ,OAAc;AAChC;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/Renderer.tsx"],"sourcesContent":["import { ComponentType, PropsWithChildren, useCallback, useState } from 'react';\r\nimport { createPortal } from 'react-dom';\r\nimport { MountedElement, RendererProvider } from '../context/RendererContext';\r\n\r\ntype RendererProps = PropsWithChildren;\r\nexport const Renderer = (props: RendererProps) => {\r\n const { children } = props;\r\n const [mountedElements, setMountedElements] = useState(new Map<HTMLElement, MountedElement>());\r\n\r\n const mountElement = useCallback(\r\n (el: HTMLElement, mountedElement: MountedElement) => {\r\n setMountedElements((prev) => {\r\n const newMountedElements = new Map(prev);\r\n newMountedElements.set(el, mountedElement);\r\n\r\n return newMountedElements;\r\n });\r\n\r\n return () => {\r\n setMountedElements((prev) => {\r\n const newMountedElements = new Map(prev);\r\n newMountedElements.delete(el);\r\n\r\n return newMountedElements;\r\n });\r\n };\r\n },\r\n [setMountedElements]\r\n );\r\n\r\n return (\r\n <RendererProvider value={{ mountElement }}>\r\n {[...mountedElements].map(([element, mountedElement]) => {\r\n return createPortal(mountedElement, element);\r\n })}\r\n\r\n {children}\r\n </RendererProvider>\r\n );\r\n};\r\n\r\nexport const withRenderer = <P extends object>(\r\n WrappedComponent: ComponentType<P>\r\n): ComponentType<P & PropsWithChildren<{}>> => {\r\n const HOC = (props: P) => {\r\n return (\r\n <Renderer>\r\n <WrappedComponent {...props} />\r\n </Renderer>\r\n );\r\n };\r\n\r\n HOC.displayName = `WithRenderer(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\r\n\r\n return HOC;\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwE;AACxE,uBAA6B;AAC7B,6BAAiD;AA6B7C;AA1BG,IAAM,WAAW,CAAC,UAAyB;AAChD,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,CAAC,iBAAiB,kBAAkB,QAAI,uBAAS,oBAAI,IAAiC,CAAC;AAE7F,QAAM,mBAAe;AAAA,IACnB,CAAC,IAAiB,mBAAmC;AACnD,yBAAmB,CAAC,SAAS;AAC3B,cAAM,qBAAqB,IAAI,IAAI,IAAI;AACvC,2BAAmB,IAAI,IAAI,cAAc;AAEzC,eAAO;AAAA,MACT,CAAC;AAED,aAAO,MAAM;AACX,2BAAmB,CAAC,SAAS;AAC3B,gBAAM,qBAAqB,IAAI,IAAI,IAAI;AACvC,6BAAmB,OAAO,EAAE;AAE5B,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB;AAAA,EACrB;AAEA,SACE,6CAAC,2CAAiB,OAAO,EAAE,aAAa,GACrC;AAAA,KAAC,GAAG,eAAe,EAAE,IAAI,CAAC,CAAC,SAAS,cAAc,MAAM;AACvD,iBAAO,+BAAa,gBAAgB,OAAO;AAAA,IAC7C,CAAC;AAAA,IAEA;AAAA,KACH;AAEJ;AAEO,IAAM,eAAe,CAC1B,qBAC6C;AAC7C,QAAM,MAAM,CAAC,UAAa;AACxB,WACE,4CAAC,YACC,sDAAC,oBAAkB,GAAG,OAAO,GAC/B;AAAA,EAEJ;AAEA,MAAI,cAAc,gBAAgB,iBAAiB,eAAe,iBAAiB,QAAQ,WAAW;AAEtG,SAAO;AACT;","names":[]} | ||
| {"version":3,"sources":["../../../src/components/Renderer.tsx"],"sourcesContent":["import { ComponentType, PropsWithChildren, useCallback, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { MountedElement, RendererProvider } from '../context/RendererContext';\n\ntype RendererProps = PropsWithChildren;\nexport const Renderer = (props: RendererProps) => {\n const { children } = props;\n const [mountedElements, setMountedElements] = useState(new Map<HTMLElement, MountedElement>());\n\n const mountElement = useCallback(\n (el: HTMLElement, mountedElement: MountedElement) => {\n setMountedElements((prev) => {\n const newMountedElements = new Map(prev);\n newMountedElements.set(el, mountedElement);\n\n return newMountedElements;\n });\n\n return () => {\n setMountedElements((prev) => {\n const newMountedElements = new Map(prev);\n newMountedElements.delete(el);\n\n return newMountedElements;\n });\n };\n },\n [setMountedElements]\n );\n\n return (\n <RendererProvider value={{ mountElement }}>\n {[...mountedElements].map(([element, mountedElement]) => {\n return createPortal(mountedElement, element);\n })}\n\n {children}\n </RendererProvider>\n );\n};\n\nexport const withRenderer = <P extends object>(\n WrappedComponent: ComponentType<P>\n): ComponentType<P & PropsWithChildren<{}>> => {\n const HOC = (props: P) => {\n return (\n <Renderer>\n <WrappedComponent {...props} />\n </Renderer>\n );\n };\n\n HOC.displayName = `WithRenderer(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\n\n return HOC;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwE;AACxE,uBAA6B;AAC7B,6BAAiD;AA6B7C;AA1BG,IAAM,WAAW,CAAC,UAAyB;AAChD,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,CAAC,iBAAiB,kBAAkB,QAAI,uBAAS,oBAAI,IAAiC,CAAC;AAE7F,QAAM,mBAAe;AAAA,IACnB,CAAC,IAAiB,mBAAmC;AACnD,yBAAmB,CAAC,SAAS;AAC3B,cAAM,qBAAqB,IAAI,IAAI,IAAI;AACvC,2BAAmB,IAAI,IAAI,cAAc;AAEzC,eAAO;AAAA,MACT,CAAC;AAED,aAAO,MAAM;AACX,2BAAmB,CAAC,SAAS;AAC3B,gBAAM,qBAAqB,IAAI,IAAI,IAAI;AACvC,6BAAmB,OAAO,EAAE;AAE5B,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB;AAAA,EACrB;AAEA,SACE,6CAAC,2CAAiB,OAAO,EAAE,aAAa,GACrC;AAAA,KAAC,GAAG,eAAe,EAAE,IAAI,CAAC,CAAC,SAAS,cAAc,MAAM;AACvD,iBAAO,+BAAa,gBAAgB,OAAO;AAAA,IAC7C,CAAC;AAAA,IAEA;AAAA,KACH;AAEJ;AAEO,IAAM,eAAe,CAC1B,qBAC6C;AAC7C,QAAM,MAAM,CAAC,UAAa;AACxB,WACE,4CAAC,YACC,sDAAC,oBAAkB,GAAG,OAAO,GAC/B;AAAA,EAEJ;AAEA,MAAI,cAAc,gBAAgB,iBAAiB,eAAe,iBAAiB,QAAQ,WAAW;AAEtG,SAAO;AACT;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/ShadowRootDetector.tsx"],"sourcesContent":["import React from 'react';\r\n\r\nexport const ShadowRootDetector = React.forwardRef<HTMLDivElement>((props, ref) => {\r\n return (\r\n <div\r\n ref={ref}\r\n style={{\r\n position: 'absolute',\r\n width: 1,\r\n height: 1,\r\n padding: 0,\r\n margin: -1,\r\n overflow: 'hidden',\r\n clip: 'rect(0, 0, 0, 0)',\r\n whiteSpace: 'nowrap',\r\n borderWidth: 0,\r\n }}\r\n data-shadow-root-detector\r\n {...props}\r\n />\r\n );\r\n});\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAId;AAFG,IAAM,qBAAqB,aAAAA,QAAM,WAA2B,CAAC,OAAO,QAAQ;AACjF,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,OAAO;AAAA,QACL,UAAU;AAAA,QACV,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,aAAa;AAAA,MACf;AAAA,MACA,6BAAyB;AAAA,MACxB,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;","names":["React"]} | ||
| {"version":3,"sources":["../../../src/components/ShadowRootDetector.tsx"],"sourcesContent":["import React from 'react';\n\nexport const ShadowRootDetector = React.forwardRef<HTMLDivElement>((props, ref) => {\n return (\n <div\n ref={ref}\n style={{\n position: 'absolute',\n width: 1,\n height: 1,\n padding: 0,\n margin: -1,\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n borderWidth: 0,\n }}\n data-shadow-root-detector\n {...props}\n />\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAId;AAFG,IAAM,qBAAqB,aAAAA,QAAM,WAA2B,CAAC,OAAO,QAAQ;AACjF,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,OAAO;AAAA,QACL,UAAU;AAAA,QACV,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,aAAa;AAAA,MACf;AAAA,MACA,6BAAyB;AAAA,MACxB,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/slack-connect-button/DefaultSlackConnectButton.tsx"],"sourcesContent":["import { SlackConnectButtonProps } from '@notiflyio/js/ui';\r\nimport { useCallback } from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type DefaultSlackConnectButtonProps = Pick<\r\n SlackConnectButtonProps,\r\n | 'integrationIdentifier'\r\n | 'connectionIdentifier'\r\n | 'subscriberId'\r\n | 'context'\r\n | 'scope'\r\n | 'connectionMode'\r\n | 'autoLinkUser'\r\n | 'onConnectSuccess'\r\n | 'onConnectError'\r\n | 'onDisconnectSuccess'\r\n | 'onDisconnectError'\r\n | 'connectLabel'\r\n | 'connectedLabel'\r\n>;\r\n\r\nexport const DefaultSlackConnectButton = (props: DefaultSlackConnectButtonProps) => {\r\n const {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n autoLinkUser,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'SlackConnectButton',\r\n props: {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n autoLinkUser,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n },\r\n element,\r\n });\r\n },\r\n [\r\n novuUI,\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n autoLinkUser,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAC5B,2BAA0B;AAC1B,qBAAwB;AA6Ef;AA1DF,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,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,OAAO,QAAI,gCAAU;AAE7B,QAAM,YAAQ;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,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,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/slack-connect-button/DefaultSlackConnectButton.tsx"],"sourcesContent":["import { SlackConnectButtonProps } from '@notiflyio/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 | 'autoLinkUser'\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 autoLinkUser,\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 autoLinkUser,\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 autoLinkUser,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n ]\n );\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAC5B,2BAA0B;AAC1B,qBAAwB;AA6Ef;AA1DF,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,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,OAAO,QAAI,gCAAU;AAE7B,QAAM,YAAQ;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,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,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/slack-connect-button/SlackConnectButton.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\nimport { useNovu } from '../../hooks/NovuProvider';\r\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\r\nimport { withRenderer } from '../Renderer';\r\nimport { DefaultSlackConnectButton, DefaultSlackConnectButtonProps } from './DefaultSlackConnectButton';\r\n\r\nexport type SlackConnectButtonProps = DefaultSlackConnectButtonProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\r\n\r\nconst SlackConnectButtonInternal = withRenderer<SlackConnectButtonProps>((props) => {\r\n const { container, appearance, ...defaultProps } = props;\r\n const novu = useNovu();\r\n\r\n const options: NovuUIOptions = useMemo(() => {\r\n return {\r\n container,\r\n appearance,\r\n options: novu.options,\r\n };\r\n }, [container, appearance, novu.options]);\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultSlackConnectButton {...defaultProps} />\r\n </NovuUI>\r\n );\r\n});\r\n\r\nSlackConnectButtonInternal.displayName = 'SlackConnectButtonInternal';\r\n\r\nexport const SlackConnectButton = React.memo((props: SlackConnectButtonProps) => {\r\n return <SlackConnectButtonInternal {...props} />;\r\n});\r\n\r\nSlackConnectButton.displayName = 'SlackConnectButton';\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,0BAAwB;AACxB,oBAAsC;AACtC,sBAA6B;AAC7B,uCAA0E;AAkBpE;AAdN,IAAM,iCAA6B,8BAAsC,CAAC,UAAU;AAClF,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,WAAO,6BAAQ;AAErB,QAAM,cAAyB,sBAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,4CAAC,wBAAO,SAAkB,MACxB,sDAAC,8DAA2B,GAAG,cAAc,GAC/C;AAEJ,CAAC;AAED,2BAA2B,cAAc;AAElC,IAAM,qBAAqB,aAAAA,QAAM,KAAK,CAAC,UAAmC;AAC/E,SAAO,4CAAC,8BAA4B,GAAG,OAAO;AAChD,CAAC;AAED,mBAAmB,cAAc;","names":["React"]} | ||
| {"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;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,0BAAwB;AACxB,oBAAsC;AACtC,sBAA6B;AAC7B,uCAA0E;AAkBpE;AAdN,IAAM,iCAA6B,8BAAsC,CAAC,UAAU;AAClF,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,WAAO,6BAAQ;AAErB,QAAM,cAAyB,sBAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,4CAAC,wBAAO,SAAkB,MACxB,sDAAC,8DAA2B,GAAG,cAAc,GAC/C;AAEJ,CAAC;AAED,2BAA2B,cAAc;AAElC,IAAM,qBAAqB,aAAAA,QAAM,KAAK,CAAC,UAAmC;AAC/E,SAAO,4CAAC,8BAA4B,GAAG,OAAO;AAChD,CAAC;AAED,mBAAmB,cAAc;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/slack-link-user/DefaultSlackLinkUser.tsx"],"sourcesContent":["import { SlackLinkUserProps } from '@notiflyio/js/ui';\r\nimport { useCallback } from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type DefaultSlackLinkUserProps = Pick<\r\n SlackLinkUserProps,\r\n | 'integrationIdentifier'\r\n | 'connectionIdentifier'\r\n | 'context'\r\n | 'onLinkSuccess'\r\n | 'onLinkError'\r\n | 'onUnlinkSuccess'\r\n | 'onUnlinkError'\r\n | 'linkLabel'\r\n | 'unlinkLabel'\r\n>;\r\n\r\nexport const DefaultSlackLinkUser = (props: DefaultSlackLinkUserProps) => {\r\n const {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n context,\r\n onLinkSuccess,\r\n onLinkError,\r\n onUnlinkSuccess,\r\n onUnlinkError,\r\n linkLabel,\r\n unlinkLabel,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'SlackLinkUser',\r\n props: {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n context,\r\n onLinkSuccess,\r\n onLinkError,\r\n onUnlinkSuccess,\r\n onUnlinkError,\r\n linkLabel,\r\n unlinkLabel,\r\n },\r\n element,\r\n });\r\n },\r\n [\r\n novuUI,\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n context,\r\n onLinkSuccess,\r\n onLinkError,\r\n onUnlinkSuccess,\r\n onUnlinkError,\r\n linkLabel,\r\n unlinkLabel,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAC5B,2BAA0B;AAC1B,qBAAwB;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,QAAI,gCAAU;AAE7B,QAAM,YAAQ;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,4CAAC,0BAAQ,OAAc;AAChC;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/slack-link-user/DefaultSlackLinkUser.tsx"],"sourcesContent":["import { SlackLinkUserProps } from '@notiflyio/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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAC5B,2BAA0B;AAC1B,qBAAwB;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,QAAI,gCAAU;AAE7B,QAAM,YAAQ;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,4CAAC,0BAAQ,OAAc;AAChC;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/slack-link-user/SlackLinkUser.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\nimport { useNovu } from '../../hooks/NovuProvider';\r\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\r\nimport { withRenderer } from '../Renderer';\r\nimport { DefaultSlackLinkUser, DefaultSlackLinkUserProps } from './DefaultSlackLinkUser';\r\n\r\nexport type SlackLinkUserProps = DefaultSlackLinkUserProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\r\n\r\nconst SlackLinkUserInternal = withRenderer<SlackLinkUserProps>((props) => {\r\n const { container, appearance, ...defaultProps } = props;\r\n const novu = useNovu();\r\n\r\n const options: NovuUIOptions = useMemo(() => {\r\n return {\r\n container,\r\n appearance,\r\n options: novu.options,\r\n };\r\n }, [container, appearance, novu.options]);\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultSlackLinkUser {...defaultProps} />\r\n </NovuUI>\r\n );\r\n});\r\n\r\nSlackLinkUserInternal.displayName = 'SlackLinkUserInternal';\r\n\r\nexport const SlackLinkUser = React.memo((props: SlackLinkUserProps) => {\r\n return <SlackLinkUserInternal {...props} />;\r\n});\r\n\r\nSlackLinkUser.displayName = 'SlackLinkUser';\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,0BAAwB;AACxB,oBAAsC;AACtC,sBAA6B;AAC7B,kCAAgE;AAkB1D;AAdN,IAAM,4BAAwB,8BAAiC,CAAC,UAAU;AACxE,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,WAAO,6BAAQ;AAErB,QAAM,cAAyB,sBAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,4CAAC,wBAAO,SAAkB,MACxB,sDAAC,oDAAsB,GAAG,cAAc,GAC1C;AAEJ,CAAC;AAED,sBAAsB,cAAc;AAE7B,IAAM,gBAAgB,aAAAA,QAAM,KAAK,CAAC,UAA8B;AACrE,SAAO,4CAAC,yBAAuB,GAAG,OAAO;AAC3C,CAAC;AAED,cAAc,cAAc;","names":["React"]} | ||
| {"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;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,0BAAwB;AACxB,oBAAsC;AACtC,sBAA6B;AAC7B,kCAAgE;AAkB1D;AAdN,IAAM,4BAAwB,8BAAiC,CAAC,UAAU;AACxE,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,WAAO,6BAAQ;AAErB,QAAM,cAAyB,sBAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,4CAAC,wBAAO,SAAkB,MACxB,sDAAC,oDAAsB,GAAG,cAAc,GAC1C;AAEJ,CAAC;AAED,sBAAsB,cAAc;AAE7B,IAAM,gBAAgB,aAAAA,QAAM,KAAK,CAAC,UAA8B;AACrE,SAAO,4CAAC,yBAAuB,GAAG,OAAO;AAC3C,CAAC;AAED,cAAc,cAAc;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/subscription/DefaultSubscription.tsx"],"sourcesContent":["import { TopicSubscription } from '@notiflyio/js';\r\nimport { SubscriptionProps } from '@notiflyio/js/ui';\r\nimport { useCallback } from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { useRenderer } from '../../context/RendererContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type PreferencesRenderer = (subscription?: TopicSubscription, loading?: boolean) => React.ReactNode;\r\n\r\nexport type DefaultSubscriptionProps = {\r\n renderPreferences?: PreferencesRenderer;\r\n} & Pick<SubscriptionProps, 'open' | 'placement' | 'placementOffset' | 'topicKey' | 'identifier' | 'preferences'>;\r\n\r\nexport const DefaultSubscription = (props: DefaultSubscriptionProps) => {\r\n const { topicKey, identifier, preferences, open, placement, placementOffset, renderPreferences } = props;\r\n const { novuUI } = useNovuUI();\r\n const { mountElement } = useRenderer();\r\n\r\n const mount = useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'Subscription',\r\n props: {\r\n topicKey,\r\n identifier,\r\n preferences,\r\n open,\r\n placementOffset,\r\n placement,\r\n renderPreferences: renderPreferences\r\n ? (el, subscription, loading) => mountElement(el, renderPreferences(subscription, loading))\r\n : undefined,\r\n },\r\n element,\r\n });\r\n },\r\n [topicKey, identifier, preferences, open, placementOffset, placement, renderPreferences, novuUI, mountElement]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA4B;AAC5B,2BAA0B;AAC1B,6BAA4B;AAC5B,qBAAwB;AAkCf;AA1BF,IAAM,sBAAsB,CAAC,UAAoC;AACtE,QAAM,EAAE,UAAU,YAAY,aAAa,MAAM,WAAW,iBAAiB,kBAAkB,IAAI;AACnG,QAAM,EAAE,OAAO,QAAI,gCAAU;AAC7B,QAAM,EAAE,aAAa,QAAI,oCAAY;AAErC,QAAM,YAAQ;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,mBAAmB,oBACf,CAAC,IAAI,cAAc,YAAY,aAAa,IAAI,kBAAkB,cAAc,OAAO,CAAC,IACxF;AAAA,QACN;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,CAAC,UAAU,YAAY,aAAa,MAAM,iBAAiB,WAAW,mBAAmB,QAAQ,YAAY;AAAA,EAC/G;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/subscription/DefaultSubscription.tsx"],"sourcesContent":["import { TopicSubscription } from '@notiflyio/js';\nimport { SubscriptionProps } from '@notiflyio/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { useRenderer } from '../../context/RendererContext';\nimport { Mounter } from '../Mounter';\n\nexport type PreferencesRenderer = (subscription?: TopicSubscription, loading?: boolean) => React.ReactNode;\n\nexport type DefaultSubscriptionProps = {\n renderPreferences?: PreferencesRenderer;\n} & Pick<SubscriptionProps, 'open' | 'placement' | 'placementOffset' | 'topicKey' | 'identifier' | 'preferences'>;\n\nexport const DefaultSubscription = (props: DefaultSubscriptionProps) => {\n const { topicKey, identifier, preferences, open, placement, placementOffset, renderPreferences } = props;\n const { novuUI } = useNovuUI();\n const { mountElement } = useRenderer();\n\n const mount = useCallback(\n (element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'Subscription',\n props: {\n topicKey,\n identifier,\n preferences,\n open,\n placementOffset,\n placement,\n renderPreferences: renderPreferences\n ? (el, subscription, loading) => mountElement(el, renderPreferences(subscription, loading))\n : undefined,\n },\n element,\n });\n },\n [topicKey, identifier, preferences, open, placementOffset, placement, renderPreferences, novuUI, mountElement]\n );\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA4B;AAC5B,2BAA0B;AAC1B,6BAA4B;AAC5B,qBAAwB;AAkCf;AA1BF,IAAM,sBAAsB,CAAC,UAAoC;AACtE,QAAM,EAAE,UAAU,YAAY,aAAa,MAAM,WAAW,iBAAiB,kBAAkB,IAAI;AACnG,QAAM,EAAE,OAAO,QAAI,gCAAU;AAC7B,QAAM,EAAE,aAAa,QAAI,oCAAY;AAErC,QAAM,YAAQ;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,mBAAmB,oBACf,CAAC,IAAI,cAAc,YAAY,aAAa,IAAI,kBAAkB,cAAc,OAAO,CAAC,IACxF;AAAA,QACN;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,CAAC,UAAU,YAAY,aAAa,MAAM,iBAAiB,WAAW,mBAAmB,QAAQ,YAAY;AAAA,EAC/G;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/subscription/Subscription.tsx"],"sourcesContent":["import { SubscriptionLocalization } from '@notiflyio/js/ui';\r\nimport React, { useMemo } from 'react';\r\nimport { useNovu } from '../../hooks/NovuProvider';\r\nimport { ReactSubscriptionAppearance } from '../../utils/types';\r\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\r\nimport { withRenderer } from '../Renderer';\r\nimport { DefaultSubscription, DefaultSubscriptionProps } from './DefaultSubscription';\r\n\r\ntype BaseSubscriptionProps = {\r\n localization?: SubscriptionLocalization;\r\n appearance?: ReactSubscriptionAppearance;\r\n} & Pick<NovuUIOptions, 'container'>;\r\n\r\ntype SubscriptionPropsWithChildren = {\r\n children?: React.ReactNode;\r\n} & Exclude<DefaultSubscriptionProps, 'renderPreferences'> &\r\n BaseSubscriptionProps;\r\n\r\ntype SubscriptionPropsWithoutChildren = {\r\n children?: never;\r\n} & DefaultSubscriptionProps &\r\n BaseSubscriptionProps;\r\n\r\nexport type SubscriptionProps = SubscriptionPropsWithChildren | SubscriptionPropsWithoutChildren;\r\n\r\nconst SubscriptionInternal = withRenderer<SubscriptionProps>((props) => {\r\n const { container, localization, appearance, ...defaultSubscriptionProps } = props;\r\n const novu = useNovu();\r\n\r\n const options: NovuUIOptions = useMemo(() => {\r\n return {\r\n container,\r\n localization,\r\n appearance,\r\n options: novu.options,\r\n };\r\n }, [localization, appearance, container, novu.options]);\r\n\r\n if (isWithChildrenProps(props)) {\r\n const clonedChildren = React.Children.map(props.children, (child) => {\r\n if (React.isValidElement(child)) {\r\n return React.cloneElement(child, {\r\n ...child.props,\r\n topicKey: defaultSubscriptionProps.topicKey,\r\n identifier: defaultSubscriptionProps.identifier,\r\n preferences: defaultSubscriptionProps.preferences,\r\n });\r\n }\r\n\r\n return child;\r\n });\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n {clonedChildren}\r\n </NovuUI>\r\n );\r\n }\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultSubscription {...defaultSubscriptionProps} />\r\n </NovuUI>\r\n );\r\n});\r\n\r\nSubscriptionInternal.displayName = 'SubscriptionInternal';\r\n\r\nexport const Subscription = React.memo((props: SubscriptionProps) => {\r\n return <SubscriptionInternal {...props} />;\r\n});\r\n\r\nfunction isWithChildrenProps(props: SubscriptionProps): props is SubscriptionPropsWithChildren {\r\n return 'children' in props;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA+B;AAC/B,0BAAwB;AAExB,oBAAsC;AACtC,sBAA6B;AAC7B,iCAA8D;AA+CxD;AA5BN,IAAM,2BAAuB,8BAAgC,CAAC,UAAU;AACtE,QAAM,EAAE,WAAW,cAAc,YAAY,GAAG,yBAAyB,IAAI;AAC7E,QAAM,WAAO,6BAAQ;AAErB,QAAM,cAAyB,sBAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,cAAc,YAAY,WAAW,KAAK,OAAO,CAAC;AAEtD,MAAI,oBAAoB,KAAK,GAAG;AAC9B,UAAM,iBAAiB,aAAAA,QAAM,SAAS,IAAI,MAAM,UAAU,CAAC,UAAU;AACnE,UAAI,aAAAA,QAAM,eAAe,KAAK,GAAG;AAC/B,eAAO,aAAAA,QAAM,aAAa,OAAO;AAAA,UAC/B,GAAG,MAAM;AAAA,UACT,UAAU,yBAAyB;AAAA,UACnC,YAAY,yBAAyB;AAAA,UACrC,aAAa,yBAAyB;AAAA,QACxC,CAAC;AAAA,MACH;AAEA,aAAO;AAAA,IACT,CAAC;AAED,WACE,4CAAC,wBAAO,SAAkB,MACvB,0BACH;AAAA,EAEJ;AAEA,SACE,4CAAC,wBAAO,SAAkB,MACxB,sDAAC,kDAAqB,GAAG,0BAA0B,GACrD;AAEJ,CAAC;AAED,qBAAqB,cAAc;AAE5B,IAAM,eAAe,aAAAA,QAAM,KAAK,CAAC,UAA6B;AACnE,SAAO,4CAAC,wBAAsB,GAAG,OAAO;AAC1C,CAAC;AAED,SAAS,oBAAoB,OAAkE;AAC7F,SAAO,cAAc;AACvB;","names":["React"]} | ||
| {"version":3,"sources":["../../../../src/components/subscription/Subscription.tsx"],"sourcesContent":["import { SubscriptionLocalization } from '@notiflyio/js/ui';\nimport React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { ReactSubscriptionAppearance } from '../../utils/types';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultSubscription, DefaultSubscriptionProps } from './DefaultSubscription';\n\ntype BaseSubscriptionProps = {\n localization?: SubscriptionLocalization;\n appearance?: ReactSubscriptionAppearance;\n} & Pick<NovuUIOptions, 'container'>;\n\ntype SubscriptionPropsWithChildren = {\n children?: React.ReactNode;\n} & Exclude<DefaultSubscriptionProps, 'renderPreferences'> &\n BaseSubscriptionProps;\n\ntype SubscriptionPropsWithoutChildren = {\n children?: never;\n} & DefaultSubscriptionProps &\n BaseSubscriptionProps;\n\nexport type SubscriptionProps = SubscriptionPropsWithChildren | SubscriptionPropsWithoutChildren;\n\nconst SubscriptionInternal = withRenderer<SubscriptionProps>((props) => {\n const { container, localization, appearance, ...defaultSubscriptionProps } = props;\n const novu = useNovu();\n\n const options: NovuUIOptions = useMemo(() => {\n return {\n container,\n localization,\n appearance,\n options: novu.options,\n };\n }, [localization, appearance, container, novu.options]);\n\n if (isWithChildrenProps(props)) {\n const clonedChildren = React.Children.map(props.children, (child) => {\n if (React.isValidElement(child)) {\n return React.cloneElement(child, {\n ...child.props,\n topicKey: defaultSubscriptionProps.topicKey,\n identifier: defaultSubscriptionProps.identifier,\n preferences: defaultSubscriptionProps.preferences,\n });\n }\n\n return child;\n });\n\n return (\n <NovuUI options={options} novu={novu}>\n {clonedChildren}\n </NovuUI>\n );\n }\n\n return (\n <NovuUI options={options} novu={novu}>\n <DefaultSubscription {...defaultSubscriptionProps} />\n </NovuUI>\n );\n});\n\nSubscriptionInternal.displayName = 'SubscriptionInternal';\n\nexport const Subscription = React.memo((props: SubscriptionProps) => {\n return <SubscriptionInternal {...props} />;\n});\n\nfunction isWithChildrenProps(props: SubscriptionProps): props is SubscriptionPropsWithChildren {\n return 'children' in props;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA+B;AAC/B,0BAAwB;AAExB,oBAAsC;AACtC,sBAA6B;AAC7B,iCAA8D;AA+CxD;AA5BN,IAAM,2BAAuB,8BAAgC,CAAC,UAAU;AACtE,QAAM,EAAE,WAAW,cAAc,YAAY,GAAG,yBAAyB,IAAI;AAC7E,QAAM,WAAO,6BAAQ;AAErB,QAAM,cAAyB,sBAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,cAAc,YAAY,WAAW,KAAK,OAAO,CAAC;AAEtD,MAAI,oBAAoB,KAAK,GAAG;AAC9B,UAAM,iBAAiB,aAAAA,QAAM,SAAS,IAAI,MAAM,UAAU,CAAC,UAAU;AACnE,UAAI,aAAAA,QAAM,eAAe,KAAK,GAAG;AAC/B,eAAO,aAAAA,QAAM,aAAa,OAAO;AAAA,UAC/B,GAAG,MAAM;AAAA,UACT,UAAU,yBAAyB;AAAA,UACnC,YAAY,yBAAyB;AAAA,UACrC,aAAa,yBAAyB;AAAA,QACxC,CAAC;AAAA,MACH;AAEA,aAAO;AAAA,IACT,CAAC;AAED,WACE,4CAAC,wBAAO,SAAkB,MACvB,0BACH;AAAA,EAEJ;AAEA,SACE,4CAAC,wBAAO,SAAkB,MACxB,sDAAC,kDAAqB,GAAG,0BAA0B,GACrD;AAEJ,CAAC;AAED,qBAAqB,cAAc;AAE5B,IAAM,eAAe,aAAAA,QAAM,KAAK,CAAC,UAA6B;AACnE,SAAO,4CAAC,wBAAsB,GAAG,OAAO;AAC1C,CAAC;AAED,SAAS,oBAAoB,OAAkE;AAC7F,SAAO,cAAc;AACvB;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/subscription/SubscriptionButton.tsx"],"sourcesContent":["import type { SubscriptionButtonWrapperProps } from '@notiflyio/js/ui';\r\nimport React from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type SubscriptionButtonProps = Partial<SubscriptionButtonWrapperProps>;\r\n\r\nexport const SubscriptionButton = React.memo(\r\n ({\r\n topicKey,\r\n identifier,\r\n preferences,\r\n onClick,\r\n onDeleteError,\r\n onDeleteSuccess,\r\n onCreateError,\r\n onCreateSuccess,\r\n }: SubscriptionButtonProps) => {\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = React.useCallback(\r\n (element: HTMLElement) => {\r\n if (!topicKey) {\r\n return;\r\n }\r\n\r\n return novuUI.mountComponent({\r\n name: 'SubscriptionButton',\r\n element,\r\n props: {\r\n topicKey,\r\n identifier,\r\n preferences,\r\n onClick,\r\n onDeleteError,\r\n onDeleteSuccess,\r\n onCreateError,\r\n onCreateSuccess,\r\n },\r\n });\r\n },\r\n [\r\n novuUI,\r\n topicKey,\r\n identifier,\r\n preferences,\r\n onClick,\r\n onDeleteError,\r\n onDeleteSuccess,\r\n onCreateError,\r\n onCreateSuccess,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n }\r\n);\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,2BAA0B;AAC1B,qBAAwB;AAmDb;AA/CJ,IAAM,qBAAqB,aAAAA,QAAM;AAAA,EACtC,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAA+B;AAC7B,UAAM,EAAE,OAAO,QAAI,gCAAU;AAE7B,UAAM,QAAQ,aAAAA,QAAM;AAAA,MAClB,CAAC,YAAyB;AACxB,YAAI,CAAC,UAAU;AACb;AAAA,QACF;AAEA,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA,OAAO;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO,4CAAC,0BAAQ,OAAc;AAAA,EAChC;AACF;","names":["React"]} | ||
| {"version":3,"sources":["../../../../src/components/subscription/SubscriptionButton.tsx"],"sourcesContent":["import type { SubscriptionButtonWrapperProps } from '@notiflyio/js/ui';\nimport React from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type SubscriptionButtonProps = Partial<SubscriptionButtonWrapperProps>;\n\nexport const SubscriptionButton = React.memo(\n ({\n topicKey,\n identifier,\n preferences,\n onClick,\n onDeleteError,\n onDeleteSuccess,\n onCreateError,\n onCreateSuccess,\n }: SubscriptionButtonProps) => {\n const { novuUI } = useNovuUI();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n if (!topicKey) {\n return;\n }\n\n return novuUI.mountComponent({\n name: 'SubscriptionButton',\n element,\n props: {\n topicKey,\n identifier,\n preferences,\n onClick,\n onDeleteError,\n onDeleteSuccess,\n onCreateError,\n onCreateSuccess,\n },\n });\n },\n [\n novuUI,\n topicKey,\n identifier,\n preferences,\n onClick,\n onDeleteError,\n onDeleteSuccess,\n onCreateError,\n onCreateSuccess,\n ]\n );\n\n return <Mounter mount={mount} />;\n }\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,2BAA0B;AAC1B,qBAAwB;AAmDb;AA/CJ,IAAM,qBAAqB,aAAAA,QAAM;AAAA,EACtC,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAA+B;AAC7B,UAAM,EAAE,OAAO,QAAI,gCAAU;AAE7B,UAAM,QAAQ,aAAAA,QAAM;AAAA,MAClB,CAAC,YAAyB;AACxB,YAAI,CAAC,UAAU;AACb;AAAA,QACF;AAEA,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA,OAAO;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO,4CAAC,0BAAQ,OAAc;AAAA,EAChC;AACF;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/subscription/SubscriptionPreferences.tsx"],"sourcesContent":["import type { SubscriptionPreferencesWrapperProps } from '@notiflyio/js/ui';\r\nimport React from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type SubscriptionPreferencesProps = Partial<SubscriptionPreferencesWrapperProps>;\r\n\r\nexport const SubscriptionPreferences = React.memo(\r\n ({\r\n topicKey,\r\n identifier,\r\n preferences,\r\n onClick,\r\n onDeleteError,\r\n onDeleteSuccess,\r\n onCreateError,\r\n onCreateSuccess,\r\n }: SubscriptionPreferencesProps) => {\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = React.useCallback(\r\n (element: HTMLElement) => {\r\n if (!topicKey) {\r\n return;\r\n }\r\n\r\n return novuUI.mountComponent({\r\n name: 'SubscriptionPreferences',\r\n element,\r\n props: {\r\n topicKey,\r\n identifier,\r\n preferences,\r\n onClick,\r\n onDeleteError,\r\n onDeleteSuccess,\r\n onCreateError,\r\n onCreateSuccess,\r\n },\r\n });\r\n },\r\n [\r\n novuUI,\r\n topicKey,\r\n identifier,\r\n preferences,\r\n onClick,\r\n onDeleteError,\r\n onDeleteSuccess,\r\n onCreateError,\r\n onCreateSuccess,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n }\r\n);\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,2BAA0B;AAC1B,qBAAwB;AAmDb;AA/CJ,IAAM,0BAA0B,aAAAA,QAAM;AAAA,EAC3C,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAAoC;AAClC,UAAM,EAAE,OAAO,QAAI,gCAAU;AAE7B,UAAM,QAAQ,aAAAA,QAAM;AAAA,MAClB,CAAC,YAAyB;AACxB,YAAI,CAAC,UAAU;AACb;AAAA,QACF;AAEA,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA,OAAO;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO,4CAAC,0BAAQ,OAAc;AAAA,EAChC;AACF;","names":["React"]} | ||
| {"version":3,"sources":["../../../../src/components/subscription/SubscriptionPreferences.tsx"],"sourcesContent":["import type { SubscriptionPreferencesWrapperProps } from '@notiflyio/js/ui';\nimport React from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type SubscriptionPreferencesProps = Partial<SubscriptionPreferencesWrapperProps>;\n\nexport const SubscriptionPreferences = React.memo(\n ({\n topicKey,\n identifier,\n preferences,\n onClick,\n onDeleteError,\n onDeleteSuccess,\n onCreateError,\n onCreateSuccess,\n }: SubscriptionPreferencesProps) => {\n const { novuUI } = useNovuUI();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n if (!topicKey) {\n return;\n }\n\n return novuUI.mountComponent({\n name: 'SubscriptionPreferences',\n element,\n props: {\n topicKey,\n identifier,\n preferences,\n onClick,\n onDeleteError,\n onDeleteSuccess,\n onCreateError,\n onCreateSuccess,\n },\n });\n },\n [\n novuUI,\n topicKey,\n identifier,\n preferences,\n onClick,\n onDeleteError,\n onDeleteSuccess,\n onCreateError,\n onCreateSuccess,\n ]\n );\n\n return <Mounter mount={mount} />;\n }\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,2BAA0B;AAC1B,qBAAwB;AAmDb;AA/CJ,IAAM,0BAA0B,aAAAA,QAAM;AAAA,EAC3C,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAAoC;AAClC,UAAM,EAAE,OAAO,QAAI,gCAAU;AAE7B,UAAM,QAAQ,aAAAA,QAAM;AAAA,MAClB,CAAC,YAAyB;AACxB,YAAI,CAAC,UAAU;AACb;AAAA,QACF;AAEA,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA,OAAO;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO,4CAAC,0BAAQ,OAAc;AAAA,EAChC;AACF;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/telegram-connect-button/DefaultTelegramConnectButton.tsx"],"sourcesContent":["import { TelegramConnectButtonProps } from '@notiflyio/js/ui';\r\nimport { useCallback } from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type DefaultTelegramConnectButtonProps = Pick<\r\n TelegramConnectButtonProps,\r\n | 'integrationIdentifier'\r\n | 'subscriberId'\r\n | 'onConnectSuccess'\r\n | 'onConnectError'\r\n | 'onDisconnectSuccess'\r\n | 'onDisconnectError'\r\n | 'connectLabel'\r\n | 'connectedLabel'\r\n>;\r\n\r\nexport const DefaultTelegramConnectButton = (props: DefaultTelegramConnectButtonProps) => {\r\n const {\r\n integrationIdentifier,\r\n subscriberId,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'TelegramConnectButton',\r\n props: {\r\n integrationIdentifier,\r\n subscriberId,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n },\r\n element,\r\n });\r\n },\r\n [\r\n novuUI,\r\n integrationIdentifier,\r\n subscriberId,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAC5B,2BAA0B;AAC1B,qBAAwB;AAyDf;AA3CF,IAAM,+BAA+B,CAAC,UAA6C;AACxF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,OAAO,QAAI,gCAAU;AAE7B,QAAM,YAAQ;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,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,IACF;AAAA,EACF;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/telegram-connect-button/DefaultTelegramConnectButton.tsx"],"sourcesContent":["import { TelegramConnectButtonProps } from '@notiflyio/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultTelegramConnectButtonProps = Pick<\n TelegramConnectButtonProps,\n | 'integrationIdentifier'\n | 'subscriberId'\n | 'onConnectSuccess'\n | 'onConnectError'\n | 'onDisconnectSuccess'\n | 'onDisconnectError'\n | 'connectLabel'\n | 'connectedLabel'\n>;\n\nexport const DefaultTelegramConnectButton = (props: DefaultTelegramConnectButtonProps) => {\n const {\n integrationIdentifier,\n subscriberId,\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: 'TelegramConnectButton',\n props: {\n integrationIdentifier,\n subscriberId,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n },\n element,\n });\n },\n [\n novuUI,\n integrationIdentifier,\n subscriberId,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n ]\n );\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAC5B,2BAA0B;AAC1B,qBAAwB;AAyDf;AA3CF,IAAM,+BAA+B,CAAC,UAA6C;AACxF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,OAAO,QAAI,gCAAU;AAE7B,QAAM,YAAQ;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,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,IACF;AAAA,EACF;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/telegram-connect-button/TelegramConnectButton.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\nimport { useNovu } from '../../hooks/NovuProvider';\r\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\r\nimport { withRenderer } from '../Renderer';\r\nimport { DefaultTelegramConnectButton, DefaultTelegramConnectButtonProps } from './DefaultTelegramConnectButton';\r\n\r\nexport type TelegramConnectButtonProps = DefaultTelegramConnectButtonProps &\r\n Pick<NovuUIOptions, 'container' | 'appearance'>;\r\n\r\nconst TelegramConnectButtonInternal = withRenderer<TelegramConnectButtonProps>((props) => {\r\n const { container, appearance, ...defaultProps } = props;\r\n const novu = useNovu();\r\n\r\n const options: NovuUIOptions = useMemo(() => {\r\n return {\r\n container,\r\n appearance,\r\n options: novu.options,\r\n };\r\n }, [container, appearance, novu.options]);\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultTelegramConnectButton {...defaultProps} />\r\n </NovuUI>\r\n );\r\n});\r\n\r\nTelegramConnectButtonInternal.displayName = 'TelegramConnectButtonInternal';\r\n\r\nexport const TelegramConnectButton = React.memo((props: TelegramConnectButtonProps) => {\r\n return <TelegramConnectButtonInternal {...props} />;\r\n});\r\n\r\nTelegramConnectButton.displayName = 'TelegramConnectButton';\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,0BAAwB;AACxB,oBAAsC;AACtC,sBAA6B;AAC7B,0CAAgF;AAmB1E;AAdN,IAAM,oCAAgC,8BAAyC,CAAC,UAAU;AACxF,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,WAAO,6BAAQ;AAErB,QAAM,cAAyB,sBAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,4CAAC,wBAAO,SAAkB,MACxB,sDAAC,oEAA8B,GAAG,cAAc,GAClD;AAEJ,CAAC;AAED,8BAA8B,cAAc;AAErC,IAAM,wBAAwB,aAAAA,QAAM,KAAK,CAAC,UAAsC;AACrF,SAAO,4CAAC,iCAA+B,GAAG,OAAO;AACnD,CAAC;AAED,sBAAsB,cAAc;","names":["React"]} | ||
| {"version":3,"sources":["../../../../src/components/telegram-connect-button/TelegramConnectButton.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultTelegramConnectButton, DefaultTelegramConnectButtonProps } from './DefaultTelegramConnectButton';\n\nexport type TelegramConnectButtonProps = DefaultTelegramConnectButtonProps &\n Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst TelegramConnectButtonInternal = withRenderer<TelegramConnectButtonProps>((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 <DefaultTelegramConnectButton {...defaultProps} />\n </NovuUI>\n );\n});\n\nTelegramConnectButtonInternal.displayName = 'TelegramConnectButtonInternal';\n\nexport const TelegramConnectButton = React.memo((props: TelegramConnectButtonProps) => {\n return <TelegramConnectButtonInternal {...props} />;\n});\n\nTelegramConnectButton.displayName = 'TelegramConnectButton';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,0BAAwB;AACxB,oBAAsC;AACtC,sBAA6B;AAC7B,0CAAgF;AAmB1E;AAdN,IAAM,oCAAgC,8BAAyC,CAAC,UAAU;AACxF,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,WAAO,6BAAQ;AAErB,QAAM,cAAyB,sBAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,4CAAC,wBAAO,SAAkB,MACxB,sDAAC,oEAA8B,GAAG,cAAc,GAClD;AAEJ,CAAC;AAED,8BAA8B,cAAc;AAErC,IAAM,wBAAwB,aAAAA,QAAM,KAAK,CAAC,UAAsC;AACrF,SAAO,4CAAC,iCAA+B,GAAG,OAAO;AACnD,CAAC;AAED,sBAAsB,cAAc;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/context/NovuUIContext.tsx"],"sourcesContent":["import type { NovuUI } from '@notiflyio/js/ui';\r\nimport React from 'react';\r\nimport { createContextAndHook } from '../utils/createContextAndHook';\r\n\r\ntype NovuUIContextValue = {\r\n novuUI: NovuUI;\r\n};\r\n\r\nconst [NovuUIContext, useNovuUIContext, useUnsafeNovuUIContext] =\r\n createContextAndHook<NovuUIContextValue>('NovuUIContext');\r\n\r\nconst NovuUIProvider = (props: React.PropsWithChildren<{ value: NovuUIContextValue }>) => {\r\n return <NovuUIContext.Provider value={{ value: props.value }}>{props.children}</NovuUIContext.Provider>;\r\n};\r\n\r\nexport { useNovuUIContext as useNovuUI, useUnsafeNovuUIContext as useUnsafeNovuUI, NovuUIProvider };\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kCAAqC;AAU5B;AAJT,IAAM,CAAC,eAAe,kBAAkB,sBAAsB,QAC5D,kDAAyC,eAAe;AAE1D,IAAM,iBAAiB,CAAC,UAAkE;AACxF,SAAO,4CAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,OAAO,MAAM,MAAM,GAAI,gBAAM,UAAS;AAChF;","names":[]} | ||
| {"version":3,"sources":["../../../src/context/NovuUIContext.tsx"],"sourcesContent":["import type { NovuUI } from '@notiflyio/js/ui';\nimport React from 'react';\nimport { createContextAndHook } from '../utils/createContextAndHook';\n\ntype NovuUIContextValue = {\n novuUI: NovuUI;\n};\n\nconst [NovuUIContext, useNovuUIContext, useUnsafeNovuUIContext] =\n createContextAndHook<NovuUIContextValue>('NovuUIContext');\n\nconst NovuUIProvider = (props: React.PropsWithChildren<{ value: NovuUIContextValue }>) => {\n return <NovuUIContext.Provider value={{ value: props.value }}>{props.children}</NovuUIContext.Provider>;\n};\n\nexport { useNovuUIContext as useNovuUI, useUnsafeNovuUIContext as useUnsafeNovuUI, NovuUIProvider };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kCAAqC;AAU5B;AAJT,IAAM,CAAC,eAAe,kBAAkB,sBAAsB,QAC5D,kDAAyC,eAAe;AAE1D,IAAM,iBAAiB,CAAC,UAAkE;AACxF,SAAO,4CAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,OAAO,MAAM,MAAM,GAAI,gBAAM,UAAS;AAChF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/context/RendererContext.tsx"],"sourcesContent":["import React from 'react';\r\nimport { createContextAndHook } from '../utils/createContextAndHook';\r\n\r\nexport type MountedElement = React.ReactNode;\r\nexport type MountedElements = Map<HTMLElement, MountedElement>;\r\n\r\ntype RendererContextValue = {\r\n mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void;\r\n};\r\n\r\nconst [RendererContext, useRendererContext, useUnsafeRendererContext] =\r\n createContextAndHook<RendererContextValue>('RendererContext');\r\n\r\nconst RendererProvider = (props: React.PropsWithChildren<{ value: RendererContextValue }>) => {\r\n return <RendererContext.Provider value={{ value: props.value }}>{props.children}</RendererContext.Provider>;\r\n};\r\n\r\nexport { useRendererContext as useRenderer, useUnsafeRendererContext as useUnsafeRenderer, RendererProvider };\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kCAAqC;AAa5B;AAJT,IAAM,CAAC,iBAAiB,oBAAoB,wBAAwB,QAClE,kDAA2C,iBAAiB;AAE9D,IAAM,mBAAmB,CAAC,UAAoE;AAC5F,SAAO,4CAAC,gBAAgB,UAAhB,EAAyB,OAAO,EAAE,OAAO,MAAM,MAAM,GAAI,gBAAM,UAAS;AAClF;","names":[]} | ||
| {"version":3,"sources":["../../../src/context/RendererContext.tsx"],"sourcesContent":["import React from 'react';\nimport { createContextAndHook } from '../utils/createContextAndHook';\n\nexport type MountedElement = React.ReactNode;\nexport type MountedElements = Map<HTMLElement, MountedElement>;\n\ntype RendererContextValue = {\n mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void;\n};\n\nconst [RendererContext, useRendererContext, useUnsafeRendererContext] =\n createContextAndHook<RendererContextValue>('RendererContext');\n\nconst RendererProvider = (props: React.PropsWithChildren<{ value: RendererContextValue }>) => {\n return <RendererContext.Provider value={{ value: props.value }}>{props.children}</RendererContext.Provider>;\n};\n\nexport { useRendererContext as useRenderer, useUnsafeRendererContext as useUnsafeRenderer, RendererProvider };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kCAAqC;AAa5B;AAJT,IAAM,CAAC,iBAAiB,oBAAoB,wBAAwB,QAClE,kDAA2C,iBAAiB;AAE9D,IAAM,mBAAmB,CAAC,UAAoE;AAC5F,SAAO,4CAAC,gBAAgB,UAAhB,EAAyB,OAAO,EAAE,OAAO,MAAM,MAAM,GAAI,gBAAM,UAAS;AAClF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export type * from '@notiflyio/js';\r\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\r\nexport { NovuProvider, useNovu } from './NovuProvider';\r\nexport * from './useChannelConnection';\r\nexport * from './useChannelConnections';\r\nexport * from './useChannelEndpoint';\r\nexport * from './useCounts';\r\nexport * from './useCreateChannelEndpoint';\r\nexport * from './useCreateSubscription';\r\nexport * from './useDeleteChannelEndpoint';\r\nexport * from './useNotifications';\r\nexport * from './usePreferences';\r\nexport * from './useRemoveSubscription';\r\nexport * from './useSchedule';\r\nexport * from './useSubscription';\r\nexport * from './useSubscriptions';\r\nexport * from './useTelegramSubscriberLink';\r\nexport * from './useUpdateSubscription';\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAA4E;AAC5E,0BAAsC;AACtC,0BAAc,uCAHd;AAIA,0BAAc,wCAJd;AAKA,0BAAc,qCALd;AAMA,0BAAc,4BANd;AAOA,0BAAc,2CAPd;AAQA,0BAAc,wCARd;AASA,0BAAc,2CATd;AAUA,0BAAc,mCAVd;AAWA,0BAAc,iCAXd;AAYA,0BAAc,wCAZd;AAaA,0BAAc,8BAbd;AAcA,0BAAc,kCAdd;AAeA,0BAAc,mCAfd;AAgBA,0BAAc,4CAhBd;AAiBA,0BAAc,wCAjBd;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export type * from '@notiflyio/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\nexport { NovuProvider, useNovu } from './NovuProvider';\nexport * from './useChannelConnection';\nexport * from './useChannelConnections';\nexport * from './useChannelEndpoint';\nexport * from './useCounts';\nexport * from './useCreateChannelEndpoint';\nexport * from './useCreateSubscription';\nexport * from './useDeleteChannelEndpoint';\nexport * from './useNotifications';\nexport * from './usePreferences';\nexport * from './useRemoveSubscription';\nexport * from './useSchedule';\nexport * from './useSubscription';\nexport * from './useSubscriptions';\nexport * from './useTelegramSubscriberLink';\nexport * from './useUpdateSubscription';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAA4E;AAC5E,0BAAsC;AACtC,0BAAc,uCAHd;AAIA,0BAAc,wCAJd;AAKA,0BAAc,qCALd;AAMA,0BAAc,4BANd;AAOA,0BAAc,2CAPd;AAQA,0BAAc,wCARd;AASA,0BAAc,2CATd;AAUA,0BAAc,mCAVd;AAWA,0BAAc,iCAXd;AAYA,0BAAc,wCAZd;AAaA,0BAAc,8BAbd;AAcA,0BAAc,kCAdd;AAeA,0BAAc,mCAfd;AAgBA,0BAAc,4CAhBd;AAiBA,0BAAc,wCAjBd;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/hooks/internal/useBrowserTabsChannel.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\r\n\r\nexport const useBrowserTabsChannel = <T = unknown>({\r\n channelName,\r\n onMessage,\r\n enabled = true,\r\n}: {\r\n channelName: string;\r\n onMessage: (args: T) => void;\r\n enabled?: boolean;\r\n}) => {\r\n const [tabsChannel] = useState(\r\n typeof BroadcastChannel !== 'undefined' ? new BroadcastChannel(channelName) : undefined\r\n );\r\n\r\n const postMessage = (data: T) => {\r\n if (!enabled) return;\r\n tabsChannel?.postMessage(data);\r\n };\r\n\r\n useEffect(() => {\r\n if (!enabled) return;\r\n\r\n const listener = (event: MessageEvent<T>) => {\r\n onMessage(event.data);\r\n };\r\n\r\n tabsChannel?.addEventListener('message', listener);\r\n\r\n return () => {\r\n tabsChannel?.removeEventListener('message', listener);\r\n };\r\n }, [enabled]);\r\n\r\n return { postMessage };\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoC;AAE7B,IAAM,wBAAwB,CAAc;AAAA,EACjD;AAAA,EACA;AAAA,EACA,UAAU;AACZ,MAIM;AACJ,QAAM,CAAC,WAAW,QAAI;AAAA,IACpB,OAAO,qBAAqB,cAAc,IAAI,iBAAiB,WAAW,IAAI;AAAA,EAChF;AAEA,QAAM,cAAc,CAAC,SAAY;AAC/B,QAAI,CAAC,QAAS;AACd,+CAAa,YAAY;AAAA,EAC3B;AAEA,8BAAU,MAAM;AACd,QAAI,CAAC,QAAS;AAEd,UAAM,WAAW,CAAC,UAA2B;AAC3C,gBAAU,MAAM,IAAI;AAAA,IACtB;AAEA,+CAAa,iBAAiB,WAAW;AAEzC,WAAO,MAAM;AACX,iDAAa,oBAAoB,WAAW;AAAA,IAC9C;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAEZ,SAAO,EAAE,YAAY;AACvB;","names":[]} | ||
| {"version":3,"sources":["../../../../src/hooks/internal/useBrowserTabsChannel.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport const useBrowserTabsChannel = <T = unknown>({\n channelName,\n onMessage,\n enabled = true,\n}: {\n channelName: string;\n onMessage: (args: T) => void;\n enabled?: boolean;\n}) => {\n const [tabsChannel] = useState(\n typeof BroadcastChannel !== 'undefined' ? new BroadcastChannel(channelName) : undefined\n );\n\n const postMessage = (data: T) => {\n if (!enabled) return;\n tabsChannel?.postMessage(data);\n };\n\n useEffect(() => {\n if (!enabled) return;\n\n const listener = (event: MessageEvent<T>) => {\n onMessage(event.data);\n };\n\n tabsChannel?.addEventListener('message', listener);\n\n return () => {\n tabsChannel?.removeEventListener('message', listener);\n };\n }, [enabled]);\n\n return { postMessage };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoC;AAE7B,IAAM,wBAAwB,CAAc;AAAA,EACjD;AAAA,EACA;AAAA,EACA,UAAU;AACZ,MAIM;AACJ,QAAM,CAAC,WAAW,QAAI;AAAA,IACpB,OAAO,qBAAqB,cAAc,IAAI,iBAAiB,WAAW,IAAI;AAAA,EAChF;AAEA,QAAM,cAAc,CAAC,SAAY;AAC/B,QAAI,CAAC,QAAS;AACd,+CAAa,YAAY;AAAA,EAC3B;AAEA,8BAAU,MAAM;AACd,QAAI,CAAC,QAAS;AAEd,UAAM,WAAW,CAAC,UAA2B;AAC3C,gBAAU,MAAM,IAAI;AAAA,IACtB;AAEA,+CAAa,iBAAiB,WAAW;AAEzC,WAAO,MAAM;AACX,iDAAa,oBAAoB,WAAW;AAAA,IAC9C;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAEZ,SAAO,EAAE,YAAY;AACvB;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/hooks/internal/useDataRef.ts"],"sourcesContent":["import { useRef } from 'react';\r\n\r\nexport const useDataRef = <T>(data: T) => {\r\n const ref = useRef(data);\r\n ref.current = data;\r\n\r\n return ref;\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAuB;AAEhB,IAAM,aAAa,CAAI,SAAY;AACxC,QAAM,UAAM,qBAAO,IAAI;AACvB,MAAI,UAAU;AAEd,SAAO;AACT;","names":[]} | ||
| {"version":3,"sources":["../../../../src/hooks/internal/useDataRef.ts"],"sourcesContent":["import { useRef } from 'react';\n\nexport const useDataRef = <T>(data: T) => {\n const ref = useRef(data);\n ref.current = data;\n\n return ref;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAuB;AAEhB,IAAM,aAAa,CAAI,SAAY;AACxC,QAAM,UAAM,qBAAO,IAAI;AACvB,MAAI,UAAU;AAEd,SAAO;AACT;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/hooks/internal/useWebsocketEvent.ts"],"sourcesContent":["import { EventHandler, Events, SocketEventNames } from '@notiflyio/js';\r\nimport { useEffect } from 'react';\r\nimport { requestLock } from '../../utils/requestLock';\r\nimport { useNovu } from '../NovuProvider';\r\nimport { useBrowserTabsChannel } from './useBrowserTabsChannel';\r\n\r\nexport const useWebSocketEvent = <E extends SocketEventNames>({\r\n event: webSocketEvent,\r\n eventHandler: onMessage,\r\n enabled = true,\r\n}: {\r\n event: E;\r\n eventHandler: (args: Events[E]) => void;\r\n enabled?: boolean;\r\n}) => {\r\n const novu = useNovu();\r\n const channelName = `nv_ws_connection:a=${novu.applicationIdentifier}:s=${novu.subscriberId}:c=${novu.contextKey}:e=${webSocketEvent}`;\r\n\r\n const { postMessage } = useBrowserTabsChannel({\r\n channelName,\r\n onMessage,\r\n enabled,\r\n });\r\n\r\n const updateReadCount: EventHandler<Events[E]> = (data) => {\r\n onMessage(data);\r\n postMessage(data);\r\n };\r\n\r\n useEffect(() => {\r\n if (!enabled) return;\r\n\r\n let cleanup: () => void;\r\n const resolveLock = requestLock(channelName, () => {\r\n cleanup = novu.on(webSocketEvent, updateReadCount);\r\n });\r\n\r\n return () => {\r\n if (cleanup) {\r\n cleanup();\r\n }\r\n\r\n resolveLock();\r\n };\r\n }, [enabled]);\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA0B;AAC1B,yBAA4B;AAC5B,0BAAwB;AACxB,mCAAsC;AAE/B,IAAM,oBAAoB,CAA6B;AAAA,EAC5D,OAAO;AAAA,EACP,cAAc;AAAA,EACd,UAAU;AACZ,MAIM;AACJ,QAAM,WAAO,6BAAQ;AACrB,QAAM,cAAc,sBAAsB,KAAK,qBAAqB,MAAM,KAAK,YAAY,MAAM,KAAK,UAAU,MAAM,cAAc;AAEpI,QAAM,EAAE,YAAY,QAAI,oDAAsB;AAAA,IAC5C;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,kBAA2C,CAAC,SAAS;AACzD,cAAU,IAAI;AACd,gBAAY,IAAI;AAAA,EAClB;AAEA,8BAAU,MAAM;AACd,QAAI,CAAC,QAAS;AAEd,QAAI;AACJ,UAAM,kBAAc,gCAAY,aAAa,MAAM;AACjD,gBAAU,KAAK,GAAG,gBAAgB,eAAe;AAAA,IACnD,CAAC;AAED,WAAO,MAAM;AACX,UAAI,SAAS;AACX,gBAAQ;AAAA,MACV;AAEA,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AACd;","names":[]} | ||
| {"version":3,"sources":["../../../../src/hooks/internal/useWebsocketEvent.ts"],"sourcesContent":["import { EventHandler, Events, SocketEventNames } from '@notiflyio/js';\nimport { useEffect } from 'react';\nimport { requestLock } from '../../utils/requestLock';\nimport { useNovu } from '../NovuProvider';\nimport { useBrowserTabsChannel } from './useBrowserTabsChannel';\n\nexport const useWebSocketEvent = <E extends SocketEventNames>({\n event: webSocketEvent,\n eventHandler: onMessage,\n enabled = true,\n}: {\n event: E;\n eventHandler: (args: Events[E]) => void;\n enabled?: boolean;\n}) => {\n const novu = useNovu();\n const channelName = `nv_ws_connection:a=${novu.applicationIdentifier}:s=${novu.subscriberId}:c=${novu.contextKey}:e=${webSocketEvent}`;\n\n const { postMessage } = useBrowserTabsChannel({\n channelName,\n onMessage,\n enabled,\n });\n\n const updateReadCount: EventHandler<Events[E]> = (data) => {\n onMessage(data);\n postMessage(data);\n };\n\n useEffect(() => {\n if (!enabled) return;\n\n let cleanup: () => void;\n const resolveLock = requestLock(channelName, () => {\n cleanup = novu.on(webSocketEvent, updateReadCount);\n });\n\n return () => {\n if (cleanup) {\n cleanup();\n }\n\n resolveLock();\n };\n }, [enabled]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA0B;AAC1B,yBAA4B;AAC5B,0BAAwB;AACxB,mCAAsC;AAE/B,IAAM,oBAAoB,CAA6B;AAAA,EAC5D,OAAO;AAAA,EACP,cAAc;AAAA,EACd,UAAU;AACZ,MAIM;AACJ,QAAM,WAAO,6BAAQ;AACrB,QAAM,cAAc,sBAAsB,KAAK,qBAAqB,MAAM,KAAK,YAAY,MAAM,KAAK,UAAU,MAAM,cAAc;AAEpI,QAAM,EAAE,YAAY,QAAI,oDAAsB;AAAA,IAC5C;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,kBAA2C,CAAC,SAAS;AACzD,cAAU,IAAI;AACd,gBAAY,IAAI;AAAA,EAClB;AAEA,8BAAU,MAAM;AACd,QAAI,CAAC,QAAS;AAEd,QAAI;AACJ,UAAM,kBAAc,gCAAY,aAAa,MAAM;AACjD,gBAAU,KAAK,GAAG,gBAAgB,eAAe;AAAA,IACnD,CAAC;AAED,WAAO,MAAM;AACX,UAAI,SAAS;AACX,gBAAQ;AAAA,MACV;AAEA,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AACd;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/NovuProvider.tsx"],"sourcesContent":["import { Novu, NovuOptions } from '@notiflyio/js';\r\nimport { buildSubscriber } from '@notiflyio/js/internal';\r\nimport { createContext, ReactNode, useContext, useMemo } from 'react';\r\n\r\nexport type NovuProviderProps = NovuOptions & {\r\n /**\r\n * When `false`, disables the WebSocket subscription that auto-injects\r\n * newly received notifications into the list and subscription that auto-resync\r\n * notification counts. Built-in mutations like\r\n * `readAll`, `seenAll`, `archiveAll`, and `archiveAllRead` continue to\r\n * update local state. Use this when you want to drive new-notification updates yourself (e.g.\r\n * via your own `novu.on('notifications.notification_received', ...)`\r\n * handler combined with `refetch()`). Defaults to `true`.\r\n */\r\n realtime?: boolean;\r\n children: ReactNode;\r\n};\r\n\r\nconst NovuContext = createContext<{ novu: Novu; realtime: boolean }>({ novu: undefined as any, realtime: true });\r\n\r\nexport const NovuProvider = (props: NovuProviderProps) => {\r\n const { subscriberId, realtime = true, ...propsWithoutSubscriberId } = props;\r\n const subscriberObj = useMemo(\r\n () => buildSubscriber({ subscriberId, subscriber: props.subscriber }),\r\n [subscriberId, props.subscriber]\r\n );\r\n const applicationIdentifier = propsWithoutSubscriberId.applicationIdentifier\r\n ? propsWithoutSubscriberId.applicationIdentifier\r\n : '';\r\n\r\n const providerProps: NovuProviderProps = {\r\n ...propsWithoutSubscriberId,\r\n applicationIdentifier,\r\n subscriber: subscriberObj,\r\n realtime,\r\n };\r\n\r\n return (\r\n <InternalNovuProvider {...providerProps} applicationIdentifier={applicationIdentifier}>\r\n {props.children}\r\n </InternalNovuProvider>\r\n );\r\n};\r\n\r\n/**\r\n * @internal Should be used internally not to be exposed outside of the library\r\n */\r\nexport const InternalNovuProvider = (props: NovuProviderProps) => {\r\n const applicationIdentifier = props.applicationIdentifier || '';\r\n const subscriberObj = useMemo(\r\n () => buildSubscriber({ subscriberId: props.subscriberId, subscriber: props.subscriber }),\r\n [props.subscriberId, props.subscriber]\r\n );\r\n\r\n const {\r\n children,\r\n subscriberHash,\r\n contextHash,\r\n backendUrl,\r\n apiUrl,\r\n socketUrl,\r\n socketOptions,\r\n useCache,\r\n defaultSchedule,\r\n context,\r\n realtime = true,\r\n } = props;\r\n\r\n const value = useMemo(\r\n () => ({\r\n novu: new Novu({\r\n applicationIdentifier,\r\n subscriberHash,\r\n contextHash,\r\n backendUrl,\r\n apiUrl,\r\n socketUrl,\r\n socketOptions,\r\n useCache,\r\n subscriber: subscriberObj,\r\n defaultSchedule,\r\n context,\r\n }),\r\n realtime,\r\n }),\r\n [\r\n applicationIdentifier,\r\n subscriberHash,\r\n subscriberObj,\r\n context,\r\n contextHash,\r\n backendUrl,\r\n apiUrl,\r\n socketUrl,\r\n socketOptions,\r\n useCache,\r\n realtime,\r\n ]\r\n );\r\n\r\n return <NovuContext.Provider value={value}>{children}</NovuContext.Provider>;\r\n};\r\n\r\nexport const useNovu = () => {\r\n const context = useContext(NovuContext);\r\n if (!context.novu) {\r\n throw new Error('useNovu must be used within a <NovuProvider />');\r\n }\r\n\r\n return context.novu;\r\n};\r\n\r\nexport const useUnsafeNovu = () => {\r\n const context = useContext(NovuContext);\r\n\r\n return context.novu;\r\n};\r\n\r\nexport const useRealtime = () => {\r\n const context = useContext(NovuContext);\r\n\r\n return context.realtime;\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAkC;AAClC,sBAAgC;AAChC,mBAA8D;AAoC1D;AApBJ,IAAM,kBAAc,4BAAiD,EAAE,MAAM,QAAkB,UAAU,KAAK,CAAC;AAExG,IAAM,eAAe,CAAC,UAA6B;AACxD,QAAM,EAAE,cAAc,WAAW,MAAM,GAAG,yBAAyB,IAAI;AACvE,QAAM,oBAAgB;AAAA,IACpB,UAAM,iCAAgB,EAAE,cAAc,YAAY,MAAM,WAAW,CAAC;AAAA,IACpE,CAAC,cAAc,MAAM,UAAU;AAAA,EACjC;AACA,QAAM,wBAAwB,yBAAyB,wBACnD,yBAAyB,wBACzB;AAEJ,QAAM,gBAAmC;AAAA,IACvC,GAAG;AAAA,IACH;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,EACF;AAEA,SACE,4CAAC,wBAAsB,GAAG,eAAe,uBACtC,gBAAM,UACT;AAEJ;AAKO,IAAM,uBAAuB,CAAC,UAA6B;AAChE,QAAM,wBAAwB,MAAM,yBAAyB;AAC7D,QAAM,oBAAgB;AAAA,IACpB,UAAM,iCAAgB,EAAE,cAAc,MAAM,cAAc,YAAY,MAAM,WAAW,CAAC;AAAA,IACxF,CAAC,MAAM,cAAc,MAAM,UAAU;AAAA,EACvC;AAEA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,EACb,IAAI;AAEJ,QAAM,YAAQ;AAAA,IACZ,OAAO;AAAA,MACL,MAAM,IAAI,eAAK;AAAA,QACb;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,YAAY;AAAA,QACZ;AAAA,QACA;AAAA,MACF,CAAC;AAAA,MACD;AAAA,IACF;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,4CAAC,YAAY,UAAZ,EAAqB,OAAe,UAAS;AACvD;AAEO,IAAM,UAAU,MAAM;AAC3B,QAAM,cAAU,yBAAW,WAAW;AACtC,MAAI,CAAC,QAAQ,MAAM;AACjB,UAAM,IAAI,MAAM,gDAAgD;AAAA,EAClE;AAEA,SAAO,QAAQ;AACjB;AAEO,IAAM,gBAAgB,MAAM;AACjC,QAAM,cAAU,yBAAW,WAAW;AAEtC,SAAO,QAAQ;AACjB;AAEO,IAAM,cAAc,MAAM;AAC/B,QAAM,cAAU,yBAAW,WAAW;AAEtC,SAAO,QAAQ;AACjB;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/NovuProvider.tsx"],"sourcesContent":["import { Novu, NovuOptions } from '@notiflyio/js';\nimport { buildSubscriber } from '@notiflyio/js/internal';\nimport { createContext, ReactNode, useContext, useMemo } from 'react';\n\nexport type NovuProviderProps = NovuOptions & {\n /**\n * When `false`, disables the WebSocket subscription that auto-injects\n * newly received notifications into the list and subscription that auto-resync\n * notification counts. Built-in mutations like\n * `readAll`, `seenAll`, `archiveAll`, and `archiveAllRead` continue to\n * update local state. Use this when you want to drive new-notification updates yourself (e.g.\n * via your own `novu.on('notifications.notification_received', ...)`\n * handler combined with `refetch()`). Defaults to `true`.\n */\n realtime?: boolean;\n children: ReactNode;\n};\n\nconst NovuContext = createContext<{ novu: Novu; realtime: boolean }>({ novu: undefined as any, realtime: true });\n\nexport const NovuProvider = (props: NovuProviderProps) => {\n const { subscriberId, realtime = true, ...propsWithoutSubscriberId } = props;\n const subscriberObj = useMemo(\n () => buildSubscriber({ subscriberId, subscriber: props.subscriber }),\n [subscriberId, props.subscriber]\n );\n const applicationIdentifier = propsWithoutSubscriberId.applicationIdentifier\n ? propsWithoutSubscriberId.applicationIdentifier\n : '';\n\n const providerProps: NovuProviderProps = {\n ...propsWithoutSubscriberId,\n applicationIdentifier,\n subscriber: subscriberObj,\n realtime,\n };\n\n return (\n <InternalNovuProvider {...providerProps} applicationIdentifier={applicationIdentifier}>\n {props.children}\n </InternalNovuProvider>\n );\n};\n\n/**\n * @internal Should be used internally not to be exposed outside of the library\n */\nexport const InternalNovuProvider = (props: NovuProviderProps) => {\n const applicationIdentifier = props.applicationIdentifier || '';\n const subscriberObj = useMemo(\n () => buildSubscriber({ subscriberId: props.subscriberId, subscriber: props.subscriber }),\n [props.subscriberId, props.subscriber]\n );\n\n const {\n children,\n subscriberHash,\n contextHash,\n backendUrl,\n apiUrl,\n socketUrl,\n socketOptions,\n useCache,\n defaultSchedule,\n context,\n realtime = true,\n } = props;\n\n const value = useMemo(\n () => ({\n novu: new Novu({\n applicationIdentifier,\n subscriberHash,\n contextHash,\n backendUrl,\n apiUrl,\n socketUrl,\n socketOptions,\n useCache,\n subscriber: subscriberObj,\n defaultSchedule,\n context,\n }),\n realtime,\n }),\n [\n applicationIdentifier,\n subscriberHash,\n subscriberObj,\n context,\n contextHash,\n backendUrl,\n apiUrl,\n socketUrl,\n socketOptions,\n useCache,\n realtime,\n ]\n );\n\n return <NovuContext.Provider value={value}>{children}</NovuContext.Provider>;\n};\n\nexport const useNovu = () => {\n const context = useContext(NovuContext);\n if (!context.novu) {\n throw new Error('useNovu must be used within a <NovuProvider />');\n }\n\n return context.novu;\n};\n\nexport const useUnsafeNovu = () => {\n const context = useContext(NovuContext);\n\n return context.novu;\n};\n\nexport const useRealtime = () => {\n const context = useContext(NovuContext);\n\n return context.realtime;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAkC;AAClC,sBAAgC;AAChC,mBAA8D;AAoC1D;AApBJ,IAAM,kBAAc,4BAAiD,EAAE,MAAM,QAAkB,UAAU,KAAK,CAAC;AAExG,IAAM,eAAe,CAAC,UAA6B;AACxD,QAAM,EAAE,cAAc,WAAW,MAAM,GAAG,yBAAyB,IAAI;AACvE,QAAM,oBAAgB;AAAA,IACpB,UAAM,iCAAgB,EAAE,cAAc,YAAY,MAAM,WAAW,CAAC;AAAA,IACpE,CAAC,cAAc,MAAM,UAAU;AAAA,EACjC;AACA,QAAM,wBAAwB,yBAAyB,wBACnD,yBAAyB,wBACzB;AAEJ,QAAM,gBAAmC;AAAA,IACvC,GAAG;AAAA,IACH;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,EACF;AAEA,SACE,4CAAC,wBAAsB,GAAG,eAAe,uBACtC,gBAAM,UACT;AAEJ;AAKO,IAAM,uBAAuB,CAAC,UAA6B;AAChE,QAAM,wBAAwB,MAAM,yBAAyB;AAC7D,QAAM,oBAAgB;AAAA,IACpB,UAAM,iCAAgB,EAAE,cAAc,MAAM,cAAc,YAAY,MAAM,WAAW,CAAC;AAAA,IACxF,CAAC,MAAM,cAAc,MAAM,UAAU;AAAA,EACvC;AAEA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,EACb,IAAI;AAEJ,QAAM,YAAQ;AAAA,IACZ,OAAO;AAAA,MACL,MAAM,IAAI,eAAK;AAAA,QACb;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,YAAY;AAAA,QACZ;AAAA,QACA;AAAA,MACF,CAAC;AAAA,MACD;AAAA,IACF;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,4CAAC,YAAY,UAAZ,EAAqB,OAAe,UAAS;AACvD;AAEO,IAAM,UAAU,MAAM;AAC3B,QAAM,cAAU,yBAAW,WAAW;AACtC,MAAI,CAAC,QAAQ,MAAM;AACjB,UAAM,IAAI,MAAM,gDAAgD;AAAA,EAClE;AAEA,SAAO,QAAQ;AACjB;AAEO,IAAM,gBAAgB,MAAM;AACjC,QAAM,cAAU,yBAAW,WAAW;AAEtC,SAAO,QAAQ;AACjB;AAEO,IAAM,cAAc,MAAM;AAC/B,QAAM,cAAU,yBAAW,WAAW;AAEtC,SAAO,QAAQ;AACjB;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useChannelConnection.ts"],"sourcesContent":["import type { ChannelConnectionResponse, NovuError } from '@notiflyio/js';\r\nimport { useCallback, useEffect, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseChannelConnectionProps = {\r\n identifier: string;\r\n onSuccess?: (data: ChannelConnectionResponse | null) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseChannelConnectionResult = {\r\n connection?: ChannelConnectionResponse | null;\r\n error?: NovuError;\r\n isLoading: boolean;\r\n isFetching: boolean;\r\n refetch: () => Promise<void>;\r\n};\r\n\r\n/**\r\n * Get a channel connection by identifier.\r\n */\r\nexport const useChannelConnection = (props: UseChannelConnectionProps): UseChannelConnectionResult => {\r\n const novu = useNovu();\r\n const propsRef = useRef<UseChannelConnectionProps>(props);\r\n propsRef.current = props;\r\n\r\n const [connection, setConnection] = useState<ChannelConnectionResponse | null>();\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const fetchConnection = useCallback(\r\n async (options?: { refetch: boolean }) => {\r\n const { identifier, onSuccess, onError } = propsRef.current;\r\n if (options?.refetch) {\r\n setError(undefined);\r\n setIsLoading(true);\r\n }\r\n\r\n setIsFetching(true);\r\n\r\n const response = await novu.channelConnections.get({ identifier });\r\n\r\n if (response.error) {\r\n setError(response.error as NovuError);\r\n onError?.(response.error as NovuError);\r\n } else if (response.data !== undefined) {\r\n onSuccess?.(response.data);\r\n setConnection(response.data);\r\n }\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n },\r\n [novu]\r\n );\r\n\r\n // props.identifier triggers a re-fetch and re-registration whenever the\r\n // caller switches to a different identifier; fetchConnection reads it from\r\n // propsRef at call-time so it doesn't appear in the callback body directly.\r\n // biome-ignore lint/correctness/useExhaustiveDependencies: props.identifier is an intentional trigger dependency\r\n useEffect(() => {\r\n const cleanupGetPending = novu.on('channel-connection.get.pending', ({ args }) => {\r\n if (!args || args.identifier !== propsRef.current.identifier) {\r\n return;\r\n }\r\n setIsFetching(true);\r\n });\r\n\r\n const cleanupGetResolved = novu.on('channel-connection.get.resolved', ({ args, data, error: resolvedError }) => {\r\n if (!args || args.identifier !== propsRef.current.identifier) {\r\n return;\r\n }\r\n const { onSuccess, onError } = propsRef.current;\r\n if (resolvedError) {\r\n setError(resolvedError as NovuError);\r\n onError?.(resolvedError as NovuError);\r\n } else {\r\n setConnection((data as ChannelConnectionResponse) ?? null);\r\n onSuccess?.((data as ChannelConnectionResponse) ?? null);\r\n }\r\n setIsFetching(false);\r\n });\r\n\r\n const cleanupDeleteResolved = novu.on('channel-connection.delete.resolved', ({ args }) => {\r\n if (!args || args.identifier !== propsRef.current.identifier) {\r\n return;\r\n }\r\n setConnection(null);\r\n propsRef.current.onSuccess?.(null);\r\n setIsFetching(false);\r\n });\r\n\r\n void fetchConnection({ refetch: true });\r\n\r\n return () => {\r\n cleanupGetPending();\r\n cleanupGetResolved();\r\n cleanupDeleteResolved();\r\n };\r\n }, [novu, fetchConnection, props.identifier]);\r\n\r\n const refetch = useCallback(() => fetchConnection({ refetch: true }), [fetchConnection]);\r\n\r\n return {\r\n connection,\r\n error,\r\n isLoading,\r\n isFetching,\r\n refetch,\r\n };\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAyD;AACzD,0BAAwB;AAmBjB,IAAM,uBAAuB,CAAC,UAAiE;AACpG,QAAM,WAAO,6BAAQ;AACrB,QAAM,eAAW,qBAAkC,KAAK;AACxD,WAAS,UAAU;AAEnB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAA2C;AAC/E,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAElD,QAAM,sBAAkB;AAAA,IACtB,OAAO,YAAmC;AACxC,YAAM,EAAE,YAAY,WAAW,QAAQ,IAAI,SAAS;AACpD,UAAI,mCAAS,SAAS;AACpB,iBAAS,MAAS;AAClB,qBAAa,IAAI;AAAA,MACnB;AAEA,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,mBAAmB,IAAI,EAAE,WAAW,CAAC;AAEjE,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAkB;AACpC,2CAAU,SAAS;AAAA,MACrB,WAAW,SAAS,SAAS,QAAW;AACtC,+CAAY,SAAS;AACrB,sBAAc,SAAS,IAA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ACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useChannelConnection.ts"],"sourcesContent":["import type { ChannelConnectionResponse, NovuError } from '@notiflyio/js';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseChannelConnectionProps = {\n identifier: string;\n onSuccess?: (data: ChannelConnectionResponse | null) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseChannelConnectionResult = {\n connection?: ChannelConnectionResponse | null;\n error?: NovuError;\n isLoading: boolean;\n isFetching: boolean;\n refetch: () => Promise<void>;\n};\n\n/**\n * Get a channel connection by identifier.\n */\nexport const useChannelConnection = (props: UseChannelConnectionProps): UseChannelConnectionResult => {\n const novu = useNovu();\n const propsRef = useRef<UseChannelConnectionProps>(props);\n propsRef.current = props;\n\n const [connection, setConnection] = useState<ChannelConnectionResponse | null>();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const fetchConnection = useCallback(\n async (options?: { refetch: boolean }) => {\n const { identifier, onSuccess, onError } = propsRef.current;\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n }\n\n setIsFetching(true);\n\n const response = await novu.channelConnections.get({ identifier });\n\n if (response.error) {\n setError(response.error as NovuError);\n onError?.(response.error as NovuError);\n } else if (response.data !== undefined) {\n onSuccess?.(response.data);\n setConnection(response.data);\n }\n setIsLoading(false);\n setIsFetching(false);\n },\n [novu]\n );\n\n // props.identifier triggers a re-fetch and re-registration whenever the\n // caller switches to a different identifier; fetchConnection reads it from\n // propsRef at call-time so it doesn't appear in the callback body directly.\n // biome-ignore lint/correctness/useExhaustiveDependencies: props.identifier is an intentional trigger dependency\n useEffect(() => {\n const cleanupGetPending = novu.on('channel-connection.get.pending', ({ args }) => {\n if (!args || args.identifier !== propsRef.current.identifier) {\n return;\n }\n setIsFetching(true);\n });\n\n const cleanupGetResolved = novu.on('channel-connection.get.resolved', ({ args, data, error: resolvedError }) => {\n if (!args || args.identifier !== propsRef.current.identifier) {\n return;\n }\n const { onSuccess, onError } = propsRef.current;\n if (resolvedError) {\n setError(resolvedError as NovuError);\n onError?.(resolvedError as NovuError);\n } else {\n setConnection((data as ChannelConnectionResponse) ?? null);\n onSuccess?.((data as ChannelConnectionResponse) ?? null);\n }\n setIsFetching(false);\n });\n\n const cleanupDeleteResolved = novu.on('channel-connection.delete.resolved', ({ args }) => {\n if (!args || args.identifier !== propsRef.current.identifier) {\n return;\n }\n setConnection(null);\n propsRef.current.onSuccess?.(null);\n setIsFetching(false);\n });\n\n void fetchConnection({ refetch: true });\n\n return () => {\n cleanupGetPending();\n cleanupGetResolved();\n cleanupDeleteResolved();\n };\n }, [novu, fetchConnection, props.identifier]);\n\n const refetch = useCallback(() => fetchConnection({ refetch: true }), [fetchConnection]);\n\n return {\n connection,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAyD;AACzD,0BAAwB;AAmBjB,IAAM,uBAAuB,CAAC,UAAiE;AACpG,QAAM,WAAO,6BAAQ;AACrB,QAAM,eAAW,qBAAkC,KAAK;AACxD,WAAS,UAAU;AAEnB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAA2C;AAC/E,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAElD,QAAM,sBAAkB;AAAA,IACtB,OAAO,YAAmC;AACxC,YAAM,EAAE,YAAY,WAAW,QAAQ,IAAI,SAAS;AACpD,UAAI,mCAAS,SAAS;AACpB,iBAAS,MAAS;AAClB,qBAAa,IAAI;AAAA,MACnB;AAEA,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,mBAAmB,IAAI,EAAE,WAAW,CAAC;AAEjE,UAAI,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AAM,gBAAgB,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC;AAEvF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useChannelConnections.ts"],"sourcesContent":["import type { ChannelConnectionResponse, ListChannelConnectionsArgs, NovuError } from '@notiflyio/js';\r\nimport { useCallback, useEffect, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseChannelConnectionsProps = ListChannelConnectionsArgs & {\r\n onSuccess?: (data: ChannelConnectionResponse[]) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseChannelConnectionsResult = {\r\n connections: ChannelConnectionResponse[];\r\n error?: NovuError;\r\n isLoading: boolean;\r\n isFetching: boolean;\r\n refetch: () => Promise<void>;\r\n};\r\n\r\n/**\r\n * List channel connections for the current subscriber. Use this to discover an active\r\n * connection identifier after a chat OAuth flow so it can be passed to `LinkUser`.\r\n *\r\n * @example\r\n * const { connections } = useChannelConnections({ integrationIdentifier: 'my-chat-integration' });\r\n * const connectionIdentifier = connections[0]?.identifier;\r\n */\r\nexport const useChannelConnections = (props: UseChannelConnectionsProps = {}): UseChannelConnectionsResult => {\r\n const novu = useNovu();\r\n const propsRef = useRef<UseChannelConnectionsProps>(props);\r\n propsRef.current = props;\r\n\r\n const [connections, setConnections] = useState<ChannelConnectionResponse[]>([]);\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const fetchConnections = useCallback(\r\n async (options?: { refetch: boolean }) => {\r\n const { onSuccess, onError, ...listArgs } = propsRef.current;\r\n\r\n if (options?.refetch) {\r\n setError(undefined);\r\n setIsLoading(true);\r\n }\r\n\r\n setIsFetching(true);\r\n\r\n try {\r\n const response = await novu.channelConnections.list(listArgs);\r\n\r\n if (response.error) {\r\n setError(response.error as NovuError);\r\n onError?.(response.error as NovuError);\r\n } else if (response.data !== undefined) {\r\n setConnections(response.data);\r\n onSuccess?.(response.data);\r\n }\r\n } catch (err) {\r\n setError(err as NovuError);\r\n onError?.(err as NovuError);\r\n } finally {\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n }\r\n },\r\n [novu]\r\n );\r\n\r\n useEffect(() => {\r\n const cleanupDeleteResolved = novu.on('channel-connection.delete.resolved', () => {\r\n void fetchConnections({ refetch: true });\r\n });\r\n\r\n void fetchConnections({ refetch: true });\r\n\r\n return () => {\r\n cleanupDeleteResolved();\r\n };\r\n }, [novu, fetchConnections]);\r\n\r\n const refetch = useCallback(() => fetchConnections({ refetch: true }), [fetchConnections]);\r\n\r\n return {\r\n connections,\r\n error,\r\n isLoading,\r\n isFetching,\r\n refetch,\r\n };\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAyD;AACzD,0BAAwB;AAuBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,WAAO,6BAAQ;AACrB,QAAM,eAAW,qBAAmC,KAAK;AACzD,WAAS,UAAU;AAEnB,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAsC,CAAC,CAAC;AAC9E,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAElD,QAAM,uBAAmB;AAAA,IACvB,OAAO,YAAmC;AACxC,YAAM,EAAE,WAAW,SAAS,GAAG,SAAS,IAAI,SAAS;AAErD,UAAI,mCAAS,SAAS;AACpB,iBAAS,MAAS;AAClB,qBAAa,IAAI;AAAA,MACnB;AAEA,oBAAc,IAAI;AAElB,UAAI;AACF,cAAM,WAAW,MAAM,KAAK,mBAAmB,KAAK,QAAQ;AAE5D,YAAI,SAAS,OAAO;AAClB,mBAAS,SAAS,KAAkB;AACpC,6CAAU,SAAS;AAAA,QACrB,WAAW,SAAS,SAAS,QAAW;AACtC,yBAAe,SAAS,IAAI;AAC5B,iDAAY,SAAS;AAAA,QACvB;AAAA,MACF,SAAS,KAAK;AACZ,iBAAS,GAAgB;AACzB,2CAAU;AAAA,MACZ,UAAE;AACA,qBAAa,KAAK;AAClB,sBAAc,KAAK;AAAA,MACrB;AAAA,IACF;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,8BAAU,MAAM;AACd,UAAM,wBAAwB,KAAK,GAAG,sCAAsC,MAAM;AAChF,WAAK,iBAAiB,EAAE,SAAS,KAAK,CAAC;AAAA,IACzC,CAAC;AAED,SAAK,iBAAiB,EAAE,SAAS,KAAK,CAAC;AAEvC,WAAO,MAAM;AACX,4BAAsB;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,MAAM,gBAAgB,CAAC;AAE3B,QAAM,cAAU,0BAAY,MAAM,iBAAiB,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC;AAEzF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useChannelConnections.ts"],"sourcesContent":["import type { ChannelConnectionResponse, ListChannelConnectionsArgs, NovuError } from '@notiflyio/js';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseChannelConnectionsProps = ListChannelConnectionsArgs & {\n onSuccess?: (data: ChannelConnectionResponse[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseChannelConnectionsResult = {\n connections: ChannelConnectionResponse[];\n error?: NovuError;\n isLoading: boolean;\n isFetching: boolean;\n refetch: () => Promise<void>;\n};\n\n/**\n * List channel connections for the current subscriber. Use this to discover an active\n * connection identifier after a chat OAuth flow so it can be passed to `LinkUser`.\n *\n * @example\n * const { connections } = useChannelConnections({ integrationIdentifier: 'my-chat-integration' });\n * const connectionIdentifier = connections[0]?.identifier;\n */\nexport const useChannelConnections = (props: UseChannelConnectionsProps = {}): UseChannelConnectionsResult => {\n const novu = useNovu();\n const propsRef = useRef<UseChannelConnectionsProps>(props);\n propsRef.current = props;\n\n const [connections, setConnections] = useState<ChannelConnectionResponse[]>([]);\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const fetchConnections = useCallback(\n async (options?: { refetch: boolean }) => {\n const { onSuccess, onError, ...listArgs } = propsRef.current;\n\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n }\n\n setIsFetching(true);\n\n try {\n const response = await novu.channelConnections.list(listArgs);\n\n if (response.error) {\n setError(response.error as NovuError);\n onError?.(response.error as NovuError);\n } else if (response.data !== undefined) {\n setConnections(response.data);\n onSuccess?.(response.data);\n }\n } catch (err) {\n setError(err as NovuError);\n onError?.(err as NovuError);\n } finally {\n setIsLoading(false);\n setIsFetching(false);\n }\n },\n [novu]\n );\n\n useEffect(() => {\n const cleanupDeleteResolved = novu.on('channel-connection.delete.resolved', () => {\n void fetchConnections({ refetch: true });\n });\n\n void fetchConnections({ refetch: true });\n\n return () => {\n cleanupDeleteResolved();\n };\n }, [novu, fetchConnections]);\n\n const refetch = useCallback(() => fetchConnections({ refetch: true }), [fetchConnections]);\n\n return {\n connections,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAyD;AACzD,0BAAwB;AAuBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,WAAO,6BAAQ;AACrB,QAAM,eAAW,qBAAmC,KAAK;AACzD,WAAS,UAAU;AAEnB,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAsC,CAAC,CAAC;AAC9E,QAAM,CAAC,OAAO,QAA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{ ChannelEndpointResponse, NovuError } from '@notiflyio/js';\r\nimport { useCallback, useEffect, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseChannelEndpointProps = {\r\n identifier: string;\r\n onSuccess?: (data: ChannelEndpointResponse | null) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseChannelEndpointResult = {\r\n endpoint?: ChannelEndpointResponse | null;\r\n error?: NovuError;\r\n isLoading: boolean;\r\n isFetching: boolean;\r\n refetch: () => Promise<void>;\r\n};\r\n\r\n/**\r\n * Get a channel endpoint by identifier.\r\n */\r\nexport const useChannelEndpoint = (props: UseChannelEndpointProps): UseChannelEndpointResult => {\r\n const novu = useNovu();\r\n const propsRef = useRef<UseChannelEndpointProps>(props);\r\n propsRef.current = props;\r\n\r\n const [endpoint, setEndpoint] = useState<ChannelEndpointResponse | null>();\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const fetchEndpoint = useCallback(\r\n async (options?: { refetch: boolean }) => {\r\n const { identifier, onSuccess, onError } = propsRef.current;\r\n if (options?.refetch) {\r\n setError(undefined);\r\n setIsLoading(true);\r\n }\r\n\r\n setIsFetching(true);\r\n\r\n const response = await novu.channelEndpoints.get({ identifier });\r\n\r\n if (response.error) {\r\n setError(response.error as NovuError);\r\n onError?.(response.error as NovuError);\r\n } else if (response.data !== undefined) {\r\n onSuccess?.(response.data);\r\n setEndpoint(response.data);\r\n }\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n },\r\n [novu]\r\n );\r\n\r\n // biome-ignore lint/correctness/useExhaustiveDependencies: props.identifier is needed to re-run the effect and initial fetch when the identifier changes\r\n useEffect(() => {\r\n const cleanupGetPending = novu.on('channel-endpoint.get.pending', () => {\r\n setIsFetching(true);\r\n });\r\n\r\n const cleanupGetResolved = novu.on('channel-endpoint.get.resolved', ({ data, error: resolvedError }) => {\r\n const { onSuccess, onError } = propsRef.current;\r\n if (resolvedError) {\r\n setError(resolvedError as NovuError);\r\n onError?.(resolvedError as NovuError);\r\n } else {\r\n setEndpoint((data as ChannelEndpointResponse) ?? null);\r\n onSuccess?.((data as ChannelEndpointResponse) ?? null);\r\n }\r\n setIsFetching(false);\r\n });\r\n\r\n const cleanupCreateResolved = novu.on('channel-endpoint.create.resolved', ({ data }) => {\r\n if (data) {\r\n setEndpoint(data as ChannelEndpointResponse);\r\n propsRef.current.onSuccess?.(data as ChannelEndpointResponse);\r\n }\r\n setIsFetching(false);\r\n });\r\n\r\n const cleanupDeleteResolved = novu.on('channel-endpoint.delete.resolved', ({ args }) => {\r\n if (!args || args.identifier !== propsRef.current.identifier) {\r\n return;\r\n }\r\n setEndpoint(null);\r\n propsRef.current.onSuccess?.(null);\r\n setIsFetching(false);\r\n });\r\n\r\n void fetchEndpoint({ refetch: true });\r\n\r\n return () => {\r\n cleanupGetPending();\r\n cleanupGetResolved();\r\n cleanupCreateResolved();\r\n cleanupDeleteResolved();\r\n };\r\n }, [novu, fetchEndpoint, props.identifier]);\r\n\r\n const refetch = useCallback(() => fetchEndpoint({ refetch: true }), [fetchEndpoint]);\r\n\r\n return {\r\n endpoint,\r\n error,\r\n isLoading,\r\n isFetching,\r\n refetch,\r\n };\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAyD;AACzD,0BAAwB;AAmBjB,IAAM,qBAAqB,CAAC,UAA6D;AAC9F,QAAM,WAAO,6BAAQ;AACrB,QAAM,eAAW,qBAAgC,KAAK;AACtD,WAAS,UAAU;AAEnB,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAyC;AACzE,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAElD,QAAM,oBAAgB;AAAA,IACpB,O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Q,cAAjB,4BAA6B;AAC7B,oBAAc,KAAK;AAAA,IACrB,CAAC;AAED,SAAK,cAAc,EAAE,SAAS,KAAK,CAAC;AAEpC,WAAO,MAAM;AACX,wBAAkB;AAClB,yBAAmB;AACnB,4BAAsB;AACtB,4BAAsB;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,MAAM,eAAe,MAAM,UAAU,CAAC;AAE1C,QAAM,cAAU,0BAAY,MAAM,cAAc,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC;AAEnF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useChannelEndpoint.ts"],"sourcesContent":["import type { ChannelEndpointResponse, NovuError } from '@notiflyio/js';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseChannelEndpointProps = {\n identifier: string;\n onSuccess?: (data: ChannelEndpointResponse | null) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseChannelEndpointResult = {\n endpoint?: ChannelEndpointResponse | null;\n error?: NovuError;\n isLoading: boolean;\n isFetching: boolean;\n refetch: () => Promise<void>;\n};\n\n/**\n * Get a channel endpoint by identifier.\n */\nexport const useChannelEndpoint = (props: UseChannelEndpointProps): UseChannelEndpointResult => {\n const novu = useNovu();\n const propsRef = useRef<UseChannelEndpointProps>(props);\n propsRef.current = props;\n\n const [endpoint, setEndpoint] = useState<ChannelEndpointResponse | null>();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const fetchEndpoint = useCallback(\n async (options?: { refetch: boolean }) => {\n const { identifier, onSuccess, onError } = propsRef.current;\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n }\n\n setIsFetching(true);\n\n const response = await novu.channelEndpoints.get({ identifier });\n\n if (response.error) {\n setError(response.error as NovuError);\n onError?.(response.error as NovuError);\n } else if (response.data !== undefined) {\n onSuccess?.(response.data);\n setEndpoint(response.data);\n }\n setIsLoading(false);\n setIsFetching(false);\n },\n [novu]\n );\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: props.identifier is needed to re-run the effect and initial fetch when the identifier changes\n useEffect(() => {\n const cleanupGetPending = novu.on('channel-endpoint.get.pending', () => {\n setIsFetching(true);\n });\n\n const cleanupGetResolved = novu.on('channel-endpoint.get.resolved', ({ data, error: resolvedError }) => {\n const { onSuccess, onError } = propsRef.current;\n if (resolvedError) {\n setError(resolvedError as NovuError);\n onError?.(resolvedError as NovuError);\n } else {\n setEndpoint((data as ChannelEndpointResponse) ?? null);\n onSuccess?.((data as ChannelEndpointResponse) ?? null);\n }\n setIsFetching(false);\n });\n\n const cleanupCreateResolved = novu.on('channel-endpoint.create.resolved', ({ data }) => {\n if (data) {\n setEndpoint(data as ChannelEndpointResponse);\n propsRef.current.onSuccess?.(data as ChannelEndpointResponse);\n }\n setIsFetching(false);\n });\n\n const cleanupDeleteResolved = novu.on('channel-endpoint.delete.resolved', ({ args }) => {\n if (!args || args.identifier !== propsRef.current.identifier) {\n return;\n }\n setEndpoint(null);\n propsRef.current.onSuccess?.(null);\n setIsFetching(false);\n });\n\n void fetchEndpoint({ refetch: true });\n\n return () => {\n cleanupGetPending();\n cleanupGetResolved();\n cleanupCreateResolved();\n cleanupDeleteResolved();\n };\n }, [novu, fetchEndpoint, props.identifier]);\n\n const refetch = useCallback(() => fetchEndpoint({ refetch: true }), [fetchEndpoint]);\n\n return {\n endpoint,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAyD;AACzD,0BAAwB;AAmBjB,IAAM,qBAAqB,CAAC,UAA6D;AAC9F,QAAM,WAAO,6BAAQ;AACrB,QAAM,eAAW,qBAAgC,KAAK;AACtD,WAAS,UAAU;AAEnB,QAAM,CAA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c,KAAK;AAAA,IACrB,CAAC;AAED,UAAM,wBAAwB,KAAK,GAAG,oCAAoC,CAAC,EAAE,KAAK,MAAM;AAlF5F;AAmFM,UAAI,CAAC,QAAQ,KAAK,eAAe,SAAS,QAAQ,YAAY;AAC5D;AAAA,MACF;AACA,kBAAY,IAAI;AAChB,2BAAS,SAAQ,cAAjB,4BAA6B;AAC7B,oBAAc,KAAK;AAAA,IACrB,CAAC;AAED,SAAK,cAAc,EAAE,SAAS,KAAK,CAAC;AAEpC,WAAO,MAAM;AACX,wBAAkB;AAClB,yBAAmB;AACnB,4BAAsB;AACtB,4BAAsB;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,MAAM,eAAe,MAAM,UAAU,CAAC;AAE1C,QAAM,cAAU,0BAAY,MAAM,cAAc,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC;AAEnF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useCounts.ts"],"sourcesContent":["import { NOTIFICATION_COUNT_SYNC_EVENTS, checkNotificationMatchesFilter, isSameFilter, Notification, NotificationFilter, NovuError } from '@notiflyio/js';\r\nimport { useCallback, useEffect, useRef, useState } from 'react';\r\nimport { useDataRef } from './internal/useDataRef';\r\nimport { useWebSocketEvent } from './internal/useWebsocketEvent';\r\nimport { useNovu, useRealtime } from './NovuProvider';\r\n\r\ntype Count = {\r\n count: number;\r\n filter: NotificationFilter;\r\n};\r\n\r\n/**\r\n * Props for the useCounts hook.\r\n *\r\n * @example\r\n * ```tsx\r\n * // Count unread notifications\r\n * const { counts } = useCounts({\r\n * filters: [{ read: false }]\r\n * });\r\n *\r\n * // Count unseen notifications with specific tags\r\n * const { counts } = useCounts({\r\n * filters: [{ seen: false, tags: ['important'] }]\r\n * });\r\n *\r\n * // Count seen but unread notifications\r\n * const { counts } = useCounts({\r\n * filters: [{ seen: true, read: false }]\r\n * });\r\n *\r\n * // Opt out of the built-in realtime count updates and drive them yourself\r\n * const { counts, refetch } = useCounts({\r\n * filters: [{ read: false }],\r\n * realtime: false,\r\n * });\r\n * ```\r\n */\r\nexport type UseCountsProps = {\r\n filters: NotificationFilter[];\r\n /**\r\n * When `false`, disables the WebSocket subscriptions that auto-resync\r\n * counts on `notifications.notification_received` and\r\n * `notifications.unread_count_changed`. The filter-driven fetch and\r\n * `refetch()` keep working. Use alongside\r\n * `useNotifications({ realtime: false })` when you drive live updates\r\n * yourself.\r\n *\r\n * When set, this prop takes precedence over the `realtime` config on\r\n * `<NovuProvider />`. When omitted, the provider value (default `true`) is used.\r\n */\r\n realtime?: boolean;\r\n onSuccess?: (data: Count[]) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseCountsResult = {\r\n counts?: Count[];\r\n error?: NovuError;\r\n isLoading: boolean; // initial loading\r\n isFetching: boolean; // the request is in flight\r\n refetch: () => Promise<void>;\r\n};\r\n\r\nexport const useCounts = (props: UseCountsProps): UseCountsResult => {\r\n const { filters, realtime: propsRealtime, onSuccess, onError } = props;\r\n const novu = useNovu();\r\n const { notifications } = novu;\r\n const providerRealtime = useRealtime();\r\n const realtime = propsRealtime ?? providerRealtime;\r\n const filtersRef = useDataRef<NotificationFilter[]>(filters);\r\n const onSuccessRef = useDataRef(onSuccess);\r\n const onErrorRef = useDataRef(onError);\r\n const syncGenerationRef = useRef(0);\r\n const [error, setError] = useState<NovuError>();\r\n const [counts, setCounts] = useState<Count[]>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const sync = useCallback(\r\n async (notification?: Notification, overrideFilters?: NotificationFilter[]) => {\r\n const currentFilters = overrideFilters || filtersRef.current;\r\n const existingCounts = currentFilters.map((filter) => ({ count: 0, filter }));\r\n let countFiltersToFetch: NotificationFilter[] = [];\r\n\r\n if (notification) {\r\n countFiltersToFetch = currentFilters.filter((filter) =>\r\n checkNotificationMatchesFilter(notification, filter)\r\n );\r\n } else {\r\n countFiltersToFetch = currentFilters;\r\n }\r\n\r\n if (countFiltersToFetch.length === 0) {\r\n return;\r\n }\r\n\r\n const generation = ++syncGenerationRef.current;\r\n setIsFetching(true);\r\n\r\n const countsRes = await notifications.count({ filters: countFiltersToFetch });\r\n\r\n if (generation !== syncGenerationRef.current) {\r\n return;\r\n }\r\n\r\n setIsFetching(false);\r\n setIsLoading(false);\r\n\r\n if (countsRes.error) {\r\n setError(countsRes.error);\r\n onErrorRef.current?.(countsRes.error);\r\n\r\n return;\r\n }\r\n\r\n const data = countsRes.data!;\r\n onSuccessRef.current?.(data.counts);\r\n\r\n setCounts((oldCounts) => {\r\n const newCounts: Count[] = [];\r\n const countsReceived = data.counts;\r\n\r\n for (let i = 0; i < existingCounts.length; i++) {\r\n const existingFilter = existingCounts[i].filter;\r\n const countReceived = countsReceived.find((c) => isSameFilter(c.filter, existingFilter));\r\n const count = countReceived || oldCounts?.[i];\r\n if (count) {\r\n newCounts.push(count);\r\n }\r\n }\r\n\r\n return newCounts;\r\n });\r\n },\r\n [notifications, filtersRef, onErrorRef, onSuccessRef]\r\n );\r\n\r\n useWebSocketEvent({\r\n event: 'notifications.notification_received',\r\n enabled: realtime,\r\n eventHandler: (data) => {\r\n sync(data.result);\r\n },\r\n });\r\n\r\n useWebSocketEvent({\r\n event: 'notifications.unread_count_changed',\r\n enabled: realtime,\r\n eventHandler: () => {\r\n sync();\r\n },\r\n });\r\n\r\n useEffect(() => {\r\n const cleanups = NOTIFICATION_COUNT_SYNC_EVENTS.map((event) =>\r\n novu.on(event, (payload) => {\r\n if ('error' in payload && payload.error) {\r\n return;\r\n }\r\n\r\n sync();\r\n })\r\n );\r\n\r\n return () => cleanups.forEach((cleanup) => cleanup());\r\n }, [novu, sync]);\r\n\r\n useEffect(() => {\r\n setError(undefined);\r\n setIsLoading(true);\r\n setIsFetching(false);\r\n sync(undefined, filters);\r\n }, [JSON.stringify(filters), sync]);\r\n\r\n const refetch = useCallback(async () => {\r\n await sync();\r\n }, [sync]);\r\n\r\n return { counts, error, refetch, isLoading, isFetching };\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA0I;AAC1I,mBAAyD;AACzD,wBAA2B;AAC3B,+BAAkC;AAClC,0BAAqC;AA4D9B,IAAM,YAAY,CAAC,UAA2C;AACnE,QAAM,EAAE,SAAS,UAAU,eAAe,WAAW,QAAQ,IAAI;AACjE,QAAM,WAAO,6BAAQ;AACrB,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,uBAAmB,iCAAY;AACrC,QAAM,WAAW,iBAAiB;AAClC,QAAM,iBAAa,8BAAiC,OAAO;AAC3D,QAAM,mBAAe,8BAAW,SAAS;AACzC,QAAM,iBAAa,8BAAW,OAAO;AACrC,QAAM,wBAAoB,qBAAO,CAAC;AAClC,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAC9C,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAkB;AAC9C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAElD,QAAM,WAAO;AAAA,IACX,OAAO,cAA6B,oBAA2C;AAhFnF;AAiFM,YAAM,iBAAiB,mBAAmB,WAAW;AACrD,YAAM,iBAAiB,eAAe,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,EAAE;AAC5E,UAAI,sBAA4C,CAAC;AAEjD,UAAI,cAAc;AAChB,8BAAsB,eAAe;AAAA,UAAO,CAAC,eAC3C,0CAA+B,cAAc,MAAM;AAAA,QACrD;AAAA,MACF,OAAO;AACL,8BAAsB;AAAA,MACxB;AAEA,UAAI,oBAAoB,WAAW,GAAG;AACpC;AAAA,MACF;AAEA,YAAM,aAAa,EAAE,kBAAkB;AACvC,oBAAc,IAAI;AAElB,YAAM,YAAY,MA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,EACtD,GAAG,CAAC,MAAM,IAAI,CAAC;AAEf,8BAAU,MAAM;AACd,aAAS,MAAS;AAClB,iBAAa,IAAI;AACjB,kBAAc,KAAK;AACnB,SAAK,QAAW,OAAO;AAAA,EACzB,GAAG,CAAC,KAAK,UAAU,OAAO,GAAG,IAAI,CAAC;AAElC,QAAM,cAAU,0BAAY,YAAY;AACtC,UAAM,KAAK;AAAA,EACb,GAAG,CAAC,IAAI,CAAC;AAET,SAAO,EAAE,QAAQ,OAAO,SAAS,WAAW,WAAW;AACzD;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useCounts.ts"],"sourcesContent":["import { NOTIFICATION_COUNT_SYNC_EVENTS, checkNotificationMatchesFilter, isSameFilter, Notification, NotificationFilter, NovuError } from '@notiflyio/js';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useDataRef } from './internal/useDataRef';\nimport { useWebSocketEvent } from './internal/useWebsocketEvent';\nimport { useNovu, useRealtime } from './NovuProvider';\n\ntype Count = {\n count: number;\n filter: NotificationFilter;\n};\n\n/**\n * Props for the useCounts hook.\n *\n * @example\n * ```tsx\n * // Count unread notifications\n * const { counts } = useCounts({\n * filters: [{ read: false }]\n * });\n *\n * // Count unseen notifications with specific tags\n * const { counts } = useCounts({\n * filters: [{ seen: false, tags: ['important'] }]\n * });\n *\n * // Count seen but unread notifications\n * const { counts } = useCounts({\n * filters: [{ seen: true, read: false }]\n * });\n *\n * // Opt out of the built-in realtime count updates and drive them yourself\n * const { counts, refetch } = useCounts({\n * filters: [{ read: false }],\n * realtime: false,\n * });\n * ```\n */\nexport type UseCountsProps = {\n filters: NotificationFilter[];\n /**\n * When `false`, disables the WebSocket subscriptions that auto-resync\n * counts on `notifications.notification_received` and\n * `notifications.unread_count_changed`. The filter-driven fetch and\n * `refetch()` keep working. Use alongside\n * `useNotifications({ realtime: false })` when you drive live updates\n * yourself.\n *\n * When set, this prop takes precedence over the `realtime` config on\n * `<NovuProvider />`. When omitted, the provider value (default `true`) is used.\n */\n realtime?: boolean;\n onSuccess?: (data: Count[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseCountsResult = {\n counts?: Count[];\n error?: NovuError;\n isLoading: boolean; // initial loading\n isFetching: boolean; // the request is in flight\n refetch: () => Promise<void>;\n};\n\nexport const useCounts = (props: UseCountsProps): UseCountsResult => {\n const { filters, realtime: propsRealtime, onSuccess, onError } = props;\n const novu = useNovu();\n const { notifications } = novu;\n const providerRealtime = useRealtime();\n const realtime = propsRealtime ?? providerRealtime;\n const filtersRef = useDataRef<NotificationFilter[]>(filters);\n const onSuccessRef = useDataRef(onSuccess);\n const onErrorRef = useDataRef(onError);\n const syncGenerationRef = useRef(0);\n const [error, setError] = useState<NovuError>();\n const [counts, setCounts] = useState<Count[]>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const sync = useCallback(\n async (notification?: Notification, overrideFilters?: NotificationFilter[]) => {\n const currentFilters = overrideFilters || filtersRef.current;\n const existingCounts = currentFilters.map((filter) => ({ count: 0, filter }));\n let countFiltersToFetch: NotificationFilter[] = [];\n\n if (notification) {\n countFiltersToFetch = currentFilters.filter((filter) =>\n checkNotificationMatchesFilter(notification, filter)\n );\n } else {\n countFiltersToFetch = currentFilters;\n }\n\n if (countFiltersToFetch.length === 0) {\n return;\n }\n\n const generation = ++syncGenerationRef.current;\n setIsFetching(true);\n\n const countsRes = await notifications.count({ filters: countFiltersToFetch });\n\n if (generation !== syncGenerationRef.current) {\n return;\n }\n\n setIsFetching(false);\n setIsLoading(false);\n\n if (countsRes.error) {\n setError(countsRes.error);\n onErrorRef.current?.(countsRes.error);\n\n return;\n }\n\n const data = countsRes.data!;\n onSuccessRef.current?.(data.counts);\n\n setCounts((oldCounts) => {\n const newCounts: Count[] = [];\n const countsReceived = data.counts;\n\n for (let i = 0; i < existingCounts.length; i++) {\n const existingFilter = existingCounts[i].filter;\n const countReceived = countsReceived.find((c) => isSameFilter(c.filter, existingFilter));\n const count = countReceived || oldCounts?.[i];\n if (count) {\n newCounts.push(count);\n }\n }\n\n return newCounts;\n });\n },\n [notifications, filtersRef, onErrorRef, onSuccessRef]\n );\n\n useWebSocketEvent({\n event: 'notifications.notification_received',\n enabled: realtime,\n eventHandler: (data) => {\n sync(data.result);\n },\n });\n\n useWebSocketEvent({\n event: 'notifications.unread_count_changed',\n enabled: realtime,\n eventHandler: () => {\n sync();\n },\n });\n\n useEffect(() => {\n const cleanups = NOTIFICATION_COUNT_SYNC_EVENTS.map((event) =>\n novu.on(event, (payload) => {\n if ('error' in payload && payload.error) {\n return;\n }\n\n sync();\n })\n );\n\n return () => cleanups.forEach((cleanup) => cleanup());\n }, [novu, sync]);\n\n useEffect(() => {\n setError(undefined);\n setIsLoading(true);\n setIsFetching(false);\n sync(undefined, filters);\n }, [JSON.stringify(filters), sync]);\n\n const refetch = useCallback(async () => {\n await sync();\n }, [sync]);\n\n return { counts, error, refetch, isLoading, isFetching };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA0I;AAC1I,mBAAyD;AACzD,wBAA2B;AAC3B,+BAAkC;AAClC,0BAAqC;AA4D9B,IAAM,YAAY,CAAC,UAA2C;AACnE,QAAM,EAAE,SAAS,UAAU,eAAe,WAAW,QAAQ,IAAI;AACjE,QAAM,WAAO,6BAAQ;AACrB,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,uBAAmB,iCAAY;AACrC,QAAM,WAAW,iBAAiB;AAClC,QAAM,iBAAa,8BAAiC,OAAO;AAC3D,QAAM,mBAAe,8BAAW,SAAS;AACzC,QAAM,iBAAa,8BAAW,OAAO;AACrC,QAAM,wBAAoB,qBAAO,CAAC;AAClC,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAC9C,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAkB;AAC9C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAC/C,QAAM,CAAC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,kDAAkB;AAAA,IAChB,OAAO;AAAA,IACP,SAAS;AAAA,IACT,cAAc,CAAC,SAAS;AACtB,WAAK,KAAK,MAAM;AAAA,IAClB;AAAA,EACF,CAAC;AAED,kDAAkB;AAAA,IAChB,OAAO;AAAA,IACP,SAAS;AAAA,IACT,cAAc,MAAM;AAClB,WAAK;AAAA,IACP;AAAA,EACF,CAAC;AAED,8BAAU,MAAM;AACd,UAAM,WAAW,yCAA+B;AAAA,MAAI,CAAC,UACnD,KAAK,GAAG,OAAO,CAAC,YAAY;AAC1B,YAAI,WAAW,WAAW,QAAQ,OAAO;AACvC;AAAA,QACF;AAEA,aAAK;AAAA,MACP,CAAC;AAAA,IACH;AAEA,WAAO,MAAM,SAAS,QAAQ,CAAC,YAAY,QAAQ,CAAC;AAAA,EACtD,GAAG,CAAC,MAAM,IAAI,CAAC;AAEf,8BAAU,MAAM;AACd,aAAS,MAAS;AAClB,iBAAa,IAAI;AACjB,kBAAc,KAAK;AACnB,SAAK,QAAW,OAAO;AAAA,EACzB,GAAG,CAAC,KAAK,UAAU,OAAO,GAAG,IAAI,CAAC;AAElC,QAAM,cAAU,0BAAY,YAAY;AACtC,UAAM,KAAK;AAAA,EACb,GAAG,CAAC,IAAI,CAAC;AAET,SAAO,EAAE,QAAQ,OAAO,SAAS,WAAW,WAAW;AACzD;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useCreateChannelEndpoint.ts"],"sourcesContent":["import type { ChannelEndpointResponse, CreateChannelEndpointArgs, NovuError } from '@notiflyio/js';\r\nimport { useCallback, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseCreateChannelEndpointProps = {\r\n onSuccess?: (data: ChannelEndpointResponse) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseCreateChannelEndpointResult = {\r\n isCreating: boolean;\r\n error?: NovuError;\r\n create: (args: CreateChannelEndpointArgs) => Promise<{\r\n data?: ChannelEndpointResponse | undefined;\r\n error?: NovuError | undefined;\r\n }>;\r\n};\r\n\r\nexport const useCreateChannelEndpoint = (props: UseCreateChannelEndpointProps = {}): UseCreateChannelEndpointResult => {\r\n const propsRef = useRef<UseCreateChannelEndpointProps>(props);\r\n propsRef.current = props;\r\n const novu = useNovu();\r\n const [isCreating, setIsCreating] = useState(false);\r\n const [error, setError] = useState<NovuError>();\r\n\r\n const create = useCallback(\r\n async (args: CreateChannelEndpointArgs) => {\r\n const { onSuccess, onError } = propsRef.current;\r\n setError(undefined);\r\n setIsCreating(true);\r\n\r\n const response = await novu.channelEndpoints.create(args);\r\n\r\n setIsCreating(false);\r\n\r\n if (response.error) {\r\n setError(response.error as NovuError);\r\n onError?.(response.error as NovuError);\r\n } else if (response.data) {\r\n onSuccess?.(response.data as ChannelEndpointResponse);\r\n }\r\n\r\n return response as { data?: ChannelEndpointResponse; error?: NovuError };\r\n },\r\n [novu]\r\n );\r\n\r\n return {\r\n create,\r\n isCreating,\r\n error,\r\n };\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA8C;AAC9C,0BAAwB;AAgBjB,IAAM,2BAA2B,CAAC,QAAuC,CAAC,MAAsC;AACrH,QAAM,eAAW,qBAAsC,KAAK;AAC5D,WAAS,UAAU;AACnB,QAAM,WAAO,6BAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAE9C,QAAM,aAAS;AAAA,IACb,OAAO,SAAoC;AACzC,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,iBAAiB,OAAO,IAAI;AAExD,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAkB;AACpC,2CAAU,SAAS;AAAA,MACrB,WAAW,SAAS,MAAM;AACxB,+CAAY,SAAS;AAAA,MACvB;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useCreateChannelEndpoint.ts"],"sourcesContent":["import type { ChannelEndpointResponse, CreateChannelEndpointArgs, NovuError } from '@notiflyio/js';\nimport { useCallback, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseCreateChannelEndpointProps = {\n onSuccess?: (data: ChannelEndpointResponse) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseCreateChannelEndpointResult = {\n isCreating: boolean;\n error?: NovuError;\n create: (args: CreateChannelEndpointArgs) => Promise<{\n data?: ChannelEndpointResponse | undefined;\n error?: NovuError | undefined;\n }>;\n};\n\nexport const useCreateChannelEndpoint = (props: UseCreateChannelEndpointProps = {}): UseCreateChannelEndpointResult => {\n const propsRef = useRef<UseCreateChannelEndpointProps>(props);\n propsRef.current = props;\n const novu = useNovu();\n const [isCreating, setIsCreating] = useState(false);\n const [error, setError] = useState<NovuError>();\n\n const create = useCallback(\n async (args: CreateChannelEndpointArgs) => {\n const { onSuccess, onError } = propsRef.current;\n setError(undefined);\n setIsCreating(true);\n\n const response = await novu.channelEndpoints.create(args);\n\n setIsCreating(false);\n\n if (response.error) {\n setError(response.error as NovuError);\n onError?.(response.error as NovuError);\n } else if (response.data) {\n onSuccess?.(response.data as ChannelEndpointResponse);\n }\n\n return response as { data?: ChannelEndpointResponse; error?: NovuError };\n },\n [novu]\n );\n\n return {\n create,\n isCreating,\n error,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA8C;AAC9C,0BAAwB;AAgBjB,IAAM,2BAA2B,CAAC,QAAuC,CAAC,MAAsC;AACrH,QAAM,eAAW,qBAAsC,KAAK;AAC5D,WAAS,UAAU;AACnB,QAAM,WAAO,6BAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAE9C,QAAM,aAAS;AAAA,IACb,OAAO,SAAoC;AACzC,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,iBAAiB,OAAO,IAAI;AAExD,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAkB;AACpC,2CAAU,SAAS;AAAA,MACrB,WAAW,SAAS,MAAM;AACxB,+CAAY,SAAS;AAAA,MACvB;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useCreateSubscription.ts"],"sourcesContent":["import { CreateSubscriptionArgs, NovuError, TopicSubscription } from '@notiflyio/js';\r\nimport { useCallback, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseCreateSubscriptionProps = {\r\n onSuccess?: (data: TopicSubscription) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseCreateSubscriptionResult = {\r\n isCreating: boolean;\r\n error?: NovuError;\r\n create: (args: CreateSubscriptionArgs) => Promise<{\r\n data?: TopicSubscription | undefined;\r\n error?: NovuError | undefined;\r\n }>;\r\n};\r\n\r\nexport const useCreateSubscription = (props: UseCreateSubscriptionProps = {}): UseCreateSubscriptionResult => {\r\n const propsRef = useRef<UseCreateSubscriptionProps>(props);\r\n propsRef.current = props;\r\n const novu = useNovu();\r\n const [isCreating, setIsCreating] = useState(false);\r\n const [error, setError] = useState<NovuError>();\r\n\r\n const create = useCallback(\r\n async (args: CreateSubscriptionArgs) => {\r\n const { onSuccess, onError } = propsRef.current;\r\n setError(undefined);\r\n setIsCreating(true);\r\n\r\n const response = await novu.subscriptions.create(args);\r\n\r\n setIsCreating(false);\r\n\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n } else if (response.data) {\r\n onSuccess?.(response.data);\r\n }\r\n\r\n return response;\r\n },\r\n [novu]\r\n );\r\n\r\n return {\r\n create,\r\n isCreating,\r\n error,\r\n };\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA8C;AAC9C,0BAAwB;AAgBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,eAAW,qBAAmC,KAAK;AACzD,WAAS,UAAU;AACnB,QAAM,WAAO,6BAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAE9C,QAAM,aAAS;AAAA,IACb,OAAO,SAAiC;AACtC,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,OAAO,IAAI;AAErD,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,2CAAU,SAAS;AAAA,MACrB,WAAW,SAAS,MAAM;AACxB,+CAAY,SAAS;AAAA,MACvB;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useCreateSubscription.ts"],"sourcesContent":["import { CreateSubscriptionArgs, NovuError, TopicSubscription } from '@notiflyio/js';\nimport { useCallback, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseCreateSubscriptionProps = {\n onSuccess?: (data: TopicSubscription) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseCreateSubscriptionResult = {\n isCreating: boolean;\n error?: NovuError;\n create: (args: CreateSubscriptionArgs) => Promise<{\n data?: TopicSubscription | undefined;\n error?: NovuError | undefined;\n }>;\n};\n\nexport const useCreateSubscription = (props: UseCreateSubscriptionProps = {}): UseCreateSubscriptionResult => {\n const propsRef = useRef<UseCreateSubscriptionProps>(props);\n propsRef.current = props;\n const novu = useNovu();\n const [isCreating, setIsCreating] = useState(false);\n const [error, setError] = useState<NovuError>();\n\n const create = useCallback(\n async (args: CreateSubscriptionArgs) => {\n const { onSuccess, onError } = propsRef.current;\n setError(undefined);\n setIsCreating(true);\n\n const response = await novu.subscriptions.create(args);\n\n setIsCreating(false);\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data) {\n onSuccess?.(response.data);\n }\n\n return response;\n },\n [novu]\n );\n\n return {\n create,\n isCreating,\n error,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA8C;AAC9C,0BAAwB;AAgBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,eAAW,qBAAmC,KAAK;AACzD,WAAS,UAAU;AACnB,QAAM,WAAO,6BAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAE9C,QAAM,aAAS;AAAA,IACb,OAAO,SAAiC;AACtC,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,OAAO,IAAI;AAErD,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,2CAAU,SAAS;AAAA,MACrB,WAAW,SAAS,MAAM;AACxB,+CAAY,SAAS;AAAA,MACvB;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useDeleteChannelEndpoint.ts"],"sourcesContent":["import type { NovuError } from '@notiflyio/js';\r\nimport { useCallback, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseDeleteChannelEndpointProps = {\r\n onSuccess?: () => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseDeleteChannelEndpointResult = {\r\n isDeleting: boolean;\r\n error?: NovuError;\r\n remove: (identifier: string) => Promise<{\r\n data?: undefined;\r\n error?: NovuError | undefined;\r\n }>;\r\n};\r\n\r\nexport const useDeleteChannelEndpoint = (props: UseDeleteChannelEndpointProps = {}): UseDeleteChannelEndpointResult => {\r\n const propsRef = useRef<UseDeleteChannelEndpointProps>(props);\r\n propsRef.current = props;\r\n const novu = useNovu();\r\n const [isDeleting, setIsDeleting] = useState(false);\r\n const [error, setError] = useState<NovuError>();\r\n\r\n const remove = useCallback(\r\n async (identifier: string) => {\r\n setError(undefined);\r\n setIsDeleting(true);\r\n\r\n try {\r\n const response = await novu.channelEndpoints.delete({ identifier });\r\n\r\n if (response.error) {\r\n setError(response.error as NovuError);\r\n propsRef.current.onError?.(response.error as NovuError);\r\n } else {\r\n propsRef.current.onSuccess?.();\r\n }\r\n\r\n return response as { data?: undefined; error?: NovuError };\r\n } catch (err) {\r\n const novuError = err as NovuError;\r\n setError(novuError);\r\n propsRef.current.onError?.(novuError);\r\n\r\n return { error: novuError };\r\n } finally {\r\n setIsDeleting(false);\r\n }\r\n },\r\n [novu]\r\n );\r\n\r\n return {\r\n remove,\r\n isDeleting,\r\n error,\r\n };\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA8C;AAC9C,0BAAwB;AAgBjB,IAAM,2BAA2B,CAAC,QAAuC,CAAC,MAAsC;AACrH,QAAM,eAAW,qBAAsC,KAAK;AAC5D,WAAS,UAAU;AACnB,QAAM,WAAO,6BAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAE9C,QAAM,aAAS;AAAA,IACb,OAAO,eAAuB;AA1BlC;AA2BM,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,UAAI;AACF,cAAM,WAAW,MAAM,KAAK,iBAAiB,OAAO,EAAE,WAAW,CAAC;AAElE,YAAI,SAAS,OAAO;AAClB,mBAAS,SAAS,KAAkB;AACpC,+BAAS,SAAQ,YAAjB,4BAA2B,SAAS;AAAA,QACtC,OAAO;AACL,+BAAS,SAAQ,cAAjB;AAAA,QACF;AAEA,eAAO;AAAA,MACT,SAAS,KAAK;AACZ,cAAM,YAAY;AAClB,iBAAS,SAAS;AAClB,6BAAS,SAAQ,YAAjB,4BAA2B;AAE3B,eAAO,EAAE,OAAO,UAAU;AAAA,MAC5B,UAAE;AACA,sBAAc,KAAK;AAAA,MACrB;AAAA,IACF;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useDeleteChannelEndpoint.ts"],"sourcesContent":["import type { NovuError } from '@notiflyio/js';\nimport { useCallback, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseDeleteChannelEndpointProps = {\n onSuccess?: () => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseDeleteChannelEndpointResult = {\n isDeleting: boolean;\n error?: NovuError;\n remove: (identifier: string) => Promise<{\n data?: undefined;\n error?: NovuError | undefined;\n }>;\n};\n\nexport const useDeleteChannelEndpoint = (props: UseDeleteChannelEndpointProps = {}): UseDeleteChannelEndpointResult => {\n const propsRef = useRef<UseDeleteChannelEndpointProps>(props);\n propsRef.current = props;\n const novu = useNovu();\n const [isDeleting, setIsDeleting] = useState(false);\n const [error, setError] = useState<NovuError>();\n\n const remove = useCallback(\n async (identifier: string) => {\n setError(undefined);\n setIsDeleting(true);\n\n try {\n const response = await novu.channelEndpoints.delete({ identifier });\n\n if (response.error) {\n setError(response.error as NovuError);\n propsRef.current.onError?.(response.error as NovuError);\n } else {\n propsRef.current.onSuccess?.();\n }\n\n return response as { data?: undefined; error?: NovuError };\n } catch (err) {\n const novuError = err as NovuError;\n setError(novuError);\n propsRef.current.onError?.(novuError);\n\n return { error: novuError };\n } finally {\n setIsDeleting(false);\n }\n },\n [novu]\n );\n\n return {\n remove,\n isDeleting,\n error,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA8C;AAC9C,0BAAwB;AAgBjB,IAAM,2BAA2B,CAAC,QAAuC,CAAC,MAAsC;AACrH,QAAM,eAAW,qBAAsC,KAAK;AAC5D,WAAS,UAAU;AACnB,QAAM,WAAO,6BAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAE9C,QAAM,aAAS;AAAA,IACb,OAAO,eAAuB;AA1BlC;AA2BM,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,UAAI;AACF,cAAM,WAAW,MAAM,KAAK,iBAAiB,OAAO,EAAE,WAAW,CAAC;AAElE,YAAI,SAAS,OAAO;AAClB,mBAAS,SAAS,KAAkB;AACpC,+BAAS,SAAQ,YAAjB,4BAA2B,SAAS;AAAA,QACtC,OAAO;AACL,+BAAS,SAAQ,cAAjB;AAAA,QACF;AAEA,eAAO;AAAA,MACT,SAAS,KAAK;AACZ,cAAM,YAAY;AAClB,iBAAS,SAAS;AAClB,6BAAS,SAAQ,YAAjB,4BAA2B;AAE3B,eAAO,EAAE,OAAO,UAAU;AAAA,MAC5B,UAAE;AACA,sBAAc,KAAK;AAAA,MACrB;AAAA,IACF;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useNotifications.ts"],"sourcesContent":["import { checkNotificationMatchesFilter, isSameFilter, Notification, NotificationFilter, NovuError } from '@notiflyio/js';\r\nimport { useCallback, useEffect, useState } from 'react';\r\nimport { useDataRef } from './internal/useDataRef';\r\nimport { useWebSocketEvent } from './internal/useWebsocketEvent';\r\nimport { useNovu, useRealtime } from './NovuProvider';\r\n\r\n/**\r\n * Props for the useNotifications hook.\r\n *\r\n * @example\r\n * ```tsx\r\n * // Get unread notifications\r\n * const { notifications } = useNotifications({\r\n * read: false\r\n * });\r\n *\r\n * // Get unseen notifications with specific tags\r\n * const { notifications } = useNotifications({\r\n * seen: false,\r\n * tags: ['important']\r\n * });\r\n *\r\n * // Get notifications (auto-updates in real time when new notifications arrive)\r\n * const { notifications } = useNotifications({\r\n * read: false\r\n * });\r\n *\r\n * // Get notifications from a specific time period\r\n * const { notifications } = useNotifications({\r\n * createdGte: 1704067200000,\r\n * createdLte: 1735689599999\r\n * });\r\n *\r\n * // Opt out of the built-in realtime updates and drive them yourself\r\n * const { notifications, refetch } = useNotifications({\r\n * read: false,\r\n * realtime: false,\r\n * });\r\n * ```\r\n */\r\nexport type UseNotificationsProps = {\r\n tags?: NotificationFilter['tags'];\r\n data?: NotificationFilter['data'];\r\n read?: NotificationFilter['read'];\r\n archived?: NotificationFilter['archived'];\r\n snoozed?: NotificationFilter['snoozed'];\r\n seen?: NotificationFilter['seen'];\r\n severity?: NotificationFilter['severity'];\r\n createdGte?: NotificationFilter['createdGte'];\r\n createdLte?: NotificationFilter['createdLte'];\r\n limit?: number;\r\n /**\r\n * When `false`, disables the WebSocket subscription that auto-injects\r\n * newly received notifications into the list. Built-in mutations like\r\n * `readAll`, `seenAll`, `archiveAll`, and `archiveAllRead` continue to\r\n * update local state. Use this when you want to drive new-notification updates yourself (e.g.\r\n * via your own `novu.on('notifications.notification_received', ...)`\r\n * handler combined with `refetch()`).\r\n *\r\n * When set, this prop takes precedence over the `realtime` config on\r\n * `<NovuProvider />`. When omitted, the provider value (default `true`) is used.\r\n */\r\n realtime?: boolean;\r\n onSuccess?: (data: Notification[]) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseNotificationsResult = {\r\n notifications?: Notification[];\r\n error?: NovuError;\r\n isLoading: boolean;\r\n isFetching: boolean;\r\n hasMore: boolean;\r\n readAll: () => Promise<{\r\n data?: void | undefined;\r\n error?: NovuError | undefined;\r\n }>;\r\n seenAll: () => Promise<{\r\n data?: void | undefined;\r\n error?: NovuError | undefined;\r\n }>;\r\n archiveAll: () => Promise<{\r\n data?: void | undefined;\r\n error?: NovuError | undefined;\r\n }>;\r\n archiveAllRead: () => Promise<{\r\n data?: void | undefined;\r\n error?: NovuError | undefined;\r\n }>;\r\n refetch: () => Promise<void>;\r\n fetchMore: () => Promise<void>;\r\n};\r\n\r\nexport const useNotifications = (props?: UseNotificationsProps): UseNotificationsResult => {\r\n const {\r\n tags,\r\n data: dataFilter,\r\n read,\r\n archived = false,\r\n snoozed = false,\r\n seen,\r\n severity,\r\n createdGte,\r\n createdLte,\r\n limit = 10,\r\n realtime: propsRealtime,\r\n onSuccess,\r\n onError,\r\n } = props || {};\r\n const limitRef = useDataRef<number | undefined>(limit);\r\n const filterRef = useDataRef<NotificationFilter>({\r\n tags,\r\n data: dataFilter,\r\n read,\r\n archived,\r\n snoozed,\r\n seen,\r\n severity,\r\n createdGte,\r\n createdLte,\r\n });\r\n const novu = useNovu();\r\n const providerRealtime = useRealtime();\r\n const realtime = propsRealtime ?? providerRealtime;\r\n const [data, setData] = useState<Array<Notification>>();\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n const [hasMore, setHasMore] = useState(false);\r\n const length = data?.length;\r\n const after = length ? data[length - 1].id : undefined;\r\n const afterRef = useDataRef<string | undefined>(after);\r\n\r\n useEffect(() => {\r\n const listener = ({\r\n data,\r\n }: {\r\n data: { notifications: Notification[]; hasMore: boolean; filter: NotificationFilter };\r\n }) => {\r\n if (!data || !isSameFilter(filterRef.current, data.filter)) {\r\n return;\r\n }\r\n\r\n // the event is called with the list of all notifications cached matching the current filter\r\n setData(data.notifications);\r\n setHasMore(data.hasMore);\r\n };\r\n\r\n const cleanup = novu.on('notifications.list.updated', listener);\r\n\r\n return () => {\r\n cleanup();\r\n };\r\n }, [filterRef, novu]);\r\n\r\n useWebSocketEvent({\r\n event: 'notifications.notification_received',\r\n enabled: realtime,\r\n eventHandler: ({ result: notification }) => {\r\n const currentFilter = filterRef.current;\r\n const matches = checkNotificationMatchesFilter(notification, currentFilter);\r\n if (matches) {\r\n // the limit and after props are used to create a cache key\r\n // the first batch of notifications in the cache doesn't include the after prop and we want to push to the first batch\r\n const cacheKey = { ...currentFilter, limit: limitRef.current };\r\n novu.notifications.cache.unshift(cacheKey, notification);\r\n }\r\n },\r\n });\r\n\r\n const fetchNotifications = useCallback(\r\n async (options?: { refetch: boolean }) => {\r\n if (options?.refetch) {\r\n setError(undefined);\r\n setIsLoading(true);\r\n setIsFetching(false);\r\n }\r\n setIsFetching(true);\r\n\r\n const response = await novu.notifications.list({\r\n ...filterRef.current,\r\n limit,\r\n after: options?.refetch ? undefined : afterRef.current,\r\n });\r\n\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n } else if (response.data) {\r\n const responseData = response.data;\r\n onSuccess?.(responseData.notifications);\r\n setData(responseData.notifications);\r\n setHasMore(responseData.hasMore);\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n }\r\n },\r\n [novu, filterRef, afterRef, limit, onError, onSuccess]\r\n );\r\n\r\n useEffect(() => {\r\n novu.notifications.clearCache({ filter: filterRef.current });\r\n fetchNotifications({ refetch: true });\r\n }, [filterRef, novu, JSON.stringify(filterRef.current), fetchNotifications]);\r\n\r\n const refetch = useCallback(() => {\r\n novu.notifications.clearCache({ filter: filterRef.current });\r\n return fetchNotifications({ refetch: true });\r\n }, [filterRef, novu, fetchNotifications]);\r\n\r\n const fetchMore = useCallback(async () => {\r\n if (!hasMore || isFetching) return;\r\n\r\n return fetchNotifications();\r\n }, [hasMore, isFetching, fetchNotifications]);\r\n\r\n const readAll = useCallback(async () => {\r\n return await novu.notifications.readAll({ tags: filterRef.current.tags, data: filterRef.current.data });\r\n }, [filterRef, novu]);\r\n\r\n const seenAll = useCallback(async () => {\r\n return await novu.notifications.seenAll({ tags: filterRef.current.tags, data: filterRef.current.data });\r\n }, [filterRef, novu]);\r\n\r\n const archiveAll = useCallback(async () => {\r\n return await novu.notifications.archiveAll({ tags: filterRef.current.tags, data: filterRef.current.data });\r\n }, [filterRef, novu]);\r\n\r\n const archiveAllRead = useCallback(async () => {\r\n return await novu.notifications.archiveAllRead({ tags: filterRef.current.tags, data: filterRef.current.data });\r\n }, [filterRef, novu]);\r\n\r\n return {\r\n readAll,\r\n seenAll,\r\n archiveAll,\r\n archiveAllRead,\r\n notifications: data,\r\n error,\r\n isLoading,\r\n isFetching,\r\n refetch,\r\n fetchMore,\r\n hasMore,\r\n };\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA0G;AAC1G,mBAAiD;AACjD,wBAA2B;AAC3B,+BAAkC;AAClC,0BAAqC;AAyF9B,IAAM,mBAAmB,CAAC,UAA0D;AACzF,QAAM;AAAA,IACJ;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA,WAAW;AAAA,IACX,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AA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AAE5B,WAAO,mBAAmB;AAAA,EAC5B,GAAG,CAAC,SAAS,YAAY,kBAAkB,CAAC;AAE5C,QAAM,cAAU,0BAAY,YAAY;AACtC,WAAO,MAAM,KAAK,cAAc,QAAQ,EAAE,MAAM,UAAU,QAAQ,MAAM,MAAM,UAAU,QAAQ,KAAK,CAAC;AAAA,EACxG,GAAG,CAAC,WAAW,IAAI,CAAC;AAEpB,QAAM,cAAU,0BAAY,YAAY;AACtC,WAAO,MAAM,KAAK,cAAc,QAAQ,EAAE,MAAM,UAAU,QAAQ,MAAM,MAAM,UAAU,QAAQ,KAAK,CAAC;AAAA,EACxG,GAAG,CAAC,WAAW,IAAI,CAAC;AAEpB,QAAM,iBAAa,0BAAY,YAAY;AACzC,WAAO,MAAM,KAAK,cAAc,WAAW,EAAE,MAAM,UAAU,QAAQ,MAAM,MAAM,UAAU,QAAQ,KAAK,CAAC;AAAA,EAC3G,GAAG,CAAC,WAAW,IAAI,CAAC;AAEpB,QAAM,qBAAiB,0BAAY,YAAY;AAC7C,WAAO,MAAM,KAAK,cAAc,eAAe,EAAE,MAAM,UAAU,QAAQ,MAAM,MAAM,UAAU,QAAQ,KAAK,CAAC;AAAA,EAC/G,GAAG,CAAC,WAAW,IAAI,CAAC;AAEpB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["data"]} | ||
| {"version":3,"sources":["../../../src/hooks/useNotifications.ts"],"sourcesContent":["import { checkNotificationMatchesFilter, isSameFilter, Notification, NotificationFilter, NovuError } from '@notiflyio/js';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useDataRef } from './internal/useDataRef';\nimport { useWebSocketEvent } from './internal/useWebsocketEvent';\nimport { useNovu, useRealtime } from './NovuProvider';\n\n/**\n * Props for the useNotifications hook.\n *\n * @example\n * ```tsx\n * // Get unread notifications\n * const { notifications } = useNotifications({\n * read: false\n * });\n *\n * // Get unseen notifications with specific tags\n * const { notifications } = useNotifications({\n * seen: false,\n * tags: ['important']\n * });\n *\n * // Get notifications (auto-updates in real time when new notifications arrive)\n * const { notifications } = useNotifications({\n * read: false\n * });\n *\n * // Get notifications from a specific time period\n * const { notifications } = useNotifications({\n * createdGte: 1704067200000,\n * createdLte: 1735689599999\n * });\n *\n * // Opt out of the built-in realtime updates and drive them yourself\n * const { notifications, refetch } = useNotifications({\n * read: false,\n * realtime: false,\n * });\n * ```\n */\nexport type UseNotificationsProps = {\n tags?: NotificationFilter['tags'];\n data?: NotificationFilter['data'];\n read?: NotificationFilter['read'];\n archived?: NotificationFilter['archived'];\n snoozed?: NotificationFilter['snoozed'];\n seen?: NotificationFilter['seen'];\n severity?: NotificationFilter['severity'];\n createdGte?: NotificationFilter['createdGte'];\n createdLte?: NotificationFilter['createdLte'];\n limit?: number;\n /**\n * When `false`, disables the WebSocket subscription that auto-injects\n * newly received notifications into the list. Built-in mutations like\n * `readAll`, `seenAll`, `archiveAll`, and `archiveAllRead` continue to\n * update local state. Use this when you want to drive new-notification updates yourself (e.g.\n * via your own `novu.on('notifications.notification_received', ...)`\n * handler combined with `refetch()`).\n *\n * When set, this prop takes precedence over the `realtime` config on\n * `<NovuProvider />`. When omitted, the provider value (default `true`) is used.\n */\n realtime?: boolean;\n onSuccess?: (data: Notification[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseNotificationsResult = {\n notifications?: Notification[];\n error?: NovuError;\n isLoading: boolean;\n isFetching: boolean;\n hasMore: boolean;\n readAll: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n seenAll: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n archiveAll: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n archiveAllRead: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n refetch: () => Promise<void>;\n fetchMore: () => Promise<void>;\n};\n\nexport const useNotifications = (props?: UseNotificationsProps): UseNotificationsResult => {\n const {\n tags,\n data: dataFilter,\n read,\n archived = false,\n snoozed = false,\n seen,\n severity,\n createdGte,\n createdLte,\n limit = 10,\n realtime: propsRealtime,\n onSuccess,\n onError,\n } = props || {};\n const limitRef = useDataRef<number | undefined>(limit);\n const filterRef = useDataRef<NotificationFilter>({\n tags,\n data: dataFilter,\n read,\n archived,\n snoozed,\n seen,\n severity,\n createdGte,\n createdLte,\n });\n const novu = useNovu();\n const providerRealtime = useRealtime();\n const realtime = propsRealtime ?? providerRealtime;\n const [data, setData] = useState<Array<Notification>>();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n const [hasMore, setHasMore] = useState(false);\n const length = data?.length;\n const after = length ? data[length - 1].id : undefined;\n const afterRef = useDataRef<string | undefined>(after);\n\n useEffect(() => {\n const listener = ({\n data,\n }: {\n data: { notifications: Notification[]; hasMore: boolean; filter: NotificationFilter };\n }) => {\n if (!data || !isSameFilter(filterRef.current, data.filter)) {\n return;\n }\n\n // the event is called with the list of all notifications cached matching the current filter\n setData(data.notifications);\n setHasMore(data.hasMore);\n };\n\n const cleanup = novu.on('notifications.list.updated', listener);\n\n return () => {\n cleanup();\n };\n }, [filterRef, novu]);\n\n useWebSocketEvent({\n event: 'notifications.notification_received',\n enabled: realtime,\n eventHandler: ({ result: notification }) => {\n const currentFilter = filterRef.current;\n const matches = checkNotificationMatchesFilter(notification, currentFilter);\n if (matches) {\n // the limit and after props are used to create a cache key\n // the first batch of notifications in the cache doesn't include the after prop and we want to push to the first batch\n const cacheKey = { ...currentFilter, limit: limitRef.current };\n novu.notifications.cache.unshift(cacheKey, notification);\n }\n },\n });\n\n const fetchNotifications = useCallback(\n async (options?: { refetch: boolean }) => {\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n setIsFetching(false);\n }\n setIsFetching(true);\n\n const response = await novu.notifications.list({\n ...filterRef.current,\n limit,\n after: options?.refetch ? undefined : afterRef.current,\n });\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n setIsLoading(false);\n setIsFetching(false);\n } else if (response.data) {\n const responseData = response.data;\n onSuccess?.(responseData.notifications);\n setData(responseData.notifications);\n setHasMore(responseData.hasMore);\n setIsLoading(false);\n setIsFetching(false);\n }\n },\n [novu, filterRef, afterRef, limit, onError, onSuccess]\n );\n\n useEffect(() => {\n novu.notifications.clearCache({ filter: filterRef.current });\n fetchNotifications({ refetch: true });\n }, [filterRef, novu, JSON.stringify(filterRef.current), fetchNotifications]);\n\n const refetch = useCallback(() => {\n novu.notifications.clearCache({ filter: filterRef.current });\n return fetchNotifications({ refetch: true });\n }, [filterRef, novu, fetchNotifications]);\n\n const fetchMore = useCallback(async () => {\n if (!hasMore || isFetching) return;\n\n return fetchNotifications();\n }, [hasMore, isFetching, fetchNotifications]);\n\n const readAll = useCallback(async () => {\n return await novu.notifications.readAll({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n const seenAll = useCallback(async () => {\n return await novu.notifications.seenAll({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n const archiveAll = useCallback(async () => {\n return await novu.notifications.archiveAll({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n const archiveAllRead = useCallback(async () => {\n return await novu.notifications.archiveAllRead({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n return {\n readAll,\n seenAll,\n archiveAll,\n archiveAllRead,\n notifications: data,\n error,\n isLoading,\n isFetching,\n refetch,\n fetchMore,\n hasMore,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA0G;AAC1G,mBAAiD;AACjD,wBAA2B;AAC3B,+BAAkC;AAClC,0BAAqC;AAyF9B,IAAM,mBAAmB,CAAC,UAA0D;AACzF,QAAM;AAAA,IAC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S,KAAK,CAAC;AAAA,EAC7C,GAAG,CAAC,WAAW,MAAM,kBAAkB,CAAC;AAExC,QAAM,gBAAY,0BAAY,YAAY;AACxC,QAAI,CAAC,WAAW,WAAY;AAE5B,WAAO,mBAAmB;AAAA,EAC5B,GAAG,CAAC,SAAS,YAAY,kBAAkB,CAAC;AAE5C,QAAM,cAAU,0BAAY,YAAY;AACtC,WAAO,MAAM,KAAK,cAAc,QAAQ,EAAE,MAAM,UAAU,QAAQ,MAAM,MAAM,UAAU,QAAQ,KAAK,CAAC;AAAA,EACxG,GAAG,CAAC,WAAW,IAAI,CAAC;AAEpB,QAAM,cAAU,0BAAY,YAAY;AACtC,WAAO,MAAM,KAAK,cAAc,QAAQ,EAAE,MAAM,UAAU,QAAQ,MAAM,MAAM,UAAU,QAAQ,KAAK,CAAC;AAAA,EACxG,GAAG,CAAC,WAAW,IAAI,CAAC;AAEpB,QAAM,iBAAa,0BAAY,YAAY;AACzC,WAAO,MAAM,KAAK,cAAc,WAAW,EAAE,MAAM,UAAU,QAAQ,MAAM,MAAM,UAAU,QAAQ,KAAK,CAAC;AAAA,EAC3G,GAAG,CAAC,WAAW,IAAI,CAAC;AAEpB,QAAM,qBAAiB,0BAAY,YAAY;AAC7C,WAAO,MAAM,KAAK,cAAc,eAAe,EAAE,MAAM,UAAU,QAAQ,MAAM,MAAM,UAAU,QAAQ,KAAK,CAAC;AAAA,EAC/G,GAAG,CAAC,WAAW,IAAI,CAAC;AAEpB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["data"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/usePreferences.ts"],"sourcesContent":["import { NovuError, Preference, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\r\nimport { useEffect, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UsePreferencesProps = {\r\n filter?: {\r\n tags?: string[];\r\n severity?: SeverityLevelEnum | SeverityLevelEnum[];\r\n criticality?: WorkflowCriticalityEnum;\r\n };\r\n onSuccess?: (data: Preference[]) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UsePreferencesResult = {\r\n preferences?: Preference[];\r\n error?: NovuError;\r\n isLoading: boolean; // initial loading\r\n isFetching: boolean; // the request is in flight\r\n refetch: () => Promise<void>;\r\n};\r\n\r\nexport const usePreferences = (props?: UsePreferencesProps): UsePreferencesResult => {\r\n const { onSuccess, onError } = props || {};\r\n const [data, setData] = useState<Preference[]>();\r\n const { preferences, on } = useNovu();\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const sync = (event: { data?: Preference[] }) => {\r\n if (!event.data) {\r\n return;\r\n }\r\n setData(event.data);\r\n };\r\n\r\n useEffect(() => {\r\n fetchPreferences();\r\n\r\n const listUpdatedCleanup = on('preferences.list.updated', sync);\r\n const listPendingCleanup = on('preferences.list.pending', sync);\r\n const listResolvedCleanup = on('preferences.list.resolved', sync);\r\n\r\n return () => {\r\n listUpdatedCleanup();\r\n listPendingCleanup();\r\n listResolvedCleanup();\r\n };\r\n }, []);\r\n\r\n const fetchPreferences = async () => {\r\n setIsFetching(true);\r\n const response = await preferences.list(props?.filter);\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n } else if (response.data) {\r\n setData(response.data);\r\n onSuccess?.(response.data);\r\n }\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n };\r\n\r\n const refetch = () => {\r\n preferences.cache.clearAll();\r\n\r\n return fetchPreferences();\r\n };\r\n\r\n return {\r\n preferences: data,\r\n error,\r\n isLoading,\r\n isFetching,\r\n refetch,\r\n };\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AA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../../../src/hooks/usePreferences.ts"],"sourcesContent":["import { NovuError, Preference, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\nimport { useEffect, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UsePreferencesProps = {\n filter?: {\n tags?: string[];\n severity?: SeverityLevelEnum | SeverityLevelEnum[];\n criticality?: WorkflowCriticalityEnum;\n };\n onSuccess?: (data: Preference[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UsePreferencesResult = {\n preferences?: Preference[];\n error?: NovuError;\n isLoading: boolean; // initial loading\n isFetching: boolean; // the request is in flight\n refetch: () => Promise<void>;\n};\n\nexport const usePreferences = (props?: UsePreferencesProps): UsePreferencesResult => {\n const { onSuccess, onError } = props || {};\n const [data, setData] = useState<Preference[]>();\n const { preferences, on } = useNovu();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const sync = (event: { data?: Preference[] }) => {\n if (!event.data) {\n return;\n }\n setData(event.data);\n };\n\n useEffect(() => {\n fetchPreferences();\n\n const listUpdatedCleanup = on('preferences.list.updated', sync);\n const listPendingCleanup = on('preferences.list.pending', sync);\n const listResolvedCleanup = on('preferences.list.resolved', sync);\n\n return () => {\n listUpdatedCleanup();\n listPendingCleanup();\n listResolvedCleanup();\n };\n }, []);\n\n const fetchPreferences = async () => {\n setIsFetching(true);\n const response = await preferences.list(props?.filter);\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data) {\n setData(response.data);\n onSuccess?.(response.data);\n }\n setIsLoading(false);\n setIsFetching(false);\n };\n\n const refetch = () => {\n preferences.cache.clearAll();\n\n return fetchPreferences();\n };\n\n return {\n preferences: data,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAoC;AACpC,0BAAwB;AAoBjB,IAAM,iBAAiB,CAAC,U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eleteSubscriptionArgs, NovuError, DeleteSubscriptionArgs as RemoveSubscriptionArgs } from '@notiflyio/js';\r\nimport { useCallback, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseRemoveSubscriptionProps = {\r\n onSuccess?: () => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\ntype RemoveResult = Promise<{\r\n error?: NovuError;\r\n}>;\r\n\r\nexport type UseRemoveSubscriptionResult = {\r\n isRemoving: boolean;\r\n error?: NovuError;\r\n remove: (args: RemoveSubscriptionArgs) => RemoveResult;\r\n};\r\n\r\nexport const useRemoveSubscription = (props: UseRemoveSubscriptionProps = {}): UseRemoveSubscriptionResult => {\r\n const propsRef = useRef<UseRemoveSubscriptionProps>(props);\r\n propsRef.current = props;\r\n const novu = useNovu();\r\n const [isRemoving, setIsRemoving] = useState(false);\r\n const [error, setError] = useState<NovuError>();\r\n\r\n const removeCallback = useCallback(\r\n async (args: RemoveSubscriptionArgs): RemoveResult => {\r\n const { onSuccess, onError } = propsRef.current;\r\n setError(undefined);\r\n setIsRemoving(true);\r\n\r\n const response = await novu.subscriptions.delete(args as BaseDeleteSubscriptionArgs);\r\n\r\n setIsRemoving(false);\r\n\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n } else if (response.data) {\r\n onSuccess?.();\r\n }\r\n\r\n return response;\r\n },\r\n [novu]\r\n );\r\n\r\n return {\r\n remove: removeCallback,\r\n isRemoving,\r\n error,\r\n };\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA8C;AAC9C,0BAAwB;AAiBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,eAAW,qBAAmC,KAAK;AACzD,WAAS,UAAU;AACnB,QAAM,WAAO,6BAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAE9C,QAAM,qBAAiB;AAAA,IACrB,OAAO,SAA+C;AACpD,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,OAAO,IAAkC;AAEnF,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,2CAAU,SAAS;AAAA,MACrB,WAAW,SAAS,MAAM;AACxB;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useRemoveSubscription.ts"],"sourcesContent":["import { BaseDeleteSubscriptionArgs, NovuError, DeleteSubscriptionArgs as RemoveSubscriptionArgs } from '@notiflyio/js';\nimport { useCallback, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseRemoveSubscriptionProps = {\n onSuccess?: () => void;\n onError?: (error: NovuError) => void;\n};\n\ntype RemoveResult = Promise<{\n error?: NovuError;\n}>;\n\nexport type UseRemoveSubscriptionResult = {\n isRemoving: boolean;\n error?: NovuError;\n remove: (args: RemoveSubscriptionArgs) => RemoveResult;\n};\n\nexport const useRemoveSubscription = (props: UseRemoveSubscriptionProps = {}): UseRemoveSubscriptionResult => {\n const propsRef = useRef<UseRemoveSubscriptionProps>(props);\n propsRef.current = props;\n const novu = useNovu();\n const [isRemoving, setIsRemoving] = useState(false);\n const [error, setError] = useState<NovuError>();\n\n const removeCallback = useCallback(\n async (args: RemoveSubscriptionArgs): RemoveResult => {\n const { onSuccess, onError } = propsRef.current;\n setError(undefined);\n setIsRemoving(true);\n\n const response = await novu.subscriptions.delete(args as BaseDeleteSubscriptionArgs);\n\n setIsRemoving(false);\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data) {\n onSuccess?.();\n }\n\n return response;\n },\n [novu]\n );\n\n return {\n remove: removeCallback,\n isRemoving,\n error,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA8C;AAC9C,0BAAwB;AAiBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,eAAW,qBAAmC,KAAK;AACzD,WAAS,UAAU;AACnB,QAAM,WAAO,6BAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAE9C,QAAM,qBAAiB;AAAA,IACrB,OAAO,SAA+C;AACpD,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,OAAO,IAAkC;AAEnF,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,2CAAU,SAAS;AAAA,MACrB,WAAW,SAAS,MAAM;AACxB;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useSchedule.ts"],"sourcesContent":["import { NovuError, Schedule } from '@notiflyio/js';\r\nimport { useEffect, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseScheduleProps = {\r\n onSuccess?: (data: Schedule) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseScheduleResult = {\r\n schedule?: Schedule;\r\n error?: NovuError;\r\n isLoading: boolean; // initial loading\r\n isFetching: boolean; // the request is in flight\r\n refetch: () => Promise<void>;\r\n};\r\n\r\nexport const useSchedule = (props?: UseScheduleProps): UseScheduleResult => {\r\n const { onSuccess, onError } = props || {};\r\n const [data, setData] = useState<Schedule>();\r\n const { preferences, on } = useNovu();\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const sync = (event: { data?: Schedule }) => {\r\n if (!event.data) {\r\n return;\r\n }\r\n setData(event.data);\r\n };\r\n\r\n useEffect(() => {\r\n fetchSchedule();\r\n\r\n const listUpdatedCleanup = on('preference.schedule.get.updated', sync);\r\n const listPendingCleanup = on('preference.schedule.get.pending', sync);\r\n const listResolvedCleanup = on('preference.schedule.get.resolved', sync);\r\n\r\n return () => {\r\n listUpdatedCleanup();\r\n listPendingCleanup();\r\n listResolvedCleanup();\r\n };\r\n }, []);\r\n\r\n const fetchSchedule = async () => {\r\n setIsFetching(true);\r\n const response = await preferences.schedule.get();\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n } else if (response.data) {\r\n setData(response.data);\r\n onSuccess?.(response.data);\r\n }\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n };\r\n\r\n const refetch = () => {\r\n preferences.schedule.cache.clearAll();\r\n\r\n return fetchSchedule();\r\n };\r\n\r\n return {\r\n schedule: data,\r\n error,\r\n isLoading,\r\n isFetching,\r\n refetch,\r\n };\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAoC;AACpC,0BAAwB;AAejB,IAAM,cAAc,CAAC,UAAgD;AAC1E,QAAM,EAAE,WAAW,QAAQ,IAAI,SAAS,CAAC;AACzC,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAmB;AAC3C,QAAM,EAAE,aAAa,GAAG,QAAI,6BAAQ;AACpC,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAElD,QAAM,OAAO,CAAC,UAA+B;AAC3C,QAAI,CAAC,MAAM,MAAM;AACf;AAAA,IACF;AACA,YAAQ,MAAM,IAAI;AAAA,EACpB;AAEA,8BAAU,MAAM;AACd,kBAAc;AAEd,UAAM,qBAAqB,GAAG,mCAAmC,IAAI;AACrE,UAAM,qBAAqB,GAAG,mCAAmC,IAAI;AACrE,UAAM,sBAAsB,GAAG,oCAAoC,IAAI;AAEvE,WAAO,MAAM;AACX,yBAAmB;AACnB,yBAAmB;AACnB,0BAAoB;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,gBAAgB,YAAY;AAChC,kBAAc,IAAI;AAClB,UAAM,WAAW,MAAM,YAAY,SAAS,IAAI;AAChD,QAAI,SAAS,OAAO;AAClB,eAAS,SAAS,KAAK;AACvB,yCAAU,SAAS;AAAA,IACrB,WAAW,SAAS,MAAM;AACxB,cAAQ,SAAS,IAAI;AACrB,6CAAY,SAAS;AAAA,IACvB;AACA,iBAAa,KAAK;AAClB,kBAAc,KAAK;AAAA,EACrB;AAEA,QAAM,UAAU,MAAM;AACpB,gBAAY,SAAS,MAAM,SAAS;AAEpC,WAAO,cAAc;AAAA,EACvB;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useSchedule.ts"],"sourcesContent":["import { NovuError, Schedule } from '@notiflyio/js';\nimport { useEffect, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseScheduleProps = {\n onSuccess?: (data: Schedule) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseScheduleResult = {\n schedule?: Schedule;\n error?: NovuError;\n isLoading: boolean; // initial loading\n isFetching: boolean; // the request is in flight\n refetch: () => Promise<void>;\n};\n\nexport const useSchedule = (props?: UseScheduleProps): UseScheduleResult => {\n const { onSuccess, onError } = props || {};\n const [data, setData] = useState<Schedule>();\n const { preferences, on } = useNovu();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const sync = (event: { data?: Schedule }) => {\n if (!event.data) {\n return;\n }\n setData(event.data);\n };\n\n useEffect(() => {\n fetchSchedule();\n\n const listUpdatedCleanup = on('preference.schedule.get.updated', sync);\n const listPendingCleanup = on('preference.schedule.get.pending', sync);\n const listResolvedCleanup = on('preference.schedule.get.resolved', sync);\n\n return () => {\n listUpdatedCleanup();\n listPendingCleanup();\n listResolvedCleanup();\n };\n }, []);\n\n const fetchSchedule = async () => {\n setIsFetching(true);\n const response = await preferences.schedule.get();\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data) {\n setData(response.data);\n onSuccess?.(response.data);\n }\n setIsLoading(false);\n setIsFetching(false);\n };\n\n const refetch = () => {\n preferences.schedule.cache.clearAll();\n\n return fetchSchedule();\n };\n\n return {\n schedule: data,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAoC;AACpC,0BAAwB;AAejB,IAAM,cAAc,CAAC,UAAgD;AAC1E,QAAM,EAAE,WAAW,QAAQ,IAAI,SAAS,CAAC;AACzC,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAmB;AAC3C,QAAM,EAAE,aAAa,GAAG,QAAI,6BAAQ;AACpC,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAElD,QAAM,OAAO,CAAC,UAA+B;AAC3C,QAAI,CAAC,MAAM,MAAM;AACf;AAAA,IACF;AACA,YAAQ,MAAM,IAAI;AAAA,EACpB;AAEA,8BAAU,MAAM;AACd,kBAAc;AAEd,UAAM,qBAAqB,GAAG,mCAAmC,IAAI;AACrE,UAAM,qBAAqB,GAAG,mCAAmC,IAAI;AACrE,UAAM,sBAAsB,GAAG,oCAAoC,IAAI;AAEvE,WAAO,MAAM;AACX,yBAAmB;AACnB,yBAAmB;AACnB,0BAAoB;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,gBAAgB,YAAY;AAChC,kBAAc,IAAI;AAClB,UAAM,WAAW,MAAM,YAAY,SAAS,IAAI;AAChD,QAAI,SAAS,OAAO;AAClB,eAAS,SAAS,KAAK;AACvB,yCAAU,SAAS;AAAA,IACrB,WAAW,SAAS,MAAM;AACxB,cAAQ,SAAS,IAAI;AACrB,6CAAY,SAAS;AAAA,IACvB;AACA,iBAAa,KAAK;AAClB,kBAAc,KAAK;AAAA,EACrB;AAEA,QAAM,UAAU,MAAM;AACpB,gBAAY,SAAS,MAAM,SAAS;AAEpC,WAAO,cAAc;AAAA,EACvB;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useSubscription.ts"],"sourcesContent":["import { NovuError, TopicSubscription } from '@notiflyio/js';\r\nimport { buildSubscriptionIdentifier } from '@notiflyio/js/internal';\r\nimport { useCallback, useEffect, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseSubscriptionProps = {\r\n topicKey: string;\r\n identifier?: string;\r\n onSuccess?: (data: TopicSubscription | null) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseSubscriptionResult = {\r\n subscription?: TopicSubscription | null;\r\n error?: NovuError;\r\n isLoading: boolean;\r\n isFetching: boolean;\r\n refetch: () => Promise<void>;\r\n};\r\n\r\n/**\r\n * Get a subscription for a topic.\r\n */\r\nexport const useSubscription = (props: UseSubscriptionProps): UseSubscriptionResult => {\r\n const novu = useNovu();\r\n const propsRef = useRef<UseSubscriptionProps>(props);\r\n propsRef.current = {\r\n ...props,\r\n identifier:\r\n props.identifier ?? buildSubscriptionIdentifier({ topicKey: props.topicKey, subscriberId: novu.subscriberId }),\r\n };\r\n const [subscription, setSubscription] = useState<TopicSubscription | null>();\r\n const subscriptionRef = useRef<TopicSubscription | null>(null);\r\n subscriptionRef.current = subscription ?? null;\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const fetchSubscription = useCallback(\r\n async (options?: { refetch: boolean }) => {\r\n const { topicKey, identifier, onSuccess, onError } = propsRef.current;\r\n if (options?.refetch) {\r\n setError(undefined);\r\n setIsLoading(true);\r\n }\r\n\r\n setIsFetching(true);\r\n\r\n const response = await novu.subscriptions.get(\r\n {\r\n topicKey,\r\n identifier,\r\n },\r\n { refetch: options?.refetch }\r\n );\r\n\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n } else if (response.data !== undefined) {\r\n onSuccess?.(response.data);\r\n setSubscription(response.data);\r\n }\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n },\r\n [novu]\r\n );\r\n\r\n useEffect(() => {\r\n const listener = ({ data: subscription }: { data?: TopicSubscription }) => {\r\n const { topicKey, identifier } = propsRef.current;\r\n if (!subscription || subscription.topicKey !== topicKey || subscription.identifier !== identifier) {\r\n return;\r\n }\r\n\r\n setSubscription(subscription);\r\n setIsFetching(false);\r\n };\r\n\r\n const cleanupGetPending = novu.on('subscription.get.pending', ({ args }) => {\r\n const { topicKey, identifier } = propsRef.current;\r\n if (!args || args.topicKey !== topicKey || args.identifier !== identifier) {\r\n return;\r\n }\r\n setIsFetching(true);\r\n });\r\n\r\n const cleanupGetResolved = novu.on('subscription.get.resolved', ({ args, data, error }) => {\r\n const { topicKey, identifier, onSuccess, onError } = propsRef.current;\r\n if (!args || args.topicKey !== topicKey || args.identifier !== identifier) {\r\n return;\r\n }\r\n if (error) {\r\n setError(error as NovuError);\r\n onError?.(error as NovuError);\r\n } else {\r\n setSubscription(data ?? null);\r\n onSuccess?.(data ?? null);\r\n }\r\n setIsFetching(false);\r\n });\r\n\r\n const cleanupCreatePending = novu.on('subscription.create.pending', ({ args }) => {\r\n const { topicKey, identifier } = propsRef.current;\r\n if (!args || args.topicKey !== topicKey || args.identifier !== identifier) {\r\n return;\r\n }\r\n setIsFetching(true);\r\n });\r\n\r\n const cleanupCreateResolved = novu.on('subscription.create.resolved', listener);\r\n\r\n const cleanupUpdateResolved = novu.on('subscription.update.resolved', listener);\r\n\r\n const cleanupDeletePending = novu.on('subscription.delete.pending', ({ args }) => {\r\n const subscriptionId = subscriptionRef.current?.id;\r\n const subscriptionIdentifier = subscriptionRef.current?.identifier;\r\n if (!subscriptionId || !subscriptionIdentifier) {\r\n return;\r\n }\r\n\r\n if (\r\n !args ||\r\n ('subscriptionId' in args &&\r\n args.subscriptionId !== subscriptionId &&\r\n args.subscriptionId !== subscriptionIdentifier) ||\r\n ('subscription' in args &&\r\n args.subscription.id !== subscriptionId &&\r\n args.subscription.identifier !== subscriptionIdentifier)\r\n ) {\r\n return;\r\n }\r\n setIsFetching(true);\r\n });\r\n\r\n const cleanupDeleteResolved = novu.on('subscription.delete.resolved', ({ args }) => {\r\n const subscriptionId = subscriptionRef.current?.id;\r\n const subscriptionIdentifier = subscriptionRef.current?.identifier;\r\n if (!subscriptionId || !subscriptionIdentifier) {\r\n return;\r\n }\r\n\r\n if (\r\n ('subscriptionId' in args && args.subscriptionId === subscriptionId) ||\r\n ('subscriptionId' in args && args.subscriptionId === subscriptionIdentifier) ||\r\n ('subscription' in args && args.subscription.id === subscriptionId) ||\r\n ('subscription' in args && args.subscription.identifier === subscriptionIdentifier)\r\n ) {\r\n setSubscription(null);\r\n setIsFetching(false);\r\n }\r\n });\r\n\r\n void fetchSubscription({ refetch: true });\r\n\r\n return () => {\r\n cleanupGetPending();\r\n cleanupGetResolved();\r\n cleanupCreatePending();\r\n cleanupCreateResolved();\r\n cleanupUpdateResolved();\r\n cleanupDeletePending();\r\n cleanupDeleteResolved();\r\n };\r\n }, [novu, fetchSubscription]);\r\n\r\n const refetch = useCallback(() => fetchSubscription({ refetch: true }), [fetchSubscription]);\r\n\r\n return {\r\n subscription,\r\n error,\r\n isLoading,\r\n isFetching,\r\n refetch,\r\n };\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAA4C;AAC5C,mBAAyD;AACzD,0BAAwB;AAoBjB,IAAM,kBAAkB,CAAC,UAAuD;AACrF,QAAM,WAAO,6BAAQ;AACrB,QAAM,eAAW,qBAA6B,KAAK;AACnD,WAAS,UAAU;AAAA,IACjB,GAAG;AAAA,IACH,YACE,MAAM,kBAAc,6CAA4B,EAAE,UAAU,MAAM,UAAU,cAAc,KAAK,aAAa,CAAC;AAAA,EACjH;AACA,QAAM,CAAC,cAAc,eAAe,QAAI,uBAAmC;AAC3E,QAAM,sBAAkB,qBAAiC,IAAI;AAC7D,kBAAgB,UAAU,gBAAgB;AAC1C,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAElD,QAAM,wBAAoB;AAAA,IACxB,OAAO,YAAmC;AACxC,YAAM,EAAE,UAAU,YAAY,WAAW,QAAQ,IAAI,SAAS;AAC9D,UAAI,mCAAS,SAAS;AACpB,iBAAS,MAAS;AAClB,qBAAa,IAAI;AAAA,MACnB;AAEA,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc;AAAA,QACxC;AAAA,UACE;AAAA,UACA;AAAA,QACF;AAAA,QACA,EAAE,SAAS,mCAAS,QAAQ;AAAA,MAC9B;AAEA,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,2CAAU,SAAS;AAAA,MACrB,WAAW,SAAS,S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AE,SAAS,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC;AAE3F,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["subscription","error"]} | ||
| {"version":3,"sources":["../../../src/hooks/useSubscription.ts"],"sourcesContent":["import { NovuError, TopicSubscription } from '@notiflyio/js';\nimport { buildSubscriptionIdentifier } from '@notiflyio/js/internal';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseSubscriptionProps = {\n topicKey: string;\n identifier?: string;\n onSuccess?: (data: TopicSubscription | null) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseSubscriptionResult = {\n subscription?: TopicSubscription | null;\n error?: NovuError;\n isLoading: boolean;\n isFetching: boolean;\n refetch: () => Promise<void>;\n};\n\n/**\n * Get a subscription for a topic.\n */\nexport const useSubscription = (props: UseSubscriptionProps): UseSubscriptionResult => {\n const novu = useNovu();\n const propsRef = useRef<UseSubscriptionProps>(props);\n propsRef.current = {\n ...props,\n identifier:\n props.identifier ?? buildSubscriptionIdentifier({ topicKey: props.topicKey, subscriberId: novu.subscriberId }),\n };\n const [subscription, setSubscription] = useState<TopicSubscription | null>();\n const subscriptionRef = useRef<TopicSubscription | null>(null);\n subscriptionRef.current = subscription ?? null;\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const fetchSubscription = useCallback(\n async (options?: { refetch: boolean }) => {\n const { topicKey, identifier, onSuccess, onError } = propsRef.current;\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n }\n\n setIsFetching(true);\n\n const response = await novu.subscriptions.get(\n {\n topicKey,\n identifier,\n },\n { refetch: options?.refetch }\n );\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data !== undefined) {\n onSuccess?.(response.data);\n setSubscription(response.data);\n }\n setIsLoading(false);\n setIsFetching(false);\n },\n [novu]\n );\n\n useEffect(() => {\n const listener = ({ data: subscription }: { data?: TopicSubscription }) => {\n const { topicKey, identifier } = propsRef.current;\n if (!subscription || subscription.topicKey !== topicKey || subscription.identifier !== identifier) {\n return;\n }\n\n setSubscription(subscription);\n setIsFetching(false);\n };\n\n const cleanupGetPending = novu.on('subscription.get.pending', ({ args }) => {\n const { topicKey, identifier } = propsRef.current;\n if (!args || args.topicKey !== topicKey || args.identifier !== identifier) {\n return;\n }\n setIsFetching(true);\n });\n\n const cleanupGetResolved = novu.on('subscription.get.resolved', ({ args, data, error }) => {\n const { topicKey, identifier, onSuccess, onError } = propsRef.current;\n if (!args || args.topicKey !== topicKey || args.identifier !== identifier) {\n return;\n }\n if (error) {\n setError(error as NovuError);\n onError?.(error as NovuError);\n } else {\n setSubscription(data ?? null);\n onSuccess?.(data ?? null);\n }\n setIsFetching(false);\n });\n\n const cleanupCreatePending = novu.on('subscription.create.pending', ({ args }) => {\n const { topicKey, identifier } = propsRef.current;\n if (!args || args.topicKey !== topicKey || args.identifier !== identifier) {\n return;\n }\n setIsFetching(true);\n });\n\n const cleanupCreateResolved = novu.on('subscription.create.resolved', listener);\n\n const cleanupUpdateResolved = novu.on('subscription.update.resolved', listener);\n\n const cleanupDeletePending = novu.on('subscription.delete.pending', ({ args }) => {\n const subscriptionId = subscriptionRef.current?.id;\n const subscriptionIdentifier = subscriptionRef.current?.identifier;\n if (!subscriptionId || !subscriptionIdentifier) {\n return;\n }\n\n if (\n !args ||\n ('subscriptionId' in args &&\n args.subscriptionId !== subscriptionId &&\n args.subscriptionId !== subscriptionIdentifier) ||\n ('subscription' in args &&\n args.subscription.id !== subscriptionId &&\n args.subscription.identifier !== subscriptionIdentifier)\n ) {\n return;\n }\n setIsFetching(true);\n });\n\n const cleanupDeleteResolved = novu.on('subscription.delete.resolved', ({ args }) => {\n const subscriptionId = subscriptionRef.current?.id;\n const subscriptionIdentifier = subscriptionRef.current?.identifier;\n if (!subscriptionId || !subscriptionIdentifier) {\n return;\n }\n\n if (\n ('subscriptionId' in args && args.subscriptionId === subscriptionId) ||\n ('subscriptionId' in args && args.subscriptionId === subscriptionIdentifier) ||\n ('subscription' in args && args.subscription.id === subscriptionId) ||\n ('subscription' in args && args.subscription.identifier === subscriptionIdentifier)\n ) {\n setSubscription(null);\n setIsFetching(false);\n }\n });\n\n void fetchSubscription({ refetch: true });\n\n return () => {\n cleanupGetPending();\n cleanupGetResolved();\n cleanupCreatePending();\n cleanupCreateResolved();\n cleanupUpdateResolved();\n cleanupDeletePending();\n cleanupDeleteResolved();\n };\n }, [novu, fetchSubscription]);\n\n const refetch = useCallback(() => fetchSubscription({ refetch: true }), [fetchSubscription]);\n\n return {\n subscription,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAA4C;AAC5C,mBAAyD;AACzD,0BAAwB;AAoBjB,IAAM,kBAAkB,CAAC,UAAuD;AACrF,QAAM,WAAO,6BAAQ;AACrB,QAAM,eAAW,qBAA6B,KAAK;AACnD,WAAS,UAAU;AAAA,IACjB,GAAG;AAAA,IACH,YACE,MAAM,kBAAc,6CAA4B,EAAE,UAAU,MAAM,UAAU,cAAc,KAAK,aAAa,CAAC;AAAA,EACjH;AACA,QAAM,CAAC,cAAc,eAAe,QAAI,uBAAmC;AAC3E,QAAM,sBAAkB,qBAAiC,IAAI;AAC7D,kBAAgB,UAAU,gBAAgB;AAC1C,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAElD,QAAM,wBAAoB;AAAA,IACxB,OAAO,YAAmC;AACxC,YAAM,EAAE,UAAU,YAAY,WAAW,QAAQ,IAAI,SAAS;AAC9D,UAAI,mCAAS,SAAS;AACpB,iBAAS,MAAS;AAClB,qBAAa,IAA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AED,SAAK,kBAAkB,EAAE,SAAS,KAAK,CAAC;AAExC,WAAO,MAAM;AACX,wBAAkB;AAClB,yBAAmB;AACnB,2BAAqB;AACrB,4BAAsB;AACtB,4BAAsB;AACtB,2BAAqB;AACrB,4BAAsB;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,MAAM,iBAAiB,CAAC;AAE5B,QAAM,cAAU,0BAAY,MAAM,kBAAkB,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC;AAE3F,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["subscription","error"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useSubscriptions.ts"],"sourcesContent":["import { NovuError, TopicSubscription } from '@notiflyio/js';\r\nimport { useCallback, useEffect, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\n/**\r\n * Get all subscriptions for a topic.\r\n * Props for the useSubscriptions hook.\r\n *\r\n * @example\r\n * ```tsx\r\n * // Get all subscriptions for a topic\r\n * const { subscriptions } = useSubscriptions({\r\n * topicKey: 'my-topic'\r\n * });\r\n *\r\n * // Get subscriptions with callbacks\r\n * const { subscriptions, refetch } = useSubscriptions({\r\n * topicKey: 'my-topic',\r\n * onSuccess: (data) => console.log('Loaded:', data),\r\n * onError: (error) => console.error('Error:', error)\r\n * });\r\n * ```\r\n */\r\nexport type UseSubscriptionsProps = {\r\n topicKey: string;\r\n onSuccess?: (data: TopicSubscription[]) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseSubscriptionsResult = {\r\n subscriptions?: TopicSubscription[];\r\n error?: NovuError;\r\n isLoading: boolean;\r\n isFetching: boolean;\r\n refetch: () => Promise<void>;\r\n};\r\n\r\nexport const useSubscriptions = ({ topicKey, onSuccess, onError }: UseSubscriptionsProps): UseSubscriptionsResult => {\r\n const novu = useNovu();\r\n const [data, setData] = useState<TopicSubscription[]>();\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const fetchSubscriptions = useCallback(\r\n async (options?: { refetch: boolean }) => {\r\n if (options?.refetch) {\r\n setError(undefined);\r\n setIsLoading(true);\r\n novu.subscriptions.cache.invalidate({ topicKey });\r\n }\r\n setIsFetching(true);\r\n\r\n const response = await novu.subscriptions.list({ topicKey }, { refetch: options?.refetch });\r\n\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n } else if (response.data) {\r\n onSuccess?.(response.data);\r\n setData(response.data);\r\n }\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n },\r\n [novu, topicKey, onError, onSuccess]\r\n );\r\n\r\n useEffect(() => {\r\n const cleanupListPending = novu.on('subscriptions.list.pending', ({ args }) => {\r\n if (args.topicKey !== topicKey) {\r\n return;\r\n }\r\n setIsFetching(true);\r\n });\r\n\r\n const cleanupListResolved = novu.on('subscriptions.list.resolved', ({ args, data, error }) => {\r\n if (args.topicKey !== topicKey) {\r\n return;\r\n }\r\n if (error) {\r\n setError(error as NovuError);\r\n onError?.(error as NovuError);\r\n } else if (data) {\r\n onSuccess?.(data);\r\n setData(data);\r\n }\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n });\r\n\r\n const cleanupListUpdated = novu.on('subscriptions.list.updated', ({ data }) => {\r\n if (data.topicKey !== topicKey) {\r\n return;\r\n }\r\n setData(data.subscriptions);\r\n });\r\n\r\n const cleanupCreateResolved = novu.on('subscription.create.resolved', ({ args, data }) => {\r\n if (args.topicKey !== topicKey) {\r\n return;\r\n }\r\n if (data) {\r\n void fetchSubscriptions({ refetch: true });\r\n }\r\n });\r\n\r\n const cleanupDeleteResolved = novu.on('subscription.delete.resolved', ({ args }) => {\r\n const deleteTopicKey = 'subscription' in args ? args.subscription.topicKey : topicKey;\r\n if (deleteTopicKey !== topicKey) {\r\n return;\r\n }\r\n void fetchSubscriptions({ refetch: true });\r\n });\r\n\r\n void fetchSubscriptions({ refetch: true });\r\n\r\n return () => {\r\n cleanupListPending();\r\n cleanupListResolved();\r\n cleanupListUpdated();\r\n cleanupCreateResolved();\r\n cleanupDeleteResolved();\r\n };\r\n }, [topicKey, novu, fetchSubscriptions, onError, onSuccess]);\r\n\r\n const refetch = useCallback(() => {\r\n return fetchSubscriptions({ refetch: true });\r\n }, [fetchSubscriptions]);\r\n\r\n return {\r\n subscriptions: data,\r\n error,\r\n isLoading,\r\n isFetching,\r\n refetch,\r\n };\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAiD;AACjD,0BAAwB;AAmCjB,IAAM,mBAAmB,CAAC,EAAE,UAAU,WAAW,QAAQ,MAAqD;AACnH,QAAM,WAAO,6BAAQ;AACrB,QAAM,CAAC,MAAM,OAAO,QAAI,uBAA8B;AACtD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAElD,QAAM,yBAAqB;AAAA,IACzB,OAAO,YAAmC;AACxC,UAAI,mCAAS,SAAS;AACpB,iBAAS,MAAS;AAClB,qBAAa,IAAI;AACjB,aAAK,cAAc,MAAM,WAAW,EAAE,SAAS,CAAC;AAAA,MAClD;AACA,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,KAAK,EAAE,SAAS,GAAG,EAAE,SAAS,mCAAS,QAAQ,CAAC;AAE1F,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,2CAAU,SAAS;AAAA,MACrB,WAAW,SAAS,MAAM;AACxB,+CAAY,SAAS;AACrB,gBAAQ,SAAS,IAAI;AAAA,MACvB;AACA,mBAAa,KAAK;AAClB,oBAAc,KAAK;AAAA,IACrB;AAAA,IACA,CAAC,MAAM,UAAU,SAAS,SAAS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BAAsB;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,UAAU,MAAM,oBAAoB,SAAS,SAAS,CAAC;AAE3D,QAAM,cAAU,0BAAY,MAAM;AAChC,WAAO,mBAAmB,EAAE,SAAS,KAAK,CAAC;AAAA,EAC7C,GAAG,CAAC,kBAAkB,CAAC;AAEvB,SAAO;AAAA,IACL,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["data","error"]} | ||
| {"version":3,"sources":["../../../src/hooks/useSubscriptions.ts"],"sourcesContent":["import { NovuError, TopicSubscription } from '@notiflyio/js';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\n/**\n * Get all subscriptions for a topic.\n * Props for the useSubscriptions hook.\n *\n * @example\n * ```tsx\n * // Get all subscriptions for a topic\n * const { subscriptions } = useSubscriptions({\n * topicKey: 'my-topic'\n * });\n *\n * // Get subscriptions with callbacks\n * const { subscriptions, refetch } = useSubscriptions({\n * topicKey: 'my-topic',\n * onSuccess: (data) => console.log('Loaded:', data),\n * onError: (error) => console.error('Error:', error)\n * });\n * ```\n */\nexport type UseSubscriptionsProps = {\n topicKey: string;\n onSuccess?: (data: TopicSubscription[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseSubscriptionsResult = {\n subscriptions?: TopicSubscription[];\n error?: NovuError;\n isLoading: boolean;\n isFetching: boolean;\n refetch: () => Promise<void>;\n};\n\nexport const useSubscriptions = ({ topicKey, onSuccess, onError }: UseSubscriptionsProps): UseSubscriptionsResult => {\n const novu = useNovu();\n const [data, setData] = useState<TopicSubscription[]>();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const fetchSubscriptions = useCallback(\n async (options?: { refetch: boolean }) => {\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n novu.subscriptions.cache.invalidate({ topicKey });\n }\n setIsFetching(true);\n\n const response = await novu.subscriptions.list({ topicKey }, { refetch: options?.refetch });\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data) {\n onSuccess?.(response.data);\n setData(response.data);\n }\n setIsLoading(false);\n setIsFetching(false);\n },\n [novu, topicKey, onError, onSuccess]\n );\n\n useEffect(() => {\n const cleanupListPending = novu.on('subscriptions.list.pending', ({ args }) => {\n if (args.topicKey !== topicKey) {\n return;\n }\n setIsFetching(true);\n });\n\n const cleanupListResolved = novu.on('subscriptions.list.resolved', ({ args, data, error }) => {\n if (args.topicKey !== topicKey) {\n return;\n }\n if (error) {\n setError(error as NovuError);\n onError?.(error as NovuError);\n } else if (data) {\n onSuccess?.(data);\n setData(data);\n }\n setIsLoading(false);\n setIsFetching(false);\n });\n\n const cleanupListUpdated = novu.on('subscriptions.list.updated', ({ data }) => {\n if (data.topicKey !== topicKey) {\n return;\n }\n setData(data.subscriptions);\n });\n\n const cleanupCreateResolved = novu.on('subscription.create.resolved', ({ args, data }) => {\n if (args.topicKey !== topicKey) {\n return;\n }\n if (data) {\n void fetchSubscriptions({ refetch: true });\n }\n });\n\n const cleanupDeleteResolved = novu.on('subscription.delete.resolved', ({ args }) => {\n const deleteTopicKey = 'subscription' in args ? args.subscription.topicKey : topicKey;\n if (deleteTopicKey !== topicKey) {\n return;\n }\n void fetchSubscriptions({ refetch: true });\n });\n\n void fetchSubscriptions({ refetch: true });\n\n return () => {\n cleanupListPending();\n cleanupListResolved();\n cleanupListUpdated();\n cleanupCreateResolved();\n cleanupDeleteResolved();\n };\n }, [topicKey, novu, fetchSubscriptions, onError, onSuccess]);\n\n const refetch = useCallback(() => {\n return fetchSubscriptions({ refetch: true });\n }, [fetchSubscriptions]);\n\n return {\n subscriptions: data,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAiD;AACjD,0BAAwB;AAmCjB,IAAM,mBAAmB,CAAC,EAAE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K;AAClB,oBAAc,KAAK;AAAA,IACrB,CAAC;AAED,UAAM,qBAAqB,KAAK,GAAG,8BAA8B,CAAC,EAAE,MAAAA,MAAK,MAAM;AAC7E,UAAIA,MAAK,aAAa,UAAU;AAC9B;AAAA,MACF;AACA,cAAQA,MAAK,aAAa;AAAA,IAC5B,CAAC;AAED,UAAM,wBAAwB,KAAK,GAAG,gCAAgC,CAAC,EAAE,MAAM,MAAAA,MAAK,MAAM;AACxF,UAAI,KAAK,aAAa,UAAU;AAC9B;AAAA,MACF;AACA,UAAIA,OAAM;AACR,aAAK,mBAAmB,EAAE,SAAS,KAAK,CAAC;AAAA,MAC3C;AAAA,IACF,CAAC;AAED,UAAM,wBAAwB,KAAK,GAAG,gCAAgC,CAAC,EAAE,KAAK,MAAM;AAClF,YAAM,iBAAiB,kBAAkB,OAAO,KAAK,aAAa,WAAW;AAC7E,UAAI,mBAAmB,UAAU;AAC/B;AAAA,MACF;AACA,WAAK,mBAAmB,EAAE,SAAS,KAAK,CAAC;AAAA,IAC3C,CAAC;AAED,SAAK,mBAAmB,EAAE,SAAS,KAAK,CAAC;AAEzC,WAAO,MAAM;AACX,yBAAmB;AACnB,0BAAoB;AACpB,yBAAmB;AACnB,4BAAsB;AACtB,4BAAsB;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,UAAU,MAAM,oBAAoB,SAAS,SAAS,CAAC;AAE3D,QAAM,cAAU,0BAAY,MAAM;AAChC,WAAO,mBAAmB,EAAE,SAAS,KAAK,CAAC;AAAA,EAC7C,GAAG,CAAC,kBAAkB,CAAC;AAEvB,SAAO;AAAA,IACL,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["data","error"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useTelegramSubscriberLink.ts"],"sourcesContent":["import type {\r\n TelegramSubscriberLinkOptions,\r\n TelegramSubscriberLinkState,\r\n TelegramSubscriberLinkStatus,\r\n} from '@notiflyio/js';\r\nimport { TelegramSubscriberLink } from '@notiflyio/js';\r\nimport { useCallback, useEffect, useRef, useState } from 'react';\r\n\r\nexport type UseTelegramSubscriberLinkProps = TelegramSubscriberLinkOptions;\r\n\r\nexport type UseTelegramSubscriberLinkResult = {\r\n /** Current deep-link URL (`t.me/<bot>?start=<code>`), or `null` before the first issue. */\r\n deepLinkUrl: string | null;\r\n /** Telegram bot username (no `@`), or `null` before the first issue. */\r\n botUsername: string | null;\r\n /** Lifecycle status: `loading` while resolving initial state, `pending` while waiting for Start, `connected` once linked, `expired` briefly before auto-reissue. */\r\n status: TelegramSubscriberLinkStatus;\r\n /** Last error, if any. */\r\n error: Error | null;\r\n /** Re-issue a fresh deep link and restart polling. */\r\n refresh: () => Promise<void>;\r\n};\r\n\r\n/**\r\n * React hook wrapping {@link TelegramSubscriberLink} from `@notiflyio/js`.\r\n *\r\n * Issues a Telegram subscriber-link deep link, polls for connection, and\r\n * re-issues automatically on code expiry. Returns reactive state that\r\n * updates as the lifecycle progresses.\r\n *\r\n * **Important:** The underlying API endpoint requires `INTEGRATION_WRITE` permission.\r\n * Either pass `secretKey` for direct server-side usage, or provide a custom\r\n * `fetchFn` / `apiUrl` that routes through your backend proxy.\r\n *\r\n * @example\r\n * ```tsx\r\n * import { useTelegramSubscriberLink } from '@notiflyio/react';\r\n *\r\n * function TelegramConnect() {\r\n * const { deepLinkUrl, botUsername, status, refresh } = useTelegramSubscriberLink({\r\n * apiUrl: '/api/novu-proxy',\r\n * integrationIdentifier: '<telegram-integration-identifier>',\r\n * subscriberId: 'user-42',\r\n * });\r\n *\r\n * if (status === 'connected') return <p>Connected!</p>;\r\n *\r\n * return (\r\n * <div>\r\n * {deepLinkUrl && <a href={deepLinkUrl}>Open @{botUsername} in Telegram</a>}\r\n * <button onClick={refresh}>Refresh link</button>\r\n * </div>\r\n * );\r\n * }\r\n * ```\r\n */\r\nexport function useTelegramSubscriberLink(props: UseTelegramSubscriberLinkProps): UseTelegramSubscriberLinkResult {\r\n const [state, setState] = useState<TelegramSubscriberLinkState>({\r\n status: 'loading',\r\n deepLinkUrl: null,\r\n botUsername: null,\r\n expiresAt: null,\r\n error: null,\r\n });\r\n\r\n const instanceRef = useRef<TelegramSubscriberLink | null>(null);\r\n\r\n const { apiUrl, secretKey, integrationIdentifier, subscriberId, pollIntervalMs, fetchFn } = props;\r\n\r\n // Keep the latest `fetchFn` in a ref so a new inline-function identity on every\r\n // render does not re-trigger the effect (which would tear down and re-issue the\r\n // link on a loop). The stable wrapper below reads from this ref.\r\n const fetchFnRef = useRef(fetchFn);\r\n fetchFnRef.current = fetchFn;\r\n\r\n const stableFetchFn = useCallback<typeof fetch>((input, init) => {\r\n const fn = fetchFnRef.current ?? fetch;\r\n\r\n return fn(input, init);\r\n }, []);\r\n\r\n useEffect(() => {\r\n const link = new TelegramSubscriberLink({\r\n apiUrl,\r\n secretKey,\r\n integrationIdentifier,\r\n subscriberId,\r\n pollIntervalMs,\r\n fetchFn: stableFetchFn,\r\n });\r\n\r\n instanceRef.current = link;\r\n setState({ ...link.state });\r\n\r\n const unsubscribe = link.onStateChange((next) => {\r\n setState({ ...next });\r\n });\r\n\r\n void link.start();\r\n\r\n return () => {\r\n unsubscribe();\r\n link.stop();\r\n instanceRef.current = null;\r\n };\r\n }, [apiUrl, secretKey, integrationIdentifier, subscriberId, pollIntervalMs, stableFetchFn]);\r\n\r\n const refresh = useCallback(async () => {\r\n if (instanceRef.current) {\r\n await instanceRef.current.refresh();\r\n }\r\n }, []);\r\n\r\n return {\r\n deepLinkUrl: state.deepLinkUrl,\r\n botUsername: state.botUsername,\r\n status: state.status,\r\n error: state.error,\r\n refresh,\r\n };\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,gBAAuC;AACvC,mBAAyD;AAkDlD,SAAS,0BAA0B,OAAwE;AAChH,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAsC;AAAA,IAC9D,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,aAAa;AAAA,IACb,WAAW;AAAA,IACX,OAAO;AAAA,EACT,CAAC;AAED,QAAM,kBAAc,qBAAsC,IAAI;AAE9D,QAAM,EAAE,QAAQ,WAAW,uBAAuB,cAAc,gBAAgB,QAAQ,IAAI;AAK5F,QAAM,iBAAa,qBAAO,OAAO;AACjC,aAAW,UAAU;AAErB,QAAM,oBAAgB,0BAA0B,CAAC,OAAO,SAAS;AAC/D,UAAM,KAAK,WAAW,WAAW;AAEjC,WAAO,GAAG,OAAO,IAAI;AAAA,EACvB,GAAG,CAAC,CAAC;AAEL,8BAAU,MAAM;AACd,UAAM,OAAO,IAAI,iCAAuB;AAAA,MACtC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS;AAAA,IACX,CAAC;AAED,gBAAY,UAAU;AACtB,aAAS,EAAE,GAAG,KAAK,MAAM,CAAC;AAE1B,UAAM,cAAc,KAAK,cAAc,CAAC,SAAS;AAC/C,eAAS,EAAE,GAAG,KAAK,CAAC;AAAA,IACtB,CAAC;AAED,SAAK,KAAK,MAAM;AAEhB,WAAO,MAAM;AACX,kBAAY;AACZ,WAAK,KAAK;AACV,kBAAY,UAAU;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,QAAQ,WAAW,uBAAuB,cAAc,gBAAgB,aAAa,CAAC;AAE1F,QAAM,cAAU,0BAAY,YAAY;AACtC,QAAI,YAAY,SAAS;AACvB,YAAM,YAAY,QAAQ,QAAQ;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO;AAAA,IACL,aAAa,MAAM;AAAA,IACnB,aAAa,MAAM;AAAA,IACnB,QAAQ,MAAM;AAAA,IACd,OAAO,MAAM;AAAA,IACb;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useTelegramSubscriberLink.ts"],"sourcesContent":["import type {\n TelegramSubscriberLinkOptions,\n TelegramSubscriberLinkState,\n TelegramSubscriberLinkStatus,\n} from '@notiflyio/js';\nimport { TelegramSubscriberLink } from '@notiflyio/js';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nexport type UseTelegramSubscriberLinkProps = TelegramSubscriberLinkOptions;\n\nexport type UseTelegramSubscriberLinkResult = {\n /** Current deep-link URL (`t.me/<bot>?start=<code>`), or `null` before the first issue. */\n deepLinkUrl: string | null;\n /** Telegram bot username (no `@`), or `null` before the first issue. */\n botUsername: string | null;\n /** Lifecycle status: `loading` while resolving initial state, `pending` while waiting for Start, `connected` once linked, `expired` briefly before auto-reissue. */\n status: TelegramSubscriberLinkStatus;\n /** Last error, if any. */\n error: Error | null;\n /** Re-issue a fresh deep link and restart polling. */\n refresh: () => Promise<void>;\n};\n\n/**\n * React hook wrapping {@link TelegramSubscriberLink} from `@notiflyio/js`.\n *\n * Issues a Telegram subscriber-link deep link, polls for connection, and\n * re-issues automatically on code expiry. Returns reactive state that\n * updates as the lifecycle progresses.\n *\n * **Important:** The underlying API endpoint requires `INTEGRATION_WRITE` permission.\n * Either pass `secretKey` for direct server-side usage, or provide a custom\n * `fetchFn` / `apiUrl` that routes through your backend proxy.\n *\n * @example\n * ```tsx\n * import { useTelegramSubscriberLink } from '@notiflyio/react';\n *\n * function TelegramConnect() {\n * const { deepLinkUrl, botUsername, status, refresh } = useTelegramSubscriberLink({\n * apiUrl: '/api/novu-proxy',\n * integrationIdentifier: '<telegram-integration-identifier>',\n * subscriberId: 'user-42',\n * });\n *\n * if (status === 'connected') return <p>Connected!</p>;\n *\n * return (\n * <div>\n * {deepLinkUrl && <a href={deepLinkUrl}>Open @{botUsername} in Telegram</a>}\n * <button onClick={refresh}>Refresh link</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useTelegramSubscriberLink(props: UseTelegramSubscriberLinkProps): UseTelegramSubscriberLinkResult {\n const [state, setState] = useState<TelegramSubscriberLinkState>({\n status: 'loading',\n deepLinkUrl: null,\n botUsername: null,\n expiresAt: null,\n error: null,\n });\n\n const instanceRef = useRef<TelegramSubscriberLink | null>(null);\n\n const { apiUrl, secretKey, integrationIdentifier, subscriberId, pollIntervalMs, fetchFn } = props;\n\n // Keep the latest `fetchFn` in a ref so a new inline-function identity on every\n // render does not re-trigger the effect (which would tear down and re-issue the\n // link on a loop). The stable wrapper below reads from this ref.\n const fetchFnRef = useRef(fetchFn);\n fetchFnRef.current = fetchFn;\n\n const stableFetchFn = useCallback<typeof fetch>((input, init) => {\n const fn = fetchFnRef.current ?? fetch;\n\n return fn(input, init);\n }, []);\n\n useEffect(() => {\n const link = new TelegramSubscriberLink({\n apiUrl,\n secretKey,\n integrationIdentifier,\n subscriberId,\n pollIntervalMs,\n fetchFn: stableFetchFn,\n });\n\n instanceRef.current = link;\n setState({ ...link.state });\n\n const unsubscribe = link.onStateChange((next) => {\n setState({ ...next });\n });\n\n void link.start();\n\n return () => {\n unsubscribe();\n link.stop();\n instanceRef.current = null;\n };\n }, [apiUrl, secretKey, integrationIdentifier, subscriberId, pollIntervalMs, stableFetchFn]);\n\n const refresh = useCallback(async () => {\n if (instanceRef.current) {\n await instanceRef.current.refresh();\n }\n }, []);\n\n return {\n deepLinkUrl: state.deepLinkUrl,\n botUsername: state.botUsername,\n status: state.status,\n error: state.error,\n refresh,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,gBAAuC;AACvC,mBAAyD;AAkDlD,SAAS,0BAA0B,OAAwE;AAChH,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAsC;AAAA,IAC9D,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,aAAa;AAAA,IACb,WAAW;AAAA,IACX,OAAO;AAAA,EACT,CAAC;AAED,QAAM,kBAAc,qBAAsC,IAAI;AAE9D,QAAM,EAAE,QAAQ,WAAW,uBAAuB,cAAc,gBAAgB,QAAQ,IAAI;AAK5F,QAAM,iBAAa,qBAAO,OAAO;AACjC,aAAW,UAAU;AAErB,QAAM,oBAAgB,0BAA0B,CAAC,OAAO,SAAS;AAC/D,UAAM,KAAK,WAAW,WAAW;AAEjC,WAAO,GAAG,OAAO,IAAI;AAAA,EACvB,GAAG,CAAC,CAAC;AAEL,8BAAU,MAAM;AACd,UAAM,OAAO,IAAI,iCAAuB;AAAA,MACtC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS;AAAA,IACX,CAAC;AAED,gBAAY,UAAU;AACtB,aAAS,EAAE,GAAG,KAAK,MAAM,CAAC;AAE1B,UAAM,cAAc,KAAK,cAAc,CAAC,SAAS;AAC/C,eAAS,EAAE,GAAG,KAAK,CAAC;AAAA,IACtB,CAAC;AAED,SAAK,KAAK,MAAM;AAEhB,WAAO,MAAM;AACX,kBAAY;AACZ,WAAK,KAAK;AACV,kBAAY,UAAU;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,QAAQ,WAAW,uBAAuB,cAAc,gBAAgB,aAAa,CAAC;AAE1F,QAAM,cAAU,0BAAY,YAAY;AACtC,QAAI,YAAY,SAAS;AACvB,YAAM,YAAY,QAAQ,QAAQ;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO;AAAA,IACL,aAAa,MAAM;AAAA,IACnB,aAAa,MAAM;AAAA,IACnB,QAAQ,MAAM;AAAA,IACd,OAAO,MAAM;AAAA,IACb;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useUpdateSubscription.ts"],"sourcesContent":["import { BaseUpdateSubscriptionArgs, NovuError, TopicSubscription, UpdateSubscriptionArgs } from '@notiflyio/js';\r\nimport { useCallback, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseUpdateSubscriptionProps = {\r\n onSuccess?: (data: TopicSubscription) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\ntype UpdateResult = Promise<{\r\n data?: TopicSubscription | undefined;\r\n error?: NovuError;\r\n}>;\r\n\r\nexport type UseUpdateSubscriptionResult = {\r\n isUpdating: boolean;\r\n error?: NovuError;\r\n update: (args: UpdateSubscriptionArgs) => UpdateResult;\r\n};\r\n\r\nexport const useUpdateSubscription = (props: UseUpdateSubscriptionProps = {}): UseUpdateSubscriptionResult => {\r\n const propsRef = useRef<UseUpdateSubscriptionProps>(props);\r\n propsRef.current = props;\r\n const novu = useNovu();\r\n const [isUpdating, setIsUpdating] = useState(false);\r\n const [error, setError] = useState<NovuError>();\r\n\r\n const update = useCallback(\r\n async (args: UpdateSubscriptionArgs): UpdateResult => {\r\n const { onSuccess, onError } = propsRef.current;\r\n setError(undefined);\r\n setIsUpdating(true);\r\n\r\n const response = await novu.subscriptions.update(args as BaseUpdateSubscriptionArgs);\r\n\r\n setIsUpdating(false);\r\n\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n } else if (response.data) {\r\n onSuccess?.(response.data);\r\n }\r\n\r\n return response;\r\n },\r\n [novu]\r\n );\r\n\r\n return {\r\n update,\r\n isUpdating,\r\n error,\r\n };\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA8C;AAC9C,0BAAwB;AAkBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,eAAW,qBAAmC,KAAK;AACzD,WAAS,UAAU;AACnB,QAAM,WAAO,6BAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAE9C,QAAM,aAAS;AAAA,IACb,OAAO,SAA+C;AACpD,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,OAAO,IAAkC;AAEnF,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,2CAAU,SAAS;AAAA,MACrB,WAAW,SAAS,MAAM;AACxB,+CAAY,SAAS;AAAA,MACvB;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useUpdateSubscription.ts"],"sourcesContent":["import { BaseUpdateSubscriptionArgs, NovuError, TopicSubscription, UpdateSubscriptionArgs } from '@notiflyio/js';\nimport { useCallback, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseUpdateSubscriptionProps = {\n onSuccess?: (data: TopicSubscription) => void;\n onError?: (error: NovuError) => void;\n};\n\ntype UpdateResult = Promise<{\n data?: TopicSubscription | undefined;\n error?: NovuError;\n}>;\n\nexport type UseUpdateSubscriptionResult = {\n isUpdating: boolean;\n error?: NovuError;\n update: (args: UpdateSubscriptionArgs) => UpdateResult;\n};\n\nexport const useUpdateSubscription = (props: UseUpdateSubscriptionProps = {}): UseUpdateSubscriptionResult => {\n const propsRef = useRef<UseUpdateSubscriptionProps>(props);\n propsRef.current = props;\n const novu = useNovu();\n const [isUpdating, setIsUpdating] = useState(false);\n const [error, setError] = useState<NovuError>();\n\n const update = useCallback(\n async (args: UpdateSubscriptionArgs): UpdateResult => {\n const { onSuccess, onError } = propsRef.current;\n setError(undefined);\n setIsUpdating(true);\n\n const response = await novu.subscriptions.update(args as BaseUpdateSubscriptionArgs);\n\n setIsUpdating(false);\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data) {\n onSuccess?.(response.data);\n }\n\n return response;\n },\n [novu]\n );\n\n return {\n update,\n isUpdating,\n error,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA8C;AAC9C,0BAAwB;AAkBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,eAAW,qBAAmC,KAAK;AACzD,WAAS,UAAU;AACnB,QAAM,WAAO,6BAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAE9C,QAAM,aAAS;AAAA,IACb,OAAO,SAA+C;AACpD,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,OAAO,IAAkC;AAEnF,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,2CAAU,SAAS;AAAA,MACrB,WAAW,SAAS,MAAM;AACxB,+CAAY,SAAS;AAAA,MACvB;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type * from '@notiflyio/js';\r\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\r\n\r\nexport type {\r\n AllLocalization,\r\n AllLocalizationKey,\r\n ChannelConnectButtonIconKey,\r\n ElementStyles,\r\n InboxAppearance,\r\n InboxAppearanceCallback,\r\n InboxAppearanceCallbackFunction,\r\n InboxAppearanceCallbackKeys,\r\n InboxAppearanceKey,\r\n InboxElements,\r\n InboxLocalization,\r\n InboxLocalizationKey,\r\n InboxTheme,\r\n NotificationActionClickHandler,\r\n NotificationClickHandler,\r\n NotificationRenderer,\r\n PreferenceGroups,\r\n PreferencesFilter,\r\n RouterPush,\r\n SubscriptionAppearance,\r\n SubscriptionAppearanceCallback,\r\n SubscriptionAppearanceCallbackFunction,\r\n SubscriptionAppearanceCallbackKeys,\r\n SubscriptionAppearanceKey,\r\n SubscriptionElements,\r\n SubscriptionLocalization,\r\n SubscriptionLocalizationKey,\r\n SubscriptionTheme,\r\n Tab,\r\n Variables,\r\n} from '@notiflyio/js/ui';\r\nexport type {\r\n BellProps,\r\n InboxContentProps,\r\n InboxProps,\r\n MsTeamsConnectButtonProps,\r\n MsTeamsLinkUserProps,\r\n NotificationProps,\r\n NovuProviderProps,\r\n SlackConnectButtonProps,\r\n SlackLinkUserProps,\r\n SubscriptionButtonProps,\r\n SubscriptionPreferencesProps,\r\n SubscriptionProps,\r\n TelegramConnectButtonProps,\r\n} from './components';\r\nexport {\r\n Bell,\r\n Inbox,\r\n InboxContent,\r\n MsTeamsConnectButton,\r\n MsTeamsLinkUser,\r\n Notifications,\r\n NovuProvider,\r\n Preferences,\r\n SlackConnectButton,\r\n SlackLinkUser,\r\n Subscription,\r\n SubscriptionButton,\r\n SubscriptionPreferences,\r\n TelegramConnectButton,\r\n} from './components';\r\nexport type {\r\n UseChannelConnectionProps,\r\n UseChannelConnectionResult,\r\n UseChannelConnectionsProps,\r\n UseChannelConnectionsResult,\r\n UseChannelEndpointProps,\r\n UseChannelEndpointResult,\r\n UseCountsProps,\r\n UseCountsResult,\r\n UseCreateChannelEndpointProps,\r\n UseCreateChannelEndpointResult,\r\n UseDeleteChannelEndpointProps,\r\n UseDeleteChannelEndpointResult,\r\n UseNotificationsProps,\r\n UseNotificationsResult,\r\n UsePreferencesResult,\r\n UseScheduleProps as UsePreferencesProps,\r\n UseTelegramSubscriberLinkProps,\r\n UseTelegramSubscriberLinkResult,\r\n} from './hooks';\r\nexport {\r\n useChannelConnection,\r\n useChannelConnections,\r\n useChannelEndpoint,\r\n useCounts,\r\n useCreateChannelEndpoint,\r\n useCreateSubscription,\r\n useDeleteChannelEndpoint,\r\n useNotifications,\r\n useNovu,\r\n usePreferences,\r\n useRemoveSubscription,\r\n useSchedule,\r\n useSubscription,\r\n useSubscriptions,\r\n useTelegramSubscriberLink,\r\n useUpdateSubscription,\r\n} from './hooks';\r\n\r\nexport type {\r\n BaseProps,\r\n BellRenderer,\r\n BodyRenderer,\r\n DefaultInboxProps,\r\n DefaultProps,\r\n NoRendererProps,\r\n NotificationRendererProps,\r\n NotificationsRenderer,\r\n ReactAllAppearance,\r\n ReactInboxAppearance,\r\n ReactInboxTheme,\r\n ReactSubscriptionAppearance,\r\n ReactSubscriptionTheme,\r\n SubjectBodyRendererProps,\r\n SubjectRenderer,\r\n WithChildrenProps,\r\n} from './utils/types';\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAA4E;AAiD5E,wBAeO;AAqBP,mBAiBO;","names":[]} | ||
| {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type * from '@notiflyio/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\n\nexport type {\n AllLocalization,\n AllLocalizationKey,\n ChannelConnectButtonIconKey,\n ElementStyles,\n InboxAppearance,\n InboxAppearanceCallback,\n InboxAppearanceCallbackFunction,\n InboxAppearanceCallbackKeys,\n InboxAppearanceKey,\n InboxElements,\n InboxLocalization,\n InboxLocalizationKey,\n InboxTheme,\n NotificationActionClickHandler,\n NotificationClickHandler,\n NotificationRenderer,\n PreferenceGroups,\n PreferencesFilter,\n RouterPush,\n SubscriptionAppearance,\n SubscriptionAppearanceCallback,\n SubscriptionAppearanceCallbackFunction,\n SubscriptionAppearanceCallbackKeys,\n SubscriptionAppearanceKey,\n SubscriptionElements,\n SubscriptionLocalization,\n SubscriptionLocalizationKey,\n SubscriptionTheme,\n Tab,\n Variables,\n} from '@notiflyio/js/ui';\nexport type {\n BellProps,\n InboxContentProps,\n InboxProps,\n MsTeamsConnectButtonProps,\n MsTeamsLinkUserProps,\n NotificationProps,\n NovuProviderProps,\n SlackConnectButtonProps,\n SlackLinkUserProps,\n SubscriptionButtonProps,\n SubscriptionPreferencesProps,\n SubscriptionProps,\n TelegramConnectButtonProps,\n} from './components';\nexport {\n Bell,\n Inbox,\n InboxContent,\n MsTeamsConnectButton,\n MsTeamsLinkUser,\n Notifications,\n NovuProvider,\n Preferences,\n SlackConnectButton,\n SlackLinkUser,\n Subscription,\n SubscriptionButton,\n SubscriptionPreferences,\n TelegramConnectButton,\n} from './components';\nexport type {\n UseChannelConnectionProps,\n UseChannelConnectionResult,\n UseChannelConnectionsProps,\n UseChannelConnectionsResult,\n UseChannelEndpointProps,\n UseChannelEndpointResult,\n UseCountsProps,\n UseCountsResult,\n UseCreateChannelEndpointProps,\n UseCreateChannelEndpointResult,\n UseDeleteChannelEndpointProps,\n UseDeleteChannelEndpointResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesResult,\n UseScheduleProps as UsePreferencesProps,\n UseTelegramSubscriberLinkProps,\n UseTelegramSubscriberLinkResult,\n} from './hooks';\nexport {\n useChannelConnection,\n useChannelConnections,\n useChannelEndpoint,\n useCounts,\n useCreateChannelEndpoint,\n useCreateSubscription,\n useDeleteChannelEndpoint,\n useNotifications,\n useNovu,\n usePreferences,\n useRemoveSubscription,\n useSchedule,\n useSubscription,\n useSubscriptions,\n useTelegramSubscriberLink,\n useUpdateSubscription,\n} from './hooks';\n\nexport type {\n BaseProps,\n BellRenderer,\n BodyRenderer,\n DefaultInboxProps,\n DefaultProps,\n NoRendererProps,\n NotificationRendererProps,\n NotificationsRenderer,\n ReactAllAppearance,\n ReactInboxAppearance,\n ReactInboxTheme,\n ReactSubscriptionAppearance,\n ReactSubscriptionTheme,\n SubjectBodyRendererProps,\n SubjectRenderer,\n WithChildrenProps,\n} from './utils/types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAA4E;AAiD5E,wBAeO;AAqBP,mBAiBO;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/internal/index.ts"],"sourcesContent":["export { buildSubscriber } from '@notiflyio/js/internal';\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAgC;","names":[]} | ||
| {"version":3,"sources":["../../../src/internal/index.ts"],"sourcesContent":["export { buildSubscriber } from '@notiflyio/js/internal';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAgC;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/server/index.tsx"],"sourcesContent":["import type { InboxProps } from '../components/Inbox';\r\nimport { ShadowRootDetector } from '../components/ShadowRootDetector';\r\nimport type {\r\n UseCreateSubscriptionProps,\r\n UseCreateSubscriptionResult,\r\n UseNotificationsProps,\r\n UseNotificationsResult,\r\n UsePreferencesProps,\r\n UsePreferencesResult,\r\n UseRemoveSubscriptionProps,\r\n UseRemoveSubscriptionResult,\r\n UseScheduleProps,\r\n UseScheduleResult,\r\n UseSubscriptionProps,\r\n UseSubscriptionResult,\r\n UseSubscriptionsProps,\r\n UseSubscriptionsResult,\r\n UseUpdateSubscriptionProps,\r\n UseUpdateSubscriptionResult,\r\n} from '../hooks';\r\nimport type { NovuProviderProps } from '../hooks/NovuProvider';\r\nimport type { UseCountsProps, UseCountsResult } from '../hooks/useCounts';\r\n\r\n/**\r\n * Exporting all components from the components folder\r\n * as empty functions to fix build errors in SSR\r\n * This will be replaced with actual components\r\n * when we implement the SSR components in @notiflyio/js/ui\r\n */\r\nexport function Inbox(props: InboxProps) {\r\n return <ShadowRootDetector />;\r\n}\r\n\r\nexport function InboxContent() {}\r\n\r\nexport function Notifications() {}\r\n\r\nexport function Preferences() {}\r\n\r\nexport function Bell() {}\r\n\r\nexport function NovuProvider(props: NovuProviderProps) {\r\n return <>{props.children}</>;\r\n}\r\n\r\nexport function Subscription() {\r\n return <ShadowRootDetector />;\r\n}\r\n\r\nexport function SubscriptionButton() {}\r\n\r\nexport function SubscriptionPreferences() {}\r\n\r\nexport function SlackConnectButton() {\r\n return <ShadowRootDetector />;\r\n}\r\n\r\nexport function SlackLinkUser() {\r\n return <ShadowRootDetector />;\r\n}\r\n\r\nexport function MsTeamsConnectButton() {\r\n return <ShadowRootDetector />;\r\n}\r\n\r\nexport function MsTeamsLinkUser() {\r\n return <ShadowRootDetector />;\r\n}\r\n\r\nexport function TelegramConnectButton() {\r\n return <ShadowRootDetector />;\r\n}\r\n\r\nexport function useNovu() {\r\n return null;\r\n}\r\n\r\nexport function useCounts(_: UseCountsProps): UseCountsResult {\r\n return {\r\n isLoading: false,\r\n isFetching: false,\r\n refetch: () => Promise.resolve(),\r\n };\r\n}\r\n\r\nexport function useNotifications(_: UseNotificationsProps): UseNotificationsResult {\r\n return {\r\n isLoading: false,\r\n isFetching: false,\r\n hasMore: false,\r\n readAll: () => Promise.resolve({ data: undefined, error: undefined }),\r\n seenAll: () => Promise.resolve({ data: undefined, error: undefined }),\r\n archiveAll: () => Promise.resolve({ data: undefined, error: undefined }),\r\n archiveAllRead: () => Promise.resolve({ data: undefined, error: undefined }),\r\n refetch: () => Promise.resolve(),\r\n fetchMore: () => Promise.resolve(),\r\n };\r\n}\r\n\r\nexport function usePreferences(_: UsePreferencesProps): UsePreferencesResult {\r\n return {\r\n isLoading: false,\r\n isFetching: false,\r\n refetch: () => Promise.resolve(),\r\n };\r\n}\r\n\r\nexport function useSchedule(_: UseScheduleProps): UseScheduleResult {\r\n return {\r\n isLoading: false,\r\n isFetching: false,\r\n refetch: () => Promise.resolve(),\r\n };\r\n}\r\n\r\nexport function useSubscription(_: UseSubscriptionProps): UseSubscriptionResult {\r\n return {\r\n isLoading: false,\r\n isFetching: false,\r\n refetch: () => Promise.resolve(),\r\n };\r\n}\r\n\r\nexport function useCreateSubscription(_: UseCreateSubscriptionProps = {}): UseCreateSubscriptionResult {\r\n return {\r\n isCreating: false,\r\n error: undefined,\r\n create: () => Promise.resolve({ data: undefined, error: undefined }),\r\n };\r\n}\r\n\r\nexport function useUpdateSubscription(_: UseUpdateSubscriptionProps = {}): UseUpdateSubscriptionResult {\r\n return {\r\n isUpdating: false,\r\n error: undefined,\r\n update: () => Promise.resolve({ data: undefined, error: undefined }),\r\n };\r\n}\r\n\r\nexport function useRemoveSubscription(_: UseRemoveSubscriptionProps = {}): UseRemoveSubscriptionResult {\r\n return {\r\n isRemoving: false,\r\n error: undefined,\r\n remove: () => Promise.resolve({ data: undefined, error: undefined }),\r\n };\r\n}\r\n\r\nexport function useSubscriptions(_: UseSubscriptionsProps): UseSubscriptionsResult {\r\n return {\r\n isLoading: false,\r\n isFetching: false,\r\n refetch: () => Promise.resolve(),\r\n };\r\n}\r\n\r\nexport type * from '@notiflyio/js';\r\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\r\n\r\nexport type {\r\n AllLocalization,\r\n AllLocalizationKey,\r\n ElementStyles,\r\n InboxAppearance,\r\n InboxAppearanceCallback,\r\n InboxAppearanceCallbackFunction,\r\n InboxAppearanceCallbackKeys,\r\n InboxAppearanceKey,\r\n InboxElements,\r\n InboxLocalization,\r\n InboxLocalizationKey,\r\n InboxTheme,\r\n NotificationActionClickHandler,\r\n NotificationClickHandler,\r\n NotificationRenderer,\r\n PreferenceGroups,\r\n PreferencesFilter,\r\n RouterPush,\r\n SubscriptionAppearance,\r\n SubscriptionAppearanceCallback,\r\n SubscriptionAppearanceCallbackFunction,\r\n SubscriptionAppearanceCallbackKeys,\r\n SubscriptionAppearanceKey,\r\n SubscriptionElements,\r\n SubscriptionLocalization,\r\n SubscriptionLocalizationKey,\r\n SubscriptionTheme,\r\n Tab,\r\n Variables,\r\n} from '@notiflyio/js/ui';\r\n\r\nexport type { BellProps, InboxContentProps, InboxProps, NotificationProps, NovuProviderProps } from '../components';\r\n\r\nexport type {\r\n UseCountsProps,\r\n UseCountsResult,\r\n UseNotificationsProps,\r\n UseNotificationsResult,\r\n UsePreferencesResult,\r\n UseScheduleProps as UsePreferencesProps,\r\n} from '../hooks';\r\n\r\nexport type {\r\n BaseProps,\r\n BellRenderer,\r\n BodyRenderer,\r\n DefaultInboxProps,\r\n DefaultProps,\r\n NoRendererProps,\r\n NotificationRendererProps,\r\n NotificationsRenderer,\r\n SubjectBodyRendererProps,\r\n SubjectRenderer,\r\n WithChildrenProps,\r\n} from '../utils/types';\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gCAAmC;AA2JnC,gBAA4E;AA9HnE;AADF,SAAS,MAAM,OAAmB;AACvC,SAAO,4CAAC,gDAAmB;AAC7B;AAEO,SAAS,eAAe;AAAC;AAEzB,SAAS,gBAAgB;AAAC;AAE1B,SAAS,cAAc;AAAC;AAExB,SAAS,OAAO;AAAC;AAEjB,SAAS,aAAa,OAA0B;AACrD,SAAO,2EAAG,gBAAM,UAAS;AAC3B;AAEO,SAAS,eAAe;AAC7B,SAAO,4CAAC,gDAAmB;AAC7B;AAEO,SAAS,qBAAqB;AAAC;AAE/B,SAAS,0BAA0B;AAAC;AAEpC,SAAS,qBAAqB;AACnC,SAAO,4CAAC,gDAAmB;AAC7B;AAEO,SAAS,gBAAgB;AAC9B,SAAO,4CAAC,gDAAmB;AAC7B;AAEO,SAAS,uBAAuB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;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,sBAAsB,IAAgC,CAAC,GAAgC;AACrG,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,sBAAsB,IAAgC,CAAC,GAAgC;AACrG,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,iBAAiB,GAAkD;AACjF,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/server/index.tsx"],"sourcesContent":["import type { InboxProps } from '../components/Inbox';\nimport { ShadowRootDetector } from '../components/ShadowRootDetector';\nimport type {\n UseCreateSubscriptionProps,\n UseCreateSubscriptionResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesProps,\n UsePreferencesResult,\n UseRemoveSubscriptionProps,\n UseRemoveSubscriptionResult,\n UseScheduleProps,\n UseScheduleResult,\n UseSubscriptionProps,\n UseSubscriptionResult,\n UseSubscriptionsProps,\n UseSubscriptionsResult,\n UseUpdateSubscriptionProps,\n UseUpdateSubscriptionResult,\n} from '../hooks';\nimport type { NovuProviderProps } from '../hooks/NovuProvider';\nimport type { UseCountsProps, UseCountsResult } from '../hooks/useCounts';\n\n/**\n * Exporting all components from the components folder\n * as empty functions to fix build errors in SSR\n * This will be replaced with actual components\n * when we implement the SSR components in @notiflyio/js/ui\n */\nexport function Inbox(props: InboxProps) {\n return <ShadowRootDetector />;\n}\n\nexport function InboxContent() {}\n\nexport function Notifications() {}\n\nexport function Preferences() {}\n\nexport function Bell() {}\n\nexport function NovuProvider(props: NovuProviderProps) {\n return <>{props.children}</>;\n}\n\nexport function Subscription() {\n return <ShadowRootDetector />;\n}\n\nexport function SubscriptionButton() {}\n\nexport function SubscriptionPreferences() {}\n\nexport function SlackConnectButton() {\n return <ShadowRootDetector />;\n}\n\nexport function SlackLinkUser() {\n return <ShadowRootDetector />;\n}\n\nexport function MsTeamsConnectButton() {\n return <ShadowRootDetector />;\n}\n\nexport function MsTeamsLinkUser() {\n return <ShadowRootDetector />;\n}\n\nexport function TelegramConnectButton() {\n return <ShadowRootDetector />;\n}\n\nexport function useNovu() {\n return null;\n}\n\nexport function useCounts(_: UseCountsProps): UseCountsResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useNotifications(_: UseNotificationsProps): UseNotificationsResult {\n return {\n isLoading: false,\n isFetching: false,\n hasMore: false,\n readAll: () => Promise.resolve({ data: undefined, error: undefined }),\n seenAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAllRead: () => Promise.resolve({ data: undefined, error: undefined }),\n refetch: () => Promise.resolve(),\n fetchMore: () => Promise.resolve(),\n };\n}\n\nexport function usePreferences(_: UsePreferencesProps): UsePreferencesResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useSchedule(_: UseScheduleProps): UseScheduleResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useSubscription(_: UseSubscriptionProps): UseSubscriptionResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useCreateSubscription(_: UseCreateSubscriptionProps = {}): UseCreateSubscriptionResult {\n return {\n isCreating: false,\n error: undefined,\n create: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useUpdateSubscription(_: UseUpdateSubscriptionProps = {}): UseUpdateSubscriptionResult {\n return {\n isUpdating: false,\n error: undefined,\n update: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useRemoveSubscription(_: UseRemoveSubscriptionProps = {}): UseRemoveSubscriptionResult {\n return {\n isRemoving: false,\n error: undefined,\n remove: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useSubscriptions(_: UseSubscriptionsProps): UseSubscriptionsResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport type * from '@notiflyio/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\n\nexport type {\n AllLocalization,\n AllLocalizationKey,\n ElementStyles,\n InboxAppearance,\n InboxAppearanceCallback,\n InboxAppearanceCallbackFunction,\n InboxAppearanceCallbackKeys,\n InboxAppearanceKey,\n InboxElements,\n InboxLocalization,\n InboxLocalizationKey,\n InboxTheme,\n NotificationActionClickHandler,\n NotificationClickHandler,\n NotificationRenderer,\n PreferenceGroups,\n PreferencesFilter,\n RouterPush,\n SubscriptionAppearance,\n SubscriptionAppearanceCallback,\n SubscriptionAppearanceCallbackFunction,\n SubscriptionAppearanceCallbackKeys,\n SubscriptionAppearanceKey,\n SubscriptionElements,\n SubscriptionLocalization,\n SubscriptionLocalizationKey,\n SubscriptionTheme,\n Tab,\n Variables,\n} from '@notiflyio/js/ui';\n\nexport type { BellProps, InboxContentProps, InboxProps, NotificationProps, NovuProviderProps } from '../components';\n\nexport type {\n UseCountsProps,\n UseCountsResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesResult,\n UseScheduleProps as UsePreferencesProps,\n} from '../hooks';\n\nexport type {\n BaseProps,\n BellRenderer,\n BodyRenderer,\n DefaultInboxProps,\n DefaultProps,\n NoRendererProps,\n NotificationRendererProps,\n NotificationsRenderer,\n SubjectBodyRendererProps,\n SubjectRenderer,\n WithChildr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AEO,SAAS,iBAAiB,GAAkD;AACjF,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/themes/index.ts"],"sourcesContent":["export * from '@notiflyio/js/themes';\r\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,2BAAc,iCAAd;","names":[]} | ||
| {"version":3,"sources":["../../../src/themes/index.ts"],"sourcesContent":["export * from '@notiflyio/js/themes';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,2BAAc,iCAAd;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/utils/appearance.ts"],"sourcesContent":["import type { AllAppearance, AllIconKey, AllIconOverrides } from '@notiflyio/js/ui';\r\nimport { MountedElement } from '../context/RendererContext';\r\nimport type { ReactAllAppearance, ReactIconRenderer, ReactInboxAppearance, ReactSubscriptionAppearance } from './types';\r\n\r\nexport function adaptAppearanceForJs(\r\n appearance: ReactInboxAppearance | ReactSubscriptionAppearance | ReactAllAppearance,\r\n mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void\r\n): AllAppearance | undefined {\r\n if (!appearance) {\r\n return undefined;\r\n }\r\n const { icons, ...restAppearance } = appearance;\r\n const jsAppearance = { ...restAppearance } as AllAppearance;\r\n\r\n if (icons) {\r\n const jsIcons: AllIconOverrides = {};\r\n const iconKeys = Object.keys(icons) as Array<AllIconKey>;\r\n\r\n for (const iconKey of iconKeys) {\r\n // @ts-expect-error: cant easily fix this type error\r\n const reactRenderer = icons[iconKey] as ReactIconRenderer;\r\n\r\n if (reactRenderer) {\r\n jsIcons[iconKey] = (el: HTMLDivElement, props: { class?: string }) => {\r\n return mountElement(el, reactRenderer(props));\r\n };\r\n }\r\n }\r\n\r\n // JsAppearance also has .icons directly (from JsTheme part of JsAppearance)\r\n jsAppearance.icons = jsIcons;\r\n } else {\r\n // If original didn't have icons, ensure the clone doesn't either\r\n delete jsAppearance.icons;\r\n }\r\n\r\n return jsAppearance;\r\n}\r\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":[]} | ||
| {"version":3,"sources":["../../../src/utils/appearance.ts"],"sourcesContent":["import type { AllAppearance, AllIconKey, AllIconOverrides } from '@notiflyio/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,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/utils/createContextAndHook.ts"],"sourcesContent":["import React from 'react';\r\n\r\nexport function assertContextExists(contextVal: unknown, msgOrCtx: string | React.Context<any>): asserts contextVal {\r\n if (!contextVal) {\r\n throw typeof msgOrCtx === 'string' ? new Error(msgOrCtx) : new Error(`${msgOrCtx.displayName} not found`);\r\n }\r\n}\r\n\r\ntype Options = { assertCtxFn?: (v: unknown, msg: string) => void };\r\ntype ContextOf<T> = React.Context<{ value: T } | undefined>;\r\ntype UseCtxFn<T> = () => T;\r\n\r\n/**\r\n * Creates and returns a Context and two hooks that return the context value.\r\n * The Context type is derived from the type passed in by the user.\r\n * The first hook returned guarantees that the context exists so the returned value is always CtxValue\r\n * The second hook makes no guarantees, so the returned value can be CtxValue | undefined\r\n */\r\nexport const createContextAndHook = <CtxVal>(\r\n displayName: string,\r\n options?: Options\r\n): [ContextOf<CtxVal>, UseCtxFn<CtxVal>, UseCtxFn<CtxVal | Partial<CtxVal>>] => {\r\n const { assertCtxFn = assertContextExists } = options || {};\r\n const Ctx = React.createContext<{ value: CtxVal } | undefined>(undefined);\r\n Ctx.displayName = displayName;\r\n\r\n const useCtx = () => {\r\n const ctx = React.useContext(Ctx);\r\n assertCtxFn(ctx, `Component must be wrapped with ${Ctx.displayName}`);\r\n\r\n return (ctx as any).value as CtxVal;\r\n };\r\n\r\n const useCtxWithoutGuarantee = () => {\r\n const ctx = React.useContext(Ctx);\r\n\r\n return ctx ? ctx.value : {};\r\n };\r\n\r\n return [Ctx, useCtx, useCtxWithoutGuarantee];\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAEX,SAAS,oBAAoB,YAAqB,UAA2D;AAClH,MAAI,CAAC,YAAY;AACf,UAAM,OAAO,aAAa,WAAW,IAAI,MAAM,QAAQ,IAAI,IAAI,MAAM,GAAG,SAAS,WAAW,YAAY;AAAA,EAC1G;AACF;AAYO,IAAM,uBAAuB,CAClC,aACA,YAC8E;AAC9E,QAAM,EAAE,cAAc,oBAAoB,IAAI,WAAW,CAAC;AAC1D,QAAM,MAAM,aAAAA,QAAM,cAA6C,MAAS;AACxE,MAAI,cAAc;AAElB,QAAM,SAAS,MAAM;AACnB,UAAM,MAAM,aAAAA,QAAM,WAAW,GAAG;AAChC,gBAAY,KAAK,kCAAkC,IAAI,WAAW,EAAE;AAEpE,WAAQ,IAAY;AAAA,EACtB;AAEA,QAAM,yBAAyB,MAAM;AACnC,UAAM,MAAM,aAAAA,QAAM,WAAW,GAAG;AAEhC,WAAO,MAAM,IAAI,QAAQ,CAAC;AAAA,EAC5B;AAEA,SAAO,CAAC,KAAK,QAAQ,sBAAsB;AAC7C;","names":["React"]} | ||
| {"version":3,"sources":["../../../src/utils/createContextAndHook.ts"],"sourcesContent":["import React from 'react';\n\nexport function assertContextExists(contextVal: unknown, msgOrCtx: string | React.Context<any>): asserts contextVal {\n if (!contextVal) {\n throw typeof msgOrCtx === 'string' ? new Error(msgOrCtx) : new Error(`${msgOrCtx.displayName} not found`);\n }\n}\n\ntype Options = { assertCtxFn?: (v: unknown, msg: string) => void };\ntype ContextOf<T> = React.Context<{ value: T } | undefined>;\ntype UseCtxFn<T> = () => T;\n\n/**\n * Creates and returns a Context and two hooks that return the context value.\n * The Context type is derived from the type passed in by the user.\n * The first hook returned guarantees that the context exists so the returned value is always CtxValue\n * The second hook makes no guarantees, so the returned value can be CtxValue | undefined\n */\nexport const createContextAndHook = <CtxVal>(\n displayName: string,\n options?: Options\n): [ContextOf<CtxVal>, UseCtxFn<CtxVal>, UseCtxFn<CtxVal | Partial<CtxVal>>] => {\n const { assertCtxFn = assertContextExists } = options || {};\n const Ctx = React.createContext<{ value: CtxVal } | undefined>(undefined);\n Ctx.displayName = displayName;\n\n const useCtx = () => {\n const ctx = React.useContext(Ctx);\n assertCtxFn(ctx, `Component must be wrapped with ${Ctx.displayName}`);\n\n return (ctx as any).value as CtxVal;\n };\n\n const useCtxWithoutGuarantee = () => {\n const ctx = React.useContext(Ctx);\n\n return ctx ? ctx.value : {};\n };\n\n return [Ctx, useCtx, useCtxWithoutGuarantee];\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAEX,SAAS,oBAAoB,YAAqB,UAA2D;AAClH,MAAI,CAAC,YAAY;AACf,UAAM,OAAO,aAAa,WAAW,IAAI,MAAM,QAAQ,IAAI,IAAI,MAAM,GAAG,SAAS,WAAW,YAAY;AAAA,EAC1G;AACF;AAYO,IAAM,uBAAuB,CAClC,aACA,YAC8E;AAC9E,QAAM,EAAE,cAAc,oBAAoB,IAAI,WAAW,CAAC;AAC1D,QAAM,MAAM,aAAAA,QAAM,cAA6C,MAAS;AACxE,MAAI,cAAc;AAElB,QAAM,SAAS,MAAM;AACnB,UAAM,MAAM,aAAAA,QAAM,WAAW,GAAG;AAChC,gBAAY,KAAK,kCAAkC,IAAI,WAAW,EAAE;AAEpE,WAAQ,IAAY;AAAA,EACtB;AAEA,QAAM,yBAAyB,MAAM;AACnC,UAAM,MAAM,aAAAA,QAAM,WAAW,GAAG;AAEhC,WAAO,MAAM,IAAI,QAAQ,CAAC;AAAA,EAC5B;AAEA,SAAO,CAAC,KAAK,QAAQ,sBAAsB;AAC7C;","names":["React"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/utils/requestLock.ts"],"sourcesContent":["export function requestLock(id: string, cb: (id: string) => void) {\r\n // Check if the Lock API is available\r\n if (!('locks' in navigator)) {\r\n // If Lock API is not available, immediately invoke the callback and return a no-op function\r\n cb(id);\r\n\r\n return () => {};\r\n }\r\n\r\n let isFulfilled = false;\r\n let promiseResolve: () => void;\r\n\r\n const promise = new Promise<void>((resolve) => {\r\n promiseResolve = resolve;\r\n });\r\n\r\n navigator.locks.request(id, () => {\r\n if (!isFulfilled) {\r\n cb(id);\r\n }\r\n\r\n return promise;\r\n });\r\n\r\n return () => {\r\n isFulfilled = true;\r\n promiseResolve();\r\n };\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,YAAY,IAAY,IAA0B;AAEhE,MAAI,EAAE,WAAW,YAAY;AAE3B,OAAG,EAAE;AAEL,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AAEA,MAAI,cAAc;AAClB,MAAI;AAEJ,QAAM,UAAU,IAAI,QAAc,CAAC,YAAY;AAC7C,qBAAiB;AAAA,EACnB,CAAC;AAED,YAAU,MAAM,QAAQ,IAAI,MAAM;AAChC,QAAI,CAAC,aAAa;AAChB,SAAG,EAAE;AAAA,IACP;AAEA,WAAO;AAAA,EACT,CAAC;AAED,SAAO,MAAM;AACX,kBAAc;AACd,mBAAe;AAAA,EACjB;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/utils/requestLock.ts"],"sourcesContent":["export function requestLock(id: string, cb: (id: string) => void) {\n // Check if the Lock API is available\n if (!('locks' in navigator)) {\n // If Lock API is not available, immediately invoke the callback and return a no-op function\n cb(id);\n\n return () => {};\n }\n\n let isFulfilled = false;\n let promiseResolve: () => void;\n\n const promise = new Promise<void>((resolve) => {\n promiseResolve = resolve;\n });\n\n navigator.locks.request(id, () => {\n if (!isFulfilled) {\n cb(id);\n }\n\n return promise;\n });\n\n return () => {\n isFulfilled = true;\n promiseResolve();\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,YAAY,IAAY,IAA0B;AAEhE,MAAI,EAAE,WAAW,YAAY;AAE3B,OAAG,EAAE;AAEL,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AAEA,MAAI,cAAc;AAClB,MAAI;AAEJ,QAAM,UAAU,IAAI,QAAc,CAAC,YAAY;AAC7C,qBAAiB;AAAA,EACnB,CAAC;AAED,YAAU,MAAM,QAAQ,IAAI,MAAM;AAChC,QAAI,CAAC,aAAa;AAChB,SAAG,EAAE;AAAA,IACP;AAEA,WAAO;AAAA,EACT,CAAC;AAED,SAAO,MAAM;AACX,kBAAc;AACd,mBAAe;AAAA,EACjB;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/utils/types.ts"],"sourcesContent":["import type { Context, DefaultSchedule, NovuSocketOptions, Subscriber, UnreadCount } from '@notiflyio/js';\r\nimport type {\r\n AllIconKey,\r\n AllTheme,\r\n InboxIconKey,\r\n InboxLocalization,\r\n InboxProps,\r\n InboxTheme,\r\n Notification,\r\n NotificationActionClickHandler,\r\n NotificationClickHandler,\r\n PreferenceGroups,\r\n PreferencesFilter,\r\n PreferencesSort,\r\n RouterPush,\r\n SubscriptionIconKey,\r\n SubscriptionTheme,\r\n Tab,\r\n} from '@notiflyio/js/ui';\r\nimport type { ReactNode } from 'react';\r\n\r\nexport type NotificationsRenderer = (notification: Notification) => React.ReactNode;\r\nexport type AvatarRenderer = (notification: Notification) => React.ReactNode;\r\nexport type SubjectRenderer = (notification: Notification) => React.ReactNode;\r\nexport type BodyRenderer = (notification: Notification) => React.ReactNode;\r\nexport type DefaultActionsRenderer = (notification: Notification) => React.ReactNode;\r\nexport type CustomActionsRenderer = (notification: Notification) => React.ReactNode;\r\nexport type BellRenderer = (unreadCount: UnreadCount) => React.ReactNode;\r\n\r\nexport type ReactIconRendererProps = { class?: string };\r\nexport type ReactIconRenderer = (props: ReactIconRendererProps) => ReactNode;\r\n\r\nexport type ReactInboxIconOverrides = {\r\n [key in InboxIconKey]?: ReactIconRenderer;\r\n};\r\n\r\nexport type ReactInboxTheme = Omit<InboxTheme, 'icons'> & {\r\n icons?: ReactInboxIconOverrides;\r\n};\r\n\r\nexport type ReactSubscriptionIconOverrides = {\r\n [key in SubscriptionIconKey]?: ReactIconRenderer;\r\n};\r\n\r\nexport type ReactSubscriptionTheme = Omit<SubscriptionTheme, 'icons'> & {\r\n icons?: ReactSubscriptionIconOverrides;\r\n};\r\n\r\nexport type ReactAllIconOverrides = {\r\n [key in AllIconKey]?: ReactIconRenderer;\r\n};\r\n\r\nexport type ReactAllTheme = Omit<AllTheme, 'icons'> & {\r\n icons?: ReactAllIconOverrides;\r\n};\r\n\r\nexport type ReactInboxAppearance = ReactInboxTheme & {\r\n baseTheme?: InboxTheme | InboxTheme[];\r\n};\r\n\r\nexport type ReactSubscriptionAppearance = ReactSubscriptionTheme & {\r\n baseTheme?: SubscriptionTheme | SubscriptionTheme[];\r\n};\r\n\r\nexport type ReactAllAppearance = ReactAllTheme & {\r\n baseTheme?: ReactAllTheme | ReactAllTheme[];\r\n};\r\n\r\nexport type DefaultInboxProps = {\r\n open?: boolean;\r\n renderNotification?: NotificationsRenderer;\r\n renderAvatar?: AvatarRenderer;\r\n renderSubject?: SubjectRenderer;\r\n renderBody?: BodyRenderer;\r\n renderDefaultActions?: DefaultActionsRenderer;\r\n renderCustomActions?: CustomActionsRenderer;\r\n renderBell?: BellRenderer;\r\n onNotificationClick?: NotificationClickHandler;\r\n onPrimaryActionClick?: NotificationActionClickHandler;\r\n onSecondaryActionClick?: NotificationActionClickHandler;\r\n placement?: InboxProps['placement'];\r\n placementOffset?: InboxProps['placementOffset'];\r\n};\r\n\r\ntype StandardBaseProps = {\r\n subscriberHash?: string;\r\n contextHash?: string;\r\n backendUrl?: string;\r\n socketUrl?: string;\r\n socketOptions?: NovuSocketOptions;\r\n appearance?: ReactInboxAppearance;\r\n localization?: InboxLocalization;\r\n tabs?: Array<Tab>;\r\n preferencesFilter?: PreferencesFilter;\r\n preferenceGroups?: PreferenceGroups;\r\n preferencesSort?: PreferencesSort;\r\n defaultSchedule?: DefaultSchedule;\r\n routerPush?: RouterPush;\r\n context?: Context;\r\n} & (\r\n | {\r\n // TODO: Backward compatibility support - remove in future versions (see NV-5801)\r\n /** @deprecated Use subscriber prop instead */\r\n subscriberId: string;\r\n subscriber?: never;\r\n applicationIdentifier: string;\r\n }\r\n | {\r\n subscriber: Subscriber | string;\r\n subscriberId?: never;\r\n applicationIdentifier: string;\r\n }\r\n | {\r\n // Keyless mode - no subscriber or subscriberId or applicationIdentifier\r\n subscriber?: never;\r\n subscriberId?: never;\r\n applicationIdentifier?: never;\r\n }\r\n);\r\n\r\ntype InboxBaseProps = Omit<StandardBaseProps, 'appearance'> & {\r\n appearance?: ReactInboxAppearance;\r\n};\r\n\r\nexport type BaseProps = InboxBaseProps;\r\n\r\nexport type NotificationRendererProps = {\r\n renderNotification: NotificationsRenderer;\r\n renderAvatar?: never;\r\n renderSubject?: never;\r\n renderBody?: never;\r\n renderDefaultActions?: never;\r\n renderCustomActions?: never;\r\n};\r\n\r\nexport type SubjectBodyRendererProps = {\r\n renderNotification?: never;\r\n renderAvatar?: AvatarRenderer;\r\n renderSubject?: SubjectRenderer;\r\n renderBody?: BodyRenderer;\r\n renderDefaultActions?: DefaultActionsRenderer;\r\n renderCustomActions?: CustomActionsRenderer;\r\n};\r\n\r\nexport type NoRendererProps = {\r\n renderNotification?: undefined;\r\n renderAvatar?: undefined;\r\n renderSubject?: undefined;\r\n renderBody?: undefined;\r\n renderDefaultActions?: undefined;\r\n renderCustomActions?: undefined;\r\n};\r\n\r\nexport type DefaultProps = BaseProps &\r\n DefaultInboxProps & {\r\n children?: never;\r\n } & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);\r\n\r\nexport type WithChildrenProps = BaseProps & {\r\n children: React.ReactNode;\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]} | ||
| {"version":3,"sources":["../../../src/utils/types.ts"],"sourcesContent":["import type { Context, DefaultSchedule, NovuSocketOptions, Subscriber, UnreadCount } from '@notiflyio/js';\nimport type {\n AllIconKey,\n AllTheme,\n InboxIconKey,\n InboxLocalization,\n InboxProps,\n InboxTheme,\n Notification,\n NotificationActionClickHandler,\n NotificationClickHandler,\n PreferenceGroups,\n PreferencesFilter,\n PreferencesSort,\n RouterPush,\n SubscriptionIconKey,\n SubscriptionTheme,\n Tab,\n} from '@notiflyio/js/ui';\nimport type { ReactNode } from 'react';\n\nexport type NotificationsRenderer = (notification: Notification) => React.ReactNode;\nexport type AvatarRenderer = (notification: Notification) => React.ReactNode;\nexport type SubjectRenderer = (notification: Notification) => React.ReactNode;\nexport type BodyRenderer = (notification: Notification) => React.ReactNode;\nexport type DefaultActionsRenderer = (notification: Notification) => React.ReactNode;\nexport type CustomActionsRenderer = (notification: Notification) => React.ReactNode;\nexport type BellRenderer = (unreadCount: UnreadCount) => React.ReactNode;\n\nexport type ReactIconRendererProps = { class?: string };\nexport type ReactIconRenderer = (props: ReactIconRendererProps) => ReactNode;\n\nexport type ReactInboxIconOverrides = {\n [key in InboxIconKey]?: ReactIconRenderer;\n};\n\nexport type ReactInboxTheme = Omit<InboxTheme, 'icons'> & {\n icons?: ReactInboxIconOverrides;\n};\n\nexport type ReactSubscriptionIconOverrides = {\n [key in SubscriptionIconKey]?: ReactIconRenderer;\n};\n\nexport type ReactSubscriptionTheme = Omit<SubscriptionTheme, 'icons'> & {\n icons?: ReactSubscriptionIconOverrides;\n};\n\nexport type ReactAllIconOverrides = {\n [key in AllIconKey]?: ReactIconRenderer;\n};\n\nexport type ReactAllTheme = Omit<AllTheme, 'icons'> & {\n icons?: ReactAllIconOverrides;\n};\n\nexport type ReactInboxAppearance = ReactInboxTheme & {\n baseTheme?: InboxTheme | InboxTheme[];\n};\n\nexport type ReactSubscriptionAppearance = ReactSubscriptionTheme & {\n baseTheme?: SubscriptionTheme | SubscriptionTheme[];\n};\n\nexport type ReactAllAppearance = ReactAllTheme & {\n baseTheme?: ReactAllTheme | ReactAllTheme[];\n};\n\nexport type DefaultInboxProps = {\n open?: boolean;\n renderNotification?: NotificationsRenderer;\n renderAvatar?: AvatarRenderer;\n renderSubject?: SubjectRenderer;\n renderBody?: BodyRenderer;\n renderDefaultActions?: DefaultActionsRenderer;\n renderCustomActions?: CustomActionsRenderer;\n renderBell?: BellRenderer;\n onNotificationClick?: NotificationClickHandler;\n onPrimaryActionClick?: NotificationActionClickHandler;\n onSecondaryActionClick?: NotificationActionClickHandler;\n placement?: InboxProps['placement'];\n placementOffset?: InboxProps['placementOffset'];\n};\n\ntype StandardBaseProps = {\n subscriberHash?: string;\n contextHash?: string;\n backendUrl?: string;\n socketUrl?: string;\n socketOptions?: NovuSocketOptions;\n appearance?: ReactInboxAppearance;\n localization?: InboxLocalization;\n tabs?: Array<Tab>;\n preferencesFilter?: PreferencesFilter;\n preferenceGroups?: PreferenceGroups;\n preferencesSort?: PreferencesSort;\n defaultSchedule?: DefaultSchedule;\n routerPush?: RouterPush;\n context?: Context;\n} & (\n | {\n // TODO: Backward compatibility support - remove in future versions (see NV-5801)\n /** @deprecated Use subscriber prop instead */\n subscriberId: string;\n subscriber?: never;\n applicationIdentifier: string;\n }\n | {\n subscriber: Subscriber | string;\n subscriberId?: never;\n applicationIdentifier: string;\n }\n | {\n // Keyless mode - no subscriber or subscriberId or applicationIdentifier\n subscriber?: never;\n subscriberId?: never;\n applicationIdentifier?: never;\n }\n);\n\ntype InboxBaseProps = Omit<StandardBaseProps, 'appearance'> & {\n appearance?: ReactInboxAppearance;\n};\n\nexport type BaseProps = InboxBaseProps;\n\nexport type NotificationRendererProps = {\n renderNotification: NotificationsRenderer;\n renderAvatar?: never;\n renderSubject?: never;\n renderBody?: never;\n renderDefaultActions?: never;\n renderCustomActions?: never;\n};\n\nexport type SubjectBodyRendererProps = {\n renderNotification?: never;\n renderAvatar?: AvatarRenderer;\n renderSubject?: SubjectRenderer;\n renderBody?: BodyRenderer;\n renderDefaultActions?: DefaultActionsRenderer;\n renderCustomActions?: CustomActionsRenderer;\n};\n\nexport type NoRendererProps = {\n renderNotification?: undefined;\n renderAvatar?: undefined;\n renderSubject?: undefined;\n renderBody?: undefined;\n renderDefaultActions?: undefined;\n renderCustomActions?: undefined;\n};\n\nexport type DefaultProps = BaseProps &\n DefaultInboxProps & {\n children?: never;\n } & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);\n\nexport type WithChildrenProps = BaseProps & {\n children: React.ReactNode;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/Bell.tsx"],"sourcesContent":["import React from 'react';\r\nimport { useNovuUI } from '../context/NovuUIContext';\r\nimport { useRenderer } from '../context/RendererContext';\r\nimport { BellRenderer } from '../utils/types';\r\nimport { Mounter } from './Mounter';\r\nimport { withRenderer } from './Renderer';\r\n\r\nexport type BellProps = {\r\n renderBell?: BellRenderer;\r\n};\r\n\r\nconst _Bell = React.memo((props: BellProps) => {\r\n const { renderBell } = props;\r\n const { novuUI } = useNovuUI();\r\n const { mountElement } = useRenderer();\r\n\r\n const mount = React.useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'Bell',\r\n element,\r\n props: renderBell\r\n ? {\r\n renderBell: (el, unreadCount) => mountElement(el, renderBell(unreadCount)),\r\n }\r\n : undefined,\r\n });\r\n },\r\n [renderBell, mountElement, novuUI]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n});\r\n\r\nexport const Bell = withRenderer(_Bell);\r\n"],"mappings":";AAAA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAE5B,SAAS,eAAe;AACxB,SAAS,oBAAoB;AA0BpB;AApBT,IAAM,QAAQ,MAAM,KAAK,CAAC,UAAqB;AAC7C,QAAM,EAAE,WAAW,IAAI;AACvB,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,EAAE,aAAa,IAAI,YAAY;AAErC,QAAM,QAAQ,MAAM;AAAA,IAClB,CAAC,YAAyB;AACxB,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN;AAAA,QACA,OAAO,aACH;AAAA,UACE,YAAY,CAAC,IAAI,gBAAgB,aAAa,IAAI,WAAW,WAAW,CAAC;AAAA,QAC3E,IACA;AAAA,MACN,CAAC;AAAA,IACH;AAAA,IACA,CAAC,YAAY,cAAc,MAAM;AAAA,EACnC;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC,CAAC;AAEM,IAAM,OAAO,aAAa,KAAK;","names":[]} | ||
| {"version":3,"sources":["../../../src/components/Bell.tsx"],"sourcesContent":["import React from 'react';\nimport { useNovuUI } from '../context/NovuUIContext';\nimport { useRenderer } from '../context/RendererContext';\nimport { BellRenderer } from '../utils/types';\nimport { Mounter } from './Mounter';\nimport { withRenderer } from './Renderer';\n\nexport type BellProps = {\n renderBell?: BellRenderer;\n};\n\nconst _Bell = React.memo((props: BellProps) => {\n const { renderBell } = props;\n const { novuUI } = useNovuUI();\n const { mountElement } = useRenderer();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'Bell',\n element,\n props: renderBell\n ? {\n renderBell: (el, unreadCount) => mountElement(el, renderBell(unreadCount)),\n }\n : undefined,\n });\n },\n [renderBell, mountElement, novuUI]\n );\n\n return <Mounter mount={mount} />;\n});\n\nexport const Bell = withRenderer(_Bell);\n"],"mappings":";AAAA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAE5B,SAAS,eAAe;AACxB,SAAS,oBAAoB;AA0BpB;AApBT,IAAM,QAAQ,MAAM,KAAK,CAAC,UAAqB;AAC7C,QAAM,EAAE,WAAW,IAAI;AACvB,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,EAAE,aAAa,IAAI,YAAY;AAErC,QAAM,QAAQ,MAAM;AAAA,IAClB,CAAC,YAAyB;AACxB,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN;AAAA,QACA,OAAO,aACH;AAAA,UACE,YAAY,CAAC,IAAI,gBAAgB,aAAa,IAAI,WAAW,WAAW,CAAC;AAAA,QAC3E,IACA;AAAA,MACN,CAAC;AAAA,IACH;AAAA,IACA,CAAC,YAAY,cAAc,MAAM;AAAA,EACnC;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC,CAAC;AAEM,IAAM,OAAO,aAAa,KAAK;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/connect-chat/ConnectChat.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\nimport { useNovu } from '../../hooks/NovuProvider';\r\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\r\nimport { withRenderer } from '../Renderer';\r\nimport { DefaultConnectChat, DefaultConnectChatProps } from './DefaultConnectChat';\r\n\r\nexport type ConnectChatProps = DefaultConnectChatProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\r\n\r\nconst ConnectChatInternal = withRenderer<ConnectChatProps>((props) => {\r\n const { container, appearance, ...defaultProps } = props;\r\n const novu = useNovu();\r\n\r\n const options: NovuUIOptions = useMemo(() => {\r\n return {\r\n container,\r\n appearance,\r\n options: novu.options,\r\n };\r\n }, [container, appearance, novu.options]);\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultConnectChat {...defaultProps} />\r\n </NovuUI>\r\n );\r\n});\r\n\r\nConnectChatInternal.displayName = 'ConnectChatInternal';\r\n\r\nexport const ConnectChat = React.memo((props: ConnectChatProps) => {\r\n return <ConnectChatInternal {...props} />;\r\n});\r\n\r\nConnectChat.displayName = 'ConnectChat';\r\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":[]} | ||
| {"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":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/connect-chat/DefaultConnectChat.tsx"],"sourcesContent":["import { ConnectChatProps } from '@notiflyio/js/ui';\r\nimport { useCallback } from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type DefaultConnectChatProps = Pick<\r\n ConnectChatProps,\r\n | 'integrationIdentifier'\r\n | 'connectionIdentifier'\r\n | 'subscriberId'\r\n | 'context'\r\n | 'scope'\r\n | 'connectionMode'\r\n | 'onConnectSuccess'\r\n | 'onConnectError'\r\n | 'onDisconnectSuccess'\r\n | 'onDisconnectError'\r\n>;\r\n\r\nexport const DefaultConnectChat = (props: DefaultConnectChatProps) => {\r\n const {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'ConnectChat',\r\n props: {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n },\r\n element,\r\n });\r\n },\r\n [\r\n novuUI,\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\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":[]} | ||
| {"version":3,"sources":["../../../../src/components/connect-chat/DefaultConnectChat.tsx"],"sourcesContent":["import { ConnectChatProps } from '@notiflyio/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,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/Inbox.tsx"],"sourcesContent":["import { StandardNovuOptions } from '@notiflyio/js';\r\nimport { buildSubscriber } from '@notiflyio/js/internal';\r\nimport React, { useMemo } from 'react';\r\nimport { useNovuUI } from '../context/NovuUIContext';\r\nimport { useRenderer } from '../context/RendererContext';\r\nimport { InternalNovuProvider, useNovu, useUnsafeNovu } from '../hooks/NovuProvider';\r\nimport { DefaultInboxProps, DefaultProps, WithChildrenProps } from '../utils/types';\r\nimport { Mounter } from './Mounter';\r\nimport { NovuUI } from './NovuUI';\r\nimport { withRenderer } from './Renderer';\r\n\r\nexport type InboxProps = DefaultProps | WithChildrenProps;\r\n\r\nconst DefaultInbox = (props: DefaultInboxProps) => {\r\n const {\r\n open,\r\n renderNotification,\r\n renderAvatar,\r\n renderSubject,\r\n renderBody,\r\n renderDefaultActions,\r\n renderCustomActions,\r\n renderBell,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n placement,\r\n placementOffset,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n const { mountElement } = useRenderer();\r\n\r\n const mount = React.useCallback(\r\n (element: HTMLElement) => {\r\n if (renderNotification) {\r\n return novuUI.mountComponent({\r\n name: 'Inbox',\r\n props: {\r\n open,\r\n renderNotification: renderNotification\r\n ? (el, notification) => mountElement(el, renderNotification(notification))\r\n : undefined,\r\n renderBell: renderBell ? (el, unreadCount) => mountElement(el, renderBell(unreadCount)) : undefined,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n placementOffset,\r\n placement,\r\n },\r\n element,\r\n });\r\n }\r\n\r\n return novuUI.mountComponent({\r\n name: 'Inbox',\r\n props: {\r\n open,\r\n renderAvatar: renderAvatar ? (el, notification) => mountElement(el, renderAvatar(notification)) : undefined,\r\n renderSubject: renderSubject\r\n ? (el, notification) => mountElement(el, renderSubject(notification))\r\n : undefined,\r\n renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : undefined,\r\n renderDefaultActions: renderDefaultActions\r\n ? (el, notification) => mountElement(el, renderDefaultActions(notification))\r\n : undefined,\r\n renderCustomActions: renderCustomActions\r\n ? (el, notification) => mountElement(el, renderCustomActions(notification))\r\n : undefined,\r\n renderBell: renderBell ? (el, unreadCount) => mountElement(el, renderBell(unreadCount)) : undefined,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n placementOffset,\r\n placement,\r\n },\r\n element,\r\n });\r\n },\r\n [\r\n open,\r\n renderNotification,\r\n renderAvatar,\r\n renderSubject,\r\n renderBody,\r\n renderDefaultActions,\r\n renderCustomActions,\r\n renderBell,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n\r\nexport const Inbox = React.memo((props: InboxProps) => {\r\n const { subscriberId, ...propsWithoutSubscriberId } = props;\r\n const subscriber = useMemo(\r\n () => buildSubscriber({ subscriberId: props.subscriberId, subscriber: props.subscriber }),\r\n [props.subscriberId, props.subscriber]\r\n );\r\n const applicationIdentifier = props.applicationIdentifier ? props.applicationIdentifier : ''; // for keyless we provide an empty string, the api will generate a identifier\r\n const novu = useUnsafeNovu();\r\n\r\n if (novu) {\r\n return (\r\n <InboxChild {...propsWithoutSubscriberId} applicationIdentifier={applicationIdentifier} subscriber={subscriber} />\r\n );\r\n }\r\n\r\n const providerProps = {\r\n applicationIdentifier,\r\n subscriberHash: props.subscriberHash,\r\n contextHash: props.contextHash,\r\n backendUrl: props.backendUrl,\r\n socketUrl: props.socketUrl,\r\n socketOptions: props.socketOptions,\r\n subscriber,\r\n defaultSchedule: props.defaultSchedule,\r\n context: props.context,\r\n } satisfies StandardNovuOptions;\r\n\r\n return (\r\n <InternalNovuProvider {...providerProps}>\r\n <InboxChild {...propsWithoutSubscriberId} applicationIdentifier={applicationIdentifier} subscriber={subscriber} />\r\n </InternalNovuProvider>\r\n );\r\n});\r\n\r\nconst InboxChild = withRenderer(\r\n React.memo((props: InboxProps) => {\r\n const {\r\n localization,\r\n appearance,\r\n tabs,\r\n preferencesFilter,\r\n preferenceGroups,\r\n preferencesSort,\r\n routerPush,\r\n applicationIdentifier = '', // for keyless we provide an empty string, the api will generate a identifier\r\n subscriberId,\r\n subscriberHash,\r\n contextHash,\r\n backendUrl,\r\n socketUrl,\r\n socketOptions,\r\n subscriber,\r\n defaultSchedule,\r\n context,\r\n } = props;\r\n const novu = useNovu();\r\n\r\n const options = useMemo(() => {\r\n return {\r\n localization,\r\n appearance,\r\n tabs,\r\n preferencesFilter,\r\n preferenceGroups,\r\n preferencesSort,\r\n routerPush,\r\n options: {\r\n applicationIdentifier,\r\n subscriberHash,\r\n contextHash,\r\n backendUrl,\r\n socketUrl,\r\n socketOptions,\r\n subscriber: buildSubscriber({ subscriberId, subscriber }),\r\n defaultSchedule,\r\n context,\r\n },\r\n };\r\n }, [\r\n localization,\r\n appearance,\r\n tabs,\r\n preferencesFilter,\r\n preferenceGroups,\r\n preferencesSort,\r\n applicationIdentifier,\r\n subscriberId,\r\n subscriberHash,\r\n contextHash,\r\n backendUrl,\r\n socketUrl,\r\n socketOptions,\r\n subscriber,\r\n context,\r\n ]);\r\n\r\n if (isWithChildrenProps(props)) {\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n {props.children}\r\n </NovuUI>\r\n );\r\n }\r\n\r\n const {\r\n open,\r\n renderNotification,\r\n renderAvatar,\r\n renderSubject,\r\n renderBody,\r\n renderDefaultActions,\r\n renderCustomActions,\r\n renderBell,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n placementOffset,\r\n placement,\r\n } = props;\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultInbox\r\n open={open}\r\n renderNotification={renderNotification}\r\n renderAvatar={renderAvatar}\r\n renderSubject={renderSubject}\r\n renderBody={renderBody}\r\n renderDefaultActions={renderDefaultActions}\r\n renderCustomActions={renderCustomActions}\r\n renderBell={renderBell}\r\n onNotificationClick={onNotificationClick}\r\n onPrimaryActionClick={onPrimaryActionClick}\r\n onSecondaryActionClick={onSecondaryActionClick}\r\n placement={placement}\r\n placementOffset={placementOffset}\r\n />\r\n </NovuUI>\r\n );\r\n })\r\n);\r\n\r\nInboxChild.displayName = 'InboxChild';\r\n\r\nfunction isWithChildrenProps(props: InboxProps): props is WithChildrenProps {\r\n return 'children' in props;\r\n}\r\n"],"mappings":";AACA,SAAS,uBAAuB;AAChC,OAAO,SAAS,eAAe;AAC/B,SAAS,iBAAiB;AAC1B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AC;AACH;AAEA,WAAW,cAAc;AAEzB,SAAS,oBAAoB,OAA+C;AAC1E,SAAO,cAAc;AACvB;","names":[]} | ||
| {"version":3,"sources":["../../../src/components/Inbox.tsx"],"sourcesContent":["import { StandardNovuOptions } from '@notiflyio/js';\nimport { buildSubscriber } from '@notiflyio/js/internal';\nimport React, { useMemo } from 'react';\nimport { useNovuUI } from '../context/NovuUIContext';\nimport { useRenderer } from '../context/RendererContext';\nimport { InternalNovuProvider, useNovu, useUnsafeNovu } from '../hooks/NovuProvider';\nimport { DefaultInboxProps, DefaultProps, WithChildrenProps } from '../utils/types';\nimport { Mounter } from './Mounter';\nimport { NovuUI } from './NovuUI';\nimport { withRenderer } from './Renderer';\n\nexport type InboxProps = DefaultProps | WithChildrenProps;\n\nconst DefaultInbox = (props: DefaultInboxProps) => {\n const {\n open,\n renderNotification,\n renderAvatar,\n renderSubject,\n renderBody,\n renderDefaultActions,\n renderCustomActions,\n renderBell,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n placement,\n placementOffset,\n } = props;\n const { novuUI } = useNovuUI();\n const { mountElement } = useRenderer();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n if (renderNotification) {\n return novuUI.mountComponent({\n name: 'Inbox',\n props: {\n open,\n renderNotification: renderNotification\n ? (el, notification) => mountElement(el, renderNotification(notification))\n : undefined,\n renderBell: renderBell ? (el, unreadCount) => mountElement(el, renderBell(unreadCount)) : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n placementOffset,\n placement,\n },\n element,\n });\n }\n\n return novuUI.mountComponent({\n name: 'Inbox',\n props: {\n open,\n renderAvatar: renderAvatar ? (el, notification) => mountElement(el, renderAvatar(notification)) : undefined,\n renderSubject: renderSubject\n ? (el, notification) => mountElement(el, renderSubject(notification))\n : undefined,\n renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : undefined,\n renderDefaultActions: renderDefaultActions\n ? (el, notification) => mountElement(el, renderDefaultActions(notification))\n : undefined,\n renderCustomActions: renderCustomActions\n ? (el, notification) => mountElement(el, renderCustomActions(notification))\n : undefined,\n renderBell: renderBell ? (el, unreadCount) => mountElement(el, renderBell(unreadCount)) : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n placementOffset,\n placement,\n },\n element,\n });\n },\n [\n open,\n renderNotification,\n renderAvatar,\n renderSubject,\n renderBody,\n renderDefaultActions,\n renderCustomActions,\n renderBell,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n ]\n );\n\n return <Mounter mount={mount} />;\n};\n\nexport const Inbox = React.memo((props: InboxProps) => {\n const { subscriberId, ...propsWithoutSubscriberId } = props;\n const subscriber = useMemo(\n () => buildSubscriber({ subscriberId: props.subscriberId, subscriber: props.subscriber }),\n [props.subscriberId, props.subscriber]\n );\n const applicationIdentifier = props.applicationIdentifier ? props.applicationIdentifier : ''; // for keyless we provide an empty string, the api will generate a identifier\n const novu = useUnsafeNovu();\n\n if (novu) {\n return (\n <InboxChild {...propsWithoutSubscriberId} applicationIdentifier={applicationIdentifier} subscriber={subscriber} />\n );\n }\n\n const providerProps = {\n applicationIdentifier,\n subscriberHash: props.subscriberHash,\n contextHash: props.contextHash,\n backendUrl: props.backendUrl,\n socketUrl: props.socketUrl,\n socketOptions: props.socketOptions,\n subscriber,\n defaultSchedule: props.defaultSchedule,\n context: props.context,\n } satisfies StandardNovuOptions;\n\n return (\n <InternalNovuProvider {...providerProps}>\n <InboxChild {...propsWithoutSubscriberId} applicationIdentifier={applicationIdentifier} subscriber={subscriber} />\n </InternalNovuProvider>\n );\n});\n\nconst InboxChild = withRenderer(\n React.memo((props: InboxProps) => {\n const {\n localization,\n appearance,\n tabs,\n preferencesFilter,\n preferenceGroups,\n preferencesSort,\n routerPush,\n applicationIdentifier = '', // for keyless we provide an empty string, the api will generate a identifier\n subscriberId,\n subscriberHash,\n contextHash,\n backendUrl,\n socketUrl,\n socketOptions,\n subscriber,\n defaultSchedule,\n context,\n } = props;\n const novu = useNovu();\n\n const options = useMemo(() => {\n return {\n localization,\n appearance,\n tabs,\n preferencesFilter,\n preferenceGroups,\n preferencesSort,\n routerPush,\n options: {\n applicationIdentifier,\n subscriberHash,\n contextHash,\n backendUrl,\n socketUrl,\n socketOptions,\n subscriber: buildSubscriber({ subscriberId, subscriber }),\n defaultSchedule,\n context,\n },\n };\n }, [\n localization,\n appearance,\n tabs,\n preferencesFilter,\n preferenceGroups,\n preferencesSort,\n applicationIdentifier,\n subscriberId,\n subscriberHash,\n contextHash,\n backendUrl,\n socketUrl,\n socketOptions,\n subscriber,\n context,\n ]);\n\n if (isWithChildrenProps(props)) {\n return (\n <NovuUI options={options} novu={novu}>\n {props.children}\n </NovuUI>\n );\n }\n\n const {\n open,\n renderNotification,\n renderAvatar,\n renderSubject,\n renderBody,\n renderDefaultActions,\n renderCustomActions,\n renderBell,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n placementOffset,\n placement,\n } = props;\n\n return (\n <NovuUI options={options} novu={novu}>\n <DefaultInbox\n open={open}\n renderNotification={renderNotification}\n renderAvatar={renderAvatar}\n renderSubject={renderSubject}\n renderBody={renderBody}\n renderDefaultActions={renderDefaultActions}\n renderCustomActions={renderCustomActions}\n renderBell={renderBell}\n onNotificationClick={onNotificationClick}\n onPrimaryActionClick={onPrimaryActionClick}\n onSecondaryActionClick={onSecondaryActionClick}\n placement={placement}\n placementOffset={placementOffset}\n />\n </NovuUI>\n );\n })\n);\n\nInboxChild.displayName = 'InboxChild';\n\nfunction isWithChildrenProps(props: InboxProps): props is WithChildrenProps {\n return 'children' in props;\n}\n"],"mappings":";AACA,SAAS,uBAAuB;AAChC,OAAO,SAAS,eAAe;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB,SAAS,qBAAqB;AAE7D,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAoFpB;AAhFT,IAAM,eAAe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A,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,IAAI;AACJ,UAAM,OAAO,QAAQ;AAErB,UAAM,UAAU,QAAQ,MAAM;AAC5B,aAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,SAAS;AAAA,UACP;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,YAAY,gBAAgB,EAAE,cAAc,WAAW,CAAC;AAAA,UACxD;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF,GAAG;AAAA,MACD;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,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,QAAI,oBAAoB,KAAK,GAAG;AAC9B,aACE,oBAAC,UAAO,SAAkB,MACvB,gBAAM,UACT;AAAA,IAEJ;AAEA,UAAM;AAAA,MACJ;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,IAAI;AAEJ,WACE,oBAAC,UAAO,SAAkB,MACxB;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF,GACF;AAAA,EAEJ,CAAC;AACH;AAEA,WAAW,cAAc;AAEzB,SAAS,oBAAoB,OAA+C;AAC1E,SAAO,cAAc;AACvB;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/InboxContent.tsx"],"sourcesContent":["import type { InboxPage, NotificationActionClickHandler, NotificationClickHandler } from '@notiflyio/js/ui';\r\nimport React from 'react';\r\nimport { useNovuUI } from '../context/NovuUIContext';\r\nimport { useRenderer } from '../context/RendererContext';\r\nimport { NoRendererProps, NotificationRendererProps, SubjectBodyRendererProps } from '../utils/types';\r\nimport { Mounter } from './Mounter';\r\nimport { withRenderer } from './Renderer';\r\n\r\nexport type InboxContentProps = {\r\n onNotificationClick?: NotificationClickHandler;\r\n onPrimaryActionClick?: NotificationActionClickHandler;\r\n onSecondaryActionClick?: NotificationActionClickHandler;\r\n initialPage?: InboxPage;\r\n hideNav?: boolean;\r\n} & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);\r\n\r\nconst _InboxContent = React.memo((props: InboxContentProps) => {\r\n const {\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n renderNotification,\r\n renderAvatar,\r\n renderSubject,\r\n renderBody,\r\n renderDefaultActions,\r\n renderCustomActions,\r\n onSecondaryActionClick,\r\n initialPage,\r\n hideNav,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n const { mountElement } = useRenderer();\r\n\r\n const mount = React.useCallback(\r\n (element: HTMLElement) => {\r\n if (renderNotification) {\r\n return novuUI.mountComponent({\r\n name: 'InboxContent',\r\n element,\r\n props: {\r\n renderNotification: renderNotification\r\n ? (el, notification) => mountElement(el, renderNotification(notification))\r\n : undefined,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n initialPage,\r\n hideNav,\r\n },\r\n });\r\n }\r\n\r\n return novuUI.mountComponent({\r\n name: 'InboxContent',\r\n element,\r\n props: {\r\n renderAvatar: renderAvatar ? (el, notification) => mountElement(el, renderAvatar(notification)) : undefined,\r\n renderSubject: renderSubject\r\n ? (el, notification) => mountElement(el, renderSubject(notification))\r\n : undefined,\r\n renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : undefined,\r\n renderDefaultActions: renderDefaultActions\r\n ? (el, notification) => mountElement(el, renderDefaultActions(notification))\r\n : undefined,\r\n renderCustomActions: renderCustomActions\r\n ? (el, notification) => mountElement(el, renderCustomActions(notification))\r\n : undefined,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n initialPage,\r\n hideNav,\r\n },\r\n });\r\n },\r\n [\r\n renderNotification,\r\n renderAvatar,\r\n renderSubject,\r\n renderBody,\r\n renderDefaultActions,\r\n renderCustomActions,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n});\r\n\r\nexport const InboxContent = withRenderer(_InboxContent);\r\n"],"mappings":";AACA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAE5B,SAAS,eAAe;AACxB,SAAS,oBAAoB;AAkFpB;AAxET,IAAM,gBAAgB,MAAM,KAAK,CAAC,UAA6B;AAC7D,QAAM;AAAA,IACJ;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;AAC7B,QAAM,EAAE,aAAa,IAAI,YAAY;AAErC,QAAM,QAAQ,MAAM;AAAA,IAClB,CAAC,YAAyB;AACxB,UAAI,oBAAoB;AACtB,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA,OAAO;AAAA,YACL,oBAAoB,qBAChB,CAAC,IAAI,iBAAiB,aAAa,IAAI,mBAAmB,YAAY,CAAC,IACvE;AAAA,YACJ;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAEA,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN;AAAA,QACA,OAAO;AAAA,UACL,cAAc,eAAe,CAAC,IAAI,iBAAiB,aAAa,IAAI,aAAa,YAAY,CAAC,IAAI;AAAA,UAClG,eAAe,gBACX,CAAC,IAAI,iBAAiB,aAAa,IAAI,cAAc,YAAY,CAAC,IAClE;AAAA,UACJ,YAAY,aAAa,CAAC,IAAI,iBAAiB,aAAa,IAAI,WAAW,YAAY,CAAC,IAAI;AAAA,UAC5F,sBAAsB,uBAClB,CAAC,IAAI,iBAAiB,aAAa,IAAI,qBAAqB,YAAY,CAAC,IACzE;AAAA,UACJ,qBAAqB,sBACjB,CAAC,IAAI,iBAAiB,aAAa,IAAI,oBAAoB,YAAY,CAAC,IACxE;AAAA,UACJ;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;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,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC,CAAC;AAEM,IAAM,eAAe,aAAa,aAAa;","names":[]} | ||
| {"version":3,"sources":["../../../src/components/InboxContent.tsx"],"sourcesContent":["import type { InboxPage, NotificationActionClickHandler, NotificationClickHandler } from '@notiflyio/js/ui';\nimport React from 'react';\nimport { useNovuUI } from '../context/NovuUIContext';\nimport { useRenderer } from '../context/RendererContext';\nimport { NoRendererProps, NotificationRendererProps, SubjectBodyRendererProps } from '../utils/types';\nimport { Mounter } from './Mounter';\nimport { withRenderer } from './Renderer';\n\nexport type InboxContentProps = {\n onNotificationClick?: NotificationClickHandler;\n onPrimaryActionClick?: NotificationActionClickHandler;\n onSecondaryActionClick?: NotificationActionClickHandler;\n initialPage?: InboxPage;\n hideNav?: boolean;\n} & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);\n\nconst _InboxContent = React.memo((props: InboxContentProps) => {\n const {\n onNotificationClick,\n onPrimaryActionClick,\n renderNotification,\n renderAvatar,\n renderSubject,\n renderBody,\n renderDefaultActions,\n renderCustomActions,\n onSecondaryActionClick,\n initialPage,\n hideNav,\n } = props;\n const { novuUI } = useNovuUI();\n const { mountElement } = useRenderer();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n if (renderNotification) {\n return novuUI.mountComponent({\n name: 'InboxContent',\n element,\n props: {\n renderNotification: renderNotification\n ? (el, notification) => mountElement(el, renderNotification(notification))\n : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n initialPage,\n hideNav,\n },\n });\n }\n\n return novuUI.mountComponent({\n name: 'InboxContent',\n element,\n props: {\n renderAvatar: renderAvatar ? (el, notification) => mountElement(el, renderAvatar(notification)) : undefined,\n renderSubject: renderSubject\n ? (el, notification) => mountElement(el, renderSubject(notification))\n : undefined,\n renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : undefined,\n renderDefaultActions: renderDefaultActions\n ? (el, notification) => mountElement(el, renderDefaultActions(notification))\n : undefined,\n renderCustomActions: renderCustomActions\n ? (el, notification) => mountElement(el, renderCustomActions(notification))\n : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n initialPage,\n hideNav,\n },\n });\n },\n [\n renderNotification,\n renderAvatar,\n renderSubject,\n renderBody,\n renderDefaultActions,\n renderCustomActions,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n ]\n );\n\n return <Mounter mount={mount} />;\n});\n\nexport const InboxContent = withRenderer(_InboxContent);\n"],"mappings":";AACA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAE5B,SAAS,eAAe;AACxB,SAAS,oBAAoB;AAkFpB;AAxET,IAAM,gBAAgB,MAAM,KAAK,CAAC,UAA6B;AAC7D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AA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":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from '../hooks/NovuProvider';\r\nexport * from './Bell';\r\nexport * from './Inbox';\r\nexport * from './InboxContent';\r\nexport * from './msteams-connect-button/MsTeamsConnectButton';\r\nexport * from './msteams-link-user/MsTeamsLinkUser';\r\nexport * from './Notifications';\r\nexport * from './Preferences';\r\nexport * from './slack-connect-button/SlackConnectButton';\r\nexport * from './slack-link-user/SlackLinkUser';\r\nexport * from './subscription/Subscription';\r\nexport * from './subscription/SubscriptionButton';\r\nexport * from './subscription/SubscriptionPreferences';\r\nexport * from './telegram-connect-button/TelegramConnectButton';\r\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]} | ||
| {"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from '../hooks/NovuProvider';\nexport * from './Bell';\nexport * from './Inbox';\nexport * from './InboxContent';\nexport * from './msteams-connect-button/MsTeamsConnectButton';\nexport * from './msteams-link-user/MsTeamsLinkUser';\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';\nexport * from './telegram-connect-button/TelegramConnectButton';\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/Mounter.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\r\n\r\ntype MounterProps = {\r\n mount: (node: HTMLElement) => ((node: HTMLElement) => void) | void;\r\n};\r\n\r\n/**\r\n * Mounter allows you to mount a component to a DOM node.\r\n */\r\nexport function Mounter({ mount }: MounterProps) {\r\n const ref = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n let unmount: (node: HTMLDivElement) => void | undefined;\r\n const element = ref.current;\r\n if (element && mount) {\r\n const possibleUnmount = mount(element);\r\n if (possibleUnmount) {\r\n unmount = possibleUnmount;\r\n }\r\n }\r\n\r\n return () => {\r\n if (element && unmount) {\r\n unmount(element);\r\n }\r\n };\r\n }, [ref, mount]);\r\n\r\n return <div ref={ref} />;\r\n}\r\n"],"mappings":";AAAA,SAAS,WAAW,cAAc;AA6BzB;AApBF,SAAS,QAAQ,EAAE,MAAM,GAAiB;AAC/C,QAAM,MAAM,OAAuB,IAAI;AAEvC,YAAU,MAAM;AACd,QAAI;AACJ,UAAM,UAAU,IAAI;AACpB,QAAI,WAAW,OAAO;AACpB,YAAM,kBAAkB,MAAM,OAAO;AACrC,UAAI,iBAAiB;AACnB,kBAAU;AAAA,MACZ;AAAA,IACF;AAEA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,gBAAQ,OAAO;AAAA,MACjB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,KAAK,KAAK,CAAC;AAEf,SAAO,oBAAC,SAAI,KAAU;AACxB;","names":[]} | ||
| {"version":3,"sources":["../../../src/components/Mounter.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\ntype MounterProps = {\n mount: (node: HTMLElement) => ((node: HTMLElement) => void) | void;\n};\n\n/**\n * Mounter allows you to mount a component to a DOM node.\n */\nexport function Mounter({ mount }: MounterProps) {\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n let unmount: (node: HTMLDivElement) => void | undefined;\n const element = ref.current;\n if (element && mount) {\n const possibleUnmount = mount(element);\n if (possibleUnmount) {\n unmount = possibleUnmount;\n }\n }\n\n return () => {\n if (element && unmount) {\n unmount(element);\n }\n };\n }, [ref, mount]);\n\n return <div ref={ref} />;\n}\n"],"mappings":";AAAA,SAAS,WAAW,cAAc;AA6BzB;AApBF,SAAS,QAAQ,EAAE,MAAM,GAAiB;AAC/C,QAAM,MAAM,OAAuB,IAAI;AAEvC,YAAU,MAAM;AACd,QAAI;AACJ,UAAM,UAAU,IAAI;AACpB,QAAI,WAAW,OAAO;AACpB,YAAM,kBAAkB,MAAM,OAAO;AACrC,UAAI,iBAAiB;AACnB,kBAAU;AAAA,MACZ;AAAA,IACF;AAEA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,gBAAQ,OAAO;AAAA,MACjB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,KAAK,KAAK,CAAC;AAEf,SAAO,oBAAC,SAAI,KAAU;AACxB;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/msteams-connect-button/DefaultMsTeamsConnectButton.tsx"],"sourcesContent":["import { MsTeamsConnectButtonProps } from '@notiflyio/js/ui';\r\nimport { useCallback } from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type DefaultMsTeamsConnectButtonProps = Pick<\r\n MsTeamsConnectButtonProps,\r\n | 'integrationIdentifier'\r\n | 'connectionIdentifier'\r\n | 'subscriberId'\r\n | 'context'\r\n | 'scope'\r\n | 'connectionMode'\r\n | 'autoLinkUser'\r\n | 'onConnectSuccess'\r\n | 'onConnectError'\r\n | 'onDisconnectSuccess'\r\n | 'onDisconnectError'\r\n | 'connectLabel'\r\n | 'connectedLabel'\r\n>;\r\n\r\nexport const DefaultMsTeamsConnectButton = (props: DefaultMsTeamsConnectButtonProps) => {\r\n const {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n autoLinkUser,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'MsTeamsConnectButton',\r\n props: {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n autoLinkUser,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n },\r\n element,\r\n });\r\n },\r\n [\r\n novuUI,\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n autoLinkUser,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n"],"mappings":";AACA,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AA6Ef;AA1DF,IAAM,8BAA8B,CAAC,UAA4C;AACtF,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,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,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,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/msteams-connect-button/DefaultMsTeamsConnectButton.tsx"],"sourcesContent":["import { MsTeamsConnectButtonProps } from '@notiflyio/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultMsTeamsConnectButtonProps = Pick<\n MsTeamsConnectButtonProps,\n | 'integrationIdentifier'\n | 'connectionIdentifier'\n | 'subscriberId'\n | 'context'\n | 'scope'\n | 'connectionMode'\n | 'autoLinkUser'\n | 'onConnectSuccess'\n | 'onConnectError'\n | 'onDisconnectSuccess'\n | 'onDisconnectError'\n | 'connectLabel'\n | 'connectedLabel'\n>;\n\nexport const DefaultMsTeamsConnectButton = (props: DefaultMsTeamsConnectButtonProps) => {\n const {\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n scope,\n connectionMode,\n autoLinkUser,\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: 'MsTeamsConnectButton',\n props: {\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n scope,\n connectionMode,\n autoLinkUser,\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 autoLinkUser,\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;AA6Ef;AA1DF,IAAM,8BAA8B,CAAC,UAA4C;AACtF,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,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,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,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/msteams-connect-button/MsTeamsConnectButton.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\nimport { useNovu } from '../../hooks/NovuProvider';\r\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\r\nimport { withRenderer } from '../Renderer';\r\nimport { DefaultMsTeamsConnectButton, DefaultMsTeamsConnectButtonProps } from './DefaultMsTeamsConnectButton';\r\n\r\nexport type MsTeamsConnectButtonProps = DefaultMsTeamsConnectButtonProps &\r\n Pick<NovuUIOptions, 'container' | 'appearance'>;\r\n\r\nconst MsTeamsConnectButtonInternal = withRenderer<MsTeamsConnectButtonProps>((props) => {\r\n const { container, appearance, ...defaultProps } = props;\r\n const novu = useNovu();\r\n\r\n const options: NovuUIOptions = useMemo(() => {\r\n return {\r\n container,\r\n appearance,\r\n options: novu.options,\r\n };\r\n }, [container, appearance, novu.options]);\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultMsTeamsConnectButton {...defaultProps} />\r\n </NovuUI>\r\n );\r\n});\r\n\r\nMsTeamsConnectButtonInternal.displayName = 'MsTeamsConnectButtonInternal';\r\n\r\nexport const MsTeamsConnectButton = React.memo((props: MsTeamsConnectButtonProps) => {\r\n return <MsTeamsConnectButtonInternal {...props} />;\r\n});\r\n\r\nMsTeamsConnectButton.displayName = 'MsTeamsConnectButton';\r\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,mCAAqE;AAmBxE;AAdN,IAAM,+BAA+B,aAAwC,CAAC,UAAU;AACtF,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,+BAA6B,GAAG,cAAc,GACjD;AAEJ,CAAC;AAED,6BAA6B,cAAc;AAEpC,IAAM,uBAAuB,MAAM,KAAK,CAAC,UAAqC;AACnF,SAAO,oBAAC,gCAA8B,GAAG,OAAO;AAClD,CAAC;AAED,qBAAqB,cAAc;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/msteams-connect-button/MsTeamsConnectButton.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultMsTeamsConnectButton, DefaultMsTeamsConnectButtonProps } from './DefaultMsTeamsConnectButton';\n\nexport type MsTeamsConnectButtonProps = DefaultMsTeamsConnectButtonProps &\n Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst MsTeamsConnectButtonInternal = withRenderer<MsTeamsConnectButtonProps>((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 <DefaultMsTeamsConnectButton {...defaultProps} />\n </NovuUI>\n );\n});\n\nMsTeamsConnectButtonInternal.displayName = 'MsTeamsConnectButtonInternal';\n\nexport const MsTeamsConnectButton = React.memo((props: MsTeamsConnectButtonProps) => {\n return <MsTeamsConnectButtonInternal {...props} />;\n});\n\nMsTeamsConnectButton.displayName = 'MsTeamsConnectButton';\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,mCAAqE;AAmBxE;AAdN,IAAM,+BAA+B,aAAwC,CAAC,UAAU;AACtF,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,+BAA6B,GAAG,cAAc,GACjD;AAEJ,CAAC;AAED,6BAA6B,cAAc;AAEpC,IAAM,uBAAuB,MAAM,KAAK,CAAC,UAAqC;AACnF,SAAO,oBAAC,gCAA8B,GAAG,OAAO;AAClD,CAAC;AAED,qBAAqB,cAAc;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/msteams-link-user/DefaultMsTeamsLinkUser.tsx"],"sourcesContent":["import { MsTeamsLinkUserProps } from '@notiflyio/js/ui';\r\nimport { useCallback } from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type DefaultMsTeamsLinkUserProps = Pick<\r\n MsTeamsLinkUserProps,\r\n | 'integrationIdentifier'\r\n | 'connectionIdentifier'\r\n | 'context'\r\n | 'onLinkSuccess'\r\n | 'onLinkError'\r\n | 'onUnlinkSuccess'\r\n | 'onUnlinkError'\r\n | 'linkLabel'\r\n | 'unlinkLabel'\r\n>;\r\n\r\nexport const DefaultMsTeamsLinkUser = (props: DefaultMsTeamsLinkUserProps) => {\r\n const {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n context,\r\n onLinkSuccess,\r\n onLinkError,\r\n onUnlinkSuccess,\r\n onUnlinkError,\r\n linkLabel,\r\n unlinkLabel,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'MsTeamsLinkUser',\r\n props: {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n context,\r\n onLinkSuccess,\r\n onLinkError,\r\n onUnlinkSuccess,\r\n onUnlinkError,\r\n linkLabel,\r\n unlinkLabel,\r\n },\r\n element,\r\n });\r\n },\r\n [\r\n novuUI,\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n context,\r\n onLinkSuccess,\r\n onLinkError,\r\n onUnlinkSuccess,\r\n onUnlinkError,\r\n linkLabel,\r\n unlinkLabel,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n"],"mappings":";AACA,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AA6Df;AA9CF,IAAM,yBAAyB,CAAC,UAAuC;AAC5E,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":[]} | ||
| {"version":3,"sources":["../../../../src/components/msteams-link-user/DefaultMsTeamsLinkUser.tsx"],"sourcesContent":["import { MsTeamsLinkUserProps } from '@notiflyio/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultMsTeamsLinkUserProps = Pick<\n MsTeamsLinkUserProps,\n | 'integrationIdentifier'\n | 'connectionIdentifier'\n | 'context'\n | 'onLinkSuccess'\n | 'onLinkError'\n | 'onUnlinkSuccess'\n | 'onUnlinkError'\n | 'linkLabel'\n | 'unlinkLabel'\n>;\n\nexport const DefaultMsTeamsLinkUser = (props: DefaultMsTeamsLinkUserProps) => {\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: 'MsTeamsLinkUser',\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,yBAAyB,CAAC,UAAuC;AAC5E,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":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/msteams-link-user/MsTeamsLinkUser.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\nimport { useNovu } from '../../hooks/NovuProvider';\r\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\r\nimport { withRenderer } from '../Renderer';\r\nimport { DefaultMsTeamsLinkUser, DefaultMsTeamsLinkUserProps } from './DefaultMsTeamsLinkUser';\r\n\r\nexport type MsTeamsLinkUserProps = DefaultMsTeamsLinkUserProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\r\n\r\nconst MsTeamsLinkUserInternal = withRenderer<MsTeamsLinkUserProps>((props) => {\r\n const { container, appearance, ...defaultProps } = props;\r\n const novu = useNovu();\r\n\r\n const options: NovuUIOptions = useMemo(() => {\r\n return {\r\n container,\r\n appearance,\r\n options: novu.options,\r\n };\r\n }, [container, appearance, novu.options]);\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultMsTeamsLinkUser {...defaultProps} />\r\n </NovuUI>\r\n );\r\n});\r\n\r\nMsTeamsLinkUserInternal.displayName = 'MsTeamsLinkUserInternal';\r\n\r\nexport const MsTeamsLinkUser = React.memo((props: MsTeamsLinkUserProps) => {\r\n return <MsTeamsLinkUserInternal {...props} />;\r\n});\r\n\r\nMsTeamsLinkUser.displayName = 'MsTeamsLinkUser';\r\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,8BAA2D;AAkB9D;AAdN,IAAM,0BAA0B,aAAmC,CAAC,UAAU;AAC5E,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,0BAAwB,GAAG,cAAc,GAC5C;AAEJ,CAAC;AAED,wBAAwB,cAAc;AAE/B,IAAM,kBAAkB,MAAM,KAAK,CAAC,UAAgC;AACzE,SAAO,oBAAC,2BAAyB,GAAG,OAAO;AAC7C,CAAC;AAED,gBAAgB,cAAc;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/msteams-link-user/MsTeamsLinkUser.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultMsTeamsLinkUser, DefaultMsTeamsLinkUserProps } from './DefaultMsTeamsLinkUser';\n\nexport type MsTeamsLinkUserProps = DefaultMsTeamsLinkUserProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst MsTeamsLinkUserInternal = withRenderer<MsTeamsLinkUserProps>((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 <DefaultMsTeamsLinkUser {...defaultProps} />\n </NovuUI>\n );\n});\n\nMsTeamsLinkUserInternal.displayName = 'MsTeamsLinkUserInternal';\n\nexport const MsTeamsLinkUser = React.memo((props: MsTeamsLinkUserProps) => {\n return <MsTeamsLinkUserInternal {...props} />;\n});\n\nMsTeamsLinkUser.displayName = 'MsTeamsLinkUser';\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,8BAA2D;AAkB9D;AAdN,IAAM,0BAA0B,aAAmC,CAAC,UAAU;AAC5E,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,0BAAwB,GAAG,cAAc,GAC5C;AAEJ,CAAC;AAED,wBAAwB,cAAc;AAE/B,IAAM,kBAAkB,MAAM,KAAK,CAAC,UAAgC;AACzE,SAAO,oBAAC,2BAAyB,GAAG,OAAO;AAC7C,CAAC;AAED,gBAAgB,cAAc;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/Notifications.tsx"],"sourcesContent":["import type { NotificationActionClickHandler, NotificationClickHandler } from '@notiflyio/js/ui';\r\nimport React from 'react';\r\nimport { useNovuUI } from '../context/NovuUIContext';\r\nimport { useRenderer } from '../context/RendererContext';\r\nimport { NoRendererProps, NotificationRendererProps, SubjectBodyRendererProps } from '../utils/types';\r\nimport { Mounter } from './Mounter';\r\nimport { withRenderer } from './Renderer';\r\n\r\nexport type NotificationProps = {\r\n onNotificationClick?: NotificationClickHandler;\r\n onPrimaryActionClick?: NotificationActionClickHandler;\r\n onSecondaryActionClick?: NotificationActionClickHandler;\r\n} & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);\r\n\r\nconst _Notifications = React.memo((props: NotificationProps) => {\r\n const {\r\n renderNotification,\r\n renderAvatar,\r\n renderSubject,\r\n renderBody,\r\n renderDefaultActions,\r\n renderCustomActions,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n const { mountElement } = useRenderer();\r\n\r\n const mount = React.useCallback(\r\n (element: HTMLElement) => {\r\n if (renderNotification) {\r\n return novuUI.mountComponent({\r\n name: 'Notifications',\r\n element,\r\n props: {\r\n renderNotification: renderNotification\r\n ? (el, notification) => mountElement(el, renderNotification(notification))\r\n : undefined,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n },\r\n });\r\n }\r\n\r\n return novuUI.mountComponent({\r\n name: 'Notifications',\r\n element,\r\n props: {\r\n renderAvatar: renderAvatar ? (el, notification) => mountElement(el, renderAvatar(notification)) : undefined,\r\n renderSubject: renderSubject\r\n ? (el, notification) => mountElement(el, renderSubject(notification))\r\n : undefined,\r\n renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : undefined,\r\n renderDefaultActions: renderDefaultActions\r\n ? (el, notification) => mountElement(el, renderDefaultActions(notification))\r\n : undefined,\r\n renderCustomActions: renderCustomActions\r\n ? (el, notification) => mountElement(el, renderCustomActions(notification))\r\n : undefined,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n },\r\n });\r\n },\r\n [\r\n renderNotification,\r\n renderAvatar,\r\n renderSubject,\r\n renderBody,\r\n renderDefaultActions,\r\n renderCustomActions,\r\n onNotificationClick,\r\n onPrimaryActionClick,\r\n onSecondaryActionClick,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n});\r\n\r\nexport const Notifications = withRenderer(_Notifications);\r\n"],"mappings":";AACA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAE5B,SAAS,eAAe;AACxB,SAAS,oBAAoB;AA0EpB;AAlET,IAAM,iBAAiB,MAAM,KAAK,CAAC,UAA6B;AAC9D,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;AAC7B,QAAM,EAAE,aAAa,IAAI,YAAY;AAErC,QAAM,QAAQ,MAAM;AAAA,IAClB,CAAC,YAAyB;AACxB,UAAI,oBAAoB;AACtB,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA,OAAO;AAAA,YACL,oBAAoB,qBAChB,CAAC,IAAI,iBAAiB,aAAa,IAAI,mBAAmB,YAAY,CAAC,IACvE;AAAA,YACJ;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAEA,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN;AAAA,QACA,OAAO;AAAA,UACL,cAAc,eAAe,CAAC,IAAI,iBAAiB,aAAa,IAAI,aAAa,YAAY,CAAC,IAAI;AAAA,UAClG,eAAe,gBACX,CAAC,IAAI,iBAAiB,aAAa,IAAI,cAAc,YAAY,CAAC,IAClE;AAAA,UACJ,YAAY,aAAa,CAAC,IAAI,iBAAiB,aAAa,IAAI,WAAW,YAAY,CAAC,IAAI;AAAA,UAC5F,sBAAsB,uBAClB,CAAC,IAAI,iBAAiB,aAAa,IAAI,qBAAqB,YAAY,CAAC,IACzE;AAAA,UACJ,qBAAqB,sBACjB,CAAC,IAAI,iBAAiB,aAAa,IAAI,oBAAoB,YAAY,CAAC,IACxE;AAAA,UACJ;AAAA,UACA;AAAA,UACA;AAAA,QACF;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,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC,CAAC;AAEM,IAAM,gBAAgB,aAAa,cAAc;","names":[]} | ||
| {"version":3,"sources":["../../../src/components/Notifications.tsx"],"sourcesContent":["import type { NotificationActionClickHandler, NotificationClickHandler } from '@notiflyio/js/ui';\nimport React from 'react';\nimport { useNovuUI } from '../context/NovuUIContext';\nimport { useRenderer } from '../context/RendererContext';\nimport { NoRendererProps, NotificationRendererProps, SubjectBodyRendererProps } from '../utils/types';\nimport { Mounter } from './Mounter';\nimport { withRenderer } from './Renderer';\n\nexport type NotificationProps = {\n onNotificationClick?: NotificationClickHandler;\n onPrimaryActionClick?: NotificationActionClickHandler;\n onSecondaryActionClick?: NotificationActionClickHandler;\n} & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);\n\nconst _Notifications = React.memo((props: NotificationProps) => {\n const {\n renderNotification,\n renderAvatar,\n renderSubject,\n renderBody,\n renderDefaultActions,\n renderCustomActions,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n } = props;\n const { novuUI } = useNovuUI();\n const { mountElement } = useRenderer();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n if (renderNotification) {\n return novuUI.mountComponent({\n name: 'Notifications',\n element,\n props: {\n renderNotification: renderNotification\n ? (el, notification) => mountElement(el, renderNotification(notification))\n : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n },\n });\n }\n\n return novuUI.mountComponent({\n name: 'Notifications',\n element,\n props: {\n renderAvatar: renderAvatar ? (el, notification) => mountElement(el, renderAvatar(notification)) : undefined,\n renderSubject: renderSubject\n ? (el, notification) => mountElement(el, renderSubject(notification))\n : undefined,\n renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : undefined,\n renderDefaultActions: renderDefaultActions\n ? (el, notification) => mountElement(el, renderDefaultActions(notification))\n : undefined,\n renderCustomActions: renderCustomActions\n ? (el, notification) => mountElement(el, renderCustomActions(notification))\n : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n },\n });\n },\n [\n renderNotification,\n renderAvatar,\n renderSubject,\n renderBody,\n renderDefaultActions,\n renderCustomActions,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n ]\n );\n\n return <Mounter mount={mount} />;\n});\n\nexport const Notifications = withRenderer(_Notifications);\n"],"mappings":";AACA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAE5B,SAAS,eAAe;AACxB,SAAS,oBAAoB;AA0EpB;AAlET,IAAM,iBAAiB,MAAM,KAAK,CAAC,UAA6B;AAC9D,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;AAC7B,QAAM,EAAE,aAAa,IAAI,YAAY;AAErC,QAAM,QAAQ,MAAM;AAAA,IAClB,CAAC,YAAyB;AACxB,UAAI,oBAAoB;AACtB,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA,OAAO;AAAA,YACL,oBAAoB,qBAChB,CAAC,IAAI,iBAAiB,aAAa,IAAI,mBAAmB,YAAY,CAAC,IACvE;AAAA,YACJ;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAEA,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN;AAAA,QACA,OAAO;AAAA,UACL,cAAc,eAAe,CAAC,IAAI,iBAAiB,aAAa,IAAI,aAAa,YAAY,CAAC,IAAI;AAAA,UAClG,eAAe,gBACX,CAAC,IAAI,iBAAiB,aAAa,IAAI,cAAc,YAAY,CAAC,IAClE;AAAA,UACJ,YAAY,aAAa,CAAC,IAAI,iBAAiB,aAAa,IAAI,WAAW,YAAY,CAAC,IAAI;AAAA,UAC5F,sBAAsB,uBAClB,CAAC,IAAI,iBAAiB,aAAa,IAAI,qBAAqB,YAAY,CAAC,IACzE;AAAA,UACJ,qBAAqB,sBACjB,CAAC,IAAI,iBAAiB,aAAa,IAAI,oBAAoB,YAAY,CAAC,IACxE;AAAA,UACJ;AAAA,UACA;AAAA,UACA;AAAA,QACF;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,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC,CAAC;AAEM,IAAM,gBAAgB,aAAa,cAAc;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/NovuUI.tsx"],"sourcesContent":["import { Novu } from '@notiflyio/js';\r\nimport type { NovuUIOptions as JsNovuUIOptions } from '@notiflyio/js/ui';\r\nimport { NovuUI as NovuUIClass } from '@notiflyio/js/ui';\r\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\r\nimport { NovuUIProvider } from '../context/NovuUIContext';\r\nimport { useRenderer } from '../context/RendererContext';\r\nimport { useDataRef } from '../hooks/internal/useDataRef';\r\nimport { adaptAppearanceForJs } from '../utils/appearance';\r\nimport type { ReactAllAppearance, ReactInboxAppearance, ReactSubscriptionAppearance } from '../utils/types';\r\nimport { ShadowRootDetector } from './ShadowRootDetector';\r\n\r\nexport type NovuUIOptions = Omit<JsNovuUIOptions, 'appearance'> & {\r\n appearance?: ReactInboxAppearance | ReactSubscriptionAppearance | ReactAllAppearance;\r\n};\r\n\r\ntype NovuUIProps = React.PropsWithChildren<{\r\n options: NovuUIOptions;\r\n novu: Novu;\r\n}>;\r\n\r\nconst findParentShadowRoot = (child?: HTMLDivElement | null): Node | null => {\r\n if (!child) {\r\n return null;\r\n }\r\n\r\n let node: Node | null = child;\r\n\r\n while (node) {\r\n if (node instanceof Element && node.shadowRoot) {\r\n return node.shadowRoot;\r\n }\r\n\r\n if (node instanceof ShadowRoot) {\r\n return node;\r\n }\r\n\r\n node = node.parentNode;\r\n\r\n if (!node || node === document) {\r\n break;\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\nexport const NovuUI = ({ options, novu, children }: NovuUIProps) => {\r\n const shadowRootDetector = useRef<HTMLDivElement>(null);\r\n const { mountElement } = useRenderer();\r\n\r\n const adaptedAppearanceForUpdate = useMemo(\r\n () => adaptAppearanceForJs(options.appearance || {}, mountElement),\r\n [options.appearance, mountElement]\r\n );\r\n\r\n const adaptedOptions = useMemo(() => {\r\n return {\r\n ...options,\r\n appearance: adaptedAppearanceForUpdate,\r\n novu,\r\n };\r\n }, [options, novu, adaptedAppearanceForUpdate]);\r\n\r\n const optionsRef = useDataRef(adaptedOptions);\r\n const [novuUI, setNovuUI] = useState<NovuUIClass | undefined>();\r\n\r\n useEffect(() => {\r\n const parentShadowRoot = findParentShadowRoot(shadowRootDetector.current);\r\n const instance = new NovuUIClass({\r\n ...optionsRef.current,\r\n container: optionsRef.current.container ?? parentShadowRoot,\r\n });\r\n setNovuUI(instance);\r\n\r\n return () => {\r\n instance.unmount();\r\n };\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (!novuUI) {\r\n return;\r\n }\r\n\r\n const parentShadowRoot = findParentShadowRoot(shadowRootDetector.current);\r\n novuUI.updateContainer(options.container ?? parentShadowRoot);\r\n novuUI.updateAppearance(adaptedAppearanceForUpdate);\r\n novuUI.updateLocalization(options.localization);\r\n novuUI.updateTabs(options.tabs);\r\n novuUI.updateOptions(options.options);\r\n novuUI.updateRouterPush(options.routerPush);\r\n novuUI.updateNovu(novu);\r\n }, [\r\n shadowRootDetector,\r\n novuUI,\r\n adaptedAppearanceForUpdate,\r\n options.localization,\r\n options.tabs,\r\n options.options,\r\n options.routerPush,\r\n novu,\r\n ]);\r\n\r\n return (\r\n <>\r\n <ShadowRootDetector ref={shadowRootDetector} />\r\n {novuUI && <NovuUIProvider value={{ novuUI }}>{children}</NovuUIProvider>}\r\n </>\r\n );\r\n};\r\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,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;AAAA,wBAAC,sBAAmB,KAAK,oBAAoB;AAAA,IAC5C,UAAU,oBAAC,kBAAe,OAAO,EAAE,OAAO,GAAI,UAAS;AAAA,KAC1D;AAEJ;","names":[]} | ||
| {"version":3,"sources":["../../../src/components/NovuUI.tsx"],"sourcesContent":["import { Novu } from '@notiflyio/js';\nimport type { NovuUIOptions as JsNovuUIOptions } from '@notiflyio/js/ui';\nimport { NovuUI as NovuUIClass } from '@notiflyio/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,IA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CACE;AAAA,wBAAC,sBAAmB,KAAK,oBAAoB;AAAA,IAC5C,UAAU,oBAAC,kBAAe,OAAO,EAAE,OAAO,GAAI,UAAS;AAAA,KAC1D;AAEJ;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/Preferences.tsx"],"sourcesContent":["import React from 'react';\r\nimport { useNovuUI } from '../context/NovuUIContext';\r\nimport { Mounter } from './Mounter';\r\n\r\nexport const Preferences = () => {\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = React.useCallback((element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'Preferences',\r\n element,\r\n });\r\n }, []);\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n"],"mappings":";AAAA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAYf;AAVF,IAAM,cAAc,MAAM;AAC/B,QAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,QAAM,QAAQ,MAAM,YAAY,CAAC,YAAyB;AACxD,WAAO,OAAO,eAAe;AAAA,MAC3B,MAAM;AAAA,MACN;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]} | ||
| {"version":3,"sources":["../../../src/components/Preferences.tsx"],"sourcesContent":["import React from 'react';\nimport { useNovuUI } from '../context/NovuUIContext';\nimport { Mounter } from './Mounter';\n\nexport const Preferences = () => {\n const { novuUI } = useNovuUI();\n\n const mount = React.useCallback((element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'Preferences',\n element,\n });\n }, []);\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";AAAA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAYf;AAVF,IAAM,cAAc,MAAM;AAC/B,QAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,QAAM,QAAQ,MAAM,YAAY,CAAC,YAAyB;AACxD,WAAO,OAAO,eAAe;AAAA,MAC3B,MAAM;AAAA,MACN;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/Renderer.tsx"],"sourcesContent":["import { ComponentType, PropsWithChildren, useCallback, useState } from 'react';\r\nimport { createPortal } from 'react-dom';\r\nimport { MountedElement, RendererProvider } from '../context/RendererContext';\r\n\r\ntype RendererProps = PropsWithChildren;\r\nexport const Renderer = (props: RendererProps) => {\r\n const { children } = props;\r\n const [mountedElements, setMountedElements] = useState(new Map<HTMLElement, MountedElement>());\r\n\r\n const mountElement = useCallback(\r\n (el: HTMLElement, mountedElement: MountedElement) => {\r\n setMountedElements((prev) => {\r\n const newMountedElements = new Map(prev);\r\n newMountedElements.set(el, mountedElement);\r\n\r\n return newMountedElements;\r\n });\r\n\r\n return () => {\r\n setMountedElements((prev) => {\r\n const newMountedElements = new Map(prev);\r\n newMountedElements.delete(el);\r\n\r\n return newMountedElements;\r\n });\r\n };\r\n },\r\n [setMountedElements]\r\n );\r\n\r\n return (\r\n <RendererProvider value={{ mountElement }}>\r\n {[...mountedElements].map(([element, mountedElement]) => {\r\n return createPortal(mountedElement, element);\r\n })}\r\n\r\n {children}\r\n </RendererProvider>\r\n );\r\n};\r\n\r\nexport const withRenderer = <P extends object>(\r\n WrappedComponent: ComponentType<P>\r\n): ComponentType<P & PropsWithChildren<{}>> => {\r\n const HOC = (props: P) => {\r\n return (\r\n <Renderer>\r\n <WrappedComponent {...props} />\r\n </Renderer>\r\n );\r\n };\r\n\r\n HOC.displayName = `WithRenderer(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\r\n\r\n return HOC;\r\n};\r\n"],"mappings":";AAAA,SAA2C,aAAa,gBAAgB;AACxE,SAAS,oBAAoB;AAC7B,SAAyB,wBAAwB;AA6B7C,SAgBI,KAhBJ;AA1BG,IAAM,WAAW,CAAC,UAAyB;AAChD,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAS,oBAAI,IAAiC,CAAC;AAE7F,QAAM,eAAe;AAAA,IACnB,CAAC,IAAiB,mBAAmC;AACnD,yBAAmB,CAAC,SAAS;AAC3B,cAAM,qBAAqB,IAAI,IAAI,IAAI;AACvC,2BAAmB,IAAI,IAAI,cAAc;AAEzC,eAAO;AAAA,MACT,CAAC;AAED,aAAO,MAAM;AACX,2BAAmB,CAAC,SAAS;AAC3B,gBAAM,qBAAqB,IAAI,IAAI,IAAI;AACvC,6BAAmB,OAAO,EAAE;AAE5B,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB;AAAA,EACrB;AAEA,SACE,qBAAC,oBAAiB,OAAO,EAAE,aAAa,GACrC;AAAA,KAAC,GAAG,eAAe,EAAE,IAAI,CAAC,CAAC,SAAS,cAAc,MAAM;AACvD,aAAO,aAAa,gBAAgB,OAAO;AAAA,IAC7C,CAAC;AAAA,IAEA;AAAA,KACH;AAEJ;AAEO,IAAM,eAAe,CAC1B,qBAC6C;AAC7C,QAAM,MAAM,CAAC,UAAa;AACxB,WACE,oBAAC,YACC,8BAAC,oBAAkB,GAAG,OAAO,GAC/B;AAAA,EAEJ;AAEA,MAAI,cAAc,gBAAgB,iBAAiB,eAAe,iBAAiB,QAAQ,WAAW;AAEtG,SAAO;AACT;","names":[]} | ||
| {"version":3,"sources":["../../../src/components/Renderer.tsx"],"sourcesContent":["import { ComponentType, PropsWithChildren, useCallback, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { MountedElement, RendererProvider } from '../context/RendererContext';\n\ntype RendererProps = PropsWithChildren;\nexport const Renderer = (props: RendererProps) => {\n const { children } = props;\n const [mountedElements, setMountedElements] = useState(new Map<HTMLElement, MountedElement>());\n\n const mountElement = useCallback(\n (el: HTMLElement, mountedElement: MountedElement) => {\n setMountedElements((prev) => {\n const newMountedElements = new Map(prev);\n newMountedElements.set(el, mountedElement);\n\n return newMountedElements;\n });\n\n return () => {\n setMountedElements((prev) => {\n const newMountedElements = new Map(prev);\n newMountedElements.delete(el);\n\n return newMountedElements;\n });\n };\n },\n [setMountedElements]\n );\n\n return (\n <RendererProvider value={{ mountElement }}>\n {[...mountedElements].map(([element, mountedElement]) => {\n return createPortal(mountedElement, element);\n })}\n\n {children}\n </RendererProvider>\n );\n};\n\nexport const withRenderer = <P extends object>(\n WrappedComponent: ComponentType<P>\n): ComponentType<P & PropsWithChildren<{}>> => {\n const HOC = (props: P) => {\n return (\n <Renderer>\n <WrappedComponent {...props} />\n </Renderer>\n );\n };\n\n HOC.displayName = `WithRenderer(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\n\n return HOC;\n};\n"],"mappings":";AAAA,SAA2C,aAAa,gBAAgB;AACxE,SAAS,oBAAoB;AAC7B,SAAyB,wBAAwB;AA6B7C,SAgBI,KAhBJ;AA1BG,IAAM,WAAW,CAAC,UAAyB;AAChD,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAS,oBAAI,IAAiC,CAAC;AAE7F,QAAM,eAAe;AAAA,IACnB,CAAC,IAAiB,mBAAmC;AACnD,yBAAmB,CAAC,SAAS;AAC3B,cAAM,qBAAqB,IAAI,IAAI,IAAI;AACvC,2BAAmB,IAAI,IAAI,cAAc;AAEzC,eAAO;AAAA,MACT,CAAC;AAED,aAAO,MAAM;AACX,2BAAmB,CAAC,SAAS;AAC3B,gBAAM,qBAAqB,IAAI,IAAI,IAAI;AACvC,6BAAmB,OAAO,EAAE;AAE5B,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB;AAAA,EACrB;AAEA,SACE,qBAAC,oBAAiB,OAAO,EAAE,aAAa,GACrC;AAAA,KAAC,GAAG,eAAe,EAAE,IAAI,CAAC,CAAC,SAAS,cAAc,MAAM;AACvD,aAAO,aAAa,gBAAgB,OAAO;AAAA,IAC7C,CAAC;AAAA,IAEA;AAAA,KACH;AAEJ;AAEO,IAAM,eAAe,CAC1B,qBAC6C;AAC7C,QAAM,MAAM,CAAC,UAAa;AACxB,WACE,oBAAC,YACC,8BAAC,oBAAkB,GAAG,OAAO,GAC/B;AAAA,EAEJ;AAEA,MAAI,cAAc,gBAAgB,iBAAiB,eAAe,iBAAiB,QAAQ,WAAW;AAEtG,SAAO;AACT;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/components/ShadowRootDetector.tsx"],"sourcesContent":["import React from 'react';\r\n\r\nexport const ShadowRootDetector = React.forwardRef<HTMLDivElement>((props, ref) => {\r\n return (\r\n <div\r\n ref={ref}\r\n style={{\r\n position: 'absolute',\r\n width: 1,\r\n height: 1,\r\n padding: 0,\r\n margin: -1,\r\n overflow: 'hidden',\r\n clip: 'rect(0, 0, 0, 0)',\r\n whiteSpace: 'nowrap',\r\n borderWidth: 0,\r\n }}\r\n data-shadow-root-detector\r\n {...props}\r\n />\r\n );\r\n});\r\n"],"mappings":";AAAA,OAAO,WAAW;AAId;AAFG,IAAM,qBAAqB,MAAM,WAA2B,CAAC,OAAO,QAAQ;AACjF,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,OAAO;AAAA,QACL,UAAU;AAAA,QACV,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,aAAa;AAAA,MACf;AAAA,MACA,6BAAyB;AAAA,MACxB,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;","names":[]} | ||
| {"version":3,"sources":["../../../src/components/ShadowRootDetector.tsx"],"sourcesContent":["import React from 'react';\n\nexport const ShadowRootDetector = React.forwardRef<HTMLDivElement>((props, ref) => {\n return (\n <div\n ref={ref}\n style={{\n position: 'absolute',\n width: 1,\n height: 1,\n padding: 0,\n margin: -1,\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n borderWidth: 0,\n }}\n data-shadow-root-detector\n {...props}\n />\n );\n});\n"],"mappings":";AAAA,OAAO,WAAW;AAId;AAFG,IAAM,qBAAqB,MAAM,WAA2B,CAAC,OAAO,QAAQ;AACjF,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,OAAO;AAAA,QACL,UAAU;AAAA,QACV,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,aAAa;AAAA,MACf;AAAA,MACA,6BAAyB;AAAA,MACxB,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/slack-connect-button/DefaultSlackConnectButton.tsx"],"sourcesContent":["import { SlackConnectButtonProps } from '@notiflyio/js/ui';\r\nimport { useCallback } from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type DefaultSlackConnectButtonProps = Pick<\r\n SlackConnectButtonProps,\r\n | 'integrationIdentifier'\r\n | 'connectionIdentifier'\r\n | 'subscriberId'\r\n | 'context'\r\n | 'scope'\r\n | 'connectionMode'\r\n | 'autoLinkUser'\r\n | 'onConnectSuccess'\r\n | 'onConnectError'\r\n | 'onDisconnectSuccess'\r\n | 'onDisconnectError'\r\n | 'connectLabel'\r\n | 'connectedLabel'\r\n>;\r\n\r\nexport const DefaultSlackConnectButton = (props: DefaultSlackConnectButtonProps) => {\r\n const {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n autoLinkUser,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'SlackConnectButton',\r\n props: {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n autoLinkUser,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n },\r\n element,\r\n });\r\n },\r\n [\r\n novuUI,\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n subscriberId,\r\n context,\r\n scope,\r\n connectionMode,\r\n autoLinkUser,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n"],"mappings":";AACA,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AA6Ef;AA1DF,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,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,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,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/slack-connect-button/DefaultSlackConnectButton.tsx"],"sourcesContent":["import { SlackConnectButtonProps } from '@notiflyio/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 | 'autoLinkUser'\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 autoLinkUser,\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 autoLinkUser,\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 autoLinkUser,\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;AA6Ef;AA1DF,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,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,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,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/slack-connect-button/SlackConnectButton.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\nimport { useNovu } from '../../hooks/NovuProvider';\r\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\r\nimport { withRenderer } from '../Renderer';\r\nimport { DefaultSlackConnectButton, DefaultSlackConnectButtonProps } from './DefaultSlackConnectButton';\r\n\r\nexport type SlackConnectButtonProps = DefaultSlackConnectButtonProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\r\n\r\nconst SlackConnectButtonInternal = withRenderer<SlackConnectButtonProps>((props) => {\r\n const { container, appearance, ...defaultProps } = props;\r\n const novu = useNovu();\r\n\r\n const options: NovuUIOptions = useMemo(() => {\r\n return {\r\n container,\r\n appearance,\r\n options: novu.options,\r\n };\r\n }, [container, appearance, novu.options]);\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultSlackConnectButton {...defaultProps} />\r\n </NovuUI>\r\n );\r\n});\r\n\r\nSlackConnectButtonInternal.displayName = 'SlackConnectButtonInternal';\r\n\r\nexport const SlackConnectButton = React.memo((props: SlackConnectButtonProps) => {\r\n return <SlackConnectButtonInternal {...props} />;\r\n});\r\n\r\nSlackConnectButton.displayName = 'SlackConnectButton';\r\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":[]} | ||
| {"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":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/slack-link-user/DefaultSlackLinkUser.tsx"],"sourcesContent":["import { SlackLinkUserProps } from '@notiflyio/js/ui';\r\nimport { useCallback } from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type DefaultSlackLinkUserProps = Pick<\r\n SlackLinkUserProps,\r\n | 'integrationIdentifier'\r\n | 'connectionIdentifier'\r\n | 'context'\r\n | 'onLinkSuccess'\r\n | 'onLinkError'\r\n | 'onUnlinkSuccess'\r\n | 'onUnlinkError'\r\n | 'linkLabel'\r\n | 'unlinkLabel'\r\n>;\r\n\r\nexport const DefaultSlackLinkUser = (props: DefaultSlackLinkUserProps) => {\r\n const {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n context,\r\n onLinkSuccess,\r\n onLinkError,\r\n onUnlinkSuccess,\r\n onUnlinkError,\r\n linkLabel,\r\n unlinkLabel,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'SlackLinkUser',\r\n props: {\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n context,\r\n onLinkSuccess,\r\n onLinkError,\r\n onUnlinkSuccess,\r\n onUnlinkError,\r\n linkLabel,\r\n unlinkLabel,\r\n },\r\n element,\r\n });\r\n },\r\n [\r\n novuUI,\r\n integrationIdentifier,\r\n connectionIdentifier,\r\n context,\r\n onLinkSuccess,\r\n onLinkError,\r\n onUnlinkSuccess,\r\n onUnlinkError,\r\n linkLabel,\r\n unlinkLabel,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\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":[]} | ||
| {"version":3,"sources":["../../../../src/components/slack-link-user/DefaultSlackLinkUser.tsx"],"sourcesContent":["import { SlackLinkUserProps } from '@notiflyio/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":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/slack-link-user/SlackLinkUser.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\nimport { useNovu } from '../../hooks/NovuProvider';\r\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\r\nimport { withRenderer } from '../Renderer';\r\nimport { DefaultSlackLinkUser, DefaultSlackLinkUserProps } from './DefaultSlackLinkUser';\r\n\r\nexport type SlackLinkUserProps = DefaultSlackLinkUserProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\r\n\r\nconst SlackLinkUserInternal = withRenderer<SlackLinkUserProps>((props) => {\r\n const { container, appearance, ...defaultProps } = props;\r\n const novu = useNovu();\r\n\r\n const options: NovuUIOptions = useMemo(() => {\r\n return {\r\n container,\r\n appearance,\r\n options: novu.options,\r\n };\r\n }, [container, appearance, novu.options]);\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultSlackLinkUser {...defaultProps} />\r\n </NovuUI>\r\n );\r\n});\r\n\r\nSlackLinkUserInternal.displayName = 'SlackLinkUserInternal';\r\n\r\nexport const SlackLinkUser = React.memo((props: SlackLinkUserProps) => {\r\n return <SlackLinkUserInternal {...props} />;\r\n});\r\n\r\nSlackLinkUser.displayName = 'SlackLinkUser';\r\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":[]} | ||
| {"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":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/subscription/DefaultSubscription.tsx"],"sourcesContent":["import { TopicSubscription } from '@notiflyio/js';\r\nimport { SubscriptionProps } from '@notiflyio/js/ui';\r\nimport { useCallback } from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { useRenderer } from '../../context/RendererContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type PreferencesRenderer = (subscription?: TopicSubscription, loading?: boolean) => React.ReactNode;\r\n\r\nexport type DefaultSubscriptionProps = {\r\n renderPreferences?: PreferencesRenderer;\r\n} & Pick<SubscriptionProps, 'open' | 'placement' | 'placementOffset' | 'topicKey' | 'identifier' | 'preferences'>;\r\n\r\nexport const DefaultSubscription = (props: DefaultSubscriptionProps) => {\r\n const { topicKey, identifier, preferences, open, placement, placementOffset, renderPreferences } = props;\r\n const { novuUI } = useNovuUI();\r\n const { mountElement } = useRenderer();\r\n\r\n const mount = useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'Subscription',\r\n props: {\r\n topicKey,\r\n identifier,\r\n preferences,\r\n open,\r\n placementOffset,\r\n placement,\r\n renderPreferences: renderPreferences\r\n ? (el, subscription, loading) => mountElement(el, renderPreferences(subscription, loading))\r\n : undefined,\r\n },\r\n element,\r\n });\r\n },\r\n [topicKey, identifier, preferences, open, placementOffset, placement, renderPreferences, novuUI, mountElement]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AAkCf;AA1BF,IAAM,sBAAsB,CAAC,UAAoC;AACtE,QAAM,EAAE,UAAU,YAAY,aAAa,MAAM,WAAW,iBAAiB,kBAAkB,IAAI;AACnG,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,EAAE,aAAa,IAAI,YAAY;AAErC,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,mBAAmB,oBACf,CAAC,IAAI,cAAc,YAAY,aAAa,IAAI,kBAAkB,cAAc,OAAO,CAAC,IACxF;AAAA,QACN;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,CAAC,UAAU,YAAY,aAAa,MAAM,iBAAiB,WAAW,mBAAmB,QAAQ,YAAY;AAAA,EAC/G;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/subscription/DefaultSubscription.tsx"],"sourcesContent":["import { TopicSubscription } from '@notiflyio/js';\nimport { SubscriptionProps } from '@notiflyio/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { useRenderer } from '../../context/RendererContext';\nimport { Mounter } from '../Mounter';\n\nexport type PreferencesRenderer = (subscription?: TopicSubscription, loading?: boolean) => React.ReactNode;\n\nexport type DefaultSubscriptionProps = {\n renderPreferences?: PreferencesRenderer;\n} & Pick<SubscriptionProps, 'open' | 'placement' | 'placementOffset' | 'topicKey' | 'identifier' | 'preferences'>;\n\nexport const DefaultSubscription = (props: DefaultSubscriptionProps) => {\n const { topicKey, identifier, preferences, open, placement, placementOffset, renderPreferences } = props;\n const { novuUI } = useNovuUI();\n const { mountElement } = useRenderer();\n\n const mount = useCallback(\n (element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'Subscription',\n props: {\n topicKey,\n identifier,\n preferences,\n open,\n placementOffset,\n placement,\n renderPreferences: renderPreferences\n ? (el, subscription, loading) => mountElement(el, renderPreferences(subscription, loading))\n : undefined,\n },\n element,\n });\n },\n [topicKey, identifier, preferences, open, placementOffset, placement, renderPreferences, novuUI, mountElement]\n );\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AAkCf;AA1BF,IAAM,sBAAsB,CAAC,UAAoC;AACtE,QAAM,EAAE,UAAU,YAAY,aAAa,MAAM,WAAW,iBAAiB,kBAAkB,IAAI;AACnG,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,EAAE,aAAa,IAAI,YAAY;AAErC,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,mBAAmB,oBACf,CAAC,IAAI,cAAc,YAAY,aAAa,IAAI,kBAAkB,cAAc,OAAO,CAAC,IACxF;AAAA,QACN;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,CAAC,UAAU,YAAY,aAAa,MAAM,iBAAiB,WAAW,mBAAmB,QAAQ,YAAY;AAAA,EAC/G;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/subscription/Subscription.tsx"],"sourcesContent":["import { SubscriptionLocalization } from '@notiflyio/js/ui';\r\nimport React, { useMemo } from 'react';\r\nimport { useNovu } from '../../hooks/NovuProvider';\r\nimport { ReactSubscriptionAppearance } from '../../utils/types';\r\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\r\nimport { withRenderer } from '../Renderer';\r\nimport { DefaultSubscription, DefaultSubscriptionProps } from './DefaultSubscription';\r\n\r\ntype BaseSubscriptionProps = {\r\n localization?: SubscriptionLocalization;\r\n appearance?: ReactSubscriptionAppearance;\r\n} & Pick<NovuUIOptions, 'container'>;\r\n\r\ntype SubscriptionPropsWithChildren = {\r\n children?: React.ReactNode;\r\n} & Exclude<DefaultSubscriptionProps, 'renderPreferences'> &\r\n BaseSubscriptionProps;\r\n\r\ntype SubscriptionPropsWithoutChildren = {\r\n children?: never;\r\n} & DefaultSubscriptionProps &\r\n BaseSubscriptionProps;\r\n\r\nexport type SubscriptionProps = SubscriptionPropsWithChildren | SubscriptionPropsWithoutChildren;\r\n\r\nconst SubscriptionInternal = withRenderer<SubscriptionProps>((props) => {\r\n const { container, localization, appearance, ...defaultSubscriptionProps } = props;\r\n const novu = useNovu();\r\n\r\n const options: NovuUIOptions = useMemo(() => {\r\n return {\r\n container,\r\n localization,\r\n appearance,\r\n options: novu.options,\r\n };\r\n }, [localization, appearance, container, novu.options]);\r\n\r\n if (isWithChildrenProps(props)) {\r\n const clonedChildren = React.Children.map(props.children, (child) => {\r\n if (React.isValidElement(child)) {\r\n return React.cloneElement(child, {\r\n ...child.props,\r\n topicKey: defaultSubscriptionProps.topicKey,\r\n identifier: defaultSubscriptionProps.identifier,\r\n preferences: defaultSubscriptionProps.preferences,\r\n });\r\n }\r\n\r\n return child;\r\n });\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n {clonedChildren}\r\n </NovuUI>\r\n );\r\n }\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultSubscription {...defaultSubscriptionProps} />\r\n </NovuUI>\r\n );\r\n});\r\n\r\nSubscriptionInternal.displayName = 'SubscriptionInternal';\r\n\r\nexport const Subscription = React.memo((props: SubscriptionProps) => {\r\n return <SubscriptionInternal {...props} />;\r\n});\r\n\r\nfunction isWithChildrenProps(props: SubscriptionProps): props is SubscriptionPropsWithChildren {\r\n return 'children' in props;\r\n}\r\n"],"mappings":";AACA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AAExB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,2BAAqD;AA+CxD;AA5BN,IAAM,uBAAuB,aAAgC,CAAC,UAAU;AACtE,QAAM,EAAE,WAAW,cAAc,YAAY,GAAG,yBAAyB,IAAI;AAC7E,QAAM,OAAO,QAAQ;AAErB,QAAM,UAAyB,QAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,cAAc,YAAY,WAAW,KAAK,OAAO,CAAC;AAEtD,MAAI,oBAAoB,KAAK,GAAG;AAC9B,UAAM,iBAAiB,MAAM,SAAS,IAAI,MAAM,UAAU,CAAC,UAAU;AACnE,UAAI,MAAM,eAAe,KAAK,GAAG;AAC/B,eAAO,MAAM,aAAa,OAAO;AAAA,UAC/B,GAAG,MAAM;AAAA,UACT,UAAU,yBAAyB;AAAA,UACnC,YAAY,yBAAyB;AAAA,UACrC,aAAa,yBAAyB;AAAA,QACxC,CAAC;AAAA,MACH;AAEA,aAAO;AAAA,IACT,CAAC;AAED,WACE,oBAAC,UAAO,SAAkB,MACvB,0BACH;AAAA,EAEJ;AAEA,SACE,oBAAC,UAAO,SAAkB,MACxB,8BAAC,uBAAqB,GAAG,0BAA0B,GACrD;AAEJ,CAAC;AAED,qBAAqB,cAAc;AAE5B,IAAM,eAAe,MAAM,KAAK,CAAC,UAA6B;AACnE,SAAO,oBAAC,wBAAsB,GAAG,OAAO;AAC1C,CAAC;AAED,SAAS,oBAAoB,OAAkE;AAC7F,SAAO,cAAc;AACvB;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/subscription/Subscription.tsx"],"sourcesContent":["import { SubscriptionLocalization } from '@notiflyio/js/ui';\nimport React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { ReactSubscriptionAppearance } from '../../utils/types';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultSubscription, DefaultSubscriptionProps } from './DefaultSubscription';\n\ntype BaseSubscriptionProps = {\n localization?: SubscriptionLocalization;\n appearance?: ReactSubscriptionAppearance;\n} & Pick<NovuUIOptions, 'container'>;\n\ntype SubscriptionPropsWithChildren = {\n children?: React.ReactNode;\n} & Exclude<DefaultSubscriptionProps, 'renderPreferences'> &\n BaseSubscriptionProps;\n\ntype SubscriptionPropsWithoutChildren = {\n children?: never;\n} & DefaultSubscriptionProps &\n BaseSubscriptionProps;\n\nexport type SubscriptionProps = SubscriptionPropsWithChildren | SubscriptionPropsWithoutChildren;\n\nconst SubscriptionInternal = withRenderer<SubscriptionProps>((props) => {\n const { container, localization, appearance, ...defaultSubscriptionProps } = props;\n const novu = useNovu();\n\n const options: NovuUIOptions = useMemo(() => {\n return {\n container,\n localization,\n appearance,\n options: novu.options,\n };\n }, [localization, appearance, container, novu.options]);\n\n if (isWithChildrenProps(props)) {\n const clonedChildren = React.Children.map(props.children, (child) => {\n if (React.isValidElement(child)) {\n return React.cloneElement(child, {\n ...child.props,\n topicKey: defaultSubscriptionProps.topicKey,\n identifier: defaultSubscriptionProps.identifier,\n preferences: defaultSubscriptionProps.preferences,\n });\n }\n\n return child;\n });\n\n return (\n <NovuUI options={options} novu={novu}>\n {clonedChildren}\n </NovuUI>\n );\n }\n\n return (\n <NovuUI options={options} novu={novu}>\n <DefaultSubscription {...defaultSubscriptionProps} />\n </NovuUI>\n );\n});\n\nSubscriptionInternal.displayName = 'SubscriptionInternal';\n\nexport const Subscription = React.memo((props: SubscriptionProps) => {\n return <SubscriptionInternal {...props} />;\n});\n\nfunction isWithChildrenProps(props: SubscriptionProps): props is SubscriptionPropsWithChildren {\n return 'children' in props;\n}\n"],"mappings":";AACA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AAExB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,2BAAqD;AA+CxD;AA5BN,IAAM,uBAAuB,aAAgC,CAAC,UAAU;AACtE,QAAM,EAAE,WAAW,cAAc,YAAY,GAAG,yBAAyB,IAAI;AAC7E,QAAM,OAAO,QAAQ;AAErB,QAAM,UAAyB,QAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,cAAc,YAAY,WAAW,KAAK,OAAO,CAAC;AAEtD,MAAI,oBAAoB,KAAK,GAAG;AAC9B,UAAM,iBAAiB,MAAM,SAAS,IAAI,MAAM,UAAU,CAAC,UAAU;AACnE,UAAI,MAAM,eAAe,KAAK,GAAG;AAC/B,eAAO,MAAM,aAAa,OAAO;AAAA,UAC/B,GAAG,MAAM;AAAA,UACT,UAAU,yBAAyB;AAAA,UACnC,YAAY,yBAAyB;AAAA,UACrC,aAAa,yBAAyB;AAAA,QACxC,CAAC;AAAA,MACH;AAEA,aAAO;AAAA,IACT,CAAC;AAED,WACE,oBAAC,UAAO,SAAkB,MACvB,0BACH;AAAA,EAEJ;AAEA,SACE,oBAAC,UAAO,SAAkB,MACxB,8BAAC,uBAAqB,GAAG,0BAA0B,GACrD;AAEJ,CAAC;AAED,qBAAqB,cAAc;AAE5B,IAAM,eAAe,MAAM,KAAK,CAAC,UAA6B;AACnE,SAAO,oBAAC,wBAAsB,GAAG,OAAO;AAC1C,CAAC;AAED,SAAS,oBAAoB,OAAkE;AAC7F,SAAO,cAAc;AACvB;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/subscription/SubscriptionButton.tsx"],"sourcesContent":["import type { SubscriptionButtonWrapperProps } from '@notiflyio/js/ui';\r\nimport React from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type SubscriptionButtonProps = Partial<SubscriptionButtonWrapperProps>;\r\n\r\nexport const SubscriptionButton = React.memo(\r\n ({\r\n topicKey,\r\n identifier,\r\n preferences,\r\n onClick,\r\n onDeleteError,\r\n onDeleteSuccess,\r\n onCreateError,\r\n onCreateSuccess,\r\n }: SubscriptionButtonProps) => {\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = React.useCallback(\r\n (element: HTMLElement) => {\r\n if (!topicKey) {\r\n return;\r\n }\r\n\r\n return novuUI.mountComponent({\r\n name: 'SubscriptionButton',\r\n element,\r\n props: {\r\n topicKey,\r\n identifier,\r\n preferences,\r\n onClick,\r\n onDeleteError,\r\n onDeleteSuccess,\r\n onCreateError,\r\n onCreateSuccess,\r\n },\r\n });\r\n },\r\n [\r\n novuUI,\r\n topicKey,\r\n identifier,\r\n preferences,\r\n onClick,\r\n onDeleteError,\r\n onDeleteSuccess,\r\n onCreateError,\r\n onCreateSuccess,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n }\r\n);\r\n"],"mappings":";AACA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAmDb;AA/CJ,IAAM,qBAAqB,MAAM;AAAA,EACtC,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAA+B;AAC7B,UAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,UAAM,QAAQ,MAAM;AAAA,MAClB,CAAC,YAAyB;AACxB,YAAI,CAAC,UAAU;AACb;AAAA,QACF;AAEA,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA,OAAO;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO,oBAAC,WAAQ,OAAc;AAAA,EAChC;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/subscription/SubscriptionButton.tsx"],"sourcesContent":["import type { SubscriptionButtonWrapperProps } from '@notiflyio/js/ui';\nimport React from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type SubscriptionButtonProps = Partial<SubscriptionButtonWrapperProps>;\n\nexport const SubscriptionButton = React.memo(\n ({\n topicKey,\n identifier,\n preferences,\n onClick,\n onDeleteError,\n onDeleteSuccess,\n onCreateError,\n onCreateSuccess,\n }: SubscriptionButtonProps) => {\n const { novuUI } = useNovuUI();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n if (!topicKey) {\n return;\n }\n\n return novuUI.mountComponent({\n name: 'SubscriptionButton',\n element,\n props: {\n topicKey,\n identifier,\n preferences,\n onClick,\n onDeleteError,\n onDeleteSuccess,\n onCreateError,\n onCreateSuccess,\n },\n });\n },\n [\n novuUI,\n topicKey,\n identifier,\n preferences,\n onClick,\n onDeleteError,\n onDeleteSuccess,\n onCreateError,\n onCreateSuccess,\n ]\n );\n\n return <Mounter mount={mount} />;\n }\n);\n"],"mappings":";AACA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAmDb;AA/CJ,IAAM,qBAAqB,MAAM;AAAA,EACtC,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAA+B;AAC7B,UAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,UAAM,QAAQ,MAAM;AAAA,MAClB,CAAC,YAAyB;AACxB,YAAI,CAAC,UAAU;AACb;AAAA,QACF;AAEA,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA,OAAO;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO,oBAAC,WAAQ,OAAc;AAAA,EAChC;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/subscription/SubscriptionPreferences.tsx"],"sourcesContent":["import type { SubscriptionPreferencesWrapperProps } from '@notiflyio/js/ui';\r\nimport React from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type SubscriptionPreferencesProps = Partial<SubscriptionPreferencesWrapperProps>;\r\n\r\nexport const SubscriptionPreferences = React.memo(\r\n ({\r\n topicKey,\r\n identifier,\r\n preferences,\r\n onClick,\r\n onDeleteError,\r\n onDeleteSuccess,\r\n onCreateError,\r\n onCreateSuccess,\r\n }: SubscriptionPreferencesProps) => {\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = React.useCallback(\r\n (element: HTMLElement) => {\r\n if (!topicKey) {\r\n return;\r\n }\r\n\r\n return novuUI.mountComponent({\r\n name: 'SubscriptionPreferences',\r\n element,\r\n props: {\r\n topicKey,\r\n identifier,\r\n preferences,\r\n onClick,\r\n onDeleteError,\r\n onDeleteSuccess,\r\n onCreateError,\r\n onCreateSuccess,\r\n },\r\n });\r\n },\r\n [\r\n novuUI,\r\n topicKey,\r\n identifier,\r\n preferences,\r\n onClick,\r\n onDeleteError,\r\n onDeleteSuccess,\r\n onCreateError,\r\n onCreateSuccess,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n }\r\n);\r\n"],"mappings":";AACA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAmDb;AA/CJ,IAAM,0BAA0B,MAAM;AAAA,EAC3C,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAAoC;AAClC,UAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,UAAM,QAAQ,MAAM;AAAA,MAClB,CAAC,YAAyB;AACxB,YAAI,CAAC,UAAU;AACb;AAAA,QACF;AAEA,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA,OAAO;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO,oBAAC,WAAQ,OAAc;AAAA,EAChC;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/subscription/SubscriptionPreferences.tsx"],"sourcesContent":["import type { SubscriptionPreferencesWrapperProps } from '@notiflyio/js/ui';\nimport React from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type SubscriptionPreferencesProps = Partial<SubscriptionPreferencesWrapperProps>;\n\nexport const SubscriptionPreferences = React.memo(\n ({\n topicKey,\n identifier,\n preferences,\n onClick,\n onDeleteError,\n onDeleteSuccess,\n onCreateError,\n onCreateSuccess,\n }: SubscriptionPreferencesProps) => {\n const { novuUI } = useNovuUI();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n if (!topicKey) {\n return;\n }\n\n return novuUI.mountComponent({\n name: 'SubscriptionPreferences',\n element,\n props: {\n topicKey,\n identifier,\n preferences,\n onClick,\n onDeleteError,\n onDeleteSuccess,\n onCreateError,\n onCreateSuccess,\n },\n });\n },\n [\n novuUI,\n topicKey,\n identifier,\n preferences,\n onClick,\n onDeleteError,\n onDeleteSuccess,\n onCreateError,\n onCreateSuccess,\n ]\n );\n\n return <Mounter mount={mount} />;\n }\n);\n"],"mappings":";AACA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAmDb;AA/CJ,IAAM,0BAA0B,MAAM;AAAA,EAC3C,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAAoC;AAClC,UAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,UAAM,QAAQ,MAAM;AAAA,MAClB,CAAC,YAAyB;AACxB,YAAI,CAAC,UAAU;AACb;AAAA,QACF;AAEA,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA,OAAO;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO,oBAAC,WAAQ,OAAc;AAAA,EAChC;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/telegram-connect-button/DefaultTelegramConnectButton.tsx"],"sourcesContent":["import { TelegramConnectButtonProps } from '@notiflyio/js/ui';\r\nimport { useCallback } from 'react';\r\nimport { useNovuUI } from '../../context/NovuUIContext';\r\nimport { Mounter } from '../Mounter';\r\n\r\nexport type DefaultTelegramConnectButtonProps = Pick<\r\n TelegramConnectButtonProps,\r\n | 'integrationIdentifier'\r\n | 'subscriberId'\r\n | 'onConnectSuccess'\r\n | 'onConnectError'\r\n | 'onDisconnectSuccess'\r\n | 'onDisconnectError'\r\n | 'connectLabel'\r\n | 'connectedLabel'\r\n>;\r\n\r\nexport const DefaultTelegramConnectButton = (props: DefaultTelegramConnectButtonProps) => {\r\n const {\r\n integrationIdentifier,\r\n subscriberId,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n } = props;\r\n const { novuUI } = useNovuUI();\r\n\r\n const mount = useCallback(\r\n (element: HTMLElement) => {\r\n return novuUI.mountComponent({\r\n name: 'TelegramConnectButton',\r\n props: {\r\n integrationIdentifier,\r\n subscriberId,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n },\r\n element,\r\n });\r\n },\r\n [\r\n novuUI,\r\n integrationIdentifier,\r\n subscriberId,\r\n onConnectSuccess,\r\n onConnectError,\r\n onDisconnectSuccess,\r\n onDisconnectError,\r\n connectLabel,\r\n connectedLabel,\r\n ]\r\n );\r\n\r\n return <Mounter mount={mount} />;\r\n};\r\n"],"mappings":";AACA,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAyDf;AA3CF,IAAM,+BAA+B,CAAC,UAA6C;AACxF,QAAM;AAAA,IACJ;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,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,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/telegram-connect-button/DefaultTelegramConnectButton.tsx"],"sourcesContent":["import { TelegramConnectButtonProps } from '@notiflyio/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultTelegramConnectButtonProps = Pick<\n TelegramConnectButtonProps,\n | 'integrationIdentifier'\n | 'subscriberId'\n | 'onConnectSuccess'\n | 'onConnectError'\n | 'onDisconnectSuccess'\n | 'onDisconnectError'\n | 'connectLabel'\n | 'connectedLabel'\n>;\n\nexport const DefaultTelegramConnectButton = (props: DefaultTelegramConnectButtonProps) => {\n const {\n integrationIdentifier,\n subscriberId,\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: 'TelegramConnectButton',\n props: {\n integrationIdentifier,\n subscriberId,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n },\n element,\n });\n },\n [\n novuUI,\n integrationIdentifier,\n subscriberId,\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;AAyDf;AA3CF,IAAM,+BAA+B,CAAC,UAA6C;AACxF,QAAM;AAAA,IACJ;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,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,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/components/telegram-connect-button/TelegramConnectButton.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\nimport { useNovu } from '../../hooks/NovuProvider';\r\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\r\nimport { withRenderer } from '../Renderer';\r\nimport { DefaultTelegramConnectButton, DefaultTelegramConnectButtonProps } from './DefaultTelegramConnectButton';\r\n\r\nexport type TelegramConnectButtonProps = DefaultTelegramConnectButtonProps &\r\n Pick<NovuUIOptions, 'container' | 'appearance'>;\r\n\r\nconst TelegramConnectButtonInternal = withRenderer<TelegramConnectButtonProps>((props) => {\r\n const { container, appearance, ...defaultProps } = props;\r\n const novu = useNovu();\r\n\r\n const options: NovuUIOptions = useMemo(() => {\r\n return {\r\n container,\r\n appearance,\r\n options: novu.options,\r\n };\r\n }, [container, appearance, novu.options]);\r\n\r\n return (\r\n <NovuUI options={options} novu={novu}>\r\n <DefaultTelegramConnectButton {...defaultProps} />\r\n </NovuUI>\r\n );\r\n});\r\n\r\nTelegramConnectButtonInternal.displayName = 'TelegramConnectButtonInternal';\r\n\r\nexport const TelegramConnectButton = React.memo((props: TelegramConnectButtonProps) => {\r\n return <TelegramConnectButtonInternal {...props} />;\r\n});\r\n\r\nTelegramConnectButton.displayName = 'TelegramConnectButton';\r\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,oCAAuE;AAmB1E;AAdN,IAAM,gCAAgC,aAAyC,CAAC,UAAU;AACxF,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,gCAA8B,GAAG,cAAc,GAClD;AAEJ,CAAC;AAED,8BAA8B,cAAc;AAErC,IAAM,wBAAwB,MAAM,KAAK,CAAC,UAAsC;AACrF,SAAO,oBAAC,iCAA+B,GAAG,OAAO;AACnD,CAAC;AAED,sBAAsB,cAAc;","names":[]} | ||
| {"version":3,"sources":["../../../../src/components/telegram-connect-button/TelegramConnectButton.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultTelegramConnectButton, DefaultTelegramConnectButtonProps } from './DefaultTelegramConnectButton';\n\nexport type TelegramConnectButtonProps = DefaultTelegramConnectButtonProps &\n Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst TelegramConnectButtonInternal = withRenderer<TelegramConnectButtonProps>((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 <DefaultTelegramConnectButton {...defaultProps} />\n </NovuUI>\n );\n});\n\nTelegramConnectButtonInternal.displayName = 'TelegramConnectButtonInternal';\n\nexport const TelegramConnectButton = React.memo((props: TelegramConnectButtonProps) => {\n return <TelegramConnectButtonInternal {...props} />;\n});\n\nTelegramConnectButton.displayName = 'TelegramConnectButton';\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,oCAAuE;AAmB1E;AAdN,IAAM,gCAAgC,aAAyC,CAAC,UAAU;AACxF,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,gCAA8B,GAAG,cAAc,GAClD;AAEJ,CAAC;AAED,8BAA8B,cAAc;AAErC,IAAM,wBAAwB,MAAM,KAAK,CAAC,UAAsC;AACrF,SAAO,oBAAC,iCAA+B,GAAG,OAAO;AACnD,CAAC;AAED,sBAAsB,cAAc;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/context/NovuUIContext.tsx"],"sourcesContent":["import type { NovuUI } from '@notiflyio/js/ui';\r\nimport React from 'react';\r\nimport { createContextAndHook } from '../utils/createContextAndHook';\r\n\r\ntype NovuUIContextValue = {\r\n novuUI: NovuUI;\r\n};\r\n\r\nconst [NovuUIContext, useNovuUIContext, useUnsafeNovuUIContext] =\r\n createContextAndHook<NovuUIContextValue>('NovuUIContext');\r\n\r\nconst NovuUIProvider = (props: React.PropsWithChildren<{ value: NovuUIContextValue }>) => {\r\n return <NovuUIContext.Provider value={{ value: props.value }}>{props.children}</NovuUIContext.Provider>;\r\n};\r\n\r\nexport { useNovuUIContext as useNovuUI, useUnsafeNovuUIContext as useUnsafeNovuUI, NovuUIProvider };\r\n"],"mappings":";AAEA,SAAS,4BAA4B;AAU5B;AAJT,IAAM,CAAC,eAAe,kBAAkB,sBAAsB,IAC5D,qBAAyC,eAAe;AAE1D,IAAM,iBAAiB,CAAC,UAAkE;AACxF,SAAO,oBAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,OAAO,MAAM,MAAM,GAAI,gBAAM,UAAS;AAChF;","names":[]} | ||
| {"version":3,"sources":["../../../src/context/NovuUIContext.tsx"],"sourcesContent":["import type { NovuUI } from '@notiflyio/js/ui';\nimport React from 'react';\nimport { createContextAndHook } from '../utils/createContextAndHook';\n\ntype NovuUIContextValue = {\n novuUI: NovuUI;\n};\n\nconst [NovuUIContext, useNovuUIContext, useUnsafeNovuUIContext] =\n createContextAndHook<NovuUIContextValue>('NovuUIContext');\n\nconst NovuUIProvider = (props: React.PropsWithChildren<{ value: NovuUIContextValue }>) => {\n return <NovuUIContext.Provider value={{ value: props.value }}>{props.children}</NovuUIContext.Provider>;\n};\n\nexport { useNovuUIContext as useNovuUI, useUnsafeNovuUIContext as useUnsafeNovuUI, NovuUIProvider };\n"],"mappings":";AAEA,SAAS,4BAA4B;AAU5B;AAJT,IAAM,CAAC,eAAe,kBAAkB,sBAAsB,IAC5D,qBAAyC,eAAe;AAE1D,IAAM,iBAAiB,CAAC,UAAkE;AACxF,SAAO,oBAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,OAAO,MAAM,MAAM,GAAI,gBAAM,UAAS;AAChF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/context/RendererContext.tsx"],"sourcesContent":["import React from 'react';\r\nimport { createContextAndHook } from '../utils/createContextAndHook';\r\n\r\nexport type MountedElement = React.ReactNode;\r\nexport type MountedElements = Map<HTMLElement, MountedElement>;\r\n\r\ntype RendererContextValue = {\r\n mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void;\r\n};\r\n\r\nconst [RendererContext, useRendererContext, useUnsafeRendererContext] =\r\n createContextAndHook<RendererContextValue>('RendererContext');\r\n\r\nconst RendererProvider = (props: React.PropsWithChildren<{ value: RendererContextValue }>) => {\r\n return <RendererContext.Provider value={{ value: props.value }}>{props.children}</RendererContext.Provider>;\r\n};\r\n\r\nexport { useRendererContext as useRenderer, useUnsafeRendererContext as useUnsafeRenderer, RendererProvider };\r\n"],"mappings":";AACA,SAAS,4BAA4B;AAa5B;AAJT,IAAM,CAAC,iBAAiB,oBAAoB,wBAAwB,IAClE,qBAA2C,iBAAiB;AAE9D,IAAM,mBAAmB,CAAC,UAAoE;AAC5F,SAAO,oBAAC,gBAAgB,UAAhB,EAAyB,OAAO,EAAE,OAAO,MAAM,MAAM,GAAI,gBAAM,UAAS;AAClF;","names":[]} | ||
| {"version":3,"sources":["../../../src/context/RendererContext.tsx"],"sourcesContent":["import React from 'react';\nimport { createContextAndHook } from '../utils/createContextAndHook';\n\nexport type MountedElement = React.ReactNode;\nexport type MountedElements = Map<HTMLElement, MountedElement>;\n\ntype RendererContextValue = {\n mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void;\n};\n\nconst [RendererContext, useRendererContext, useUnsafeRendererContext] =\n createContextAndHook<RendererContextValue>('RendererContext');\n\nconst RendererProvider = (props: React.PropsWithChildren<{ value: RendererContextValue }>) => {\n return <RendererContext.Provider value={{ value: props.value }}>{props.children}</RendererContext.Provider>;\n};\n\nexport { useRendererContext as useRenderer, useUnsafeRendererContext as useUnsafeRenderer, RendererProvider };\n"],"mappings":";AACA,SAAS,4BAA4B;AAa5B;AAJT,IAAM,CAAC,iBAAiB,oBAAoB,wBAAwB,IAClE,qBAA2C,iBAAiB;AAE9D,IAAM,mBAAmB,CAAC,UAAoE;AAC5F,SAAO,oBAAC,gBAAgB,UAAhB,EAAyB,OAAO,EAAE,OAAO,MAAM,MAAM,GAAI,gBAAM,UAAS;AAClF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export type * from '@notiflyio/js';\r\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\r\nexport { NovuProvider, useNovu } from './NovuProvider';\r\nexport * from './useChannelConnection';\r\nexport * from './useChannelConnections';\r\nexport * from './useChannelEndpoint';\r\nexport * from './useCounts';\r\nexport * from './useCreateChannelEndpoint';\r\nexport * from './useCreateSubscription';\r\nexport * from './useDeleteChannelEndpoint';\r\nexport * from './useNotifications';\r\nexport * from './usePreferences';\r\nexport * from './useRemoveSubscription';\r\nexport * from './useSchedule';\r\nexport * from './useSubscription';\r\nexport * from './useSubscriptions';\r\nexport * from './useTelegramSubscriberLink';\r\nexport * from './useUpdateSubscription';\r\n"],"mappings":";AACA,SAAS,iBAAiB,mBAAmB,+BAA+B;AAC5E,SAAS,cAAc,eAAe;AACtC,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export type * from '@notiflyio/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\nexport { NovuProvider, useNovu } from './NovuProvider';\nexport * from './useChannelConnection';\nexport * from './useChannelConnections';\nexport * from './useChannelEndpoint';\nexport * from './useCounts';\nexport * from './useCreateChannelEndpoint';\nexport * from './useCreateSubscription';\nexport * from './useDeleteChannelEndpoint';\nexport * from './useNotifications';\nexport * from './usePreferences';\nexport * from './useRemoveSubscription';\nexport * from './useSchedule';\nexport * from './useSubscription';\nexport * from './useSubscriptions';\nexport * from './useTelegramSubscriberLink';\nexport * from './useUpdateSubscription';\n"],"mappings":";AACA,SAAS,iBAAiB,mBAAmB,+BAA+B;AAC5E,SAAS,cAAc,eAAe;AACtC,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/hooks/internal/useBrowserTabsChannel.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\r\n\r\nexport const useBrowserTabsChannel = <T = unknown>({\r\n channelName,\r\n onMessage,\r\n enabled = true,\r\n}: {\r\n channelName: string;\r\n onMessage: (args: T) => void;\r\n enabled?: boolean;\r\n}) => {\r\n const [tabsChannel] = useState(\r\n typeof BroadcastChannel !== 'undefined' ? new BroadcastChannel(channelName) : undefined\r\n );\r\n\r\n const postMessage = (data: T) => {\r\n if (!enabled) return;\r\n tabsChannel?.postMessage(data);\r\n };\r\n\r\n useEffect(() => {\r\n if (!enabled) return;\r\n\r\n const listener = (event: MessageEvent<T>) => {\r\n onMessage(event.data);\r\n };\r\n\r\n tabsChannel?.addEventListener('message', listener);\r\n\r\n return () => {\r\n tabsChannel?.removeEventListener('message', listener);\r\n };\r\n }, [enabled]);\r\n\r\n return { postMessage };\r\n};\r\n"],"mappings":";AAAA,SAAS,WAAW,gBAAgB;AAE7B,IAAM,wBAAwB,CAAc;AAAA,EACjD;AAAA,EACA;AAAA,EACA,UAAU;AACZ,MAIM;AACJ,QAAM,CAAC,WAAW,IAAI;AAAA,IACpB,OAAO,qBAAqB,cAAc,IAAI,iBAAiB,WAAW,IAAI;AAAA,EAChF;AAEA,QAAM,cAAc,CAAC,SAAY;AAC/B,QAAI,CAAC,QAAS;AACd,iBAAa,YAAY,IAAI;AAAA,EAC/B;AAEA,YAAU,MAAM;AACd,QAAI,CAAC,QAAS;AAEd,UAAM,WAAW,CAAC,UAA2B;AAC3C,gBAAU,MAAM,IAAI;AAAA,IACtB;AAEA,iBAAa,iBAAiB,WAAW,QAAQ;AAEjD,WAAO,MAAM;AACX,mBAAa,oBAAoB,WAAW,QAAQ;AAAA,IACtD;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAEZ,SAAO,EAAE,YAAY;AACvB;","names":[]} | ||
| {"version":3,"sources":["../../../../src/hooks/internal/useBrowserTabsChannel.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport const useBrowserTabsChannel = <T = unknown>({\n channelName,\n onMessage,\n enabled = true,\n}: {\n channelName: string;\n onMessage: (args: T) => void;\n enabled?: boolean;\n}) => {\n const [tabsChannel] = useState(\n typeof BroadcastChannel !== 'undefined' ? new BroadcastChannel(channelName) : undefined\n );\n\n const postMessage = (data: T) => {\n if (!enabled) return;\n tabsChannel?.postMessage(data);\n };\n\n useEffect(() => {\n if (!enabled) return;\n\n const listener = (event: MessageEvent<T>) => {\n onMessage(event.data);\n };\n\n tabsChannel?.addEventListener('message', listener);\n\n return () => {\n tabsChannel?.removeEventListener('message', listener);\n };\n }, [enabled]);\n\n return { postMessage };\n};\n"],"mappings":";AAAA,SAAS,WAAW,gBAAgB;AAE7B,IAAM,wBAAwB,CAAc;AAAA,EACjD;AAAA,EACA;AAAA,EACA,UAAU;AACZ,MAIM;AACJ,QAAM,CAAC,WAAW,IAAI;AAAA,IACpB,OAAO,qBAAqB,cAAc,IAAI,iBAAiB,WAAW,IAAI;AAAA,EAChF;AAEA,QAAM,cAAc,CAAC,SAAY;AAC/B,QAAI,CAAC,QAAS;AACd,iBAAa,YAAY,IAAI;AAAA,EAC/B;AAEA,YAAU,MAAM;AACd,QAAI,CAAC,QAAS;AAEd,UAAM,WAAW,CAAC,UAA2B;AAC3C,gBAAU,MAAM,IAAI;AAAA,IACtB;AAEA,iBAAa,iBAAiB,WAAW,QAAQ;AAEjD,WAAO,MAAM;AACX,mBAAa,oBAAoB,WAAW,QAAQ;AAAA,IACtD;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAEZ,SAAO,EAAE,YAAY;AACvB;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/hooks/internal/useDataRef.ts"],"sourcesContent":["import { useRef } from 'react';\r\n\r\nexport const useDataRef = <T>(data: T) => {\r\n const ref = useRef(data);\r\n ref.current = data;\r\n\r\n return ref;\r\n};\r\n"],"mappings":";AAAA,SAAS,cAAc;AAEhB,IAAM,aAAa,CAAI,SAAY;AACxC,QAAM,MAAM,OAAO,IAAI;AACvB,MAAI,UAAU;AAEd,SAAO;AACT;","names":[]} | ||
| {"version":3,"sources":["../../../../src/hooks/internal/useDataRef.ts"],"sourcesContent":["import { useRef } from 'react';\n\nexport const useDataRef = <T>(data: T) => {\n const ref = useRef(data);\n ref.current = data;\n\n return ref;\n};\n"],"mappings":";AAAA,SAAS,cAAc;AAEhB,IAAM,aAAa,CAAI,SAAY;AACxC,QAAM,MAAM,OAAO,IAAI;AACvB,MAAI,UAAU;AAEd,SAAO;AACT;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/hooks/internal/useWebsocketEvent.ts"],"sourcesContent":["import { EventHandler, Events, SocketEventNames } from '@notiflyio/js';\r\nimport { useEffect } from 'react';\r\nimport { requestLock } from '../../utils/requestLock';\r\nimport { useNovu } from '../NovuProvider';\r\nimport { useBrowserTabsChannel } from './useBrowserTabsChannel';\r\n\r\nexport const useWebSocketEvent = <E extends SocketEventNames>({\r\n event: webSocketEvent,\r\n eventHandler: onMessage,\r\n enabled = true,\r\n}: {\r\n event: E;\r\n eventHandler: (args: Events[E]) => void;\r\n enabled?: boolean;\r\n}) => {\r\n const novu = useNovu();\r\n const channelName = `nv_ws_connection:a=${novu.applicationIdentifier}:s=${novu.subscriberId}:c=${novu.contextKey}:e=${webSocketEvent}`;\r\n\r\n const { postMessage } = useBrowserTabsChannel({\r\n channelName,\r\n onMessage,\r\n enabled,\r\n });\r\n\r\n const updateReadCount: EventHandler<Events[E]> = (data) => {\r\n onMessage(data);\r\n postMessage(data);\r\n };\r\n\r\n useEffect(() => {\r\n if (!enabled) return;\r\n\r\n let cleanup: () => void;\r\n const resolveLock = requestLock(channelName, () => {\r\n cleanup = novu.on(webSocketEvent, updateReadCount);\r\n });\r\n\r\n return () => {\r\n if (cleanup) {\r\n cleanup();\r\n }\r\n\r\n resolveLock();\r\n };\r\n }, [enabled]);\r\n};\r\n"],"mappings":";AACA,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,6BAA6B;AAE/B,IAAM,oBAAoB,CAA6B;AAAA,EAC5D,OAAO;AAAA,EACP,cAAc;AAAA,EACd,UAAU;AACZ,MAIM;AACJ,QAAM,OAAO,QAAQ;AACrB,QAAM,cAAc,sBAAsB,KAAK,qBAAqB,MAAM,KAAK,YAAY,MAAM,KAAK,UAAU,MAAM,cAAc;AAEpI,QAAM,EAAE,YAAY,IAAI,sBAAsB;AAAA,IAC5C;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,kBAA2C,CAAC,SAAS;AACzD,cAAU,IAAI;AACd,gBAAY,IAAI;AAAA,EAClB;AAEA,YAAU,MAAM;AACd,QAAI,CAAC,QAAS;AAEd,QAAI;AACJ,UAAM,cAAc,YAAY,aAAa,MAAM;AACjD,gBAAU,KAAK,GAAG,gBAAgB,eAAe;AAAA,IACnD,CAAC;AAED,WAAO,MAAM;AACX,UAAI,SAAS;AACX,gBAAQ;AAAA,MACV;AAEA,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AACd;","names":[]} | ||
| {"version":3,"sources":["../../../../src/hooks/internal/useWebsocketEvent.ts"],"sourcesContent":["import { EventHandler, Events, SocketEventNames } from '@notiflyio/js';\nimport { useEffect } from 'react';\nimport { requestLock } from '../../utils/requestLock';\nimport { useNovu } from '../NovuProvider';\nimport { useBrowserTabsChannel } from './useBrowserTabsChannel';\n\nexport const useWebSocketEvent = <E extends SocketEventNames>({\n event: webSocketEvent,\n eventHandler: onMessage,\n enabled = true,\n}: {\n event: E;\n eventHandler: (args: Events[E]) => void;\n enabled?: boolean;\n}) => {\n const novu = useNovu();\n const channelName = `nv_ws_connection:a=${novu.applicationIdentifier}:s=${novu.subscriberId}:c=${novu.contextKey}:e=${webSocketEvent}`;\n\n const { postMessage } = useBrowserTabsChannel({\n channelName,\n onMessage,\n enabled,\n });\n\n const updateReadCount: EventHandler<Events[E]> = (data) => {\n onMessage(data);\n postMessage(data);\n };\n\n useEffect(() => {\n if (!enabled) return;\n\n let cleanup: () => void;\n const resolveLock = requestLock(channelName, () => {\n cleanup = novu.on(webSocketEvent, updateReadCount);\n });\n\n return () => {\n if (cleanup) {\n cleanup();\n }\n\n resolveLock();\n };\n }, [enabled]);\n};\n"],"mappings":";AACA,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,6BAA6B;AAE/B,IAAM,oBAAoB,CAA6B;AAAA,EAC5D,OAAO;AAAA,EACP,cAAc;AAAA,EACd,UAAU;AACZ,MAIM;AACJ,QAAM,OAAO,QAAQ;AACrB,QAAM,cAAc,sBAAsB,KAAK,qBAAqB,MAAM,KAAK,YAAY,MAAM,KAAK,UAAU,MAAM,cAAc;AAEpI,QAAM,EAAE,YAAY,IAAI,sBAAsB;AAAA,IAC5C;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,kBAA2C,CAAC,SAAS;AACzD,cAAU,IAAI;AACd,gBAAY,IAAI;AAAA,EAClB;AAEA,YAAU,MAAM;AACd,QAAI,CAAC,QAAS;AAEd,QAAI;AACJ,UAAM,cAAc,YAAY,aAAa,MAAM;AACjD,gBAAU,KAAK,GAAG,gBAAgB,eAAe;AAAA,IACnD,CAAC;AAED,WAAO,MAAM;AACX,UAAI,SAAS;AACX,gBAAQ;AAAA,MACV;AAEA,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AACd;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/NovuProvider.tsx"],"sourcesContent":["import { Novu, NovuOptions } from '@notiflyio/js';\r\nimport { buildSubscriber } from '@notiflyio/js/internal';\r\nimport { createContext, ReactNode, useContext, useMemo } from 'react';\r\n\r\nexport type NovuProviderProps = NovuOptions & {\r\n /**\r\n * When `false`, disables the WebSocket subscription that auto-injects\r\n * newly received notifications into the list and subscription that auto-resync\r\n * notification counts. Built-in mutations like\r\n * `readAll`, `seenAll`, `archiveAll`, and `archiveAllRead` continue to\r\n * update local state. Use this when you want to drive new-notification updates yourself (e.g.\r\n * via your own `novu.on('notifications.notification_received', ...)`\r\n * handler combined with `refetch()`). Defaults to `true`.\r\n */\r\n realtime?: boolean;\r\n children: ReactNode;\r\n};\r\n\r\nconst NovuContext = createContext<{ novu: Novu; realtime: boolean }>({ novu: undefined as any, realtime: true });\r\n\r\nexport const NovuProvider = (props: NovuProviderProps) => {\r\n const { subscriberId, realtime = true, ...propsWithoutSubscriberId } = props;\r\n const subscriberObj = useMemo(\r\n () => buildSubscriber({ subscriberId, subscriber: props.subscriber }),\r\n [subscriberId, props.subscriber]\r\n );\r\n const applicationIdentifier = propsWithoutSubscriberId.applicationIdentifier\r\n ? propsWithoutSubscriberId.applicationIdentifier\r\n : '';\r\n\r\n const providerProps: NovuProviderProps = {\r\n ...propsWithoutSubscriberId,\r\n applicationIdentifier,\r\n subscriber: subscriberObj,\r\n realtime,\r\n };\r\n\r\n return (\r\n <InternalNovuProvider {...providerProps} applicationIdentifier={applicationIdentifier}>\r\n {props.children}\r\n </InternalNovuProvider>\r\n );\r\n};\r\n\r\n/**\r\n * @internal Should be used internally not to be exposed outside of the library\r\n */\r\nexport const InternalNovuProvider = (props: NovuProviderProps) => {\r\n const applicationIdentifier = props.applicationIdentifier || '';\r\n const subscriberObj = useMemo(\r\n () => buildSubscriber({ subscriberId: props.subscriberId, subscriber: props.subscriber }),\r\n [props.subscriberId, props.subscriber]\r\n );\r\n\r\n const {\r\n children,\r\n subscriberHash,\r\n contextHash,\r\n backendUrl,\r\n apiUrl,\r\n socketUrl,\r\n socketOptions,\r\n useCache,\r\n defaultSchedule,\r\n context,\r\n realtime = true,\r\n } = props;\r\n\r\n const value = useMemo(\r\n () => ({\r\n novu: new Novu({\r\n applicationIdentifier,\r\n subscriberHash,\r\n contextHash,\r\n backendUrl,\r\n apiUrl,\r\n socketUrl,\r\n socketOptions,\r\n useCache,\r\n subscriber: subscriberObj,\r\n defaultSchedule,\r\n context,\r\n }),\r\n realtime,\r\n }),\r\n [\r\n applicationIdentifier,\r\n subscriberHash,\r\n subscriberObj,\r\n context,\r\n contextHash,\r\n backendUrl,\r\n apiUrl,\r\n socketUrl,\r\n socketOptions,\r\n useCache,\r\n realtime,\r\n ]\r\n );\r\n\r\n return <NovuContext.Provider value={value}>{children}</NovuContext.Provider>;\r\n};\r\n\r\nexport const useNovu = () => {\r\n const context = useContext(NovuContext);\r\n if (!context.novu) {\r\n throw new Error('useNovu must be used within a <NovuProvider />');\r\n }\r\n\r\n return context.novu;\r\n};\r\n\r\nexport const useUnsafeNovu = () => {\r\n const context = useContext(NovuContext);\r\n\r\n return context.novu;\r\n};\r\n\r\nexport const useRealtime = () => {\r\n const context = useContext(NovuContext);\r\n\r\n return context.realtime;\r\n};\r\n"],"mappings":";AAAA,SAAS,YAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,eAA0B,YAAY,eAAe;AAoC1D;AApBJ,IAAM,cAAc,cAAiD,EAAE,MAAM,QAAkB,UAAU,KAAK,CAAC;AAExG,IAAM,eAAe,CAAC,UAA6B;AACxD,QAAM,EAAE,cAAc,WAAW,MAAM,GAAG,yBAAyB,IAAI;AACvE,QAAM,gBAAgB;AAAA,IACpB,MAAM,gBAAgB,EAAE,cAAc,YAAY,MAAM,WAAW,CAAC;AAAA,IACpE,CAAC,cAAc,MAAM,UAAU;AAAA,EACjC;AACA,QAAM,wBAAwB,yBAAyB,wBACnD,yBAAyB,wBACzB;AAEJ,QAAM,gBAAmC;AAAA,IACvC,GAAG;AAAA,IACH;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,EACF;AAEA,SACE,oBAAC,wBAAsB,GAAG,eAAe,uBACtC,gBAAM,UACT;AAEJ;AAKO,IAAM,uBAAuB,CAAC,UAA6B;AAChE,QAAM,wBAAwB,MAAM,yBAAyB;AAC7D,QAAM,gBAAgB;AAAA,IACpB,MAAM,gBAAgB,EAAE,cAAc,MAAM,cAAc,YAAY,MAAM,WAAW,CAAC;AAAA,IACxF,CAAC,MAAM,cAAc,MAAM,UAAU;AAAA,EACvC;AAEA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,EACb,IAAI;AAEJ,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,MAAM,IAAI,KAAK;AAAA,QACb;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,YAAY;AAAA,QACZ;AAAA,QACA;AAAA,MACF,CAAC;AAAA,MACD;AAAA,IACF;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,YAAY,UAAZ,EAAqB,OAAe,UAAS;AACvD;AAEO,IAAM,UAAU,MAAM;AAC3B,QAAM,UAAU,WAAW,WAAW;AACtC,MAAI,CAAC,QAAQ,MAAM;AACjB,UAAM,IAAI,MAAM,gDAAgD;AAAA,EAClE;AAEA,SAAO,QAAQ;AACjB;AAEO,IAAM,gBAAgB,MAAM;AACjC,QAAM,UAAU,WAAW,WAAW;AAEtC,SAAO,QAAQ;AACjB;AAEO,IAAM,cAAc,MAAM;AAC/B,QAAM,UAAU,WAAW,WAAW;AAEtC,SAAO,QAAQ;AACjB;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/NovuProvider.tsx"],"sourcesContent":["import { Novu, NovuOptions } from '@notiflyio/js';\nimport { buildSubscriber } from '@notiflyio/js/internal';\nimport { createContext, ReactNode, useContext, useMemo } from 'react';\n\nexport type NovuProviderProps = NovuOptions & {\n /**\n * When `false`, disables the WebSocket subscription that auto-injects\n * newly received notifications into the list and subscription that auto-resync\n * notification counts. Built-in mutations like\n * `readAll`, `seenAll`, `archiveAll`, and `archiveAllRead` continue to\n * update local state. Use this when you want to drive new-notification updates yourself (e.g.\n * via your own `novu.on('notifications.notification_received', ...)`\n * handler combined with `refetch()`). Defaults to `true`.\n */\n realtime?: boolean;\n children: ReactNode;\n};\n\nconst NovuContext = createContext<{ novu: Novu; realtime: boolean }>({ novu: undefined as any, realtime: true });\n\nexport const NovuProvider = (props: NovuProviderProps) => {\n const { subscriberId, realtime = true, ...propsWithoutSubscriberId } = props;\n const subscriberObj = useMemo(\n () => buildSubscriber({ subscriberId, subscriber: props.subscriber }),\n [subscriberId, props.subscriber]\n );\n const applicationIdentifier = propsWithoutSubscriberId.applicationIdentifier\n ? propsWithoutSubscriberId.applicationIdentifier\n : '';\n\n const providerProps: NovuProviderProps = {\n ...propsWithoutSubscriberId,\n applicationIdentifier,\n subscriber: subscriberObj,\n realtime,\n };\n\n return (\n <InternalNovuProvider {...providerProps} applicationIdentifier={applicationIdentifier}>\n {props.children}\n </InternalNovuProvider>\n );\n};\n\n/**\n * @internal Should be used internally not to be exposed outside of the library\n */\nexport const InternalNovuProvider = (props: NovuProviderProps) => {\n const applicationIdentifier = props.applicationIdentifier || '';\n const subscriberObj = useMemo(\n () => buildSubscriber({ subscriberId: props.subscriberId, subscriber: props.subscriber }),\n [props.subscriberId, props.subscriber]\n );\n\n const {\n children,\n subscriberHash,\n contextHash,\n backendUrl,\n apiUrl,\n socketUrl,\n socketOptions,\n useCache,\n defaultSchedule,\n context,\n realtime = true,\n } = props;\n\n const value = useMemo(\n () => ({\n novu: new Novu({\n applicationIdentifier,\n subscriberHash,\n contextHash,\n backendUrl,\n apiUrl,\n socketUrl,\n socketOptions,\n useCache,\n subscriber: subscriberObj,\n defaultSchedule,\n context,\n }),\n realtime,\n }),\n [\n applicationIdentifier,\n subscriberHash,\n subscriberObj,\n context,\n contextHash,\n backendUrl,\n apiUrl,\n socketUrl,\n socketOptions,\n useCache,\n realtime,\n ]\n );\n\n return <NovuContext.Provider value={value}>{children}</NovuContext.Provider>;\n};\n\nexport const useNovu = () => {\n const context = useContext(NovuContext);\n if (!context.novu) {\n throw new Error('useNovu must be used within a <NovuProvider />');\n }\n\n return context.novu;\n};\n\nexport const useUnsafeNovu = () => {\n const context = useContext(NovuContext);\n\n return context.novu;\n};\n\nexport const useRealtime = () => {\n const context = useContext(NovuContext);\n\n return context.realtime;\n};\n"],"mappings":";AAAA,SAAS,YAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,eAA0B,YAAY,eAAe;AAoC1D;AApBJ,IAAM,cAAc,cAAiD,EAAE,MAAM,QAAkB,UAAU,KAAK,CAAC;AAExG,IAAM,eAAe,CAAC,UAA6B;AACxD,QAAM,EAAE,cAAc,WAAW,MAAM,GAAG,yBAAyB,IAAI;AACvE,QAAM,gBAAgB;AAAA,IACpB,MAAM,gBAAgB,EAAE,cAAc,YAAY,MAAM,WAAW,CAAC;AAAA,IACpE,CAAC,cAAc,MAAM,UAAU;AAAA,EACjC;AACA,QAAM,wBAAwB,yBAAyB,wBACnD,yBAAyB,wBACzB;AAEJ,QAAM,gBAAmC;AAAA,IACvC,GAAG;AAAA,IACH;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,EACF;AAEA,SACE,oBAAC,wBAAsB,GAAG,eAAe,uBACtC,gBAAM,UACT;AAEJ;AAKO,IAAM,uBAAuB,CAAC,UAA6B;AAChE,QAAM,wBAAwB,MAAM,yBAAyB;AAC7D,QAAM,gBAAgB;AAAA,IACpB,MAAM,gBAAgB,EAAE,cAAc,MAAM,cAAc,YAAY,MAAM,WAAW,CAAC;AAAA,IACxF,CAAC,MAAM,cAAc,MAAM,UAAU;AAAA,EACvC;AAEA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,EACb,IAAI;AAEJ,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,MAAM,IAAI,KAAK;AAAA,QACb;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,YAAY;AAAA,QACZ;AAAA,QACA;AAAA,MACF,CAAC;AAAA,MACD;AAAA,IACF;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,YAAY,UAAZ,EAAqB,OAAe,UAAS;AACvD;AAEO,IAAM,UAAU,MAAM;AAC3B,QAAM,UAAU,WAAW,WAAW;AACtC,MAAI,CAAC,QAAQ,MAAM;AACjB,UAAM,IAAI,MAAM,gDAAgD;AAAA,EAClE;AAEA,SAAO,QAAQ;AACjB;AAEO,IAAM,gBAAgB,MAAM;AACjC,QAAM,UAAU,WAAW,WAAW;AAEtC,SAAO,QAAQ;AACjB;AAEO,IAAM,cAAc,MAAM;AAC/B,QAAM,UAAU,WAAW,WAAW;AAEtC,SAAO,QAAQ;AACjB;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useChannelConnection.ts"],"sourcesContent":["import type { ChannelConnectionResponse, NovuError } from '@notiflyio/js';\r\nimport { useCallback, useEffect, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseChannelConnectionProps = {\r\n identifier: string;\r\n onSuccess?: (data: ChannelConnectionResponse | null) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseChannelConnectionResult = {\r\n connection?: ChannelConnectionResponse | null;\r\n error?: NovuError;\r\n isLoading: boolean;\r\n isFetching: boolean;\r\n refetch: () => Promise<void>;\r\n};\r\n\r\n/**\r\n * Get a channel connection by identifier.\r\n */\r\nexport const useChannelConnection = (props: UseChannelConnectionProps): UseChannelConnectionResult => {\r\n const novu = useNovu();\r\n const propsRef = useRef<UseChannelConnectionProps>(props);\r\n propsRef.current = props;\r\n\r\n const [connection, setConnection] = useState<ChannelConnectionResponse | null>();\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const fetchConnection = useCallback(\r\n async (options?: { refetch: boolean }) => {\r\n const { identifier, onSuccess, onError } = propsRef.current;\r\n if (options?.refetch) {\r\n setError(undefined);\r\n setIsLoading(true);\r\n }\r\n\r\n setIsFetching(true);\r\n\r\n const response = await novu.channelConnections.get({ identifier });\r\n\r\n if (response.error) {\r\n setError(response.error as NovuError);\r\n onError?.(response.error as NovuError);\r\n } else if (response.data !== undefined) {\r\n onSuccess?.(response.data);\r\n setConnection(response.data);\r\n }\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n },\r\n [novu]\r\n );\r\n\r\n // props.identifier triggers a re-fetch and re-registration whenever the\r\n // caller switches to a different identifier; fetchConnection reads it from\r\n // propsRef at call-time so it doesn't appear in the callback body directly.\r\n // biome-ignore lint/correctness/useExhaustiveDependencies: props.identifier is an intentional trigger dependency\r\n useEffect(() => {\r\n const cleanupGetPending = novu.on('channel-connection.get.pending', ({ args }) => {\r\n if (!args || args.identifier !== propsRef.current.identifier) {\r\n return;\r\n }\r\n setIsFetching(true);\r\n });\r\n\r\n const cleanupGetResolved = novu.on('channel-connection.get.resolved', ({ args, data, error: resolvedError }) => {\r\n if (!args || args.identifier !== propsRef.current.identifier) {\r\n return;\r\n }\r\n const { onSuccess, onError } = propsRef.current;\r\n if (resolvedError) {\r\n setError(resolvedError as NovuError);\r\n onError?.(resolvedError as NovuError);\r\n } else {\r\n setConnection((data as ChannelConnectionResponse) ?? null);\r\n onSuccess?.((data as ChannelConnectionResponse) ?? null);\r\n }\r\n setIsFetching(false);\r\n });\r\n\r\n const cleanupDeleteResolved = novu.on('channel-connection.delete.resolved', ({ args }) => {\r\n if (!args || args.identifier !== propsRef.current.identifier) {\r\n return;\r\n }\r\n setConnection(null);\r\n propsRef.current.onSuccess?.(null);\r\n setIsFetching(false);\r\n });\r\n\r\n void fetchConnection({ refetch: true });\r\n\r\n return () => {\r\n cleanupGetPending();\r\n cleanupGetResolved();\r\n cleanupDeleteResolved();\r\n };\r\n }, [novu, fetchConnection, props.identifier]);\r\n\r\n const refetch = useCallback(() => fetchConnection({ refetch: true }), [fetchConnection]);\r\n\r\n return {\r\n connection,\r\n error,\r\n isLoading,\r\n isFetching,\r\n refetch,\r\n };\r\n};\r\n"],"mappings":";AACA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAAS,eAAe;AAmBjB,IAAM,uBAAuB,CAAC,UAAiE;AACpG,QAAM,OAAO,QAAQ;AACrB,QAAM,WAAW,OAAkC,KAAK;AACxD,WAAS,UAAU;AAEnB,QAAM,CAAC,YAAY,aAAa,IAAI,SAA2C;AAC/E,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,kBAAkB;AAAA,IACtB,OAAO,YAAmC;AACxC,YAAM,EAAE,YAAY,WAAW,QAAQ,IAAI,SAAS;AACpD,UAAI,SAAS,SAAS;AACpB,iBAAS,MAAS;AAClB,qBAAa,IAAI;AAAA,MACnB;AAEA,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,mBAAmB,IAAI,EAAE,WAAW,CAAC;AAEjE,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAkB;AACpC,kBAAU,SAAS,KAAkB;AAAA,MACvC,WAAW,SAAS,SAAS,QAAW;AACtC,oBAAY,SAAS,IAAI;AACzB,sBAAc,SAAS,IAAI;AAAA,MAC7B;AACA,mBAAa,KAAK;AAClB,oBAAc,KAAK;AAAA,IACrB;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAMA,YAAU,MAAM;AACd,UAAM,oBAAoB,KAAK,GAAG,kCAAkC,CAAC,EAAE,KAAK,MAAM;AAChF,UAAI,CAAC,QAAQ,KAAK,eAAe,SAAS,QAAQ,YAAY;AAC5D;AAAA,MACF;AACA,oBAAc,IAAI;AAAA,IACpB,CAAC;AAED,UAAM,qBAAqB,KAAK,GAAG,mCAAmC,CAAC,EAAE,MAAM,MAAM,OAAO,cAAc,MAAM;AAC9G,UAAI,CAAC,QAAQ,KAAK,eAAe,SAAS,QAAQ,YAAY;AAC5D;AAAA,MACF;AACA,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,UAAI,eAAe;AACjB,iBAAS,aAA0B;AACnC,kBAAU,aAA0B;AAAA,MACtC,OAAO;AACL,sBAAe,QAAsC,IAAI;AACzD,oBAAa,QAAsC,IAAI;AAAA,MACzD;AACA,oBAAc,KAAK;AAAA,IACrB,CAAC;AAED,UAAM,wBAAwB,KAAK,GAAG,sCAAsC,CAAC,EAAE,KAAK,MAAM;AACxF,UAAI,CAAC,QAAQ,KAAK,eAAe,SAAS,QAAQ,YAAY;AAC5D;AAAA,MACF;AACA,oBAAc,IAAI;AAClB,eAAS,QAAQ,YAAY,IAAI;AACjC,oBAAc,KAAK;AAAA,IACrB,CAAC;AAED,SAAK,gBAAgB,EAAE,SAAS,KAAK,CAAC;AAEtC,WAAO,MAAM;AACX,wBAAkB;AAClB,yBAAmB;AACnB,4BAAsB;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,MAAM,iBAAiB,MAAM,UAAU,CAAC;AAE5C,QAAM,UAAU,YAAY,MAAM,gBAAgB,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC;AAEvF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useChannelConnection.ts"],"sourcesContent":["import type { ChannelConnectionResponse, NovuError } from '@notiflyio/js';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseChannelConnectionProps = {\n identifier: string;\n onSuccess?: (data: ChannelConnectionResponse | null) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseChannelConnectionResult = {\n connection?: ChannelConnectionResponse | null;\n error?: NovuError;\n isLoading: boolean;\n isFetching: boolean;\n refetch: () => Promise<void>;\n};\n\n/**\n * Get a channel connection by identifier.\n */\nexport const useChannelConnection = (props: UseChannelConnectionProps): UseChannelConnectionResult => {\n const novu = useNovu();\n const propsRef = useRef<UseChannelConnectionProps>(props);\n propsRef.current = props;\n\n const [connection, setConnection] = useState<ChannelConnectionResponse | null>();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const fetchConnection = useCallback(\n async (options?: { refetch: boolean }) => {\n const { identifier, onSuccess, onError } = propsRef.current;\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n }\n\n setIsFetching(true);\n\n const response = await novu.channelConnections.get({ identifier });\n\n if (response.error) {\n setError(response.error as NovuError);\n onError?.(response.error as NovuError);\n } else if (response.data !== undefined) {\n onSuccess?.(response.data);\n setConnection(response.data);\n }\n setIsLoading(false);\n setIsFetching(false);\n },\n [novu]\n );\n\n // props.identifier triggers a re-fetch and re-registration whenever the\n // caller switches to a different identifier; fetchConnection reads it from\n // propsRef at call-time so it doesn't appear in the callback body directly.\n // biome-ignore lint/correctness/useExhaustiveDependencies: props.identifier is an intentional trigger dependency\n useEffect(() => {\n const cleanupGetPending = novu.on('channel-connection.get.pending', ({ args }) => {\n if (!args || args.identifier !== propsRef.current.identifier) {\n return;\n }\n setIsFetching(true);\n });\n\n const cleanupGetResolved = novu.on('channel-connection.get.resolved', ({ args, data, error: resolvedError }) => {\n if (!args || args.identifier !== propsRef.current.identifier) {\n return;\n }\n const { onSuccess, onError } = propsRef.current;\n if (resolvedError) {\n setError(resolvedError as NovuError);\n onError?.(resolvedError as NovuError);\n } else {\n setConnection((data as ChannelConnectionResponse) ?? null);\n onSuccess?.((data as ChannelConnectionResponse) ?? null);\n }\n setIsFetching(false);\n });\n\n const cleanupDeleteResolved = novu.on('channel-connection.delete.resolved', ({ args }) => {\n if (!args || args.identifier !== propsRef.current.identifier) {\n return;\n }\n setConnection(null);\n propsRef.current.onSuccess?.(null);\n setIsFetching(false);\n });\n\n void fetchConnection({ refetch: true });\n\n return () => {\n cleanupGetPending();\n cleanupGetResolved();\n cleanupDeleteResolved();\n };\n }, [novu, fetchConnection, props.identifier]);\n\n const refetch = useCallback(() => fetchConnection({ refetch: true }), [fetchConnection]);\n\n return {\n connection,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n"],"mappings":";AACA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAAS,eAAe;AAmBjB,IAAM,uBAAuB,CAAC,UAAiE;AACpG,QAAM,OAAO,QAAQ;AACrB,QAAM,WAAW,OAAkC,KAAK;AACxD,WAAS,UAAU;AAEnB,QAAM,CAAC,YAAY,aAAa,IAAI,SAA2C;AAC/E,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,kBAAkB;AAAA,IACtB,OAAO,YAAmC;AACxC,YAAM,EAAE,YAAY,WAAW,QAAQ,IAAI,SAAS;AACpD,UAAI,SAAS,SAAS;AACpB,iBAAS,MAAS;AAClB,qBAAa,IAAI;AAAA,MACnB;AAEA,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,mBAAmB,IAAI,EAAE,WAAW,CAAC;AAEjE,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAkB;AACpC,kBAAU,SAAS,KAAkB;AAAA,MACvC,WAAW,SAAS,SAAS,QAAW;AACtC,oBAAY,SAAS,IAAI;AACzB,sBAAc,SAAS,IAAI;AAAA,MAC7B;AACA,mBAAa,KAAK;AAClB,oBAAc,KAAK;AAAA,IACrB;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAMA,YAAU,MAAM;AACd,UAAM,oBAAoB,KAAK,GAAG,kCAAkC,CAAC,EAAE,KAAK,MAAM;AAChF,UAAI,CAAC,QAAQ,KAAK,eAAe,SAAS,QAAQ,YAAY;AAC5D;AAAA,MACF;AACA,oBAAc,IAAI;AAAA,IACpB,CAAC;AAED,UAAM,qBAAqB,KAAK,GAAG,mCAAmC,CAAC,EAAE,MAAM,MAAM,OAAO,cAAc,MAAM;AAC9G,UAAI,CAAC,QAAQ,KAAK,eAAe,SAAS,QAAQ,YAAY;AAC5D;AAAA,MACF;AACA,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,UAAI,eAAe;AACjB,iBAAS,aAA0B;AACnC,kBAAU,aAA0B;AAAA,MACtC,OAAO;AACL,sBAAe,QAAsC,IAAI;AACzD,oBAAa,QAAsC,IAAI;AAAA,MACzD;AACA,oBAAc,KAAK;AAAA,IACrB,CAAC;AAED,UAAM,wBAAwB,KAAK,GAAG,sCAAsC,CAAC,EAAE,KAAK,MAAM;AACxF,UAAI,CAAC,QAAQ,KAAK,eAAe,SAAS,QAAQ,YAAY;AAC5D;AAAA,MACF;AACA,oBAAc,IAAI;AAClB,eAAS,QAAQ,YAAY,IAAI;AACjC,oBAAc,KAAK;AAAA,IACrB,CAAC;AAED,SAAK,gBAAgB,EAAE,SAAS,KAAK,CAAC;AAEtC,WAAO,MAAM;AACX,wBAAkB;AAClB,yBAAmB;AACnB,4BAAsB;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,MAAM,iBAAiB,MAAM,UAAU,CAAC;AAE5C,QAAM,UAAU,YAAY,MAAM,gBAAgB,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC;AAEvF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useChannelConnections.ts"],"sourcesContent":["import type { ChannelConnectionResponse, ListChannelConnectionsArgs, NovuError } from '@notiflyio/js';\r\nimport { useCallback, useEffect, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseChannelConnectionsProps = ListChannelConnectionsArgs & {\r\n onSuccess?: (data: ChannelConnectionResponse[]) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseChannelConnectionsResult = {\r\n connections: ChannelConnectionResponse[];\r\n error?: NovuError;\r\n isLoading: boolean;\r\n isFetching: boolean;\r\n refetch: () => Promise<void>;\r\n};\r\n\r\n/**\r\n * List channel connections for the current subscriber. Use this to discover an active\r\n * connection identifier after a chat OAuth flow so it can be passed to `LinkUser`.\r\n *\r\n * @example\r\n * const { connections } = useChannelConnections({ integrationIdentifier: 'my-chat-integration' });\r\n * const connectionIdentifier = connections[0]?.identifier;\r\n */\r\nexport const useChannelConnections = (props: UseChannelConnectionsProps = {}): UseChannelConnectionsResult => {\r\n const novu = useNovu();\r\n const propsRef = useRef<UseChannelConnectionsProps>(props);\r\n propsRef.current = props;\r\n\r\n const [connections, setConnections] = useState<ChannelConnectionResponse[]>([]);\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const fetchConnections = useCallback(\r\n async (options?: { refetch: boolean }) => {\r\n const { onSuccess, onError, ...listArgs } = propsRef.current;\r\n\r\n if (options?.refetch) {\r\n setError(undefined);\r\n setIsLoading(true);\r\n }\r\n\r\n setIsFetching(true);\r\n\r\n try {\r\n const response = await novu.channelConnections.list(listArgs);\r\n\r\n if (response.error) {\r\n setError(response.error as NovuError);\r\n onError?.(response.error as NovuError);\r\n } else if (response.data !== undefined) {\r\n setConnections(response.data);\r\n onSuccess?.(response.data);\r\n }\r\n } catch (err) {\r\n setError(err as NovuError);\r\n onError?.(err as NovuError);\r\n } finally {\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n }\r\n },\r\n [novu]\r\n );\r\n\r\n useEffect(() => {\r\n const cleanupDeleteResolved = novu.on('channel-connection.delete.resolved', () => {\r\n void fetchConnections({ refetch: true });\r\n });\r\n\r\n void fetchConnections({ refetch: true });\r\n\r\n return () => {\r\n cleanupDeleteResolved();\r\n };\r\n }, [novu, fetchConnections]);\r\n\r\n const refetch = useCallback(() => fetchConnections({ refetch: true }), [fetchConnections]);\r\n\r\n return {\r\n connections,\r\n error,\r\n isLoading,\r\n isFetching,\r\n refetch,\r\n };\r\n};\r\n"],"mappings":";AACA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAAS,eAAe;AAuBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,OAAO,QAAQ;AACrB,QAAM,WAAW,OAAmC,KAAK;AACzD,WAAS,UAAU;AAEnB,QAAM,CAAC,aAAa,cAAc,IAAI,SAAsC,CAAC,CAAC;AAC9E,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,mBAAmB;AAAA,IACvB,OAAO,YAAmC;AACxC,YAAM,EAAE,WAAW,SAAS,GAAG,SAAS,IAAI,SAAS;AAErD,UAAI,SAAS,SAAS;AACpB,iBAAS,MAAS;AAClB,qBAAa,IAAI;AAAA,MACnB;AAEA,oBAAc,IAAI;AAElB,UAAI;AACF,cAAM,WAAW,MAAM,KAAK,mBAAmB,KAAK,QAAQ;AAE5D,YAAI,SAAS,OAAO;AAClB,mBAAS,SAAS,KAAkB;AACpC,oBAAU,SAAS,KAAkB;AAAA,QACvC,WAAW,SAAS,SAAS,QAAW;AACtC,yBAAe,SAAS,IAAI;AAC5B,sBAAY,SAAS,IAAI;AAAA,QAC3B;AAAA,MACF,SAAS,KAAK;AACZ,iBAAS,GAAgB;AACzB,kBAAU,GAAgB;AAAA,MAC5B,UAAE;AACA,qBAAa,KAAK;AAClB,sBAAc,KAAK;AAAA,MACrB;AAAA,IACF;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,YAAU,MAAM;AACd,UAAM,wBAAwB,KAAK,GAAG,sCAAsC,MAAM;AAChF,WAAK,iBAAiB,EAAE,SAAS,KAAK,CAAC;AAAA,IACzC,CAAC;AAED,SAAK,iBAAiB,EAAE,SAAS,KAAK,CAAC;AAEvC,WAAO,MAAM;AACX,4BAAsB;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,MAAM,gBAAgB,CAAC;AAE3B,QAAM,UAAU,YAAY,MAAM,iBAAiB,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC;AAEzF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useChannelConnections.ts"],"sourcesContent":["import type { ChannelConnectionResponse, ListChannelConnectionsArgs, NovuError } from '@notiflyio/js';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseChannelConnectionsProps = ListChannelConnectionsArgs & {\n onSuccess?: (data: ChannelConnectionResponse[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseChannelConnectionsResult = {\n connections: ChannelConnectionResponse[];\n error?: NovuError;\n isLoading: boolean;\n isFetching: boolean;\n refetch: () => Promise<void>;\n};\n\n/**\n * List channel connections for the current subscriber. Use this to discover an active\n * connection identifier after a chat OAuth flow so it can be passed to `LinkUser`.\n *\n * @example\n * const { connections } = useChannelConnections({ integrationIdentifier: 'my-chat-integration' });\n * const connectionIdentifier = connections[0]?.identifier;\n */\nexport const useChannelConnections = (props: UseChannelConnectionsProps = {}): UseChannelConnectionsResult => {\n const novu = useNovu();\n const propsRef = useRef<UseChannelConnectionsProps>(props);\n propsRef.current = props;\n\n const [connections, setConnections] = useState<ChannelConnectionResponse[]>([]);\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const fetchConnections = useCallback(\n async (options?: { refetch: boolean }) => {\n const { onSuccess, onError, ...listArgs } = propsRef.current;\n\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n }\n\n setIsFetching(true);\n\n try {\n const response = await novu.channelConnections.list(listArgs);\n\n if (response.error) {\n setError(response.error as NovuError);\n onError?.(response.error as NovuError);\n } else if (response.data !== undefined) {\n setConnections(response.data);\n onSuccess?.(response.data);\n }\n } catch (err) {\n setError(err as NovuError);\n onError?.(err as NovuError);\n } finally {\n setIsLoading(false);\n setIsFetching(false);\n }\n },\n [novu]\n );\n\n useEffect(() => {\n const cleanupDeleteResolved = novu.on('channel-connection.delete.resolved', () => {\n void fetchConnections({ refetch: true });\n });\n\n void fetchConnections({ refetch: true });\n\n return () => {\n cleanupDeleteResolved();\n };\n }, [novu, fetchConnections]);\n\n const refetch = useCallback(() => fetchConnections({ refetch: true }), [fetchConnections]);\n\n return {\n connections,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n"],"mappings":";AACA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAAS,eAAe;AAuBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,OAAO,QAAQ;AACrB,QAAM,WAAW,OAAmC,KAAK;AACzD,WAAS,UAAU;AAEnB,QAAM,CAAC,aAAa,cAAc,IAAI,SAAsC,CAAC,CAAC;AAC9E,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,mBAAmB;AAAA,IACvB,OAAO,YAAmC;AACxC,YAAM,EAAE,WAAW,SAAS,GAAG,SAAS,IAAI,SAAS;AAErD,UAAI,SAAS,SAAS;AACpB,iBAAS,MAAS;AAClB,qBAAa,IAAI;AAAA,MACnB;AAEA,oBAAc,IAAI;AAElB,UAAI;AACF,cAAM,WAAW,MAAM,KAAK,mBAAmB,KAAK,QAAQ;AAE5D,YAAI,SAAS,OAAO;AAClB,mBAAS,SAAS,KAAkB;AACpC,oBAAU,SAAS,KAAkB;AAAA,QACvC,WAAW,SAAS,SAAS,QAAW;AACtC,yBAAe,SAAS,IAAI;AAC5B,sBAAY,SAAS,IAAI;AAAA,QAC3B;AAAA,MACF,SAAS,KAAK;AACZ,iBAAS,GAAgB;AACzB,kBAAU,GAAgB;AAAA,MAC5B,UAAE;AACA,qBAAa,KAAK;AAClB,sBAAc,KAAK;AAAA,MACrB;AAAA,IACF;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,YAAU,MAAM;AACd,UAAM,wBAAwB,KAAK,GAAG,sCAAsC,MAAM;AAChF,WAAK,iBAAiB,EAAE,SAAS,KAAK,CAAC;AAAA,IACzC,CAAC;AAED,SAAK,iBAAiB,EAAE,SAAS,KAAK,CAAC;AAEvC,WAAO,MAAM;AACX,4BAAsB;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,MAAM,gBAAgB,CAAC;AAE3B,QAAM,UAAU,YAAY,MAAM,iBAAiB,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC;AAEzF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useChannelEndpoint.ts"],"sourcesContent":["import type { ChannelEndpointResponse, NovuError } from '@notiflyio/js';\r\nimport { useCallback, useEffect, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseChannelEndpointProps = {\r\n identifier: string;\r\n onSuccess?: (data: ChannelEndpointResponse | null) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseChannelEndpointResult = {\r\n endpoint?: ChannelEndpointResponse | null;\r\n error?: NovuError;\r\n isLoading: boolean;\r\n isFetching: boolean;\r\n refetch: () => Promise<void>;\r\n};\r\n\r\n/**\r\n * Get a channel endpoint by identifier.\r\n */\r\nexport const useChannelEndpoint = (props: UseChannelEndpointProps): UseChannelEndpointResult => {\r\n const novu = useNovu();\r\n const propsRef = useRef<UseChannelEndpointProps>(props);\r\n propsRef.current = props;\r\n\r\n const [endpoint, setEndpoint] = useState<ChannelEndpointResponse | null>();\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const fetchEndpoint = useCallback(\r\n async (options?: { refetch: boolean }) => {\r\n const { identifier, onSuccess, onError } = propsRef.current;\r\n if (options?.refetch) {\r\n setError(undefined);\r\n setIsLoading(true);\r\n }\r\n\r\n setIsFetching(true);\r\n\r\n const response = await novu.channelEndpoints.get({ identifier });\r\n\r\n if (response.error) {\r\n setError(response.error as NovuError);\r\n onError?.(response.error as NovuError);\r\n } else if (response.data !== undefined) {\r\n onSuccess?.(response.data);\r\n setEndpoint(response.data);\r\n }\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n },\r\n [novu]\r\n );\r\n\r\n // biome-ignore lint/correctness/useExhaustiveDependencies: props.identifier is needed to re-run the effect and initial fetch when the identifier changes\r\n useEffect(() => {\r\n const cleanupGetPending = novu.on('channel-endpoint.get.pending', () => {\r\n setIsFetching(true);\r\n });\r\n\r\n const cleanupGetResolved = novu.on('channel-endpoint.get.resolved', ({ data, error: resolvedError }) => {\r\n const { onSuccess, onError } = propsRef.current;\r\n if (resolvedError) {\r\n setError(resolvedError as NovuError);\r\n onError?.(resolvedError as NovuError);\r\n } else {\r\n setEndpoint((data as ChannelEndpointResponse) ?? null);\r\n onSuccess?.((data as ChannelEndpointResponse) ?? null);\r\n }\r\n setIsFetching(false);\r\n });\r\n\r\n const cleanupCreateResolved = novu.on('channel-endpoint.create.resolved', ({ data }) => {\r\n if (data) {\r\n setEndpoint(data as ChannelEndpointResponse);\r\n propsRef.current.onSuccess?.(data as ChannelEndpointResponse);\r\n }\r\n setIsFetching(false);\r\n });\r\n\r\n const cleanupDeleteResolved = novu.on('channel-endpoint.delete.resolved', ({ args }) => {\r\n if (!args || args.identifier !== propsRef.current.identifier) {\r\n return;\r\n }\r\n setEndpoint(null);\r\n propsRef.current.onSuccess?.(null);\r\n setIsFetching(false);\r\n });\r\n\r\n void fetchEndpoint({ refetch: true });\r\n\r\n return () => {\r\n cleanupGetPending();\r\n cleanupGetResolved();\r\n cleanupCreateResolved();\r\n cleanupDeleteResolved();\r\n };\r\n }, [novu, fetchEndpoint, props.identifier]);\r\n\r\n const refetch = useCallback(() => fetchEndpoint({ refetch: true }), [fetchEndpoint]);\r\n\r\n return {\r\n endpoint,\r\n error,\r\n isLoading,\r\n isFetching,\r\n refetch,\r\n };\r\n};\r\n"],"mappings":";AACA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAAS,eAAe;AAmBjB,IAAM,qBAAqB,CAAC,UAA6D;AAC9F,QAAM,OAAO,QAAQ;AACrB,QAAM,WAAW,OAAgC,KAAK;AACtD,WAAS,UAAU;AAEnB,QAAM,CAAC,UAAU,WAAW,IAAI,SAAyC;AACzE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,gBAAgB;AAAA,IACpB,OAAO,YAAmC;AACxC,YAAM,EAAE,YAAY,WAAW,QAAQ,IAAI,SAAS;AACpD,UAAI,SAAS,SAAS;AACpB,iBAAS,MAAS;AAClB,qBAAa,IAAI;AAAA,MACnB;AAEA,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,iBAAiB,IAAI,EAAE,WAAW,CAAC;AAE/D,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAkB;AACpC,kBAAU,SAAS,KAAkB;AAAA,MACvC,WAAW,SAAS,SAAS,QAAW;AACtC,oBAAY,SAAS,IAAI;AACzB,oB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;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useChannelEndpoint.ts"],"sourcesContent":["import type { ChannelEndpointResponse, NovuError } from '@notiflyio/js';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseChannelEndpointProps = {\n identifier: string;\n onSuccess?: (data: ChannelEndpointResponse | null) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseChannelEndpointResult = {\n endpoint?: ChannelEndpointResponse | null;\n error?: NovuError;\n isLoading: boolean;\n isFetching: boolean;\n refetch: () => Promise<void>;\n};\n\n/**\n * Get a channel endpoint by identifier.\n */\nexport const useChannelEndpoint = (props: UseChannelEndpointProps): UseChannelEndpointResult => {\n const novu = useNovu();\n const propsRef = useRef<UseChannelEndpointProps>(props);\n propsRef.current = props;\n\n const [endpoint, setEndpoint] = useState<ChannelEndpointResponse | null>();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const fetchEndpoint = useCallback(\n async (options?: { refetch: boolean }) => {\n const { identifier, onSuccess, onError } = propsRef.current;\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n }\n\n setIsFetching(true);\n\n const response = await novu.channelEndpoints.get({ identifier });\n\n if (response.error) {\n setError(response.error as NovuError);\n onError?.(response.error as NovuError);\n } else if (response.data !== undefined) {\n onSuccess?.(response.data);\n setEndpoint(response.data);\n }\n setIsLoading(false);\n setIsFetching(false);\n },\n [novu]\n );\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: props.identifier is needed to re-run the effect and initial fetch when the identifier changes\n useEffect(() => {\n const cleanupGetPending = novu.on('channel-endpoint.get.pending', () => {\n setIsFetching(true);\n });\n\n const cleanupGetResolved = novu.on('channel-endpoint.get.resolved', ({ data, error: resolvedError }) => {\n const { onSuccess, onError } = propsRef.current;\n if (resolvedError) {\n setError(resolvedError as NovuError);\n onError?.(resolvedError as NovuError);\n } else {\n setEndpoint((data as ChannelEndpointResponse) ?? null);\n onSuccess?.((data as ChannelEndpointResponse) ?? null);\n }\n setIsFetching(false);\n });\n\n const cleanupCreateResolved = novu.on('channel-endpoint.create.resolved', ({ data }) => {\n if (data) {\n setEndpoint(data as ChannelEndpointResponse);\n propsRef.current.onSuccess?.(data as ChannelEndpointResponse);\n }\n setIsFetching(false);\n });\n\n const cleanupDeleteResolved = novu.on('channel-endpoint.delete.resolved', ({ args }) => {\n if (!args || args.identifier !== propsRef.current.identifier) {\n return;\n }\n setEndpoint(null);\n propsRef.current.onSuccess?.(null);\n setIsFetching(false);\n });\n\n void fetchEndpoint({ refetch: true });\n\n return () => {\n cleanupGetPending();\n cleanupGetResolved();\n cleanupCreateResolved();\n cleanupDeleteResolved();\n };\n }, [novu, fetchEndpoint, props.identifier]);\n\n const refetch = useCallback(() => fetchEndpoint({ refetch: true }), [fetchEndpoint]);\n\n return {\n endpoint,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n"],"mappings":";AACA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAAS,eAAe;AAmBjB,IAAM,qBAAqB,CAAC,UAA6D;AAC9F,QAAM,OAAO,QAAQ;AACrB,QAAM,WAAW,OAAgC,KAAK;AACtD,WAAS,UAAU;AAEnB,QAAM,CAAC,UAAU,WAAW,IAAI,SAAyC;AACzE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,gBAAgB;AAAA,IACpB,OAAO,YAAmC;AACxC,YAAM,EAAE,YAAY,WAAW,QAAQ,IAAI,SAAS;AACpD,UAAI,SAAS,SAAS;AACpB,iBAAS,MAAS;AAClB,qBAAa,IAAI;AAAA,MACnB;AAEA,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,iBAAiB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,GAAG,CAAC,MAAM,eAAe,MAAM,UAAU,CAAC;AAE1C,QAAM,UAAU,YAAY,MAAM,cAAc,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC;AAEnF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useCounts.ts"],"sourcesContent":["import { NOTIFICATION_COUNT_SYNC_EVENTS, checkNotificationMatchesFilter, isSameFilter, Notification, NotificationFilter, NovuError } from '@notiflyio/js';\r\nimport { useCallback, useEffect, useRef, useState } from 'react';\r\nimport { useDataRef } from './internal/useDataRef';\r\nimport { useWebSocketEvent } from './internal/useWebsocketEvent';\r\nimport { useNovu, useRealtime } from './NovuProvider';\r\n\r\ntype Count = {\r\n count: number;\r\n filter: NotificationFilter;\r\n};\r\n\r\n/**\r\n * Props for the useCounts hook.\r\n *\r\n * @example\r\n * ```tsx\r\n * // Count unread notifications\r\n * const { counts } = useCounts({\r\n * filters: [{ read: false }]\r\n * });\r\n *\r\n * // Count unseen notifications with specific tags\r\n * const { counts } = useCounts({\r\n * filters: [{ seen: false, tags: ['important'] }]\r\n * });\r\n *\r\n * // Count seen but unread notifications\r\n * const { counts } = useCounts({\r\n * filters: [{ seen: true, read: false }]\r\n * });\r\n *\r\n * // Opt out of the built-in realtime count updates and drive them yourself\r\n * const { counts, refetch } = useCounts({\r\n * filters: [{ read: false }],\r\n * realtime: false,\r\n * });\r\n * ```\r\n */\r\nexport type UseCountsProps = {\r\n filters: NotificationFilter[];\r\n /**\r\n * When `false`, disables the WebSocket subscriptions that auto-resync\r\n * counts on `notifications.notification_received` and\r\n * `notifications.unread_count_changed`. The filter-driven fetch and\r\n * `refetch()` keep working. Use alongside\r\n * `useNotifications({ realtime: false })` when you drive live updates\r\n * yourself.\r\n *\r\n * When set, this prop takes precedence over the `realtime` config on\r\n * `<NovuProvider />`. When omitted, the provider value (default `true`) is used.\r\n */\r\n realtime?: boolean;\r\n onSuccess?: (data: Count[]) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseCountsResult = {\r\n counts?: Count[];\r\n error?: NovuError;\r\n isLoading: boolean; // initial loading\r\n isFetching: boolean; // the request is in flight\r\n refetch: () => Promise<void>;\r\n};\r\n\r\nexport const useCounts = (props: UseCountsProps): UseCountsResult => {\r\n const { filters, realtime: propsRealtime, onSuccess, onError } = props;\r\n const novu = useNovu();\r\n const { notifications } = novu;\r\n const providerRealtime = useRealtime();\r\n const realtime = propsRealtime ?? providerRealtime;\r\n const filtersRef = useDataRef<NotificationFilter[]>(filters);\r\n const onSuccessRef = useDataRef(onSuccess);\r\n const onErrorRef = useDataRef(onError);\r\n const syncGenerationRef = useRef(0);\r\n const [error, setError] = useState<NovuError>();\r\n const [counts, setCounts] = useState<Count[]>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const sync = useCallback(\r\n async (notification?: Notification, overrideFilters?: NotificationFilter[]) => {\r\n const currentFilters = overrideFilters || filtersRef.current;\r\n const existingCounts = currentFilters.map((filter) => ({ count: 0, filter }));\r\n let countFiltersToFetch: NotificationFilter[] = [];\r\n\r\n if (notification) {\r\n countFiltersToFetch = currentFilters.filter((filter) =>\r\n checkNotificationMatchesFilter(notification, filter)\r\n );\r\n } else {\r\n countFiltersToFetch = currentFilters;\r\n }\r\n\r\n if (countFiltersToFetch.length === 0) {\r\n return;\r\n }\r\n\r\n const generation = ++syncGenerationRef.current;\r\n setIsFetching(true);\r\n\r\n const countsRes = await notifications.count({ filters: countFiltersToFetch });\r\n\r\n if (generation !== syncGenerationRef.current) {\r\n return;\r\n }\r\n\r\n setIsFetching(false);\r\n setIsLoading(false);\r\n\r\n if (countsRes.error) {\r\n setError(countsRes.error);\r\n onErrorRef.current?.(countsRes.error);\r\n\r\n return;\r\n }\r\n\r\n const data = countsRes.data!;\r\n onSuccessRef.current?.(data.counts);\r\n\r\n setCounts((oldCounts) => {\r\n const newCounts: Count[] = [];\r\n const countsReceived = data.counts;\r\n\r\n for (let i = 0; i < existingCounts.length; i++) {\r\n const existingFilter = existingCounts[i].filter;\r\n const countReceived = countsReceived.find((c) => isSameFilter(c.filter, existingFilter));\r\n const count = countReceived || oldCounts?.[i];\r\n if (count) {\r\n newCounts.push(count);\r\n }\r\n }\r\n\r\n return newCounts;\r\n });\r\n },\r\n [notifications, filtersRef, onErrorRef, onSuccessRef]\r\n );\r\n\r\n useWebSocketEvent({\r\n event: 'notifications.notification_received',\r\n enabled: realtime,\r\n eventHandler: (data) => {\r\n sync(data.result);\r\n },\r\n });\r\n\r\n useWebSocketEvent({\r\n event: 'notifications.unread_count_changed',\r\n enabled: realtime,\r\n eventHandler: () => {\r\n sync();\r\n },\r\n });\r\n\r\n useEffect(() => {\r\n const cleanups = NOTIFICATION_COUNT_SYNC_EVENTS.map((event) =>\r\n novu.on(event, (payload) => {\r\n if ('error' in payload && payload.error) {\r\n return;\r\n }\r\n\r\n sync();\r\n })\r\n );\r\n\r\n return () => cleanups.forEach((cleanup) => cleanup());\r\n }, [novu, sync]);\r\n\r\n useEffect(() => {\r\n setError(undefined);\r\n setIsLoading(true);\r\n setIsFetching(false);\r\n sync(undefined, filters);\r\n }, [JSON.stringify(filters), sync]);\r\n\r\n const refetch = useCallback(async () => {\r\n await sync();\r\n }, [sync]);\r\n\r\n return { counts, error, refetch, isLoading, isFetching };\r\n};\r\n"],"mappings":";AAAA,SAAS,gCAAgC,gCAAgC,oBAAiE;AAC1I,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAClC,SAAS,SAAS,mBAAmB;AA4D9B,IAAM,YAAY,CAAC,UAA2C;AACnE,QAAM,EAAE,SAAS,UAAU,eAAe,WAAW,QAAQ,IAAI;AACjE,QAAM,OAAO,QAAQ;AACrB,QAAM,EAAE,cAAc,IAA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_EVENTS, checkNotificationMatchesFilter, isSameFilter, Notification, NotificationFilter, NovuError } from '@notiflyio/js';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useDataRef } from './internal/useDataRef';\nimport { useWebSocketEvent } from './internal/useWebsocketEvent';\nimport { useNovu, useRealtime } from './NovuProvider';\n\ntype Count = {\n count: number;\n filter: NotificationFilter;\n};\n\n/**\n * Props for the useCounts hook.\n *\n * @example\n * ```tsx\n * // Count unread notifications\n * const { counts } = useCounts({\n * filters: [{ read: false }]\n * });\n *\n * // Count unseen notifications with specific tags\n * const { counts } = useCounts({\n * filters: [{ seen: false, tags: ['important'] }]\n * });\n *\n * // Count seen but unread notifications\n * const { counts } = useCounts({\n * filters: [{ seen: true, read: false }]\n * });\n *\n * // Opt out of the built-in realtime count updates and drive them yourself\n * const { counts, refetch } = useCounts({\n * filters: [{ read: false }],\n * realtime: false,\n * });\n * ```\n */\nexport type UseCountsProps = {\n filters: NotificationFilter[];\n /**\n * When `false`, disables the WebSocket subscriptions that auto-resync\n * counts on `notifications.notification_received` and\n * `notifications.unread_count_changed`. The filter-driven fetch and\n * `refetch()` keep working. Use alongside\n * `useNotifications({ realtime: false })` when you drive live updates\n * yourself.\n *\n * When set, this prop takes precedence over the `realtime` config on\n * `<NovuProvider />`. When omitted, the provider value (default `true`) is used.\n */\n realtime?: boolean;\n onSuccess?: (data: Count[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseCountsResult = {\n counts?: Count[];\n error?: NovuError;\n isLoading: boolean; // initial loading\n isFetching: boolean; // the request is in flight\n refetch: () => Promise<void>;\n};\n\nexport const useCounts = (props: UseCountsProps): UseCountsResult => {\n const { filters, realtime: propsRealtime, onSuccess, onError } = props;\n const novu = useNovu();\n const { notifications } = novu;\n const providerRealtime = useRealtime();\n const realtime = propsRealtime ?? providerRealtime;\n const filtersRef = useDataRef<NotificationFilter[]>(filters);\n const onSuccessRef = useDataRef(onSuccess);\n const onErrorRef = useDataRef(onError);\n const syncGenerationRef = useRef(0);\n const [error, setError] = useState<NovuError>();\n const [counts, setCounts] = useState<Count[]>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const sync = useCallback(\n async (notification?: Notification, overrideFilters?: NotificationFilter[]) => {\n const currentFilters = overrideFilters || filtersRef.current;\n const existingCounts = currentFilters.map((filter) => ({ count: 0, filter }));\n let countFiltersToFetch: NotificationFilter[] = [];\n\n if (notification) {\n countFiltersToFetch = currentFilters.filter((filter) =>\n checkNotificationMatchesFilter(notification, filter)\n );\n } else {\n countFiltersToFetch = currentFilters;\n }\n\n if (countFiltersToFetch.length === 0) {\n return;\n }\n\n const generation = ++syncGenerationRef.current;\n setIsFetching(true);\n\n const countsRes = await notifications.count({ filters: countFiltersToFetch });\n\n if (generation !== syncGenerationRef.current) {\n return;\n }\n\n setIsFetching(false);\n setIsLoading(false);\n\n if (countsRes.error) {\n setError(countsRes.error);\n onErrorRef.current?.(countsRes.error);\n\n return;\n }\n\n const data = countsRes.data!;\n onSuccessRef.current?.(data.counts);\n\n setCounts((oldCounts) => {\n const newCounts: Count[] = [];\n const countsReceived = data.counts;\n\n for (let i = 0; i < existingCounts.length; i++) {\n const existingFilter = existingCounts[i].filter;\n const countReceived = countsReceived.find((c) => isSameFilter(c.filter, existingFilter));\n const count = countReceived || oldCounts?.[i];\n if (count) {\n newCounts.push(count);\n }\n }\n\n return newCounts;\n });\n },\n [notifications, filtersRef, onErrorRef, onSuccessRef]\n );\n\n useWebSocketEvent({\n event: 'notifications.notification_received',\n enabled: realtime,\n eventHandler: (data) => {\n sync(data.result);\n },\n });\n\n useWebSocketEvent({\n event: 'notifications.unread_count_changed',\n enabled: realtime,\n eventHandler: () => {\n sync();\n },\n });\n\n useEffect(() => {\n const cleanups = NOTIFICATION_COUNT_SYNC_EVENTS.map((event) =>\n novu.on(event, (payload) => {\n if ('error' in payload && payload.error) {\n return;\n }\n\n sync();\n })\n );\n\n return () => cleanups.forEach((cleanup) => cleanup());\n }, [novu, sync]);\n\n useEffect(() => {\n setError(undefined);\n setIsLoading(true);\n setIsFetching(false);\n sync(undefined, filters);\n }, [JSON.stringify(filters), sync]);\n\n const refetch = useCallback(async () => {\n await sync();\n }, [sync]);\n\n return { counts, error, refetch, isLoading, isFetching };\n};\n"],"mappings":";AAAA,SAAS,gCAAgC,gCAAgC,oBAAiE;AAC1I,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAClC,SAAS,SAAS,mBAAmB;AA4D9B,IAAM,YAAY,CAAC,UAA2C;AACnE,QAAM,EAAE,SAAS,UAAU,eAAe,WAAW,QAAQ,IAAI;AACjE,QAAM,OAAO,QAAQ;AACrB,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,mBAAmB,YAAY;AACrC,QAAM,WAAW,iBAAiB;AAClC,QAAM,aAAa,WAAiC,OAAO;AAC3D,QAAM,eAAe,WAAW,SAAS;AACzC,QAAM,aAAa,WAAW,OAAO;AACrC,QAAM,oBAAoB,OAAO,CAAC;AAClC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAkB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,OAAO;AAAA,IACX,OAAO,cAA6B,oBAA2C;AAC7E,YAAM,iBAAiB,mBAAmB,WAAW;AACrD,YAAM,iBAAiB,eAAe,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,EAAE;AAC5E,UAAI,sBAA4C,CAAC;AAEjD,UAAI,cAAc;AAChB,8BAAsB,eAAe;AAAA,UAAO,CAAC,WAC3C,+BAA+B,cAAc,MAAM;AAAA,QACrD;AAAA,MACF,OAAO;AACL,8BAAsB;AAAA,MACxB;AAEA,UAAI,oBAAoB,WAAW,GAAG;AACpC;AAAA,MACF;AAE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ACH;AAEA,WAAO,MAAM,SAAS,QAAQ,CAAC,YAAY,QAAQ,CAAC;AAAA,EACtD,GAAG,CAAC,MAAM,IAAI,CAAC;AAEf,YAAU,MAAM;AACd,aAAS,MAAS;AAClB,iBAAa,IAAI;AACjB,kBAAc,KAAK;AACnB,SAAK,QAAW,OAAO;AAAA,EACzB,GAAG,CAAC,KAAK,UAAU,OAAO,GAAG,IAAI,CAAC;AAElC,QAAM,UAAU,YAAY,YAAY;AACtC,UAAM,KAAK;AAAA,EACb,GAAG,CAAC,IAAI,CAAC;AAET,SAAO,EAAE,QAAQ,OAAO,SAAS,WAAW,WAAW;AACzD;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useCreateChannelEndpoint.ts"],"sourcesContent":["import type { ChannelEndpointResponse, CreateChannelEndpointArgs, NovuError } from '@notiflyio/js';\r\nimport { useCallback, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseCreateChannelEndpointProps = {\r\n onSuccess?: (data: ChannelEndpointResponse) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseCreateChannelEndpointResult = {\r\n isCreating: boolean;\r\n error?: NovuError;\r\n create: (args: CreateChannelEndpointArgs) => Promise<{\r\n data?: ChannelEndpointResponse | undefined;\r\n error?: NovuError | undefined;\r\n }>;\r\n};\r\n\r\nexport const useCreateChannelEndpoint = (props: UseCreateChannelEndpointProps = {}): UseCreateChannelEndpointResult => {\r\n const propsRef = useRef<UseCreateChannelEndpointProps>(props);\r\n propsRef.current = props;\r\n const novu = useNovu();\r\n const [isCreating, setIsCreating] = useState(false);\r\n const [error, setError] = useState<NovuError>();\r\n\r\n const create = useCallback(\r\n async (args: CreateChannelEndpointArgs) => {\r\n const { onSuccess, onError } = propsRef.current;\r\n setError(undefined);\r\n setIsCreating(true);\r\n\r\n const response = await novu.channelEndpoints.create(args);\r\n\r\n setIsCreating(false);\r\n\r\n if (response.error) {\r\n setError(response.error as NovuError);\r\n onError?.(response.error as NovuError);\r\n } else if (response.data) {\r\n onSuccess?.(response.data as ChannelEndpointResponse);\r\n }\r\n\r\n return response as { data?: ChannelEndpointResponse; error?: NovuError };\r\n },\r\n [novu]\r\n );\r\n\r\n return {\r\n create,\r\n isCreating,\r\n error,\r\n };\r\n};\r\n"],"mappings":";AACA,SAAS,aAAa,QAAQ,gBAAgB;AAC9C,SAAS,eAAe;AAgBjB,IAAM,2BAA2B,CAAC,QAAuC,CAAC,MAAsC;AACrH,QAAM,WAAW,OAAsC,KAAK;AAC5D,WAAS,UAAU;AACnB,QAAM,OAAO,QAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAE9C,QAAM,SAAS;AAAA,IACb,OAAO,SAAoC;AACzC,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,iBAAiB,OAAO,IAAI;AAExD,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAkB;AACpC,kBAAU,SAAS,KAAkB;AAAA,MACvC,WAAW,SAAS,MAAM;AACxB,oBAAY,SAAS,IAA+B;AAAA,MACtD;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useCreateChannelEndpoint.ts"],"sourcesContent":["import type { ChannelEndpointResponse, CreateChannelEndpointArgs, NovuError } from '@notiflyio/js';\nimport { useCallback, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseCreateChannelEndpointProps = {\n onSuccess?: (data: ChannelEndpointResponse) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseCreateChannelEndpointResult = {\n isCreating: boolean;\n error?: NovuError;\n create: (args: CreateChannelEndpointArgs) => Promise<{\n data?: ChannelEndpointResponse | undefined;\n error?: NovuError | undefined;\n }>;\n};\n\nexport const useCreateChannelEndpoint = (props: UseCreateChannelEndpointProps = {}): UseCreateChannelEndpointResult => {\n const propsRef = useRef<UseCreateChannelEndpointProps>(props);\n propsRef.current = props;\n const novu = useNovu();\n const [isCreating, setIsCreating] = useState(false);\n const [error, setError] = useState<NovuError>();\n\n const create = useCallback(\n async (args: CreateChannelEndpointArgs) => {\n const { onSuccess, onError } = propsRef.current;\n setError(undefined);\n setIsCreating(true);\n\n const response = await novu.channelEndpoints.create(args);\n\n setIsCreating(false);\n\n if (response.error) {\n setError(response.error as NovuError);\n onError?.(response.error as NovuError);\n } else if (response.data) {\n onSuccess?.(response.data as ChannelEndpointResponse);\n }\n\n return response as { data?: ChannelEndpointResponse; error?: NovuError };\n },\n [novu]\n );\n\n return {\n create,\n isCreating,\n error,\n };\n};\n"],"mappings":";AACA,SAAS,aAAa,QAAQ,gBAAgB;AAC9C,SAAS,eAAe;AAgBjB,IAAM,2BAA2B,CAAC,QAAuC,CAAC,MAAsC;AACrH,QAAM,WAAW,OAAsC,KAAK;AAC5D,WAAS,UAAU;AACnB,QAAM,OAAO,QAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAE9C,QAAM,SAAS;AAAA,IACb,OAAO,SAAoC;AACzC,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,iBAAiB,OAAO,IAAI;AAExD,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAkB;AACpC,kBAAU,SAAS,KAAkB;AAAA,MACvC,WAAW,SAAS,MAAM;AACxB,oBAAY,SAAS,IAA+B;AAAA,MACtD;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useCreateSubscription.ts"],"sourcesContent":["import { CreateSubscriptionArgs, NovuError, TopicSubscription } from '@notiflyio/js';\r\nimport { useCallback, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseCreateSubscriptionProps = {\r\n onSuccess?: (data: TopicSubscription) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseCreateSubscriptionResult = {\r\n isCreating: boolean;\r\n error?: NovuError;\r\n create: (args: CreateSubscriptionArgs) => Promise<{\r\n data?: TopicSubscription | undefined;\r\n error?: NovuError | undefined;\r\n }>;\r\n};\r\n\r\nexport const useCreateSubscription = (props: UseCreateSubscriptionProps = {}): UseCreateSubscriptionResult => {\r\n const propsRef = useRef<UseCreateSubscriptionProps>(props);\r\n propsRef.current = props;\r\n const novu = useNovu();\r\n const [isCreating, setIsCreating] = useState(false);\r\n const [error, setError] = useState<NovuError>();\r\n\r\n const create = useCallback(\r\n async (args: CreateSubscriptionArgs) => {\r\n const { onSuccess, onError } = propsRef.current;\r\n setError(undefined);\r\n setIsCreating(true);\r\n\r\n const response = await novu.subscriptions.create(args);\r\n\r\n setIsCreating(false);\r\n\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n } else if (response.data) {\r\n onSuccess?.(response.data);\r\n }\r\n\r\n return response;\r\n },\r\n [novu]\r\n );\r\n\r\n return {\r\n create,\r\n isCreating,\r\n error,\r\n };\r\n};\r\n"],"mappings":";AACA,SAAS,aAAa,QAAQ,gBAAgB;AAC9C,SAAS,eAAe;AAgBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,WAAW,OAAmC,KAAK;AACzD,WAAS,UAAU;AACnB,QAAM,OAAO,QAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAE9C,QAAM,SAAS;AAAA,IACb,OAAO,SAAiC;AACtC,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,OAAO,IAAI;AAErD,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,kBAAU,SAAS,KAAK;AAAA,MAC1B,WAAW,SAAS,MAAM;AACxB,oBAAY,SAAS,IAAI;AAAA,MAC3B;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useCreateSubscription.ts"],"sourcesContent":["import { CreateSubscriptionArgs, NovuError, TopicSubscription } from '@notiflyio/js';\nimport { useCallback, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseCreateSubscriptionProps = {\n onSuccess?: (data: TopicSubscription) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseCreateSubscriptionResult = {\n isCreating: boolean;\n error?: NovuError;\n create: (args: CreateSubscriptionArgs) => Promise<{\n data?: TopicSubscription | undefined;\n error?: NovuError | undefined;\n }>;\n};\n\nexport const useCreateSubscription = (props: UseCreateSubscriptionProps = {}): UseCreateSubscriptionResult => {\n const propsRef = useRef<UseCreateSubscriptionProps>(props);\n propsRef.current = props;\n const novu = useNovu();\n const [isCreating, setIsCreating] = useState(false);\n const [error, setError] = useState<NovuError>();\n\n const create = useCallback(\n async (args: CreateSubscriptionArgs) => {\n const { onSuccess, onError } = propsRef.current;\n setError(undefined);\n setIsCreating(true);\n\n const response = await novu.subscriptions.create(args);\n\n setIsCreating(false);\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data) {\n onSuccess?.(response.data);\n }\n\n return response;\n },\n [novu]\n );\n\n return {\n create,\n isCreating,\n error,\n };\n};\n"],"mappings":";AACA,SAAS,aAAa,QAAQ,gBAAgB;AAC9C,SAAS,eAAe;AAgBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,WAAW,OAAmC,KAAK;AACzD,WAAS,UAAU;AACnB,QAAM,OAAO,QAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAE9C,QAAM,SAAS;AAAA,IACb,OAAO,SAAiC;AACtC,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,OAAO,IAAI;AAErD,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,kBAAU,SAAS,KAAK;AAAA,MAC1B,WAAW,SAAS,MAAM;AACxB,oBAAY,SAAS,IAAI;AAAA,MAC3B;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useDeleteChannelEndpoint.ts"],"sourcesContent":["import type { NovuError } from '@notiflyio/js';\r\nimport { useCallback, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseDeleteChannelEndpointProps = {\r\n onSuccess?: () => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseDeleteChannelEndpointResult = {\r\n isDeleting: boolean;\r\n error?: NovuError;\r\n remove: (identifier: string) => Promise<{\r\n data?: undefined;\r\n error?: NovuError | undefined;\r\n }>;\r\n};\r\n\r\nexport const useDeleteChannelEndpoint = (props: UseDeleteChannelEndpointProps = {}): UseDeleteChannelEndpointResult => {\r\n const propsRef = useRef<UseDeleteChannelEndpointProps>(props);\r\n propsRef.current = props;\r\n const novu = useNovu();\r\n const [isDeleting, setIsDeleting] = useState(false);\r\n const [error, setError] = useState<NovuError>();\r\n\r\n const remove = useCallback(\r\n async (identifier: string) => {\r\n setError(undefined);\r\n setIsDeleting(true);\r\n\r\n try {\r\n const response = await novu.channelEndpoints.delete({ identifier });\r\n\r\n if (response.error) {\r\n setError(response.error as NovuError);\r\n propsRef.current.onError?.(response.error as NovuError);\r\n } else {\r\n propsRef.current.onSuccess?.();\r\n }\r\n\r\n return response as { data?: undefined; error?: NovuError };\r\n } catch (err) {\r\n const novuError = err as NovuError;\r\n setError(novuError);\r\n propsRef.current.onError?.(novuError);\r\n\r\n return { error: novuError };\r\n } finally {\r\n setIsDeleting(false);\r\n }\r\n },\r\n [novu]\r\n );\r\n\r\n return {\r\n remove,\r\n isDeleting,\r\n error,\r\n };\r\n};\r\n"],"mappings":";AACA,SAAS,aAAa,QAAQ,gBAAgB;AAC9C,SAAS,eAAe;AAgBjB,IAAM,2BAA2B,CAAC,QAAuC,CAAC,MAAsC;AACrH,QAAM,WAAW,OAAsC,KAAK;AAC5D,WAAS,UAAU;AACnB,QAAM,OAAO,QAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAE9C,QAAM,SAAS;AAAA,IACb,OAAO,eAAuB;AAC5B,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,UAAI;AACF,cAAM,WAAW,MAAM,KAAK,iBAAiB,OAAO,EAAE,WAAW,CAAC;AAElE,YAAI,SAAS,OAAO;AAClB,mBAAS,SAAS,KAAkB;AACpC,mBAAS,QAAQ,UAAU,SAAS,KAAkB;AAAA,QACxD,OAAO;AACL,mBAAS,QAAQ,YAAY;AAAA,QAC/B;AAEA,eAAO;AAAA,MACT,SAAS,KAAK;AACZ,cAAM,YAAY;AAClB,iBAAS,SAAS;AAClB,iBAAS,QAAQ,UAAU,SAAS;AAEpC,eAAO,EAAE,OAAO,UAAU;AAAA,MAC5B,UAAE;AACA,sBAAc,KAAK;AAAA,MACrB;AAAA,IACF;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useDeleteChannelEndpoint.ts"],"sourcesContent":["import type { NovuError } from '@notiflyio/js';\nimport { useCallback, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseDeleteChannelEndpointProps = {\n onSuccess?: () => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseDeleteChannelEndpointResult = {\n isDeleting: boolean;\n error?: NovuError;\n remove: (identifier: string) => Promise<{\n data?: undefined;\n error?: NovuError | undefined;\n }>;\n};\n\nexport const useDeleteChannelEndpoint = (props: UseDeleteChannelEndpointProps = {}): UseDeleteChannelEndpointResult => {\n const propsRef = useRef<UseDeleteChannelEndpointProps>(props);\n propsRef.current = props;\n const novu = useNovu();\n const [isDeleting, setIsDeleting] = useState(false);\n const [error, setError] = useState<NovuError>();\n\n const remove = useCallback(\n async (identifier: string) => {\n setError(undefined);\n setIsDeleting(true);\n\n try {\n const response = await novu.channelEndpoints.delete({ identifier });\n\n if (response.error) {\n setError(response.error as NovuError);\n propsRef.current.onError?.(response.error as NovuError);\n } else {\n propsRef.current.onSuccess?.();\n }\n\n return response as { data?: undefined; error?: NovuError };\n } catch (err) {\n const novuError = err as NovuError;\n setError(novuError);\n propsRef.current.onError?.(novuError);\n\n return { error: novuError };\n } finally {\n setIsDeleting(false);\n }\n },\n [novu]\n );\n\n return {\n remove,\n isDeleting,\n error,\n };\n};\n"],"mappings":";AACA,SAAS,aAAa,QAAQ,gBAAgB;AAC9C,SAAS,eAAe;AAgBjB,IAAM,2BAA2B,CAAC,QAAuC,CAAC,MAAsC;AACrH,QAAM,WAAW,OAAsC,KAAK;AAC5D,WAAS,UAAU;AACnB,QAAM,OAAO,QAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAE9C,QAAM,SAAS;AAAA,IACb,OAAO,eAAuB;AAC5B,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,UAAI;AACF,cAAM,WAAW,MAAM,KAAK,iBAAiB,OAAO,EAAE,WAAW,CAAC;AAElE,YAAI,SAAS,OAAO;AAClB,mBAAS,SAAS,KAAkB;AACpC,mBAAS,QAAQ,UAAU,SAAS,KAAkB;AAAA,QACxD,OAAO;AACL,mBAAS,QAAQ,YAAY;AAAA,QAC/B;AAEA,eAAO;AAAA,MACT,SAAS,KAAK;AACZ,cAAM,YAAY;AAClB,iBAAS,SAAS;AAClB,iBAAS,QAAQ,UAAU,SAAS;AAEpC,eAAO,EAAE,OAAO,UAAU;AAAA,MAC5B,UAAE;AACA,sBAAc,KAAK;AAAA,MACrB;AAAA,IACF;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useNotifications.ts"],"sourcesContent":["import { checkNotificationMatchesFilter, isSameFilter, Notification, NotificationFilter, NovuError } from '@notiflyio/js';\r\nimport { useCallback, useEffect, useState } from 'react';\r\nimport { useDataRef } from './internal/useDataRef';\r\nimport { useWebSocketEvent } from './internal/useWebsocketEvent';\r\nimport { useNovu, useRealtime } from './NovuProvider';\r\n\r\n/**\r\n * Props for the useNotifications hook.\r\n *\r\n * @example\r\n * ```tsx\r\n * // Get unread notifications\r\n * const { notifications } = useNotifications({\r\n * read: false\r\n * });\r\n *\r\n * // Get unseen notifications with specific tags\r\n * const { notifications } = useNotifications({\r\n * seen: false,\r\n * tags: ['important']\r\n * });\r\n *\r\n * // Get notifications (auto-updates in real time when new notifications arrive)\r\n * const { notifications } = useNotifications({\r\n * read: false\r\n * });\r\n *\r\n * // Get notifications from a specific time period\r\n * const { notifications } = useNotifications({\r\n * createdGte: 1704067200000,\r\n * createdLte: 1735689599999\r\n * });\r\n *\r\n * // Opt out of the built-in realtime updates and drive them yourself\r\n * const { notifications, refetch } = useNotifications({\r\n * read: false,\r\n * realtime: false,\r\n * });\r\n * ```\r\n */\r\nexport type UseNotificationsProps = {\r\n tags?: NotificationFilter['tags'];\r\n data?: NotificationFilter['data'];\r\n read?: NotificationFilter['read'];\r\n archived?: NotificationFilter['archived'];\r\n snoozed?: NotificationFilter['snoozed'];\r\n seen?: NotificationFilter['seen'];\r\n severity?: NotificationFilter['severity'];\r\n createdGte?: NotificationFilter['createdGte'];\r\n createdLte?: NotificationFilter['createdLte'];\r\n limit?: number;\r\n /**\r\n * When `false`, disables the WebSocket subscription that auto-injects\r\n * newly received notifications into the list. Built-in mutations like\r\n * `readAll`, `seenAll`, `archiveAll`, and `archiveAllRead` continue to\r\n * update local state. Use this when you want to drive new-notification updates yourself (e.g.\r\n * via your own `novu.on('notifications.notification_received', ...)`\r\n * handler combined with `refetch()`).\r\n *\r\n * When set, this prop takes precedence over the `realtime` config on\r\n * `<NovuProvider />`. When omitted, the provider value (default `true`) is used.\r\n */\r\n realtime?: boolean;\r\n onSuccess?: (data: Notification[]) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseNotificationsResult = {\r\n notifications?: Notification[];\r\n error?: NovuError;\r\n isLoading: boolean;\r\n isFetching: boolean;\r\n hasMore: boolean;\r\n readAll: () => Promise<{\r\n data?: void | undefined;\r\n error?: NovuError | undefined;\r\n }>;\r\n seenAll: () => Promise<{\r\n data?: void | undefined;\r\n error?: NovuError | undefined;\r\n }>;\r\n archiveAll: () => Promise<{\r\n data?: void | undefined;\r\n error?: NovuError | undefined;\r\n }>;\r\n archiveAllRead: () => Promise<{\r\n data?: void | undefined;\r\n error?: NovuError | undefined;\r\n }>;\r\n refetch: () => Promise<void>;\r\n fetchMore: () => Promise<void>;\r\n};\r\n\r\nexport const useNotifications = (props?: UseNotificationsProps): UseNotificationsResult => {\r\n const {\r\n tags,\r\n data: dataFilter,\r\n read,\r\n archived = false,\r\n snoozed = false,\r\n seen,\r\n severity,\r\n createdGte,\r\n createdLte,\r\n limit = 10,\r\n realtime: propsRealtime,\r\n onSuccess,\r\n onError,\r\n } = props || {};\r\n const limitRef = useDataRef<number | undefined>(limit);\r\n const filterRef = useDataRef<NotificationFilter>({\r\n tags,\r\n data: dataFilter,\r\n read,\r\n archived,\r\n snoozed,\r\n seen,\r\n severity,\r\n createdGte,\r\n createdLte,\r\n });\r\n const novu = useNovu();\r\n const providerRealtime = useRealtime();\r\n const realtime = propsRealtime ?? providerRealtime;\r\n const [data, setData] = useState<Array<Notification>>();\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n const [hasMore, setHasMore] = useState(false);\r\n const length = data?.length;\r\n const after = length ? data[length - 1].id : undefined;\r\n const afterRef = useDataRef<string | undefined>(after);\r\n\r\n useEffect(() => {\r\n const listener = ({\r\n data,\r\n }: {\r\n data: { notifications: Notification[]; hasMore: boolean; filter: NotificationFilter };\r\n }) => {\r\n if (!data || !isSameFilter(filterRef.current, data.filter)) {\r\n return;\r\n }\r\n\r\n // the event is called with the list of all notifications cached matching the current filter\r\n setData(data.notifications);\r\n setHasMore(data.hasMore);\r\n };\r\n\r\n const cleanup = novu.on('notifications.list.updated', listener);\r\n\r\n return () => {\r\n cleanup();\r\n };\r\n }, [filterRef, novu]);\r\n\r\n useWebSocketEvent({\r\n event: 'notifications.notification_received',\r\n enabled: realtime,\r\n eventHandler: ({ result: notification }) => {\r\n const currentFilter = filterRef.current;\r\n const matches = checkNotificationMatchesFilter(notification, currentFilter);\r\n if (matches) {\r\n // the limit and after props are used to create a cache key\r\n // the first batch of notifications in the cache doesn't include the after prop and we want to push to the first batch\r\n const cacheKey = { ...currentFilter, limit: limitRef.current };\r\n novu.notifications.cache.unshift(cacheKey, notification);\r\n }\r\n },\r\n });\r\n\r\n const fetchNotifications = useCallback(\r\n async (options?: { refetch: boolean }) => {\r\n if (options?.refetch) {\r\n setError(undefined);\r\n setIsLoading(true);\r\n setIsFetching(false);\r\n }\r\n setIsFetching(true);\r\n\r\n const response = await novu.notifications.list({\r\n ...filterRef.current,\r\n limit,\r\n after: options?.refetch ? undefined : afterRef.current,\r\n });\r\n\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n } else if (response.data) {\r\n const responseData = response.data;\r\n onSuccess?.(responseData.notifications);\r\n setData(responseData.notifications);\r\n setHasMore(responseData.hasMore);\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n }\r\n },\r\n [novu, filterRef, afterRef, limit, onError, onSuccess]\r\n );\r\n\r\n useEffect(() => {\r\n novu.notifications.clearCache({ filter: filterRef.current });\r\n fetchNotifications({ refetch: true });\r\n }, [filterRef, novu, JSON.stringify(filterRef.current), fetchNotifications]);\r\n\r\n const refetch = useCallback(() => {\r\n novu.notifications.clearCache({ filter: filterRef.current });\r\n return fetchNotifications({ refetch: true });\r\n }, [filterRef, novu, fetchNotifications]);\r\n\r\n const fetchMore = useCallback(async () => {\r\n if (!hasMore || isFetching) return;\r\n\r\n return fetchNotifications();\r\n }, [hasMore, isFetching, fetchNotifications]);\r\n\r\n const readAll = useCallback(async () => {\r\n return await novu.notifications.readAll({ tags: filterRef.current.tags, data: filterRef.current.data });\r\n }, [filterRef, novu]);\r\n\r\n const seenAll = useCallback(async () => {\r\n return await novu.notifications.seenAll({ tags: filterRef.current.tags, data: filterRef.current.data });\r\n }, [filterRef, novu]);\r\n\r\n const archiveAll = useCallback(async () => {\r\n return await novu.notifications.archiveAll({ tags: filterRef.current.tags, data: filterRef.current.data });\r\n }, [filterRef, novu]);\r\n\r\n const archiveAllRead = useCallback(async () => {\r\n return await novu.notifications.archiveAllRead({ tags: filterRef.current.tags, data: filterRef.current.data });\r\n }, [filterRef, novu]);\r\n\r\n return {\r\n readAll,\r\n seenAll,\r\n archiveAll,\r\n archiveAllRead,\r\n notifications: data,\r\n error,\r\n isLoading,\r\n isFetching,\r\n refetch,\r\n fetchMore,\r\n hasMore,\r\n };\r\n};\r\n"],"mappings":";AAAA,SAAS,gCAAgC,oBAAiE;AAC1G,SAAS,aAAa,WAAW,gBAAgB;AACjD,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAClC,SAAS,SAAS,mBAAmB;AAyF9B,IAAM,mBAAmB,CAAC,UAA0D;AACzF,QAAM;AAAA,IACJ;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA,WAAW;AAAA,IACX,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,UAAU;AAAA,IACV;AAAA,IACA;AAAA,EACF,IAAI,SAAS,CAAC;AACd,QAAM,WAAW,WAA+B,KAAK;AACrD,QAAM,YAAY,WAA+B;AAAA,IAC/C;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,OAAO,QAAQ;AACrB,QAAM,mBAAmB,YAAY;AACrC,QAAM,WAAW,iBAAiB;AAClC,QAAM,CAAC,MAAM,OAAO,IAAI,SAA8B;AACtD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,SAAS,MAAM;AACrB,QAAM,QAAQ,SAA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YAAY,YAAY;AAC7C,WAAO,MAAM,KAAK,cAAc,eAAe,EAAE,MAAM,UAAU,QAAQ,MAAM,MAAM,UAAU,QAAQ,KAAK,CAAC;AAAA,EAC/G,GAAG,CAAC,WAAW,IAAI,CAAC;AAEpB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["data"]} | ||
| {"version":3,"sources":["../../../src/hooks/useNotifications.ts"],"sourcesContent":["import { checkNotificationMatchesFilter, isSameFilter, Notification, NotificationFilter, NovuError } from '@notiflyio/js';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useDataRef } from './internal/useDataRef';\nimport { useWebSocketEvent } from './internal/useWebsocketEvent';\nimport { useNovu, useRealtime } from './NovuProvider';\n\n/**\n * Props for the useNotifications hook.\n *\n * @example\n * ```tsx\n * // Get unread notifications\n * const { notifications } = useNotifications({\n * read: false\n * });\n *\n * // Get unseen notifications with specific tags\n * const { notifications } = useNotifications({\n * seen: false,\n * tags: ['important']\n * });\n *\n * // Get notifications (auto-updates in real time when new notifications arrive)\n * const { notifications } = useNotifications({\n * read: false\n * });\n *\n * // Get notifications from a specific time period\n * const { notifications } = useNotifications({\n * createdGte: 1704067200000,\n * createdLte: 1735689599999\n * });\n *\n * // Opt out of the built-in realtime updates and drive them yourself\n * const { notifications, refetch } = useNotifications({\n * read: false,\n * realtime: false,\n * });\n * ```\n */\nexport type UseNotificationsProps = {\n tags?: NotificationFilter['tags'];\n data?: NotificationFilter['data'];\n read?: NotificationFilter['read'];\n archived?: NotificationFilter['archived'];\n snoozed?: NotificationFilter['snoozed'];\n seen?: NotificationFilter['seen'];\n severity?: NotificationFilter['severity'];\n createdGte?: NotificationFilter['createdGte'];\n createdLte?: NotificationFilter['createdLte'];\n limit?: number;\n /**\n * When `false`, disables the WebSocket subscription that auto-injects\n * newly received notifications into the list. Built-in mutations like\n * `readAll`, `seenAll`, `archiveAll`, and `archiveAllRead` continue to\n * update local state. Use this when you want to drive new-notification updates yourself (e.g.\n * via your own `novu.on('notifications.notification_received', ...)`\n * handler combined with `refetch()`).\n *\n * When set, this prop takes precedence over the `realtime` config on\n * `<NovuProvider />`. When omitted, the provider value (default `true`) is used.\n */\n realtime?: boolean;\n onSuccess?: (data: Notification[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseNotificationsResult = {\n notifications?: Notification[];\n error?: NovuError;\n isLoading: boolean;\n isFetching: boolean;\n hasMore: boolean;\n readAll: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n seenAll: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n archiveAll: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n archiveAllRead: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n refetch: () => Promise<void>;\n fetchMore: () => Promise<void>;\n};\n\nexport const useNotifications = (props?: UseNotificationsProps): UseNotificationsResult => {\n const {\n tags,\n data: dataFilter,\n read,\n archived = false,\n snoozed = false,\n seen,\n severity,\n createdGte,\n createdLte,\n limit = 10,\n realtime: propsRealtime,\n onSuccess,\n onError,\n } = props || {};\n const limitRef = useDataRef<number | undefined>(limit);\n const filterRef = useDataRef<NotificationFilter>({\n tags,\n data: dataFilter,\n read,\n archived,\n snoozed,\n seen,\n severity,\n createdGte,\n createdLte,\n });\n const novu = useNovu();\n const providerRealtime = useRealtime();\n const realtime = propsRealtime ?? providerRealtime;\n const [data, setData] = useState<Array<Notification>>();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n const [hasMore, setHasMore] = useState(false);\n const length = data?.length;\n const after = length ? data[length - 1].id : undefined;\n const afterRef = useDataRef<string | undefined>(after);\n\n useEffect(() => {\n const listener = ({\n data,\n }: {\n data: { notifications: Notification[]; hasMore: boolean; filter: NotificationFilter };\n }) => {\n if (!data || !isSameFilter(filterRef.current, data.filter)) {\n return;\n }\n\n // the event is called with the list of all notifications cached matching the current filter\n setData(data.notifications);\n setHasMore(data.hasMore);\n };\n\n const cleanup = novu.on('notifications.list.updated', listener);\n\n return () => {\n cleanup();\n };\n }, [filterRef, novu]);\n\n useWebSocketEvent({\n event: 'notifications.notification_received',\n enabled: realtime,\n eventHandler: ({ result: notification }) => {\n const currentFilter = filterRef.current;\n const matches = checkNotificationMatchesFilter(notification, currentFilter);\n if (matches) {\n // the limit and after props are used to create a cache key\n // the first batch of notifications in the cache doesn't include the after prop and we want to push to the first batch\n const cacheKey = { ...currentFilter, limit: limitRef.current };\n novu.notifications.cache.unshift(cacheKey, notification);\n }\n },\n });\n\n const fetchNotifications = useCallback(\n async (options?: { refetch: boolean }) => {\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n setIsFetching(false);\n }\n setIsFetching(true);\n\n const response = await novu.notifications.list({\n ...filterRef.current,\n limit,\n after: options?.refetch ? undefined : afterRef.current,\n });\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n setIsLoading(false);\n setIsFetching(false);\n } else if (response.data) {\n const responseData = response.data;\n onSuccess?.(responseData.notifications);\n setData(responseData.notifications);\n setHasMore(responseData.hasMore);\n setIsLoading(false);\n setIsFetching(false);\n }\n },\n [novu, filterRef, afterRef, limit, onError, onSuccess]\n );\n\n useEffect(() => {\n novu.notifications.clearCache({ filter: filterRef.current });\n fetchNotifications({ refetch: true });\n }, [filterRef, novu, JSON.stringify(filterRef.current), fetchNotifications]);\n\n const refetch = useCallback(() => {\n novu.notifications.clearCache({ filter: filterRef.current });\n return fetchNotifications({ refetch: true });\n }, [filterRef, novu, fetchNotifications]);\n\n const fetchMore = useCallback(async () => {\n if (!hasMore || isFetching) return;\n\n return fetchNotifications();\n }, [hasMore, isFetching, fetchNotifications]);\n\n const readAll = useCallback(async () => {\n return await novu.notifications.readAll({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n const seenAll = useCallback(async () => {\n return await novu.notifications.seenAll({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n const archiveAll = useCallback(async () => {\n return await novu.notifications.archiveAll({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n const archiveAllRead = useCallback(async () => {\n return await novu.notifications.archiveAllRead({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n return {\n readAll,\n seenAll,\n archiveAll,\n archiveAllRead,\n notifications: data,\n error,\n isLoading,\n isFetching,\n refetch,\n fetchMore,\n hasMore,\n };\n};\n"],"mappings":";AAAA,SAAS,gCAAgC,oBAAiE;AAC1G,SAAS,aAAa,WAAW,gBAAgB;AACjD,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAClC,SAAS,SAAS,mBAAmB;AAyF9B,IAAM,mBAAmB,CAAC,UAA0D;AACzF,QAAM;AAAA,IACJ;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA,WAAW;AAAA,IACX,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,UAAU;AAAA,IACV;AAAA,IACA;AAAA,EACF,IAAI,SAAS,CAAC;AACd,QAAM,WAAW,WAA+B,KAAK;AACrD,QAAM,YAAY,WAA+B;AAAA,IAC/C;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,OAAO,QAAQ;AACrB,QAAM,mBAAmB,YAAY;AACrC,QAAM,WAAW,iBAAiB;AAClC,QAAM,CAAC,MAAM,OAAO,IAAI,SAA8B;AACtD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,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AAU,QAAQ,MAAM,MAAM,UAAU,QAAQ,KAAK,CAAC;AAAA,EAC3G,GAAG,CAAC,WAAW,IAAI,CAAC;AAEpB,QAAM,iBAAiB,YAAY,YAAY;AAC7C,WAAO,MAAM,KAAK,cAAc,eAAe,EAAE,MAAM,UAAU,QAAQ,MAAM,MAAM,UAAU,QAAQ,KAAK,CAAC;AAAA,EAC/G,GAAG,CAAC,WAAW,IAAI,CAAC;AAEpB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["data"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/usePreferences.ts"],"sourcesContent":["import { NovuError, Preference, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\r\nimport { useEffect, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UsePreferencesProps = {\r\n filter?: {\r\n tags?: string[];\r\n severity?: SeverityLevelEnum | SeverityLevelEnum[];\r\n criticality?: WorkflowCriticalityEnum;\r\n };\r\n onSuccess?: (data: Preference[]) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UsePreferencesResult = {\r\n preferences?: Preference[];\r\n error?: NovuError;\r\n isLoading: boolean; // initial loading\r\n isFetching: boolean; // the request is in flight\r\n refetch: () => Promise<void>;\r\n};\r\n\r\nexport const usePreferences = (props?: UsePreferencesProps): UsePreferencesResult => {\r\n const { onSuccess, onError } = props || {};\r\n const [data, setData] = useState<Preference[]>();\r\n const { preferences, on } = useNovu();\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const sync = (event: { data?: Preference[] }) => {\r\n if (!event.data) {\r\n return;\r\n }\r\n setData(event.data);\r\n };\r\n\r\n useEffect(() => {\r\n fetchPreferences();\r\n\r\n const listUpdatedCleanup = on('preferences.list.updated', sync);\r\n const listPendingCleanup = on('preferences.list.pending', sync);\r\n const listResolvedCleanup = on('preferences.list.resolved', sync);\r\n\r\n return () => {\r\n listUpdatedCleanup();\r\n listPendingCleanup();\r\n listResolvedCleanup();\r\n };\r\n }, []);\r\n\r\n const fetchPreferences = async () => {\r\n setIsFetching(true);\r\n const response = await preferences.list(props?.filter);\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n } else if (response.data) {\r\n setData(response.data);\r\n onSuccess?.(response.data);\r\n }\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n };\r\n\r\n const refetch = () => {\r\n preferences.cache.clearAll();\r\n\r\n return fetchPreferences();\r\n };\r\n\r\n return {\r\n preferences: data,\r\n error,\r\n isLoading,\r\n isFetching,\r\n refetch,\r\n };\r\n};\r\n"],"mappings":";AACA,SAAS,WAAW,gBAAgB;AACpC,SAAS,eAAe;AAoBjB,IAAM,iBAAiB,CAAC,UAAsD;AACnF,QAAM,EAAE,WAAW,QAAQ,IAAI,SAAS,CAAC;AACzC,QAAM,CAAC,MAAM,OAAO,IAAI,SAAuB;AAC/C,QAAM,EAAE,aAAa,GAAG,IAAI,QAAQ;AACpC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,OAAO,CAAC,UAAmC;AAC/C,QAAI,CAAC,MAAM,MAAM;AACf;AAAA,IACF;AACA,YAAQ,MAAM,IAAI;AAAA,EACpB;AAEA,YAAU,MAAM;AACd,qBAAiB;AAEjB,UAAM,qBAAqB,GAAG,4BAA4B,IAAI;AAC9D,UAAM,qBAAqB,GAAG,4BAA4B,IAAI;AAC9D,UAAM,sBAAsB,GAAG,6BAA6B,IAAI;AAEhE,WAAO,MAAM;AACX,yBAAmB;AACnB,yBAAmB;AACnB,0BAAoB;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,mBAAmB,YAAY;AACnC,kBAAc,IAAI;AAClB,UAAM,WAAW,MAAM,YAAY,KAAK,OAAO,MAAM;AACrD,QAAI,SAAS,OAAO;AAClB,eAAS,SAAS,KAAK;AACvB,gBAAU,SAAS,KAAK;AAAA,IAC1B,WAAW,SAAS,MAAM;AACxB,cAAQ,SAAS,IAAI;AACrB,kBAAY,SAAS,IAAI;AAAA,IAC3B;AACA,iBAAa,KAAK;AAClB,kBAAc,KAAK;AAAA,EACrB;AAEA,QAAM,UAAU,MAAM;AACpB,gBAAY,MAAM,SAAS;AAE3B,WAAO,iBAAiB;AAAA,EAC1B;AAEA,SAAO;AAAA,IACL,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/usePreferences.ts"],"sourcesContent":["import { NovuError, Preference, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\nimport { useEffect, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UsePreferencesProps = {\n filter?: {\n tags?: string[];\n severity?: SeverityLevelEnum | SeverityLevelEnum[];\n criticality?: WorkflowCriticalityEnum;\n };\n onSuccess?: (data: Preference[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UsePreferencesResult = {\n preferences?: Preference[];\n error?: NovuError;\n isLoading: boolean; // initial loading\n isFetching: boolean; // the request is in flight\n refetch: () => Promise<void>;\n};\n\nexport const usePreferences = (props?: UsePreferencesProps): UsePreferencesResult => {\n const { onSuccess, onError } = props || {};\n const [data, setData] = useState<Preference[]>();\n const { preferences, on } = useNovu();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const sync = (event: { data?: Preference[] }) => {\n if (!event.data) {\n return;\n }\n setData(event.data);\n };\n\n useEffect(() => {\n fetchPreferences();\n\n const listUpdatedCleanup = on('preferences.list.updated', sync);\n const listPendingCleanup = on('preferences.list.pending', sync);\n const listResolvedCleanup = on('preferences.list.resolved', sync);\n\n return () => {\n listUpdatedCleanup();\n listPendingCleanup();\n listResolvedCleanup();\n };\n }, []);\n\n const fetchPreferences = async () => {\n setIsFetching(true);\n const response = await preferences.list(props?.filter);\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data) {\n setData(response.data);\n onSuccess?.(response.data);\n }\n setIsLoading(false);\n setIsFetching(false);\n };\n\n const refetch = () => {\n preferences.cache.clearAll();\n\n return fetchPreferences();\n };\n\n return {\n preferences: data,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n"],"mappings":";AACA,SAAS,WAAW,gBAAgB;AACpC,SAAS,eAAe;AAoBjB,IAAM,iBAAiB,CAAC,UAAsD;AACnF,QAAM,EAAE,WAAW,QAAQ,IAAI,SAAS,CAAC;AACzC,QAAM,CAAC,MAAM,OAAO,IAAI,SAAuB;AAC/C,QAAM,EAAE,aAAa,GAAG,IAAI,QAAQ;AACpC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,OAAO,CAAC,UAAmC;AAC/C,QAAI,CAAC,MAAM,MAAM;AACf;AAAA,IACF;AACA,YAAQ,MAAM,IAAI;AAAA,EACpB;AAEA,YAAU,MAAM;AACd,qBAAiB;AAEjB,UAAM,qBAAqB,GAAG,4BAA4B,IAAI;AAC9D,UAAM,qBAAqB,GAAG,4BAA4B,IAAI;AAC9D,UAAM,sBAAsB,GAAG,6BAA6B,IAAI;AAEhE,WAAO,MAAM;AACX,yBAAmB;AACnB,yBAAmB;AACnB,0BAAoB;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,mBAAmB,YAAY;AACnC,kBAAc,IAAI;AAClB,UAAM,WAAW,MAAM,YAAY,KAAK,OAAO,MAAM;AACrD,QAAI,SAAS,OAAO;AAClB,eAAS,SAAS,KAAK;AACvB,gBAAU,SAAS,KAAK;AAAA,IAC1B,WAAW,SAAS,MAAM;AACxB,cAAQ,SAAS,IAAI;AACrB,kBAAY,SAAS,IAAI;AAAA,IAC3B;AACA,iBAAa,KAAK;AAClB,kBAAc,KAAK;AAAA,EACrB;AAEA,QAAM,UAAU,MAAM;AACpB,gBAAY,MAAM,SAAS;AAE3B,WAAO,iBAAiB;AAAA,EAC1B;AAEA,SAAO;AAAA,IACL,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useRemoveSubscription.ts"],"sourcesContent":["import { BaseDeleteSubscriptionArgs, NovuError, DeleteSubscriptionArgs as RemoveSubscriptionArgs } from '@notiflyio/js';\r\nimport { useCallback, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseRemoveSubscriptionProps = {\r\n onSuccess?: () => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\ntype RemoveResult = Promise<{\r\n error?: NovuError;\r\n}>;\r\n\r\nexport type UseRemoveSubscriptionResult = {\r\n isRemoving: boolean;\r\n error?: NovuError;\r\n remove: (args: RemoveSubscriptionArgs) => RemoveResult;\r\n};\r\n\r\nexport const useRemoveSubscription = (props: UseRemoveSubscriptionProps = {}): UseRemoveSubscriptionResult => {\r\n const propsRef = useRef<UseRemoveSubscriptionProps>(props);\r\n propsRef.current = props;\r\n const novu = useNovu();\r\n const [isRemoving, setIsRemoving] = useState(false);\r\n const [error, setError] = useState<NovuError>();\r\n\r\n const removeCallback = useCallback(\r\n async (args: RemoveSubscriptionArgs): RemoveResult => {\r\n const { onSuccess, onError } = propsRef.current;\r\n setError(undefined);\r\n setIsRemoving(true);\r\n\r\n const response = await novu.subscriptions.delete(args as BaseDeleteSubscriptionArgs);\r\n\r\n setIsRemoving(false);\r\n\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n } else if (response.data) {\r\n onSuccess?.();\r\n }\r\n\r\n return response;\r\n },\r\n [novu]\r\n );\r\n\r\n return {\r\n remove: removeCallback,\r\n isRemoving,\r\n error,\r\n };\r\n};\r\n"],"mappings":";AACA,SAAS,aAAa,QAAQ,gBAAgB;AAC9C,SAAS,eAAe;AAiBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,WAAW,OAAmC,KAAK;AACzD,WAAS,UAAU;AACnB,QAAM,OAAO,QAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAE9C,QAAM,iBAAiB;AAAA,IACrB,OAAO,SAA+C;AACpD,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,OAAO,IAAkC;AAEnF,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,kBAAU,SAAS,KAAK;AAAA,MAC1B,WAAW,SAAS,MAAM;AACxB,oBAAY;AAAA,MACd;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useRemoveSubscription.ts"],"sourcesContent":["import { BaseDeleteSubscriptionArgs, NovuError, DeleteSubscriptionArgs as RemoveSubscriptionArgs } from '@notiflyio/js';\nimport { useCallback, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseRemoveSubscriptionProps = {\n onSuccess?: () => void;\n onError?: (error: NovuError) => void;\n};\n\ntype RemoveResult = Promise<{\n error?: NovuError;\n}>;\n\nexport type UseRemoveSubscriptionResult = {\n isRemoving: boolean;\n error?: NovuError;\n remove: (args: RemoveSubscriptionArgs) => RemoveResult;\n};\n\nexport const useRemoveSubscription = (props: UseRemoveSubscriptionProps = {}): UseRemoveSubscriptionResult => {\n const propsRef = useRef<UseRemoveSubscriptionProps>(props);\n propsRef.current = props;\n const novu = useNovu();\n const [isRemoving, setIsRemoving] = useState(false);\n const [error, setError] = useState<NovuError>();\n\n const removeCallback = useCallback(\n async (args: RemoveSubscriptionArgs): RemoveResult => {\n const { onSuccess, onError } = propsRef.current;\n setError(undefined);\n setIsRemoving(true);\n\n const response = await novu.subscriptions.delete(args as BaseDeleteSubscriptionArgs);\n\n setIsRemoving(false);\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data) {\n onSuccess?.();\n }\n\n return response;\n },\n [novu]\n );\n\n return {\n remove: removeCallback,\n isRemoving,\n error,\n };\n};\n"],"mappings":";AACA,SAAS,aAAa,QAAQ,gBAAgB;AAC9C,SAAS,eAAe;AAiBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,WAAW,OAAmC,KAAK;AACzD,WAAS,UAAU;AACnB,QAAM,OAAO,QAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAE9C,QAAM,iBAAiB;AAAA,IACrB,OAAO,SAA+C;AACpD,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,OAAO,IAAkC;AAEnF,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,kBAAU,SAAS,KAAK;AAAA,MAC1B,WAAW,SAAS,MAAM;AACxB,oBAAY;AAAA,MACd;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useSchedule.ts"],"sourcesContent":["import { NovuError, Schedule } from '@notiflyio/js';\r\nimport { useEffect, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseScheduleProps = {\r\n onSuccess?: (data: Schedule) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseScheduleResult = {\r\n schedule?: Schedule;\r\n error?: NovuError;\r\n isLoading: boolean; // initial loading\r\n isFetching: boolean; // the request is in flight\r\n refetch: () => Promise<void>;\r\n};\r\n\r\nexport const useSchedule = (props?: UseScheduleProps): UseScheduleResult => {\r\n const { onSuccess, onError } = props || {};\r\n const [data, setData] = useState<Schedule>();\r\n const { preferences, on } = useNovu();\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const sync = (event: { data?: Schedule }) => {\r\n if (!event.data) {\r\n return;\r\n }\r\n setData(event.data);\r\n };\r\n\r\n useEffect(() => {\r\n fetchSchedule();\r\n\r\n const listUpdatedCleanup = on('preference.schedule.get.updated', sync);\r\n const listPendingCleanup = on('preference.schedule.get.pending', sync);\r\n const listResolvedCleanup = on('preference.schedule.get.resolved', sync);\r\n\r\n return () => {\r\n listUpdatedCleanup();\r\n listPendingCleanup();\r\n listResolvedCleanup();\r\n };\r\n }, []);\r\n\r\n const fetchSchedule = async () => {\r\n setIsFetching(true);\r\n const response = await preferences.schedule.get();\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n } else if (response.data) {\r\n setData(response.data);\r\n onSuccess?.(response.data);\r\n }\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n };\r\n\r\n const refetch = () => {\r\n preferences.schedule.cache.clearAll();\r\n\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,SAAO;AAAA,IACL,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useSchedule.ts"],"sourcesContent":["import { NovuError, Schedule } from '@notiflyio/js';\nimport { useEffect, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseScheduleProps = {\n onSuccess?: (data: Schedule) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseScheduleResult = {\n schedule?: Schedule;\n error?: NovuError;\n isLoading: boolean; // initial loading\n isFetching: boolean; // the request is in flight\n refetch: () => Promise<void>;\n};\n\nexport const useSchedule = (props?: UseScheduleProps): UseScheduleResult => {\n const { onSuccess, onError } = props || {};\n const [data, setData] = useState<Schedule>();\n const { preferences, on } = useNovu();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const sync = (event: { data?: Schedule }) => {\n if (!event.data) {\n return;\n }\n setData(event.data);\n };\n\n useEffect(() => {\n fetchSchedule();\n\n const listUpdatedCleanup = on('preference.schedule.get.updated', sync);\n const listPendingCleanup = on('preference.schedule.get.pending', sync);\n const listResolvedCleanup = on('preference.schedule.get.resolved', sync);\n\n return () => {\n listUpdatedCleanup();\n listPendingCleanup();\n listResolvedCleanup();\n };\n }, []);\n\n const fetchSchedule = async () => {\n setIsFetching(true);\n const response = await preferences.schedule.get();\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data) {\n setData(response.data);\n onSuccess?.(response.data);\n }\n setIsLoading(false);\n setIsFetching(false);\n };\n\n const refetch = () => {\n preferences.schedule.cache.clearAll();\n\n return fetchSchedule();\n };\n\n return {\n schedule: data,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n"],"mappings":";AACA,SAAS,WAAW,gBAAgB;AACpC,SAAS,eAAe;AAejB,IAAM,cAAc,CAAC,UAAgD;AAC1E,QAAM,EAAE,WAAW,QAAQ,IAAI,SAAS,CAAC;AACzC,QAAM,CAAC,MAAM,OAAO,IAAI,SAAmB;AAC3C,QAAM,EAAE,aAAa,GAAG,IAAI,QAAQ;AACpC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,OAAO,CAAC,UAA+B;AAC3C,QAAI,CAAC,MAAM,MAAM;AACf;AAAA,IACF;AACA,YAAQ,MAAM,IAAI;AAAA,EACpB;AAEA,YAAU,MAAM;AACd,kBAAc;AAEd,UAAM,qBAAqB,GAAG,mCAAmC,IAAI;AACrE,UAAM,qBAAqB,GAAG,mCAAmC,IAAI;AACrE,UAAM,sBAAsB,GAAG,oCAAoC,IAAI;AAEvE,WAAO,MAAM;AACX,yBAAmB;AACnB,yBAAmB;AACnB,0BAAoB;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,gBAAgB,YAAY;AAChC,kBAAc,IAAI;AAClB,UAAM,WAAW,MAAM,YAAY,SAAS,IAAI;AAChD,QAAI,SAAS,OAAO;AAClB,eAAS,SAAS,KAAK;AACvB,gBAAU,SAAS,KAAK;AAAA,IAC1B,WAAW,SAAS,MAAM;AACxB,cAAQ,SAAS,IAAI;AACrB,kBAAY,SAAS,IAAI;AAAA,IAC3B;AACA,iBAAa,KAAK;AAClB,kBAAc,KAAK;AAAA,EACrB;AAEA,QAAM,UAAU,MAAM;AACpB,gBAAY,SAAS,MAAM,SAAS;AAEpC,WAAO,cAAc;AAAA,EACvB;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useSubscription.ts"],"sourcesContent":["import { NovuError, TopicSubscription } from '@notiflyio/js';\r\nimport { buildSubscriptionIdentifier } from '@notiflyio/js/internal';\r\nimport { useCallback, useEffect, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseSubscriptionProps = {\r\n topicKey: string;\r\n identifier?: string;\r\n onSuccess?: (data: TopicSubscription | null) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseSubscriptionResult = {\r\n subscription?: TopicSubscription | null;\r\n error?: NovuError;\r\n isLoading: boolean;\r\n isFetching: boolean;\r\n refetch: () => Promise<void>;\r\n};\r\n\r\n/**\r\n * Get a subscription for a topic.\r\n */\r\nexport const useSubscription = (props: UseSubscriptionProps): UseSubscriptionResult => {\r\n const novu = useNovu();\r\n const propsRef = useRef<UseSubscriptionProps>(props);\r\n propsRef.current = {\r\n ...props,\r\n identifier:\r\n props.identifier ?? buildSubscriptionIdentifier({ topicKey: props.topicKey, subscriberId: novu.subscriberId }),\r\n };\r\n const [subscription, setSubscription] = useState<TopicSubscription | null>();\r\n const subscriptionRef = useRef<TopicSubscription | null>(null);\r\n subscriptionRef.current = subscription ?? null;\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const fetchSubscription = useCallback(\r\n async (options?: { refetch: boolean }) => {\r\n const { topicKey, identifier, onSuccess, onError } = propsRef.current;\r\n if (options?.refetch) {\r\n setError(undefined);\r\n setIsLoading(true);\r\n }\r\n\r\n setIsFetching(true);\r\n\r\n const response = await novu.subscriptions.get(\r\n {\r\n topicKey,\r\n identifier,\r\n },\r\n { refetch: options?.refetch }\r\n );\r\n\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n } else if (response.data !== undefined) {\r\n onSuccess?.(response.data);\r\n setSubscription(response.data);\r\n }\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n },\r\n [novu]\r\n );\r\n\r\n useEffect(() => {\r\n const listener = ({ data: subscription }: { data?: TopicSubscription }) => {\r\n const { topicKey, identifier } = propsRef.current;\r\n if (!subscription || subscription.topicKey !== topicKey || subscription.identifier !== identifier) {\r\n return;\r\n }\r\n\r\n setSubscription(subscription);\r\n setIsFetching(false);\r\n };\r\n\r\n const cleanupGetPending = novu.on('subscription.get.pending', ({ args }) => {\r\n const { topicKey, identifier } = propsRef.current;\r\n if (!args || args.topicKey !== topicKey || args.identifier !== identifier) {\r\n return;\r\n }\r\n setIsFetching(true);\r\n });\r\n\r\n const cleanupGetResolved = novu.on('subscription.get.resolved', ({ args, data, error }) => {\r\n const { topicKey, identifier, onSuccess, onError } = propsRef.current;\r\n if (!args || args.topicKey !== topicKey || args.identifier !== identifier) {\r\n return;\r\n }\r\n if (error) {\r\n setError(error as NovuError);\r\n onError?.(error as NovuError);\r\n } else {\r\n setSubscription(data ?? null);\r\n onSuccess?.(data ?? null);\r\n }\r\n setIsFetching(false);\r\n });\r\n\r\n const cleanupCreatePending = novu.on('subscription.create.pending', ({ args }) => {\r\n const { topicKey, identifier } = propsRef.current;\r\n if (!args || args.topicKey !== topicKey || args.identifier !== identifier) {\r\n return;\r\n }\r\n setIsFetching(true);\r\n });\r\n\r\n const cleanupCreateResolved = novu.on('subscription.create.resolved', listener);\r\n\r\n const cleanupUpdateResolved = novu.on('subscription.update.resolved', listener);\r\n\r\n const cleanupDeletePending = novu.on('subscription.delete.pending', ({ args }) => {\r\n const subscriptionId = subscriptionRef.current?.id;\r\n const subscriptionIdentifier = subscriptionRef.current?.identifier;\r\n if (!subscriptionId || !subscriptionIdentifier) {\r\n return;\r\n }\r\n\r\n if (\r\n !args ||\r\n ('subscriptionId' in args &&\r\n args.subscriptionId !== subscriptionId &&\r\n args.subscriptionId !== subscriptionIdentifier) ||\r\n ('subscription' in args &&\r\n args.subscription.id !== subscriptionId &&\r\n args.subscription.identifier !== subscriptionIdentifier)\r\n ) {\r\n return;\r\n }\r\n setIsFetching(true);\r\n });\r\n\r\n const cleanupDeleteResolved = novu.on('subscription.delete.resolved', ({ args }) => {\r\n const subscriptionId = subscriptionRef.current?.id;\r\n const subscriptionIdentifier = subscriptionRef.current?.identifier;\r\n if (!subscriptionId || !subscriptionIdentifier) {\r\n return;\r\n }\r\n\r\n if (\r\n ('subscriptionId' in args && args.subscriptionId === subscriptionId) ||\r\n ('subscriptionId' in args && args.subscriptionId === subscriptionIdentifier) ||\r\n ('subscription' in args && args.subscription.id === subscriptionId) ||\r\n ('subscription' in args && args.subscription.identifier === subscriptionIdentifier)\r\n ) {\r\n setSubscription(null);\r\n setIsFetching(false);\r\n }\r\n });\r\n\r\n void fetchSubscription({ refetch: true });\r\n\r\n return () => {\r\n cleanupGetPending();\r\n cleanupGetResolved();\r\n cleanupCreatePending();\r\n cleanupCreateResolved();\r\n cleanupUpdateResolved();\r\n cleanupDeletePending();\r\n cleanupDeleteResolved();\r\n };\r\n }, [novu, fetchSubscription]);\r\n\r\n const refetch = useCallback(() => fetchSubscription({ refetch: true }), [fetchSubscription]);\r\n\r\n return {\r\n subscription,\r\n error,\r\n isLoading,\r\n isFetching,\r\n refetch,\r\n };\r\n};\r\n"],"mappings":";AACA,SAAS,mCAAmC;AAC5C,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAAS,eAAe;AAoBjB,IAAM,kBAAkB,CAAC,UAAuD;AACrF,QAAM,OAAO,QAAQ;AACrB,QAAM,WAAW,OAA6B,KAAK;AACnD,WAAS,UAAU;AAAA,IACjB,GAAG;AAAA,IACH,YACE,MAAM,cAAc,4BAA4B,EAAE,UAAU,MAAM,UAAU,cAAc,KAAK,aAAa,CAAC;AAAA,EACjH;AACA,QAAM,CAAC,cAAc,eAAe,IAAI,SAAmC;AAC3E,QAAM,kBAAkB,OAAiC,IAAI;AAC7D,kBAAgB,UAAU,gBAAgB;AAC1C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,oBAA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nD,kBAAkB,QAAQ,KAAK,aAAa,eAAe,wBAC5D;AACA,wBAAgB,IAAI;AACpB,sBAAc,KAAK;AAAA,MACrB;AAAA,IACF,CAAC;AAED,SAAK,kBAAkB,EAAE,SAAS,KAAK,CAAC;AAExC,WAAO,MAAM;AACX,wBAAkB;AAClB,yBAAmB;AACnB,2BAAqB;AACrB,4BAAsB;AACtB,4BAAsB;AACtB,2BAAqB;AACrB,4BAAsB;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,MAAM,iBAAiB,CAAC;AAE5B,QAAM,UAAU,YAAY,MAAM,kBAAkB,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC;AAE3F,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["subscription","error"]} | ||
| {"version":3,"sources":["../../../src/hooks/useSubscription.ts"],"sourcesContent":["import { NovuError, TopicSubscription } from '@notiflyio/js';\nimport { buildSubscriptionIdentifier } from '@notiflyio/js/internal';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseSubscriptionProps = {\n topicKey: string;\n identifier?: string;\n onSuccess?: (data: TopicSubscription | null) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseSubscriptionResult = {\n subscription?: TopicSubscription | null;\n error?: NovuError;\n isLoading: boolean;\n isFetching: boolean;\n refetch: () => Promise<void>;\n};\n\n/**\n * Get a subscription for a topic.\n */\nexport const useSubscription = (props: UseSubscriptionProps): UseSubscriptionResult => {\n const novu = useNovu();\n const propsRef = useRef<UseSubscriptionProps>(props);\n propsRef.current = {\n ...props,\n identifier:\n props.identifier ?? buildSubscriptionIdentifier({ topicKey: props.topicKey, subscriberId: novu.subscriberId }),\n };\n const [subscription, setSubscription] = useState<TopicSubscription | null>();\n const subscriptionRef = useRef<TopicSubscription | null>(null);\n subscriptionRef.current = subscription ?? null;\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const fetchSubscription = useCallback(\n async (options?: { refetch: boolean }) => {\n const { topicKey, identifier, onSuccess, onError } = propsRef.current;\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n }\n\n setIsFetching(true);\n\n const response = await novu.subscriptions.get(\n {\n topicKey,\n identifier,\n },\n { refetch: options?.refetch }\n );\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data !== undefined) {\n onSuccess?.(response.data);\n setSubscription(response.data);\n }\n setIsLoading(false);\n setIsFetching(false);\n },\n [novu]\n );\n\n useEffect(() => {\n const listener = ({ data: subscription }: { data?: TopicSubscription }) => {\n const { topicKey, identifier } = propsRef.current;\n if (!subscription || subscription.topicKey !== topicKey || subscription.identifier !== identifier) {\n return;\n }\n\n setSubscription(subscription);\n setIsFetching(false);\n };\n\n const cleanupGetPending = novu.on('subscription.get.pending', ({ args }) => {\n const { topicKey, identifier } = propsRef.current;\n if (!args || args.topicKey !== topicKey || args.identifier !== identifier) {\n return;\n }\n setIsFetching(true);\n });\n\n const cleanupGetResolved = novu.on('subscription.get.resolved', ({ args, data, error }) => {\n const { topicKey, identifier, onSuccess, onError } = propsRef.current;\n if (!args || args.topicKey !== topicKey || args.identifier !== identifier) {\n return;\n }\n if (error) {\n setError(error as NovuError);\n onError?.(error as NovuError);\n } else {\n setSubscription(data ?? null);\n onSuccess?.(data ?? null);\n }\n setIsFetching(false);\n });\n\n const cleanupCreatePending = novu.on('subscription.create.pending', ({ args }) => {\n const { topicKey, identifier } = propsRef.current;\n if (!args || args.topicKey !== topicKey || args.identifier !== identifier) {\n return;\n }\n setIsFetching(true);\n });\n\n const cleanupCreateResolved = novu.on('subscription.create.resolved', listener);\n\n const cleanupUpdateResolved = novu.on('subscription.update.resolved', listener);\n\n const cleanupDeletePending = novu.on('subscription.delete.pending', ({ args }) => {\n const subscriptionId = subscriptionRef.current?.id;\n const subscriptionIdentifier = subscriptionRef.current?.identifier;\n if (!subscriptionId || !subscriptionIdentifier) {\n return;\n }\n\n if (\n !args ||\n ('subscriptionId' in args &&\n args.subscriptionId !== subscriptionId &&\n args.subscriptionId !== subscriptionIdentifier) ||\n ('subscription' in args &&\n args.subscription.id !== subscriptionId &&\n args.subscription.identifier !== subscriptionIdentifier)\n ) {\n return;\n }\n setIsFetching(true);\n });\n\n const cleanupDeleteResolved = novu.on('subscription.delete.resolved', ({ args }) => {\n const subscriptionId = subscriptionRef.current?.id;\n const subscriptionIdentifier = subscriptionRef.current?.identifier;\n if (!subscriptionId || !subscriptionIdentifier) {\n return;\n }\n\n if (\n ('subscriptionId' in args && args.subscriptionId === subscriptionId) ||\n ('subscriptionId' in args && args.subscriptionId === subscriptionIdentifier) ||\n ('subscription' in args && args.subscription.id === subscriptionId) ||\n ('subscription' in args && args.subscription.identifier === subscriptionIdentifier)\n ) {\n setSubscription(null);\n setIsFetching(false);\n }\n });\n\n void fetchSubscription({ refetch: true });\n\n return () => {\n cleanupGetPending();\n cleanupGetResolved();\n cleanupCreatePending();\n cleanupCreateResolved();\n cleanupUpdateResolved();\n cleanupDeletePending();\n cleanupDeleteResolved();\n };\n }, [novu, fetchSubscription]);\n\n const refetch = useCallback(() => fetchSubscription({ refetch: true }), [fetchSubscription]);\n\n return {\n subscription,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n"],"mappings":";AACA,SAAS,mCAAmC;AAC5C,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAAS,eAAe;AAoBjB,IAAM,kBAAkB,CAAC,UAAuD;AACrF,QAAM,OAAO,QAAQ;AACrB,QAAM,WAAW,OAA6B,KAAK;AACnD,WAAS,UAAU;AAAA,IACjB,GAAG;AAAA,IACH,YACE,MAAM,cAAc,4BAA4B,EAAE,UAAU,MAAM,UAAU,cAAc,KAAK,aAAa,CAAC;AAAA,EACjH;AACA,QAAM,CAAC,cAAc,eAAe,IAAI,SAAmC;AAC3E,QAAM,kBAAkB,OAAiC,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,gBAAgB,SAAS;AACxD,UAAI,CAAC,kBAAkB,CAAC,wBAAwB;AAC9C;AAAA,MACF;AAEA,UACG,oBAAoB,QAAQ,KAAK,mBAAmB,kBACpD,oBAAoB,QAAQ,KAAK,mBAAmB,0BACpD,kBAAkB,QAAQ,KAAK,aAAa,OAAO,kBACnD,kBAAkB,QAAQ,KAAK,aAAa,eAAe,wBAC5D;AACA,wBAAgB,IAAI;AACpB,sBAAc,KAAK;AAAA,MACrB;AAAA,IACF,CAAC;AAED,SAAK,kBAAkB,EAAE,SAAS,KAAK,CAAC;AAExC,WAAO,MAAM;AACX,wBAAkB;AAClB,yBAAmB;AACnB,2BAAqB;AACrB,4BAAsB;AACtB,4BAAsB;AACtB,2BAAqB;AACrB,4BAAsB;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,MAAM,iBAAiB,CAAC;AAE5B,QAAM,UAAU,YAAY,MAAM,kBAAkB,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC;AAE3F,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["subscription","error"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useSubscriptions.ts"],"sourcesContent":["import { NovuError, TopicSubscription } from '@notiflyio/js';\r\nimport { useCallback, useEffect, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\n/**\r\n * Get all subscriptions for a topic.\r\n * Props for the useSubscriptions hook.\r\n *\r\n * @example\r\n * ```tsx\r\n * // Get all subscriptions for a topic\r\n * const { subscriptions } = useSubscriptions({\r\n * topicKey: 'my-topic'\r\n * });\r\n *\r\n * // Get subscriptions with callbacks\r\n * const { subscriptions, refetch } = useSubscriptions({\r\n * topicKey: 'my-topic',\r\n * onSuccess: (data) => console.log('Loaded:', data),\r\n * onError: (error) => console.error('Error:', error)\r\n * });\r\n * ```\r\n */\r\nexport type UseSubscriptionsProps = {\r\n topicKey: string;\r\n onSuccess?: (data: TopicSubscription[]) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\nexport type UseSubscriptionsResult = {\r\n subscriptions?: TopicSubscription[];\r\n error?: NovuError;\r\n isLoading: boolean;\r\n isFetching: boolean;\r\n refetch: () => Promise<void>;\r\n};\r\n\r\nexport const useSubscriptions = ({ topicKey, onSuccess, onError }: UseSubscriptionsProps): UseSubscriptionsResult => {\r\n const novu = useNovu();\r\n const [data, setData] = useState<TopicSubscription[]>();\r\n const [error, setError] = useState<NovuError>();\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [isFetching, setIsFetching] = useState(false);\r\n\r\n const fetchSubscriptions = useCallback(\r\n async (options?: { refetch: boolean }) => {\r\n if (options?.refetch) {\r\n setError(undefined);\r\n setIsLoading(true);\r\n novu.subscriptions.cache.invalidate({ topicKey });\r\n }\r\n setIsFetching(true);\r\n\r\n const response = await novu.subscriptions.list({ topicKey }, { refetch: options?.refetch });\r\n\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n } else if (response.data) {\r\n onSuccess?.(response.data);\r\n setData(response.data);\r\n }\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n },\r\n [novu, topicKey, onError, onSuccess]\r\n );\r\n\r\n useEffect(() => {\r\n const cleanupListPending = novu.on('subscriptions.list.pending', ({ args }) => {\r\n if (args.topicKey !== topicKey) {\r\n return;\r\n }\r\n setIsFetching(true);\r\n });\r\n\r\n const cleanupListResolved = novu.on('subscriptions.list.resolved', ({ args, data, error }) => {\r\n if (args.topicKey !== topicKey) {\r\n return;\r\n }\r\n if (error) {\r\n setError(error as NovuError);\r\n onError?.(error as NovuError);\r\n } else if (data) {\r\n onSuccess?.(data);\r\n setData(data);\r\n }\r\n setIsLoading(false);\r\n setIsFetching(false);\r\n });\r\n\r\n const cleanupListUpdated = novu.on('subscriptions.list.updated', ({ data }) => {\r\n if (data.topicKey !== topicKey) {\r\n return;\r\n }\r\n setData(data.subscriptions);\r\n });\r\n\r\n const cleanupCreateResolved = novu.on('subscription.create.resolved', ({ args, data }) => {\r\n if (args.topicKey !== topicKey) {\r\n return;\r\n }\r\n if (data) {\r\n void fetchSubscriptions({ refetch: true });\r\n }\r\n });\r\n\r\n const cleanupDeleteResolved = novu.on('subscription.delete.resolved', ({ args }) => {\r\n const deleteTopicKey = 'subscription' in args ? args.subscription.topicKey : topicKey;\r\n if (deleteTopicKey !== topicKey) {\r\n return;\r\n }\r\n void fetchSubscriptions({ refetch: true });\r\n });\r\n\r\n void fetchSubscriptions({ refetch: true });\r\n\r\n return () => {\r\n cleanupListPending();\r\n cleanupListResolved();\r\n cleanupListUpdated();\r\n cleanupCreateResolved();\r\n cleanupDeleteResolved();\r\n };\r\n }, [topicKey, novu, fetchSubscriptions, onError, onSuccess]);\r\n\r\n const refetch = useCallback(() => {\r\n return fetchSubscriptions({ refetch: true });\r\n }, [fetchSubscriptions]);\r\n\r\n return {\r\n subscriptions: data,\r\n error,\r\n isLoading,\r\n isFetching,\r\n refetch,\r\n };\r\n};\r\n"],"mappings":";AACA,SAAS,aAAa,WAAW,gBAAgB;AACjD,SAAS,eAAe;AAmCjB,IAAM,mBAAmB,CAAC,EAAE,UAAU,WAAW,QAAQ,MAAqD;AACnH,QAAM,OAAO,QAAQ;AACrB,QAAM,CAAC,MAAM,OAAO,IAAI,SAA8B;AACtD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,qBAAqB;AAAA,IACzB,OAAO,YAAmC;AACxC,UAAI,SAAS,SAAS;AACpB,iBAAS,MAAS;AAClB,qBAAa,IAAI;AACjB,aAAK,cAAc,MAAM,WAAW,EAAE,SAAS,CAAC;AAAA,MAClD;AACA,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,KAAK,EAAE,SAAS,GAAG,EAAE,S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AK,MAAM;AAClF,YAAM,iBAAiB,kBAAkB,OAAO,KAAK,aAAa,WAAW;AAC7E,UAAI,mBAAmB,UAAU;AAC/B;AAAA,MACF;AACA,WAAK,mBAAmB,EAAE,SAAS,KAAK,CAAC;AAAA,IAC3C,CAAC;AAED,SAAK,mBAAmB,EAAE,SAAS,KAAK,CAAC;AAEzC,WAAO,MAAM;AACX,yBAAmB;AACnB,0BAAoB;AACpB,yBAAmB;AACnB,4BAAsB;AACtB,4BAAsB;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,UAAU,MAAM,oBAAoB,SAAS,SAAS,CAAC;AAE3D,QAAM,UAAU,YAAY,MAAM;AAChC,WAAO,mBAAmB,EAAE,SAAS,KAAK,CAAC;AAAA,EAC7C,GAAG,CAAC,kBAAkB,CAAC;AAEvB,SAAO;AAAA,IACL,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["data","error"]} | ||
| {"version":3,"sources":["../../../src/hooks/useSubscriptions.ts"],"sourcesContent":["import { NovuError, TopicSubscription } from '@notiflyio/js';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\n/**\n * Get all subscriptions for a topic.\n * Props for the useSubscriptions hook.\n *\n * @example\n * ```tsx\n * // Get all subscriptions for a topic\n * const { subscriptions } = useSubscriptions({\n * topicKey: 'my-topic'\n * });\n *\n * // Get subscriptions with callbacks\n * const { subscriptions, refetch } = useSubscriptions({\n * topicKey: 'my-topic',\n * onSuccess: (data) => console.log('Loaded:', data),\n * onError: (error) => console.error('Error:', error)\n * });\n * ```\n */\nexport type UseSubscriptionsProps = {\n topicKey: string;\n onSuccess?: (data: TopicSubscription[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseSubscriptionsResult = {\n subscriptions?: TopicSubscription[];\n error?: NovuError;\n isLoading: boolean;\n isFetching: boolean;\n refetch: () => Promise<void>;\n};\n\nexport const useSubscriptions = ({ topicKey, onSuccess, onError }: UseSubscriptionsProps): UseSubscriptionsResult => {\n const novu = useNovu();\n const [data, setData] = useState<TopicSubscription[]>();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const fetchSubscriptions = useCallback(\n async (options?: { refetch: boolean }) => {\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n novu.subscriptions.cache.invalidate({ topicKey });\n }\n setIsFetching(true);\n\n const response = await novu.subscriptions.list({ topicKey }, { refetch: options?.refetch });\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data) {\n onSuccess?.(response.data);\n setData(response.data);\n }\n setIsLoading(false);\n setIsFetching(false);\n },\n [novu, topicKey, onError, onSuccess]\n );\n\n useEffect(() => {\n const cleanupListPending = novu.on('subscriptions.list.pending', ({ args }) => {\n if (args.topicKey !== topicKey) {\n return;\n }\n setIsFetching(true);\n });\n\n const cleanupListResolved = novu.on('subscriptions.list.resolved', ({ args, data, error }) => {\n if (args.topicKey !== topicKey) {\n return;\n }\n if (error) {\n setError(error as NovuError);\n onError?.(error as NovuError);\n } else if (data) {\n onSuccess?.(data);\n setData(data);\n }\n setIsLoading(false);\n setIsFetching(false);\n });\n\n const cleanupListUpdated = novu.on('subscriptions.list.updated', ({ data }) => {\n if (data.topicKey !== topicKey) {\n return;\n }\n setData(data.subscriptions);\n });\n\n const cleanupCreateResolved = novu.on('subscription.create.resolved', ({ args, data }) => {\n if (args.topicKey !== topicKey) {\n return;\n }\n if (data) {\n void fetchSubscriptions({ refetch: true });\n }\n });\n\n const cleanupDeleteResolved = novu.on('subscription.delete.resolved', ({ args }) => {\n const deleteTopicKey = 'subscription' in args ? args.subscription.topicKey : topicKey;\n if (deleteTopicKey !== topicKey) {\n return;\n }\n void fetchSubscriptions({ refetch: true });\n });\n\n void fetchSubscriptions({ refetch: true });\n\n return () => {\n cleanupListPending();\n cleanupListResolved();\n cleanupListUpdated();\n cleanupCreateResolved();\n cleanupDeleteResolved();\n };\n }, [topicKey, novu, fetchSubscriptions, onError, onSuccess]);\n\n const refetch = useCallback(() => {\n return fetchSubscriptions({ refetch: true });\n }, [fetchSubscriptions]);\n\n return {\n subscriptions: data,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n"],"mappings":";AACA,SAAS,aAAa,WAAW,gBAAgB;AACjD,SAAS,eAAe;AAmCjB,IAAM,mBAAmB,CAAC,EAAE,UAAU,WAAW,QAAQ,MAAqD;AACnH,QAAM,OAAO,QAAQ;AACrB,QAAM,CAAC,MAAM,OAAO,IAAI,SAA8B;AACtD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,qBAAqB;AAAA,IACzB,OAAO,YAAmC;AACxC,UAAI,SAAS,SAAS;AACpB,iBAAS,MAAS;AAClB,qBAAa,IAAI;AACjB,aAAK,cAAc,MAAM,WAAW,EAAE,SAAS,CAAC;AAAA,MAClD;AACA,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,KAAK,EAAE,SAAS,GAAG,EAAE,SAAS,SAAS,QAAQ,CAAC;AAE1F,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,kBAAU,SAAS,KAAK;AAAA,MAC1B,WAAW,SAAS,MAAM;AACxB,oBAAY,SAAS,IAAI;AACzB,gBAAQ,SAAS,IAAI;AAAA,MACvB;AACA,mBAAa,KAAK;AAClB,oBAAc,KAAK;AAAA,IACrB;AAAA,IACA,CAAC,MAAM,UAAU,SAAS,SAAS;AAAA,EACrC;AAEA,YAAU,MAAM;AACd,UAAM,qBAAqB,KAAK,GAAG,8BAA8B,CAAC,EAAE,KAAK,MAAM;AAC7E,UAAI,KAAK,aAAa,UAAU;AAC9B;AAAA,MACF;AACA,oBAAc,IAAI;AAAA,IACpB,CAAC;AAED,UAAM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AAC,kBAAkB,CAAC;AAEvB,SAAO;AAAA,IACL,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["data","error"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useTelegramSubscriberLink.ts"],"sourcesContent":["import type {\r\n TelegramSubscriberLinkOptions,\r\n TelegramSubscriberLinkState,\r\n TelegramSubscriberLinkStatus,\r\n} from '@notiflyio/js';\r\nimport { TelegramSubscriberLink } from '@notiflyio/js';\r\nimport { useCallback, useEffect, useRef, useState } from 'react';\r\n\r\nexport type UseTelegramSubscriberLinkProps = TelegramSubscriberLinkOptions;\r\n\r\nexport type UseTelegramSubscriberLinkResult = {\r\n /** Current deep-link URL (`t.me/<bot>?start=<code>`), or `null` before the first issue. */\r\n deepLinkUrl: string | null;\r\n /** Telegram bot username (no `@`), or `null` before the first issue. */\r\n botUsername: string | null;\r\n /** Lifecycle status: `loading` while resolving initial state, `pending` while waiting for Start, `connected` once linked, `expired` briefly before auto-reissue. */\r\n status: TelegramSubscriberLinkStatus;\r\n /** Last error, if any. */\r\n error: Error | null;\r\n /** Re-issue a fresh deep link and restart polling. */\r\n refresh: () => Promise<void>;\r\n};\r\n\r\n/**\r\n * React hook wrapping {@link TelegramSubscriberLink} from `@notiflyio/js`.\r\n *\r\n * Issues a Telegram subscriber-link deep link, polls for connection, and\r\n * re-issues automatically on code expiry. Returns reactive state that\r\n * updates as the lifecycle progresses.\r\n *\r\n * **Important:** The underlying API endpoint requires `INTEGRATION_WRITE` permission.\r\n * Either pass `secretKey` for direct server-side usage, or provide a custom\r\n * `fetchFn` / `apiUrl` that routes through your backend proxy.\r\n *\r\n * @example\r\n * ```tsx\r\n * import { useTelegramSubscriberLink } from '@notiflyio/react';\r\n *\r\n * function TelegramConnect() {\r\n * const { deepLinkUrl, botUsername, status, refresh } = useTelegramSubscriberLink({\r\n * apiUrl: '/api/novu-proxy',\r\n * integrationIdentifier: '<telegram-integration-identifier>',\r\n * subscriberId: 'user-42',\r\n * });\r\n *\r\n * if (status === 'connected') return <p>Connected!</p>;\r\n *\r\n * return (\r\n * <div>\r\n * {deepLinkUrl && <a href={deepLinkUrl}>Open @{botUsername} in Telegram</a>}\r\n * <button onClick={refresh}>Refresh link</button>\r\n * </div>\r\n * );\r\n * }\r\n * ```\r\n */\r\nexport function useTelegramSubscriberLink(props: UseTelegramSubscriberLinkProps): UseTelegramSubscriberLinkResult {\r\n const [state, setState] = useState<TelegramSubscriberLinkState>({\r\n status: 'loading',\r\n deepLinkUrl: null,\r\n botUsername: null,\r\n expiresAt: null,\r\n error: null,\r\n });\r\n\r\n const instanceRef = useRef<TelegramSubscriberLink | null>(null);\r\n\r\n const { apiUrl, secretKey, integrationIdentifier, subscriberId, pollIntervalMs, fetchFn } = props;\r\n\r\n // Keep the latest `fetchFn` in a ref so a new inline-function identity on every\r\n // render does not re-trigger the effect (which would tear down and re-issue the\r\n // link on a loop). The stable wrapper below reads from this ref.\r\n const fetchFnRef = useRef(fetchFn);\r\n fetchFnRef.current = fetchFn;\r\n\r\n const stableFetchFn = useCallback<typeof fetch>((input, init) => {\r\n const fn = fetchFnRef.current ?? fetch;\r\n\r\n return fn(input, init);\r\n }, []);\r\n\r\n useEffect(() => {\r\n const link = new TelegramSubscriberLink({\r\n apiUrl,\r\n secretKey,\r\n integrationIdentifier,\r\n subscriberId,\r\n pollIntervalMs,\r\n fetchFn: stableFetchFn,\r\n });\r\n\r\n instanceRef.current = link;\r\n setState({ ...link.state });\r\n\r\n const unsubscribe = link.onStateChange((next) => {\r\n setState({ ...next });\r\n });\r\n\r\n void link.start();\r\n\r\n return () => {\r\n unsubscribe();\r\n link.stop();\r\n instanceRef.current = null;\r\n };\r\n }, [apiUrl, secretKey, integrationIdentifier, subscriberId, pollIntervalMs, stableFetchFn]);\r\n\r\n const refresh = useCallback(async () => {\r\n if (instanceRef.current) {\r\n await instanceRef.current.refresh();\r\n }\r\n }, []);\r\n\r\n return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C;AAEL,SAAO;AAAA,IACL,aAAa,MAAM;AAAA,IACnB,aAAa,MAAM;AAAA,IACnB,QAAQ,MAAM;AAAA,IACd,OAAO,MAAM;AAAA,IACb;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useTelegramSubscriberLink.ts"],"sourcesContent":["import type {\n TelegramSubscriberLinkOptions,\n TelegramSubscriberLinkState,\n TelegramSubscriberLinkStatus,\n} from '@notiflyio/js';\nimport { TelegramSubscriberLink } from '@notiflyio/js';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nexport type UseTelegramSubscriberLinkProps = TelegramSubscriberLinkOptions;\n\nexport type UseTelegramSubscriberLinkResult = {\n /** Current deep-link URL (`t.me/<bot>?start=<code>`), or `null` before the first issue. */\n deepLinkUrl: string | null;\n /** Telegram bot username (no `@`), or `null` before the first issue. */\n botUsername: string | null;\n /** Lifecycle status: `loading` while resolving initial state, `pending` while waiting for Start, `connected` once linked, `expired` briefly before auto-reissue. */\n status: TelegramSubscriberLinkStatus;\n /** Last error, if any. */\n error: Error | null;\n /** Re-issue a fresh deep link and restart polling. */\n refresh: () => Promise<void>;\n};\n\n/**\n * React hook wrapping {@link TelegramSubscriberLink} from `@notiflyio/js`.\n *\n * Issues a Telegram subscriber-link deep link, polls for connection, and\n * re-issues automatically on code expiry. Returns reactive state that\n * updates as the lifecycle progresses.\n *\n * **Important:** The underlying API endpoint requires `INTEGRATION_WRITE` permission.\n * Either pass `secretKey` for direct server-side usage, or provide a custom\n * `fetchFn` / `apiUrl` that routes through your backend proxy.\n *\n * @example\n * ```tsx\n * import { useTelegramSubscriberLink } from '@notiflyio/react';\n *\n * function TelegramConnect() {\n * const { deepLinkUrl, botUsername, status, refresh } = useTelegramSubscriberLink({\n * apiUrl: '/api/novu-proxy',\n * integrationIdentifier: '<telegram-integration-identifier>',\n * subscriberId: 'user-42',\n * });\n *\n * if (status === 'connected') return <p>Connected!</p>;\n *\n * return (\n * <div>\n * {deepLinkUrl && <a href={deepLinkUrl}>Open @{botUsername} in Telegram</a>}\n * <button onClick={refresh}>Refresh link</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useTelegramSubscriberLink(props: UseTelegramSubscriberLinkProps): UseTelegramSubscriberLinkResult {\n const [state, setState] = useState<TelegramSubscriberLinkState>({\n status: 'loading',\n deepLinkUrl: null,\n botUsername: null,\n expiresAt: null,\n error: null,\n });\n\n const instanceRef = useRef<TelegramSubscriberLink | null>(null);\n\n const { apiUrl, secretKey, integrationIdentifier, subscriberId, pollIntervalMs, fetchFn } = props;\n\n // Keep the latest `fetchFn` in a ref so a new inline-function identity on every\n // render does not re-trigger the effect (which would tear down and re-issue the\n // link on a loop). The stable wrapper below reads from this ref.\n const fetchFnRef = useRef(fetchFn);\n fetchFnRef.current = fetchFn;\n\n const stableFetchFn = useCallback<typeof fetch>((input, init) => {\n const fn = fetchFnRef.current ?? fetch;\n\n return fn(input, init);\n }, []);\n\n useEffect(() => {\n const link = new TelegramSubscriberLink({\n apiUrl,\n secretKey,\n integrationIdentifier,\n subscriberId,\n pollIntervalMs,\n fetchFn: stableFetchFn,\n });\n\n instanceRef.current = link;\n setState({ ...link.state });\n\n const unsubscribe = link.onStateChange((next) => {\n setState({ ...next });\n });\n\n void link.start();\n\n return () => {\n unsubscribe();\n link.stop();\n instanceRef.current = null;\n };\n }, [apiUrl, secretKey, integrationIdentifier, subscriberId, pollIntervalMs, stableFetchFn]);\n\n const refresh = useCallback(async () => {\n if (instanceRef.current) {\n await instanceRef.current.refresh();\n }\n }, []);\n\n return {\n deepLinkUrl: state.deepLinkUrl,\n botUsername: state.botUsername,\n status: state.status,\n error: state.error,\n refresh,\n };\n}\n"],"mappings":";AAKA,SAAS,8BAA8B;AACvC,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AAkDlD,SAAS,0BAA0B,OAAwE;AAChH,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAsC;AAAA,IAC9D,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,aAAa;AAAA,IACb,WAAW;AAAA,IACX,OAAO;AAAA,EACT,CAAC;AAED,QAAM,cAAc,OAAsC,IAAI;AAE9D,QAAM,EAAE,QAAQ,WAAW,uBAAuB,cAAc,gBAAgB,QAAQ,IAAI;AAK5F,QAAM,aAAa,OAAO,OAAO;AACjC,aAAW,UAAU;AAErB,QAAM,gBAAgB,YAA0B,CAAC,OAAO,SAAS;AAC/D,UAAM,KAAK,WAAW,WAAW;AAEjC,WAAO,GAAG,OAAO,IAAI;AAAA,EACvB,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,UAAM,OAAO,IAAI,uBAAuB;AAAA,MACtC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS;AAAA,IACX,CAAC;AAED,gBAAY,UAAU;AACtB,aAAS,EAAE,GAAG,KAAK,MAAM,CAAC;AAE1B,UAAM,cAAc,KAAK,cAAc,CAAC,SAAS;AAC/C,eAAS,EAAE,GAAG,KAAK,CAAC;AAAA,IACtB,CAAC;AAED,SAAK,KAAK,MAAM;AAEhB,WAAO,MAAM;AACX,kBAAY;AACZ,WAAK,KAAK;AACV,kBAAY,UAAU;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,QAAQ,WAAW,uBAAuB,cAAc,gBAAgB,aAAa,CAAC;AAE1F,QAAM,UAAU,YAAY,YAAY;AACtC,QAAI,YAAY,SAAS;AACvB,YAAM,YAAY,QAAQ,QAAQ;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO;AAAA,IACL,aAAa,MAAM;AAAA,IACnB,aAAa,MAAM;AAAA,IACnB,QAAQ,MAAM;AAAA,IACd,OAAO,MAAM;AAAA,IACb;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/hooks/useUpdateSubscription.ts"],"sourcesContent":["import { BaseUpdateSubscriptionArgs, NovuError, TopicSubscription, UpdateSubscriptionArgs } from '@notiflyio/js';\r\nimport { useCallback, useRef, useState } from 'react';\r\nimport { useNovu } from './NovuProvider';\r\n\r\nexport type UseUpdateSubscriptionProps = {\r\n onSuccess?: (data: TopicSubscription) => void;\r\n onError?: (error: NovuError) => void;\r\n};\r\n\r\ntype UpdateResult = Promise<{\r\n data?: TopicSubscription | undefined;\r\n error?: NovuError;\r\n}>;\r\n\r\nexport type UseUpdateSubscriptionResult = {\r\n isUpdating: boolean;\r\n error?: NovuError;\r\n update: (args: UpdateSubscriptionArgs) => UpdateResult;\r\n};\r\n\r\nexport const useUpdateSubscription = (props: UseUpdateSubscriptionProps = {}): UseUpdateSubscriptionResult => {\r\n const propsRef = useRef<UseUpdateSubscriptionProps>(props);\r\n propsRef.current = props;\r\n const novu = useNovu();\r\n const [isUpdating, setIsUpdating] = useState(false);\r\n const [error, setError] = useState<NovuError>();\r\n\r\n const update = useCallback(\r\n async (args: UpdateSubscriptionArgs): UpdateResult => {\r\n const { onSuccess, onError } = propsRef.current;\r\n setError(undefined);\r\n setIsUpdating(true);\r\n\r\n const response = await novu.subscriptions.update(args as BaseUpdateSubscriptionArgs);\r\n\r\n setIsUpdating(false);\r\n\r\n if (response.error) {\r\n setError(response.error);\r\n onError?.(response.error);\r\n } else if (response.data) {\r\n onSuccess?.(response.data);\r\n }\r\n\r\n return response;\r\n },\r\n [novu]\r\n );\r\n\r\n return {\r\n update,\r\n isUpdating,\r\n error,\r\n };\r\n};\r\n"],"mappings":";AACA,SAAS,aAAa,QAAQ,gBAAgB;AAC9C,SAAS,eAAe;AAkBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,WAAW,OAAmC,KAAK;AACzD,WAAS,UAAU;AACnB,QAAM,OAAO,QAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAE9C,QAAM,SAAS;AAAA,IACb,OAAO,SAA+C;AACpD,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,OAAO,IAAkC;AAEnF,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,kBAAU,SAAS,KAAK;AAAA,MAC1B,WAAW,SAAS,MAAM;AACxB,oBAAY,SAAS,IAAI;AAAA,MAC3B;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/hooks/useUpdateSubscription.ts"],"sourcesContent":["import { BaseUpdateSubscriptionArgs, NovuError, TopicSubscription, UpdateSubscriptionArgs } from '@notiflyio/js';\nimport { useCallback, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseUpdateSubscriptionProps = {\n onSuccess?: (data: TopicSubscription) => void;\n onError?: (error: NovuError) => void;\n};\n\ntype UpdateResult = Promise<{\n data?: TopicSubscription | undefined;\n error?: NovuError;\n}>;\n\nexport type UseUpdateSubscriptionResult = {\n isUpdating: boolean;\n error?: NovuError;\n update: (args: UpdateSubscriptionArgs) => UpdateResult;\n};\n\nexport const useUpdateSubscription = (props: UseUpdateSubscriptionProps = {}): UseUpdateSubscriptionResult => {\n const propsRef = useRef<UseUpdateSubscriptionProps>(props);\n propsRef.current = props;\n const novu = useNovu();\n const [isUpdating, setIsUpdating] = useState(false);\n const [error, setError] = useState<NovuError>();\n\n const update = useCallback(\n async (args: UpdateSubscriptionArgs): UpdateResult => {\n const { onSuccess, onError } = propsRef.current;\n setError(undefined);\n setIsUpdating(true);\n\n const response = await novu.subscriptions.update(args as BaseUpdateSubscriptionArgs);\n\n setIsUpdating(false);\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data) {\n onSuccess?.(response.data);\n }\n\n return response;\n },\n [novu]\n );\n\n return {\n update,\n isUpdating,\n error,\n };\n};\n"],"mappings":";AACA,SAAS,aAAa,QAAQ,gBAAgB;AAC9C,SAAS,eAAe;AAkBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,WAAW,OAAmC,KAAK;AACzD,WAAS,UAAU;AACnB,QAAM,OAAO,QAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAE9C,QAAM,SAAS;AAAA,IACb,OAAO,SAA+C;AACpD,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,OAAO,IAAkC;AAEnF,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,kBAAU,SAAS,KAAK;AAAA,MAC1B,WAAW,SAAS,MAAM;AACxB,oBAAY,SAAS,IAAI;AAAA,MAC3B;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type * from '@notiflyio/js';\r\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\r\n\r\nexport type {\r\n AllLocalization,\r\n AllLocalizationKey,\r\n ChannelConnectButtonIconKey,\r\n ElementStyles,\r\n InboxAppearance,\r\n InboxAppearanceCallback,\r\n InboxAppearanceCallbackFunction,\r\n InboxAppearanceCallbackKeys,\r\n InboxAppearanceKey,\r\n InboxElements,\r\n InboxLocalization,\r\n InboxLocalizationKey,\r\n InboxTheme,\r\n NotificationActionClickHandler,\r\n NotificationClickHandler,\r\n NotificationRenderer,\r\n PreferenceGroups,\r\n PreferencesFilter,\r\n RouterPush,\r\n SubscriptionAppearance,\r\n SubscriptionAppearanceCallback,\r\n SubscriptionAppearanceCallbackFunction,\r\n SubscriptionAppearanceCallbackKeys,\r\n SubscriptionAppearanceKey,\r\n SubscriptionElements,\r\n SubscriptionLocalization,\r\n SubscriptionLocalizationKey,\r\n SubscriptionTheme,\r\n Tab,\r\n Variables,\r\n} from '@notiflyio/js/ui';\r\nexport type {\r\n BellProps,\r\n InboxContentProps,\r\n InboxProps,\r\n MsTeamsConnectButtonProps,\r\n MsTeamsLinkUserProps,\r\n NotificationProps,\r\n NovuProviderProps,\r\n SlackConnectButtonProps,\r\n SlackLinkUserProps,\r\n SubscriptionButtonProps,\r\n SubscriptionPreferencesProps,\r\n SubscriptionProps,\r\n TelegramConnectButtonProps,\r\n} from './components';\r\nexport {\r\n Bell,\r\n Inbox,\r\n InboxContent,\r\n MsTeamsConnectButton,\r\n MsTeamsLinkUser,\r\n Notifications,\r\n NovuProvider,\r\n Preferences,\r\n SlackConnectButton,\r\n SlackLinkUser,\r\n Subscription,\r\n SubscriptionButton,\r\n SubscriptionPreferences,\r\n TelegramConnectButton,\r\n} from './components';\r\nexport type {\r\n UseChannelConnectionProps,\r\n UseChannelConnectionResult,\r\n UseChannelConnectionsProps,\r\n UseChannelConnectionsResult,\r\n UseChannelEndpointProps,\r\n UseChannelEndpointResult,\r\n UseCountsProps,\r\n UseCountsResult,\r\n UseCreateChannelEndpointProps,\r\n UseCreateChannelEndpointResult,\r\n UseDeleteChannelEndpointProps,\r\n UseDeleteChannelEndpointResult,\r\n UseNotificationsProps,\r\n UseNotificationsResult,\r\n UsePreferencesResult,\r\n UseScheduleProps as UsePreferencesProps,\r\n UseTelegramSubscriberLinkProps,\r\n UseTelegramSubscriberLinkResult,\r\n} from './hooks';\r\nexport {\r\n useChannelConnection,\r\n useChannelConnections,\r\n useChannelEndpoint,\r\n useCounts,\r\n useCreateChannelEndpoint,\r\n useCreateSubscription,\r\n useDeleteChannelEndpoint,\r\n useNotifications,\r\n useNovu,\r\n usePreferences,\r\n useRemoveSubscription,\r\n useSchedule,\r\n useSubscription,\r\n useSubscriptions,\r\n useTelegramSubscriberLink,\r\n useUpdateSubscription,\r\n} from './hooks';\r\n\r\nexport type {\r\n BaseProps,\r\n BellRenderer,\r\n BodyRenderer,\r\n DefaultInboxProps,\r\n DefaultProps,\r\n NoRendererProps,\r\n NotificationRendererProps,\r\n NotificationsRenderer,\r\n ReactAllAppearance,\r\n ReactInboxAppearance,\r\n ReactInboxTheme,\r\n ReactSubscriptionAppearance,\r\n ReactSubscriptionTheme,\r\n SubjectBodyRendererProps,\r\n SubjectRenderer,\r\n WithChildrenProps,\r\n} from './utils/types';\r\n"],"mappings":";AACA,SAAS,iBAAiB,mBAAmB,+BAA+B;AAiD5E;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAqBP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]} | ||
| {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type * from '@notiflyio/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\n\nexport type {\n AllLocalization,\n AllLocalizationKey,\n ChannelConnectButtonIconKey,\n ElementStyles,\n InboxAppearance,\n InboxAppearanceCallback,\n InboxAppearanceCallbackFunction,\n InboxAppearanceCallbackKeys,\n InboxAppearanceKey,\n InboxElements,\n InboxLocalization,\n InboxLocalizationKey,\n InboxTheme,\n NotificationActionClickHandler,\n NotificationClickHandler,\n NotificationRenderer,\n PreferenceGroups,\n PreferencesFilter,\n RouterPush,\n SubscriptionAppearance,\n SubscriptionAppearanceCallback,\n SubscriptionAppearanceCallbackFunction,\n SubscriptionAppearanceCallbackKeys,\n SubscriptionAppearanceKey,\n SubscriptionElements,\n SubscriptionLocalization,\n SubscriptionLocalizationKey,\n SubscriptionTheme,\n Tab,\n Variables,\n} from '@notiflyio/js/ui';\nexport type {\n BellProps,\n InboxContentProps,\n InboxProps,\n MsTeamsConnectButtonProps,\n MsTeamsLinkUserProps,\n NotificationProps,\n NovuProviderProps,\n SlackConnectButtonProps,\n SlackLinkUserProps,\n SubscriptionButtonProps,\n SubscriptionPreferencesProps,\n SubscriptionProps,\n TelegramConnectButtonProps,\n} from './components';\nexport {\n Bell,\n Inbox,\n InboxContent,\n MsTeamsConnectButton,\n MsTeamsLinkUser,\n Notifications,\n NovuProvider,\n Preferences,\n SlackConnectButton,\n SlackLinkUser,\n Subscription,\n SubscriptionButton,\n SubscriptionPreferences,\n TelegramConnectButton,\n} from './components';\nexport type {\n UseChannelConnectionProps,\n UseChannelConnectionResult,\n UseChannelConnectionsProps,\n UseChannelConnectionsResult,\n UseChannelEndpointProps,\n UseChannelEndpointResult,\n UseCountsProps,\n UseCountsResult,\n UseCreateChannelEndpointProps,\n UseCreateChannelEndpointResult,\n UseDeleteChannelEndpointProps,\n UseDeleteChannelEndpointResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesResult,\n UseScheduleProps as UsePreferencesProps,\n UseTelegramSubscriberLinkProps,\n UseTelegramSubscriberLinkResult,\n} from './hooks';\nexport {\n useChannelConnection,\n useChannelConnections,\n useChannelEndpoint,\n useCounts,\n useCreateChannelEndpoint,\n useCreateSubscription,\n useDeleteChannelEndpoint,\n useNotifications,\n useNovu,\n usePreferences,\n useRemoveSubscription,\n useSchedule,\n useSubscription,\n useSubscriptions,\n useTelegramSubscriberLink,\n useUpdateSubscription,\n} from './hooks';\n\nexport type {\n BaseProps,\n BellRenderer,\n BodyRenderer,\n DefaultInboxProps,\n DefaultProps,\n NoRendererProps,\n NotificationRendererProps,\n NotificationsRenderer,\n ReactAllAppearance,\n ReactInboxAppearance,\n ReactInboxTheme,\n ReactSubscriptionAppearance,\n ReactSubscriptionTheme,\n SubjectBodyRendererProps,\n SubjectRenderer,\n WithChildrenProps,\n} from './utils/types';\n"],"mappings":";AACA,SAAS,iBAAiB,mBAAmB,+BAA+B;AAiD5E;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAqBP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]} |
| export { buildSubscriber } from '@notiflyio/js/internal'; | ||
| import '@notiflyio/js/themes'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/internal/index.ts"],"sourcesContent":["export { buildSubscriber } from '@notiflyio/js/internal';\r\n"],"mappings":";AAAA,SAAS,uBAAuB;","names":[]} | ||
| {"version":3,"sources":["../../../src/internal/index.ts"],"sourcesContent":["export { buildSubscriber } from '@notiflyio/js/internal';\n"],"mappings":";AAAA,SAAS,uBAAuB;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/server/index.tsx"],"sourcesContent":["import type { InboxProps } from '../components/Inbox';\r\nimport { ShadowRootDetector } from '../components/ShadowRootDetector';\r\nimport type {\r\n UseCreateSubscriptionProps,\r\n UseCreateSubscriptionResult,\r\n UseNotificationsProps,\r\n UseNotificationsResult,\r\n UsePreferencesProps,\r\n UsePreferencesResult,\r\n UseRemoveSubscriptionProps,\r\n UseRemoveSubscriptionResult,\r\n UseScheduleProps,\r\n UseScheduleResult,\r\n UseSubscriptionProps,\r\n UseSubscriptionResult,\r\n UseSubscriptionsProps,\r\n UseSubscriptionsResult,\r\n UseUpdateSubscriptionProps,\r\n UseUpdateSubscriptionResult,\r\n} from '../hooks';\r\nimport type { NovuProviderProps } from '../hooks/NovuProvider';\r\nimport type { UseCountsProps, UseCountsResult } from '../hooks/useCounts';\r\n\r\n/**\r\n * Exporting all components from the components folder\r\n * as empty functions to fix build errors in SSR\r\n * This will be replaced with actual components\r\n * when we implement the SSR components in @notiflyio/js/ui\r\n */\r\nexport function Inbox(props: InboxProps) {\r\n return <ShadowRootDetector />;\r\n}\r\n\r\nexport function InboxContent() {}\r\n\r\nexport function Notifications() {}\r\n\r\nexport function Preferences() {}\r\n\r\nexport function Bell() {}\r\n\r\nexport function NovuProvider(props: NovuProviderProps) {\r\n return <>{props.children}</>;\r\n}\r\n\r\nexport function Subscription() {\r\n return <ShadowRootDetector />;\r\n}\r\n\r\nexport function SubscriptionButton() {}\r\n\r\nexport function SubscriptionPreferences() {}\r\n\r\nexport function SlackConnectButton() {\r\n return <ShadowRootDetector />;\r\n}\r\n\r\nexport function SlackLinkUser() {\r\n return <ShadowRootDetector />;\r\n}\r\n\r\nexport function MsTeamsConnectButton() {\r\n return <ShadowRootDetector />;\r\n}\r\n\r\nexport function MsTeamsLinkUser() {\r\n return <ShadowRootDetector />;\r\n}\r\n\r\nexport function TelegramConnectButton() {\r\n return <ShadowRootDetector />;\r\n}\r\n\r\nexport function useNovu() {\r\n return null;\r\n}\r\n\r\nexport function useCounts(_: UseCountsProps): UseCountsResult {\r\n return {\r\n isLoading: false,\r\n isFetching: false,\r\n refetch: () => Promise.resolve(),\r\n };\r\n}\r\n\r\nexport function useNotifications(_: UseNotificationsProps): UseNotificationsResult {\r\n return {\r\n isLoading: false,\r\n isFetching: false,\r\n hasMore: false,\r\n readAll: () => Promise.resolve({ data: undefined, error: undefined }),\r\n seenAll: () => Promise.resolve({ data: undefined, error: undefined }),\r\n archiveAll: () => Promise.resolve({ data: undefined, error: undefined }),\r\n archiveAllRead: () => Promise.resolve({ data: undefined, error: undefined }),\r\n refetch: () => Promise.resolve(),\r\n fetchMore: () => Promise.resolve(),\r\n };\r\n}\r\n\r\nexport function usePreferences(_: UsePreferencesProps): UsePreferencesResult {\r\n return {\r\n isLoading: false,\r\n isFetching: false,\r\n refetch: () => Promise.resolve(),\r\n };\r\n}\r\n\r\nexport function useSchedule(_: UseScheduleProps): UseScheduleResult {\r\n return {\r\n isLoading: false,\r\n isFetching: false,\r\n refetch: () => Promise.resolve(),\r\n };\r\n}\r\n\r\nexport function useSubscription(_: UseSubscriptionProps): UseSubscriptionResult {\r\n return {\r\n isLoading: false,\r\n isFetching: false,\r\n refetch: () => Promise.resolve(),\r\n };\r\n}\r\n\r\nexport function useCreateSubscription(_: UseCreateSubscriptionProps = {}): UseCreateSubscriptionResult {\r\n return {\r\n isCreating: false,\r\n error: undefined,\r\n create: () => Promise.resolve({ data: undefined, error: undefined }),\r\n };\r\n}\r\n\r\nexport function useUpdateSubscription(_: UseUpdateSubscriptionProps = {}): UseUpdateSubscriptionResult {\r\n return {\r\n isUpdating: false,\r\n error: undefined,\r\n update: () => Promise.resolve({ data: undefined, error: undefined }),\r\n };\r\n}\r\n\r\nexport function useRemoveSubscription(_: UseRemoveSubscriptionProps = {}): UseRemoveSubscriptionResult {\r\n return {\r\n isRemoving: false,\r\n error: undefined,\r\n remove: () => Promise.resolve({ data: undefined, error: undefined }),\r\n };\r\n}\r\n\r\nexport function useSubscriptions(_: UseSubscriptionsProps): UseSubscriptionsResult {\r\n return {\r\n isLoading: false,\r\n isFetching: false,\r\n refetch: () => Promise.resolve(),\r\n };\r\n}\r\n\r\nexport type * from '@notiflyio/js';\r\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\r\n\r\nexport type {\r\n AllLocalization,\r\n AllLocalizationKey,\r\n ElementStyles,\r\n InboxAppearance,\r\n InboxAppearanceCallback,\r\n InboxAppearanceCallbackFunction,\r\n InboxAppearanceCallbackKeys,\r\n InboxAppearanceKey,\r\n InboxElements,\r\n InboxLocalization,\r\n InboxLocalizationKey,\r\n InboxTheme,\r\n NotificationActionClickHandler,\r\n NotificationClickHandler,\r\n NotificationRenderer,\r\n PreferenceGroups,\r\n PreferencesFilter,\r\n RouterPush,\r\n SubscriptionAppearance,\r\n SubscriptionAppearanceCallback,\r\n SubscriptionAppearanceCallbackFunction,\r\n SubscriptionAppearanceCallbackKeys,\r\n SubscriptionAppearanceKey,\r\n SubscriptionElements,\r\n SubscriptionLocalization,\r\n SubscriptionLocalizationKey,\r\n SubscriptionTheme,\r\n Tab,\r\n Variables,\r\n} from '@notiflyio/js/ui';\r\n\r\nexport type { BellProps, InboxContentProps, InboxProps, NotificationProps, NovuProviderProps } from '../components';\r\n\r\nexport type {\r\n UseCountsProps,\r\n UseCountsResult,\r\n UseNotificationsProps,\r\n UseNotificationsResult,\r\n UsePreferencesResult,\r\n UseScheduleProps as UsePreferencesProps,\r\n} from '../hooks';\r\n\r\nexport type {\r\n BaseProps,\r\n BellRenderer,\r\n BodyRenderer,\r\n DefaultInboxProps,\r\n DefaultProps,\r\n NoRendererProps,\r\n NotificationRendererProps,\r\n NotificationsRenderer,\r\n SubjectBodyRendererProps,\r\n SubjectRenderer,\r\n WithChildrenProps,\r\n} from '../utils/types';\r\n"],"mappings":";AACA,SAAS,0BAA0B;AA2JnC,SAAS,iBAAiB,mBAAmB,+BAA+B;AA9HnE,SAYA,UAZA;AADF,SAAS,MAAM,OAAmB;AACvC,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,eAAe;AAAC;AAEzB,SAAS,gBAAgB;AAAC;AAE1B,SAAS,cAAc;AAAC;AAExB,SAAS,OAAO;AAAC;AAEjB,SAAS,aAAa,OAA0B;AACrD,SAAO,gCAAG,gBAAM,UAAS;AAC3B;AAEO,SAAS,eAAe;AAC7B,SAAO,oBAAC,sBAAmB;AAC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jC;AACF;AAEO,SAAS,gBAAgB,GAAgD;AAC9E,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;AAEO,SAAS,sBAAsB,IAAgC,CAAC,GAAgC;AACrG,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,sBAAsB,IAAgC,CAAC,GAAgC;AACrG,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,sBAAsB,IAAgC,CAAC,GAAgC;AACrG,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,iBAAiB,GAAkD;AACjF,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/server/index.tsx"],"sourcesContent":["import type { InboxProps } from '../components/Inbox';\nimport { ShadowRootDetector } from '../components/ShadowRootDetector';\nimport type {\n UseCreateSubscriptionProps,\n UseCreateSubscriptionResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesProps,\n UsePreferencesResult,\n UseRemoveSubscriptionProps,\n UseRemoveSubscriptionResult,\n UseScheduleProps,\n UseScheduleResult,\n UseSubscriptionProps,\n UseSubscriptionResult,\n UseSubscriptionsProps,\n UseSubscriptionsResult,\n UseUpdateSubscriptionProps,\n UseUpdateSubscriptionResult,\n} from '../hooks';\nimport type { NovuProviderProps } from '../hooks/NovuProvider';\nimport type { UseCountsProps, UseCountsResult } from '../hooks/useCounts';\n\n/**\n * Exporting all components from the components folder\n * as empty functions to fix build errors in SSR\n * This will be replaced with actual components\n * when we implement the SSR components in @notiflyio/js/ui\n */\nexport function Inbox(props: InboxProps) {\n return <ShadowRootDetector />;\n}\n\nexport function InboxContent() {}\n\nexport function Notifications() {}\n\nexport function Preferences() {}\n\nexport function Bell() {}\n\nexport function NovuProvider(props: NovuProviderProps) {\n return <>{props.children}</>;\n}\n\nexport function Subscription() {\n return <ShadowRootDetector />;\n}\n\nexport function SubscriptionButton() {}\n\nexport function SubscriptionPreferences() {}\n\nexport function SlackConnectButton() {\n return <ShadowRootDetector />;\n}\n\nexport function SlackLinkUser() {\n return <ShadowRootDetector />;\n}\n\nexport function MsTeamsConnectButton() {\n return <ShadowRootDetector />;\n}\n\nexport function MsTeamsLinkUser() {\n return <ShadowRootDetector />;\n}\n\nexport function TelegramConnectButton() {\n return <ShadowRootDetector />;\n}\n\nexport function useNovu() {\n return null;\n}\n\nexport function useCounts(_: UseCountsProps): UseCountsResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useNotifications(_: UseNotificationsProps): UseNotificationsResult {\n return {\n isLoading: false,\n isFetching: false,\n hasMore: false,\n readAll: () => Promise.resolve({ data: undefined, error: undefined }),\n seenAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAllRead: () => Promise.resolve({ data: undefined, error: undefined }),\n refetch: () => Promise.resolve(),\n fetchMore: () => Promise.resolve(),\n };\n}\n\nexport function usePreferences(_: UsePreferencesProps): UsePreferencesResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useSchedule(_: UseScheduleProps): UseScheduleResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useSubscription(_: UseSubscriptionProps): UseSubscriptionResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useCreateSubscription(_: UseCreateSubscriptionProps = {}): UseCreateSubscriptionResult {\n return {\n isCreating: false,\n error: undefined,\n create: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useUpdateSubscription(_: UseUpdateSubscriptionProps = {}): UseUpdateSubscriptionResult {\n return {\n isUpdating: false,\n error: undefined,\n update: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useRemoveSubscription(_: UseRemoveSubscriptionProps = {}): UseRemoveSubscriptionResult {\n return {\n isRemoving: false,\n error: undefined,\n remove: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useSubscriptions(_: UseSubscriptionsProps): UseSubscriptionsResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport type * from '@notiflyio/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@notiflyio/js';\n\nexport type {\n AllLocalization,\n AllLocalizationKey,\n ElementStyles,\n InboxAppearance,\n InboxAppearanceCallback,\n InboxAppearanceCallbackFunction,\n InboxAppearanceCallbackKeys,\n InboxAppearanceKey,\n InboxElements,\n InboxLocalization,\n InboxLocalizationKey,\n InboxTheme,\n NotificationActionClickHandler,\n NotificationClickHandler,\n NotificationRenderer,\n PreferenceGroups,\n PreferencesFilter,\n RouterPush,\n SubscriptionAppearance,\n SubscriptionAppearanceCallback,\n SubscriptionAppearanceCallbackFunction,\n SubscriptionAppearanceCallbackKeys,\n SubscriptionAppearanceKey,\n SubscriptionElements,\n SubscriptionLocalization,\n SubscriptionLocalizationKey,\n SubscriptionTheme,\n Tab,\n Variables,\n} from '@notiflyio/js/ui';\n\nexport type { BellProps, InboxContentProps, InboxProps, NotificationProps, NovuProviderProps } from '../components';\n\nexport type {\n UseCountsProps,\n UseCountsResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesResult,\n UseScheduleProps as UsePreferencesProps,\n} from '../hooks';\n\nexport type {\n BaseProps,\n BellRenderer,\n BodyRenderer,\n DefaultInboxProps,\n DefaultProps,\n NoRendererProps,\n NotificationRendererProps,\n NotificationsRenderer,\n SubjectBodyRendererProps,\n SubjectRenderer,\n WithChildrenProps,\n} from '../utils/types';\n"],"mappings":";AACA,SAAS,0BAA0B;AA2JnC,SAAS,iBAAiB,mBAAmB,+BAA+B;AA9HnE,SAYA,UAZA;AADF,SAAS,MAAM,OAAmB;AACvC,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,eAAe;AAAC;AAEzB,SAAS,gBAAgB;AAAC;AAE1B,SAAS,cAAc;AAAC;AAExB,SAAS,OAAO;AAAC;AAEjB,SAAS,aAAa,OAA0B;AACrD,SAAO,gCAAG,gBAAM,UAAS;AAC3B;AAEO,SAAS,eAAe;AAC7B,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,qBAAqB;AAAC;AAE/B,SAAS,0BAA0B;AAAC;AAEpC,SAAS,qBAAqB;AACnC,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,gBAAgB;AAC9B,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,uBAAuB;AACrC,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,kBAAkB;AAChC,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,wBAAwB;AACtC,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,UAAU;AACxB,SAAO;AACT;AAEO,SAAS,UAAU,GAAoC;AAC5D,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;AAEO,SAAS,iBAAiB,GAAkD;AACjF,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,SAAS,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAA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AC;AAAA,EACrE;AACF;AAEO,SAAS,iBAAiB,GAAkD;AACjF,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;","names":[]} |
| export * from '@notiflyio/js/themes'; | ||
| import '@notiflyio/js/internal'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/themes/index.ts"],"sourcesContent":["export * from '@notiflyio/js/themes';\r\n"],"mappings":";AAAA,cAAc;","names":[]} | ||
| {"version":3,"sources":["../../../src/themes/index.ts"],"sourcesContent":["export * from '@notiflyio/js/themes';\n"],"mappings":";AAAA,cAAc;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/utils/appearance.ts"],"sourcesContent":["import type { AllAppearance, AllIconKey, AllIconOverrides } from '@notiflyio/js/ui';\r\nimport { MountedElement } from '../context/RendererContext';\r\nimport type { ReactAllAppearance, ReactIconRenderer, ReactInboxAppearance, ReactSubscriptionAppearance } from './types';\r\n\r\nexport function adaptAppearanceForJs(\r\n appearance: ReactInboxAppearance | ReactSubscriptionAppearance | ReactAllAppearance,\r\n mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void\r\n): AllAppearance | undefined {\r\n if (!appearance) {\r\n return undefined;\r\n }\r\n const { icons, ...restAppearance } = appearance;\r\n const jsAppearance = { ...restAppearance } as AllAppearance;\r\n\r\n if (icons) {\r\n const jsIcons: AllIconOverrides = {};\r\n const iconKeys = Object.keys(icons) as Array<AllIconKey>;\r\n\r\n for (const iconKey of iconKeys) {\r\n // @ts-expect-error: cant easily fix this type error\r\n const reactRenderer = icons[iconKey] as ReactIconRenderer;\r\n\r\n if (reactRenderer) {\r\n jsIcons[iconKey] = (el: HTMLDivElement, props: { class?: string }) => {\r\n return mountElement(el, reactRenderer(props));\r\n };\r\n }\r\n }\r\n\r\n // JsAppearance also has .icons directly (from JsTheme part of JsAppearance)\r\n jsAppearance.icons = jsIcons;\r\n } else {\r\n // If original didn't have icons, ensure the clone doesn't either\r\n delete jsAppearance.icons;\r\n }\r\n\r\n return jsAppearance;\r\n}\r\n"],"mappings":";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":[]} | ||
| {"version":3,"sources":["../../../src/utils/appearance.ts"],"sourcesContent":["import type { AllAppearance, AllIconKey, AllIconOverrides } from '@notiflyio/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":";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,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/utils/createContextAndHook.ts"],"sourcesContent":["import React from 'react';\r\n\r\nexport function assertContextExists(contextVal: unknown, msgOrCtx: string | React.Context<any>): asserts contextVal {\r\n if (!contextVal) {\r\n throw typeof msgOrCtx === 'string' ? new Error(msgOrCtx) : new Error(`${msgOrCtx.displayName} not found`);\r\n }\r\n}\r\n\r\ntype Options = { assertCtxFn?: (v: unknown, msg: string) => void };\r\ntype ContextOf<T> = React.Context<{ value: T } | undefined>;\r\ntype UseCtxFn<T> = () => T;\r\n\r\n/**\r\n * Creates and returns a Context and two hooks that return the context value.\r\n * The Context type is derived from the type passed in by the user.\r\n * The first hook returned guarantees that the context exists so the returned value is always CtxValue\r\n * The second hook makes no guarantees, so the returned value can be CtxValue | undefined\r\n */\r\nexport const createContextAndHook = <CtxVal>(\r\n displayName: string,\r\n options?: Options\r\n): [ContextOf<CtxVal>, UseCtxFn<CtxVal>, UseCtxFn<CtxVal | Partial<CtxVal>>] => {\r\n const { assertCtxFn = assertContextExists } = options || {};\r\n const Ctx = React.createContext<{ value: CtxVal } | undefined>(undefined);\r\n Ctx.displayName = displayName;\r\n\r\n const useCtx = () => {\r\n const ctx = React.useContext(Ctx);\r\n assertCtxFn(ctx, `Component must be wrapped with ${Ctx.displayName}`);\r\n\r\n return (ctx as any).value as CtxVal;\r\n };\r\n\r\n const useCtxWithoutGuarantee = () => {\r\n const ctx = React.useContext(Ctx);\r\n\r\n return ctx ? ctx.value : {};\r\n };\r\n\r\n return [Ctx, useCtx, useCtxWithoutGuarantee];\r\n};\r\n"],"mappings":";AAAA,OAAO,WAAW;AAEX,SAAS,oBAAoB,YAAqB,UAA2D;AAClH,MAAI,CAAC,YAAY;AACf,UAAM,OAAO,aAAa,WAAW,IAAI,MAAM,QAAQ,IAAI,IAAI,MAAM,GAAG,SAAS,WAAW,YAAY;AAAA,EAC1G;AACF;AAYO,IAAM,uBAAuB,CAClC,aACA,YAC8E;AAC9E,QAAM,EAAE,cAAc,oBAAoB,IAAI,WAAW,CAAC;AAC1D,QAAM,MAAM,MAAM,cAA6C,MAAS;AACxE,MAAI,cAAc;AAElB,QAAM,SAAS,MAAM;AACnB,UAAM,MAAM,MAAM,WAAW,GAAG;AAChC,gBAAY,KAAK,kCAAkC,IAAI,WAAW,EAAE;AAEpE,WAAQ,IAAY;AAAA,EACtB;AAEA,QAAM,yBAAyB,MAAM;AACnC,UAAM,MAAM,MAAM,WAAW,GAAG;AAEhC,WAAO,MAAM,IAAI,QAAQ,CAAC;AAAA,EAC5B;AAEA,SAAO,CAAC,KAAK,QAAQ,sBAAsB;AAC7C;","names":[]} | ||
| {"version":3,"sources":["../../../src/utils/createContextAndHook.ts"],"sourcesContent":["import React from 'react';\n\nexport function assertContextExists(contextVal: unknown, msgOrCtx: string | React.Context<any>): asserts contextVal {\n if (!contextVal) {\n throw typeof msgOrCtx === 'string' ? new Error(msgOrCtx) : new Error(`${msgOrCtx.displayName} not found`);\n }\n}\n\ntype Options = { assertCtxFn?: (v: unknown, msg: string) => void };\ntype ContextOf<T> = React.Context<{ value: T } | undefined>;\ntype UseCtxFn<T> = () => T;\n\n/**\n * Creates and returns a Context and two hooks that return the context value.\n * The Context type is derived from the type passed in by the user.\n * The first hook returned guarantees that the context exists so the returned value is always CtxValue\n * The second hook makes no guarantees, so the returned value can be CtxValue | undefined\n */\nexport const createContextAndHook = <CtxVal>(\n displayName: string,\n options?: Options\n): [ContextOf<CtxVal>, UseCtxFn<CtxVal>, UseCtxFn<CtxVal | Partial<CtxVal>>] => {\n const { assertCtxFn = assertContextExists } = options || {};\n const Ctx = React.createContext<{ value: CtxVal } | undefined>(undefined);\n Ctx.displayName = displayName;\n\n const useCtx = () => {\n const ctx = React.useContext(Ctx);\n assertCtxFn(ctx, `Component must be wrapped with ${Ctx.displayName}`);\n\n return (ctx as any).value as CtxVal;\n };\n\n const useCtxWithoutGuarantee = () => {\n const ctx = React.useContext(Ctx);\n\n return ctx ? ctx.value : {};\n };\n\n return [Ctx, useCtx, useCtxWithoutGuarantee];\n};\n"],"mappings":";AAAA,OAAO,WAAW;AAEX,SAAS,oBAAoB,YAAqB,UAA2D;AAClH,MAAI,CAAC,YAAY;AACf,UAAM,OAAO,aAAa,WAAW,IAAI,MAAM,QAAQ,IAAI,IAAI,MAAM,GAAG,SAAS,WAAW,YAAY;AAAA,EAC1G;AACF;AAYO,IAAM,uBAAuB,CAClC,aACA,YAC8E;AAC9E,QAAM,EAAE,cAAc,oBAAoB,IAAI,WAAW,CAAC;AAC1D,QAAM,MAAM,MAAM,cAA6C,MAAS;AACxE,MAAI,cAAc;AAElB,QAAM,SAAS,MAAM;AACnB,UAAM,MAAM,MAAM,WAAW,GAAG;AAChC,gBAAY,KAAK,kCAAkC,IAAI,WAAW,EAAE;AAEpE,WAAQ,IAAY;AAAA,EACtB;AAEA,QAAM,yBAAyB,MAAM;AACnC,UAAM,MAAM,MAAM,WAAW,GAAG;AAEhC,WAAO,MAAM,IAAI,QAAQ,CAAC;AAAA,EAC5B;AAEA,SAAO,CAAC,KAAK,QAAQ,sBAAsB;AAC7C;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../src/utils/requestLock.ts"],"sourcesContent":["export function requestLock(id: string, cb: (id: string) => void) {\r\n // Check if the Lock API is available\r\n if (!('locks' in navigator)) {\r\n // If Lock API is not available, immediately invoke the callback and return a no-op function\r\n cb(id);\r\n\r\n return () => {};\r\n }\r\n\r\n let isFulfilled = false;\r\n let promiseResolve: () => void;\r\n\r\n const promise = new Promise<void>((resolve) => {\r\n promiseResolve = resolve;\r\n });\r\n\r\n navigator.locks.request(id, () => {\r\n if (!isFulfilled) {\r\n cb(id);\r\n }\r\n\r\n return promise;\r\n });\r\n\r\n return () => {\r\n isFulfilled = true;\r\n promiseResolve();\r\n };\r\n}\r\n"],"mappings":";AAAO,SAAS,YAAY,IAAY,IAA0B;AAEhE,MAAI,EAAE,WAAW,YAAY;AAE3B,OAAG,EAAE;AAEL,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AAEA,MAAI,cAAc;AAClB,MAAI;AAEJ,QAAM,UAAU,IAAI,QAAc,CAAC,YAAY;AAC7C,qBAAiB;AAAA,EACnB,CAAC;AAED,YAAU,MAAM,QAAQ,IAAI,MAAM;AAChC,QAAI,CAAC,aAAa;AAChB,SAAG,EAAE;AAAA,IACP;AAEA,WAAO;AAAA,EACT,CAAC;AAED,SAAO,MAAM;AACX,kBAAc;AACd,mBAAe;AAAA,EACjB;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../src/utils/requestLock.ts"],"sourcesContent":["export function requestLock(id: string, cb: (id: string) => void) {\n // Check if the Lock API is available\n if (!('locks' in navigator)) {\n // If Lock API is not available, immediately invoke the callback and return a no-op function\n cb(id);\n\n return () => {};\n }\n\n let isFulfilled = false;\n let promiseResolve: () => void;\n\n const promise = new Promise<void>((resolve) => {\n promiseResolve = resolve;\n });\n\n navigator.locks.request(id, () => {\n if (!isFulfilled) {\n cb(id);\n }\n\n return promise;\n });\n\n return () => {\n isFulfilled = true;\n promiseResolve();\n };\n}\n"],"mappings":";AAAO,SAAS,YAAY,IAAY,IAA0B;AAEhE,MAAI,EAAE,WAAW,YAAY;AAE3B,OAAG,EAAE;AAEL,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AAEA,MAAI,cAAc;AAClB,MAAI;AAEJ,QAAM,UAAU,IAAI,QAAc,CAAC,YAAY;AAC7C,qBAAiB;AAAA,EACnB,CAAC;AAED,YAAU,MAAM,QAAQ,IAAI,MAAM;AAChC,QAAI,CAAC,aAAa;AAChB,SAAG,EAAE;AAAA,IACP;AAEA,WAAO;AAAA,EACT,CAAC;AAED,SAAO,MAAM;AACX,kBAAc;AACd,mBAAe;AAAA,EACjB;AACF;","names":[]} |
+2
-2
| { | ||
| "name": "@notiflyio/react", | ||
| "version": "3.17.0", | ||
| "version": "3.17.1", | ||
| "repository": { | ||
@@ -124,3 +124,3 @@ "type": "git", | ||
| "dependencies": { | ||
| "@notiflyio/js": "3.17.0" | ||
| "@notiflyio/js": "3.17.1" | ||
| }, | ||
@@ -127,0 +127,0 @@ "nx": { |
719090
-2.18%+ Added
- Removed
Updated