@atlaskit/smart-card 44.16.4 → 44.16.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 +12 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/hover-card/hover-card-unauthorised--default--platform-sl-3p-preauth-better-hovercard-false.png +2 -2
- package/dist/cjs/__tests__/vr-tests/__snapshots__/hover-card/hover-card-unauthorised--default--platform-sl-3p-preauth-better-hovercard-true.png +2 -2
- package/dist/cjs/extractors/action/extract-invoke-copy-link-action.js +1 -1
- package/dist/cjs/extractors/action/extract-invoke-download-action.js +1 -1
- package/dist/cjs/extractors/action/extract-invoke-preview-action.js +7 -7
- package/dist/cjs/extractors/action/extract-invoke-view-action.js +1 -1
- package/dist/cjs/state/actions/index.js +7 -7
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +46 -46
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/readStream.js +44 -44
- package/dist/cjs/state/hooks/use-incoming-outgoing-links/index.js +34 -34
- package/dist/cjs/state/hooks/use-invoke/index.js +4 -4
- package/dist/cjs/state/hooks/use-invoke-client-action/index.js +12 -12
- package/dist/cjs/state/hooks/use-resolve/index.js +4 -4
- package/dist/cjs/state/hooks/usePrefetch.js +14 -14
- package/dist/cjs/state/services/current-site-cloud-id/index.js +16 -16
- package/dist/cjs/state/services/personalization/index.js +23 -23
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/index.js +26 -25
- package/dist/cjs/utils/mocks.js +16 -16
- package/dist/cjs/view/EmbedModal/utils.js +4 -4
- package/dist/cjs/view/FlexibleCard/components/actions/action/server-action/index.js +17 -17
- package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js +8 -8
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/test-utils.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.js +10 -10
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.js +31 -31
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.js +10 -10
- package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +4 -4
- package/dist/cjs/view/FlexibleCard/components/actions/rovo-chat-action/index.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/index.js +34 -34
- package/dist/cjs/view/InlineCard/common/action-button/index.compiled.css +1 -1
- package/dist/cjs/view/InlineCard/common/action-button/index.js +1 -1
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/RelatedLinksModal/index.js +41 -41
- package/dist/es2019/__tests__/vr-tests/__snapshots__/hover-card/hover-card-unauthorised--default--platform-sl-3p-preauth-better-hovercard-false.png +2 -2
- package/dist/es2019/__tests__/vr-tests/__snapshots__/hover-card/hover-card-unauthorised--default--platform-sl-3p-preauth-better-hovercard-true.png +2 -2
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/InlineCard/common/action-button/index.compiled.css +1 -1
- package/dist/es2019/view/InlineCard/common/action-button/index.js +1 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/__tests__/vr-tests/__snapshots__/hover-card/hover-card-unauthorised--default--platform-sl-3p-preauth-better-hovercard-false.png +2 -2
- package/dist/esm/__tests__/vr-tests/__snapshots__/hover-card/hover-card-unauthorised--default--platform-sl-3p-preauth-better-hovercard-true.png +2 -2
- package/dist/esm/extractors/action/extract-invoke-copy-link-action.js +1 -1
- package/dist/esm/extractors/action/extract-invoke-download-action.js +1 -1
- package/dist/esm/extractors/action/extract-invoke-preview-action.js +7 -7
- package/dist/esm/extractors/action/extract-invoke-view-action.js +1 -1
- package/dist/esm/state/actions/index.js +7 -7
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +46 -46
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/readStream.js +44 -44
- package/dist/esm/state/hooks/use-incoming-outgoing-links/index.js +34 -34
- package/dist/esm/state/hooks/use-invoke/index.js +4 -4
- package/dist/esm/state/hooks/use-invoke-client-action/index.js +11 -11
- package/dist/esm/state/hooks/use-resolve/index.js +4 -4
- package/dist/esm/state/hooks/usePrefetch.js +14 -14
- package/dist/esm/state/services/current-site-cloud-id/index.js +16 -16
- package/dist/esm/state/services/personalization/index.js +23 -23
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/index.js +25 -24
- package/dist/esm/utils/mocks.js +16 -16
- package/dist/esm/view/EmbedModal/utils.js +4 -4
- package/dist/esm/view/FlexibleCard/components/actions/action/server-action/index.js +16 -16
- package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js +8 -8
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/test-utils.js +2 -2
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.js +10 -10
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.js +30 -30
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.js +10 -10
- package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +4 -4
- package/dist/esm/view/FlexibleCard/components/actions/rovo-chat-action/index.js +1 -1
- package/dist/esm/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/index.js +33 -33
- package/dist/esm/view/InlineCard/common/action-button/index.compiled.css +1 -1
- package/dist/esm/view/InlineCard/common/action-button/index.js +1 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/RelatedLinksModal/index.js +40 -40
- package/package.json +9 -9
|
@@ -10,99 +10,99 @@ export function readStream(_x) {
|
|
|
10
10
|
}
|
|
11
11
|
function _readStream() {
|
|
12
12
|
_readStream = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(response) {
|
|
13
|
-
var reader, doneStreaming, chunkBuffer, _yield$_awaitAsyncGen, value, done, processedChunks, _iterator, _step, chunk, jsonChunk, error;
|
|
14
|
-
return _regeneratorRuntime.wrap(function
|
|
13
|
+
var reader, doneStreaming, chunkBuffer, _yield$_awaitAsyncGen, value, done, processedChunks, _iterator, _step, chunk, jsonChunk, error, _t, _t2, _t3;
|
|
14
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
15
15
|
while (1) switch (_context.prev = _context.next) {
|
|
16
16
|
case 0:
|
|
17
17
|
reader = getBufferReader(response);
|
|
18
18
|
doneStreaming = false;
|
|
19
19
|
chunkBuffer = '';
|
|
20
|
-
case
|
|
21
|
-
_context.prev =
|
|
22
|
-
_context.next =
|
|
20
|
+
case 1:
|
|
21
|
+
_context.prev = 1;
|
|
22
|
+
_context.next = 2;
|
|
23
23
|
return _awaitAsyncGenerator(reader.read());
|
|
24
|
-
case
|
|
24
|
+
case 2:
|
|
25
25
|
_yield$_awaitAsyncGen = _context.sent;
|
|
26
26
|
value = _yield$_awaitAsyncGen.value;
|
|
27
27
|
done = _yield$_awaitAsyncGen.done;
|
|
28
28
|
doneStreaming = done;
|
|
29
29
|
if (!value) {
|
|
30
|
-
_context.next =
|
|
30
|
+
_context.next = 12;
|
|
31
31
|
break;
|
|
32
32
|
}
|
|
33
33
|
processedChunks = "".concat(chunkBuffer).concat(value).split('\n'); // assumes that all JSON chunks are separated by a new-line;
|
|
34
34
|
chunkBuffer = '';
|
|
35
35
|
_iterator = _createForOfIteratorHelper(processedChunks);
|
|
36
|
-
_context.prev =
|
|
36
|
+
_context.prev = 3;
|
|
37
37
|
_iterator.s();
|
|
38
|
-
case
|
|
38
|
+
case 4:
|
|
39
39
|
if ((_step = _iterator.n()).done) {
|
|
40
|
-
_context.next =
|
|
40
|
+
_context.next = 9;
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
43
|
chunk = _step.value;
|
|
44
|
-
_context.prev =
|
|
44
|
+
_context.prev = 5;
|
|
45
45
|
jsonChunk = JSON.parse(chunk);
|
|
46
46
|
if (jsonChunk.type === 'ERROR') {
|
|
47
47
|
reader.cancel();
|
|
48
48
|
}
|
|
49
|
-
_context.next =
|
|
49
|
+
_context.next = 6;
|
|
50
50
|
return jsonChunk;
|
|
51
|
-
case
|
|
52
|
-
_context.next =
|
|
51
|
+
case 6:
|
|
52
|
+
_context.next = 8;
|
|
53
53
|
break;
|
|
54
|
-
case
|
|
55
|
-
_context.prev =
|
|
56
|
-
|
|
54
|
+
case 7:
|
|
55
|
+
_context.prev = 7;
|
|
56
|
+
_t = _context["catch"](5);
|
|
57
57
|
// the chunk may be incomplete, so we'll save it for the next iteration.
|
|
58
58
|
chunkBuffer = chunk;
|
|
59
|
-
case
|
|
60
|
-
_context.next =
|
|
59
|
+
case 8:
|
|
60
|
+
_context.next = 4;
|
|
61
61
|
break;
|
|
62
|
-
case
|
|
63
|
-
_context.next =
|
|
62
|
+
case 9:
|
|
63
|
+
_context.next = 11;
|
|
64
64
|
break;
|
|
65
|
-
case
|
|
66
|
-
_context.prev =
|
|
67
|
-
|
|
68
|
-
_iterator.e(
|
|
69
|
-
case
|
|
70
|
-
_context.prev =
|
|
65
|
+
case 10:
|
|
66
|
+
_context.prev = 10;
|
|
67
|
+
_t2 = _context["catch"](3);
|
|
68
|
+
_iterator.e(_t2);
|
|
69
|
+
case 11:
|
|
70
|
+
_context.prev = 11;
|
|
71
71
|
_iterator.f();
|
|
72
|
-
return _context.finish(
|
|
73
|
-
case
|
|
74
|
-
_context.next =
|
|
72
|
+
return _context.finish(11);
|
|
73
|
+
case 12:
|
|
74
|
+
_context.next = 15;
|
|
75
75
|
break;
|
|
76
|
-
case
|
|
77
|
-
_context.prev =
|
|
78
|
-
|
|
79
|
-
if (!(
|
|
80
|
-
_context.next =
|
|
76
|
+
case 13:
|
|
77
|
+
_context.prev = 13;
|
|
78
|
+
_t3 = _context["catch"](1);
|
|
79
|
+
if (!(_t3 instanceof DOMException && _t3.name === 'AbortError')) {
|
|
80
|
+
_context.next = 14;
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
83
83
|
doneStreaming = true;
|
|
84
|
-
_context.next =
|
|
84
|
+
_context.next = 15;
|
|
85
85
|
break;
|
|
86
|
-
case
|
|
86
|
+
case 14:
|
|
87
87
|
reader.cancel();
|
|
88
|
-
throw
|
|
89
|
-
case
|
|
88
|
+
throw _t3;
|
|
89
|
+
case 15:
|
|
90
90
|
if (!doneStreaming) {
|
|
91
|
-
_context.next =
|
|
91
|
+
_context.next = 1;
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
|
-
case
|
|
94
|
+
case 16:
|
|
95
95
|
if (!chunkBuffer) {
|
|
96
|
-
_context.next =
|
|
96
|
+
_context.next = 17;
|
|
97
97
|
break;
|
|
98
98
|
}
|
|
99
99
|
error = new Error("Not all the data was processed: ".concat(chunkBuffer));
|
|
100
100
|
throw error;
|
|
101
|
-
case
|
|
101
|
+
case 17:
|
|
102
102
|
case "end":
|
|
103
103
|
return _context.stop();
|
|
104
104
|
}
|
|
105
|
-
}, _callee, null, [[
|
|
105
|
+
}, _callee, null, [[1, 13], [3, 10, 11, 12], [5, 7]]);
|
|
106
106
|
}));
|
|
107
107
|
return _readStream.apply(this, arguments);
|
|
108
108
|
}
|
|
@@ -12,7 +12,7 @@ var useIncomingOutgoingAri = function useIncomingOutgoingAri() {
|
|
|
12
12
|
var baseUriWithNoTrailingSlash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
13
13
|
var aggRequestCall = useCallback( /*#__PURE__*/function () {
|
|
14
14
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(body, headers) {
|
|
15
|
-
return _regeneratorRuntime.wrap(function
|
|
15
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
16
16
|
while (1) switch (_context.prev = _context.next) {
|
|
17
17
|
case 0:
|
|
18
18
|
return _context.abrupt("return", request('post', baseUriWithNoTrailingSlash + '/gateway/api/graphql', body, headers, [200]));
|
|
@@ -27,30 +27,30 @@ var useIncomingOutgoingAri = function useIncomingOutgoingAri() {
|
|
|
27
27
|
};
|
|
28
28
|
}(), [baseUriWithNoTrailingSlash]);
|
|
29
29
|
var getCurrentSiteId = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
30
|
-
var response;
|
|
31
|
-
return _regeneratorRuntime.wrap(function
|
|
30
|
+
var response, _t;
|
|
31
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
32
32
|
while (1) switch (_context2.prev = _context2.next) {
|
|
33
33
|
case 0:
|
|
34
34
|
_context2.prev = 0;
|
|
35
|
-
_context2.next =
|
|
35
|
+
_context2.next = 1;
|
|
36
36
|
return request('get', baseUriWithNoTrailingSlash + '/_edge/tenant_info');
|
|
37
|
-
case
|
|
37
|
+
case 1:
|
|
38
38
|
response = _context2.sent;
|
|
39
39
|
return _context2.abrupt("return", response === null || response === void 0 ? void 0 : response.cloudId);
|
|
40
|
-
case
|
|
41
|
-
_context2.prev =
|
|
42
|
-
|
|
40
|
+
case 2:
|
|
41
|
+
_context2.prev = 2;
|
|
42
|
+
_t = _context2["catch"](0);
|
|
43
43
|
return _context2.abrupt("return", undefined);
|
|
44
|
-
case
|
|
44
|
+
case 3:
|
|
45
45
|
case "end":
|
|
46
46
|
return _context2.stop();
|
|
47
47
|
}
|
|
48
|
-
}, _callee2, null, [[0,
|
|
48
|
+
}, _callee2, null, [[0, 2]]);
|
|
49
49
|
})), [baseUriWithNoTrailingSlash]);
|
|
50
50
|
var getSiteId = useCallback( /*#__PURE__*/function () {
|
|
51
51
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(resourceAri) {
|
|
52
|
-
var ariPattern, match;
|
|
53
|
-
return _regeneratorRuntime.wrap(function
|
|
52
|
+
var ariPattern, match, _t2;
|
|
53
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
54
54
|
while (1) switch (_context3.prev = _context3.next) {
|
|
55
55
|
case 0:
|
|
56
56
|
// ARI pattern that matches both formats:
|
|
@@ -67,29 +67,29 @@ var useIncomingOutgoingAri = function useIncomingOutgoingAri() {
|
|
|
67
67
|
ariPattern = /^ari:cloud:([a-z][a-z.-]+):([a-zA-Z0-9_.-]+):([a-z][a-zA-Z.-]+)\/(.+)$/;
|
|
68
68
|
match = resourceAri.match(ariPattern);
|
|
69
69
|
if (!(match && match[2])) {
|
|
70
|
-
_context3.next =
|
|
70
|
+
_context3.next = 1;
|
|
71
71
|
break;
|
|
72
72
|
}
|
|
73
73
|
return _context3.abrupt("return", match[2]);
|
|
74
|
-
case
|
|
74
|
+
case 1:
|
|
75
75
|
if (!fg('platform_sl_incoming_outgoing_tenant_info_killswitch')) {
|
|
76
|
-
_context3.next =
|
|
76
|
+
_context3.next = 3;
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
|
-
_context3.next =
|
|
79
|
+
_context3.next = 2;
|
|
80
80
|
return getCurrentSiteCloudId(baseUriWithNoTrailingSlash);
|
|
81
|
-
case
|
|
82
|
-
|
|
83
|
-
_context3.next =
|
|
81
|
+
case 2:
|
|
82
|
+
_t2 = _context3.sent;
|
|
83
|
+
_context3.next = 5;
|
|
84
84
|
break;
|
|
85
|
-
case
|
|
86
|
-
_context3.next =
|
|
85
|
+
case 3:
|
|
86
|
+
_context3.next = 4;
|
|
87
87
|
return getCurrentSiteId();
|
|
88
|
-
case
|
|
89
|
-
|
|
90
|
-
case
|
|
91
|
-
return _context3.abrupt("return",
|
|
92
|
-
case
|
|
88
|
+
case 4:
|
|
89
|
+
_t2 = _context3.sent;
|
|
90
|
+
case 5:
|
|
91
|
+
return _context3.abrupt("return", _t2);
|
|
92
|
+
case 6:
|
|
93
93
|
case "end":
|
|
94
94
|
return _context3.stop();
|
|
95
95
|
}
|
|
@@ -120,28 +120,28 @@ var useIncomingOutgoingAri = function useIncomingOutgoingAri() {
|
|
|
120
120
|
incomingAris,
|
|
121
121
|
outgoingAris,
|
|
122
122
|
_args4 = arguments;
|
|
123
|
-
return _regeneratorRuntime.wrap(function
|
|
123
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
124
124
|
while (1) switch (_context4.prev = _context4.next) {
|
|
125
125
|
case 0:
|
|
126
126
|
firstIncoming = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : 50;
|
|
127
127
|
firstOutgoing = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : 50;
|
|
128
|
-
_context4.next =
|
|
128
|
+
_context4.next = 1;
|
|
129
129
|
return getSiteId(ari);
|
|
130
|
-
case
|
|
130
|
+
case 1:
|
|
131
131
|
siteId = _context4.sent;
|
|
132
132
|
if (siteId) {
|
|
133
|
-
_context4.next =
|
|
133
|
+
_context4.next = 2;
|
|
134
134
|
break;
|
|
135
135
|
}
|
|
136
136
|
return _context4.abrupt("return", {
|
|
137
137
|
incomingAris: [],
|
|
138
138
|
outgoingAris: []
|
|
139
139
|
});
|
|
140
|
-
case
|
|
140
|
+
case 2:
|
|
141
141
|
headers = {
|
|
142
142
|
'X-Query-Context': "ari:cloud:platform::site/".concat(siteId)
|
|
143
143
|
};
|
|
144
|
-
_context4.next =
|
|
144
|
+
_context4.next = 3;
|
|
145
145
|
return aggRequestCall({
|
|
146
146
|
variables: {
|
|
147
147
|
id: ari,
|
|
@@ -150,7 +150,7 @@ var useIncomingOutgoingAri = function useIncomingOutgoingAri() {
|
|
|
150
150
|
},
|
|
151
151
|
query: queryIncomingOutgoingAris
|
|
152
152
|
}, headers);
|
|
153
|
-
case
|
|
153
|
+
case 3:
|
|
154
154
|
response = _context4.sent;
|
|
155
155
|
incomingAris = (_response$data$graphS = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 || (_response$data = _response$data.graphStore) === null || _response$data === void 0 || (_response$data = _response$data.incoming) === null || _response$data === void 0 || (_response$data = _response$data.aris) === null || _response$data === void 0 || (_response$data = _response$data.map(function (node) {
|
|
156
156
|
return node === null || node === void 0 ? void 0 : node.id;
|
|
@@ -166,7 +166,7 @@ var useIncomingOutgoingAri = function useIncomingOutgoingAri() {
|
|
|
166
166
|
incomingAris: incomingAris,
|
|
167
167
|
outgoingAris: outgoingAris
|
|
168
168
|
});
|
|
169
|
-
case
|
|
169
|
+
case 4:
|
|
170
170
|
case "end":
|
|
171
171
|
return _context4.stop();
|
|
172
172
|
}
|
|
@@ -10,15 +10,15 @@ var useInvoke = function useInvoke() {
|
|
|
10
10
|
return useCallback( /*#__PURE__*/function () {
|
|
11
11
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(req, cb) {
|
|
12
12
|
var response;
|
|
13
|
-
return _regeneratorRuntime.wrap(function
|
|
13
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
14
14
|
while (1) switch (_context.prev = _context.next) {
|
|
15
15
|
case 0:
|
|
16
|
-
_context.next =
|
|
16
|
+
_context.next = 1;
|
|
17
17
|
return clientExt.invoke(req);
|
|
18
|
-
case
|
|
18
|
+
case 1:
|
|
19
19
|
response = _context.sent;
|
|
20
20
|
return _context.abrupt("return", cb ? cb(response) : response);
|
|
21
|
-
case
|
|
21
|
+
case 2:
|
|
22
22
|
case "end":
|
|
23
23
|
return _context.stop();
|
|
24
24
|
}
|
|
@@ -19,8 +19,8 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
19
19
|
var fireEvent = fireEventProp !== null && fireEventProp !== void 0 ? fireEventProp : defaultFireEvent;
|
|
20
20
|
return useCallback( /*#__PURE__*/function () {
|
|
21
21
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
|
|
22
|
-
var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, prompt, _ref2$resourceType, resourceType, experienceId, markName, _measure$getMeasure$d, _measure$getMeasure, result, _measure$getMeasure$d2, _measure$getMeasure2, reason;
|
|
23
|
-
return _regeneratorRuntime.wrap(function
|
|
22
|
+
var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, prompt, _ref2$resourceType, resourceType, experienceId, markName, _measure$getMeasure$d, _measure$getMeasure, result, _measure$getMeasure$d2, _measure$getMeasure2, reason, _t;
|
|
23
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
24
24
|
while (1) switch (_context.prev = _context.next) {
|
|
25
25
|
case 0:
|
|
26
26
|
actionSubjectId = _ref2.actionSubjectId, actionType = _ref2.actionType, actionFn = _ref2.actionFn, _ref2$definitionId = _ref2.definitionId, definitionId = _ref2$definitionId === void 0 ? null : _ref2$definitionId, extensionKey = _ref2.extensionKey, display = _ref2.display, id = _ref2.id, prompt = _ref2.prompt, _ref2$resourceType = _ref2.resourceType, resourceType = _ref2$resourceType === void 0 ? null : _ref2$resourceType;
|
|
@@ -28,7 +28,7 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
28
28
|
experienceId = uuid(); // Begin performance instrumentation.
|
|
29
29
|
markName = "".concat(experienceId, "-").concat(actionType);
|
|
30
30
|
measure.mark(markName, 'pending');
|
|
31
|
-
_context.prev =
|
|
31
|
+
_context.prev = 1;
|
|
32
32
|
// Begin UFO experience
|
|
33
33
|
startUfoExperience(ACTION_EXPERIENCE_NAME, experienceId, {
|
|
34
34
|
actionType: actionType,
|
|
@@ -49,9 +49,9 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
// Invoke action
|
|
52
|
-
_context.next =
|
|
52
|
+
_context.next = 2;
|
|
53
53
|
return actionFn();
|
|
54
|
-
case
|
|
54
|
+
case 2:
|
|
55
55
|
result = _context.sent;
|
|
56
56
|
measure.mark(markName, 'resolved');
|
|
57
57
|
succeedUfoExperience(ACTION_EXPERIENCE_NAME, experienceId);
|
|
@@ -64,12 +64,12 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
64
64
|
resourceType: resourceType
|
|
65
65
|
});
|
|
66
66
|
return _context.abrupt("return", result);
|
|
67
|
-
case
|
|
68
|
-
_context.prev =
|
|
69
|
-
|
|
67
|
+
case 3:
|
|
68
|
+
_context.prev = 3;
|
|
69
|
+
_t = _context["catch"](1);
|
|
70
70
|
measure.mark(markName, 'errored');
|
|
71
71
|
failUfoExperience(ACTION_EXPERIENCE_NAME, experienceId);
|
|
72
|
-
reason = typeof
|
|
72
|
+
reason = typeof _t === 'string' ? _t : _t === null || _t === void 0 ? void 0 : _t.message;
|
|
73
73
|
fireEvent('operational.smartLinkAction.unresolved', {
|
|
74
74
|
actionType: actionType !== null && actionType !== void 0 ? actionType : null,
|
|
75
75
|
definitionId: definitionId,
|
|
@@ -79,11 +79,11 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
79
79
|
reason: reason,
|
|
80
80
|
resourceType: resourceType
|
|
81
81
|
});
|
|
82
|
-
case
|
|
82
|
+
case 4:
|
|
83
83
|
case "end":
|
|
84
84
|
return _context.stop();
|
|
85
85
|
}
|
|
86
|
-
}, _callee, null, [[
|
|
86
|
+
}, _callee, null, [[1, 3]]);
|
|
87
87
|
}));
|
|
88
88
|
return function (_x) {
|
|
89
89
|
return _ref3.apply(this, arguments);
|
|
@@ -27,7 +27,7 @@ var useResolve = function useResolve() {
|
|
|
27
27
|
details,
|
|
28
28
|
hasData,
|
|
29
29
|
_args = arguments;
|
|
30
|
-
return _regeneratorRuntime.wrap(function
|
|
30
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
31
31
|
while (1) switch (_context.prev = _context.next) {
|
|
32
32
|
case 0:
|
|
33
33
|
isReloading = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
|
|
@@ -39,7 +39,7 @@ var useResolve = function useResolve() {
|
|
|
39
39
|
}, details = _ref2.details;
|
|
40
40
|
hasData = !!(details && details.data || isEntityPresent(details));
|
|
41
41
|
if (!(isReloading || !hasData || isMetadataRequest)) {
|
|
42
|
-
_context.next =
|
|
42
|
+
_context.next = 1;
|
|
43
43
|
break;
|
|
44
44
|
}
|
|
45
45
|
return _context.abrupt("return", connections.client.fetchData(url, isReloading).then(function (response) {
|
|
@@ -47,11 +47,11 @@ var useResolve = function useResolve() {
|
|
|
47
47
|
}).catch(function (error) {
|
|
48
48
|
return handleResolvedLinkError(url, error, undefined, isMetadataRequest);
|
|
49
49
|
}));
|
|
50
|
-
case
|
|
50
|
+
case 1:
|
|
51
51
|
addMetadataToExperience('smart-link-rendered', id, {
|
|
52
52
|
cached: true
|
|
53
53
|
});
|
|
54
|
-
case
|
|
54
|
+
case 2:
|
|
55
55
|
case "end":
|
|
56
56
|
return _context.stop();
|
|
57
57
|
}
|
|
@@ -14,16 +14,16 @@ export function usePrefetch(url) {
|
|
|
14
14
|
var _ref2 = connections || {},
|
|
15
15
|
client = _ref2.client;
|
|
16
16
|
return useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
17
|
-
var isPrefetching, isFetching, needsPrefetch, response;
|
|
18
|
-
return _regeneratorRuntime.wrap(function
|
|
17
|
+
var isPrefetching, isFetching, needsPrefetch, response, _t;
|
|
18
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
19
19
|
while (1) switch (_context.prev = _context.next) {
|
|
20
20
|
case 0:
|
|
21
21
|
if (!(!store || !prefetchStore || !connections)) {
|
|
22
|
-
_context.next =
|
|
22
|
+
_context.next = 1;
|
|
23
23
|
break;
|
|
24
24
|
}
|
|
25
25
|
return _context.abrupt("return");
|
|
26
|
-
case
|
|
26
|
+
case 1:
|
|
27
27
|
// If the link is already being prefetched, the prefetch store
|
|
28
28
|
// should have a flag set against the URL. The prefetch store is purposefully
|
|
29
29
|
// separate from the UI in order to ensure no rendering takes place;
|
|
@@ -34,7 +34,7 @@ export function usePrefetch(url) {
|
|
|
34
34
|
isFetching = getState()[url]; // We compute if a link needs to be prefetched thus, referencing the above.
|
|
35
35
|
needsPrefetch = !isPrefetching && !isFetching;
|
|
36
36
|
if (!needsPrefetch) {
|
|
37
|
-
_context.next =
|
|
37
|
+
_context.next = 5;
|
|
38
38
|
break;
|
|
39
39
|
}
|
|
40
40
|
// We specify in the prefetch store that this link no
|
|
@@ -45,10 +45,10 @@ export function usePrefetch(url) {
|
|
|
45
45
|
// Try fetch the data for this URL from Object Resolver Service (ORS), executing batch
|
|
46
46
|
// requests by domain (as usual) to ensure we minimize the amount of connections
|
|
47
47
|
// we create between browser -> ORS when making network requests.
|
|
48
|
-
_context.prev =
|
|
49
|
-
_context.next =
|
|
48
|
+
_context.prev = 2;
|
|
49
|
+
_context.next = 3;
|
|
50
50
|
return client.prefetchData(url);
|
|
51
|
-
case
|
|
51
|
+
case 3:
|
|
52
52
|
response = _context.sent;
|
|
53
53
|
// Once the data comes back, we put the link in the `resolved` status. This ensures
|
|
54
54
|
// that when the link enters the viewport and is rendered, we immediately show it as
|
|
@@ -65,15 +65,15 @@ export function usePrefetch(url) {
|
|
|
65
65
|
url: url
|
|
66
66
|
}, undefined, undefined, 'resolved'));
|
|
67
67
|
}
|
|
68
|
-
_context.next =
|
|
68
|
+
_context.next = 5;
|
|
69
69
|
break;
|
|
70
|
-
case
|
|
71
|
-
_context.prev =
|
|
72
|
-
|
|
73
|
-
case
|
|
70
|
+
case 4:
|
|
71
|
+
_context.prev = 4;
|
|
72
|
+
_t = _context["catch"](2);
|
|
73
|
+
case 5:
|
|
74
74
|
case "end":
|
|
75
75
|
return _context.stop();
|
|
76
76
|
}
|
|
77
|
-
}, _callee, null, [[
|
|
77
|
+
}, _callee, null, [[2, 4]]);
|
|
78
78
|
})), [store, prefetchStore, connections, url, getState, client, dispatch]);
|
|
79
79
|
}
|
|
@@ -67,33 +67,33 @@ export var CurrentSiteCloudIdService = /*#__PURE__*/function () {
|
|
|
67
67
|
return existing;
|
|
68
68
|
}
|
|
69
69
|
var promise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
70
|
-
var response, cloudId;
|
|
71
|
-
return _regeneratorRuntime.wrap(function
|
|
70
|
+
var response, cloudId, _t;
|
|
71
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
72
72
|
while (1) switch (_context.prev = _context.next) {
|
|
73
73
|
case 0:
|
|
74
74
|
_context.prev = 0;
|
|
75
|
-
_context.next =
|
|
75
|
+
_context.next = 1;
|
|
76
76
|
return request('get', "".concat(baseUri, "/_edge/tenant_info"));
|
|
77
|
-
case
|
|
77
|
+
case 1:
|
|
78
78
|
response = _context.sent;
|
|
79
79
|
cloudId = response === null || response === void 0 ? void 0 : response.cloudId;
|
|
80
80
|
if (cloudId) {
|
|
81
81
|
_this.writeStoredCloudId(baseUri, cloudId);
|
|
82
82
|
}
|
|
83
83
|
return _context.abrupt("return", cloudId ? cloudId : _this.readStoredCloudId(baseUri));
|
|
84
|
-
case
|
|
85
|
-
_context.prev =
|
|
86
|
-
|
|
84
|
+
case 2:
|
|
85
|
+
_context.prev = 2;
|
|
86
|
+
_t = _context["catch"](0);
|
|
87
87
|
return _context.abrupt("return", _this.readStoredCloudId(baseUri));
|
|
88
|
-
case
|
|
89
|
-
_context.prev =
|
|
88
|
+
case 3:
|
|
89
|
+
_context.prev = 3;
|
|
90
90
|
_this.tenantInfoInflightPromises.delete(baseUri);
|
|
91
|
-
return _context.finish(
|
|
92
|
-
case
|
|
91
|
+
return _context.finish(3);
|
|
92
|
+
case 4:
|
|
93
93
|
case "end":
|
|
94
94
|
return _context.stop();
|
|
95
95
|
}
|
|
96
|
-
}, _callee, null, [[0,
|
|
96
|
+
}, _callee, null, [[0, 2, 3, 4]]);
|
|
97
97
|
}))();
|
|
98
98
|
this.tenantInfoInflightPromises.set(baseUri, promise);
|
|
99
99
|
return promise;
|
|
@@ -121,19 +121,19 @@ export var CurrentSiteCloudIdService = /*#__PURE__*/function () {
|
|
|
121
121
|
var baseUriWithNoTrailingSlash,
|
|
122
122
|
fromStorage,
|
|
123
123
|
_args2 = arguments;
|
|
124
|
-
return _regeneratorRuntime.wrap(function
|
|
124
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
125
125
|
while (1) switch (_context2.prev = _context2.next) {
|
|
126
126
|
case 0:
|
|
127
127
|
baseUriWithNoTrailingSlash = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : '';
|
|
128
128
|
fromStorage = this.readStoredCloudId(baseUriWithNoTrailingSlash);
|
|
129
129
|
if (!fromStorage) {
|
|
130
|
-
_context2.next =
|
|
130
|
+
_context2.next = 1;
|
|
131
131
|
break;
|
|
132
132
|
}
|
|
133
133
|
return _context2.abrupt("return", fromStorage);
|
|
134
|
-
case
|
|
134
|
+
case 1:
|
|
135
135
|
return _context2.abrupt("return", this.ensureTenantInfoInflightStarted(baseUriWithNoTrailingSlash));
|
|
136
|
-
case
|
|
136
|
+
case 2:
|
|
137
137
|
case "end":
|
|
138
138
|
return _context2.stop();
|
|
139
139
|
}
|
|
@@ -32,10 +32,10 @@ function _fetchSiteTraits() {
|
|
|
32
32
|
_fetchSiteTraits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(cloudId) {
|
|
33
33
|
var _data$attributes;
|
|
34
34
|
var response, data;
|
|
35
|
-
return _regeneratorRuntime.wrap(function
|
|
35
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
36
36
|
while (1) switch (_context3.prev = _context3.next) {
|
|
37
37
|
case 0:
|
|
38
|
-
_context3.next =
|
|
38
|
+
_context3.next = 1;
|
|
39
39
|
return fetch("".concat(BASE_URL, "/site/").concat(cloudId), {
|
|
40
40
|
method: 'GET',
|
|
41
41
|
credentials: 'include',
|
|
@@ -43,20 +43,20 @@ function _fetchSiteTraits() {
|
|
|
43
43
|
'Content-Type': 'application/json'
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
-
case
|
|
46
|
+
case 1:
|
|
47
47
|
response = _context3.sent;
|
|
48
48
|
if (response.ok) {
|
|
49
|
-
_context3.next =
|
|
49
|
+
_context3.next = 2;
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
52
|
return _context3.abrupt("return", []);
|
|
53
|
-
case
|
|
54
|
-
_context3.next =
|
|
53
|
+
case 2:
|
|
54
|
+
_context3.next = 3;
|
|
55
55
|
return response.json();
|
|
56
|
-
case
|
|
56
|
+
case 3:
|
|
57
57
|
data = _context3.sent;
|
|
58
58
|
return _context3.abrupt("return", (_data$attributes = data === null || data === void 0 ? void 0 : data.attributes) !== null && _data$attributes !== void 0 ? _data$attributes : []);
|
|
59
|
-
case
|
|
59
|
+
case 4:
|
|
60
60
|
case "end":
|
|
61
61
|
return _context3.stop();
|
|
62
62
|
}
|
|
@@ -84,32 +84,32 @@ export var PersonalizationService = /*#__PURE__*/function () {
|
|
|
84
84
|
var _getProviderPctMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(cloudId, traitName) {
|
|
85
85
|
var _this = this;
|
|
86
86
|
var cacheKey, cachedPromise, promise, retryablePromise;
|
|
87
|
-
return _regeneratorRuntime.wrap(function
|
|
87
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
88
88
|
while (1) switch (_context2.prev = _context2.next) {
|
|
89
89
|
case 0:
|
|
90
90
|
if (cloudId) {
|
|
91
|
-
_context2.next =
|
|
91
|
+
_context2.next = 1;
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
94
|
return _context2.abrupt("return", undefined);
|
|
95
|
-
case
|
|
95
|
+
case 1:
|
|
96
96
|
cacheKey = scopedCacheKey(cloudId, traitName);
|
|
97
97
|
cachedPromise = this.cache.get(cacheKey);
|
|
98
98
|
if (!cachedPromise) {
|
|
99
|
-
_context2.next =
|
|
99
|
+
_context2.next = 2;
|
|
100
100
|
break;
|
|
101
101
|
}
|
|
102
102
|
return _context2.abrupt("return", cachedPromise);
|
|
103
|
-
case
|
|
103
|
+
case 2:
|
|
104
104
|
promise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
105
|
-
var traits, trait, mapped;
|
|
106
|
-
return _regeneratorRuntime.wrap(function
|
|
105
|
+
var traits, trait, mapped, _t;
|
|
106
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
107
107
|
while (1) switch (_context.prev = _context.next) {
|
|
108
108
|
case 0:
|
|
109
109
|
_context.prev = 0;
|
|
110
|
-
_context.next =
|
|
110
|
+
_context.next = 1;
|
|
111
111
|
return fetchSiteTraits(cloudId);
|
|
112
|
-
case
|
|
112
|
+
case 1:
|
|
113
113
|
traits = _context.sent;
|
|
114
114
|
trait = traits.find(function (t) {
|
|
115
115
|
return t.name === traitName;
|
|
@@ -119,22 +119,22 @@ export var PersonalizationService = /*#__PURE__*/function () {
|
|
|
119
119
|
_this.writeStoredProviderPctMap(cloudId, traitName, mapped);
|
|
120
120
|
}
|
|
121
121
|
return _context.abrupt("return", mapped);
|
|
122
|
-
case
|
|
123
|
-
_context.prev =
|
|
124
|
-
|
|
122
|
+
case 2:
|
|
123
|
+
_context.prev = 2;
|
|
124
|
+
_t = _context["catch"](0);
|
|
125
125
|
return _context.abrupt("return", undefined);
|
|
126
|
-
case
|
|
126
|
+
case 3:
|
|
127
127
|
case "end":
|
|
128
128
|
return _context.stop();
|
|
129
129
|
}
|
|
130
|
-
}, _callee, null, [[0,
|
|
130
|
+
}, _callee, null, [[0, 2]]);
|
|
131
131
|
}))();
|
|
132
132
|
retryablePromise = promise.finally(function () {
|
|
133
133
|
_this.cache.delete(cacheKey);
|
|
134
134
|
});
|
|
135
135
|
this.cache.set(cacheKey, retryablePromise);
|
|
136
136
|
return _context2.abrupt("return", retryablePromise);
|
|
137
|
-
case
|
|
137
|
+
case 3:
|
|
138
138
|
case "end":
|
|
139
139
|
return _context2.stop();
|
|
140
140
|
}
|