@atlaskit/smart-card 43.11.2 → 43.12.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.
- package/CHANGELOG.md +15 -0
- package/analytics.spec.yaml +7 -1
- package/dist/cjs/state/actions/index.js +1 -4
- package/dist/cjs/state/hooks/use-resolve/index.js +3 -13
- package/dist/cjs/state/hooks/use-response/index.js +0 -2
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/analytics/click.js +0 -1
- package/dist/cjs/view/CardWithUrl/component.js +327 -3
- package/dist/cjs/view/EmbedCard/components/ExpandedFrame.js +93 -2
- package/dist/cjs/view/EmbedCard/components/Frame.js +121 -3
- package/dist/cjs/view/EmbedCard/components/IframeDwellTracker.js +25 -4
- package/dist/cjs/view/EmbedCard/index.js +204 -1
- package/dist/cjs/view/EmbedCard/views/ResolvedView.js +95 -2
- package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +0 -1
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/boolean-prompt/main.js +9 -13
- package/dist/cjs/view/LinkUrl/Hyperlink/index.js +0 -1
- package/dist/cjs/view/LinkUrl/index.js +1 -3
- package/dist/es2019/state/actions/index.js +1 -4
- package/dist/es2019/state/hooks/use-resolve/index.js +1 -10
- package/dist/es2019/state/hooks/use-response/index.js +0 -2
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/analytics/click.js +0 -1
- package/dist/es2019/view/CardWithUrl/component.js +324 -2
- package/dist/es2019/view/EmbedCard/components/ExpandedFrame.js +87 -2
- package/dist/es2019/view/EmbedCard/components/Frame.js +112 -2
- package/dist/es2019/view/EmbedCard/components/IframeDwellTracker.js +25 -4
- package/dist/es2019/view/EmbedCard/index.js +208 -0
- package/dist/es2019/view/EmbedCard/views/ResolvedView.js +91 -3
- package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +0 -1
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/boolean-prompt/main.js +8 -12
- package/dist/es2019/view/LinkUrl/Hyperlink/index.js +0 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -3
- package/dist/esm/state/actions/index.js +1 -4
- package/dist/esm/state/hooks/use-resolve/index.js +3 -13
- package/dist/esm/state/hooks/use-response/index.js +0 -2
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/analytics/click.js +0 -1
- package/dist/esm/view/CardWithUrl/component.js +326 -2
- package/dist/esm/view/EmbedCard/components/ExpandedFrame.js +95 -2
- package/dist/esm/view/EmbedCard/components/Frame.js +122 -2
- package/dist/esm/view/EmbedCard/components/IframeDwellTracker.js +25 -4
- package/dist/esm/view/EmbedCard/index.js +203 -0
- package/dist/esm/view/EmbedCard/views/ResolvedView.js +97 -3
- package/dist/esm/view/FlexibleCard/components/actions/action/index.js +0 -1
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/boolean-prompt/main.js +9 -13
- package/dist/esm/view/LinkUrl/Hyperlink/index.js +0 -1
- package/dist/esm/view/LinkUrl/index.js +1 -3
- package/dist/types/common/analytics/generated/analytics.types.d.ts +1 -0
- package/dist/types/view/EmbedCard/components/ExpandedFrame.d.ts +8 -1
- package/dist/types/view/EmbedCard/components/Frame.d.ts +6 -0
- package/dist/types/view/EmbedCard/index.d.ts +4 -0
- package/dist/types/view/EmbedCard/types.d.ts +4 -0
- package/dist/types/view/EmbedCard/views/ResolvedView.d.ts +6 -1
- package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +1 -0
- package/dist/types-ts4.5/view/EmbedCard/components/ExpandedFrame.d.ts +8 -1
- package/dist/types-ts4.5/view/EmbedCard/components/Frame.d.ts +6 -0
- package/dist/types-ts4.5/view/EmbedCard/index.d.ts +4 -0
- package/dist/types-ts4.5/view/EmbedCard/types.d.ts +4 -0
- package/dist/types-ts4.5/view/EmbedCard/views/ResolvedView.d.ts +6 -1
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 43.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`ad5cf8dbae112`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ad5cf8dbae112) -
|
|
8
|
+
[ux] Added analytics for mouse enter and leave using existing analytics and fixing issue with
|
|
9
|
+
sending embedCard dwell analytics
|
|
10
|
+
|
|
11
|
+
## 43.11.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`55920a92e882a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/55920a92e882a) -
|
|
16
|
+
tsignores added for help-center local consumpton removed
|
|
17
|
+
|
|
3
18
|
## 43.11.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/analytics.spec.yaml
CHANGED
|
@@ -343,6 +343,11 @@ events:
|
|
|
343
343
|
required: false
|
|
344
344
|
type: string
|
|
345
345
|
description: The definitionId of the Smart Link resolver invoked.
|
|
346
|
+
interactionType:
|
|
347
|
+
required: false
|
|
348
|
+
type: ['mouseenter', 'mouseleave', 'focus']
|
|
349
|
+
description:
|
|
350
|
+
The type of interaction that triggered this event - mouse enter, mouse leave, or focus.
|
|
346
351
|
- applicationAccount connected:
|
|
347
352
|
type: track
|
|
348
353
|
description: user connecting their account to view a Smart Link.
|
|
@@ -616,7 +621,8 @@ events:
|
|
|
616
621
|
description: Whether a modifier key was pressed when clicking the Smart Link.
|
|
617
622
|
- smartLink clicked (previewHoverCard):
|
|
618
623
|
type: ui
|
|
619
|
-
description:
|
|
624
|
+
description:
|
|
625
|
+
fires an event that represents when a user clicks on a Smart Link to open a preview panel.
|
|
620
626
|
attributes:
|
|
621
627
|
<<: [*PackageMetaDataContext, *CommonContext, *ResolvedContext]
|
|
622
628
|
id:
|
|
@@ -58,10 +58,7 @@ var useSmartCardActions = exports.useSmartCardActions = function useSmartCardAct
|
|
|
58
58
|
resourceUrl = _args.length > 0 && _args[0] !== undefined ? _args[0] : url;
|
|
59
59
|
isReloading = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
|
|
60
60
|
isMetadataRequest = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
|
|
61
|
-
return _context.abrupt("return",
|
|
62
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
63
|
-
|
|
64
|
-
resolveUrl(resourceUrl, isReloading, isMetadataRequest, id));
|
|
61
|
+
return _context.abrupt("return", resolveUrl(resourceUrl, isReloading, isMetadataRequest, id));
|
|
65
62
|
case 4:
|
|
66
63
|
case "end":
|
|
67
64
|
return _context.stop();
|
|
@@ -49,22 +49,12 @@ var useResolve = function useResolve() {
|
|
|
49
49
|
_context.next = 9;
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
|
-
return _context.abrupt("return", connections.client
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
57
|
-
|
|
58
|
-
handleResolvedLinkResponse(url, response, isReloading, isMetadataRequest)
|
|
59
|
-
);
|
|
60
|
-
})
|
|
61
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
62
|
-
.catch(function (error) {
|
|
52
|
+
return _context.abrupt("return", connections.client.fetchData(url, isReloading).then(function (response) {
|
|
53
|
+
return handleResolvedLinkResponse(url, response, isReloading, isMetadataRequest);
|
|
54
|
+
}).catch(function (error) {
|
|
63
55
|
return handleResolvedLinkError(url, error, undefined, isMetadataRequest);
|
|
64
56
|
}));
|
|
65
57
|
case 9:
|
|
66
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
67
|
-
|
|
68
58
|
(0, _analytics.addMetadataToExperience)('smart-link-rendered', id, {
|
|
69
59
|
cached: true
|
|
70
60
|
});
|
|
@@ -122,8 +122,6 @@ var useResponse = function useResponse() {
|
|
|
122
122
|
* https://react-redux.js.org/api/batch
|
|
123
123
|
*/
|
|
124
124
|
(0, _reactDom.unstable_batchedUpdates)(function () {
|
|
125
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
126
|
-
|
|
127
125
|
handleResolvedLinkSuccess(resourceUrl, response, isReloading, isMetadataRequest);
|
|
128
126
|
});
|
|
129
127
|
}, [handleResolvedLinkError, handleResolvedLinkSuccess, hasAuthFlowSupported]);
|
|
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
11
11
|
var context = exports.context = {
|
|
12
12
|
componentName: 'smart-cards',
|
|
13
13
|
packageName: "@atlaskit/smart-card",
|
|
14
|
-
packageVersion: "
|
|
14
|
+
packageVersion: "0.0.0-development"
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -142,7 +142,6 @@ var getDisplayName = function getDisplayName(WrappedComponent) {
|
|
|
142
142
|
if (typeof WrappedComponent === 'string') {
|
|
143
143
|
return WrappedComponent;
|
|
144
144
|
}
|
|
145
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
146
145
|
return WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
147
146
|
};
|
|
148
147
|
function withLinkClickedEvent(WrappedComponent) {
|
|
@@ -10,9 +10,10 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
11
11
|
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
+
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
13
14
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
15
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
|
-
var
|
|
16
|
+
var _useAnalyticsEvents3 = require("../../common/analytics/generated/use-analytics-events");
|
|
16
17
|
var _constants = require("../../constants");
|
|
17
18
|
var _state = require("../../state");
|
|
18
19
|
var _analytics = require("../../state/analytics");
|
|
@@ -31,6 +32,7 @@ var _InlineCard = require("../InlineCard");
|
|
|
31
32
|
var _useSmartLinkEvents = require("../SmartLinkEvents/useSmartLinkEvents");
|
|
32
33
|
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); }
|
|
33
34
|
var thirdPartyARIPrefix = 'ari:third-party';
|
|
35
|
+
var EmbedCardComponent = (0, _platformFeatureFlagsReact.componentWithFG)('rovo_chat_embed_card_dwell_and_hover_metrics', _EmbedCard.EmbedCardUpdated, _EmbedCard.EmbedCard);
|
|
34
36
|
function Component(_ref) {
|
|
35
37
|
var id = _ref.id,
|
|
36
38
|
url = _ref.url,
|
|
@@ -61,7 +63,7 @@ function Component(_ref) {
|
|
|
61
63
|
placeholderData = _ref.placeholderData;
|
|
62
64
|
var _useAnalyticsEventsNe = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
63
65
|
createAnalyticsEvent = _useAnalyticsEventsNe.createAnalyticsEvent;
|
|
64
|
-
var _useAnalyticsEvents = (0,
|
|
66
|
+
var _useAnalyticsEvents = (0, _useAnalyticsEvents3.useAnalyticsEvents)(),
|
|
65
67
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
66
68
|
var isFlexibleUi = (0, _react.useMemo)(function () {
|
|
67
69
|
return (0, _flexible.isFlexibleUiCard)(children, ui);
|
|
@@ -333,11 +335,333 @@ function Component(_ref) {
|
|
|
333
335
|
});
|
|
334
336
|
}
|
|
335
337
|
}
|
|
338
|
+
function ComponentUpdated(_ref2) {
|
|
339
|
+
var id = _ref2.id,
|
|
340
|
+
url = _ref2.url,
|
|
341
|
+
isSelected = _ref2.isSelected,
|
|
342
|
+
isHovered = _ref2.isHovered,
|
|
343
|
+
frameStyle = _ref2.frameStyle,
|
|
344
|
+
platform = _ref2.platform,
|
|
345
|
+
onClick = _ref2.onClick,
|
|
346
|
+
appearance = _ref2.appearance,
|
|
347
|
+
onResolve = _ref2.onResolve,
|
|
348
|
+
onError = _ref2.onError,
|
|
349
|
+
testId = _ref2.testId,
|
|
350
|
+
actionOptionsProp = _ref2.actionOptions,
|
|
351
|
+
inheritDimensions = _ref2.inheritDimensions,
|
|
352
|
+
embedIframeRef = _ref2.embedIframeRef,
|
|
353
|
+
embedIframeUrlType = _ref2.embedIframeUrlType,
|
|
354
|
+
inlinePreloaderStyle = _ref2.inlinePreloaderStyle,
|
|
355
|
+
ui = _ref2.ui,
|
|
356
|
+
children = _ref2.children,
|
|
357
|
+
showHoverPreview = _ref2.showHoverPreview,
|
|
358
|
+
hoverPreviewOptions = _ref2.hoverPreviewOptions,
|
|
359
|
+
removeTextHighlightingFromTitle = _ref2.removeTextHighlightingFromTitle,
|
|
360
|
+
resolvingPlaceholder = _ref2.resolvingPlaceholder,
|
|
361
|
+
truncateInline = _ref2.truncateInline,
|
|
362
|
+
CompetitorPrompt = _ref2.CompetitorPrompt,
|
|
363
|
+
hideIconLoadingSkeleton = _ref2.hideIconLoadingSkeleton,
|
|
364
|
+
disablePreviewPanel = _ref2.disablePreviewPanel,
|
|
365
|
+
placeholderData = _ref2.placeholderData;
|
|
366
|
+
var _useAnalyticsEventsNe2 = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
367
|
+
createAnalyticsEvent = _useAnalyticsEventsNe2.createAnalyticsEvent;
|
|
368
|
+
var _useAnalyticsEvents2 = (0, _useAnalyticsEvents3.useAnalyticsEvents)(),
|
|
369
|
+
fireEvent = _useAnalyticsEvents2.fireEvent;
|
|
370
|
+
var isFlexibleUi = (0, _react.useMemo)(function () {
|
|
371
|
+
return (0, _flexible.isFlexibleUiCard)(children, ui);
|
|
372
|
+
}, [children, ui]);
|
|
373
|
+
|
|
374
|
+
// Get state, actions for this card.
|
|
375
|
+
var _useSmartLink2 = (0, _state.useSmartLink)(id, url),
|
|
376
|
+
state = _useSmartLink2.state,
|
|
377
|
+
actions = _useSmartLink2.actions,
|
|
378
|
+
config = _useSmartLink2.config,
|
|
379
|
+
renderers = _useSmartLink2.renderers,
|
|
380
|
+
error = _useSmartLink2.error,
|
|
381
|
+
isPreviewPanelAvailable = _useSmartLink2.isPreviewPanelAvailable,
|
|
382
|
+
openPreviewPanel = _useSmartLink2.openPreviewPanel;
|
|
383
|
+
var ari = (0, _helpers.getObjectAri)(state.details);
|
|
384
|
+
var name = (0, _helpers.getObjectName)(state.details);
|
|
385
|
+
var definitionId = (0, _helpers.getDefinitionId)(state.details);
|
|
386
|
+
var extensionKey = (0, _helpers.getExtensionKey)(state.details);
|
|
387
|
+
var resourceType = (0, _helpers.getResourceType)(state.details);
|
|
388
|
+
var services = (0, _helpers.getServices)(state.details);
|
|
389
|
+
var thirdPartyARI = (0, _helpers.getThirdPartyARI)(state.details);
|
|
390
|
+
var firstPartyIdentifier = (0, _helpers.getFirstPartyIdentifier)();
|
|
391
|
+
var actionOptions = (0, _combineActionOptions.combineActionOptions)({
|
|
392
|
+
actionOptions: actionOptionsProp,
|
|
393
|
+
platform: platform
|
|
394
|
+
});
|
|
395
|
+
var fire3PClickEvent = (0, _platformFeatureFlags.fg)('platform_smartlink_3pclick_analytics') ?
|
|
396
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
397
|
+
(0, _useSmartLinkEvents.useFire3PWorkflowsClickEvent)(firstPartyIdentifier, thirdPartyARI) : undefined;
|
|
398
|
+
|
|
399
|
+
// Setup UI handlers.
|
|
400
|
+
var handleClickWrapper = (0, _react.useCallback)(function (event) {
|
|
401
|
+
var isModifierKeyPressed = (0, _utils.isSpecialKey)(event) || (0, _utils.isSpecialClick)(event);
|
|
402
|
+
fireEvent('ui.smartLink.clicked', {
|
|
403
|
+
id: id,
|
|
404
|
+
display: isFlexibleUi ? _constants.CardDisplay.Flexible : appearance,
|
|
405
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
406
|
+
isModifierKeyPressed: isModifierKeyPressed
|
|
407
|
+
});
|
|
408
|
+
if ((0, _platformFeatureFlags.fg)('platform_smartlink_3pclick_analytics')) {
|
|
409
|
+
if (thirdPartyARI && thirdPartyARI.startsWith(thirdPartyARIPrefix)) {
|
|
410
|
+
var clickURL = (0, _helpers.getClickUrl)(url, state.details);
|
|
411
|
+
if (clickURL === url && fire3PClickEvent) {
|
|
412
|
+
// For questions or concerns about this event,
|
|
413
|
+
// please reach out to the 3P Workflows Team via Slack in #help-3p-connector-workflow
|
|
414
|
+
fire3PClickEvent();
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
var isDisablePreviewPanel = disablePreviewPanel && (0, _experiments.editorExperiment)('platform_editor_preview_panel_linking_exp', true, {
|
|
419
|
+
exposure: true
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
// If preview panel is available and the user clicked on the link,
|
|
423
|
+
// delegate the click to the preview panel handler
|
|
424
|
+
if (!isModifierKeyPressed && ari && name && openPreviewPanel && isPreviewPanelAvailable !== null && isPreviewPanelAvailable !== void 0 && isPreviewPanelAvailable({
|
|
425
|
+
ari: ari
|
|
426
|
+
}) && !isDisablePreviewPanel) {
|
|
427
|
+
var _extractSmartLinkEmbe2;
|
|
428
|
+
event.preventDefault();
|
|
429
|
+
event.stopPropagation();
|
|
430
|
+
openPreviewPanel({
|
|
431
|
+
url: url,
|
|
432
|
+
ari: ari,
|
|
433
|
+
name: name,
|
|
434
|
+
iconUrl: (0, _helpers.getObjectIconUrl)(state.details),
|
|
435
|
+
panelData: {
|
|
436
|
+
embedUrl: (0, _expValEquals.expValEquals)('platform_hover_card_preview_panel', 'cohort', 'test') ? (_extractSmartLinkEmbe2 = (0, _linkExtractors.extractSmartLinkEmbed)(state.details)) === null || _extractSmartLinkEmbe2 === void 0 ? void 0 : _extractSmartLinkEmbe2.src : undefined
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
(0, _click.fireLinkClickedEvent)(createAnalyticsEvent)(event, {
|
|
440
|
+
attributes: {
|
|
441
|
+
clickOutcome: 'previewPanel'
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
return;
|
|
445
|
+
} else if (!onClick && !isFlexibleUi) {
|
|
446
|
+
var clickUrl = (0, _helpers.getClickUrl)(url, state.details);
|
|
447
|
+
|
|
448
|
+
// Ctrl+left click on mac typically doesn't trigger onClick
|
|
449
|
+
// The event could have potentially had `e.preventDefault()` called on it by now
|
|
450
|
+
// event by smart card internally
|
|
451
|
+
// If it has been called then only then can `isSpecialEvent` be true.
|
|
452
|
+
var target = (0, _utils.isSpecialEvent)(event) ? '_blank' : '_self';
|
|
453
|
+
window.open(clickUrl, target);
|
|
454
|
+
(0, _click.fireLinkClickedEvent)(createAnalyticsEvent)(event, {
|
|
455
|
+
attributes: {
|
|
456
|
+
clickOutcome: target === '_blank' ? 'clickThroughNewTabOrWindow' : 'clickThrough'
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
} else {
|
|
460
|
+
if (onClick) {
|
|
461
|
+
onClick(event);
|
|
462
|
+
}
|
|
463
|
+
(0, _click.fireLinkClickedEvent)(createAnalyticsEvent)(event);
|
|
464
|
+
}
|
|
465
|
+
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, onClick, url, state.details, ari, name, fire3PClickEvent, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent, thirdPartyARI, disablePreviewPanel]);
|
|
466
|
+
var handleAuthorize = (0, _react.useCallback)(function () {
|
|
467
|
+
return actions.authorize(appearance);
|
|
468
|
+
}, [actions, appearance]);
|
|
469
|
+
var handleRetry = (0, _react.useCallback)(function () {
|
|
470
|
+
actions.reload();
|
|
471
|
+
}, [actions]);
|
|
472
|
+
var handleInvoke = (0, _react.useCallback)(function (opts) {
|
|
473
|
+
return actions.invoke(opts, appearance);
|
|
474
|
+
}, [actions, appearance]);
|
|
475
|
+
|
|
476
|
+
// NB: for each status change in a Smart Link, a performance mark is created.
|
|
477
|
+
// Measures are sent relative to the first mark, matching what a user sees.
|
|
478
|
+
(0, _react.useEffect)(function () {
|
|
479
|
+
measure.mark(id, state.status);
|
|
480
|
+
if (state.status !== 'pending' && state.status !== 'resolving') {
|
|
481
|
+
var _state$error3, _state$error4;
|
|
482
|
+
measure.create(id, state.status);
|
|
483
|
+
if (state.status === 'resolved') {
|
|
484
|
+
var _measure$getMeasure$d2, _measure$getMeasure2;
|
|
485
|
+
fireEvent('operational.smartLink.resolved', {
|
|
486
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
487
|
+
duration: (_measure$getMeasure$d2 = (_measure$getMeasure2 = measure.getMeasure(id, state.status)) === null || _measure$getMeasure2 === void 0 ? void 0 : _measure$getMeasure2.duration) !== null && _measure$getMeasure$d2 !== void 0 ? _measure$getMeasure$d2 : null
|
|
488
|
+
});
|
|
489
|
+
} else if (((_state$error3 = state.error) === null || _state$error3 === void 0 ? void 0 : _state$error3.type) !== 'ResolveUnsupportedError' && ((_state$error4 = state.error) === null || _state$error4 === void 0 ? void 0 : _state$error4.type) !== 'UnsupportedError') {
|
|
490
|
+
fireEvent('operational.smartLink.unresolved', {
|
|
491
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
492
|
+
reason: state.status,
|
|
493
|
+
error: state.error === undefined ? null : {
|
|
494
|
+
name: state.error.name,
|
|
495
|
+
kind: state.error.kind,
|
|
496
|
+
type: state.error.type
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}, [id, appearance, state.status, state.error, definitionId, extensionKey, resourceType, fireEvent]);
|
|
502
|
+
|
|
503
|
+
// NB: once the smart-card has rendered into an end state, we capture
|
|
504
|
+
// this as a successful render. These can be one of:
|
|
505
|
+
// - the resolved state: when metadata is shown;
|
|
506
|
+
// - the unresolved states: viz. forbidden, not_found, unauthorized, errored.
|
|
507
|
+
(0, _react.useEffect)(function () {
|
|
508
|
+
if ((0, _helpers.isFinalState)(state.status)) {
|
|
509
|
+
(0, _analytics.succeedUfoExperience)('smart-link-rendered', id || 'NULL', {
|
|
510
|
+
extensionKey: extensionKey,
|
|
511
|
+
display: isFlexibleUi ? 'flexible' : appearance
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
// UFO will disregard this if authentication experience has not yet been started
|
|
515
|
+
(0, _analytics.succeedUfoExperience)('smart-link-authenticated', id || 'NULL', {
|
|
516
|
+
display: isFlexibleUi ? 'flexible' : appearance
|
|
517
|
+
});
|
|
518
|
+
fireEvent('ui.smartLink.renderSuccess', {
|
|
519
|
+
display: isFlexibleUi ? 'flexible' : appearance
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
}, [appearance, extensionKey, fireEvent, id, isFlexibleUi, state.status]);
|
|
523
|
+
var onIframeDwell = (0, _react.useCallback)(function (dwellTime, dwellPercentVisible) {
|
|
524
|
+
fireEvent('ui.smartLinkIframe.dwelled', {
|
|
525
|
+
id: id,
|
|
526
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
527
|
+
display: isFlexibleUi ? 'flexible' : appearance,
|
|
528
|
+
dwellPercentVisible: dwellPercentVisible,
|
|
529
|
+
dwellTime: dwellTime
|
|
530
|
+
});
|
|
531
|
+
}, [id, appearance, definitionId, isFlexibleUi, fireEvent]);
|
|
532
|
+
var onIframeFocus = (0, _react.useCallback)(function () {
|
|
533
|
+
fireEvent('ui.smartLinkIframe.focused', {
|
|
534
|
+
id: id,
|
|
535
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
536
|
+
display: isFlexibleUi ? 'flexible' : appearance,
|
|
537
|
+
interactionType: 'focus'
|
|
538
|
+
});
|
|
539
|
+
}, [id, appearance, definitionId, isFlexibleUi, fireEvent]);
|
|
540
|
+
var onIframeMouseEnter = (0, _react.useCallback)(function () {
|
|
541
|
+
fireEvent('ui.smartLinkIframe.focused', {
|
|
542
|
+
id: id,
|
|
543
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
544
|
+
display: isFlexibleUi ? 'flexible' : appearance,
|
|
545
|
+
interactionType: 'mouseenter'
|
|
546
|
+
});
|
|
547
|
+
}, [id, appearance, definitionId, isFlexibleUi, fireEvent]);
|
|
548
|
+
var onIframeMouseLeave = (0, _react.useCallback)(function () {
|
|
549
|
+
fireEvent('ui.smartLinkIframe.focused', {
|
|
550
|
+
id: id,
|
|
551
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
552
|
+
display: isFlexibleUi ? 'flexible' : appearance,
|
|
553
|
+
interactionType: 'mouseleave'
|
|
554
|
+
});
|
|
555
|
+
}, [id, appearance, definitionId, isFlexibleUi, fireEvent]);
|
|
556
|
+
if (isFlexibleUi) {
|
|
557
|
+
var cardState = state;
|
|
558
|
+
if (error) {
|
|
559
|
+
if ((error === null || error === void 0 ? void 0 : error.name) === 'APIError') {
|
|
560
|
+
cardState = {
|
|
561
|
+
status: 'errored'
|
|
562
|
+
};
|
|
563
|
+
} else {
|
|
564
|
+
throw error;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, {
|
|
568
|
+
id: id,
|
|
569
|
+
cardState: cardState,
|
|
570
|
+
placeholderData: (0, _platformFeatureFlags.fg)('platform_initial_data_for_smart_cards') ? placeholderData : undefined,
|
|
571
|
+
onAuthorize: services.length && handleAuthorize || undefined,
|
|
572
|
+
onClick: handleClickWrapper,
|
|
573
|
+
origin: "smartLinkCard",
|
|
574
|
+
renderers: renderers,
|
|
575
|
+
ui: ui,
|
|
576
|
+
showHoverPreview: showHoverPreview,
|
|
577
|
+
hoverPreviewOptions: hoverPreviewOptions,
|
|
578
|
+
actionOptions: actionOptions,
|
|
579
|
+
url: url,
|
|
580
|
+
testId: testId,
|
|
581
|
+
onResolve: onResolve,
|
|
582
|
+
onError: onError
|
|
583
|
+
}, children);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
// We have to keep this last to prevent hook order from being violated
|
|
587
|
+
if (error) {
|
|
588
|
+
throw error;
|
|
589
|
+
}
|
|
590
|
+
switch (appearance) {
|
|
591
|
+
case 'inline':
|
|
592
|
+
return /*#__PURE__*/_react.default.createElement(_InlineCard.InlineCard, {
|
|
593
|
+
id: id,
|
|
594
|
+
url: url,
|
|
595
|
+
renderers: renderers,
|
|
596
|
+
cardState: state,
|
|
597
|
+
handleAuthorize: services.length && handleAuthorize || undefined,
|
|
598
|
+
handleFrameClick: handleClickWrapper,
|
|
599
|
+
isSelected: isSelected,
|
|
600
|
+
isHovered: isHovered,
|
|
601
|
+
onResolve: onResolve,
|
|
602
|
+
onError: onError,
|
|
603
|
+
testId: testId,
|
|
604
|
+
inlinePreloaderStyle: inlinePreloaderStyle,
|
|
605
|
+
showHoverPreview: showHoverPreview,
|
|
606
|
+
hoverPreviewOptions: hoverPreviewOptions,
|
|
607
|
+
actionOptions: actionOptions,
|
|
608
|
+
removeTextHighlightingFromTitle: removeTextHighlightingFromTitle,
|
|
609
|
+
resolvingPlaceholder: resolvingPlaceholder,
|
|
610
|
+
truncateInline: truncateInline,
|
|
611
|
+
hideIconLoadingSkeleton: hideIconLoadingSkeleton
|
|
612
|
+
});
|
|
613
|
+
case 'block':
|
|
614
|
+
return /*#__PURE__*/_react.default.createElement(_BlockCard.BlockCard, {
|
|
615
|
+
id: id,
|
|
616
|
+
url: url,
|
|
617
|
+
renderers: renderers,
|
|
618
|
+
authFlow: config && config.authFlow,
|
|
619
|
+
cardState: state,
|
|
620
|
+
handleAuthorize: services.length && handleAuthorize || undefined,
|
|
621
|
+
handleFrameClick: handleClickWrapper,
|
|
622
|
+
isSelected: isSelected,
|
|
623
|
+
onResolve: onResolve,
|
|
624
|
+
onError: onError,
|
|
625
|
+
testId: testId,
|
|
626
|
+
actionOptions: actionOptions,
|
|
627
|
+
CompetitorPrompt: CompetitorPrompt,
|
|
628
|
+
hideIconLoadingSkeleton: hideIconLoadingSkeleton
|
|
629
|
+
});
|
|
630
|
+
case 'embed':
|
|
631
|
+
return /*#__PURE__*/_react.default.createElement(EmbedCardComponent, {
|
|
632
|
+
id: id,
|
|
633
|
+
url: url,
|
|
634
|
+
renderers: renderers,
|
|
635
|
+
cardState: state,
|
|
636
|
+
iframeUrlType: embedIframeUrlType,
|
|
637
|
+
handleAuthorize: services.length && handleAuthorize || undefined,
|
|
638
|
+
handleErrorRetry: handleRetry,
|
|
639
|
+
handleFrameClick: handleClickWrapper,
|
|
640
|
+
handleInvoke: handleInvoke,
|
|
641
|
+
isSelected: isSelected,
|
|
642
|
+
frameStyle: frameStyle,
|
|
643
|
+
platform: platform,
|
|
644
|
+
onResolve: onResolve,
|
|
645
|
+
onError: onError,
|
|
646
|
+
testId: testId,
|
|
647
|
+
inheritDimensions: inheritDimensions,
|
|
648
|
+
actionOptions: actionOptions,
|
|
649
|
+
ref: embedIframeRef,
|
|
650
|
+
onIframeDwell: onIframeDwell,
|
|
651
|
+
onIframeFocus: onIframeFocus,
|
|
652
|
+
onIframeMouseEnter: onIframeMouseEnter,
|
|
653
|
+
onIframeMouseLeave: onIframeMouseLeave,
|
|
654
|
+
CompetitorPrompt: CompetitorPrompt,
|
|
655
|
+
hideIconLoadingSkeleton: hideIconLoadingSkeleton
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
var CardWithUrlContentComponent = (0, _platformFeatureFlagsReact.componentWithFG)('rovo_chat_embed_card_dwell_and_hover_metrics', ComponentUpdated, Component);
|
|
336
660
|
var CardWithUrlContent = exports.CardWithUrlContent = function CardWithUrlContent(props) {
|
|
337
661
|
var display = (0, _flexible.isFlexibleUiCard)(props.children, props === null || props === void 0 ? void 0 : props.ui) ? _constants.CardDisplay.Flexible : props.appearance;
|
|
338
662
|
return /*#__PURE__*/_react.default.createElement(_modal.SmartLinkModalProvider, null, /*#__PURE__*/_react.default.createElement(_SmartLinkAnalyticsContext.SmartLinkAnalyticsContext, {
|
|
339
663
|
url: props.url,
|
|
340
664
|
id: props.id,
|
|
341
665
|
display: display
|
|
342
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
666
|
+
}, /*#__PURE__*/_react.default.createElement(CardWithUrlContentComponent, props)));
|
|
343
667
|
};
|
|
@@ -12,12 +12,14 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _runtime = require("@compiled/react/runtime");
|
|
13
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
|
+
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
15
16
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
16
17
|
var _useLinkClicked = require("../../../state/analytics/useLinkClicked");
|
|
17
18
|
var _utils = require("../../common/utils");
|
|
18
19
|
var _styled = require("./styled");
|
|
19
20
|
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); }
|
|
20
|
-
|
|
21
|
+
// eslint-disable-next-line no-unused-vars
|
|
22
|
+
var ExpandedFrame = function ExpandedFrame(_ref) {
|
|
21
23
|
var _ref$isPlaceholder = _ref.isPlaceholder,
|
|
22
24
|
isPlaceholder = _ref$isPlaceholder === void 0 ? false : _ref$isPlaceholder,
|
|
23
25
|
children = _ref.children,
|
|
@@ -113,4 +115,93 @@ var styles = {
|
|
|
113
115
|
contentStyle: "_19itdlqj _2rko12b0 _1reo15vq _18m915vq _v56414au _bfhkhp5a _16jlkb7n _4t3i1osq _1pbykb7n",
|
|
114
116
|
contentInteractiveActiveBorder: "_1jhm1tt7",
|
|
115
117
|
contentOverflowAuto: "_1reo1wug _18m91wug"
|
|
116
|
-
};
|
|
118
|
+
};
|
|
119
|
+
var ExpandedFrameUpdated = function ExpandedFrameUpdated(_ref2) {
|
|
120
|
+
var _ref2$isPlaceholder = _ref2.isPlaceholder,
|
|
121
|
+
isPlaceholder = _ref2$isPlaceholder === void 0 ? false : _ref2$isPlaceholder,
|
|
122
|
+
children = _ref2.children,
|
|
123
|
+
onClick = _ref2.onClick,
|
|
124
|
+
icon = _ref2.icon,
|
|
125
|
+
text = _ref2.text,
|
|
126
|
+
isSelected = _ref2.isSelected,
|
|
127
|
+
_ref2$frameStyle = _ref2.frameStyle,
|
|
128
|
+
frameStyle = _ref2$frameStyle === void 0 ? 'showOnHover' : _ref2$frameStyle,
|
|
129
|
+
href = _ref2.href,
|
|
130
|
+
minWidth = _ref2.minWidth,
|
|
131
|
+
maxWidth = _ref2.maxWidth,
|
|
132
|
+
_ref2$testId = _ref2.testId,
|
|
133
|
+
testId = _ref2$testId === void 0 ? 'expanded-frame' : _ref2$testId,
|
|
134
|
+
inheritDimensions = _ref2.inheritDimensions,
|
|
135
|
+
_ref2$allowScrollBar = _ref2.allowScrollBar,
|
|
136
|
+
allowScrollBar = _ref2$allowScrollBar === void 0 ? false : _ref2$allowScrollBar,
|
|
137
|
+
_ref2$setOverflow = _ref2.setOverflow,
|
|
138
|
+
setOverflow = _ref2$setOverflow === void 0 ? true : _ref2$setOverflow,
|
|
139
|
+
CompetitorPrompt = _ref2.CompetitorPrompt,
|
|
140
|
+
onContentMouseEnter = _ref2.onContentMouseEnter,
|
|
141
|
+
onContentMouseLeave = _ref2.onContentMouseLeave;
|
|
142
|
+
var isInteractive = function isInteractive() {
|
|
143
|
+
return !isPlaceholder && (Boolean(href) || Boolean(onClick));
|
|
144
|
+
};
|
|
145
|
+
var handleClick = function handleClick(event) {
|
|
146
|
+
return (0, _utils.handleClickCommon)(event, onClick);
|
|
147
|
+
};
|
|
148
|
+
var handleMouseDown = (0, _useLinkClicked.useMouseDownEvent)();
|
|
149
|
+
|
|
150
|
+
// Note: cleanup fg based on results of prompt_whiteboard_competitor_link experiment
|
|
151
|
+
var CompetitorPromptComponent = CompetitorPrompt && href && (0, _platformFeatureFlags.fg)('prompt_whiteboard_competitor_link_gate') ? /*#__PURE__*/React.createElement(CompetitorPrompt, {
|
|
152
|
+
sourceUrl: href,
|
|
153
|
+
linkType: "embed"
|
|
154
|
+
}) : null;
|
|
155
|
+
var renderHeader = function renderHeader() {
|
|
156
|
+
return frameStyle !== 'hide' && /*#__PURE__*/React.createElement("div", {
|
|
157
|
+
className: (0, _runtime.ax)([styles.header, "embed-header"])
|
|
158
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
159
|
+
className: (0, _runtime.ax)([styles.leftSection])
|
|
160
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
161
|
+
className: (0, _runtime.ax)([styles.headerIcon])
|
|
162
|
+
}, icon), /*#__PURE__*/React.createElement("div", {
|
|
163
|
+
className: (0, _runtime.ax)([styles.tooltipWrapper])
|
|
164
|
+
}, !isPlaceholder && /*#__PURE__*/React.createElement(_tooltip.default, {
|
|
165
|
+
content: text,
|
|
166
|
+
hideTooltipOnMouseDown: true
|
|
167
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
168
|
+
href: href,
|
|
169
|
+
onClick: handleClick,
|
|
170
|
+
onMouseDown: handleMouseDown,
|
|
171
|
+
className: (0, _runtime.ax)([styles.headerAnchor])
|
|
172
|
+
}, text)))), CompetitorPromptComponent);
|
|
173
|
+
};
|
|
174
|
+
var interactive = isInteractive();
|
|
175
|
+
var showBackgroundAlways = frameStyle === 'show' || isSelected && frameStyle !== 'hide';
|
|
176
|
+
var showBackgroundOnHover = interactive && frameStyle !== 'hide';
|
|
177
|
+
var renderContent = function renderContent() {
|
|
178
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
179
|
+
"data-testid": "embed-content-wrapper",
|
|
180
|
+
// This fixes an issue with input fields in cross domain iframes (ie. databases and jira fields from different domains)
|
|
181
|
+
// See: HOT-107830
|
|
182
|
+
contentEditable: false,
|
|
183
|
+
onMouseEnter: onContentMouseEnter,
|
|
184
|
+
onMouseLeave: onContentMouseLeave,
|
|
185
|
+
onFocus: onContentMouseEnter,
|
|
186
|
+
onBlur: onContentMouseLeave,
|
|
187
|
+
className: (0, _runtime.ax)([styles.contentStyle, setOverflow && allowScrollBar && styles.contentOverflowAuto, interactive && !showBackgroundAlways && !showBackgroundOnHover && styles.contentInteractiveActiveBorder])
|
|
188
|
+
}, children);
|
|
189
|
+
};
|
|
190
|
+
return /*#__PURE__*/React.createElement("div", (0, _extends2.default)({
|
|
191
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
192
|
+
className: (0, _runtime.ax)([styles.linkWrapper, inheritDimensions && styles.linkWrapperInheritDimensions, isSelected && frameStyle !== 'hide' && styles.linkWrapperSelected, showBackgroundAlways && styles.linkWrapperBorderAndBackground, showBackgroundOnHover && !showBackgroundAlways && styles.linkWrapperInteractiveNotHidden, _styled.className]),
|
|
193
|
+
style: {
|
|
194
|
+
minWidth: minWidth ? "".concat(minWidth, "px") : '',
|
|
195
|
+
maxWidth: maxWidth ? "".concat(maxWidth, "px") : ''
|
|
196
|
+
},
|
|
197
|
+
"data-testid": testId,
|
|
198
|
+
"data-trello-do-not-use-override": testId
|
|
199
|
+
// Due to limitations of testing library, we can't assert ::after
|
|
200
|
+
,
|
|
201
|
+
"data-is-selected": isSelected
|
|
202
|
+
}, (isPlaceholder || !href) && {
|
|
203
|
+
'data-wrapper-type': 'default',
|
|
204
|
+
'data-is-interactive': isInteractive()
|
|
205
|
+
}), renderHeader(), renderContent());
|
|
206
|
+
};
|
|
207
|
+
var ExpandedFrameWithFG = exports.ExpandedFrame = (0, _platformFeatureFlagsReact.componentWithFG)('rovo_chat_embed_card_dwell_and_hover_metrics', ExpandedFrameUpdated, ExpandedFrame);
|