@pushwoosh/smart-components-kit 1.0.73 → 1.0.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { DocsButtonProps } from './types';
3
+ export declare function DocsButton(props: DocsButtonProps): React.JSX.Element | null;
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import { Button, DrawerDocs, useDocs } from '@pushwoosh/dumb-components';
3
+ import { DocsIcon } from '@pushwoosh/kit-icons';
4
+ import { useSPAContext } from '@pushwoosh/spa-context';
5
+ const PUSHWOOSH_DOCS_BASE = 'https://docs.pushwoosh.com';
6
+ const WAVESEND_DOCS_BASE = 'https://docs.wavesend.ru';
7
+ export function DocsButton(props) {
8
+ const {
9
+ pathname,
10
+ children,
11
+ color = 'secondary',
12
+ view = 'ghost',
13
+ size
14
+ } = props;
15
+ const {
16
+ environment
17
+ } = useSPAContext();
18
+ const {
19
+ docsOpen,
20
+ openDocsDrawer,
21
+ closeDocsDrawer
22
+ } = useDocs();
23
+ if (environment.isOMO) {
24
+ return null;
25
+ }
26
+ const base = environment.isWavesend ? WAVESEND_DOCS_BASE : PUSHWOOSH_DOCS_BASE;
27
+ const normalizedPath = pathname.startsWith('/') ? pathname : `/${pathname}`;
28
+ const url = `${base}${normalizedPath}`;
29
+ return React.createElement(React.Fragment, null, React.createElement(Button, {
30
+ "aria-label": "Documentation",
31
+ color: color,
32
+ view: view,
33
+ size: size,
34
+ icon: React.createElement(DocsIcon, {
35
+ size: "medium",
36
+ view: "lined"
37
+ }),
38
+ onClick: openDocsDrawer
39
+ }, children), React.createElement(DrawerDocs, {
40
+ url: url,
41
+ isOpen: docsOpen,
42
+ onClose: closeDocsDrawer
43
+ }));
44
+ }
@@ -0,0 +1,2 @@
1
+ export { DocsButton } from './DocsButton';
2
+ export type { DocsButtonProps } from './types';
@@ -0,0 +1 @@
1
+ export { DocsButton } from './DocsButton';
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface DocsButtonProps {
3
+ pathname: string;
4
+ children?: ReactNode;
5
+ color?: 'primary' | 'secondary' | 'danger';
6
+ size?: 'field' | 'compact';
7
+ view?: 'shape' | 'ghost';
8
+ }
@@ -0,0 +1 @@
1
+ export {};
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './hooks';
2
2
  export * from './CampaignsConfigurationDrawer';
3
+ export * from './DocsButton';
3
4
  export * from './DynamicContentPicker';
4
5
  export * from './DynamicContentPickerForm';
5
6
  export * from './EmailTemplatePreview';
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './hooks';
2
2
  export * from './CampaignsConfigurationDrawer';
3
+ export * from './DocsButton';
3
4
  export * from './DynamicContentPicker';
4
5
  export * from './DynamicContentPickerForm';
5
6
  export * from './EmailTemplatePreview';
package/package.json CHANGED
@@ -48,5 +48,5 @@
48
48
  "react": "^16.14.0 || ^18.0.0",
49
49
  "react-dom": "^16.14.0 || ^18.0.0"
50
50
  },
51
- "version": "1.0.73"
51
+ "version": "1.0.74"
52
52
  }