@knocklabs/react 0.7.25 → 0.7.27
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 +17 -0
- package/dist/cjs/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.js +1 -1
- package/dist/cjs/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.js.map +1 -1
- package/dist/esm/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.mjs +21 -21
- package/dist/esm/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.mjs.map +1 -1
- package/dist/types/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.d.ts +13 -3
- package/dist/types/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.7.27
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Updated dependencies [fb68ce1]
|
8
|
+
- Updated dependencies [d7e5371]
|
9
|
+
- @knocklabs/client@0.15.2
|
10
|
+
- @knocklabs/react-core@0.7.5
|
11
|
+
|
12
|
+
## 0.7.26
|
13
|
+
|
14
|
+
### Patch Changes
|
15
|
+
|
16
|
+
- 001690a: Rename `msTeamsBotId` prop of `<MsTeamsAuthButton>` component to `graphApiClientId`
|
17
|
+
- Updated dependencies [001690a]
|
18
|
+
- @knocklabs/react-core@0.7.4
|
19
|
+
|
3
20
|
## 0.7.25
|
4
21
|
|
5
22
|
### Patch Changes
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react"),u=require("@knocklabs/react-core"),b=require("../../../core/utils.js");;/* empty css */const l=require("../MsTeamsIcon/MsTeamsIcon.js");;/* empty css */const M=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},e=M(T),w=({redirectUrl:t,onAuthenticationComplete:s,...i})=>{const p="graphApiClientId"in i?i.graphApiClientId:i.msTeamsBotId,{t:n}=u.useTranslations(),d=u.useKnockClient(),{setConnectionStatus:o,connectionStatus:c,setActionLabel:a,actionLabel:m,errorLabel:g}=u.useKnockMsTeamsClient(),{buildMsTeamsAuthUrl:_,disconnectFromMsTeams:h}=u.useMsTeamsAuth(p,t);T.useEffect(()=>{const f=r=>{if(r.origin===d.host)try{r.data==="authComplete"&&o("connected"),r.data==="authFailed"&&o("error"),s==null||s(r.data)}catch{o("error")}};return window.addEventListener("message",f,!1),()=>{window.removeEventListener("message",f)}},[d.host,s,o]);const E=n("msTeamsDisconnect")||null,k=n("msTeamsReconnect")||null;return c==="connecting"||c==="disconnecting"?e.default.createElement("div",{className:"rtk-connect__button rtk-connect__button--loading"},e.default.createElement(l.MsTeamsIcon,{height:"16px",width:"16px"}),e.default.createElement("span",null,n(c==="connecting"?"msTeamsConnecting":"msTeamsDisconnecting"))):c==="error"?e.default.createElement("button",{onClick:()=>b.openPopupWindow(_()),className:"rtk-connect__button rtk-connect__button--error",onMouseEnter:()=>a(k),onMouseLeave:()=>a(null)},e.default.createElement(l.MsTeamsIcon,{height:"16px",width:"16px"}),e.default.createElement("span",{className:"rtk-connect__button__text--error"},m||g||n("msTeamsError"))):c==="disconnected"?e.default.createElement("button",{onClick:()=>b.openPopupWindow(_()),className:"rtk-connect__button rtk-connect__button--disconnected"},e.default.createElement(l.MsTeamsIcon,{height:"16px",width:"16px"}),e.default.createElement("span",null,n("msTeamsConnect"))):e.default.createElement("button",{onClick:h,className:"rtk-connect__button rtk-connect__button--connected",onMouseEnter:()=>a(E),onMouseLeave:()=>a(null)},e.default.createElement(l.MsTeamsIcon,{height:"16px",width:"16px"}),e.default.createElement("span",{className:"rtk-connect__button__text--connected"},m||n("msTeamsConnected")))};exports.MsTeamsAuthButton=w;
|
2
2
|
//# sourceMappingURL=MsTeamsAuthButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MsTeamsAuthButton.js","sources":["../../../../../../src/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.tsx"],"sourcesContent":["import {\n useKnockClient,\n useKnockMsTeamsClient,\n useMsTeamsAuth,\n useTranslations,\n} from \"@knocklabs/react-core\";\nimport { FunctionComponent, useEffect } from \"react\";\n\nimport { openPopupWindow } from \"../../../core/utils\";\nimport \"../../theme.css\";\nimport { MsTeamsIcon } from \"../MsTeamsIcon\";\n\nimport \"./styles.css\";\n\nexport
|
1
|
+
{"version":3,"file":"MsTeamsAuthButton.js","sources":["../../../../../../src/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.tsx"],"sourcesContent":["import {\n useKnockClient,\n useKnockMsTeamsClient,\n useMsTeamsAuth,\n useTranslations,\n} from \"@knocklabs/react-core\";\nimport { FunctionComponent, useEffect } from \"react\";\n\nimport { openPopupWindow } from \"../../../core/utils\";\nimport \"../../theme.css\";\nimport { MsTeamsIcon } from \"../MsTeamsIcon\";\n\nimport \"./styles.css\";\n\nexport type MsTeamsAuthButtonProps = {\n redirectUrl?: string;\n onAuthenticationComplete?: (authenticationResp: string) => void;\n} & (\n | {\n /**\n * The client ID of your Microsoft Graph API-enabled application registered with Microsoft Entra. This should\n * match the \"Graph API client ID\" setting of your Microsoft Teams channel in the Knock dashboard.\n */\n graphApiClientId: string;\n }\n | {\n /**\n * @deprecated Use `graphApiClientId` instead. This field will be removed in a future release.\n */\n msTeamsBotId: string;\n }\n);\n\nexport const MsTeamsAuthButton: FunctionComponent<MsTeamsAuthButtonProps> = ({\n redirectUrl,\n onAuthenticationComplete,\n ...props\n}) => {\n const graphApiClientId =\n \"graphApiClientId\" in props ? props.graphApiClientId : props.msTeamsBotId;\n\n const { t } = useTranslations();\n const knock = useKnockClient();\n\n const {\n setConnectionStatus,\n connectionStatus,\n setActionLabel,\n actionLabel,\n errorLabel,\n } = useKnockMsTeamsClient();\n\n const { buildMsTeamsAuthUrl, disconnectFromMsTeams } = useMsTeamsAuth(\n graphApiClientId,\n redirectUrl,\n );\n\n useEffect(() => {\n const receiveMessage = (event: MessageEvent) => {\n if (event.origin !== knock.host) {\n return;\n }\n\n try {\n if (event.data === \"authComplete\") {\n setConnectionStatus(\"connected\");\n }\n\n if (event.data === \"authFailed\") {\n setConnectionStatus(\"error\");\n }\n\n onAuthenticationComplete?.(event.data);\n } catch (_error) {\n setConnectionStatus(\"error\");\n }\n };\n\n window.addEventListener(\"message\", receiveMessage, false);\n\n // Cleanup the event listener when the component unmounts\n return () => {\n window.removeEventListener(\"message\", receiveMessage);\n };\n }, [knock.host, onAuthenticationComplete, setConnectionStatus]);\n\n const disconnectLabel = t(\"msTeamsDisconnect\") || null;\n const reconnectLabel = t(\"msTeamsReconnect\") || null;\n\n // Loading states\n if (\n connectionStatus === \"connecting\" ||\n connectionStatus === \"disconnecting\"\n ) {\n return (\n <div className=\"rtk-connect__button rtk-connect__button--loading\">\n <MsTeamsIcon height=\"16px\" width=\"16px\" />\n <span>\n {connectionStatus === \"connecting\"\n ? t(\"msTeamsConnecting\")\n : t(\"msTeamsDisconnecting\")}\n </span>\n </div>\n );\n }\n\n // Error state\n if (connectionStatus === \"error\") {\n return (\n <button\n onClick={() => openPopupWindow(buildMsTeamsAuthUrl())}\n className=\"rtk-connect__button rtk-connect__button--error\"\n onMouseEnter={() => setActionLabel(reconnectLabel)}\n onMouseLeave={() => setActionLabel(null)}\n >\n <MsTeamsIcon height=\"16px\" width=\"16px\" />\n <span className=\"rtk-connect__button__text--error\">\n {actionLabel || errorLabel || t(\"msTeamsError\")}\n </span>\n </button>\n );\n }\n\n // Disconnected state\n if (connectionStatus === \"disconnected\") {\n return (\n <button\n onClick={() => openPopupWindow(buildMsTeamsAuthUrl())}\n className=\"rtk-connect__button rtk-connect__button--disconnected\"\n >\n <MsTeamsIcon height=\"16px\" width=\"16px\" />\n <span>{t(\"msTeamsConnect\")}</span>\n </button>\n );\n }\n\n // Connected state\n return (\n <button\n onClick={disconnectFromMsTeams}\n className=\"rtk-connect__button rtk-connect__button--connected\"\n onMouseEnter={() => setActionLabel(disconnectLabel)}\n onMouseLeave={() => setActionLabel(null)}\n >\n <MsTeamsIcon height=\"16px\" width=\"16px\" />\n <span className=\"rtk-connect__button__text--connected\">\n {actionLabel || t(\"msTeamsConnected\")}\n </span>\n </button>\n );\n};\n"],"names":["MsTeamsAuthButton","redirectUrl","onAuthenticationComplete","props","graphApiClientId","msTeamsBotId","t","useTranslations","knock","useKnockClient","setConnectionStatus","connectionStatus","setActionLabel","actionLabel","errorLabel","useKnockMsTeamsClient","buildMsTeamsAuthUrl","disconnectFromMsTeams","useMsTeamsAuth","useEffect","receiveMessage","event","origin","host","data","addEventListener","removeEventListener","disconnectLabel","reconnectLabel","React","MsTeamsIcon","openPopupWindow"],"mappings":"+VAiCaA,EAA+DA,CAAC,CAC3EC,YAAAA,EACAC,yBAAAA,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EACJ,qBAAsBD,EAAQA,EAAMC,iBAAmBD,EAAME,aAEzD,CAAEC,EAAAA,GAAMC,kBAAgB,EACxBC,EAAQC,EAAAA,eAAe,EAEvB,CACJC,oBAAAA,EACAC,iBAAAA,EACAC,eAAAA,EACAC,YAAAA,EACAC,WAAAA,GACEC,wBAAsB,EAEpB,CAAEC,oBAAAA,EAAqBC,sBAAAA,CAAAA,EAA0BC,EACrDd,eAAAA,EACAH,CACF,EAEAkB,EAAAA,UAAU,IAAM,CACRC,MAAAA,EAAkBC,GAAwB,CAC1CA,GAAAA,EAAMC,SAAWd,EAAMe,KAIvB,GAAA,CACEF,EAAMG,OAAS,gBACjBd,EAAoB,WAAW,EAG7BW,EAAMG,OAAS,cACjBd,EAAoB,OAAO,EAG7BR,GAAAA,MAAAA,EAA2BmB,EAAMG,WAClB,CACfd,EAAoB,OAAO,CAAA,CAE/B,EAEOe,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,kBAAkB,CACtC,CACF,CAEJ"}
|
@@ -1,28 +1,28 @@
|
|
1
|
-
import e, { useEffect as
|
2
|
-
import { useTranslations as
|
3
|
-
import { openPopupWindow as
|
1
|
+
import e, { useEffect as T } from "react";
|
2
|
+
import { useTranslations as f, useKnockClient as x, useKnockMsTeamsClient as M, useMsTeamsAuth as w } from "@knocklabs/react-core";
|
3
|
+
import { openPopupWindow as _ } from "../../../core/utils.mjs";
|
4
4
|
/* empty css */
|
5
5
|
import { MsTeamsIcon as a } from "../MsTeamsIcon/MsTeamsIcon.mjs";
|
6
6
|
/* empty css */
|
7
|
-
const
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
const D = ({
|
8
|
+
redirectUrl: p,
|
9
|
+
onAuthenticationComplete: c,
|
10
|
+
...i
|
11
11
|
}) => {
|
12
|
-
const {
|
12
|
+
const b = "graphApiClientId" in i ? i.graphApiClientId : i.msTeamsBotId, {
|
13
13
|
t
|
14
|
-
} =
|
14
|
+
} = f(), m = x(), {
|
15
15
|
setConnectionStatus: o,
|
16
16
|
connectionStatus: n,
|
17
17
|
setActionLabel: s,
|
18
|
-
actionLabel:
|
19
|
-
errorLabel:
|
20
|
-
} =
|
21
|
-
buildMsTeamsAuthUrl:
|
18
|
+
actionLabel: l,
|
19
|
+
errorLabel: h
|
20
|
+
} = M(), {
|
21
|
+
buildMsTeamsAuthUrl: u,
|
22
22
|
disconnectFromMsTeams: E
|
23
|
-
} =
|
24
|
-
|
25
|
-
const
|
23
|
+
} = w(b, p);
|
24
|
+
T(() => {
|
25
|
+
const d = (r) => {
|
26
26
|
if (r.origin === m.host)
|
27
27
|
try {
|
28
28
|
r.data === "authComplete" && o("connected"), r.data === "authFailed" && o("error"), c == null || c(r.data);
|
@@ -30,14 +30,14 @@ const K = ({
|
|
30
30
|
o("error");
|
31
31
|
}
|
32
32
|
};
|
33
|
-
return window.addEventListener("message",
|
34
|
-
window.removeEventListener("message",
|
33
|
+
return window.addEventListener("message", d, !1), () => {
|
34
|
+
window.removeEventListener("message", d);
|
35
35
|
};
|
36
36
|
}, [m.host, c, o]);
|
37
|
-
const
|
38
|
-
return n === "connecting" || n === "disconnecting" ? /* @__PURE__ */ e.createElement("div", { className: "rtk-connect__button rtk-connect__button--loading" }, /* @__PURE__ */ e.createElement(a, { height: "16px", width: "16px" }), /* @__PURE__ */ e.createElement("span", null, t(n === "connecting" ? "msTeamsConnecting" : "msTeamsDisconnecting"))) : n === "error" ? /* @__PURE__ */ e.createElement("button", { onClick: () =>
|
37
|
+
const g = t("msTeamsDisconnect") || null, k = t("msTeamsReconnect") || null;
|
38
|
+
return n === "connecting" || n === "disconnecting" ? /* @__PURE__ */ e.createElement("div", { className: "rtk-connect__button rtk-connect__button--loading" }, /* @__PURE__ */ e.createElement(a, { height: "16px", width: "16px" }), /* @__PURE__ */ e.createElement("span", null, t(n === "connecting" ? "msTeamsConnecting" : "msTeamsDisconnecting"))) : n === "error" ? /* @__PURE__ */ e.createElement("button", { onClick: () => _(u()), className: "rtk-connect__button rtk-connect__button--error", onMouseEnter: () => s(k), onMouseLeave: () => s(null) }, /* @__PURE__ */ e.createElement(a, { height: "16px", width: "16px" }), /* @__PURE__ */ e.createElement("span", { className: "rtk-connect__button__text--error" }, l || h || t("msTeamsError"))) : n === "disconnected" ? /* @__PURE__ */ e.createElement("button", { onClick: () => _(u()), className: "rtk-connect__button rtk-connect__button--disconnected" }, /* @__PURE__ */ e.createElement(a, { height: "16px", width: "16px" }), /* @__PURE__ */ e.createElement("span", null, t("msTeamsConnect"))) : /* @__PURE__ */ e.createElement("button", { onClick: E, className: "rtk-connect__button rtk-connect__button--connected", onMouseEnter: () => s(g), onMouseLeave: () => s(null) }, /* @__PURE__ */ e.createElement(a, { height: "16px", width: "16px" }), /* @__PURE__ */ e.createElement("span", { className: "rtk-connect__button__text--connected" }, l || t("msTeamsConnected")));
|
39
39
|
};
|
40
40
|
export {
|
41
|
-
|
41
|
+
D as MsTeamsAuthButton
|
42
42
|
};
|
43
43
|
//# sourceMappingURL=MsTeamsAuthButton.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MsTeamsAuthButton.mjs","sources":["../../../../../../src/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.tsx"],"sourcesContent":["import {\n useKnockClient,\n useKnockMsTeamsClient,\n useMsTeamsAuth,\n useTranslations,\n} from \"@knocklabs/react-core\";\nimport { FunctionComponent, useEffect } from \"react\";\n\nimport { openPopupWindow } from \"../../../core/utils\";\nimport \"../../theme.css\";\nimport { MsTeamsIcon } from \"../MsTeamsIcon\";\n\nimport \"./styles.css\";\n\nexport
|
1
|
+
{"version":3,"file":"MsTeamsAuthButton.mjs","sources":["../../../../../../src/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.tsx"],"sourcesContent":["import {\n useKnockClient,\n useKnockMsTeamsClient,\n useMsTeamsAuth,\n useTranslations,\n} from \"@knocklabs/react-core\";\nimport { FunctionComponent, useEffect } from \"react\";\n\nimport { openPopupWindow } from \"../../../core/utils\";\nimport \"../../theme.css\";\nimport { MsTeamsIcon } from \"../MsTeamsIcon\";\n\nimport \"./styles.css\";\n\nexport type MsTeamsAuthButtonProps = {\n redirectUrl?: string;\n onAuthenticationComplete?: (authenticationResp: string) => void;\n} & (\n | {\n /**\n * The client ID of your Microsoft Graph API-enabled application registered with Microsoft Entra. This should\n * match the \"Graph API client ID\" setting of your Microsoft Teams channel in the Knock dashboard.\n */\n graphApiClientId: string;\n }\n | {\n /**\n * @deprecated Use `graphApiClientId` instead. This field will be removed in a future release.\n */\n msTeamsBotId: string;\n }\n);\n\nexport const MsTeamsAuthButton: FunctionComponent<MsTeamsAuthButtonProps> = ({\n redirectUrl,\n onAuthenticationComplete,\n ...props\n}) => {\n const graphApiClientId =\n \"graphApiClientId\" in props ? props.graphApiClientId : props.msTeamsBotId;\n\n const { t } = useTranslations();\n const knock = useKnockClient();\n\n const {\n setConnectionStatus,\n connectionStatus,\n setActionLabel,\n actionLabel,\n errorLabel,\n } = useKnockMsTeamsClient();\n\n const { buildMsTeamsAuthUrl, disconnectFromMsTeams } = useMsTeamsAuth(\n graphApiClientId,\n redirectUrl,\n );\n\n useEffect(() => {\n const receiveMessage = (event: MessageEvent) => {\n if (event.origin !== knock.host) {\n return;\n }\n\n try {\n if (event.data === \"authComplete\") {\n setConnectionStatus(\"connected\");\n }\n\n if (event.data === \"authFailed\") {\n setConnectionStatus(\"error\");\n }\n\n onAuthenticationComplete?.(event.data);\n } catch (_error) {\n setConnectionStatus(\"error\");\n }\n };\n\n window.addEventListener(\"message\", receiveMessage, false);\n\n // Cleanup the event listener when the component unmounts\n return () => {\n window.removeEventListener(\"message\", receiveMessage);\n };\n }, [knock.host, onAuthenticationComplete, setConnectionStatus]);\n\n const disconnectLabel = t(\"msTeamsDisconnect\") || null;\n const reconnectLabel = t(\"msTeamsReconnect\") || null;\n\n // Loading states\n if (\n connectionStatus === \"connecting\" ||\n connectionStatus === \"disconnecting\"\n ) {\n return (\n <div className=\"rtk-connect__button rtk-connect__button--loading\">\n <MsTeamsIcon height=\"16px\" width=\"16px\" />\n <span>\n {connectionStatus === \"connecting\"\n ? t(\"msTeamsConnecting\")\n : t(\"msTeamsDisconnecting\")}\n </span>\n </div>\n );\n }\n\n // Error state\n if (connectionStatus === \"error\") {\n return (\n <button\n onClick={() => openPopupWindow(buildMsTeamsAuthUrl())}\n className=\"rtk-connect__button rtk-connect__button--error\"\n onMouseEnter={() => setActionLabel(reconnectLabel)}\n onMouseLeave={() => setActionLabel(null)}\n >\n <MsTeamsIcon height=\"16px\" width=\"16px\" />\n <span className=\"rtk-connect__button__text--error\">\n {actionLabel || errorLabel || t(\"msTeamsError\")}\n </span>\n </button>\n );\n }\n\n // Disconnected state\n if (connectionStatus === \"disconnected\") {\n return (\n <button\n onClick={() => openPopupWindow(buildMsTeamsAuthUrl())}\n className=\"rtk-connect__button rtk-connect__button--disconnected\"\n >\n <MsTeamsIcon height=\"16px\" width=\"16px\" />\n <span>{t(\"msTeamsConnect\")}</span>\n </button>\n );\n }\n\n // Connected state\n return (\n <button\n onClick={disconnectFromMsTeams}\n className=\"rtk-connect__button rtk-connect__button--connected\"\n onMouseEnter={() => setActionLabel(disconnectLabel)}\n onMouseLeave={() => setActionLabel(null)}\n >\n <MsTeamsIcon height=\"16px\" width=\"16px\" />\n <span className=\"rtk-connect__button__text--connected\">\n {actionLabel || t(\"msTeamsConnected\")}\n </span>\n </button>\n );\n};\n"],"names":["MsTeamsAuthButton","redirectUrl","onAuthenticationComplete","props","graphApiClientId","msTeamsBotId","t","useTranslations","knock","useKnockClient","setConnectionStatus","connectionStatus","setActionLabel","actionLabel","errorLabel","useKnockMsTeamsClient","buildMsTeamsAuthUrl","disconnectFromMsTeams","useMsTeamsAuth","useEffect","receiveMessage","event","origin","host","data","addEventListener","removeEventListener","disconnectLabel","reconnectLabel","React","MsTeamsIcon","openPopupWindow"],"mappings":";;;;;;AAiCO,MAAMA,IAA+DA,CAAC;AAAA,EAC3EC,aAAAA;AAAAA,EACAC,0BAAAA;AAAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAMC,IACJ,sBAAsBD,IAAQA,EAAMC,mBAAmBD,EAAME,cAEzD;AAAA,IAAEC;AAAAA,MAAMC,EAAgB,GACxBC,IAAQC,EAAe,GAEvB;AAAA,IACJC,qBAAAA;AAAAA,IACAC,kBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAC,YAAAA;AAAAA,MACEC,EAAsB,GAEpB;AAAA,IAAEC,qBAAAA;AAAAA,IAAqBC,uBAAAA;AAAAA,EAAAA,IAA0BC,EACrDd,GACAH,CACF;AAEAkB,EAAAA,EAAU,MAAM;AACRC,UAAAA,IAAiBA,CAACC,MAAwB;AAC1CA,UAAAA,EAAMC,WAAWd,EAAMe;AAIvB,YAAA;AACEF,UAAAA,EAAMG,SAAS,kBACjBd,EAAoB,WAAW,GAG7BW,EAAMG,SAAS,gBACjBd,EAAoB,OAA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GAAY,EAAA,QAAO,QAAO,OAAM,OAAM,CAAA,GACvCD,gBAAAA,EAAA,cAAC,QAAK,EAAA,WAAU,uCACbhB,GAAAA,KAAeP,EAAE,kBAAkB,CACtC,CACF;AAEJ;"}
|
@@ -1,8 +1,18 @@
|
|
1
1
|
import { FunctionComponent } from 'react';
|
2
|
-
export
|
3
|
-
msTeamsBotId: string;
|
2
|
+
export type MsTeamsAuthButtonProps = {
|
4
3
|
redirectUrl?: string;
|
5
4
|
onAuthenticationComplete?: (authenticationResp: string) => void;
|
6
|
-
}
|
5
|
+
} & ({
|
6
|
+
/**
|
7
|
+
* The client ID of your Microsoft Graph API-enabled application registered with Microsoft Entra. This should
|
8
|
+
* match the "Graph API client ID" setting of your Microsoft Teams channel in the Knock dashboard.
|
9
|
+
*/
|
10
|
+
graphApiClientId: string;
|
11
|
+
} | {
|
12
|
+
/**
|
13
|
+
* @deprecated Use `graphApiClientId` instead. This field will be removed in a future release.
|
14
|
+
*/
|
15
|
+
msTeamsBotId: string;
|
16
|
+
});
|
7
17
|
export declare const MsTeamsAuthButton: FunctionComponent<MsTeamsAuthButtonProps>;
|
8
18
|
//# sourceMappingURL=MsTeamsAuthButton.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MsTeamsAuthButton.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAa,MAAM,OAAO,CAAC;AAGrD,OAAO,iBAAiB,CAAC;AAGzB,OAAO,cAAc,CAAC;AAEtB,MAAM,
|
1
|
+
{"version":3,"file":"MsTeamsAuthButton.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAa,MAAM,OAAO,CAAC;AAGrD,OAAO,iBAAiB,CAAC;AAGzB,OAAO,cAAc,CAAC;AAEtB,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wBAAwB,CAAC,EAAE,CAAC,kBAAkB,EAAE,MAAM,KAAK,IAAI,CAAC;CACjE,GAAG,CACA;IACE;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B,GACD;IACE;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB,CACJ,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,sBAAsB,CAqHvE,CAAC"}
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@knocklabs/react",
|
3
3
|
"description": "A set of React components to build notification experiences powered by Knock",
|
4
4
|
"author": "@knocklabs",
|
5
|
-
"version": "0.7.
|
5
|
+
"version": "0.7.27",
|
6
6
|
"license": "MIT",
|
7
7
|
"main": "dist/cjs/index.js",
|
8
8
|
"module": "dist/esm/index.mjs",
|
@@ -50,8 +50,8 @@
|
|
50
50
|
"react-dom": "^16.11.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
51
51
|
},
|
52
52
|
"dependencies": {
|
53
|
-
"@knocklabs/client": "^0.15.
|
54
|
-
"@knocklabs/react-core": "^0.7.
|
53
|
+
"@knocklabs/client": "^0.15.2",
|
54
|
+
"@knocklabs/react-core": "^0.7.5",
|
55
55
|
"@popperjs/core": "^2.11.8",
|
56
56
|
"@radix-ui/react-dialog": "^1.1.14",
|
57
57
|
"@telegraph/combobox": "^0.1.1",
|