@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
@@ -1 +1 @@
1
- import { JdJumpJdApp } from './jdJumpJdApp'
2
1
  routerInfo: {
3
2
  params: {},
4
3
  },
5
4
  nativeEvent: null,
6
5
  jumpConfig: {
7
6
  venderId: null,
8
7
  shopId: null,
9
8
  sourceValue: '',
10
9
  sourceType: 'App-H5',
11
10
  activityType: 'shopx',
12
11
  moduleId: 'none',
13
12
  entrance: 'none',
14
13
  },
15
14
  logPageParamStr: '',
16
15
  public logPageId: string
17
16
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
18
17
  constructor(opt = {}) {
19
18
  console.log('jdb加载==========')
20
19
  super(opt)
21
20
  this.getConfig(opt)
22
21
  }
23
22
  jdbOpenAppParams(openAppUrl): Object | boolean {
24
23
  let getParams: boolean | Object = false
25
24
  if (this.isOpenJdbAppUrl(openAppUrl)) {
26
25
  try {
27
26
  getParams = openAppUrl.replace(
28
27
  /openApp\.jdbmall:\/\/virtual\?params=/i,
29
28
  '',
30
29
  )
31
30
  getParams = JSON.parse(String(getParams))
32
31
  } catch (e) {
33
32
  console.log(e)
34
33
  }
35
34
  }
36
35
  return getParams
37
36
  }
38
37
  isOpenJdbAppUrl(openAppUrl) {
39
38
  return /openApp\.jdbmall:\/\/virtual\?params=/i.test(openAppUrl)
40
39
  }
41
40
 
42
41
  async jdJumpConfigUrl(detail, logEventInfo = {}) {
43
42
  const { configDataType, configDataValue } = detail
44
43
  switch (configDataType) {
45
44
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
46
45
  this.jdJumpToProduct(
47
46
  {
48
47
  ...configDataValue,
49
48
  skuId: configDataValue.skuIds,
50
49
  skuUniformBizInfo: { buId: configDataValue.buId },
51
50
  },
52
51
  logEventInfo,
53
52
  )
54
53
  break
55
54
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK: {
56
55
  const _url = configDataValue.linkUrl
57
56
  if (this.isOpenJdbAppUrl(_url)) {
58
57
  const getOpenAppParams = this.jdbOpenAppParams(_url)
59
58
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams)
60
59
  if (getOpenAppParams) {
61
60
  this.jdNavigateToNative(
62
61
  Object.assign({}, getOpenAppParams, {
63
62
  logEventInfo,
64
63
  }),
65
64
  )
66
65
  }
67
66
  }
68
67
  break
69
68
  }
70
69
  default:
71
70
  }
72
71
  }
73
72
 
74
73
  jdJumpToProduct(skuParams, logEventInfo) {
75
74
  if (typeof skuParams !== 'object') {
76
75
  console.error('万商app跳转商品详情参数需要对象,详情请查看文档')
77
76
  return
78
77
  }
79
78
 
80
79
  let { skuId, bMallTag = '1', skuUniformBizInfo } = skuParams
81
80
  skuId = skuId.toString().trim()
82
81
  this.jdNavigateToNative({
83
82
  category: 'jump',
84
83
  des: 'skudetail',
85
84
  param: {
86
85
  skuId: skuId,
87
86
  bMallTag: bMallTag,
88
87
  skuUniformBizInfo,
89
88
  },
90
89
  logEventInfo,
91
90
  })
92
91
  }
93
92
 
94
93
  jdNavigateToNative(
95
94
  params: {},
96
95
  url = OpenAppHost,
97
96
  successBack?: Function | null,
98
97
  failBack?: Function | null,
99
98
  ) {
100
99
  console.log('jdb web', params)
101
100
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams =
102
101
  Object.assign(
103
102
  {},
104
103
  {
105
104
  param: {},
106
105
  },
107
106
  params,
108
107
  )
109
108
  const { logEventInfo, ...otherParams } = getResParams
110
109
  console.log(
111
110
  'jdb web 获取open协议参数 jdNavigateToNative params: ',
112
111
  otherParams,
113
112
  )
114
113
  console.log('logEventInfo params: ', logEventInfo)
115
114
  console.log('otherParams', otherParams)
116
115
  const paramsStr = JSON.stringify(otherParams)
117
116
  console.log('跳转web jdb open协议', `${url}?params=${paramsStr}`)
118
117
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
119
118
  this.clickEventLog(logEventInfo || getResParams)
120
119
  .then(() => {
121
120
  if (typeof successBack == 'function') {
122
121
  successBack(getResParams)
123
122
  } else {
124
123
  try {
125
124
  const paramsStr = JSON.stringify(otherParams)
126
125
  console.log(
127
126
  'success: 跳转web jdb open协议',
128
127
  `${url}?params=${paramsStr}`,
129
128
  )
130
129
  window.location.href = `${url}?params=${paramsStr}`
131
130
  } catch (e) {
132
131
  console.log('跳转异常', e)
133
132
  }
134
133
  }
135
134
  })
136
135
  .catch((e) => {
137
136
  console.log('catch', e)
138
137
  typeof failBack == 'function' && failBack(getResParams)
139
138
  })
140
139
  }
