@conecli/cone-render 0.9.1-shop2.3 → 0.9.1-shop2.30

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 (113) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/assets/icon_blue_info.svg +1 -0
  3. package/dist/common/const.ts +1 -1
  4. package/dist/common/environmentType.ts +1 -0
  5. package/dist/common/index.h5.ts +1 -1
  6. package/dist/common/index.jd.ts +1 -1
  7. package/dist/common/index.ts +1 -1
  8. package/dist/common/index.weapp.ts +1 -1
  9. package/dist/common/jdplayerSdk.ts +1 -0
  10. package/dist/common/jssdk.ts +1 -0
  11. package/dist/common/pageType.ts +1 -0
  12. package/dist/common/sgmCustomCode.ts +1 -0
  13. package/dist/common/token/index.h5.ts +1 -1
  14. package/dist/common/token/token.jd.ts +1 -1
  15. package/dist/common/token/token.ts +1 -1
  16. package/dist/common/wxappApi.jd.ts +1 -0
  17. package/dist/components/ErrorBoundary.tsx +1 -1
  18. package/dist/components/base/CountDown/index.tsx +1 -1
  19. package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
  20. package/dist/components/base/CustomScrollView/index.module.scss +7 -0
  21. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  22. package/dist/components/base/CustomVideo/common.ts +1 -0
  23. package/dist/components/base/CustomVideo/index.tsx +1 -1
  24. package/dist/components/base/Dialog/index.module.scss +5 -0
  25. package/dist/components/base/Dialog/index.tsx +1 -1
  26. package/dist/components/base/Exposure/index.h5.tsx +1 -1
  27. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  28. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  29. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  30. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  31. package/dist/components/base/InViewRender/index.tsx +1 -1
  32. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  33. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  34. package/dist/components/base/LazyLoadImage/const.ts +1 -1
  35. package/dist/components/base/LazyLoadImage/index.h5.module.scss +23 -20
  36. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  37. package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
  38. package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
  39. package/dist/components/base/NetworkDataError/const.ts +1 -1
  40. package/dist/components/base/NetworkDataError/index.module.scss +7 -0
  41. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  42. package/dist/components/base/Price/Base/index.tsx +1 -1
  43. package/dist/components/base/Price/Double/index.tsx +1 -1
  44. package/dist/components/base/Price/index.tsx +1 -1
  45. package/dist/components/debug/DebugLayout/index.module.scss +67 -0
  46. package/dist/components/debug/DebugLayout/index.tsx +1 -0
  47. package/dist/components/debug/DebugLayout/utils.ts +1 -0
  48. package/dist/components/decorate/DecorateFloorModule/index.module.scss +32 -2
  49. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  50. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  51. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  52. package/dist/components/floorItem.jd.tsx +1 -1
  53. package/dist/components/floorItem.tsx +1 -1
  54. package/dist/components/floorItem.weapp.tsx +1 -1
  55. package/dist/components/isv/Floor/index.tsx +1 -1
  56. package/dist/components/remoteFloorItem.tsx +1 -1
  57. package/dist/interface/common.ts +1 -1
  58. package/dist/interface/component.ts +1 -1
  59. package/dist/interface/jumpEventReport.ts +1 -1
  60. package/dist/interface/service.ts +1 -1
  61. package/dist/interface/utils.ts +1 -1
  62. package/dist/jumpEventReport/base.ts +1 -1
  63. package/dist/jumpEventReport/const.ts +1 -1
  64. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  65. package/dist/jumpEventReport/index.h5.ts +1 -1
  66. package/dist/jumpEventReport/index.jd.ts +1 -1
  67. package/dist/jumpEventReport/index.weapp.ts +1 -1
  68. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  69. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  70. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  71. package/dist/jumpEventReport/web/report.ts +1 -1
  72. package/dist/jumpEventReport/web.base.ts +1 -1
  73. package/dist/jumpEventReport/web.jd.ts +1 -1
  74. package/dist/jumpEventReport/web.jdb.ts +1 -1
  75. package/dist/jumpEventReport/web.jdjch.ts +1 -1
  76. package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
  77. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  78. package/dist/jumpEventReport/web.tjm.ts +1 -0
  79. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  80. package/dist/modules/ContainerFloorList/index.h5.module.scss +18 -1
  81. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  82. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  83. package/dist/open/api/device.ts +1 -1
  84. package/dist/open/api/environment.ts +1 -1
  85. package/dist/open/api/index.ts +1 -1
  86. package/dist/open/api/jump copy.ts +1 -1
  87. package/dist/open/api/request.ts +1 -1
  88. package/dist/open/api/shopMember.ts +1 -1
  89. package/dist/open/api/track.ts +1 -1
  90. package/dist/open/api/util.ts +1 -1
  91. package/dist/open/components/index.ts +1 -1
  92. package/dist/sass/app.h5.scss +49 -3
  93. package/dist/sass/base.scss +57 -0
  94. package/dist/service/fetchGateway.ts +1 -1
  95. package/dist/service/http/colorSign.ts +1 -1
  96. package/dist/service/http/const.ts +1 -1
  97. package/dist/service/http/h5Http.ts +1 -0
  98. package/dist/service/http/index.h5.ts +1 -0
  99. package/dist/service/requestServer.h5.ts +1 -0
  100. package/dist/service/requestServer.ts +1 -1
  101. package/dist/utils/connectNativeJsBridge.ts +1 -1
  102. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  103. package/dist/utils/draExceptionAndProfile.ts +1 -1
  104. package/dist/utils/h5Utils.ts +1 -1
  105. package/dist/utils/index.h5.ts +1 -1
  106. package/dist/utils/index.ts +1 -1
  107. package/dist/utils/index.weapp.ts +1 -1
  108. package/dist/utils/jm-common.js +1 -1
  109. package/dist/utils/sgmCodeUtils.ts +1 -0
  110. package/dist/utils/taroRenderUtil.ts +1 -1
  111. package/dist/utils/utils.ts +1 -1
  112. package/package.json +1 -1
  113. package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
