@inploi/plugin-chatbot 3.16.0 → 3.16.1

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.
@@ -1,4 +1,4 @@
1
- import { g as getHeadOrThrow, i as invariant, A as AbortedError, N, a as getFlowSubmissionsPayload, _, k as kbToReadableSize, h, b as _$1, p, F, o as o$1, c as clsx, y, s as store, d as a$2, e as debounce$1, f as k, j as parse, l as picklist, m as isSubmissionOfType, C as Cn, n as parseAsync, V as ValiError, q as object, t as transform, r as maxLength, u as minLength, v as record, w as boolean, x as string, z as email, B as url, D as regex, E as cva, G as ERROR_MESSAGES } from "./index-063bd7e8.js";
1
+ import { i as isString$1, g as getHeadOrThrow, a as invariant, A as AbortedError, N, b as getFlowSubmissionsPayload, _, k as kbToReadableSize, h, c as _$1, p, F, o as o$1, d as clsx, y, s as store, e as a$2, f as debounce$1, j as k, l as parse, m as picklist, n as isSubmissionOfType, C as Cn, q as parseAsync, V as ValiError, r as object, t as transform, u as maxLength, v as minLength, w as record, x as boolean, z as string, B as email, D as url, E as regex, G as cva, H as ERROR_MESSAGES } from "./index-dfe3ef24.js";
2
2
  import "@inploi/sdk";
3
3
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
@@ -459,7 +459,6 @@ function get$1(object2, path, defaultValue) {
459
459
  }
460
460
  var get_1 = get$1;
461
461
  const get$2 = /* @__PURE__ */ getDefaultExportFromCjs(get_1);
