@atlaskit/smart-card 44.24.2 → 44.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/extractors/flexible/extract-state.js +4 -1
  3. package/dist/cjs/ssr.js +14 -3
  4. package/dist/cjs/state/actions/index.js +111 -23
  5. package/dist/cjs/state/hooks/use-resolve/index.js +7 -13
  6. package/dist/cjs/state/hooks/use-response/index.js +9 -3
  7. package/dist/cjs/state/hooks/usePrefetch.js +7 -6
  8. package/dist/cjs/state/hooks/useSmartLink.js +12 -3
  9. package/dist/cjs/state/hooks-external/useSmartLinkActions.js +3 -1
  10. package/dist/cjs/utils/analytics/analytics.js +1 -1
  11. package/dist/cjs/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +1 -1
  12. package/dist/cjs/view/CardWithUrl/component.js +25 -3
  13. package/dist/cjs/view/CardWithUrl/loader.js +7 -1
  14. package/dist/cjs/view/EmbedCard/useEmbedResolvePostMessageListener.js +4 -1
  15. package/dist/cjs/view/FlexibleCard/components/actions/action/server-action/index.js +5 -1
  16. package/dist/cjs/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/index.js +5 -1
  17. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +2 -1
  18. package/dist/cjs/view/LinkUrl/index.js +1 -1
  19. package/dist/es2019/extractors/flexible/extract-state.js +4 -1
  20. package/dist/es2019/ssr.js +14 -3
  21. package/dist/es2019/state/actions/index.js +85 -12
  22. package/dist/es2019/state/hooks/use-resolve/index.js +11 -2
  23. package/dist/es2019/state/hooks/use-response/index.js +9 -5
  24. package/dist/es2019/state/hooks/usePrefetch.js +8 -7
  25. package/dist/es2019/state/hooks/useSmartLink.js +13 -3
  26. package/dist/es2019/state/hooks-external/useSmartLinkActions.js +3 -1
  27. package/dist/es2019/utils/analytics/analytics.js +1 -1
  28. package/dist/es2019/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +1 -1
  29. package/dist/es2019/view/CardWithUrl/component.js +28 -4
  30. package/dist/es2019/view/CardWithUrl/loader.js +7 -1
  31. package/dist/es2019/view/EmbedCard/useEmbedResolvePostMessageListener.js +4 -1
  32. package/dist/es2019/view/FlexibleCard/components/actions/action/server-action/index.js +5 -1
  33. package/dist/es2019/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/index.js +5 -1
  34. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +2 -1
  35. package/dist/es2019/view/LinkUrl/index.js +1 -1
  36. package/dist/esm/extractors/flexible/extract-state.js +4 -1
  37. package/dist/esm/ssr.js +14 -3
  38. package/dist/esm/state/actions/index.js +111 -23
  39. package/dist/esm/state/hooks/use-resolve/index.js +7 -13
  40. package/dist/esm/state/hooks/use-response/index.js +9 -3
  41. package/dist/esm/state/hooks/usePrefetch.js +7 -6
  42. package/dist/esm/state/hooks/useSmartLink.js +13 -3
  43. package/dist/esm/state/hooks-external/useSmartLinkActions.js +3 -1
  44. package/dist/esm/utils/analytics/analytics.js +1 -1
  45. package/dist/esm/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +1 -1
  46. package/dist/esm/view/CardWithUrl/component.js +26 -4
  47. package/dist/esm/view/CardWithUrl/loader.js +7 -1
  48. package/dist/esm/view/EmbedCard/useEmbedResolvePostMessageListener.js +4 -1
  49. package/dist/esm/view/FlexibleCard/components/actions/action/server-action/index.js +5 -1
  50. package/dist/esm/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/index.js +5 -1
  51. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +2 -1
  52. package/dist/esm/view/LinkUrl/index.js +1 -1
  53. package/dist/types/state/actions/index.d.ts +3 -2
  54. package/dist/types/state/hooks/use-resolve/index.d.ts +9 -1
  55. package/dist/types/state/hooks/use-response/index.d.ts +2 -2
  56. package/dist/types/state/hooks/usePrefetch.d.ts +2 -1
  57. package/dist/types/state/hooks/useSmartLink.d.ts +14 -6
  58. package/dist/types-ts4.5/state/actions/index.d.ts +3 -2
  59. package/dist/types-ts4.5/state/hooks/use-resolve/index.d.ts +9 -1
  60. package/dist/types-ts4.5/state/hooks/use-response/index.d.ts +2 -2
  61. package/dist/types-ts4.5/state/hooks/usePrefetch.d.ts +2 -1
  62. package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +14 -6
  63. package/package.json +6 -3
@@ -1,3 +1,11 @@
1
- declare const useResolve: () => ((url: string, isReloading?: boolean, isMetadataRequest?: boolean, id?: string) => Promise<void>);
1
+ import type { CardAppearance } from '@atlaskit/linking-common';
2
+ export interface ResolveUrlParams {
3
+ appearance?: CardAppearance;
4
+ id?: string;
5
+ isMetadataRequest?: boolean;
6
+ isReloading?: boolean;
7
+ url: string;
8
+ }
9
+ declare const useResolve: () => ((params: ResolveUrlParams) => Promise<void>);
2
10
  export default useResolve;
