@conecli/cone-render 0.8.20-shop.220 → 0.8.20-shop.221

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.
@@ -1 +1 @@
1
- export declare namespace JumpEventReportInterFace {
2
1
  export interface ShopIdsInfo {
3
2
  shopId?: number | string;
4
3
  venderId?: number | string;
5
4
  logEventInfo?: object;
6
5
  type?: string;
7
6
  }
8
7
  export interface RouterInfo {
9
8
  params: any;
10
9
  pageParamStr?: string;
11
10
  [key: string]: any;
12
11
  }
13
12
  export interface JumpMiniPath {
14
13
  shop: string;
15
14
  shopx: string;
16
15
  detail: string;
17
16
  searchCoupon: string;
18
17
  h5: string;
19
18
  jingGouHome: string;
20
19
  shopFans: string;
21
20
  shopLight: string;
22
21
  couponSearch: string;
23
22
  shopSearch: string;
24
23
  jxCouponSearch: string;
25
24
  jxDetail: string;
26
25
  jdLive: string;
27
26
  }
28
27
  export interface jumpWebUrl {
29
28
  mshop: string;
30
29
  pages: string;
31
30
  pcCoupon: string;
32
31
  couponSearch: string;
33
32
  jxCouponSearch: string;
34
33
  pcCouponSearch: string;
35
34
  shopSecondActivity: string;
36
35
  shopLight: string;
37
36
  detail: string;
38
37
  jxDetail: string;
39
38
  tjDetail: string;
40
39
  pcDetail: string;
41
40
  mobileHome: string;
42
41
  rank: string;
43
42
  wqShopMember: string;
44
43
  wqShopDetail: string;
45
44
  wqShopSearch: string;
46
45
  myCouponList: string;
47
46
  myRedPacketList: string;
48
47
  memberHome: string;
49
48
  memberCard: string;
50
49
  memberPoints: string;
51
50
  memberBenefit: string;
52
51
  memberScores: string;
53
52
  memberScoreRule: string;
54
53
  memberProduct: string;
55
54
  shopMember: string;
56
55
  shopMemberPointDetail: string;
57
56
  shopMemberBenefit: string;
58
57
  shopMemberRule: string;
59
58
  shopMemberCloseAccount: string;
60
59
  shopMemberPointExchange: string;
61
60
  shopMemberBonusPurchase: string;
62
61
  shopMemberGood: string;
63
62
  beanDetail: string;
64
63
  totalPromotion: string;
65
64
  mLive: string;
66
65
  shopHome: string;
67
66
  shopIntroduce: string;
68
67
  shopSearch: string;
69
68
  shopLottery: string;
70
69
  shopCoupon: string;
71
70
  shopWares: string;
72
71
  shopFastShopping: string;
73
72
  shopSpeciSeckill: string;
74
73
  shopVideos: string;
75
74
  shopUseShareOrderUgcContent: string;
76
75
  dongDongChat: string;
77
76
  samCenter: string;
78
77
  samCard: string;
79
78
  shopH5MemberCardAPP: string;
80
79
  shopH5MemberCardM: string;
81
80
  sageAuthorHome: string;
82
81
  }
83
82
  export interface EventReportConfig {
84
83
  routerInfo: RouterInfo;
85
84
  nativeEvent: any;
86
85
  }
87
86
  export interface OptEventLogParams {
88
87
  eventId?: string;
89
88
  eventParam?: string | object;
90
89
  pTag?: string;
91
90
  jsonParam?: {
92
91
  [key: string]: any;
93
92
  };
94
93
  skuId?: string | number;
95
94
  eventLevel?: string;
96
95
  exposureState?: boolean;
97
96
  otherParams?: object;
98
97
  }
99
98
 
100
99
  export interface JumpH5ReportConfig {
101
100
  shopId?: number | string;
102
101
  venderId?: number | string;
103
102
  sourceValue?: string;
104
103
  sourceType?: string;
105
104
  }
106
105
  export interface JumpEventReportInit extends EventReportConfig {
107
106
  getConfig(opt): EventReportConfig;
108
107
  updateInfo(routerInfo, logPname): void;
109
108
  }
110
109
  export interface CouponUrlParams {
111
110
  batchId: number;
112
111
  bindType: number;
113
112
  startTime?: number;
114
113
  endTime?: number;
115
114
  quangoufrom?: number;
116
115
  sceneId?: number;
117
116
  }
118
117
  export interface JdMiniJumpParams {
119
118
  param: string | object;
120
119
  sourceValue?: string;
121
120
  sourceType?: string;
122
121
  des?: any;
123
122
  logEventInfo?: object;
124
123
  }
125
124
  export interface LinkMiniParams {
126
125
  param?: {
127
126
  pageType?: string;
128
127
  };
129
128
  appId?: string | number;
130
129
  path?: string;
131
130
  }
132
131
  export interface JdJumpWxappReportConfig {
133
132
  wxApiVersion: string;
134
133
  wxApiUrl: string;
135
134
  wqReportUrl: string;
136
135
  }
136
+ export declare namespace JumpEventReportInterFace {
137
137
  export interface ShopIdsInfo {
138
138
  shopId?: number | string;
139
139
  venderId?: number | string;
140
140
  logEventInfo?: object;
141
141
  type?: string;
142
142
  }
143
143
  export interface RouterInfo {
144
144
  params: any;
145
145
  pageParamStr?: string;
146
146
  [key: string]: any;
147
147
  }
148
148
  export interface JumpMiniPath {
149
149
  shop: string;
150
150
  shopx: string;
151
151
  detail: string;
152
152
  searchCoupon: string;
153
153
  h5: string;
154
154
  jingGouHome: string;
155
155
  shopFans: string;
156
156
  shopLight: string;
157
157
  couponSearch: string;
158
158
  shopSearch: string;
159
159
  jxCouponSearch: string;
160
160
  jxDetail: string;
161
161
  jdLive: string;
162
162
  }
163
163
  export interface jumpWebUrl {
164
164
  mshop: string;
165
165
  pages: string;
166
166
  pcCoupon: string;
167
167
  couponSearch: string;
168
168
  jxCouponSearch: string;
169
169
  pcCouponSearch: string;
170
170
  shopSecondActivity: string;
171
171
  shopLight: string;
172
172
  detail: string;
173
173
  jxDetail: string;
174
174
  tjDetail: string;
175
175
  pcDetail: string;
176
176
  mobileHome: string;
177
177
  rank: string;
178
178
  wqShopMember: string;
179
179
  wqShopDetail: string;
180
180
  wqShopSearch: string;
181
181
  myCouponList: string;
182
182
  myRedPacketList: string;
183
183
  memberHome: string;
184
184
  memberCard: string;
185
185
  memberPoints: string;
186
186
  memberBenefit: string;
187
187
  memberScores: string;
188
188
  memberScoreRule: string;
189
189
  memberProduct: string;
190
190
  shopMember: string;
191
191
  shopMemberPointDetail: string;
192
192
  shopMemberBenefit: string;
193
193
  shopMemberRule: string;
194
194
  shopMemberCloseAccount: string;
195
195
  shopMemberPointExchange: string;
196
196
  shopMemberBonusPurchase: string;
197
197
  shopMemberGood: string;
198
198
  beanDetail: string;
199
199
  totalPromotion: string;
200
200
  mLive: string;
201
201
  shopHome: string;
202
202
  shopIntroduce: string;
203
203
  shopSearch: string;
204
204
  shopLottery: string;
205
205
  shopCoupon: string;
206
206
  shopWares: string;
207
207
  shopFastShopping: string;
208
208
  shopSpeciSeckill: string;
209
209
  shopVideos: string;
210
210
  shopUseShareOrderUgcContent: string;
211
211
  dongDongChat: string;
212
212
  samCenter: string;
213
213
  samCard: string;
214
214
  shopH5MemberCardAPP: string;
215
215
  shopH5MemberCardM: string;
216
216
  sageAuthorHome: string;
217
217
  }
218
218
  export interface EventReportConfig {
219
219
  routerInfo: RouterInfo;
220
220
  nativeEvent: any;
221
221
  }
222
222
  export interface OptEventLogParams {
223
223
  eventId?: string;
224
224
  eventParam?: string | object;
225
225
  pTag?: string;
226
226
  jsonParam?: {
227
227
  [key: string]: any;
228
228
  };
229
229
  skuId?: string | number;
230
230
  eventLevel?: string;
231
231
  exposureState?: boolean;
232
232
  otherParams?: object;
233
233
  }
234
234
 
235
235
  export interface JumpH5ReportConfig {
236
236
  shopId?: number | string;
237
237
  venderId?: number | string;
238
238
  sourceValue?: string;
239
239
  sourceType?: string;
240
240
  }
241
241
  export interface JumpEventReportInit extends EventReportConfig {
242
242
  getConfig(opt): EventReportConfig;
243
243
  updateInfo(routerInfo, logPname): void;
244
244
  }
245
245
  export interface CouponUrlParams {
246
246
  batchId: number;
247
247
  bindType: number;
248
248
  startTime?: number;
249
249
  endTime?: number;
250
250
  quangoufrom?: number;
251
251
  sceneId?: number;
252
252
  }
253
253
  export interface JdMiniJumpParams {
254
254
  param: string | object;
255
255
  sourceValue?: string;
256
256
  sourceType?: string;
257
257
  des?: any;
258
258
  logEventInfo?: object;
259
259
  useEncodeParams?: boolean;
260
260
  }
261
261
  export interface LinkMiniParams {
262
262
  param?: {
263
263
  pageType?: string;
264
264
  };
265
265
  appId?: string | number;
266
266
  path?: string;
267
267
  }
268
268
  export interface JdJumpWxappReportConfig {
269
269
  wxApiVersion: string;
270
270
  wxApiUrl: string;
271
271
  wqReportUrl: string;
272
272
  }
@@ -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
  super(opt);
20
19
  this.getConfig(opt);
21
20
  }
22
21
  getConfig(opt = {}) {
23
22
  return Object.assign(this, {}, defaultConfig, opt);
24
23
  }
25
24
  updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
26
25
  this.logPageId = pageId;
27
26
  this.routerInfo = routerInfo;
28
27
  this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params);
