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.cjs CHANGED
@@ -1048,9 +1048,90 @@ var settingRender$5 = [
1048
1048
  }
1049
1049
  ];
1050
1050
 
1051
+ /*
1052
+ * @Author: binruan@chatlabs.com
1053
+ * @Date: 2024-03-12 10:59:06
1054
+ * @LastEditors: binruan@chatlabs.com
1055
+ * @LastEditTime: 2024-04-15 09:47:08
1056
+ * @FilePath: \pb-sxp-ui\src\core\hooks\useEventReport.ts
1057
+ *
1058
+ */
1059
+ function useEventReport() {
1060
+ const { bffEventReport, popupDetailData, waterFallData, isFromHashtag } = useSxpDataSource();
1061
+ const jumpToWeb = React.useCallback((data, product, cta, position) => {
1062
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1063
+ let fromKName = '';
1064
+ 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))) {
1065
+ fromKName = 'pdpPage';
1066
+ }
1067
+ else if (isFromHashtag) {
1068
+ fromKName = 'hashTagPage';
1069
+ }
1070
+ else if ((_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.url) {
1071
+ fromKName = 'videoPage';
1072
+ }
1073
+ 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)) {
1074
+ fromKName = 'imagePage';
1075
+ }
1076
+ else if (data === null || data === void 0 ? void 0 : data.product) {
1077
+ fromKName = 'productPage';
1078
+ }
1079
+ bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
1080
+ eventInfo: {
1081
+ eventSubject: 'jumpToWeb',
1082
+ eventDescription: 'User jumped to website',
1083
+ productId: (_h = product === null || product === void 0 ? void 0 : product.itemId) !== null && _h !== void 0 ? _h : '',
1084
+ productName: (_j = product === null || product === void 0 ? void 0 : product.title) !== null && _j !== void 0 ? _j : '',
1085
+ price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0',
1086
+ productCollection: (_k = product === null || product === void 0 ? void 0 : product.collection) !== null && _k !== void 0 ? _k : '',
1087
+ fromKName,
1088
+ fromKPage: location === null || location === void 0 ? void 0 : location.href,
1089
+ contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
1090
+ position: position + '',
1091
+ 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 : '',
1092
+ ctatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
1093
+ traceInfo: (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : ''
1094
+ }
1095
+ });
1096
+ }, [bffEventReport, popupDetailData, isFromHashtag]);
1097
+ const productView = React.useCallback((data, product, cta, viewTime, position) => {
1098
+ var _a, _b, _c, _d;
1099
+ let fromKName = '';
1100
+ 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))) {
1101
+ fromKName = 'pdpPage';
1102
+ }
1103
+ else if (data === null || data === void 0 ? void 0 : data.product) {
1104
+ fromKName = 'productPage';
1105
+ }
1106
+ bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
1107
+ eventInfo: {
1108
+ productId: product === null || product === void 0 ? void 0 : product.itemId,
1109
+ productName: product === null || product === void 0 ? void 0 : product.title,
1110
+ price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0',
1111
+ productCollection: product === null || product === void 0 ? void 0 : product.collection,
1112
+ fromKName,
1113
+ fromKPage: location === null || location === void 0 ? void 0 : location.href,
1114
+ contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
1115
+ position: position + '',
1116
+ contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
1117
+ ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
1118
+ traceInfo: product === null || product === void 0 ? void 0 : product.traceInfo,
1119
+ timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
1120
+ eventSubject: 'productView',
1121
+ eventDescription: 'User browsed the product'
1122
+ }
1123
+ });
1124
+ }, [bffEventReport, popupDetailData]);
1125
+ return {
1126
+ jumpToWeb,
1127
+ productView
1128
+ };
1129
+ }
1130
+
1051
1131
  const AppointForm$1 = (_a) => {
1052
- 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"]);
1053
- const { submitForm } = useSxpDataSource();
1132
+ 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"]);
1133
+ const { submitForm, popupDetailData } = useSxpDataSource();
1134
+ const { jumpToWeb } = useEventReport();
1054
1135
  const formRef = React.useRef();
1055
1136
  const [loading, setLoading] = React.useState(false);
1056
1137
  const defaultColumns = React.useMemo(() => [
@@ -1089,7 +1170,7 @@ const AppointForm$1 = (_a) => {
1089
1170
  }
1090
1171
  }, [layoutType, columns, defaultColumns]);
1091
1172
  const handleSubmit = lodash.debounce(() => __awaiter(void 0, void 0, void 0, function* () {
1092
- var _b, _c, _d;
1173
+ var _b, _c, _d, _e, _f, _g;
1093
1174
  const vals = yield ((_b = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _b === void 0 ? void 0 : _b.getFieldsValue());
1094
1175
  if (!vals)
1095
1176
  return;
@@ -1106,6 +1187,13 @@ const AppointForm$1 = (_a) => {
1106
1187
  const res = (yield (submitForm === null || submitForm === void 0 ? void 0 : submitForm({ attributes: arr })));
1107
1188
  setLoading(false);
1108
1189
  if (res) {
1190
+ if (isExternalLink) {
1191
+ const data = popupDetailData;
1192
+ const product = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.bindProduct;
1193
+ 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;
1194
+ const position = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
1195
+ jumpToWeb(data, product, cta, position);
1196
+ }
1109
1197
  onClose === null || onClose === void 0 ? void 0 : onClose();
1110
1198
  onClick === null || onClick === void 0 ? void 0 : onClick();
1111
1199
  }
@@ -8157,86 +8245,6 @@ const SwiperSlide = /*#__PURE__*/React.forwardRef(function (_temp, externalRef)
8157
8245
  });
8158
8246
  SwiperSlide.displayName = 'SwiperSlide';
8159
8247
 
8160
- /*
8161
- * @Author: binruan@chatlabs.com
8162
- * @Date: 2024-03-12 10:59:06
8163
- * @LastEditors: binruan@chatlabs.com
8164
- * @LastEditTime: 2024-04-15 09:47:08
8165
- * @FilePath: \pb-sxp-ui\src\core\hooks\useEventReport.ts
8166
- *
8167
- */
8168
- function useEventReport() {
8169
- const { bffEventReport, popupDetailData, waterFallData, isFromHashtag } = useSxpDataSource();
8170
- const jumpToWeb = React.useCallback((data, product, cta, position) => {
8171
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
8172
- let fromKName = '';
8173
- 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))) {
8174
- fromKName = 'pdpPage';
8175
- }
8176
- else if (isFromHashtag) {
8177
- fromKName = 'hashTagPage';
8178
- }
8179
- else if ((_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.url) {
8180
- fromKName = 'videoPage';
8181
- }
8182
- 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)) {
8183
- fromKName = 'imagePage';
8184
- }
8185
- else if (data === null || data === void 0 ? void 0 : data.product) {
8186
- fromKName = 'productPage';
8187
- }
8188
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
8189
- eventInfo: {
8190
- eventSubject: 'jumpToWeb',
8191
- eventDescription: 'User jumped to website',
8192
- productId: (_h = product === null || product === void 0 ? void 0 : product.itemId) !== null && _h !== void 0 ? _h : '',
8193
- productName: (_j = product === null || product === void 0 ? void 0 : product.title) !== null && _j !== void 0 ? _j : '',
8194
- price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0',
8195
- productCollection: (_k = product === null || product === void 0 ? void 0 : product.collection) !== null && _k !== void 0 ? _k : '',
8196
- fromKName,
8197
- fromKPage: location === null || location === void 0 ? void 0 : location.href,
8198
- contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
8199
- position: position + '',
8200
- 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 : '',
8201
- ctatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
8202
- traceInfo: (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : ''
8203
- }
8204
- });
8205
- }, [bffEventReport, popupDetailData, isFromHashtag]);
8206
- const productView = React.useCallback((data, product, cta, viewTime, position) => {
8207
- var _a, _b, _c, _d;
8208
- let fromKName = '';
8209
- 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))) {
8210
- fromKName = 'pdpPage';
8211
- }
8212
- else if (data === null || data === void 0 ? void 0 : data.product) {
8213
- fromKName = 'productPage';
8214
- }
8215
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
8216
- eventInfo: {
8217
- productId: product === null || product === void 0 ? void 0 : product.itemId,
8218
- productName: product === null || product === void 0 ? void 0 : product.title,
8219
- price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0',
8220
- productCollection: product === null || product === void 0 ? void 0 : product.collection,
8221
- fromKName,
8222
- fromKPage: location === null || location === void 0 ? void 0 : location.href,
8223
- contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
8224
- position: position + '',
8225
- contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
8226
- ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
8227
- traceInfo: product === null || product === void 0 ? void 0 : product.traceInfo,
8228
- timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
8229
- eventSubject: 'productView',
8230
- eventDescription: 'User browsed the product'
8231
- }
8232
- });
8233
- }, [bffEventReport, popupDetailData]);
8234
- return {
8235
- jumpToWeb,
8236
- productView
8237
- };
8238
- }
8239
-
8240
8248
  /*
8241
8249
  * @Author: binruan@chatlabs.com
8242
8250
  * @Date: 2023-11-02 18:34:34
@@ -8399,7 +8407,7 @@ const CommodityDetail$1 = (_a) => {
8399
8407
  const position = isPost ? index : popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
8400
8408
  const handleLink = () => {
8401
8409
  if (product === null || product === void 0 ? void 0 : product.link) {
8402
- jumpToWeb(popupDetailData, product, cta, position);
8410
+ jumpToWeb(data, product, cta, position);
8403
8411
  if (!isPost) {
8404
8412
  productView(data, product, cta, viewTime || curTimeRef.current, position);
8405
8413
  }
@@ -13430,7 +13438,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
13430
13438
  right: 0
13431
13439
  } },
13432
13440
  React.createElement("div", { style: { position: 'relative', width, height: '100%' } },
13433
- 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: {
13441
+ 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: {
13434
13442
  width: '100%',
13435
13443
  height,
13436
13444
  objectFit: 'contain'
@@ -13442,7 +13450,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
13442
13450
  height,
13443
13451
  overflow: 'hidden'
13444
13452
  } },
13445
- 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 }),
13453
+ 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 }),
13446
13454
  renderPoster,
13447
13455
  React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
13448
13456
  };
@@ -13572,7 +13580,7 @@ var index$1 = React.memo(DiyPortalPreview);
13572
13580
  * @Author: binruan@chatlabs.com
13573
13581
  * @Date: 2023-10-31 10:56:01
13574
13582
  * @LastEditors: binruan@chatlabs.com
13575
- * @LastEditTime: 2024-05-08 17:41:44
13583
+ * @LastEditTime: 2024-05-13 15:19:20
13576
13584
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Popup\index.tsx
13577
13585
  *
13578
13586
  */
@@ -13618,18 +13626,19 @@ const Popup = () => {
13618
13626
  const renderPopupDetail = React.useMemo(() => {
13619
13627
  var _a, _b, _c;
13620
13628
  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) => {
13621
- var _a, _b, _c, _d, _e, _f, _g, _h;
13629
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
13622
13630
  if ((value === null || value === void 0 ? void 0 : value.id) === (popup === null || popup === void 0 ? void 0 : popup.id)) {
13623
13631
  const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
13624
13632
  const Component = withBindDataSource(t);
13625
- const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
13626
- 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 })));
13633
+ 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';
13634
+ const defaulSetting = (_e = t === null || t === void 0 ? void 0 : t.extend) === null || _e === void 0 ? void 0 : _e.defaulSetting;
13635
+ 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 })));
13627
13636
  }
13628
13637
  else {
13629
13638
  return React.createElement(React.Fragment, null);
13630
13639
  }
13631
13640
  });
13632
- }, [schema, popup, resolver]);
13641
+ }, [schema, popup, resolver, handleClose]);
13633
13642
  return (React.createElement(Modal$1, { popup: visible, onClose: handleClose, padding: 0, modalStyle: { position: 'fixed' } }, renderPopupDetail));
13634
13643
  };
13635
13644