pb-sxp-ui 1.0.56 → 1.0.58

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.js CHANGED
@@ -1025,9 +1025,90 @@ var settingRender$5 = [
1025
1025
  }
1026
1026
  ];
1027
1027
 
1028
+ /*
1029
+ * @Author: binruan@chatlabs.com
1030
+ * @Date: 2024-03-12 10:59:06
1031
+ * @LastEditors: binruan@chatlabs.com
1032
+ * @LastEditTime: 2024-04-15 09:47:08
1033
+ * @FilePath: \pb-sxp-ui\src\core\hooks\useEventReport.ts
1034
+ *
1035
+ */
1036
+ function useEventReport() {
1037
+ const { bffEventReport, popupDetailData, waterFallData, isFromHashtag } = useSxpDataSource();
1038
+ const jumpToWeb = useCallback((data, product, cta, position) => {
1039
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1040
+ let fromKName = '';
1041
+ if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
1042
+ fromKName = 'pdpPage';
1043
+ }
1044
+ else if (isFromHashtag) {
1045
+ fromKName = 'hashTagPage';
1046
+ }
1047
+ else if ((_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.url) {
1048
+ fromKName = 'videoPage';
1049
+ }
1050
+ else if (((_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.imgUrls) && ((_g = (_f = data === null || data === void 0 ? void 0 : data.video) === null || _f === void 0 ? void 0 : _f.imgUrls) === null || _g === void 0 ? void 0 : _g.length)) {
1051
+ fromKName = 'imagePage';
1052
+ }
1053
+ else if (data === null || data === void 0 ? void 0 : data.product) {
1054
+ fromKName = 'productPage';
1055
+ }
1056
+ bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
1057
+ eventInfo: {
1058
+ eventSubject: 'jumpToWeb',
1059
+ eventDescription: 'User jumped to website',
1060
+ productId: (_h = product === null || product === void 0 ? void 0 : product.itemId) !== null && _h !== void 0 ? _h : '',
1061
+ productName: (_j = product === null || product === void 0 ? void 0 : product.title) !== null && _j !== void 0 ? _j : '',
1062
+ price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0',
1063
+ productCollection: (_k = product === null || product === void 0 ? void 0 : product.collection) !== null && _k !== void 0 ? _k : '',
1064
+ fromKName,
1065
+ fromKPage: location === null || location === void 0 ? void 0 : location.href,
1066
+ contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
1067
+ position: position + '',
1068
+ contentId: (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.itemId) !== null && _m !== void 0 ? _m : '',
1069
+ ctatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
1070
+ traceInfo: (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : ''
1071
+ }
1072
+ });
1073
+ }, [bffEventReport, popupDetailData, isFromHashtag]);
1074
+ const productView = useCallback((data, product, cta, viewTime, position) => {
1075
+ var _a, _b, _c, _d;
1076
+ let fromKName = '';
1077
+ if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
1078
+ fromKName = 'pdpPage';
1079
+ }
1080
+ else if (data === null || data === void 0 ? void 0 : data.product) {
1081
+ fromKName = 'productPage';
1082
+ }
1083
+ bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
1084
+ eventInfo: {
1085
+ productId: product === null || product === void 0 ? void 0 : product.itemId,
1086
+ productName: product === null || product === void 0 ? void 0 : product.title,
1087
+ price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0',
1088
+ productCollection: product === null || product === void 0 ? void 0 : product.collection,
1089
+ fromKName,
1090
+ fromKPage: location === null || location === void 0 ? void 0 : location.href,
1091
+ contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
1092
+ position: position + '',
1093
+ contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
1094
+ ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
1095
+ traceInfo: product === null || product === void 0 ? void 0 : product.traceInfo,
1096
+ timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
1097
+ eventSubject: 'productView',
1098
+ eventDescription: 'User browsed the product'
1099
+ }
1100
+ });
1101
+ }, [bffEventReport, popupDetailData]);
1102
+ return {
1103
+ jumpToWeb,
1104
+ productView
1105
+ };
1106
+ }
1107
+
1028
1108
  const AppointForm$1 = (_a) => {
1029
- 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"]);
1030
- const { submitForm } = useSxpDataSource();
1109
+ var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, isExternalLink, onClick, onClose } = _a, props = __rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "isExternalLink", "onClick", "onClose"]);
1110
+ const { submitForm, popupDetailData } = useSxpDataSource();
1111
+ const { jumpToWeb } = useEventReport();
1031
1112
  const formRef = useRef();
1032
1113
  const [loading, setLoading] = useState(false);
1033
1114
  const defaultColumns = useMemo(() => [
@@ -1066,7 +1147,7 @@ const AppointForm$1 = (_a) => {
1066
1147
  }
1067
1148
  }, [layoutType, columns, defaultColumns]);
