pb-sxp-ui 1.0.17 → 1.0.19
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 +13065 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1683 -0
- package/dist/index.js +13033 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.cjs +7 -0
- package/dist/index.min.cjs.map +1 -0
- package/dist/index.min.js +7 -0
- package/dist/index.min.js.map +1 -0
- package/dist/pb-ui.js +13061 -0
- package/dist/pb-ui.js.map +1 -0
- package/dist/pb-ui.min.js +7 -0
- package/dist/pb-ui.min.js.map +1 -0
- package/es/core/Pagebuilder/PagebuilderClass.d.ts +15 -0
- package/es/core/Pagebuilder/PagebuilderClass.js +42 -0
- package/es/core/Pagebuilder/index.d.ts +3 -0
- package/es/core/Pagebuilder/index.js +96 -0
- package/es/core/Pagebuilder/type.d.ts +55 -0
- package/es/core/Pagebuilder/type.js +1 -0
- package/es/core/components/SxpPageCore/index.d.ts +12 -0
- package/es/core/components/SxpPageCore/index.js +26 -0
- package/es/core/components/SxpPageRender/ExpandableText.d.ts +14 -0
- package/es/core/components/SxpPageRender/ExpandableText.js +52 -0
- package/es/core/components/SxpPageRender/FingerSwipeTip/index.d.ts +6 -0
- package/es/core/components/SxpPageRender/FingerSwipeTip/index.js +19 -0
- package/es/core/components/SxpPageRender/Hashtag/index.d.ts +12 -0
- package/es/core/components/SxpPageRender/Hashtag/index.js +40 -0
- package/es/core/components/SxpPageRender/LikeButton/index.d.ts +11 -0
- package/es/core/components/SxpPageRender/LikeButton/index.js +58 -0
- package/es/core/components/SxpPageRender/Modal/index.d.ts +11 -0
- package/es/core/components/SxpPageRender/Modal/index.js +48 -0
- package/es/core/components/SxpPageRender/Navbar.d.ts +9 -0
- package/es/core/components/SxpPageRender/Navbar.js +10 -0
- package/es/core/components/SxpPageRender/Nudge/index.d.ts +24 -0
- package/es/core/components/SxpPageRender/Nudge/index.js +13 -0
- package/es/core/components/SxpPageRender/PictureGroup/Picture.d.ts +8 -0
- package/es/core/components/SxpPageRender/PictureGroup/Picture.js +54 -0
- package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +13 -0
- package/es/core/components/SxpPageRender/PictureGroup/index.js +31 -0
- package/es/core/components/SxpPageRender/Popup/index.d.ts +3 -0
- package/es/core/components/SxpPageRender/Popup/index.js +62 -0
- package/es/core/components/SxpPageRender/RenderCard.d.ts +11 -0
- package/es/core/components/SxpPageRender/RenderCard.js +43 -0
- package/es/core/components/SxpPageRender/ToggleButton/index.d.ts +10 -0
- package/es/core/components/SxpPageRender/ToggleButton/index.js +13 -0
- package/es/core/components/SxpPageRender/VideoWidget/index.d.ts +12 -0
- package/es/core/components/SxpPageRender/VideoWidget/index.js +219 -0
- package/es/core/components/SxpPageRender/WaterFall/List.d.ts +4 -0
- package/es/core/components/SxpPageRender/WaterFall/List.js +183 -0
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.d.ts +4 -0
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +319 -0
- package/es/core/components/SxpPageRender/WaterFall/index.d.ts +7 -0
- package/es/core/components/SxpPageRender/WaterFall/index.js +101 -0
- package/es/core/components/SxpPageRender/WaterFall/preview.json +1242 -0
- package/es/core/components/SxpPageRender/fakeData.d.ts +130 -0
- package/es/core/components/SxpPageRender/fakeData.js +899 -0
- package/es/core/components/SxpPageRender/index.d.ts +57 -0
- package/es/core/components/SxpPageRender/index.js +378 -0
- package/es/core/components/SxpPageRender/typing.d.ts +66 -0
- package/es/core/components/SxpPageRender/typing.js +1 -0
- package/es/core/components/SxpPageRender/useIconLink.d.ts +1 -0
- package/es/core/components/SxpPageRender/useIconLink.js +13 -0
- package/es/core/context/DataSourceProvider.d.ts +17 -0
- package/es/core/context/DataSourceProvider.js +45 -0
- package/es/core/context/EditorContext.d.ts +83 -0
- package/es/core/context/EditorContext.js +147 -0
- package/es/core/context/EditorDataProvider.d.ts +20 -0
- package/es/core/context/EditorDataProvider.js +23 -0
- package/es/core/context/SxpDataSourceProvider.d.ts +94 -0
- package/es/core/context/SxpDataSourceProvider.js +208 -0
- package/es/core/create.d.ts +37 -0
- package/es/core/create.js +4 -0
- package/es/core/hoc/withBindDataSource.d.ts +6 -0
- package/es/core/hoc/withBindDataSource.js +61 -0
- package/es/core/hooks/index.d.ts +4 -0
- package/es/core/hooks/index.js +4 -0
- package/es/core/hooks/useCurrentNode.d.ts +10 -0
- package/es/core/hooks/useCurrentNode.js +11 -0
- package/es/core/hooks/useDataSource.d.ts +2 -0
- package/es/core/hooks/useDataSource.js +6 -0
- package/es/core/hooks/useEditor.d.ts +1 -0
- package/es/core/hooks/useEditor.js +5 -0
- package/es/core/hooks/useEventReport.d.ts +5 -0
- package/es/core/hooks/useEventReport.js +73 -0
- package/es/core/hooks/useOnScreen.d.ts +2 -0
- package/es/core/hooks/useOnScreen.js +19 -0
- package/es/core/hooks/useSxpDataSource.d.ts +1 -0
- package/es/core/hooks/useSxpDataSource.js +5 -0
- package/es/core/index.d.ts +3 -0
- package/es/core/index.js +1 -0
- package/es/core/schema.d.ts +58 -0
- package/es/core/schema.js +1 -0
- package/es/core/utils/event.d.ts +7 -0
- package/es/core/utils/event.js +8 -0
- package/es/core/utils/getDataByDS.d.ts +6 -0
- package/es/core/utils/getDataByDS.js +39 -0
- package/es/core/utils/getSxpTokenInfo.d.ts +2 -0
- package/es/core/utils/getSxpTokenInfo.js +26 -0
- package/es/core/utils/localStore.d.ts +5 -0
- package/es/core/utils/localStore.js +22 -0
- package/es/core/utils/materials.d.ts +11 -0
- package/es/core/utils/materials.js +31 -0
- package/es/core/utils/sessionStore.d.ts +3 -0
- package/es/core/utils/sessionStore.js +26 -0
- package/es/core/utils/tool.d.ts +5 -0
- package/es/core/utils/tool.js +48 -0
- package/es/core/utils/unzip.d.ts +1 -0
- package/es/core/utils/unzip.js +10 -0
- package/es/index.d.ts +11 -0
- package/es/index.js +13 -0
- package/es/materials/index.d.ts +1 -0
- package/es/materials/index.js +1 -0
- package/es/materials/sxp/HashTag/index.d.ts +14 -0
- package/es/materials/sxp/HashTag/index.js +6 -0
- package/es/materials/sxp/HashTag/material.d.ts +2 -0
- package/es/materials/sxp/HashTag/material.js +52 -0
- package/es/materials/sxp/HashTag/settingRender.d.ts +125 -0
- package/es/materials/sxp/HashTag/settingRender.js +157 -0
- package/es/materials/sxp/defaultSetting.d.ts +11 -0
- package/es/materials/sxp/defaultSetting.js +7 -0
- package/es/materials/sxp/index.d.ts +3 -0
- package/es/materials/sxp/index.js +3 -0
- package/es/materials/sxp/popup/AppointForm/index.d.ts +18 -0
- package/es/materials/sxp/popup/AppointForm/index.js +76 -0
- package/es/materials/sxp/popup/AppointForm/interactionRender.d.ts +8 -0
- package/es/materials/sxp/popup/AppointForm/interactionRender.js +11 -0
- package/es/materials/sxp/popup/AppointForm/material.d.ts +2 -0
- package/es/materials/sxp/popup/AppointForm/material.js +35 -0
- package/es/materials/sxp/popup/AppointForm/settingRender.d.ts +68 -0
- package/es/materials/sxp/popup/AppointForm/settingRender.js +93 -0
- package/es/materials/sxp/popup/CommodityDetail/index.d.ts +34 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +110 -0
- package/es/materials/sxp/popup/CommodityDetail/material.d.ts +2 -0
- package/es/materials/sxp/popup/CommodityDetail/material.js +51 -0
- package/es/materials/sxp/popup/CommodityDetail/settingRender.d.ts +137 -0
- package/es/materials/sxp/popup/CommodityDetail/settingRender.js +171 -0
- package/es/materials/sxp/popup/CommodityDetailDiro/index.d.ts +19 -0
- package/es/materials/sxp/popup/CommodityDetailDiro/index.js +163 -0
- package/es/materials/sxp/popup/CommodityDetailDiro/material.d.ts +2 -0
- package/es/materials/sxp/popup/CommodityDetailDiro/material.js +16 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +35 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +134 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/material.d.ts +2 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/material.js +61 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +137 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +175 -0
- package/es/materials/sxp/popup/Prompt/index.d.ts +11 -0
- package/es/materials/sxp/popup/Prompt/index.js +20 -0
- package/es/materials/sxp/popup/Prompt/interactionRender.d.ts +8 -0
- package/es/materials/sxp/popup/Prompt/interactionRender.js +11 -0
- package/es/materials/sxp/popup/Prompt/material.d.ts +2 -0
- package/es/materials/sxp/popup/Prompt/material.js +28 -0
- package/es/materials/sxp/popup/Prompt/settingRender.d.ts +12 -0
- package/es/materials/sxp/popup/Prompt/settingRender.js +18 -0
- package/es/materials/sxp/popup/index.d.ts +4 -0
- package/es/materials/sxp/popup/index.js +4 -0
- package/es/materials/sxp/template/Appoint/index.d.ts +15 -0
- package/es/materials/sxp/template/Appoint/index.js +16 -0
- package/es/materials/sxp/template/Appoint/interactionRender.d.ts +8 -0
- package/es/materials/sxp/template/Appoint/interactionRender.js +11 -0
- package/es/materials/sxp/template/Appoint/material.d.ts +2 -0
- package/es/materials/sxp/template/Appoint/material.js +46 -0
- package/es/materials/sxp/template/Commodity/index.d.ts +15 -0
- package/es/materials/sxp/template/Commodity/index.js +27 -0
- package/es/materials/sxp/template/Commodity/interactionRender.d.ts +8 -0
- package/es/materials/sxp/template/Commodity/interactionRender.js +11 -0
- package/es/materials/sxp/template/Commodity/material.d.ts +2 -0
- package/es/materials/sxp/template/Commodity/material.js +52 -0
- package/es/materials/sxp/template/CommodityDiro/index.d.ts +15 -0
- package/es/materials/sxp/template/CommodityDiro/index.js +27 -0
- package/es/materials/sxp/template/CommodityDiro/interactionRender.d.ts +8 -0
- package/es/materials/sxp/template/CommodityDiro/interactionRender.js +11 -0
- package/es/materials/sxp/template/CommodityDiro/material.d.ts +2 -0
- package/es/materials/sxp/template/CommodityDiro/material.js +52 -0
- package/es/materials/sxp/template/CommodityDiroNew/index.d.ts +15 -0
- package/es/materials/sxp/template/CommodityDiroNew/index.js +27 -0
- package/es/materials/sxp/template/CommodityDiroNew/interactionRender.d.ts +8 -0
- package/es/materials/sxp/template/CommodityDiroNew/interactionRender.js +11 -0
- package/es/materials/sxp/template/CommodityDiroNew/material.d.ts +2 -0
- package/es/materials/sxp/template/CommodityDiroNew/material.js +53 -0
- package/es/materials/sxp/template/Link/index.d.ts +14 -0
- package/es/materials/sxp/template/Link/index.js +32 -0
- package/es/materials/sxp/template/Link/material.d.ts +2 -0
- package/es/materials/sxp/template/Link/material.js +44 -0
- package/es/materials/sxp/template/MultiCommodity/index.d.ts +16 -0
- package/es/materials/sxp/template/MultiCommodity/index.js +52 -0
- package/es/materials/sxp/template/MultiCommodity/interactionRender.d.ts +8 -0
- package/es/materials/sxp/template/MultiCommodity/interactionRender.js +11 -0
- package/es/materials/sxp/template/MultiCommodity/material.d.ts +2 -0
- package/es/materials/sxp/template/MultiCommodity/material.js +52 -0
- package/es/materials/sxp/template/MultiCommodityDiro/index.d.ts +16 -0
- package/es/materials/sxp/template/MultiCommodityDiro/index.js +51 -0
- package/es/materials/sxp/template/MultiCommodityDiro/interactionRender.d.ts +8 -0
- package/es/materials/sxp/template/MultiCommodityDiro/interactionRender.js +11 -0
- package/es/materials/sxp/template/MultiCommodityDiro/material.d.ts +2 -0
- package/es/materials/sxp/template/MultiCommodityDiro/material.js +52 -0
- package/es/materials/sxp/template/MultiCommodityDiroNew/index.d.ts +16 -0
- package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +52 -0
- package/es/materials/sxp/template/MultiCommodityDiroNew/interactionRender.d.ts +8 -0
- package/es/materials/sxp/template/MultiCommodityDiroNew/interactionRender.js +11 -0
- package/es/materials/sxp/template/MultiCommodityDiroNew/material.d.ts +2 -0
- package/es/materials/sxp/template/MultiCommodityDiroNew/material.js +53 -0
- package/es/materials/sxp/template/components/EventProvider.d.ts +13 -0
- package/es/materials/sxp/template/components/EventProvider.js +47 -0
- package/es/materials/sxp/template/components/Img.d.ts +10 -0
- package/es/materials/sxp/template/components/Img.js +19 -0
- package/es/materials/sxp/template/components/Scroll.d.ts +10 -0
- package/es/materials/sxp/template/components/Scroll.js +10 -0
- package/es/materials/sxp/template/components/settingRender.d.ts +129 -0
- package/es/materials/sxp/template/components/settingRender.js +219 -0
- package/es/materials/sxp/template/components/typing.d.ts +6 -0
- package/es/materials/sxp/template/components/typing.js +1 -0
- package/es/materials/sxp/template/index.d.ts +8 -0
- package/es/materials/sxp/template/index.js +8 -0
- package/lib/core/Pagebuilder/PagebuilderClass.d.ts +15 -0
- package/lib/core/Pagebuilder/PagebuilderClass.js +45 -0
- package/lib/core/Pagebuilder/index.d.ts +3 -0
- package/lib/core/Pagebuilder/index.js +99 -0
- package/lib/core/Pagebuilder/type.d.ts +55 -0
- package/lib/core/Pagebuilder/type.js +2 -0
- package/lib/core/components/SxpPageCore/index.d.ts +12 -0
- package/lib/core/components/SxpPageCore/index.js +29 -0
- package/lib/core/components/SxpPageRender/ExpandableText.d.ts +14 -0
- package/lib/core/components/SxpPageRender/ExpandableText.js +55 -0
- package/lib/core/components/SxpPageRender/FingerSwipeTip/index.d.ts +6 -0
- package/lib/core/components/SxpPageRender/FingerSwipeTip/index.js +22 -0
- package/lib/core/components/SxpPageRender/Hashtag/index.d.ts +12 -0
- package/lib/core/components/SxpPageRender/Hashtag/index.js +43 -0
- package/lib/core/components/SxpPageRender/LikeButton/index.d.ts +11 -0
- package/lib/core/components/SxpPageRender/LikeButton/index.js +60 -0
- package/lib/core/components/SxpPageRender/Modal/index.d.ts +11 -0
- package/lib/core/components/SxpPageRender/Modal/index.js +51 -0
- package/lib/core/components/SxpPageRender/Navbar.d.ts +9 -0
- package/lib/core/components/SxpPageRender/Navbar.js +13 -0
- package/lib/core/components/SxpPageRender/Nudge/index.d.ts +24 -0
- package/lib/core/components/SxpPageRender/Nudge/index.js +16 -0
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.d.ts +8 -0
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.js +57 -0
- package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +13 -0
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +34 -0
- package/lib/core/components/SxpPageRender/Popup/index.d.ts +3 -0
- package/lib/core/components/SxpPageRender/Popup/index.js +65 -0
- package/lib/core/components/SxpPageRender/RenderCard.d.ts +11 -0
- package/lib/core/components/SxpPageRender/RenderCard.js +46 -0
- package/lib/core/components/SxpPageRender/ToggleButton/index.d.ts +10 -0
- package/lib/core/components/SxpPageRender/ToggleButton/index.js +16 -0
- package/lib/core/components/SxpPageRender/VideoWidget/index.d.ts +12 -0
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +222 -0
- package/lib/core/components/SxpPageRender/WaterFall/List.d.ts +4 -0
- package/lib/core/components/SxpPageRender/WaterFall/List.js +186 -0
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.d.ts +4 -0
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +322 -0
- package/lib/core/components/SxpPageRender/WaterFall/index.d.ts +7 -0
- package/lib/core/components/SxpPageRender/WaterFall/index.js +104 -0
- package/lib/core/components/SxpPageRender/WaterFall/preview.json +1242 -0
- package/lib/core/components/SxpPageRender/fakeData.d.ts +130 -0
- package/lib/core/components/SxpPageRender/fakeData.js +902 -0
- package/lib/core/components/SxpPageRender/index.d.ts +57 -0
- package/lib/core/components/SxpPageRender/index.js +381 -0
- package/lib/core/components/SxpPageRender/typing.d.ts +66 -0
- package/lib/core/components/SxpPageRender/typing.js +2 -0
- package/lib/core/components/SxpPageRender/useIconLink.d.ts +1 -0
- package/lib/core/components/SxpPageRender/useIconLink.js +17 -0
- package/lib/core/context/DataSourceProvider.d.ts +17 -0
- package/lib/core/context/DataSourceProvider.js +48 -0
- package/lib/core/context/EditorContext.d.ts +83 -0
- package/lib/core/context/EditorContext.js +151 -0
- package/lib/core/context/EditorDataProvider.d.ts +20 -0
- package/lib/core/context/EditorDataProvider.js +28 -0
- package/lib/core/context/SxpDataSourceProvider.d.ts +94 -0
- package/lib/core/context/SxpDataSourceProvider.js +211 -0
- package/lib/core/create.d.ts +37 -0
- package/lib/core/create.js +8 -0
- package/lib/core/hoc/withBindDataSource.d.ts +6 -0
- package/lib/core/hoc/withBindDataSource.js +63 -0
- package/lib/core/hooks/index.d.ts +4 -0
- package/lib/core/hooks/index.js +7 -0
- package/lib/core/hooks/useCurrentNode.d.ts +10 -0
- package/lib/core/hooks/useCurrentNode.js +14 -0
- package/lib/core/hooks/useDataSource.d.ts +2 -0
- package/lib/core/hooks/useDataSource.js +9 -0
- package/lib/core/hooks/useEditor.d.ts +1 -0
- package/lib/core/hooks/useEditor.js +9 -0
- package/lib/core/hooks/useEventReport.d.ts +5 -0
- package/lib/core/hooks/useEventReport.js +77 -0
- package/lib/core/hooks/useOnScreen.d.ts +2 -0
- package/lib/core/hooks/useOnScreen.js +22 -0
- package/lib/core/hooks/useSxpDataSource.d.ts +1 -0
- package/lib/core/hooks/useSxpDataSource.js +9 -0
- package/lib/core/index.d.ts +3 -0
- package/lib/core/index.js +5 -0
- package/lib/core/schema.d.ts +58 -0
- package/lib/core/schema.js +2 -0
- package/lib/core/utils/event.d.ts +7 -0
- package/lib/core/utils/event.js +12 -0
- package/lib/core/utils/getDataByDS.d.ts +6 -0
- package/lib/core/utils/getDataByDS.js +41 -0
- package/lib/core/utils/getSxpTokenInfo.d.ts +2 -0
- package/lib/core/utils/getSxpTokenInfo.js +30 -0
- package/lib/core/utils/localStore.d.ts +5 -0
- package/lib/core/utils/localStore.js +28 -0
- package/lib/core/utils/materials.d.ts +11 -0
- package/lib/core/utils/materials.js +37 -0
- package/lib/core/utils/sessionStore.d.ts +3 -0
- package/lib/core/utils/sessionStore.js +32 -0
- package/lib/core/utils/tool.d.ts +5 -0
- package/lib/core/utils/tool.js +54 -0
- package/lib/core/utils/unzip.d.ts +1 -0
- package/lib/core/utils/unzip.js +15 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +22 -0
- package/lib/materials/index.d.ts +1 -0
- package/lib/materials/index.js +4 -0
- package/lib/materials/sxp/HashTag/index.d.ts +14 -0
- package/lib/materials/sxp/HashTag/index.js +9 -0
- package/lib/materials/sxp/HashTag/material.d.ts +2 -0
- package/lib/materials/sxp/HashTag/material.js +56 -0
- package/lib/materials/sxp/HashTag/settingRender.d.ts +125 -0
- package/lib/materials/sxp/HashTag/settingRender.js +159 -0
- package/lib/materials/sxp/defaultSetting.d.ts +11 -0
- package/lib/materials/sxp/defaultSetting.js +10 -0
- package/lib/materials/sxp/index.d.ts +3 -0
- package/lib/materials/sxp/index.js +6 -0
- package/lib/materials/sxp/popup/AppointForm/index.d.ts +18 -0
- package/lib/materials/sxp/popup/AppointForm/index.js +78 -0
- package/lib/materials/sxp/popup/AppointForm/interactionRender.d.ts +8 -0
- package/lib/materials/sxp/popup/AppointForm/interactionRender.js +13 -0
- package/lib/materials/sxp/popup/AppointForm/material.d.ts +2 -0
- package/lib/materials/sxp/popup/AppointForm/material.js +39 -0
- package/lib/materials/sxp/popup/AppointForm/settingRender.d.ts +68 -0
- package/lib/materials/sxp/popup/AppointForm/settingRender.js +95 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +34 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.js +112 -0
- package/lib/materials/sxp/popup/CommodityDetail/material.d.ts +2 -0
- package/lib/materials/sxp/popup/CommodityDetail/material.js +55 -0
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +137 -0
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +173 -0
- package/lib/materials/sxp/popup/CommodityDetailDiro/index.d.ts +19 -0
- package/lib/materials/sxp/popup/CommodityDetailDiro/index.js +165 -0
- package/lib/materials/sxp/popup/CommodityDetailDiro/material.d.ts +2 -0
- package/lib/materials/sxp/popup/CommodityDetailDiro/material.js +20 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +35 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +136 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/material.d.ts +2 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/material.js +65 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +137 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +177 -0
- package/lib/materials/sxp/popup/Prompt/index.d.ts +11 -0
- package/lib/materials/sxp/popup/Prompt/index.js +22 -0
- package/lib/materials/sxp/popup/Prompt/interactionRender.d.ts +8 -0
- package/lib/materials/sxp/popup/Prompt/interactionRender.js +13 -0
- package/lib/materials/sxp/popup/Prompt/material.d.ts +2 -0
- package/lib/materials/sxp/popup/Prompt/material.js +32 -0
- package/lib/materials/sxp/popup/Prompt/settingRender.d.ts +12 -0
- package/lib/materials/sxp/popup/Prompt/settingRender.js +20 -0
- package/lib/materials/sxp/popup/index.d.ts +4 -0
- package/lib/materials/sxp/popup/index.js +7 -0
- package/lib/materials/sxp/template/Appoint/index.d.ts +15 -0
- package/lib/materials/sxp/template/Appoint/index.js +18 -0
- package/lib/materials/sxp/template/Appoint/interactionRender.d.ts +8 -0
- package/lib/materials/sxp/template/Appoint/interactionRender.js +13 -0
- package/lib/materials/sxp/template/Appoint/material.d.ts +2 -0
- package/lib/materials/sxp/template/Appoint/material.js +50 -0
- package/lib/materials/sxp/template/Commodity/index.d.ts +15 -0
- package/lib/materials/sxp/template/Commodity/index.js +29 -0
- package/lib/materials/sxp/template/Commodity/interactionRender.d.ts +8 -0
- package/lib/materials/sxp/template/Commodity/interactionRender.js +13 -0
- package/lib/materials/sxp/template/Commodity/material.d.ts +2 -0
- package/lib/materials/sxp/template/Commodity/material.js +56 -0
- package/lib/materials/sxp/template/CommodityDiro/index.d.ts +15 -0
- package/lib/materials/sxp/template/CommodityDiro/index.js +29 -0
- package/lib/materials/sxp/template/CommodityDiro/interactionRender.d.ts +8 -0
- package/lib/materials/sxp/template/CommodityDiro/interactionRender.js +13 -0
- package/lib/materials/sxp/template/CommodityDiro/material.d.ts +2 -0
- package/lib/materials/sxp/template/CommodityDiro/material.js +56 -0
- package/lib/materials/sxp/template/CommodityDiroNew/index.d.ts +15 -0
- package/lib/materials/sxp/template/CommodityDiroNew/index.js +29 -0
- package/lib/materials/sxp/template/CommodityDiroNew/interactionRender.d.ts +8 -0
- package/lib/materials/sxp/template/CommodityDiroNew/interactionRender.js +13 -0
- package/lib/materials/sxp/template/CommodityDiroNew/material.d.ts +2 -0
- package/lib/materials/sxp/template/CommodityDiroNew/material.js +57 -0
- package/lib/materials/sxp/template/Link/index.d.ts +14 -0
- package/lib/materials/sxp/template/Link/index.js +34 -0
- package/lib/materials/sxp/template/Link/material.d.ts +2 -0
- package/lib/materials/sxp/template/Link/material.js +48 -0
- package/lib/materials/sxp/template/MultiCommodity/index.d.ts +16 -0
- package/lib/materials/sxp/template/MultiCommodity/index.js +54 -0
- package/lib/materials/sxp/template/MultiCommodity/interactionRender.d.ts +8 -0
- package/lib/materials/sxp/template/MultiCommodity/interactionRender.js +13 -0
- package/lib/materials/sxp/template/MultiCommodity/material.d.ts +2 -0
- package/lib/materials/sxp/template/MultiCommodity/material.js +56 -0
- package/lib/materials/sxp/template/MultiCommodityDiro/index.d.ts +16 -0
- package/lib/materials/sxp/template/MultiCommodityDiro/index.js +53 -0
- package/lib/materials/sxp/template/MultiCommodityDiro/interactionRender.d.ts +8 -0
- package/lib/materials/sxp/template/MultiCommodityDiro/interactionRender.js +13 -0
- package/lib/materials/sxp/template/MultiCommodityDiro/material.d.ts +2 -0
- package/lib/materials/sxp/template/MultiCommodityDiro/material.js +56 -0
- package/lib/materials/sxp/template/MultiCommodityDiroNew/index.d.ts +16 -0
- package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +54 -0
- package/lib/materials/sxp/template/MultiCommodityDiroNew/interactionRender.d.ts +8 -0
- package/lib/materials/sxp/template/MultiCommodityDiroNew/interactionRender.js +13 -0
- package/lib/materials/sxp/template/MultiCommodityDiroNew/material.d.ts +2 -0
- package/lib/materials/sxp/template/MultiCommodityDiroNew/material.js +57 -0
- package/lib/materials/sxp/template/components/EventProvider.d.ts +13 -0
- package/lib/materials/sxp/template/components/EventProvider.js +49 -0
- package/lib/materials/sxp/template/components/Img.d.ts +10 -0
- package/lib/materials/sxp/template/components/Img.js +22 -0
- package/lib/materials/sxp/template/components/Scroll.d.ts +10 -0
- package/lib/materials/sxp/template/components/Scroll.js +13 -0
- package/lib/materials/sxp/template/components/settingRender.d.ts +129 -0
- package/lib/materials/sxp/template/components/settingRender.js +221 -0
- package/lib/materials/sxp/template/components/typing.d.ts +6 -0
- package/lib/materials/sxp/template/components/typing.js +2 -0
- package/lib/materials/sxp/template/index.d.ts +8 -0
- package/lib/materials/sxp/template/index.js +11 -0
- package/package.json +1 -1
@@ -0,0 +1,54 @@
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
2
|
+
import { useSxpDataSource } from '../../../../core/hooks';
|
3
|
+
const Picture = (props) => {
|
4
|
+
const { src, height, width } = props;
|
5
|
+
const [blur, setBlur] = useState(false);
|
6
|
+
const { sxpParameter } = useSxpDataSource();
|
7
|
+
useEffect(() => {
|
8
|
+
if (src === '' || !src)
|
9
|
+
return;
|
10
|
+
const img = new Image();
|
11
|
+
img.src = `${src}?imageMogr2/format/jpg`;
|
12
|
+
img.onload = () => {
|
13
|
+
const aspectRatio = img.height / img.width;
|
14
|
+
const targetAspectRatio = 16 / 9;
|
15
|
+
const tolerance = 0.05;
|
16
|
+
if (Math.abs(aspectRatio - targetAspectRatio) > tolerance) {
|
17
|
+
setBlur(true);
|
18
|
+
}
|
19
|
+
};
|
20
|
+
}, [src]);
|
21
|
+
const getImg = useCallback((src, style) => {
|
22
|
+
if (src === '' || !src)
|
23
|
+
return;
|
24
|
+
return (React.createElement("picture", null,
|
25
|
+
React.createElement("source", { type: 'image/avif', srcSet: `${src}?imageMogr2/format/avif` }),
|
26
|
+
React.createElement("source", { type: 'image/webp', srcSet: `${src}?imageMogr2/format/webp` }),
|
27
|
+
React.createElement("source", { type: 'image/jpeg', srcSet: `${src}?imageMogr2/format/jpg` }),
|
28
|
+
React.createElement("img", { loading: 'lazy', src: src, style: style })));
|
29
|
+
}, []);
|
30
|
+
return (React.createElement("div", { style: {
|
31
|
+
overflow: 'hidden',
|
32
|
+
height,
|
33
|
+
width: '100%',
|
34
|
+
position: 'relative'
|
35
|
+
} },
|
36
|
+
getImg(src !== null && src !== void 0 ? src : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, {
|
37
|
+
height: '100%',
|
38
|
+
width: '100%',
|
39
|
+
objectFit: 'cover',
|
40
|
+
filter: blur ? 'blur(10px)' : 'none',
|
41
|
+
transform: blur ? 'scale(1.2)' : 'none'
|
42
|
+
}),
|
43
|
+
blur &&
|
44
|
+
getImg(src, {
|
45
|
+
width: '100%',
|
46
|
+
objectFit: 'contain',
|
47
|
+
position: 'absolute',
|
48
|
+
top: '50%',
|
49
|
+
transform: 'translateY(-50%)',
|
50
|
+
left: 0,
|
51
|
+
right: 0
|
52
|
+
})));
|
53
|
+
};
|
54
|
+
export default Picture;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { RecItemType } from '../typing';
|
3
|
+
interface IPictureGroupProps {
|
4
|
+
imgUrls?: string[];
|
5
|
+
width: number;
|
6
|
+
height: number;
|
7
|
+
rec: RecItemType;
|
8
|
+
index: number;
|
9
|
+
onReportViewImageEnd: (rec: RecItemType) => void;
|
10
|
+
onViewImageStartEvent: (index: number) => void;
|
11
|
+
}
|
12
|
+
declare const _default: React.NamedExoticComponent<IPictureGroupProps>;
|
13
|
+
export default _default;
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import React, { memo, useEffect, useRef, useState } from 'react';
|
2
|
+
import { Autoplay, Pagination } from 'swiper/modules';
|
3
|
+
import { Swiper, SwiperSlide, useSwiperSlide } from 'swiper/react';
|
4
|
+
import Picture from './Picture';
|
5
|
+
import { useSxpDataSource } from '../../../../core/hooks';
|
6
|
+
const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent }) => {
|
7
|
+
const ref = useRef();
|
8
|
+
const { isActive } = useSwiperSlide();
|
9
|
+
const { sxpParameter, openHashtag } = useSxpDataSource();
|
10
|
+
const [isLoad, setIsLoad] = useState(false);
|
11
|
+
useEffect(() => {
|
12
|
+
if (isLoad && isActive) {
|
13
|
+
(ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.start();
|
14
|
+
if (openHashtag) {
|
15
|
+
onReportViewImageEnd(rec);
|
16
|
+
}
|
17
|
+
else {
|
18
|
+
onViewImageStartEvent(index);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
else {
|
22
|
+
setIsLoad(true);
|
23
|
+
(ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.stop();
|
24
|
+
}
|
25
|
+
}, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad]);
|
26
|
+
return (React.createElement(Swiper, { ref: ref, defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, loop: true, autoplay: { delay: 3000 } }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url) => {
|
27
|
+
return (React.createElement(SwiperSlide, { key: url },
|
28
|
+
React.createElement(Picture, { src: url, width: width, height: height })));
|
29
|
+
})));
|
30
|
+
};
|
31
|
+
export default memo(PictureGroup);
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
2
|
+
import Modal from '../Modal';
|
3
|
+
import { useEditor, useSxpDataSource } from '../../../../core/hooks';
|
4
|
+
import withBindDataSource from '../../../../core/hoc/withBindDataSource';
|
5
|
+
import { useEventReport } from '../../../../core/hooks/useEventReport';
|
6
|
+
const Popup = () => {
|
7
|
+
const { schema, resolver, popup } = useEditor();
|
8
|
+
const { setPopupDetailData, popupDetailData, bffEventReport } = useSxpDataSource();
|
9
|
+
const { productView } = useEventReport();
|
10
|
+
const [visible, setVisible] = useState();
|
11
|
+
const curTimeRef = useRef(null);
|
12
|
+
useEffect(() => {
|
13
|
+
const initTime = () => {
|
14
|
+
curTimeRef.current = new Date();
|
15
|
+
};
|
16
|
+
initTime();
|
17
|
+
window.addEventListener('pageshow', initTime);
|
18
|
+
return () => {
|
19
|
+
window.removeEventListener('pageshow', initTime);
|
20
|
+
};
|
21
|
+
}, []);
|
22
|
+
useEffect(() => {
|
23
|
+
if (popup && (popup === null || popup === void 0 ? void 0 : popup.id) && (popup === null || popup === void 0 ? void 0 : popup.id) !== '') {
|
24
|
+
curTimeRef.current = new Date();
|
25
|
+
setVisible(popup);
|
26
|
+
}
|
27
|
+
}, [popup]);
|
28
|
+
const handleClose = () => {
|
29
|
+
var _a, _b, _c, _d;
|
30
|
+
if (!popup || (popup === null || popup === void 0 ? void 0 : popup.id) === '' || !visible || new Date() - curTimeRef.current < ((_a = popup === null || popup === void 0 ? void 0 : popup.duration) !== null && _a !== void 0 ? _a : 0)) {
|
31
|
+
return;
|
32
|
+
}
|
33
|
+
setVisible(Object.assign(Object.assign({}, popup), { id: '' }));
|
34
|
+
const data = popupDetailData;
|
35
|
+
const product = (_b = data === null || data === void 0 ? void 0 : data.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
|
36
|
+
const cta = (_d = (_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct) === null || _d === void 0 ? void 0 : _d.bindCta;
|
37
|
+
if (product && cta) {
|
38
|
+
productView(data, product, cta, curTimeRef.current, popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index);
|
39
|
+
}
|
40
|
+
setTimeout(() => {
|
41
|
+
window === null || window === void 0 ? void 0 : window.sxpPopup('');
|
42
|
+
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(null);
|
43
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
44
|
+
};
|
45
|
+
const renderPopupDetail = useMemo(() => {
|
46
|
+
var _a, _b, _c;
|
47
|
+
return (_c = (_b = (_a = schema === null || schema === void 0 ? void 0 : schema.sxpPageConf) === null || _a === void 0 ? void 0 : _a.globalConfig) === null || _b === void 0 ? void 0 : _b.popupList) === null || _c === void 0 ? void 0 : _c.map((value, index) => {
|
48
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
49
|
+
if ((value === null || value === void 0 ? void 0 : value.id) === (popup === null || popup === void 0 ? void 0 : popup.id)) {
|
50
|
+
const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
|
51
|
+
const Component = withBindDataSource(t);
|
52
|
+
const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
|
53
|
+
return (React.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_c = value === null || value === void 0 ? void 0 : value.item) === null || _c === void 0 ? void 0 : _c.style), { width: '100%', height: '80vh', overflow: 'auto' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_d = value === null || value === void 0 ? void 0 : value.item) === null || _d === void 0 ? void 0 : _d.textStyle), bindDatas: (_f = (_e = value === null || value === void 0 ? void 0 : value.item) === null || _e === void 0 ? void 0 : _e.bindDatas) !== null && _f !== void 0 ? _f : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.props, { event: ((_h = value === null || value === void 0 ? void 0 : value.item) === null || _h === void 0 ? void 0 : _h.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id })));
|
54
|
+
}
|
55
|
+
else {
|
56
|
+
return React.createElement(React.Fragment, null);
|
57
|
+
}
|
58
|
+
});
|
59
|
+
}, [schema, popup, resolver]);
|
60
|
+
return (React.createElement(Modal, { popup: visible, onClose: handleClose, padding: 0, modalStyle: { position: 'fixed' } }, renderPopupDetail));
|
61
|
+
};
|
62
|
+
export default Popup;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import './index.less';
|
3
|
+
import { RecItemType } from './typing';
|
4
|
+
interface IRenderCardProps {
|
5
|
+
index: number;
|
6
|
+
rec: RecItemType;
|
7
|
+
tempMap?: Record<string, any>;
|
8
|
+
resolver: any;
|
9
|
+
}
|
10
|
+
declare const _default: React.NamedExoticComponent<IRenderCardProps>;
|
11
|
+
export default _default;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import React, { memo, useMemo } from 'react';
|
2
|
+
import './index.less';
|
3
|
+
import withBindDataSource from '../../../core/hoc/withBindDataSource';
|
4
|
+
import { useEditor } from '../../../core/hooks';
|
5
|
+
const RenderCard = ({ rec, index, tempMap, resolver }) => {
|
6
|
+
const { schema } = useEditor();
|
7
|
+
const renderComp = useMemo(() => {
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
|
9
|
+
if (!(rec === null || rec === void 0 ? void 0 : rec.video))
|
10
|
+
return null;
|
11
|
+
let cta = null;
|
12
|
+
if ((_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) {
|
13
|
+
cta = '多商品CTA';
|
14
|
+
}
|
15
|
+
else if ((_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProduct) {
|
16
|
+
cta = '商品CTA';
|
17
|
+
}
|
18
|
+
else {
|
19
|
+
cta = (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.bindCta) === null || _e === void 0 ? void 0 : _e.itemId;
|
20
|
+
}
|
21
|
+
const value = tempMap === null || tempMap === void 0 ? void 0 : tempMap[cta];
|
22
|
+
if ((((_f = value === null || value === void 0 ? void 0 : value.item) === null || _f === void 0 ? void 0 : _f.type) === 'CommodityDiro' && !((_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.bindProduct)) ||
|
23
|
+
(((_h = value === null || value === void 0 ? void 0 : value.item) === null || _h === void 0 ? void 0 : _h.type) === 'Commodity' && !((_j = rec === null || rec === void 0 ? void 0 : rec.video) === null || _j === void 0 ? void 0 : _j.bindProduct)) ||
|
24
|
+
(((_k = value === null || value === void 0 ? void 0 : value.item) === null || _k === void 0 ? void 0 : _k.type) === 'CommodityDiroNew' && !((_l = rec === null || rec === void 0 ? void 0 : rec.video) === null || _l === void 0 ? void 0 : _l.bindProduct)) ||
|
25
|
+
(((_m = value === null || value === void 0 ? void 0 : value.item) === null || _m === void 0 ? void 0 : _m.type) === 'MultiCommodity' && !((_p = (_o = rec === null || rec === void 0 ? void 0 : rec.video) === null || _o === void 0 ? void 0 : _o.bindProducts) === null || _p === void 0 ? void 0 : _p.length)) ||
|
26
|
+
(((_q = value === null || value === void 0 ? void 0 : value.item) === null || _q === void 0 ? void 0 : _q.type) === 'MultiCommodityDiro' && !((_s = (_r = rec === null || rec === void 0 ? void 0 : rec.video) === null || _r === void 0 ? void 0 : _r.bindProducts) === null || _s === void 0 ? void 0 : _s.length)) ||
|
27
|
+
(((_t = value === null || value === void 0 ? void 0 : value.item) === null || _t === void 0 ? void 0 : _t.type) === 'MultiCommodityDiroNew' && !((_v = (_u = rec === null || rec === void 0 ? void 0 : rec.video) === null || _u === void 0 ? void 0 : _u.bindProducts) === null || _v === void 0 ? void 0 : _v.length))) {
|
28
|
+
return null;
|
29
|
+
}
|
30
|
+
if (value && resolver) {
|
31
|
+
const t = resolver[(_w = value === null || value === void 0 ? void 0 : value.item) === null || _w === void 0 ? void 0 : _w.type];
|
32
|
+
const Component = withBindDataSource(t);
|
33
|
+
const defaulSetting = (_x = t === null || t === void 0 ? void 0 : t.extend) === null || _x === void 0 ? void 0 : _x.defaulSetting;
|
34
|
+
const isExternalLink = ((_0 = (_z = (_y = value === null || value === void 0 ? void 0 : value.item) === null || _y === void 0 ? void 0 : _y.event) === null || _z === void 0 ? void 0 : _z.onClick) === null || _0 === void 0 ? void 0 : _0.linkType) === 'externalLink';
|
35
|
+
return (React.createElement(Component, Object.assign({ style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_1 = value === null || value === void 0 ? void 0 : value.item) === null || _1 === void 0 ? void 0 : _1.style), { zIndex: 50, marginLeft: '20px', boxSizing: 'border-box' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_2 = value === null || value === void 0 ? void 0 : value.item) === null || _2 === void 0 ? void 0 : _2.textStyle), bindDatas: (_4 = (_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.bindDatas) !== null && _4 !== void 0 ? _4 : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_5 = value === null || value === void 0 ? void 0 : value.item) === null || _5 === void 0 ? void 0 : _5.props, { event: ((_6 = value === null || value === void 0 ? void 0 : value.item) === null || _6 === void 0 ? void 0 : _6.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, key: value === null || value === void 0 ? void 0 : value.id, recData: rec, isExternalLink: isExternalLink, index: index })));
|
36
|
+
}
|
37
|
+
else {
|
38
|
+
return null;
|
39
|
+
}
|
40
|
+
}, [rec, resolver, tempMap, schema]);
|
41
|
+
return React.createElement(React.Fragment, null, renderComp);
|
42
|
+
};
|
43
|
+
export default memo(RenderCard);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
2
|
+
interface IToggleButtonProps {
|
3
|
+
activeIcon?: string;
|
4
|
+
unactiveIcon?: string;
|
5
|
+
onChange?: (result: boolean) => void;
|
6
|
+
defaultValue?: boolean;
|
7
|
+
style?: CSSProperties;
|
8
|
+
}
|
9
|
+
declare const _default: React.NamedExoticComponent<IToggleButtonProps>;
|
10
|
+
export default _default;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React, { memo, useState } from 'react';
|
2
|
+
const ToggleButton = ({ defaultValue, activeIcon, unactiveIcon, onChange, style }) => {
|
3
|
+
const [isTrue, setIsTure] = useState(defaultValue);
|
4
|
+
const handleClick = (e) => {
|
5
|
+
e.stopPropagation();
|
6
|
+
const result = !isTrue;
|
7
|
+
setIsTure(result);
|
8
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(result);
|
9
|
+
};
|
10
|
+
return (React.createElement("button", { style: style, className: 'pb-toggle-button', onClick: handleClick },
|
11
|
+
React.createElement("img", { className: 'pb-toggle-button-icon', src: isTrue ? activeIcon : unactiveIcon })));
|
12
|
+
};
|
13
|
+
export default memo(ToggleButton);
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { RecItemType } from '../typing';
|
3
|
+
interface IVideoWidgetProps {
|
4
|
+
rec: RecItemType;
|
5
|
+
index: number;
|
6
|
+
height: number;
|
7
|
+
data: RecItemType[];
|
8
|
+
muted: boolean;
|
9
|
+
activeIndex?: number;
|
10
|
+
}
|
11
|
+
declare const _default: React.NamedExoticComponent<IVideoWidgetProps>;
|
12
|
+
export default _default;
|
@@ -0,0 +1,219 @@
|
|
1
|
+
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
2
|
+
import { useSwiperSlide } from 'swiper/react';
|
3
|
+
import { useIconLink } from '../useIconLink';
|
4
|
+
import { useSxpDataSource } from '../../../../core/hooks';
|
5
|
+
import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../../../../core/utils/event';
|
6
|
+
const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
|
7
|
+
const [isPauseVideo, setIsPauseVideo] = useState(false);
|
8
|
+
const videoRef = useRef(null);
|
9
|
+
const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
|
10
|
+
const videoStartTime = useRef(0);
|
11
|
+
const [isLoad, setIsLoad] = useState(false);
|
12
|
+
const { isActive } = useSwiperSlide();
|
13
|
+
useEffect(() => {
|
14
|
+
if (!videoRef.current)
|
15
|
+
return;
|
16
|
+
videoRef.current.muted = muted;
|
17
|
+
}, [muted]);
|
18
|
+
const handleVideoStart = useCallback(() => {
|
19
|
+
var _a;
|
20
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
21
|
+
}, []);
|
22
|
+
const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
|
23
|
+
const handlePlaying = useCallback(() => {
|
24
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
25
|
+
setIsPauseVideo(false);
|
26
|
+
const item = data[index];
|
27
|
+
if (item && isLoad && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
|
28
|
+
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
|
29
|
+
const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
30
|
+
const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
31
|
+
const playType = '1';
|
32
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
33
|
+
eventInfo: {
|
34
|
+
eventSubject: 'playVideo',
|
35
|
+
eventDescription: 'User played the video',
|
36
|
+
contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
37
|
+
contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
|
38
|
+
playType,
|
39
|
+
startTime: videoCurrentTime,
|
40
|
+
videoDuration,
|
41
|
+
contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
|
42
|
+
position: index + '',
|
43
|
+
contentFormat: 'video',
|
44
|
+
traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
45
|
+
}
|
46
|
+
});
|
47
|
+
}
|
48
|
+
if (!isLoad) {
|
49
|
+
setIsLoad(true);
|
50
|
+
}
|
51
|
+
}, [bffEventReport, data, index, isLoad]);
|
52
|
+
const handleLoadedMetadata = useCallback(() => {
|
53
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
54
|
+
const item = data[index];
|
55
|
+
if (item && !isLoad && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
|
56
|
+
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
|
57
|
+
const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
58
|
+
const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
59
|
+
const playType = '0';
|
60
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
61
|
+
eventInfo: {
|
62
|
+
eventSubject: 'playVideo',
|
63
|
+
eventDescription: 'User played the video',
|
64
|
+
contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
65
|
+
contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
|
66
|
+
playType,
|
67
|
+
startTime: videoCurrentTime,
|
68
|
+
videoDuration,
|
69
|
+
contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
|
70
|
+
position: index + '',
|
71
|
+
contentFormat: 'video',
|
72
|
+
traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
73
|
+
}
|
74
|
+
});
|
75
|
+
}
|
76
|
+
setTimeout(() => {
|
77
|
+
var _a;
|
78
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
79
|
+
}, 0);
|
80
|
+
}, [index, bffEventReport, data, isLoad]);
|
81
|
+
const handleClickVideo = useCallback((type) => () => {
|
82
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
83
|
+
if (!isLoad)
|
84
|
+
return;
|
85
|
+
const item = data[index];
|
86
|
+
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
87
|
+
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
88
|
+
const isPause = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.paused;
|
89
|
+
switch (type) {
|
90
|
+
case 'start':
|
91
|
+
if (!isPause)
|
92
|
+
return;
|
93
|
+
(_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.play();
|
94
|
+
setIsPauseVideo(false);
|
95
|
+
break;
|
96
|
+
case 'pause':
|
97
|
+
if (isPause)
|
98
|
+
return;
|
99
|
+
(_g = videoRef.current) === null || _g === void 0 ? void 0 : _g.pause();
|
100
|
+
setIsPauseVideo(true);
|
101
|
+
break;
|
102
|
+
default:
|
103
|
+
if (isPause) {
|
104
|
+
(_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.play();
|
105
|
+
}
|
106
|
+
else {
|
107
|
+
(_j = videoRef.current) === null || _j === void 0 ? void 0 : _j.pause();
|
108
|
+
}
|
109
|
+
setIsPauseVideo(!isPause);
|
110
|
+
break;
|
111
|
+
}
|
112
|
+
}, [data, index, isLoad]);
|
113
|
+
const onPause = useCallback(() => {
|
114
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
115
|
+
const item = data[index];
|
116
|
+
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
117
|
+
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
118
|
+
if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
|
119
|
+
const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
|
120
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
121
|
+
eventInfo: {
|
122
|
+
eventSubject: 'playOverVideo',
|
123
|
+
eventDescription: 'User finished playing the video',
|
124
|
+
contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
125
|
+
contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
|
126
|
+
endTime: videoCurrentTime,
|
127
|
+
videoDuration,
|
128
|
+
playDuration,
|
129
|
+
contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
|
130
|
+
position: index + '',
|
131
|
+
contentFormat: 'video',
|
132
|
+
traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
133
|
+
}
|
134
|
+
});
|
135
|
+
}
|
136
|
+
}, [data, index, bffEventReport]);
|
137
|
+
useEffect(() => {
|
138
|
+
var _a, _b, _c;
|
139
|
+
if (data.length <= 0)
|
140
|
+
return;
|
141
|
+
if (!videoRef.current)
|
142
|
+
return;
|
143
|
+
setIsPauseVideo(false);
|
144
|
+
if (!isActive) {
|
145
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
|
146
|
+
return;
|
147
|
+
}
|
148
|
+
if (!videoRef.current.src) {
|
149
|
+
const videoSrc = rec.video.url;
|
150
|
+
videoRef.current.src = videoSrc;
|
151
|
+
videoRef.current.setAttribute('x5-playsinline', 'true');
|
152
|
+
videoRef.current.setAttribute('webkit-playsinline', 'true');
|
153
|
+
}
|
154
|
+
else {
|
155
|
+
videoRef.current.play();
|
156
|
+
}
|
157
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
|
158
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
|
159
|
+
return () => {
|
160
|
+
var _a, _b;
|
161
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', handleLoadedMetadata);
|
162
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('playing', handlePlaying);
|
163
|
+
};
|
164
|
+
}, [data, handleLoadedMetadata, handlePlaying, isActive, isLoad, rec.video]);
|
165
|
+
useEffect(() => {
|
166
|
+
var _a, _b, _c;
|
167
|
+
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
168
|
+
if (!isActive)
|
169
|
+
return;
|
170
|
+
if (!isPause && openHashtag) {
|
171
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
|
172
|
+
}
|
173
|
+
else if (!openHashtag) {
|
174
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
|
175
|
+
}
|
176
|
+
}, [openHashtag, isActive]);
|
177
|
+
useEffect(() => {
|
178
|
+
if (!isActive)
|
179
|
+
return;
|
180
|
+
const onShow = handleClickVideo('start');
|
181
|
+
const onHide = handleClickVideo('pause');
|
182
|
+
SXP_EVENT_BUS.on(SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
|
183
|
+
SXP_EVENT_BUS.on(SXP_EVENT_TYPE.PAGE_DID_HIDE, onHide);
|
184
|
+
return () => {
|
185
|
+
SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
|
186
|
+
SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE, onHide);
|
187
|
+
};
|
188
|
+
}, [handleClickVideo, isActive]);
|
189
|
+
const renderPoster = useMemo(() => {
|
190
|
+
if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image)) {
|
191
|
+
return null;
|
192
|
+
}
|
193
|
+
return (React.createElement("img", { hidden: isLoad, style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image }));
|
194
|
+
}, [isLoad, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
|
195
|
+
useEffect(() => {
|
196
|
+
const handleBeforeUnload = () => {
|
197
|
+
var _a, _b;
|
198
|
+
if (activeIndex === index && ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.src) && !isPauseVideo) {
|
199
|
+
handleClickVideo('pause')();
|
200
|
+
}
|
201
|
+
};
|
202
|
+
window.addEventListener('beforeunload', handleBeforeUnload);
|
203
|
+
return () => {
|
204
|
+
window.removeEventListener('beforeunload', handleBeforeUnload);
|
205
|
+
};
|
206
|
+
}, [activeIndex, index, rec, videoRef, handleClickVideo, isPauseVideo]);
|
207
|
+
if (!rec.video) {
|
208
|
+
return null;
|
209
|
+
}
|
210
|
+
return (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
|
211
|
+
position: 'relative',
|
212
|
+
width: '100%',
|
213
|
+
height
|
214
|
+
} },
|
215
|
+
React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, poster: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
|
216
|
+
renderPoster,
|
217
|
+
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })));
|
218
|
+
};
|
219
|
+
export default memo(VideoWidget);
|