@conecli/cone-render 0.8.20-beta.0 → 0.8.20-beta.2

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 (160) hide show
  1. package/README.md +7 -1
  2. package/dist/api/index.ts +1 -1
  3. package/dist/assets/icon_blue_info.svg +1 -0
  4. package/dist/common/const.ts +1 -1
  5. package/dist/common/environmentType.ts +1 -0
  6. package/dist/common/index.h5.ts +1 -1
  7. package/dist/common/index.jd.ts +1 -1
  8. package/dist/common/index.ts +1 -1
  9. package/dist/common/index.weapp.ts +1 -1
  10. package/dist/common/jdplayerSdk.ts +1 -0
  11. package/dist/common/jssdk.ts +1 -0
  12. package/dist/common/pageType.ts +1 -0
  13. package/dist/common/sgmCustomCode.ts +1 -0
  14. package/dist/common/token/index.h5.ts +1 -1
  15. package/dist/common/token/token.jd.ts +1 -1
  16. package/dist/common/token/token.ts +1 -1
  17. package/dist/common/wxappApi.jd.ts +1 -0
  18. package/dist/common/wxappApi.ts +1 -1
  19. package/dist/components/ErrorBoundary.tsx +1 -1
  20. package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
  21. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  22. package/dist/components/base/CountDown/index.module.scss +49 -44
  23. package/dist/components/base/CountDown/index.tsx +1 -1
  24. package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
  25. package/dist/components/base/CustomScrollView/index.module.scss +7 -0
  26. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  27. package/dist/components/base/CustomVideo/common.ts +1 -0
  28. package/dist/components/base/CustomVideo/index.tsx +1 -1
  29. package/dist/components/base/Dialog/index.module.scss +16 -0
  30. package/dist/components/base/Dialog/index.tsx +1 -1
  31. package/dist/components/base/Exposure/index.h5.tsx +1 -1
  32. package/dist/components/base/ExposureSmart/const.ts +1 -0
  33. package/dist/components/base/ExposureSmart/index.h5.module.scss +30 -6
  34. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  35. package/dist/components/base/ExposureSmart/index.module.scss +20 -9
  36. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  37. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  38. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  39. package/dist/components/base/InViewRender/index.tsx +1 -1
  40. package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
  41. package/dist/components/base/ItemViewExposureSmart/index.module.scss +8 -0
  42. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -0
  43. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  44. package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
  45. package/dist/components/base/LazyLoadImage/const.ts +1 -1
  46. package/dist/components/base/LazyLoadImage/index.h5.module.scss +24 -20
  47. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  48. package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
  49. package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
  50. package/dist/components/base/NetworkDataError/const.ts +1 -1
  51. package/dist/components/base/NetworkDataError/index.module.scss +125 -69
  52. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  53. package/dist/components/base/Price/Base/index.module.scss +12 -0
  54. package/dist/components/base/Price/Base/index.tsx +1 -1
  55. package/dist/components/base/Price/Double/index.module.scss +32 -0
  56. package/dist/components/base/Price/Double/index.tsx +1 -1
  57. package/dist/components/base/Price/index.tsx +1 -1
  58. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  59. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  60. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  61. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  62. package/dist/components/base/Skeleton/index.tsx +1 -1
  63. package/dist/components/debug/DebugLayout/index.module.scss +67 -0
  64. package/dist/components/debug/DebugLayout/index.tsx +1 -0
  65. package/dist/components/debug/DebugLayout/utils.ts +1 -0
  66. package/dist/components/decorate/DecorateFloorModule/index.module.scss +32 -2
  67. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  68. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  69. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  70. package/dist/components/floorItem.jd.tsx +1 -1
  71. package/dist/components/floorItem.tsx +1 -1
  72. package/dist/components/floorItem.weapp.tsx +1 -1
  73. package/dist/components/isv/Floor/index.tsx +1 -1
  74. package/dist/components/remoteFloorItem.tsx +1 -0
  75. package/dist/interface/common.ts +1 -1
  76. package/dist/interface/component.ts +1 -1
  77. package/dist/interface/jumpEventReport.ts +1 -1
  78. package/dist/interface/service.ts +1 -1
  79. package/dist/interface/utils.ts +1 -1
  80. package/dist/jumpEventReport/base.ts +1 -1
  81. package/dist/jumpEventReport/const.ts +1 -1
  82. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  83. package/dist/jumpEventReport/index.h5.ts +1 -1
  84. package/dist/jumpEventReport/index.jd.ts +1 -1
  85. package/dist/jumpEventReport/index.ts +1 -1
  86. package/dist/jumpEventReport/index.weapp.ts +1 -1
  87. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  88. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  89. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  90. package/dist/jumpEventReport/web/report.ts +1 -1
  91. package/dist/jumpEventReport/web.base.ts +1 -1
  92. package/dist/jumpEventReport/web.jd.ts +1 -1
  93. package/dist/jumpEventReport/web.jdb.ts +1 -1
  94. package/dist/jumpEventReport/web.jdjch.ts +1 -0
  95. package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
  96. package/dist/jumpEventReport/web.pc.ts +1 -0
  97. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  98. package/dist/jumpEventReport/web.tjm.ts +1 -0
  99. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  100. package/dist/language/en_US.json +231 -0
  101. package/dist/language/zh_CN.json +231 -0
  102. package/dist/language/zh_HK.json +231 -0
  103. package/dist/libs/taroAppReport.js +2 -2
  104. package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -27
  105. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  106. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  107. package/dist/open/api/device.ts +1 -1
  108. package/dist/open/api/environment.ts +1 -1
  109. package/dist/open/api/index.ts +1 -1
  110. package/dist/open/api/jump copy.ts +1 -1
  111. package/dist/open/api/request.ts +1 -1
  112. package/dist/open/api/shopMember.ts +1 -1
  113. package/dist/open/api/track.ts +1 -1
  114. package/dist/open/api/util.ts +1 -1
  115. package/dist/open/components/index.ts +1 -1
  116. package/dist/sass/app.h5.scss +294 -212
  117. package/dist/sass/base.scss +195 -137
  118. package/dist/service/bMallConst.ts +1 -1
  119. package/dist/service/fetchGateway.ts +1 -1
  120. package/dist/service/fetchGateway.weapp.ts +1 -0
  121. package/dist/service/http/colorSign.ts +1 -1
  122. package/dist/service/http/const.ts +1 -1
  123. package/dist/service/http/h5Http.ts +1 -0
  124. package/dist/service/http/index.h5.ts +1 -0
  125. package/dist/service/requestServer.h5.ts +1 -0
  126. package/dist/service/requestServer.ts +1 -1
  127. package/dist/service/requestServer.weapp.ts +1 -0
  128. package/dist/utils/connectNativeJsBridge.ts +1 -1
  129. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  130. package/dist/utils/draExceptionAndProfile.ts +1 -1
  131. package/dist/utils/h5Utils.ts +1 -1
  132. package/dist/utils/index.h5.ts +1 -1
  133. package/dist/utils/index.ts +1 -1
  134. package/dist/utils/index.weapp.ts +1 -1
  135. package/dist/utils/intersectionObserver.ts +1 -1
  136. package/dist/utils/jm-common.js +1 -1
  137. package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
  138. package/dist/utils/jumpExtMapUtil.ts +1 -0
  139. package/dist/utils/sColor.js +1 -0
  140. package/dist/utils/sgmCodeUtils.ts +1 -0
  141. package/dist/utils/taroRenderUtil.ts +1 -0
  142. package/dist/utils/utils.ts +1 -1
  143. package/dist/wxapp/api/helper.js +1 -0
  144. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  145. package/dist/wxapp/common/user_info.js +1 -1
  146. package/dist/wxapp/components/launch-app/index.js +1 -0
  147. package/dist/wxapp/components/launch-app/index.json +5 -0
  148. package/dist/wxapp/components/launch-app/index.wxml +0 -0
  149. package/dist/wxapp/components/launch-app/index.wxss +0 -0
  150. package/dist/wxapp/components/subscribe-guider/helper.js +1 -0
  151. package/dist/wxapp/components/subscribe-guider/index.js +1 -0
  152. package/dist/wxapp/components/subscribe-guider/index.json +5 -0
  153. package/dist/wxapp/components/subscribe-guider/index.wxml +0 -0
  154. package/dist/wxapp/components/subscribe-guider/index.wxss +0 -0
  155. package/package.json +145 -115
  156. package/dist/components/base/Skeleton/old.tsx +0 -1
  157. package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
  158. package/dist/utils/memberFormatUtils.js +0 -1
  159. /package/dist/service/{bMallConst.wxapp.ts → bMallConst.weapp.ts} +0 -0
  160. /package/dist/service/http/{colorSign.wxapp.ts → colorSign.weapp.ts} +0 -0
