strapi-plugin-faqchatbot 1.0.5 → 1.0.9

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.
@@ -9314,7 +9314,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
9314
9314
  var ys = arrObjKeys(obj, inspect2);
9315
9315
  var isPlainObject2 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
9316
9316
  var protoTag = obj instanceof Object ? "" : "null prototype";
9317
- var stringTag2 = !isPlainObject2 && toStringTag$1 && Object(obj) === obj && toStringTag$1 in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
9317
+ var stringTag2 = !isPlainObject2 && toStringTag$1 && Object(obj) === obj && toStringTag$1 in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
9318
9318
  var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
9319
9319
  var tag = constructorTag + (stringTag2 || protoTag ? "[" + $join.call($concat$1.call([], stringTag2 || [], protoTag || []), ": ") + "] " : "");
9320
9320
  if (ys.length === 0) {
@@ -9339,25 +9339,25 @@ function canTrustToString(obj) {
9339
9339
  return !toStringTag$1 || !(typeof obj === "object" && (toStringTag$1 in obj || typeof obj[toStringTag$1] !== "undefined"));
9340
9340
  }
9341
9341
  function isArray$4(obj) {
9342
- return toStr$1(obj) === "[object Array]" && canTrustToString(obj);
9342
+ return toStr(obj) === "[object Array]" && canTrustToString(obj);
9343
9343
  }
9344
9344
  function isDate$2(obj) {
9345
- return toStr$1(obj) === "[object Date]" && canTrustToString(obj);
9345
+ return toStr(obj) === "[object Date]" && canTrustToString(obj);
9346
9346
  }
9347
9347
  function isRegExp$2(obj) {
9348
- return toStr$1(obj) === "[object RegExp]" && canTrustToString(obj);
9348
+ return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
9349
9349
  }
9350
9350
  function isError(obj) {
9351
- return toStr$1(obj) === "[object Error]" && canTrustToString(obj);
9351
+ return toStr(obj) === "[object Error]" && canTrustToString(obj);
9352
9352
  }
9353
9353
  function isString$1(obj) {
9354
- return toStr$1(obj) === "[object String]" && canTrustToString(obj);
9354
+ return toStr(obj) === "[object String]" && canTrustToString(obj);
9355
9355
  }
9356
9356
  function isNumber$1(obj) {
9357
- return toStr$1(obj) === "[object Number]" && canTrustToString(obj);
9357
+ return toStr(obj) === "[object Number]" && canTrustToString(obj);
9358
9358
  }
9359
9359
  function isBoolean$1(obj) {
9360
- return toStr$1(obj) === "[object Boolean]" && canTrustToString(obj);
9360
+ return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
9361
9361
  }
9362
9362
  function isSymbol(obj) {
9363
9363
  if (hasShammedSymbols) {
@@ -9393,7 +9393,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
9393
9393
  function has$5(obj, key) {
9394
9394
  return hasOwn$1.call(obj, key);
9395
9395
  }
9396
- function toStr$1(obj) {
9396
+ function toStr(obj) {
9397
9397
  return objectToString.call(obj);
9398
9398
  }
9399
9399
  function nameOf(f2) {
@@ -9702,7 +9702,7 @@ var syntax = SyntaxError;
9702
9702
  var uri = URIError;
9703
9703
  var abs$1 = Math.abs;
9704
9704
  var floor$1 = Math.floor;
9705
- var max$2 = Math.max;
9705
+ var max$1 = Math.max;
9706
9706
  var min$1 = Math.min;
9707
9707
  var pow$1 = Math.pow;
9708
9708
  var round$1 = Math.round;
@@ -9831,78 +9831,99 @@ function requireObject_getPrototypeOf() {
9831
9831
  Object_getPrototypeOf = $Object2.getPrototypeOf || null;
9832
9832
  return Object_getPrototypeOf;
9833
9833
  }
9834
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
9835
- var toStr = Object.prototype.toString;
9836
- var max$1 = Math.max;
9837
- var funcType = "[object Function]";
9838
- var concatty = function concatty2(a2, b2) {
9839
- var arr = [];
9840
- for (var i2 = 0; i2 < a2.length; i2 += 1) {
9841
- arr[i2] = a2[i2];
9842
- }
9843
- for (var j2 = 0; j2 < b2.length; j2 += 1) {
9844
- arr[j2 + a2.length] = b2[j2];
9845
- }
9846
- return arr;
9847
- };
9848
- var slicy = function slicy2(arrLike, offset) {
9849
- var arr = [];
9850
- for (var i2 = offset, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
9851
- arr[j2] = arrLike[i2];
9852
- }
9853
- return arr;
9854
- };
9855
- var joiny = function(arr, joiner) {
9856
- var str = "";
9857
- for (var i2 = 0; i2 < arr.length; i2 += 1) {
9858
- str += arr[i2];
9859
- if (i2 + 1 < arr.length) {
9860
- str += joiner;
9834
+ var implementation;
9835
+ var hasRequiredImplementation;
9836
+ function requireImplementation() {
9837
+ if (hasRequiredImplementation) return implementation;
9838
+ hasRequiredImplementation = 1;
9839
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
9840
+ var toStr2 = Object.prototype.toString;
9841
+ var max2 = Math.max;
9842
+ var funcType = "[object Function]";
9843
+ var concatty = function concatty2(a2, b2) {
9844
+ var arr = [];
9845
+ for (var i2 = 0; i2 < a2.length; i2 += 1) {
9846
+ arr[i2] = a2[i2];
9861
9847
  }
9862
- }
9863
- return str;
9864
- };
9865
- var implementation$1 = function bind(that) {
9866
- var target = this;
9867
- if (typeof target !== "function" || toStr.apply(target) !== funcType) {
9868
- throw new TypeError(ERROR_MESSAGE + target);
9869
- }
9870
- var args = slicy(arguments, 1);
9871
- var bound;
9872
- var binder = function() {
9873
- if (this instanceof bound) {
9874
- var result = target.apply(
9875
- this,
9876
- concatty(args, arguments)
9877
- );
9878
- if (Object(result) === result) {
9879
- return result;
9848
+ for (var j2 = 0; j2 < b2.length; j2 += 1) {
9849
+ arr[j2 + a2.length] = b2[j2];
9850
+ }
9851
+ return arr;
9852
+ };
9853
+ var slicy = function slicy2(arrLike, offset) {
9854
+ var arr = [];
9855
+ for (var i2 = offset, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
9856
+ arr[j2] = arrLike[i2];
9857
+ }
9858
+ return arr;
9859
+ };
9860
+ var joiny = function(arr, joiner) {
9861
+ var str = "";
9862
+ for (var i2 = 0; i2 < arr.length; i2 += 1) {
9863
+ str += arr[i2];
9864
+ if (i2 + 1 < arr.length) {
9865
+ str += joiner;
9880
9866
  }
9881
- return this;
9882
9867
  }
9883
- return target.apply(
9884
- that,
9885
- concatty(args, arguments)
9886
- );
9868
+ return str;
9887
9869
  };
9888
- var boundLength = max$1(0, target.length - args.length);
9889
- var boundArgs = [];
9890
- for (var i2 = 0; i2 < boundLength; i2++) {
9891
- boundArgs[i2] = "$" + i2;
9892
- }
9893
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
9894
- if (target.prototype) {
9895
- var Empty = function Empty2() {
9870
+ implementation = function bind2(that) {
9871
+ var target = this;
9872
+ if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
9873
+ throw new TypeError(ERROR_MESSAGE + target);
9874
+ }
9875
+ var args = slicy(arguments, 1);
9876
+ var bound;
9877
+ var binder = function() {
9878
+ if (this instanceof bound) {
9879
+ var result = target.apply(
9880
+ this,
9881
+ concatty(args, arguments)
9882
+ );
9883
+ if (Object(result) === result) {
9884
+ return result;
9885
+ }
9886
+ return this;
9887
+ }
9888
+ return target.apply(
9889
+ that,
9890
+ concatty(args, arguments)
9891
+ );
9896
9892
  };
9897
- Empty.prototype = target.prototype;
9898
- bound.prototype = new Empty();
9899
- Empty.prototype = null;
9900
- }
9901
- return bound;
9902
- };
9903
- var implementation = implementation$1;
9904
- var functionBind = Function.prototype.bind || implementation;
9905
- var functionCall = Function.prototype.call;
9893
+ var boundLength = max2(0, target.length - args.length);
9894
+ var boundArgs = [];
9895
+ for (var i2 = 0; i2 < boundLength; i2++) {
9896
+ boundArgs[i2] = "$" + i2;
9897
+ }
9898
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
9899
+ if (target.prototype) {
9900
+ var Empty = function Empty2() {
9901
+ };
9902
+ Empty.prototype = target.prototype;
9903
+ bound.prototype = new Empty();
9904
+ Empty.prototype = null;
9905
+ }
9906
+ return bound;
9907
+ };
9908
+ return implementation;
9909
+ }
9910
+ var functionBind;
9911
+ var hasRequiredFunctionBind;
9912
+ function requireFunctionBind() {
9913
+ if (hasRequiredFunctionBind) return functionBind;
9914
+ hasRequiredFunctionBind = 1;
9915
+ var implementation2 = requireImplementation();
9916
+ functionBind = Function.prototype.bind || implementation2;
9917
+ return functionBind;
9918
+ }
9919
+ var functionCall;
9920
+ var hasRequiredFunctionCall;
9921
+ function requireFunctionCall() {
9922
+ if (hasRequiredFunctionCall) return functionCall;
9923
+ hasRequiredFunctionCall = 1;
9924
+ functionCall = Function.prototype.call;
9925
+ return functionCall;
9926
+ }
9906
9927
  var functionApply;
9907
9928
  var hasRequiredFunctionApply;
9908
9929
  function requireFunctionApply() {
@@ -9912,14 +9933,14 @@ function requireFunctionApply() {
9912
9933
  return functionApply;
9913
9934
  }
9914
9935
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
9915
- var bind$3 = functionBind;
9936
+ var bind$3 = requireFunctionBind();
9916
9937
  var $apply$1 = requireFunctionApply();
9917
- var $call$2 = functionCall;
9938
+ var $call$2 = requireFunctionCall();
9918
9939
  var $reflectApply = reflectApply;
9919
9940
  var actualApply = $reflectApply || bind$3.call($call$2, $apply$1);
9920
- var bind$2 = functionBind;
9941
+ var bind$2 = requireFunctionBind();
9921
9942
  var $TypeError$4 = type;
9922
- var $call$1 = functionCall;
9943
+ var $call$1 = requireFunctionCall();
9923
9944
  var $actualApply = actualApply;
9924
9945
  var callBindApplyHelpers = function callBindBasic(args) {
9925
9946
  if (args.length < 1 || typeof args[0] !== "function") {
@@ -9985,8 +10006,8 @@ function requireHasown() {
9985
10006
  hasRequiredHasown = 1;
9986
10007
  var call = Function.prototype.call;
9987
10008
  var $hasOwn = Object.prototype.hasOwnProperty;
9988
- var bind3 = functionBind;
9989
- hasown = bind3.call(call, $hasOwn);
10009
+ var bind2 = requireFunctionBind();
10010
+ hasown = bind2.call(call, $hasOwn);
9990
10011
  return hasown;
9991
10012
  }
9992
10013
  var undefined$1;
@@ -10000,7 +10021,7 @@ var $TypeError$3 = type;
10000
10021
  var $URIError = uri;
10001
10022
  var abs = abs$1;
10002
10023
  var floor = floor$1;
10003
- var max = max$2;
10024
+ var max = max$1;
10004
10025
  var min = min$1;
10005
10026
  var pow = pow$1;
10006
10027
  var round = round$1;
@@ -10034,7 +10055,7 @@ var getProto = requireGetProto();
10034
10055
  var $ObjectGPO = requireObject_getPrototypeOf();
10035
10056
  var $ReflectGPO = requireReflect_getPrototypeOf();
10036
10057
  var $apply = requireFunctionApply();
10037
- var $call = functionCall;
10058
+ var $call = requireFunctionCall();
10038
10059
  var needsEval = {};
10039
10060
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
10040
10061
  var INTRINSICS = {
@@ -10205,7 +10226,7 @@ var LEGACY_ALIASES = {
10205
10226
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
10206
10227
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
10207
10228
  };
10208
- var bind$1 = functionBind;
10229
+ var bind$1 = requireFunctionBind();
10209
10230
  var hasOwn = requireHasown();
10210
10231
  var $concat = bind$1.call($call, Array.prototype.concat);
10211
10232
  var $spliceApply = bind$1.call($apply, Array.prototype.splice);
@@ -14536,7 +14557,7 @@ const admin = adminApi.enhanceEndpoints({
14536
14557
  overrideExisting: false
14537
14558
  });
14538
14559
  const { useInitQuery, useTelemetryPropertiesQuery, useInformationQuery, useProjectSettingsQuery, useUpdateProjectSettingsMutation, useGetPluginsQuery, useGetLicenseLimitsQuery, useGetLicenseTrialTimeLeftQuery, useGetGuidedTourMetaQuery } = admin;
14539
- function bind2(fn2, thisArg) {
14560
+ function bind(fn2, thisArg) {
14540
14561
  return function wrap() {
14541
14562
  return fn2.apply(thisArg, arguments);
14542
14563
  };
@@ -14673,7 +14694,7 @@ function merge2() {
14673
14694
  const extend = (a2, b2, thisArg, { allOwnKeys } = {}) => {
14674
14695
  forEach$1(b2, (val, key) => {
14675
14696
  if (thisArg && isFunction$1(val)) {
14676
- a2[key] = bind2(val, thisArg);
14697
+ a2[key] = bind(val, thisArg);
14677
14698
  } else {
14678
14699
  a2[key] = val;
14679
14700
  }
@@ -16953,7 +16974,7 @@ Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
16953
16974
  });
16954
16975
  function createInstance(defaultConfig) {
16955
16976
  const context = new Axios$1(defaultConfig);
16956
- const instance = bind2(Axios$1.prototype.request, context);
16977
+ const instance = bind(Axios$1.prototype.request, context);
16957
16978
  utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
16958
16979
  utils$1.extend(instance, context, null, { allOwnKeys: true });
16959
16980
  instance.create = function create2(instanceConfig) {
@@ -25012,6 +25033,7 @@ const ChatbotPreview = () => {
25012
25033
  const decoder = new TextDecoder();
25013
25034
  let botMessage = "";
25014
25035
  setMessages((prev) => [...prev, { text: "", isUser: false }]);
25036
+ let isCardsEvent = false;
25015
25037
  while (true) {
25016
25038
  const { done, value } = await reader.read();
25017
25039
  if (done) break;
@@ -25019,7 +25041,18 @@ const ChatbotPreview = () => {
25019
25041
  const lines = chunk.split("\n");
25020
25042
  for (let rawLine of lines) {
25021
25043
  const line = rawLine.replace(/\r/g, "");
25022
- if (line.includes("[DONE]")) return;
25044
+ if (!line) continue;
25045
+ if (line.startsWith("event: cards")) {
25046
+ isCardsEvent = true;
25047
+ continue;
25048
+ }
25049
+ if (isCardsEvent && line.startsWith("data: ")) {
25050
+ isCardsEvent = false;
25051
+ continue;
25052
+ }
25053
+ if (line.includes("[DONE]")) {
25054
+ return;
25055
+ }
25023
25056
  if (line.startsWith("data: ")) {
25024
25057
  const token = line.replace("data: ", "");
25025
25058
  botMessage += token;
@@ -25635,7 +25668,12 @@ const HomePage = () => {
25635
25668
  );
25636
25669
  setActiveCollections(initialActive);
25637
25670
  } catch (err) {
25638
- toggleNotification({ type: "warning", message: "Error loading configuration." });
25671
+ console.log("SAVE ERROR:", err);
25672
+ const message = err?.response?.data?.error || err?.response?.data?.message || "Invalid settings. Please check Base Domain.";
25673
+ toggleNotification({
25674
+ type: "warning",
25675
+ message
25676
+ });
25639
25677
  } finally {
25640
25678
  setIsLoading(false);
25641
25679
  }
@@ -25644,9 +25682,9 @@ const HomePage = () => {
25644
25682
  init();
25645
25683
  }, [get2]);
25646
25684
  const handleUpdateCardStyle = (uid, style) => {
25647
- setActiveCollections((prev) => prev.map(
25648
- (c2) => c2.uid === uid ? { ...c2, cardStyle: style } : c2
25649
- ));
25685
+ setActiveCollections(
25686
+ (prev) => prev.map((c2) => c2.uid === uid ? { ...c2, cardStyle: style } : c2)
25687
+ );
25650
25688
  };
25651
25689
  const handleRemoveCollection = (uid) => {
25652
25690
  setActiveCollections((prev) => prev.filter((c2) => c2.uid !== uid));
@@ -25713,21 +25751,33 @@ const HomePage = () => {
25713
25751
  setIsSaving(false);
25714
25752
  }
25715
25753
  };
25716
- if (isLoading) return /* @__PURE__ */ jsx(Flex, { justifyContent: "center", height: "100vh", children: /* @__PURE__ */ jsx(Loader, {}) });
25754
+ if (isLoading)
25755
+ return /* @__PURE__ */ jsx(Flex, { justifyContent: "center", height: "100vh", children: /* @__PURE__ */ jsx(Loader, {}) });
25717
25756
  return /* @__PURE__ */ jsxs(Main, { children: [
25718
- /* @__PURE__ */ jsx(Box, { background: "neutral100", position: "sticky", top: 0, zIndex: 2, padding: 8, paddingBottom: 6, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", children: [
25719
- /* @__PURE__ */ jsx(Typography, { variant: "beta", fontWeight: "bold", children: "Chatbot Configuration" }),
25720
- /* @__PURE__ */ jsx(
25721
- Button,
25722
- {
25723
- onClick: save,
25724
- loading: isSaving,
25725
- startIcon: /* @__PURE__ */ jsx(Check, {}),
25726
- disabled: !openaiKey || openaiKey.trim() === "",
25727
- children: "Save Settings"
25728
- }
25729
- )
25730
- ] }) }),
25757
+ /* @__PURE__ */ jsx(
25758
+ Box,
25759
+ {
25760
+ background: "neutral100",
25761
+ position: "sticky",
25762
+ top: 0,
25763
+ zIndex: 2,
25764
+ padding: 8,
25765
+ paddingBottom: 6,
25766
+ children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", children: [
25767
+ /* @__PURE__ */ jsx(Typography, { variant: "beta", fontWeight: "bold", children: "Chatbot Configuration" }),
25768
+ /* @__PURE__ */ jsx(
25769
+ Button,
25770
+ {
25771
+ onClick: save,
25772
+ loading: isSaving,
25773
+ startIcon: /* @__PURE__ */ jsx(Check, {}),
25774
+ disabled: !openaiKey || openaiKey.trim() === "",
25775
+ children: "Save Settings"
25776
+ }
25777
+ )
25778
+ ] })
25779
+ }
25780
+ ),
25731
25781
  /* @__PURE__ */ jsxs(Box, { paddingLeft: 8, paddingTop: 2, paddingRight: 8, background: "neutral100", children: [
25732
25782
  /* @__PURE__ */ jsx(
25733
25783
  ConfigSettings,
@@ -25745,16 +25795,26 @@ const HomePage = () => {
25745
25795
  collections: activeCollections,
25746
25796
  cardOptions,
25747
25797
  onToggleField: (uid, fName) => {
25748
- setActiveCollections((prev) => prev.map((c2) => c2.uid !== uid ? c2 : {
25749
- ...c2,
25750
- fields: c2.fields.map((f2) => f2.name === fName ? { ...f2, enabled: !f2.enabled } : f2)
25751
- }));
25798
+ setActiveCollections(
25799
+ (prev) => prev.map(
25800
+ (c2) => c2.uid !== uid ? c2 : {
25801
+ ...c2,
25802
+ fields: c2.fields.map(
25803
+ (f2) => f2.name === fName ? { ...f2, enabled: !f2.enabled } : f2
25804
+ )
25805
+ }
25806
+ )
25807
+ );
25752
25808
  },
25753
25809
  onToggleAll: (uid, val) => {
25754
- setActiveCollections((prev) => prev.map((c2) => c2.uid !== uid ? c2 : {
25755
- ...c2,
25756
- fields: c2.fields.map((f2) => ({ ...f2, enabled: val }))
25757
- }));
25810
+ setActiveCollections(
25811
+ (prev) => prev.map(
25812
+ (c2) => c2.uid !== uid ? c2 : {
25813
+ ...c2,
25814
+ fields: c2.fields.map((f2) => ({ ...f2, enabled: val }))
25815
+ }
25816
+ )
25817
+ );
25758
25818
  },
25759
25819
  onRemoveCollection: handleRemoveCollection,
25760
25820
  onUpdateCardStyle: handleUpdateCardStyle,