@atlaskit/smart-card 45.21.8 → 45.22.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 (39) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/entry-points/embedded-confluence-page.js +18 -0
  3. package/dist/cjs/state/services/current-site-cloud-id/CurrentSiteCloudIdService.js +2 -2
  4. package/dist/cjs/state/services/personalization/PersonalizationService.js +2 -2
  5. package/dist/cjs/utils/analytics/analytics.js +1 -1
  6. package/dist/cjs/utils/analytics/getSmartLinkAnalyticsContext.js +2 -2
  7. package/dist/cjs/view/EmbedCard/components/IFrame.js +33 -13
  8. package/dist/cjs/view/EmbedCard/components/embedded-confluence-page-context.js +22 -0
  9. package/dist/cjs/view/EmbedCard/components/loadEmbeddedConfluencePage.js +44 -0
  10. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/index.js +2 -2
  11. package/dist/cjs/view/LinkUrl/index.js +1 -1
  12. package/dist/es2019/entry-points/embedded-confluence-page.js +1 -0
  13. package/dist/es2019/state/services/current-site-cloud-id/CurrentSiteCloudIdService.js +1 -1
  14. package/dist/es2019/state/services/personalization/PersonalizationService.js +1 -1
  15. package/dist/es2019/utils/analytics/analytics.js +1 -1
  16. package/dist/es2019/utils/analytics/getSmartLinkAnalyticsContext.js +1 -1
  17. package/dist/es2019/view/EmbedCard/components/IFrame.js +27 -13
  18. package/dist/es2019/view/EmbedCard/components/embedded-confluence-page-context.js +15 -0
  19. package/dist/es2019/view/EmbedCard/components/loadEmbeddedConfluencePage.js +14 -0
  20. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/index.js +1 -1
  21. package/dist/es2019/view/LinkUrl/index.js +1 -1
  22. package/dist/esm/entry-points/embedded-confluence-page.js +1 -0
  23. package/dist/esm/state/services/current-site-cloud-id/CurrentSiteCloudIdService.js +1 -1
  24. package/dist/esm/state/services/personalization/PersonalizationService.js +1 -1
  25. package/dist/esm/utils/analytics/analytics.js +1 -1
  26. package/dist/esm/utils/analytics/getSmartLinkAnalyticsContext.js +1 -1
  27. package/dist/esm/view/EmbedCard/components/IFrame.js +31 -13
  28. package/dist/esm/view/EmbedCard/components/embedded-confluence-page-context.js +17 -0
  29. package/dist/esm/view/EmbedCard/components/loadEmbeddedConfluencePage.js +33 -0
  30. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/feature-discovery/index.js +1 -1
  31. package/dist/esm/view/LinkUrl/index.js +1 -1
  32. package/dist/types/entry-points/embedded-confluence-page.d.ts +1 -0
  33. package/dist/types/hooks/useConfluencePageData.d.ts +1 -1
  34. package/dist/types/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
  35. package/dist/types/view/EmbedCard/components/IFrame.d.ts +5 -1
  36. package/dist/types/view/EmbedCard/components/embedded-confluence-page-context.d.ts +29 -0
  37. package/dist/types/view/EmbedCard/components/loadEmbeddedConfluencePage.d.ts +8 -0
  38. package/embedded-confluence-page/package.json +10 -0
  39. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 45.22.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`790c4f8c5dee0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/790c4f8c5dee0) -
8
+ Add opt-in `/confluence-renderer` and `/local-model` entry points, lazy-load embedded-confluence
9
+ in smart-card, and register chat autocomplete in the initial editor preset. Trello does not
10
+ download embedded-confluence or web-llm with the default chat bundle. Confluence users keep focus
11
+ when `platform_editor_ai_autocomplete_rovo_chat_editor` is on because the plugin is no longer
12
+ added after mount.
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
18
+ ## 45.21.9
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+
3
24
  ## 45.21.8
4
25
 
5
26
  ### Patch Changes
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "EmbeddedConfluencePageProvider", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _embeddedConfluencePageContext.EmbeddedConfluencePageProvider;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "useEmbeddedConfluencePage", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _embeddedConfluencePageContext.useEmbeddedConfluencePage;
16
+ }
17
+ });
18
+ var _embeddedConfluencePageContext = require("../view/EmbedCard/components/embedded-confluence-page-context");
@@ -10,12 +10,12 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
10
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
- var _storageClient = require("@atlaskit/frontend-utilities/storage-client");
13
+ var _StorageClient = require("@atlaskit/frontend-utilities/StorageClient");
14
14
  var _linkingCommon = require("@atlaskit/linking-common");
15
15
  var _cloudIdStorageItemKey = require("./cloudIdStorageItemKey");
16
16
  var _constants = require("./constants");
17
17
  var _normalizeBaseUri = require("./normalizeBaseUri");
18
- var smartCardStorage = new _storageClient.StorageClient(_constants.currentSiteCloudIdConstants.SMART_CARD_STORAGE_SCOPE);
18
+ var smartCardStorage = new _StorageClient.StorageClient(_constants.currentSiteCloudIdConstants.SMART_CARD_STORAGE_SCOPE);
19
19
  var CurrentSiteCloudIdService = exports.CurrentSiteCloudIdService = /*#__PURE__*/function () {
20
20
  function CurrentSiteCloudIdService() {
21
21
  (0, _classCallCheck2.default)(this, CurrentSiteCloudIdService);
@@ -12,9 +12,9 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
12
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
15
- var _storageClient = require("@atlaskit/frontend-utilities/storage-client");
15
+ var _StorageClient = require("@atlaskit/frontend-utilities/StorageClient");
16
16
  var _constants = require("./constants");
17
- var smartCardStorage = new _storageClient.StorageClient(_constants.personalizationConstants.PERSONALIZATION_STORAGE_SCOPE);
17
+ var smartCardStorage = new _StorageClient.StorageClient(_constants.personalizationConstants.PERSONALIZATION_STORAGE_SCOPE);
18
18
 
19
19
  /** Keys written by this service in localStorage when using {@link smartCardStorage}. */
20
20
  var LOCAL_STORAGE_ROW_KEY_PREFIX = "".concat(_constants.personalizationConstants.PERSONALIZATION_STORAGE_SCOPE, "_").concat(_constants.personalizationConstants.PERSONALIZATION_STORAGE_ITEM_KEY_PREFIX);
@@ -24,7 +24,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
24
24
  var context = exports.context = {
25
25
  componentName: 'smart-cards',
26
26
  packageName: "@atlaskit/smart-card" || '',
27
- packageVersion: "45.21.7" || ''
27
+ packageVersion: "45.21.9" || ''
28
28
  };
29
29
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
30
30
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.getSmartLinkAnalyticsContext = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _resolvedAttributes = require("@atlaskit/link-analytics/resolved-attributes");
9
+ var _getResolvedAttributes = require("@atlaskit/link-analytics/get-resolved-attributes");
10
10
  var _analytics = require("./analytics");
11
11
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
12
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -15,7 +15,7 @@ var getExtendedResolvedAttributes = function getExtendedResolvedAttributes(linkD
15
15
  return _objectSpread({
16
16
  definitionId: (_details$meta$definit = details === null || details === void 0 || (_details$meta = details.meta) === null || _details$meta === void 0 ? void 0 : _details$meta.definitionId) !== null && _details$meta$definit !== void 0 ? _details$meta$definit : null,
17
17
  resourceType: (_details$meta$resourc = details === null || details === void 0 || (_details$meta2 = details.meta) === null || _details$meta2 === void 0 ? void 0 : _details$meta2.resourceType) !== null && _details$meta$resourc !== void 0 ? _details$meta$resourc : null
18
- }, (0, _resolvedAttributes.getResolvedAttributes)(linkDetails, details, linkStatus, error));
18
+ }, (0, _getResolvedAttributes.getResolvedAttributes)(linkDetails, details, linkStatus, error));
19
19
  };
20
20
  var getSmartLinkAnalyticsContext = exports.getSmartLinkAnalyticsContext = function getSmartLinkAnalyticsContext(_ref) {
21
21
  var display = _ref.display,
@@ -1,18 +1,33 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.IFrame = void 0;
8
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
- var _react = _interopRequireDefault(require("react"));
11
- var _page = require("@atlaskit/embedded-confluence/page");
11
+ var _react = _interopRequireWildcard(require("react"));
12
12
  var _useConfluencePageData = require("../../../hooks/useConfluencePageData");
13
+ var _embeddedConfluencePageContext = require("./embedded-confluence-page-context");
14
+ var _loadEmbeddedConfluencePage = require("./loadEmbeddedConfluencePage");
13
15
  var _excluded = ["childRef", "className", "extensionKey"];
16
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
17
+ var LazyEmbeddedConfluencePage = /*#__PURE__*/(0, _react.lazy)(function () {
18
+ return (0, _loadEmbeddedConfluencePage.loadEmbeddedConfluencePage)().then(function (Page) {
19
+ return {
20
+ default: Page
21
+ };
22
+ });
23
+ });
24
+
14
25
  /**
15
- * Iframe element isolated for DI purposes
26
+ * Iframe element isolated for DI purposes.
27
+ *
28
+ * Confluence `Page` is a dynamic import (or an injected host component) so
29
+ * Trello and other non-Confluence embeds do not statically pull
30
+ * `@atlaskit/embedded-confluence`.
16
31
  */
17
32
  var IFrame = exports.IFrame = function IFrame(_ref) {
18
33
  var childRef = _ref.childRef,
@@ -20,9 +35,22 @@ var IFrame = exports.IFrame = function IFrame(_ref) {
20
35
  extensionKey = _ref.extensionKey,
21
36
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
22
37
  var confluencePageData = (0, _useConfluencePageData.useConfluencePageData)(props.src || '', extensionKey || '');
38
+ var InjectedPage = (0, _embeddedConfluencePageContext.useEmbeddedConfluencePage)();
39
+ var Page = InjectedPage !== null && InjectedPage !== void 0 ? InjectedPage : LazyEmbeddedConfluencePage;
40
+ var fallbackIframe =
41
+ /*#__PURE__*/
42
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
43
+ _react.default.createElement("iframe", (0, _extends2.default)({
44
+ className: className
45
+ }, props, {
46
+ ref: childRef,
47
+ title: props.title
48
+ }));
23
49
 
24
50
  // Conditional rendering: Page component for lp-cc-embed URLs, iframe for everything else
25
- return confluencePageData ? /*#__PURE__*/_react.default.createElement(_page.Page, {
51
+ return confluencePageData ? /*#__PURE__*/_react.default.createElement(_react.Suspense, {
52
+ fallback: fallbackIframe
53
+ }, /*#__PURE__*/_react.default.createElement(Page, {
26
54
  hostname: confluencePageData.hostname,
27
55
  spaceKey: confluencePageData.spaceKey,
28
56
  contentId: confluencePageData.contentId,
@@ -38,13 +66,5 @@ var IFrame = exports.IFrame = function IFrame(_ref) {
38
66
  allowedFeatures: confluencePageData.allowedFeatures,
39
67
  themeState: confluencePageData.themeStateObject,
40
68
  userInfo: confluencePageData.userInfo
41
- }) :
42
- /*#__PURE__*/
43
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
44
- _react.default.createElement("iframe", (0, _extends2.default)({
45
- className: className
46
- }, props, {
47
- ref: childRef,
48
- title: props.title
49
- }));
69
+ })) : fallbackIframe;
50
70
  };
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useEmbeddedConfluencePage = exports.EmbeddedConfluencePageProvider = void 0;
7
+ var _react = require("react");
8
+ /**
9
+ * Props forwarded to `@atlaskit/embedded-confluence` `Page` from the embed iframe.
10
+ * Kept local so this module never imports the Confluence package.
11
+ */
12
+
13
+ var EmbeddedConfluencePageContext = /*#__PURE__*/(0, _react.createContext)(null);
14
+
15
+ /**
16
+ * Hosts that want Confluence page embeds can inject `Page` here so Trello and
17
+ * other products never compile `@atlaskit/embedded-confluence` as a hard import.
18
+ */
19
+ var EmbeddedConfluencePageProvider = exports.EmbeddedConfluencePageProvider = EmbeddedConfluencePageContext.Provider;
20
+ var useEmbeddedConfluencePage = exports.useEmbeddedConfluencePage = function useEmbeddedConfluencePage() {
21
+ return (0, _react.useContext)(EmbeddedConfluencePageContext);
22
+ };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.loadEmbeddedConfluencePage = loadEmbeddedConfluencePage;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != (0, _typeof2.default)(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
12
+ /**
13
+ * Async factory for the Confluence embed `Page` component.
14
+ *
15
+ * Kept in its own module so `@atlaskit/embedded-confluence` is a dynamic
16
+ * import only — hosts that never render a Confluence embed URL do not
17
+ * download this chunk.
18
+ */
19
+ function loadEmbeddedConfluencePage() {
20
+ return _loadEmbeddedConfluencePage.apply(this, arguments);
21
+ }
22
+ function _loadEmbeddedConfluencePage() {
23
+ _loadEmbeddedConfluencePage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
24
+ var _yield$import, Page;
25
+ return _regenerator.default.wrap(function (_context) {
26
+ while (1) switch (_context.prev = _context.next) {
27
+ case 0:
28
+ _context.next = 1;
29
+ return Promise.resolve().then(function () {
30
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_smart-card-embedded-confluence" */
31
+ '@atlaskit/embedded-confluence'));
32
+ });
33
+ case 1:
34
+ _yield$import = _context.sent;
35
+ Page = _yield$import.Page;
36
+ return _context.abrupt("return", Page);
37
+ case 2:
38
+ case "end":
39
+ return _context.stop();
40
+ }
41
+ }, _callee);
42
+ }));
43
+ return _loadEmbeddedConfluencePage.apply(this, arguments);
44
+ }
@@ -10,7 +10,7 @@ require("./index.compiled.css");
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var React = _react;
12
12
  var _runtime = require("@compiled/react/runtime");
13
- var _storageClient = require("@atlaskit/frontend-utilities/storage-client");
13
+ var _StorageClient = require("@atlaskit/frontend-utilities/StorageClient");
14
14
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
15
15
  var LOCAL_STORAGE_CLIENT_KEY = '@atlaskit/smart-card';
16
16
  var LOCAL_STORAGE_DISCOVERY_KEY = 'action-discovery-ai-summarise';
@@ -30,7 +30,7 @@ var FeatureDiscovery = function FeatureDiscovery(_ref) {
30
30
  testId = _ref.testId;
31
31
  var renderedTime = (0, _react.useRef)();
32
32
  var storageClient = (0, _react.useMemo)(function () {
33
- return new _storageClient.StorageClient(LOCAL_STORAGE_CLIENT_KEY);
33
+ return new _StorageClient.StorageClient(LOCAL_STORAGE_CLIENT_KEY);
34
34
  }, []);
35
35
  var discovered = (0, _react.useMemo)(function () {
36
36
  try {
@@ -19,7 +19,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
19
19
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
20
20
  var PACKAGE_DATA = {
21
21
  packageName: "@atlaskit/smart-card",
22
- packageVersion: "45.21.7",
22
+ packageVersion: "45.21.9",
23
23
  componentName: 'linkUrl'
24
24
  };
25
25
  var LinkUrl = function LinkUrl(_ref) {
@@ -0,0 +1 @@
1
+ export { EmbeddedConfluencePageProvider, useEmbeddedConfluencePage } from '../view/EmbedCard/components/embedded-confluence-page-context';
@@ -1,5 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { StorageClient } from '@atlaskit/frontend-utilities/storage-client';
2
+ import { StorageClient } from '@atlaskit/frontend-utilities/StorageClient';
3
3
  import { request } from '@atlaskit/linking-common';
4
4
  import { cloudIdStorageItemKey } from './cloudIdStorageItemKey';
5
5
  import { currentSiteCloudIdConstants } from './constants';
@@ -1,5 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { StorageClient } from '@atlaskit/frontend-utilities/storage-client';
2
+ import { StorageClient } from '@atlaskit/frontend-utilities/StorageClient';
3
3
  import { personalizationConstants } from './constants';
4
4
  const smartCardStorage = new StorageClient(personalizationConstants.PERSONALIZATION_STORAGE_SCOPE);
5
5
 
@@ -3,7 +3,7 @@ export const ANALYTICS_CHANNEL = 'media';
3
3
  export const context = {
4
4
  componentName: 'smart-cards',
5
5
  packageName: "@atlaskit/smart-card" || '',
6
- packageVersion: "45.21.7" || ''
6
+ packageVersion: "45.21.9" || ''
7
7
  };
8
8
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
9
9
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,4 +1,4 @@
1
- import { getResolvedAttributes } from '@atlaskit/link-analytics/resolved-attributes';
1
+ import { getResolvedAttributes } from '@atlaskit/link-analytics/get-resolved-attributes';
2
2
  import { context } from './analytics';
3
3
  const getExtendedResolvedAttributes = (linkDetails, details, linkStatus, error) => {
4
4
  var _details$meta$definit, _details$meta, _details$meta$resourc, _details$meta2;
@@ -1,9 +1,18 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React from 'react';
3
- import { Page } from '@atlaskit/embedded-confluence/page';
2
+ import React, { lazy, Suspense } from 'react';
4
3
  import { useConfluencePageData } from '../../../hooks/useConfluencePageData';
4
+ import { useEmbeddedConfluencePage } from './embedded-confluence-page-context';
5
+ import { loadEmbeddedConfluencePage } from './loadEmbeddedConfluencePage';
6
+ const LazyEmbeddedConfluencePage = /*#__PURE__*/lazy(() => loadEmbeddedConfluencePage().then(Page => ({
7
+ default: Page
8
+ })));
9
+
5
10
  /**
6
- * Iframe element isolated for DI purposes
11
+ * Iframe element isolated for DI purposes.
12
+ *
13
+ * Confluence `Page` is a dynamic import (or an injected host component) so
14
+ * Trello and other non-Confluence embeds do not statically pull
15
+ * `@atlaskit/embedded-confluence`.
7
16
  */
8
17
  export const IFrame = ({
9
18
  childRef,
@@ -12,9 +21,22 @@ export const IFrame = ({
12
21
  ...props
13
22
  }) => {
14
23
  const confluencePageData = useConfluencePageData(props.src || '', extensionKey || '');
24
+ const InjectedPage = useEmbeddedConfluencePage();
25
+ const Page = InjectedPage !== null && InjectedPage !== void 0 ? InjectedPage : LazyEmbeddedConfluencePage;
26
+ const fallbackIframe =
27
+ /*#__PURE__*/
28
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
29
+ React.createElement("iframe", _extends({
30
+ className: className
31
+ }, props, {
32
+ ref: childRef,
33
+ title: props.title
34
+ }));
15
35
 
16
36
  // Conditional rendering: Page component for lp-cc-embed URLs, iframe for everything else
17
- return confluencePageData ? /*#__PURE__*/React.createElement(Page, {
37
+ return confluencePageData ? /*#__PURE__*/React.createElement(Suspense, {
38
+ fallback: fallbackIframe
39
+ }, /*#__PURE__*/React.createElement(Page, {
18
40
  hostname: confluencePageData.hostname,
19
41
  spaceKey: confluencePageData.spaceKey,
20
42
  contentId: confluencePageData.contentId,
@@ -30,13 +52,5 @@ export const IFrame = ({
30
52
  allowedFeatures: confluencePageData.allowedFeatures,
31
53
  themeState: confluencePageData.themeStateObject,
32
54
  userInfo: confluencePageData.userInfo
33
- }) :
34
- /*#__PURE__*/
35
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
36
- React.createElement("iframe", _extends({
37
- className: className
38
- }, props, {
39
- ref: childRef,
40
- title: props.title
41
- }));
55
+ })) : fallbackIframe;
42
56
  };
@@ -0,0 +1,15 @@
1
+ import { createContext, useContext } from 'react';
2
+
3
+ /**
4
+ * Props forwarded to `@atlaskit/embedded-confluence` `Page` from the embed iframe.
5
+ * Kept local so this module never imports the Confluence package.
6
+ */
7
+
8
+ const EmbeddedConfluencePageContext = /*#__PURE__*/createContext(null);
9
+
10
+ /**
11
+ * Hosts that want Confluence page embeds can inject `Page` here so Trello and
12
+ * other products never compile `@atlaskit/embedded-confluence` as a hard import.
13
+ */
14
+ export const EmbeddedConfluencePageProvider = EmbeddedConfluencePageContext.Provider;
15
+ export const useEmbeddedConfluencePage = () => useContext(EmbeddedConfluencePageContext);
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Async factory for the Confluence embed `Page` component.
3
+ *
4
+ * Kept in its own module so `@atlaskit/embedded-confluence` is a dynamic
5
+ * import only — hosts that never render a Confluence embed URL do not
6
+ * download this chunk.
7
+ */
8
+ export async function loadEmbeddedConfluencePage() {
9
+ const {
10
+ Page
11
+ } = await import( /* webpackChunkName: "@atlaskit-internal_smart-card-embedded-confluence" */
12
+ '@atlaskit/embedded-confluence');
13
+ return Page;
14
+ }
@@ -3,7 +3,7 @@ import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { useEffect, useMemo, useRef } from 'react';
6
- import { StorageClient } from '@atlaskit/frontend-utilities/storage-client';
6
+ import { StorageClient } from '@atlaskit/frontend-utilities/StorageClient';
7
7
  const LOCAL_STORAGE_CLIENT_KEY = '@atlaskit/smart-card';
8
8
  const LOCAL_STORAGE_DISCOVERY_KEY = 'action-discovery-ai-summarise';
9
9
  const LOCAL_STORAGE_DISCOVERY_VALUE = 'discovered';
@@ -9,7 +9,7 @@ import LinkWarningModal from './LinkWarningModal';
9
9
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
10
10
  const PACKAGE_DATA = {
11
11
  packageName: "@atlaskit/smart-card",
12
- packageVersion: "45.21.7",
12
+ packageVersion: "45.21.9",
13
13
  componentName: 'linkUrl'
14
14
  };
15
15
  const LinkUrl = ({
@@ -0,0 +1 @@
1
+ export { EmbeddedConfluencePageProvider, useEmbeddedConfluencePage } from '../view/EmbedCard/components/embedded-confluence-page-context';
@@ -3,7 +3,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
6
- import { StorageClient } from '@atlaskit/frontend-utilities/storage-client';
6
+ import { StorageClient } from '@atlaskit/frontend-utilities/StorageClient';
7
7
  import { request } from '@atlaskit/linking-common';
8
8
  import { cloudIdStorageItemKey } from './cloudIdStorageItemKey';
9
9
  import { currentSiteCloudIdConstants } from './constants';
@@ -5,7 +5,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
5
5
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
6
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
- import { StorageClient } from '@atlaskit/frontend-utilities/storage-client';
8
+ import { StorageClient } from '@atlaskit/frontend-utilities/StorageClient';
9
9
  import { personalizationConstants } from './constants';
10
10
  var smartCardStorage = new StorageClient(personalizationConstants.PERSONALIZATION_STORAGE_SCOPE);
11
11
 
@@ -3,7 +3,7 @@ export var ANALYTICS_CHANNEL = 'media';
3
3
  export var context = {
4
4
  componentName: 'smart-cards',
5
5
  packageName: "@atlaskit/smart-card" || '',
6
- packageVersion: "45.21.7" || ''
6
+ packageVersion: "45.21.9" || ''
7
7
  };
8
8
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
9
9
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- import { getResolvedAttributes } from '@atlaskit/link-analytics/resolved-attributes';
4
+ import { getResolvedAttributes } from '@atlaskit/link-analytics/get-resolved-attributes';
5
5
  import { context } from './analytics';
6
6
  var getExtendedResolvedAttributes = function getExtendedResolvedAttributes(linkDetails, details, linkStatus, error) {
7
7
  var _details$meta$definit, _details$meta, _details$meta$resourc, _details$meta2;
@@ -1,11 +1,24 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["childRef", "className", "extensionKey"];
4
- import React from 'react';
5
- import { Page } from '@atlaskit/embedded-confluence/page';
4
+ import React, { lazy, Suspense } from 'react';
6
5
  import { useConfluencePageData } from '../../../hooks/useConfluencePageData';
6
+ import { useEmbeddedConfluencePage } from './embedded-confluence-page-context';
7
+ import { loadEmbeddedConfluencePage } from './loadEmbeddedConfluencePage';
8
+ var LazyEmbeddedConfluencePage = /*#__PURE__*/lazy(function () {
9
+ return loadEmbeddedConfluencePage().then(function (Page) {
10
+ return {
11
+ default: Page
12
+ };
13
+ });
14
+ });
15
+
7
16
  /**
8
- * Iframe element isolated for DI purposes
17
+ * Iframe element isolated for DI purposes.
18
+ *
19
+ * Confluence `Page` is a dynamic import (or an injected host component) so
20
+ * Trello and other non-Confluence embeds do not statically pull
21
+ * `@atlaskit/embedded-confluence`.
9
22
  */
10
23
  export var IFrame = function IFrame(_ref) {
11
24
  var childRef = _ref.childRef,
@@ -13,9 +26,22 @@ export var IFrame = function IFrame(_ref) {
13
26
  extensionKey = _ref.extensionKey,
14
27
  props = _objectWithoutProperties(_ref, _excluded);
15
28
  var confluencePageData = useConfluencePageData(props.src || '', extensionKey || '');
29
+ var InjectedPage = useEmbeddedConfluencePage();
30
+ var Page = InjectedPage !== null && InjectedPage !== void 0 ? InjectedPage : LazyEmbeddedConfluencePage;
31
+ var fallbackIframe =
32
+ /*#__PURE__*/
33
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
34
+ React.createElement("iframe", _extends({
35
+ className: className
36
+ }, props, {
37
+ ref: childRef,
38
+ title: props.title
39
+ }));
16
40
 
17
41
  // Conditional rendering: Page component for lp-cc-embed URLs, iframe for everything else
18
- return confluencePageData ? /*#__PURE__*/React.createElement(Page, {
42
+ return confluencePageData ? /*#__PURE__*/React.createElement(Suspense, {
43
+ fallback: fallbackIframe
44
+ }, /*#__PURE__*/React.createElement(Page, {
19
45
  hostname: confluencePageData.hostname,
20
46
  spaceKey: confluencePageData.spaceKey,
21
47
  contentId: confluencePageData.contentId,
@@ -31,13 +57,5 @@ export var IFrame = function IFrame(_ref) {
31
57
  allowedFeatures: confluencePageData.allowedFeatures,
32
58
  themeState: confluencePageData.themeStateObject,
33
59
  userInfo: confluencePageData.userInfo
34
- }) :
35
- /*#__PURE__*/
36
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
37
- React.createElement("iframe", _extends({
38
- className: className
39
- }, props, {
40
- ref: childRef,
41
- title: props.title
42
- }));
60
+ })) : fallbackIframe;
43
61
  };
@@ -0,0 +1,17 @@
1
+ import { createContext, useContext } from 'react';
2
+
3
+ /**
4
+ * Props forwarded to `@atlaskit/embedded-confluence` `Page` from the embed iframe.
5
+ * Kept local so this module never imports the Confluence package.
6
+ */
7
+
8
+ var EmbeddedConfluencePageContext = /*#__PURE__*/createContext(null);
9
+
10
+ /**
11
+ * Hosts that want Confluence page embeds can inject `Page` here so Trello and
12
+ * other products never compile `@atlaskit/embedded-confluence` as a hard import.
13
+ */
14
+ export var EmbeddedConfluencePageProvider = EmbeddedConfluencePageContext.Provider;
15
+ export var useEmbeddedConfluencePage = function useEmbeddedConfluencePage() {
16
+ return useContext(EmbeddedConfluencePageContext);
17
+ };
@@ -0,0 +1,33 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ /**
4
+ * Async factory for the Confluence embed `Page` component.
5
+ *
6
+ * Kept in its own module so `@atlaskit/embedded-confluence` is a dynamic
7
+ * import only — hosts that never render a Confluence embed URL do not
8
+ * download this chunk.
9
+ */
10
+ export function loadEmbeddedConfluencePage() {
11
+ return _loadEmbeddedConfluencePage.apply(this, arguments);
12
+ }
13
+ function _loadEmbeddedConfluencePage() {
14
+ _loadEmbeddedConfluencePage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
15
+ var _yield$import, Page;
16
+ return _regeneratorRuntime.wrap(function (_context) {
17
+ while (1) switch (_context.prev = _context.next) {
18
+ case 0:
19
+ _context.next = 1;
20
+ return import( /* webpackChunkName: "@atlaskit-internal_smart-card-embedded-confluence" */
21
+ '@atlaskit/embedded-confluence');
22
+ case 1:
23
+ _yield$import = _context.sent;
24
+ Page = _yield$import.Page;
25
+ return _context.abrupt("return", Page);
26
+ case 2:
27
+ case "end":
28
+ return _context.stop();
29
+ }
30
+ }, _callee);
31
+ }));
32
+ return _loadEmbeddedConfluencePage.apply(this, arguments);
33
+ }
@@ -3,7 +3,7 @@ import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { useEffect, useMemo, useRef } from 'react';
6
- import { StorageClient } from '@atlaskit/frontend-utilities/storage-client';
6
+ import { StorageClient } from '@atlaskit/frontend-utilities/StorageClient';
7
7
  var LOCAL_STORAGE_CLIENT_KEY = '@atlaskit/smart-card';
8
8
  var LOCAL_STORAGE_DISCOVERY_KEY = 'action-discovery-ai-summarise';
9
9
  var LOCAL_STORAGE_DISCOVERY_VALUE = 'discovered';
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
12
12
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
13
13
  var PACKAGE_DATA = {
14
14
  packageName: "@atlaskit/smart-card",
15
- packageVersion: "45.21.7",
15
+ packageVersion: "45.21.9",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  var LinkUrl = function LinkUrl(_ref) {
@@ -0,0 +1 @@
1
+ export { EmbeddedConfluencePageProvider, useEmbeddedConfluencePage, type EmbeddedConfluencePageComponent, type EmbeddedConfluencePageProps, } from '../view/EmbedCard/components/embedded-confluence-page-context';
@@ -1,4 +1,4 @@
1
- import type { ThemeState } from '@atlaskit/tokens/theme-config';
1
+ import type { ThemeState } from '@atlaskit/tokens/theme-state';
2
2
  export declare enum userType {
3
3
  ATLASSIAN_ACCOUNT = "atlassianAccount",
4
4
  HASHED_EMAIL = "hashedEmail",
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type getResolvedAttributes } from '@atlaskit/link-analytics/resolved-attributes';
2
+ import type { getResolvedAttributes } from '@atlaskit/link-analytics/get-resolved-attributes';
3
3
  import { type context } from './analytics';
4
4
  export type SmartLinkAnalyticsContextProps = {
5
5
  children?: React.ReactNode;
@@ -5,7 +5,11 @@ interface IFrameProps {
5
5
  extensionKey?: string;
6
6
  }
7
7
  /**
8
- * Iframe element isolated for DI purposes
8
+ * Iframe element isolated for DI purposes.
9
+ *
10
+ * Confluence `Page` is a dynamic import (or an injected host component) so
11
+ * Trello and other non-Confluence embeds do not statically pull
12
+ * `@atlaskit/embedded-confluence`.
9
13
  */
10
14
  export declare const IFrame: ({ childRef, className, extensionKey, ...props }: React.ComponentProps<'iframe'> & IFrameProps) => React.JSX.Element;
11
15
  export {};
@@ -0,0 +1,29 @@
1
+ import { type ComponentType, type MouseEventHandler, type Provider, type ReactEventHandler, type Ref } from 'react';
2
+ /**
3
+ * Props forwarded to `@atlaskit/embedded-confluence` `Page` from the embed iframe.
4
+ * Kept local so this module never imports the Confluence package.
5
+ */
6
+ export type EmbeddedConfluencePageProps = {
7
+ allowedFeatures?: unknown;
8
+ contentId: string;
9
+ hash?: string;
10
+ hostname: string;
11
+ iframeRef?: Ref<HTMLIFrameElement>;
12
+ locale?: string;
13
+ mode?: string;
14
+ onLoad?: ReactEventHandler<HTMLIFrameElement>;
15
+ onMouseEnter?: MouseEventHandler<HTMLIFrameElement>;
16
+ onMouseLeave?: MouseEventHandler<HTMLIFrameElement>;
17
+ parentProduct?: string;
18
+ sandbox?: string;
19
+ spaceKey: string;
20
+ themeState?: unknown;
21
+ userInfo?: unknown;
22
+ };
23
+ export type EmbeddedConfluencePageComponent = ComponentType<EmbeddedConfluencePageProps>;
24
+ /**
25
+ * Hosts that want Confluence page embeds can inject `Page` here so Trello and
26
+ * other products never compile `@atlaskit/embedded-confluence` as a hard import.
27
+ */
28
+ export declare const EmbeddedConfluencePageProvider: Provider<EmbeddedConfluencePageComponent | null>;
29
+ export declare const useEmbeddedConfluencePage: () => EmbeddedConfluencePageComponent | null;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Async factory for the Confluence embed `Page` component.
3
+ *
4
+ * Kept in its own module so `@atlaskit/embedded-confluence` is a dynamic
5
+ * import only — hosts that never render a Confluence embed URL do not
6
+ * download this chunk.
7
+ */
8
+ export declare function loadEmbeddedConfluencePage(): Promise<(typeof import('@atlaskit/embedded-confluence'))['Page']>;
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/smart-card/embedded-confluence-page",
3
+ "main": "../dist/cjs/entry-points/embedded-confluence-page.js",
4
+ "module": "../dist/esm/entry-points/embedded-confluence-page.js",
5
+ "module:es2019": "../dist/es2019/entry-points/embedded-confluence-page.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../dist/types/entry-points/embedded-confluence-page.d.ts"
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "45.21.8",
3
+ "version": "45.22.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,7 +31,7 @@
31
31
  }
32
32
  },
33
33
  "scripts": {
34
- "analytics:codegen": "yarn workspace @atlassian/analytics-tooling run analytics:codegen smart-card --output ./src/common/analytics/generated",
34
+ "analytics:codegen": "afm workspace @atlassian/analytics-tooling analytics:codegen smart-card --output ./src/common/analytics/generated",
35
35
  "ak-postbuild": "ls -d dist/* | xargs -n 1 copyfiles -u 1 -V src/**/*.{svg,png}"
36
36
  },
37
37
  "dependencies": {
@@ -90,7 +90,7 @@
90
90
  "@atlaskit/textfield": "^10.2.0",
91
91
  "@atlaskit/theme": "^28.2.0",
92
92
  "@atlaskit/tile": "^4.1.0",
93
- "@atlaskit/tmp-editor-statsig": "^186.0.0",
93
+ "@atlaskit/tmp-editor-statsig": "^187.0.0",
94
94
  "@atlaskit/tokens": "^16.12.0",
95
95
  "@atlaskit/tooltip": "^24.3.0",
96
96
  "@atlaskit/ufo": "^1.2.0",