slack-blocks-to-jsx 0.3.3 → 0.3.4

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/dist/index.d.mts CHANGED
@@ -1097,7 +1097,7 @@ type Hooks = {
1097
1097
  atChannel?: () => ReactNode;
1098
1098
  atEveryone?: () => ReactNode;
1099
1099
  atHere?: () => ReactNode;
1100
- emoji?: (emoji_text: string) => ReactNode;
1100
+ emoji?: (emoji_text: string) => string;
1101
1101
  date?: (data: {
1102
1102
  timestamp: string;
1103
1103
  format: string;
package/dist/index.d.ts CHANGED
@@ -1097,7 +1097,7 @@ type Hooks = {
1097
1097
  atChannel?: () => ReactNode;
1098
1098
  atEveryone?: () => ReactNode;
1099
1099
  atHere?: () => ReactNode;
1100
- emoji?: (emoji_text: string) => ReactNode;
1100
+ emoji?: (emoji_text: string) => string;
1101
1101
  date?: (data: {
1102
1102
  timestamp: string;
1103
1103
  format: string;
package/dist/index.js CHANGED
@@ -2758,7 +2758,7 @@ var TextObject = (props) => {
2758
2758
  const { type, text, emoji, verbatim = false } = props.data;
2759
2759
  const { className = "" } = props;
2760
2760
  const { channels, users, hooks } = useGlobalData();
2761
- let emoji_parsed = type == "mrkdwn" ? parseEmojis(text) : emoji === false ? text : parseEmojis(text);
2761
+ let emoji_parsed = type == "mrkdwn" ? hooks.emoji ? hooks.emoji(text) : parseEmojis(text) : emoji === false ? text : hooks.emoji ? hooks.emoji(text) : parseEmojis(text);
2762
2762
  emoji_parsed = emoji_parsed.replace(/&gt;/g, "> ").replace(/&lt;/g, "<");
2763
2763
  if (type === "plain_text")
2764
2764
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className, children: markdown_parser(emoji_parsed, { markdown: false, users, channels, hooks }) });
package/dist/index.mjs CHANGED
@@ -2725,7 +2725,7 @@ var TextObject = (props) => {
2725
2725
  const { type, text, emoji, verbatim = false } = props.data;
2726
2726
  const { className = "" } = props;
2727
2727
  const { channels, users, hooks } = useGlobalData();
2728
- let emoji_parsed = type == "mrkdwn" ? parseEmojis(text) : emoji === false ? text : parseEmojis(text);
2728
+ let emoji_parsed = type == "mrkdwn" ? hooks.emoji ? hooks.emoji(text) : parseEmojis(text) : emoji === false ? text : hooks.emoji ? hooks.emoji(text) : parseEmojis(text);
2729
2729
  emoji_parsed = emoji_parsed.replace(/&gt;/g, "> ").replace(/&lt;/g, "<");
2730
2730
  if (type === "plain_text")
2731
2731
  return /* @__PURE__ */ jsx17("div", { className, children: markdown_parser(emoji_parsed, { markdown: false, users, channels, hooks }) });
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "repository": "https://github.com/themashcodee/slack-blocks-to-jsx.git",
13
13
  "license": "MIT",
14
- "version": "0.3.3",
14
+ "version": "0.3.4",
15
15
  "main": "dist/index.js",
16
16
  "module": "dist/index.mjs",
17
17
  "types": "dist/index.d.ts",
package/readme.md CHANGED
@@ -66,6 +66,14 @@ This is the main component that renders the entire Slack message. It supports va
66
66
  - `unstyled?`: If true, disables all included styles. Default to false.
67
67
  - `withoutWrapper?`: If true, renders only the Slack blocks without any wrapper. Default to false.
68
68
  - `hooks?`: custom handlers for user, channel, broadcast, usergroup, emoji etc.
69
+ - user?: (input: { id: string; name: string }) = ReactNode
70
+ - channel?: (input: { id: string; name: string }) = ReactNode
71
+ - usergroup?: (input: { id: string; name: string }) = ReactNode
72
+ - atChannel?: () = ReactNode
73
+ - atEveryone?: () = ReactNode
74
+ - atHere?: () = ReactNode
75
+ - emoji?: (text:string) => string
76
+ - date?: (NOT SUPPORTED)
69
77
  - `data?`: optionally pass an array or users, channels and user groups to automatically be replaced with the user, channel and user group mentions.
70
78
  - `showBlockKitDebug?`: Show a link to open the message in the Slack Block Kit Builder, for debugging purposes. Defaults to false.
71
79
 
@@ -81,7 +89,7 @@ Each Slack block type has a corresponding component:
81
89
  - `File` (❌ not supported yet)
82
90
  - `Header` (✅ supported)
83
91
  - `Input` (🟨 partially supported)
84
- - `RichText` (✅ supported)
92
+ - `RichText` (✅ supported, except [date parser](https://github.com/themashcodee/slack-blocks-to-jsx/issues/15))
85
93
  - `Video` (✅ supported)
86
94
 
87
95
  If you want a support of a particular block or element which is not supported yet so please raise a github issue or mail me at codeemash@gmail.com. I will try to push it asap.