@@ -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
  } else {
68
67
  const win = window.parent !== window ? window.parent : window;
69
68
  win.location.href = _url
70
69
  }
71
70
  break
72
71
  }
73
72
  default:
74
73
  }
75
74
  }
76
75
 
77
76
  jdJumpToProduct(skuParams, logEventInfo) {
78
77
  if (typeof skuParams !== 'object') {
79
78
  console.error('万商app跳转商品详情参数需要对象,详情请查看文档')
80
79
  return
81
80
  }
82
81
 
83
82
  let {skuId, bMallTag = '1', skuUniformBizInfo} = skuParams
84
83
  skuId = skuId.toString().trim()
85
84
  let url = 'https://b2b.m.jd'
86
85
  url = url + `.com/goods-detail/#/pages/index/index?skuId=${skuId}&bMallTag=${bMallTag}&skuSourceInfo=${encodeURIComponent(JSON.stringify(skuUniformBizInfo))}`
87
86
  if(/jdjchshopapp/i.test(navigator.userAgent)) {
88
87
  const {browser} = window['@jd/jdb-jssdk-b2b'] || {}
89
88
  if (browser) {
90
89
  browser.openPage({
91
90
  url,
92
91
  })
93
92
  }
94
93
  }else {
95
94
  const win = window.parent !== window ? window.parent : window;
96
95
  win.location.href = url
97
96
  }
98
97
  }
99
98
 