29
28
  this.logPname = logPname;
30
29
  }
31
30
  reportInfoPv(
32
31
  pageId = LogPageIdInfo.APP,
33
32
  opt: {
34
33
  pageParam?: any;
35
34
  } = {},
36
35
  ) {
37
36
  const { pageParam } = opt;
38
37
  this.logPageParamStr = pageParam
39
38
  ? pageParam
40
39
  : this.creatParamToLogStr(this.jumpConfig)
41
40
  .replace(/moduleId/, 'JumpmoduleID')
42
41
  .replace(/entrance/, 'Jumpentrance');
43
42
  reportPV({
44
43
  pageId,
45
44
  pageParam: this.logPageParamStr,
46
45
  ...opt,
47
46
  });
48
47
  }
49
48
 
50
49
  jdJumpToDongDongChatGroup(groupId, source = '4') {
51
50
  this.jdNavigateToNative({
52
51
  category: 'jump',
53
52
  des: 'dongdong_group_chat',
54
53
  source: source,
55
54
  groupId: `${groupId}`,
56
55
  });
57
56
  }
58
57
 
59
58
  jdJumpToWeb(
60
59
  url,
61
60
  logEventInfo,
62
61
  successBack?: functionType | undefined,
63
62
  failBack?: functionType | undefined,
64
63
  ) {
65
64
  console.log('jd web', this.isOpenJdAppUrl(url), url);
66
65
  if (this.isOpenJdAppUrl(url)) {
67
66
  const getOpenAppParams = this.jdOpenAppParams(url);
68
67
  console.log('jd web 获取自定义openApp链接解析后的参数结果', getOpenAppParams);
69
68
  if (getOpenAppParams) {
70
69
  this.jdNavigateToNative(
71
70
  Object.assign({}, getOpenAppParams, {
72
71
  logEventInfo,
73
72
  }),
74
73
  );
75
74
  }
76
75
  } else {
77
76
  let _getLastUrl = url;
78
77
  if (/shop\.m\.jd\.com|pages\.jd\.com/.test(_getLastUrl)) {
79
78
  const getUrlSearchParamState = _getLastUrl.indexOf('?') !== -1;
80
79
  if (!/jwebprog=0/.test(_getLastUrl)) {
81
80
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}jwebprog=0`;
82
81
  }
83
82
  if (global.info.sysInfo?.isJdTabletDevice && !/device=tablet/.test(_getLastUrl)) {
84
83
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}device=tablet`;
85
84
  }
86
85
  }
87
86
  super.jdJumpToWeb(
88
87
  _getLastUrl,
89
88
  {
90
89
  ...logEventInfo,
91
90
  },
92
91
  successBack,
93
92
  failBack,
94
93
  );
95
94
  }