@@ -0,0 +1 @@
1
+ import global from '../common';
2
  BUSINESS_TYPE,
1
3
  SHOP_MENU_ID_TYPE,
2
4
  SHOP_MENU_ID_NAME,
3
5
  SECTION_HOME_TAB_TYPE,
4
6
  SECTION_HOME_TAB_NAME_TYPE,
5
7
  routerInfo: {
6
8
  params: {},
7
9
  },
8
10
  nativeEvent: null,
9
11
  jumpConfig: {
10
12
  venderId: null,
11
13
  shopId: null,
12
14
  sourceValue: '',
13
15
  sourceType: 'M-H5',
14
16
  activityType: 'shopx',
15
17
  moduleId: 'none',
16
18
  entrance: 'none',
17
19
  },
18
20
  logPageParamStr: '',
19
21
  public logPageId: string;
20
22
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
21
23
  getConfig(opt) {
22
24
  return Object.assign(this, {}, defaultConfig, opt);
23
25
  }
24
26
  updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
25
27
  this.routerInfo = routerInfo;
26
28
  this.logPname = logPname;
27
29
  this.jumpConfig = Object.assign(
28
30
  {},
29
31
  this.jumpConfig,
30
32
  filterUrlQueryData(routerInfo?.params || {}),
31
33
  );