462
- const isString$1 = (value) => typeof value === "string";
463
462
  const isIfBlockConditionMet = (ifBlock, submissions) => {
464
463
  const [firstSegment, ...rest] = ifBlock.data.compareKey.split(".");
465
464
  if (!firstSegment)
@@ -1141,8 +1140,8 @@ async function interpretEndFlowNode({
1141
1140
  const interpolateString = (str, context) => {
1142
1141
  const regex2 = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g;
1143
1142
  return str.replace(regex2, (_2, key, defaultValue = "") => {
1144
- key = key.trim();
1145
- const submission = context == null ? void 0 : context[key];
1143
+ const [firstSegment, ...rest] = key.trim().split(".");
1144
+ const submission = context == null ? void 0 : context[firstSegment];
1146
1145
  if (!submission)
1147
1146
  return defaultValue;
1148
1147
  switch (submission.type) {
@@ -1159,11 +1158,28 @@ const interpolateString = (str, context) => {
1159
1158
  if (!submission.value)
1160
1159
  return defaultValue;
1161
1160
  return submission.value.toString();
1162
- case "integration":
1163
- return JSON.stringify(submission.value);
1164
- default:
1165
- return defaultValue;
1161
+ case "integration": {
1162
+ if (typeof submission.value !== "object")
1163
+ break;
1164
+ if (Array.isArray(submission.value))
1165
+ break;
1166
+ const value = get$2(submission.value, rest.join("."));
1167
+ switch (typeof value) {
1168
+ case "boolean":
1169
+ return value === true ? "true" : "false";
1170
+ case "string":
1171
+ return value;
1172
+ case "number":
1173
+ return value.toString();
1174
+ case "object":
1175
+ if (Array.isArray(value) && value.every(isString$1)) {
1176
+ return value.join(", ");
1177
+ }
1178
+ }
1179
+ break;
1180
+ }
1166
1181
  }
1182
+ return defaultValue;
1167
1183
  });
1168
1184
  };
1169
1185
  function debounce(func, wait, immediate) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-a8a873bc.cjs");
3
+ const index = require("./index-154bf9a3.cjs");
4
4
  require("@inploi/sdk");
5
5
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
6
6
  function getDefaultExportFromCjs(x) {
@@ -461,7 +461,6 @@ function get$1(object, path, defaultValue) {
461
461
  }
462
462
  var get_1 = get$1;
463
463
  const get$2 = /* @__PURE__ */ getDefaultExportFromCjs(get_1);
464
- const isString$1 = (value) => typeof value === "string";
465
464
  const isIfBlockConditionMet = (ifBlock, submissions) => {
466
465
  const [firstSegment, ...rest] = ifBlock.data.compareKey.split(".");
467
466
  if (!firstSegment)
@@ -524,7 +523,7 @@ const isIfBlockConditionMet = (ifBlock, submissions) => {
524
523
  }
525
524
  });
526
525
  case "object":
527
- if (Array.isArray(value) && value.every(isString$1)) {
526
+ if (Array.isArray(value) && value.every(index.isString)) {
528
527
  return isIfBlockConditionMet(newIfBlock, {
529
528
  ["_temp"]: {
530
529
  value,
@@ -1143,8 +1142,8 @@ async function interpretEndFlowNode({
1143
1142
  const interpolateString = (str, context) => {
1144
1143
  const regex = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g;
1145
1144
  return str.replace(regex, (_, key, defaultValue = "") => {
1146
- key = key.trim();
1147
- const submission = context == null ? void 0 : context[key];
1145
+ const [firstSegment, ...rest] = key.trim().split(".");
1146
+ const submission = context == null ? void 0 : context[firstSegment];
1148
1147
  if (!submission)
1149
1148
  return defaultValue;
1150
1149
  switch (submission.type) {
@@ -1161,11 +1160,28 @@ const interpolateString = (str, context) => {
1161
1160
  if (!submission.value)
1162
1161
  return defaultValue;
1163
1162
  return submission.value.toString();
1164
- case "integration":
1165
- return JSON.stringify(submission.value);
1166
- default:
1167
- return defaultValue;
1163
+ case "integration": {
1164
+ if (typeof submission.value !== "object")
1165
+ break;
1166
+ if (Array.isArray(submission.value))
1167
+ break;
1168
+ const value = get$2(submission.value, rest.join("."));
1169
+ switch (typeof value) {
1170
+ case "boolean":
1171
+ return value === true ? "true" : "false";
1172
+ case "string":
1173
+ return value;
1174
+ case "number":
1175
+ return value.toString();
1176
+ case "object":
1177
+ if (Array.isArray(value) && value.every(index.isString)) {
1178
+ return value.join(", ");
1179
+ }
1180
+ }
1181
+ break;
1182
+ }
1168
1183
  }
1184
+ return defaultValue;
1169
1185
  });
1170
1186
  };
1171
1187
  function debounce(func, wait, immediate) {
@@ -186,3 +186,4 @@ export declare class AbortedError extends Error {
186
186
  constructor();
187
187
  }
188
188
  export declare function debounce<TFn extends (...params: any[]) => void>(func: TFn, timeout?: number): TFn;
189
+ export declare const isString: (value: unknown) => value is string;
@@ -4280,6 +4280,7 @@ function debounce(func, timeout = 300) {
4280
4280
  }, timeout);
4281
4281
  };
4282
4282
  }
4283
+ const isString = (value) => typeof value === "string";
4283
4284
  const db = typeof window === "undefined" ? void 0 : openDB("inploi-chatbot", 2, {
4284
4285
  upgrade(db2) {
4285
4286
  try {
@@ -4733,7 +4734,7 @@ const StatusBar = ({
4733
4734
  })
4734
4735
  });
4735
4736
  };
4736
- const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-5774cb2a.cjs")).then((module2) => module2.ChatbotBody));
4737
+ const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-9bce9c3f.cjs")).then((module2) => module2.ChatbotBody));
4737
4738
  const chatbotContentClass = cva("selection:bg-accent-4 selection:text-accent-12 fixed bottom-2 left-2 right-2 isolate mx-auto max-h-full max-w-[450px] focus:outline-none", {
4738
4739
  variants: {
4739
4740
  view: {
@@ -5205,6 +5206,7 @@ exports.getFlowSubmissionsPayload = getFlowSubmissionsPayload;
5205
5206
  exports.getHeadOrThrow = getHeadOrThrow;
5206
5207
  exports.h = h$1;
5207
5208
  exports.invariant = invariant;
5209
+ exports.isString = isString;
5208
5210
  exports.isSubmissionOfType = isSubmissionOfType;
5209
5211
  exports.k = k$3;
5210
5212
  exports.kbToReadableSize = kbToReadableSize;
@@ -4279,6 +4279,7 @@ function debounce(func, timeout = 300) {
4279
4279
  }, timeout);
4280
4280
  };
4281
4281
  }
4282
+ const isString = (value) => typeof value === "string";
4282
4283
  const db = typeof window === "undefined" ? void 0 : openDB("inploi-chatbot", 2, {
4283
4284
  upgrade(db2) {
4284
4285
  try {
@@ -4732,7 +4733,7 @@ const StatusBar = ({
4732
4733
  })
4733
4734
  });
4734
4735
  };
4735
- const ChatbotBody = M(() => import("./chatbot-body-1f7580cd.js").then((module) => module.ChatbotBody));
4736
+ const ChatbotBody = M(() => import("./chatbot-body-59fab6f6.js").then((module) => module.ChatbotBody));
4736
4737
  const chatbotContentClass = cva("selection:bg-accent-4 selection:text-accent-12 fixed bottom-2 left-2 right-2 isolate mx-auto max-h-full max-w-[450px] focus:outline-none", {
4737
4738
  variants: {
4738
4739
  view: {
@@ -5187,40 +5188,41 @@ const chatbotPlugin = ({
5187
5188
  });
5188
5189
  export {
5189
5190
  AbortedError as A,
5190
- url as B,
5191
+ email as B,
5191
5192
  Cn as C,
5192
- regex as D,
5193
- cva as E,
5193
+ url as D,
5194
+ regex as E,
5194
5195
  F$1 as F,
5195
- ERROR_MESSAGES as G,
5196
- chatbotPlugin as H,
5196
+ cva as G,
5197
+ ERROR_MESSAGES as H,
5198
+ chatbotPlugin as I,
5197
5199
  N,
5198
5200
  ValiError as V,
5199
5201
  _$3 as _,
5200
- getFlowSubmissionsPayload as a,
5201
- _$4 as b,
5202
- clsx as c,
5203
- a as d,
5204
- debounce as e,
5205
- k$3 as f,
5202
+ invariant as a,
5203
+ getFlowSubmissionsPayload as b,
5204
+ _$4 as c,
5205
+ clsx as d,
5206
+ a as e,
5207
+ debounce as f,
5206
5208
  getHeadOrThrow as g,
5207
5209
  h$1 as h,
5208
- invariant as i,
5209
- parse$1 as j,
5210
+ isString as i,
5211
+ k$3 as j,
5210
5212
  kbToReadableSize as k,
5211
- picklist as l,
5212
- isSubmissionOfType as m,
5213
- parseAsync as n,
5213
+ parse$1 as l,
5214
+ picklist as m,
5215
+ isSubmissionOfType as n,
5214
5216
  o,
5215
5217
  p$3 as p,
5216
- object as q,
5217
- maxLength as r,
5218
+ parseAsync as q,
5219
+ object as r,
5218
5220
  store as s,
5219
5221
  transform as t,
5220
- minLength as u,
5221
- record as v,
5222
- boolean as w,
5223
- string as x,
5222
+ maxLength as u,
5223
+ minLength as v,
5224
+ record as w,
5225
+ boolean as x,
5224
5226
  y$2 as y,
5225
- email as z
5227
+ string as z
5226
5228
  };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-a8a873bc.cjs");
3
+ const index = require("./index-154bf9a3.cjs");
4
4
  require("@inploi/sdk");
5
5
  exports.chatbotPlugin = index.chatbotPlugin;
@@ -1,5 +1,5 @@
1
- import { H } from "./index-063bd7e8.js";
1
+ import { I } from "./index-dfe3ef24.js";
2
2
  import "@inploi/sdk";
3
3
  export {
4
- H as chatbotPlugin
4
+ I as chatbotPlugin
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/plugin-chatbot",
3
- "version": "3.16.0",
3
+ "version": "3.16.1",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-chatbot.js",
6
6
  "types": "dist/index.d.ts",