96
95
  }
97
96
 
98
97
  jdJumpToWebInner(url, logEventInfo) {
99
98
  this.jdJumpToWeb(url, logEventInfo);
100
99
  }
101
100
 
102
101
  jdJumpConfigUrl(detail, logEventInfo = {}) {
103
102
  const { configDataType, configDataValue } = detail;
104
103
  switch (configDataType) {
105
104
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
106
105
  this.jdJumpToShopCategory({
107
106
  ...configDataValue,
108
107
  logEventInfo,
109
108
  });
110
109
  break;
111
110
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
112
111
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
113
112
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
114
113
  }
115
114
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
116
115
  break;
117
116
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
118
117
  this.jdJumpToWeb(
119
118
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
120
119
  {},
121
120
  );
122
121
  break;
123
122
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
124
123
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
125
124
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
126
125
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
127
126
  getShopSearchParams &&
128
127
  this.jdJumpToShopSearch(
129
128
  Object.assign({}, getShopSearchParams, {
130
129
  logEventInfo,
131
130
  }),
132
131
  );
133
132
  } else {
134
133
  this.jdJumpToShopSearch(
135
134
  configDataValue['cid']
136
135
  ? Object.assign(
137
136
  {},
138
137
  {
139
138
  shopId: global.info.queryInfo.shopId,
140
139
  categoryId: configDataValue.cid,
141
140
  searchType: '5',
142
141
  logEventInfo,
143
142
  },
144
143
  )
145
144
  : {
146
145
  shopId: global.info.queryInfo.shopId,
147
146
  logEventInfo,
148
147
  },
149
148
  );
150
149
  }
