@conecli/cone-render 0.10.1-beta.4 → 0.10.1-beta.6

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 (81) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/common/const.ts +1 -1
  3. package/dist/common/environmentType.ts +1 -1
  4. package/dist/common/index.h5.ts +1 -1
  5. package/dist/common/index.jd.ts +1 -1
  6. package/dist/common/index.ts +1 -1
  7. package/dist/common/index.weapp.ts +1 -1
  8. package/dist/common/pageType.ts +1 -1
  9. package/dist/common/sgmCustomCode.ts +1 -1
  10. package/dist/components/ErrorBoundary.tsx +1 -1
  11. package/dist/components/base/CountDown/index.module.scss +49 -44
  12. package/dist/components/base/CountDown/index.tsx +1 -1
  13. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  14. package/dist/components/base/CustomVideo/common.ts +1 -0
  15. package/dist/components/base/CustomVideo/index.tsx +1 -1
  16. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  17. package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
  18. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  19. package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
  20. package/dist/components/base/LazyLoadImage/index.h5.module.scss +11 -3
  21. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  22. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  23. package/dist/components/base/NetworkDataError/index.module.scss +3 -0
  24. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  25. package/dist/components/base/Price/Base/index.tsx +1 -1
  26. package/dist/components/base/Price/Double/index.module.scss +8 -0
  27. package/dist/components/base/Price/Double/index.tsx +1 -1
  28. package/dist/components/decorate/DecorateFloorModule/index.module.scss +11 -0
  29. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  30. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  31. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  32. package/dist/components/floorItem.tsx +1 -1
  33. package/dist/components/isv/Floor/index.tsx +1 -1
  34. package/dist/components/remoteFloorItem.tsx +1 -1
  35. package/dist/interface/common.ts +1 -1
  36. package/dist/interface/component.ts +1 -1
  37. package/dist/interface/jumpEventReport.ts +1 -1
  38. package/dist/interface/service.ts +1 -1
  39. package/dist/jumpEventReport/base.ts +1 -1
  40. package/dist/jumpEventReport/const.ts +1 -1
  41. package/dist/jumpEventReport/index.jd.ts +1 -1
  42. package/dist/jumpEventReport/index.weapp.ts +1 -1
  43. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  44. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  45. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  46. package/dist/jumpEventReport/web.base.ts +1 -1
  47. package/dist/jumpEventReport/web.jd.ts +1 -1
  48. package/dist/jumpEventReport/web.jdb.ts +1 -1
  49. package/dist/jumpEventReport/web.jdjch.ts +1 -1
  50. package/dist/jumpEventReport/web.jxwxapp.ts +1 -1
  51. package/dist/jumpEventReport/web.pc.ts +1 -1
  52. package/dist/jumpEventReport/web.tjapp.ts +1 -1
  53. package/dist/jumpEventReport/web.tjm.ts +1 -1
  54. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  55. package/dist/modules/ContainerFloorList/index.h5.module.scss +1 -0
  56. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  57. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  58. package/dist/open/api/device.ts +1 -1
  59. package/dist/open/api/request.ts +1 -1
  60. package/dist/open/api/shopMember.ts +1 -1
  61. package/dist/open/api/util.ts +1 -1
  62. package/dist/open/components/index.ts +1 -1
  63. package/dist/sass/app.h5.scss +5 -0
  64. package/dist/sass/base.scss +183 -137
  65. package/dist/service/fetchGateway.ts +1 -1
  66. package/dist/service/http/colorSign.ts +1 -1
  67. package/dist/service/http/h5Http.ts +1 -0
  68. package/dist/service/http/index.h5.ts +1 -0
  69. package/dist/service/requestServer.h5.ts +1 -0
  70. package/dist/service/requestServer.ts +1 -1
  71. package/dist/utils/connectNativeJsBridge.ts +1 -1
  72. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  73. package/dist/utils/h5Utils.ts +1 -1
  74. package/dist/utils/index.h5.ts +1 -1
  75. package/dist/utils/index.ts +1 -1
  76. package/dist/utils/index.weapp.ts +1 -1
  77. package/dist/utils/sgmCodeUtils.ts +1 -1
  78. package/dist/utils/taroRenderUtil.ts +1 -1
  79. package/dist/utils/utils.ts +1 -1
  80. package/package.json +35 -28
  81. package/dist/utils/memberFormatUtils.js +0 -1
