@pushwoosh/kit-helpers 4.11.0 → 4.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analytics/identifyOpenReplay.js +4 -2
- package/expand.js +24 -18
- package/flex.d.ts +6 -6
- package/grid.d.ts +29 -29
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/navigation.d.ts +9 -0
- package/navigation.js +25 -0
- package/package.json +2 -2
|
@@ -8,9 +8,11 @@ export const identifyOpenReplaySession = properties => {
|
|
|
8
8
|
store.push(properties);
|
|
9
9
|
window.pwOpenReplayIdentifyStore = store;
|
|
10
10
|
} else {
|
|
11
|
-
|
|
11
|
+
var _window$OpenReplay;
|
|
12
|
+
(_window$OpenReplay = window.OpenReplay) === null || _window$OpenReplay === void 0 || _window$OpenReplay.setUserID(properties.email);
|
|
12
13
|
if (properties.accountID) {
|
|
13
|
-
|
|
14
|
+
var _window$OpenReplay2;
|
|
15
|
+
(_window$OpenReplay2 = window.OpenReplay) === null || _window$OpenReplay2 === void 0 || _window$OpenReplay2.setMetadata('AccountID', `${properties.accountID}`);
|
|
14
16
|
}
|
|
15
17
|
}
|
|
16
18
|
};
|
package/expand.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { createElement as _createElement } from "react";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
3
|
/* eslint-disable react/require-default-props, react/jsx-no-bind */
|
|
2
|
-
import
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
5
|
import { CSSTransition, TransitionGroup } from 'react-transition-group';
|
|
4
6
|
import styled, { css } from 'styled-components';
|
|
5
7
|
const ExpandTransitionComp = ({
|
|
@@ -22,21 +24,24 @@ const ExpandTransitionComp = ({
|
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
26
|
useEffect(updateStyle, [timeout]);
|
|
25
|
-
return
|
|
27
|
+
return _jsx(CSSTransition, {
|
|
26
28
|
...rest,
|
|
27
29
|
timeout: timeout,
|
|
28
30
|
classNames: className,
|
|
29
31
|
onEnter: updateStyle,
|
|
30
32
|
onExit: updateStyle,
|
|
31
|
-
nodeRef: refExternal
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
nodeRef: refExternal,
|
|
34
|
+
children: _jsx("div", {
|
|
35
|
+
ref: refExternal,
|
|
36
|
+
className: externalClassName ? `${className} ${externalClassName}` : className,
|
|
37
|
+
style: externalStyle,
|
|
38
|
+
children: _jsx("div", {
|
|
39
|
+
ref: refInternal,
|
|
40
|
+
className: internalClassName,
|
|
41
|
+
children: children
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
});
|
|
40
45
|
};
|
|
41
46
|
const CollapseTransition = styled(ExpandTransitionComp).withConfig({
|
|
42
47
|
displayName: "CollapseTransition",
|
|
@@ -53,10 +58,11 @@ export const Collapse = ({
|
|
|
53
58
|
children,
|
|
54
59
|
className,
|
|
55
60
|
...rest
|
|
56
|
-
}) =>
|
|
57
|
-
component: null
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, typeof children === 'function' ? children() : children)
|
|
61
|
+
}) => _jsx(TransitionGroup, {
|
|
62
|
+
component: null,
|
|
63
|
+
children: expanded && _createElement(CollapseTransition, {
|
|
64
|
+
...rest,
|
|
65
|
+
externalClassName: className,
|
|
66
|
+
key: 0
|
|
67
|
+
}, typeof children === 'function' ? children() : children)
|
|
68
|
+
});
|
package/flex.d.ts
CHANGED
|
@@ -5,13 +5,13 @@ type FlexContainerProps = CommonContainerProps & {
|
|
|
5
5
|
};
|
|
6
6
|
export declare const FlexContainer: import("styled-components").StyledComponent<"div", any, FlexContainerProps, never>;
|
|
7
7
|
export declare const Cluster: import("styled-components").StyledComponent<"div", any, import("./styled-helpers").CommonBoxProps & {
|
|
8
|
-
$alignContent?: import("./styled-helpers").AlignContentValue
|
|
9
|
-
$alignItems?: import("./styled-helpers").ItemAlignmentValue
|
|
10
|
-
$gap?: import("./styled-helpers").StrNum
|
|
11
|
-
$justifyContent?: import("./styled-helpers").JustifyContentValue
|
|
8
|
+
$alignContent?: import("./styled-helpers").AlignContentValue;
|
|
9
|
+
$alignItems?: import("./styled-helpers").ItemAlignmentValue;
|
|
10
|
+
$gap?: import("./styled-helpers").StrNum;
|
|
11
|
+
$justifyContent?: import("./styled-helpers").JustifyContentValue;
|
|
12
12
|
} & {
|
|
13
|
-
$flexDirection?: "row" | "row-reverse" | "column" | "column-reverse"
|
|
14
|
-
$flexWrap?: "
|
|
13
|
+
$flexDirection?: "row" | "row-reverse" | "column" | "column-reverse";
|
|
14
|
+
$flexWrap?: "nowrap" | "wrap" | "wrap-reverse";
|
|
15
15
|
} & {
|
|
16
16
|
$flexWrap: string;
|
|
17
17
|
}, "$flexWrap">;
|
package/grid.d.ts
CHANGED
|
@@ -7,50 +7,50 @@ type GridContainerProps = CommonContainerProps & {
|
|
|
7
7
|
};
|
|
8
8
|
export declare const GridContainer: import("styled-components").StyledComponent<"div", any, GridContainerProps, never>;
|
|
9
9
|
export declare const Columns: import("styled-components").StyledComponent<"div", any, import("./styled-helpers").CommonBoxProps & {
|
|
10
|
-
$alignContent?: import("./styled-helpers").AlignContentValue
|
|
11
|
-
$alignItems?: ItemAlignmentValue
|
|
12
|
-
$gap?: StrNum
|
|
13
|
-
$justifyContent?: import("./styled-helpers").JustifyContentValue
|
|
10
|
+
$alignContent?: import("./styled-helpers").AlignContentValue;
|
|
11
|
+
$alignItems?: ItemAlignmentValue;
|
|
12
|
+
$gap?: StrNum;
|
|
13
|
+
$justifyContent?: import("./styled-helpers").JustifyContentValue;
|
|
14
14
|
} & {
|
|
15
|
-
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense"
|
|
16
|
-
$justifyItems?: ItemAlignmentValue
|
|
17
|
-
$placeItems?: ItemAlignmentValue
|
|
15
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense";
|
|
16
|
+
$justifyItems?: ItemAlignmentValue;
|
|
17
|
+
$placeItems?: ItemAlignmentValue;
|
|
18
18
|
} & {
|
|
19
19
|
$sizes: StrNum;
|
|
20
20
|
}, never>;
|
|
21
21
|
export declare const Rows: import("styled-components").StyledComponent<"div", any, import("./styled-helpers").CommonBoxProps & {
|
|
22
|
-
$alignContent?: import("./styled-helpers").AlignContentValue
|
|
23
|
-
$alignItems?: ItemAlignmentValue
|
|
24
|
-
$gap?: StrNum
|
|
25
|
-
$justifyContent?: import("./styled-helpers").JustifyContentValue
|
|
22
|
+
$alignContent?: import("./styled-helpers").AlignContentValue;
|
|
23
|
+
$alignItems?: ItemAlignmentValue;
|
|
24
|
+
$gap?: StrNum;
|
|
25
|
+
$justifyContent?: import("./styled-helpers").JustifyContentValue;
|
|
26
26
|
} & {
|
|
27
|
-
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense"
|
|
28
|
-
$justifyItems?: ItemAlignmentValue
|
|
29
|
-
$placeItems?: ItemAlignmentValue
|
|
27
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense";
|
|
28
|
+
$justifyItems?: ItemAlignmentValue;
|
|
29
|
+
$placeItems?: ItemAlignmentValue;
|
|
30
30
|
} & {
|
|
31
31
|
$sizes: StrNum;
|
|
32
32
|
}, never>;
|
|
33
33
|
export declare const Horizontal: import("styled-components").StyledComponent<"div", any, import("./styled-helpers").CommonBoxProps & {
|
|
34
|
-
$alignContent?: import("./styled-helpers").AlignContentValue
|
|
35
|
-
$alignItems?: ItemAlignmentValue
|
|
36
|
-
$gap?: StrNum
|
|
37
|
-
$justifyContent?: import("./styled-helpers").JustifyContentValue
|
|
34
|
+
$alignContent?: import("./styled-helpers").AlignContentValue;
|
|
35
|
+
$alignItems?: ItemAlignmentValue;
|
|
36
|
+
$gap?: StrNum;
|
|
37
|
+
$justifyContent?: import("./styled-helpers").JustifyContentValue;
|
|
38
38
|
} & {
|
|
39
|
-
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense"
|
|
40
|
-
$justifyItems?: ItemAlignmentValue
|
|
41
|
-
$placeItems?: ItemAlignmentValue
|
|
39
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense";
|
|
40
|
+
$justifyItems?: ItemAlignmentValue;
|
|
41
|
+
$placeItems?: ItemAlignmentValue;
|
|
42
42
|
} & {
|
|
43
43
|
$gridAutoFlow: string;
|
|
44
44
|
}, "$gridAutoFlow">;
|
|
45
45
|
export declare const Vertical: import("styled-components").StyledComponent<"div", any, import("./styled-helpers").CommonBoxProps & {
|
|
46
|
-
$alignContent?: import("./styled-helpers").AlignContentValue
|
|
47
|
-
$alignItems?: ItemAlignmentValue
|
|
48
|
-
$gap?: StrNum
|
|
49
|
-
$justifyContent?: import("./styled-helpers").JustifyContentValue
|
|
50
|
-
} & {
|
|
51
|
-
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense"
|
|
52
|
-
$justifyItems?: ItemAlignmentValue
|
|
53
|
-
$placeItems?: ItemAlignmentValue
|
|
46
|
+
$alignContent?: import("./styled-helpers").AlignContentValue;
|
|
47
|
+
$alignItems?: ItemAlignmentValue;
|
|
48
|
+
$gap?: StrNum;
|
|
49
|
+
$justifyContent?: import("./styled-helpers").JustifyContentValue;
|
|
50
|
+
} & {
|
|
51
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense";
|
|
52
|
+
$justifyItems?: ItemAlignmentValue;
|
|
53
|
+
$placeItems?: ItemAlignmentValue;
|
|
54
54
|
} & {
|
|
55
55
|
$gridAutoFlow: string;
|
|
56
56
|
}, "$gridAutoFlow">;
|
package/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './hooks/useClickAway';
|
|
|
5
5
|
export { identifyOpenReplaySession } from './analytics/identifyOpenReplay';
|
|
6
6
|
export { trackEvent } from './analytics/trackEvent';
|
|
7
7
|
export { formatNumber } from './formatNumber';
|
|
8
|
+
export { readNavigationHistory, writeNavigationHistory } from './navigation';
|
|
8
9
|
export { default as usePersistentFunction } from './hooks/usePersistentFunction';
|
|
9
10
|
export { default as useEffectOnce } from './hooks/useEffectOnce';
|
|
10
11
|
export { default as useMountedState } from './hooks/useMountedState';
|
package/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from './hooks/useClickAway';
|
|
|
5
5
|
export { identifyOpenReplaySession } from './analytics/identifyOpenReplay';
|
|
6
6
|
export { trackEvent } from './analytics/trackEvent';
|
|
7
7
|
export { formatNumber } from './formatNumber';
|
|
8
|
+
export { readNavigationHistory, writeNavigationHistory } from './navigation';
|
|
8
9
|
export { default as usePersistentFunction } from './hooks/usePersistentFunction';
|
|
9
10
|
export { default as useEffectOnce } from './hooks/useEffectOnce';
|
|
10
11
|
export { default as useMountedState } from './hooks/useMountedState';
|
package/navigation.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the navigation stack from sessionStorage.
|
|
3
|
+
* The last element is the current page.
|
|
4
|
+
*/
|
|
5
|
+
export declare function readNavigationHistory(): string[];
|
|
6
|
+
/**
|
|
7
|
+
* Persists the navigation stack to sessionStorage.
|
|
8
|
+
*/
|
|
9
|
+
export declare function writeNavigationHistory(entries: string[]): void;
|
package/navigation.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const STORAGE_KEY = 'pw_navigation_history';
|
|
2
|
+
const MAX_ENTRIES = 50;
|
|
3
|
+
/**
|
|
4
|
+
* Reads the navigation stack from sessionStorage.
|
|
5
|
+
* The last element is the current page.
|
|
6
|
+
*/
|
|
7
|
+
export function readNavigationHistory() {
|
|
8
|
+
try {
|
|
9
|
+
const raw = sessionStorage.getItem(STORAGE_KEY);
|
|
10
|
+
const parsed = raw ? JSON.parse(raw) : null;
|
|
11
|
+
return Array.isArray(parsed) && parsed.every(e => typeof e === 'string') ? parsed.slice(-MAX_ENTRIES) : [];
|
|
12
|
+
} catch {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Persists the navigation stack to sessionStorage.
|
|
18
|
+
*/
|
|
19
|
+
export function writeNavigationHistory(entries) {
|
|
20
|
+
try {
|
|
21
|
+
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(entries.slice(-MAX_ENTRIES)));
|
|
22
|
+
} catch {
|
|
23
|
+
// sessionStorage is unavailable (private mode / quota exceeded) — silently ignore.
|
|
24
|
+
}
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushwoosh/kit-helpers",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.2",
|
|
4
4
|
"description": "React component for build Pushwoosh products",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"react-transition-group": "^4.4.5"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@pushwoosh/frontend-builder-engine": "^
|
|
22
|
+
"@pushwoosh/frontend-builder-engine": "^2.1.1",
|
|
23
23
|
"@pushwoosh/kit-constants": "^1.6.0",
|
|
24
24
|
"@types/react": "^16.14.20",
|
|
25
25
|
"@types/react-dom": "^16.9.14",
|