@websolutespa/bom-llm 0.0.17 → 0.0.18
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/index.d.ts +11 -5
- package/dist/umd/index.js +29 -35
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { LlmInstance } from '@websolutespa/bom-mixer-llm';
|
|
2
|
-
|
|
3
1
|
type DeepPartial<T> = T extends object ? {
|
|
4
2
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
5
3
|
} : T;
|
|
@@ -63,17 +61,25 @@ type LlmMock = {
|
|
|
63
61
|
};
|
|
64
62
|
type LlmTest = undefined | boolean | DeepPartial<LlmMock>;
|
|
65
63
|
type LlmDecorateUrl = (item: LlmItem) => (string | void) | Promise<string | void>;
|
|
64
|
+
type LlmViewOptions = {
|
|
65
|
+
threadId?: string;
|
|
66
|
+
preview?: boolean;
|
|
67
|
+
opened?: boolean;
|
|
68
|
+
dismissable?: boolean;
|
|
69
|
+
skipCustomIntro?: boolean;
|
|
70
|
+
embedded?: boolean;
|
|
71
|
+
};
|
|
66
72
|
type LlmOptions = {
|
|
67
73
|
apiKey: string;
|
|
68
74
|
appKey: string;
|
|
69
75
|
decorateUrl?: LlmDecorateUrl;
|
|
70
76
|
test?: LlmTest;
|
|
71
|
-
threadId?: string;
|
|
72
77
|
customTheme?: Partial<LlmTheme>;
|
|
73
|
-
opened?: boolean;
|
|
74
|
-
embedded?: boolean;
|
|
75
78
|
locale?: string;
|
|
76
79
|
market?: string;
|
|
80
|
+
} & LlmViewOptions;
|
|
81
|
+
type LlmInstance = {
|
|
82
|
+
open: () => void;
|
|
77
83
|
};
|
|
78
84
|
|
|
79
85
|
declare function bomLlm(props: LlmOptions): LlmInstance | undefined;
|
package/dist/umd/index.js
CHANGED
|
@@ -24055,7 +24055,7 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
24055
24055
|
message: 'Bad Request: html is missing'
|
|
24056
24056
|
};
|
|
24057
24057
|
}
|
|
24058
|
-
console.log('/llm/summary', payload);
|
|
24058
|
+
// console.log('/llm/summary', payload);
|
|
24059
24059
|
return {
|
|
24060
24060
|
code: 'SENT'
|
|
24061
24061
|
};
|
|
@@ -24953,15 +24953,19 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
24953
24953
|
const createLlmViewStore = _ref => {
|
|
24954
24954
|
let {
|
|
24955
24955
|
threadId,
|
|
24956
|
+
dismissable = true,
|
|
24957
|
+
skipCustomIntro = false,
|
|
24956
24958
|
opened,
|
|
24957
24959
|
embedded,
|
|
24958
24960
|
send,
|
|
24959
24961
|
setEmbed
|
|
24960
24962
|
} = _ref;
|
|
24961
24963
|
const props = {
|
|
24962
|
-
opened: opened != null
|
|
24964
|
+
opened: opened != null ? opened : embedded != null || threadId != null ? true : false,
|
|
24965
|
+
dismissable: embedded ? false : dismissable,
|
|
24966
|
+
skipCustomIntro: skipCustomIntro,
|
|
24963
24967
|
embedded: embedded || false,
|
|
24964
|
-
introed: false,
|
|
24968
|
+
introed: skipCustomIntro ? true : false,
|
|
24965
24969
|
hidden: false,
|
|
24966
24970
|
fixed: false,
|
|
24967
24971
|
idle: true,
|
|
@@ -25164,11 +25168,12 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
25164
25168
|
appKey,
|
|
25165
25169
|
apiKey,
|
|
25166
25170
|
threadId,
|
|
25167
|
-
customTheme,
|
|
25168
25171
|
decorateUrl,
|
|
25169
25172
|
endpoint,
|
|
25170
|
-
test,
|
|
25171
25173
|
storage,
|
|
25174
|
+
test,
|
|
25175
|
+
preview,
|
|
25176
|
+
customTheme,
|
|
25172
25177
|
label
|
|
25173
25178
|
} = _ref;
|
|
25174
25179
|
const theme = getTheme(customTheme);
|
|
@@ -25200,7 +25205,8 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
25200
25205
|
threadId,
|
|
25201
25206
|
endpoint,
|
|
25202
25207
|
locale,
|
|
25203
|
-
test
|
|
25208
|
+
test,
|
|
25209
|
+
preview
|
|
25204
25210
|
});
|
|
25205
25211
|
return apiService;
|
|
25206
25212
|
},
|
|
@@ -25211,7 +25217,8 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
25211
25217
|
threadId,
|
|
25212
25218
|
endpoint,
|
|
25213
25219
|
locale,
|
|
25214
|
-
test
|
|
25220
|
+
test,
|
|
25221
|
+
preview
|
|
25215
25222
|
});
|
|
25216
25223
|
const app = await apiService.getInfo();
|
|
25217
25224
|
if (!app) {
|
|
@@ -25488,6 +25495,15 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
25488
25495
|
...props
|
|
25489
25496
|
} = _ref3;
|
|
25490
25497
|
const label = useLabel();
|
|
25498
|
+
if (props.embedded) {
|
|
25499
|
+
props.dismissable = false;
|
|
25500
|
+
props.opened = true;
|
|
25501
|
+
}
|
|
25502
|
+
if (props.preview) {
|
|
25503
|
+
props.dismissable = false;
|
|
25504
|
+
props.opened = true;
|
|
25505
|
+
props.skipCustomIntro = true;
|
|
25506
|
+
}
|
|
25491
25507
|
const storeRef = reactExports.useRef();
|
|
25492
25508
|
if (!storeRef.current) {
|
|
25493
25509
|
storeRef.current = createSharedLlmStore({
|
|
@@ -26604,6 +26620,7 @@ void main(void) {
|
|
|
26604
26620
|
} = useLlmView(state => state.actions);
|
|
26605
26621
|
const hidden = useLlmView(state => state.hidden);
|
|
26606
26622
|
const fixed = useLlmView(state => state.fixed);
|
|
26623
|
+
const dismissable = useLlmView(state => state.dismissable);
|
|
26607
26624
|
const label = useLabel();
|
|
26608
26625
|
const logo = app?.contents.logo;
|
|
26609
26626
|
const logoMini = app?.contents?.logoMini;
|
|
@@ -26630,7 +26647,7 @@ void main(void) {
|
|
|
26630
26647
|
alt: logoMini.alt
|
|
26631
26648
|
})
|
|
26632
26649
|
})]
|
|
26633
|
-
}), /*#__PURE__*/jsxRuntimeExports.jsxs("button", {
|
|
26650
|
+
}), dismissable && /*#__PURE__*/jsxRuntimeExports.jsxs("button", {
|
|
26634
26651
|
className: "llm__header-back -llm-t-cta-3",
|
|
26635
26652
|
onClick: () => open(),
|
|
26636
26653
|
children: [label('llm.back'), /*#__PURE__*/jsxRuntimeExports.jsx(IconLlmArrowCornerRightUp, {})]
|
|
@@ -26837,13 +26854,11 @@ void main(void) {
|
|
|
26837
26854
|
const Intro = () => {
|
|
26838
26855
|
const iframeRef = reactExports.useRef(null);
|
|
26839
26856
|
const app = useLlm(state => state.app);
|
|
26840
|
-
// const introed = useLlmView(state => state.introed);
|
|
26841
|
-
const {
|
|
26842
|
-
send
|
|
26843
|
-
} = useLlmView(state => state.actions);
|
|
26844
26857
|
const {
|
|
26858
|
+
send,
|
|
26845
26859
|
setIntroed
|
|
26846
26860
|
} = useLlmView(state => state.actions);
|
|
26861
|
+
const skipCustomIntro = useLlmView(state => state.skipCustomIntro);
|
|
26847
26862
|
const motionItem = {
|
|
26848
26863
|
hidden: {
|
|
26849
26864
|
y: '40px'
|
|
@@ -26913,27 +26928,6 @@ void main(void) {
|
|
|
26913
26928
|
}
|
|
26914
26929
|
return () => {};
|
|
26915
26930
|
}, [setIntroed]);
|
|
26916
|
-
|
|
26917
|
-
/*
|
|
26918
|
-
const onIntroed = (newIntroed: boolean) => {
|
|
26919
|
-
console.log('onIntroed', 'introed', introed, 'newIntroed', newIntroed);
|
|
26920
|
-
if (newIntroed !== introed) {
|
|
26921
|
-
setIntroed(newIntroed);
|
|
26922
|
-
}
|
|
26923
|
-
};
|
|
26924
|
-
useEffect(() => {
|
|
26925
|
-
const onScroll = () => {
|
|
26926
|
-
if (iframeRef.current) {
|
|
26927
|
-
const rect = iframeRef.current.getBoundingClientRect();
|
|
26928
|
-
console.log('onScroll', rect.bottom < window.innerHeight);
|
|
26929
|
-
onIntroed(rect.bottom < window.innerHeight);
|
|
26930
|
-
}
|
|
26931
|
-
}
|
|
26932
|
-
window.addEventListener('scroll', onScroll);
|
|
26933
|
-
return () => window.removeEventListener('scroll', onScroll);
|
|
26934
|
-
}, [setIntroed]);
|
|
26935
|
-
*/
|
|
26936
|
-
|
|
26937
26931
|
reactExports.useEffect(() => {
|
|
26938
26932
|
const onLenisScroll = () => {
|
|
26939
26933
|
if (iframeRef.current) {
|
|
@@ -26951,7 +26945,7 @@ void main(void) {
|
|
|
26951
26945
|
if (!app) {
|
|
26952
26946
|
return;
|
|
26953
26947
|
}
|
|
26954
|
-
return app.contents.customIntro ? /*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
26948
|
+
return app.contents.customIntro ? skipCustomIntro ? null : /*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
26955
26949
|
className: "llm__customIntro",
|
|
26956
26950
|
children: /*#__PURE__*/jsxRuntimeExports.jsx("iframe", {
|
|
26957
26951
|
ref: iframeRef,
|
|
@@ -31324,7 +31318,7 @@ void main(void) {
|
|
|
31324
31318
|
};
|
|
31325
31319
|
}
|
|
31326
31320
|
}, [locale, market]);
|
|
31327
|
-
const endpoint = props.test
|
|
31321
|
+
const endpoint = typeof props.test !== 'undefined' ? 'https://bom-sample-basic-web-git-bom-llm-actarian.vercel.app' : 'https://platform.websolute.ai';
|
|
31328
31322
|
const layout = {
|
|
31329
31323
|
labels: getLabels(data.locale),
|
|
31330
31324
|
locale: data.locale,
|