Skip to content

Commit 490fe53

Browse files
Ugraded @livechat/developer-ui-react
1 parent 37a90d2 commit 490fe53

File tree

21 files changed

+595
-283
lines changed

21 files changed

+595
-283
lines changed

.eslintrc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
{
2-
"extends": "next/core-web-vitals"
2+
"extends": ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"],
3+
"plugins": ["@typescript-eslint"],
4+
"parser": "@typescript-eslint/parser",
5+
"parserOptions": {
6+
"project": "tsconfig.json"
7+
}
38
}

app/(products)/helpdesk/(widgets)/details/layout.tsx

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
"use client";
22

33
import { Card } from "@livechat/design-system-react-components";
4-
import { useApp, useHelpDeskDetails } from "@livechat/developer-ui-react";
4+
import { HelpDeskDetailsProvider } from "@livechat/developer-ui-react";
55

66
export default function Page() {
7-
const { app } = useApp();
8-
const { widget, ticketInfo } = useHelpDeskDetails();
9-
107
return (
11-
<div>
12-
<h1>Ticket Details widget</h1>
8+
<HelpDeskDetailsProvider>
9+
{({ ticketInfo }) => (
10+
<div>
11+
<h1>Ticket Details widget</h1>
1312

14-
<Card title="Ticket info">
15-
{ticketInfo ? (
16-
<ul>
17-
<li>Ticket ID: {ticketInfo.id}</li>
18-
</ul>
19-
) : (
20-
"Loading ticket info ..."
21-
)}
22-
</Card>
23-
</div>
13+
<Card title="Ticket info">
14+
{ticketInfo ? (
15+
<ul>
16+
<li>Ticket ID: {ticketInfo.id}</li>
17+
</ul>
18+
) : (
19+
"Loading ticket info ..."
20+
)}
21+
</Card>
22+
</div>
23+
)}
24+
</HelpDeskDetailsProvider>
2425
);
2526
}

app/(products)/helpdesk/(widgets)/fullscreen/layout.tsx

Lines changed: 0 additions & 9 deletions
This file was deleted.

app/(products)/helpdesk/(widgets)/fullscreen/page.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
"use client";
22

3-
import { NumericInput } from "@livechat/design-system-react-components";
4-
import { useApp, useHelpDeskFullscreen } from "@livechat/developer-ui-react";
53
import { useEffect, useState } from "react";
4+
import { NumericInput } from "@livechat/design-system-react-components";
5+
import {
6+
useApp,
7+
useHelpDeskFullscreen,
8+
HelpDeskFullscreenProvider,
9+
} from "@livechat/developer-ui-react";
610

7-
export default function Page() {
11+
function Widget() {
812
const { app } = useApp();
913
const { widget } = useHelpDeskFullscreen();
10-
1114
const [notificationsCount, setNotificationsCount] = useState(0);
1215

1316
useEffect(() => {
1417
widget.setNotificationBadge(notificationsCount);
1518
}, [widget, notificationsCount]);
1619

20+
console.log(app);
21+
1722
return (
1823
<div>
1924
<h1>Fullscreen widget</h1>
@@ -27,3 +32,11 @@ export default function Page() {
2732
</div>
2833
);
2934
}
35+
36+
export default function Page() {
37+
return (
38+
<HelpDeskFullscreenProvider>
39+
<Widget />
40+
</HelpDeskFullscreenProvider>
41+
);
42+
}

app/(products)/helpdesk/(widgets)/settings/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { useApp } from "@livechat/developer-ui-react";
55
export default function Page() {
66
const { app } = useApp();
77

8+
console.log(app);
9+
810
return (
911
<div>
1012
<h1>Fullscreen</h1>

app/(products)/livechat/(widgets)/details/layout.tsx

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,36 @@
11
"use client";
22

33
import { Button, Card } from "@livechat/design-system-react-components";
4-
import { useApp, useLiveChatDetails } from "@livechat/developer-ui-react";
4+
import { LiveChatDetailsProvider } from "@livechat/developer-ui-react";
55

66
export default function Page() {
7-
const { app } = useApp();
8-
const { widget, customerProfile } = useLiveChatDetails();
9-
107
return (
11-
<div>
12-
<h1>Chat Details widget</h1>
13-
<Button
14-
kind="primary"
15-
type="button"
16-
onClick={() => {
17-
widget.putMessage("New message");
18-
}}
19-
>
20-
Put a message
21-
</Button>
22-
<Card title="Customer profile">
23-
{customerProfile ? (
24-
<ul>
25-
<li>Name: {customerProfile.name}</li>
26-
<li>Country: {customerProfile.geolocation.country}</li>
27-
<li>Timezone: {customerProfile.geolocation.timezone}</li>
28-
</ul>
29-
) : (
30-
"Loading customer profile ..."
31-
)}
32-
</Card>
33-
</div>
8+
<LiveChatDetailsProvider>
9+
{({ widget, customerProfile }) => (
10+
<div>
11+
<h1>Chat Details widget</h1>
12+
<Button
13+
kind="primary"
14+
type="button"
15+
onClick={() => {
16+
widget.putMessage("New message");
17+
}}
18+
>
19+
Put a message
20+
</Button>
21+
<Card title="Customer profile">
22+
{customerProfile ? (
23+
<ul>
24+
<li>Name: {customerProfile.name}</li>
25+
<li>Country: {customerProfile.geolocation.country}</li>
26+
<li>Timezone: {customerProfile.geolocation.timezone}</li>
27+
</ul>
28+
) : (
29+
"Loading customer profile ..."
30+
)}
31+
</Card>
32+
</div>
33+
)}
34+
</LiveChatDetailsProvider>
3435
);
3536
}

app/(products)/livechat/(widgets)/fullscreen/layout.tsx

Lines changed: 0 additions & 9 deletions
This file was deleted.

app/(products)/livechat/(widgets)/fullscreen/page.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
"use client";
22

3-
import { Card, NumericInput } from "@livechat/design-system-react-components";
4-
import { useApp, useLiveChatFullscreen } from "@livechat/developer-ui-react";
53
import { useEffect, useState } from "react";
4+
import { Card, NumericInput } from "@livechat/design-system-react-components";
5+
import {
6+
useApp,
7+
useLiveChatFullscreen,
8+
LiveChatFullscreenProvider,
9+
} from "@livechat/developer-ui-react";
610
import {
711
AgentConfigurationDto,
812
LiveChatConfigurationApiError,
913
} from "@livechat/developer-studio-api";
1014

11-
export default function Page() {
15+
function Widget() {
1216
const { app } = useApp();
1317
const { widget } = useLiveChatFullscreen();
1418

@@ -64,3 +68,11 @@ export default function Page() {
6468
</div>
6569
);
6670
}
71+
72+
export default function Page() {
73+
return (
74+
<LiveChatFullscreenProvider>
75+
<Widget />
76+
</LiveChatFullscreenProvider>
77+
);
78+
}

0 commit comments

Comments
 (0)