pb-sxp-ui 1.0.52 → 1.0.54

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.
Files changed (38) hide show
  1. package/dist/index.cjs +72 -23
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +1 -1
  4. package/dist/index.js +72 -23
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.cjs +3 -3
  7. package/dist/index.min.cjs.map +1 -1
  8. package/dist/index.min.js +3 -3
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/pb-ui.js +72 -23
  11. package/dist/pb-ui.js.map +1 -1
  12. package/dist/pb-ui.min.js +3 -3
  13. package/dist/pb-ui.min.js.map +1 -1
  14. package/es/core/components/SxpPageCore/index.d.ts +1 -0
  15. package/es/core/components/SxpPageCore/index.js +2 -2
  16. package/es/core/components/SxpPageRender/Popup/index.js +1 -1
  17. package/es/core/components/SxpPageRender/VideoWidget/index.js +10 -2
  18. package/es/core/components/SxpPageRender/index.js +11 -2
  19. package/es/core/context/SxpDataSourceProvider.d.ts +7 -0
  20. package/es/core/context/SxpDataSourceProvider.js +15 -2
  21. package/es/materials/sxp/popup/AppointForm/index.d.ts +1 -0
  22. package/es/materials/sxp/popup/AppointForm/index.js +14 -9
  23. package/es/materials/sxp/popup/CommodityDetail/index.js +8 -1
  24. package/es/materials/sxp/popup/CommodityDetailDiro/index.js +8 -1
  25. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +8 -1
  26. package/lib/core/components/SxpPageCore/index.d.ts +1 -0
  27. package/lib/core/components/SxpPageCore/index.js +2 -2
  28. package/lib/core/components/SxpPageRender/Popup/index.js +1 -1
  29. package/lib/core/components/SxpPageRender/VideoWidget/index.js +10 -2
  30. package/lib/core/components/SxpPageRender/index.js +11 -2
  31. package/lib/core/context/SxpDataSourceProvider.d.ts +7 -0
  32. package/lib/core/context/SxpDataSourceProvider.js +15 -2
  33. package/lib/materials/sxp/popup/AppointForm/index.d.ts +1 -0
  34. package/lib/materials/sxp/popup/AppointForm/index.js +14 -9
  35. package/lib/materials/sxp/popup/CommodityDetail/index.js +8 -1
  36. package/lib/materials/sxp/popup/CommodityDetailDiro/index.js +8 -1
  37. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +8 -1
  38. package/package.json +1 -1
package/dist/pb-ui.js CHANGED
@@ -430,7 +430,7 @@
430
430
  DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
431
431
  })(DataSourceType || (DataSourceType = {}));
432
432
  const UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_id', 'utm_content', 'cl_source'];
433
- const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false }) => {
433
+ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false }) => {
434
434
  const [rtcList, setRtcList] = React.useState([]);
435
435
  const [tagList, setTagList] = React.useState([]);
436
436
  const [loading, setLoading] = React.useState(false);
@@ -545,6 +545,18 @@
545
545
  type: 'beacon'
546
546
  });
547
547
  }, [bffFetch, curReqInfo, enableReportEvent]);
548
+ const bffFbReport = React.useCallback((_a) => {
549
+ var _b;
550
+ var { eventName, actionSource = 'website', eventSourceUrl = (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href, externalId } = _a;
551
+ if (!enableReportEvent || !enabledMetaConversionApi) {
552
+ return;
553
+ }
554
+ return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/fb/events', {
555
+ method: 'POST',
556
+ body: { eventName, actionSource, eventSourceUrl, 'userData.externalId': externalId },
557
+ type: 'beacon'
558
+ });
559
+ }, [bffFetch, enableReportEvent, enabledMetaConversionApi]);
548
560
  const bffMutateLike = React.useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
549
561
  const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/like', { method: 'POST', body }));
550
562
  return res === null || res === void 0 ? void 0 : res.success;
@@ -652,7 +664,8 @@
652
664
  tagList,
