@conecli/cone-render 0.8.19 → 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 (183) 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/isvStorage/index.h5.ts +1 -0
  11. package/dist/common/isvStorage/index.ts +1 -0
  12. package/dist/common/jdplayerSdk.ts +1 -0
  13. package/dist/common/jssdk.ts +1 -0
  14. package/dist/common/pageType.ts +1 -0
  15. package/dist/common/sgmCustomCode.ts +1 -0
  16. package/dist/common/token/const.ts +1 -0
  17. package/dist/common/token/index.h5.ts +1 -0
  18. package/dist/common/token/index.ts +1 -0
  19. package/dist/common/token/token.jd.ts +1 -0
  20. package/dist/common/token/token.ts +1 -0
  21. package/dist/common/token/token.wxapp.ts +1 -0
  22. package/dist/common/wxappApi.jd.ts +1 -0
  23. package/dist/common/wxappApi.ts +1 -1
  24. package/dist/components/ErrorBoundary.tsx +1 -1
  25. package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
  26. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  27. package/dist/components/base/CountDown/index.module.scss +49 -44
  28. package/dist/components/base/CountDown/index.tsx +1 -1
  29. package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
  30. package/dist/components/base/CustomScrollView/index.module.scss +7 -0
  31. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  32. package/dist/components/base/CustomVideo/common.ts +1 -0
  33. package/dist/components/base/CustomVideo/const.ts +1 -0
  34. package/dist/components/base/CustomVideo/index.module.scss +40 -64
  35. package/dist/components/base/CustomVideo/index.tsx +1 -1
  36. package/dist/components/base/Dialog/index.module.scss +22 -2
  37. package/dist/components/base/Dialog/index.tsx +1 -1
  38. package/dist/components/base/Exposure/index.h5.tsx +1 -1
  39. package/dist/components/base/ExposureSmart/const.ts +1 -0
  40. package/dist/components/base/ExposureSmart/index.h5.module.scss +30 -6
  41. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  42. package/dist/components/base/ExposureSmart/index.module.scss +20 -9
  43. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  44. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  45. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  46. package/dist/components/base/InViewRender/index.tsx +1 -1
  47. package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
  48. package/dist/components/base/ItemViewExposureSmart/index.module.scss +8 -0
  49. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -0
  50. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  51. package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
  52. package/dist/components/base/LazyLoadImage/const.ts +1 -1
  53. package/dist/components/base/LazyLoadImage/index.h5.module.scss +24 -20
  54. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  55. package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
  56. package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
  57. package/dist/components/base/NetworkDataError/const.ts +1 -1
  58. package/dist/components/base/NetworkDataError/index.module.scss +128 -69
  59. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  60. package/dist/components/base/Price/{const.ts → Base/const.ts} +0 -0
  61. package/dist/components/base/Price/Base/index.module.scss +148 -0
  62. package/dist/components/base/Price/Base/index.tsx +1 -0
  63. package/dist/components/base/Price/Double/index.module.scss +190 -0
  64. package/dist/components/base/Price/Double/index.tsx +1 -0
  65. package/dist/components/base/Price/index.tsx +1 -1
  66. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  67. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  68. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  69. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  70. package/dist/components/base/Skeleton/index.tsx +1 -1
  71. package/dist/components/debug/DebugLayout/index.module.scss +67 -0
  72. package/dist/components/debug/DebugLayout/index.tsx +1 -0
  73. package/dist/components/debug/DebugLayout/utils.ts +1 -0
  74. package/dist/components/decorate/DecorateFloorModule/index.module.scss +32 -2
  75. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  76. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  77. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  78. package/dist/components/floorItem.jd.tsx +1 -0
  79. package/dist/components/floorItem.tsx +1 -1
  80. package/dist/components/floorItem.weapp.tsx +1 -1
  81. package/dist/components/isv/Floor/index.tsx +1 -1
  82. package/dist/components/remoteFloorItem.tsx +1 -0
  83. package/dist/interface/common.ts +1 -1
  84. package/dist/interface/component.ts +1 -1
  85. package/dist/interface/jumpEventReport.ts +1 -1
  86. package/dist/interface/service.ts +1 -1
  87. package/dist/interface/utils.ts +1 -1
  88. package/dist/jumpEventReport/base.ts +1 -1
  89. package/dist/jumpEventReport/const.ts +1 -1
  90. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  91. package/dist/jumpEventReport/index.h5.ts +1 -1
  92. package/dist/jumpEventReport/index.jd.ts +1 -1
  93. package/dist/jumpEventReport/index.ts +1 -1
  94. package/dist/jumpEventReport/index.weapp.ts +1 -1
  95. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  96. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  97. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  98. package/dist/jumpEventReport/web/report.ts +1 -1
  99. package/dist/jumpEventReport/web.base.ts +1 -1
  100. package/dist/jumpEventReport/web.jd.ts +1 -1
  101. package/dist/jumpEventReport/web.jdb.ts +1 -0
  102. package/dist/jumpEventReport/web.jdjch.ts +1 -0
  103. package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
  104. package/dist/jumpEventReport/web.pc.ts +1 -0
  105. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  106. package/dist/jumpEventReport/web.tjm.ts +1 -0
  107. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  108. package/dist/language/en_US.json +231 -0
  109. package/dist/language/zh_CN.json +231 -0
  110. package/dist/language/zh_HK.json +231 -0
  111. package/dist/libs/taroAppReport.js +2 -2
  112. package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -27
  113. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  114. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  115. package/dist/open/api/device.ts +1 -1
  116. package/dist/open/api/environment.ts +1 -1
  117. package/dist/open/api/index.ts +1 -1
  118. package/dist/open/api/jump/business.ts +1 -0
  119. package/dist/open/api/jump/index.ts +1 -0
  120. package/dist/open/api/jump/minPath.ts +1 -0
  121. package/dist/open/api/jump/side.ts +1 -0
  122. package/dist/open/api/jump/webUrl.ts +1 -0
  123. package/dist/open/api/jump copy.ts +1 -0
  124. package/dist/open/api/moduleUtil.ts +1 -1
  125. package/dist/open/api/request.ts +1 -0
  126. package/dist/open/api/shopMember.ts +1 -0
  127. package/dist/open/api/track.ts +1 -1
  128. package/dist/open/api/userToken.ts +1 -0
  129. package/dist/open/api/util.ts +1 -1
  130. package/dist/open/components/index.ts +1 -1
  131. package/dist/sass/app.h5.scss +294 -212
  132. package/dist/sass/base.scss +195 -137
  133. package/dist/service/bMallConst.ts +1 -0
  134. package/dist/service/bMallConst.weapp.ts +1 -0
  135. package/dist/service/fetchGateway.ts +1 -0
  136. package/dist/service/fetchGateway.weapp.ts +1 -0
  137. package/dist/service/fetchJsonp.ts +1 -0
  138. package/dist/service/http/colorSign.ts +1 -0
  139. package/dist/service/http/colorSign.weapp.ts +1 -0
  140. package/dist/service/http/const.ts +1 -0
  141. package/dist/service/http/h5Http.ts +1 -0
  142. package/dist/service/http/http.ts +1 -0
  143. package/dist/service/http/httpInterceptors.jd.ts +1 -0
  144. package/dist/service/http/httpInterceptors.ts +1 -0
  145. package/dist/service/http/index.h5.ts +1 -0
  146. package/dist/service/http/index.ts +1 -0
  147. package/dist/service/requestServer.h5.ts +1 -0
  148. package/dist/service/requestServer.ts +1 -0
  149. package/dist/service/requestServer.weapp.ts +1 -0
  150. package/dist/utils/connectNativeJsBridge.ts +1 -1
  151. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  152. package/dist/utils/draExceptionAndProfile.ts +1 -1
  153. package/dist/utils/h5Utils.ts +1 -1
  154. package/dist/utils/index.h5.ts +1 -1
  155. package/dist/utils/index.ts +1 -1
  156. package/dist/utils/index.weapp.ts +1 -1
  157. package/dist/utils/intersectionObserver.ts +1 -1
  158. package/dist/utils/jm-common.js +1 -1
  159. package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
  160. package/dist/utils/jumpExtMapUtil.ts +1 -0
  161. package/dist/utils/priceUtils.js +1 -0
  162. package/dist/utils/ready.ts +1 -0
  163. package/dist/utils/sColor.js +1 -0
  164. package/dist/utils/sgmCodeUtils.ts +1 -0
  165. package/dist/utils/taroRenderUtil.ts +1 -0
  166. package/dist/utils/utils.ts +1 -1
  167. package/dist/wxapp/api/helper.js +1 -0
  168. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  169. package/dist/wxapp/common/user_info.js +1 -1
  170. package/dist/wxapp/components/launch-app/index.js +1 -0
  171. package/dist/wxapp/components/launch-app/index.json +5 -0
  172. package/dist/wxapp/components/launch-app/index.wxml +0 -0
  173. package/dist/wxapp/components/launch-app/index.wxss +0 -0
  174. package/dist/wxapp/components/subscribe-guider/helper.js +1 -0
  175. package/dist/wxapp/components/subscribe-guider/index.js +1 -0
  176. package/dist/wxapp/components/subscribe-guider/index.json +5 -0
  177. package/dist/wxapp/components/subscribe-guider/index.wxml +0 -0
  178. package/dist/wxapp/components/subscribe-guider/index.wxss +0 -0
  179. package/package.json +145 -114
  180. package/dist/components/base/Price/index.module.scss +0 -136
  181. package/dist/components/base/Skeleton/old.tsx +0 -1
  182. package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
  183. package/dist/open/api/jump.ts +0 -1
