@sawport/react-sdk 0.1.0-alpha.80 → 0.1.0-alpha.81.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/dist/index.js +105 -12
- package/dist/index.umd.js +6 -6
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -70156,7 +70156,8 @@ const Schedule = ({
|
|
|
70156
70156
|
join: join2,
|
|
70157
70157
|
reschedule,
|
|
70158
70158
|
id: id2,
|
|
70159
|
-
cancelCall
|
|
70159
|
+
cancelCall,
|
|
70160
|
+
duration
|
|
70160
70161
|
}) => {
|
|
70161
70162
|
const onJoin = () => join2({
|
|
70162
70163
|
conversation
|
|
@@ -70190,22 +70191,22 @@ const Schedule = ({
|
|
|
70190
70191
|
className: styles$2.schTime,
|
|
70191
70192
|
children: hooks(scheduledAt).calendar(null, {
|
|
70192
70193
|
lastDay: function() {
|
|
70193
|
-
return `[Yesterday at] hh:mm A - [${hooks(this).add(
|
|
70194
|
+
return `[Yesterday at] hh:mm A - [${hooks(this).add(duration, "minutes").format("hh:mm A")}]`;
|
|
70194
70195
|
},
|
|
70195
70196
|
sameDay: function() {
|
|
70196
|
-
return `[Today at] hh:mm A - [${hooks(this).add(
|
|
70197
|
+
return `[Today at] hh:mm A - [${hooks(this).add(duration, "minutes").format("hh:mm A")}]`;
|
|
70197
70198
|
},
|
|
70198
70199
|
nextDay: function() {
|
|
70199
|
-
return `[Tomorrow at] hh:mm A - [${hooks(this).add(
|
|
70200
|
+
return `[Tomorrow at] hh:mm A - [${hooks(this).add(duration, "minutes").format("hh:mm A")}]`;
|
|
70200
70201
|
},
|
|
70201
70202
|
lastWeek: function() {
|
|
70202
|
-
return `[last] dddd [at] hh:mm A - [${hooks(this).add(
|
|
70203
|
+
return `[last] dddd [at] hh:mm A - [${hooks(this).add(duration, "minutes").format("hh:mm A")}]`;
|
|
70203
70204
|
},
|
|
70204
70205
|
nextWeek: function() {
|
|
70205
|
-
return `dddd [at] hh:mm A - [${hooks(this).add(
|
|
70206
|
+
return `dddd [at] hh:mm A - [${hooks(this).add(duration, "minutes").format("hh:mm A")}]`;
|
|
70206
70207
|
},
|
|
70207
70208
|
sameElse: function() {
|
|
70208
|
-
return `hh:mm A - [${hooks(this).add(
|
|
70209
|
+
return `hh:mm A - [${hooks(this).add(duration, "minutes").format("hh:mm A")}]`;
|
|
70209
70210
|
}
|
|
70210
70211
|
})
|
|
70211
70212
|
})]
|
|
@@ -75945,6 +75946,7 @@ const Marquee = reactExports.forwardRef(function Marquee2({
|
|
|
75945
75946
|
})]
|
|
75946
75947
|
});
|
|
75947
75948
|
});
|
|
75949
|
+
const dayOrder = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
|
|
75948
75950
|
function SubTitle({
|
|
75949
75951
|
timezone: timezone2,
|
|
75950
75952
|
workHours = defaultWorkHours
|
|
@@ -75952,7 +75954,7 @@ function SubTitle({
|
|
|
75952
75954
|
var _a;
|
|
75953
75955
|
const localWorkHours = reactExports.useMemo(() => {
|
|
75954
75956
|
const newHours = lodashExports.cloneDeep(workHours);
|
|
75955
|
-
Object.keys(newHours).map((day) => {
|
|
75957
|
+
Object.keys(newHours).sort((a2, b2) => dayOrder.indexOf(a2) - dayOrder.indexOf(b2)).map((day) => {
|
|
75956
75958
|
var _a2;
|
|
75957
75959
|
(_a2 = newHours[day].times) == null ? void 0 : _a2.map((_2, i2) => {
|
|
75958
75960
|
const [from2, to2] = newHours[day].times[i2];
|
|
@@ -76931,7 +76933,8 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
76931
76933
|
});
|
|
76932
76934
|
} catch (e2) {
|
|
76933
76935
|
if (e2.message !== "Permission denied") {
|
|
76934
|
-
toast.error("
|
|
76936
|
+
toast.error("Unable to start screen sharing. Please check your permissions and try again.");
|
|
76937
|
+
console.error("Screen sharing error:", e2);
|
|
76935
76938
|
}
|
|
76936
76939
|
}
|
|
76937
76940
|
const { peerConnection, localStream, screenStream } = ref.current;
|
|
@@ -77606,6 +77609,87 @@ const LongestWaitTime = reactExports.memo(() => {
|
|
|
77606
77609
|
})
|
|
77607
77610
|
});
|
|
77608
77611
|
});
|
|
77612
|
+
const _Language = class _Language {
|
|
77613
|
+
static onFirstTranslation(language) {
|
|
77614
|
+
setTimeout(() => {
|
|
77615
|
+
var _a;
|
|
77616
|
+
const value2 = (_a = document.querySelector(".goog-te-combo")) == null ? void 0 : _a.value;
|
|
77617
|
+
if (value2 !== language) {
|
|
77618
|
+
this.triggerTranslateTo(language);
|
|
77619
|
+
}
|
|
77620
|
+
}, 500);
|
|
77621
|
+
}
|
|
77622
|
+
static triggerTranslateTo(language) {
|
|
77623
|
+
const selectField = document.querySelector(".goog-te-combo");
|
|
77624
|
+
if (selectField) {
|
|
77625
|
+
selectField.value = language;
|
|
77626
|
+
selectField.dispatchEvent(new Event("change"));
|
|
77627
|
+
}
|
|
77628
|
+
}
|
|
77629
|
+
static observeFirstTranslation(language) {
|
|
77630
|
+
const observer = new MutationObserver((mutationsList) => {
|
|
77631
|
+
var _a, _b;
|
|
77632
|
+
for (let mutation of mutationsList) {
|
|
77633
|
+
if (mutation.type === "childList" || mutation.type === "subtree") {
|
|
77634
|
+
this.onFirstTranslation(language);
|
|
77635
|
+
observer.disconnect();
|
|
77636
|
+
(_a = this.docObserver) == null ? void 0 : _a.disconnect();
|
|
77637
|
+
(_b = this.bodyObserver) == null ? void 0 : _b.disconnect();
|
|
77638
|
+
break;
|
|
77639
|
+
}
|
|
77640
|
+
}
|
|
77641
|
+
});
|
|
77642
|
+
observer.observe(document.querySelector(".goog-te-combo"), {
|
|
77643
|
+
childList: true,
|
|
77644
|
+
subtree: true
|
|
77645
|
+
});
|
|
77646
|
+
}
|
|
77647
|
+
static checkAndRevertStyle(elem, type4) {
|
|
77648
|
+
const cssText = elem.style.cssText;
|
|
77649
|
+
if (cssText !== this[type4]) {
|
|
77650
|
+
elem.style.cssText = this[type4];
|
|
77651
|
+
}
|
|
77652
|
+
}
|
|
77653
|
+
static observeElemStyle(type4) {
|
|
77654
|
+
const elems = { currentHtmlStyle: document.documentElement, currentBodyStyle: document.body };
|
|
77655
|
+
const elem = elems[type4];
|
|
77656
|
+
const observer = new MutationObserver((mutations) => {
|
|
77657
|
+
mutations.forEach((mutation) => {
|
|
77658
|
+
if (mutation.attributeName === "style") {
|
|
77659
|
+
this.checkAndRevertStyle(elem, type4);
|
|
77660
|
+
}
|
|
77661
|
+
});
|
|
77662
|
+
});
|
|
77663
|
+
observer.observe(elem, {
|
|
77664
|
+
attributes: true,
|
|
77665
|
+
// Observe elemattribute changes (like style)
|
|
77666
|
+
attributeFilter: ["style"]
|
|
77667
|
+
// Only observe style changes
|
|
77668
|
+
});
|
|
77669
|
+
return observer;
|
|
77670
|
+
}
|
|
77671
|
+
};
|
|
77672
|
+
__publicField(_Language, "currentHtmlStyle");
|
|
77673
|
+
__publicField(_Language, "currentBodyStyle");
|
|
77674
|
+
__publicField(_Language, "bodyObserver");
|
|
77675
|
+
__publicField(_Language, "docObserver");
|
|
77676
|
+
__publicField(_Language, "loadGoogleTranslate", lodashExports.once(({ language = "en" }) => {
|
|
77677
|
+
_Language.currentHtmlStyle = document.documentElement.style.cssText;
|
|
77678
|
+
_Language.currentBodyStyle = document.body.style.cssText;
|
|
77679
|
+
if (!window.google || !window.google.translate) {
|
|
77680
|
+
const script = document.createElement("script");
|
|
77681
|
+
script.src = "//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit";
|
|
77682
|
+
script.async = true;
|
|
77683
|
+
document.body.appendChild(script);
|
|
77684
|
+
}
|
|
77685
|
+
window.googleTranslateElementInit = () => {
|
|
77686
|
+
_Language.docObserver = _Language.observeElemStyle("currentHtmlStyle");
|
|
77687
|
+
_Language.bodyObserver = _Language.observeElemStyle("currentBodyStyle");
|
|
77688
|
+
new window.google.translate.TranslateElement({ pageLanguage: "en" }, "g-translate-widget");
|
|
77689
|
+
_Language.observeFirstTranslation(language);
|
|
77690
|
+
};
|
|
77691
|
+
}));
|
|
77692
|
+
let Language = _Language;
|
|
77609
77693
|
String.prototype.truncate = String.prototype.truncate || function(n2, useWordBoundary) {
|
|
77610
77694
|
if (this.length <= n2) {
|
|
77611
77695
|
return this;
|
|
@@ -77617,6 +77701,7 @@ function UnwrapWidget({
|
|
|
77617
77701
|
user: companyUser_,
|
|
77618
77702
|
projectId
|
|
77619
77703
|
}) {
|
|
77704
|
+
var _a;
|
|
77620
77705
|
const config = useSawportConfig();
|
|
77621
77706
|
const companyUser = reactExports.useMemo(() => companyUser_ || config.user, [companyUser_, config.user]);
|
|
77622
77707
|
reactExports.useEffect(() => {
|
|
@@ -77644,7 +77729,8 @@ function UnwrapWidget({
|
|
|
77644
77729
|
} = company;
|
|
77645
77730
|
const companyIsClosed = reactExports.useMemo(() => {
|
|
77646
77731
|
if (!isLoadingCompany && (company == null ? void 0 : company.name)) {
|
|
77647
|
-
const
|
|
77732
|
+
const timeZone = company.timezone ?? "UTC";
|
|
77733
|
+
const companyDate = hooks().tz(timeZone).utc();
|
|
77648
77734
|
const time2 = companyDate.clone();
|
|
77649
77735
|
const day = companyDate.format("dddd");
|
|
77650
77736
|
const workHours = company.work_hours || defaultWorkHours;
|
|
@@ -77652,8 +77738,8 @@ function UnwrapWidget({
|
|
|
77652
77738
|
if (workingDay.closed)
|
|
77653
77739
|
return true;
|
|
77654
77740
|
for (const [startTimeStr, endTimeStr] of workingDay.times) {
|
|
77655
|
-
const startTime = hooks(startTimeStr, "HH:mm").tz(
|
|
77656
|
-
const endTime = hooks(endTimeStr, "HH:mm").tz(
|
|
77741
|
+
const startTime = hooks(startTimeStr, "HH:mm").tz(timeZone).utc();
|
|
77742
|
+
const endTime = hooks(endTimeStr, "HH:mm").tz(timeZone).utc();
|
|
77657
77743
|
if (time2.isBetween(startTime, endTime, null, "[]"))
|
|
77658
77744
|
return false;
|
|
77659
77745
|
}
|
|
@@ -77670,6 +77756,12 @@ function UnwrapWidget({
|
|
|
77670
77756
|
};
|
|
77671
77757
|
}
|
|
77672
77758
|
}, [isLoadingCompany]);
|
|
77759
|
+
reactExports.useEffect(() => {
|
|
77760
|
+
var _a2, _b;
|
|
77761
|
+
((_a2 = company == null ? void 0 : company.options) == null ? void 0 : _a2.language) && Language.loadGoogleTranslate({
|
|
77762
|
+
language: (_b = company == null ? void 0 : company.options) == null ? void 0 : _b.language
|
|
77763
|
+
});
|
|
77764
|
+
}, [(_a = company == null ? void 0 : company.options) == null ? void 0 : _a.language]);
|
|
77673
77765
|
if (isLoadingCompany || isLoadingCompany === void 0) {
|
|
77674
77766
|
return null;
|
|
77675
77767
|
}
|
|
@@ -77680,6 +77772,7 @@ function UnwrapWidget({
|
|
|
77680
77772
|
}
|
|
77681
77773
|
},
|
|
77682
77774
|
children: [/* @__PURE__ */ jsx(ToastContainer, {}), /* @__PURE__ */ jsxs("div", {
|
|
77775
|
+
id: "g-translate-widget",
|
|
77683
77776
|
className: `widget-cover mb-2 ${isWidgetLaunched ? "widget-cover-container" : ""}`,
|
|
77684
77777
|
children: [/* @__PURE__ */ jsx(WidgetFormDisplay, {
|
|
77685
77778
|
companyIsClosed,
|