100
99
  jdNavigateToNative(
101
100
  params: {},
102
101
  url = OpenAppHost,
103
102
  successBack?: Function | null,
104
103
  failBack?: Function | null,
105
104
  ) {
106
105
  console.log('jdb web', params)
107
106
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams =
108
107
  Object.assign(
109
108
  {},
110
109
  {
111
110
  param: {},
112
111
  },
113
112
  params,
114
113
  )
115
114
  const {logEventInfo, ...otherParams} = getResParams
116
115
  console.log(
117
116
  'jdb web 获取open协议参数 jdNavigateToNative params: ',
118
117
  otherParams,
119
118
  )
120
119
  console.log('logEventInfo params: ', logEventInfo)
121
120
  console.log('otherParams', otherParams)
122
121
  const paramsStr = JSON.stringify(otherParams)
123
122
  console.log('跳转web jdb open协议', `${url}?params=${paramsStr}`)
124
123
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
125
124
  this.clickEventLog(logEventInfo || getResParams)
126
125
  .then(() => {
127
126
  if (typeof successBack == 'function') {
128
127
  successBack(getResParams)
129
128
  } else {
130
129
  try {
131
130
  const paramsStr = JSON.stringify(otherParams)
132
131
  console.log(
133
132
  'success: 跳转web jdb open协议',
134
133
  `${url}?params=${paramsStr}`,
135
134
  )
136
135
  window.location.href = `${url}?params=${paramsStr}`
137
136
  } catch (e) {
138
137
  console.log('跳转异常', e)
139
138
  }
140
139
  }
141
140
  })
142
141
  .catch((e) => {
143
142
  console.log('catch', e)
144
143
  typeof failBack == 'function' && failBack(getResParams)
145
144
  })
146
145
  }
147
146
 
148
147
  clickEventLog(
149
148
  opts: JumpEventReportInterFace.OptEventLogParams = {},
150
149
  reportKey = 'click',
151
150
  ) {
152
151
  const {eventId, jsonParam, eventLevel = 3, ...otherParams} = opts
153
152
  if (eventId && jsonParam) {
154
153
  const {etModelInfo, logBaseInfo} = jsonParam
155
154
  const webLogParams = {
156
155
  eid: eventId,
157
156
  elevel: eventLevel,
158
157
  eparam: JSON.stringify(logBaseInfo || jsonParam),
159
158
  jsonParam: JSON.stringify(logBaseInfo || jsonParam),
160
159
  etModel: JSON.stringify(etModelInfo || {}),
161
160
  pageId: this.logPageId,
162
161
  pageParam: this.logPageParamStr,
163
162
  ...otherParams,
164
163
  }
165
164
  return /click|exposure/.test(reportKey)
166
165
  ? reportClick(webLogParams)
167
166
  : reportToCart(opts)
168
167
  } else {
169
168
  console.log('暂无埋点参数eventId和eventParam')
170
169
  return Promise.resolve(false)
171
170
  }
172
171
  }
173
172
  getConfig(opt = {}) {
174
173
  return Object.assign(this, {}, defaultConfig, opt)
175
174
  }
175
+ import {JdJumpJdApp} from './jdJumpJdApp'
176
176
  routerInfo: {
177
177
  params: {},
178
178
  },
179
179
  nativeEvent: null,
180
180
  jumpConfig: {
181
181
  venderId: null,
182
182
  shopId: null,
183
183
  sourceValue: '',
184
184
  sourceType: 'App-H5',
185
185
  activityType: 'shopx',
186
186
  moduleId: 'none',
187
187
  entrance: 'none',
188
188
  },
189
189
  logPageParamStr: '',
190
190
  public logPageId: string
191
191
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
192
192
  constructor(opt = {}) {
193
193
  console.log('jdb加载==========')
194
194
  super(opt)
195
195
  this.getConfig(opt)
196
196
  }
197
197
  jdbOpenAppParams(openAppUrl): Object | boolean {
198
198
  let getParams: boolean | Object = false
199
199
  if (this.isOpenJdbAppUrl(openAppUrl)) {
200
200
  try {
201
201
  getParams = openAppUrl.replace(
202
202
  /openApp\.jdbmall:\/\/virtual\?params=/i,
203
203
  '',
204
204
  )
205
205
  getParams = JSON.parse(String(getParams))
206
206
  } catch (e) {
207
207
  console.log(e)
208
208
  }
209
209
  }
210
210
  return getParams
211
211
  }
212
212
  isOpenJdbAppUrl(openAppUrl) {
213
213
  return /openApp\.jdbmall:\/\/virtual\?params=/i.test(openAppUrl)
214
214
  }
215
215
 
