@pexip-engage-public/plugin-react 2.1.35 → 2.1.37-canary-20250703080335
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @pexip-engage-public/plugin-react
|
|
2
2
|
|
|
3
|
+
## 2.1.37-canary-20250703080335
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @pexip-engage-public/plugin@1.1.23-canary-20250703080335
|
|
8
|
+
|
|
9
|
+
## 2.1.36
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 9fe91c2: chore: memoize onInstanceChange, remove useState
|
|
14
|
+
|
|
3
15
|
## 2.1.35
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -7,6 +7,6 @@ interface PexipEngagePluginProps extends PexipEngagePluginContextProps {
|
|
|
7
7
|
id?: string;
|
|
8
8
|
style?: React.CSSProperties;
|
|
9
9
|
}
|
|
10
|
-
export declare function PexipEngagePlugin({ className, fallback, id, onInstanceChange, scriptSrc, style, children, ...config }: React.PropsWithChildren<PexipEngagePluginProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function PexipEngagePlugin({ className, fallback, id, onInstanceChange: _onInstanceChange, scriptSrc, style, children, ...config }: React.PropsWithChildren<PexipEngagePluginProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
|
12
12
|
//# sourceMappingURL=PexipEngagePlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PexipEngagePlugin.d.ts","sourceRoot":"","sources":["../src/PexipEngagePlugin.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"PexipEngagePlugin.d.ts","sourceRoot":"","sources":["../src/PexipEngagePlugin.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAI3E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAI7E,UAAU,sBAAuB,SAAQ,6BAA6B;IACpE,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,KAAK,OAAO,CAAC;IAChE,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAGD,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,QAAQ,EACR,EAAE,EACF,gBAAgB,EAAE,iBAAwB,EAC1C,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,KAAK,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,2CAiCjD"}
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useEffectEvent } from "@pexip-engage-public/utils";
|
|
3
|
+
import { isValidElement, useEffect, useRef } from "react";
|
|
3
4
|
import { usePexipEngagePlugin } from "./usePexipEngagePlugin.js";
|
|
4
5
|
import { usePluginConfiguration } from "./usePluginConfiguration.js";
|
|
5
|
-
|
|
6
|
+
function NOOP() { }
|
|
7
|
+
export function PexipEngagePlugin({ className, fallback, id, onInstanceChange: _onInstanceChange = NOOP, scriptSrc, style, children, ...config }) {
|
|
6
8
|
const { Plugin, status } = usePexipEngagePlugin(scriptSrc);
|
|
7
9
|
const options = usePluginConfiguration(config);
|
|
8
10
|
const containerRef = useRef(null);
|
|
9
|
-
const
|
|
11
|
+
const onInstanceChange = useEffectEvent(_onInstanceChange);
|
|
10
12
|
useEffect(() => {
|
|
11
13
|
if (Plugin && containerRef.current) {
|
|
12
14
|
const instance = new Plugin(containerRef.current, { config: options });
|
|
13
|
-
|
|
15
|
+
onInstanceChange(instance);
|
|
14
16
|
return () => {
|
|
15
17
|
instance.dispose();
|
|
16
|
-
|
|
18
|
+
onInstanceChange(null);
|
|
17
19
|
};
|
|
18
20
|
}
|
|
19
|
-
}, [Plugin, options]);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
onInstanceChange?.(instance);
|
|
22
|
-
}, [instance, onInstanceChange]);
|
|
21
|
+
}, [Plugin, options, onInstanceChange]);
|
|
23
22
|
if (status === "failed" && isValidElement(fallback)) {
|
|
24
23
|
return fallback;
|
|
25
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PexipEngagePlugin.js","sourceRoot":"","sources":["../src/PexipEngagePlugin.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"PexipEngagePlugin.js","sourceRoot":"","sources":["../src/PexipEngagePlugin.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAUrE,SAAS,IAAI,KAAI,CAAC;AAClB,MAAM,UAAU,iBAAiB,CAAC,EAChC,SAAS,EACT,QAAQ,EACR,EAAE,EACF,gBAAgB,EAAE,iBAAiB,GAAG,IAAI,EAC1C,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,MAAM,EACuC;IAChD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC3D,MAAM,OAAO,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAClD,MAAM,gBAAgB,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAAC;IAE3D,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,MAAM,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;YACnC,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;YACvE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAE3B,OAAO,GAAG,EAAE;gBACV,QAAQ,CAAC,OAAO,EAAE,CAAC;gBACnB,gBAAgB,CAAC,IAAI,CAAC,CAAC;YACzB,CAAC,CAAC;QACJ,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAExC,IAAI,MAAM,KAAK,QAAQ,IAAI,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,CACL,cACE,SAAS,EAAE,SAAS,0BACC,OAAO,EAC5B,EAAE,EAAE,EAAE,EACN,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,KAAK,YAEX,QAAQ,GACL,CACP,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pexip-engage-public/plugin-react",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.37-canary-20250703080335",
|
|
4
4
|
"description": "React wrapper component for the Pexip Engage Plugin",
|
|
5
5
|
"homepage": "https://github.com/skedify/frontend-mono/tree/develop/apps/booking-plugin/packages/plugin-react#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"deepmerge": "^4.3.1",
|
|
32
|
-
"@pexip-engage-public/plugin": "1.1.
|
|
32
|
+
"@pexip-engage-public/plugin": "1.1.23-canary-20250703080335",
|
|
33
|
+
"@pexip-engage-public/utils": "0.1.46"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@pexip-engage/tsconfig": "0.1.1",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PluginInstance } from "@pexip-engage-public/plugin/instance";
|
|
2
|
-
import {
|
|
2
|
+
import { useEffectEvent } from "@pexip-engage-public/utils";
|
|
3
|
+
import { isValidElement, useEffect, useRef } from "react";
|
|
3
4
|
|
|
4
5
|
import type { PexipEngagePluginContextProps } from "./PexipEngageContext.js";
|
|
5
6
|
import { usePexipEngagePlugin } from "./usePexipEngagePlugin.js";
|
|
@@ -13,11 +14,12 @@ interface PexipEngagePluginProps extends PexipEngagePluginContextProps {
|
|
|
13
14
|
style?: React.CSSProperties;
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
function NOOP() {}
|
|
16
18
|
export function PexipEngagePlugin({
|
|
17
19
|
className,
|
|
18
20
|
fallback,
|
|
19
21
|
id,
|
|
20
|
-
onInstanceChange,
|
|
22
|
+
onInstanceChange: _onInstanceChange = NOOP,
|
|
21
23
|
scriptSrc,
|
|
22
24
|
style,
|
|
23
25
|
children,
|
|
@@ -26,23 +28,19 @@ export function PexipEngagePlugin({
|
|
|
26
28
|
const { Plugin, status } = usePexipEngagePlugin(scriptSrc);
|
|
27
29
|
const options = usePluginConfiguration(config);
|
|
28
30
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
29
|
-
const
|
|
31
|
+
const onInstanceChange = useEffectEvent(_onInstanceChange);
|
|
30
32
|
|
|
31
33
|
useEffect(() => {
|
|
32
34
|
if (Plugin && containerRef.current) {
|
|
33
35
|
const instance = new Plugin(containerRef.current, { config: options });
|
|
34
|
-
|
|
36
|
+
onInstanceChange(instance);
|
|
35
37
|
|
|
36
38
|
return () => {
|
|
37
39
|
instance.dispose();
|
|
38
|
-
|
|
40
|
+
onInstanceChange(null);
|
|
39
41
|
};
|
|
40
42
|
}
|
|
41
|
-
}, [Plugin, options]);
|
|
42
|
-
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
onInstanceChange?.(instance);
|
|
45
|
-
}, [instance, onInstanceChange]);
|
|
43
|
+
}, [Plugin, options, onInstanceChange]);
|
|
46
44
|
|
|
47
45
|
if (status === "failed" && isValidElement(fallback)) {
|
|
48
46
|
return fallback;
|