ublo-lib 1.32.0 → 1.32.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/es/common/components/plausible/hooks/use-plausible.d.ts +1 -1
- package/es/common/components/plausible/hooks/use-plausible.d.ts.map +1 -1
- package/es/common/components/plausible/hooks/use-plausible.js +6 -6
- package/es/common/components/scrolling-carousel/scrolling-carousel.d.ts.map +1 -1
- package/es/common/components/scrolling-carousel/scrolling-carousel.js +23 -9
- package/es/common/hooks/use-update-effect.d.ts +1 -1
- package/es/common/hooks/use-update-effect.d.ts.map +1 -1
- package/es/common/hooks/use-update-effect.js +2 -2
- package/es/common/utils/cms.d.ts.map +1 -1
- package/es/future/components/plausible/hooks/use-plausible.d.ts +1 -1
- package/es/future/components/plausible/hooks/use-plausible.d.ts.map +1 -1
- package/es/future/components/plausible/hooks/use-plausible.js +6 -6
- package/package.json +9 -2
|
@@ -2,7 +2,7 @@ type Revenue = {
|
|
|
2
2
|
currency: string;
|
|
3
3
|
amount: number;
|
|
4
4
|
};
|
|
5
|
-
export default function useGoal(goal: string, props: Record<string, any>, revenue?: Revenue,
|
|
5
|
+
export default function useGoal(goal: string, props: Record<string, any>, revenue?: Revenue, domainOverride?: string): void;
|
|
6
6
|
declare global {
|
|
7
7
|
interface Window {
|
|
8
8
|
plausible: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-plausible.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/plausible/hooks/use-plausible.ts"],"names":[],"mappings":"AAQA,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,OAAO,CAAC,EAAE,OAAO,EACjB,
|
|
1
|
+
{"version":3,"file":"use-plausible.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/plausible/hooks/use-plausible.ts"],"names":[],"mappings":"AAQA,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,OAAO,CAAC,EAAE,OAAO,EACjB,cAAc,CAAC,EAAE,MAAM,QAQxB;AAcD,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,MAAM;QACd,SAAS,EAAE,GAAG,CAAC;KAChB;CACF"}
|
|
@@ -4,22 +4,22 @@ import load from "../services/load";
|
|
|
4
4
|
import sendGoal from "../services/send-goal";
|
|
5
5
|
const { publicRuntimeConfig } = getConfig();
|
|
6
6
|
const { plausibleDomain } = publicRuntimeConfig;
|
|
7
|
-
export default function useGoal(goal, props, revenue,
|
|
8
|
-
const [loaded] = usePlausible(
|
|
7
|
+
export default function useGoal(goal, props, revenue, domainOverride) {
|
|
8
|
+
const [loaded] = usePlausible(domainOverride);
|
|
9
9
|
React.useEffect(() => {
|
|
10
10
|
if (!loaded || !window.plausible)
|
|
11
11
|
return;
|
|
12
12
|
const defaultProps = { path: document.location.pathname };
|
|
13
13
|
sendGoal(goal, props || defaultProps, revenue);
|
|
14
|
-
}, [goal, loaded, props]);
|
|
14
|
+
}, [goal, loaded, props, revenue]);
|
|
15
15
|
}
|
|
16
|
-
function usePlausible(
|
|
16
|
+
function usePlausible(domainOverride) {
|
|
17
17
|
const [loaded, setLoaded] = React.useState(false);
|
|
18
18
|
React.useEffect(() => {
|
|
19
|
-
if (!
|
|
19
|
+
if (!domainOverride && !plausibleDomain)
|
|
20
20
|
return;
|
|
21
21
|
load();
|
|
22
22
|
setLoaded(true);
|
|
23
|
-
}, [
|
|
23
|
+
}, [domainOverride]);
|
|
24
24
|
return [loaded, setLoaded];
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrolling-carousel.d.ts","sourceRoot":"","sources":["../../../../src/common/components/scrolling-carousel/scrolling-carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAKF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"scrolling-carousel.d.ts","sourceRoot":"","sources":["../../../../src/common/components/scrolling-carousel/scrolling-carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAKF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAkHvE"}
|
|
@@ -18,6 +18,13 @@ export default function ScrollingCarousel({ className, children }) {
|
|
|
18
18
|
nextDisabled: false,
|
|
19
19
|
});
|
|
20
20
|
const { width } = useWindowSizes();
|
|
21
|
+
const resetScroll = () => {
|
|
22
|
+
const inner = ref.current;
|
|
23
|
+
if (inner) {
|
|
24
|
+
const innerContainer = inner;
|
|
25
|
+
innerContainer.scrollLeft = 0;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
21
28
|
const slideTo = (direction) => () => {
|
|
22
29
|
const zone = zoneRef.current;
|
|
23
30
|
const inner = ref.current;
|
|
@@ -45,21 +52,28 @@ export default function ScrollingCarousel({ className, children }) {
|
|
|
45
52
|
setOverflow(innerContainer.clientWidth < zoneContainer.clientWidth);
|
|
46
53
|
setControls({
|
|
47
54
|
prevDisabled: Math.floor(innerContainer.scrollLeft) === 0,
|
|
48
|
-
nextDisabled: Math.
|
|
49
|
-
Math.
|
|
50
|
-
Math.
|
|
55
|
+
nextDisabled: Math.floor(innerContainer.scrollLeft) ===
|
|
56
|
+
Math.floor(innerContainer.scrollWidth) -
|
|
57
|
+
Math.floor(innerContainer.clientWidth),
|
|
51
58
|
});
|
|
52
59
|
}
|
|
53
60
|
}, []);
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
const zone = zoneRef.current;
|
|
63
|
+
if (!cmsMode && zone) {
|
|
64
|
+
const observer = new MutationObserver(resetScroll);
|
|
65
|
+
observer.observe(zone, {
|
|
66
|
+
attributes: true,
|
|
67
|
+
childList: true,
|
|
68
|
+
subtree: true,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}, [cmsMode]);
|
|
54
72
|
React.useEffect(() => {
|
|
55
73
|
refreshControls();
|
|
56
|
-
}, [cmsMode, refreshControls]);
|
|
74
|
+
}, [cmsMode, refreshControls, width]);
|
|
57
75
|
React.useEffect(() => {
|
|
58
|
-
|
|
59
|
-
if (inner) {
|
|
60
|
-
const innerContainer = inner;
|
|
61
|
-
innerContainer.scrollLeft = 0;
|
|
62
|
-
}
|
|
76
|
+
resetScroll();
|
|
63
77
|
}, [width]);
|
|
64
78
|
const classes = classNames(css.carousel, className);
|
|
65
79
|
return (_jsxs("div", { className: classes, children: [overflow && (_jsxs("div", { className: css.controls, "data-controls": "", children: [_jsx(Button, { className: css.control, variant: "link", onClick: slideTo(PREV), disabled: controls.prevDisabled, "data-control": "prev", children: _jsx(Icons.ChevronLeft, { className: css.controlIcon }) }), _jsx(Button, { className: css.control, variant: "link", onClick: slideTo(NEXT), disabled: controls.nextDisabled, "data-control": "next", children: _jsx(Icons.ChevronRight, { className: css.controlIcon }) })] })), _jsx("div", { className: css.inner, ref: ref, onScroll: refreshControls, "data-inner": "", children: React.cloneElement(children, { ref: zoneRef }) })] }));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default function useUpdateEffect(callback: any, dependencies
|
|
1
|
+
export default function useUpdateEffect(callback: any, dependencies?: any[]): void;
|
|
2
2
|
//# sourceMappingURL=use-update-effect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-update-effect.d.ts","sourceRoot":"","sources":["../../../src/common/hooks/use-update-effect.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,QAAQ,KAAA,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"use-update-effect.d.ts","sourceRoot":"","sources":["../../../src/common/hooks/use-update-effect.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,QAAQ,KAAA,EAAE,YAAY,QAAK,QAWlE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
export default function useUpdateEffect(callback, dependencies) {
|
|
2
|
+
export default function useUpdateEffect(callback, dependencies = []) {
|
|
3
3
|
const firstRenderRef = React.useRef(true);
|
|
4
4
|
React.useEffect(() => {
|
|
5
5
|
if (firstRenderRef.current) {
|
|
@@ -7,5 +7,5 @@ export default function useUpdateEffect(callback, dependencies) {
|
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
9
|
return callback();
|
|
10
|
-
}, dependencies);
|
|
10
|
+
}, [callback, ...dependencies]);
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cms.d.ts","sourceRoot":"","sources":["../../../src/common/utils/cms.ts"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,YAE1B;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cms.d.ts","sourceRoot":"","sources":["../../../src/common/utils/cms.ts"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,YAE1B;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,iBAQ5C;AAED,wBAAsB,aAAa,kBAQlC"}
|
|
@@ -2,7 +2,7 @@ type Revenue = {
|
|
|
2
2
|
currency: string;
|
|
3
3
|
amount: number;
|
|
4
4
|
};
|
|
5
|
-
export default function useGoal(goal: string, props: Record<string, any>, revenue?: Revenue,
|
|
5
|
+
export default function useGoal(goal: string, props: Record<string, any>, revenue?: Revenue, domainOverride?: string): void;
|
|
6
6
|
declare global {
|
|
7
7
|
interface Window {
|
|
8
8
|
plausible: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-plausible.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/plausible/hooks/use-plausible.ts"],"names":[],"mappings":"AAQA,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,OAAO,CAAC,EAAE,OAAO,EACjB,
|
|
1
|
+
{"version":3,"file":"use-plausible.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/plausible/hooks/use-plausible.ts"],"names":[],"mappings":"AAQA,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,OAAO,CAAC,EAAE,OAAO,EACjB,cAAc,CAAC,EAAE,MAAM,QAQxB;AAcD,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,MAAM;QACd,SAAS,EAAE,GAAG,CAAC;KAChB;CACF"}
|
|
@@ -4,22 +4,22 @@ import load from "../services/load";
|
|
|
4
4
|
import sendGoal from "../services/send-goal";
|
|
5
5
|
const { publicRuntimeConfig } = getConfig();
|
|
6
6
|
const { plausibleDomain } = publicRuntimeConfig;
|
|
7
|
-
export default function useGoal(goal, props, revenue,
|
|
8
|
-
const [loaded] = usePlausible(
|
|
7
|
+
export default function useGoal(goal, props, revenue, domainOverride) {
|
|
8
|
+
const [loaded] = usePlausible(domainOverride);
|
|
9
9
|
React.useEffect(() => {
|
|
10
10
|
if (!loaded || !window.plausible)
|
|
11
11
|
return;
|
|
12
12
|
const defaultProps = { path: document.location.pathname };
|
|
13
13
|
sendGoal(goal, props || defaultProps, revenue);
|
|
14
|
-
}, [goal, loaded, props]);
|
|
14
|
+
}, [goal, loaded, props, revenue]);
|
|
15
15
|
}
|
|
16
|
-
function usePlausible(
|
|
16
|
+
function usePlausible(domainOverride) {
|
|
17
17
|
const [loaded, setLoaded] = React.useState(false);
|
|
18
18
|
React.useEffect(() => {
|
|
19
|
-
if (!
|
|
19
|
+
if (!domainOverride && !plausibleDomain)
|
|
20
20
|
return;
|
|
21
21
|
load();
|
|
22
22
|
setLoaded(true);
|
|
23
|
-
}, [
|
|
23
|
+
}, [domainOverride]);
|
|
24
24
|
return [loaded, setLoaded];
|
|
25
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ublo-lib",
|
|
3
|
-
"version": "1.32.
|
|
3
|
+
"version": "1.32.2",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"peerDependencies": {
|
|
5
6
|
"dt-design-system": "^3.8.5",
|
|
6
7
|
"leaflet": "^1.9.1",
|
|
@@ -32,8 +33,13 @@
|
|
|
32
33
|
"@types/css-modules": "1.0.5",
|
|
33
34
|
"@types/react": "18.2.77",
|
|
34
35
|
"@types/react-dom": "18.2.25",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "7.6.0",
|
|
37
|
+
"@typescript-eslint/parser": "7.6.0",
|
|
35
38
|
"classnames": "2.5.1",
|
|
36
39
|
"cpx2": "7.0.1",
|
|
40
|
+
"eslint": "8.57.0",
|
|
41
|
+
"eslint-plugin-react": "7.34.1",
|
|
42
|
+
"eslint-plugin-react-hooks": "4.6.0",
|
|
37
43
|
"dt-design-system": "3.8.5",
|
|
38
44
|
"mv": "2.1.1",
|
|
39
45
|
"next": "14.1.0",
|
|
@@ -47,7 +53,8 @@
|
|
|
47
53
|
"build": "yarn clean && tsc",
|
|
48
54
|
"postbuild": "cpx 'src/**/*.{json,css,svg}' es",
|
|
49
55
|
"prepublishOnly": "yarn build",
|
|
50
|
-
"watch": "yarn clean && tsc --watch & cpx './src/**/*.{json,css,svg}' es -w"
|
|
56
|
+
"watch": "yarn clean && tsc --watch & cpx './src/**/*.{json,css,svg}' es -w",
|
|
57
|
+
"lint": "eslint --ext .ts,.tsx src/"
|
|
51
58
|
},
|
|
52
59
|
"packageManager": "yarn@1.22.18",
|
|
53
60
|
"files": [
|