216
216
  async jdJumpConfigUrl(detail, logEventInfo = {}) {
217
217
  const {configDataType, configDataValue} = detail
218
218
  switch (configDataType) {
219
219
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
220
220
  this.jdJumpToProduct(
221
221
  {
222
222
  ...configDataValue,
223
223
  skuId: configDataValue.skuIds,
224
224
  skuUniformBizInfo: {buId: configDataValue.buId},
225
225
  },
226
226
  logEventInfo,
227
227
  )
228
228
  break
229
229
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK: {
230
230
  const _url = configDataValue.linkUrl
231
231
  if (this.isOpenJdbAppUrl(_url)) {
232
232
  const getOpenAppParams = this.jdbOpenAppParams(_url)
233
233
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams)
234
234
  if (getOpenAppParams) {
235
235
  this.jdNavigateToNative(
236
236
  Object.assign({}, getOpenAppParams, {
237
237
  logEventInfo,
238
238
  }),
239
239
  )
240
240
  }
241
241
  } else {
242
242
  const win = window.parent !== window ? window.parent : window;
243
243
  win.location.href = _url
244
244
  }
245
245
  break
246
246
  }
247
247
  default:
248
248
  }
249
249
  }
250
250
 
251
251
  jdJumpToProduct(skuParams, logEventInfo) {
252
252
  if (typeof skuParams !== 'object') {
253
253
  console.error('万商app跳转商品详情参数需要对象,详情请查看文档')
254
254
  return
255
255
  }
256
256
 
257
257
  let {skuId, bMallTag = '1', skuUniformBizInfo} = skuParams
258
258
  skuId = skuId.toString().trim()
259
259
  let url = 'https://b2b.m.jd'
260
260
  url = url + `.com/goods-detail/#/pages/index/index?skuId=${skuId}&bMallTag=${bMallTag}&skuSourceInfo=${encodeURIComponent(JSON.stringify(skuUniformBizInfo))}`
261
261
  if(/jdjchshopapp/i.test(navigator.userAgent)) {
262
262
  const {browser} = window['@jd/jdb-jssdk-b2b'] || {}
263
263
  if (browser) {
264
264
  browser.openPage({
265
265
  url,
266
266
  })
267
267
  }
268
268
  }else {
269
269
  const win = window.parent !== window ? window.parent : window;
270
270
  win.location.href = url
271
271
  }
272
272
  }
273
273
 
274
274
  jdNavigateToNative(
275
275
  params: {},
276
276
  url = OpenAppHost,
277
277
  successBack?: Function | null,
278
278
  failBack?: Function | null,
279
279
  ) {
280
280
  console.log('jdb web', params)
281
281
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams =
282
282
  Object.assign(
283
283
  {},
284
284
  {
285
285
  param: {},
286
286
  },
287
287
  params,
288
288
  )
289
289
  const {logEventInfo, ...otherParams} = getResParams
290
290
  console.log(
291
291
  'jdb web 获取open协议参数 jdNavigateToNative params: ',
292
292
  otherParams,
293
293
  )
294
294
  console.log('logEventInfo params: ', logEventInfo)
295
295
  console.log('otherParams', otherParams)
296
296
  const paramsStr = JSON.stringify(otherParams)
297
297
  console.log('跳转web jdb open协议', `${url}?params=${paramsStr}`)
298
298
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
299
299
  this.clickEventLog(logEventInfo || getResParams)
300
300
  .then(() => {
301
301
  if (typeof successBack == 'function') {
302
302
  successBack(getResParams)
303
303
  } else {
304
304
  try {
305
305
  const paramsStr = JSON.stringify(otherParams)
306
306
  console.log(
307
307
  'success: 跳转web jdb open协议',
308
308
  `${url}?params=${paramsStr}`,
309
309
  )
310
310
  window.location.href = `${url}?params=${paramsStr}`
311
311
  } catch (e) {
312
312
  console.log('跳转异常', e)
313
313
  }
314
314
  }
315
315
  })
316
316
  .catch((e) => {
317
317
  console.log('catch', e)
318
318
  typeof failBack == 'function' && failBack(getResParams)
319
319
  })
320
320
  }
321
321
 
