@constructor-io/constructorio-ui-pia 2.10.1 → 2.10.3

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.
Files changed (52) hide show
  1. package/dist/constructorio-ui-pia-bundled.js +40 -40
  2. package/lib/cjs/components/CioPia/CioPia.js +3 -2
  3. package/lib/cjs/components/Input/Input.js +21 -17
  4. package/lib/cjs/components/PiaConversation/PiaConversation.js +1 -1
  5. package/lib/cjs/components/PiaConversation/PiaModal.js +1 -1
  6. package/lib/cjs/components/SuggestedQuestion/SuggestedQuestion.js +3 -7
  7. package/lib/cjs/components/icons/QuestionIcon.js +9 -0
  8. package/lib/cjs/components/icons/SendIcon.js +9 -0
  9. package/lib/cjs/components/icons/SparklesIcon.js +11 -0
  10. package/lib/cjs/components/icons/index.js +12 -0
  11. package/lib/cjs/errors.js +19 -0
  12. package/lib/cjs/hooks/mocks/agent.js +13 -8
  13. package/lib/cjs/hooks/useAnswerResults.js +6 -19
  14. package/lib/cjs/hooks/useCioPia.js +3 -1
  15. package/lib/cjs/hooks/useSuggestedQuestions.js +8 -4
  16. package/lib/cjs/index.js +4 -1
  17. package/lib/cjs/utils/transformers.js +22 -1
  18. package/lib/cjs/version.js +1 -1
  19. package/lib/mjs/components/CioPia/CioPia.js +3 -2
  20. package/lib/mjs/components/Input/Input.js +22 -18
  21. package/lib/mjs/components/PiaConversation/PiaConversation.js +1 -1
  22. package/lib/mjs/components/PiaConversation/PiaModal.js +1 -1
  23. package/lib/mjs/components/SuggestedQuestion/SuggestedQuestion.js +3 -7
  24. package/lib/mjs/components/icons/QuestionIcon.js +5 -0
  25. package/lib/mjs/components/icons/SendIcon.js +5 -0
  26. package/lib/mjs/components/icons/SparklesIcon.js +7 -0
  27. package/lib/mjs/components/icons/index.js +3 -0
  28. package/lib/mjs/errors.js +16 -0
  29. package/lib/mjs/hooks/mocks/agent.js +13 -8
  30. package/lib/mjs/hooks/useAnswerResults.js +6 -18
  31. package/lib/mjs/hooks/useCioPia.js +3 -1
  32. package/lib/mjs/hooks/useSuggestedQuestions.js +8 -4
  33. package/lib/mjs/index.js +2 -0
  34. package/lib/mjs/utils/transformers.js +19 -0
  35. package/lib/mjs/version.js +1 -1
  36. package/lib/types/components/CioPia/CioPia.d.ts +5 -0
  37. package/lib/types/components/Input/Input.d.ts +4 -2
  38. package/lib/types/components/icons/QuestionIcon.d.ts +2 -0
  39. package/lib/types/components/icons/SendIcon.d.ts +2 -0
  40. package/lib/types/components/icons/SparklesIcon.d.ts +2 -0
  41. package/lib/types/components/icons/index.d.ts +3 -0
  42. package/lib/types/errors.d.ts +12 -0
  43. package/lib/types/hooks/mocks/agent.d.ts +1 -1
  44. package/lib/types/hooks/mocks/types.d.ts +2 -0
  45. package/lib/types/hooks/useAnswerResults.d.ts +2 -2
  46. package/lib/types/hooks/useCioPia.d.ts +5 -0
  47. package/lib/types/hooks/useSuggestedQuestions.d.ts +2 -1
  48. package/lib/types/index.d.ts +1 -0
  49. package/lib/types/types.d.ts +11 -0
  50. package/lib/types/utils/transformers.d.ts +8 -1
  51. package/lib/types/version.d.ts +1 -1
  52. package/package.json +2 -2