151
150
  break;
152
151
  case LinkConfigType.CONFIG_TYPE_MEMBER:
153
152
  if (isAppHomeForMarketPage) {
154
153
  this.jdJumpToBottomTabBrandMember({
155
154
  logEventInfo,
156
155
  });
157
156
  } else {
158
157
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
159
158
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
160
159
  getShopMemberParams &&
161
160
  this.jdJumpToShopMember(
162
161
  Object.assign({}, getShopMemberParams, {
163
162
  logEventInfo,
164
163
  }),
165
164
  );
166
165
  } else {
167
166
  this.jdJumpToShopMember({
168
167
  shopId: global.info.queryInfo.shopId,
169
168
  venderId: configDataValue.shopDetail,
170
169
  logEventInfo,
171
170
  });
172
171
  }
173
172
  }
174
173
  break;
175
174
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
176
175
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
177
176
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
178
177
  getShopActivityParams &&
179
178
  this.jdJumpToShopActivity(
180
179
  Object.assign({}, getShopActivityParams, {
181
180
  logEventInfo,
182
181
  }),
183
182
  );
184
183
  } else if (configDataValue['projectId']) {
185
184
  this.jdJumpToShopActivity({
186
185
  projectId: configDataValue['projectId'],
187
186
  configDataValue,
188
187
  logEventInfo,
189
188
  });
190
189
  }
191
190
  break;
192
191
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
193
192
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
194
193
  const _url = configDataValue.linkUrl;
195
194
  if (
196
195
  _url.indexOf('to=') === -1 &&
197
196
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
198
197
  ) {
199
198
  const _shopId = _url.match(/\d+/g)[0];
200
199
  this.jdJumpToShopHome({
201
200
  shopId: `${_shopId}`,
202
201
  logEventInfo,
203
202
  });
204
203
  } else if (this.isOpenJdAppUrl(_url)) {
205
204
  const getOpenAppParams = this.jdOpenAppParams(_url);
206
205
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams);
207
206
  if (getOpenAppParams) {
208
207
  let _changeOpenAppParams = getOpenAppParams;
209
208
  if (isAppHomeForMarketPage) {
210
209
  const { operation, ...otherOpenAppParams } = getOpenAppParams;
211
210
  if (operation && operation === 'jumpTabInner') {
212
211
  _changeOpenAppParams = otherOpenAppParams;
213
212
  }
214
213
  }
215
214
  this.jdNavigateToNative(
216
215
  Object.assign({}, _changeOpenAppParams, {
217
216
  logEventInfo,
218
217
  }),
219
218
  );
220
219
  }
221
220
  } else {
222
221
  this.jdJumpToWeb(_url, logEventInfo);
223
222
  }
224
223
  break;
225
224
  }
226
225
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
227
226
  this.jdJumpToShopDetail({
228
227
  venderId: global.info.queryInfo.venderId,
229
228
  shopId: global.info.queryInfo.shopId,
230
229
  logEventInfo,
231
230
  });
232
231
  break;
233
232
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
234
233
  this.jdJumpToShopHome({
235
234
  ...configDataValue,
236
235
  logEventInfo,
237
236
  });
238
237
  break;
239
238
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
240
239
  break;
241
240
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
242
241
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
243
242
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
244
243
  getShoppingGuideParams &&
245
244
  this.jdJumpToShopActivity(
246
245
  Object.assign({}, getShoppingGuideParams, {
247
246
  logEventInfo,
248
247
  }),
249
248
  );
250
249
  }
251
250
  break;
252
251
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
253
252
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
254
253
  const search = linkUrl.match(/\?.+/);
255
254
  if (search) {
256
255
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
257
256
  parseQueryUrlString(linkUrl);
258
257
  try {
259
258
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
260
259
  } catch (e) {
261
260
  console.warn('解析小程序 param 错误:', miniQueryData.param);
262
261
  }
263
262
  this.jdJumpToMiniProgram(miniQueryData);
264
263
  } else {
265
264
  console.warn('小程序地址错误:', linkUrl);
266
265
  }