@@ -1 +1 @@
1
- import global from '../common'
2
1
  BUSINESS_TYPE,
3
2
  SHOP_MENU_ID_TYPE,
4
3
  SHOP_MENU_ID_NAME,
5
4
  SECTION_HOME_TAB_TYPE,
6
5
  SECTION_HOME_TAB_NAME_TYPE,
7
6
  objectToUrlEncode,
8
7
  parseQueryUrlString,
9
8
  filterUrlQueryData,
10
9
  routerInfo: {
11
10
  params: {},
12
11
  },
13
12
  nativeEvent: null,
14
13
  jumpConfig: {
15
14
  venderId: null,
16
15
  shopId: null,
17
16
  sourceValue: '',
18
17
  sourceType: 'M-H5',
19
18
  activityType: 'shopx',
20
19
  moduleId: 'none',
21
20
  entrance: 'none',
22
21
  },
23
22
  logPageParamStr: '',
24
23
  public logPageId: string
25
24
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
26
25
  getConfig(opt) {
27
26
  return Object.assign(this, {}, defaultConfig, opt)
28
27
  }
29
28
  updateInfo(
30
29
  routerInfo,
31
30
  logPname = LogPnameInfo.HOME,
32
31
  pageId = LogPageIdInfo.APP,
33
32
  ) {
34
33
  this.routerInfo = routerInfo
35
34
  this.logPname = logPname
36
35
  this.jumpConfig = Object.assign(
37
36
  {},
38
37
  this.jumpConfig,
39
38
  filterUrlQueryData(routerInfo?.params || {}),
40
39
  )
41
40
  this.logPageId = pageId
42
41
  }
43
42
 
44
43
  jdJumpToProduct(skuIds, logEventInfo) {
45
44
  skuIds = skuIds.toString().trim()
46
45
  const getSkuId = skuIds.indexOf(',') !== -1 ? skuIds.split(',')[0] : skuIds
47
46
  let url = `${this.jumpWebUrl.pcDetail}${getSkuId}.html`
48
47
  this.jdNavigateToNative(url, logEventInfo)
49
48
  }
50
49
 
51
50
  jdJumpToShopHome(shopInfo: JumpEventReportInterFace.ShopIdsInfo = {}) {
52
51
  const getInfo = Object.assign(
53
52
  {},
54
53
  {
55
54
  shopId: global.info.queryInfo.shopId,
56
55
  venderId: global.info.queryInfo.venderId,
57
56
  },
58
57
  shopInfo,
59
58
  )
60
59
  let url = `${this.jumpWebUrl.pages}/index-${global.info.queryInfo.shopId}.html`
61
60
  this.jdNavigateToNative(url, {
62
61
  ...getInfo,
63
62
  })
64
63
  }
65
64
 
66
65
  getPcSearchUrl = (cateId) => {
67
66
  const flag = document.querySelector('#JSHOP_CHANNEL_FLAG')?.value
68
67
  const appId =
69
68
  document.querySelector('#J_AppId')?.value ||
70
69
  document.querySelector('#pageInstance_appId')?.value
71
70
  return flag === 'yao'
72
71
  ? this.jumpWebUrl.pages + '/view_shop_search-' + appId + '.html'
73
72
  : this.jumpWebUrl.pages +
74
73
  '/view_search-' +
75
74
  appId +
76
75
  '-' +
77
76
  cateId +
78
77
  '-99-1-20-1.html'
79
78
  }
80
79
 
81
80
  jdJumpToShopSearch(shopInfo) {
82
81
  const getInfo = Object.assign(
83
82
  {},
84
83
  {
85
84
  shopId: global.info.queryInfo.shopId,
86
85
  venderId: global.info.queryInfo.venderId,
87
86
  },
88
87
  shopInfo,
89
88
  )
90
89
  const { categoryId } = getInfo
91
90
  const url = `${this.getPcSearchUrl(categoryId)}`
92
91
  this.jdJumpToWeb(url, getInfo)
93
92
  }
94
93
 
95
94
  jdJumpToTabAllProduct(shopId, venderId, logEventInfo = {}) {
96
95
  console.log('web.base.ts - jdJumpToTabAllProduct')
97
96
  if (typeof shopId === 'undefined') shopId = global.info.queryInfo.shopId
98
97
  if (typeof venderId === 'undefined')
99
98
  venderId = global.info.queryInfo.venderId
100
99
  const url = `${this.jumpWebUrl.pages}/index-${shopId}.html`
101
100
  this.jdJumpToWeb(url, logEventInfo)
102
101
  }
