@atlaskit/editor-plugin-card 7.4.6 → 7.4.8

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.
Files changed (78) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/types/cardPluginType.d.ts +3 -3
  3. package/dist/types/nodeviews/blockCard.d.ts +7 -7
  4. package/dist/types/nodeviews/datasource.d.ts +5 -5
  5. package/dist/types/nodeviews/embedCard.d.ts +8 -8
  6. package/dist/types/nodeviews/genericCard.d.ts +19 -19
  7. package/dist/types/nodeviews/inlineCardWithAwareness.d.ts +1 -1
  8. package/dist/types/pm-plugins/actions.d.ts +1 -1
  9. package/dist/types/pm-plugins/doc.d.ts +5 -5
  10. package/dist/types/pm-plugins/util/state.d.ts +13 -13
  11. package/dist/types/types/index.d.ts +48 -48
  12. package/dist/types/ui/AwarenessWrapper/index.d.ts +4 -4
  13. package/dist/types/ui/ConfigureOverlay/index.d.ts +2 -2
  14. package/dist/types/ui/DatasourceAppearanceButton.d.ts +5 -5
  15. package/dist/types/ui/DatasourceDropdownOption.d.ts +3 -3
  16. package/dist/types/ui/DatasourceModal/index.d.ts +2 -2
  17. package/dist/types/ui/EditLinkToolbar.d.ts +10 -10
  18. package/dist/types/ui/EditToolbarButton/EditToolbarButtonPresentation.d.ts +1 -1
  19. package/dist/types/ui/EditToolbarButton/types.d.ts +4 -4
  20. package/dist/types/ui/EditorAnalyticsContext.d.ts +1 -1
  21. package/dist/types/ui/EditorLinkingPlatformAnalytics/common.d.ts +2 -2
  22. package/dist/types/ui/HyperlinkToolbarAppearance.d.ts +4 -4
  23. package/dist/types/ui/HyperlinkToolbarAppearanceDropdown.d.ts +1 -1
  24. package/dist/types/ui/LayoutButton/types.d.ts +4 -4
  25. package/dist/types/ui/LinkToolbarAppearance.d.ts +6 -6
  26. package/dist/types/ui/LinkToolbarAppearanceDropdown.d.ts +2 -2
  27. package/dist/types/ui/OpenPreviewButton/index.d.ts +2 -2
  28. package/dist/types/ui/Pulse/index.d.ts +6 -6
  29. package/dist/types/ui/ResizableEmbedCard.d.ts +2 -2
  30. package/dist/types/ui/ToolbarViewedEvent.d.ts +1 -1
  31. package/dist/types/ui/analytics/create-events-queue.d.ts +2 -2
  32. package/dist/types/ui/analytics/events-from-tr.d.ts +1 -1
  33. package/dist/types/ui/analytics/types.d.ts +11 -11
  34. package/dist/types/ui/analytics/utils.d.ts +1 -1
  35. package/dist/types/ui/datasourceErrorBoundary.d.ts +4 -4
  36. package/dist/types/ui/hooks/useLinkUpgradeDiscoverability.d.ts +4 -4
  37. package/dist/types/ui/preview/PreviewInvoker.d.ts +1 -1
  38. package/dist/types/ui/toolbar.d.ts +1 -1
  39. package/dist/types/ui/useFetchDatasourceInfo.d.ts +2 -2
  40. package/dist/types-ts4.5/cardPluginType.d.ts +3 -3
  41. package/dist/types-ts4.5/nodeviews/blockCard.d.ts +7 -7
  42. package/dist/types-ts4.5/nodeviews/datasource.d.ts +5 -5
  43. package/dist/types-ts4.5/nodeviews/embedCard.d.ts +8 -8
  44. package/dist/types-ts4.5/nodeviews/genericCard.d.ts +19 -19
  45. package/dist/types-ts4.5/nodeviews/inlineCardWithAwareness.d.ts +1 -1
  46. package/dist/types-ts4.5/pm-plugins/actions.d.ts +1 -1
  47. package/dist/types-ts4.5/pm-plugins/doc.d.ts +5 -5
  48. package/dist/types-ts4.5/pm-plugins/util/state.d.ts +13 -13
  49. package/dist/types-ts4.5/types/index.d.ts +48 -48
  50. package/dist/types-ts4.5/ui/AwarenessWrapper/index.d.ts +4 -4
  51. package/dist/types-ts4.5/ui/ConfigureOverlay/index.d.ts +2 -2
  52. package/dist/types-ts4.5/ui/DatasourceAppearanceButton.d.ts +5 -5
  53. package/dist/types-ts4.5/ui/DatasourceDropdownOption.d.ts +3 -3
  54. package/dist/types-ts4.5/ui/DatasourceModal/index.d.ts +2 -2
  55. package/dist/types-ts4.5/ui/EditLinkToolbar.d.ts +10 -10
  56. package/dist/types-ts4.5/ui/EditToolbarButton/EditToolbarButtonPresentation.d.ts +1 -1
  57. package/dist/types-ts4.5/ui/EditToolbarButton/types.d.ts +4 -4
  58. package/dist/types-ts4.5/ui/EditorAnalyticsContext.d.ts +1 -1
  59. package/dist/types-ts4.5/ui/EditorLinkingPlatformAnalytics/common.d.ts +2 -2
  60. package/dist/types-ts4.5/ui/HyperlinkToolbarAppearance.d.ts +4 -4
  61. package/dist/types-ts4.5/ui/HyperlinkToolbarAppearanceDropdown.d.ts +1 -1
  62. package/dist/types-ts4.5/ui/LayoutButton/types.d.ts +4 -4
  63. package/dist/types-ts4.5/ui/LinkToolbarAppearance.d.ts +6 -6
  64. package/dist/types-ts4.5/ui/LinkToolbarAppearanceDropdown.d.ts +2 -2
  65. package/dist/types-ts4.5/ui/OpenPreviewButton/index.d.ts +2 -2
  66. package/dist/types-ts4.5/ui/Pulse/index.d.ts +6 -6
  67. package/dist/types-ts4.5/ui/ResizableEmbedCard.d.ts +2 -2
  68. package/dist/types-ts4.5/ui/ToolbarViewedEvent.d.ts +1 -1
  69. package/dist/types-ts4.5/ui/analytics/create-events-queue.d.ts +2 -2
  70. package/dist/types-ts4.5/ui/analytics/events-from-tr.d.ts +1 -1
  71. package/dist/types-ts4.5/ui/analytics/types.d.ts +11 -11
  72. package/dist/types-ts4.5/ui/analytics/utils.d.ts +1 -1
  73. package/dist/types-ts4.5/ui/datasourceErrorBoundary.d.ts +4 -4
  74. package/dist/types-ts4.5/ui/hooks/useLinkUpgradeDiscoverability.d.ts +4 -4
  75. package/dist/types-ts4.5/ui/preview/PreviewInvoker.d.ts +1 -1
  76. package/dist/types-ts4.5/ui/toolbar.d.ts +1 -1
  77. package/dist/types-ts4.5/ui/useFetchDatasourceInfo.d.ts +2 -2
  78. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 7.4.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`265c1bf0cefa4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/265c1bf0cefa4) -
8
+ Sorted type and interface props to improve Atlaskit docs
9
+ - Updated dependencies
10
+
11
+ ## 7.4.7
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 7.4.6
4
18
 
5
19
  ### Patch Changes
@@ -15,10 +15,10 @@ import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
15
15
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
16
16
  import type { CardPluginOptions, CardPluginState } from './types';
17
17
  type DummyAnnotationPlugin = NextEditorPlugin<'annotation', {
18
- sharedState: InlineCommentPluginState;
19
18
  actions: {
20
19
  setInlineCommentDraftState: (isDraft: boolean, inputMethod: INPUT_METHOD) => Command;
21
20
  };
21
+ sharedState: InlineCommentPluginState;
22
22
  }>;
23
23
  export type CardPluginDependencies = [
24
24
  OptionalPlugin<FeatureFlagsPlugin>,
@@ -35,9 +35,9 @@ export type CardPluginDependencies = [
35
35
  OptionalPlugin<BasePlugin>
36
36
  ];
37
37
  export type CardPlugin = NextEditorPlugin<'card', {
38
- pluginConfiguration: CardPluginOptions | undefined;
38
+ actions: CardPluginActions;
39
39
  dependencies: CardPluginDependencies;
40
+ pluginConfiguration: CardPluginOptions | undefined;
40
41
  sharedState: CardPluginState | null;
41
- actions: CardPluginActions;
42
42
  }>;
43
43
  export {};
@@ -13,8 +13,8 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
13
13
  id?: string;
14
14
  });
15
15
  onResolve: (data: {
16
- url?: string;
17
16
  title?: string;
17
+ url?: string;
18
18
  }) => void;
19
19
  componentWillUnmount(): void;
20
20
  private removeCardDispatched;
@@ -37,16 +37,16 @@ export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
37
37
  destroy(): void;
38
38
  }
39
39
  export interface BlockCardNodeViewProperties {
40
- pmPluginFactoryParams: PMPluginFactoryParams;
41
40
  actionOptions: BlockCardNodeViewProps['actionOptions'];
42
- pluginInjectionApi: BlockCardNodeViewProps['pluginInjectionApi'];
43
- onClickCallback: BlockCardNodeViewProps['onClickCallback'];
44
41
  allowDatasource: boolean | undefined;
45
- inlineCardViewProducer: ReturnType<typeof getInlineNodeViewProducer>;
46
- isPageSSRed: BlockCardNodeViewProps['isPageSSRed'];
47
42
  CompetitorPrompt?: React.ComponentType<{
48
- sourceUrl: string;
49
43
  linkType?: string;
44
+ sourceUrl: string;
50
45
  }>;
46
+ inlineCardViewProducer: ReturnType<typeof getInlineNodeViewProducer>;
47
+ isPageSSRed: BlockCardNodeViewProps['isPageSSRed'];
48
+ onClickCallback: BlockCardNodeViewProps['onClickCallback'];
49
+ pluginInjectionApi: BlockCardNodeViewProps['pluginInjectionApi'];
50
+ pmPluginFactoryParams: PMPluginFactoryParams;
51
51
  }
52
52
  export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
@@ -13,13 +13,13 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
13
13
  import type { Decoration, DecorationSource, EditorView } from '@atlaskit/editor-prosemirror/view';
14
14
  import type { cardPlugin } from '../index';
15
15
  export interface DatasourceProps extends ReactComponentProps {
16
- node: PMNode;
17
- view: EditorView;
18
- getPos: getPosHandler;
19
- portalProviderAPI: PortalProviderAPI;
20
16
  eventDispatcher: EventDispatcher;
21
- pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
17
+ getPos: getPosHandler;
22
18
  isNodeNested?: boolean;
19
+ node: PMNode;
20
+ pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
21
+ portalProviderAPI: PortalProviderAPI;
22
+ view: EditorView;
23
23
  }
24
24
  interface DatasourceComponentProps extends ReactComponentProps, Pick<DatasourceProps, 'node' | 'view' | 'getPos'> {
25
25
  }
@@ -8,8 +8,8 @@ import type { cardPlugin } from '../index';
8
8
  import type { SmartCardProps } from './genericCard';
9
9
  export type EmbedCardState = {
10
10
  hasPreview: boolean;
11
- liveHeight?: number;
12
11
  initialAspectRatio?: number;
12
+ liveHeight?: number;
13
13
  };
14
14
  export declare class EmbedCardComponent extends React.PureComponent<SmartCardProps & {
15
15
  id?: string;
@@ -22,9 +22,9 @@ export declare class EmbedCardComponent extends React.PureComponent<SmartCardPro
22
22
  state: EmbedCardState;
23
23
  private getPosSafely;
24
24
  onResolve: (data: {
25
- url?: string;
26
- title?: string;
27
25
  aspectRatio?: number;
26
+ title?: string;
27
+ url?: string;
28
28
  }) => void;
29
29
  updateSize: (pctWidth: number | null, layout: RichMediaLayout) => true | undefined;
30
30
  private getLineLength;
@@ -55,13 +55,13 @@ export declare class EmbedCard extends ReactNodeView<EmbedCardNodeViewProps> {
55
55
  destroy(): void;
56
56
  }
57
57
  export interface EmbedCardNodeViewProperties {
58
+ actionOptions: EmbedCardNodeViewProps['actionOptions'];
58
59
  allowResizing: EmbedCardNodeViewProps['allowResizing'];
60
+ CompetitorPrompt?: EmbedCardNodeViewProps['CompetitorPrompt'];
59
61
  fullWidthMode: EmbedCardNodeViewProps['fullWidthMode'];
60
- pmPluginFactoryParams: PMPluginFactoryParams;
61
- pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
62
- actionOptions: EmbedCardNodeViewProps['actionOptions'];
63
- onClickCallback: EmbedCardNodeViewProps['onClickCallback'];
64
62
  isPageSSRed: EmbedCardNodeViewProps['isPageSSRed'];
65
- CompetitorPrompt?: EmbedCardNodeViewProps['CompetitorPrompt'];
63
+ onClickCallback: EmbedCardNodeViewProps['onClickCallback'];
64
+ pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
65
+ pmPluginFactoryParams: PMPluginFactoryParams;
66
66
  }
67
67
  export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
@@ -16,40 +16,40 @@ export type EditorContext<T> = React.Context<T> & {
16
16
  value: T;
17
17
  };
18
18
  export interface CardNodeViewProps extends ReactComponentProps {
19
- providerFactory?: ProviderFactory;
20
19
  eventDispatcher?: EventDispatcher;
20
+ providerFactory?: ProviderFactory;
21
21
  }
22
22
  export interface CardProps extends CardNodeViewProps {
23
+ __livePage?: boolean;
24
+ actionOptions?: BaseCardProps['actionOptions'];
25
+ allowResizing?: boolean;
23
26
  children?: React.ReactNode;
24
- node: PMNode;
25
- view: EditorView;
26
- getPos: getPosHandler;
27
27
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
28
28
  eventDispatcher?: EventDispatcher;
29
- allowResizing?: boolean;
30
29
  fullWidthMode?: boolean;
31
- useAlternativePreloader?: boolean;
32
- actionOptions?: BaseCardProps['actionOptions'];
33
- pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
30
+ getPos: getPosHandler;
31
+ hoverPreviewOptions?: BaseCardProps['hoverPreviewOptions'];
32
+ node: PMNode;
34
33
  onClickCallback?: OnClickCallback;
34
+ pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
35
35
  showHoverPreview?: BaseCardProps['showHoverPreview'];
36
- hoverPreviewOptions?: BaseCardProps['hoverPreviewOptions'];
37
- __livePage?: boolean;
36
+ useAlternativePreloader?: boolean;
37
+ view: EditorView;
38
38
  }
39
39
  export interface SmartCardProps extends CardProps {
40
- pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
41
- cardContext?: EditorContext<CardContext | undefined>;
42
- onClick?: EventHandler<MouseEvent | KeyboardEvent> | undefined;
43
- onResolve?: (tr: Transaction, title?: string) => void;
44
- isHovered?: boolean;
45
- allowEmbeds?: boolean;
46
40
  allowBlockCards?: boolean;
47
- enableInlineUpgradeFeatures?: boolean;
48
- isPageSSRed?: boolean;
41
+ allowEmbeds?: boolean;
42
+ cardContext?: EditorContext<CardContext | undefined>;
49
43
  CompetitorPrompt?: React.ComponentType<{
50
- sourceUrl: string;
51
44
  linkType?: string;
45
+ sourceUrl: string;
52
46
  }>;
47
+ enableInlineUpgradeFeatures?: boolean;
48
+ isHovered?: boolean;
49
+ isPageSSRed?: boolean;
50
+ onClick?: EventHandler<MouseEvent | KeyboardEvent> | undefined;
51
+ onResolve?: (tr: Transaction, title?: string) => void;
52
+ pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
53
53
  }
54
54
  /**
55
55
  *
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import type { SmartCardProps } from './genericCard';
3
3
  export type InlineCardWithAwarenessProps = {
4
- isPulseEnabled?: boolean;
5
4
  isOverlayEnabled?: boolean;
5
+ isPulseEnabled?: boolean;
6
6
  isSelected?: boolean;
7
7
  };
8
8
  export declare const InlineCardWithAwareness: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, pluginInjectionApi, onClick, isPulseEnabled, isOverlayEnabled, isSelected, isPageSSRed, appearance, }: SmartCardProps & InlineCardWithAwarenessProps) => React.JSX.Element>;
@@ -16,8 +16,8 @@ export declare const setProvider: (cardProvider: CardProvider | null) => (tr: Tr
16
16
  export declare const setDatasourceTableRef: (datasourceTableRef?: HTMLElement) => (tr: Transaction) => Transaction;
17
17
  export declare const setCardLayout: (layout: DatasourceTableLayout) => (tr: Transaction) => Transaction;
18
18
  export declare const setCardLayoutAndDatasourceTableRef: ({ layout, datasourceTableRef, }: {
19
- layout: DatasourceTableLayout;
20
19
  datasourceTableRef?: HTMLElement;
20
+ layout: DatasourceTableLayout;
21
21
  }) => (tr: Transaction) => Transaction;
22
22
  export declare const showLinkToolbar: (tr: Transaction) => Transaction;
23
23
  export declare const hideLinkToolbar: (tr: Transaction) => Transaction;
@@ -24,13 +24,13 @@ export type LinkNodes = {
24
24
  };
25
25
  export declare const getLinkNodeType: (appearance: CardAppearance, linkNodes: LinkNodes) => NodeType;
26
26
  type UpdateCardArgs = {
27
- state: EditorState;
28
- node: Node;
27
+ inputMethod?: string;
28
+ isDeletingConfig?: boolean;
29
29
  newAdf: DatasourceAdf | InlineCardAdf;
30
- view: EditorView;
30
+ node: Node;
31
31
  sourceEvent?: UIAnalyticsEvent;
32
- isDeletingConfig?: boolean;
33
- inputMethod?: string;
32
+ state: EditorState;
33
+ view: EditorView;
34
34
  };
35
35
  export declare const updateCardViaDatasource: (args: UpdateCardArgs) => void;
36
36
  export declare const insertDatasource: (state: EditorState, adf: DatasourceAdf | InlineCardAdf, view: EditorView, sourceEvent?: UIAnalyticsEvent) => void;
@@ -4,39 +4,39 @@ export declare const getPluginState: (editorState: EditorState) => CardPluginSta
4
4
  export declare const getPluginStateWithUpdatedPos: (pluginState: CardPluginState, tr: ReadonlyTransaction) => {
5
5
  requests: {
6
6
  pos: number;
7
- url: string;
7
+ analyticsAction?: import("@atlaskit/editor-common/analytics").ACTION;
8
8
  appearance: import("@atlaskit/editor-common/provider-factory").CardAppearance;
9
9
  compareLinkText: boolean;
10
- source: import("@atlaskit/editor-common/card").CardReplacementInputMethod;
11
10
  previousAppearance?: import("@atlaskit/editor-common/provider-factory").CardAppearance | "url";
12
- analyticsAction?: import("@atlaskit/editor-common/analytics").ACTION;
13
11
  shouldReplaceLink?: boolean;
12
+ source: import("@atlaskit/editor-common/card").CardReplacementInputMethod;
14
13
  sourceEvent?: import("@atlaskit/analytics-next").UIAnalyticsEvent | null | undefined;
14
+ url: string;
15
15
  }[];
16
16
  cards: {
17
17
  pos: number;
18
+ id?: string;
18
19
  title?: string;
19
20
  url?: string;
20
- id?: string;
21
21
  }[];
22
- provider: import("@atlaskit/editor-common/provider-factory").CardProvider | null;
22
+ allowBlockCards?: boolean;
23
+ allowEmbeds?: boolean;
24
+ datasourceModalType?: import("@atlaskit/editor-common/types").DatasourceModalType;
23
25
  datasourceStash: {
24
26
  [x: string]: {
25
27
  views: import("@atlaskit/linking-common").DatasourceAdfView[];
26
28
  };
27
29
  };
28
- showLinkingToolbar: boolean;
29
- smartLinkEvents?: import("@atlaskit/smart-card").SmartLinkEvents;
30
- editorAppearance?: import("@atlaskit/editor-common/types").EditorAppearance;
31
- showDatasourceModal: boolean;
32
- datasourceModalType?: import("@atlaskit/editor-common/types").DatasourceModalType;
33
30
  datasourceTableRef?: HTMLElement;
34
- layout?: import("../../ui/LayoutButton/types").DatasourceTableLayout;
31
+ editorAppearance?: import("@atlaskit/editor-common/types").EditorAppearance;
35
32
  inlineCardAwarenessCandidatePosition?: number;
33
+ layout?: import("../../ui/LayoutButton/types").DatasourceTableLayout;
36
34
  overlayCandidatePosition?: number;
35
+ provider: import("@atlaskit/editor-common/provider-factory").CardProvider | null;
37
36
  removeOverlay?: () => void;
38
37
  selectedInlineLinkPosition?: number;
39
- allowEmbeds?: boolean;
40
- allowBlockCards?: boolean;
38
+ showDatasourceModal: boolean;
39
+ showLinkingToolbar: boolean;
40
+ smartLinkEvents?: import("@atlaskit/smart-card").SmartLinkEvents;
41
41
  };
42
42
  export declare const getNewRequests: (oldState: CardPluginState | undefined, currentState: CardPluginState) => Request[];
@@ -15,20 +15,19 @@ export type DatasourceNode = Omit<Node, 'attrs'> & {
15
15
  readonly attrs: DatasourceAdf['attrs'] & Partial<RichMediaAttributes>;
16
16
  };
17
17
  export type CardInfo = {
18
- title?: string;
19
- url?: string;
20
18
  id?: string;
21
19
  pos: number;
20
+ title?: string;
21
+ url?: string;
22
22
  };
23
23
  export type Request = {
24
24
  /**
25
- * The position of the link in the doc this request for upgrade is for
26
- */
27
- pos: number;
28
- /**
29
- * The URL of the link being upgraded/resolved
25
+ * Analytics action to be used when disaptching
26
+ * analytics events once the link is successfully/unsuccessfully
27
+ * resolved. Preserves the users "intent" ie was this a link
28
+ * being inserted or updated?
30
29
  */
31
- url: string;
30
+ analyticsAction?: ACTION;
32
31
  /**
33
32
  * The requested appearance to upgrade to
34
33
  */
@@ -40,11 +39,9 @@ export type Request = {
40
39
  */
41
40
  compareLinkText: boolean;
42
41
  /**
43
- * Analytics input method which preserves "how" the change
44
- * has occured. Used when analytics are dispatched after the link
45
- * is successfully/unsuccessfully resolved.
42
+ * The position of the link in the doc this request for upgrade is for
46
43
  */
47
- source: CardReplacementInputMethod;
44
+ pos: number;
48
45
  /**
49
46
  * The previous appearance of the link
50
47
  * This is necessary when tracking an update of a link
@@ -52,13 +49,6 @@ export type Request = {
52
49
  * replacing with a hyperlink and queueing it for upgrade
53
50
  */
54
51
  previousAppearance?: CardAppearance | 'url';
55
- /**
56
- * Analytics action to be used when disaptching
57
- * analytics events once the link is successfully/unsuccessfully
58
- * resolved. Preserves the users "intent" ie was this a link
59
- * being inserted or updated?
60
- */
61
- analyticsAction?: ACTION;
62
52
  /**
63
53
  * Describes if the requested `appearance` MUST be returned by the card provider
64
54
  * when resolving the link, because the request is associated with the user intent
@@ -66,12 +56,22 @@ export type Request = {
66
56
  * should not be affected by "default appearances" or "user preferences"
67
57
  */
68
58
  shouldReplaceLink?: boolean;
59
+ /**
60
+ * Analytics input method which preserves "how" the change
61
+ * has occured. Used when analytics are dispatched after the link
62
+ * is successfully/unsuccessfully resolved.
63
+ */
64
+ source: CardReplacementInputMethod;
69
65
  /**
70
66
  * Source UI that triggered this step if relevant
71
67
  * Primarily for transfering link picker UI event from initial UI action
72
68
  * through to the end of the link queue/request saga
73
69
  */
74
70
  sourceEvent?: UIAnalyticsEvent | null | undefined;
71
+ /**
72
+ * The URL of the link being upgraded/resolved
73
+ */
74
+ url: string;
75
75
  };
76
76
  /**
77
77
  * Each key in the stash is URL.
@@ -81,57 +81,57 @@ type DatasourceStash = Record<string, {
81
81
  views: DatasourceAdfView[];
82
82
  }>;
83
83
  export type CardPluginState = {
84
- requests: Request[];
85
- provider: CardProvider | null;
84
+ allowBlockCards?: boolean;
85
+ allowEmbeds?: boolean;
86
86
  cards: CardInfo[];
87
- datasourceStash: DatasourceStash;
88
- showLinkingToolbar: boolean;
89
- smartLinkEvents?: SmartLinkEvents;
90
- editorAppearance?: EditorAppearance;
91
- showDatasourceModal: boolean;
92
87
  datasourceModalType?: DatasourceModalType;
88
+ datasourceStash: DatasourceStash;
93
89
  datasourceTableRef?: HTMLElement;
94
- layout?: DatasourceTableLayout;
90
+ editorAppearance?: EditorAppearance;
95
91
  inlineCardAwarenessCandidatePosition?: number;
92
+ layout?: DatasourceTableLayout;
96
93
  overlayCandidatePosition?: number;
94
+ provider: CardProvider | null;
97
95
  removeOverlay?: () => void;
96
+ requests: Request[];
98
97
  selectedInlineLinkPosition?: number;
99
- allowEmbeds?: boolean;
100
- allowBlockCards?: boolean;
98
+ showDatasourceModal: boolean;
99
+ showLinkingToolbar: boolean;
100
+ smartLinkEvents?: SmartLinkEvents;
101
101
  };
102
102
  export type CardPluginOptions = CardOptions & {
103
+ cardPluginEvents?: EditorCardPluginEvents<CardPluginEvent>;
104
+ CompetitorPrompt?: React.ComponentType<{
105
+ linkType?: string;
106
+ sourceUrl: string;
107
+ }>;
108
+ disableFloatingToolbar?: boolean;
103
109
  editorAppearance?: EditorAppearance;
104
110
  fullWidthMode?: boolean;
111
+ isPageSSRed?: boolean;
105
112
  linkPicker?: LinkPickerOptions;
106
- cardPluginEvents?: EditorCardPluginEvents<CardPluginEvent>;
107
113
  lpLinkPicker?: boolean;
108
- disableFloatingToolbar?: boolean;
109
114
  onClickCallback?: OnClickCallback;
110
- isPageSSRed?: boolean;
111
- CompetitorPrompt?: React.ComponentType<{
112
- sourceUrl: string;
113
- linkType?: string;
114
- }>;
115
115
  };
116
116
  export type SetProvider = {
117
- type: 'SET_PROVIDER';
118
117
  provider: CardProvider | null;
118
+ type: 'SET_PROVIDER';
119
119
  };
120
120
  export type Queue = {
121
- type: 'QUEUE';
122
121
  requests: Request[];
122
+ type: 'QUEUE';
123
123
  };
124
124
  export type Resolve = {
125
125
  type: 'RESOLVE';
126
126
  url: string;
127
127
  };
128
128
  export type Register = {
129
- type: 'REGISTER';
130
129
  info: CardInfo;
130
+ type: 'REGISTER';
131
131
  };
132
132
  export type RemoveCard = {
133
- type: 'REMOVE_CARD';
134
133
  info: Partial<CardInfo>;
134
+ type: 'REMOVE_CARD';
135
135
  };
136
136
  export type ShowLinkToolbar = {
137
137
  type: 'SHOW_LINK_TOOLBAR';
@@ -140,43 +140,43 @@ export type HideLinkToolbar = {
140
140
  type: 'HIDE_LINK_TOOLBAR';
141
141
  };
142
142
  export type ShowDatasourceModal = {
143
- type: 'SHOW_DATASOURCE_MODAL';
144
143
  modalType: DatasourceModalType;
144
+ type: 'SHOW_DATASOURCE_MODAL';
145
145
  };
146
146
  export type HideDatasourceModal = {
147
147
  type: 'HIDE_DATASOURCE_MODAL';
148
148
  };
149
149
  export type RegisterSmartCardEvents = {
150
- type: 'REGISTER_EVENTS';
151
150
  smartLinkEvents: SmartLinkEvents;
151
+ type: 'REGISTER_EVENTS';
152
152
  };
153
153
  export type SetDatasourceTableRef = {
154
- type: 'SET_DATASOURCE_TABLE_REF';
155
154
  datasourceTableRef?: HTMLElement;
155
+ type: 'SET_DATASOURCE_TABLE_REF';
156
156
  };
157
157
  export type SetCardLayout = {
158
- type: 'SET_CARD_LAYOUT';
159
158
  layout: DatasourceTableLayout;
159
+ type: 'SET_CARD_LAYOUT';
160
160
  };
161
161
  export type SetCardLayoutAndDatasourceTableRef = {
162
- type: 'SET_CARD_LAYOUT_AND_DATASOURCE_TABLE_REF';
163
- layout: DatasourceTableLayout;
164
162
  datasourceTableRef?: HTMLElement;
163
+ layout: DatasourceTableLayout;
164
+ type: 'SET_CARD_LAYOUT_AND_DATASOURCE_TABLE_REF';
165
165
  };
166
166
  type ClearOverlayCandidate = {
167
167
  type: 'CLEAR_OVERLAY_CANDIDATE';
168
168
  };
169
169
  type RegisterRemoveOverlayOnInsertedLink = {
170
- type: 'REGISTER_REMOVE_OVERLAY_ON_INSERTED_LINK';
171
170
  callback: () => void;
172
171
  info?: Register['info'];
172
+ type: 'REGISTER_REMOVE_OVERLAY_ON_INSERTED_LINK';
173
173
  };
174
174
  export type SetDatasourceStash = {
175
- type: 'SET_DATASOURCE_STASH';
176
175
  datasourceStash: {
177
176
  url: string;
178
177
  views: DatasourceAdfView[];
179
178
  };
179
+ type: 'SET_DATASOURCE_STASH';
180
180
  };
181
181
  export type RemoveDatasourceStash = {
182
182
  type: 'REMOVE_DATASOURCE_STASH';
@@ -1,15 +1,15 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import type { SmartCardProps } from '../../nodeviews/genericCard';
3
3
  type AwarenessWrapperProps = {
4
+ children: JSX.Element;
4
5
  isInserted?: boolean;
6
+ isOverlayEnabled?: boolean;
7
+ isPulseEnabled?: boolean;
5
8
  isResolvedViewRendered?: boolean;
6
- children: JSX.Element;
9
+ isSelected?: boolean;
7
10
  markMostRecentlyInsertedLink: (isLinkMostRecentlyInserted: boolean) => void;
8
11
  setOverlayHoveredStyles: (isHovered: boolean) => void;
9
12
  url: string;
10
- isOverlayEnabled?: boolean;
11
- isPulseEnabled?: boolean;
12
- isSelected?: boolean;
13
13
  } & Partial<SmartCardProps>;
14
14
  export declare const AwarenessWrapper: ({ cardContext, children, getPos, isInserted, isOverlayEnabled, isSelected, isResolvedViewRendered, isPulseEnabled, markMostRecentlyInsertedLink, pluginInjectionApi, setOverlayHoveredStyles, url, appearance, }: AwarenessWrapperProps) => jsx.JSX.Element;
15
15
  export {};
@@ -1,11 +1,11 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { type EditorView } from '@atlaskit/editor-prosemirror/view';
3
3
  declare const OverlayWrapper: ({ view, targetElementPos, children, isHoveredCallback: hoverCallback, onOpenLinkClick, }: {
4
- view: EditorView;
5
- targetElementPos: number | undefined;
6
4
  children: JSX.Element;
7
5
  /** Fired when the mouse enters or leaves the overlay button */
8
6
  isHoveredCallback: (isHovered: boolean) => void;
9
7
  onOpenLinkClick: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;
8
+ targetElementPos: number | undefined;
9
+ view: EditorView;
10
10
  }) => jsx.JSX.Element;
11
11
  export default OverlayWrapper;
@@ -5,13 +5,13 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
6
  import { type CardContext } from '@atlaskit/link-provider';
7
7
  export interface DatasourceAppearanceButtonProps {
8
- intl: IntlShape;
8
+ cardContext?: CardContext;
9
9
  editorAnalyticsApi?: EditorAnalyticsAPI;
10
- url: string;
11
- editorView?: EditorView;
12
10
  editorState: EditorState;
13
- cardContext?: CardContext;
14
- selected?: boolean;
11
+ editorView?: EditorView;
15
12
  inputMethod: string;
13
+ intl: IntlShape;
14
+ selected?: boolean;
15
+ url: string;
16
16
  }
17
17
  export declare const DatasourceAppearanceButton: ({ intl, editorAnalyticsApi, url, editorView, editorState, selected, inputMethod, }: DatasourceAppearanceButtonProps) => jsx.JSX.Element;
@@ -3,11 +3,11 @@ import type { IntlShape } from 'react-intl-next';
3
3
  import type { Command } from '@atlaskit/editor-common/types';
4
4
  interface Props {
5
5
  allowDatasource?: boolean;
6
+ dispatchCommand: (command: Command) => void;
7
+ inputMethod: string;
6
8
  intl: IntlShape;
7
- url: string;
8
9
  selected: boolean;
9
- inputMethod: string;
10
- dispatchCommand: (command: Command) => void;
10
+ url: string;
11
11
  }
12
12
  export declare const datasourceDisplayInformation: {
13
13
  title: {
@@ -4,9 +4,9 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { CardContext } from '@atlaskit/link-provider';
5
5
  import type { ModalTypeToComponentMap } from './ModalWithState';
6
6
  type DatasourceModalProps = {
7
- view: EditorView;
8
- editorAnalyticsApi?: EditorAnalyticsAPI;
9
7
  cardContext?: CardContext;
8
+ editorAnalyticsApi?: EditorAnalyticsAPI;
9
+ view: EditorView;
10
10
  } & ModalTypeToComponentMap;
11
11
  export declare const DatasourceModal: ({ view, cardContext, datasourceId: defaultDatasourceId, componentType: Component, }: DatasourceModalProps) => React.JSX.Element | null;
12
12
  export {};
@@ -9,15 +9,15 @@ import type { Node } from '@atlaskit/editor-prosemirror/model';
9
9
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
10
10
  import type { cardPlugin } from '../cardPlugin';
11
11
  export type EditLinkToolbarProps = {
12
- view: EditorView;
13
- providerFactory: ProviderFactory;
14
- url: string | undefined;
15
- text: string;
16
- node: Node;
17
- onSubmit?: (href: string, text?: string, inputMethod?: LinkInputType, analytic?: UIAnalyticsEvent | null | undefined) => void;
18
- linkPickerOptions?: LinkPickerOptions;
19
12
  forceFocusSelector: ForceFocusSelector | undefined;
13
+ linkPickerOptions?: LinkPickerOptions;
20
14
  lpLinkPicker: boolean;
15
+ node: Node;
16
+ onSubmit?: (href: string, text?: string, inputMethod?: LinkInputType, analytic?: UIAnalyticsEvent | null | undefined) => void;
17
+ providerFactory: ProviderFactory;
18
+ text: string;
19
+ url: string | undefined;
20
+ view: EditorView;
21
21
  };
22
22
  export declare function HyperlinkAddToolbarWithState({ linkPickerOptions, onSubmit, displayText, displayUrl, providerFactory, view, onCancel, invokeMethod, lpLinkPicker, onClose, onEscapeCallback, onClickAwayCallback, }: HyperlinkAddToolbarProps): React.JSX.Element;
23
23
  export declare class EditLinkToolbar extends React.Component<EditLinkToolbarProps> {
@@ -28,10 +28,10 @@ export declare class EditLinkToolbar extends React.Component<EditLinkToolbarProp
28
28
  }
29
29
  export declare const getEditLinkCallback: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, scrollIntoView: boolean) => Command;
30
30
  export declare const buildEditLinkToolbar: ({ providerFactory, node, pluginInjectionApi, linkPicker, lpLinkPicker, }: {
31
- providerFactory: ProviderFactory;
32
- node: Node;
33
- pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
34
31
  linkPicker?: LinkPickerOptions;
35
32
  lpLinkPicker: boolean;
33
+ node: Node;
34
+ pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
35
+ providerFactory: ProviderFactory;
36
36
  }) => FloatingToolbarItem<Command>;
37
37
  export declare const editLinkToolbarConfig: (showLinkingToolbar: boolean, lpLinkPicker?: boolean) => Partial<FloatingToolbarConfig>;
@@ -1,9 +1,9 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import type { EditDatasourceToolbarButtonWithCommonProps, EditVariant } from './types';
3
3
  interface EditToolbarPresentationProps extends EditDatasourceToolbarButtonWithCommonProps {
4
- extensionKey?: string;
5
4
  datasourceId?: string;
6
5
  editVariant: EditVariant;
6
+ extensionKey?: string;
7
7
  }
8
8
  declare const EditToolbarButtonPresentation: ({ datasourceId, currentAppearance, editorAnalyticsApi, editVariant, editorView, extensionKey, onLinkEditClick, intl, }: EditToolbarPresentationProps) => jsx.JSX.Element | null;
9
9
  export default EditToolbarButtonPresentation;
@@ -7,11 +7,11 @@ import type { CardContext } from '@atlaskit/link-provider';
7
7
  import { type CardType } from '../../types';
8
8
  export type EditVariant = 'none' | 'edit-link' | 'edit-datasource' | 'edit-dropdown';
9
9
  export interface EditDatasourceToolbarButtonWithCommonProps {
10
- intl: IntlShape;
11
- onLinkEditClick: Command;
10
+ currentAppearance?: CardType;
12
11
  editorAnalyticsApi?: EditorAnalyticsAPI;
13
12
  editorView?: EditorView;
14
- currentAppearance?: CardType;
13
+ intl: IntlShape;
14
+ onLinkEditClick: Command;
15
15
  }
16
16
  export interface EditDatasourceToolbarButtonWithUrlProps extends EditDatasourceToolbarButtonWithCommonProps {
17
17
  cardContext?: CardContext;
@@ -24,7 +24,7 @@ export interface EditDatasourceToolbarButtonWithDatasourceIdProps extends EditDa
24
24
  }
25
25
  export type EditDatasourceToolbarButtonProps = EditDatasourceToolbarButtonWithCommonProps & {
26
26
  cardContext?: CardContext;
27
- url?: string;
28
27
  datasourceId?: string;
29
28
  node?: Node;
29
+ url?: string;
30
30
  };