32
34
  this.logPageId = pageId;
33
35
  }
34
36
 
35
37
  jdJumpToProduct(skuIds, logEventInfo) {
36
38
  skuIds = skuIds.toString().trim();
37
39
  const getSkuId = skuIds.indexOf(',') !== -1 ? skuIds.split(',')[0] : skuIds;
38
40
  let url = `${this.jumpWebUrl.pcDetail}${getSkuId}.html`;
39
41
  this.jdNavigateToNative(url, logEventInfo);
40
42
  }
41
43
 
42
44
  jdJumpSkuInfoToProduct(skuInfo: any = {}, logEventInfo) {
43
45
  const getSkuId = skuInfo?.skuId;
44
46
  this.jdJumpToProduct(getSkuId, logEventInfo);
45
47
  }
46
48
 
47
49
  jdJumpToShopHome(shopInfo: JumpEventReportInterFace.ShopIdsInfo = {}) {
48
50
  const currentShopInfo = {
49
51
  shopId: global.info.queryInfo.shopId,
50
52
  venderId: global.info.queryInfo.venderId,
51
53
  };
52
54
  const restParams =
53
55
  (shopInfo?.shopId && shopInfo.shopId !== currentShopInfo.shopId) ||
54
56
  (shopInfo?.venderId && shopInfo.venderId !== currentShopInfo.venderId)
55
57
  ? {}
56
58
  : currentShopInfo;
57
59
  const getInfo = Object.assign({}, restParams, shopInfo);
58
60
  let url = `${this.jumpWebUrl.pages}/index-${getInfo.shopId}.html`;
59
61
  this.jdNavigateToNative(url, {
60
62
  ...getInfo,
61
63
  });
62
64
  }
63
65
 
64
66
  getPcSearchUrl = (searchInfo: { categoryId: string; keyWord: string }) => {
65
67
  const { categoryId, keyWord } = searchInfo;
66
68
  const flag = document.querySelector('#JSHOP_CHANNEL_FLAG')?.value;
67
69
  const appId =
68
70
  document.querySelector('#J_AppId')?.value ||
69
71
  document.querySelector('#pageInstance_appId')?.value;
70
72
  const keywordStr = keyWord && keyWord !== "" ? `?keyword=${keyWord}` : ''
71
73
  const searchUrl = categoryId
72
74
  ? this.jumpWebUrl.pages + '/view_search-' + appId + '-' + categoryId + '-99-1-20-1.html'
73
75
  : `${this.jumpWebUrl.pages}/view_search-${appId}.html${keywordStr}`;
74
76
  return flag === 'yao'
75
77
  ? this.jumpWebUrl.pages + '/view_shop_search-' + appId + '.html'
76
78
  : searchUrl;
77
79
  };
78
80
 
79
81
  jdJumpToShopSearch(shopInfo) {
80
82
  const getInfo = Object.assign(
81
83
  {},
82
84
  {
83
85
  shopId: global.info.queryInfo.shopId,
84
86
  venderId: global.info.queryInfo.venderId,
85
87
  },
86
88
  shopInfo,
87
89
  );
88
90
  const { categoryId = '', keyWord = '' } = getInfo;
89
91
  const url = `${this.getPcSearchUrl({ categoryId, keyWord })}`;
90
92
  this.jdJumpToWeb(url, getInfo);
91
93
  }
92
94
 
93
95
  jdJumpToShopCategory(shopInfo) {
94
96
  this.jdJumpToShopSearch(shopInfo)
95
97
  }
96
98
 