103
102
 
104
103
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
105
104
  const url = `${this.jumpWebUrl.couponSearch}?couponbatch=${couponId}&sceneval=2`
106
105
  this.jdJumpToWeb(url, logEventInfo)
107
106
  }
107
+ import global from '../common'
108
108
  BUSINESS_TYPE,
109
109
  SHOP_MENU_ID_TYPE,
110
110
  SHOP_MENU_ID_NAME,
111
111
  SECTION_HOME_TAB_TYPE,
112
112
  SECTION_HOME_TAB_NAME_TYPE,
113
113
  objectToUrlEncode,
114
114
  parseQueryUrlString,
115
115
  filterUrlQueryData,
116
116
  routerInfo: {
117
117
  params: {},
118
118
  },
119
119
  nativeEvent: null,
120
120
  jumpConfig: {
121
121
  venderId: null,
122
122
  shopId: null,
123
123
  sourceValue: '',
124
124
  sourceType: 'M-H5',
125
125
  activityType: 'shopx',
126
126
  moduleId: 'none',
127
127
  entrance: 'none',
128
128
  },
129
129
  logPageParamStr: '',
130
130
  public logPageId: string
131
131
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
132
132
  getConfig(opt) {
133
133
  return Object.assign(this, {}, defaultConfig, opt)
134
134
  }
135
135
  updateInfo(
136
136
  routerInfo,
137
137
  logPname = LogPnameInfo.HOME,
138
138
  pageId = LogPageIdInfo.APP,
139
139
  ) {
140
140
  this.routerInfo = routerInfo
141
141
  this.logPname = logPname
142
142
  this.jumpConfig = Object.assign(
143
143
  {},
144
144
  this.jumpConfig,
145
145
  filterUrlQueryData(routerInfo?.params || {}),
146
146
  )
147
147
  this.logPageId = pageId
148
148
  }
149
149
 
150
150
  jdJumpToProduct(skuIds, logEventInfo) {
151
151
  skuIds = skuIds.toString().trim()
152
152
  const getSkuId = skuIds.indexOf(',') !== -1 ? skuIds.split(',')[0] : skuIds
153
153
  let url = `${this.jumpWebUrl.pcDetail}${getSkuId}.html`
154
154
  this.jdNavigateToNative(url, logEventInfo)
155
155
  }
156
156
 
157
157
  jdJumpSkuInfoToProduct(skuInfo: any = {}, logEventInfo) {
158
158
  const getSkuId = skuInfo?.skuId;
159
159
  this.jdJumpToProduct(getSkuId, logEventInfo)
160
160
  }
161
161
 
162
162
  jdJumpToShopHome(shopInfo: JumpEventReportInterFace.ShopIdsInfo = {}) {
163
163
  const getInfo = Object.assign(
164
164
  {},
165
165
  {
166
166
  shopId: global.info.queryInfo.shopId,
167
167
  venderId: global.info.queryInfo.venderId,
168
168
  },
169
169
  shopInfo,
170
170
  )
171
171
  let url = `${this.jumpWebUrl.pages}/index-${global.info.queryInfo.shopId}.html`
172
172
  this.jdNavigateToNative(url, {
173
173
  ...getInfo,
174
174
  })
175
175
  }
176
176
 
177
177
  getPcSearchUrl = (cateId) => {
178
178
  const flag = document.querySelector('#JSHOP_CHANNEL_FLAG')?.value
179
179
  const appId =
180
180
  document.querySelector('#J_AppId')?.value ||
181
181
  document.querySelector('#pageInstance_appId')?.value
182
182
  return flag === 'yao'
183
183
  ? this.jumpWebUrl.pages + '/view_shop_search-' + appId + '.html'
184
184
  : this.jumpWebUrl.pages +
185
185
  '/view_search-' +
186
186
  appId +
187
187
  '-' +
188
188
  cateId +
189
189
  '-99-1-20-1.html'
190
190
  }
191
191
 
192
192
  jdJumpToShopSearch(shopInfo) {
193
193
  const getInfo = Object.assign(
194
194
  {},
195
195
  {
196
196
  shopId: global.info.queryInfo.shopId,
197
197
  venderId: global.info.queryInfo.venderId,
198
198
  },
199
199
  shopInfo,
200
200
  )
201
201
  const { categoryId } = getInfo
202
202
  const url = `${this.getPcSearchUrl(categoryId)}`
203
203
  this.jdJumpToWeb(url, getInfo)
204
204
  }
