@copart/ops-tool-kit 1.12.2-alpha.2 → 1.12.2-alpha.4

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.
@@ -47,7 +47,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
47
47
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
48
48
 
49
49
  const name$r = "@copart/ops-tool-kit";
50
- const version$8 = "1.12.2-alpha.2";
50
+ const version$8 = "1.12.2-alpha.4";
51
51
  const main$1 = "dist/ops-tool-kit.js";
52
52
  const style = "dist/ops-tool-kit.css";
53
53
  const files = [
@@ -2761,6 +2761,9 @@ var setAppContext = function setAppContext() {
2761
2761
  var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2762
2762
  try {
2763
2763
  var _window$toolkitEnv, _window$toolkitEnv2, _window$toolkitEnv3;
2764
+ if (_typeof$1(context) !== 'object' || context === null || Array.isArray(context)) {
2765
+ context = {};
2766
+ }
2764
2767
  var isCoreApp = (_window$toolkitEnv = window.toolkitEnv) !== null && _window$toolkitEnv !== void 0 && _window$toolkitEnv.IS_CORE_APP ? window.toolkitEnv.IS_CORE_APP : process.env.IS_CORE_APP;
2765
2768
  if (isCoreApp) {
2766
2769
  setSessionItem('opsportal-core:miHelpBotContext', context);
@@ -2819,7 +2822,7 @@ var createOpsStorage = function createOpsStorage() {
2819
2822
  }
2820
2823
  });
2821
2824
  var appAuthName = appData ? appData.appAuthName : (_window$toolkitEnv8 = window.toolkitEnv) !== null && _window$toolkitEnv8 !== void 0 && _window$toolkitEnv8.APP_AUTH_NAME ? window.toolkitEnv.APP_AUTH_NAME : process.env.APP_AUTH_NAME;
2822
- return appAuthName ? getSessionItem("".concat(appAuthName, ":miHelpBotContext")) : '';
2825
+ return appAuthName ? getSessionItem("".concat(appAuthName, ":miHelpBotContext")) : {};
2823
2826
  }
2824
2827
  } catch (e) {
2825
2828
  console.log('App context error, ', e);
@@ -7159,7 +7162,7 @@ var map$3 = map$2;
7159
7162
  * R.path(['a', 'b'], {a: {b: 2}}); //=> 2
7160
7163
  * R.path(['a', 'b'], {c: {b: 2}}); //=> undefined
7161
7164
  */
7162
- var path = /*#__PURE__*/_curry2(function path(paths, obj) {
7165
+ var path$1 = /*#__PURE__*/_curry2(function path(paths, obj) {
7163
7166
  var val = obj;
7164
7167
  var idx = 0;
7165
7168
  while (idx < paths.length) {
@@ -7171,7 +7174,7 @@ var path = /*#__PURE__*/_curry2(function path(paths, obj) {
7171
7174
  }
7172
7175
  return val;
7173
7176
  });
7174
- var path$1 = path;
7177
+ var path$2 = path$1;
7175
7178
 
7176
7179
  /**
7177
7180
  * Returns a function that when supplied an object returns the indicated
@@ -7194,7 +7197,7 @@ var path$1 = path;
7194
7197
  */
7195
7198
 
7196
7199
  var prop = /*#__PURE__*/_curry2(function prop(p, obj) {
7197
- return path$1([p], obj);
7200
+ return path$2([p], obj);
7198
7201
  });
7199
7202
  var prop$1 = prop;
7200
7203
 
@@ -9023,7 +9026,7 @@ var isEmpty$2 = isEmpty$1;
9023
9026
  * R.pathOr('N/A', ['a', 'b'], {c: {b: 2}}); //=> "N/A"
9024
9027
  */
9025
9028
  var pathOr = /*#__PURE__*/_curry3(function pathOr(d, p, obj) {
9026
- return defaultTo$1(d, path$1(p, obj));
9029
+ return defaultTo$1(d, path$2(p, obj));
9027
9030
  });
9028
9031
  var pathOr$1 = pathOr;
9029
9032
 
@@ -57047,10 +57050,14 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
57047
57050
  _ref.collection;
57048
57051
  var _ref$systemPrompt = _ref.systemPrompt,
57049
57052
  systemPrompt = _ref$systemPrompt === void 0 ? '' : _ref$systemPrompt,
57053
+ _ref$contextChangePro = _ref.contextChangePrompt,
57054
+ contextChangePrompt = _ref$contextChangePro === void 0 ? '' : _ref$contextChangePro,
57050
57055
  _ref$contextMessagesC = _ref.contextMessagesCount,
57051
57056
  contextMessagesCount = _ref$contextMessagesC === void 0 ? 5 : _ref$contextMessagesC,
57057
+ _ref$contextTopMessag = _ref.contextTopMessagesCount,
57058
+ contextTopMessagesCount = _ref$contextTopMessag === void 0 ? 10 : _ref$contextTopMessag,
57052
57059
  _ref$contextChunks = _ref.contextChunks,
57053
- contextChunks = _ref$contextChunks === void 0 ? 10 : _ref$contextChunks,
57060
+ contextChunks = _ref$contextChunks === void 0 ? 30 : _ref$contextChunks,
57054
57061
  mihelpAgentRef = _ref.mihelpAgentRef;
57055
57062
  var _useState = React.useState(false),
57056
57063
  _useState2 = _slicedToArray(_useState, 2),
@@ -57410,7 +57417,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
57410
57417
  behavior: 'smooth'
57411
57418
  });
57412
57419
  };
57413
- var getSystemPrompt = function getSystemPrompt() {
57420
+ var getSystemPrompt = function getSystemPrompt(prompt) {
57414
57421
  var context = {};
57415
57422
  try {
57416
57423
  if (storage$1.appContext) {
@@ -57419,7 +57426,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
57419
57426
  } catch (e) {
57420
57427
  console.log('App context error');
57421
57428
  }
57422
- return frontEndUtils.string.substitute(systemPrompt, {
57429
+ return frontEndUtils.string.substitute(prompt, {
57423
57430
  appContext: JSON.stringify(context)
57424
57431
  });
57425
57432
  };
@@ -57427,7 +57434,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
57427
57434
  var messages = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
57428
57435
  return messages.map(function (m) {
57429
57436
  return _objectSpread2(_objectSpread2({}, m), {}, {
57430
- content: purify$2.sanitize(m === null || m === void 0 ? void 0 : m.content)
57437
+ content: (m === null || m === void 0 ? void 0 : m.role) === 'system' ? m === null || m === void 0 ? void 0 : m.content : purify$2.sanitize(m === null || m === void 0 ? void 0 : m.content)
57431
57438
  });
57432
57439
  });
57433
57440
  };
@@ -57458,20 +57465,32 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
57458
57465
  if (!newMessages.find(function (m) {
57459
57466
  return (m === null || m === void 0 ? void 0 : m.role) === 'system';
57460
57467
  })) {
57468
+ if (contextChangePrompt) {
57469
+ newMessages.unshift({
57470
+ role: 'system',
57471
+ content: getSystemPrompt(contextChangePrompt)
57472
+ });
57473
+ }
57461
57474
  newMessages.unshift({
57462
57475
  role: 'system',
57463
- content: getSystemPrompt()
57476
+ content: getSystemPrompt(systemPrompt)
57464
57477
  });
57465
57478
  }
57466
- if (!isEmpty$2(storage$1.appContext)) {
57479
+ if (storage$1.appContext) {
57467
57480
  setCurrentContext(storage$1.appContext);
57468
57481
  }
57469
57482
  } else if (!equals$1(currentContext, storage$1.appContext) || lastSentFromApp !== currentAppName) {
57470
57483
  setCurrentContext(storage$1.appContext);
57471
57484
  newMessages.splice(newMessages.length - 1, 0, {
57472
57485
  role: 'system',
57473
- content: getSystemPrompt()
57486
+ content: getSystemPrompt(systemPrompt)
57474
57487
  });
57488
+ if (contextChangePrompt) {
57489
+ newMessages.splice(newMessages.length - 1, 0, {
57490
+ role: 'system',
57491
+ content: getSystemPrompt(contextChangePrompt)
57492
+ });
57493
+ }
57475
57494
  }
57476
57495
  }
57477
57496
  messagesWithOutId = newMessages.map(function (m) {
@@ -57486,6 +57505,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
57486
57505
  last_n: contextMessagesCount,
57487
57506
  app_name: currentAppName,
57488
57507
  k: contextChunks,
57508
+ top_n: contextTopMessagesCount,
57489
57509
  user_email: storage$1.userEmail
57490
57510
  };
57491
57511
  endpoint = (_storage$getLocalItem = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem === void 0 ? void 0 : (_storage$getLocalItem2 = _storage$getLocalItem.endpoints) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.mihelpChat;
@@ -69019,7 +69039,7 @@ var SCROLL = {
69019
69039
  var NO_SCROLL = {};
69020
69040
  var defaultSystemPrompt = 'Format all of the subsequent AI responses in valid HTML5, without markdown code blocks or any additional formatting, ensuring that the response consists only of raw HTML tags. Format your response in this structure:<html> <p> Your answer here </p> </html>';
69021
69041
  var AppFrame = function AppFrame(props) {
69022
- var _props$mihelpAgentPro, _props$mihelpAgentPro2, _props$mihelpAgentPro3, _props$mihelpAgentPro4, _props$mihelpAgentPro5, _props$mihelpAgentPro6;
69042
+ var _props$mihelpAgentPro, _props$mihelpAgentPro2, _props$mihelpAgentPro3, _props$mihelpAgentPro4, _props$mihelpAgentPro5, _props$mihelpAgentPro6, _props$mihelpAgentPro7, _props$mihelpAgentPro8;
69023
69043
  // Check if the child AppBar is mounted
69024
69044
  var _useState = React.useState(false),
69025
69045
  _useState2 = _slicedToArray(_useState, 2),
@@ -69154,9 +69174,11 @@ var AppFrame = function AppFrame(props) {
69154
69174
  quickReplies: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro = props.mihelpAgentProps) === null || _props$mihelpAgentPro === void 0 ? void 0 : _props$mihelpAgentPro.quickReplies,
69155
69175
  collection: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro2 = props.mihelpAgentProps) === null || _props$mihelpAgentPro2 === void 0 ? void 0 : _props$mihelpAgentPro2.collection,
69156
69176
  systemPrompt: (props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro3 = props.mihelpAgentProps) === null || _props$mihelpAgentPro3 === void 0 ? void 0 : _props$mihelpAgentPro3.systemPrompt) || defaultSystemPrompt,
69157
- contextMessagesCount: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro4 = props.mihelpAgentProps) === null || _props$mihelpAgentPro4 === void 0 ? void 0 : _props$mihelpAgentPro4.contextMessagesCount,
69158
- contextChunks: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro5 = props.mihelpAgentProps) === null || _props$mihelpAgentPro5 === void 0 ? void 0 : _props$mihelpAgentPro5.contextChunksCount,
69159
- mihelpAgentRef: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro6 = props.mihelpAgentProps) === null || _props$mihelpAgentPro6 === void 0 ? void 0 : _props$mihelpAgentPro6.mihelpAgentRef
69177
+ contextChangePrompt: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro4 = props.mihelpAgentProps) === null || _props$mihelpAgentPro4 === void 0 ? void 0 : _props$mihelpAgentPro4.contextChangePrompt,
69178
+ contextMessagesCount: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro5 = props.mihelpAgentProps) === null || _props$mihelpAgentPro5 === void 0 ? void 0 : _props$mihelpAgentPro5.contextMessagesCount,
69179
+ contextTopMessagesCount: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro6 = props.mihelpAgentProps) === null || _props$mihelpAgentPro6 === void 0 ? void 0 : _props$mihelpAgentPro6.contextTopMessagesCount,
69180
+ contextChunks: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro7 = props.mihelpAgentProps) === null || _props$mihelpAgentPro7 === void 0 ? void 0 : _props$mihelpAgentPro7.contextChunksCount,
69181
+ mihelpAgentRef: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro8 = props.mihelpAgentProps) === null || _props$mihelpAgentPro8 === void 0 ? void 0 : _props$mihelpAgentPro8.mihelpAgentRef
69160
69182
  }))))));
