Skip to content

Commit

Permalink
fix(fix toast props and types): fix toast types and props
Browse files Browse the repository at this point in the history
  • Loading branch information
rileylnapier committed Jul 9, 2024
1 parent a46dd24 commit 69f9cbc
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 50 deletions.
2 changes: 1 addition & 1 deletion packages/client-graphql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trycourier/client-graphql",
"version": "6.2.0",
"version": "6.2.1",
"description": "",
"main": "dist/index.js",
"types": "typings/index.d.ts",
Expand Down
12 changes: 6 additions & 6 deletions packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trycourier/components",
"version": "6.2.0",
"version": "6.2.1",
"private": true,
"description": "Beautiful, easy React toast notifications",
"author": "Courier <support@courier.com>",
Expand All @@ -18,11 +18,11 @@
"license": "MIT",
"dependencies": {
"@trycourier/courier": "^1.3.0",
"@trycourier/react-brand-designer": "^6.2.0",
"@trycourier/react-inbox": "^6.2.0",
"@trycourier/react-preferences": "^6.2.0",
"@trycourier/react-provider": "^6.2.0",
"@trycourier/react-toast": "^6.2.0",
"@trycourier/react-brand-designer": "^6.2.1",
"@trycourier/react-inbox": "^6.2.1",
"@trycourier/react-preferences": "^6.2.1",
"@trycourier/react-provider": "^6.2.1",
"@trycourier/react-toast": "^6.2.1",
"babel-loader": "^8.0.6",
"babel-preset-preact": "^2.0.0",
"camel-case": "^4.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trycourier/core",
"version": "6.2.0",
"version": "6.2.1",
"description": "",
"main": "dist/index.js",
"types": "typings/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/react-brand-designer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trycourier/react-brand-designer",
"version": "6.2.0",
"version": "6.2.1",
"description": "Embeddable brand designer for multi-channel notifications",
"homepage": "https://github.com/trycourier/courier-react/tree/main/packages/react-elements#readme",
"license": "ISC",
Expand Down Expand Up @@ -29,7 +29,7 @@
"url": "https://github.com/trycourier/courier-react/issues"
},
"dependencies": {
"@trycourier/react-elements": "^6.2.0",
"@trycourier/react-elements": "^6.2.1",
"rimraf": "^3.0.2"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-elements/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trycourier/react-elements",
"version": "6.2.0",
"version": "6.2.1",
"description": "Shareable components for each Courier package",
"author": "Drew Youngwerth <drew@youngwerth.com>",
"homepage": "https://github.com/trycourier/courier-react/tree/main/packages/react-elements#readme",
Expand Down
6 changes: 3 additions & 3 deletions packages/react-hooks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trycourier/react-hooks",
"version": "6.2.0",
"version": "6.2.1",
"description": "",
"main": "dist/index.js",
"types": "typings/index.d.ts",
Expand All @@ -20,8 +20,8 @@
"concat-md": "^0.3.5"
},
"dependencies": {
"@trycourier/client-graphql": "^6.2.0",
"@trycourier/core": "^6.2.0",
"@trycourier/client-graphql": "^6.2.1",
"@trycourier/core": "^6.2.1",
"deep-extend": "^0.6.0",
"rimraf": "^3.0.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-inbox-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trycourier/react-inbox-next",
"version": "6.2.0",
"version": "6.2.1",
"description": "",
"private": true,
"main": "dist/index.js",
Expand Down
10 changes: 5 additions & 5 deletions packages/react-inbox/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trycourier/react-inbox",
"version": "6.2.0",
"version": "6.2.1",
"description": "",
"main": "dist/index.js",
"types": "typings/index.d.ts",
Expand All @@ -19,10 +19,10 @@
"dependencies": {
"@fontsource/poppins": "^4.5.9",
"@tippyjs/react": "^4.2.3",
"@trycourier/client-graphql": "^6.2.0",
"@trycourier/react-elements": "^6.2.0",
"@trycourier/react-hooks": "^6.2.0",
"@trycourier/react-preferences": "^6.2.0",
"@trycourier/client-graphql": "^6.2.1",
"@trycourier/react-elements": "^6.2.1",
"@trycourier/react-hooks": "^6.2.1",
"@trycourier/react-preferences": "^6.2.1",
"classnames": "^2.2.6",
"date-fns": "^2.19.0",
"deep-extend": "^0.6.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/react-preferences/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trycourier/react-preferences",
"version": "6.2.0",
"version": "6.2.1",
"main": "dist/index.js",
"types": "typings/index.d.ts",
"scripts": {
Expand All @@ -24,7 +24,7 @@
],
"license": "ISC",
"dependencies": {
"@trycourier/react-hooks": "^6.2.0",
"@trycourier/react-hooks": "^6.2.1",
"date-fns": "^2.19.0",
"react-toggle": "^4.1.2"
}
Expand Down
8 changes: 4 additions & 4 deletions packages/react-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trycourier/react-provider",
"version": "6.2.0",
"version": "6.2.1",
"description": "",
"main": "dist/index.js",
"types": "typings/index.d.ts",
Expand All @@ -15,10 +15,10 @@
},
"license": "ISC",
"dependencies": {
"@trycourier/client-graphql": "^6.2.0",
"@trycourier/core": "^6.2.0",
"@trycourier/client-graphql": "^6.2.1",
"@trycourier/core": "^6.2.1",
"@trycourier/courier-js": "^1.4.2",
"@trycourier/transport": "^6.2.0",
"@trycourier/transport": "^6.2.1",
"buffer": "^6.0.3",
"jwt-decode": "^3.1.2",
"react-use": "^17.2.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/react-toast/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trycourier/react-toast",
"version": "6.2.0",
"version": "6.2.1",
"description": "Beautiful, easy React toast notifications",
"main": "dist/index.js",
"types": "typings/index.d.ts",
Expand All @@ -24,7 +24,7 @@
"concat-md": "^0.3.5"
},
"dependencies": {
"@trycourier/react-hooks": "^6.2.0",
"@trycourier/react-hooks": "^6.2.1",
"deep-extend": "^0.6.0",
"markdown-to-jsx": "7.1.7",
"react-toastify": "^9.1.3",
Expand Down
21 changes: 13 additions & 8 deletions packages/react-toast/src/components/Body/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,31 +62,36 @@ const NonClickableContainer = styled.div(({ theme }) => {
});

const Body: React.FunctionComponent<{
icon: IInboxMessagePreview["icon"] | ReactElement;
markdownOptions?: MarkdownToJSX.Options;
message: IInboxMessagePreview;
markdownOptions?: MarkdownToJSX.Options;
toastProps?: ToastOptions;
onClick?: (event: React.MouseEvent) => void;
preview?: IInboxMessagePreview["preview"] | ReactElement;
icon: IInboxMessagePreview["icon"] | ReactElement;
title?: IInboxMessagePreview["title"] | ReactElement;
toastProps?: ToastOptions;
preview?: IInboxMessagePreview["preview"] | ReactElement;
}> = ({
message,
onClick,
title,
preview,
markdownOptions,
icon,
markdownOptions,
...props
}) => {
const { actions, data, messageId } = message;
const courier = useCourier();
title = message.title ?? title;
preview = message.preview ?? preview;
icon = message.icon ?? icon;

const [, { config }] = useToast();

const courier = useCourier();
const { brand: courierBrand } = courier;
const brand = config?.brand ?? courierBrand;

const { toastProps } = props;
const { brand: courierBrand } = useCourier();
const { markMessageRead, trackClick } = useInbox();

const brand = config?.brand ?? courierBrand;
const { openLinksInNewTab } = config;

const handleOnClickDismiss = useCallback(
Expand Down
4 changes: 3 additions & 1 deletion packages/react-toast/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import { IToastConfig } from "../types";
import { UseToast, ToastCaller } from "./types";

export const useToast: UseToast = () => {
const { toast, clientKey } =
const courier =
useCourier<{
toast?: {
toast: ToastCaller;
config?: IToastConfig;
};
}>();

const { toast, clientKey } = courier ?? {};
const toastCaller = toast?.toast ? toast.toast : () => {};
return [
toastCaller,
Expand Down
14 changes: 7 additions & 7 deletions packages/storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trycourier/storybook",
"version": "6.2.0",
"version": "6.2.1",
"private": true,
"description": "Beautiful, easy React toast notifications",
"author": "Courier <support@courier.com>",
Expand All @@ -23,12 +23,12 @@
"@storybook/addon-links": "^6.5.9",
"@storybook/addon-viewport": "^6.5.9",
"@storybook/react": "^6.5.9",
"@trycourier/components": "^6.2.0",
"@trycourier/react-brand-designer": "^6.2.0",
"@trycourier/react-inbox": "^6.2.0",
"@trycourier/react-preferences": "^6.2.0",
"@trycourier/react-provider": "^6.2.0",
"@trycourier/react-toast": "^6.2.0",
"@trycourier/components": "^6.2.1",
"@trycourier/react-brand-designer": "^6.2.1",
"@trycourier/react-inbox": "^6.2.1",
"@trycourier/react-preferences": "^6.2.1",
"@trycourier/react-provider": "^6.2.1",
"@trycourier/react-toast": "^6.2.1",
"react-frame-component": "^5.2.3",
"react-markdown": "^8.0.1",
"rehype-raw": "^6.1.1",
Expand Down
7 changes: 4 additions & 3 deletions packages/storybook/stories/toast/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const ExampleButton: React.FunctionComponent<{ text?: string }> = ({

const handleOnClick = () => {
toast({
title: "Hello World",
preview: "Hello World",
title: "foo",
});
};

Expand All @@ -41,7 +42,7 @@ export const Props = () => {
const autoCloseTimeout = number("Auto Close Timeout", 5000);

return (
<CourierProvider>
<CourierProvider clientKey="foobar">
<ReactMarkdown>{propsMd}</ReactMarkdown>
<ReactMarkdown>{`## Example`}</ReactMarkdown>
<Toast
Expand Down Expand Up @@ -103,7 +104,7 @@ export const Theme = () => {
null,
2
)}\n\`\`\``}</ReactMarkdown>
<CourierProvider>
<CourierProvider clientKey="foobar">
<ToastBody message={{} as any} title="Title" theme={theme} />
</CourierProvider>
</>
Expand Down
4 changes: 2 additions & 2 deletions packages/transport/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trycourier/transport",
"version": "6.2.0",
"version": "6.2.1",
"description": "",
"main": "dist/index.js",
"types": "typings/index.d.ts",
Expand All @@ -14,7 +14,7 @@
},
"license": "ISC",
"dependencies": {
"@trycourier/core": "^6.2.0",
"@trycourier/core": "^6.2.1",
"jwt-decode": "^3.1.2",
"reconnecting-websocket": "^4.4.0",
"rimraf": "^3.0.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@trycourier/types",
"private": true,
"version": "6.2.0",
"version": "6.2.1",
"main": "index.d.ts",
"types": "index.d.ts",
"scripts": {}
Expand Down

0 comments on commit 69f9cbc

Please sign in to comment.