mozrest-sdk-react-dev 0.3.30 → 0.3.32
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/mozrest-sdk.es.js +43 -18
- package/package.json +1 -1
package/mozrest-sdk.es.js
CHANGED
|
@@ -126253,7 +126253,7 @@ const Chart = ({
|
|
|
126253
126253
|
...info,
|
|
126254
126254
|
name: hooks(day2.date, "YYYYMMDD").format("YYYY")
|
|
126255
126255
|
};
|
|
126256
|
-
if (day2.reservationPortal) {
|
|
126256
|
+
if (day2.reservationPortal && sources2) {
|
|
126257
126257
|
day2.reservationPortal.map((rp) => {
|
|
126258
126258
|
const source2 = sources2.find((s2) => s2.code === rp.name);
|
|
126259
126259
|
const sourceName = (source2 == null ? void 0 : source2.name) || rp.name;
|
|
@@ -126367,7 +126367,7 @@ const Chart = ({
|
|
|
126367
126367
|
border: "1px solid var(--moz-cta-content-sec-bg)"
|
|
126368
126368
|
}
|
|
126369
126369
|
}), sources2.map((src) => {
|
|
126370
|
-
const displayName = src.name === "Resbook" ? "Widget" : src.name;
|
|
126370
|
+
const displayName = src.name === "Resbook" ? "Widget" : (src == null ? void 0 : src.hubDisplayName) || (src == null ? void 0 : src.name);
|
|
126371
126371
|
return /* @__PURE__ */ jsx$1(Bar, {
|
|
126372
126372
|
dataKey: src.code,
|
|
126373
126373
|
name: displayName,
|
|
@@ -169938,37 +169938,62 @@ const CodeViewer = ({
|
|
|
169938
169938
|
})]
|
|
169939
169939
|
});
|
|
169940
169940
|
};
|
|
169941
|
+
const GetWidget = async () => {
|
|
169942
|
+
const responseData = await instance$1.get(
|
|
169943
|
+
`/widgets`
|
|
169944
|
+
);
|
|
169945
|
+
const data2 = responseData.data;
|
|
169946
|
+
return data2;
|
|
169947
|
+
};
|
|
169941
169948
|
function Main({
|
|
169942
169949
|
venueId
|
|
169943
169950
|
}) {
|
|
169944
169951
|
const {
|
|
169945
169952
|
t: t2
|
|
169946
169953
|
} = useTranslation();
|
|
169947
|
-
const
|
|
169948
|
-
|
|
169949
|
-
|
|
169954
|
+
const {
|
|
169955
|
+
data: data2,
|
|
169956
|
+
isLoading
|
|
169957
|
+
} = useFetch(GetWidget, {
|
|
169958
|
+
cacheId: "widget"
|
|
169959
|
+
});
|
|
169960
|
+
const [widgetUrl, setWidgetUrl] = useState(null);
|
|
169961
|
+
const buildWidgetUrl = (data22) => {
|
|
169962
|
+
const widget2 = data22 && data22.length > 0 ? data22[0] : {
|
|
169963
|
+
key: "61afa0d0b5fb12d27dfa89e3"
|
|
169964
|
+
};
|
|
169965
|
+
const widgetKey = widget2 == null ? void 0 : widget2.key;
|
|
169966
|
+
const widgetHost = "https://widget-dev.mozrest.com";
|
|
169967
|
+
const widgetUrl2 = `${widgetHost}/?key=${widgetKey}&mzId=${venueId}`;
|
|
169968
|
+
setWidgetUrl(widgetUrl2);
|
|
169969
|
+
};
|
|
169970
|
+
useEffect(() => {
|
|
169971
|
+
buildWidgetUrl(data2);
|
|
169972
|
+
}, [data2]);
|
|
169950
169973
|
const widgetCode = `<iframe
|
|
169951
169974
|
src="${widgetUrl}"
|
|
169952
169975
|
frameborder="0"
|
|
169953
169976
|
style="width: 100%; min-height: calc(-130px + 100vh)"
|
|
169954
169977
|
>
|
|
169955
169978
|
</iframe>`;
|
|
169956
|
-
return /* @__PURE__ */
|
|
169979
|
+
return /* @__PURE__ */ jsx$1(LayoutPage$1, {
|
|
169957
169980
|
header: /* @__PURE__ */ jsx$1("h1", {
|
|
169958
169981
|
children: t2("widget")
|
|
169959
169982
|
}),
|
|
169960
|
-
children:
|
|
169961
|
-
|
|
169962
|
-
|
|
169963
|
-
|
|
169964
|
-
|
|
169965
|
-
|
|
169966
|
-
|
|
169967
|
-
|
|
169968
|
-
|
|
169969
|
-
|
|
169970
|
-
|
|
169971
|
-
|
|
169983
|
+
children: isLoading ? /* @__PURE__ */ jsx$1(SkeletonPage, {}) : /* @__PURE__ */ jsxs(React__default.Fragment, {
|
|
169984
|
+
children: [/* @__PURE__ */ jsx$1(CodeViewer, {
|
|
169985
|
+
code: widgetCode
|
|
169986
|
+
}), /* @__PURE__ */ jsx$1("div", {
|
|
169987
|
+
className: styles$6.buttonContainer,
|
|
169988
|
+
children: /* @__PURE__ */ jsx$1(Button$1, {
|
|
169989
|
+
mode: "primary",
|
|
169990
|
+
onClick: () => {
|
|
169991
|
+
window.open(widgetUrl, "_blank");
|
|
169992
|
+
},
|
|
169993
|
+
children: t2("openWidget")
|
|
169994
|
+
})
|
|
169995
|
+
})]
|
|
169996
|
+
})
|
|
169972
169997
|
});
|
|
169973
169998
|
}
|
|
169974
169999
|
const skeleton = "_skeleton_1bgvx_1";
|