@copart/ops-tool-kit 1.13.6-alpha.3 → 1.13.6-alpha.5
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 +10 -0
- package/dist/ops-tool-kit.js +58 -12
- package/dist/ops-tool-kit.js.map +1 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
### alpha
|
|
2
|
+
|
|
3
|
+
FormData requests work in iframe apps, user status apps come from the user record, and the chat window can talk to the lot agent.
|
|
4
|
+
|
|
5
|
+
- `fetcher.post` / `put` / `patch` with a `FormData` body threw `DataCloneError` in iframe apps, because `postMessage` cannot clone a `FormData`. The bridge now sends the entries with `bodyType: 'formData'` and drops the iframe `Content-Type` header. The shell rebuilds the `FormData` so the browser can set the multipart boundary.
|
|
6
|
+
- A request body that `postMessage` cannot clone now rejects with the real error and is removed from the pending list, instead of staying pending.
|
|
7
|
+
- The signed-in user's status apps are read from `user_availability_checked_apps`. The apps list is the overlap of `user_eligible_apps` and `user_provisioned_apps`, with display names from `endpoints.getAllUserAvailabilityApps`.
|
|
8
|
+
- The status apps dropdown is disabled when `self_managed_flag` is not true.
|
|
9
|
+
- `mihelpAgentProps.version: 'v2'` posts to `endpoints.lotAgentChat` with `messages` and `client_context` from `storage.appContext`. The session id is kept per app, and thumbs are hidden. Apps that do not pass `version: 'v2'` still use `endpoints.mihelpChat`. The window title is G2 Agent, and the clear button is New conversation.
|
|
10
|
+
|
|
1
11
|
### 1.13.5
|
|
2
12
|
|
|
3
13
|
Iframe storage now matches the portal store the embedded app used to share.
|
package/dist/ops-tool-kit.js
CHANGED
|
@@ -49,7 +49,7 @@ var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
|
49
49
|
var ReactRouterDOM__namespace = /*#__PURE__*/_interopNamespace(ReactRouterDOM);
|
|
50
50
|
|
|
51
51
|
const name$1 = "@copart/ops-tool-kit";
|
|
52
|
-
const version$3 = "1.13.6-alpha.
|
|
52
|
+
const version$3 = "1.13.6-alpha.5";
|
|
53
53
|
const main$1 = "dist/ops-tool-kit.js";
|
|
54
54
|
const style = "dist/ops-tool-kit.css";
|
|
55
55
|
const files = [
|
|
@@ -2943,7 +2943,7 @@ function isArrayBuffer(val) {
|
|
|
2943
2943
|
* @param {Object} val The value to test
|
|
2944
2944
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
2945
2945
|
*/
|
|
2946
|
-
function isFormData(val) {
|
|
2946
|
+
function isFormData$1(val) {
|
|
2947
2947
|
return typeof FormData !== 'undefined' && val instanceof FormData;
|
|
2948
2948
|
}
|
|
2949
2949
|
|
|
@@ -3186,7 +3186,7 @@ var utils = {
|
|
|
3186
3186
|
isArray: isArray$2,
|
|
3187
3187
|
isArrayBuffer: isArrayBuffer,
|
|
3188
3188
|
isBuffer: isBuffer_1$1,
|
|
3189
|
-
isFormData: isFormData,
|
|
3189
|
+
isFormData: isFormData$1,
|
|
3190
3190
|
isArrayBufferView: isArrayBufferView,
|
|
3191
3191
|
isString: isString,
|
|
3192
3192
|
isNumber: isNumber,
|
|
@@ -54702,7 +54702,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
54702
54702
|
className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowHeader"
|
|
54703
54703
|
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
54704
54704
|
className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--title"
|
|
54705
|
-
}, "
|
|
54705
|
+
}, "G2 Agent"), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
54706
54706
|
onClick: function onClick() {
|
|
54707
54707
|
return setShowChatWindow(false);
|
|
54708
54708
|
},
|
|
@@ -54743,7 +54743,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
54743
54743
|
color: '#000',
|
|
54744
54744
|
fontSize: '16px'
|
|
54745
54745
|
}
|
|
54746
|
-
}), /*#__PURE__*/React__default["default"].createElement("span", null, "
|
|
54746
|
+
}), /*#__PURE__*/React__default["default"].createElement("span", null, "New conversation")))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
54747
54747
|
className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messagesContainer",
|
|
54748
54748
|
ref: messagesContainerRef
|
|
54749
54749
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -54758,7 +54758,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
54758
54758
|
className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble"
|
|
54759
54759
|
}, /*#__PURE__*/React__default["default"].createElement("p", {
|
|
54760
54760
|
"data-chat-id": "agent-message-1"
|
|
54761
|
-
}, "Hi! Welcome to
|
|
54761
|
+
}, "Hi! Welcome to G2 Agent."))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
54762
54762
|
className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--message utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--welcomeQuestion",
|
|
54763
54763
|
ref: welcomeQuestionRef
|
|
54764
54764
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -70064,6 +70064,31 @@ function isAllowedOrigin(origin) {
|
|
|
70064
70064
|
}
|
|
70065
70065
|
}
|
|
70066
70066
|
|
|
70067
|
+
// window.parent.postMessage copies its payload with the structured clone algorithm, which
|
|
70068
|
+
// cannot clone a FormData (DataCloneError). Its entries can be cloned: strings, File and
|
|
70069
|
+
// Blob values all survive, so the bridge sends the entries and the shell rebuilds the FormData.
|
|
70070
|
+
var FORM_DATA_BODY_TYPE = 'formData';
|
|
70071
|
+
function isFormData(value) {
|
|
70072
|
+
return typeof FormData !== 'undefined' && value instanceof FormData;
|
|
70073
|
+
}
|
|
70074
|
+
|
|
70075
|
+
// [[name, value], ...] in append order; duplicate names are kept.
|
|
70076
|
+
function serializeFormData(formData) {
|
|
70077
|
+
return Array.from(formData.entries());
|
|
70078
|
+
}
|
|
70079
|
+
|
|
70080
|
+
// The iframe app sets Content-Type: multipart/form-data with no boundary. The browser
|
|
70081
|
+
// adds the boundary only when it sends a FormData itself, so that header must not be
|
|
70082
|
+
// forwarded. Axios 0.18 also drops Content-Type when the body is a FormData.
|
|
70083
|
+
function headersForFormData(headers) {
|
|
70084
|
+
if (!headers || _typeof$1(headers) !== 'object') return headers;
|
|
70085
|
+
var next = _objectSpread2({}, headers);
|
|
70086
|
+
Object.keys(next).forEach(function (key) {
|
|
70087
|
+
if (String(key).toLowerCase() === 'content-type') delete next[key];
|
|
70088
|
+
});
|
|
70089
|
+
return next;
|
|
70090
|
+
}
|
|
70091
|
+
|
|
70067
70092
|
var _excluded$1 = ["signal"];
|
|
70068
70093
|
var pending = new Map();
|
|
70069
70094
|
var STORAGE_REQUEST_TIMEOUT_MS = 5000;
|
|
@@ -70517,7 +70542,14 @@ if (typeof window !== 'undefined') {
|
|
|
70517
70542
|
}
|
|
70518
70543
|
function sendFetchRequest(payload) {
|
|
70519
70544
|
var signal = payload.signal,
|
|
70520
|
-
|
|
70545
|
+
rest = _objectWithoutProperties(payload, _excluded$1);
|
|
70546
|
+
// A FormData body cannot be posted to the shell as-is (see ./formData.js). It is sent as
|
|
70547
|
+
// its entries, flagged with bodyType so the shell knows to rebuild it.
|
|
70548
|
+
var restPayload = isFormData(rest.data) ? _objectSpread2(_objectSpread2({}, rest), {}, {
|
|
70549
|
+
data: serializeFormData(rest.data),
|
|
70550
|
+
bodyType: FORM_DATA_BODY_TYPE,
|
|
70551
|
+
headers: headersForFormData(rest.headers)
|
|
70552
|
+
}) : rest;
|
|
70521
70553
|
return new Promise(function (resolve, reject) {
|
|
70522
70554
|
if (signal !== null && signal !== void 0 && signal.aborted) {
|
|
70523
70555
|
reject(new DOMException('Request aborted', 'AbortError'));
|
|
@@ -70529,8 +70561,9 @@ function sendFetchRequest(payload) {
|
|
|
70529
70561
|
reject: reject,
|
|
70530
70562
|
responseType: payload.responseType
|
|
70531
70563
|
});
|
|
70564
|
+
var onAbort;
|
|
70532
70565
|
if (signal) {
|
|
70533
|
-
|
|
70566
|
+
onAbort = function onAbort() {
|
|
70534
70567
|
if (pending.has(id)) {
|
|
70535
70568
|
pending.delete(id);
|
|
70536
70569
|
post(IFRAME_EVENTS.CANCEL_REQUEST, {
|
|
@@ -70543,11 +70576,24 @@ function sendFetchRequest(payload) {
|
|
|
70543
70576
|
once: true
|
|
70544
70577
|
});
|
|
70545
70578
|
}
|
|
70546
|
-
var
|
|
70547
|
-
requestId: id
|
|
70548
|
-
}));
|
|
70549
|
-
if (!sent) {
|
|
70579
|
+
var dropPending = function dropPending() {
|
|
70550
70580
|
pending.delete(id);
|
|
70581
|
+
if (signal && onAbort) signal.removeEventListener('abort', onAbort);
|
|
70582
|
+
};
|
|
70583
|
+
var sent;
|
|
70584
|
+
try {
|
|
70585
|
+
sent = post(IFRAME_EVENTS.FETCH_REQUEST, _objectSpread2(_objectSpread2({}, restPayload), {}, {
|
|
70586
|
+
requestId: id
|
|
70587
|
+
}));
|
|
70588
|
+
} catch (error) {
|
|
70589
|
+
// postMessage throws DataCloneError for any body the structured clone cannot copy.
|
|
70590
|
+
// Without this the request stays in `pending` forever.
|
|
70591
|
+
dropPending();
|
|
70592
|
+
reject(error);
|
|
70593
|
+
return;
|
|
70594
|
+
}
|
|
70595
|
+
if (!sent) {
|
|
70596
|
+
dropPending();
|
|
70551
70597
|
reject(new Error('iframe-bridge: FETCH_REQUEST blocked — shell origin not pinned'));
|
|
70552
70598
|
}
|
|
70553
70599
|
});
|