97
99
  jdJumpToTabAllProduct(shopId, venderId, logEventInfo = {}) {
98
100
  console.log('web.base.ts - jdJumpToTabAllProduct');
99
101
  if (typeof shopId === 'undefined') shopId = global.info.queryInfo.shopId;
100
102
  if (typeof venderId === 'undefined') venderId = global.info.queryInfo.venderId;
101
103
  const url = `${this.jumpWebUrl.pages}/index-${shopId}.html`;
102
104
  this.jdJumpToWeb(url, logEventInfo);
103
105
  }
104
106
 
105
107
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
106
108
  const url = `${this.jumpWebUrl.couponSearch}?couponbatch=${couponId}&sceneval=2`;
107
109
  this.jdJumpToWeb(url, logEventInfo);
108
110
  }
@@ -0,0 +1 @@
1
+ import { JumpEventTJWebReport } from './web.tjm'
2
  routerInfo: {
1
3
  params: {},
2
4
  },
3
5
  nativeEvent: null,
4
6
  jumpConfig: {
5
7
  venderId: null,
6
8
  shopId: null,
7
9
  sourceValue: '',
8
10
  sourceType: 'App-H5',
9
11
  activityType: 'shopx',
10
12
  moduleId: 'none',
11
13
  entrance: 'none',
12
14
  },
13
15
  logPageParamStr: '',
14
16
  public logPageId: string
15
17
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
16
18
  constructor(opt = {}) {
17
19
  console.log('jdlite加载==========')
18
20
  super(opt)
19
21
  this.getConfig(opt)
20
22
  }
21
23
  tjOpenAppParams(openAppUrl): Object | boolean {
22
24
  let getParams: boolean | Object = false
23
25
  if (this.isOpenTjAppUrl(openAppUrl)) {
24
26
  try {
25
27
  getParams = openAppUrl.replace(
26
28
  /openApp\.jdlite:\/\/virtual\?params=/i,
27
29
  '',
28
30
  )
29
31
  getParams = JSON.parse(String(getParams))
30
32
  } catch (e) {
31
33
  console.log(e)
32
34
  }
33
35
  }
34
36
  return getParams
35
37
  }
36
38
  isOpenTjAppUrl(openAppUrl) {
37
39
  return /openApp\.jdlite:\/\/virtual\?params=/i.test(openAppUrl)
38
40
  }
39
41
 
40
42
  async jdJumpConfigUrl(detail, logEventInfo = {}) {
41
43
  const { configDataType, configDataValue } = detail
42
44
  console.log("测试tj app",detail)
43
45
  switch (configDataType) {
44
46
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
45
47
  this.jdJumpToProduct( configDataValue.skuIds, logEventInfo)
46
48
  break
47
49
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK: {
48
50
  const _url = configDataValue.linkUrl
49
51
  this.jdJumpToWeb(_url, logEventInfo)
50
52
  break
51
53
  }
52
54
  default:
53
55
  }
54
56
  }
55
57
 
56
58
  jdJumpToProduct(skuIds, logEventInfo) {
57
59
  skuIds = skuIds.toString().trim()
58
60
  const getSkuId = skuIds.indexOf(',') !== -1 ? skuIds.split(',')[0] : skuIds
59
61
  this.jdNavigateToNative({
60
62
  category: "jump",
61
63
  des: "productDetail",
62
64
  skuId: getSkuId,
63
65
  logEventInfo,
64
66
  })
65
67
  }
66
68
 
67
69
  jdJumpSkuInfoToProduct(skuInfo: any = {}, logEventInfo) {
68
70
  const getSkuId = skuInfo?.skuId;
69
71
  this.jdJumpToProduct(getSkuId, logEventInfo)
70
72
  }
71
73
 
72
74
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
73
75
  this.jdNavigateToNative(
74
76
  Object.assign(
75
77
  {},
76
78
  {
77
79
  category: "jump",
78
80
  des: "productList",
79
81
  from: "couponBatch",
80
82
  couponId: `${couponId}`,
81
83
  tip: "1",
82
84
  inlet: 0,
83
85
  quangoufrom: 2
84
86
  },
85
87
  logEventInfo,
86
88
  ),
87
89
  )
88
90
  }
89
91
 
