pb-sxp-ui 1.8.8 → 1.9.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.cjs +240 -253
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +67 -4
- package/dist/index.js +240 -253
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +240 -253
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +3 -3
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/Pagebuilder/index.js +4 -3
- package/es/core/components/SxpPageCore/index.d.ts +1 -1
- package/es/core/components/SxpPageCore/index.js +6 -7
- package/es/core/components/SxpPageRender/ExpandableText.js +1 -1
- package/es/core/components/SxpPageRender/Hashtag/index.js +2 -2
- package/es/core/components/SxpPageRender/Modal/index.js +44 -6
- package/es/core/components/SxpPageRender/index.js +3 -3
- package/es/core/components/SxpPageRender/typing.d.ts +0 -1
- package/es/core/context/SxpDataSourceProvider.d.ts +1 -4
- package/es/core/context/SxpDataSourceProvider.js +25 -51
- package/es/core/hooks/useFocusTrap.d.ts +2 -0
- package/es/core/hooks/useFocusTrap.js +37 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +4 -2
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
- package/es/materials/sxp/popup/CommodityList/index.js +32 -28
- package/es/materials/sxp/template/Appoint/index.js +1 -1
- package/es/materials/sxp/template/Commodity/index.js +4 -4
- package/es/materials/sxp/template/CommodityDiro/index.js +4 -4
- package/es/materials/sxp/template/CommodityDiroNew/index.js +4 -4
- package/es/materials/sxp/template/Link/index.js +1 -1
- package/es/materials/sxp/template/MultiCommodity/index.js +23 -42
- package/es/materials/sxp/template/MultiCommodityDiro/index.js +24 -42
- package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +25 -44
- package/es/materials/sxp/template/components/EventProvider.d.ts +2 -0
- package/es/materials/sxp/template/components/EventProvider.js +22 -11
- package/es/materials/sxp/template/components/Scroll.js +1 -1
- package/lib/core/Pagebuilder/index.js +4 -3
- package/lib/core/components/SxpPageCore/index.d.ts +1 -1
- package/lib/core/components/SxpPageCore/index.js +5 -6
- package/lib/core/components/SxpPageRender/ExpandableText.js +1 -1
- package/lib/core/components/SxpPageRender/Hashtag/index.js +2 -2
- package/lib/core/components/SxpPageRender/Modal/index.js +44 -6
- package/lib/core/components/SxpPageRender/index.js +3 -3
- package/lib/core/components/SxpPageRender/typing.d.ts +0 -1
- package/lib/core/context/SxpDataSourceProvider.d.ts +1 -4
- package/lib/core/context/SxpDataSourceProvider.js +25 -51
- package/lib/core/hooks/useFocusTrap.d.ts +2 -0
- package/lib/core/hooks/useFocusTrap.js +39 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.js +4 -2
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
- package/lib/materials/sxp/popup/CommodityList/index.js +32 -28
- package/lib/materials/sxp/template/Appoint/index.js +1 -1
- package/lib/materials/sxp/template/Commodity/index.js +4 -4
- package/lib/materials/sxp/template/CommodityDiro/index.js +4 -4
- package/lib/materials/sxp/template/CommodityDiroNew/index.js +4 -4
- package/lib/materials/sxp/template/Link/index.js +1 -1
- package/lib/materials/sxp/template/MultiCommodity/index.js +22 -41
- package/lib/materials/sxp/template/MultiCommodityDiro/index.js +23 -41
- package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +24 -43
- package/lib/materials/sxp/template/components/EventProvider.d.ts +2 -0
- package/lib/materials/sxp/template/components/EventProvider.js +21 -10
- package/lib/materials/sxp/template/components/Scroll.js +1 -1
- package/package.json +1 -1
@@ -11,19 +11,18 @@ const RESOLVER = {};
|
|
11
11
|
Object.values(_materials_).forEach((v) => {
|
12
12
|
RESOLVER[v.extend.type] = v;
|
13
13
|
});
|
14
|
-
const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain,
|
15
|
-
var _a, _b, _c, _d, _e, _f;
|
14
|
+
const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain, licenseUrl, enabledMetaConversionApi }) => {
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
16
16
|
const utmVal = (0, react_1.useMemo)(() => {
|
17
17
|
var _a;
|
18
18
|
const searchParams = (location === null || location === void 0 ? void 0 : location.search) ? (_a = location === null || location === void 0 ? void 0 : location.search) === null || _a === void 0 ? void 0 : _a.replace('?', '') : '';
|
19
19
|
return searchParams;
|
20
20
|
}, []);
|
21
|
-
|
22
|
-
|
23
|
-
react_1.default.createElement(SxpDataSourceProvider_1.default, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter, data: data, dataList: dataList, onUpdateSchema: (d) => setSchema(d), render: ({ rtcList, tagList, pageData }) => {
|
21
|
+
return (react_1.default.createElement(core_1.EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: data === null || data === void 0 ? void 0 : data.data, utmVal: utmVal },
|
22
|
+
react_1.default.createElement(SxpDataSourceProvider_1.default, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, isShowTag: (_j = (_h = (_g = data === null || data === void 0 ? void 0 : data.data) === null || _g === void 0 ? void 0 : _g.sxpPageConf) === null || _h === void 0 ? void 0 : _h.globalConfig) === null || _j === void 0 ? void 0 : _j.isShowTag, globalConfig: (_l = (_k = data === null || data === void 0 ? void 0 : data.data) === null || _k === void 0 ? void 0 : _k.sxpPageConf) === null || _l === void 0 ? void 0 : _l.globalConfig, utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter, render: ({ rtcList, tagList }) => {
|
24
23
|
var _a;
|
25
24
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
26
|
-
react_1.default.createElement(SxpPageRender_1.default, Object.assign({}, (_a =
|
25
|
+
react_1.default.createElement(SxpPageRender_1.default, Object.assign({}, (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER, licenseUrl: licenseUrl })),
|
27
26
|
react_1.default.createElement(Popup_1.default, null)));
|
28
27
|
} })));
|
29
28
|
};
|
@@ -53,7 +53,7 @@ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldTex
|
|
53
53
|
wordBreak: 'break-word'
|
54
54
|
}, dangerouslySetInnerHTML: { __html: (0, tool_1.setFontForText)(text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>'), style) } }),
|
55
55
|
react_1.default.createElement("div", { ref: multiRowCopy, dangerouslySetInnerHTML: { __html: (0, tool_1.setFontForText)(text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>'), style) } }),
|
56
|
-
text && isPost && isShow && (react_1.default.createElement("
|
56
|
+
text && isPost && isShow && (react_1.default.createElement("button", { "aria-label": isShowMore ? unfoldText || 'show less' : foldText || 'show more', style: { textDecoration: 'underline', cursor: 'pointer' }, onClick: onClick !== null && onClick !== void 0 ? onClick : handleClick, dangerouslySetInnerHTML: {
|
57
57
|
__html: (0, tool_1.setFontForText)(isShowMore ? unfoldText || 'show less' : foldText || 'show more', style)
|
58
58
|
} }))));
|
59
59
|
};
|
@@ -43,7 +43,7 @@ const Hashtag = ({ tags, itemId, itemType, index, rec, hashTagStyle, hashTagRigh
|
|
43
43
|
marginTop: `${(_a = hashTagStyle === null || hashTagStyle === void 0 ? void 0 : hashTagStyle.marginTop) !== null && _a !== void 0 ? _a : 16}px`,
|
44
44
|
width: hashTagRightMargin
|
45
45
|
} },
|
46
|
-
react_1.default.createElement(Scroll_1.default, null, tags === null || tags === void 0 ? void 0 : tags.map((item, index) => (react_1.default.createElement(react_2.SwiperSlide, { key: index, hidden: !isShowMore ? index >= 6 : false, className: 'clc-sxp-bottom-hashtag-item', style: hashTagStyle, onClick: () => handleClickTag(item), tag: '
|
47
|
-
react_1.default.createElement("
|
46
|
+
react_1.default.createElement(Scroll_1.default, null, tags === null || tags === void 0 ? void 0 : tags.map((item, index) => (react_1.default.createElement(react_2.SwiperSlide, { key: index, hidden: !isShowMore ? index >= 6 : false, className: 'clc-sxp-bottom-hashtag-item', style: hashTagStyle, onClick: () => handleClickTag(item), tag: 'li', role: 'listitem' },
|
47
|
+
react_1.default.createElement("button", { className: 'clc-sxp-bottom-hashtag-item-button', "aria-label": item, "aria-describedby": item, dangerouslySetInnerHTML: { __html: (0, tool_1.setFontForText)(`#${item}`, hashTagStyle) } })))))));
|
48
48
|
};
|
49
49
|
exports.default = (0, react_1.memo)(Hashtag);
|
@@ -12,6 +12,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
12
12
|
const fTouchRef = (0, react_1.useRef)(null);
|
13
13
|
const touchMoveRef = (0, react_1.useRef)(null);
|
14
14
|
const ref = (0, react_1.useRef)(null);
|
15
|
+
const modalRef = (0, react_1.useRef)(null);
|
15
16
|
const MODAL_DEF_TRANS = fullHeight * 0.2;
|
16
17
|
const MODAL_DEF_CON_H = isFullScreen ? fullHeight : fullHeight * 0.8;
|
17
18
|
const [modalTrans, setModalTrans] = (0, react_1.useState)(MODAL_DEF_TRANS);
|
@@ -59,6 +60,43 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
59
60
|
const child = (0, react_1.useCallback)(() => {
|
60
61
|
return children;
|
61
62
|
}, [_popup, openState, globalConfig]);
|
63
|
+
(0, react_1.useEffect)(() => {
|
64
|
+
const trapFocus = (element) => {
|
65
|
+
var focusableEls = element === null || element === void 0 ? void 0 : element.querySelectorAll('a, a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])');
|
66
|
+
var firstFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[0];
|
67
|
+
var lastFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[(focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls.length) - 1];
|
68
|
+
var KEYCODE_TAB = 9;
|
69
|
+
element.addEventListener('keydown', function (e) {
|
70
|
+
if (e.key === 'Escape' || e.key === 'Esc') {
|
71
|
+
handleClose();
|
72
|
+
e.preventDefault();
|
73
|
+
}
|
74
|
+
var isTabPressed = e.key === 'Tab' || e.keyCode === KEYCODE_TAB;
|
75
|
+
if (!isTabPressed) {
|
76
|
+
return;
|
77
|
+
}
|
78
|
+
if (e.shiftKey) {
|
79
|
+
if ((document === null || document === void 0 ? void 0 : document.activeElement) === firstFocusableEl) {
|
80
|
+
lastFocusableEl === null || lastFocusableEl === void 0 ? void 0 : lastFocusableEl.focus();
|
81
|
+
e.preventDefault();
|
82
|
+
}
|
83
|
+
}
|
84
|
+
else {
|
85
|
+
if ((document === null || document === void 0 ? void 0 : document.activeElement) === lastFocusableEl) {
|
86
|
+
firstFocusableEl === null || firstFocusableEl === void 0 ? void 0 : firstFocusableEl.focus();
|
87
|
+
e.preventDefault();
|
88
|
+
}
|
89
|
+
}
|
90
|
+
});
|
91
|
+
firstFocusableEl === null || firstFocusableEl === void 0 ? void 0 : firstFocusableEl.focus();
|
92
|
+
};
|
93
|
+
if (modalRef === null || modalRef === void 0 ? void 0 : modalRef.current)
|
94
|
+
trapFocus(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current);
|
95
|
+
return () => {
|
96
|
+
var _a;
|
97
|
+
(_a = modalRef === null || modalRef === void 0 ? void 0 : modalRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('keydown', trapFocus);
|
98
|
+
};
|
99
|
+
}, [modalRef, isShow, _popup]);
|
62
100
|
if (!modalEleRef.current)
|
63
101
|
return null;
|
64
102
|
const handleClose = (0, lodash_1.debounce)(() => {
|
@@ -120,7 +158,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
120
158
|
width: `calc(100% - ${((_r = (_q = (_p = (_o = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _o === void 0 ? void 0 : _o.props) === null || _p === void 0 ? void 0 : _p.popupBg) === null || _q === void 0 ? void 0 : _q.horizontalMargin) !== null && _r !== void 0 ? _r : 0) * 2}px)`,
|
121
159
|
height: '100%'
|
122
160
|
} },
|
123
|
-
react_1.default.createElement("div", Object.assign({ className: `modal-container ${isOpen ? 'modal-popIn' : 'modal-popOut'}`, role: 'dialog', "aria-label": (_s = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _s === void 0 ? void 0 : _s.displayName, "aria-modal": true, style: Object.assign(Object.assign({ padding, animationDuration: ((_t = popup === null || popup === void 0 ? void 0 : popup.duration) !== null && _t !== void 0 ? _t : 0) / 1000 + 's' }, (isScrollFullScreen && {
|
161
|
+
react_1.default.createElement("div", Object.assign({ ref: modalRef, className: `modal-container ${isOpen ? 'modal-popIn' : 'modal-popOut'}`, role: 'dialog', "aria-label": (_s = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _s === void 0 ? void 0 : _s.displayName, "aria-modal": true, "aria-labelledby": 'modal-content', style: Object.assign(Object.assign({ padding, animationDuration: ((_t = popup === null || popup === void 0 ? void 0 : popup.duration) !== null && _t !== void 0 ? _t : 0) / 1000 + 's' }, (isScrollFullScreen && {
|
124
162
|
transform: `translateY(${modalTrans}px)`
|
125
163
|
})), { overflow: 'hidden', borderRadius: `${(_x = (_w = (_v = (_u = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _u === void 0 ? void 0 : _u.props) === null || _v === void 0 ? void 0 : _v.popupBg) === null || _w === void 0 ? void 0 : _w.borderRadius) !== null && _x !== void 0 ? _x : 0}px`, zIndex: 9 }), onClick: (e) => {
|
126
164
|
e.stopPropagation();
|
@@ -130,17 +168,17 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
130
168
|
onTouchStart: handleTouchStart,
|
131
169
|
onTouchEnd: handleTouchEnd
|
132
170
|
})),
|
133
|
-
react_1.default.createElement("
|
134
|
-
react_1.default.createElement("img", { src: (_y = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) !== null && _y !== void 0 ? _y : closeIcon, alt: 'close button', className: 'modal-icon' })),
|
135
|
-
react_1.default.createElement("div", Object.assign({ ref: ref, style: {
|
171
|
+
react_1.default.createElement("div", Object.assign({ id: 'modal-content', ref: ref, style: {
|
136
172
|
height: isScrollFullScreen ? fullHeight : MODAL_DEF_CON_H,
|
137
173
|
overflow: (isScrollFullScreen && modalTrans <= 0) || !isScrollFullScreen ? 'auto' : 'hidden',
|
138
174
|
zIndex: 1
|
139
|
-
} }, (((
|
175
|
+
} }, (((_z = (_y = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _y === void 0 ? void 0 : _y.props) === null || _z === void 0 ? void 0 : _z.enableFixedCloseButton) && {
|
140
176
|
onScroll: (e) => {
|
141
177
|
var _a;
|
142
178
|
setScrollTop(15 - ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.scrollTop));
|
143
179
|
}
|
144
|
-
})), child())
|
180
|
+
})), child()),
|
181
|
+
react_1.default.createElement("button", { className: 'modal-icon-wrapper', role: 'button', "aria-label": 'close button', onClick: onClose, style: { top: scrollTop } },
|
182
|
+
react_1.default.createElement("img", { src: (_0 = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) !== null && _0 !== void 0 ? _0 : closeIcon, alt: 'close button', className: 'modal-icon' }))))))), modalEleRef.current);
|
145
183
|
};
|
146
184
|
exports.default = (0, react_1.memo)(Modal);
|
@@ -496,9 +496,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
496
496
|
alignItems: 'center'
|
497
497
|
} },
|
498
498
|
react_1.default.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
499
|
+
renderBottom(rec, index),
|
499
500
|
renderLikeButton(rec, index, !(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
500
501
|
renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
|
501
|
-
renderBottom(rec, index),
|
502
502
|
renderContent(rec, index)))))));
|
503
503
|
});
|
504
504
|
}, [
|
@@ -564,9 +564,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
564
564
|
}
|
565
565
|
}
|
566
566
|
}, direction: 'vertical', height: height },
|
567
|
+
renderView,
|
567
568
|
renderLikeButton(visList[activeIndex], activeIndex, !!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
568
|
-
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
|
569
|
-
renderView),
|
569
|
+
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
|
570
570
|
react_1.default.createElement(WaterFall_1.default, Object.assign({}, (_w = (_v = (_u = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _u === void 0 ? void 0 : _u[0]) === null || _v === void 0 ? void 0 : _v.item) === null || _w === void 0 ? void 0 : _w.props)),
|
571
571
|
react_1.default.createElement(ConsentPopup_1.default, { resolver: resolver, globalConfig: globalConfig })));
|
572
572
|
};
|
@@ -100,7 +100,6 @@ export interface SxpDataSourceProviderProps {
|
|
100
100
|
mutateLike: (body: {
|
101
101
|
content: string;
|
102
102
|
}) => Promise<boolean>;
|
103
|
-
pageData?: PageData;
|
104
103
|
}) => ReactNode;
|
105
104
|
utmVal?: string;
|
106
105
|
enableReportEvent?: boolean;
|
@@ -113,6 +112,7 @@ export interface SxpDataSourceProviderProps {
|
|
113
112
|
loadingImage?: string;
|
114
113
|
isOpenHashTag?: boolean;
|
115
114
|
enabledMetaConversionApi?: boolean;
|
115
|
+
isShowTag?: boolean;
|
116
116
|
consentWidth?: number;
|
117
117
|
consentHeight?: number;
|
118
118
|
isOpenConsent?: boolean;
|
@@ -120,9 +120,6 @@ export interface SxpDataSourceProviderProps {
|
|
120
120
|
isEditor?: boolean;
|
121
121
|
utmParameter?: PageData['utm_parameter'];
|
122
122
|
channelQueryList?: any[];
|
123
|
-
data?: PageData;
|
124
|
-
dataList?: PageData[];
|
125
|
-
onUpdateSchema?: (d: PageData['data']) => void;
|
126
123
|
}
|
127
124
|
export declare const DEFAULT_TAG = "FOR U";
|
128
125
|
declare const _default: React.NamedExoticComponent<SxpDataSourceProviderProps>;
|
@@ -20,8 +20,8 @@ var DataSourceType;
|
|
20
20
|
DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
|
21
21
|
})(DataSourceType || (DataSourceType = {}));
|
22
22
|
exports.DEFAULT_TAG = 'FOR U';
|
23
|
-
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList
|
24
|
-
var _a, _b, _c
|
23
|
+
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isShowTag = true, isOpenConsent = false, globalConfig, isEditor = false, utmParameter, channelQueryList }) => {
|
24
|
+
var _a, _b, _c;
|
25
25
|
const [rtcList, setRtcList] = (0, react_1.useState)([]);
|
26
26
|
const [tagList, setTagList] = (0, react_1.useState)([]);
|
27
27
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
@@ -42,19 +42,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
42
42
|
const checkCommodityIndexRef = (0, react_1.useRef)(-1);
|
43
43
|
const popupCurTimeRef = (0, react_1.useRef)(null);
|
44
44
|
const [isNoMoreData, setIsNoMoreData] = (0, react_1.useState)(false);
|
45
|
-
const [globalConfig, setGlobalConfig] = (0, react_1.useState)((_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.globalConfig);
|
46
|
-
const [pageData, setPageData] = (0, react_1.useState)(data);
|
47
|
-
const [showConsent, setShowConsent] = (0, react_1.useState)(false);
|
48
|
-
const [layoutVariantId, setLayoutVariantId] = (0, react_1.useState)();
|
49
|
-
const isShowTag = (0, react_1.useMemo)(() => {
|
50
|
-
var _a, _b, _c;
|
51
|
-
return !!((_c = (_b = (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig) === null || _c === void 0 ? void 0 : _c.isShowTag);
|
52
|
-
}, [pageData]);
|
53
45
|
const isShowConsent = (0, react_1.useMemo)(() => {
|
54
46
|
var _a, _b, _c, _d;
|
55
|
-
return (((
|
56
|
-
|
57
|
-
}, [isAgreePolicy, globalConfig, isOpenConsent, isEditor, showConsent]);
|
47
|
+
return (((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent;
|
48
|
+
}, [isAgreePolicy, globalConfig, isOpenConsent, isEditor]);
|
58
49
|
const getFilterRecList = (0, react_1.useCallback)((data) => {
|
59
50
|
var _a;
|
60
51
|
const recList = data === null || data === void 0 ? void 0 : data.recList;
|
@@ -111,14 +102,14 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
111
102
|
.catch((err) => Promise.reject(err));
|
112
103
|
}, [bffDataSource]);
|
113
104
|
const getRecommendVideos = (0, react_1.useCallback)((query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
114
|
-
var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s
|
115
|
-
query = Object.assign(Object.assign(Object.assign({ maxSize: (
|
105
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
106
|
+
query = Object.assign(Object.assign(Object.assign({ maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize, defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : defaultSize, hashTag: query === null || query === void 0 ? void 0 : query.hashTag, traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo, themeTag: query === null || query === void 0 ? void 0 : query.themeTag }, ((query === null || query === void 0 ? void 0 : query.contentFilter) && { contentFilter: `[${query === null || query === void 0 ? void 0 : query.contentFilter}]` })), ((query === null || query === void 0 ? void 0 : query.productFilter) && { productFilter: `[${query === null || query === void 0 ? void 0 : query.productFilter}]` })), { pageNum: query === null || query === void 0 ? void 0 : query.pageNum });
|
116
107
|
if (utmVal) {
|
117
|
-
const val = (
|
108
|
+
const val = (_h = (_g = (_f = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _f === void 0 ? void 0 : _f.filter((val) => {
|
118
109
|
var _a, _b;
|
119
110
|
const key = val.split('=')[0];
|
120
111
|
return (_b = ((_a = utmParameter === null || utmParameter === void 0 ? void 0 : utmParameter.channels) !== null && _a !== void 0 ? _a : [])) === null || _b === void 0 ? void 0 : _b.includes(key);
|
121
|
-
})) === null ||
|
112
|
+
})) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
|
122
113
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
123
114
|
}
|
124
115
|
if (isEditor) {
|
@@ -131,17 +122,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
131
122
|
let list = [];
|
132
123
|
let result = null;
|
133
124
|
const recurveRecList = (query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
134
|
-
var _u, _v, _w, _x, _y
|
125
|
+
var _t, _u, _v, _w, _x, _y;
|
135
126
|
query.pageNum = pageNum;
|
136
127
|
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
137
128
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
138
129
|
return undefined;
|
139
130
|
}
|
140
131
|
setLoading(false);
|
141
|
-
list = list.concat((
|
132
|
+
list = list.concat((_w = (_v = (_u = (_t = result === null || result === void 0 ? void 0 : result.data) === null || _t === void 0 ? void 0 : _t.recList) === null || _u === void 0 ? void 0 : _u.filter) === null || _v === void 0 ? void 0 : _v.call(_u, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _w !== void 0 ? _w : []);
|
142
133
|
setRtcList(getFilterRecList(Object.assign(Object.assign({}, result.data), { recList: list })));
|
143
134
|
setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result.data), { recList: list })));
|
144
|
-
const isNotNullList = (
|
135
|
+
const isNotNullList = (_y = (_x = result === null || result === void 0 ? void 0 : result.data) === null || _x === void 0 ? void 0 : _x.recList) === null || _y === void 0 ? void 0 : _y.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
|
145
136
|
if (isNotNullList) {
|
146
137
|
pageNum = pageNum + 1;
|
147
138
|
yield recurveRecList(query);
|
@@ -149,11 +140,11 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
149
140
|
});
|
150
141
|
yield recurveRecList(query);
|
151
142
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
|
152
|
-
setCurReqInfo({ rtc: (
|
143
|
+
setCurReqInfo({ rtc: (_j = result === null || result === void 0 ? void 0 : result.data) === null || _j === void 0 ? void 0 : _j.rtc, requestId: (_k = result === null || result === void 0 ? void 0 : result.data) === null || _k === void 0 ? void 0 : _k.requestId });
|
153
144
|
return Object.assign(Object.assign({}, result.data), { recList: list });
|
154
145
|
}
|
155
146
|
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
156
|
-
query = Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (
|
147
|
+
query = Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (_l = query === null || query === void 0 ? void 0 : query.pageNum) !== null && _l !== void 0 ? _l : 1 });
|
157
148
|
}
|
158
149
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
159
150
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
@@ -163,8 +154,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
163
154
|
setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
|
164
155
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor) {
|
165
156
|
let list = [];
|
166
|
-
list = list.concat((
|
167
|
-
const isNotNullList = (
|
157
|
+
list = list.concat((_q = (_p = (_o = (_m = result === null || result === void 0 ? void 0 : result.data) === null || _m === void 0 ? void 0 : _m.recList) === null || _o === void 0 ? void 0 : _o.filter) === null || _p === void 0 ? void 0 : _p.call(_o, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _q !== void 0 ? _q : []);
|
158
|
+
const isNotNullList = (_s = (_r = result === null || result === void 0 ? void 0 : result.data) === null || _r === void 0 ? void 0 : _r.recList) === null || _s === void 0 ? void 0 : _s.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
|
168
159
|
if (!isNotNullList) {
|
169
160
|
setIsNoMoreData(true);
|
170
161
|
}
|
@@ -173,12 +164,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
173
164
|
return result === null || result === void 0 ? void 0 : result.data;
|
174
165
|
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList]);
|
175
166
|
const loadVideos = (0, react_1.useCallback)((pageNum) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
176
|
-
var _0, _1, _2
|
167
|
+
var _z, _0, _1, _2;
|
177
168
|
if (rtcList.length <= 0) {
|
178
169
|
return;
|
179
170
|
}
|
180
171
|
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
181
|
-
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((
|
172
|
+
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((_z = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _z === void 0 ? void 0 : _z.itemId) && { productFilter: (_0 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _0 === void 0 ? void 0 : _0.itemId })), (((_1 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _1 === void 0 ? void 0 : _1.itemId) && { contentFilter: (_2 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _2 === void 0 ? void 0 : _2.itemId })), { themeTag: themeTag.current }), ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor && { pageNum })));
|
182
173
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
183
174
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
184
175
|
return data;
|
@@ -191,7 +182,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
191
182
|
userInfo = {};
|
192
183
|
}
|
193
184
|
const sessionID = (0, sessionStore_1.storeAndLoadFeSessionId)();
|
194
|
-
const ef = Object.assign(Object.assign(Object.assign(Object.assign(
|
185
|
+
const ef = Object.assign(Object.assign(Object.assign(Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, eventInfo), ((0, tool_1.getDevice)() && { sxpDevice: (0, tool_1.getDevice)() })), ((0, tool_1.getSystem)() && { sxpSystem: (0, tool_1.getSystem)() })), ((0, tool_1.getBrowserInfo)() && { sxpBrowser: (0, tool_1.getBrowserInfo)() }));
|
195
186
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
196
187
|
const realEventInfo = Object.entries(ef)
|
197
188
|
.map(([k, v]) => v && { name: k, value: v })
|
@@ -205,7 +196,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
205
196
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
206
197
|
type: 'beacon'
|
207
198
|
});
|
208
|
-
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview
|
199
|
+
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
209
200
|
const bffFbReport = (0, react_1.useCallback)(({ eventName, product }) => {
|
210
201
|
var _a, _b, _c, _d, _e;
|
211
202
|
if (!enableReportEvent ||
|
@@ -290,17 +281,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
290
281
|
return res === null || res === void 0 ? void 0 : res.success;
|
291
282
|
}), [bffFetch]);
|
292
283
|
const bffGetTagList = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
293
|
-
var _4, _5, _6, _7
|
284
|
+
var _3, _4, _5, _6, _7;
|
294
285
|
if (!utmVal || !isShowTag)
|
295
286
|
return;
|
296
287
|
try {
|
297
|
-
const val = (
|
288
|
+
const val = (_5 = (_4 = (_3 = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _3 === void 0 ? void 0 : _3.filter((val) => {
|
298
289
|
var _a, _b;
|
299
290
|
const key = val.split('=')[0];
|
300
291
|
return (_b = ((_a = utmParameter === null || utmParameter === void 0 ? void 0 : utmParameter.channels) !== null && _a !== void 0 ? _a : [])) === null || _b === void 0 ? void 0 : _b.includes(key);
|
301
|
-
})) === null ||
|
292
|
+
})) === null || _4 === void 0 ? void 0 : _4.join('&')) !== null && _5 !== void 0 ? _5 : '';
|
302
293
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
303
|
-
setTagList((
|
294
|
+
setTagList((_7 = (_6 = result === null || result === void 0 ? void 0 : result.data) === null || _6 === void 0 ? void 0 : _6.tags) !== null && _7 !== void 0 ? _7 : []);
|
304
295
|
}
|
305
296
|
catch (e) {
|
306
297
|
console.log('e', e);
|
@@ -365,25 +356,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
365
356
|
bffGetTagList();
|
366
357
|
getRecommendVideos()
|
367
358
|
.then((data) => {
|
368
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
369
359
|
if (data) {
|
370
360
|
setRtcList(getFilterRecList(data));
|
371
361
|
setCacheRtcList(getFilterRecList(data));
|
372
|
-
if (data === null || data === void 0 ? void 0 : data.layoutVariantId) {
|
373
|
-
const id = (_b = (_a = data === null || data === void 0 ? void 0 : data.layoutVariantId) === null || _a === void 0 ? void 0 : _a.split('-')) === null || _b === void 0 ? void 0 : _b[1];
|
374
|
-
if (id) {
|
375
|
-
setLayoutVariantId(id);
|
376
|
-
const curData = dataList === null || dataList === void 0 ? void 0 : dataList.find((item) => (item === null || item === void 0 ? void 0 : item.id) === id);
|
377
|
-
if (curData) {
|
378
|
-
setPageData(curData);
|
379
|
-
document.title = (_c = curData === null || curData === void 0 ? void 0 : curData.name) !== null && _c !== void 0 ? _c : 'home';
|
380
|
-
setGlobalConfig((_d = curData === null || curData === void 0 ? void 0 : curData.data) === null || _d === void 0 ? void 0 : _d.globalConfig);
|
381
|
-
onUpdateSchema === null || onUpdateSchema === void 0 ? void 0 : onUpdateSchema(curData === null || curData === void 0 ? void 0 : curData.data);
|
382
|
-
if ((_k = (_j = (_h = (_g = (_f = (_e = curData === null || curData === void 0 ? void 0 : curData.data) === null || _e === void 0 ? void 0 : _e.globalConfig) === null || _f === void 0 ? void 0 : _f.consent) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.item) === null || _j === void 0 ? void 0 : _j.props) === null || _k === void 0 ? void 0 : _k.privacy_necessity)
|
383
|
-
setShowConsent(true);
|
384
|
-
}
|
385
|
-
}
|
386
|
-
}
|
387
362
|
}
|
388
363
|
})
|
389
364
|
.finally(() => {
|
@@ -468,13 +443,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
468
443
|
checkCommodityIndexRef,
|
469
444
|
isEditor,
|
470
445
|
isNoMoreData
|
471
|
-
} }, isShowConsent ? (react_1.default.createElement(Consent_1.default, Object.assign({}, (
|
446
|
+
} }, isShowConsent ? (react_1.default.createElement(Consent_1.default, Object.assign({}, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props))) : (render({
|
472
447
|
rtcList,
|
473
448
|
mutateLike: bffMutateLike,
|
474
449
|
mutateUnlike: bffMutateUnlike,
|
475
450
|
submitForm: bffSubmitForm,
|
476
|
-
tagList
|
477
|
-
pageData
|
451
|
+
tagList
|
478
452
|
}))));
|
479
453
|
};
|
480
454
|
exports.default = (0, react_1.memo)(SxpDataSourceProvider);
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const react_1 = require("react");
|
4
|
+
const useFocusTrap = (elementRef) => {
|
5
|
+
(0, react_1.useEffect)(() => {
|
6
|
+
const trapFocus = (element) => {
|
7
|
+
var focusableEls = element === null || element === void 0 ? void 0 : element.querySelectorAll('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])');
|
8
|
+
var firstFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[0];
|
9
|
+
var lastFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[(focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls.length) - 1];
|
10
|
+
var KEYCODE_TAB = 9;
|
11
|
+
element.addEventListener('keydown', function (e) {
|
12
|
+
var isTabPressed = e.key === 'Tab' || e.keyCode === KEYCODE_TAB;
|
13
|
+
if (!isTabPressed) {
|
14
|
+
return;
|
15
|
+
}
|
16
|
+
if (e.shiftKey) {
|
17
|
+
if ((document === null || document === void 0 ? void 0 : document.activeElement) === firstFocusableEl) {
|
18
|
+
lastFocusableEl === null || lastFocusableEl === void 0 ? void 0 : lastFocusableEl.focus();
|
19
|
+
e.preventDefault();
|
20
|
+
}
|
21
|
+
}
|
22
|
+
else {
|
23
|
+
if ((document === null || document === void 0 ? void 0 : document.activeElement) === lastFocusableEl) {
|
24
|
+
firstFocusableEl === null || firstFocusableEl === void 0 ? void 0 : firstFocusableEl.focus();
|
25
|
+
e.preventDefault();
|
26
|
+
}
|
27
|
+
}
|
28
|
+
});
|
29
|
+
firstFocusableEl === null || firstFocusableEl === void 0 ? void 0 : firstFocusableEl.focus();
|
30
|
+
};
|
31
|
+
if (elementRef === null || elementRef === void 0 ? void 0 : elementRef.current)
|
32
|
+
trapFocus(elementRef === null || elementRef === void 0 ? void 0 : elementRef.current);
|
33
|
+
return () => {
|
34
|
+
var _a;
|
35
|
+
(_a = elementRef === null || elementRef === void 0 ? void 0 : elementRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('keydown', trapFocus);
|
36
|
+
};
|
37
|
+
}, [elementRef]);
|
38
|
+
};
|
39
|
+
exports.default = useFocusTrap;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useEditorDataProvider = exports.EditorDataProvider = exports.SxpPageCore = exports.SxpDataSourceProvider = exports.Modal = exports.DiyPortalPreview = exports.SxpPageRender = exports.materials = exports.core = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const Pagebuilder_1 = require("./core/Pagebuilder");
|
6
|
+
require("./index.css");
|
6
7
|
exports.core = tslib_1.__importStar(require("./core"));
|
7
8
|
exports.materials = tslib_1.__importStar(require("./materials"));
|
8
9
|
var SxpPageRender_1 = require("./core/components/SxpPageRender");
|
@@ -99,7 +99,7 @@ const CommodityDetail = (_a) => {
|
|
99
99
|
};
|
100
100
|
const renderBtn = () => {
|
101
101
|
var _a, _b;
|
102
|
-
return (react_1.default.createElement(react_1.default.Fragment, null, (isDefault || (product === null || product === void 0 ? void 0 : product.link)) && (react_1.default.createElement("
|
102
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, (isDefault || (product === null || product === void 0 ? void 0 : product.link)) && (react_1.default.createElement("a", { "aria-label": (_a = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _a !== void 0 ? _a : 'Purchase on Website', role: 'button', tabIndex: 0, onClick: handleLink, className: 'pb-commondity-btn', style: buttonStyle },
|
103
103
|
react_1.default.createElement("span", { dangerouslySetInnerHTML: {
|
104
104
|
__html: (0, tool_1.setFontForText)((_b = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _b !== void 0 ? _b : 'Purchase on Website', buttonStyle)
|
105
105
|
} })))));
|
@@ -137,7 +137,9 @@ const CommodityDetail = (_a) => {
|
|
137
137
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
138
138
|
react_1.default.createElement("div", Object.assign({ className: (0, css_1.css)(Object.assign({}, style)) }, props),
|
139
139
|
react_1.default.createElement("div", { style: { position: 'relative' } },
|
140
|
-
product && ((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) > 0 && (react_1.default.createElement(react_2.Swiper, {
|
140
|
+
product && ((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) > 0 && (react_1.default.createElement(react_2.Swiper, { a11y: {
|
141
|
+
enabled: true
|
142
|
+
}, height: height, modules: [modules_1.Pagination, modules_1.Autoplay], pagination: {
|
141
143
|
clickable: true,
|
142
144
|
bulletActiveClass: 'swipe-item-active-bullet',
|
143
145
|
clickableClass: getDotsAlign,
|
@@ -196,7 +196,7 @@ Made in Italy` })));
|
|
196
196
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo), dangerouslySetInnerHTML: {
|
197
197
|
__html: (0, tool_1.setFontForText)((_2 = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _2 !== void 0 ? _2 : '税费', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo)
|
198
198
|
} }))),
|
199
|
-
(!product || (product === null || product === void 0 ? void 0 : product.link)) && (react_1.default.createElement("
|
199
|
+
(!product || (product === null || product === void 0 ? void 0 : product.link)) && (react_1.default.createElement("a", { "aria-label": (_3 = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _3 !== void 0 ? _3 : 'Shop now', role: 'button', tabIndex: 0, onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle },
|
200
200
|
react_1.default.createElement("span", { dangerouslySetInnerHTML: {
|
201
201
|
__html: (0, tool_1.setFontForText)((_4 = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _4 !== void 0 ? _4 : 'Shop now', buttonStyle)
|
202
202
|
} }))),
|
@@ -49,39 +49,43 @@ const CommodityList = (_a) => {
|
|
49
49
|
eventName: 'PageView'
|
50
50
|
});
|
51
51
|
}, []);
|
52
|
-
return (react_1.default.createElement("
|
52
|
+
return (react_1.default.createElement("ul", { role: 'list', className: (0, css_1.css)(Object.assign(Object.assign({}, style), { display: 'flex', flexDirection: 'column', gap: '10px', padding: '0 20px', marginTop: '50px', boxSizing: 'border-box' })) }, product === null || product === void 0 ? void 0 : product.map((item, index) => {
|
53
53
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
54
|
-
return (react_1.default.createElement(react_1.default.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (react_1.default.createElement("
|
55
|
-
|
56
|
-
}), onClick: () => handleClick(item, index) }),
|
57
|
-
react_1.default.createElement(Img_1.default, { src: (_d = (_c = (_a = item === null || item === void 0 ? void 0 : item.cover) !== null && _a !== void 0 ? _a : (_b = item === null || item === void 0 ? void 0 : item.homePage) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image, rec: recData, item: item, index: index, translateY: translateY, imgStyle: commodityPicture, enableEventReport: false }),
|
58
|
-
react_1.default.createElement("div", { style: {
|
59
|
-
width: `calc(100% - ${(_e = commodityPicture === null || commodityPicture === void 0 ? void 0 : commodityPicture.width) !== null && _e !== void 0 ? _e : 0}px - ${(_f = commodityPicture === null || commodityPicture === void 0 ? void 0 : commodityPicture.marginRight) !== null && _f !== void 0 ? _f : 0}px)`,
|
54
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (react_1.default.createElement("li", { role: 'listitem', key: index, onClick: () => handleClick(item, index) },
|
55
|
+
react_1.default.createElement("button", Object.assign({ role: 'button', "aria-label": item === null || item === void 0 ? void 0 : item.title, tabIndex: 0, className: (0, css_1.css)({
|
60
56
|
display: 'flex',
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
} })
|
68
|
-
react_1.default.createElement("div", { className: 'two-line-ellipsis', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection, hidden: !!item && (!(item === null || item === void 0 ? void 0 : item.collection) || (item === null || item === void 0 ? void 0 : item.collection) === ''), dangerouslySetInnerHTML: {
|
69
|
-
__html: (0, tool_1.setFontForText)((_h = item === null || item === void 0 ? void 0 : item.collection) !== null && _h !== void 0 ? _h : 'Tiffany Lock', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection)
|
70
|
-
} })),
|
71
|
-
react_1.default.createElement("div", { className: (0, css_1.css)({
|
57
|
+
alignItems: 'normal',
|
58
|
+
width: '100%',
|
59
|
+
textAlign: 'left'
|
60
|
+
}) }, props),
|
61
|
+
react_1.default.createElement(Img_1.default, { src: (_d = (_c = (_a = item === null || item === void 0 ? void 0 : item.cover) !== null && _a !== void 0 ? _a : (_b = item === null || item === void 0 ? void 0 : item.homePage) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image, rec: recData, item: item, index: index, translateY: translateY, imgStyle: commodityPicture, enableEventReport: false }),
|
62
|
+
react_1.default.createElement("div", { style: {
|
63
|
+
width: `calc(100% - ${(_e = commodityPicture === null || commodityPicture === void 0 ? void 0 : commodityPicture.width) !== null && _e !== void 0 ? _e : 0}px - ${(_f = commodityPicture === null || commodityPicture === void 0 ? void 0 : commodityPicture.marginRight) !== null && _f !== void 0 ? _f : 0}px)`,
|
72
64
|
display: 'flex',
|
73
|
-
|
74
|
-
justifyContent: 'space-between'
|
75
|
-
|
76
|
-
overflow: 'hidden'
|
77
|
-
}) },
|
65
|
+
flexDirection: 'column',
|
66
|
+
justifyContent: 'space-between'
|
67
|
+
} },
|
78
68
|
react_1.default.createElement("div", null,
|
79
|
-
react_1.default.createElement("div", { style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.
|
80
|
-
__html: (
|
69
|
+
react_1.default.createElement("div", { className: 'one-line-ellipsis', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title, hidden: !!item && !(item === null || item === void 0 ? void 0 : item.title), dangerouslySetInnerHTML: {
|
70
|
+
__html: (0, tool_1.setFontForText)((_g = item === null || item === void 0 ? void 0 : item.title) !== null && _g !== void 0 ? _g : 'Pendant in Yellow Gold with Diamonds, Medium', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title)
|
71
|
+
} }),
|
72
|
+
react_1.default.createElement("div", { className: 'two-line-ellipsis', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection, hidden: !!item && (!(item === null || item === void 0 ? void 0 : item.collection) || (item === null || item === void 0 ? void 0 : item.collection) === ''), dangerouslySetInnerHTML: {
|
73
|
+
__html: (0, tool_1.setFontForText)((_h = item === null || item === void 0 ? void 0 : item.collection) !== null && _h !== void 0 ? _h : 'Tiffany Lock', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection)
|
81
74
|
} })),
|
82
|
-
react_1.default.createElement("div", { className:
|
83
|
-
|
84
|
-
|
75
|
+
react_1.default.createElement("div", { className: (0, css_1.css)({
|
76
|
+
display: 'flex',
|
77
|
+
alignItems: 'flex-end',
|
78
|
+
justifyContent: 'space-between',
|
79
|
+
width: '100%',
|
80
|
+
overflow: 'hidden'
|
81
|
+
}) },
|
82
|
+
react_1.default.createElement("div", null,
|
83
|
+
react_1.default.createElement("div", { style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price, hidden: !!item && !(item === null || item === void 0 ? void 0 : item.price), dangerouslySetInnerHTML: {
|
84
|
+
__html: (_j = priceText(item)) !== null && _j !== void 0 ? _j : ''
|
85
|
+
} })),
|
86
|
+
react_1.default.createElement("div", { className: 'one-line-ellipsis', style: Object.assign(Object.assign({}, buttonStyle), { padding: '0 15px' }), dangerouslySetInnerHTML: {
|
87
|
+
__html: (0, tool_1.setFontForText)((_l = (_k = item === null || item === void 0 ? void 0 : item.bindCta) === null || _k === void 0 ? void 0 : _k.enTitle) !== null && _l !== void 0 ? _l : 'Shop Now', buttonStyle)
|
88
|
+
} }))))))));
|
85
89
|
})));
|
86
90
|
};
|
87
91
|
exports.default = (0, react_1.memo)(CommodityList);
|
@@ -13,7 +13,7 @@ const Appoint = (_a) => {
|
|
13
13
|
const { sxpParameter } = (0, hooks_1.useSxpDataSource)();
|
14
14
|
const cta = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindCta;
|
15
15
|
const src = (_d = (_c = cta === null || cta === void 0 ? void 0 : cta.icon) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image;
|
16
|
-
return (react_1.default.createElement(EventProvider_1.default, Object.assign({ isExternalLink: isExternalLink, rec: recData,
|
16
|
+
return (react_1.default.createElement(EventProvider_1.default, Object.assign({ isExternalLink: isExternalLink, rec: recData, style: Object.assign({ alignItems: 'center' }, style), index: index }, props),
|
17
17
|
react_1.default.createElement(Img_1.default, { src: src, rec: recData, item: (_f = (_e = recData === null || recData === void 0 ? void 0 : recData.video) === null || _e === void 0 ? void 0 : _e.bindProduct) !== null && _f !== void 0 ? _f : recData === null || recData === void 0 ? void 0 : recData.video, index: index, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img, isActive: isActive }),
|
18
18
|
react_1.default.createElement("div", { className: (0, css_1.css)(Object.assign({ overflow: 'hidden', textOverflow: 'ellipsis' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)), dangerouslySetInnerHTML: {
|
19
19
|
__html: (0, tool_1.setFontForText)((_g = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _g !== void 0 ? _g : 'Product Name', ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)
|