Skip to content

Commit 37a90d2

Browse files
Added @livechat/developer-ui-react. Upgraded next to v14
1 parent 27fc203 commit 37a90d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3380
-1903
lines changed

.eslintrc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
{
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-
}
2+
"extends": "next/core-web-vitals"
83
}

.gitignore

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/node_modules
55
/.pnp
66
.pnp.js
7+
.yarn/install-state.gz
78

89
# testing
910
/coverage
@@ -23,16 +24,13 @@
2324
npm-debug.log*
2425
yarn-debug.log*
2526
yarn-error.log*
26-
.pnpm-debug.log*
2727

2828
# local env files
29-
.env.local
30-
.env.development.local
31-
.env.test.local
32-
.env.production.local
29+
.env*.local
3330

3431
# vercel
3532
.vercel
3633

3734
# typescript
3835
*.tsbuildinfo
36+
next-env.d.ts

.prettierrc

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { HelpDeskDetailsProvider } from "@livechat/developer-ui-react";
2+
3+
export default function Layout({
4+
children,
5+
}: Readonly<{
6+
children: React.ReactNode;
7+
}>) {
8+
return <HelpDeskDetailsProvider>{children}</HelpDeskDetailsProvider>;
9+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"use client";
2+
3+
import { Card } from "@livechat/design-system-react-components";
4+
import { useApp, useHelpDeskDetails } from "@livechat/developer-ui-react";
5+
6+
export default function Page() {
7+
const { app } = useApp();
8+
const { widget, ticketInfo } = useHelpDeskDetails();
9+
10+
return (
11+
<div>
12+
<h1>Ticket Details widget</h1>
13+
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>
24+
);
25+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { HelpDeskFullscreenProvider } from "@livechat/developer-ui-react";
2+
3+
export default function Layout({
4+
children,
5+
}: Readonly<{
6+
children: React.ReactNode;
7+
}>) {
8+
return <HelpDeskFullscreenProvider>{children}</HelpDeskFullscreenProvider>;
9+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"use client";
2+
3+
import { NumericInput } from "@livechat/design-system-react-components";
4+
import { useApp, useHelpDeskFullscreen } from "@livechat/developer-ui-react";
5+
import { useEffect, useState } from "react";
6+
7+
export default function Page() {
8+
const { app } = useApp();
9+
const { widget } = useHelpDeskFullscreen();
10+
11+
const [notificationsCount, setNotificationsCount] = useState(0);
12+
13+
useEffect(() => {
14+
widget.setNotificationBadge(notificationsCount);
15+
}, [widget, notificationsCount]);
16+
17+
return (
18+
<div>
19+
<h1>Fullscreen widget</h1>
20+
<NumericInput
21+
min={0}
22+
max={99}
23+
id="notifications-count"
24+
value={String(notificationsCount)}
25+
onChange={(value) => setNotificationsCount(Number(value))}
26+
/>
27+
</div>
28+
);
29+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"use client";
2+
3+
import { useApp } from "@livechat/developer-ui-react";
4+
5+
export default function Page() {
6+
const { app } = useApp();
7+
8+
return (
9+
<div>
10+
<h1>Fullscreen</h1>
11+
</div>
12+
);
13+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { LiveChatDetailsProvider } from "@livechat/developer-ui-react";
2+
3+
export default function Layout({
4+
children,
5+
}: Readonly<{
6+
children: React.ReactNode;
7+
}>) {
8+
return <LiveChatDetailsProvider>{children}</LiveChatDetailsProvider>;
9+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"use client";
2+
3+
import { Button, Card } from "@livechat/design-system-react-components";
4+
import { useApp, useLiveChatDetails } from "@livechat/developer-ui-react";
5+
6+
export default function Page() {
7+
const { app } = useApp();
8+
const { widget, customerProfile } = useLiveChatDetails();
9+
10+
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>
34+
);
35+
}

0 commit comments

Comments
 (0)