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
@@ -48,7 +48,7 @@ const Pagebuilder = {
|
|
48
48
|
const tenantId = builder.getTenantId();
|
49
49
|
const appId = builder.getAppId();
|
50
50
|
const apiUrl = builder.getApiUrl();
|
51
|
-
return fetch(`${apiUrl}/storefront/v1/page
|
51
|
+
return fetch(`${apiUrl}/storefront/v1/page?id=` + id, {
|
52
52
|
method: 'get',
|
53
53
|
headers: {
|
54
54
|
'x-tenant-id': tenantId || '',
|
@@ -60,8 +60,9 @@ const Pagebuilder = {
|
|
60
60
|
if (!result.success) {
|
61
61
|
return undefined;
|
62
62
|
}
|
63
|
-
const
|
64
|
-
|
63
|
+
const decodeData = unzip((_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.data);
|
64
|
+
result.data.data = decodeData;
|
65
|
+
return result.data;
|
65
66
|
}));
|
66
67
|
}),
|
67
68
|
getSxpRecommendVideoData: (dataId) => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -7,8 +7,8 @@ export interface ISxpPageCoreProps {
|
|
7
7
|
hashTagSize?: number;
|
8
8
|
loadingImage?: string;
|
9
9
|
appDomain?: string;
|
10
|
+
licenseUrl?: String;
|
10
11
|
enabledMetaConversionApi?: boolean;
|
11
|
-
dataList?: PageData[];
|
12
12
|
}
|
13
13
|
declare const _default: React.NamedExoticComponent<ISxpPageCoreProps>;
|
14
14
|
export default _default;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { memo, useMemo
|
1
|
+
import React, { memo, useMemo } from 'react';
|
2
2
|
import SxpPageRender from '../SxpPageRender';
|
3
3
|
import Popup from '../SxpPageRender/Popup';
|
4
4
|
import * as _materials_ from '../../../materials';
|
@@ -8,19 +8,18 @@ const RESOLVER = {};
|
|
8
8
|
Object.values(_materials_).forEach((v) => {
|
9
9
|
RESOLVER[v.extend.type] = v;
|
10
10
|
});
|
11
|
-
const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain,
|
12
|
-
var _a, _b, _c, _d, _e, _f;
|
11
|
+
const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain, licenseUrl, enabledMetaConversionApi }) => {
|
12
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
13
13
|
const utmVal = useMemo(() => {
|
14
14
|
var _a;
|
15
15
|
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('?', '') : '';
|
16
16
|
return searchParams;
|
17
17
|
}, []);
|
18
|
-
|
19
|
-
|
20
|
-
React.createElement(SxpDataSourceProvider, { 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 }) => {
|
18
|
+
return (React.createElement(EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: data === null || data === void 0 ? void 0 : data.data, utmVal: utmVal },
|
19
|
+
React.createElement(SxpDataSourceProvider, { 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 }) => {
|
21
20
|
var _a;
|
22
21
|
return (React.createElement(React.Fragment, null,
|
23
|
-
React.createElement(SxpPageRender, Object.assign({}, (_a =
|
22
|
+
React.createElement(SxpPageRender, 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 })),
|
24
23
|
React.createElement(Popup, null)));
|
25
24
|
} })));
|
26
25
|
};
|
@@ -50,7 +50,7 @@ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldTex
|
|
50
50
|
wordBreak: 'break-word'
|
51
51
|
}, dangerouslySetInnerHTML: { __html: setFontForText(text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>'), style) } }),
|
52
52
|
React.createElement("div", { ref: multiRowCopy, dangerouslySetInnerHTML: { __html: setFontForText(text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>'), style) } }),
|
53
|
-
text && isPost && isShow && (React.createElement("
|
53
|
+
text && isPost && isShow && (React.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: {
|
54
54
|
__html: setFontForText(isShowMore ? unfoldText || 'show less' : foldText || 'show more', style)
|
55
55
|
} }))));
|
56
56
|
};
|
@@ -40,7 +40,7 @@ const Hashtag = ({ tags, itemId, itemType, index, rec, hashTagStyle, hashTagRigh
|
|
40
40
|
marginTop: `${(_a = hashTagStyle === null || hashTagStyle === void 0 ? void 0 : hashTagStyle.marginTop) !== null && _a !== void 0 ? _a : 16}px`,
|
41
41
|
width: hashTagRightMargin
|
42
42
|
} },
|
43
|
-
React.createElement(Scroll, null, tags === null || tags === void 0 ? void 0 : tags.map((item, index) => (React.createElement(SwiperSlide, { key: index, hidden: !isShowMore ? index >= 6 : false, className: 'clc-sxp-bottom-hashtag-item', style: hashTagStyle, onClick: () => handleClickTag(item), tag: '
|
44
|
-
React.createElement("
|
43
|
+
React.createElement(Scroll, null, tags === null || tags === void 0 ? void 0 : tags.map((item, index) => (React.createElement(SwiperSlide, { key: index, hidden: !isShowMore ? index >= 6 : false, className: 'clc-sxp-bottom-hashtag-item', style: hashTagStyle, onClick: () => handleClickTag(item), tag: 'li', role: 'listitem' },
|
44
|
+
React.createElement("button", { className: 'clc-sxp-bottom-hashtag-item-button', "aria-label": item, "aria-describedby": item, dangerouslySetInnerHTML: { __html: setFontForText(`#${item}`, hashTagStyle) } })))))));
|
45
45
|
};
|
46
46
|
export default memo(Hashtag);
|
@@ -9,6 +9,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
9
9
|
const fTouchRef = useRef(null);
|
10
10
|
const touchMoveRef = useRef(null);
|
11
11
|
const ref = useRef(null);
|
12
|
+
const modalRef = useRef(null);
|
12
13
|
const MODAL_DEF_TRANS = fullHeight * 0.2;
|
13
14
|
const MODAL_DEF_CON_H = isFullScreen ? fullHeight : fullHeight * 0.8;
|
14
15
|
const [modalTrans, setModalTrans] = useState(MODAL_DEF_TRANS);
|
@@ -56,6 +57,43 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
56
57
|
const child = useCallback(() => {
|
57
58
|
return children;
|
58
59
|
}, [_popup, openState, globalConfig]);
|
60
|
+
useEffect(() => {
|
61
|
+
const trapFocus = (element) => {
|
62
|
+
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])');
|
63
|
+
var firstFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[0];
|
64
|
+
var lastFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[(focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls.length) - 1];
|
65
|
+
var KEYCODE_TAB = 9;
|
66
|
+
element.addEventListener('keydown', function (e) {
|
67
|
+
if (e.key === 'Escape' || e.key === 'Esc') {
|
68
|
+
handleClose();
|
69
|
+
e.preventDefault();
|
70
|
+
}
|
71
|
+
var isTabPressed = e.key === 'Tab' || e.keyCode === KEYCODE_TAB;
|
72
|
+
if (!isTabPressed) {
|
73
|
+
return;
|
74
|
+
}
|
75
|
+
if (e.shiftKey) {
|
76
|
+
if ((document === null || document === void 0 ? void 0 : document.activeElement) === firstFocusableEl) {
|
77
|
+
lastFocusableEl === null || lastFocusableEl === void 0 ? void 0 : lastFocusableEl.focus();
|
78
|
+
e.preventDefault();
|
79
|
+
}
|
80
|
+
}
|
81
|
+
else {
|
82
|
+
if ((document === null || document === void 0 ? void 0 : document.activeElement) === lastFocusableEl) {
|
83
|
+
firstFocusableEl === null || firstFocusableEl === void 0 ? void 0 : firstFocusableEl.focus();
|
84
|
+
e.preventDefault();
|
85
|
+
}
|
86
|
+
}
|
87
|
+
});
|
88
|
+
firstFocusableEl === null || firstFocusableEl === void 0 ? void 0 : firstFocusableEl.focus();
|
89
|
+
};
|
90
|
+
if (modalRef === null || modalRef === void 0 ? void 0 : modalRef.current)
|
91
|
+
trapFocus(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current);
|
92
|
+
return () => {
|
93
|
+
var _a;
|
94
|
+
(_a = modalRef === null || modalRef === void 0 ? void 0 : modalRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('keydown', trapFocus);
|
95
|
+
};
|
96
|
+
}, [modalRef, isShow, _popup]);
|
59
97
|
if (!modalEleRef.current)
|
60
98
|
return null;
|
61
99
|
const handleClose = debounce(() => {
|
@@ -117,7 +155,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
117
155
|
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)`,
|
118
156
|
height: '100%'
|
119
157
|
} },
|
120
|
-
React.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 && {
|
158
|
+
React.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 && {
|
121
159
|
transform: `translateY(${modalTrans}px)`
|
122
160
|
})), { 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) => {
|
123
161
|
e.stopPropagation();
|
@@ -127,17 +165,17 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
127
165
|
onTouchStart: handleTouchStart,
|
128
166
|
onTouchEnd: handleTouchEnd
|
129
167
|
})),
|
130
|
-
React.createElement("
|
131
|
-
React.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' })),
|
132
|
-
React.createElement("div", Object.assign({ ref: ref, style: {
|
168
|
+
React.createElement("div", Object.assign({ id: 'modal-content', ref: ref, style: {
|
133
169
|
height: isScrollFullScreen ? fullHeight : MODAL_DEF_CON_H,
|
134
170
|
overflow: (isScrollFullScreen && modalTrans <= 0) || !isScrollFullScreen ? 'auto' : 'hidden',
|
135
171
|
zIndex: 1
|
136
|
-
} }, (((
|
172
|
+
} }, (((_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) && {
|
137
173
|
onScroll: (e) => {
|
138
174
|
var _a;
|
139
175
|
setScrollTop(15 - ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.scrollTop));
|
140
176
|
}
|
141
|
-
})), child())
|
177
|
+
})), child()),
|
178
|
+
React.createElement("button", { className: 'modal-icon-wrapper', role: 'button', "aria-label": 'close button', onClick: onClose, style: { top: scrollTop } },
|
179
|
+
React.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);
|
142
180
|
};
|
143
181
|
export default memo(Modal);
|
@@ -493,9 +493,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
493
493
|
alignItems: 'center'
|
494
494
|
} },
|
495
495
|
React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement(React.Fragment, null,
|
496
|
+
renderBottom(rec, index),
|
496
497
|
renderLikeButton(rec, index, !(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
497
498
|
renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
|
498
|
-
renderBottom(rec, index),
|
499
499
|
renderContent(rec, index)))))));
|
500
500
|
});
|
501
501
|
}, [
|
@@ -561,9 +561,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
561
561
|
}
|
562
562
|
}
|
563
563
|
}, direction: 'vertical', height: height },
|
564
|
+
renderView,
|
564
565
|
renderLikeButton(visList[activeIndex], activeIndex, !!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
565
|
-
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
|
566
|
-
renderView),
|
566
|
+
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
|
567
567
|
React.createElement(WaterFall, 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)),
|
568
568
|
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig })));
|
569
569
|
};
|
@@ -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>;
|
@@ -17,8 +17,8 @@ var DataSourceType;
|
|
17
17
|
DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
|
18
18
|
})(DataSourceType || (DataSourceType = {}));
|
19
19
|
export const DEFAULT_TAG = 'FOR U';
|
20
|
-
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
|
21
|
-
var _a, _b, _c
|
20
|
+
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 }) => {
|
21
|
+
var _a, _b, _c;
|
22
22
|
const [rtcList, setRtcList] = useState([]);
|
23
23
|
const [tagList, setTagList] = useState([]);
|
24
24
|
const [loading, setLoading] = useState(false);
|
@@ -39,19 +39,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
39
39
|
const checkCommodityIndexRef = useRef(-1);
|
40
40
|
const popupCurTimeRef = useRef(null);
|
41
41
|
const [isNoMoreData, setIsNoMoreData] = useState(false);
|
42
|
-
const [globalConfig, setGlobalConfig] = useState((_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.globalConfig);
|
43
|
-
const [pageData, setPageData] = useState(data);
|
44
|
-
const [showConsent, setShowConsent] = useState(false);
|
45
|
-
const [layoutVariantId, setLayoutVariantId] = useState();
|
46
|
-
const isShowTag = useMemo(() => {
|
47
|
-
var _a, _b, _c;
|
48
|
-
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);
|
49
|
-
}, [pageData]);
|
50
42
|
const isShowConsent = useMemo(() => {
|
51
43
|
var _a, _b, _c, _d;
|
52
|
-
return (((
|
53
|
-
|
54
|
-
}, [isAgreePolicy, globalConfig, isOpenConsent, isEditor, showConsent]);
|
44
|
+
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;
|
45
|
+
}, [isAgreePolicy, globalConfig, isOpenConsent, isEditor]);
|
55
46
|
const getFilterRecList = useCallback((data) => {
|
56
47
|
var _a;
|
57
48
|
const recList = data === null || data === void 0 ? void 0 : data.recList;
|
@@ -108,14 +99,14 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
108
99
|
.catch((err) => Promise.reject(err));
|
109
100
|
}, [bffDataSource]);
|
110
101
|
const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
111
|
-
var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s
|
112
|
-
query = Object.assign(Object.assign(Object.assign({ maxSize: (
|
102
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
103
|
+
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 });
|
113
104
|
if (utmVal) {
|
114
|
-
const val = (
|
105
|
+
const val = (_h = (_g = (_f = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _f === void 0 ? void 0 : _f.filter((val) => {
|
115
106
|
var _a, _b;
|
116
107
|
const key = val.split('=')[0];
|
117
108
|
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);
|
118
|
-
})) === null ||
|
109
|
+
})) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
|
119
110
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
120
111
|
}
|
121
112
|
if (isEditor) {
|
@@ -128,17 +119,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
128
119
|
let list = [];
|
129
120
|
let result = null;
|
130
121
|
const recurveRecList = (query) => __awaiter(void 0, void 0, void 0, function* () {
|
131
|
-
var _u, _v, _w, _x, _y
|
122
|
+
var _t, _u, _v, _w, _x, _y;
|
132
123
|
query.pageNum = pageNum;
|
133
124
|
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
134
125
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
135
126
|
return undefined;
|
136
127
|
}
|
137
128
|
setLoading(false);
|
138
|
-
list = list.concat((
|
129
|
+
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 : []);
|
139
130
|
setRtcList(getFilterRecList(Object.assign(Object.assign({}, result.data), { recList: list })));
|
140
131
|
setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result.data), { recList: list })));
|
141
|
-
const isNotNullList = (
|
132
|
+
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));
|
142
133
|
if (isNotNullList) {
|
143
134
|
pageNum = pageNum + 1;
|
144
135
|
yield recurveRecList(query);
|
@@ -146,11 +137,11 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
146
137
|
});
|
147
138
|
yield recurveRecList(query);
|
148
139
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
|
149
|
-
setCurReqInfo({ rtc: (
|
140
|
+
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 });
|
150
141
|
return Object.assign(Object.assign({}, result.data), { recList: list });
|
151
142
|
}
|
152
143
|
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
153
|
-
query = Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (
|
144
|
+
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 });
|
154
145
|
}
|
155
146
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
156
147
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
@@ -160,8 +151,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
160
151
|
setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
|
161
152
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor) {
|
162
153
|
let list = [];
|
163
|
-
list = list.concat((
|
164
|
-
const isNotNullList = (
|
154
|
+
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 : []);
|
155
|
+
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));
|
165
156
|
if (!isNotNullList) {
|
166
157
|
setIsNoMoreData(true);
|
167
158
|
}
|
@@ -170,12 +161,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
170
161
|
return result === null || result === void 0 ? void 0 : result.data;
|
171
162
|
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList]);
|
172
163
|
const loadVideos = useCallback((pageNum) => __awaiter(void 0, void 0, void 0, function* () {
|
173
|
-
var _0, _1, _2
|
164
|
+
var _z, _0, _1, _2;
|
174
165
|
if (rtcList.length <= 0) {
|
175
166
|
return;
|
176
167
|
}
|
177
168
|
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
178
|
-
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((
|
169
|
+
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 })));
|
179
170
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
180
171
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
181
172
|
return data;
|
@@ -188,7 +179,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
188
179
|
userInfo = {};
|
189
180
|
}
|
190
181
|
const sessionID = storeAndLoadFeSessionId();
|
191
|
-
const ef = Object.assign(Object.assign(Object.assign(Object.assign(
|
182
|
+
const ef = Object.assign(Object.assign(Object.assign(Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, eventInfo), (getDevice() && { sxpDevice: getDevice() })), (getSystem() && { sxpSystem: getSystem() })), (getBrowserInfo() && { sxpBrowser: getBrowserInfo() }));
|
192
183
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
193
184
|
const realEventInfo = Object.entries(ef)
|
194
185
|
.map(([k, v]) => v && { name: k, value: v })
|
@@ -202,7 +193,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
202
193
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
203
194
|
type: 'beacon'
|
204
195
|
});
|
205
|
-
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview
|
196
|
+
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
206
197
|
const bffFbReport = useCallback(({ eventName, product }) => {
|
207
198
|
var _a, _b, _c, _d, _e;
|
208
199
|
if (!enableReportEvent ||
|
@@ -287,17 +278,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
287
278
|
return res === null || res === void 0 ? void 0 : res.success;
|
288
279
|
}), [bffFetch]);
|
289
280
|
const bffGetTagList = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
290
|
-
var _4, _5, _6, _7
|
281
|
+
var _3, _4, _5, _6, _7;
|
291
282
|
if (!utmVal || !isShowTag)
|
292
283
|
return;
|
293
284
|
try {
|
294
|
-
const val = (
|
285
|
+
const val = (_5 = (_4 = (_3 = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _3 === void 0 ? void 0 : _3.filter((val) => {
|
295
286
|
var _a, _b;
|
296
287
|
const key = val.split('=')[0];
|
297
288
|
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);
|
298
|
-
})) === null ||
|
289
|
+
})) === null || _4 === void 0 ? void 0 : _4.join('&')) !== null && _5 !== void 0 ? _5 : '';
|
299
290
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
300
|
-
setTagList((
|
291
|
+
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 : []);
|
301
292
|
}
|
302
293
|
catch (e) {
|
303
294
|
console.log('e', e);
|
@@ -362,25 +353,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
362
353
|
bffGetTagList();
|
363
354
|
getRecommendVideos()
|
364
355
|
.then((data) => {
|
365
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
366
356
|
if (data) {
|
367
357
|
setRtcList(getFilterRecList(data));
|
368
358
|
setCacheRtcList(getFilterRecList(data));
|
369
|
-
if (data === null || data === void 0 ? void 0 : data.layoutVariantId) {
|
370
|
-
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];
|
371
|
-
if (id) {
|
372
|
-
setLayoutVariantId(id);
|
373
|
-
const curData = dataList === null || dataList === void 0 ? void 0 : dataList.find((item) => (item === null || item === void 0 ? void 0 : item.id) === id);
|
374
|
-
if (curData) {
|
375
|
-
setPageData(curData);
|
376
|
-
document.title = (_c = curData === null || curData === void 0 ? void 0 : curData.name) !== null && _c !== void 0 ? _c : 'home';
|
377
|
-
setGlobalConfig((_d = curData === null || curData === void 0 ? void 0 : curData.data) === null || _d === void 0 ? void 0 : _d.globalConfig);
|
378
|
-
onUpdateSchema === null || onUpdateSchema === void 0 ? void 0 : onUpdateSchema(curData === null || curData === void 0 ? void 0 : curData.data);
|
379
|
-
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)
|
380
|
-
setShowConsent(true);
|
381
|
-
}
|
382
|
-
}
|
383
|
-
}
|
384
359
|
}
|
385
360
|
})
|
386
361
|
.finally(() => {
|
@@ -465,13 +440,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
465
440
|
checkCommodityIndexRef,
|
466
441
|
isEditor,
|
467
442
|
isNoMoreData
|
468
|
-
} }, isShowConsent ? (React.createElement(Consent, Object.assign({}, (
|
443
|
+
} }, isShowConsent ? (React.createElement(Consent, 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({
|
469
444
|
rtcList,
|
470
445
|
mutateLike: bffMutateLike,
|
471
446
|
mutateUnlike: bffMutateUnlike,
|
472
447
|
submitForm: bffSubmitForm,
|
473
|
-
tagList
|
474
|
-
pageData
|
448
|
+
tagList
|
475
449
|
}))));
|
476
450
|
};
|
477
451
|
export default memo(SxpDataSourceProvider);
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { useEffect } from 'react';
|
2
|
+
const useFocusTrap = (elementRef) => {
|
3
|
+
useEffect(() => {
|
4
|
+
const trapFocus = (element) => {
|
5
|
+
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])');
|
6
|
+
var firstFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[0];
|
7
|
+
var lastFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[(focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls.length) - 1];
|
8
|
+
var KEYCODE_TAB = 9;
|
9
|
+
element.addEventListener('keydown', function (e) {
|
10
|
+
var isTabPressed = e.key === 'Tab' || e.keyCode === KEYCODE_TAB;
|
11
|
+
if (!isTabPressed) {
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
if (e.shiftKey) {
|
15
|
+
if ((document === null || document === void 0 ? void 0 : document.activeElement) === firstFocusableEl) {
|
16
|
+
lastFocusableEl === null || lastFocusableEl === void 0 ? void 0 : lastFocusableEl.focus();
|
17
|
+
e.preventDefault();
|
18
|
+
}
|
19
|
+
}
|
20
|
+
else {
|
21
|
+
if ((document === null || document === void 0 ? void 0 : document.activeElement) === lastFocusableEl) {
|
22
|
+
firstFocusableEl === null || firstFocusableEl === void 0 ? void 0 : firstFocusableEl.focus();
|
23
|
+
e.preventDefault();
|
24
|
+
}
|
25
|
+
}
|
26
|
+
});
|
27
|
+
firstFocusableEl === null || firstFocusableEl === void 0 ? void 0 : firstFocusableEl.focus();
|
28
|
+
};
|
29
|
+
if (elementRef === null || elementRef === void 0 ? void 0 : elementRef.current)
|
30
|
+
trapFocus(elementRef === null || elementRef === void 0 ? void 0 : elementRef.current);
|
31
|
+
return () => {
|
32
|
+
var _a;
|
33
|
+
(_a = elementRef === null || elementRef === void 0 ? void 0 : elementRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('keydown', trapFocus);
|
34
|
+
};
|
35
|
+
}, [elementRef]);
|
36
|
+
};
|
37
|
+
export default useFocusTrap;
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
@@ -97,7 +97,7 @@ const CommodityDetail = (_a) => {
|
|
97
97
|
};
|
98
98
|
const renderBtn = () => {
|
99
99
|
var _a, _b;
|
100
|
-
return (React.createElement(React.Fragment, null, (isDefault || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("
|
100
|
+
return (React.createElement(React.Fragment, null, (isDefault || (product === null || product === void 0 ? void 0 : product.link)) && (React.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 },
|
101
101
|
React.createElement("span", { dangerouslySetInnerHTML: {
|
102
102
|
__html: setFontForText((_b = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _b !== void 0 ? _b : 'Purchase on Website', buttonStyle)
|
103
103
|
} })))));
|
@@ -135,7 +135,9 @@ const CommodityDetail = (_a) => {
|
|
135
135
|
return (React.createElement(React.Fragment, null,
|
136
136
|
React.createElement("div", Object.assign({ className: css(Object.assign({}, style)) }, props),
|
137
137
|
React.createElement("div", { style: { position: 'relative' } },
|
138
|
-
product && ((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) > 0 && (React.createElement(Swiper, {
|
138
|
+
product && ((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) > 0 && (React.createElement(Swiper, { a11y: {
|
139
|
+
enabled: true
|
140
|
+
}, height: height, modules: [Pagination, Autoplay], pagination: {
|
139
141
|
clickable: true,
|
140
142
|
bulletActiveClass: 'swipe-item-active-bullet',
|
141
143
|
clickableClass: getDotsAlign,
|
@@ -194,7 +194,7 @@ Made in Italy` })));
|
|
194
194
|
React.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: {
|
195
195
|
__html: 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)
|
196
196
|
} }))),
|
197
|
-
(!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("
|
197
|
+
(!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.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 },
|
198
198
|
React.createElement("span", { dangerouslySetInnerHTML: {
|
199
199
|
__html: setFontForText((_4 = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _4 !== void 0 ? _4 : 'Shop now', buttonStyle)
|
200
200
|
} }))),
|