90
92
  jdJumpToWeb(
91
93
  url,
92
94
  logEventInfo,
93
95
  successBack?: Function | undefined,
94
96
  failBack?: Function | undefined,
95
97
  ) {
96
98
  if (this.isOpenTjAppUrl(url)) {
97
99
  const getOpenAppParams = this.tjOpenAppParams(url)
98
100
  console.log(
99
101
  'tj web 获取自定义openApp链接解析后的参数结果',
100
102
  getOpenAppParams,
101
103
  )
102
104
  if (getOpenAppParams) {
103
105
  this.jdNavigateToNative(
104
106
  Object.assign({}, getOpenAppParams, {
105
107
  logEventInfo,
106
108
  }),
107
109
  )
108
110
  }
109
111
  } else {
110
112
  if(url.indexOf('tjshop') == -1) {
111
113
  url = url + this.getTjShopParam()
112
114
  }
113
115
  const changeUrl = /^\/\//.test(url) ? `https:${url}` : url
114
116
  this.jdNavigateToNative(
115
117
  {
116
118
  category: 'jump',
117
119
  des: 'm',
118
120
  url: changeUrl,
119
121
  logEventInfo,
120
122
  },
121
123
  OpenAppHost,
122
124
  successBack,
123
125
  failBack,
124
126
  )
125
127
  }
126
128
  }
127
129
  jdJumpToShopSearch(shopInfo) {
128
130
  const getInfo = Object.assign(
129
131
  {},
130
132
  {
131
133
  shopId: global.info.queryInfo.shopId,
132
134
  venderId: global.info.queryInfo.venderId,
133
135
  },
134
136
  shopInfo,
135
137
  )
136
138
  const { shopId, categoryId, keyword, pageId, description, shopName } =
137
139
  getInfo
138
140
  const cateId = categoryId ? `&cateId=${typeof categoryId === 'string' ? categoryId?.trim() : categoryId}` : ''
139
141
  const addKeyWord = keyword ? `&keyword=${keyword}` : ''
140
142
  const addPageId = pageId ? `&pageId=${pageId}` : ''
141
143
  const searchDes = description ? `&description=${description}` : ''
142
144
  const shopNameDes = shopName ? `&shopName=${shopName}` : ''
143
145
  const searchType = categoryId ? 5 : keyword ? 4 : 3
144
146
  super.jdNavigateToNative(
145
147
  `${this.jumpWebUrl.shopSearch}?shopId=${shopId}&searchType=${searchType}${cateId}${addKeyWord}${addPageId}${searchDes}${shopNameDes}`,
146
148
  getInfo,
147
149
  )
148
150
  }
149
151
 
150
152
  jdNavigateToNative(
151
153
  params,
152
154
  url = OpenAppHost,
153
155
  successBack?: Function | null,
154
156
  failBack?: Function | null,
155
157
  ) {
156
158
  console.log('tj web', params)
157
159
  const { logEventInfo , ...otherParams } = params
158
160
  console.log('tj web 获取open协议参数 jdNavigateToNative params: ',otherParams)
159
161
  console.log('logEventInfo params: ', logEventInfo)
160
162
  console.log('otherParams', otherParams)
161
163
  const paramsStr = JSON.stringify(otherParams)
162
164
  console.log('跳转web tj open协议', `${url}?params=${paramsStr}`)
163
165
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
164
166
  this.clickEventLog(logEventInfo || params)
165
167
  .then(() => {
166
168
  if (typeof successBack == 'function') {
167
169
  successBack(params)
168
170
  } else {
169
171
  try {
170
172
  const paramsStr = encodeURIComponent(JSON.stringify(otherParams))
171
173
  console.log(
172
174
  'success: 跳转web tj open协议',
173
175
  `${url}?params=${paramsStr}`,
174
176
  )
175
177
  window.location.href = `${url}?params=${paramsStr}`
176
178
  } catch (e) {
177
179
  console.log('跳转异常', e)
178
180
  }
179
181
  }
180
182
  })
181
183
  .catch((e) => {
182
184
  console.log('catch', e)
183
185
  typeof failBack == 'function' && failBack(params)
184
186
  })
185
187
  }
186
188
 
187
189
  clickEventLog(
188
190
  opts: JumpEventReportInterFace.OptEventLogParams = {},
189
191
  reportKey = 'click',
190
192
  ) {
191
193
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
192
194
  if (eventId && jsonParam) {
193
195
  const { etModelInfo, logBaseInfo } = jsonParam
194
196
  const webLogParams = {
195
197
  eid: eventId,
196
198
  elevel: eventLevel,
197
199
  eparam:JSON.stringify(logBaseInfo || jsonParam),
198
200
  jsonParam: JSON.stringify(logBaseInfo || jsonParam),
199
201
  etModel: JSON.stringify(etModelInfo || {}),
200
202
  pageId: this.logPageId,
201
203
  pageParam: this.logPageParamStr,
202
204
  ...otherParams,
203
205
  }
204
206
  return /click|exposure/.test(reportKey)
205
207
  ? reportClick(webLogParams)
206
208
  : reportToCart(opts,webLogParams)
207
209
  } else {
208
210
  console.log('暂无埋点参数eventId和eventParam')
209
211
  return Promise.resolve(false)
210
212
  }
211
213
  }