322
322
  clickEventLog(
323
323
  opts: JumpEventReportInterFace.OptEventLogParams = {},
324
324
  reportKey = 'click',
325
325
  ) {
326
326
  const {eventId, jsonParam, eventLevel = 3, ...otherParams} = opts
327
327
  if (eventId && jsonParam) {
328
328
  const {etModelInfo, logBaseInfo} = jsonParam
329
329
  let getJsonParam = {}
330
330
  if (etModelInfo && logBaseInfo) {
331
331
  getJsonParam = logBaseInfo
332
332
  } else {
333
333
  if (Array.isArray(jsonParam)){
334
334
  getJsonParam = jsonParam
335
335
  } else {
336
336
  getJsonParam = Object.assign(
337
337
  {},
338
338
  {
339
339
  shopid: global.info.queryInfo?.shopId,
340
340
  },
341
341
  jsonParam,
342
342
  )
343
343
  }
344
344
  }
345
345
  const webLogParams = {
346
346
  eid: eventId,
347
347
  elevel: eventLevel,
348
348
  eparam: JSON.stringify(getJsonParam),
349
349
  jsonParam: JSON.stringify(getJsonParam),
350
350
  etModel: JSON.stringify(etModelInfo || {}),
351
351
  pageId: this.logPageId,
352
352
  pageParam: this.logPageParamStr,
353
353
  ...otherParams,
354
354
  }
355
355
  return /click|exposure/.test(reportKey)
356
356
  ? reportClick(webLogParams)
357
357
  : reportToCart(opts, webLogParams)
358
358
  } else {
359
359
  console.log('暂无埋点参数eventId和eventParam')
360
360
  return Promise.resolve(false)
361
361
  }
362
362
  }
363
363
  getConfig(opt = {}) {
364
364
  return Object.assign(this, {}, defaultConfig, opt)
365
365
  }
@@ -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
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
70
72
  if (this.jingXiMiniState) {
71
73
  const batchParam = `coupon_batch=${couponId}`
72
74
  const detailUrl = `${this.jumpMiniPath.jxCouponSearch}?${batchParam}`
73
75
  this.jdJumpToMiniPage(detailUrl, logEventInfo)
74
76
  } else {
75
77
  super.jdJumpToCouponSearchProductList(couponId, logEventInfo)
76
78
  }
77
79
  }
@@ -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
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
68
70
  this.jdNavigateToNative(
69
71
  Object.assign(
70
72
  {},
71
73
  {
72
74
  category: "jump",
73
75
  des: "productList",
74
76
  from: "couponBatch",
75
77
  couponId: `${couponId}`,
76
78
  tip: "1",
77
79
  inlet: 0,
78
80
  quangoufrom: 2
79
81
  },
80
82
  logEventInfo,
81
83
  ),
82
84
  )
83
85
  }
84
86
 
85
87
  jdJumpToWeb(
86
88
  url,
87
89
  logEventInfo,
88
90
  successBack?: Function | undefined,
89
91
  failBack?: Function | undefined,
90
92
  ) {
91
93
  if (this.isOpenTjAppUrl(url)) {
92
94
  const getOpenAppParams = this.tjOpenAppParams(url)
93
95
  console.log(
94
96
  'tj web 获取自定义openApp链接解析后的参数结果',
95
97
  getOpenAppParams,
96
98
  )
97
99
  if (getOpenAppParams) {
98
100
  this.jdNavigateToNative(
99
101
  Object.assign({}, getOpenAppParams, {
100
102
  logEventInfo,
101
103
  }),
102
104
  )
103
105
  }
104
106
  } else {
105
107
  if(url.indexOf('tjshop') == -1) {
106
108
  url = url + this.getTjShopParam()
107
109
  }
108
110
  const changeUrl = /^\/\//.test(url) ? `https:${url}` : url
109
111
  this.jdNavigateToNative(
110
112
  {
111
113
  category: 'jump',
112
114
  des: 'm',
113
115
  url: changeUrl,
114
116
  logEventInfo,
115
117
  },
116
118
  OpenAppHost,
117
119
  successBack,
118
120
  failBack,
119
121
  )
120
122
  }
121
123
  }