@@ -19,7 +19,7 @@ const PiaConversation_1 = tslib_1.__importDefault(require("../PiaConversation/Pi
19
19
  // eslint-disable-next-line complexity
20
20
  function CioPia(props) {
21
21
  var _a;
22
- const { apiKey, itemId, itemName, threadId, variationId, cioClient, displayConfigs, componentOverrides, callbacks, formatters, productCardProps, children, translations, suggestedQuestionsParameters, } = props;
22
+ const { apiKey, itemId, itemName, threadId, variationId, cioClient, displayConfigs, componentOverrides, callbacks, formatters, productCardProps, children, translations, suggestedQuestionsParameters, parameters, } = props;
23
23
  const { learnMoreUrl, showFeedback, mode = 'default', type = 'inline', showPreviousItems, disclaimerPosition = 'bottom', } = displayConfigs || {};
24
24
  const isConversation = mode === 'conversation' || type === 'modal';
25
25
  const { priceCurrency } = productCardProps || {};
@@ -30,6 +30,7 @@ function CioPia(props) {
30
30
  variationId,
31
31
  cioClient,
32
32
  suggestedQuestionsParameters,
33
+ parameters,
33
34
  formatImageUrl: formatters === null || formatters === void 0 ? void 0 : formatters.formatImageUrl,
34
35
  });
35
36
  const tracking = (0, useTracking_1.default)({
@@ -92,7 +93,7 @@ function CioPia(props) {
92
93
  return (react_1.default.createElement("div", { ref: containerRef, className: 'cio-pia-container', "data-testid": 'cio-pia-container' },
93
94
  react_1.default.createElement(constructorio_ui_components_1.RenderPropsWrapper, { props: renderProps, override: children || (componentOverrides === null || componentOverrides === void 0 ? void 0 : componentOverrides.reactNode) },
94
95
  react_1.default.createElement("p", { className: 'cio-pia-title', "data-testid": 'cio-pia-title' }, (0, translate_1.translate)('Any questions about this product?', translations)),
95
- react_1.default.createElement(Input_1.default, { onSubmit: handleSubmitQuestion, onFocus: handleInputFocus, value: currentQuestion, translations: translations }),
96
+ react_1.default.createElement(Input_1.default, { onSubmit: handleSubmitQuestion, onFocus: handleInputFocus, value: currentQuestion, translations: translations, componentOverride: componentOverrides === null || componentOverrides === void 0 ? void 0 : componentOverrides.input }),
96
97
  isLoading && react_1.default.createElement(LoadingSkeleton_1.default, { componentOverride: componentOverrides === null || componentOverrides === void 0 ? void 0 : componentOverrides.loading }),
97
98
  !isLoading && error && react_1.default.createElement(ErrorBlock_1.default, { message: (error === null || error === void 0 ? void 0 : error.message) || 'Unexpected error' }),
98
99
  !isLoading && !error && (react_1.default.createElement(react_1.default.Fragment, null,
@@ -2,41 +2,45 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
+ const constructorio_ui_components_1 = require("@constructor-io/constructorio-ui-components");
5
6
  const translate_1 = require("../../utils/translate");
6
- function SendIcon() {
7
- return (react_1.default.createElement("svg", { width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
8
- react_1.default.createElement("g", { id: '.icon-send' },
9
- react_1.default.createElement("path", { id: 'Vector', d: 'M14.8934 7.09533L14.8884 7.09314L1.54219 1.55752C1.42993 1.51053 1.30778 1.49211 1.18666 1.50388C1.06554 1.51566 0.949225 1.55728 0.848125 1.62502C0.741311 1.69501 0.653573 1.79045 0.592805 1.90277C0.532037 2.01509 0.500145 2.14075 0.5 2.26845V5.80877C0.50006 5.98335 0.561019 6.15243 0.67237 6.28689C0.783722 6.42134 0.938491 6.51274 1.11 6.54533L8.38906 7.89127C8.41767 7.89669 8.44348 7.91193 8.46205 7.93435C8.48062 7.95677 8.49078 7.98497 8.49078 8.01408C8.49078 8.04319 8.48062 8.07139 8.46205 8.09381C8.44348 8.11623 8.41767 8.13147 8.38906 8.13689L1.11031 9.48283C0.938851 9.51533 0.784092 9.60661 0.67269 9.74094C0.561288 9.87528 0.500219 10.0443 0.5 10.2188V13.7597C0.499917 13.8816 0.530111 14.0017 0.587871 14.1091C0.645632 14.2165 0.729152 14.3079 0.830938 14.375C0.953375 14.4564 1.09706 14.4998 1.24406 14.5C1.34626 14.4999 1.4474 14.4794 1.54156 14.4397L14.8875 8.93564L14.8934 8.93283C15.0731 8.85563 15.2262 8.72745 15.3337 8.56415C15.4413 8.40086 15.4986 8.20961 15.4986 8.01408C15.4986 7.81855 15.4413 7.6273 15.3337 7.46401C15.2262 7.30071 15.0731 7.17253 14.8934 7.09533Z', fill: 'white' }))));
10
- }
11
- function Input({ value: providedValue, placeholder, disabled = false, onSubmit, onFocus, translations, }) {
7
+ const icons_1 = require("../icons");
8
+ function Input({ value: providedValue, placeholder, disabled = false, onSubmit, onFocus, translations, componentOverride, }) {
12
9
  const [value, setValue] = (0, react_1.useState)(providedValue || '');
13
10
  (0, react_1.useEffect)(() => {
14
11
  if (providedValue) {
15
12
  setValue(providedValue);
16
13
  }
17
14
  }, [providedValue]);
18
- const handleSubmit = () => {
19
- if (value.trim()) {
20
- onSubmit(value.trim());
21
- if (value.trim() !== providedValue) {
15
+ const handleSubmit = (0, react_1.useCallback)((submittedValue) => {
16
+ if (submittedValue.trim()) {
17
+ onSubmit(submittedValue.trim());
18
+ if (submittedValue.trim() !== providedValue) {
22
19
  setValue('');
23
20
  }
24
21
  }
25
- };
22
+ }, [onSubmit, providedValue]);
26
23
  const handleSubmitOnEnter = (e) => {
27
24
  if (e.key === 'Enter') {
28
25
  e.preventDefault();
29
- handleSubmit();
26
+ handleSubmit(value);
30
27
  }
31
28
  };
32
29
  // Priority: translations > placeholder prop > default
33
30
  const resolvedPlaceholder = (translations === null || translations === void 0 ? void 0 : translations['Ask anything']) !== undefined
34
31
  ? (0, translate_1.translate)('Ask anything', translations)
35
32
  : (placeholder !== null && placeholder !== void 0 ? placeholder : (0, translate_1.translate)('Ask anything'));
36
- return (react_1.default.createElement("div", { className: 'cio-pia-input-container' },
37
- react_1.default.createElement("input", { type: 'text', value: value, onChange: (e) => setValue(e.target.value), onKeyDown: handleSubmitOnEnter, onFocus: onFocus, placeholder: resolvedPlaceholder, disabled: disabled, className: 'cio-pia-input' }),
38
- react_1.default.createElement("button", { type: 'button', onClick: handleSubmit, className: 'cio-pia-send-button', disabled: disabled },
39
- (0, translate_1.translate)('Send', translations),
40
- react_1.default.createElement(SendIcon, null))));
33
+ return (react_1.default.createElement(constructorio_ui_components_1.RenderPropsWrapper, { props: {
34
+ disabled,
35
+ placeholder: resolvedPlaceholder,
36
+ onSubmit: handleSubmit,
37
+ onFocus,
38
+ translations,
39
+ }, override: componentOverride === null || componentOverride === void 0 ? void 0 : componentOverride.reactNode },
40
+ react_1.default.createElement("div", { className: 'cio-pia-input-container' },
41
+ react_1.default.createElement("input", { type: 'text', value: value, onChange: (e) => setValue(e.target.value), onKeyDown: handleSubmitOnEnter, onFocus: onFocus, placeholder: resolvedPlaceholder, disabled: disabled, className: 'cio-pia-input' }),
42
+ react_1.default.createElement("button", { type: 'button', onClick: () => handleSubmit(value), className: 'cio-pia-send-button', disabled: disabled },
43
+ (0, translate_1.translate)('Send', translations),
44
+ react_1.default.createElement(icons_1.SendIcon, null)))));
41
45
  }
42
46
  exports.default = Input;
@@ -15,6 +15,6 @@ function PiaConversation({ conversationHistory, isLoading, error, currentItems,
15
15
  react_1.default.createElement("div", { className: 'cio-pia-conversation-footer' },
16
16
  isLoading && !error && react_1.default.createElement(SuggestedQuestionsSkeleton_1.default, null),
17
17
  !isLoading && !error && (react_1.default.createElement(SuggestedQuestionsContainer_1.default, { questions: displayedQuestions, onQuestionClick: handleQuestionClick, componentOverride: componentOverrides === null || componentOverrides === void 0 ? void 0 : componentOverrides.suggestedQuestions })),
18
- react_1.default.createElement(Input_1.default, { onSubmit: handleSubmitQuestion, onFocus: onInputFocus, disabled: isLoading, translations: translations }))));
18
+ react_1.default.createElement(Input_1.default, { onSubmit: handleSubmitQuestion, onFocus: onInputFocus, disabled: isLoading, translations: translations, componentOverride: componentOverrides === null || componentOverrides === void 0 ? void 0 : componentOverrides.input }))));
19
19
  }
20
20
  exports.default = PiaConversation;
@@ -67,7 +67,7 @@ function PiaModal({ initialQuestions, handleSubmitQuestion, handleQuestionClick,
67
67
  react_1.default.createElement("p", { className: 'cio-pia-title', "data-testid": 'cio-pia-title' }, (0, translate_1.translate)('Any questions about this product?', translations)),
68
68
  react_1.default.createElement("div", { className: 'cio-pia-conversation-footer' },
69
69
  initialQuestions.length > 0 && (react_1.default.createElement(SuggestedQuestionsContainer_1.default, { questions: initialQuestions, onQuestionClick: handleQuestionClicked, componentOverride: componentOverrides === null || componentOverrides === void 0 ? void 0 : componentOverrides.suggestedQuestions })),
70
- react_1.default.createElement(Input_1.default, { onSubmit: handleQuestion, onFocus: onInputFocus, disabled: isLoading || isOpen, translations: translations })),
70
+ react_1.default.createElement(Input_1.default, { onSubmit: handleQuestion, onFocus: onInputFocus, disabled: isLoading || isOpen, translations: translations, componentOverride: componentOverrides === null || componentOverrides === void 0 ? void 0 : componentOverrides.input })),
71
71
  react_1.default.createElement("dialog", { ref: dialogRef, className: 'cio-pia-modal', "aria-labelledby": 'cio-pia-modal-title' },
72
72
  react_1.default.createElement("div", { className: 'cio-pia-modal-content' },
73
73
  react_1.default.createElement("div", { className: 'cio-pia-modal-header' },
@@ -2,15 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importDefault(require("react"));
5
- function QuestionSvg() {
6
- return (react_1.default.createElement("div", { className: 'cio-pia-suggested-question-icon' },
7
- react_1.default.createElement("svg", { width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
8
- react_1.default.createElement("g", { id: 'help' },
9
- react_1.default.createElement("path", { id: 'Vector', d: 'M8.00004 1.33331C4.32004 1.33331 1.33337 4.31998 1.33337 7.99998C1.33337 11.68 4.32004 14.6666 8.00004 14.6666C11.68 14.6666 14.6667 11.68 14.6667 7.99998C14.6667 4.31998 11.68 1.33331 8.00004 1.33331ZM8.66671 12.6666H7.33337V11.3333H8.66671V12.6666ZM10.0467 7.49998L9.44671 8.11331C8.96671 8.59998 8.66671 8.99998 8.66671 9.99998H7.33337V9.66665C7.33337 8.93331 7.63337 8.26665 8.11337 7.77998L8.94004 6.93998C9.18671 6.69998 9.33337 6.36665 9.33337 5.99998C9.33337 5.26665 8.73337 4.66665 8.00004 4.66665C7.26671 4.66665 6.66671 5.26665 6.66671 5.99998H5.33337C5.33337 4.52665 6.52671 3.33331 8.00004 3.33331C9.47337 3.33331 10.6667 4.52665 10.6667 5.99998C10.6667 6.58665 10.4267 7.11998 10.0467 7.49998Z', fill: '#0F1324', fillOpacity: '0.6' })))));
10
- }
5
+ const icons_1 = require("../icons");
11
6
  function SuggestedQuestion({ question, onClick }) {
12
7
  return (react_1.default.createElement("button", { type: 'button', className: 'cio-pia-suggested-question', onClick: onClick },
13
- react_1.default.createElement(QuestionSvg, null),
8
+ react_1.default.createElement("div", { className: 'cio-pia-suggested-question-icon' },
9
+ react_1.default.createElement(icons_1.QuestionIcon, null)),
14
10
  question));
15
11
  }
16
12
  exports.default = SuggestedQuestion;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importDefault(require("react"));
5
+ function QuestionIcon() {
6
+ return (react_1.default.createElement("svg", { "aria-hidden": 'true', width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
7
+ react_1.default.createElement("path", { d: 'M8.00004 1.33331C4.32004 1.33331 1.33337 4.31998 1.33337 7.99998C1.33337 11.68 4.32004 14.6666 8.00004 14.6666C11.68 14.6666 14.6667 11.68 14.6667 7.99998C14.6667 4.31998 11.68 1.33331 8.00004 1.33331ZM8.66671 12.6666H7.33337V11.3333H8.66671V12.6666ZM10.0467 7.49998L9.44671 8.11331C8.96671 8.59998 8.66671 8.99998 8.66671 9.99998H7.33337V9.66665C7.33337 8.93331 7.63337 8.26665 8.11337 7.77998L8.94004 6.93998C9.18671 6.69998 9.33337 6.36665 9.33337 5.99998C9.33337 5.26665 8.73337 4.66665 8.00004 4.66665C7.26671 4.66665 6.66671 5.26665 6.66671 5.99998H5.33337C5.33337 4.52665 6.52671 3.33331 8.00004 3.33331C9.47337 3.33331 10.6667 4.52665 10.6667 5.99998C10.6667 6.58665 10.4267 7.11998 10.0467 7.49998Z', fill: '#0F1324', fillOpacity: '0.6' })));
8
+ }
9
+ exports.default = QuestionIcon;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importDefault(require("react"));
5
+ function SendIcon() {
6
+ return (react_1.default.createElement("svg", { "aria-hidden": 'true', width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
7
+ react_1.default.createElement("path", { d: 'M14.8934 7.09533L14.8884 7.09314L1.54219 1.55752C1.42993 1.51053 1.30778 1.49211 1.18666 1.50388C1.06554 1.51566 0.949225 1.55728 0.848125 1.62502C0.741311 1.69501 0.653573 1.79045 0.592805 1.90277C0.532037 2.01509 0.500145 2.14075 0.5 2.26845V5.80877C0.50006 5.98335 0.561019 6.15243 0.67237 6.28689C0.783722 6.42134 0.938491 6.51274 1.11 6.54533L8.38906 7.89127C8.41767 7.89669 8.44348 7.91193 8.46205 7.93435C8.48062 7.95677 8.49078 7.98497 8.49078 8.01408C8.49078 8.04319 8.48062 8.07139 8.46205 8.09381C8.44348 8.11623 8.41767 8.13147 8.38906 8.13689L1.11031 9.48283C0.938851 9.51533 0.784092 9.60661 0.67269 9.74094C0.561288 9.87528 0.500219 10.0443 0.5 10.2188V13.7597C0.499917 13.8816 0.530111 14.0017 0.587871 14.1091C0.645632 14.2165 0.729152 14.3079 0.830938 14.375C0.953375 14.4564 1.09706 14.4998 1.24406 14.5C1.34626 14.4999 1.4474 14.4794 1.54156 14.4397L14.8875 8.93564L14.8934 8.93283C15.0731 8.85563 15.2262 8.72745 15.3337 8.56415C15.4413 8.40086 15.4986 8.20961 15.4986 8.01408C15.4986 7.81855 15.4413 7.6273 15.3337 7.46401C15.2262 7.30071 15.0731 7.17253 14.8934 7.09533Z', fill: 'white' })));
8
+ }
9
+ exports.default = SendIcon;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importDefault(require("react"));
5
+ function SparklesIcon() {
6
+ return (react_1.default.createElement("svg", { "aria-hidden": 'true', width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
7
+ react_1.default.createElement("path", { d: 'M12.6667 6.0013L13.5001 4.16797L15.3334 3.33464L13.5001 2.5013L12.6667 0.667969L11.8334 2.5013L10.0001 3.33464L11.8334 4.16797L12.6667 6.0013Z', fill: '#1C1917' }),
8
+ react_1.default.createElement("path", { d: 'M12.6667 10.0013L11.8334 11.8346L10.0001 12.668L11.8334 13.5013L12.6667 15.3346L13.5001 13.5013L15.3334 12.668L13.5001 11.8346L12.6667 10.0013Z', fill: '#1C1917' }),
9
+ react_1.default.createElement("path", { d: 'M7.66675 6.33464L6.00008 2.66797L4.33341 6.33464L0.666748 8.0013L4.33341 9.66797L6.00008 13.3346L7.66675 9.66797L11.3334 8.0013L7.66675 6.33464ZM6.66008 8.6613L6.00008 10.1146L5.34008 8.6613L3.88675 8.0013L5.34008 7.3413L6.00008 5.88797L6.66008 7.3413L8.11341 8.0013L6.66008 8.6613Z', fill: '#1C1917' })));
10
+ }
11
+ exports.default = SparklesIcon;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SparklesIcon = exports.SendIcon = exports.QuestionIcon = void 0;
7
+ var QuestionIcon_1 = require("./QuestionIcon");
8
+ Object.defineProperty(exports, "QuestionIcon", { enumerable: true, get: function () { return __importDefault(QuestionIcon_1).default; } });
9
+ var SendIcon_1 = require("./SendIcon");
10
+ Object.defineProperty(exports, "SendIcon", { enumerable: true, get: function () { return __importDefault(SendIcon_1).default; } });
11
+ var SparklesIcon_1 = require("./SparklesIcon");
12
+ Object.defineProperty(exports, "SparklesIcon", { enumerable: true, get: function () { return __importDefault(SparklesIcon_1).default; } });
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AgentRequestError = void 0;
4
+ /**
5
+ * Thrown when a Constructor agent request returns a non-2xx response.
6
+ *
7
+ * `status` is the HTTP status code, so callers can act on the kind of failure instead of
8
+ * parsing the message. A 422 means the request itself was rejected as unsuitable, a 429
9
+ * means rate limiting, and anything 500 or above means the service failed and a retry may
10
+ * succeed. This is the error that arrives in `CioPiaRenderProps.error` when a request fails.
11
+ */
12
+ class AgentRequestError extends Error {
13
+ constructor(status) {
14
+ super(`Request failed with status ${status}`);
15
+ this.name = 'AgentRequestError';
16
+ this.status = status;
17
+ }
18
+ }
19
+ exports.AgentRequestError = AgentRequestError;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ const errors_1 = require("../../errors");
4
5
  // Create URL for PIA API
5
6
  function createAgentUrl({ itemId, threadId, variationId, question, isStreaming = false, options, parameters = {}, }) {
6
7
  const { apiKey, agentServiceUrl, clientId, sessionId, userId, segments, version } = options;
@@ -56,7 +57,7 @@ class MockAgent {
56
57
  constructor(options) {
57
58
  this.options = options;
58
59
  }
59
- getSuggestedQuestions({ itemId, variationId, threadId, parameters = {}, }) {
60
+ getSuggestedQuestions({ itemId, variationId, threadId, parameters = {}, requestParameters = {}, }) {
60
61
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
61
62
  if (!itemId)
62
63
  throw new Error('Item ID is required');
@@ -67,18 +68,20 @@ class MockAgent {
67
68
  variationId,
68
69
  threadId,
69
70
  options: this.options,
70
- parameters: mapSuggestedQuestionsParams(parameters),
71
+ parameters: Object.assign(Object.assign({}, requestParameters), mapSuggestedQuestionsParams(parameters)),
71
72
  });
72
73
  try {
73
74
  const response = yield fetch(url);
74
75
  if (!response.ok)
75
- throw new Error(`Request failed with status ${response.status}`);
76
+ throw new errors_1.AgentRequestError(response.status);
76
77
  const data = yield response.json();
77
78
  return data;
78
79
  }
79
80
  catch (error) {
80
- const errorMessage = error instanceof Error ? error.message : String(error);
81
- throw new Error(errorMessage);
81
+ // Rethrow untouched so the status code and the original stack survive.
82
+ if (error instanceof Error)
83
+ throw error;
84
+ throw new Error(String(error));
82
85
  }
83
86
  });
84
87
  }
@@ -101,13 +104,15 @@ class MockAgent {
101
104
  try {
102
105
  const response = yield fetch(url);
103
106
  if (!response.ok)
104
- throw new Error(`Request failed with status ${response.status}`);
107
+ throw new errors_1.AgentRequestError(response.status);
105
108
  const data = yield response.json();
106
109
  return data;
107
110
  }
108
111
  catch (error) {
109
- const errorMessage = error instanceof Error ? error.message : String(error);
110
- throw new Error(errorMessage);
112
+ // Rethrow untouched so the status code and the original stack survive.
113
+ if (error instanceof Error)
114
+ throw error;
115
+ throw new Error(String(error));
111
116
  }
112
117
  });
113
118
  }
@@ -3,41 +3,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = require("react");
5
5
  const transformers_1 = require("../utils/transformers");
6
- const extractAndTransformItems = (data, formatImageUrl) => {
7
- var _a, _b;
8
- if (!((_b = (_a = data === null || data === void 0 ? void 0 : data.item_results) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.results)) {
9
- return null;
10
- }
11
- const { results } = data.item_results.response;
12
- if (!Array.isArray(results) || results.length === 0) {
13
- return null;
14
- }
15
- const transformedItems = results
16
- .map((item) => (0, transformers_1.transformResultItem)(item, formatImageUrl))
17
- .filter((item) => item !== null);
18
- return transformedItems.length > 0 ? transformedItems : null;
19
- };
20
- const fetchAnswerResults = ({ client, itemId, question, variationId, threadId, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
6
+ const fetchAnswerResults = ({ client, itemId, question, variationId, threadId, parameters, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
21
7
  const response = yield client.agent.getAnswerResults({
22
8
  itemId,
23
9
  variationId,
24
10
  threadId,
25
11
  question,
12
+ parameters,
26
13
  });
27
14
  return response;
28
15
  });
29
- function useAnswerResults({ itemId, variationId, threadId, cioClient, formatImageUrl, }) {
16
+ function useAnswerResults({ itemId, variationId, threadId, cioClient, parameters, formatImageUrl, }) {
30
17
  const [answerResults, setAnswerResults] = (0, react_1.useState)(null);
31
18
  const [isLoading, setIsLoading] = (0, react_1.useState)(false);
32
19
  const [error, setError] = (0, react_1.useState)(null);
33
- const items = (0, react_1.useMemo)(() => extractAndTransformItems(answerResults, formatImageUrl), [answerResults, formatImageUrl]);
20
+ const items = (0, react_1.useMemo)(() => (0, transformers_1.extractAndTransformItems)(answerResults, formatImageUrl), [answerResults, formatImageUrl]);
34
21
  const fetchResult = (0, react_1.useCallback)((question) => {
35
22
  if (!cioClient)
36
23
  return;
37
24
  setIsLoading(true);
38
25
  setError(null);
39
26
  setAnswerResults(null);
40
- fetchAnswerResults({ client: cioClient, itemId, question, variationId, threadId })
27
+ fetchAnswerResults({ client: cioClient, itemId, question, variationId, threadId, parameters })
41
28
  .then((fetchedAnswerResults) => {
42
29
  setAnswerResults(fetchedAnswerResults);
43
30
  setError(null);
@@ -49,7 +36,7 @@ function useAnswerResults({ itemId, variationId, threadId, cioClient, formatImag
49
36
  .finally(() => {
50
37
  setIsLoading(false);
51
38
  });
52
- }, [cioClient, itemId, variationId, threadId]);
39
+ }, [cioClient, itemId, variationId, threadId, parameters]);
53
40
  return {
54
41
  data: answerResults,
55
42
  items,
@@ -7,7 +7,7 @@ const useAnswerResults_1 = tslib_1.__importDefault(require("./useAnswerResults")
7
7
  const useSuggestedQuestions_1 = tslib_1.__importDefault(require("./useSuggestedQuestions"));
8
8
  const version_1 = tslib_1.__importDefault(require("../version"));
9
9
  function useCioPia(props) {
10
- const { apiKey, itemId, variationId, threadId: providedThreadId, cioClient: providedClient, suggestedQuestionsParameters, formatImageUrl, } = props;
10
+ const { apiKey, itemId, variationId, threadId: providedThreadId, cioClient: providedClient, suggestedQuestionsParameters, parameters, formatImageUrl, } = props;
11
11
  const [generatedThreadId] = (0, react_1.useState)(() => crypto.randomUUID());
12
12
  const threadId = providedThreadId || generatedThreadId;
13
13
  const client = (0, react_1.useMemo)(() => {
@@ -25,12 +25,14 @@ function useCioPia(props) {
25
25
  threadId,
26
26
  cioClient: client,
27
27
  parameters: suggestedQuestionsParameters,
28
+ requestParameters: parameters,
28
29
  });
29
30
  const answers = (0, useAnswerResults_1.default)({
30
31
  itemId,
31
32
  variationId,
32
33
  threadId,
33
34
  cioClient: client,
35
+ parameters,
34
36
  formatImageUrl,
35
37
  });
36
38
  return {
@@ -2,19 +2,22 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = require("react");
5
- const fetchSuggestedQuestions = ({ client, itemId, variationId, threadId, parameters, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
5
+ const fetchSuggestedQuestions = ({ client, itemId, variationId, threadId, parameters, requestParameters, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
6
6
  const response = yield client.agent.getSuggestedQuestions({
7
7
  itemId,
8
8
  variationId,
9
9
  threadId,
10
10
  parameters,
11
+ requestParameters,
11
12
  });
12
13
  return response.questions;
13
14
  });
14
- function useSuggestedQuestions({ itemId, variationId, threadId, cioClient, parameters, }) {
15
+ function useSuggestedQuestions({ itemId, variationId, threadId, cioClient, parameters, requestParameters, }) {
15
16
  const [questions, setQuestions] = (0, react_1.useState)([]);
16
17
  const [isLoading, setIsLoading] = (0, react_1.useState)(false);
17
18
  const [error, setError] = (0, react_1.useState)(null);
19
+ // Serialize to a primitive so an object-literal prop doesn't retrigger the auto-fetch effect each render.
20
+ const requestParametersKey = JSON.stringify(requestParameters);
18
21
  const fetchResult = (0, react_1.useCallback)(() => {
19
22
  if (!cioClient)
20
23
  return;
@@ -26,6 +29,7 @@ function useSuggestedQuestions({ itemId, variationId, threadId, cioClient, param
26
29
  variationId,
27
30
  threadId,
28
31
  parameters,
32
+ requestParameters,
29
33
  })
30
34
  .then((fetchedQuestions) => {
31
35
  setQuestions(fetchedQuestions);
@@ -37,8 +41,8 @@ function useSuggestedQuestions({ itemId, variationId, threadId, cioClient, param
37
41
  .finally(() => {
38
42
  setIsLoading(false);
39
43
  });
40
- // eslint-disable-next-line react-hooks/exhaustive-deps -- primitive dep prevents refetch on object reference change
41
- }, [cioClient, itemId, variationId, threadId, parameters === null || parameters === void 0 ? void 0 : parameters.numResults]);
44
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- primitive deps prevent refetch loop
45
+ }, [cioClient, itemId, variationId, threadId, parameters === null || parameters === void 0 ? void 0 : parameters.numResults, requestParametersKey]);
42
46
  (0, react_1.useEffect)(() => {
43
47
  fetchResult();
44
48
  }, [fetchResult]);
package/lib/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderMarkdown = exports.sanitizeHtml = exports.CioPia = void 0;
3
+ exports.AgentRequestError = exports.renderMarkdown = exports.sanitizeHtml = exports.CioPia = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const CioPia_1 = tslib_1.__importDefault(require("./components/CioPia"));
6
6
  // Components
@@ -10,6 +10,9 @@ Object.defineProperty(exports, "CioPia", { enumerable: true, get: function () {
10
10
  var contentTransformers_1 = require("./utils/contentTransformers");
11
11
  Object.defineProperty(exports, "sanitizeHtml", { enumerable: true, get: function () { return contentTransformers_1.sanitizeHtml; } });
12
12
  Object.defineProperty(exports, "renderMarkdown", { enumerable: true, get: function () { return contentTransformers_1.renderMarkdown; } });
13
+ // Errors
14
+ var errors_1 = require("./errors");
15
+ Object.defineProperty(exports, "AgentRequestError", { enumerable: true, get: function () { return errors_1.AgentRequestError; } });
13
16
  // Default
14
17
  tslib_1.__exportStar(require("./types"), exports);
15
18
  exports.default = CioPia_1.default;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformResultItem = void 0;
3
+ exports.extractAndTransformItems = exports.transformResultItem = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  /**
6
6
  * Converts a raw ApiItem from the Get Answers API response into an Item object
@@ -35,3 +35,24 @@ function transformResultItem(resultItem, formatImageUrl) {
35
35
  badge, data: Object.assign({}, otherMetadataFields) }, otherFields);
36
36
  }
37
37
  exports.transformResultItem = transformResultItem;
38
+ /**
39
+ * Pulls the product results out of an answers response and converts them to Items.
40
+ *
41
+ * Returns `null` rather than an empty array whenever there is nothing to render, so callers
42
+ * can treat "no products" as a single case.
43
+ */
44
+ function extractAndTransformItems(data, formatImageUrl) {
45
+ var _a, _b;
46
+ if (!((_b = (_a = data === null || data === void 0 ? void 0 : data.item_results) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.results)) {
47
+ return null;
48
+ }
49
+ const { results } = data.item_results.response;
50
+ if (!Array.isArray(results) || results.length === 0) {
51
+ return null;
52
+ }
53
+ const transformedItems = results
54
+ .map((item) => transformResultItem(item, formatImageUrl))
55
+ .filter((item) => item !== null);
56
+ return transformedItems.length > 0 ? transformedItems : null;
57
+ }
58
+ exports.extractAndTransformItems = extractAndTransformItems;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '2.10.1';
3
+ exports.default = '2.10.3';
@@ -15,7 +15,7 @@ import PiaModal from '../PiaConversation/PiaModal';
15
15
  import PiaConversation from '../PiaConversation/PiaConversation';
16
16
  // eslint-disable-next-line complexity
17
17
  export default function CioPia(props) {
18
- const { apiKey, itemId, itemName, threadId, variationId, cioClient, displayConfigs, componentOverrides, callbacks, formatters, productCardProps, children, translations, suggestedQuestionsParameters, } = props;
18
+ const { apiKey, itemId, itemName, threadId, variationId, cioClient, displayConfigs, componentOverrides, callbacks, formatters, productCardProps, children, translations, suggestedQuestionsParameters, parameters, } = props;
19
19
  const { learnMoreUrl, showFeedback, mode = 'default', type = 'inline', showPreviousItems, disclaimerPosition = 'bottom', } = displayConfigs || {};
20
20
  const isConversation = mode === 'conversation' || type === 'modal';
21
21
  const { priceCurrency } = productCardProps || {};
@@ -26,6 +26,7 @@ export default function CioPia(props) {
26
26
  variationId,
27
27
  cioClient,
28
28
  suggestedQuestionsParameters,
29
+ parameters,
29
30
  formatImageUrl: formatters?.formatImageUrl,
30
31
  });
31
32
  const tracking = useTracking({
@@ -88,7 +89,7 @@ export default function CioPia(props) {
88
89
  return (React.createElement("div", { ref: containerRef, className: 'cio-pia-container', "data-testid": 'cio-pia-container' },
89
90
  React.createElement(RenderPropsWrapper, { props: renderProps, override: children || componentOverrides?.reactNode },
90
91
  React.createElement("p", { className: 'cio-pia-title', "data-testid": 'cio-pia-title' }, translate('Any questions about this product?', translations)),
91
- React.createElement(Input, { onSubmit: handleSubmitQuestion, onFocus: handleInputFocus, value: currentQuestion, translations: translations }),
92
+ React.createElement(Input, { onSubmit: handleSubmitQuestion, onFocus: handleInputFocus, value: currentQuestion, translations: translations, componentOverride: componentOverrides?.input }),
92
93
  isLoading && React.createElement(LoadingSkeleton, { componentOverride: componentOverrides?.loading }),
93
94
  !isLoading && error && React.createElement(ErrorBlock, { message: error?.message || 'Unexpected error' }),
94
95
  !isLoading && !error && (React.createElement(React.Fragment, null,
@@ -1,39 +1,43 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useCallback, useEffect, useState } from 'react';
2
+ import { RenderPropsWrapper, } from '@constructor-io/constructorio-ui-components';
2
3
  import { translate } from '../../utils/translate';
3
- function SendIcon() {
4
- return (React.createElement("svg", { width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
5
- React.createElement("g", { id: '.icon-send' },
6
- React.createElement("path", { id: 'Vector', d: 'M14.8934 7.09533L14.8884 7.09314L1.54219 1.55752C1.42993 1.51053 1.30778 1.49211 1.18666 1.50388C1.06554 1.51566 0.949225 1.55728 0.848125 1.62502C0.741311 1.69501 0.653573 1.79045 0.592805 1.90277C0.532037 2.01509 0.500145 2.14075 0.5 2.26845V5.80877C0.50006 5.98335 0.561019 6.15243 0.67237 6.28689C0.783722 6.42134 0.938491 6.51274 1.11 6.54533L8.38906 7.89127C8.41767 7.89669 8.44348 7.91193 8.46205 7.93435C8.48062 7.95677 8.49078 7.98497 8.49078 8.01408C8.49078 8.04319 8.48062 8.07139 8.46205 8.09381C8.44348 8.11623 8.41767 8.13147 8.38906 8.13689L1.11031 9.48283C0.938851 9.51533 0.784092 9.60661 0.67269 9.74094C0.561288 9.87528 0.500219 10.0443 0.5 10.2188V13.7597C0.499917 13.8816 0.530111 14.0017 0.587871 14.1091C0.645632 14.2165 0.729152 14.3079 0.830938 14.375C0.953375 14.4564 1.09706 14.4998 1.24406 14.5C1.34626 14.4999 1.4474 14.4794 1.54156 14.4397L14.8875 8.93564L14.8934 8.93283C15.0731 8.85563 15.2262 8.72745 15.3337 8.56415C15.4413 8.40086 15.4986 8.20961 15.4986 8.01408C15.4986 7.81855 15.4413 7.6273 15.3337 7.46401C15.2262 7.30071 15.0731 7.17253 14.8934 7.09533Z', fill: 'white' }))));
7
- }
8
- function Input({ value: providedValue, placeholder, disabled = false, onSubmit, onFocus, translations, }) {
4
+ import { SendIcon } from '../icons';
5
+ function Input({ value: providedValue, placeholder, disabled = false, onSubmit, onFocus, translations, componentOverride, }) {
9
6
  const [value, setValue] = useState(providedValue || '');
10
7
  useEffect(() => {
11
8
  if (providedValue) {
12
9
  setValue(providedValue);
13
10
  }
14
11
  }, [providedValue]);
15
- const handleSubmit = () => {
16
- if (value.trim()) {
17
- onSubmit(value.trim());
18
- if (value.trim() !== providedValue) {
12
+ const handleSubmit = useCallback((submittedValue) => {
13
+ if (submittedValue.trim()) {
14
+ onSubmit(submittedValue.trim());
15
+ if (submittedValue.trim() !== providedValue) {
19
16
  setValue('');
20
17
  }
21
18
  }
22
- };
19
+ }, [onSubmit, providedValue]);
23
20
  const handleSubmitOnEnter = (e) => {
24
21
  if (e.key === 'Enter') {
25
22
  e.preventDefault();
26
- handleSubmit();
23
+ handleSubmit(value);
27
24
  }
28
25
  };
29
26
  // Priority: translations > placeholder prop > default
30
27
  const resolvedPlaceholder = translations?.['Ask anything'] !== undefined
31
28
  ? translate('Ask anything', translations)
32
29
  : (placeholder ?? translate('Ask anything'));
33
- return (React.createElement("div", { className: 'cio-pia-input-container' },
34
- React.createElement("input", { type: 'text', value: value, onChange: (e) => setValue(e.target.value), onKeyDown: handleSubmitOnEnter, onFocus: onFocus, placeholder: resolvedPlaceholder, disabled: disabled, className: 'cio-pia-input' }),
35
- React.createElement("button", { type: 'button', onClick: handleSubmit, className: 'cio-pia-send-button', disabled: disabled },
36
- translate('Send', translations),
37
- React.createElement(SendIcon, null))));
30
+ return (React.createElement(RenderPropsWrapper, { props: {
31
+ disabled,
32
+ placeholder: resolvedPlaceholder,
33
+ onSubmit: handleSubmit,
34
+ onFocus,
35
+ translations,
36
+ }, override: componentOverride?.reactNode },
37
+ React.createElement("div", { className: 'cio-pia-input-container' },
38
+ React.createElement("input", { type: 'text', value: value, onChange: (e) => setValue(e.target.value), onKeyDown: handleSubmitOnEnter, onFocus: onFocus, placeholder: resolvedPlaceholder, disabled: disabled, className: 'cio-pia-input' }),
39
+ React.createElement("button", { type: 'button', onClick: () => handleSubmit(value), className: 'cio-pia-send-button', disabled: disabled },
40
+ translate('Send', translations),
41
+ React.createElement(SendIcon, null)))));
38
42
  }
39
43
  export default Input;
@@ -12,5 +12,5 @@ export default function PiaConversation({ conversationHistory, isLoading, error,
12
12
  React.createElement("div", { className: 'cio-pia-conversation-footer' },
13
13
  isLoading && !error && React.createElement(SuggestedQuestionsSkeleton, null),
14
14
  !isLoading && !error && (React.createElement(SuggestedQuestionsContainer, { questions: displayedQuestions, onQuestionClick: handleQuestionClick, componentOverride: componentOverrides?.suggestedQuestions })),
15
- React.createElement(Input, { onSubmit: handleSubmitQuestion, onFocus: onInputFocus, disabled: isLoading, translations: translations }))));
15
+ React.createElement(Input, { onSubmit: handleSubmitQuestion, onFocus: onInputFocus, disabled: isLoading, translations: translations, componentOverride: componentOverrides?.input }))));
16
16
  }
@@ -64,7 +64,7 @@ export default function PiaModal({ initialQuestions, handleSubmitQuestion, handl
64
64
  React.createElement("p", { className: 'cio-pia-title', "data-testid": 'cio-pia-title' }, translate('Any questions about this product?', translations)),
65
65
  React.createElement("div", { className: 'cio-pia-conversation-footer' },
66
66
  initialQuestions.length > 0 && (React.createElement(SuggestedQuestionsContainer, { questions: initialQuestions, onQuestionClick: handleQuestionClicked, componentOverride: componentOverrides?.suggestedQuestions })),
67
- React.createElement(Input, { onSubmit: handleQuestion, onFocus: onInputFocus, disabled: isLoading || isOpen, translations: translations })),
67
+ React.createElement(Input, { onSubmit: handleQuestion, onFocus: onInputFocus, disabled: isLoading || isOpen, translations: translations, componentOverride: componentOverrides?.input })),
68
68
  React.createElement("dialog", { ref: dialogRef, className: 'cio-pia-modal', "aria-labelledby": 'cio-pia-modal-title' },
69
69
  React.createElement("div", { className: 'cio-pia-modal-content' },
70
70
  React.createElement("div", { className: 'cio-pia-modal-header' },
@@ -1,13 +1,9 @@
1
1
  import React from 'react';
2
- function QuestionSvg() {
3
- return (React.createElement("div", { className: 'cio-pia-suggested-question-icon' },
4
- React.createElement("svg", { width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
5
- React.createElement("g", { id: 'help' },
6
- React.createElement("path", { id: 'Vector', d: 'M8.00004 1.33331C4.32004 1.33331 1.33337 4.31998 1.33337 7.99998C1.33337 11.68 4.32004 14.6666 8.00004 14.6666C11.68 14.6666 14.6667 11.68 14.6667 7.99998C14.6667 4.31998 11.68 1.33331 8.00004 1.33331ZM8.66671 12.6666H7.33337V11.3333H8.66671V12.6666ZM10.0467 7.49998L9.44671 8.11331C8.96671 8.59998 8.66671 8.99998 8.66671 9.99998H7.33337V9.66665C7.33337 8.93331 7.63337 8.26665 8.11337 7.77998L8.94004 6.93998C9.18671 6.69998 9.33337 6.36665 9.33337 5.99998C9.33337 5.26665 8.73337 4.66665 8.00004 4.66665C7.26671 4.66665 6.66671 5.26665 6.66671 5.99998H5.33337C5.33337 4.52665 6.52671 3.33331 8.00004 3.33331C9.47337 3.33331 10.6667 4.52665 10.6667 5.99998C10.6667 6.58665 10.4267 7.11998 10.0467 7.49998Z', fill: '#0F1324', fillOpacity: '0.6' })))));
7
- }
2
+ import { QuestionIcon } from '../icons';
8
3
  function SuggestedQuestion({ question, onClick }) {
9
4
  return (React.createElement("button", { type: 'button', className: 'cio-pia-suggested-question', onClick: onClick },
10
- React.createElement(QuestionSvg, null),
5
+ React.createElement("div", { className: 'cio-pia-suggested-question-icon' },
6
+ React.createElement(QuestionIcon, null)),
11
7
  question));
12
8
  }
13
9
  export default SuggestedQuestion;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export default function QuestionIcon() {
3
+ return (React.createElement("svg", { "aria-hidden": 'true', width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
4
+ React.createElement("path", { d: 'M8.00004 1.33331C4.32004 1.33331 1.33337 4.31998 1.33337 7.99998C1.33337 11.68 4.32004 14.6666 8.00004 14.6666C11.68 14.6666 14.6667 11.68 14.6667 7.99998C14.6667 4.31998 11.68 1.33331 8.00004 1.33331ZM8.66671 12.6666H7.33337V11.3333H8.66671V12.6666ZM10.0467 7.49998L9.44671 8.11331C8.96671 8.59998 8.66671 8.99998 8.66671 9.99998H7.33337V9.66665C7.33337 8.93331 7.63337 8.26665 8.11337 7.77998L8.94004 6.93998C9.18671 6.69998 9.33337 6.36665 9.33337 5.99998C9.33337 5.26665 8.73337 4.66665 8.00004 4.66665C7.26671 4.66665 6.66671 5.26665 6.66671 5.99998H5.33337C5.33337 4.52665 6.52671 3.33331 8.00004 3.33331C9.47337 3.33331 10.6667 4.52665 10.6667 5.99998C10.6667 6.58665 10.4267 7.11998 10.0467 7.49998Z', fill: '#0F1324', fillOpacity: '0.6' })));
5
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export default function SendIcon() {
3
+ return (React.createElement("svg", { "aria-hidden": 'true', width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
4
+ React.createElement("path", { d: 'M14.8934 7.09533L14.8884 7.09314L1.54219 1.55752C1.42993 1.51053 1.30778 1.49211 1.18666 1.50388C1.06554 1.51566 0.949225 1.55728 0.848125 1.62502C0.741311 1.69501 0.653573 1.79045 0.592805 1.90277C0.532037 2.01509 0.500145 2.14075 0.5 2.26845V5.80877C0.50006 5.98335 0.561019 6.15243 0.67237 6.28689C0.783722 6.42134 0.938491 6.51274 1.11 6.54533L8.38906 7.89127C8.41767 7.89669 8.44348 7.91193 8.46205 7.93435C8.48062 7.95677 8.49078 7.98497 8.49078 8.01408C8.49078 8.04319 8.48062 8.07139 8.46205 8.09381C8.44348 8.11623 8.41767 8.13147 8.38906 8.13689L1.11031 9.48283C0.938851 9.51533 0.784092 9.60661 0.67269 9.74094C0.561288 9.87528 0.500219 10.0443 0.5 10.2188V13.7597C0.499917 13.8816 0.530111 14.0017 0.587871 14.1091C0.645632 14.2165 0.729152 14.3079 0.830938 14.375C0.953375 14.4564 1.09706 14.4998 1.24406 14.5C1.34626 14.4999 1.4474 14.4794 1.54156 14.4397L14.8875 8.93564L14.8934 8.93283C15.0731 8.85563 15.2262 8.72745 15.3337 8.56415C15.4413 8.40086 15.4986 8.20961 15.4986 8.01408C15.4986 7.81855 15.4413 7.6273 15.3337 7.46401C15.2262 7.30071 15.0731 7.17253 14.8934 7.09533Z', fill: 'white' })));
5
+ }
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export default function SparklesIcon() {
3
+ return (React.createElement("svg", { "aria-hidden": 'true', width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
4
+ React.createElement("path", { d: 'M12.6667 6.0013L13.5001 4.16797L15.3334 3.33464L13.5001 2.5013L12.6667 0.667969L11.8334 2.5013L10.0001 3.33464L11.8334 4.16797L12.6667 6.0013Z', fill: '#1C1917' }),
5
+ React.createElement("path", { d: 'M12.6667 10.0013L11.8334 11.8346L10.0001 12.668L11.8334 13.5013L12.6667 15.3346L13.5001 13.5013L15.3334 12.668L13.5001 11.8346L12.6667 10.0013Z', fill: '#1C1917' }),
6
+ React.createElement("path", { d: 'M7.66675 6.33464L6.00008 2.66797L4.33341 6.33464L0.666748 8.0013L4.33341 9.66797L6.00008 13.3346L7.66675 9.66797L11.3334 8.0013L7.66675 6.33464ZM6.66008 8.6613L6.00008 10.1146L5.34008 8.6613L3.88675 8.0013L5.34008 7.3413L6.00008 5.88797L6.66008 7.3413L8.11341 8.0013L6.66008 8.6613Z', fill: '#1C1917' })));
7
+ }