1068
1149
  const handleSubmit = debounce(() => __awaiter(void 0, void 0, void 0, function* () {
1069
- var _b, _c, _d;
1150
+ var _b, _c, _d, _e, _f, _g;
1070
1151
  const vals = yield ((_b = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _b === void 0 ? void 0 : _b.getFieldsValue());
1071
1152
  if (!vals)
1072
1153
  return;
@@ -1083,6 +1164,13 @@ const AppointForm$1 = (_a) => {
1083
1164
  const res = (yield (submitForm === null || submitForm === void 0 ? void 0 : submitForm({ attributes: arr })));
1084
1165
  setLoading(false);
1085
1166
  if (res) {
1167
+ if (isExternalLink) {
1168
+ const data = popupDetailData;
1169
+ const product = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.bindProduct;
1170
+ const cta = (_g = (_f = data === null || data === void 0 ? void 0 : data.video) === null || _f === void 0 ? void 0 : _f.bindProduct) === null || _g === void 0 ? void 0 : _g.bindCta;
1171
+ const position = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
1172
+ jumpToWeb(data, product, cta, position);
1173
+ }
1086
1174
  onClose === null || onClose === void 0 ? void 0 : onClose();
1087
1175
  onClick === null || onClick === void 0 ? void 0 : onClick();
1088
1176
  }
@@ -8134,86 +8222,6 @@ const SwiperSlide = /*#__PURE__*/forwardRef(function (_temp, externalRef) {
8134
8222
  });
8135
8223
  SwiperSlide.displayName = 'SwiperSlide';
8136
8224
 
8137
- /*
8138
- * @Author: binruan@chatlabs.com
8139
- * @Date: 2024-03-12 10:59:06
8140
- * @LastEditors: binruan@chatlabs.com
8141
- * @LastEditTime: 2024-04-15 09:47:08
8142
- * @FilePath: \pb-sxp-ui\src\core\hooks\useEventReport.ts
8143
- *
8144
- */
8145
- function useEventReport() {
8146
- const { bffEventReport, popupDetailData, waterFallData, isFromHashtag } = useSxpDataSource();
8147
- const jumpToWeb = useCallback((data, product, cta, position) => {
8148
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
8149
- let fromKName = '';
8150
- if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
8151
- fromKName = 'pdpPage';
8152
- }
8153
- else if (isFromHashtag) {
8154
- fromKName = 'hashTagPage';
8155
- }
8156
- else if ((_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.url) {
8157
- fromKName = 'videoPage';
8158
- }
8159
- else if (((_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.imgUrls) && ((_g = (_f = data === null || data === void 0 ? void 0 : data.video) === null || _f === void 0 ? void 0 : _f.imgUrls) === null || _g === void 0 ? void 0 : _g.length)) {
8160
- fromKName = 'imagePage';
8161
- }
8162
- else if (data === null || data === void 0 ? void 0 : data.product) {
8163
- fromKName = 'productPage';
8164
- }
8165
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
8166
- eventInfo: {
8167
- eventSubject: 'jumpToWeb',
8168
- eventDescription: 'User jumped to website',
8169
- productId: (_h = product === null || product === void 0 ? void 0 : product.itemId) !== null && _h !== void 0 ? _h : '',
8170
- productName: (_j = product === null || product === void 0 ? void 0 : product.title) !== null && _j !== void 0 ? _j : '',
8171
- price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0',
8172
- productCollection: (_k = product === null || product === void 0 ? void 0 : product.collection) !== null && _k !== void 0 ? _k : '',
8173
- fromKName,
8174
- fromKPage: location === null || location === void 0 ? void 0 : location.href,
8175
- contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
8176
- position: position + '',
8177
- contentId: (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.itemId) !== null && _m !== void 0 ? _m : '',
8178
- ctatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
8179
- traceInfo: (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : ''
8180
- }
8181
- });
8182
- }, [bffEventReport, popupDetailData, isFromHashtag]);
8183
- const productView = useCallback((data, product, cta, viewTime, position) => {
8184
- var _a, _b, _c, _d;
8185
- let fromKName = '';
8186
- if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
8187
- fromKName = 'pdpPage';
8188
- }
8189
- else if (data === null || data === void 0 ? void 0 : data.product) {
8190
- fromKName = 'productPage';
8191
- }
8192
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
8193
- eventInfo: {
8194
- productId: product === null || product === void 0 ? void 0 : product.itemId,
8195
- productName: product === null || product === void 0 ? void 0 : product.title,
8196
- price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0',
8197
- productCollection: product === null || product === void 0 ? void 0 : product.collection,
8198
- fromKName,
8199
- fromKPage: location === null || location === void 0 ? void 0 : location.href,
8200
- contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
8201
- position: position + '',
8202
- contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
8203
- ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
8204
- traceInfo: product === null || product === void 0 ? void 0 : product.traceInfo,
8205
- timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
8206
- eventSubject: 'productView',
8207
- eventDescription: 'User browsed the product'
8208
- }
8209
- });
8210
- }, [bffEventReport, popupDetailData]);
8211
- return {
8212
- jumpToWeb,
8213
- productView
8214
- };
8215
- }
8216
-
8217
8225
  /*
8218
8226
  * @Author: binruan@chatlabs.com
8219
8227
  * @Date: 2023-11-02 18:34:34
@@ -8376,7 +8384,7 @@ const CommodityDetail$1 = (_a) => {
8376
8384
  const position = isPost ? index : popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
8377
8385
  const handleLink = () => {
8378
8386
  if (product === null || product === void 0 ? void 0 : product.link) {
8379
- jumpToWeb(popupDetailData, product, cta, position);
8387
+ jumpToWeb(data, product, cta, position);
8380
8388
  if (!isPost) {
8381
8389
  productView(data, product, cta, viewTime || curTimeRef.current, position);
8382
8390
  }
@@ -13407,7 +13415,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
13407
13415
  right: 0
13408
13416
  } },
13409
13417
  React.createElement("div", { style: { position: 'relative', width, height: '100%' } },
13410
- React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
13418
+ React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, autoPlay: true, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
13411
13419
  width: '100%',
13412
13420
  height,
13413
13421
  objectFit: 'contain'
@@ -13419,7 +13427,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
13419
13427
  height,
13420
13428
  overflow: 'hidden'
13421
13429
  } },
13422
- React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
13430
+ React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', style: { width: '100%' }, ref: videoRef, crossOrigin: 'anonymous', muted: true, autoPlay: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
13423
13431
  renderPoster,
13424
13432
  React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
13425
13433
  };
@@ -13549,7 +13557,7 @@ var index$1 = memo(DiyPortalPreview);
13549
13557
  * @Author: binruan@chatlabs.com
13550
13558
  * @Date: 2023-10-31 10:56:01
13551
13559
  * @LastEditors: binruan@chatlabs.com
13552
- * @LastEditTime: 2024-05-08 17:41:44
13560
+ * @LastEditTime: 2024-05-13 15:19:20
13553
13561
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Popup\index.tsx
13554
13562
  *
13555
13563
  */
@@ -13595,18 +13603,19 @@ const Popup = () => {
13595
13603
  const renderPopupDetail = useMemo(() => {
13596
13604
  var _a, _b, _c;
13597
13605
  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) => {
13598
- var _a, _b, _c, _d, _e, _f, _g, _h;
13606
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
13599
13607
  if ((value === null || value === void 0 ? void 0 : value.id) === (popup === null || popup === void 0 ? void 0 : popup.id)) {
13600
13608
  const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
13601
13609
  const Component = withBindDataSource(t);
13602
- const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
13603
- 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 })));
13610
+ const isExternalLink = ((_d = (_c = (_b = value === null || value === void 0 ? void 0 : value.item) === null || _b === void 0 ? void 0 : _b.event) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.linkType) === 'externalLink';
13611
+ const defaulSetting = (_e = t === null || t === void 0 ? void 0 : t.extend) === null || _e === void 0 ? void 0 : _e.defaulSetting;
13612
+ return (React.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_f = value === null || value === void 0 ? void 0 : value.item) === null || _f === void 0 ? void 0 : _f.style), { width: '100%', height: '80vh', overflow: 'auto' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.textStyle), bindDatas: (_j = (_h = value === null || value === void 0 ? void 0 : value.item) === null || _h === void 0 ? void 0 : _h.bindDatas) !== null && _j !== void 0 ? _j : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_k = value === null || value === void 0 ? void 0 : value.item) === null || _k === void 0 ? void 0 : _k.props, { event: ((_l = value === null || value === void 0 ? void 0 : value.item) === null || _l === void 0 ? void 0 : _l.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, isExternalLink: isExternalLink, onClose: handleClose })));
13604
13613
  }
13605
13614
  else {
13606
13615
  return React.createElement(React.Fragment, null);
13607
13616
  }
13608
13617
  });
13609
- }, [schema, popup, resolver]);
13618
+ }, [schema, popup, resolver, handleClose]);
13610
13619
  return (React.createElement(Modal$1, { popup: visible, onClose: handleClose, padding: 0, modalStyle: { position: 'fixed' } }, renderPopupDetail));
13611
13620
  };
13612
13621