267
266
  break;
268
267
  }
269
268
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
270
269
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
271
270
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
272
271
  console.log('jd web 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
273
272
  getShopSearchParams &&
274
273
  this.jdJumpToShopSearch(
275
274
  Object.assign({}, getShopSearchParams, {
276
275
  logEventInfo,
277
276
  }),
278
277
  );
279
278
  } else {
280
279
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
281
280
  }
282
281
  break;
283
282
  }
284
283
  default:
285
284
  }
286
285
  }
287
286
 
288
287
  jdNavigateToNative(
289
288
  params: object,
290
289
  url = 'openapp.jdmobile://virtual',
291
290
  successBack?: functionType | null,
292
291
  failBack?: functionType | null,
293
292
  ) {
294
293
  console.log('[降级H5] jdNavigateToNative web.jd:', params);
295
294
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
296
295
  {},
297
296
  {
298
297
  sourceValue: 'sourceValue_jshopModuleWeb',
299
298
  sourceType: 'sourceType_jshopModuleWeb',
300
299
  param: {},
301
300
  },
302
301
  params,
303
302
  );
304
303
  const { logEventInfo, ...otherParams } = getResParams;
305
304
  console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
306
305
  console.log('logEventInfo params: ', logEventInfo);
307
306
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
308
307
  this.clickEventLog(logEventInfo || getResParams)
309
308
  .then(() => {
310
309
  if (typeof successBack === 'function') {
311
310
  successBack(getResParams);
312
311
  } else {
313
312
  try {
314
313
  const paramsStr = JSON.stringify(otherParams);
315
314
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
316
315
  window.location.href = `${url}?params=${paramsStr}`;
317
316
  } catch (e) {
318
317
  console.log('跳转异常', e);
319
318
  }
320
319
  }
321
320
  })
322
321
  .catch(() => {
323
322
  typeof failBack === 'function' && failBack(getResParams);
324
323
  });
325
324
  }
326
325
 
327
326
  clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
328
327
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts;
329
328
  if (eventId && jsonParam) {
330
329
  const { etModelInfo, logBaseInfo } = jsonParam;
331
330
  let getJsonParam = {};
332
331
  if (etModelInfo && logBaseInfo) {
333
332
  getJsonParam = logBaseInfo;
334
333
  } else {
335
334
  if (Array.isArray(jsonParam)) {
336
335
  getJsonParam = jsonParam;
337
336
  } else {
338
337
  getJsonParam = Object.assign(
339
338
  {},
340
339
  {
341
340
  shopid: global.info.queryInfo?.shopId,
342
341
  },
343
342
  jsonParam,
344
343
  );
345
344
  }
346
345
  }
347
346
  if (
348
347
  reportKey === 'exposure' &&
349
348
  /^TerminatorNew/.test(eventId) &&
350
349
  !Array.isArray(getJsonParam)
351
350
  ) {
352
351
  getJsonParam = [getJsonParam];
353
352
  }
354
353
  const webLogParams = {
355
354
  isExpo: reportKey === 'exposure',
356
355
  eid: eventId,
357
356
  elevel: eventLevel,
358
357
  jsonParam: JSON.stringify(getJsonParam),
359
358
  etModel: JSON.stringify(etModelInfo || {}),
360
359
  pageId: this.logPageId,
361
360
  pageParam: this.logPageParamStr,
362
361
  ...otherParams,
363
362
  };
364
363
  return /click|exposure/.test(reportKey)
365
364
  ? reportClick(webLogParams)
366
365
  : reportToCart(opts, webLogParams);
367
366
  } else {
368
367
  console.log('暂无埋点参数eventId和eventParam');
369
368
  return Promise.resolve(false);
370
369
  }
371
370
  }
372
371
 
373
372
  exposureEventLog(opts) {
374
373
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
375
374
  ? this.clickEventLog(
376
375
  {
377
376
  ...opts,
378
377
  exposureState: true,
379
378
  },
380
379
  'exposure',
381
380
  )
382
381
  : Promise.resolve(false);
383
382
  }
383
+ import { JdJumpJdApp } from './jdJumpJdApp';
384
384
  routerInfo: {
385
385
  params: {},
386
386
  },
387
387
  nativeEvent: null,
388
388
  jumpConfig: {
389
389
  venderId: null,
390
390
  shopId: null,
391
391
  sourceValue: '',
392
392
  sourceType: 'App-H5',
393
393
  activityType: 'shopx',
394
394
  moduleId: 'none',
395
395
  entrance: 'none',
396
396
  },