212
214
  getConfig(opt = {}) {
213
215
  return Object.assign(this, {}, defaultConfig, opt)
214
216
  }
@@ -0,0 +1 @@
1
+ import global from '../common';
2
  objectToUrlEncode,
1
3
  parseQueryUrlString,
2
4
  isTjScence,
3
5
  isTjM,
4
6
  isTjJxM,
5
7
  isH5AdnJxMini,
6
8
  tjChannel,
7
9
  public logPageId: string;
8
10
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
9
11
  constructor(opt) {
10
12
  super(opt);
11
13
  this.getConfig(opt);
12
14
  console.log('加载特价/京喜m的跳转js文件....');
13
15
  }
14
16
 
15
17
  getTjShopParam() {
16
18
  const { tjshop } = global.info.queryInfo;
17
19
  const tjshopParam = tjshop ? `&tjshop=${tjshop}` : '';
18
20
  const tjChannelStr = tjChannel ? `&tjChannel=${tjChannel}` : '';
19
21
  return `${tjshopParam}${tjChannelStr}`;
20
22
  }
21
23
 
22
24
  jdJumpToProduct(skuIds, logEventInfo) {
23
25
  skuIds = skuIds.toString().trim();
24
26
  const getSkuId = skuIds.indexOf(',') !== -1 ? skuIds.split(',')[0] : skuIds;
25
27
  const { jingxiSdx, ...otherLogInfo } = logEventInfo;
26
28
  let url = `${this.jumpWebUrl.detail}${getSkuId}.html`;
27
29
  if (isTjScence) {
28
30
  if (isTjM) {
29
31
  url = `${this.jumpWebUrl.tjDetail}?wareId=${getSkuId}`;
30
32
  } else if (isTjJxM) {
31
33
  const { _fd } = global.info.queryInfo;
32
34
  const fd = _fd ? `&_fd=${_fd}` : '';
33
35
  url = `${this.jumpWebUrl.jxDetail}?sku=${getSkuId}${fd}`;
34
36
  }
35
37
  }
36
38
  if (jingxiSdx) {
37
39
  this.jdNavigateToNative(`${url}?sdx=${jingxiSdx}`, otherLogInfo);
38
40
  } else {
39
41
  this.jdNavigateToNative(url, logEventInfo);
40
42
  }
41
43
  }
42
44
 
43
45
  jdJumpSkuInfoToProduct(skuInfo: any = {}, logEventInfo) {
44
46
  const getSkuId = skuInfo?.skuId;
45
47
  this.jdJumpToProduct(getSkuId, logEventInfo);
46
48
  }
47
49
 
48
50
  jdJumpToShopHome(shopInfo: JumpEventReportInterFace.ShopIdsInfo = {}) {
49
51
  const currentShopInfo = {
50
52
  shopId: global.info.queryInfo.shopId,
51
53
  venderId: global.info.queryInfo.venderId,
52
54
  };
53
55
  const restParams =
54
56
  (shopInfo?.shopId && shopInfo.shopId !== currentShopInfo.shopId) ||
55
57
  (shopInfo?.venderId && shopInfo.venderId !== currentShopInfo.venderId)
56
58
  ? {}
57
59
  : currentShopInfo;
58
60
  const getInfo = Object.assign({}, restParams, shopInfo);
59
61
  this.jdNavigateToNative(
60
62
  `${this.jumpWebUrl.mshop}?${objectToUrlEncode(
61
63
  this.getShopIdOrVenderIdParams(getInfo),
62
64
  )}${this.getTjShopParam()}`,
63
65
  {
64
66
  ...getInfo,
65
67
  },
66
68
  );
67
69
  }
68
70
 
69
71
  jdJumpToWeb(
70
72
  url,
71
73
  logEventInfo,
72
74
  successBack?: Function | undefined,
73
75
  failBack?: Function | undefined,
74
76
  ) {
75
77
  console.log('web.tjm.ts - jdJumpToWeb');
76
78
  if (url.indexOf('tjshop') == -1) {
77
79
  url = url + this.getTjShopParam();
78
80
  }
79
81
  this.jdNavigateToNative(
80
82
  url,
81
83
  {
82
84
  ...logEventInfo,
83
85
  },
84
86
  successBack,
85
87
  failBack,
86
88
  );
87
89
  }
88
90
 
