pb-sxp-ui 1.0.0
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/LICENSE +21 -0
- package/README.md +111 -0
- package/dist/index.cjs +10752 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1782 -0
- package/dist/index.js +10721 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.cjs +9 -0
- package/dist/index.min.cjs.map +1 -0
- package/dist/index.min.js +9 -0
- package/dist/index.min.js.map +1 -0
- package/dist/pb-ui.js +10748 -0
- package/dist/pb-ui.js.map +1 -0
- package/dist/pb-ui.min.js +9 -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 +11 -0
- package/es/core/components/SxpPageCore/index.js +26 -0
- package/es/core/components/SxpPageRender/ExpandableText.d.ts +12 -0
- package/es/core/components/SxpPageRender/ExpandableText.js +54 -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 +11 -0
- package/es/core/components/SxpPageRender/Hashtag/index.js +40 -0
- package/es/core/components/SxpPageRender/LikeButton/index.d.ts +10 -0
- package/es/core/components/SxpPageRender/LikeButton/index.js +58 -0
- package/es/core/components/SxpPageRender/Modal/index.d.ts +9 -0
- package/es/core/components/SxpPageRender/Modal/index.js +44 -0
- package/es/core/components/SxpPageRender/Navbar.d.ts +8 -0
- package/es/core/components/SxpPageRender/Navbar.js +9 -0
- package/es/core/components/SxpPageRender/PictureGroup/Picture.d.ts +8 -0
- package/es/core/components/SxpPageRender/PictureGroup/Picture.js +19 -0
- package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +13 -0
- package/es/core/components/SxpPageRender/PictureGroup/index.js +27 -0
- package/es/core/components/SxpPageRender/Popup/index.d.ts +3 -0
- package/es/core/components/SxpPageRender/Popup/index.js +60 -0
- package/es/core/components/SxpPageRender/ProductInfo/index.d.ts +14 -0
- package/es/core/components/SxpPageRender/ProductInfo/index.js +55 -0
- package/es/core/components/SxpPageRender/RenderCard.d.ts +11 -0
- package/es/core/components/SxpPageRender/RenderCard.js +40 -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 +3 -0
- package/es/core/components/SxpPageRender/WaterFall/List.js +173 -0
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.d.ts +3 -0
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +317 -0
- package/es/core/components/SxpPageRender/WaterFall/index.d.ts +6 -0
- package/es/core/components/SxpPageRender/WaterFall/index.js +100 -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 +35 -0
- package/es/core/components/SxpPageRender/index.js +345 -0
- package/es/core/components/SxpPageRender/typing.d.ts +65 -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 +8 -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 +76 -0
- package/es/core/context/EditorContext.js +142 -0
- package/es/core/context/EditorDataProvider.d.ts +18 -0
- package/es/core/context/EditorDataProvider.js +20 -0
- package/es/core/context/SxpDataSourceProvider.d.ts +90 -0
- package/es/core/context/SxpDataSourceProvider.js +204 -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 +3 -0
- package/es/core/utils/localStore.js +14 -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 +10 -0
- package/es/index.js +12 -0
- package/es/materials/index.d.ts +1 -0
- package/es/materials/index.js +1 -0
- package/es/materials/sxp/index.d.ts +2 -0
- package/es/materials/sxp/index.js +2 -0
- package/es/materials/sxp/popup/AppointForm/index.d.ts +18 -0
- package/es/materials/sxp/popup/AppointForm/index.js +77 -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 +36 -0
- package/es/materials/sxp/popup/AppointForm/settingRender.d.ts +65 -0
- package/es/materials/sxp/popup/AppointForm/settingRender.js +90 -0
- package/es/materials/sxp/popup/CommodityDetail/index.d.ts +14 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +85 -0
- package/es/materials/sxp/popup/CommodityDetail/material.d.ts +2 -0
- package/es/materials/sxp/popup/CommodityDetail/material.js +16 -0
- package/es/materials/sxp/popup/CommodityDetailDiro/index.d.ts +18 -0
- package/es/materials/sxp/popup/CommodityDetailDiro/index.js +162 -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 +22 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +129 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/material.d.ts +2 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/material.js +16 -0
- package/es/materials/sxp/popup/Prompt/index.d.ts +11 -0
- package/es/materials/sxp/popup/Prompt/index.js +22 -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 +5 -0
- package/es/materials/sxp/popup/index.js +5 -0
- package/es/materials/sxp/template/Appoint/index.d.ts +11 -0
- package/es/materials/sxp/template/Appoint/index.js +30 -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 +29 -0
- package/es/materials/sxp/template/Commodity/index.d.ts +11 -0
- package/es/materials/sxp/template/Commodity/index.js +44 -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 +26 -0
- package/es/materials/sxp/template/CommodityDiro/index.d.ts +11 -0
- package/es/materials/sxp/template/CommodityDiro/index.js +46 -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 +26 -0
- package/es/materials/sxp/template/CommodityDiroNew/index.d.ts +11 -0
- package/es/materials/sxp/template/CommodityDiroNew/index.js +46 -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 +26 -0
- package/es/materials/sxp/template/Link/index.d.ts +11 -0
- package/es/materials/sxp/template/Link/index.js +41 -0
- package/es/materials/sxp/template/Link/material.d.ts +2 -0
- package/es/materials/sxp/template/Link/material.js +26 -0
- package/es/materials/sxp/template/MultiCommodity/index.d.ts +12 -0
- package/es/materials/sxp/template/MultiCommodity/index.js +58 -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 +26 -0
- package/es/materials/sxp/template/MultiCommodityDiro/index.d.ts +12 -0
- package/es/materials/sxp/template/MultiCommodityDiro/index.js +60 -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 +26 -0
- package/es/materials/sxp/template/MultiCommodityDiroNew/index.d.ts +12 -0
- package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +59 -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 +26 -0
- package/es/materials/sxp/template/components/EventProvider.d.ts +10 -0
- package/es/materials/sxp/template/components/EventProvider.js +33 -0
- package/es/materials/sxp/template/components/Img.d.ts +9 -0
- package/es/materials/sxp/template/components/Img.js +19 -0
- package/es/materials/sxp/template/components/Scroll.d.ts +9 -0
- package/es/materials/sxp/template/components/Scroll.js +10 -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 +11 -0
- package/lib/core/components/SxpPageCore/index.js +29 -0
- package/lib/core/components/SxpPageRender/ExpandableText.d.ts +12 -0
- package/lib/core/components/SxpPageRender/ExpandableText.js +57 -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 +11 -0
- package/lib/core/components/SxpPageRender/Hashtag/index.js +43 -0
- package/lib/core/components/SxpPageRender/LikeButton/index.d.ts +10 -0
- package/lib/core/components/SxpPageRender/LikeButton/index.js +60 -0
- package/lib/core/components/SxpPageRender/Modal/index.d.ts +9 -0
- package/lib/core/components/SxpPageRender/Modal/index.js +47 -0
- package/lib/core/components/SxpPageRender/Navbar.d.ts +8 -0
- package/lib/core/components/SxpPageRender/Navbar.js +12 -0
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.d.ts +8 -0
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.js +22 -0
- package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +13 -0
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +30 -0
- package/lib/core/components/SxpPageRender/Popup/index.d.ts +3 -0
- package/lib/core/components/SxpPageRender/Popup/index.js +63 -0
- package/lib/core/components/SxpPageRender/ProductInfo/index.d.ts +14 -0
- package/lib/core/components/SxpPageRender/ProductInfo/index.js +58 -0
- package/lib/core/components/SxpPageRender/RenderCard.d.ts +11 -0
- package/lib/core/components/SxpPageRender/RenderCard.js +43 -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 +3 -0
- package/lib/core/components/SxpPageRender/WaterFall/List.js +177 -0
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.d.ts +3 -0
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +321 -0
- package/lib/core/components/SxpPageRender/WaterFall/index.d.ts +6 -0
- package/lib/core/components/SxpPageRender/WaterFall/index.js +103 -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 +35 -0
- package/lib/core/components/SxpPageRender/index.js +348 -0
- package/lib/core/components/SxpPageRender/typing.d.ts +65 -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 +12 -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 +76 -0
- package/lib/core/context/EditorContext.js +146 -0
- package/lib/core/context/EditorDataProvider.d.ts +18 -0
- package/lib/core/context/EditorDataProvider.js +25 -0
- package/lib/core/context/SxpDataSourceProvider.d.ts +90 -0
- package/lib/core/context/SxpDataSourceProvider.js +207 -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 +3 -0
- package/lib/core/utils/localStore.js +19 -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 +10 -0
- package/lib/index.js +20 -0
- package/lib/materials/index.d.ts +1 -0
- package/lib/materials/index.js +4 -0
- package/lib/materials/sxp/index.d.ts +2 -0
- package/lib/materials/sxp/index.js +5 -0
- package/lib/materials/sxp/popup/AppointForm/index.d.ts +18 -0
- package/lib/materials/sxp/popup/AppointForm/index.js +79 -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 +40 -0
- package/lib/materials/sxp/popup/AppointForm/settingRender.d.ts +65 -0
- package/lib/materials/sxp/popup/AppointForm/settingRender.js +92 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +14 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.js +87 -0
- package/lib/materials/sxp/popup/CommodityDetail/material.d.ts +2 -0
- package/lib/materials/sxp/popup/CommodityDetail/material.js +20 -0
- package/lib/materials/sxp/popup/CommodityDetailDiro/index.d.ts +18 -0
- package/lib/materials/sxp/popup/CommodityDetailDiro/index.js +164 -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 +22 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +131 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/material.d.ts +2 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/material.js +20 -0
- package/lib/materials/sxp/popup/Prompt/index.d.ts +11 -0
- package/lib/materials/sxp/popup/Prompt/index.js +24 -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 +5 -0
- package/lib/materials/sxp/popup/index.js +8 -0
- package/lib/materials/sxp/template/Appoint/index.d.ts +11 -0
- package/lib/materials/sxp/template/Appoint/index.js +32 -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 +33 -0
- package/lib/materials/sxp/template/Commodity/index.d.ts +11 -0
- package/lib/materials/sxp/template/Commodity/index.js +46 -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 +30 -0
- package/lib/materials/sxp/template/CommodityDiro/index.d.ts +11 -0
- package/lib/materials/sxp/template/CommodityDiro/index.js +48 -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 +30 -0
- package/lib/materials/sxp/template/CommodityDiroNew/index.d.ts +11 -0
- package/lib/materials/sxp/template/CommodityDiroNew/index.js +48 -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 +30 -0
- package/lib/materials/sxp/template/Link/index.d.ts +11 -0
- package/lib/materials/sxp/template/Link/index.js +43 -0
- package/lib/materials/sxp/template/Link/material.d.ts +2 -0
- package/lib/materials/sxp/template/Link/material.js +30 -0
- package/lib/materials/sxp/template/MultiCommodity/index.d.ts +12 -0
- package/lib/materials/sxp/template/MultiCommodity/index.js +60 -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 +30 -0
- package/lib/materials/sxp/template/MultiCommodityDiro/index.d.ts +12 -0
- package/lib/materials/sxp/template/MultiCommodityDiro/index.js +62 -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 +30 -0
- package/lib/materials/sxp/template/MultiCommodityDiroNew/index.d.ts +12 -0
- package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +61 -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 +30 -0
- package/lib/materials/sxp/template/components/EventProvider.d.ts +10 -0
- package/lib/materials/sxp/template/components/EventProvider.js +35 -0
- package/lib/materials/sxp/template/components/Img.d.ts +9 -0
- package/lib/materials/sxp/template/components/Img.js +22 -0
- package/lib/materials/sxp/template/components/Scroll.d.ts +9 -0
- package/lib/materials/sxp/template/components/Scroll.js +13 -0
- package/lib/materials/sxp/template/index.d.ts +8 -0
- package/lib/materials/sxp/template/index.js +11 -0
- package/package.json +113 -0
@@ -0,0 +1,142 @@
|
|
1
|
+
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useState, useMemo } from 'react';
|
2
|
+
import { cloneDeep } from 'lodash';
|
3
|
+
import DataSourceProvider from './DataSourceProvider';
|
4
|
+
import { uuid } from '../../core/utils/tool';
|
5
|
+
const item = {
|
6
|
+
id: uuid(6, 10),
|
7
|
+
item: {
|
8
|
+
type: 'common',
|
9
|
+
h: 300,
|
10
|
+
category: 'block',
|
11
|
+
displayName: 'block',
|
12
|
+
isFirstLayout: true,
|
13
|
+
w: 1000
|
14
|
+
},
|
15
|
+
point: {
|
16
|
+
i: 'x-0',
|
17
|
+
x: -38.34375,
|
18
|
+
y: 0,
|
19
|
+
w: 1000,
|
20
|
+
h: 300,
|
21
|
+
isBounded: true,
|
22
|
+
actualX: 0,
|
23
|
+
actualY: 0
|
24
|
+
},
|
25
|
+
pathArr: [0],
|
26
|
+
positionY: 0
|
27
|
+
};
|
28
|
+
export const EditorContext = React.createContext({
|
29
|
+
resolver: {},
|
30
|
+
currentNode: null,
|
31
|
+
schema: {
|
32
|
+
pointData: [],
|
33
|
+
dataSource: [],
|
34
|
+
mobilePiontData: [],
|
35
|
+
type: 'PC',
|
36
|
+
pcPiontData: [],
|
37
|
+
pageInfo: {},
|
38
|
+
pcPageConf: {},
|
39
|
+
mobilePageConf: {},
|
40
|
+
__STORE__: {},
|
41
|
+
sxpPageConf: {}
|
42
|
+
},
|
43
|
+
pageInfoData: {},
|
44
|
+
prePiontData: [],
|
45
|
+
undoStack: [item],
|
46
|
+
redoStack: [],
|
47
|
+
popup: '',
|
48
|
+
setPopup: () => { }
|
49
|
+
});
|
50
|
+
const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSource = true, utmVal }, ref) => {
|
51
|
+
const [currentNode, setCurrentNode] = useState(null);
|
52
|
+
const [_schema, setSchema] = useState(schema || {
|
53
|
+
pointData: [item],
|
54
|
+
dataSource: [],
|
55
|
+
mobilePiontData: [],
|
56
|
+
type: 'PC',
|
57
|
+
pcPiontData: [],
|
58
|
+
pageInfo: {},
|
59
|
+
pcPageConf: {},
|
60
|
+
mobilePageConf: {},
|
61
|
+
sxpPageConf: {}
|
62
|
+
});
|
63
|
+
const [prePiontData, setPrePiontData] = useState([item]);
|
64
|
+
const [undoStack, setUndoStack] = useState([[item]]);
|
65
|
+
const [redoStack, setRedoStack] = useState([]);
|
66
|
+
const [popup, setPopup] = useState('');
|
67
|
+
typeof window !== 'undefined' &&
|
68
|
+
(window.sxpPopup = (type) => {
|
69
|
+
setPopup(type);
|
70
|
+
});
|
71
|
+
typeof window !== 'undefined' &&
|
72
|
+
(window.getJointUtmLink = (url) => {
|
73
|
+
if ((url === null || url === void 0 ? void 0 : url.indexOf('?')) !== -1) {
|
74
|
+
return url + (utmVal ? '&' + utmVal : '');
|
75
|
+
}
|
76
|
+
else {
|
77
|
+
return url + (utmVal ? '?' + utmVal : '');
|
78
|
+
}
|
79
|
+
});
|
80
|
+
useEffect(() => {
|
81
|
+
setUndoStack([_schema.pointData]);
|
82
|
+
setRedoStack([]);
|
83
|
+
}, [_schema.type]);
|
84
|
+
const saveDataSource = useCallback((dataSource) => {
|
85
|
+
const schema = cloneDeep(_schema);
|
86
|
+
if (!schema)
|
87
|
+
return;
|
88
|
+
schema.dataSource = dataSource;
|
89
|
+
setSchema === null || setSchema === void 0 ? void 0 : setSchema(schema);
|
90
|
+
}, [_schema]);
|
91
|
+
const [_pageInfoData, _setPageInfoData] = useState();
|
92
|
+
useImperativeHandle(ref, () => ({
|
93
|
+
loadSchema(schema) {
|
94
|
+
if (schema) {
|
95
|
+
setUndoStack([schema.pointData]);
|
96
|
+
setSchema(schema);
|
97
|
+
}
|
98
|
+
},
|
99
|
+
exportSchema() {
|
100
|
+
return cloneDeep(_schema);
|
101
|
+
},
|
102
|
+
getPageInfoData() {
|
103
|
+
return _pageInfoData;
|
104
|
+
},
|
105
|
+
initPageInfoData(pageData) {
|
106
|
+
if (pageData) {
|
107
|
+
_setPageInfoData(pageData);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}));
|
111
|
+
const getCurPageConf = useMemo(() => {
|
112
|
+
if (!_schema)
|
113
|
+
return;
|
114
|
+
if (_schema.type === 'PC') {
|
115
|
+
return _schema.pcPageConf;
|
116
|
+
}
|
117
|
+
else {
|
118
|
+
return _schema.mobilePageConf;
|
119
|
+
}
|
120
|
+
}, [_schema]);
|
121
|
+
return (React.createElement(EditorContext.Provider, { value: {
|
122
|
+
resolver,
|
123
|
+
currentNode,
|
124
|
+
schema: _schema,
|
125
|
+
setCurrentNode,
|
126
|
+
setSchema,
|
127
|
+
saveDataSource,
|
128
|
+
prePiontData,
|
129
|
+
setPrePiontData,
|
130
|
+
pageInfoData: _pageInfoData,
|
131
|
+
setPageInfoData: (params) => _setPageInfoData(Object.assign(Object.assign({}, _pageInfoData), params)),
|
132
|
+
undoStack,
|
133
|
+
redoStack,
|
134
|
+
setRedoStack,
|
135
|
+
setUndoStack,
|
136
|
+
getCurPageConf,
|
137
|
+
popup,
|
138
|
+
setPopup
|
139
|
+
} },
|
140
|
+
React.createElement(DataSourceProvider, { isSsr: isSsr, enable: enableDataSource }, children)));
|
141
|
+
});
|
142
|
+
export { EditorCore };
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
2
|
+
interface IEditorDataContext {
|
3
|
+
sxpPrameter?: {
|
4
|
+
bottomImage: string;
|
5
|
+
defaultRecommend: number;
|
6
|
+
personalizedRecommend: number;
|
7
|
+
placeholderImage: string;
|
8
|
+
hashTagSize: number;
|
9
|
+
loadingImage: string;
|
10
|
+
};
|
11
|
+
appDomain?: string;
|
12
|
+
}
|
13
|
+
interface IEditorProviderProps {
|
14
|
+
data?: any;
|
15
|
+
}
|
16
|
+
declare const EditorDataProvider: FC<PropsWithChildren<IEditorProviderProps>>;
|
17
|
+
export declare function useEditorDataProvider(): IEditorDataContext;
|
18
|
+
export default EditorDataProvider;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import React, { createContext, useContext } from 'react';
|
2
|
+
const EditorDataContext = createContext({});
|
3
|
+
const EditorDataProvider = ({ children, data }) => {
|
4
|
+
var _a, _b, _c, _d, _e, _f;
|
5
|
+
return (React.createElement(EditorDataContext.Provider, { value: {
|
6
|
+
sxpPrameter: {
|
7
|
+
bottomImage: (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.bottom_image,
|
8
|
+
defaultRecommend: (_b = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _b === void 0 ? void 0 : _b.default_recommend,
|
9
|
+
personalizedRecommend: (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.personalized_recommend,
|
10
|
+
placeholderImage: (_d = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _d === void 0 ? void 0 : _d.placeholder_image,
|
11
|
+
hashTagSize: (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size,
|
12
|
+
loadingImage: (_f = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _f === void 0 ? void 0 : _f.loading_image
|
13
|
+
},
|
14
|
+
appDomain: data === null || data === void 0 ? void 0 : data.appDomain
|
15
|
+
} }, children));
|
16
|
+
};
|
17
|
+
export function useEditorDataProvider() {
|
18
|
+
return useContext(EditorDataContext);
|
19
|
+
}
|
20
|
+
export default EditorDataProvider;
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import React, { ReactNode } from 'react';
|
2
|
+
import { DataSource, PageData } from '../Pagebuilder/type';
|
3
|
+
import { ProductInfoType, RecItemType, RecommendVideoResultType, VideoInfoType } from '../components/SxpPageRender/typing';
|
4
|
+
export interface IWaterFallDataType {
|
5
|
+
hashTag: string;
|
6
|
+
itemId?: string;
|
7
|
+
itemType?: 'VIDEO' | 'PRODUCT' | null;
|
8
|
+
rec: RecItemType;
|
9
|
+
}
|
10
|
+
export interface ISxpDataSourceContext {
|
11
|
+
rtcList: RecItemType[];
|
12
|
+
setRtcList?: React.Dispatch<React.SetStateAction<RecItemType[]>>;
|
13
|
+
submitForm?: (body: {
|
14
|
+
attributes: Array<{
|
15
|
+
name: string;
|
16
|
+
value: string;
|
17
|
+
}>;
|
18
|
+
}) => Promise<boolean | undefined>;
|
19
|
+
mutateUnlike?: (body: {
|
20
|
+
videoItemId: string;
|
21
|
+
}) => Promise<boolean>;
|
22
|
+
mutateLike?: (body: {
|
23
|
+
content: string;
|
24
|
+
}) => Promise<boolean>;
|
25
|
+
popupDetailData?: RecItemType;
|
26
|
+
setPopupDetailData?: React.Dispatch<React.SetStateAction<any | null>>;
|
27
|
+
loadVideos?: (page: number) => Promise<void>;
|
28
|
+
getRecommendVideos?: (query?: {
|
29
|
+
maxSize?: number;
|
30
|
+
defaultSize?: number;
|
31
|
+
channel?: string;
|
32
|
+
hashTag?: string;
|
33
|
+
'itemFilter.itemId'?: string;
|
34
|
+
'itemFilter.itemType'?: 'VIDEO' | 'PRODUCT' | null | undefined;
|
35
|
+
traceInfo?: string;
|
36
|
+
}) => Promise<RecommendVideoResultType | undefined>;
|
37
|
+
utmVal?: string;
|
38
|
+
bffEventReport?: (body: {
|
39
|
+
userInfo?: object;
|
40
|
+
eventInfo: object;
|
41
|
+
}) => Promise<any> | undefined | boolean;
|
42
|
+
isPreview?: boolean;
|
43
|
+
loading?: boolean;
|
44
|
+
sxpParameter?: PageData['sxp_parameter'];
|
45
|
+
waterFallData?: IWaterFallDataType;
|
46
|
+
setWaterFallData?: React.Dispatch<React.SetStateAction<IWaterFallDataType | undefined>>;
|
47
|
+
ctaEvent?: (eventInfo: any, rec?: RecItemType, product?: ProductInfoType | VideoInfoType | null) => void;
|
48
|
+
swiperRef?: any;
|
49
|
+
openHashtag?: boolean;
|
50
|
+
setOpenHashtag?: React.Dispatch<React.SetStateAction<boolean>>;
|
51
|
+
cacheRtcList?: RecItemType[];
|
52
|
+
setCacheRtcList?: React.Dispatch<React.SetStateAction<RecItemType[]>>;
|
53
|
+
cacheActiveIndex?: number;
|
54
|
+
setCacheActiveIndex?: React.Dispatch<React.SetStateAction<number>>;
|
55
|
+
isFromHashtag?: boolean;
|
56
|
+
setIsFromHashtag?: React.Dispatch<React.SetStateAction<boolean>>;
|
57
|
+
appDomain?: string;
|
58
|
+
hashTagSize?: number;
|
59
|
+
loadingImage?: string;
|
60
|
+
}
|
61
|
+
export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
|
62
|
+
export interface SxpDataSourceProviderProps {
|
63
|
+
dataSources?: DataSource[];
|
64
|
+
render: (data: {
|
65
|
+
rtcList: RecItemType[];
|
66
|
+
submitForm: (body: {
|
67
|
+
attributes: Array<{
|
68
|
+
name: string;
|
69
|
+
value: string;
|
70
|
+
}>;
|
71
|
+
}) => Promise<boolean | undefined>;
|
72
|
+
mutateUnlike: (body: {
|
73
|
+
videoItemId: string;
|
74
|
+
}) => Promise<boolean>;
|
75
|
+
mutateLike: (body: {
|
76
|
+
content: string;
|
77
|
+
}) => Promise<boolean>;
|
78
|
+
}) => ReactNode;
|
79
|
+
utmVal?: string;
|
80
|
+
enableReportEvent?: boolean;
|
81
|
+
maxSize?: number;
|
82
|
+
defaultSize?: number;
|
83
|
+
hashTagSize?: number;
|
84
|
+
isPreview?: boolean;
|
85
|
+
sxpParameter?: PageData['sxp_parameter'];
|
86
|
+
appDomain?: string;
|
87
|
+
loadingImage?: string;
|
88
|
+
}
|
89
|
+
declare const _default: React.NamedExoticComponent<SxpDataSourceProviderProps>;
|
90
|
+
export default _default;
|
@@ -0,0 +1,204 @@
|
|
1
|
+
import { __awaiter } from "tslib";
|
2
|
+
import React, { createContext, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
3
|
+
import qs from 'qs';
|
4
|
+
import { storeAndLoadFeSessionId } from '../utils/sessionStore';
|
5
|
+
import { storeAndLoadFeUserId } from '../utils/localStore';
|
6
|
+
import { useIconLink } from '../components/SxpPageRender/useIconLink';
|
7
|
+
export const SxpDataSourceContext = createContext({
|
8
|
+
rtcList: []
|
9
|
+
});
|
10
|
+
var DataSourceType;
|
11
|
+
(function (DataSourceType) {
|
12
|
+
DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
|
13
|
+
})(DataSourceType || (DataSourceType = {}));
|
14
|
+
const UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_id', 'utm_content', 'cl_source'];
|
15
|
+
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage }) => {
|
16
|
+
const [rtcList, setRtcList] = useState([]);
|
17
|
+
const [loading, setLoading] = useState(false);
|
18
|
+
const [curReqInfo, setCurReqInfo] = useState({ rtc: '', requestId: '' });
|
19
|
+
const swiperRef = useRef(null);
|
20
|
+
const isInit = useRef(false);
|
21
|
+
const [popupDetailData, setPopupDetailData] = useState();
|
22
|
+
const [waterFallData, setWaterFallData] = useState();
|
23
|
+
const [openHashtag, setOpenHashtag] = useState(false);
|
24
|
+
const [cacheRtcList, setCacheRtcList] = useState([]);
|
25
|
+
const [cacheActiveIndex, setCacheActiveIndex] = useState(0);
|
26
|
+
const [isFromHashtag, setIsFromHashtag] = useState(false);
|
27
|
+
const bffDataSource = useMemo(() => {
|
28
|
+
return dataSources === null || dataSources === void 0 ? void 0 : dataSources.find((d) => d.type === DataSourceType.BFF);
|
29
|
+
}, [dataSources]);
|
30
|
+
const bffFetch = useCallback((path, options) => {
|
31
|
+
if (!bffDataSource)
|
32
|
+
return;
|
33
|
+
const url = bffDataSource.url;
|
34
|
+
const fakeUserId = storeAndLoadFeUserId();
|
35
|
+
if (options === null || options === void 0 ? void 0 : options.query) {
|
36
|
+
const queryString = qs.stringify(options.query);
|
37
|
+
path = `${path}?${queryString}`;
|
38
|
+
}
|
39
|
+
if (options.type === 'beacon' && navigator.sendBeacon) {
|
40
|
+
return navigator.sendBeacon(`${url}/api/v1${path}`, new Blob([
|
41
|
+
JSON.stringify(Object.assign(Object.assign(Object.assign({}, bffDataSource.headers), { 'x-user-id': fakeUserId }), options.body))
|
42
|
+
], { type: 'application/json;charset=UTF-8' }));
|
43
|
+
}
|
44
|
+
return window
|
45
|
+
.fetch(`${url}/api/v1${path}`, {
|
46
|
+
headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),
|
47
|
+
method: options.method,
|
48
|
+
body: JSON.stringify(options.body)
|
49
|
+
})
|
50
|
+
.then((res) => res.json())
|
51
|
+
.catch((err) => Promise.reject(err));
|
52
|
+
}, [bffDataSource]);
|
53
|
+
const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
54
|
+
var _a, _b, _c, _d;
|
55
|
+
query = {
|
56
|
+
maxSize,
|
57
|
+
defaultSize: (_a = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _a !== void 0 ? _a : defaultSize,
|
58
|
+
'itemFilter.itemId': query === null || query === void 0 ? void 0 : query['itemFilter.itemId'],
|
59
|
+
'itemFilter.itemType': query === null || query === void 0 ? void 0 : query['itemFilter.itemType'],
|
60
|
+
hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
|
61
|
+
traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo
|
62
|
+
};
|
63
|
+
if (utmVal) {
|
64
|
+
const val = (_d = (_c = (_b = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _b === void 0 ? void 0 : _b.filter((val) => {
|
65
|
+
const key = val.split('=')[0];
|
66
|
+
return UTM_KEYS.includes(key);
|
67
|
+
})) === null || _c === void 0 ? void 0 : _c.join('&')) !== null && _d !== void 0 ? _d : '';
|
68
|
+
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
69
|
+
}
|
70
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
71
|
+
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
72
|
+
return undefined;
|
73
|
+
}
|
74
|
+
if (!(query === null || query === void 0 ? void 0 : query.hashTag))
|
75
|
+
setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
|
76
|
+
return result === null || result === void 0 ? void 0 : result.data;
|
77
|
+
}), [bffFetch, utmVal, maxSize, defaultSize]);
|
78
|
+
const loadVideos = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
79
|
+
var _e, _f;
|
80
|
+
if (rtcList.length <= 0) {
|
81
|
+
return;
|
82
|
+
}
|
83
|
+
const data = yield getRecommendVideos({
|
84
|
+
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
|
85
|
+
'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
|
86
|
+
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
|
87
|
+
});
|
88
|
+
setRtcList(rtcList.concat((_e = data === null || data === void 0 ? void 0 : data.recList) !== null && _e !== void 0 ? _e : []));
|
89
|
+
setCacheRtcList(cacheRtcList.concat((_f = data === null || data === void 0 ? void 0 : data.recList) !== null && _f !== void 0 ? _f : []));
|
90
|
+
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
91
|
+
const bffEventReport = useCallback(({ userInfo, eventInfo }) => {
|
92
|
+
if (!enableReportEvent) {
|
93
|
+
return;
|
94
|
+
}
|
95
|
+
if (!userInfo) {
|
96
|
+
userInfo = {};
|
97
|
+
}
|
98
|
+
const sessionID = storeAndLoadFeSessionId();
|
99
|
+
const ef = Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, eventInfo);
|
100
|
+
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
101
|
+
const realEventInfo = Object.entries(ef)
|
102
|
+
.map(([k, v]) => v && { name: k, value: v })
|
103
|
+
.filter(Boolean);
|
104
|
+
console.log('======== 事件上报 ========');
|
105
|
+
console.log('userInfo:', userInfo);
|
106
|
+
console.log('eventInfo:', ef);
|
107
|
+
console.log('========= 结束 =========');
|
108
|
+
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/event/report', {
|
109
|
+
method: 'POST',
|
110
|
+
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
111
|
+
type: 'beacon'
|
112
|
+
});
|
113
|
+
}, [bffFetch, curReqInfo, enableReportEvent]);
|
114
|
+
const bffMutateLike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
115
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/like', { method: 'POST', body }));
|
116
|
+
return res === null || res === void 0 ? void 0 : res.success;
|
117
|
+
}), [bffFetch]);
|
118
|
+
const bffMutateUnlike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
119
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/unlike', { method: 'POST', body }));
|
120
|
+
return res === null || res === void 0 ? void 0 : res.success;
|
121
|
+
}), [bffFetch]);
|
122
|
+
const bffSubmitForm = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
123
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/customform', { method: 'POST', body }));
|
124
|
+
return res === null || res === void 0 ? void 0 : res.success;
|
125
|
+
}), [bffFetch]);
|
126
|
+
const ctaEvent = useCallback((eventInfo, rec, product) => {
|
127
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
128
|
+
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
129
|
+
const isProd = ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct) || (((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.bindProducts) && ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProducts) === null || _d === void 0 ? void 0 : _d.length) > 0);
|
130
|
+
let fromKName = '';
|
131
|
+
if (isFromHashtag) {
|
132
|
+
fromKName = 'hashTagPage';
|
133
|
+
}
|
134
|
+
else if ((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.url) {
|
135
|
+
fromKName = 'videoPage';
|
136
|
+
}
|
137
|
+
else if ((_g = (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.imgUrls) === null || _g === void 0 ? void 0 : _g.length) {
|
138
|
+
fromKName = 'imagePage';
|
139
|
+
}
|
140
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
141
|
+
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_h = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _h !== void 0 ? _h : '', ctaName: (_j = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _j !== void 0 ? _j : '', contentTags: JSON.stringify(cta === null || cta === void 0 ? void 0 : cta.tags), position: rec === null || rec === void 0 ? void 0 : rec.position, relatedContentId: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.itemId) !== null && _l !== void 0 ? _l : '', relatedProductId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_m = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _m !== void 0 ? _m : '', fromKName })
|
142
|
+
});
|
143
|
+
}, [bffEventReport, isFromHashtag]);
|
144
|
+
useEffect(() => {
|
145
|
+
setLoading(true);
|
146
|
+
getRecommendVideos()
|
147
|
+
.then((data) => {
|
148
|
+
var _a, _b;
|
149
|
+
setRtcList((_a = data === null || data === void 0 ? void 0 : data.recList) !== null && _a !== void 0 ? _a : []);
|
150
|
+
setCacheRtcList((_b = data === null || data === void 0 ? void 0 : data.recList) !== null && _b !== void 0 ? _b : []);
|
151
|
+
})
|
152
|
+
.finally(() => {
|
153
|
+
setLoading(false);
|
154
|
+
isInit.current = true;
|
155
|
+
});
|
156
|
+
}, []);
|
157
|
+
useEffect(() => {
|
158
|
+
if (!isInit.current)
|
159
|
+
return;
|
160
|
+
setLoading(true);
|
161
|
+
getRecommendVideos()
|
162
|
+
.then((data) => {
|
163
|
+
var _a, _b;
|
164
|
+
setRtcList((_a = data === null || data === void 0 ? void 0 : data.recList) !== null && _a !== void 0 ? _a : []);
|
165
|
+
setCacheRtcList((_b = data === null || data === void 0 ? void 0 : data.recList) !== null && _b !== void 0 ? _b : []);
|
166
|
+
})
|
167
|
+
.finally(() => {
|
168
|
+
setLoading(false);
|
169
|
+
});
|
170
|
+
}, [getRecommendVideos]);
|
171
|
+
const defaultLoadingImage = useIconLink('/pb_static/a65d23c5893c49d7aaaa81681d3179e2.gif');
|
172
|
+
return (React.createElement(SxpDataSourceContext.Provider, { value: {
|
173
|
+
rtcList,
|
174
|
+
setRtcList,
|
175
|
+
mutateLike: bffMutateLike,
|
176
|
+
mutateUnlike: bffMutateUnlike,
|
177
|
+
submitForm: bffSubmitForm,
|
178
|
+
popupDetailData,
|
179
|
+
loadVideos,
|
180
|
+
setPopupDetailData,
|
181
|
+
getRecommendVideos,
|
182
|
+
bffEventReport,
|
183
|
+
utmVal,
|
184
|
+
isPreview,
|
185
|
+
loading,
|
186
|
+
sxpParameter,
|
187
|
+
waterFallData,
|
188
|
+
setWaterFallData,
|
189
|
+
ctaEvent,
|
190
|
+
swiperRef,
|
191
|
+
openHashtag,
|
192
|
+
setOpenHashtag,
|
193
|
+
cacheRtcList,
|
194
|
+
setCacheRtcList,
|
195
|
+
cacheActiveIndex,
|
196
|
+
setCacheActiveIndex,
|
197
|
+
isFromHashtag,
|
198
|
+
setIsFromHashtag,
|
199
|
+
appDomain,
|
200
|
+
hashTagSize,
|
201
|
+
loadingImage: loadingImage !== null && loadingImage !== void 0 ? loadingImage : defaultLoadingImage
|
202
|
+
} }, render({ rtcList, mutateLike: bffMutateLike, mutateUnlike: bffMutateUnlike, submitForm: bffSubmitForm })));
|
203
|
+
};
|
204
|
+
export default memo(SxpDataSourceProvider);
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { DATA_TYPE } from './hooks';
|
3
|
+
export interface IMaterialOptions<T> {
|
4
|
+
displayName: string;
|
5
|
+
icon: React.ReactNode;
|
6
|
+
category: string;
|
7
|
+
type: string;
|
8
|
+
related?: {
|
9
|
+
settingRender?: Record<string, any>;
|
10
|
+
bindableProps: Array<{
|
11
|
+
label: string;
|
12
|
+
value: keyof T;
|
13
|
+
dataType: Array<DATA_TYPE>;
|
14
|
+
}>;
|
15
|
+
[key: string]: any;
|
16
|
+
};
|
17
|
+
h?: number;
|
18
|
+
w?: number;
|
19
|
+
disableDragging?: boolean;
|
20
|
+
isFirstLayout?: boolean;
|
21
|
+
defaulSetting?: defaulSettingProps<T>;
|
22
|
+
defaulMobileSetting?: defaulSettingProps<T>;
|
23
|
+
mobileH?: number;
|
24
|
+
mobileW?: number;
|
25
|
+
sort: number;
|
26
|
+
}
|
27
|
+
type defaulSettingProps<T> = {
|
28
|
+
style?: React.CSSProperties;
|
29
|
+
props?: T;
|
30
|
+
textStyle?: React.CSSProperties;
|
31
|
+
name?: string;
|
32
|
+
};
|
33
|
+
export type MaterialComponet<T = any> = React.ComponentType<T> & {
|
34
|
+
extend?: IMaterialOptions<T>;
|
35
|
+
};
|
36
|
+
export declare function createMaterial<T>(component: MaterialComponet<T>, options: IMaterialOptions<T>): MaterialComponet<T>;
|
37
|
+
export {};
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import { __rest } from "tslib";
|
2
|
+
import { get, cloneDeep } from 'lodash';
|
3
|
+
import React, { memo, useMemo } from 'react';
|
4
|
+
import { useDataSource } from '../hooks';
|
5
|
+
function withBindDataSource(Component) {
|
6
|
+
return memo(function (props) {
|
7
|
+
const { $store } = useDataSource();
|
8
|
+
const handleDataSourceByEvent = (value) => {
|
9
|
+
let res = value;
|
10
|
+
const dataArr = value.match(/{{.*?}}/g);
|
11
|
+
if (dataArr === null || dataArr === void 0 ? void 0 : dataArr.length) {
|
12
|
+
dataArr.forEach((item) => {
|
13
|
+
item.replace(/{{\s*([\w.]+)\s*}}/g, (match, p) => {
|
14
|
+
if (p) {
|
15
|
+
const v = get($store, p);
|
16
|
+
res = res.replace(item, v);
|
17
|
+
return v;
|
18
|
+
}
|
19
|
+
});
|
20
|
+
});
|
21
|
+
}
|
22
|
+
return res;
|
23
|
+
};
|
24
|
+
const clonedProps = useMemo(() => {
|
25
|
+
var _a, _b, _c;
|
26
|
+
const { bindDatas } = props, cloneProps = __rest(props, ["bindDatas"]);
|
27
|
+
(_a = bindDatas === null || bindDatas === void 0 ? void 0 : bindDatas.forEach) === null || _a === void 0 ? void 0 : _a.call(bindDatas, (d) => {
|
28
|
+
if ((d === null || d === void 0 ? void 0 : d.propKey) && (d === null || d === void 0 ? void 0 : d.dataPath)) {
|
29
|
+
const { propKey, dataPath } = d;
|
30
|
+
dataPath.replace(/{{\s*([\w.]+)\s*}}/g, (match, p) => {
|
31
|
+
var _a, _b;
|
32
|
+
if (p) {
|
33
|
+
const v = (_b = (_a = get($store, p)) !== null && _a !== void 0 ? _a : props[propKey]) !== null && _b !== void 0 ? _b : '';
|
34
|
+
cloneProps[propKey] = v;
|
35
|
+
return v;
|
36
|
+
}
|
37
|
+
});
|
38
|
+
}
|
39
|
+
});
|
40
|
+
if (cloneProps) {
|
41
|
+
cloneProps.eventMap = {};
|
42
|
+
const eventObj = cloneDeep(cloneProps.event) || {};
|
43
|
+
for (const key in eventObj) {
|
44
|
+
if (Object.prototype.hasOwnProperty.call(eventObj, key)) {
|
45
|
+
try {
|
46
|
+
eventObj[key].value = handleDataSourceByEvent(eventObj[key].value);
|
47
|
+
cloneProps.eventMap[key] = new Function(eventObj[key].value);
|
48
|
+
}
|
49
|
+
catch (error) { }
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
if ((_c = (_b = cloneProps === null || cloneProps === void 0 ? void 0 : cloneProps.event) === null || _b === void 0 ? void 0 : _b.onClick) === null || _c === void 0 ? void 0 : _c.linkType) {
|
54
|
+
cloneProps.style.cursor = 'pointer';
|
55
|
+
}
|
56
|
+
return cloneProps;
|
57
|
+
}, [$store, props]);
|
58
|
+
return React.createElement(Component, Object.assign({}, clonedProps, clonedProps.eventMap));
|
59
|
+
});
|
60
|
+
}
|
61
|
+
export default withBindDataSource;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
export var DATA_TYPE;
|
2
|
+
(function (DATA_TYPE) {
|
3
|
+
DATA_TYPE["STRING"] = "string";
|
4
|
+
DATA_TYPE["NUMBER"] = "number";
|
5
|
+
DATA_TYPE["ARRAY"] = "array";
|
6
|
+
DATA_TYPE["OBJECT"] = "object";
|
7
|
+
DATA_TYPE["BOOLEAN"] = "boolean";
|
8
|
+
DATA_TYPE["ARRAY_OBJECT"] = "array-object";
|
9
|
+
DATA_TYPE["ARRAY_STRING"] = "array-string";
|
10
|
+
DATA_TYPE["ARRAY_NUMBER"] = "array-number";
|
11
|
+
})(DATA_TYPE || (DATA_TYPE = {}));
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function useEditor(): import("../context/EditorContext").IEditorContext;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { RecItemType } from '../components/SxpPageRender/typing';
|
2
|
+
export declare function useEventReport(): {
|
3
|
+
jumpToWeb: (data?: RecItemType, product?: RecItemType['product'], cta?: RecItemType['cta']) => void;
|
4
|
+
productView: (data?: RecItemType, product?: RecItemType['product'], cta?: RecItemType['cta'], viewTime?: any) => void;
|
5
|
+
};
|