205
205
 
206
206
  jdJumpToTabAllProduct(shopId, venderId, logEventInfo = {}) {
207
207
  console.log('web.base.ts - jdJumpToTabAllProduct')
208
208
  if (typeof shopId === 'undefined') shopId = global.info.queryInfo.shopId
209
209
  if (typeof venderId === 'undefined')
210
210
  venderId = global.info.queryInfo.venderId
211
211
  const url = `${this.jumpWebUrl.pages}/index-${shopId}.html`
212
212
  this.jdJumpToWeb(url, logEventInfo)
213
213
  }
214
214
 
215
215
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
216
216
  const url = `${this.jumpWebUrl.couponSearch}?couponbatch=${couponId}&sceneval=2`
217
217
  this.jdJumpToWeb(url, logEventInfo)
218
218
  }
@@ -1 +1 @@
1
- import { JumpEventTJWebReport } from './web.tjm'
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('jdlite加载==========')
20
19
  super(opt)
21
20
  this.getConfig(opt)
22
21
  }
23
22
  tjOpenAppParams(openAppUrl): Object | boolean {
24
23
  let getParams: boolean | Object = false
25
24
  if (this.isOpenTjAppUrl(openAppUrl)) {
26
25
  try {
27
26
  getParams = openAppUrl.replace(
28
27
  /openApp\.jdlite:\/\/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
  isOpenTjAppUrl(openAppUrl) {
39
38
  return /openApp\.jdlite:\/\/virtual\?params=/i.test(openAppUrl)
40
39
  }
41
40
 
42
41
  async jdJumpConfigUrl(detail, logEventInfo = {}) {
43
42
  const { configDataType, configDataValue } = detail
44
43
  console.log("测试tj app",detail)
45
44
  switch (configDataType) {
46
45
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
47
46
  this.jdJumpToProduct( configDataValue.skuIds, logEventInfo)
48
47
  break
49
48
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK: {
50
49
  const _url = configDataValue.linkUrl
51
50
  this.jdJumpToWeb(_url, logEventInfo)
52
51
  break
53
52
  }
54
53
  default:
55
54
  }
56
55
  }
57
56
 
58
57
  jdJumpToProduct(skuIds, logEventInfo) {
59
58
  skuIds = skuIds.toString().trim()
60
59
  const getSkuId = skuIds.indexOf(',') !== -1 ? skuIds.split(',')[0] : skuIds
61
60
  this.jdNavigateToNative({
62
61
  category: "jump",
63
62
  des: "productDetail",
64
63
  skuId: getSkuId,
65
64
  logEventInfo,
66
65
  })
67
66
  }
68
67
 
69
68
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
70
69
  this.jdNavigateToNative(
71
70
  Object.assign(
72
71
  {},
73
72
  {
74
73
  category: "jump",
75
74
  des: "productList",
76
75
  from: "couponBatch",
77
76
  couponId: `${couponId}`,
78
77
  tip: "1",
79
78
  inlet: 0,
80
79
  quangoufrom: 2
81
80
  },
82
81
  logEventInfo,
83
82
  ),
84
83
  )
85
84
  }
86
85
 
87
86
  jdJumpToWeb(
88
87
  url,
89
88
  logEventInfo,
90
89
  successBack?: Function | undefined,
91
90
  failBack?: Function | undefined,
92
91
  ) {
93
92
  if (this.isOpenTjAppUrl(url)) {
94
93
  const getOpenAppParams = this.tjOpenAppParams(url)
95
94
  console.log(
96
95
  'tj web 获取自定义openApp链接解析后的参数结果',
97
96
  getOpenAppParams,
98
97
  )
99
98
  if (getOpenAppParams) {
100
99
  this.jdNavigateToNative(
101
100
  Object.assign({}, getOpenAppParams, {
102
101
  logEventInfo,
103
102
  }),
104
103
  )
105
104
  }
106
105
  } else {
107
106
  if(url.indexOf('tjshop') == -1) {
108
107
  url = url + this.getTjShopParam()
109
108
  }
110
109
  const changeUrl = /^\/\//.test(url) ? `https:${url}` : url
111
110
  this.jdNavigateToNative(
112
111
  {
113
112
  category: 'jump',
114
113
  des: 'm',
115
114
  url: changeUrl,
116
115
  logEventInfo,
117
116
  },
118
117
  OpenAppHost,
119
118
  successBack,
120
119
  failBack,
121
120
  )
122
121
  }
123
122
  }
124
123
  jdJumpToShopSearch(shopInfo) {
125
124
  const getInfo = Object.assign(
126
125
  {},
127
126
  {
128
127
  shopId: global.info.queryInfo.shopId,
129
128
  venderId: global.info.queryInfo.venderId,
130
129
  },
131
130
  shopInfo,
132
131
  )
133
132
  const { shopId, categoryId, keyword, pageId, description, shopName } =
134
133
  getInfo
135
134
  const cateId = categoryId ? `&cateId=${typeof categoryId === 'string' ? categoryId?.trim() : categoryId}` : ''
136
135
  const addKeyWord = keyword ? `&keyword=${keyword}` : ''
137
136
  const addPageId = pageId ? `&pageId=${pageId}` : ''
138
137
  const searchDes = description ? `&description=${description}` : ''
139
138
  const shopNameDes = shopName ? `&shopName=${shopName}` : ''
140
139
  const searchType = categoryId ? 5 : keyword ? 4 : 3
141
140
  super.jdNavigateToNative(
142
141
  `${this.jumpWebUrl.shopSearch}?shopId=${shopId}&searchType=${searchType}${cateId}${addKeyWord}${addPageId}${searchDes}${shopNameDes}`,
143
142
  getInfo,
144
143
  )
145
144
  }
146
145
 
147
146
  jdNavigateToNative(
148
147
  params,
149
148
  url = OpenAppHost,
150
149
  successBack?: Function | null,
151
150
  failBack?: Function | null,
152
151
  ) {
153
152
  console.log('tj web', params)
154
153
  const { logEventInfo , ...otherParams } = params
155
154
  console.log('tj web 获取open协议参数 jdNavigateToNative params: ',otherParams)
156
155
  console.log('logEventInfo params: ', logEventInfo)
157
156
  console.log('otherParams', otherParams)
158
157
  const paramsStr = JSON.stringify(otherParams)
159
158
  console.log('跳转web tj open协议', `${url}?params=${paramsStr}`)
160
159
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
161
160
  this.clickEventLog(logEventInfo || params)
162
161
  .then(() => {
163
162
  if (typeof successBack == 'function') {
164
163
  successBack(params)
165
164
  } else {
166
165
  try {
167
166
  const paramsStr = encodeURIComponent(JSON.stringify(otherParams))
168
167
  console.log(
169
168
  'success: 跳转web tj open协议',
170
169
  `${url}?params=${paramsStr}`,
171
170
  )
172
171
  window.location.href = `${url}?params=${paramsStr}`
173
172
  } catch (e) {
174
173
  console.log('跳转异常', e)
175
174
  }
176
175
  }
177
176
  })
178
177
  .catch((e) => {
179
178
  console.log('catch', e)
180
179
  typeof failBack == 'function' && failBack(params)
181
180
  })
182
181
  }
183
182
 
184
183
  clickEventLog(
185
184
  opts: JumpEventReportInterFace.OptEventLogParams = {},
186
185
  reportKey = 'click',
187
186
  ) {
188
187
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
189
188
  if (eventId && jsonParam) {
190
189
  const { etModelInfo, logBaseInfo } = jsonParam
191
190
  const webLogParams = {
192
191
  eid: eventId,
193
192
  elevel: eventLevel,
194
193
  eparam:JSON.stringify(logBaseInfo || jsonParam),
195
194
  jsonParam: JSON.stringify(logBaseInfo || jsonParam),
196
195
  etModel: JSON.stringify(etModelInfo || {}),
197
196
  pageId: this.logPageId,
198
197
  pageParam: this.logPageParamStr,
199
198
  ...otherParams,
200
199
  }
201
200
  return /click|exposure/.test(reportKey)
202
201
  ? reportClick(webLogParams)
203
202
  : reportToCart(opts,webLogParams)
204
203
  } else {
205
204
  console.log('暂无埋点参数eventId和eventParam')
206
205
  return Promise.resolve(false)
207
206
  }
208
207
  }
209
208
  getConfig(opt = {}) {
210
209
  return Object.assign(this, {}, defaultConfig, opt)
211
210
  }
211
+ import { JumpEventTJWebReport } from './web.tjm'
212
212
  routerInfo: {
213
213
  params: {},
214
214
  },
215
215
  nativeEvent: null,
216
216
  jumpConfig: {
217
217
  venderId: null,
218
218
  shopId: null,
219
219
  sourceValue: '',
220
220
  sourceType: 'App-H5',
221
221
  activityType: 'shopx',
222
222
  moduleId: 'none',
223
223
  entrance: 'none',
224
224
  },
225
225
  logPageParamStr: '',
226
226
  public logPageId: string
227
227
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
228
228
  constructor(opt = {}) {
229
229
  console.log('jdlite加载==========')
230
230
  super(opt)
231
231
  this.getConfig(opt)
232
232
  }
233
233
  tjOpenAppParams(openAppUrl): Object | boolean {
234
234
  let getParams: boolean | Object = false
235
235
  if (this.isOpenTjAppUrl(openAppUrl)) {
236
236
  try {
237
237
  getParams = openAppUrl.replace(
238
238
  /openApp\.jdlite:\/\/virtual\?params=/i,
239
239
  '',
240
240
  )
241
241
  getParams = JSON.parse(String(getParams))
242
242
  } catch (e) {
243
243
  console.log(e)
244
244
  }
245
245
  }
246
246
  return getParams
247
247
  }
248
248
  isOpenTjAppUrl(openAppUrl) {
249
249
  return /openApp\.jdlite:\/\/virtual\?params=/i.test(openAppUrl)
250
250
  }
251
251
 
252
252
  async jdJumpConfigUrl(detail, logEventInfo = {}) {
253
253
  const { configDataType, configDataValue } = detail
254
254
  console.log("测试tj app",detail)
255
255
  switch (configDataType) {
256
256
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
257
257
  this.jdJumpToProduct( configDataValue.skuIds, logEventInfo)
258
258
  break
259
259
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK: {
260
260
  const _url = configDataValue.linkUrl
261
261
  this.jdJumpToWeb(_url, logEventInfo)
262
262
  break
263
263
  }
264
264
  default:
265
265
  }
266
266
  }
267
267
 
268
268
  jdJumpToProduct(skuIds, logEventInfo) {
269
269
  skuIds = skuIds.toString().trim()
270
270
  const getSkuId = skuIds.indexOf(',') !== -1 ? skuIds.split(',')[0] : skuIds
271
271
  this.jdNavigateToNative({
272
272
  category: "jump",
273
273
  des: "productDetail",
274
274
  skuId: getSkuId,
275
275
  logEventInfo,
276
276
  })
277
277
  }
278
278
 
279
279
  jdJumpSkuInfoToProduct(skuInfo: any = {}, logEventInfo) {
280
280
  const getSkuId = skuInfo?.skuId;
281
281
  this.jdJumpToProduct(getSkuId, logEventInfo)
282
282
  }
283
283
 
284
284
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
285
285
  this.jdNavigateToNative(
286
286
  Object.assign(
287
287
  {},
288
288
  {
289
289
  category: "jump",
290
290
  des: "productList",
291
291
  from: "couponBatch",
292
292
  couponId: `${couponId}`,
293
293
  tip: "1",
294
294
  inlet: 0,
295
295
  quangoufrom: 2
296
296
  },
297
297
  logEventInfo,
298
298
  ),
299
299
  )
300
300
  }
301
301
 
302
302
  jdJumpToWeb(
303
303
  url,
304
304
  logEventInfo,
305
305
  successBack?: Function | undefined,
306
306
  failBack?: Function | undefined,
307
307
  ) {
308
308
  if (this.isOpenTjAppUrl(url)) {
309
309
  const getOpenAppParams = this.tjOpenAppParams(url)
310
310
  console.log(
311
311
  'tj web 获取自定义openApp链接解析后的参数结果',
312
312
  getOpenAppParams,
313
313
  )
314
314
  if (getOpenAppParams) {
315
315
  this.jdNavigateToNative(
316
316
  Object.assign({}, getOpenAppParams, {
317
317
  logEventInfo,
318
318
  }),
319
319
  )
320
320
  }
321
321
  } else {
322
322
  if(url.indexOf('tjshop') == -1) {
323
323
  url = url + this.getTjShopParam()
324
324
  }
325
325
  const changeUrl = /^\/\//.test(url) ? `https:${url}` : url
326
326
  this.jdNavigateToNative(
327
327
  {
328
328
  category: 'jump',
329
329
  des: 'm',
330
330
  url: changeUrl,
331
331
  logEventInfo,
332
332
  },
333
333
  OpenAppHost,
334
334
  successBack,
335
335
  failBack,
336
336
  )
337
337
  }
338
338
  }
339
339
  jdJumpToShopSearch(shopInfo) {
340
340
  const getInfo = Object.assign(
341
341
  {},
342
342
  {
343
343
  shopId: global.info.queryInfo.shopId,
344
344
  venderId: global.info.queryInfo.venderId,
345
345
  },
346
346
  shopInfo,
347
347
  )
348
348
  const { shopId, categoryId, keyword, pageId, description, shopName } =
349
349
  getInfo
350
350
  const cateId = categoryId ? `&cateId=${typeof categoryId === 'string' ? categoryId?.trim() : categoryId}` : ''
351
351
  const addKeyWord = keyword ? `&keyword=${keyword}` : ''
352
352
  const addPageId = pageId ? `&pageId=${pageId}` : ''
353
353
  const searchDes = description ? `&description=${description}` : ''
354
354
  const shopNameDes = shopName ? `&shopName=${shopName}` : ''
355
355
  const searchType = categoryId ? 5 : keyword ? 4 : 3
356
356
  super.jdNavigateToNative(
357
357
  `${this.jumpWebUrl.shopSearch}?shopId=${shopId}&searchType=${searchType}${cateId}${addKeyWord}${addPageId}${searchDes}${shopNameDes}`,
358
358
  getInfo,
359
359
  )
360
360
  }
361
361
 
362
362
  jdNavigateToNative(
363
363
  params,
364
364
  url = OpenAppHost,
365
365
  successBack?: Function | null,
366
366
  failBack?: Function | null,
367
367
  ) {
368
368
  console.log('tj web', params)
369
369
  const { logEventInfo , ...otherParams } = params
370
370
  console.log('tj web 获取open协议参数 jdNavigateToNative params: ',otherParams)
371
371
  console.log('logEventInfo params: ', logEventInfo)
372
372
  console.log('otherParams', otherParams)
373
373
  const paramsStr = JSON.stringify(otherParams)
374
374
  console.log('跳转web tj open协议', `${url}?params=${paramsStr}`)
375
375
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
376
376
  this.clickEventLog(logEventInfo || params)
377
377
  .then(() => {
378
378
  if (typeof successBack == 'function') {
379
379
  successBack(params)
380
380
  } else {
381
381
  try {
382
382
  const paramsStr = encodeURIComponent(JSON.stringify(otherParams))
383
383
  console.log(
384
384
  'success: 跳转web tj open协议',
385
385
  `${url}?params=${paramsStr}`,
386
386
  )
387
387
  window.location.href = `${url}?params=${paramsStr}`
388
388
  } catch (e) {
389
389
  console.log('跳转异常', e)
390
390
  }
391
391
  }
392
392
  })
393
393
  .catch((e) => {
394
394
  console.log('catch', e)
395
395
  typeof failBack == 'function' && failBack(params)
396
396
  })
397
397
  }
398
398
 
399
399
  clickEventLog(
400
400
  opts: JumpEventReportInterFace.OptEventLogParams = {},
401
401
  reportKey = 'click',
402
402
  ) {
403
403
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
404
404
  if (eventId && jsonParam) {
405
405
  const { etModelInfo, logBaseInfo } = jsonParam
406
406
  const webLogParams = {
407
407
  eid: eventId,
408
408
  elevel: eventLevel,
409
409
  eparam:JSON.stringify(logBaseInfo || jsonParam),
410
410
  jsonParam: JSON.stringify(logBaseInfo || jsonParam),
411
411
  etModel: JSON.stringify(etModelInfo || {}),
412
412
  pageId: this.logPageId,
413
413
  pageParam: this.logPageParamStr,
414
414
  ...otherParams,
415
415
  }
416
416
  return /click|exposure/.test(reportKey)
417
417
  ? reportClick(webLogParams)
418
418
  : reportToCart(opts,webLogParams)
419
419
  } else {
420
420
  console.log('暂无埋点参数eventId和eventParam')
421
421
  return Promise.resolve(false)
422
422
  }
423
423
  }
424
424
  getConfig(opt = {}) {
425
425
  return Object.assign(this, {}, defaultConfig, opt)
426
426
  }