chat 4.16.1 → 4.17.0

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.
@@ -499,12 +499,12 @@ interface CardProps {
499
499
  }
500
500
  /** Props for Text component in JSX */
501
501
  interface TextProps {
502
- children?: string | number;
502
+ children?: string | number | (string | number | undefined)[];
503
503
  style?: TextStyle;
504
504
  }
505
505
  /** Props for Button component in JSX */
506
506
  interface ButtonProps {
507
- children?: string | number;
507
+ children?: string | number | (string | number | undefined)[];
508
508
  id: string;
509
509
  label?: string;
510
510
  style?: ButtonStyle;
@@ -512,14 +512,14 @@ interface ButtonProps {
512
512
  }
513
513
  /** Props for LinkButton component in JSX */
514
514
  interface LinkButtonProps {
515
- children?: string | number;
515
+ children?: string | number | (string | number | undefined)[];
516
516
  label?: string;
517
517
  style?: ButtonStyle;
518
518
  url: string;
519
519
  }
520
520
  /** Props for CardLink component in JSX */
521
521
  interface CardLinkProps {
522
- children?: string | number;
522
+ children?: string | number | (string | number | undefined)[];
523
523
  label?: string;
524
524
  url: string;
525
525
  }
@@ -588,7 +588,87 @@ interface CardJSXElement<P extends CardJSXProps = CardJSXProps> {
588
588
  props: P;
589
589
  type: CardComponentFunction;
590
590
  }
591
- type JSXElement = CardJSXElement;
591
+ /** Union of all element types that can be produced by chat components */
592
+ type ChatElement = CardJSXElement | CardElement | TextElement | ButtonElement | LinkButtonElement | LinkElement | ImageElement | DividerElement | ActionsElement | SectionElement | FieldsElement | FieldElement | ModalElement | TextInputElement | SelectElement | SelectOptionElement | RadioSelectElement;
593
+ interface CardComponent {
594
+ (options?: CardOptions): CardElement;
595
+ (props: CardProps): ChatElement;
596
+ }
597
+ interface TextComponent {
598
+ (content: string, options?: {
599
+ style?: TextStyle;
600
+ }): TextElement;
601
+ (props: TextProps): ChatElement;
602
+ }
603
+ interface ButtonComponent {
604
+ (options: ButtonOptions): ButtonElement;
605
+ (props: ButtonProps): ChatElement;
606
+ }
607
+ interface LinkButtonComponent {
608
+ (options: LinkButtonOptions): LinkButtonElement;
609
+ (props: LinkButtonProps): ChatElement;
610
+ }
611
+ interface CardLinkComponent {
612
+ (options: {
613
+ url: string;
614
+ label: string;
615
+ }): LinkElement;
616
+ (props: CardLinkProps): ChatElement;
617
+ }
618
+ interface ImageComponent {
619
+ (options: {
620
+ url: string;
621
+ alt?: string;
622
+ }): ImageElement;
623
+ (props: ImageProps): ChatElement;
624
+ }
625
+ interface FieldComponent {
626
+ (options: {
627
+ label: string;
628
+ value: string;
629
+ }): FieldElement;
630
+ (props: FieldProps): ChatElement;
631
+ }
632
+ interface DividerComponent {
633
+ (): DividerElement;
634
+ (props: DividerProps): ChatElement;
635
+ }
636
+ interface SectionComponent {
637
+ (children: CardChild[]): SectionElement;
638
+ (props: ContainerProps): ChatElement;
639
+ }
640
+ interface ActionsComponent {
641
+ (children: (ButtonElement | LinkButtonElement | SelectElement | RadioSelectElement)[]): ActionsElement;
642
+ (props: ContainerProps): ChatElement;
643
+ }
644
+ interface FieldsComponent {
645
+ (children: FieldElement[]): FieldsElement;
646
+ (props: ContainerProps): ChatElement;
647
+ }
648
+ interface ModalComponent {
649
+ (options: ModalOptions): ModalElement;
650
+ (props: ModalProps): ChatElement;
651
+ }
652
+ interface TextInputComponent {
653
+ (options: TextInputOptions): TextInputElement;
654
+ (props: TextInputProps): ChatElement;
655
+ }
656
+ interface SelectComponent {
657
+ (options: SelectOptions): SelectElement;
658
+ (props: SelectProps): ChatElement;
659
+ }
660
+ interface SelectOptionComponent {
661
+ (options: {
662
+ label: string;
663
+ value: string;
664
+ description?: string;
665
+ }): SelectOptionElement;
666
+ (props: SelectOptionProps): ChatElement;
667
+ }
668
+ interface RadioSelectComponent {
669
+ (options: RadioSelectOptions): RadioSelectElement;
670
+ (props: SelectProps): ChatElement;
671
+ }
592
672
  /**
593
673
  * Type guard to check if props match CardLinkProps
594
674
  */
@@ -627,12 +707,14 @@ declare function toModalElement(jsxElement: unknown): ModalElement | null;
627
707
  */
628
708
  declare function isJSX(value: unknown): boolean;
629
709
  declare namespace JSX {
630
- interface Element extends JSXElement {
631
- }
710
+ type Element = ChatElement;
632
711
  type IntrinsicElements = {};
712
+ interface IntrinsicAttributes {
713
+ key?: string | number;
714
+ }
633
715
  interface ElementChildrenAttribute {
634
716
  children: {};
635
717
  }
636
718
  }
637
719
 
638
- export { type FieldProps as $, Actions as A, Button as B, type CardElement as C, Divider as D, type ImageElement as E, Field as F, type LinkButtonElement as G, type LinkButtonOptions as H, Image as I, type LinkElement as J, type SectionElement as K, LinkButton as L, type ModalElement as M, type TableAlignment as N, type TableElement as O, type TableOptions as P, type TextElement as Q, RadioSelect as R, Section as S, Text as T, type TextStyle as U, type ButtonProps as V, type CardJSXProps as W, type CardLinkProps as X, type CardProps as Y, type ContainerProps as Z, type DividerProps as _, type CardJSXElement as a, type ImageProps as a0, type LinkButtonProps as a1, type TextProps as a2, type ModalChild as a3, type ModalOptions as a4, type RadioSelectElement as a5, type RadioSelectOptions as a6, type SelectElement as a7, type SelectOptionElement as a8, type SelectOptions as a9, type TextInputElement as aa, type TextInputOptions as ab, type ModalProps as ac, type TextInputProps as ad, type SelectProps as ae, type SelectOptionProps as af, isCardLinkProps as ag, jsx as ah, jsxs as ai, jsxDEV as aj, Fragment as ak, JSX as al, type CardChild as b, Card as c, cardChildToFallbackText as d, CardLink as e, Fields as f, fromReactElement as g, isJSX as h, isCardElement as i, Table as j, toModalElement as k, fromReactModalElement as l, isModalElement as m, Modal as n, Select as o, SelectOption as p, TextInput as q, type ActionsElement as r, type ButtonElement as s, toCardElement as t, type ButtonOptions as u, type ButtonStyle as v, type CardOptions as w, type DividerElement as x, type FieldElement as y, type FieldsElement as z };
720
+ export { type DividerProps as $, type ActionsComponent as A, type ButtonComponent as B, type CardElement as C, type DividerComponent as D, type ImageElement as E, type FieldComponent as F, type LinkButtonElement as G, type LinkButtonOptions as H, type ImageComponent as I, type LinkElement as J, type SectionElement as K, type LinkButtonComponent as L, type ModalElement as M, type TableAlignment as N, type TableElement as O, type TableOptions as P, type TextElement as Q, type RadioSelectComponent as R, type SectionComponent as S, type TextComponent as T, type TextStyle as U, type ButtonProps as V, type CardJSXElement as W, type CardJSXProps as X, type CardLinkProps as Y, type CardProps as Z, type ContainerProps as _, type ChatElement as a, type FieldProps as a0, type ImageProps as a1, type LinkButtonProps as a2, type ModalProps as a3, type SelectOptionProps as a4, type SelectProps as a5, type TextInputProps as a6, type TextProps as a7, type ModalChild as a8, type ModalOptions as a9, type RadioSelectElement as aa, type RadioSelectOptions as ab, type SelectElement as ac, type SelectOptionElement as ad, type SelectOptions as ae, type TextInputElement as af, type TextInputOptions as ag, isCardLinkProps as ah, jsx as ai, jsxs as aj, jsxDEV as ak, Fragment as al, JSX as am, type CardChild as b, type CardComponent as c, cardChildToFallbackText as d, type CardLinkComponent as e, type FieldsComponent as f, fromReactElement as g, isJSX as h, isCardElement as i, Table as j, toModalElement as k, fromReactModalElement as l, isModalElement as m, type ModalComponent as n, type SelectComponent as o, type SelectOptionComponent as p, type TextInputComponent as q, type ActionsElement as r, type ButtonElement as s, toCardElement as t, type ButtonOptions as u, type ButtonStyle as v, type CardOptions as w, type DividerElement as x, type FieldElement as y, type FieldsElement as z };
@@ -1 +1 @@
1
- export { V as ButtonProps, a as CardJSXElement, W as CardJSXProps, X as CardLinkProps, Y as CardProps, Z as ContainerProps, _ as DividerProps, $ as FieldProps, ak as Fragment, a0 as ImageProps, al as JSX, a1 as LinkButtonProps, ac as ModalProps, af as SelectOptionProps, ae as SelectProps, ad as TextInputProps, a2 as TextProps, ag as isCardLinkProps, h as isJSX, ah as jsx, aj as jsxDEV, ai as jsxs, t as toCardElement, k as toModalElement } from './jsx-runtime-Bokk9xw5.js';
1
+ export { A as ActionsComponent, B as ButtonComponent, V as ButtonProps, c as CardComponent, W as CardJSXElement, X as CardJSXProps, e as CardLinkComponent, Y as CardLinkProps, Z as CardProps, a as ChatElement, _ as ContainerProps, D as DividerComponent, $ as DividerProps, F as FieldComponent, a0 as FieldProps, f as FieldsComponent, al as Fragment, I as ImageComponent, a1 as ImageProps, am as JSX, L as LinkButtonComponent, a2 as LinkButtonProps, n as ModalComponent, a3 as ModalProps, R as RadioSelectComponent, S as SectionComponent, o as SelectComponent, p as SelectOptionComponent, a4 as SelectOptionProps, a5 as SelectProps, T as TextComponent, q as TextInputComponent, a6 as TextInputProps, a7 as TextProps, ah as isCardLinkProps, h as isJSX, ai as jsx, ak as jsxDEV, aj as jsxs, t as toCardElement, k as toModalElement } from './jsx-runtime-BJENDuXl.js';
@@ -7,7 +7,7 @@ import {
7
7
  jsxs,
8
8
  toCardElement,
9
9
  toModalElement
10
- } from "./chunk-A2J5CUHD.js";
10
+ } from "./chunk-Q32GJ2PR.js";
11
11
  export {
12
12
  Fragment,
13
13
  isCardLinkProps,
@@ -140,12 +140,67 @@ All options are auto-detected from environment variables when not provided.
140
140
  | Option | Required | Description |
141
141
  |--------|----------|-------------|
142
142
  | `appId` | No* | Azure Bot App ID. Auto-detected from `TEAMS_APP_ID` |
143
- | `appPassword` | No* | Azure Bot App Password. Auto-detected from `TEAMS_APP_PASSWORD` |
143
+ | `appPassword` | No** | Azure Bot App Password. Auto-detected from `TEAMS_APP_PASSWORD` |
144
+ | `certificate` | No** | Certificate-based authentication config |
145
+ | `federated` | No** | Federated (workload identity) authentication config |
144
146
  | `appType` | No | `"MultiTenant"` or `"SingleTenant"` (default: `"MultiTenant"`) |
145
147
  | `appTenantId` | For SingleTenant | Azure AD Tenant ID. Auto-detected from `TEAMS_APP_TENANT_ID` |
146
148
  | `logger` | No | Logger instance (defaults to `ConsoleLogger("info")`) |
147
149
 
148
- *`appId` and `appPassword` are required — either via config or env vars.
150
+ \*`appId` is required — either via config or `TEAMS_APP_ID` env var.
151
+
152
+ \*\*Exactly one authentication method is required: `appPassword`, `certificate`, or `federated`.
153
+
154
+ ### Authentication methods
155
+
156
+ The adapter supports three mutually exclusive authentication methods. When no explicit auth is provided, `TEAMS_APP_PASSWORD` is auto-detected from environment variables.
157
+
158
+ #### Client secret (default)
159
+
160
+ The simplest option — provide `appPassword` directly or set `TEAMS_APP_PASSWORD`:
161
+
162
+ ```typescript title="lib/bot.ts"
163
+ createTeamsAdapter({
164
+ appPassword: "your_app_password_here",
165
+ });
166
+ ```
167
+
168
+ #### Certificate
169
+
170
+ Authenticate with a PEM certificate. Provide either `certificateThumbprint` or `x5c` (public certificate for subject-name validation):
171
+
172
+ ```typescript title="lib/bot.ts"
173
+ createTeamsAdapter({
174
+ certificate: {
175
+ certificatePrivateKey: "-----BEGIN RSA PRIVATE KEY-----\n...",
176
+ certificateThumbprint: "AB1234...", // hex-encoded thumbprint
177
+ },
178
+ });
179
+ ```
180
+
181
+ Or with subject-name validation:
182
+
183
+ ```typescript title="lib/bot.ts"
184
+ createTeamsAdapter({
185
+ certificate: {
186
+ certificatePrivateKey: "-----BEGIN RSA PRIVATE KEY-----\n...",
187
+ x5c: "-----BEGIN CERTIFICATE-----\n...",
188
+ },
189
+ });
190
+ ```
191
+
192
+ #### Federated (workload identity)
193
+
194
+ For environments with managed identities (e.g. Azure Kubernetes Service, GitHub Actions):
195
+
196
+ ```typescript title="lib/bot.ts"
197
+ createTeamsAdapter({
198
+ federated: {
199
+ clientId: "your_managed_identity_client_id_here",
200
+ clientAudience: "api://AzureADTokenExchange", // optional, this is the default
201
+ },
202
+ });
203
+ ```
149
204
 
150
205
  ## Environment variables
151
206
 
@@ -212,7 +267,10 @@ Alternatively, configure the bot in Azure to receive all messages.
212
267
 
213
268
  ### "Unauthorized" error
214
269
 
215
- - Verify `TEAMS_APP_ID` and `TEAMS_APP_PASSWORD` are correct
270
+ - Verify `TEAMS_APP_ID` and your chosen auth credential are correct
271
+ - For client secret auth, check that `TEAMS_APP_PASSWORD` is valid
272
+ - For certificate auth, ensure the private key and thumbprint/x5c match what's registered in Azure AD
273
+ - For federated auth, verify the managed identity client ID and audience are correct
216
274
  - For SingleTenant apps, ensure `TEAMS_APP_TENANT_ID` is set
217
275
  - Check that the messaging endpoint URL is correct in Azure
218
276
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chat",
3
- "version": "4.16.1",
3
+ "version": "4.17.0",
4
4
  "description": "Unified chat abstraction for Slack, Teams, Google Chat, and Discord",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",