653
665
  setLoading,
654
666
  videoRef,
655
- setVideoRef
667
+ setVideoRef,
668
+ bffFbReport
656
669
  } }, render({
657
670
  rtcList,
658
671
  mutateLike: bffMutateLike,
@@ -1027,7 +1040,7 @@
1027
1040
  ];
1028
1041
 
1029
1042
  const AppointForm$1 = (_a) => {
1030
- var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, onClick } = _a, props = __rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "onClick"]);
1043
+ var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, onClick, onClose } = _a, props = __rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "onClick", "onClose"]);
1031
1044
  const { submitForm } = useSxpDataSource();
1032
1045
  const formRef = React.useRef();
1033
1046
  const [loading, setLoading] = React.useState(false);
@@ -1068,19 +1081,24 @@
1068
1081
  }, [layoutType, columns, defaultColumns]);
1069
1082
  const handleSubmit = lodash.debounce(() => __awaiter(void 0, void 0, void 0, function* () {
1070
1083
  var _b, _c, _d;
1071
- setLoading(true);
1072
1084
  const vals = yield ((_b = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _b === void 0 ? void 0 : _b.getFieldsValue());
1073
- const arr = (_d = (_c = Object.keys(vals)) === null || _c === void 0 ? void 0 : _c.map((key) => ({
1074
- name: key,
1075
- value: vals[key]
1076
- }))) === null || _d === void 0 ? void 0 : _d.filter((item) => item === null || item === void 0 ? void 0 : item.value);
1085
+ if (!vals)
1086
+ return;
1087
+ const arr = (_d = (_c = Object.keys(vals)) === null || _c === void 0 ? void 0 : _c.map((key) => {
1088
+ var _a;
1089
+ return ({
1090
+ name: key,
1091
+ value: (_a = vals[key]) !== null && _a !== void 0 ? _a : ''
1092
+ });
1093
+ })) === null || _d === void 0 ? void 0 : _d.filter((item) => item === null || item === void 0 ? void 0 : item.value);
1077
1094
  if (!arr || !(arr === null || arr === void 0 ? void 0 : arr.length))
1078
1095
  return;
1079
- const res = yield (submitForm === null || submitForm === void 0 ? void 0 : submitForm({ attributes: arr }));
1096
+ setLoading(true);
1097
+ const res = (yield (submitForm === null || submitForm === void 0 ? void 0 : submitForm({ attributes: arr })));
1080
1098
  setLoading(false);
1081
1099
  if (res) {
1082
- window === null || window === void 0 ? void 0 : window.sxpPopup('');
1083
- res && (onClick === null || onClick === void 0 ? void 0 : onClick());
1100
+ onClose === null || onClose === void 0 ? void 0 : onClose();
1101
+ onClick === null || onClick === void 0 ? void 0 : onClick();
1084
1102
  }
1085
1103
  }), 1000);
1086
1104
  return (React.createElement("div", { className: 'pb-appoint-form' },
@@ -8362,7 +8380,7 @@
8362
8380
  var _b, _c, _d, _e, _f, _g, _h, _j, _k;
8363
8381
  var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index"]);
8364
8382
  const { sxpParameter } = useSxpDataSource();
8365
- const { popupDetailData, bffEventReport, isPreview, waterFallData } = useSxpDataSource();
8383
+ const { popupDetailData, bffEventReport, isPreview, bffFbReport } = useSxpDataSource();
8366
8384
  const { jumpToWeb, productView } = useEventReport();
8367
8385
  const curTimeRef = React.useRef(null);
8368
8386
  const [showModal, setShowModal] = React.useState(false);
@@ -8379,6 +8397,13 @@
8379
8397
  window.location.href = window.getJointUtmLink(product.link);
8380
8398
  }
8381
8399
  };
8400
+ React.useEffect(() => {
8401
+ if (!isPost) {
8402
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
8403
+ eventName: 'ProductView'
8404
+ });
8405
+ }
8406
+ }, [isPost, bffFbReport]);
8382
8407
  React.useEffect(() => {
8383
8408
  const initTime = () => {
8384
8409
  curTimeRef.current = new Date();
@@ -8814,7 +8839,7 @@
8814
8839
  var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index"]);
8815
8840
  React.useState(true);
8816
8841
  const { sxpParameter } = useSxpDataSource();
8817
- const { popupDetailData, bffEventReport, isPreview, swiperRef, waterFallData } = useSxpDataSource();
8842
+ const { popupDetailData, bffEventReport, isPreview, swiperRef, bffFbReport } = useSxpDataSource();
8818
8843
  const { jumpToWeb, productView } = useEventReport();
8819
8844
  const scrollRef = React.useRef(null);
8820
8845
  React.useRef(null);
@@ -8837,6 +8862,13 @@
8837
8862
  window.location.href = window.getJointUtmLink(product.link);
8838
8863
  }
8839
8864
  };
8865
+ React.useEffect(() => {
8866
+ if (!isPost) {
8867
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
8868
+ eventName: 'ProductView'
8869
+ });
8870
+ }
8871
+ }, [isPost, bffFbReport]);
8840
8872
  React.useEffect(() => {
8841
8873
  const initTime = () => {
8842
8874
  curTimeRef.current = new Date();
@@ -12055,7 +12087,7 @@ Made in Italy` })));
12055
12087
 
12056
12088
  const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
12057
12089
  const [isPauseVideo, setIsPauseVideo] = React.useState(false);
12058
- const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
12090
+ const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = useSxpDataSource();
12059
12091
  const videoStartTime = React.useRef(0);
12060
12092
  const [isLoadFinish, setIsLoadFinish] = React.useState(false);
12061
12093
  const [isFirstPlay, setIsFirstPlay] = React.useState(true);
@@ -12263,6 +12295,9 @@ Made in Italy` })));
12263
12295
  if (!videoRef || !isLoadFinish)