122
124
  jdJumpToShopSearch(shopInfo) {
123
125
  const getInfo = Object.assign(
124
126
  {},
125
127
  {
126
128
  shopId: global.info.queryInfo.shopId,
127
129
  venderId: global.info.queryInfo.venderId,
128
130
  },
129
131
  shopInfo,
130
132
  )
131
133
  const { shopId, categoryId, keyword, pageId, description, shopName } =
132
134
  getInfo
133
135
  const cateId = categoryId ? `&cateId=${typeof categoryId === 'string' ? categoryId?.trim() : categoryId}` : ''
134
136
  const addKeyWord = keyword ? `&keyword=${keyword}` : ''
135
137
  const addPageId = pageId ? `&pageId=${pageId}` : ''
136
138
  const searchDes = description ? `&description=${description}` : ''
137
139
  const shopNameDes = shopName ? `&shopName=${shopName}` : ''
138
140
  const searchType = categoryId ? 5 : keyword ? 4 : 3
139
141
  super.jdNavigateToNative(
140
142
  `${this.jumpWebUrl.shopSearch}?shopId=${shopId}&searchType=${searchType}${cateId}${addKeyWord}${addPageId}${searchDes}${shopNameDes}`,
141
143
  getInfo,
142
144
  )
143
145
  }
144
146
 
145
147
  jdNavigateToNative(
146
148
  params,
147
149
  url = OpenAppHost,
148
150
  successBack?: Function | null,
149
151
  failBack?: Function | null,
150
152
  ) {
151
153
  console.log('tj web', params)
152
154
  const { logEventInfo , ...otherParams } = params
153
155
  console.log('tj web 获取open协议参数 jdNavigateToNative params: ',otherParams)
154
156
  console.log('logEventInfo params: ', logEventInfo)
155
157
  console.log('otherParams', otherParams)
156
158
  const paramsStr = JSON.stringify(otherParams)
157
159
  console.log('跳转web tj open协议', `${url}?params=${paramsStr}`)
158
160
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
159
161
  this.clickEventLog(logEventInfo || params)
160
162
  .then(() => {
161
163
  if (typeof successBack == 'function') {
162
164
  successBack(params)
163
165
  } else {
164
166
  try {
165
167
  const paramsStr = encodeURIComponent(JSON.stringify(otherParams))
166
168
  console.log(
167
169
  'success: 跳转web tj open协议',
168
170
  `${url}?params=${paramsStr}`,
169
171
  )
170
172
  window.location.href = `${url}?params=${paramsStr}`
171
173
  } catch (e) {
172
174
  console.log('跳转异常', e)
173
175
  }
174
176
  }
175
177
  })
176
178
  .catch((e) => {
177
179
  console.log('catch', e)
178
180
  typeof failBack == 'function' && failBack(params)
179
181
  })
180
182
  }
181
183
 
182
184
  clickEventLog(
183
185
  opts: JumpEventReportInterFace.OptEventLogParams = {},
184
186
  reportKey = 'click',
185
187
  ) {
186
188
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
187
189
  if (eventId && jsonParam) {
188
190
  const { etModelInfo, logBaseInfo } = jsonParam
189
191
  const webLogParams = {
190
192
  eid: eventId,
191
193
  elevel: eventLevel,
192
194
  eparam:JSON.stringify(logBaseInfo || jsonParam),
193
195
  jsonParam: JSON.stringify(logBaseInfo || jsonParam),
194
196
  etModel: JSON.stringify(etModelInfo || {}),
195
197
  pageId: this.logPageId,
196
198
  pageParam: this.logPageParamStr,
197
199
  ...otherParams,
198
200
  }
199
201
  return /click|exposure/.test(reportKey)
200
202
  ? reportClick(webLogParams)
201
203
  : reportToCart(opts,webLogParams)
202
204
  } else {
203
205
  console.log('暂无埋点参数eventId和eventParam')
204
206
  return Promise.resolve(false)
205
207
  }
206
208
  }
207
209
  getConfig(opt = {}) {
208
210
  return Object.assign(this, {}, defaultConfig, opt)
209
211
  }