pager-widget 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.jsx +830 -28
- package/ConsentPopup.jsx +81 -11
- package/InputConverter.jsx +203 -289
- package/dist/lib.js +6 -6
- package/md/assistant_md.js +73 -6
- package/package.json +1 -1
package/ConsentPopup.jsx
CHANGED
|
@@ -10,6 +10,10 @@ import {
|
|
|
10
10
|
import axios from "axios";
|
|
11
11
|
|
|
12
12
|
import { useState, useEffect } from "react";
|
|
13
|
+
import AssistantMd, {
|
|
14
|
+
evalNormalOrJoinText,
|
|
15
|
+
parseUrlAndString,
|
|
16
|
+
} from "./md/assistant_md"
|
|
13
17
|
const ConsentPopup = ({
|
|
14
18
|
formData,
|
|
15
19
|
conversationId,
|
|
@@ -19,14 +23,19 @@ const ConsentPopup = ({
|
|
|
19
23
|
isVisible,
|
|
20
24
|
setIsVisible,
|
|
21
25
|
setSourceState,
|
|
26
|
+
userDetails
|
|
27
|
+
|
|
22
28
|
}) => {
|
|
23
|
-
|
|
29
|
+
|
|
24
30
|
const [deviceLocation, setDeviceLocation] = useState({
|
|
25
31
|
lat: "",
|
|
26
32
|
long: "",
|
|
27
33
|
});
|
|
28
34
|
|
|
35
|
+
// const consentOutput = JSON.parse(widget?.consent_data)
|
|
29
36
|
|
|
37
|
+
|
|
38
|
+
// console.log("consent widget", widget.consent_data)
|
|
30
39
|
const handleCheckboxChange = (event) => {
|
|
31
40
|
setIsVisible(event.target.checked);
|
|
32
41
|
};
|
|
@@ -54,6 +63,7 @@ const ConsentPopup = ({
|
|
|
54
63
|
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
55
64
|
const language = navigator.language;
|
|
56
65
|
|
|
66
|
+
console.log("url location",window.location)
|
|
57
67
|
const systemDetails = [
|
|
58
68
|
{ field_id: "SYS_browser", value: browserName },
|
|
59
69
|
{ field_id: "SYS_browser_os", value: osName },
|
|
@@ -68,7 +78,12 @@ const ConsentPopup = ({
|
|
|
68
78
|
{
|
|
69
79
|
field_id: "SYS_location",
|
|
70
80
|
value: `Lat: ${deviceLocation.lat}, Long: ${deviceLocation.long}`,
|
|
71
|
-
},
|
|
81
|
+
},
|
|
82
|
+
// Correctly updated location
|
|
83
|
+
{
|
|
84
|
+
field_id: "SYS_From_Page",
|
|
85
|
+
value: window.location.origin
|
|
86
|
+
}
|
|
72
87
|
];
|
|
73
88
|
|
|
74
89
|
const submissionPayload = {
|
|
@@ -104,29 +119,83 @@ const ConsentPopup = ({
|
|
|
104
119
|
});
|
|
105
120
|
};
|
|
106
121
|
|
|
122
|
+
console.log("url location", window.location.origin)
|
|
123
|
+
|
|
107
124
|
return (
|
|
108
|
-
|
|
125
|
+
<div style={
|
|
126
|
+
{
|
|
127
|
+
display: "flex",
|
|
128
|
+
flexDirection: "column",
|
|
129
|
+
justifyContent: "end",
|
|
130
|
+
height:"100%",
|
|
131
|
+
width:"100%"
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
}>
|
|
135
|
+
<div style={{
|
|
136
|
+
display:"flex",
|
|
137
|
+
alignItems:"start",
|
|
138
|
+
paddingBottom: "16px",
|
|
139
|
+
gap:"8px"
|
|
140
|
+
|
|
141
|
+
}}>
|
|
109
142
|
<input
|
|
110
143
|
type="checkbox"
|
|
111
144
|
id="consentCheckbox"
|
|
112
145
|
checked={isVisible}
|
|
113
146
|
onChange={handleCheckboxChange}
|
|
114
147
|
/>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
148
|
+
{console.log("output struct 2", widget.consent_data)}
|
|
149
|
+
<div style={{
|
|
150
|
+
fontSize: "16px",
|
|
151
|
+
fontWeight: "100",
|
|
152
|
+
lineHeight: "24px",
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
}}>
|
|
157
|
+
<AssistantMd mdText={widget?.consent_data}/>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
{/* <AssistantMd mdText={{
|
|
162
|
+
|
|
163
|
+
"type": "join",
|
|
164
|
+
"lhs": {
|
|
165
|
+
"type": "text",
|
|
166
|
+
"value": "Hi haha"
|
|
167
|
+
},
|
|
168
|
+
"rhs": {
|
|
169
|
+
"type": "bold",
|
|
170
|
+
"value": {
|
|
171
|
+
"type": "text",
|
|
172
|
+
"value": "Hello "
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
}}/> */}
|
|
177
|
+
{/* <AssistantMd mdText={widget.consent_data}></AssistantMd> */}
|
|
178
|
+
|
|
179
|
+
{/* <AssistantMd mdText={consentOutput?.content[0]} userDetails={userDetails}></AssistantMd> */}
|
|
180
|
+
</div>
|
|
181
|
+
<div style={{
|
|
182
|
+
width:"100%",
|
|
183
|
+
paddingTop: "16px",
|
|
184
|
+
borderTop: "1px solid lightgrey",
|
|
185
|
+
display:"flex",
|
|
186
|
+
justifyContent:"center"
|
|
187
|
+
|
|
188
|
+
}}>
|
|
121
189
|
<button
|
|
190
|
+
|
|
122
191
|
disabled={isVisible == false ? true : false}
|
|
123
|
-
style={popupStyles.button}
|
|
192
|
+
style={{...popupStyles.button, width: "90%"}}
|
|
124
193
|
onClick={handleSubmit}
|
|
125
194
|
>
|
|
126
195
|
Submit
|
|
127
196
|
</button>
|
|
128
197
|
</div>
|
|
129
|
-
|
|
198
|
+
</div>
|
|
130
199
|
);
|
|
131
200
|
|
|
132
201
|
};
|
|
@@ -169,6 +238,7 @@ const popupStyles = {
|
|
|
169
238
|
cursor: "pointer",
|
|
170
239
|
backgroundColor: "#007bff",
|
|
171
240
|
color: "white",
|
|
241
|
+
width: "90%"
|
|
172
242
|
},
|
|
173
243
|
};
|
|
174
244
|
|