@atlaskit/smart-card 46.1.4 → 46.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 46.1.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 46.1.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [`e769e157cf4ad`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e769e157cf4ad) -
14
+ Add the One Click Chat Spotlight V2 eligibility hook behind
15
+ platform_sl_one_click_chat_spotlight_v2_fg, using a fixed browser-origin suppression history
16
+ shared across accounts. UI integration follows separately.
17
+
3
18
  ## 46.1.4
4
19
 
5
20
  ### Patch Changes
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = useOneClickChatSpotlightEligibility;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _react = require("react");
11
+ var _browserApis = require("@atlaskit/browser-apis");
12
+ var _expVal = require("@atlaskit/platform-feature-experiments/exp-val");
13
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
14
+ var _rovo = require("../../../utils/rovo");
15
+ var _getExtensionKey = require("../../getExtensionKey");
16
+ var _store = require("../../store");
17
+ var _useRovoConfig2 = _interopRequireDefault(require("../use-rovo-config"));
18
+ var _evaluate = require("./evaluate");
19
+ var _suppression = require("./suppression");
20
+ 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; }
21
+ 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; }
22
+ function useOneClickChatSpotlightEligibility(_ref) {
23
+ var _card$details, _card$details2, _actionOptions$rovoCh2;
24
+ var url = _ref.url,
25
+ actionOptions = _ref.actionOptions,
26
+ isOpportunity = _ref.isOpportunity,
27
+ onInteraction = _ref.onInteraction;
28
+ var card = (0, _store.useSmartCardState)(url !== null && url !== void 0 ? url : '');
29
+ var _useRovoConfig = (0, _useRovoConfig2.default)(),
30
+ product = _useRovoConfig.product,
31
+ rovoOptions = _useRovoConfig.rovoOptions;
32
+ var gateEnabled = (0, _fg.fg)('platform_sl_one_click_chat_spotlight_v2_fg');
33
+ var provider = (0, _getExtensionKey.getExtensionKey)(card.details);
34
+ var access = (_card$details = card.details) === null || _card$details === void 0 ? void 0 : _card$details.meta.access;
35
+ var visibility = (_card$details2 = card.details) === null || _card$details2 === void 0 ? void 0 : _card$details2.meta.visibility;
36
+ var rovoAvailable = (0, _rovo.getIsRovoChatEnabled)(rovoOptions);
37
+ var hostProduct = product === 'CONFLUENCE' ? 'confluence_web' : product === 'JPD' || product === 'JSW' || product === 'JSM' || product === 'JWM' ? 'jira_web' : undefined;
38
+ var _useState = (0, _react.useState)(),
39
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
40
+ suppression = _useState2[0],
41
+ setSuppression = _useState2[1];
42
+ var _useState3 = (0, _react.useState)({
43
+ isEligible: false,
44
+ reason: 'suppression_unavailable'
45
+ }),
46
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
47
+ eligibility = _useState4[0],
48
+ setEligibility = _useState4[1];
49
+ var _useState5 = (0, _react.useState)(0),
50
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
51
+ opportunityVersion = _useState6[0],
52
+ refreshOpportunity = _useState6[1];
53
+ var owner = (0, _react.useRef)(Symbol('one-click-chat-spotlight'));
54
+ var shown = (0, _react.useRef)(false);
55
+ var ended = (0, _react.useRef)(false);
56
+ var interaction = (0, _react.useRef)(onInteraction);
57
+ interaction.current = onInteraction;
58
+ (0, _react.useEffect)(function () {
59
+ if (gateEnabled) {
60
+ setSuppression((0, _suppression.getSuppressionStore)());
61
+ }
62
+ }, [gateEnabled]);
63
+ (0, _react.useEffect)(function () {
64
+ var doc = (0, _browserApis.getDocument)();
65
+ if (!gateEnabled || !isOpportunity || !doc) {
66
+ return;
67
+ }
68
+ var refresh = function refresh() {
69
+ return refreshOpportunity(function (version) {
70
+ return version + 1;
71
+ });
72
+ };
73
+ window.addEventListener('focus', refresh);
74
+ doc.addEventListener('visibilitychange', refresh);
75
+ // A link that remains visible across midnight is a new daily opportunity.
76
+ var midnight = new Date();
77
+ midnight.setHours(24, 0, 0, 0);
78
+ var timer = window.setTimeout(refresh, midnight.getTime() - Date.now());
79
+ return function () {
80
+ window.removeEventListener('focus', refresh);
81
+ doc.removeEventListener('visibilitychange', refresh);
82
+ window.clearTimeout(timer);
83
+ };
84
+ }, [gateEnabled, isOpportunity, opportunityVersion]);
85
+ (0, _react.useEffect)(function () {
86
+ var _actionOptions$rovoCh;
87
+ var token = owner.current;
88
+ var opportunity = (0, _evaluate.evaluateOpportunity)({
89
+ gateEnabled: gateEnabled,
90
+ appearance: 'inline',
91
+ status: isOpportunity ? card.status : 'pending',
92
+ provider: provider,
93
+ // Public resolution alone does not prove provider authorization. Fail closed for it.
94
+ authorized: visibility === 'restricted' && access !== 'unauthorized',
95
+ hasAccess: access === 'granted',
96
+ rovoAvailable: rovoAvailable,
97
+ consumerOptedIn: (actionOptions === null || actionOptions === void 0 || (_actionOptions$rovoCh = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh === void 0 ? void 0 : _actionOptions$rovoCh.optIn) === true,
98
+ product: hostProduct,
99
+ history: suppression === null || suppression === void 0 ? void 0 : suppression.read(),
100
+ spotlightActive: (0, _suppression.isSpotlightActive)(token),
101
+ now: Date.now()
102
+ });
103
+ if (!opportunity.isEligible || !(0, _suppression.claimSpotlight)(token)) {
104
+ setEligibility(opportunity.isEligible ? {
105
+ isEligible: false,
106
+ reason: 'spotlight_active'
107
+ } : opportunity);
108
+ return;
109
+ }
110
+ var cohort;
111
+ try {
112
+ // Targeting owns prior-day 3P MAU exclusion and account-level sticky assignment.
113
+ // Both control and treatment are evaluated at this same, unsuppressed opportunity.
114
+ cohort = (0, _evaluate.evaluateExperiment)((0, _expVal.expVal)('platform_sl_one_click_chat_spotlight_v2_exp', 'isEnabled', null));
115
+ } catch (_unused) {
116
+ cohort = {
117
+ isEligible: false,
118
+ reason: 'experiment_unavailable'
119
+ };
120
+ }
121
+ setEligibility(cohort);
122
+ if (!cohort.isEligible) {
123
+ (0, _suppression.releaseSpotlight)(token);
124
+ }
125
+ return function () {
126
+ return (0, _suppression.releaseSpotlight)(token);
127
+ };
128
+ }, [gateEnabled, isOpportunity, card.status, access, visibility, provider, hostProduct, rovoAvailable, actionOptions === null || actionOptions === void 0 || (_actionOptions$rovoCh2 = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh2 === void 0 ? void 0 : _actionOptions$rovoCh2.optIn, suppression, opportunityVersion]);
129
+ (0, _react.useEffect)(function () {
130
+ // Eligibility refreshes can keep the same popup open across midnight. Reset
131
+ // delivery state only when it closes, not while its onShown effect stays mounted.
132
+ if (!eligibility.isEligible) {
133
+ shown.current = false;
134
+ ended.current = false;
135
+ }
136
+ }, [eligibility.isEligible]);
137
+ var onShown = (0, _react.useCallback)(function () {
138
+ if (shown.current || ended.current || !eligibility.isEligible || !suppression) {
139
+ return;
140
+ }
141
+ if (!suppression.impress(Date.now())) {
142
+ ended.current = true;
143
+ (0, _suppression.releaseSpotlight)(owner.current);
144
+ setEligibility({
145
+ isEligible: false,
146
+ reason: 'suppression_unavailable'
147
+ });
148
+ return;
149
+ }
150
+ shown.current = true;
151
+ interaction.current('impression');
152
+ }, [eligibility.isEligible, suppression]);
153
+ var finish = (0, _react.useCallback)(function (kind) {
154
+ if (!shown.current || ended.current) {
155
+ return false;
156
+ }
157
+ ended.current = true;
158
+ if (kind === 'dismissed') {
159
+ suppression === null || suppression === void 0 || suppression.dismiss(Date.now());
160
+ }
161
+ interaction.current(kind);
162
+ (0, _suppression.releaseSpotlight)(owner.current);
163
+ setEligibility({
164
+ isEligible: false,
165
+ reason: kind === 'dismissed' ? 'dismissal_cooldown' : 'shown_today'
166
+ });
167
+ return true;
168
+ }, [suppression]);
169
+ var onClick = (0, _react.useCallback)(function () {
170
+ return finish('clicked');
171
+ }, [finish]);
172
+ var onDismiss = (0, _react.useCallback)(function () {
173
+ finish('dismissed');
174
+ }, [finish]);
175
+ return _objectSpread(_objectSpread({}, eligibility), {}, {
176
+ isEligible: eligibility.isEligible && gateEnabled && isOpportunity && !!suppression,
177
+ provider: provider,
178
+ product: hostProduct,
179
+ onShown: onShown,
180
+ onClick: onClick,
181
+ onDismiss: onDismiss
182
+ });
183
+ }
@@ -9,8 +9,6 @@ exports.createSuppressionStore = createSuppressionStore;
9
9
  exports.getSuppressionStore = getSuppressionStore;
10
10
  exports.isSpotlightActive = isSpotlightActive;
11
11
  exports.releaseSpotlight = releaseSpotlight;
12
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
13
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
14
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
15
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
14
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
@@ -18,8 +16,8 @@ var _StorageClient = require("@atlaskit/frontend-utilities/StorageClient");
18
16
  var _evaluate = require("./evaluate");
19
17
  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; }
20
18
  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; }