89
91
  jdJumpConfigUrl(detail, logEventInfo = {}) {
90
92
  const { configDataType, configDataValue } = detail;
91
93
  console.log('jdJumpConfigUrl web.tj.base configDataType:', configDataType, configDataValue);
92
94
  switch (configDataType) {
93
95
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
94
96
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
95
97
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
96
98
  }
97
99
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
98
100
  break;
99
101
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
100
102
  this.jdJumpToWeb(
101
103
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
102
104
  {},
103
105
  );
104
106
  break;
105
107
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
106
108
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
107
109
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
108
110
  getShopSearchParams &&
109
111
  this.jdJumpToShopSearch(
110
112
  Object.assign({}, getShopSearchParams, {
111
113
  logEventInfo,
112
114
  }),
113
115
  );
114
116
  } else {
115
117
  this.jdJumpToShopSearch(
116
118
  configDataValue['cid']
117
119
  ? Object.assign(
118
120
  {},
119
121
  {
120
122
  shopId: global.info.queryInfo.shopId,
121
123
  categoryId: configDataValue.cid,
122
124
  ...configDataValue,
123
125
  logEventInfo,
124
126
  },
125
127
  )
126
128
  : {
127
129
  shopId: global.info.queryInfo.shopId,
128
130
  logEventInfo,
129
131
  },
130
132
  );
131
133
  }
132
134
  break;
133
135
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
134
136
  this.jdJumpToShopCategory({
135
137
  ...configDataValue,
136
138
  logEventInfo,
137
139
  });
138
140
  break;
139
141
  case LinkConfigType.CONFIG_TYPE_MEMBER:
140
142
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
141
143
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
142
144
  getShopMemberParams &&
143
145
  this.jdJumpToShopMember(
144
146
  Object.assign({}, getShopMemberParams, {
145
147
  logEventInfo,
146
148
  }),
147
149
  );
148
150
  } else {
149
151
  this.jdJumpToShopMember({
150
152
  shopId: global.info.queryInfo.shopId,
151
153
  venderId: configDataValue.shopDetail,
152
154
  logEventInfo,
153
155
  });
154
156
  }
155
157
  break;
156
158
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
157
159
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
158
160
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
159
161
  if (getShopActivityParams && getShopActivityParams['des'] == 'jshopActivity') {
160
162
  this.jdJumpToShopActivity({
161
163
  projectId: configDataValue['projectId'],
162
164
  configDataValue,
163
165
  logEventInfo,
164
166
  });
165
167
  }
166
168
  } else if (configDataValue['projectId']) {
167
169
  this.jdJumpToShopActivity({
168
170
  projectId: configDataValue['projectId'],
169
171
  configDataValue,
170
172
  logEventInfo,
171
173
  });
172
174
  }
173
175
  break;
174
176
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
175
177
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON:
176
178
  let _url = configDataValue.linkUrl;
177
179
  const isProductM = /item\.m\.jd\.com/.test(_url);
178
180
  const isProductPC = /item\.jd\.com/.test(_url);
179
181
  if (isTjScence) {
180
182
  const { appCode } = global.info.queryInfo;
181
183
 
182
184
  if (/(pro|prodev)\.jd\.com(\/mall\/)/.test(_url)) {
183
185
  if (isH5AdnJxMini) {
184
186
  _url =
185
187
  _url.replace(/([prodev]|[pro])(\.jd\.com)(\/mall)/, '$1.m$2/mini') +
186
188
  `appCode=${appCode}&wxAppName=jx`;
187
189
  } else {
188
190
  _url = _url.replace(/([prodev]|[pro])(\.jd\.com)(\/mall)/, '$1.m$2/jdlite');
189
191
  }
190
192
  } else if (/(pro|prodev)\.(m\.jd|jd)\.com(\/mall\/)/.test(_url)) {
191
193
  if (isH5AdnJxMini) {
192
194
  _url =
193
195
  _url.replace(/([prodev]|[pro])(\.m\.jd\.com)(\/mall)/, '$1$2/mini') +
194
196
  `appCode=${appCode}&wxAppName=jx`;
195
197
  } else {
196
198
  _url = _url.replace(/([prodev]|[pro])(\.m\.jd\.com)(\/mall)/, '$1$2/jdlite');
197
199
  }
198
200
  }
199
201
  }
