@atlaskit/smart-card 20.0.2 → 20.0.3

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/report.api.md CHANGED
@@ -33,21 +33,63 @@ import { WithContextProps } from '@atlaskit/analytics-next';
33
33
  import { WithIntlProps } from 'react-intl-next';
34
34
  import { WrappedComponentProps } from 'react-intl-next';
35
35
 
36
- // @public (undocumented)
37
- export type ActionItem = NamedActionItem | CustomActionItem;
36
+ export declare type ActionItem = NamedActionItem | CustomActionItem;
38
37
 
39
- // @public
40
- export enum ActionName {
41
- // (undocumented)
42
- CustomAction = 'CustomAction',
43
- // (undocumented)
38
+ /**
39
+ * Flexible UI action (button)
40
+ */
41
+ export declare enum ActionName {
44
42
  DeleteAction = 'DeleteAction',
45
- // (undocumented)
46
43
  EditAction = 'EditAction',
44
+ CustomAction = 'CustomAction',
47
45
  }
48
46
 
49
- // @public (undocumented)
50
- export type AnalyticsAction =
47
+ declare type ActionProps = {
48
+ /**
49
+ * Determines the size of the Action. Corresponds to an Action appearance.
50
+ */
51
+ size?: SmartLinkSize;
52
+ /**
53
+ * Determines the text content of the Action.
54
+ */
55
+ content?: React.ReactNode;
56
+ /**
57
+ * Determines the appearance of the action. Corresponds to the Atlaskit action appearance.
58
+ */
59
+ appearance?: Appearance;
60
+ /**
61
+ * Determines the onClick behaviour of the Action.
62
+ */
63
+ onClick: () => any;
64
+ /**
65
+ * Determines the icon rendered within the Action.
66
+ */
67
+ icon?: ReactChild;
68
+ /**
69
+ * Determines where the icon should be rendered if text is provided.
70
+ */
71
+ iconPosition?: 'before' | 'after';
72
+ /**
73
+ * Determines the tooltip message when hovering over the Action.
74
+ */
75
+ tooltipMessage?: React.ReactNode;
76
+ /**
77
+ * Used to determine whether the Action is in a Dropdown.
78
+ */
79
+ asDropDownItem?: boolean;
80
+ /**
81
+ * Additional CSS properties on the Action.
82
+ */
83
+ overrideCss?: SerializedStyles;
84
+ /**
85
+ * A `testId` prop is provided for specified elements, which is a unique
86
+ * string that appears as a data attribute `data-testid` in the rendered code,
87
+ * serving as a hook for automated tests
88
+ */
89
+ testId?: string;
90
+ };
91
+
92
+ export declare type AnalyticsAction =
51
93
  | 'resolved'
52
94
  | 'unresolved'
53
95
  | 'connectSucceeded'
@@ -63,8 +105,7 @@ export type AnalyticsAction =
63
105
  | 'dismissed'
64
106
  | 'created';
65
107
 
66
- // @public (undocumented)
67
- export type AnalyticsActionSubject =
108
+ export declare type AnalyticsActionSubject =
68
109
  | 'smartLink'
69
110
  | 'smartLinkAction'
70
111
  | 'applicationAccount'
@@ -72,11 +113,11 @@ export type AnalyticsActionSubject =
72
113
  | 'consentModal'
73
114
  | 'hoverCard';
74
115
 
75
- // @public (undocumented)
76
- export type AnalyticsHandler = (event: AnalyticsPayload) => void;
116
+ declare type AnalyticsFacade = ReturnType<typeof useSmartLinkAnalytics>;
77
117
 
78
- // @public (undocumented)
79
- export type AnalyticsPayload = GasPayload & {
118
+ export declare type AnalyticsHandler = (event: AnalyticsPayload) => void;
119
+
120
+ export declare type AnalyticsPayload = GasPayload & {
80
121
  action?: AnalyticsAction;
81
122
  actionSubject: AnalyticsActionSubject;
82
123
  attributes: GasPayload['attributes'] & {
@@ -84,47 +125,118 @@ export type AnalyticsPayload = GasPayload & {
84
125
  };
85
126
  };
86
127
 
128
+ declare type AnchorTarget = '_blank' | '_self' | '_top' | '_parent';
129
+
87
130
  export { APIError };
88
131
 
132
+ /**
133
+ * Represents the props available for an AuthorGroup element.
134
+ * @see AuthorGroup
135
+ */
136
+ declare type AuthorGroup = {
137
+ name: ElementName.AuthorGroup;
138
+ };
139
+
140
+ /**
141
+ * Used to represent an Action when passing props into Flexible UI.
142
+ */
143
+ declare type BaseActionItem = {
144
+ /**
145
+ * Determines whether the action should hide the text content of the button.
146
+ */
147
+ hideContent?: boolean;
148
+ /**
149
+ * Determines whether the action should hide the icon inside the button.
150
+ */
151
+ hideIcon?: boolean;
152
+ /**
153
+ * Determines the text and icon representation of the action, with exception
154
+ * to CustomAction.
155
+ */
156
+ name: ActionName;
157
+ /**
158
+ * Determines the onClick behaviour of the action.
159
+ */
160
+ onClick: () => any;
161
+ /**
162
+ * Additional CSS properties on the Action.
163
+ */
164
+ overrideCss?: SerializedStyles;
165
+ /**
166
+ * Determines the size of the Action. Corresponds to an Action appearance.
167
+ */
168
+ size?: SmartLinkSize;
169
+ /**
170
+ * A `testId` prop is provided for specified elements, which is a unique
171
+ * string that appears as a data attribute `data-testid` in the rendered code,
172
+ * serving as a hook for automated tests
173
+ */
174
+ testId?: string;
175
+ };
176
+
89
177
  export { BlockCardAdf };
90
178
 
91
- // @public (undocumented)
92
- export const blockCardContentClassName = 'block-card-content';
179
+ export declare const blockCardContentClassName = 'block-card-content';
93
180
 
94
- // @public (undocumented)
95
- export const blockCardContentHeaderClassName = 'block-card-content-header';
181
+ export declare const blockCardContentHeaderClassName =
182
+ 'block-card-content-header';
96
183
 
97
- // @public (undocumented)
98
- export const blockCardContentHeaderNameClassName =
184
+ export declare const blockCardContentHeaderNameClassName =
99
185
  'block-card-content-header-name';
100
186
 
101
- // @public (undocumented)
102
- export const blockCardErroredViewClassName = 'block-card-errored-view';
187
+ export declare const blockCardErroredViewClassName = 'block-card-errored-view';
103
188
 
104
- // @public (undocumented)
105
- export const blockCardForbiddenViewClassName = 'block-card-forbidden-view';
189
+ export declare const blockCardForbiddenViewClassName =
190
+ 'block-card-forbidden-view';
106
191
 
107
- // @public (undocumented)
108
- export const blockCardForbiddenViewLinkClassName =
192
+ export declare const blockCardForbiddenViewLinkClassName =
109
193
  'block-card-forbidden-view-link';
110
194
 
111
- // @public (undocumented)
112
- export const blockCardIconImageClassName = 'block-card-icon-image';
195
+ export declare const blockCardIconImageClassName = 'block-card-icon-image';
113
196
 
114
- // @public (undocumented)
115
- export const blockCardNotFoundViewClassName = 'block-card-not-found-view';
197
+ export declare const blockCardNotFoundViewClassName =
198
+ 'block-card-not-found-view';
116
199
 
117
- // @public (undocumented)
118
- export const blockCardResolvedViewByClassName = 'block-card-resolved-view-by';
200
+ export declare const blockCardResolvedViewByClassName =
201
+ 'block-card-resolved-view-by';
119
202
 
120
- // @public (undocumented)
121
- export const blockCardResolvedViewClassName = 'block-card-resolved-view';
203
+ export declare const blockCardResolvedViewClassName =
204
+ 'block-card-resolved-view';
122
205
 
123
- // @public (undocumented)
124
- export const blockCardResolvingViewClassName = 'block-card-resolving-view';
206
+ export declare const blockCardResolvingViewClassName =
207
+ 'block-card-resolving-view';
125
208
 
126
- // @public (undocumented)
127
- export const Card: React_2.ForwardRefExoticComponent<
209
+ declare type BlockProps = {
210
+ /**
211
+ * The direction that the block should arrange it's elements. Can be vertical
212
+ * or horizontal. Default is horizontal.
213
+ * @internal
214
+ */
215
+ direction?: SmartLinkDirection;
216
+ /**
217
+ * Any additional CSS properties to apply to the block.
218
+ */
219
+ overrideCss?: SerializedStyles;
220
+ /**
221
+ * The size of the block and the size that the underlying elements should
222
+ * default to.
223
+ */
224
+ size?: SmartLinkSize;
225
+ /**
226
+ * The status of the Smart Link. Used to conditionally render different blocks
227
+ * when Smart Link is in different states.
228
+ * @internal
229
+ */
230
+ status?: SmartLinkStatus;
231
+ /**
232
+ * A `testId` prop is provided for specified elements, which is a unique
233
+ * string that appears as a data attribute `data-testid` in the rendered code,
234
+ * serving as a hook for automated tests
235
+ */
236
+ testId?: string;
237
+ };
238
+
239
+ export declare const Card: React_2.ForwardRefExoticComponent<
128
240
  Pick<
129
241
  Omit<
130
242
  React_2.PropsWithChildren<
@@ -168,178 +280,458 @@ export { CardAppearance };
168
280
 
169
281
  export { CardContext };
170
282
 
283
+ declare type CardInnerAppearance = CardAppearance | 'preview' | 'flexible';
284
+
171
285
  export { CardPlatform };
172
286
 
173
- // @public (undocumented)
174
- export interface CardProps extends WithAnalyticsEventsProps {
175
- // (undocumented)
176
- analyticsEvents?: AnalyticsFacade;
177
- // (undocumented)
287
+ export declare interface CardProps extends WithAnalyticsEventsProps {
178
288
  appearance: CardAppearance;
179
- // (undocumented)
180
- children?: React.ReactNode;
181
- // (undocumented)
182
- container?: HTMLElement;
183
- // (undocumented)
184
- data?: any;
185
- // (undocumented)
186
- embedIframeRef?: React.Ref<HTMLIFrameElement>;
187
- // (undocumented)
188
289
  id?: string;
189
- // (undocumented)
190
- importer?: (target: any) => void;
191
- // (undocumented)
192
- inheritDimensions?: boolean;
193
- // (undocumented)
194
- inlinePreloaderStyle?: InlinePreloaderStyle;
195
- // (undocumented)
196
- isFrameVisible?: boolean;
197
- // (undocumented)
290
+ platform?: CardPlatform;
198
291
  isSelected?: boolean;
199
- // (undocumented)
292
+ isFrameVisible?: boolean;
200
293
  onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
201
- // (undocumented)
202
- onResolve?: OnResolveCallback;
203
- // (undocumented)
204
- placeholder?: string;
205
- // (undocumented)
206
- platform?: CardPlatform;
207
- // (undocumented)
208
- showActions?: boolean;
209
- // (undocumented)
210
- showHoverPreview?: boolean;
211
- // (undocumented)
294
+ importer?: (target: any) => void;
295
+ container?: HTMLElement;
296
+ data?: any;
297
+ url?: string;
212
298
  testId?: string;
213
- // (undocumented)
299
+ showActions?: boolean;
300
+ onResolve?: OnResolveCallback;
301
+ inheritDimensions?: boolean;
302
+ embedIframeRef?: React.Ref<HTMLIFrameElement>;
303
+ inlinePreloaderStyle?: InlinePreloaderStyle;
214
304
  ui?: FlexibleUiOptions;
215
- // (undocumented)
216
- url?: string;
305
+ children?: React.ReactNode;
306
+ showHoverPreview?: boolean;
307
+ analyticsEvents?: AnalyticsFacade;
308
+ placeholder?: string;
217
309
  }
218
310
 
219
311
  export { CardType };
220
312
 
221
313
  export { Client };
222
314
 
223
- // @public (undocumented)
224
- export const contentFooterClassName = 'smart-link-content-footer';
315
+ /**
316
+ * Represents the props available for an CollaboratorGroup element.
317
+ * @see CollaboratorGroup
318
+ */
319
+ declare type CollaboratorGroup = {
320
+ name: ElementName.CollaboratorGroup;
321
+ };
322
+
323
+ /**
324
+ * Represents the props available for an CommentCount element.
325
+ * @see CommentCount
326
+ */
327
+ declare type CommentCount = {
328
+ name: ElementName.CommentCount;
329
+ };
330
+
331
+ export declare const contentFooterClassName = 'smart-link-content-footer';
332
+
333
+ /**
334
+ * Represents the props available for an CreatedBy element.
335
+ * @see CreatedBy
336
+ */
337
+ declare type CreatedBy = {
338
+ name: ElementName.CreatedBy;
339
+ };
340
+
341
+ /**
342
+ * Represents the props available for an CreatedOn element.
343
+ * @see CreatedOn
344
+ */
345
+ declare type CreatedOn = {
346
+ name: ElementName.CreatedOn;
347
+ /**
348
+ * A string which will be displayed before the specified element.
349
+ */
350
+ text?: string;
351
+ };
352
+
353
+ /**
354
+ * This represents an action where either Icon or label must be provided.
355
+ */
356
+ declare type CustomActionItem = BaseActionItem & {
357
+ name: ActionName.CustomAction;
358
+ } & (
359
+ | (Required<Pick<ActionProps, 'icon' | 'iconPosition'>> &
360
+ Pick<ActionProps, 'content'>)
361
+ | ((Required<Pick<ActionProps, 'content'>> &
362
+ Pick<ActionProps, 'icon' | 'iconPosition'>) &
363
+ Pick<ActionProps, 'tooltipMessage'>)
364
+ );
365
+
366
+ declare type DestinationProduct =
367
+ | 'jira'
368
+ | 'confluence'
369
+ | 'bitbucket'
370
+ | 'trello';
371
+
372
+ declare type DestinationSubproduct = 'core' | 'software' | 'servicedesk';
373
+
374
+ /**
375
+ * Represents the props available for an DueOn element.
376
+ * @see CreatedOn
377
+ */
378
+ declare type DueOn = {
379
+ name: ElementName.DueOn;
380
+ };
225
381
 
226
382
  export { EditorCardProvider };
227
383
 
228
384
  export { editorCardProvider };
229
385
 
230
- // @public
231
- export type ElementItem = {
386
+ /**
387
+ * Used to represent a metadata element to be rendered.
388
+ */
389
+ export declare type ElementItem = {
390
+ /**
391
+ * Any additional CSS properties to apply to the element.
392
+ */
232
393
  overrideCss?: SerializedStyles;
394
+ /**
395
+ * The size of the element to display.
396
+ */
233
397
  size?: SmartLinkSize;
398
+ /**
399
+ * A `testId` prop is provided for specified elements, which is a unique
400
+ * string that appears as a data attribute `data-testid` in the rendered code,
401
+ * serving as a hook for automated tests
402
+ */
234
403
  testId?: string;
235
404
  } & ElementItemProps;
236
405
 
237
- // @public
238
- export enum ElementName {
239
- // (undocumented)
406
+ /**
407
+ * A type that contains all the possible combinations of elements with their corresponding props.
408
+ */
409
+ declare type ElementItemProps =
410
+ | AuthorGroup
411
+ | CollaboratorGroup
412
+ | CommentCount
413
+ | CreatedBy
414
+ | CreatedOn
415
+ | DueOn
416
+ | LatestCommit
417
+ | LinkIcon
418
+ | ModifiedBy
419
+ | ModifiedOn
420
+ | Preview
421
+ | Priority
422
+ | ProgrammingLanguage
423
+ | Provider_2
424
+ | ReactCount
425
+ | Snippet
426
+ | SourceBranch
427
+ | State_2
428
+ | SubscriberCount
429
+ | TargetBranch
430
+ | Title
431
+ | ViewCount
432
+ | VoteCount;
433
+
434
+ /**
435
+ * Flexible UI element name - each reflecting the link data its represented.
436
+ * When adding an element...
437
+ * 1) Create base element if it doesn't already exist.
438
+ * Base element are inside src/view/FlexibleCard/components/elements.
439
+ * E.g. Badge, DateTime, Icon, Lozenge, etc.
440
+ * 2) Update FlexibleUiContext with the new prop for data representing
441
+ * the element, preferably with the same name as the element itself.
442
+ * (src/state/flexible-ui-context/types.ts)
443
+ * 3) Update Flexible UI extractor (src/extractors/flexible/index.ts)
444
+ * 4) Set base element and data mapping
445
+ * (src/view/FlexibleCard/components/elements/utils.tsx)
446
+ * 5) Create element. (src/view/FlexibleCard/components/elements/index.ts)
447
+ * 6) Update element ElementDisplaySchema for inline/block display
448
+ * (src/view/FlexibleCard/components/blocks/utils.tsx)
449
+ */
450
+ export declare enum ElementName {
240
451
  AuthorGroup = 'AuthorGroup',
241
- // (undocumented)
242
452
  CollaboratorGroup = 'CollaboratorGroup',
243
- // (undocumented)
244
453
  CommentCount = 'CommentCount',
245
- // (undocumented)
246
454
  CreatedBy = 'CreatedBy',
247
- // (undocumented)
248
455
  CreatedOn = 'CreatedOn',
249
- // (undocumented)
250
456
  DueOn = 'DueOn',
251
- // (undocumented)
252
- LatestCommit = 'LatestCommit',
253
- // (undocumented)
254
457
  LinkIcon = 'LinkIcon',
255
- // (undocumented)
256
458
  ModifiedBy = 'ModifiedBy',
257
- // (undocumented)
258
459
  ModifiedOn = 'ModifiedOn',
259
- // (undocumented)
260
460
  Preview = 'Preview',
261
- // (undocumented)
262
461
  Priority = 'Priority',
263
- // (undocumented)
264
462
  ProgrammingLanguage = 'ProgrammingLanguage',
265
- // (undocumented)
266
463
  Provider = 'Provider',
267
- // (undocumented)
268
464
  ReactCount = 'ReactCount',
269
- // (undocumented)
270
465
  Snippet = 'Snippet',
271
- // (undocumented)
272
466
  SourceBranch = 'SourceBranch',
273
- // (undocumented)
274
467
  State = 'State',
275
- // (undocumented)
276
468
  SubscriberCount = 'SubscriberCount',
277
- // (undocumented)
278
469
  TargetBranch = 'TargetBranch',
279
- // (undocumented)
280
470
  Title = 'Title',
281
- // (undocumented)
282
471
  ViewCount = 'ViewCount',
283
- // (undocumented)
284
472
  VoteCount = 'VoteCount',
473
+ LatestCommit = 'LatestCommit',
285
474
  }
286
475
 
287
476
  export { EmbedCardAdf };
288
477
 
289
- // @public (undocumented)
290
- export const embedHeaderHeight = 32;
478
+ export declare const embedHeaderHeight = 32;
291
479
 
292
- // @public (undocumented)
293
- export class EmbedResizeMessageListener extends React_2.Component<
480
+ export declare class EmbedResizeMessageListener extends React_2.Component<
294
481
  Props,
295
482
  State
296
483
  > {
297
- // (undocumented)
298
484
  componentDidMount(): void;
299
- // (undocumented)
300
485
  componentWillUnmount(): void;
301
- // (undocumented)
486
+ private messageCallback;
487
+ private onEmbedHeightChange;
302
488
  render(): React_2.ReactNode;
303
489
  }
304
490
 
305
- // @public
306
- export const FooterBlock: React_2.FC<FooterBlockProps>;
491
+ declare type FlexibleUiOptions = {
492
+ /**
493
+ * Determines whether the entire Smart Link container should be clickable.
494
+ */
495
+ clickableContainer?: boolean;
496
+ /**
497
+ * Determines whether to hide elevation styling.
498
+ */
499
+ hideElevation?: boolean;
500
+ /**
501
+ * Determines whether to hide css padding styling.
502
+ */
503
+ hidePadding?: boolean;
504
+ /**
505
+ * Determines whether to hide css background color styling.
506
+ */
507
+ hideBackground?: boolean;
508
+ /**
509
+ * Determines the default padding and sizing of the underlying blocks and
510
+ * elements within Flexible UI.
511
+ */
512
+ size?: SmartLinkSize;
513
+ /**
514
+ * Determines the default theme of the Flexible UI.
515
+ * Can be Black or Link (default URL blue)
516
+ */
517
+ theme?: SmartLinkTheme;
518
+ };
519
+
520
+ /**
521
+ * Represents a FooterBlock, designed to contain elements and actions that should appear
522
+ * at the bottom of a link card.
523
+ * @public
524
+ * @param {FooterBlockProps} FooterBlockProps
525
+ * @see Block
526
+ */
527
+ export declare const FooterBlock: React_2.FC<FooterBlockProps>;
528
+
529
+ declare type FooterBlockProps = {
530
+ /**
531
+ * An array of actions to be displayed on the right.
532
+ * Adding more than three actions will result in the second and following
533
+ * actions being hidden inside of a dropdown
534
+ * @see ActionItem
535
+ */
536
+ actions?: ActionItem[];
537
+ } & BlockProps;
307
538
 
308
539
  export { InlineCardAdf };
309
540
 
310
- // @public (undocumented)
311
- export const loadingPlaceholderClassName = 'smart-link-loading-placeholder';
541
+ declare type InlinePreloaderStyle =
542
+ | 'on-left-with-skeleton'
543
+ | 'on-right-without-skeleton';
544
+
545
+ declare type InvokeType = 'server' | 'client';
546
+
547
+ /**
548
+ * Represents the props available for an LastCommit element.
549
+ * @see BadgeProps
550
+ */
551
+ declare type LatestCommit = {
552
+ name: ElementName.LatestCommit;
553
+ };
554
+
555
+ /**
556
+ * Represents the props available for an LinkIcon element.
557
+ * @see LinkIcon
558
+ */
559
+ declare type LinkIcon = {
560
+ name: ElementName.LinkIcon;
561
+ };
562
+
563
+ export declare const loadingPlaceholderClassName =
564
+ 'smart-link-loading-placeholder';
565
+
566
+ /**
567
+ * Represents a MetadataBlock, designed to contain groups of metadata in the form of elements.
568
+ * Accepts an array of elements to be shown either primary (left hand side) or secondary (right hand side).
569
+ * @public
570
+ * @param {MetadataBlockProps} MetadataBlockProps
571
+ * @see Block
572
+ */
573
+ export declare const MetadataBlock: React_2.FC<MetadataBlockProps>;
574
+
575
+ declare type MetadataBlockProps = {
576
+ /**
577
+ * Determines the number of lines the metadata should span across.
578
+ * Default is 2. Maximum is 2.
579
+ */
580
+ maxLines?: number;
581
+ /**
582
+ * An array of metadata elements to display on the left.
583
+ * By default elements will be shown to the right of the TitleBlock.
584
+ * The visibility of the element is determine by the link data.
585
+ * If link contain no data to display a particular element, the element
586
+ * will simply not show up.
587
+ * @see ElementItem
588
+ */
589
+ primary?: ElementItem[];
590
+ /**
591
+ * An array of metadata elements to display on the right.
592
+ * By default elements will be shown to the right of the TitleBlock.
593
+ * The visibility of the element is determine by the link data.
594
+ * If link contain no data to display a particular element, the element
595
+ * will simply not show up.
596
+ * @see ElementItem
597
+ */
598
+ secondary?: ElementItem[];
599
+ } & BlockProps;
600
+
601
+ export declare const metadataListClassName = 'smart-link-metadata-list';
312
602
 
313
- // @public
314
- export const MetadataBlock: React_2.FC<MetadataBlockProps>;
603
+ /**
604
+ * Represents the props available for an ModifiedBy element.
605
+ * @see ModifiedBy
606
+ */
607
+ declare type ModifiedBy = {
608
+ name: ElementName.ModifiedBy;
609
+ };
610
+
611
+ /**
612
+ * Represents the props available for an ModifiedOn element.
613
+ * @see ModifiedOn
614
+ */
615
+ declare type ModifiedOn = {
616
+ name: ElementName.ModifiedOn;
617
+ /**
618
+ * A string which will be displayed before the specified element.
619
+ */
620
+ text?: string;
621
+ };
622
+
623
+ /**
624
+ * This represents an action where Icon and Content are provided implicitly.
625
+ * @example DeleteAction - by default will contain a cross icon with the
626
+ * 'delete' content if content and icon are not provided.
627
+ */
628
+ declare type NamedActionItem = BaseActionItem & {
629
+ name: Exclude<ActionName, ActionName.CustomAction>;
630
+ };
631
+
632
+ declare type OnResolveCallback = (data: {
633
+ url?: string;
634
+ title?: string;
635
+ aspectRatio?: number;
636
+ }) => void;
637
+
638
+ /**
639
+ * Represents the props available for an Preview element.
640
+ * @see Preview
641
+ */
642
+ declare type Preview = {
643
+ name: ElementName.Preview;
644
+ };
645
+
646
+ /**
647
+ * Represents a PreviewBlock, which typically contains media or other large format content.
648
+ * @public
649
+ * @param {PreviewBlock} PreviewBlock
650
+ * @see Block
651
+ */
652
+ export declare const PreviewBlock: React_2.FC<PreviewBlockProps>;
653
+
654
+ declare type PreviewBlockProps = BlockProps;
655
+
656
+ declare type PreviewDisplay = 'card' | 'embed';
315
657
 
316
- // @public (undocumented)
317
- export const metadataListClassName = 'smart-link-metadata-list';
658
+ declare type PreviewInvokeMethod = 'keyboard' | 'mouse_hover' | 'mouse_click';
659
+
660
+ /**
661
+ * Represents the props available for an Priority element.
662
+ * @see Priority
663
+ */
664
+ declare type Priority = {
665
+ name: ElementName.Priority;
666
+ };
667
+
668
+ /**
669
+ * Represents the props available for an ProgrammingLanguage element.
670
+ * @see ProgrammingLanguage
671
+ */
672
+ declare type ProgrammingLanguage = {
673
+ name: ElementName.ProgrammingLanguage;
674
+ };
318
675
 
319
- // @public
320
- export const PreviewBlock: React_2.FC<PreviewBlockProps>;
676
+ declare interface Props {
677
+ embedIframeRef: React_2.RefObject<HTMLIFrameElement>;
678
+ onHeightUpdate: (height: number) => void;
679
+ }
321
680
 
322
681
  export { Provider };
323
682
 
683
+ /**
684
+ * Represents the props available for an Provider element.
685
+ * @see Provider
686
+ */
687
+ declare type Provider_2 = {
688
+ name: ElementName.Provider;
689
+ };
690
+
324
691
  export { ProviderProps };
325
692
 
326
- // @public (undocumented)
327
- export type ResolveResponse = JsonLd.Response;
693
+ /**
694
+ * Represents the props available for an ReactCount element.
695
+ * @see ReactCount
696
+ */
697
+ declare type ReactCount = {
698
+ name: ElementName.ReactCount;
699
+ };
700
+
701
+ export declare type ResolveResponse = JsonLd.Response;
702
+
703
+ /**
704
+ * Retry options used if Smart Link resolves to an errored state.
705
+ */
706
+ declare type RetryOptions = {
707
+ /**
708
+ * Determines the error message to show.
709
+ */
710
+ descriptor?: MessageDescriptor;
711
+ /**
712
+ * Determines the onClick behaviour of the error message.
713
+ */
714
+ onClick?: ((e: React.MouseEvent<HTMLElement>) => void) | undefined;
715
+ /**
716
+ * A list of optional value pairs for string interpolation in the message.
717
+ */
718
+ values?: Record<string, string>;
719
+ };
328
720
 
329
721
  export { SmartCardContext as Context };
330
722
  export { SmartCardContext };
331
723
 
332
- // @public
333
- export enum SmartLinkDirection {
334
- // (undocumented)
724
+ /**
725
+ * The direction of Flexible UI components. It establish the main-axis
726
+ * or how the child components laid out inside the parent component.
727
+ * Similar to flex's flex-direction concept.
728
+ */
729
+ export declare enum SmartLinkDirection {
335
730
  Horizontal = 'horizontal',
336
- // (undocumented)
337
731
  Vertical = 'vertical',
338
732
  }
339
733
 
340
- // @public (undocumented)
341
- export class SmartLinkEvents {
342
- // (undocumented)
734
+ export declare class SmartLinkEvents {
343
735
  insertSmartLink(
344
736
  url: string,
345
737
  type: CardInnerAppearance,
@@ -347,58 +739,257 @@ export class SmartLinkEvents {
347
739
  ): void;
348
740
  }
349
741
 
350
- // @public
351
- export enum SmartLinkPosition {
352
- // (undocumented)
353
- Center = 'center',
354
- // (undocumented)
742
+ /**
743
+ * The positioning of the component within the parent component.
744
+ * Similar to flex's align-items or align-self concept.
745
+ */
746
+ export declare enum SmartLinkPosition {
355
747
  Top = 'top',
748
+ Center = 'center',
356
749
  }
357
750
 
358
- // @public
359
- export enum SmartLinkSize {
360
- // (undocumented)
751
+ /**
752
+ * The sizing options of the Flexible UI component. Every component
753
+ * has or inherits the sizing props. Implementation varies
754
+ * as per component.
755
+ */
756
+ export declare enum SmartLinkSize {
757
+ XLarge = 'xlarge',
361
758
  Large = 'large',
362
- // (undocumented)
363
759
  Medium = 'medium',
364
- // (undocumented)
365
760
  Small = 'small',
366
- // (undocumented)
367
- XLarge = 'xlarge',
368
761
  }
369
762
 
370
- // @public
371
- export enum SmartLinkTheme {
372
- // (undocumented)
763
+ /**
764
+ * Smart Links link request status
765
+ */
766
+ declare enum SmartLinkStatus {
767
+ Pending = 'pending',
768
+ Resolving = 'resolving',
769
+ Resolved = 'resolved',
770
+ Forbidden = 'forbidden',
771
+ Errored = 'errored',
772
+ NotFound = 'not_found',
773
+ Unauthorized = 'unauthorized',
774
+ Fallback = 'fallback',
775
+ }
776
+
777
+ /**
778
+ * Flexible UI theme available on the Card level.
779
+ * This determine the styling of the link.
780
+ */
781
+ export declare enum SmartLinkTheme {
373
782
  Black = 'black',
374
- // (undocumented)
375
783
  Link = 'link',
376
784
  }
377
785
 
378
- // @public
379
- export const SnippetBlock: React_2.FC<SnippetBlockProps>;
786
+ /**
787
+ * Represents the props available for an Snippet element.
788
+ * @see Snippet
789
+ */
790
+ declare type Snippet = {
791
+ name: ElementName.Snippet;
792
+ };
793
+
794
+ /**
795
+ * Represents a SnippetBlock, which is used to display longer form text content, like descriptions.
796
+ * @public
797
+ * @param {SnippetBlock} SnippetBlock
798
+ * @see Block
799
+ */
800
+ export declare const SnippetBlock: React_2.FC<SnippetBlockProps>;
801
+
802
+ declare type SnippetBlockProps = {
803
+ /**
804
+ * Determines the maximum lines the text within the snippet block should
805
+ * spread over. Default is 3. Maximum is 3.
806
+ */
807
+ maxLines?: number;
808
+ } & BlockProps;
380
809
 
381
- // @public
382
- export const TitleBlock: React_2.FC<TitleBlockProps>;
810
+ /**
811
+ * Represents the props available for an SourceBranch element.
812
+ * @see SourceBranch
813
+ */
814
+ declare type SourceBranch = {
815
+ name: ElementName.SourceBranch;
816
+ };
817
+
818
+ declare interface State {}
819
+
820
+ /**
821
+ * Represents the props available for an State element.
822
+ * @see State
823
+ */
824
+ declare type State_2 = {
825
+ name: ElementName.State;
826
+ };
827
+
828
+ /**
829
+ * Represents the props available for an SubscriberCount element.
830
+ * @see SubscriberCount
831
+ */
832
+ declare type SubscriberCount = {
833
+ name: ElementName.SubscriberCount;
834
+ };
835
+
836
+ /**
837
+ * Represents the props available for an TargetBranch element.
838
+ * @see TargetBranch
839
+ */
840
+ declare type TargetBranch = {
841
+ name: ElementName.TargetBranch;
842
+ };
383
843
 
384
- // @public
385
- export const useSmartLinkAnalytics: (
844
+ /**
845
+ * Represents the props available for an Title element.
846
+ * @see Title
847
+ */
848
+ declare type Title = {
849
+ name: ElementName.Title;
850
+ };
851
+
852
+ /**
853
+ * Represents a TitleBlock, which is the foundation of Flexible UI.
854
+ * This contains an icon, the link, and any associated metadata and actions in one block.
855
+ * The TitleBlock will also render differently given the state of the smart link.
856
+ * This can be found in the corresponding Resolving, Resolved and Errored views.
857
+ * @public
858
+ * @param {TitleBlockProps} TitleBlockProps
859
+ * @see Block
860
+ * @see TitleBlockResolvingView
861
+ * @see TitleBlockResolvedView
862
+ * @see TitleBlockErroredView
863
+ */
864
+ export declare const TitleBlock: React_2.FC<TitleBlockProps>;
865
+
866
+ declare type TitleBlockProps = {
867
+ /**
868
+ * An array of action items to be displayed after the title
869
+ * on the right of the block.
870
+ * An action item provides preset icon and label, with exception of
871
+ * a custom action which either Icon or label must be provided.
872
+ * @see ActionItem
873
+ */
874
+ actions?: ActionItem[];
875
+ /**
876
+ * Determines the href target behaviour of the Link.
877
+ */
878
+ anchorTarget?: AnchorTarget;
879
+ /**
880
+ * [Experiment] Determines whether the linked title should display tooltip on hover.
881
+ */
882
+ hideTitleTooltip?: boolean;
883
+ /**
884
+ * Determines the maximum number of lines for the underlying link text to
885
+ * spread over. Default is 2. Maximum is 2.
886
+ */
887
+ maxLines?: number;
888
+ /**
889
+ * An array of metadata elements to display in the TitleBlock.
890
+ * By default elements will be shown to the right of the TitleBlock.
891
+ * The visibility of the element is determine by the link data.
892
+ * If link contain no data to display a particular element, the element
893
+ * will simply not show up.
894
+ * @see ElementItem
895
+ */
896
+ metadata?: ElementItem[];
897
+ /**
898
+ * Determines the position of the link icon in relative to the vertical
899
+ * height of the TitleBlock. It can either be centred or placed on “top”.
900
+ * Default is top.
901
+ */
902
+ position?: SmartLinkPosition;
903
+ /**
904
+ * Determines the onClick behaviour of the Link. By default used for analytics.
905
+ * @internal
906
+ */
907
+ onClick?: React_2.EventHandler<React_2.MouseEvent | React_2.KeyboardEvent>;
908
+ /**
909
+ * The options that determine the retry behaviour when a Smart Link errors.
910
+ * @internal
911
+ */
912
+ retry?: RetryOptions;
913
+ /**
914
+ * Determines whether TitleBlock will hide actions until the user is hovering
915
+ * over the link.
916
+ */
917
+ showActionOnHover?: boolean;
918
+ /**
919
+ * An array of metadata elements to display in the TitleBlock.
920
+ * By default elements will be shown below the link text.
921
+ * The visibility of the element is determine by the link data.
922
+ * If link contain no data to display a particular element, the element
923
+ * will simply not show up.
924
+ * @see ElementItem
925
+ */
926
+ subtitle?: ElementItem[];
927
+ /**
928
+ * The text to display in the link. Overrides any text that is retrieved from
929
+ * the Smart Link.
930
+ */
931
+ text?: string;
932
+ /**
933
+ * The theme of the link text. Can be Black or Link (default URL blue)
934
+ * @internal
935
+ */
936
+ theme?: SmartLinkTheme;
937
+ } & BlockProps;
938
+
939
+ /**
940
+ * This hook provides usage of Smart Link analytics outside of the Card component.
941
+ * Can be provided to Card via the analyticsEvents prop to change the analytics events.
942
+ * @param url URL of the link
943
+ * @param dispatchAnalytics dispatchAnalytics function
944
+ * @param id fallback id of the events sent if no id is available
945
+ * @param defaultLocation location attribute to be used
946
+ * @returns
947
+ */
948
+ export declare const useSmartLinkAnalytics: (
386
949
  url: string,
387
950
  dispatchAnalytics: AnalyticsHandler,
388
951
  id?: string | undefined,
389
952
  defaultLocation?: string | undefined,
390
953
  ) => {
391
954
  ui: {
955
+ /**
956
+ * This fires an event that represents when a user clicks on the authentication
957
+ * call to action with no current authenticated account. (i.e. Connect to Preview).
958
+ * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
959
+ * @param definitionId The definitionId of the Smart Link resolver invoked.
960
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
961
+ * @returns
962
+ */
392
963
  authEvent: (
393
964
  display: CardInnerAppearance,
394
965
  definitionId?: string | undefined,
395
966
  extensionKey?: string | undefined,
396
967
  ) => void;
968
+ /**
969
+ * This fires an event that represents when a user clicks on the authentication
970
+ * call to action with a forbidden authenticated account. (i.e. Try another account).
971
+ * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
972
+ * @param definitionId The definitionId of the Smart Link resolver invoked.
973
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
974
+ * @returns
975
+ */
397
976
  authAlternateAccountEvent: (
398
977
  display: CardInnerAppearance,
399
978
  definitionId?: string | undefined,
400
979
  extensionKey?: string | undefined,
401
980
  ) => void;
981
+ /**
982
+ * This fires an event that represents when a user clicks on a Smart Link.
983
+ * @param id The unique ID for this Smart Link.
984
+ * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
985
+ * @param status What status the Smart Link is currently in (e.g. resolved, unresolved)
986
+ * @param definitionId The definitionId of the Smart Link resolver invoked.
987
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
988
+ * @param isModifierKeyPressed Whether a modifier key was pressed when clicking the Smart Link.
989
+ * @param location Where the Smart Link is currently rendered.
990
+ * @param destinationProduct The product the Smart Link is linked to.
991
+ * @returns
992
+ */
402
993
  cardClickedEvent: (
403
994
  id: string | undefined,
404
995
  display: CardInnerAppearance,
@@ -411,6 +1002,16 @@ export const useSmartLinkAnalytics: (
411
1002
  destinationSubproduct?: DestinationSubproduct | string | undefined,
412
1003
  actionSubjectId?: string | undefined,
413
1004
  ) => void;
1005
+ /**
1006
+ * This fires an event that represents when a user clicks on a Smart Link action.
1007
+ * Note: This also starts the UFO smart-link-action-invocation experience.
1008
+ * @param id The unique ID for this Smart Link.
1009
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1010
+ * @param actionType The type of the action that was clicked, e.g. PreviewAction
1011
+ * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
1012
+ * @param invokeType Whether the action invoked made a call to a server.
1013
+ * @returns
1014
+ */
414
1015
  actionClickedEvent: (
415
1016
  id: string | undefined,
416
1017
  extensionKey: string | undefined,
@@ -418,17 +1019,40 @@ export const useSmartLinkAnalytics: (
418
1019
  display: CardInnerAppearance,
419
1020
  invokeType: InvokeType,
420
1021
  ) => void;
1022
+ /**
1023
+ * This fires an event that represents when a user clicks on a hover preview's "navigate to link" button.
1024
+ * https://product-fabric.atlassian.net/wiki/spaces/EM/pages/3206743323/Analytics+Metrics+-+Hover+Previews
1025
+ * @param previewDisplay What format the preview is in.
1026
+ * @param definitionId The definitionId of the Smart Link resolver invoked.
1027
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1028
+ * @param previewInvokeMethod How the preview was triggered.
1029
+ */
421
1030
  hoverCardOpenLinkClickedEvent: (
422
1031
  previewDisplay: PreviewDisplay,
423
1032
  definitionId?: string | undefined,
424
1033
  extensionKey?: string | undefined,
425
1034
  previewInvokeMethod?: PreviewInvokeMethod | undefined,
426
1035
  ) => void;
1036
+ /**
1037
+ * This fires an event that represents when a user closed the authentication window without authenticating after opening it.
1038
+ * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
1039
+ * @param definitionId The definitionId of the Smart Link resolver invoked.
1040
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1041
+ * @returns
1042
+ */
427
1043
  closedAuthEvent: (
428
1044
  display: CardInnerAppearance,
429
1045
  definitionId?: string | undefined,
430
1046
  extensionKey?: string | undefined,
431
1047
  ) => void;
1048
+ /**
1049
+ * This fires an event that represents when a Smart Link was rendered successfully.
1050
+ * Note: this fires even if the Smart Link request errored out.
1051
+ * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
1052
+ * @param id The unique ID for this Smart Link.
1053
+ * @param definitionId The definitionId of the Smart Link resolver invoked.
1054
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1055
+ */
432
1056
  renderSuccessEvent: (
433
1057
  display: CardInnerAppearance,
434
1058
  status: CardType,
@@ -436,6 +1060,14 @@ export const useSmartLinkAnalytics: (
436
1060
  definitionId?: string | undefined,
437
1061
  extensionKey?: string | undefined,
438
1062
  ) => void;
1063
+ /**
1064
+ * This fires an event that represents a hover preview being opened.
1065
+ * @param hoverDisplay Whether the hover preview was displayed as a card or embed.
1066
+ * @param definitionId The definitionId of the Smart Link resolver invoked.
1067
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1068
+ * @param previewInvokeMethod How the preview was triggered.
1069
+ * @returns
1070
+ */
439
1071
  hoverCardViewedEvent: (
440
1072
  previewDisplay: PreviewDisplay,
441
1073
  previewInvokeMethod?: PreviewInvokeMethod | undefined,
@@ -443,6 +1075,15 @@ export const useSmartLinkAnalytics: (
443
1075
  definitionId?: string | undefined,
444
1076
  extensionKey?: string | undefined,
445
1077
  ) => void;
1078
+ /**
1079
+ * This fires an event that represents a hover preview being dismissed.
1080
+ * @param hoverDisplay Whether the hover preview was displayed as a card or embed.
1081
+ * @param hoverTime The duration that the user hovered over a Smart Link before the preview was dismissed.
1082
+ * @param definitionId The definitionId of the Smart Link resolver invoked.
1083
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1084
+ * @param previewInvokeMethod How the preview was triggered.
1085
+ * @returns
1086
+ */
446
1087
  hoverCardDismissedEvent: (
447
1088
  previewDisplay: PreviewDisplay,
448
1089
  hoverTime: number,
@@ -453,12 +1094,27 @@ export const useSmartLinkAnalytics: (
453
1094
  ) => void;
454
1095
  };
455
1096
  operational: {
1097
+ /**
1098
+ * This fires an event that represents an action being successfully invoked.
1099
+ * @param id The unique ID for this Smart Link.
1100
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1101
+ * @param actionType The type of action invoked, e.g. PreviewAction
1102
+ * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
1103
+ */
456
1104
  invokeSucceededEvent: (
457
1105
  id: string | undefined,
458
1106
  extensionKey: string | undefined,
459
1107
  actionType: string,
460
1108
  display: CardInnerAppearance,
461
1109
  ) => void;
1110
+ /**
1111
+ * This fires an event that represents an action being unsuccessfully invoked.
1112
+ * @param id The unique ID for this Smart Link.
1113
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1114
+ * @param actionType The type of action invoked, e.g. PreviewAction
1115
+ * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
1116
+ * @param reason The reason the invocation failed.
1117
+ */
462
1118
  invokeFailedEvent: (
463
1119
  id: string | undefined,
464
1120
  providerKey: string | undefined,
@@ -466,17 +1122,39 @@ export const useSmartLinkAnalytics: (
466
1122
  display: CardInnerAppearance,
467
1123
  reason: string,
468
1124
  ) => void;
1125
+ /**
1126
+ * This fires an event that represents an account successfully being connected via a Smart Link.
1127
+ * @param id The unique ID for this Smart Link.
1128
+ * @param definitionId The definitionId of the Smart Link resolver invoked.
1129
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1130
+ */
469
1131
  connectSucceededEvent: (
470
1132
  id?: string,
471
1133
  definitionId?: string | undefined,
472
1134
  extensionKey?: string | undefined,
473
1135
  ) => void;
1136
+ /**
1137
+ * This fires an event that represents an account unsuccessfully being connected.
1138
+ * @param id The unique ID for this Smart Link.
1139
+ * @param definitionId The definitionId of the Smart Link resolver invoked.
1140
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1141
+ * @param reason The reason why the Smart Link connect account failed.
1142
+ */
474
1143
  connectFailedEvent: (
475
1144
  id?: string,
476
1145
  definitionId?: string | undefined,
477
1146
  extensionKey?: string | undefined,
478
1147
  reason?: string | undefined,
479
1148
  ) => void;
1149
+ /**
1150
+ * This fires an event which represents a Smart Link request succeeding or failing based on the status.
1151
+ * @param id The unique ID for this Smart Link.
1152
+ * @param status The status of the Smart Link.
1153
+ * @param definitionId The definitionId of the Smart Link resolver invoked.
1154
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1155
+ * @param resourceType The type of resource that was invoked. This is provider specific (e.g. File, PullRequest).
1156
+ * @param error An error representing why the Smart Link request failed.
1157
+ */
480
1158
  instrument: (
481
1159
  id: string | undefined,
482
1160
  status: CardType,
@@ -487,12 +1165,24 @@ export const useSmartLinkAnalytics: (
487
1165
  ) => void;
488
1166
  };
489
1167
  track: {
1168
+ /**
1169
+ * This fires an event which represents a user starting the Smart Link connect account process.
1170
+ * @param definitionId The definitionId of the Smart Link resolver invoked.
1171
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1172
+ * @returns
1173
+ */
490
1174
  appAccountConnected: (
491
1175
  definitionId?: string | undefined,
492
1176
  extensionKey?: string | undefined,
493
1177
  ) => void;
494
1178
  };
495
1179
  screen: {
1180
+ /**
1181
+ * This fires an event which represents the connect account page being opened.
1182
+ * @param definitionId The definitionId of the Smart Link resolver invoked.
1183
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1184
+ * @returns
1185
+ */
496
1186
  authPopupEvent: (
497
1187
  definitionId?: string | undefined,
498
1188
  extensionKey?: string | undefined,
@@ -500,8 +1190,23 @@ export const useSmartLinkAnalytics: (
500
1190
  };
501
1191
  };
502
1192
 
503
- // @public (undocumented)
504
- export function useSmartLinkEvents(): SmartLinkEvents;
1193
+ export declare function useSmartLinkEvents(): SmartLinkEvents;
1194
+
1195
+ /**
1196
+ * Represents the props available for an ViewCount element.
1197
+ * @see ViewCount
1198
+ */
1199
+ declare type ViewCount = {
1200
+ name: ElementName.ViewCount;
1201
+ };
1202
+
1203
+ /**
1204
+ * Represents the props available for an VoteCount element.
1205
+ * @see VoteCount
1206
+ */
1207
+ declare type VoteCount = {
1208
+ name: ElementName.VoteCount;
1209
+ };
505
1210
 
506
- // (No @packageDocumentation comment for this package)
1211
+ export {};
507
1212
  ```