@@ -0,0 +1 @@
1
+ import {JdJumpJdApp} from './jdJumpJdApp'
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('jdb加载==========')
18
20
  super(opt)
19
21
  this.getConfig(opt)
20
22
  }
21
23
  jdbOpenAppParams(openAppUrl): Object | boolean {
22
24
  let getParams: boolean | Object = false
23
25
  if (this.isOpenJdbAppUrl(openAppUrl)) {
24
26
  try {
25
27
  getParams = openAppUrl.replace(
26
28
  /openApp\.jdbmall:\/\/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
  isOpenJdbAppUrl(openAppUrl) {
37
39
  return /openApp\.jdbmall:\/\/virtual\?params=/i.test(openAppUrl)
38
40
  }
39
41
 
40
42
  async jdJumpConfigUrl(detail, logEventInfo = {}) {
41
43
  const {configDataType, configDataValue} = detail
42
44
  switch (configDataType) {
43
45
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
44
46
  this.jdJumpToProduct(
45
47
  {
46
48
  ...configDataValue,
47
49
  skuId: configDataValue.skuIds,
48
50
  skuUniformBizInfo: {buId: configDataValue.buId},
49
51
  },
50
52
  logEventInfo,
51
53
  )
52
54
  break
53
55
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK: {
54
56
  const _url = configDataValue.linkUrl
55
57
  if (this.isOpenJdbAppUrl(_url)) {
56
58
  const getOpenAppParams = this.jdbOpenAppParams(_url)
57
59
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams)
58
60
  if (getOpenAppParams) {
59
61
  this.jdNavigateToNative(
60
62
  Object.assign({}, getOpenAppParams, {
61
63
  logEventInfo,
62
64
  }),
63
65
  )
64
66
  }
65
67
  } else {
66
68
  const win = window.parent !== window ? window.parent : window;
67
69
  win.location.href = _url
68
70
  }
69
71
  break
70
72
  }
71
73
  default:
72
74
  }
73
75
  }
74
76
 
75
77
  jdJumpToProduct(skuParams, logEventInfo) {
76
78
  if (typeof skuParams !== 'object') {
77
79
  console.error('万商app跳转商品详情参数需要对象,详情请查看文档')
78
80
  return
79
81
  }
80
82
 
81
83
  let {skuId, bMallTag = '1', skuUniformBizInfo} = skuParams
82
84
  skuId = skuId.toString().trim()
83
85
  let url = 'https://b2b.m.jd'
84
86
  url = url + `.com/goods-detail/#/pages/index/index?skuId=${skuId}&bMallTag=${bMallTag}&skuSourceInfo=${encodeURIComponent(JSON.stringify(skuUniformBizInfo))}`
85
87
  if(/jdjchshopapp/i.test(navigator.userAgent)) {
86
88
  const {browser} = window['@jd/jdb-jssdk-b2b'] || {}
87
89
  if (browser) {
88
90
  browser.openPage({
89
91
  url,
90
92
  })
91
93
  }
92
94
  }else {
93
95
  const win = window.parent !== window ? window.parent : window;
94
96
  win.location.href = url
95
97
  }
96
98
  }
97
99
 
98
100
  jdJumpSkuInfoToProduct(skuInfo: any = {}, logEventInfo) {
99
101
  this.jdJumpToProduct(skuInfo, logEventInfo)
100
102
  }
101
103
 
102
104
  jdNavigateToNative(
103
105
  params: {},
104
106
  url = OpenAppHost,
105
107
  successBack?: Function | null,
106
108
  failBack?: Function | null,
107
109
  ) {
108
110
  console.log('jdb web', params)
109
111
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams =
110
112
  Object.assign(
111
113
  {},
112
114
  {
113
115
  param: {},
114
116
  },
115
117
  params,
116
118
  )
117
119
  const {logEventInfo, ...otherParams} = getResParams
118
120
  console.log(
119
121
  'jdb web 获取open协议参数 jdNavigateToNative params: ',
120
122
  otherParams,
121
123
  )
122
124
  console.log('logEventInfo params: ', logEventInfo)
123
125
  console.log('otherParams', otherParams)
124
126
  const paramsStr = JSON.stringify(otherParams)
125
127
  console.log('跳转web jdb open协议', `${url}?params=${paramsStr}`)
126
128
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
127
129
  this.clickEventLog(logEventInfo || getResParams)
128
130
  .then(() => {
129
131
  if (typeof successBack == 'function') {
130
132
  successBack(getResParams)
131
133
  } else {
132
134
  try {
133
135
  const paramsStr = JSON.stringify(otherParams)
134
136
  console.log(
135
137
  'success: 跳转web jdb open协议',
136
138
  `${url}?params=${paramsStr}`,
137
139
  )
138
140
  window.location.href = `${url}?params=${paramsStr}`
139
141
  } catch (e) {
140
142
  console.log('跳转异常', e)
141
143
  }
142
144
  }
143
145
  })
144
146
  .catch((e) => {
145
147
  console.log('catch', e)
146
148
  typeof failBack == 'function' && failBack(getResParams)
147
149
  })
148
150
  }
149
151
 
150
152
  clickEventLog(
151
153
  opts: JumpEventReportInterFace.OptEventLogParams = {},
152
154
  reportKey = 'click',
153
155
  ) {
154
156
  const {eventId, jsonParam, eventLevel = 3, ...otherParams} = opts
155
157
  if (eventId && jsonParam) {
156
158
  const {etModelInfo, logBaseInfo} = jsonParam
157
159
  let getJsonParam = {}
158
160
  if (etModelInfo && logBaseInfo) {
159
161
  getJsonParam = logBaseInfo
160
162
  } else {
161
163
  if (Array.isArray(jsonParam)){
162
164
  getJsonParam = jsonParam
163
165
  } else {
164
166
  getJsonParam = Object.assign(
165
167
  {},
166
168
  {
167
169
  shopid: global.info.queryInfo?.shopId,
168
170
  },
169
171
  jsonParam,
170
172
  )
171
173
  }
172
174
  }
173
175
  const webLogParams = {
174
176
  eid: eventId,
175
177
  elevel: eventLevel,
176
178
  eparam: JSON.stringify(getJsonParam),
177
179
  jsonParam: JSON.stringify(getJsonParam),
178
180
  etModel: JSON.stringify(etModelInfo || {}),
179
181
  pageId: this.logPageId,
180
182
  pageParam: this.logPageParamStr,
181
183
  ...otherParams,
182
184
  }
183
185
  return /click|exposure/.test(reportKey)
184
186
  ? reportClick(webLogParams)
185
187
  : reportToCart(opts, webLogParams)
186
188
  } else {
187
189
  console.log('暂无埋点参数eventId和eventParam')
188
190
  return Promise.resolve(false)
189
191
  }
190
192
  }
191
193
  getConfig(opt = {}) {
192
194
  return Object.assign(this, {}, defaultConfig, opt)
193
195
  }
@@ -0,0 +1 @@
1
+ import global from '../common'
2
  isH5AdnJxMini,
1
3
  public jingXiMiniState: boolean
2
4
  constructor(opt) {
3
5
  super(opt)
4
6
  this.jingXiMiniState = false
5
7
  this.getConfig(opt)
6
8
  console.log(
7
9
  'window.shopGlobalSwitch:',
8
10
  JSON.stringify(window.shopGlobalSwitch),
9
11
  )
10
12
  this.init()
11
13
  }
12
14
  getConfig(opt) {
13
15
  return Object.assign(this, {}, defaultConfig, super.getConfig(opt), opt)
14
16
  }
15
17
 
16
18
  async init() {
17
19
  if (window.isJingxiMiniViewState) {
18
20
  this.jingXiMiniState = true
19
21
  global.info.isJingxiMiniViewState = true
20
22
  } else {
21
23
  console.log(
22
24
  '初始化进行小程序环境检查, 当前是否是京喜小程序',
23
25
  isH5AdnJxMini
24
26
  )
25
27
  if (isH5AdnJxMini) {
26
28
  console.log('进入了 isH5AdnJxMini 的 else if')
27
29
  this.jingXiMiniState = true
28
30
  global.info.isJingxiMiniViewState = true
29
31
  window.isJingxiMiniViewState = true
30
32
  } else {
31
33
  console.log('进入了 this.isH5OpenToWxapp 的esle')
32
34
  }
33
35
  }
34
36
  }
35
37
 
36
38
  jdJumpToMiniPage(pageUrl, logEventInfo, type = 'navigateTo') {
37
39
  this.jdNavigateToNative(
38
40
  pageUrl,
39
41
  logEventInfo,
40
42
  () => {
41
43
  console.log('JD.wxappext.goto',pageUrl)
42
44
  wx?.miniProgram[type] &&
43
45
  wx?.miniProgram[type]({
44
46
  url: pageUrl,
45
47
  })
46
48
  },
47
49
  () => {
48
50
  console.log('JD.wxappext.goto2')
49
51
  wx?.miniProgram[type] &&
50
52
  wx?.miniProgram[type]({
51
53
  url: pageUrl,
52
54
  })
53
55
  },
54
56
  )
55
57
  }
56
58
 
57
59
  jdJumpToWebInner(url, logEventInfo) {
58
60
  super.jdJumpToWeb(url, logEventInfo)
59
61
  }
60
62
 
61
63
  jdJumpToProduct(skuIds, logEventInfo) {
62
64
  if (this.jingXiMiniState) {
63
65
  const detailUrl = `${this.jumpMiniPath.jxDetail}?sku=${skuIds}`
64
66
  this.jdJumpToMiniPage(detailUrl, logEventInfo)
65
67
  } else {
66
68
  super.jdJumpToProduct(skuIds, logEventInfo)
67
69
  }
68
70
  }
69
71
 
70
72
  jdJumpSkuInfoToProduct(skuInfo: any = {}, logEventInfo) {
71
73
  const getSkuId = skuInfo?.skuId;
72
74
  this.jdJumpToProduct(getSkuId, logEventInfo)
73
75
  }
74
76
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
75
77
  if (this.jingXiMiniState) {
76
78
  const batchParam = `coupon_batch=${couponId}`
77
79
  const detailUrl = `${this.jumpMiniPath.jxCouponSearch}?${batchParam}`
78
80
  this.jdJumpToMiniPage(detailUrl, logEventInfo)
79
81
  } else {
80
82
  super.jdJumpToCouponSearchProductList(couponId, logEventInfo)
81
83
  }
82
84
  }
@@ -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
  }