397
397
  logPageParamStr: '',
398
398
  public logPageId: string;
399
399
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
400
400
  constructor(opt = {}) {
401
401
  super(opt);
402
402
  this.getConfig(opt);
403
403
  }
404
404
  getConfig(opt = {}) {
405
405
  return Object.assign(this, {}, defaultConfig, opt);
406
406
  }
407
407
  updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
408
408
  this.logPageId = pageId;
409
409
  this.routerInfo = routerInfo;
410
410
  this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params);
411
411
  this.logPname = logPname;
412
412
  }
413
413
  reportInfoPv(
414
414
  pageId = LogPageIdInfo.APP,
415
415
  opt: {
416
416
  pageParam?: any;
417
417
  } = {},
418
418
  ) {
419
419
  const { pageParam } = opt;
420
420
  this.logPageParamStr = pageParam
421
421
  ? pageParam
422
422
  : this.creatParamToLogStr(this.jumpConfig)
423
423
  .replace(/moduleId/, 'JumpmoduleID')
424
424
  .replace(/entrance/, 'Jumpentrance');
425
425
  reportPV({
426
426
  pageId,
427
427
  pageParam: this.logPageParamStr,
428
428
  ...opt,
429
429
  });
430
430
  }
431
431
 
432
432
  jdJumpToDongDongChatGroup(groupId, source = '4') {
433
433
  this.jdNavigateToNative({
434
434
  category: 'jump',
435
435
  des: 'dongdong_group_chat',
436
436
  source: source,
437
437
  groupId: `${groupId}`,
438
438
  });
439
439
  }
440
440
 
441
441
  jdJumpToWeb(
442
442
  url,
443
443
  logEventInfo,
444
444
  successBack?: functionType | undefined,
445
445
  failBack?: functionType | undefined,
446
446
  ) {
447
447
  console.log('jd web', this.isOpenJdAppUrl(url), url);
448
448
  if (this.isOpenJdAppUrl(url)) {
449
449
  const getOpenAppParams = this.jdOpenAppParams(url);
450
450
  console.log('jd web 获取自定义openApp链接解析后的参数结果', getOpenAppParams);
451
451
  if (getOpenAppParams) {
452
452
 
453
453
  const { useEncodeParams, ...otherLogInfo } = logEventInfo || {};
454
454
  this.jdNavigateToNative(
455
455
  Object.assign({}, getOpenAppParams, {
456
456
  logEventInfo: otherLogInfo,
457
457
  useEncodeParams: Boolean(useEncodeParams),
458
458
  }),
459
459
  );
460
460
  }
461
461
  } else {
462
462
  let _getLastUrl = url;
463
463
  if (/shop\.m\.jd\.com|pages\.jd\.com/.test(_getLastUrl)) {
464
464
  const getUrlSearchParamState = _getLastUrl.indexOf('?') !== -1;
465
465
  if (!/jwebprog=0/.test(_getLastUrl)) {
466
466
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}jwebprog=0`;
467
467
  }
468
468
  if (global.info.sysInfo?.isJdTabletDevice && !/device=tablet/.test(_getLastUrl)) {
469
469
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}device=tablet`;
470
470
  }
471
471
  }
472
472
  super.jdJumpToWeb(
473
473
  _getLastUrl,
474
474
  {
475
475
  ...logEventInfo,
476
476
  },
477
477
  successBack,
478
478
  failBack,
479
479
  );
480
480
  }
481
481
  }
482
482
 
483
483
  jdJumpToWebInner(url, logEventInfo) {
484
484
  this.jdJumpToWeb(url, logEventInfo);
485
485
  }
486
486
 
487
487
  jdJumpConfigUrl(detail, logEventInfo = {}) {
488
488
  const { configDataType, configDataValue } = detail;
489
489
  switch (configDataType) {
490
490
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
491
491
  this.jdJumpToShopCategory({
492
492
  ...configDataValue,
493
493
  logEventInfo,
494
494
  });
495
495
  break;
496
496
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
497
497
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
498
498
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
499
499
  }
500
500
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
501
501
  break;
502
502
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
503
503
  this.jdJumpToWeb(
504
504
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
505
505
  {},
506
506
  );
507
507
  break;
508
508
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
509
509
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
510
510
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
511
511
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
512
512
  getShopSearchParams &&
513
513
  this.jdJumpToShopSearch(
514
514
  Object.assign({}, getShopSearchParams, {
515
515
  logEventInfo,
516
516
  }),
517
517
  );
518
518
  } else {
519
519
  this.jdJumpToShopSearch(
520
520
  configDataValue['cid']
521
521
  ? Object.assign(
522
522
  {},
523
523
  {
524
524
  shopId: global.info.queryInfo.shopId,
525
525
  categoryId: configDataValue.cid,
526
526
  searchType: '5',
527
527
  logEventInfo,
528
528
  },
529
529
  )
530
530
  : {
531
531
  shopId: global.info.queryInfo.shopId,
532
532
  logEventInfo,
533
533
  },
534
534
  );
535
535
  }
