@atlaskit/smart-card 19.1.27 → 19.1.28

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 19.1.28
4
+
5
+ ### Patch Changes
6
+
7
+ - [`455538b6a3f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/455538b6a3f) - use useFeatureFlag hook to get hover preview FF
8
+
3
9
  ## 19.1.27
4
10
 
5
11
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.27",
3
+ "version": "19.1.28",
4
4
  "sideEffects": false
5
5
  }
@@ -11,6 +11,8 @@ exports.CardWithUrlContent = CardWithUrlContent;
11
11
 
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
 
14
+ var _linkProvider = require("@atlaskit/link-provider");
15
+
14
16
  var _utils = require("../../utils");
15
17
 
16
18
  var measure = _interopRequireWildcard(require("../../utils/performance"));
@@ -73,7 +75,13 @@ function CardWithUrlContent(_ref) {
73
75
  var services = (0, _helpers.getServices)(state.details);
74
76
  var isFlexibleUi = (0, _react.useMemo)(function () {
75
77
  return (0, _flexible.isFlexibleUiCard)(children);
76
- }, [children]); // Setup UI handlers.
78
+ }, [children]);
79
+ var showHoverPreviewFlag = (0, _linkProvider.useFeatureFlag)('showHoverPreview');
80
+
81
+ if (showHoverPreview === undefined && showHoverPreviewFlag !== undefined) {
82
+ showHoverPreview = showHoverPreviewFlag;
83
+ } // Setup UI handlers.
84
+
77
85
 
78
86
  var handleClick = (0, _react.useCallback)(function (event) {
79
87
  var clickUrl = (0, _helpers.getClickUrl)(url, state.details);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.27",
3
+ "version": "19.1.28",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,5 @@
1
1
  import React, { useEffect, useCallback, useMemo } from 'react';
2
+ import { useFeatureFlag } from '@atlaskit/link-provider';
2
3
  import { isSpecialEvent } from '../../utils';
3
4
  import * as measure from '../../utils/performance';
4
5
  import { getDefinitionId, getServices, isFinalState, getClickUrl, getResourceType, getExtensionKey, getSubproduct, getProduct } from '../../state/helpers';
@@ -45,7 +46,13 @@ export function CardWithUrlContent({
45
46
  const product = getProduct(state.details);
46
47
  const subproduct = getSubproduct(state.details);
47
48
  const services = getServices(state.details);
48
- let isFlexibleUi = useMemo(() => isFlexibleUiCard(children), [children]); // Setup UI handlers.
49
+ let isFlexibleUi = useMemo(() => isFlexibleUiCard(children), [children]);
50
+ const showHoverPreviewFlag = useFeatureFlag('showHoverPreview');
51
+
52
+ if (showHoverPreview === undefined && showHoverPreviewFlag !== undefined) {
53
+ showHoverPreview = showHoverPreviewFlag;
54
+ } // Setup UI handlers.
55
+
49
56
 
50
57
  const handleClick = useCallback(event => {
51
58
  const clickUrl = getClickUrl(url, state.details);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.27",
3
+ "version": "19.1.28",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,5 @@
1
1
  import React, { useEffect, useCallback, useMemo } from 'react';
2
+ import { useFeatureFlag } from '@atlaskit/link-provider';
2
3
  import { isSpecialEvent } from '../../utils';
3
4
  import * as measure from '../../utils/performance';
4
5
  import { getDefinitionId, getServices, isFinalState, getClickUrl, getResourceType, getExtensionKey, getSubproduct, getProduct } from '../../state/helpers';
@@ -47,7 +48,13 @@ export function CardWithUrlContent(_ref) {
47
48
  var services = getServices(state.details);
48
49
  var isFlexibleUi = useMemo(function () {
49
50
  return isFlexibleUiCard(children);
50
- }, [children]); // Setup UI handlers.
51
+ }, [children]);
52
+ var showHoverPreviewFlag = useFeatureFlag('showHoverPreview');
53
+
54
+ if (showHoverPreview === undefined && showHoverPreviewFlag !== undefined) {
55
+ showHoverPreview = showHoverPreviewFlag;
56
+ } // Setup UI handlers.
57
+
51
58
 
52
59
  var handleClick = useCallback(function (event) {
53
60
  var clickUrl = getClickUrl(url, state.details);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.27",
3
+ "version": "19.1.28",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
package/report.api.md ADDED
@@ -0,0 +1,501 @@
1
+ ## API Report File for "@atlaskit/smart-card"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+ /// <reference types="react" />
7
+
8
+ import { APIError } from '@atlaskit/linking-common';
9
+ import { Appearance } from '@atlaskit/button/types';
10
+ import { BlockCardAdf } from '@atlaskit/linking-common';
11
+ import { CardAdf } from '@atlaskit/linking-common';
12
+ import { CardAppearance } from '@atlaskit/linking-common';
13
+ import { CardContext } from '@atlaskit/link-provider';
14
+ import { CardPlatform } from '@atlaskit/linking-common';
15
+ import { CardType } from '@atlaskit/linking-common';
16
+ import { CardClient as Client } from '@atlaskit/link-provider';
17
+ import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
18
+ import { EditorCardProvider } from '@atlaskit/link-provider';
19
+ import { editorCardProvider } from '@atlaskit/link-provider';
20
+ import { EmbedCardAdf } from '@atlaskit/linking-common';
21
+ import { GasPayload } from '@atlaskit/analytics-gas-types';
22
+ import { InlineCardAdf } from '@atlaskit/linking-common';
23
+ import { JsonLd } from 'json-ld-types';
24
+ import { MessageDescriptor } from 'react-intl-next';
25
+ import { SmartCardProvider as Provider } from '@atlaskit/link-provider';
26
+ import { ProviderProps } from '@atlaskit/link-provider';
27
+ import { default as React_2 } from 'react';
28
+ import { ReactChild } from 'react';
29
+ import { SerializedStyles } from '@emotion/core';
30
+ import { SmartCardContext } from '@atlaskit/link-provider';
31
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
32
+ import { WithContextProps } from '@atlaskit/analytics-next';
33
+ import { WithIntlProps } from 'react-intl-next';
34
+ import { WrappedComponentProps } from 'react-intl-next';
35
+
36
+ // @public (undocumented)
37
+ export type ActionItem = NamedActionItem | CustomActionItem;
38
+
39
+ // @public
40
+ export enum ActionName {
41
+ // (undocumented)
42
+ CustomAction = 'CustomAction',
43
+ // (undocumented)
44
+ DeleteAction = 'DeleteAction',
45
+ // (undocumented)
46
+ EditAction = 'EditAction',
47
+ }
48
+
49
+ // @public (undocumented)
50
+ export type AnalyticsAction =
51
+ | 'resolved'
52
+ | 'unresolved'
53
+ | 'connectSucceeded'
54
+ | 'connectFailed'
55
+ | 'connected'
56
+ | 'clicked'
57
+ | 'closed'
58
+ | 'renderFailed'
59
+ | 'renderWithStatus'
60
+ | 'renderSuccess'
61
+ | 'inserted'
62
+ | 'viewed'
63
+ | 'dismissed'
64
+ | 'created';
65
+
66
+ // @public (undocumented)
67
+ export type AnalyticsActionSubject =
68
+ | 'smartLink'
69
+ | 'smartLinkAction'
70
+ | 'applicationAccount'
71
+ | 'button'
72
+ | 'consentModal'
73
+ | 'hoverCard';
74
+
75
+ // @public (undocumented)
76
+ export type AnalyticsHandler = (event: AnalyticsPayload) => void;
77
+
78
+ // @public (undocumented)
79
+ export type AnalyticsPayload = GasPayload & {
80
+ action?: AnalyticsAction;
81
+ actionSubject: AnalyticsActionSubject;
82
+ attributes: GasPayload['attributes'] & {
83
+ display?: CardInnerAppearance;
84
+ };
85
+ };
86
+
87
+ export { APIError };
88
+
89
+ export { BlockCardAdf };
90
+
91
+ // @public (undocumented)
92
+ export const blockCardContentClassName = 'block-card-content';
93
+
94
+ // @public (undocumented)
95
+ export const blockCardContentHeaderClassName = 'block-card-content-header';
96
+
97
+ // @public (undocumented)
98
+ export const blockCardContentHeaderNameClassName =
99
+ 'block-card-content-header-name';
100
+
101
+ // @public (undocumented)
102
+ export const blockCardErroredViewClassName = 'block-card-errored-view';
103
+
104
+ // @public (undocumented)
105
+ export const blockCardForbiddenViewClassName = 'block-card-forbidden-view';
106
+
107
+ // @public (undocumented)
108
+ export const blockCardForbiddenViewLinkClassName =
109
+ 'block-card-forbidden-view-link';
110
+
111
+ // @public (undocumented)
112
+ export const blockCardIconImageClassName = 'block-card-icon-image';
113
+
114
+ // @public (undocumented)
115
+ export const blockCardNotFoundViewClassName = 'block-card-not-found-view';
116
+
117
+ // @public (undocumented)
118
+ export const blockCardResolvedViewByClassName = 'block-card-resolved-view-by';
119
+
120
+ // @public (undocumented)
121
+ export const blockCardResolvedViewClassName = 'block-card-resolved-view';
122
+
123
+ // @public (undocumented)
124
+ export const blockCardResolvingViewClassName = 'block-card-resolving-view';
125
+
126
+ // @public (undocumented)
127
+ export const Card: React_2.ForwardRefExoticComponent<
128
+ Pick<
129
+ Omit<
130
+ React_2.PropsWithChildren<
131
+ WithIntlProps<CardProps & WrappedComponentProps<'intl'>>
132
+ >,
133
+ keyof WithAnalyticsEventsProps
134
+ > &
135
+ React_2.RefAttributes<any> &
136
+ WithContextProps,
137
+ | 'children'
138
+ | 'data'
139
+ | 'appearance'
140
+ | 'testId'
141
+ | 'isSelected'
142
+ | 'inheritDimensions'
143
+ | 'id'
144
+ | 'placeholder'
145
+ | 'onClick'
146
+ | 'analyticsContext'
147
+ | 'key'
148
+ | 'url'
149
+ | 'ui'
150
+ | 'showActions'
151
+ | 'onResolve'
152
+ | 'platform'
153
+ | 'isFrameVisible'
154
+ | 'embedIframeRef'
155
+ | 'showHoverPreview'
156
+ | 'inlinePreloaderStyle'
157
+ | 'importer'
158
+ | 'container'
159
+ | 'analyticsEvents'
160
+ | 'forwardedRef'
161
+ > &
162
+ React_2.RefAttributes<any>
163
+ >;
164
+
165
+ export { CardAdf };
166
+
167
+ export { CardAppearance };
168
+
169
+ export { CardContext };
170
+
171
+ export { CardPlatform };
172
+
173
+ // @public (undocumented)
174
+ export interface CardProps extends WithAnalyticsEventsProps {
175
+ // (undocumented)
176
+ analyticsEvents?: AnalyticsFacade;
177
+ // (undocumented)
178
+ 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
+ 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)
198
+ isSelected?: boolean;
199
+ // (undocumented)
200
+ 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)
212
+ testId?: string;
213
+ // (undocumented)
214
+ ui?: FlexibleUiOptions;
215
+ // (undocumented)
216
+ url?: string;
217
+ }
218
+
219
+ export { CardType };
220
+
221
+ export { Client };
222
+
223
+ // @public (undocumented)
224
+ export const contentFooterClassName = 'smart-link-content-footer';
225
+
226
+ export { EditorCardProvider };
227
+
228
+ export { editorCardProvider };
229
+
230
+ // @public
231
+ export type ElementItem = {
232
+ overrideCss?: SerializedStyles;
233
+ size?: SmartLinkSize;
234
+ testId?: string;
235
+ } & ElementItemProps;
236
+
237
+ // @public
238
+ export enum ElementName {
239
+ // (undocumented)
240
+ AuthorGroup = 'AuthorGroup',
241
+ // (undocumented)
242
+ CollaboratorGroup = 'CollaboratorGroup',
243
+ // (undocumented)
244
+ CommentCount = 'CommentCount',
245
+ // (undocumented)
246
+ CreatedBy = 'CreatedBy',
247
+ // (undocumented)
248
+ CreatedOn = 'CreatedOn',
249
+ // (undocumented)
250
+ LatestCommit = 'LatestCommit',
251
+ // (undocumented)
252
+ LinkIcon = 'LinkIcon',
253
+ // (undocumented)
254
+ ModifiedBy = 'ModifiedBy',
255
+ // (undocumented)
256
+ ModifiedOn = 'ModifiedOn',
257
+ // (undocumented)
258
+ Preview = 'Preview',
259
+ // (undocumented)
260
+ Priority = 'Priority',
261
+ // (undocumented)
262
+ ProgrammingLanguage = 'ProgrammingLanguage',
263
+ // (undocumented)
264
+ Provider = 'Provider',
265
+ // (undocumented)
266
+ ReactCount = 'ReactCount',
267
+ // (undocumented)
268
+ Snippet = 'Snippet',
269
+ // (undocumented)
270
+ State = 'State',
271
+ // (undocumented)
272
+ SubscriberCount = 'SubscriberCount',
273
+ // (undocumented)
274
+ Title = 'Title',
275
+ // (undocumented)
276
+ ViewCount = 'ViewCount',
277
+ // (undocumented)
278
+ VoteCount = 'VoteCount',
279
+ }
280
+
281
+ export { EmbedCardAdf };
282
+
283
+ // @public (undocumented)
284
+ export const embedHeaderHeight = 32;
285
+
286
+ // @public (undocumented)
287
+ export class EmbedResizeMessageListener extends React_2.Component<
288
+ Props,
289
+ State
290
+ > {
291
+ // (undocumented)
292
+ componentDidMount(): void;
293
+ // (undocumented)
294
+ componentWillUnmount(): void;
295
+ // (undocumented)
296
+ render(): React_2.ReactNode;
297
+ }
298
+
299
+ // @public
300
+ export const FooterBlock: React_2.FC<FooterBlockProps>;
301
+
302
+ export { InlineCardAdf };
303
+
304
+ // @public (undocumented)
305
+ export const loadingPlaceholderClassName = 'smart-link-loading-placeholder';
306
+
307
+ // @public
308
+ export const MetadataBlock: React_2.FC<MetadataBlockProps>;
309
+
310
+ // @public (undocumented)
311
+ export const metadataListClassName = 'smart-link-metadata-list';
312
+
313
+ // @public
314
+ export const PreviewBlock: React_2.FC<PreviewBlockProps>;
315
+
316
+ export { Provider };
317
+
318
+ export { ProviderProps };
319
+
320
+ // @public (undocumented)
321
+ export type ResolveResponse = JsonLd.Response;
322
+
323
+ export { SmartCardContext as Context };
324
+ export { SmartCardContext };
325
+
326
+ // @public
327
+ export enum SmartLinkDirection {
328
+ // (undocumented)
329
+ Horizontal = 'horizontal',
330
+ // (undocumented)
331
+ Vertical = 'vertical',
332
+ }
333
+
334
+ // @public (undocumented)
335
+ export class SmartLinkEvents {
336
+ // (undocumented)
337
+ insertSmartLink(
338
+ url: string,
339
+ type: CardInnerAppearance,
340
+ createAnalyticsEvent?: CreateUIAnalyticsEvent,
341
+ ): void;
342
+ }
343
+
344
+ // @public
345
+ export enum SmartLinkPosition {
346
+ // (undocumented)
347
+ Center = 'center',
348
+ // (undocumented)
349
+ Top = 'top',
350
+ }
351
+
352
+ // @public
353
+ export enum SmartLinkSize {
354
+ // (undocumented)
355
+ Large = 'large',
356
+ // (undocumented)
357
+ Medium = 'medium',
358
+ // (undocumented)
359
+ Small = 'small',
360
+ // (undocumented)
361
+ XLarge = 'xlarge',
362
+ }
363
+
364
+ // @public
365
+ export enum SmartLinkTheme {
366
+ // (undocumented)
367
+ Black = 'black',
368
+ // (undocumented)
369
+ Link = 'link',
370
+ }
371
+
372
+ // @public
373
+ export const SnippetBlock: React_2.FC<SnippetBlockProps>;
374
+
375
+ // @public
376
+ export const TitleBlock: React_2.FC<TitleBlockProps>;
377
+
378
+ // @public
379
+ export const useSmartLinkAnalytics: (
380
+ url: string,
381
+ dispatchAnalytics: AnalyticsHandler,
382
+ id?: string | undefined,
383
+ defaultLocation?: string | undefined,
384
+ ) => {
385
+ ui: {
386
+ authEvent: (
387
+ display: CardInnerAppearance,
388
+ definitionId?: string | undefined,
389
+ extensionKey?: string | undefined,
390
+ ) => void;
391
+ authAlternateAccountEvent: (
392
+ display: CardInnerAppearance,
393
+ definitionId?: string | undefined,
394
+ extensionKey?: string | undefined,
395
+ ) => void;
396
+ cardClickedEvent: (
397
+ id: string | undefined,
398
+ display: CardInnerAppearance,
399
+ status: CardType,
400
+ definitionId?: string | undefined,
401
+ extensionKey?: string | undefined,
402
+ isModifierKeyPressed?: boolean | undefined,
403
+ location?: string | undefined,
404
+ destinationProduct?: DestinationProduct | string | undefined,
405
+ destinationSubproduct?: DestinationSubproduct | string | undefined,
406
+ actionSubjectId?: string | undefined,
407
+ ) => void;
408
+ actionClickedEvent: (
409
+ id: string | undefined,
410
+ extensionKey: string | undefined,
411
+ actionType: string,
412
+ display: CardInnerAppearance,
413
+ invokeType: InvokeType,
414
+ ) => void;
415
+ hoverCardOpenLinkClickedEvent: (
416
+ previewDisplay: PreviewDisplay,
417
+ definitionId?: string | undefined,
418
+ extensionKey?: string | undefined,
419
+ previewInvokeMethod?: PreviewInvokeMethod | undefined,
420
+ ) => void;
421
+ closedAuthEvent: (
422
+ display: CardInnerAppearance,
423
+ definitionId?: string | undefined,
424
+ extensionKey?: string | undefined,
425
+ ) => void;
426
+ renderSuccessEvent: (
427
+ display: CardInnerAppearance,
428
+ status: CardType,
429
+ id?: string,
430
+ definitionId?: string | undefined,
431
+ extensionKey?: string | undefined,
432
+ ) => void;
433
+ hoverCardViewedEvent: (
434
+ previewDisplay: PreviewDisplay,
435
+ previewInvokeMethod?: PreviewInvokeMethod | undefined,
436
+ id?: string,
437
+ definitionId?: string | undefined,
438
+ extensionKey?: string | undefined,
439
+ ) => void;
440
+ hoverCardDismissedEvent: (
441
+ previewDisplay: PreviewDisplay,
442
+ hoverTime: number,
443
+ previewInvokeMethod?: PreviewInvokeMethod | undefined,
444
+ id?: string,
445
+ definitionId?: string | undefined,
446
+ extensionKey?: string | undefined,
447
+ ) => void;
448
+ };
449
+ operational: {
450
+ invokeSucceededEvent: (
451
+ id: string | undefined,
452
+ extensionKey: string | undefined,
453
+ actionType: string,
454
+ display: CardInnerAppearance,
455
+ ) => void;
456
+ invokeFailedEvent: (
457
+ id: string | undefined,
458
+ providerKey: string | undefined,
459
+ actionType: string,
460
+ display: CardInnerAppearance,
461
+ reason: string,
462
+ ) => void;
463
+ connectSucceededEvent: (
464
+ id?: string,
465
+ definitionId?: string | undefined,
466
+ extensionKey?: string | undefined,
467
+ ) => void;
468
+ connectFailedEvent: (
469
+ id?: string,
470
+ definitionId?: string | undefined,
471
+ extensionKey?: string | undefined,
472
+ reason?: string | undefined,
473
+ ) => void;
474
+ instrument: (
475
+ id: string | undefined,
476
+ status: CardType,
477
+ definitionId?: string | undefined,
478
+ extensionKey?: string | undefined,
479
+ resourceType?: string | undefined,
480
+ error?: APIError | undefined,
481
+ ) => void;
482
+ };
483
+ track: {
484
+ appAccountConnected: (
485
+ definitionId?: string | undefined,
486
+ extensionKey?: string | undefined,
487
+ ) => void;
488
+ };
489
+ screen: {
490
+ authPopupEvent: (
491
+ definitionId?: string | undefined,
492
+ extensionKey?: string | undefined,
493
+ ) => void;
494
+ };
495
+ };
496
+
497
+ // @public (undocumented)
498
+ export function useSmartLinkEvents(): SmartLinkEvents;
499
+
500
+ // (No @packageDocumentation comment for this package)
501
+ ```