141
140
 
142
141
  clickEventLog(
143
142
  opts: JumpEventReportInterFace.OptEventLogParams = {},
144
143
  reportKey = 'click',
145
144
  ) {
146
145
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
147
146
  if (eventId && jsonParam) {
148
147
  const { etModelInfo, logBaseInfo } = jsonParam
149
148
  const webLogParams = {
150
149
  eid: eventId,
151
150
  elevel: eventLevel,
152
151
  eparam:JSON.stringify(logBaseInfo || jsonParam),
153
152
  jsonParam: JSON.stringify(logBaseInfo || jsonParam),
154
153
  etModel: JSON.stringify(etModelInfo || {}),
155
154
  pageId: this.logPageId,
156
155
  pageParam: this.logPageParamStr,
157
156
  ...otherParams,
158
157
  }
159
158
  return /click|exposure/.test(reportKey)
160
159
  ? reportClick(webLogParams)
161
160
  : reportToCart(opts)
162
161
  } else {
163
162
  console.log('暂无埋点参数eventId和eventParam')
164
163
  return Promise.resolve(false)
165
164
  }
166
165
  }
167
166
  getConfig(opt = {}) {
168
167
  return Object.assign(this, {}, defaultConfig, opt)
169
168
  }
169
+ import { JdJumpJdApp } from './jdJumpJdApp'
170
170
  routerInfo: {
171
171
  params: {},
172
172
  },
173
173
  nativeEvent: null,
174
174
  jumpConfig: {
175
175
  venderId: null,
176
176
  shopId: null,
177
177
  sourceValue: '',
178
178
  sourceType: 'App-H5',
179
179
  activityType: 'shopx',
180
180
  moduleId: 'none',
181
181
  entrance: 'none',
182
182
  },
183
183
  logPageParamStr: '',
184
184
  public logPageId: string
185
185
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
186
186
  constructor(opt = {}) {
187
187
  console.log('jdb加载==========')
188
188
  super(opt)
189
189
  this.getConfig(opt)
190
190
  }
191
191
  jdbOpenAppParams(openAppUrl): Object | boolean {
192
192
  let getParams: boolean | Object = false
193
193
  if (this.isOpenJdbAppUrl(openAppUrl)) {
194
194
  try {
195
195
  getParams = openAppUrl.replace(
196
196
  /openApp\.jdbmall:\/\/virtual\?params=/i,
197
197
  '',
198
198
  )
199
199
  getParams = JSON.parse(String(getParams))
200
200
  } catch (e) {
201
201
  console.log(e)
202
202
  }
203
203
  }
204
204
  return getParams
205
205
  }
206
206
  isOpenJdbAppUrl(openAppUrl) {
207
207
  return /openApp\.jdbmall:\/\/virtual\?params=/i.test(openAppUrl)
208
208
  }
209
209
 
210
210
  async jdJumpConfigUrl(detail, logEventInfo = {}) {
211
211
  const { configDataType, configDataValue } = detail
212
212
  switch (configDataType) {
213
213
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
214
214
  this.jdJumpToProduct(
215
215
  {
216
216
  ...configDataValue,
217
217
  skuId: configDataValue.skuIds,
218
218
  skuUniformBizInfo: { buId: configDataValue.buId },
219
219
  },
220
220
  logEventInfo,
221
221
  )
222
222
  break
223
223
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK: {
224
224
  const _url = configDataValue.linkUrl
225
225
  if (this.isOpenJdbAppUrl(_url)) {
226
226
  const getOpenAppParams = this.jdbOpenAppParams(_url)
227
227
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams)
228
228
  if (getOpenAppParams) {
229
229
  this.jdNavigateToNative(
230
230
  Object.assign({}, getOpenAppParams, {
231
231
  logEventInfo,
232
232
  }),
233
233
  )
234
234
  }
235
235
  }
236
236
  break
237
237
  }
238
238
  default:
239
239
  }
240
240
  }