536
536
  break;
537
537
  case LinkConfigType.CONFIG_TYPE_MEMBER:
538
538
  if (isAppHomeForMarketPage) {
539
539
  this.jdJumpToBottomTabBrandMember({
540
540
  logEventInfo,
541
541
  });
542
542
  } else {
543
543
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
544
544
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
545
545
  getShopMemberParams &&
546
546
  this.jdJumpToShopMember(
547
547
  Object.assign({}, getShopMemberParams, {
548
548
  logEventInfo,
549
549
  }),
550
550
  );
551
551
  } else {
552
552
  this.jdJumpToShopMember({
553
553
  shopId: global.info.queryInfo.shopId,
554
554
  venderId: configDataValue.shopDetail,
555
555
  logEventInfo,
556
556
  });
557
557
  }
558
558
  }
559
559
  break;
560
560
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
561
561
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
562
562
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
563
563
  getShopActivityParams &&
564
564
  this.jdJumpToShopActivity(
565
565
  Object.assign({}, getShopActivityParams, {
566
566
  logEventInfo,
567
567
  }),
568
568
  );
569
569
  } else if (configDataValue['projectId']) {
570
570
  this.jdJumpToShopActivity({
571
571
  projectId: configDataValue['projectId'],
572
572
  configDataValue,
573
573
  logEventInfo,
574
574
  });
575
575
  }
576
576
  break;
577
577
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
578
578
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
579
579
  const _url = configDataValue.linkUrl;
580
580
  if (
581
581
  _url.indexOf('to=') === -1 &&
582
582
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
583
583
  ) {
584
584
  const _shopId = _url.match(/\d+/g)[0];
585
585
  this.jdJumpToShopHome({
586
586
  shopId: `${_shopId}`,
587
587
  logEventInfo,
588
588
  });
589
589
  } else if (this.isOpenJdAppUrl(_url)) {
590
590
  const getOpenAppParams = this.jdOpenAppParams(_url);
591
591
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams);
592
592
  if (getOpenAppParams) {
593
593
  let _changeOpenAppParams = getOpenAppParams;
594
594
  if (isAppHomeForMarketPage) {
595
595
  const { operation, ...otherOpenAppParams } = getOpenAppParams;
596
596
  if (operation && operation === 'jumpTabInner') {
597
597
  _changeOpenAppParams = otherOpenAppParams;
598
598
  }
599
599
  }
600
600
  this.jdNavigateToNative(
601
601
  Object.assign({}, _changeOpenAppParams, {
602
602
  logEventInfo,
603
603
  }),
604
604
  );
605
605
  }
606
606
  } else {
607
607
  this.jdJumpToWeb(_url, logEventInfo);
608
608
  }
609
609
  break;
610
610
  }
611
611
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
612
612
  this.jdJumpToShopDetail({
613
613
  venderId: global.info.queryInfo.venderId,
614
614
  shopId: global.info.queryInfo.shopId,
615
615
  logEventInfo,
616
616
  });
617
617
  break;
618
618
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
619
619
  this.jdJumpToShopHome({
620
620
  ...configDataValue,
621
621
  logEventInfo,
622
622
  });
623
623
  break;
624
624
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
625
625
  break;
626
626
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
627
627
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
628
628
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
629
629
  getShoppingGuideParams &&
630
630
  this.jdJumpToShopActivity(
631
631
  Object.assign({}, getShoppingGuideParams, {
632
632
  logEventInfo,
633
633
  }),
634
634
  );
635
635
  }
636
636
  break;
637
637
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
638
638
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
639
639
  const search = linkUrl.match(/\?.+/);
640
640
  if (search) {
641
641
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
642
642
  parseQueryUrlString(linkUrl);
643
643
  try {
644
644
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
645
645
  } catch (e) {
646
646
  console.warn('解析小程序 param 错误:', miniQueryData.param);
647
647
  }
648
648
  this.jdJumpToMiniProgram(miniQueryData);
649
649
  } else {
650
650
  console.warn('小程序地址错误:', linkUrl);
651
651
  }
652
652
  break;
653
653
  }