3
11
  export type ResolveFunction = ReturnType<typeof useResolve>;
@@ -1,7 +1,7 @@
1
1
  import { type JsonLd } from '@atlaskit/json-ld-types';
2
- import { APIError } from '@atlaskit/linking-common';
2
+ import { APIError, type MetadataStatus } from '@atlaskit/linking-common';
3
3
  declare const useResponse: () => {
4
4
  handleResolvedLinkError: (url: string, error: APIError, response?: JsonLd.Response, isMetadataRequest?: boolean) => void;
5
- handleResolvedLinkResponse: (resourceUrl: string, response: JsonLd.Response | undefined, isReloading?: boolean, isMetadataRequest?: boolean) => void;
5
+ handleResolvedLinkResponse: (resourceUrl: string, response: JsonLd.Response | undefined, isReloading?: boolean, isMetadataRequest?: boolean, metadataStatus?: MetadataStatus) => void;
6
6
  };
7
7
  export default useResponse;
@@ -1 +1,2 @@
1
- export declare function usePrefetch(url: string): () => Promise<void>;
1
+ import { type CardAppearance } from '@atlaskit/linking-common';
2
+ export declare function usePrefetch(url: string, appearance?: CardAppearance): () => Promise<void>;
@@ -1,19 +1,25 @@
1
1
  import type { JsonLd } from '@atlaskit/json-ld-types';
2
2
  import { type CardAuthFlowOpts, type CardProviderRenderers } from '@atlaskit/link-provider';
3
- import type { CardState } from '@atlaskit/linking-common';
3
+ import type { CardAppearance, CardState } from '@atlaskit/linking-common';
4
4
  import type { InvokeClientOpts, InvokeServerOpts } from '../../model/invoke-opts';
5
5
  import type { CardInnerAppearance } from '../../view/Card/types';
6
- export declare function useSmartLink(id: string, url: string): {
7
- state: CardState;
6
+ /**
7
+ * Hook for smart link state and actions.
8
+ * @param id - Unique identifier for the smart link
9
+ * @param url - The URL to resolve
10
+ * @param appearance - Card appearance hint for ORS to optimize response payload.
11
+ * When 'inline', ORS returns minimal data (title, status).
12
+ * When 'block' or 'embed', ORS returns full data including summary.
13
+ */
14
+ export declare function useSmartLink(id: string, url: string, appearance?: CardAppearance): {
8
15
  actions: {
9
- register: () => Promise<void>;
10
- reload: () => void;
11
16
  authorize: (appearance: CardInnerAppearance) => void;
12
17
  invoke: (opts: InvokeClientOpts | InvokeServerOpts, appearance: CardInnerAppearance) => Promise<JsonLd.Response | void>;
13
18
  loadMetadata: () => Promise<void> | undefined;
19
+ register: () => Promise<void>;
20
+ reload: (appearance?: CardAppearance) => void;
14
21
  };
15
22
  config: CardAuthFlowOpts | undefined;
16
- renderers: CardProviderRenderers | undefined;
17
23
  error: Error | null;
18
24
  isPreviewPanelAvailable: ((props: {
19
25
  ari: string;
@@ -27,4 +33,6 @@ export declare function useSmartLink(id: string, url: string): {
27
33
  };
28
34
  url: string;
29
35
  }) => void) | undefined;
36
+ renderers: CardProviderRenderers | undefined;
37
+ state: CardState;
30
38
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "44.24.2",
3
+ "version": "44.25.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -93,7 +93,7 @@
93
93
  "@atlaskit/ufo": "^0.5.0",
94
94
  "@atlaskit/width-detector": "^5.1.0",
95
95
  "@babel/runtime": "^7.0.0",
96
- "@compiled/react": "patch:@compiled/react@npm%3A0.20.0#~/.yarn/patches/@compiled-react-npm-0.20.0-a771aa67a6.patch",
96
+ "@compiled/react": "^0.20.0",
97
97
  "@formatjs/intl-utils": "^3.8.4",
98
98
  "facepaint": "^1.2.1",
99
99
  "lru_map": "^0.4.1",
@@ -107,7 +107,7 @@
107
107
  "uuid": "^3.1.0"
108
108
  },
109
109
  "peerDependencies": {
110
- "@atlaskit/link-provider": "^4.6.0",
110
+ "@atlaskit/link-provider": "^4.7.0",
111
111
  "react": "^18.2.0",
112
112
  "react-dom": "^18.2.0",
113
113
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -282,6 +282,9 @@
282
282
  },
283
283
  "platform_sl_3p_auth_inline_tailored_cta_killswitch": {
284
284
  "type": "boolean"
285
+ },
286
+ "platform_smartlink_inline_resolve_optimization": {
287
+ "type": "boolean"
285
288
  }
286
289
  },
287
290
  "compassUnitTestMetricSourceId": "ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:metric-source/c5751cc6-3513-4070-9deb-af31e86aed34/f74ef1bc-7240-4aac-9dc8-9dc43b502089"