@websolutespa/bom-mixer-llm 0.0.11 → 0.0.12
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 +6 -0
- package/dist/cjs/index.js +28 -32
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/llm/components/Header/header.js +2 -1
- package/dist/esm/llm/components/Header/header.js.map +1 -1
- package/dist/esm/llm/components/Intro/intro.js +3 -24
- package/dist/esm/llm/components/Intro/intro.js.map +1 -1
- package/dist/esm/useLlm/api.service.js +1 -1
- package/dist/esm/useLlm/api.service.js.map +1 -1
- package/dist/esm/useLlm/useLlm.js +16 -4
- package/dist/esm/useLlm/useLlm.js.map +1 -1
- package/dist/esm/useLlm/useLlmView.js +6 -2
- package/dist/esm/useLlm/useLlmView.js.map +1 -1
- package/dist/types/llm/components/Header/header.d.ts.map +1 -1
- package/dist/types/llm/components/Intro/intro.d.ts +1 -1
- package/dist/types/llm/components/Intro/intro.d.ts.map +1 -1
- package/dist/types/useLlm/api.service.d.ts +1 -0
- package/dist/types/useLlm/api.service.d.ts.map +1 -1
- package/dist/types/useLlm/useLlm.d.ts +1 -2
- package/dist/types/useLlm/useLlm.d.ts.map +1 -1
- package/dist/types/useLlm/useLlmView.d.ts +6 -1
- package/dist/types/useLlm/useLlmView.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/llm/components/Header/header.tsx +7 -4
- package/src/llm/components/Intro/intro.tsx +11 -31
- package/src/useLlm/api.service.ts +2 -1
- package/src/useLlm/useLlm.tsx +14 -3
- package/src/useLlm/useLlmView.tsx +19 -5
package/CHANGELOG.md
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -1197,7 +1197,7 @@ class ApiService {
|
|
|
1197
1197
|
message: 'Bad Request: html is missing'
|
|
1198
1198
|
};
|
|
1199
1199
|
}
|
|
1200
|
-
console.log('/llm/summary', payload);
|
|
1200
|
+
// console.log('/llm/summary', payload);
|
|
1201
1201
|
return {
|
|
1202
1202
|
code: 'SENT'
|
|
1203
1203
|
};
|
|
@@ -2059,15 +2059,19 @@ function stripEmojis(text) {
|
|
|
2059
2059
|
const createLlmViewStore = _ref => {
|
|
2060
2060
|
let {
|
|
2061
2061
|
threadId,
|
|
2062
|
+
dismissable = true,
|
|
2063
|
+
skipCustomIntro = false,
|
|
2062
2064
|
opened,
|
|
2063
2065
|
embedded,
|
|
2064
2066
|
send,
|
|
2065
2067
|
setEmbed
|
|
2066
2068
|
} = _ref;
|
|
2067
2069
|
const props = {
|
|
2068
|
-
opened: opened != null
|
|
2070
|
+
opened: opened != null ? opened : embedded != null || threadId != null ? true : false,
|
|
2071
|
+
dismissable: embedded ? false : dismissable,
|
|
2072
|
+
skipCustomIntro: skipCustomIntro,
|
|
2069
2073
|
embedded: embedded || false,
|
|
2070
|
-
introed: false,
|
|
2074
|
+
introed: skipCustomIntro ? true : false,
|
|
2071
2075
|
hidden: false,
|
|
2072
2076
|
fixed: false,
|
|
2073
2077
|
idle: true,
|
|
@@ -2268,11 +2272,12 @@ const createLlmStore = _ref => {
|
|
|
2268
2272
|
appKey,
|
|
2269
2273
|
apiKey,
|
|
2270
2274
|
threadId,
|
|
2271
|
-
customTheme,
|
|
2272
2275
|
decorateUrl,
|
|
2273
2276
|
endpoint,
|
|
2274
|
-
test,
|
|
2275
2277
|
storage,
|
|
2278
|
+
test,
|
|
2279
|
+
preview,
|
|
2280
|
+
customTheme,
|
|
2276
2281
|
label
|
|
2277
2282
|
} = _ref;
|
|
2278
2283
|
const theme = getTheme(customTheme);
|
|
@@ -2303,7 +2308,8 @@ const createLlmStore = _ref => {
|
|
|
2303
2308
|
threadId,
|
|
2304
2309
|
endpoint,
|
|
2305
2310
|
locale,
|
|
2306
|
-
test
|
|
2311
|
+
test,
|
|
2312
|
+
preview
|
|
2307
2313
|
});
|
|
2308
2314
|
return apiService;
|
|
2309
2315
|
},
|
|
@@ -2315,7 +2321,8 @@ const createLlmStore = _ref => {
|
|
|
2315
2321
|
threadId,
|
|
2316
2322
|
endpoint,
|
|
2317
2323
|
locale,
|
|
2318
|
-
test
|
|
2324
|
+
test,
|
|
2325
|
+
preview
|
|
2319
2326
|
});
|
|
2320
2327
|
const app = yield apiService.getInfo();
|
|
2321
2328
|
if (!app) {
|
|
@@ -2587,6 +2594,15 @@ function LlmProvider(_a) {
|
|
|
2587
2594
|
} = _a,
|
|
2588
2595
|
props = __rest(_a, ["children"]);
|
|
2589
2596
|
const label = bomMixerHooks.useLabel();
|
|
2597
|
+
if (props.embedded) {
|
|
2598
|
+
props.dismissable = false;
|
|
2599
|
+
props.opened = true;
|
|
2600
|
+
}
|
|
2601
|
+
if (props.preview) {
|
|
2602
|
+
props.dismissable = false;
|
|
2603
|
+
props.opened = true;
|
|
2604
|
+
props.skipCustomIntro = true;
|
|
2605
|
+
}
|
|
2590
2606
|
const storeRef = react.useRef();
|
|
2591
2607
|
if (!storeRef.current) {
|
|
2592
2608
|
storeRef.current = createSharedLlmStore(Object.assign(Object.assign({}, props), {
|
|
@@ -2986,6 +3002,7 @@ const Header = props => {
|
|
|
2986
3002
|
} = useLlmView(state => state.actions);
|
|
2987
3003
|
const hidden = useLlmView(state => state.hidden);
|
|
2988
3004
|
const fixed = useLlmView(state => state.fixed);
|
|
3005
|
+
const dismissable = useLlmView(state => state.dismissable);
|
|
2989
3006
|
const label = bomMixerHooks.useLabel();
|
|
2990
3007
|
const logo = app === null || app === void 0 ? void 0 : app.contents.logo;
|
|
2991
3008
|
const logoMini = (_a = app === null || app === void 0 ? void 0 : app.contents) === null || _a === void 0 ? void 0 : _a.logoMini;
|
|
@@ -3012,7 +3029,7 @@ const Header = props => {
|
|
|
3012
3029
|
alt: logoMini.alt
|
|
3013
3030
|
})
|
|
3014
3031
|
})]
|
|
3015
|
-
}), jsxRuntime.jsxs("button", {
|
|
3032
|
+
}), dismissable && jsxRuntime.jsxs("button", {
|
|
3016
3033
|
className: "llm__header-back -llm-t-cta-3",
|
|
3017
3034
|
onClick: () => open(),
|
|
3018
3035
|
children: [label('llm.back'), jsxRuntime.jsx(bomMixerIcons.IconLlmArrowCornerRightUp, {})]
|
|
@@ -3211,13 +3228,11 @@ const Blob = () => {
|
|
|
3211
3228
|
const Intro = () => {
|
|
3212
3229
|
const iframeRef = react.useRef(null);
|
|
3213
3230
|
const app = useLlm(state => state.app);
|
|
3214
|
-
// const introed = useLlmView(state => state.introed);
|
|
3215
|
-
const {
|
|
3216
|
-
send
|
|
3217
|
-
} = useLlmView(state => state.actions);
|
|
3218
3231
|
const {
|
|
3232
|
+
send,
|
|
3219
3233
|
setIntroed
|
|
3220
3234
|
} = useLlmView(state => state.actions);
|
|
3235
|
+
const skipCustomIntro = useLlmView(state => state.skipCustomIntro);
|
|
3221
3236
|
const motionItem = {
|
|
3222
3237
|
hidden: {
|
|
3223
3238
|
y: '40px'
|
|
@@ -3288,25 +3303,6 @@ const Intro = () => {
|
|
|
3288
3303
|
}
|
|
3289
3304
|
return () => {};
|
|
3290
3305
|
}, [setIntroed]);
|
|
3291
|
-
/*
|
|
3292
|
-
const onIntroed = (newIntroed: boolean) => {
|
|
3293
|
-
console.log('onIntroed', 'introed', introed, 'newIntroed', newIntroed);
|
|
3294
|
-
if (newIntroed !== introed) {
|
|
3295
|
-
setIntroed(newIntroed);
|
|
3296
|
-
}
|
|
3297
|
-
};
|
|
3298
|
-
useEffect(() => {
|
|
3299
|
-
const onScroll = () => {
|
|
3300
|
-
if (iframeRef.current) {
|
|
3301
|
-
const rect = iframeRef.current.getBoundingClientRect();
|
|
3302
|
-
console.log('onScroll', rect.bottom < window.innerHeight);
|
|
3303
|
-
onIntroed(rect.bottom < window.innerHeight);
|
|
3304
|
-
}
|
|
3305
|
-
}
|
|
3306
|
-
window.addEventListener('scroll', onScroll);
|
|
3307
|
-
return () => window.removeEventListener('scroll', onScroll);
|
|
3308
|
-
}, [setIntroed]);
|
|
3309
|
-
*/
|
|
3310
3306
|
react.useEffect(() => {
|
|
3311
3307
|
const onLenisScroll = () => {
|
|
3312
3308
|
if (iframeRef.current) {
|
|
@@ -3324,7 +3320,7 @@ const Intro = () => {
|
|
|
3324
3320
|
if (!app) {
|
|
3325
3321
|
return;
|
|
3326
3322
|
}
|
|
3327
|
-
return app.contents.customIntro ? jsxRuntime.jsx("div", {
|
|
3323
|
+
return app.contents.customIntro ? skipCustomIntro ? null : jsxRuntime.jsx("div", {
|
|
3328
3324
|
className: "llm__customIntro",
|
|
3329
3325
|
children: jsxRuntime.jsx("iframe", {
|
|
3330
3326
|
ref: iframeRef,
|