654
654
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
655
655
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
656
656
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
657
657
  console.log('jd web 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
658
658
  getShopSearchParams &&
659
659
  this.jdJumpToShopSearch(
660
660
  Object.assign({}, getShopSearchParams, {
661
661
  logEventInfo,
662
662
  }),
663
663
  );
664
664
  } else {
665
665
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
666
666
  }
667
667
  break;
668
668
  }
669
669
  default:
670
670
  }
671
671
  }
672
672
 
673
673
  jdNavigateToNative(
674
674
  params: object,
675
675
  url = 'openapp.jdmobile://virtual',
676
676
  successBack?: functionType | null,
677
677
  failBack?: functionType | null,
678
678
  ) {
679
679
  console.log('[降级H5] jdNavigateToNative web.jd:', params);
680
680
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
681
681
  {},
682
682
  {
683
683
  sourceValue: 'sourceValue_jshopModuleWeb',
684
684
  sourceType: 'sourceType_jshopModuleWeb',
685
685
  param: {},
686
686
  },
687
687
  params,
688
688
  );
689
689
  const { logEventInfo, useEncodeParams, ...otherParams } = getResParams;
690
690
  console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
691
691
  console.log('logEventInfo params: ', logEventInfo);
692
692
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
693
693
  this.clickEventLog(logEventInfo || getResParams)
694
694
  .then(() => {
695
695
  if (typeof successBack === 'function') {
696
696
  successBack(getResParams);
697
697
  } else {
698
698
  try {
699
699
  const paramsStr = JSON.stringify(otherParams);
700
700
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
701
701
  window.location.href = useEncodeParams
702
702
  ? `${url}?params=${encodeURIComponent(paramsStr)}`
703
703
  : `${url}?params=${paramsStr}`;
704
704
  } catch (e) {
705
705
  console.log('跳转异常', e);
706
706
  draBusinessCustomReport({
707
707
  type: 'jdapp_jdNavigateToNative_catch_err',
708
708
  errMsg: '跳转web jd open协议发生错误',
709
709
  originReqDataStr: JSON.stringify({
710
710
  url,
711
711
  isJdApp,
712
712
  jdAppVersion: jdAppVersionStr,
713
713
  ...otherParams,
714
714
  }),
715
715
  });
716
716
  }
717
717
  }
718
718
  })
719
719
  .catch(() => {
720
720
  typeof failBack === 'function' && failBack(getResParams);
721
721
  });
722
722
  }
723
723
 
724
724
  clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
725
725
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts;
726
726
  if (eventId && jsonParam) {
727
727
  const { etModelInfo, logBaseInfo } = jsonParam;
728
728
  let getJsonParam = {};
729
729
  if (etModelInfo && logBaseInfo) {
730
730
  getJsonParam = logBaseInfo;
731
731
  } else {
732
732
  if (Array.isArray(jsonParam)) {
733
733
  getJsonParam = jsonParam;
734
734
  } else {
735
735
  getJsonParam = Object.assign(
736
736
  {},
737
737
  {
738
738
  shopid: global.info.queryInfo?.shopId,
739
739
  },
740
740
  jsonParam,
741
741
  );
742
742
  }
743
743
  }
744
744
  if (
745
745
  reportKey === 'exposure' &&
746
746
  /^TerminatorNew/.test(eventId) &&
747
747
  !Array.isArray(getJsonParam)
748
748
  ) {
749
749
  getJsonParam = [getJsonParam];
750
750
  }
751
751
  const webLogParams = {
752
752
  isExpo: reportKey === 'exposure',
753
753
  eid: eventId,
754
754
  elevel: eventLevel,
755
755
  jsonParam: JSON.stringify(getJsonParam),
756
756
  etModel: JSON.stringify(etModelInfo || {}),
757
757
  pageId: this.logPageId,
758
758
  pageParam: this.logPageParamStr,
759
759
  ...otherParams,
760
760
  };
761
761
  return /click|exposure/.test(reportKey)
762
762
  ? reportClick(webLogParams)
763
763
  : reportToCart(opts, webLogParams);
764
764
  } else {
765
765
  console.log('暂无埋点参数eventId和eventParam');
766
766
  return Promise.resolve(false);
767
767
  }
768
768
  }
769
769
 
770
770
  exposureEventLog(opts) {
771
771
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
772
772
  ? this.clickEventLog(
773
773
  {
774
774
  ...opts,
775
775
  exposureState: true,
776
776
  },
777
777
  'exposure',
778
778
  )
779
779
  : Promise.resolve(false);
780
780
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conecli/cone-render",
3
- "version": "0.8.20-shop.220",
3
+ "version": "0.8.20-shop.221",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist/"