21
- /** Shared across inline cards. Account identifiers are held in memory only. */
22
- var stores = new Map();
19
+ /** Shared across inline cards and accounts on this browser origin. */
20
+ var store;
23
21
  var activeSpotlight;
24
22
  var isHistory = function isHistory(value) {
25
23
  if ((0, _typeof2.default)(value) !== 'object' || value === null || !('impressions' in value)) {
@@ -30,7 +28,7 @@ var isHistory = function isHistory(value) {
30
28
  }) && (!('dismissedAt' in value) || value.dismissedAt === undefined || typeof value.dismissedAt === 'number' && Number.isFinite(value.dismissedAt));
31
29
  };
32
30
 
33
- /** Reuses Smart Card's StorageClient, with timestamp-only values and a one-way user namespace. */
31
+ /** Reuses Smart Card's StorageClient, with timestamp-only values in one browser-origin history. */
34
32
  function createSuppressionStore(storage) {
35
33
  var isAvailable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
36
34
  return true;
@@ -79,53 +77,28 @@ function createSuppressionStore(storage) {
79
77
  }
80
78
  };
81
79
  }
82
- function getSuppressionStore(accountId) {
83
- var cached = stores.get(accountId);
84
- if (cached) {
85
- return cached;
80
+ function getSuppressionStore() {
81
+ if (typeof window === 'undefined') {
82
+ return undefined;
86
83
  }
87
- var pending = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
88
- var _window$crypto, digest, namespace, available, storage, _t;
89
- return _regenerator.default.wrap(function (_context) {
90
- while (1) switch (_context.prev = _context.next) {
91
- case 0:
92
- _context.prev = 0;
93
- if (!(typeof window === 'undefined' || !((_window$crypto = window.crypto) !== null && _window$crypto !== void 0 && _window$crypto.subtle))) {
94
- _context.next = 1;
95
- break;
84
+ if (!store) {
85
+ try {
86
+ var available = true;
87
+ var storage = new _StorageClient.StorageClient('one-click-chat-spotlight-v2', {
88
+ handlers: {
89
+ captureException: function captureException() {
90
+ available = false;
96
91
  }
97
- return _context.abrupt("return", undefined);
98
- case 1:
99
- _context.next = 2;
100
- return window.crypto.subtle.digest('SHA-256', new TextEncoder().encode("one-click-chat-spotlight-v2:".concat(accountId)));
101
- case 2:
102
- digest = _context.sent;
103
- namespace = Array.from(new Uint8Array(digest), function (byte) {
104
- return byte.toString(16).padStart(2, '0');
105
- }).join('');
106
- available = true;
107
- storage = new _StorageClient.StorageClient("one-click-chat-spotlight-v2:".concat(namespace), {
108
- handlers: {
109
- captureException: function captureException() {
110
- available = false;
111
- }
112
- }
113
- });
114
- return _context.abrupt("return", createSuppressionStore(storage, function () {
115
- return available;
116
- }));
117
- case 3:
118
- _context.prev = 3;
119
- _t = _context["catch"](0);
120
- return _context.abrupt("return", undefined);
121
- case 4:
122
- case "end":
123
- return _context.stop();
124
- }
125
- }, _callee, null, [[0, 3]]);
126
- }))();
127
- stores.set(accountId, pending);
128
- return pending;
92
+ }
93
+ });
94
+ store = createSuppressionStore(storage, function () {
95
+ return available;
96
+ });
97
+ } catch (_unused3) {
98
+ return undefined;
99
+ }
100
+ }
101
+ return store;
129
102
  }