69161
69183
  };
69162
69184
  AppFrame.defaultProps = {
@@ -82762,10 +82784,10 @@ var sharedStore = createCommonjsModule(function (module) {
82762
82784
  var SHARED = '__core-js_shared__';
82763
82785
  var store = module.exports = globalThis_1[SHARED] || defineGlobalProperty(SHARED, {});
82764
82786
  (store.versions || (store.versions = [])).push({
82765
- version: '3.42.0',
82787
+ version: '3.44.0',
82766
82788
  mode: 'global',
82767
82789
  copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
82768
- license: 'https://github.com/zloirock/core-js/blob/v3.42.0/LICENSE',
82790
+ license: 'https://github.com/zloirock/core-js/blob/v3.44.0/LICENSE',
82769
82791
  source: 'https://github.com/zloirock/core-js'
82770
82792
  });
82771
82793
  });
@@ -82793,7 +82815,7 @@ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
82793
82815
 
82794
82816
  var id$1 = 0;
82795
82817
  var postfix = Math.random();
82796
- var toString = functionUncurryThis(1.0.toString);
82818
+ var toString = functionUncurryThis(1.1.toString);
82797
82819
  var uid = function (key) {
82798
82820
  return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id$1 + postfix, 36);
82799
82821
  };
@@ -83337,6 +83359,8 @@ var environment = function () {
83337
83359
 
83338
83360
  var environmentIsNode = environment === 'NODE';
83339
83361
 
83362
+ var path = globalThis_1;
83363
+
83340
83364
  var functionUncurryThisAccessor = function (object, key, method) {
83341
83365
  try {
83342
83366
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
@@ -84105,6 +84129,7 @@ _export({
84105
84129
  }, {
84106
84130
  Promise: PromiseConstructor
84107
84131
  });
84132
+ PromiseWrapper = path.Promise;
84108
84133
  setToStringTag(PromiseConstructor, PROMISE, false);
84109
84134
  setSpecies(PROMISE);
84110
84135
 
@@ -84165,7 +84190,7 @@ var iterate = function (iterable, unboundFunction, options) {
84165
84190
  var fn = functionBindContext(unboundFunction, that);
84166
84191
  var iterator, iterFn, index, length, result, next, step;
84167
84192
  var stop = function (condition) {
84168
- if (iterator) iteratorClose(iterator, 'normal', condition);
84193
+ if (iterator) iteratorClose(iterator, 'normal');
84169
84194
  return new Result(true, condition);
84170
84195
  };
84171
84196
  var callFn = function (value) {
@@ -84795,6 +84820,53 @@ var advanceStringIndex = function (S, index, unicode) {
84795
84820
  return index + (unicode ? charAt$1(S, index).length : 1);
84796
84821
  };
84797
84822
 
84823
+ // babel-minify and Closure Compiler transpiles RegExp('.', 'd') -> /./d and it causes SyntaxError
84824
+ var RegExp$1 = globalThis_1.RegExp;
84825
+ var FLAGS_GETTER_IS_CORRECT = !fails(function () {
84826
+ var INDICES_SUPPORT = true;
84827
+ try {
84828
+ RegExp$1('.', 'd');
84829
+ } catch (error) {
84830
+ INDICES_SUPPORT = false;
84831
+ }
84832
+ var O = {};
84833
+ // modern V8 bug
84834
+ var calls = '';
84835
+ var expected = INDICES_SUPPORT ? 'dgimsy' : 'gimsy';
84836
+ var addGetter = function (key, chr) {
84837
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
84838
+ Object.defineProperty(O, key, {
84839
+ get: function () {
84840
+ calls += chr;
84841
+ return true;
84842
+ }
84843
+ });
84844
+ };
84845
+ var pairs = {
84846
+ dotAll: 's',
84847
+ global: 'g',
84848
+ ignoreCase: 'i',
84849
+ multiline: 'm',
84850
+ sticky: 'y'
84851
+ };
84852
+ if (INDICES_SUPPORT) pairs.hasIndices = 'd';
84853
+ for (var key in pairs) addGetter(key, pairs[key]);
84854
+
84855
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
84856
+ var result = Object.getOwnPropertyDescriptor(RegExp$1.prototype, 'flags').get.call(O);
84857
+ return result !== expected || calls !== expected;
84858
+ });
84859
+ var regexpFlagsDetection = {
84860
+ correct: FLAGS_GETTER_IS_CORRECT
84861
+ };
84862
+
84863
+ var RegExpPrototype$1 = RegExp.prototype;
84864
+ var regexpGetFlags = regexpFlagsDetection.correct ? function (it) {
84865
+ return it.flags;
84866
+ } : function (it) {
84867
+ return !regexpFlagsDetection.correct && objectIsPrototypeOf(RegExpPrototype$1, it) && !hasOwnProperty_1(it, 'flags') ? functionCall(regexpFlags, it) : it.flags;
84868
+ };
84869
+
84798
84870
  var $TypeError$2 = TypeError;
84799
84871
 
84800
84872
  // `RegExpExec` abstract operation
@@ -84810,6 +84882,8 @@ var regexpExecAbstract = function (R, S) {
84810
84882
  throw new $TypeError$2('RegExp#exec called on incompatible receiver');
84811
84883
  };
84812
84884
 
84885
+ var stringIndexOf$2 = functionUncurryThis(''.indexOf);
84886
+
84813
84887
  // @@match logic
84814
84888
  fixRegexpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
84815
84889
  return [
@@ -84827,8 +84901,9 @@ fixRegexpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNa
84827
84901
  var S = toString_1(string);
84828
84902
  var res = maybeCallNative(nativeMatch, rx, S);
84829
84903
  if (res.done) return res.value;
84830
- if (!rx.global) return regexpExecAbstract(rx, S);
84831
- var fullUnicode = rx.unicode;
84904
+ var flags = toString_1(regexpGetFlags(rx));
84905
+ if (stringIndexOf$2(flags, 'g') === -1) return regexpExecAbstract(rx, S);
84906
+ var fullUnicode = stringIndexOf$2(flags, 'u') !== -1;
84832
84907
  rx.lastIndex = 0;
84833
84908
  var A = [];
84834
84909
  var n = 0;
@@ -84951,10 +85026,11 @@ fixRegexpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNa
84951
85026
  }
84952
85027
  var functionalReplace = isCallable(replaceValue);
84953
85028
  if (!functionalReplace) replaceValue = toString_1(replaceValue);
84954
- var global = rx.global;
85029
+ var flags = toString_1(regexpGetFlags(rx));
85030
+ var global = stringIndexOf$1(flags, 'g') !== -1;
84955
85031
  var fullUnicode;
84956
85032
  if (global) {
84957
- fullUnicode = rx.unicode;
85033
+ fullUnicode = stringIndexOf$1(flags, 'u') !== -1;
84958
85034
  rx.lastIndex = 0;
84959
85035
  }
84960
85036
  var results = [];
@@ -86638,12 +86714,6 @@ var O,
86638
86714
  }(l),
86639
86715
  N = ((O = {})[_.MOVE_TO] = 2, O[_.LINE_TO] = 2, O[_.HORIZ_LINE_TO] = 1, O[_.VERT_LINE_TO] = 1, O[_.CLOSE_PATH] = 0, O[_.QUAD_TO] = 4, O[_.SMOOTH_QUAD_TO] = 2, O[_.CURVE_TO] = 6, O[_.SMOOTH_CURVE_TO] = 4, O[_.ARC] = 7, O);
86640
86716
 
86641
- var RegExpPrototype$1 = RegExp.prototype;
86642
- var regexpGetFlags = function (R) {
86643
- var flags = R.flags;
86644
- return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwnProperty_1(R, 'flags') && objectIsPrototypeOf(RegExpPrototype$1, R) ? functionCall(regexpFlags, R) : flags;
86645
- };
86646
-
86647
86717
  var PROPER_FUNCTION_NAME = functionName.PROPER;
86648
86718
 
86649
86719