oa-componentbook 0.18.384 → 0.18.386

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/build/index.js CHANGED
@@ -401,6 +401,12 @@ Object.defineProperty(exports, "FeedbackWidget", {
401
401
  return _FeedbackWidget.default;
402
402
  }
403
403
  });
404
+ Object.defineProperty(exports, "FeedbackWidget1", {
405
+ enumerable: true,
406
+ get: function get() {
407
+ return _FeedbackWidget2.default;
408
+ }
409
+ });
404
410
  Object.defineProperty(exports, "GenericUpload", {
405
411
  enumerable: true,
406
412
  get: function get() {
@@ -754,6 +760,7 @@ var _NotesWidget = _interopRequireDefault(require("./widgets/oa-widget-notes/Not
754
760
  var _PlanCard = _interopRequireDefault(require("./widgets/oa-widget-plan-card/PlanCard"));
755
761
  var _CustomerRatingCard = _interopRequireDefault(require("./widgets/oa-widget-customer-rating-card/CustomerRatingCard"));
756
762
  var _FeedbackWidget = _interopRequireDefault(require("./widgets/oa-widget-feedback/FeedbackWidget"));
763
+ var _FeedbackWidget2 = _interopRequireDefault(require("./widgets/oa-widget-feedback/FeedbackWidget1"));
757
764
  var _ReimbursementBreakupWidget = _interopRequireDefault(require("./widgets/oa-widget-reimbursement-breakup/ReimbursementBreakupWidget"));
758
765
  var _SendPaymentLinkWidget = _interopRequireDefault(require("./widgets/oa-widget-send-payment-link/SendPaymentLinkWidget"));
759
766
  var _SparePartsWidget = _interopRequireDefault(require("./widgets/oa-widget-spare-part/SparePartsWidget"));
@@ -41,6 +41,7 @@ var _FilterListRounded = _interopRequireDefault(require("@material-ui/icons/Filt
41
41
  var _MoreVert = _interopRequireDefault(require("@material-ui/icons/MoreVert"));
42
42
  var _CustomDropdown = _interopRequireDefault(require("../../components/oa-component-dropdown/CustomDropdown"));
43
43
  var _CustomInfo = _interopRequireDefault(require("../../components/oa-component-info/CustomInfo"));
44
+ var _FeedbackWidget = _interopRequireDefault(require("../../widgets/oa-widget-feedback/FeedbackWidget1"));
44
45
  const _excluded = ["filteredValue"],
45
46
  _excluded2 = ["sortOrder"];
46
47
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -90,11 +91,14 @@ function GenricLayOut(_ref) {
90
91
  handleRightHeaderButtonClick,
91
92
  handleDownloadTemplate,
92
93
  handleCtaDownload,
93
- handleTabExtraActionChange
94
+ handleTabExtraActionChange,
95
+ handleFeedbackWidgetSubmit,
96
+ handleFeedbackQuestionsList
94
97
  } = {}
95
98
  } = _ref;
96
99
  const [state, dispatch] = (0, _react.useReducer)(_layoutReducer.genericLayoutReducer, config !== null && config !== void 0 ? config : _layoutReducer.initialState);
97
100
  const [headerButtons, setHeaderButtons] = (0, _react.useState)(null);
101
+ const [feedbackWidgetVisible, setFeedbackWidgetVisible] = (0, _react.useState)(false);
98
102
  const stateRef = (0, _react.useRef)(state);
99
103
  const notificationRef = (0, _react.useRef)(null);
100
104
  const openNotification = (0, _react.useCallback)(params => notificationRef.current.openNotification(params), []);
@@ -119,7 +123,8 @@ function GenricLayOut(_ref) {
119
123
  staticFilter,
120
124
  profileData,
121
125
  infoPanel,
122
- infoData
126
+ infoData,
127
+ feedbackWidget
123
128
  } = state !== null && state !== void 0 ? state : {};
124
129
  (0, _react.useEffect)(() => {
125
130
  init();
@@ -127,6 +132,36 @@ function GenricLayOut(_ref) {
127
132
  (0, _react.useEffect)(() => {
128
133
  stateRef.current = state;
129
134
  }, [state]);
135
+ (0, _react.useEffect)(() => {
136
+ if (typeof (feedbackWidget === null || feedbackWidget === void 0 ? void 0 : feedbackWidget.visible) === "boolean") {
137
+ setFeedbackWidgetVisible(feedbackWidget.visible);
138
+ }
139
+ }, [feedbackWidget === null || feedbackWidget === void 0 ? void 0 : feedbackWidget.visible]);
140
+ (0, _react.useEffect)(() => {
141
+ if (!feedbackWidgetVisible || !handleFeedbackQuestionsList) return;
142
+ const fetchFeedbackQuestions = async () => {
143
+ try {
144
+ var _response$data;
145
+ const response = await handleFeedbackQuestionsList(config === null || config === void 0 ? void 0 : config.misc);
146
+ const error = response === null || response === void 0 ? void 0 : response.error;
147
+ const data = (_response$data = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data !== void 0 ? _response$data : response;
148
+ if (!error && data && typeof data === "object") {
149
+ dispatch({
150
+ type: _layoutReducer.actionTypes.SET_FEEDBACK_WIDGET_SURVEY_CONFIG,
151
+ payload: data
152
+ });
153
+ }
154
+ } catch (err) {
155
+ // silently handle error
156
+ }
157
+ };
158
+ fetchFeedbackQuestions();
159
+ }, [feedbackWidgetVisible]);
160
+ const handleFeedbackWidgetSubmitWithClose = (0, _react.useCallback)(async payload => {
161
+ if (handleFeedbackWidgetSubmit) {
162
+ await handleFeedbackWidgetSubmit(payload);
163
+ }
164
+ }, [handleFeedbackWidgetSubmit]);
130
165
  (0, _react.useEffect)(() => {
131
166
  const observer = new MutationObserver(e => {
132
167
  const parent = document.querySelector(".oaheaderButtons");
@@ -2737,7 +2772,12 @@ function GenricLayOut(_ref) {
2737
2772
  handleSwitchSelectItem: handleSwitchSelectItem
2738
2773
  }))), /*#__PURE__*/_react.default.createElement(_CustomNotification.default, {
2739
2774
  ref: notificationRef
2740
- }))));
2775
+ }), (feedbackWidget === null || feedbackWidget === void 0 ? void 0 : feedbackWidget.enabled) !== false && /*#__PURE__*/_react.default.createElement(_FeedbackWidget.default, _extends({}, feedbackWidget, {
2776
+ visible: feedbackWidgetVisible,
2777
+ setVisible: setFeedbackWidgetVisible,
2778
+ onSubmit: (feedbackWidget === null || feedbackWidget === void 0 ? void 0 : feedbackWidget.onSubmit) || handleFeedbackWidgetSubmitWithClose,
2779
+ feedbackQuestionsList: handleFeedbackQuestionsList
2780
+ })))));
2741
2781
  }
2742
2782
  GenricLayOut.propTypes = {};
2743
2783
  GenricLayOut.defaultProps = {};
@@ -60,7 +60,8 @@ const actionTypes = exports.actionTypes = {
60
60
  CHANGE_ROW: "CHANGE_ROW",
61
61
  SET_TABS_EXTRA_ACTION_CHECKED: "SET_TABS_EXTRA_ACTION_CHECKED",
62
62
  SET_TABS_EXTRA_ACTION: "SET_TABS_EXTRA_ACTION",
63
- SET_INFO_DATA: "SET_INFO_DATA"
63
+ SET_INFO_DATA: "SET_INFO_DATA",
64
+ SET_FEEDBACK_WIDGET_SURVEY_CONFIG: "SET_FEEDBACK_WIDGET_SURVEY_CONFIG"
64
65
  };
65
66
  function getFieldDefaultValue(widget) {
66
67
  switch (widget) {
@@ -322,6 +323,11 @@ const genericLayoutReducer = exports.genericLayoutReducer = (0, _immer.produce)(
322
323
  draft.infoData = _objectSpread(_objectSpread({}, draft.infoData), action.payload);
323
324
  }
324
325
  break;
326
+ case actionTypes.SET_FEEDBACK_WIDGET_SURVEY_CONFIG:
327
+ if (draft.feedbackWidget && action.payload) {
328
+ draft.feedbackWidget.surveyConfig = action.payload;
329
+ }
330
+ break;
325
331
  default:
326
332
  break;
327
333
  }
@@ -0,0 +1,655 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.symbol.description.js");
4
+ require("core-js/modules/es.weak-map.js");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ require("core-js/modules/web.dom-collections.iterator.js");
10
+ require("core-js/modules/es.array.includes.js");
11
+ require("core-js/modules/es.string.includes.js");
12
+ require("core-js/modules/es.promise.js");
13
+ require("core-js/modules/web.url-search-params.js");
14
+ var _react = _interopRequireWildcard(require("react"));
15
+ var _antd = require("antd");
16
+ var _ThumbUpOutlined = _interopRequireDefault(require("@material-ui/icons/ThumbUpOutlined"));
17
+ var _ThumbDownOutlined = _interopRequireDefault(require("@material-ui/icons/ThumbDownOutlined"));
18
+ var _CheckCircle = _interopRequireDefault(require("@material-ui/icons/CheckCircle"));
19
+ var _CustomModal = _interopRequireDefault(require("../../components/oa-component-modal/CustomModal"));
20
+ var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
21
+ var _CustomButton = _interopRequireDefault(require("../../components/oa-component-button/CustomButton"));
22
+ var _CustomTextArea = _interopRequireDefault(require("../../components/oa-component-textarea/CustomTextArea"));
23
+ var _CustomCheckBox = _interopRequireDefault(require("../../components/oa-component-checkbox/CustomCheckBox"));
24
+ var _MaterialIcon = _interopRequireDefault(require("../../components/oa-component-icons/MaterialIcon"));
25
+ var _FeedbackWidget1Style = require("./FeedbackWidget1Style");
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
28
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
29
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
30
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
31
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
32
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
33
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /* eslint-disable */
34
+ const toArray = value => Array.isArray(value) ? value : value == null ? [] : [value];
35
+ function FeedbackWidget1(props) {
36
+ var _surveyConfig$questio, _surveyConfig$questio2, _surveyConfig$questio3, _surveyConfig$questio4, _singleChoiceQuestion, _multiChoiceQuestions, _singleChoiceQ$option, _singleChoiceQ$option2, _singleChoiceQ$questi, _positiveOption$optio, _negativeOption$optio, _positiveOption$id, _negativeOption$id, _multiChoiceQ$questio, _multiChoiceQ$options, _multiChoiceQ$options2, _surveyConfig$categor, _choicesState$singleC;
37
+ const {
38
+ surveyConfig = null,
39
+ visible = false,
40
+ setVisible = () => {},
41
+ hideButton = false,
42
+ title = 'Help us make your experience better',
43
+ subTitle = '',
44
+ question = 'How was your experience completing the task?',
45
+ checkboxOptions = [],
46
+ formConfig = {},
47
+ positiveButtonLabel = 'Easy',
48
+ negativeButtonLabel = 'Difficult',
49
+ improvementsQuestion = 'Which part did you face issues with?',
50
+ othersSpecifyLabel = 'Others (Please specify)',
51
+ othersSpecifyPlaceholder = 'Please provide details of what went wrong.',
52
+ commentLabel = 'Leave a comment (Optional)',
53
+ commentPlaceholder = 'Tell us your feedback',
54
+ positiveCommentLabel = 'Leave a comment (Optional)',
55
+ negativeCommentLabel = 'Tell us more (if anything was confusing):',
56
+ positiveCommentPlaceholder = 'Tell us your feedback',
57
+ negativeCommentPlaceholder = "What didn't make sense or took longer than expected?",
58
+ consentLabel = 'I understand that my feedback may be used by OneAssist to improve the overall experience.',
59
+ thankYouTitle = 'Thank you for your time!',
60
+ thankYouMessage = 'We will get back to you if needed.',
61
+ mandatoryQuestionError = 'This is a mandatory question.',
62
+ consentError = 'Please provide your consent to continue.',
63
+ feedbackButtonLabel = 'Feedback',
64
+ submitButtonLabel = 'Submit',
65
+ othersOptionValue = 'Others',
66
+ positiveChoiceValue = 'Yes',
67
+ negativeChoiceValue = 'No',
68
+ userDataStorageKey = 'userData',
69
+ modalWidth = 427,
70
+ onSubmit,
71
+ onSuccess,
72
+ onError,
73
+ showThankYouState = true
74
+ } = props !== null && props !== void 0 ? props : {};
75
+
76
+ // ── Derive question arrays from surveyConfig ──
77
+ const singleChoiceQuestions = (_surveyConfig$questio = surveyConfig === null || surveyConfig === void 0 || (_surveyConfig$questio2 = surveyConfig.questions) === null || _surveyConfig$questio2 === void 0 ? void 0 : _surveyConfig$questio2.filter(q => q.questionType === 'SINGLE_CHOICE')) !== null && _surveyConfig$questio !== void 0 ? _surveyConfig$questio : [];
78
+ const multiChoiceQuestions = (_surveyConfig$questio3 = surveyConfig === null || surveyConfig === void 0 || (_surveyConfig$questio4 = surveyConfig.questions) === null || _surveyConfig$questio4 === void 0 ? void 0 : _surveyConfig$questio4.filter(q => q.questionType === 'MULTI_CHOICE')) !== null && _surveyConfig$questio3 !== void 0 ? _surveyConfig$questio3 : [];
79
+
80
+ // ── Legacy single-question refs (first of each type, for backward compat) ──
81
+ const singleChoiceQ = (_singleChoiceQuestion = singleChoiceQuestions[0]) !== null && _singleChoiceQuestion !== void 0 ? _singleChoiceQuestion : null;
82
+ const multiChoiceQ = (_multiChoiceQuestions = multiChoiceQuestions[0]) !== null && _multiChoiceQuestions !== void 0 ? _multiChoiceQuestions : null;
83
+ const positiveOption = singleChoiceQ === null || singleChoiceQ === void 0 || (_singleChoiceQ$option = singleChoiceQ.options) === null || _singleChoiceQ$option === void 0 ? void 0 : _singleChoiceQ$option[0];
84
+ const negativeOption = singleChoiceQ === null || singleChoiceQ === void 0 || (_singleChoiceQ$option2 = singleChoiceQ.options) === null || _singleChoiceQ$option2 === void 0 ? void 0 : _singleChoiceQ$option2[1];
85
+
86
+ // ── Resolved values for legacy/single-question mode ──
87
+ const resolvedQuestion = (_singleChoiceQ$questi = singleChoiceQ === null || singleChoiceQ === void 0 ? void 0 : singleChoiceQ.question) !== null && _singleChoiceQ$questi !== void 0 ? _singleChoiceQ$questi : question;
88
+ const resolvedPositiveButtonLabel = (_positiveOption$optio = positiveOption === null || positiveOption === void 0 ? void 0 : positiveOption.optionText) !== null && _positiveOption$optio !== void 0 ? _positiveOption$optio : positiveButtonLabel;
89
+ const resolvedNegativeButtonLabel = (_negativeOption$optio = negativeOption === null || negativeOption === void 0 ? void 0 : negativeOption.optionText) !== null && _negativeOption$optio !== void 0 ? _negativeOption$optio : negativeButtonLabel;
90
+ const resolvedPositiveChoiceValue = surveyConfig ? String((_positiveOption$id = positiveOption === null || positiveOption === void 0 ? void 0 : positiveOption.id) !== null && _positiveOption$id !== void 0 ? _positiveOption$id : '') : positiveChoiceValue;
91
+ const resolvedNegativeChoiceValue = surveyConfig ? String((_negativeOption$id = negativeOption === null || negativeOption === void 0 ? void 0 : negativeOption.id) !== null && _negativeOption$id !== void 0 ? _negativeOption$id : '') : negativeChoiceValue;
92
+ const resolvedImprovementsQuestion = (_multiChoiceQ$questio = multiChoiceQ === null || multiChoiceQ === void 0 ? void 0 : multiChoiceQ.question) !== null && _multiChoiceQ$questio !== void 0 ? _multiChoiceQ$questio : improvementsQuestion;
93
+ const resolvedCheckboxOptions = (_multiChoiceQ$options = multiChoiceQ === null || multiChoiceQ === void 0 || (_multiChoiceQ$options2 = multiChoiceQ.options) === null || _multiChoiceQ$options2 === void 0 ? void 0 : _multiChoiceQ$options2.map(o => o.optionText)) !== null && _multiChoiceQ$options !== void 0 ? _multiChoiceQ$options : checkboxOptions;
94
+
95
+ // Show comment textarea only when category.getRemarks is true (or absent), or always for legacy
96
+ const showCommentSection = surveyConfig ? ((_surveyConfig$categor = surveyConfig.category) === null || _surveyConfig$categor === void 0 ? void 0 : _surveyConfig$categor.getRemarks) === true : true;
97
+ const [form] = _antd.Form.useForm();
98
+ const [showThankYou, setShowThankYou] = (0, _react.useState)(false);
99
+
100
+ // ── Legacy state (used when surveyConfig is absent) ──
101
+ const [choice, setChoice] = (0, _react.useState)('');
102
+ const [improvements, setImprovements] = (0, _react.useState)([]);
103
+ const [othersSpecify, setOthersSpecify] = (0, _react.useState)('');
104
+
105
+ // ── Multi-question state (used when surveyConfig is present) ──
106
+ // choicesState: { [questionId]: selectedOptionId (string) }
107
+ // improvementsState: { [questionId]: string[] }
108
+ // othersSpecifyState: { [questionId]: string }
109
+ const [choicesState, setChoicesState] = (0, _react.useState)({});
110
+ const [improvementsState, setImprovementsState] = (0, _react.useState)({});
111
+ const [othersSpecifyState, setOthersSpecifyState] = (0, _react.useState)({});
112
+ const userData = (0, _react.useMemo)(() => {
113
+ try {
114
+ return JSON.parse(localStorage.getItem(userDataStorageKey) || '{}');
115
+ } catch (_unused) {
116
+ return {};
117
+ }
118
+ }, [userDataStorageKey]);
119
+
120
+ // Helpers to get option IDs per question
121
+ const getPositiveOptionId = q => {
122
+ var _q$options$0$id, _q$options;
123
+ return String((_q$options$0$id = q === null || q === void 0 || (_q$options = q.options) === null || _q$options === void 0 || (_q$options = _q$options[0]) === null || _q$options === void 0 ? void 0 : _q$options.id) !== null && _q$options$0$id !== void 0 ? _q$options$0$id : '');
124
+ };
125
+ const getNegativeOptionId = q => {
126
+ var _q$options$1$id, _q$options2;
127
+ return String((_q$options$1$id = q === null || q === void 0 || (_q$options2 = q.options) === null || _q$options2 === void 0 || (_q$options2 = _q$options2[1]) === null || _q$options2 === void 0 ? void 0 : _q$options2.id) !== null && _q$options$1$id !== void 0 ? _q$options$1$id : '');
128
+ };
129
+
130
+ // True when ANY SINGLE_CHOICE question has its negative option selected
131
+ const anyNegativeSelected = singleChoiceQuestions.some(q => choicesState[q.id] === getNegativeOptionId(q));
132
+ const hasOthersSelected = improvements.includes(othersOptionValue);
133
+ const resetFormState = () => {
134
+ form.resetFields();
135
+ setChoice('');
136
+ setImprovements([]);
137
+ setOthersSpecify('');
138
+ setChoicesState({});
139
+ setImprovementsState({});
140
+ setOthersSpecifyState({});
141
+ };
142
+ (0, _react.useEffect)(() => {
143
+ if (!visible) {
144
+ resetFormState();
145
+ setShowThankYou(false);
146
+ }
147
+ }, [visible]);
148
+ (0, _react.useEffect)(() => {
149
+ if (!showThankYou) return;
150
+ const timer = setTimeout(() => {
151
+ setVisible(false);
152
+ setShowThankYou(false);
153
+ }, 3000);
154
+ return () => clearTimeout(timer);
155
+ }, [showThankYou]);
156
+
157
+ // ── Build payload for surveyConfig (multi-question) mode ──────────────────
158
+ const buildSurveyPayload = _ref => {
159
+ let {
160
+ comment,
161
+ consent
162
+ } = _ref;
163
+ const responses = [];
164
+ for (const q of (_surveyConfig$questio5 = surveyConfig === null || surveyConfig === void 0 ? void 0 : surveyConfig.questions) !== null && _surveyConfig$questio5 !== void 0 ? _surveyConfig$questio5 : []) {
165
+ var _surveyConfig$questio5;
166
+ if (q.questionType === 'SINGLE_CHOICE') {
167
+ const selectedOption = q.options.find(o => String(o.id) === choicesState[q.id]);
168
+ responses.push({
169
+ questionId: q.id,
170
+ questionType: q.questionType,
171
+ selectedOptions: selectedOption ? [selectedOption] : []
172
+ });
173
+ } else if (q.questionType === 'MULTI_CHOICE') {
174
+ const qImprovements = improvementsState[q.id] || [];
175
+ const selectedOptions = q.options.filter(o => qImprovements.includes(o.optionText));
176
+ const qOthersSpecify = othersSpecifyState[q.id] || '';
177
+ const hasOthers = qImprovements.includes(othersOptionValue);
178
+ responses.push(_objectSpread({
179
+ questionId: q.id,
180
+ questionType: q.questionType,
181
+ selectedOptions
182
+ }, hasOthers && qOthersSpecify ? {
183
+ othersSpecify: qOthersSpecify
184
+ } : {}));
185
+ }
186
+ }
187
+ return _objectSpread(_objectSpread({
188
+ category: surveyConfig.category,
189
+ responses
190
+ }, showCommentSection ? {
191
+ remarks: comment || ''
192
+ } : {}), {}, {
193
+ consent,
194
+ userData
195
+ });
196
+ };
197
+
198
+ // ── Legacy form-POST submission ───────────────────────────────────────────
199
+ const defaultSubmit = async _ref2 => {
200
+ let {
201
+ choiceValue,
202
+ comment
203
+ } = _ref2;
204
+ const endpoint = formConfig === null || formConfig === void 0 ? void 0 : formConfig.endpoint;
205
+ if (!endpoint) return;
206
+ const formBody = new URLSearchParams();
207
+ const improvementsArray = toArray(improvements);
208
+ const isNegativeChoice = choice === resolvedNegativeChoiceValue;
209
+ const hasOthers = improvementsArray.includes(othersOptionValue);
210
+ if (formConfig.choiceField) {
211
+ formBody.append(formConfig.choiceField, choiceValue);
212
+ }
213
+ if (isNegativeChoice && improvementsArray.length > 0 && formConfig.improvementsField) {
214
+ improvementsArray.forEach(improvement => {
215
+ if (improvement !== othersOptionValue) {
216
+ formBody.append(formConfig.improvementsField, improvement);
217
+ }
218
+ });
219
+ if (hasOthers && othersSpecify) {
220
+ if (formConfig.othersSpecifyField) {
221
+ formBody.append(formConfig.othersSpecifyField, othersSpecify);
222
+ }
223
+ formBody.append(formConfig.improvementsField, '__other_option__');
224
+ }
225
+ }
226
+ if (formConfig.commentField) {
227
+ formBody.append(formConfig.commentField, comment || '');
228
+ }
229
+ if (formConfig.emailidField) {
230
+ formBody.append(formConfig.emailidField, (userData === null || userData === void 0 ? void 0 : userData.emailId) || '');
231
+ }
232
+ if (formConfig.mobileNumField) {
233
+ formBody.append(formConfig.mobileNumField, (userData === null || userData === void 0 ? void 0 : userData.mobileNum) || '');
234
+ }
235
+ await fetch(endpoint, {
236
+ method: 'POST',
237
+ mode: 'no-cors',
238
+ body: formBody
239
+ });
240
+ };
241
+ const handleSubmit = async () => {
242
+ try {
243
+ const values = await form.validateFields();
244
+ const {
245
+ comment
246
+ } = values;
247
+
248
+ // Human-readable label for the selected choice (legacy path only)
249
+ const choiceValue = choice === resolvedPositiveChoiceValue ? resolvedPositiveButtonLabel : choice === resolvedNegativeChoiceValue ? resolvedNegativeButtonLabel : choice || '';
250
+ const payload = surveyConfig ? buildSurveyPayload({
251
+ comment,
252
+ consent: !!(values !== null && values !== void 0 && values.consent)
253
+ }) : {
254
+ choice,
255
+ choiceValue,
256
+ improvements: toArray(improvements),
257
+ othersSpecify,
258
+ comment: comment || '',
259
+ consent: !!(values !== null && values !== void 0 && values.consent),
260
+ userData
261
+ };
262
+ if (onSubmit) {
263
+ await onSubmit(payload);
264
+ } else {
265
+ await defaultSubmit({
266
+ choiceValue,
267
+ comment
268
+ });
269
+ }
270
+ resetFormState();
271
+ if (showThankYouState) {
272
+ setShowThankYou(true);
273
+ } else {
274
+ setVisible(false);
275
+ }
276
+ if (onSuccess) {
277
+ onSuccess(payload);
278
+ }
279
+ } catch (error) {
280
+ if (error !== null && error !== void 0 && error.errorFields) {
281
+ var _error$errorFields$;
282
+ const firstErrorName = (_error$errorFields$ = error.errorFields[0]) === null || _error$errorFields$ === void 0 ? void 0 : _error$errorFields$.name;
283
+ if (firstErrorName) {
284
+ form.scrollToField(firstErrorName, {
285
+ behavior: 'smooth',
286
+ block: 'center'
287
+ });
288
+ }
289
+ return;
290
+ }
291
+ if (onError) onError(error);
292
+ }
293
+ };
294
+
295
+ // ── Legacy handlers ───────────────────────────────────────────────────────
296
+ const handleChoiceChange = newChoice => {
297
+ setChoice(newChoice);
298
+ if (newChoice === resolvedPositiveChoiceValue) {
299
+ setImprovements([]);
300
+ setOthersSpecify('');
301
+ form.setFieldsValue({
302
+ choice: newChoice,
303
+ improvements: [],
304
+ othersSpecify: ''
305
+ });
306
+ return;
307
+ }
308
+ form.setFieldsValue({
309
+ choice: newChoice
310
+ });
311
+ };
312
+ const handleImprovementChange = (option, checked) => {
313
+ const next = checked ? Array.from(new Set([...improvements, option])) : improvements.filter(item => item !== option);
314
+ setImprovements(next);
315
+ form.setFieldsValue({
316
+ improvements: next
317
+ });
318
+ if (option === othersOptionValue && !checked) {
319
+ setOthersSpecify('');
320
+ form.setFieldsValue({
321
+ othersSpecify: ''
322
+ });
323
+ }
324
+ };
325
+ const handleOthersSpecifyChange = event => {
326
+ var _event$target;
327
+ const nextValue = (event === null || event === void 0 || (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value) || '';
328
+ setOthersSpecify(nextValue);
329
+ form.setFieldsValue({
330
+ othersSpecify: nextValue
331
+ });
332
+ };
333
+
334
+ // ── Multi-question handlers ───────────────────────────────────────────────
335
+ const handleMultiChoiceChange = (questionId, positiveOptionId, newChoice) => {
336
+ setChoicesState(prev => _objectSpread(_objectSpread({}, prev), {}, {
337
+ [questionId]: newChoice
338
+ }));
339
+ form.setFieldsValue({
340
+ ["choice_".concat(questionId)]: newChoice
341
+ });
342
+
343
+ // When switching to positive, clear improvements/othersSpecify for all MULTI_CHOICE questions
344
+ if (newChoice === positiveOptionId) {
345
+ const formUpdate = {};
346
+ setImprovementsState(prev => {
347
+ const updated = _objectSpread({}, prev);
348
+ multiChoiceQuestions.forEach(q => {
349
+ updated[q.id] = [];
350
+ formUpdate["improvements_".concat(q.id)] = [];
351
+ formUpdate["othersSpecify_".concat(q.id)] = '';
352
+ });
353
+ return updated;
354
+ });
355
+ setOthersSpecifyState(prev => {
356
+ const updated = _objectSpread({}, prev);
357
+ multiChoiceQuestions.forEach(q => {
358
+ updated[q.id] = '';
359
+ });
360
+ return updated;
361
+ });
362
+ form.setFieldsValue(formUpdate);
363
+ }
364
+ };
365
+ const handleMultiImprovementChange = (questionId, option, checked) => {
366
+ const current = improvementsState[questionId] || [];
367
+ const next = checked ? Array.from(new Set([...current, option])) : current.filter(item => item !== option);
368
+ setImprovementsState(prev => _objectSpread(_objectSpread({}, prev), {}, {
369
+ [questionId]: next
370
+ }));
371
+ form.setFieldsValue({
372
+ ["improvements_".concat(questionId)]: next
373
+ });
374
+ if (option === othersOptionValue && !checked) {
375
+ setOthersSpecifyState(prev => _objectSpread(_objectSpread({}, prev), {}, {
376
+ [questionId]: ''
377
+ }));
378
+ form.setFieldsValue({
379
+ ["othersSpecify_".concat(questionId)]: ''
380
+ });
381
+ }
382
+ };
383
+ const handleMultiOthersSpecifyChange = (questionId, event) => {
384
+ var _event$target2;
385
+ const nextValue = (event === null || event === void 0 || (_event$target2 = event.target) === null || _event$target2 === void 0 ? void 0 : _event$target2.value) || '';
386
+ setOthersSpecifyState(prev => _objectSpread(_objectSpread({}, prev), {}, {
387
+ [questionId]: nextValue
388
+ }));
389
+ form.setFieldsValue({
390
+ ["othersSpecify_".concat(questionId)]: nextValue
391
+ });
392
+ };
393
+ const handleClose = () => {
394
+ setVisible(false);
395
+ resetFormState();
396
+ };
397
+
398
+ // Comment label/placeholder: driven by first SINGLE_CHOICE question in both modes
399
+ const firstChoice = surveyConfig ? (_choicesState$singleC = choicesState[singleChoiceQ === null || singleChoiceQ === void 0 ? void 0 : singleChoiceQ.id]) !== null && _choicesState$singleC !== void 0 ? _choicesState$singleC : '' : choice;
400
+ const firstNegativeId = surveyConfig ? getNegativeOptionId(singleChoiceQ) : resolvedNegativeChoiceValue;
401
+ const firstPositiveId = surveyConfig ? getPositiveOptionId(singleChoiceQ) : resolvedPositiveChoiceValue;
402
+ const resolvedCommentLabel = firstChoice === firstNegativeId ? negativeCommentLabel || commentLabel : firstChoice === firstPositiveId ? positiveCommentLabel || commentLabel : commentLabel;
403
+ const resolvedCommentPlaceholder = firstChoice === firstNegativeId ? negativeCommentPlaceholder || commentPlaceholder : firstChoice === firstPositiveId ? positiveCommentPlaceholder || commentPlaceholder : commentPlaceholder;
404
+
405
+ // ── Render a single SINGLE_CHOICE question ────────────────────────────────
406
+ const renderSingleChoiceQuestion = q => {
407
+ var _q$options3, _q$options4, _positiveOpt$id, _negativeOpt$id, _q$question, _positiveOpt$optionTe, _negativeOpt$optionTe;
408
+ const positiveOpt = (_q$options3 = q.options) === null || _q$options3 === void 0 ? void 0 : _q$options3[0];
409
+ const negativeOpt = (_q$options4 = q.options) === null || _q$options4 === void 0 ? void 0 : _q$options4[1];
410
+ const positiveId = String((_positiveOpt$id = positiveOpt === null || positiveOpt === void 0 ? void 0 : positiveOpt.id) !== null && _positiveOpt$id !== void 0 ? _positiveOpt$id : '');
411
+ const negativeId = String((_negativeOpt$id = negativeOpt === null || negativeOpt === void 0 ? void 0 : negativeOpt.id) !== null && _negativeOpt$id !== void 0 ? _negativeOpt$id : '');
412
+ const currentChoice = choicesState[q.id] || '';
413
+ const isRequired = q.optional !== true;
414
+ return /*#__PURE__*/_react.default.createElement("div", {
415
+ key: q.id,
416
+ className: "margin-bottom-32"
417
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
418
+ typography: "type-t2-700"
419
+ }, (_q$question = q.question) !== null && _q$question !== void 0 ? _q$question : question)), /*#__PURE__*/_react.default.createElement("div", {
420
+ className: "surveyButtonSection"
421
+ }, /*#__PURE__*/_react.default.createElement("div", {
422
+ onClick: () => handleMultiChoiceChange(q.id, positiveId, positiveId),
423
+ className: "surveyBtn ".concat(currentChoice === positiveId ? 'selected' : '')
424
+ }, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
425
+ icon: _ThumbUpOutlined.default,
426
+ size: 24
427
+ }), /*#__PURE__*/_react.default.createElement(_Typography.default, {
428
+ typography: "type-b1-400"
429
+ }, (_positiveOpt$optionTe = positiveOpt === null || positiveOpt === void 0 ? void 0 : positiveOpt.optionText) !== null && _positiveOpt$optionTe !== void 0 ? _positiveOpt$optionTe : positiveButtonLabel)), /*#__PURE__*/_react.default.createElement("div", {
430
+ onClick: () => handleMultiChoiceChange(q.id, positiveId, negativeId),
431
+ className: "surveyBtn ".concat(currentChoice === negativeId ? 'selected' : '')
432
+ }, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
433
+ icon: _ThumbDownOutlined.default,
434
+ size: 24
435
+ }), /*#__PURE__*/_react.default.createElement(_Typography.default, {
436
+ typography: "type-b1-400"
437
+ }, (_negativeOpt$optionTe = negativeOpt === null || negativeOpt === void 0 ? void 0 : negativeOpt.optionText) !== null && _negativeOpt$optionTe !== void 0 ? _negativeOpt$optionTe : negativeButtonLabel))), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
438
+ name: "choice_".concat(q.id),
439
+ initialValue: "",
440
+ rules: [{
441
+ required: isRequired,
442
+ message: mandatoryQuestionError
443
+ }],
444
+ style: {
445
+ marginBottom: 0
446
+ }
447
+ }, /*#__PURE__*/_react.default.createElement("input", {
448
+ type: "hidden"
449
+ })));
450
+ };
451
+
452
+ // ── Render a single MULTI_CHOICE question ─────────────────────────────────
453
+ const renderMultiChoiceQuestion = q => {
454
+ var _q$options$map, _q$options5, _q$question2;
455
+ const qImprovements = improvementsState[q.id] || [];
456
+ const qOthersSpecify = othersSpecifyState[q.id] || '';
457
+ const hasQOthers = qImprovements.includes(othersOptionValue);
458
+ const checkboxOpts = (_q$options$map = (_q$options5 = q.options) === null || _q$options5 === void 0 ? void 0 : _q$options5.map(o => o.optionText)) !== null && _q$options$map !== void 0 ? _q$options$map : [];
459
+ const isRequired = q.optional !== true;
460
+ return /*#__PURE__*/_react.default.createElement("div", {
461
+ key: q.id
462
+ }, checkboxOpts.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
463
+ className: "margin-bottom-32"
464
+ }, /*#__PURE__*/_react.default.createElement("div", {
465
+ className: "margin-bottom-8"
466
+ }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
467
+ color: "primary-content",
468
+ typography: "type-t2-700"
469
+ }, (_q$question2 = q.question) !== null && _q$question2 !== void 0 ? _q$question2 : improvementsQuestion)), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
470
+ name: "improvements_".concat(q.id),
471
+ initialValue: [],
472
+ rules: [{
473
+ required: isRequired,
474
+ message: mandatoryQuestionError
475
+ }]
476
+ }, /*#__PURE__*/_react.default.createElement("div", null, checkboxOpts.map(option => /*#__PURE__*/_react.default.createElement("div", {
477
+ className: "margin-bottom-16",
478
+ key: option
479
+ }, /*#__PURE__*/_react.default.createElement(_CustomCheckBox.default, {
480
+ label: option,
481
+ size: "large",
482
+ value: option,
483
+ checked: qImprovements.includes(option),
484
+ onChange: event => handleMultiImprovementChange(q.id, option, event.target.checked)
485
+ })))))), hasQOthers && /*#__PURE__*/_react.default.createElement("div", {
486
+ className: "margin-bottom-32"
487
+ }, /*#__PURE__*/_react.default.createElement("div", {
488
+ className: "margin-bottom-8"
489
+ }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
490
+ color: "primary-content",
491
+ typography: "type-t2-700"
492
+ }, othersSpecifyLabel)), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
493
+ name: "othersSpecify_".concat(q.id),
494
+ initialValue: "",
495
+ rules: [{
496
+ required: true,
497
+ message: mandatoryQuestionError
498
+ }]
499
+ }, /*#__PURE__*/_react.default.createElement(_CustomTextArea.default, {
500
+ placeholder: othersSpecifyPlaceholder,
501
+ value: qOthersSpecify,
502
+ onChange: e => handleMultiOthersSpecifyChange(q.id, e)
503
+ }))));
504
+ };
505
+ return /*#__PURE__*/_react.default.createElement(_FeedbackWidget1Style.FeedbackSection, null, /*#__PURE__*/_react.default.createElement(_FeedbackWidget1Style.GlobalStyle, null), !visible && !hideButton && /*#__PURE__*/_react.default.createElement("div", {
506
+ className: "feedback-button"
507
+ }, /*#__PURE__*/_react.default.createElement("button", {
508
+ className: "feedback-btn",
509
+ onClick: () => setVisible(true)
510
+ }, feedbackButtonLabel)), /*#__PURE__*/_react.default.createElement(_CustomModal.default, {
511
+ className: "surveyPopupUniqueModal",
512
+ open: visible,
513
+ onCancel: handleClose,
514
+ centered: false,
515
+ footer: null,
516
+ width: modalWidth,
517
+ destroyOnClose: true
518
+ }, showThankYou ? /*#__PURE__*/_react.default.createElement("div", {
519
+ className: "thankYouContainer"
520
+ }, /*#__PURE__*/_react.default.createElement("div", {
521
+ className: "thankYouContent"
522
+ }, /*#__PURE__*/_react.default.createElement("div", {
523
+ className: "thankYouIcon"
524
+ }, /*#__PURE__*/_react.default.createElement(_CheckCircle.default, null)), /*#__PURE__*/_react.default.createElement("div", {
525
+ className: "margin-bottom-16"
526
+ }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
527
+ typography: "type-t1-500"
528
+ }, thankYouTitle)), /*#__PURE__*/_react.default.createElement(_Typography.default, {
529
+ typography: "type-b1-400"
530
+ }, thankYouMessage))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
531
+ className: "formScrollSec"
532
+ }, /*#__PURE__*/_react.default.createElement("div", {
533
+ className: "margin-bottom-32"
534
+ }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
535
+ typography: "type-t1-500"
536
+ }, title), subTitle ? /*#__PURE__*/_react.default.createElement(_Typography.default, {
537
+ typography: "type-b1-400",
538
+ color: "secondary-content"
539
+ }, subTitle) : null), /*#__PURE__*/_react.default.createElement(_antd.Form, {
540
+ form: form
541
+ }, surveyConfig ?
542
+ /*#__PURE__*/
543
+ // ── Multi-question mode (1 or more questions of each type) ──
544
+ _react.default.createElement(_react.default.Fragment, null, singleChoiceQuestions.map(q => renderSingleChoiceQuestion(q)), anyNegativeSelected && multiChoiceQuestions.map(q => renderMultiChoiceQuestion(q))) :
545
+ /*#__PURE__*/
546
+ // ── Legacy / no-surveyConfig mode ──
547
+ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
548
+ className: "margin-bottom-32"
549
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
550
+ typography: "type-t2-700"
551
+ }, resolvedQuestion)), /*#__PURE__*/_react.default.createElement("div", {
552
+ className: "surveyButtonSection"
553
+ }, /*#__PURE__*/_react.default.createElement("div", {
554
+ onClick: () => handleChoiceChange(resolvedPositiveChoiceValue),
555
+ className: "surveyBtn ".concat(choice === resolvedPositiveChoiceValue ? 'selected' : '')
556
+ }, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
557
+ icon: _ThumbUpOutlined.default,
558
+ size: 24
559
+ }), /*#__PURE__*/_react.default.createElement(_Typography.default, {
560
+ typography: "type-b1-400"
561
+ }, resolvedPositiveButtonLabel)), /*#__PURE__*/_react.default.createElement("div", {
562
+ onClick: () => handleChoiceChange(resolvedNegativeChoiceValue),
563
+ className: "surveyBtn ".concat(choice === resolvedNegativeChoiceValue ? 'selected' : '')
564
+ }, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
565
+ icon: _ThumbDownOutlined.default,
566
+ size: 24
567
+ }), /*#__PURE__*/_react.default.createElement(_Typography.default, {
568
+ typography: "type-b1-400"
569
+ }, resolvedNegativeButtonLabel))), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
570
+ name: "choice",
571
+ initialValue: "",
572
+ rules: [{
573
+ required: true,
574
+ message: mandatoryQuestionError
575
+ }],
576
+ style: {
577
+ marginBottom: 0
578
+ }
579
+ }, /*#__PURE__*/_react.default.createElement("input", {
580
+ type: "hidden"
581
+ }))), choice === resolvedNegativeChoiceValue && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, resolvedCheckboxOptions.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
582
+ className: "margin-bottom-32"
583
+ }, /*#__PURE__*/_react.default.createElement("div", {
584
+ className: "margin-bottom-8"
585
+ }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
586
+ color: "primary-content",
587
+ typography: "type-t2-700"
588
+ }, resolvedImprovementsQuestion)), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
589
+ name: "improvements",
590
+ initialValue: [],
591
+ rules: [{
592
+ required: true,
593
+ message: mandatoryQuestionError
594
+ }]
595
+ }, /*#__PURE__*/_react.default.createElement("div", null, resolvedCheckboxOptions.map(option => /*#__PURE__*/_react.default.createElement("div", {
596
+ className: "margin-bottom-16",
597
+ key: option
598
+ }, /*#__PURE__*/_react.default.createElement(_CustomCheckBox.default, {
599
+ label: option,
600
+ size: "large",
601
+ value: option,
602
+ checked: improvements.includes(option),
603
+ onChange: event => handleImprovementChange(option, event.target.checked)
604
+ })))))), hasOthersSelected && /*#__PURE__*/_react.default.createElement("div", {
605
+ className: "margin-bottom-32"
606
+ }, /*#__PURE__*/_react.default.createElement("div", {
607
+ className: "margin-bottom-8"
608
+ }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
609
+ color: "primary-content",
610
+ typography: "type-t2-700"
611
+ }, othersSpecifyLabel)), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
612
+ name: "othersSpecify",
613
+ initialValue: "",
614
+ rules: [{
615
+ required: true,
616
+ message: mandatoryQuestionError
617
+ }]
618
+ }, /*#__PURE__*/_react.default.createElement(_CustomTextArea.default, {
619
+ placeholder: othersSpecifyPlaceholder,
620
+ value: othersSpecify,
621
+ onChange: handleOthersSpecifyChange
622
+ }))))), showCommentSection && /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
623
+ className: "margin-bottom-32"
624
+ }, /*#__PURE__*/_react.default.createElement("div", {
625
+ className: "margin-bottom-8"
626
+ }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
627
+ color: "primary-content",
628
+ typography: "type-t2-700"
629
+ }, resolvedCommentLabel)), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
630
+ name: "comment",
631
+ noStyle: true
632
+ }, /*#__PURE__*/_react.default.createElement(_CustomTextArea.default, {
633
+ placeholder: resolvedCommentPlaceholder,
634
+ maxLength: 199
635
+ }))), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
636
+ name: "consent",
637
+ valuePropName: "checked",
638
+ rules: [{
639
+ validator: (_, value) => value ? Promise.resolve() : Promise.reject(new Error(consentError))
640
+ }]
641
+ }, /*#__PURE__*/_react.default.createElement("div", {
642
+ className: "margin-bottom-8"
643
+ }, /*#__PURE__*/_react.default.createElement(_CustomCheckBox.default, {
644
+ label: consentLabel,
645
+ name: "consent",
646
+ size: "large"
647
+ }))))), /*#__PURE__*/_react.default.createElement("div", {
648
+ className: "footerFeedback"
649
+ }, /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
650
+ label: submitButtonLabel,
651
+ size: "large",
652
+ onClick: handleSubmit
653
+ })))));
654
+ }
655
+ var _default = exports.default = FeedbackWidget1;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.weak-map.js");
4
+ require("core-js/modules/web.dom-collections.iterator.js");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.GlobalStyle = exports.FeedbackSection = void 0;
9
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
10
+ var _templateObject, _templateObject2;
11
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
14
+ const FeedbackSection = exports.FeedbackSection = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .feedback-button {\n position: fixed;\n top: 50%;\n right: -44px;\n transform: translateY(-50%);\n transition: transform 0.3s ease;\n z-index: 9999;\n }\n\n .feedback-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 130px;\n height: 50px;\n background-color: #212121;\n color: #fff;\n border: none;\n cursor: pointer;\n padding: 12px 16px;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n rotate: -90deg;\n font-size: 18px;\n font-family: Roboto, sans-serif;\n font-weight: 500;\n transition: background-color 0.3s ease;\n }\n"])));
15
+ const GlobalStyle = exports.GlobalStyle = (0, _styledComponents.createGlobalStyle)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n.surveyPopupUniqueModal {\n position: absolute;\n top: auto;\n right: 20px;\n bottom: 24px;\n left: auto;\n max-height: calc(100vh - 48px);\n}\n\n.surveyPopupUniqueModal .ant-modal-close-x {width: auto; height: auto;}\n\n.formScrollSec .ant-checkbox-wrapper{display: flex; align-items: center;}\n.formScrollSec .ant-form-item-children{display: flex; flex-direction: column;}\n\n.formScrollSec {\n height: auto;\n max-height: 500px;\n padding-right: 24px;\n padding-bottom: 80px;\n margin-right: 12px;\n overflow-y: auto;\n}\n\n@media screen and (max-height: 680px) {\n .formScrollSec {\n height: calc(100vh - 150px);\n max-height: 480px;\n margin-right: 8px;\n }\n\n .surveyPopupUniqueModal .thankYouContainer {\n height: calc(100vh - 150px);\n max-height: 480px;\n }\n\n .surveyPopupUniqueModal {\n bottom: 5px;\n top: 5px;\n max-height: calc(100vh - 10px);\n }\n\n.surveyPopupUniqueModal .ant-modal-content {\n padding: 32px 16px 0 16px;\n }\n}\n\n.formScrollSec .ant-form-item-control{line-height: normal;}\n.surveyPopupUniqueModal .ant-form-item-control-input{min-height: 0;}\n.formScrollSec::-webkit-scrollbar {width: 5px;}\n.formScrollSec::-webkit-scrollbar-track {background: #fff;}\n.formScrollSec::-webkit-scrollbar-thumb {background: #888; border-radius: 2px;}\n.formScrollSec::-webkit-scrollbar-thumb:hover {background: #555;}\n\n.surveyButtonSection .surveyBtn {\n border-radius: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 12px;\n flex: 1 1 0;\n border: 1px solid #e0e0e0;\n background: #fff;\n height: 48px;\n cursor: pointer;\n padding: 0 16px;\n min-width: 0;\n}\n\n.surveyButtonSection .surveyBtn .MuiSvgIcon-root {\n flex-shrink: 0;\n}\n\n.feedback-button.hidden {\n display: none;\n}\n\n.surveyButtonSection .selected {\n border: 1px solid #014fc5 !important;\n background: #014fc5 !important;\n color: #fff !important;\n}\n\n.surveyPopupUniqueModal .thankYouContainer {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 540px;\n padding: 20px;\n text-align: center;\n font-family: Roboto, sans-serif;\n}\n\n.thankYouContent {\n display: inline-grid;\n}\n\n.thankYouIcon svg.MuiSvgIcon-root {\n font-size: 64px;\n color: green;\n}\n\n.surveyPopupUniqueModal.ant-modal {\n padding-bottom: 0;\n}\n\n.surveyPopupUniqueModal .ant-modal-content {\n padding: 56px 0 0 40px;\n}\n\n.surveyPopupUniqueModal .ant-modal-body {\n overflow: hidden;\n}\n\n.surveyPopupUniqueModal .ant-modal-body > div {\n padding: 0;\n}\n\n.surveyPopupUniqueModal .ant-modal-content {\n display: flex;\n flex-direction: column;\n max-height: 100%;\n overflow: hidden;\n}\n\n.footerFeedback {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n border-radius: 0 0 12px 12px;\n padding: 16px 24px 16px 0;\n box-shadow: 0 -2px 10px 0 rgba(0, 0, 0, 0.14);\n display: flex;\n justify-content: flex-end;\n background: #fff;\n z-index: 1;\n box-sizing: border-box;\n}\n\n.footerFeedback button{width: auto;}\n\n.surveyButtonSection {\n margin-top: 8px;\n display: flex;\n gap: 16px;\n flex-direction: row;\n justify-content: flex-start;\n align-items: stretch;\n width: 100%;\n}\n\n@media screen and (max-width: 600px) {\n .surveyPopupUniqueModal .ant-modal-body {\n max-height: 90vh;\n overflow: auto;\n padding-right: 0;\n padding-bottom: 80px;\n }\n\n .formScrollSec {\n margin-right: 0;\n padding-right: 12px;\n padding-bottom: 0;\n }\n\n .surveyPopupUniqueModal.ant-modal {\n width: 100% !important;\n margin: 0 auto !important;\n max-width: none !important;\n position: absolute;\n top: auto;\n bottom: 40px;\n padding-bottom: 0;\n right: 0;\n }\n\n .surveyPopupUniqueModal .ant-modal-content {\n padding: 56px 16px 0 16px;\n }\n\n .footerFeedback {\n border-radius: 0;\n padding: 16px;\n margin: 0;\n width: 100%;\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1;\n background: #fff;\n }\n\n .footerFeedback button {\n width: 100%;\n }\n\n .surveyButtonSection {\n gap: 12px;\n }\n\n .surveyButtonSection .surveyBtn {\n padding: 0 12px;\n }\n}\n"])));
@@ -8,6 +8,6 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
8
  var _templateObject, _templateObject2; // styles.js
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
11
- const OalayoutStyle = _styledComponents.default.aside(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .oaLeftLayouts {\n padding: 24px 8px;\n background: #f6f6f6;\n height: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .logoContainer {\n padding: 12px;\n display: flex;\n justify-content: space-between;\n height: 110px;\n width: 220px;\n align-items: center;\n margin: 0 0 16px 0;\n }\n\n .logoutDiv {\n display: flex;\n flex-direction: row;\n margin: 48px 0 0 16px;\n gap: 8px;\n cursor: pointer;\n }\n\n .leftLogoSec {\n display: flex;\n flex-direction: row;\n gap: 8px;\n }\n\n .logo-mobile-height {\n height: auto;\n }\n\n // .logoContainer em {\n // width: 1px;\n // background: #e0e0e0;\n // }\n // .logoContainer img {\n // height: 32px;\n // }\n .ant-layout-sider-light,\n .ant-menu-light {\n background: transparent;\n }\n\n /* Regular menu items */\n .ant-menu-item {\n padding: 16px;\n border-radius: 50px;\n margin: 0 0 8px;\n height: auto;\n line-height: normal;\n border-radius: 999px;\n border: 1px solid #e0e0e0;\n background: #fff;\n }\n\n /* SubMenu title styling - this is the parent item - same size as regular items */\n .ant-menu-submenu-title {\n padding: 24px;\n border-radius: 50px;\n margin: 0 0 8px;\n height: auto;\n line-height: normal;\n border-radius: 999px;\n border: 1px solid #e0e0e0;\n background: #fff;\n display: flex;\n align-items: center;\n }\n\n /* SubMenu items - these are the children - should be plain text */\n .ant-menu-submenu .ant-menu-item {\n margin: 8px 0;\n padding: 8px 24px;\n border-radius: 0;\n background: transparent;\n border: none;\n margin-left: 16px;\n color: #666;\n font-size: 14px;\n height: auto;\n line-height: 1.4;\n }\n\n /* Add extra spacing for last nested item */\n .ant-menu-submenu .ant-menu-item:last-child {\n margin-bottom: 12px;\n }\n\n /* REMOVED: Open SubMenu styling - this was making ALL open submenus blue */\n /* .ant-menu-submenu-open > .ant-menu-submenu-title {\n background: #014fc5;\n color: #fff;\n padding: 24px; \n } */\n\n /* NEW: Only make parent blue when it contains a selected child */\n .ant-menu-submenu-open:has(.ant-menu-item-selected)\n > .ant-menu-submenu-title {\n background: #014fc5;\n color: #fff;\n padding: 24px;\n }\n\n /* Fallback for browsers that don't support :has() */\n .ant-menu-submenu-open > .ant-menu-submenu-title {\n background: #fff;\n color: #000;\n padding: 24px;\n }\n\n /* SubMenu title content */\n .ant-menu-item .ant-menu-title-content {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 8px;\n }\n\n .ant-menu-submenu-title .ant-menu-title-content {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 8px;\n }\n\n /* Add styling to span elements inside SubMenu title content */\n .ant-menu-submenu-title .ant-menu-title-content span {\n display: flex;\n gap: 8px;\n align-items: center;\n }\n\n /* Selected states */\n .ant-menu-item-active {\n background: #014fc5;\n color: #fff;\n }\n .ant-menu-item-selected {\n background: #014fc5;\n color: #fff;\n }\n\n /* SubMenu selected item - should be bold black when selected */\n .ant-menu-submenu .ant-menu-item-selected {\n background: transparent;\n color: #000;\n font-weight: bold;\n border-radius: 0;\n }\n\n /* Hover effects */\n .ant-menu-light:not(.ant-menu-horizontal)\n .ant-menu-item:not(.ant-menu-item-selected):hover,\n :where(.css-dev-only-do-not-override-zcfrx9).ant-menu-light\n > .ant-menu:not(.ant-menu-horizontal)\n .ant-menu-item:not(.ant-menu-item-selected):hover {\n background: #014fc5;\n color: #fff;\n }\n\n /* SubMenu title hover - should be blue on hover */\n .ant-menu-submenu-title:hover {\n background: #014fc5 !important;\n color: #fff !important;\n padding: 24px !important;\n }\n\n /* Nested items hover - should be bold black when hovered */\n .ant-menu-submenu .ant-menu-item:hover {\n background: transparent !important;\n color: #000 !important;\n font-weight: bold !important;\n border-radius: 0;\n }\n\n /* Make Orders parent blue when hovering over submenu items */\n .ant-menu-submenu:hover .ant-menu-submenu-title {\n background: #014fc5 !important;\n color: #fff !important;\n padding: 24px !important;\n }\n\n .ant-menu-light.ant-menu-root.ant-menu-inline {\n border: none;\n }\n\n /* SubMenu arrow styling */\n .ant-menu-submenu-arrow {\n color: inherit;\n }\n\n /* SubMenu content area */\n .ant-menu-sub {\n background: transparent !important;\n padding: 8px 0;\n }\n\n /* Remove default SubMenu styling */\n .ant-menu-submenu .ant-menu-sub {\n background: transparent !important;\n box-shadow: none !important;\n }\n\n .notShowInDesktop {\n display: none;\n }\n\n .footerLogoSection {\n margin-top: auto;\n margin-bottom: 40px;\n padding: 0 16px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n width: 172px;\n height: 75px;\n }\n\n .footerLogoContainer {\n display: flex;\n align-items: center;\n }\n\n .footerLogo {\n width: 172px;\n height: 43px;\n }\n\n @media only screen and (max-width: 600px) {\n .oaLeftLayouts {\n background: #fff;\n padding: 0 16px;\n height: auto;\n display: block;\n }\n .logoContainer {\n padding: 0;\n align-items: center;\n width: 100%;\n height: 80px;\n }\n\n .logo-mobile-height {\n height: 56px;\n }\n\n .notShowInMobile {\n display: none;\n }\n .notShowInDesktop {\n display: flex;\n }\n\n .oaLeftLayouts .ant-layout-sider {\n max-width: none !important;\n width: 100% !important;\n }\n p.ant-dropdown-trigger {\n margin-bottom: 0;\n }\n .layoutHeadingPage * {\n max-width: 200px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n }\n"])));
11
+ const OalayoutStyle = _styledComponents.default.aside(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .oaLeftLayouts {\n padding: 24px 8px;\n background: #f6f6f6;\n height: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .logoContainer {\n padding: 12px;\n display: flex;\n justify-content: space-between;\n height: 110px;\n width: 220px;\n align-items: center;\n margin: 0 0 16px 0;\n }\n\n .logoutDiv {\n display: flex;\n flex-direction: row;\n margin: 48px 0 0 16px;\n gap: 8px;\n cursor: pointer;\n }\n\n .leftLogoSec {\n display: flex;\n flex-direction: row;\n gap: 8px;\n }\n\n .logo-mobile-height {\n height: auto;\n max-height: 130px;\n }\n\n // .logoContainer em {\n // width: 1px;\n // background: #e0e0e0;\n // }\n // .logoContainer img {\n // height: 32px;\n // }\n .ant-layout-sider-light,\n .ant-menu-light {\n background: transparent;\n }\n\n /* Regular menu items */\n .ant-menu-item {\n padding: 16px;\n border-radius: 50px;\n margin: 0 0 8px;\n height: auto;\n line-height: normal;\n border-radius: 999px;\n border: 1px solid #e0e0e0;\n background: #fff;\n }\n\n /* SubMenu title styling - this is the parent item - same size as regular items */\n .ant-menu-submenu-title {\n padding: 24px;\n border-radius: 50px;\n margin: 0 0 8px;\n height: auto;\n line-height: normal;\n border-radius: 999px;\n border: 1px solid #e0e0e0;\n background: #fff;\n display: flex;\n align-items: center;\n }\n\n /* SubMenu items - these are the children - should be plain text */\n .ant-menu-submenu .ant-menu-item {\n margin: 8px 0;\n padding: 8px 24px;\n border-radius: 0;\n background: transparent;\n border: none;\n margin-left: 16px;\n color: #666;\n font-size: 14px;\n height: auto;\n line-height: 1.4;\n }\n\n /* Add extra spacing for last nested item */\n .ant-menu-submenu .ant-menu-item:last-child {\n margin-bottom: 12px;\n }\n\n /* REMOVED: Open SubMenu styling - this was making ALL open submenus blue */\n /* .ant-menu-submenu-open > .ant-menu-submenu-title {\n background: #014fc5;\n color: #fff;\n padding: 24px; \n } */\n\n /* NEW: Only make parent blue when it contains a selected child */\n .ant-menu-submenu-open:has(.ant-menu-item-selected)\n > .ant-menu-submenu-title {\n background: #014fc5;\n color: #fff;\n padding: 24px;\n }\n\n /* Fallback for browsers that don't support :has() */\n .ant-menu-submenu-open > .ant-menu-submenu-title {\n background: #fff;\n color: #000;\n padding: 24px;\n }\n\n /* SubMenu title content */\n .ant-menu-item .ant-menu-title-content {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 8px;\n }\n\n .ant-menu-submenu-title .ant-menu-title-content {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 8px;\n }\n\n /* Add styling to span elements inside SubMenu title content */\n .ant-menu-submenu-title .ant-menu-title-content span {\n display: flex;\n gap: 8px;\n align-items: center;\n }\n\n /* Selected states */\n .ant-menu-item-active {\n background: #014fc5;\n color: #fff;\n }\n .ant-menu-item-selected {\n background: #014fc5;\n color: #fff;\n }\n\n /* SubMenu selected item - should be bold black when selected */\n .ant-menu-submenu .ant-menu-item-selected {\n background: transparent;\n color: #000;\n font-weight: bold;\n border-radius: 0;\n }\n\n /* Hover effects */\n .ant-menu-light:not(.ant-menu-horizontal)\n .ant-menu-item:not(.ant-menu-item-selected):hover,\n :where(.css-dev-only-do-not-override-zcfrx9).ant-menu-light\n > .ant-menu:not(.ant-menu-horizontal)\n .ant-menu-item:not(.ant-menu-item-selected):hover {\n background: #014fc5;\n color: #fff;\n }\n\n /* SubMenu title hover - should be blue on hover */\n .ant-menu-submenu-title:hover {\n background: #014fc5 !important;\n color: #fff !important;\n padding: 24px !important;\n }\n\n /* Nested items hover - should be bold black when hovered */\n .ant-menu-submenu .ant-menu-item:hover {\n background: transparent !important;\n color: #000 !important;\n font-weight: bold !important;\n border-radius: 0;\n }\n\n /* Make Orders parent blue when hovering over submenu items */\n .ant-menu-submenu:hover .ant-menu-submenu-title {\n background: #014fc5 !important;\n color: #fff !important;\n padding: 24px !important;\n }\n\n .ant-menu-light.ant-menu-root.ant-menu-inline {\n border: none;\n }\n\n /* SubMenu arrow styling */\n .ant-menu-submenu-arrow {\n color: inherit;\n }\n\n /* SubMenu content area */\n .ant-menu-sub {\n background: transparent !important;\n padding: 8px 0;\n }\n\n /* Remove default SubMenu styling */\n .ant-menu-submenu .ant-menu-sub {\n background: transparent !important;\n box-shadow: none !important;\n }\n\n .notShowInDesktop {\n display: none;\n }\n\n .footerLogoSection {\n margin-top: auto;\n margin-bottom: 40px;\n padding: 0 16px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n width: 172px;\n height: 75px;\n }\n\n .footerLogoContainer {\n display: flex;\n align-items: center;\n }\n\n .footerLogo {\n width: 172px;\n height: 43px;\n }\n\n @media only screen and (max-width: 600px) {\n .oaLeftLayouts {\n background: #fff;\n padding: 0 16px;\n height: auto;\n display: block;\n }\n .logoContainer {\n padding: 0;\n align-items: center;\n width: 100%;\n height: 80px;\n }\n\n .logo-mobile-height {\n height: 56px;\n }\n\n .notShowInMobile {\n display: none;\n }\n .notShowInDesktop {\n display: flex;\n }\n\n .oaLeftLayouts .ant-layout-sider {\n max-width: none !important;\n width: 100% !important;\n }\n p.ant-dropdown-trigger {\n margin-bottom: 0;\n }\n .layoutHeadingPage * {\n max-width: 200px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n }\n"])));
12
12
  const ProfileIcon = exports.ProfileIcon = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 36px;\n height: 36px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.2s ease;\n box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--color-primary);\n\n &:hover {\n transform: scale(1.05);\n }\n"])));
13
13
  var _default = exports.default = OalayoutStyle;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-componentbook",
3
- "version": "0.18.384",
3
+ "version": "0.18.386",
4
4
  "private": false,
5
5
  "description": "Reusable components",
6
6
  "main": "build/index.js",