241
241
 
242
242
  jdJumpToProduct(skuParams, logEventInfo) {
243
243
  if (typeof skuParams !== 'object') {
244
244
  console.error('万商app跳转商品详情参数需要对象,详情请查看文档')
245
245
  return
246
246
  }
247
247
 
248
248
  let { skuId, bMallTag = '1', skuUniformBizInfo } = skuParams
249
249
  skuId = skuId.toString().trim()
250
250
  this.jdNavigateToNative({
251
251
  category: 'jump',
252
252
  des: 'skudetail',
253
253
  param: {
254
254
  skuId: skuId,
255
255
  bMallTag: bMallTag,
256
256
  skuUniformBizInfo,
257
257
  },
258
258
  logEventInfo,
259
259
  })
260
260
  }
261
261
 
262
262
  jdJumpSkuInfoToProduct(skuInfo: any = {}, logEventInfo) {
263
263
  this.jdJumpToProduct(skuInfo, logEventInfo)
264
264
  }
265
265
 
266
266
  jdNavigateToNative(
267
267
  params: {},
268
268
  url = OpenAppHost,
269
269
  successBack?: Function | null,
270
270
  failBack?: Function | null,
271
271
  ) {
272
272
  console.log('jdb web', params)
273
273
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams =
274
274
  Object.assign(
275
275
  {},
276
276
  {
277
277
  param: {},
278
278
  },
279
279
  params,
280
280
  )
281
281
  const { logEventInfo, ...otherParams } = getResParams
282
282
  console.log(
283
283
  'jdb web 获取open协议参数 jdNavigateToNative params: ',
284
284
  otherParams,
285
285
  )
286
286
  console.log('logEventInfo params: ', logEventInfo)
287
287
  console.log('otherParams', otherParams)
288
288
  const paramsStr = JSON.stringify(otherParams)
289
289
  console.log('跳转web jdb open协议', `${url}?params=${paramsStr}`)
290
290
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
291
291
  this.clickEventLog(logEventInfo || getResParams)
292
292
  .then(() => {
293
293
  if (typeof successBack == 'function') {
294
294
  successBack(getResParams)
295
295
  } else {
296
296
  try {
297
297
  const paramsStr = JSON.stringify(otherParams)
298
298
  console.log(
299
299
  'success: 跳转web jdb open协议',
300
300
  `${url}?params=${paramsStr}`,
301
301
  )
302
302
  window.location.href = `${url}?params=${paramsStr}`
303
303
  } catch (e) {
304
304
  console.log('跳转异常', e)
305
305
  }
306
306
  }
307
307
  })
308
308
  .catch((e) => {
309
309
  console.log('catch', e)
310
310
  typeof failBack == 'function' && failBack(getResParams)
311
311
  })
312
312
  }
313
313
 
314
314
  clickEventLog(
315
315
  opts: JumpEventReportInterFace.OptEventLogParams = {},
316
316
  reportKey = 'click',
317
317
  ) {
318
318
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
319
319
  if (eventId && jsonParam) {
320
320
  const { etModelInfo, logBaseInfo } = jsonParam
321
321
  let getJsonParam = {}
322
322
  if (etModelInfo && logBaseInfo) {
323
323
  getJsonParam = logBaseInfo
324
324
  } else {
325
325
  if (Array.isArray(jsonParam)){
326
326
  getJsonParam = jsonParam
327
327
  } else {
328
328
  getJsonParam = Object.assign(
329
329
  {},
330
330
  {
331
331
  shopid: global.info.queryInfo?.shopId,
332
332
  },
333
333
  jsonParam,
334
334
  )
335
335
  }
336
336
  }
337
337
  const webLogParams = {
338
338
  eid: eventId,
339
339
  elevel: eventLevel,
340
340
  eparam:JSON.stringify(getJsonParam),
341
341
  jsonParam: JSON.stringify(getJsonParam),
342
342
  etModel: JSON.stringify(etModelInfo || {}),
343
343
  pageId: this.logPageId,
344
344
  pageParam: this.logPageParamStr,
345
345
  ...otherParams,
346
346
  }
347
347
  return /click|exposure/.test(reportKey)
348
348
  ? reportClick(webLogParams)
349
349
  : reportToCart(opts,webLogParams)
350
350
  } else {
351
351
  console.log('暂无埋点参数eventId和eventParam')
352
352
  return Promise.resolve(false)
353
353
  }
354
354
  }
355
355
  getConfig(opt = {}) {
356
356
  return Object.assign(this, {}, defaultConfig, opt)
357
357
  }
@@ -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
  }