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