@sawport/react-sdk 0.1.0-alpha.65 → 0.1.0-alpha.67
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/dist/index.js +50 -23
- package/dist/index.umd.js +14 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24043,7 +24043,12 @@ const exts = {
|
|
|
24043
24043
|
mpg: "video",
|
|
24044
24044
|
"3pg": "video",
|
|
24045
24045
|
wmv: "video",
|
|
24046
|
-
mp4: "video"
|
|
24046
|
+
mp4: "video",
|
|
24047
|
+
doc: "document",
|
|
24048
|
+
docx: "document",
|
|
24049
|
+
docm: "document",
|
|
24050
|
+
odt: "document",
|
|
24051
|
+
pdf: "document"
|
|
24047
24052
|
};
|
|
24048
24053
|
const isFileType = (ext) => exts[ext];
|
|
24049
24054
|
const getUrlExt = (url3) => {
|
|
@@ -66967,8 +66972,8 @@ Step 2: Open the video banking widget.
|
|
|
66967
66972
|
Step 3: Click on the "Scheduled Meeting" button.
|
|
66968
66973
|
Step 4: Click the blue "Join" button to join meeting.`,
|
|
66969
66974
|
location: window.location,
|
|
66970
|
-
startTime: hooks(`${date4}T${time2}
|
|
66971
|
-
endTime: hooks(`${date4}T${time2}
|
|
66975
|
+
startTime: hooks(`${date4}T${time2}`, "YYYY-MM-DDTHH:mm"),
|
|
66976
|
+
endTime: hooks(`${date4}T${time2}`, "YYYY-MM-DDTHH:mm").add(1, "h")
|
|
66972
66977
|
};
|
|
66973
66978
|
const providersObj = {};
|
|
66974
66979
|
const objClass = {
|
|
@@ -67020,7 +67025,7 @@ Step 4: Click the blue "Join" button to join meeting.`,
|
|
|
67020
67025
|
children: hooks(date4).format("dddd, MMMM Do YYYY").toString()
|
|
67021
67026
|
}), /* @__PURE__ */ jsx("p", {
|
|
67022
67027
|
className: "text-center my-0 py-2 text-lg text-alt",
|
|
67023
|
-
children: hooks(`${date4}T${time2}
|
|
67028
|
+
children: hooks(`${date4}T${time2}`, "YYYY-MM-DDTHH:mm").format("hh:mm A").toString()
|
|
67024
67029
|
}), /* @__PURE__ */ jsx("div", {
|
|
67025
67030
|
children: /* @__PURE__ */ jsx(Tooltip$1, {
|
|
67026
67031
|
title: /* @__PURE__ */ jsxs("div", {
|
|
@@ -67215,7 +67220,8 @@ const SlotPicker = react.exports.memo(({
|
|
|
67215
67220
|
days: days2,
|
|
67216
67221
|
fromDay,
|
|
67217
67222
|
toDay,
|
|
67218
|
-
date: date4
|
|
67223
|
+
date: date4,
|
|
67224
|
+
timezone: timezone2
|
|
67219
67225
|
}) => {
|
|
67220
67226
|
const {
|
|
67221
67227
|
state: {
|
|
@@ -67228,8 +67234,8 @@ const SlotPicker = react.exports.memo(({
|
|
|
67228
67234
|
disabledHours: () => {
|
|
67229
67235
|
var _a, _b, _c, _d;
|
|
67230
67236
|
const times = [];
|
|
67231
|
-
const timeformat = "
|
|
67232
|
-
const from2 = hooks(fromTime, timeformat).get("h"), to2 = hooks(toTime, timeformat).get("h");
|
|
67237
|
+
const timeformat = "HH:mm:ss";
|
|
67238
|
+
const from2 = hooks.tz(fromTime, timeformat, timezone2).local().get("h"), to2 = hooks.tz(toTime, timeformat, timezone2).local().get("h");
|
|
67233
67239
|
for (let index2 = 0; index2 <= 23; index2++) {
|
|
67234
67240
|
const half = parseFloat(`${index2}.3`);
|
|
67235
67241
|
if (!(index2 >= from2 && index2 < to2) || ((_b = (_a = data2 == null ? void 0 : data2[date4]) == null ? void 0 : _a[index2]) == null ? void 0 : _b.full) && ((_d = (_c = data2 == null ? void 0 : data2[date4]) == null ? void 0 : _c[half]) == null ? void 0 : _d.full)) {
|
|
@@ -67250,7 +67256,7 @@ const SlotPicker = react.exports.memo(({
|
|
|
67250
67256
|
}
|
|
67251
67257
|
return mins;
|
|
67252
67258
|
}
|
|
67253
|
-
}), [toTime, fromTime, date4, data2]);
|
|
67259
|
+
}), [toTime, fromTime, date4, data2, timezone2]);
|
|
67254
67260
|
const disabledDate = react.exports.useCallback((current) => {
|
|
67255
67261
|
const day = current.day();
|
|
67256
67262
|
return hooks(hooks().subtract(1, "d")).isSameOrAfter(current.toDate()) || !(day >= days2[fromDay] && day <= days2[toDay]);
|
|
@@ -67344,7 +67350,8 @@ const Offline = react.exports.memo(({
|
|
|
67344
67350
|
customer,
|
|
67345
67351
|
fields,
|
|
67346
67352
|
quickStopChat,
|
|
67347
|
-
offlineMode
|
|
67353
|
+
offlineMode,
|
|
67354
|
+
timezone: companyTimezone
|
|
67348
67355
|
}) => {
|
|
67349
67356
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
67350
67357
|
const callRequestOptions = [...(options == null ? void 0 : options.enableVoicenote) ? ["Leave a voice note"] : [], ...options.callRequestOptions || []];
|
|
@@ -67373,7 +67380,7 @@ const Offline = react.exports.memo(({
|
|
|
67373
67380
|
timezone: void 0
|
|
67374
67381
|
});
|
|
67375
67382
|
const saved = react.exports.useRef();
|
|
67376
|
-
const offlineSchema = create$1().shape({
|
|
67383
|
+
const offlineSchema = react.exports.useMemo(() => create$1().shape({
|
|
67377
67384
|
full_name: create$4().required("Your full name is required"),
|
|
67378
67385
|
email: create$4().email().required(),
|
|
67379
67386
|
account: create$3().min(5).required("Your account no. is required"),
|
|
@@ -67384,13 +67391,13 @@ const Offline = react.exports.memo(({
|
|
|
67384
67391
|
return day >= startDay && day <= endDay;
|
|
67385
67392
|
}),
|
|
67386
67393
|
time: create$4().min(4).required("Please specify a time").test("time", "Selected time is out of Hours of Operation", function(value2) {
|
|
67387
|
-
const timeformat = "
|
|
67388
|
-
const check2 = hooks(value2, timeformat), beforeTime = hooks(fromTime, timeformat), afterTime = hooks(toTime, timeformat);
|
|
67389
|
-
return hooks(check2).
|
|
67394
|
+
const timeformat = "HH:mm:ss";
|
|
67395
|
+
const check2 = hooks(value2, timeformat), beforeTime = hooks.tz(fromTime, timeformat, companyTimezone).local(), afterTime = hooks.tz(toTime, timeformat, companyTimezone).local();
|
|
67396
|
+
return hooks(check2).isSameOrAfter(beforeTime) && hooks(check2).isSameOrBefore(afterTime);
|
|
67390
67397
|
}),
|
|
67391
67398
|
reason: create$4().min(1).required("Reason is required"),
|
|
67392
67399
|
mobile: create$4().min(7).required()
|
|
67393
|
-
});
|
|
67400
|
+
}), [companyTimezone, days$1, fromDay, toDay, fromTime, toTime]);
|
|
67394
67401
|
const emptyFields = react.exports.useMemo(() => {
|
|
67395
67402
|
const filledState = {};
|
|
67396
67403
|
fields && Object.keys(fields || {}).map((key) => {
|
|
@@ -67455,7 +67462,7 @@ const Offline = react.exports.memo(({
|
|
|
67455
67462
|
}) => {
|
|
67456
67463
|
try {
|
|
67457
67464
|
const currentTime = hooks.utc().format();
|
|
67458
|
-
const check2 = hooks(hooks(`${date4}
|
|
67465
|
+
const check2 = hooks(hooks(`${date4}T${time2}`, "YYYY-MM-DDTHH:mm").format()).isAfter(currentTime);
|
|
67459
67466
|
if (!check2) {
|
|
67460
67467
|
toast.error("Please, pick a time that is yet to go by", {
|
|
67461
67468
|
autoClose: 2e3
|
|
@@ -67473,7 +67480,7 @@ const Offline = react.exports.memo(({
|
|
|
67473
67480
|
formData.append("mobile", mobile);
|
|
67474
67481
|
formData.append("account", account);
|
|
67475
67482
|
formData.append("reason", reason2);
|
|
67476
|
-
formData.append("scheduledAt", hooks(`${date4}
|
|
67483
|
+
formData.append("scheduledAt", hooks(`${date4}T${time2}`, "YYYY-MM-DDTHH:mm").format());
|
|
67477
67484
|
formData.append("country", country);
|
|
67478
67485
|
formData.append("latitude", latitude);
|
|
67479
67486
|
formData.append("longitude", longitude);
|
|
@@ -67653,7 +67660,8 @@ const Offline = react.exports.memo(({
|
|
|
67653
67660
|
days: days$1,
|
|
67654
67661
|
fromDay,
|
|
67655
67662
|
toDay,
|
|
67656
|
-
date: values.date
|
|
67663
|
+
date: values.date,
|
|
67664
|
+
timezone: companyTimezone
|
|
67657
67665
|
}), /* @__PURE__ */ jsx(FInput, {
|
|
67658
67666
|
style: {
|
|
67659
67667
|
borderRight: void 0,
|
|
@@ -72059,6 +72067,7 @@ function ChatWidgetScreen({
|
|
|
72059
72067
|
setIsScheduling,
|
|
72060
72068
|
toTime: company == null ? void 0 : company.to_time,
|
|
72061
72069
|
fromTime: company == null ? void 0 : company.from_time,
|
|
72070
|
+
timezone: company == null ? void 0 : company.timezone,
|
|
72062
72071
|
toDay: company == null ? void 0 : company.to_day,
|
|
72063
72072
|
fromDay: company == null ? void 0 : company.from_day,
|
|
72064
72073
|
options: (company == null ? void 0 : company.options) || {},
|
|
@@ -72161,10 +72170,25 @@ const ChatInput = react.exports.memo(function({
|
|
|
72161
72170
|
console.log(error);
|
|
72162
72171
|
}
|
|
72163
72172
|
}, [stateRef, dataRef, socket2.connected, stateRef]);
|
|
72164
|
-
const handleFileUpload = (
|
|
72165
|
-
|
|
72166
|
-
|
|
72167
|
-
|
|
72173
|
+
const handleFileUpload = (event) => {
|
|
72174
|
+
var _a2, _b, _c;
|
|
72175
|
+
if ((_a2 = event == null ? void 0 : event.target) == null ? void 0 : _a2.files[0]) {
|
|
72176
|
+
const fileExtension = (_c = (_b = event == null ? void 0 : event.target) == null ? void 0 : _b.files[0]) == null ? void 0 : _c.type.split("/").pop();
|
|
72177
|
+
if (isFileType(fileExtension) === "document") {
|
|
72178
|
+
const file = event.target.files[0];
|
|
72179
|
+
const fileSizeLimit = 4 * 1024 * 1024;
|
|
72180
|
+
if (file.size > fileSizeLimit) {
|
|
72181
|
+
toast.info("File size exceeds the maximum limit (4 MB)");
|
|
72182
|
+
return;
|
|
72183
|
+
}
|
|
72184
|
+
setState({
|
|
72185
|
+
chatFiles: event.target.files[0]
|
|
72186
|
+
});
|
|
72187
|
+
} else {
|
|
72188
|
+
toast.info("File format not supported");
|
|
72189
|
+
return;
|
|
72190
|
+
}
|
|
72191
|
+
}
|
|
72168
72192
|
};
|
|
72169
72193
|
const handleEnterKeypress = (e2) => {
|
|
72170
72194
|
if (e2.key === "Enter") {
|
|
@@ -72218,6 +72242,8 @@ const ChatInput = react.exports.memo(function({
|
|
|
72218
72242
|
id: "widget-chat-input-field",
|
|
72219
72243
|
autoComplete: "off",
|
|
72220
72244
|
autoFocus: true,
|
|
72245
|
+
accept: ".docx, .pdf, .rtf, .txt, .doc",
|
|
72246
|
+
max: "4194304",
|
|
72221
72247
|
disabled: ((_a = document.getElementById("widget-file-upload-input")) == null ? void 0 : _a.value) !== ""
|
|
72222
72248
|
}), /* @__PURE__ */ jsx("img", {
|
|
72223
72249
|
onClick: chatFiles ? sendFile : sendMessage,
|
|
@@ -72538,8 +72564,8 @@ function WidgetOfflineHeader({
|
|
|
72538
72564
|
}), /* @__PURE__ */ jsx(SubTitle, {
|
|
72539
72565
|
from_day: company == null ? void 0 : company.from_day.substring(0, 3),
|
|
72540
72566
|
to_day: company == null ? void 0 : company.to_day.substring(0, 3),
|
|
72541
|
-
from_time: hooks.tz(company == null ? void 0 : company.from_time, "
|
|
72542
|
-
to_time: hooks.tz(company == null ? void 0 : company.to_time, "
|
|
72567
|
+
from_time: hooks.tz(company == null ? void 0 : company.from_time, "HH:mm:ss", company.timezone).local().format("hh:mm A"),
|
|
72568
|
+
to_time: hooks.tz(company == null ? void 0 : company.to_time, "HH:mm:ss", company.timezone).local().format("hh:mm A")
|
|
72543
72569
|
})]
|
|
72544
72570
|
});
|
|
72545
72571
|
}
|
|
@@ -74364,6 +74390,7 @@ const WidgetFormDisplay = react.exports.memo(({
|
|
|
74364
74390
|
fromTime: company == null ? void 0 : company.from_time,
|
|
74365
74391
|
toDay: company == null ? void 0 : company.to_day,
|
|
74366
74392
|
fromDay: company == null ? void 0 : company.from_day,
|
|
74393
|
+
timezone: company == null ? void 0 : company.timezone,
|
|
74367
74394
|
options: (company == null ? void 0 : company.options) || {}
|
|
74368
74395
|
}) : chatInit && !chatClose ? /* @__PURE__ */ jsx(Feedback$1, {
|
|
74369
74396
|
quickStopChat,
|