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