200
202
  if (
201
203
  _url.indexOf('to=') === -1 &&
202
204
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
203
205
  ) {
204
206
  const _shopId = _url.match(/\d+/g)[0];
205
207
  this.jdJumpToShopHome({
206
208
  shopId: `${_shopId}`,
207
209
  logEventInfo,
208
210
  });
209
211
  } else if (this.isOpenJdAppUrl(_url)) {
210
212
  const getOpenAppParams: any = this.jdOpenAppParams(_url);
211
213
  if (getOpenAppParams) {
212
214
  if (getOpenAppParams.jumpTab == 'allProduct') {
213
215
  this.jdJumpToTabAllProduct(
214
216
  global.info.queryInfo.shopId,
215
217
  global.info.queryInfo.venderId,
216
218
  );
217
219
  } else if (
218
220
  getOpenAppParams.des == 'productList' &&
219
221
  getOpenAppParams.from == 'couponBatch'
220
222
  ) {
221
223
  this.jdJumpToCouponSearchProductList(getOpenAppParams?.couponId);
222
224
  } else if (getOpenAppParams.des == 'vapp') {
223
225
  this.jdJumpToWeb(
224
226
  `https://conecli.com/apps/mpshare/index.html?category=${
225
227
  getOpenAppParams.category
226
228
  }&des=${getOpenAppParams.des}&vapptype=${
227
229
  getOpenAppParams.vapptype
228
230
  }&appId=${getOpenAppParams.appId}&path=${
229
231
  getOpenAppParams.path
230
232
  }&param=${encodeURI(JSON.stringify(getOpenAppParams.param))}`,
231
233
  logEventInfo,
232
234
  );
233
235
  } else {
234
236
  this.jdNavigateToNative(
235
237
  '',
236
238
  Object.assign({}, getOpenAppParams, {
237
239
  logEventInfo,
238
240
  }),
239
241
  );
240
242
  }
241
243
  }
242
244
  } else if (isProductM || isProductPC) {
243
245
  const skuid = _url.match(/\d+/g)[0];
244
246
  if (skuid) {
245
247
  this.jdJumpToProduct(skuid, logEventInfo);
246
248
  }
247
249
  } else {
248
250
  this.jdJumpToWeb(_url, logEventInfo);
249
251
  }
250
252
  break;
251
253
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
252
254
  this.jdJumpToShopDetail({
253
255
  venderId: global.info.queryInfo.venderId,
254
256
  shopId: global.info.queryInfo.shopId,
255
257
  logEventInfo,
256
258
  });
257
259
  break;
258
260
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
259
261
  this.jdJumpToShopHome({
260
262
  ...configDataValue,
261
263
  logEventInfo,
262
264
  });
263
265
  break;
264
266
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
265
267
  break;
266
268
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
267
269
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
268
270
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
269
271
  getShoppingGuideParams &&
270
272
  this.jdJumpToShopActivity(
271
273
  Object.assign({}, getShoppingGuideParams, {
272
274
  logEventInfo,
273
275
  }),
274
276
  );
275
277
  }
276
278
  break;
277
279
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
278
280
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
279
281
  const search = linkUrl.match(/\?.+/);
280
282
  if (search) {
281
283
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
282
284
  parseQueryUrlString(linkUrl);
283
285
  try {
284
286
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
285
287
  } catch (e) {
286
288
  console.warn('解析小程序 param 错误:', miniQueryData.param);
287
289
  }
288
290
  this.jdJumpToMiniProgram(miniQueryData);
289
291
  } else {
290
292
  console.warn('小程序地址错误:', linkUrl);
291
293
  }
292
294
  break;
293
295
  }
294
296
  default:
295
297
  }
296
298
  }
297
299
 
298
300
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
299
301
  if (isTjM) return;
300
302
  let batchParam = isTjScence ? `coupon_batch=${couponId}` : `couponbatch=${couponId}`;
301
303
  this.jdJumpToWeb(`${this.jumpWebUrl.jxCouponSearch}?${batchParam}`, logEventInfo);
302
304
  }
303
305
 
304
306
  jdNavigateToNative(
305
307
  url: string,
306
308
  params: {
307
309
  logEventInfo?: object;
308
310
  } = {},
309
311
  successBack?: Function | undefined,
310
312
  failBack?: Function | undefined,
311
313
  ) {
312
314
  const { logEventInfo } = params;
313
315
  const getEparam = logEventInfo || params;
314
316
  if (url.indexOf('tjshop') == -1) {
315
317
  url = url + this.getTjShopParam();
316
318
  }
317
319
  console.log(`url:::::::${url}`);
318
320
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
319
321
  this.clickEventLog(getEparam)
320
322
  .then(() => {
321
323
  typeof successBack === 'function' ? successBack(url) : (window.location.href = url);
322
324
  })
323
325
  .catch(() => {
324
326
  typeof failBack === 'function' && failBack(url);
325
327
  });
326
328
  }