12264
12296
  return;
12265
12297
  if (isActive) {
12298
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
12299
+ eventName: 'ViewContent'
12300
+ });
12266
12301
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12267
12302
  }
12268
12303
  else {
@@ -12286,7 +12321,12 @@ Made in Italy` })));
12286
12321
  React.useEffect(() => {
12287
12322
  if (!isActive)
12288
12323
  return;
12289
- const onShow = handleClickVideo('start');
12324
+ const onShow = () => {
12325
+ handleClickVideo('start')();
12326
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
12327
+ eventName: 'ViewContent'
12328
+ });
12329
+ };
12290
12330
  const onHide = handleClickVideo('pause');
12291
12331
  SXP_EVENT_BUS.on(SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
12292
12332
  SXP_EVENT_BUS.on(SXP_EVENT_TYPE.PAGE_DID_HIDE, onHide);
@@ -12653,7 +12693,7 @@ Made in Italy` })));
12653
12693
  * @Author: binruan@chatlabs.com
12654
12694
  * @Date: 2024-01-15 19:03:09
12655
12695
  * @LastEditors: binruan@chatlabs.com
12656
- * @LastEditTime: 2024-04-30 16:16:05
12696
+ * @LastEditTime: 2024-05-07 17:16:06
12657
12697
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12658
12698
  *
12659
12699
  */
@@ -12668,7 +12708,7 @@ Made in Italy` })));
12668
12708
  const viewTime = React.useRef();
12669
12709
  const [isLoadMore, setIsLoadMore] = React.useState(false);
12670
12710
  const [isShowMore, setIsShowMore] = React.useState(false);
12671
- const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = useSxpDataSource();
12711
+ const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport } = useSxpDataSource();
12672
12712
  const [videoRef, setVideoRef] = React.useState(null);
12673
12713
  const playerRef = React.useRef();
12674
12714
  const { productView } = useEventReport();
@@ -12701,8 +12741,11 @@ Made in Italy` })));
12701
12741
  requestId: null