130
103
  function claimSpotlight(owner) {
131
104
  if (activeSpotlight && activeSpotlight !== owner) {
@@ -25,7 +25,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
25
25
  var context = exports.context = {
26
26
  componentName: 'smart-cards',
27
27
  packageName: "@atlaskit/smart-card" || '',
28
- packageVersion: "46.1.4" || ''
28
+ packageVersion: "46.1.5" || ''
29
29
  };
30
30
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
31
31
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -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: "46.1.4",
22
+ packageVersion: "46.1.5",
23
23
  componentName: 'linkUrl'
24
24
  };
25
25
  var LinkUrl = function LinkUrl(_ref) {
@@ -0,0 +1,158 @@
1
+ import { useCallback, useEffect, useRef, useState } from 'react';
2
+ import { getDocument } from '@atlaskit/browser-apis';
3
+ import { expVal } from '@atlaskit/platform-feature-experiments/exp-val';
4
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
5
+ import { getIsRovoChatEnabled } from '../../../utils/rovo';
6
+ import { getExtensionKey } from '../../getExtensionKey';
7
+ import { useSmartCardState } from '../../store';
8
+ import useRovoConfig from '../use-rovo-config';
9
+ import { evaluateExperiment, evaluateOpportunity } from './evaluate';
10
+ import { claimSpotlight, getSuppressionStore, isSpotlightActive, releaseSpotlight } from './suppression';
11
+ export default function useOneClickChatSpotlightEligibility({
12
+ url,
13
+ actionOptions,
14
+ isOpportunity,
15
+ onInteraction
16
+ }) {
17
+ var _card$details, _card$details2, _actionOptions$rovoCh2;
18
+ const card = useSmartCardState(url !== null && url !== void 0 ? url : '');
19
+ const {
20
+ product,
21
+ rovoOptions
22
+ } = useRovoConfig();
23
+ const gateEnabled = fg('platform_sl_one_click_chat_spotlight_v2_fg');
24
+ const provider = getExtensionKey(card.details);
25
+ const access = (_card$details = card.details) === null || _card$details === void 0 ? void 0 : _card$details.meta.access;
26
+ const visibility = (_card$details2 = card.details) === null || _card$details2 === void 0 ? void 0 : _card$details2.meta.visibility;
27
+ const rovoAvailable = getIsRovoChatEnabled(rovoOptions);
28
+ const hostProduct = product === 'CONFLUENCE' ? 'confluence_web' : product === 'JPD' || product === 'JSW' || product === 'JSM' || product === 'JWM' ? 'jira_web' : undefined;
29
+ const [suppression, setSuppression] = useState();
30
+ const [eligibility, setEligibility] = useState({
31
+ isEligible: false,
32
+ reason: 'suppression_unavailable'
33
+ });
34
+ const [opportunityVersion, refreshOpportunity] = useState(0);
35
+ const owner = useRef(Symbol('one-click-chat-spotlight'));
36
+ const shown = useRef(false);
37
+ const ended = useRef(false);
38
+ const interaction = useRef(onInteraction);
39
+ interaction.current = onInteraction;
40
+ useEffect(() => {
41
+ if (gateEnabled) {
42
+ setSuppression(getSuppressionStore());
43
+ }
44
+ }, [gateEnabled]);
45
+ useEffect(() => {
46
+ const doc = getDocument();
47
+ if (!gateEnabled || !isOpportunity || !doc) {
48
+ return;
49
+ }
50
+ const refresh = () => refreshOpportunity(version => version + 1);
51
+ window.addEventListener('focus', refresh);
52
+ doc.addEventListener('visibilitychange', refresh);
53
+ // A link that remains visible across midnight is a new daily opportunity.
54
+ const midnight = new Date();
55
+ midnight.setHours(24, 0, 0, 0);
56
+ const timer = window.setTimeout(refresh, midnight.getTime() - Date.now());
57
+ return () => {
58
+ window.removeEventListener('focus', refresh);
59
+ doc.removeEventListener('visibilitychange', refresh);
60
+ window.clearTimeout(timer);
61
+ };
62
+ }, [gateEnabled, isOpportunity, opportunityVersion]);
63
+ useEffect(() => {
64
+ var _actionOptions$rovoCh;
65
+ const token = owner.current;
66
+ const opportunity = evaluateOpportunity({
67
+ gateEnabled,
68
+ appearance: 'inline',
69
+ status: isOpportunity ? card.status : 'pending',
70
+ provider,
71
+ // Public resolution alone does not prove provider authorization. Fail closed for it.
72
+ authorized: visibility === 'restricted' && access !== 'unauthorized',
73
+ hasAccess: access === 'granted',
74
+ rovoAvailable,
75
+ consumerOptedIn: (actionOptions === null || actionOptions === void 0 ? void 0 : (_actionOptions$rovoCh = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh === void 0 ? void 0 : _actionOptions$rovoCh.optIn) === true,
76
+ product: hostProduct,
77
+ history: suppression === null || suppression === void 0 ? void 0 : suppression.read(),
78
+ spotlightActive: isSpotlightActive(token),
79
+ now: Date.now()
80
+ });
81
+ if (!opportunity.isEligible || !claimSpotlight(token)) {
82
+ setEligibility(opportunity.isEligible ? {
83
+ isEligible: false,
84
+ reason: 'spotlight_active'
85
+ } : opportunity);
86
+ return;
87
+ }
88
+ let cohort;
89
+ try {
90
+ // Targeting owns prior-day 3P MAU exclusion and account-level sticky assignment.
91
+ // Both control and treatment are evaluated at this same, unsuppressed opportunity.
92
+ cohort = evaluateExperiment(expVal('platform_sl_one_click_chat_spotlight_v2_exp', 'isEnabled', null));
93
+ } catch {
94
+ cohort = {
95
+ isEligible: false,
96
+ reason: 'experiment_unavailable'
97
+ };
98
+ }
99
+ setEligibility(cohort);
100
+ if (!cohort.isEligible) {
101
+ releaseSpotlight(token);
102
+ }
103
+ return () => releaseSpotlight(token);
104
+ }, [gateEnabled, isOpportunity, card.status, access, visibility, provider, hostProduct, rovoAvailable, actionOptions === null || actionOptions === void 0 ? void 0 : (_actionOptions$rovoCh2 = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh2 === void 0 ? void 0 : _actionOptions$rovoCh2.optIn, suppression, opportunityVersion]);
105
+ useEffect(() => {
106
+ // Eligibility refreshes can keep the same popup open across midnight. Reset
107
+ // delivery state only when it closes, not while its onShown effect stays mounted.
108
+ if (!eligibility.isEligible) {
109
+ shown.current = false;
110
+ ended.current = false;
111
+ }
112
+ }, [eligibility.isEligible]);
113
+ const onShown = useCallback(() => {
114
+ if (shown.current || ended.current || !eligibility.isEligible || !suppression) {
115
+ return;
116
+ }
117
+ if (!suppression.impress(Date.now())) {
118
+ ended.current = true;
119
+ releaseSpotlight(owner.current);
120
+ setEligibility({
121
+ isEligible: false,
122
+ reason: 'suppression_unavailable'
123
+ });
124
+ return;
125
+ }
126
+ shown.current = true;
127
+ interaction.current('impression');
128
+ }, [eligibility.isEligible, suppression]);
129
+ const finish = useCallback(kind => {
130
+ if (!shown.current || ended.current) {
131
+ return false;
132
+ }
133
+ ended.current = true;
134
+ if (kind === 'dismissed') {
135
+ suppression === null || suppression === void 0 ? void 0 : suppression.dismiss(Date.now());
136
+ }
137
+ interaction.current(kind);
138
+ releaseSpotlight(owner.current);
139
+ setEligibility({
140
+ isEligible: false,
141
+ reason: kind === 'dismissed' ? 'dismissal_cooldown' : 'shown_today'
142
+ });
143
+ return true;
144
+ }, [suppression]);
145
+ const onClick = useCallback(() => finish('clicked'), [finish]);
146
+ const onDismiss = useCallback(() => {
147
+ finish('dismissed');
148
+ }, [finish]);
149
+ return {
150
+ ...eligibility,
151
+ isEligible: eligibility.isEligible && gateEnabled && isOpportunity && !!suppression,
152
+ provider,
153
+ product: hostProduct,
154
+ onShown,
155
+ onClick,
156
+ onDismiss
157
+ };
158
+ }
@@ -1,8 +1,8 @@
1
1
  import { StorageClient } from '@atlaskit/frontend-utilities/StorageClient';
2
2
  import { SEVEN_DAYS_MS } from './evaluate';
3
3
 
4
- /** Shared across inline cards. Account identifiers are held in memory only. */
5
- const stores = new Map();
4
+ /** Shared across inline cards and accounts on this browser origin. */
5
+ let store;
6
6
  let activeSpotlight;
7
7
  const isHistory = value => {
8
8
  if (typeof value !== 'object' || value === null || !('impressions' in value)) {
@@ -11,7 +11,7 @@ const isHistory = value => {
11
11
  return Array.isArray(value.impressions) && value.impressions.every(timestamp => typeof timestamp === 'number' && Number.isFinite(timestamp)) && (!('dismissedAt' in value) || value.dismissedAt === undefined || typeof value.dismissedAt === 'number' && Number.isFinite(value.dismissedAt));
12
12
  };
13
13
 
14
- /** Reuses Smart Card's StorageClient, with timestamp-only values and a one-way user namespace. */
14
+ /** Reuses Smart Card's StorageClient, with timestamp-only values in one browser-origin history. */
15
15
  export function createSuppressionStore(storage, isAvailable = () => true) {
16
16
  let blocked = false;
17
17
  const read = () => {
@@ -57,34 +57,26 @@ export function createSuppressionStore(storage, isAvailable = () => true) {
57
57
  }
58
58
  };
59
59
  }
60
- export function getSuppressionStore(accountId) {
61
- const cached = stores.get(accountId);
62
- if (cached) {
63
- return cached;
60
+ export function getSuppressionStore() {
61
+ if (typeof window === 'undefined') {
62
+ return undefined;
64
63
  }
65
- const pending = (async () => {
64
+ if (!store) {
66
65
  try {
67
- var _window$crypto;
68
- if (typeof window === 'undefined' || !((_window$crypto = window.crypto) !== null && _window$crypto !== void 0 && _window$crypto.subtle)) {
69
- return undefined;
70
- }
71
- const digest = await window.crypto.subtle.digest('SHA-256', new TextEncoder().encode(`one-click-chat-spotlight-v2:${accountId}`));
72
- const namespace = Array.from(new Uint8Array(digest), byte => byte.toString(16).padStart(2, '0')).join('');
73
66
  let available = true;
74
- const storage = new StorageClient(`one-click-chat-spotlight-v2:${namespace}`, {
67
+ const storage = new StorageClient('one-click-chat-spotlight-v2', {
75
68
  handlers: {
76
69
  captureException: () => {
77
70
  available = false;
78
71
  }
79
72
  }
80
73
  });
81
- return createSuppressionStore(storage, () => available);
74
+ store = createSuppressionStore(storage, () => available);
82
75
  } catch {
83
76
  return undefined;
84
77
  }
85
- })();
86
- stores.set(accountId, pending);
87
- return pending;
78
+ }
79
+ return store;
88
80
  }
89
81
  export function claimSpotlight(owner) {
90
82
  if (activeSpotlight && activeSpotlight !== owner) {
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
4
4
  export const context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card" || '',
7
- packageVersion: "46.1.4" || ''
7
+ packageVersion: "46.1.5" || ''
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -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: "46.1.4",
12
+ packageVersion: "46.1.5",
13
13
  componentName: 'linkUrl'
14
14
  };
15
15
  const LinkUrl = ({
@@ -0,0 +1,176 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ 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; }
4
+ 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; }
5
+ import { useCallback, useEffect, useRef, useState } from 'react';
6
+ import { getDocument } from '@atlaskit/browser-apis';
7
+ import { expVal } from '@atlaskit/platform-feature-experiments/exp-val';
8
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
9
+ import { getIsRovoChatEnabled } from '../../../utils/rovo';
10
+ import { getExtensionKey } from '../../getExtensionKey';
11
+ import { useSmartCardState } from '../../store';
12
+ import useRovoConfig from '../use-rovo-config';
13
+ import { evaluateExperiment, evaluateOpportunity } from './evaluate';
14
+ import { claimSpotlight, getSuppressionStore, isSpotlightActive, releaseSpotlight } from './suppression';
15
+ export default function useOneClickChatSpotlightEligibility(_ref) {
16
+ var _card$details, _card$details2, _actionOptions$rovoCh2;
17
+ var url = _ref.url,
18
+ actionOptions = _ref.actionOptions,
19
+ isOpportunity = _ref.isOpportunity,
20
+ onInteraction = _ref.onInteraction;
21
+ var card = useSmartCardState(url !== null && url !== void 0 ? url : '');
22
+ var _useRovoConfig = useRovoConfig(),
23
+ product = _useRovoConfig.product,
24
+ rovoOptions = _useRovoConfig.rovoOptions;
25
+ var gateEnabled = fg('platform_sl_one_click_chat_spotlight_v2_fg');
26
+ var provider = getExtensionKey(card.details);
27
+ var access = (_card$details = card.details) === null || _card$details === void 0 ? void 0 : _card$details.meta.access;
28
+ var visibility = (_card$details2 = card.details) === null || _card$details2 === void 0 ? void 0 : _card$details2.meta.visibility;
29
+ var rovoAvailable = getIsRovoChatEnabled(rovoOptions);
30
+ var hostProduct = product === 'CONFLUENCE' ? 'confluence_web' : product === 'JPD' || product === 'JSW' || product === 'JSM' || product === 'JWM' ? 'jira_web' : undefined;
31
+ var _useState = useState(),
32
+ _useState2 = _slicedToArray(_useState, 2),
33
+ suppression = _useState2[0],
34
+ setSuppression = _useState2[1];
35
+ var _useState3 = useState({
36
+ isEligible: false,
37
+ reason: 'suppression_unavailable'
38
+ }),
39
+ _useState4 = _slicedToArray(_useState3, 2),
40
+ eligibility = _useState4[0],
41
+ setEligibility = _useState4[1];
42
+ var _useState5 = useState(0),
43
+ _useState6 = _slicedToArray(_useState5, 2),
44
+ opportunityVersion = _useState6[0],
45
+ refreshOpportunity = _useState6[1];
46
+ var owner = useRef(Symbol('one-click-chat-spotlight'));
47
+ var shown = useRef(false);
48
+ var ended = useRef(false);
49
+ var interaction = useRef(onInteraction);
50
+ interaction.current = onInteraction;
51
+ useEffect(function () {
52
+ if (gateEnabled) {
53
+ setSuppression(getSuppressionStore());
54
+ }
55
+ }, [gateEnabled]);
56
+ useEffect(function () {
57
+ var doc = getDocument();
58
+ if (!gateEnabled || !isOpportunity || !doc) {
59
+ return;
60
+ }
61
+ var refresh = function refresh() {
62
+ return refreshOpportunity(function (version) {
63
+ return version + 1;
64
+ });
65
+ };
66
+ window.addEventListener('focus', refresh);
67
+ doc.addEventListener('visibilitychange', refresh);
68
+ // A link that remains visible across midnight is a new daily opportunity.
69
+ var midnight = new Date();
70
+ midnight.setHours(24, 0, 0, 0);
71
+ var timer = window.setTimeout(refresh, midnight.getTime() - Date.now());
72
+ return function () {
73
+ window.removeEventListener('focus', refresh);
74
+ doc.removeEventListener('visibilitychange', refresh);
75
+ window.clearTimeout(timer);
76
+ };
77
+ }, [gateEnabled, isOpportunity, opportunityVersion]);
78
+ useEffect(function () {
79
+ var _actionOptions$rovoCh;
80
+ var token = owner.current;
81
+ var opportunity = evaluateOpportunity({
82
+ gateEnabled: gateEnabled,
83
+ appearance: 'inline',
84
+ status: isOpportunity ? card.status : 'pending',
85
+ provider: provider,
86
+ // Public resolution alone does not prove provider authorization. Fail closed for it.
87
+ authorized: visibility === 'restricted' && access !== 'unauthorized',
88
+ hasAccess: access === 'granted',
89
+ rovoAvailable: rovoAvailable,
90
+ consumerOptedIn: (actionOptions === null || actionOptions === void 0 || (_actionOptions$rovoCh = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh === void 0 ? void 0 : _actionOptions$rovoCh.optIn) === true,
91
+ product: hostProduct,
92
+ history: suppression === null || suppression === void 0 ? void 0 : suppression.read(),
93
+ spotlightActive: isSpotlightActive(token),
94
+ now: Date.now()
95
+ });
96
+ if (!opportunity.isEligible || !claimSpotlight(token)) {
97
+ setEligibility(opportunity.isEligible ? {
98
+ isEligible: false,
99
+ reason: 'spotlight_active'
100
+ } : opportunity);
101
+ return;
102
+ }
103
+ var cohort;
104
+ try {
105
+ // Targeting owns prior-day 3P MAU exclusion and account-level sticky assignment.
106
+ // Both control and treatment are evaluated at this same, unsuppressed opportunity.
107
+ cohort = evaluateExperiment(expVal('platform_sl_one_click_chat_spotlight_v2_exp', 'isEnabled', null));
108
+ } catch (_unused) {
109
+ cohort = {
110
+ isEligible: false,
111
+ reason: 'experiment_unavailable'
112
+ };
113
+ }
114
+ setEligibility(cohort);
115
+ if (!cohort.isEligible) {
116
+ releaseSpotlight(token);
117
+ }
118
+ return function () {
119
+ return releaseSpotlight(token);
120
+ };
121
+ }, [gateEnabled, isOpportunity, card.status, access, visibility, provider, hostProduct, rovoAvailable, actionOptions === null || actionOptions === void 0 || (_actionOptions$rovoCh2 = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh2 === void 0 ? void 0 : _actionOptions$rovoCh2.optIn, suppression, opportunityVersion]);
122
+ useEffect(function () {
123
+ // Eligibility refreshes can keep the same popup open across midnight. Reset
124
+ // delivery state only when it closes, not while its onShown effect stays mounted.
125
+ if (!eligibility.isEligible) {
126
+ shown.current = false;
127
+ ended.current = false;
128
+ }
129
+ }, [eligibility.isEligible]);
130
+ var onShown = useCallback(function () {
131
+ if (shown.current || ended.current || !eligibility.isEligible || !suppression) {
132
+ return;
133
+ }
134
+ if (!suppression.impress(Date.now())) {
135
+ ended.current = true;
136
+ releaseSpotlight(owner.current);
137
+ setEligibility({
138
+ isEligible: false,
139
+ reason: 'suppression_unavailable'
140
+ });
141
+ return;
142
+ }
143
+ shown.current = true;
144
+ interaction.current('impression');
145
+ }, [eligibility.isEligible, suppression]);
146
+ var finish = useCallback(function (kind) {
147
+ if (!shown.current || ended.current) {
148
+ return false;
149
+ }
150
+ ended.current = true;
151
+ if (kind === 'dismissed') {
152
+ suppression === null || suppression === void 0 || suppression.dismiss(Date.now());
153
+ }
154
+ interaction.current(kind);
155
+ releaseSpotlight(owner.current);
156
+ setEligibility({
157
+ isEligible: false,
158
+ reason: kind === 'dismissed' ? 'dismissal_cooldown' : 'shown_today'
159
+ });
160
+ return true;
161
+ }, [suppression]);
162
+ var onClick = useCallback(function () {
163
+ return finish('clicked');
164
+ }, [finish]);
165
+ var onDismiss = useCallback(function () {
166
+ finish('dismissed');
167
+ }, [finish]);
168
+ return _objectSpread(_objectSpread({}, eligibility), {}, {
169
+ isEligible: eligibility.isEligible && gateEnabled && isOpportunity && !!suppression,
170
+ provider: provider,
171
+ product: hostProduct,
172
+ onShown: onShown,
173
+ onClick: onClick,
174
+ onDismiss: onDismiss
175
+ });
176
+ }
@@ -1,15 +1,13 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
3
  import _typeof from "@babel/runtime/helpers/typeof";
5
- import _regeneratorRuntime from "@babel/runtime/regenerator";
6
4
  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; }
7
5
  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; }
8
6
  import { StorageClient } from '@atlaskit/frontend-utilities/StorageClient';
9
7
  import { SEVEN_DAYS_MS } from './evaluate';
10
8
 
11
- /** Shared across inline cards. Account identifiers are held in memory only. */
12
- var stores = new Map();
9
+ /** Shared across inline cards and accounts on this browser origin. */
10
+ var store;
13
11
  var activeSpotlight;
14
12
  var isHistory = function isHistory(value) {
15
13
  if (_typeof(value) !== 'object' || value === null || !('impressions' in value)) {
@@ -20,7 +18,7 @@ var isHistory = function isHistory(value) {
20
18
  }) && (!('dismissedAt' in value) || value.dismissedAt === undefined || typeof value.dismissedAt === 'number' && Number.isFinite(value.dismissedAt));
21
19
  };
22
20
 
23
- /** Reuses Smart Card's StorageClient, with timestamp-only values and a one-way user namespace. */
21
+ /** Reuses Smart Card's StorageClient, with timestamp-only values in one browser-origin history. */
24
22
  export function createSuppressionStore(storage) {
25
23
  var isAvailable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
26
24
  return true;
@@ -69,53 +67,28 @@ export function createSuppressionStore(storage) {
69
67
  }
70
68
  };
71
69
  }
72
- export function getSuppressionStore(accountId) {
73
- var cached = stores.get(accountId);
74
- if (cached) {
75
- return cached;
70
+ export function getSuppressionStore() {
71
+ if (typeof window === 'undefined') {
72
+ return undefined;
76
73
  }
77
- var pending = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
78
- var _window$crypto, digest, namespace, available, storage, _t;
79
- return _regeneratorRuntime.wrap(function (_context) {
80
- while (1) switch (_context.prev = _context.next) {
81
- case 0:
82
- _context.prev = 0;
83
- if (!(typeof window === 'undefined' || !((_window$crypto = window.crypto) !== null && _window$crypto !== void 0 && _window$crypto.subtle))) {
84
- _context.next = 1;
85
- break;
74
+ if (!store) {
75
+ try {
76
+ var available = true;
77
+ var storage = new StorageClient('one-click-chat-spotlight-v2', {
78
+ handlers: {
79
+ captureException: function captureException() {
80
+ available = false;
86
81
  }
87
- return _context.abrupt("return", undefined);
88
- case 1:
89
- _context.next = 2;
90
- return window.crypto.subtle.digest('SHA-256', new TextEncoder().encode("one-click-chat-spotlight-v2:".concat(accountId)));
91
- case 2:
92
- digest = _context.sent;
93
- namespace = Array.from(new Uint8Array(digest), function (byte) {
94
- return byte.toString(16).padStart(2, '0');
95
- }).join('');
96
- available = true;
97
- storage = new StorageClient("one-click-chat-spotlight-v2:".concat(namespace), {
98
- handlers: {
99
- captureException: function captureException() {
100
- available = false;
101
- }
102
- }
103
- });
104
- return _context.abrupt("return", createSuppressionStore(storage, function () {
105
- return available;
106
- }));
107
- case 3:
108
- _context.prev = 3;
109
- _t = _context["catch"](0);
110
- return _context.abrupt("return", undefined);
111
- case 4:
112
- case "end":
113
- return _context.stop();
114
- }
115
- }, _callee, null, [[0, 3]]);
116
- }))();
117
- stores.set(accountId, pending);
118
- return pending;
82
+ }
83
+ });
84
+ store = createSuppressionStore(storage, function () {
85
+ return available;
86
+ });
87
+ } catch (_unused3) {
88
+ return undefined;
89
+ }
90
+ }
91
+ return store;
119
92
  }
120
93
  export function claimSpotlight(owner) {
121
94
  if (activeSpotlight && activeSpotlight !== owner) {
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
4
4
  export var context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card" || '',
7
- packageVersion: "46.1.4" || ''
7
+ packageVersion: "46.1.5" || ''
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -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: "46.1.4",
15
+ packageVersion: "46.1.5",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  var LinkUrl = function LinkUrl(_ref) {
@@ -0,0 +1,16 @@
1
+ import type { CardActionOptions } from '../../../view/Card/types';
2
+ import { type EligibilityResult } from './evaluate';
3
+ export type SpotlightInteraction = 'impression' | 'clicked' | 'dismissed';
4
+ export interface SpotlightEligibility extends EligibilityResult {
5
+ onClick: () => boolean;
6
+ onDismiss: () => void;
7
+ onShown: () => void;
8
+ product?: string;
9
+ provider?: string;
10
+ }
11
+ export default function useOneClickChatSpotlightEligibility({ url, actionOptions, isOpportunity, onInteraction, }: {
12
+ actionOptions?: CardActionOptions;
13
+ isOpportunity: boolean;
14
+ onInteraction: (interaction: SpotlightInteraction) => void;
15
+ url?: string;
16
+ }): SpotlightEligibility;
@@ -5,9 +5,9 @@ export interface SpotlightSuppression {
5
5
  impress: (now: number) => boolean;
6
6
  read: () => SpotlightHistory | undefined;
7
7
  }
8
- /** Reuses Smart Card's StorageClient, with timestamp-only values and a one-way user namespace. */
8
+ /** Reuses Smart Card's StorageClient, with timestamp-only values in one browser-origin history. */
9
9
  export declare function createSuppressionStore(storage: StorageClient, isAvailable?: () => boolean): SpotlightSuppression;
10
- export declare function getSuppressionStore(accountId: string): Promise<SpotlightSuppression | undefined>;
10
+ export declare function getSuppressionStore(): SpotlightSuppression | undefined;
11
11
  export declare function claimSpotlight(owner: symbol): boolean;
12
12
  export declare function releaseSpotlight(owner: symbol): void;
13
13
  export declare function isSpotlightActive(owner: symbol): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "46.1.4",
3
+ "version": "46.1.6",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -59,7 +59,7 @@
59
59
  "@atlaskit/heading": "^8.0.0",
60
60
  "@atlaskit/icon": "^38.0.0",
61
61
  "@atlaskit/icon-file-type": "^8.3.0",
62
- "@atlaskit/icon-lab": "^7.10.0",
62
+ "@atlaskit/icon-lab": "^7.11.0",
63
63
  "@atlaskit/image": "^5.2.0",
64
64
  "@atlaskit/json-ld-types": "^2.0.0",
65
65
  "@atlaskit/link": "^5.1.0",
@@ -88,7 +88,7 @@
88
88
  "@atlaskit/select": "^23.1.0",
89
89
  "@atlaskit/spinner": "^20.4.0",
90
90
  "@atlaskit/tabs": "^21.3.0",
91
- "@atlaskit/tag": "^16.0.0",
91
+ "@atlaskit/tag": "^17.0.0",
92
92
  "@atlaskit/textarea": "^10.2.0",
93
93
  "@atlaskit/textfield": "^10.2.0",
94
94
  "@atlaskit/theme": "^28.2.0",
@@ -142,6 +142,7 @@
142
142
  "@atlassian/workbench": "workspace:*",
143
143
  "@testing-library/dom": "^10.1.0",
144
144
  "@testing-library/jest-dom": "^6.4.5",
145
+ "@testing-library/react": "^16.3.0",
145
146
  "@types/facepaint": "^1.2.1",
146
147
  "@types/lorem-ipsum": "^1.0.2",
147
148
  "@types/react": "^18.2.0",
@@ -165,6 +166,10 @@
165
166
  "xhr-mock": "^2.4.0"
166
167
  },
167
168
  "platform-feature-flags": {
169
+ "platform_sl_one_click_chat_spotlight_v2_fg": {
170
+ "type": "boolean",
171
+ "referenceOnly": true
172
+ },
168
173
  "confluence_ep_shim_macro_links_v2": {
169
174
  "type": "boolean",
170
175
  "referenceOnly": true