12702
12742
  }
12703
12743
  });
12744
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
12745
+ eventName: 'PageView'
12746
+ });
12704
12747
  setIsInit(true);
12705
- }, [bffEventReport, data.length]);
12748
+ }, [bffEventReport, data.length, bffFbReport]);
12706
12749
  const initTime = () => {
12707
12750
  curTime.current = new Date();
12708
12751
  viewTime.current = new Date();
@@ -12987,6 +13030,9 @@ Made in Italy` })));
12987
13030
  var _a, _b, _c;
12988
13031
  if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && !((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls) && (item === null || item === void 0 ? void 0 : item.product)) {
12989
13032
  productView(item, item.product, (_c = item === null || item === void 0 ? void 0 : item.product) === null || _c === void 0 ? void 0 : _c.bindCta, viewTime.current, activeIndex);
13033
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
13034
+ eventName: 'ProductView'
13035
+ });
12990
13036
  }
12991
13037
  };
12992
13038
  React.useEffect(() => {
@@ -13014,6 +13060,9 @@ Made in Italy` })));
13014
13060
  traceInfo: item.video.traceInfo
13015
13061
  }
13016
13062
  });
13063
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
13064
+ eventName: 'ViewContent'
13065
+ });
13017
13066
  }
13018
13067
  };
13019
13068
  const visList = React.useMemo(() => {
@@ -13513,7 +13562,7 @@ Made in Italy` })));
13513
13562
  * @Author: binruan@chatlabs.com
13514
13563
  * @Date: 2023-10-31 10:56:01
13515
13564
  * @LastEditors: binruan@chatlabs.com
13516
- * @LastEditTime: 2024-04-15 09:39:17
13565
+ * @LastEditTime: 2024-05-08 17:41:44
13517
13566
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Popup\index.tsx
13518
13567
  *
13519
13568
  */
@@ -13564,7 +13613,7 @@ Made in Italy` })));
13564
13613
  const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
13565
13614
  const Component = withBindDataSource(t);
13566
13615
  const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
13567
- 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 })));
13616
+ 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, onClose: handleClose })));
13568
13617
  }
13569
13618
  else {
13570
13619
  return React.createElement(React.Fragment, null);
@@ -13578,7 +13627,7 @@ Made in Italy` })));
13578
13627
  * @Author: binruan@chatlabs.com
13579
13628
  * @Date: 2024-01-15 19:03:09
13580
13629
  * @LastEditors: binruan@chatlabs.com
13581
- * @LastEditTime: 2024-04-30 11:06:08
13630
+ * @LastEditTime: 2024-05-06 17:26:37
13582
13631
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageCore\index.tsx
13583
13632
  *
13584
13633
  */
@@ -13594,7 +13643,7 @@ Made in Italy` })));
13594
13643
  Object.values(_materials_).forEach((v) => {
13595
13644
  RESOLVER[v.extend.type] = v;
13596
13645
  });
13597
- const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain, licenseUrl }) => {
13646
+ const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain, licenseUrl, enabledMetaConversionApi }) => {
13598
13647
  var _a, _b, _c, _d, _e, _f;
13599
13648
  const utmVal = React.useMemo(() => {
13600
13649
  var _a;
@@ -13602,7 +13651,7 @@ Made in Italy` })));
13602
13651
  return searchParams;
13603
13652
  }, []);
13604
13653
  return (React.createElement(EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: data === null || data === void 0 ? void 0 : data.data, utmVal: utmVal },
13605
- React.createElement(SxpDataSourceProvider$1, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, render: ({ rtcList, tagList }) => {
13654
+ React.createElement(SxpDataSourceProvider$1, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, render: ({ rtcList, tagList }) => {
13606
13655
  var _a;
13607
13656
  return (React.createElement(React.Fragment, null,
13608
13657
  React.createElement(SxpPageRender, Object.assign({}, (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER, licenseUrl: licenseUrl })),