@conecli/cone-render 0.8.22-beta.0 → 0.8.22

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
- import { isApp, getUrlQuery } from '../utils/jm-common'
1
+ import { isApp, getUrlQuery } from '../utils/jm-common'
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  console.log('京购商详页跳转:', this.jumpMiniPath.detail)
2
+ import Taro from '@tarojs/taro'
3
3
  console.log('京购商详页跳转:', this.jumpMiniPath.detail)
4
4
  const getJsonParam = etModelInfo && logBaseInfo ? logBaseInfo : Object.assign({},{
5
5
  shopid: global.info.queryInfo?.shopId,
6
6
  },jsonParam)
@@ -1 +1 @@
1
- export enum LogPnameInfo {
1
+ export enum LogPnameInfo {
2
2
  MOBILE_SEARCH = 'MShop_SearchResult'
@@ -1 +1 @@
1
- import global from '../common'
1
+ import global from '../common'
2
2
  const pageParamStr = typeof pageParam === 'object' ? JSON.stringify(pageParam) : pageParam
3
3
 
4
4
  jdJumpToTabAllProductInner(shopId, venderId, logEventInfo = {}){
5
5
  this.jdJumpToTabAllProduct(shopId, venderId, logEventInfo)
6
6
  }
7
7
  const getJsonParam = etModelInfo && logBaseInfo ? logBaseInfo : Object.assign({},{
8
8
  shopid: global.info.queryInfo?.shopId,
9
9
  },jsonParam)
10
10
  jsonParam: JSON.stringify(getJsonParam),
@@ -1 +1 @@
1
- import * as device from './device'
2
1
  device,
3
2
  environment,
4
3
  jump,
5
4
  storage,
6
5
  util,
7
6
  moduleUtil,
8
7
  track,
9
8
  trackPromise,
10
9
  global,
11
10
  http,
12
11
  shopMember,
13
12
  requestServer,
13
+ import * as device from './device'
@@ -1 +1 @@
1
- import { JumpEventReport, JumpEventReportPromise } from '../../jumpEventReport'
2
1
  jdJumpToShopHome: (info: object) => void
3
2
  jdJumpToProduct: (skuId: string | null, logEventInfo: object) => void
4
3
  jdJumpConfigUrl: (detail: object, logEventInfo: object) => void
5
4
  jdJumpToShopMemberInfo: (logEventInfo: object) => void
6
5
  jdJumpToShopMemberPointDetail: (logEventInfo: object) => void
7
6
  jdJumpToShopMemberBenefit: (logEventInfo: object) => void
8
7
  jdJumpToShopMemberRule: (logEventInfo: object) => void
9
8
  jdJumpToShopMemberCloseAccount: (
10
9
  venderType: number,
11
10
  logEventInfo: object,
12
11
  ) => void
13
12
  jdJumpToShopMemberPointExchange: (
14
13
  venderType: number,
15
14
  channel: number,
16
15
  levelZeroMenuUrl: string,
17
16
  logEventInfo: object,
18
17
  ) => void
19
18
  jdJumpToShopMemberBonusPurchase: (
20
19
  customerLevel: number,
21
20
  logEventInfo: object,
22
21
  ) => void
23
22
  jdJumpToShopMemberGood: (customerLevel: number, logEventInfo: object) => void
24
23
  jdJumpToBeanDetail: (logEventInfo: object) => void
25
24
  jdJumpToMyRedEnvelope: (logEventInfo: object) => void
26
25
  jdJumpToMyCoupon: (logEventInfo: object) => void
27
26
  jdJumpToShopHome: () => {},
28
27
  jdJumpToProduct: () => {},
29
28
  jdJumpConfigUrl: () => {},
30
29
  jdJumpToShopMemberInfo: () => {},
31
30
  jdJumpToShopMemberPointDetail: () => {},
32
31
  jdJumpToShopMemberBenefit: () => {},
33
32
  jdJumpToShopMemberRule: () => {},
34
33
  jdJumpToShopMemberCloseAccount: () => {},
35
34
  jdJumpToShopMemberPointExchange: () => {},
36
35
  jdJumpToShopMemberBonusPurchase: () => {},
37
36
  jdJumpToShopMemberGood: () => {},
38
37
  jdJumpToBeanDetail: () => {},
39
38
  jdJumpToMyRedEnvelope: () => {},
40
39
  jdJumpToMyCoupon: () => {},
41
40
  jdJumpToWeb: (url: string, logEventInfo: object) => void
42
41
  jdJumpToAppMiniProgram: (path: string, logEventInfo: object) => void
43
42
  jdJumpToShopLight: (detail: object) => void
44
43
  jdJumpToAppMiniProgram: () => {},
45
44
  jdJumpToShopLight: () => {},
46
45
  jdJumpToWeb: () => {},
47
46
  [key: string]: any
48
47
  [key: string]: any
49
48
  const {
50
49
  jdJumpToTabAllProduct,
51
50
  jdJumpToShopHome,
52
51
  jdJumpToProduct,
53
52
  jdJumpToShopSearch,
54
53
  jdJumpConfigUrl,
55
54
  jdJumpToShopMemberInfo,
56
55
  jdJumpToShopMemberPointDetail,
57
56
  jdJumpToShopMemberBenefit,
58
57
  jdJumpToShopMemberRule,
59
58
  jdJumpToShopMemberCloseAccount,
60
59
  jdJumpToShopMemberPointExchange,
61
60
  jdJumpToShopMemberBonusPurchase,
62
61
  jdJumpToShopMemberGood,
63
62
  jdJumpToBeanDetail,
64
63
  jdJumpToMyRedEnvelope,
65
64
  jdJumpToMyCoupon,
66
65
  } = JumpEventReport
67
66
  const {
68
67
  jdJumpToAppMiniProgram,
69
68
  jdJumpToShopLight,
70
69
  jdJumpToWeb,
71
70
  jumpWebUrl,
72
71
  jumpMiniPath,
73
72
  } = JumpEventReport
74
73
  Object.assign(business, {
75
74
  jdJumpToShopHome: jdJumpToShopHome.bind(JumpEventReport),
76
75
  jdJumpToProduct: jdJumpToProduct.bind(JumpEventReport),
77
76
  jdJumpConfigUrl: jdJumpConfigUrl.bind(JumpEventReport),
78
77
  jdJumpToShopMemberInfo: jdJumpToShopMemberInfo.bind(JumpEventReport),
79
78
  jdJumpToShopMemberPointDetail:
80
79
  jdJumpToShopMemberPointDetail.bind(JumpEventReport),
81
80
  jdJumpToShopMemberBenefit: jdJumpToShopMemberBenefit.bind(JumpEventReport),
82
81
  jdJumpToShopMemberRule: jdJumpToShopMemberRule.bind(JumpEventReport),
83
82
  jdJumpToShopMemberCloseAccount:
84
83
  jdJumpToShopMemberCloseAccount.bind(JumpEventReport),
85
84
  jdJumpToShopMemberPointExchange:
86
85
  jdJumpToShopMemberPointExchange.bind(JumpEventReport),
87
86
  jdJumpToShopMemberBonusPurchase:
88
87
  jdJumpToShopMemberBonusPurchase.bind(JumpEventReport),
89
88
  jdJumpToShopMemberGood: jdJumpToShopMemberGood.bind(JumpEventReport),
90
89
  jdJumpToBeanDetail: jdJumpToBeanDetail.bind(JumpEventReport),
91
90
  jdJumpToMyRedEnvelope: jdJumpToMyRedEnvelope.bind(JumpEventReport),
92
91
  jdJumpToMyCoupon: jdJumpToMyCoupon.bind(JumpEventReport),
93
92
  })
94
93
  Object.assign(side, {
95
94
  jdJumpToAppMiniProgram: jdJumpToAppMiniProgram.bind(JumpEventReport),
96
95
  jdJumpToShopLight: jdJumpToShopLight.bind(JumpEventReport),
97
96
  jdJumpToWeb: jdJumpToWeb.bind(JumpEventReport),
98
97
  jumpWebUrl,
99
98
  jumpMiniPath,
100
99
  })
101
100
  Object.assign(webUrl, jumpWebUrl)
102
101
  Object.assign(minPath, jumpMiniPath)
102
+ import { JumpEventReport, JumpEventReportPromise } from '../../jumpEventReport'
103
103
  jdJumpToShopHome: (info: object) => void
104
104
  jdJumpToProduct: (skuId: string | null, logEventInfo: object) => void
105
105
  jdJumpConfigUrl: (detail: object, logEventInfo: object) => void
106
106
  jdJumpToShopMemberInfo: (logEventInfo: object) => void
107
107
  jdJumpToShopMemberPointDetail: (logEventInfo: object) => void
108
108
  jdJumpToShopMemberBenefit: (logEventInfo: object) => void
109
109
  jdJumpToShopMemberRule: (logEventInfo: object) => void
110
110
  jdJumpToShopMemberCloseAccount: (
111
111
  venderType: number,
112
112
  logEventInfo: object,
113
113
  ) => void
114
114
  jdJumpToShopMemberPointExchange: (
115
115
  venderType: number,
116
116
  channel: number,
117
117
  levelZeroMenuUrl: string,
118
118
  logEventInfo: object,
119
119
  ) => void
120
120
  jdJumpToShopMemberBonusPurchase: (
121
121
  customerLevel: number,
122
122
  logEventInfo: object,
123
123
  ) => void
124
124
  jdJumpToShopMemberGood: (customerLevel: number, logEventInfo: object) => void
125
125
  jdJumpToBeanDetail: (logEventInfo: object) => void
126
126
  jdJumpToMyRedEnvelope: (logEventInfo: object) => void
127
127
  jdJumpToMyCoupon: (logEventInfo: object) => void
128
128
  jdJumpToTabAllProduct: (shopId: string | number,venderId: string | number,logEventInfo: object) => void
129
129
  jdJumpToTabAllProductInner: (shopId: string | number,venderId: string | number,logEventInfo: object) => void
130
130
  jdJumpToShopHome: () => {},
131
131
  jdJumpToProduct: () => {},
132
132
  jdJumpConfigUrl: () => {},
133
133
  jdJumpToShopMemberInfo: () => {},
134
134
  jdJumpToShopMemberPointDetail: () => {},
135
135
  jdJumpToShopMemberBenefit: () => {},
136
136
  jdJumpToShopMemberRule: () => {},
137
137
  jdJumpToShopMemberCloseAccount: () => {},
138
138
  jdJumpToShopMemberPointExchange: () => {},
139
139
  jdJumpToShopMemberBonusPurchase: () => {},
140
140
  jdJumpToShopMemberGood: () => {},
141
141
  jdJumpToBeanDetail: () => {},
142
142
  jdJumpToMyRedEnvelope: () => {},
143
143
  jdJumpToMyCoupon: () => {},
144
144
  jdJumpToTabAllProductInner: () => {},
145
145
  jdJumpToWeb: (url: string, logEventInfo: object) => void
146
146
  jdJumpToAppMiniProgram: (path: string, logEventInfo: object) => void
147
147
  jdJumpToShopLight: (detail: object) => void
148
148
  jdJumpToAppMiniProgram: () => {},
149
149
  jdJumpToShopLight: () => {},
150
150
  jdJumpToWeb: () => {},
151
151
  [key: string]: any
152
152
  [key: string]: any
153
153
  const {
154
154
  jdJumpToShopHome,
155
155
  jdJumpToProduct,
156
156
  jdJumpConfigUrl,
157
157
  jdJumpToShopMemberInfo,
158
158
  jdJumpToShopMemberPointDetail,
159
159
  jdJumpToShopMemberBenefit,
160
160
  jdJumpToShopMemberRule,
161
161
  jdJumpToShopMemberCloseAccount,
162
162
  jdJumpToShopMemberPointExchange,
163
163
  jdJumpToShopMemberBonusPurchase,
164
164
  jdJumpToShopMemberGood,
165
165
  jdJumpToBeanDetail,
166
166
  jdJumpToMyRedEnvelope,
167
167
  jdJumpToMyCoupon,
168
168
  jdJumpToTabAllProduct,
169
169
  jdJumpToTabAllProductInner,
170
170
  } = JumpEventReport
171
171
  const {
172
172
  jdJumpToAppMiniProgram,
173
173
  jdJumpToShopLight,
174
174
  jdJumpToWeb,
175
175
  jumpWebUrl,
176
176
  jumpMiniPath,
177
177
  } = JumpEventReport
178
178
  Object.assign(business, {
179
179
  jdJumpToShopHome: jdJumpToShopHome.bind(JumpEventReport),
180
180
  jdJumpToProduct: jdJumpToProduct.bind(JumpEventReport),
181
181
  jdJumpConfigUrl: jdJumpConfigUrl.bind(JumpEventReport),
182
182
  jdJumpToShopMemberInfo: jdJumpToShopMemberInfo.bind(JumpEventReport),
183
183
  jdJumpToShopMemberPointDetail:
184
184
  jdJumpToShopMemberPointDetail.bind(JumpEventReport),
185
185
  jdJumpToShopMemberBenefit: jdJumpToShopMemberBenefit.bind(JumpEventReport),
186
186
  jdJumpToShopMemberRule: jdJumpToShopMemberRule.bind(JumpEventReport),
187
187
  jdJumpToShopMemberCloseAccount:
188
188
  jdJumpToShopMemberCloseAccount.bind(JumpEventReport),
189
189
  jdJumpToShopMemberPointExchange:
190
190
  jdJumpToShopMemberPointExchange.bind(JumpEventReport),
191
191
  jdJumpToShopMemberBonusPurchase:
192
192
  jdJumpToShopMemberBonusPurchase.bind(JumpEventReport),
193
193
  jdJumpToShopMemberGood: jdJumpToShopMemberGood.bind(JumpEventReport),
194
194
  jdJumpToBeanDetail: jdJumpToBeanDetail.bind(JumpEventReport),
195
195
  jdJumpToMyRedEnvelope: jdJumpToMyRedEnvelope.bind(JumpEventReport),
196
196
  jdJumpToMyCoupon: jdJumpToMyCoupon.bind(JumpEventReport),
197
197
  jdJumpToTabAllProduct: jdJumpToTabAllProduct.bind(JumpEventReport),
198
198
  jdJumpToTabAllProductInner: jdJumpToTabAllProductInner.bind(JumpEventReport),
199
199
  })
200
200
  Object.assign(side, {
201
201
  jdJumpToAppMiniProgram: jdJumpToAppMiniProgram.bind(JumpEventReport),
202
202
  jdJumpToShopLight: jdJumpToShopLight.bind(JumpEventReport),
203
203
  jdJumpToWeb: jdJumpToWeb.bind(JumpEventReport),
204
204
  jumpWebUrl,
205
205
  jumpMiniPath,
206
206
  })
207
207
  Object.assign(webUrl, jumpWebUrl)
208
208
  Object.assign(minPath, jumpMiniPath)
@@ -1 +1 @@
1
- export const HttpStatus = {
2
1
  SUCCESS: 200,
3
2
  CREATED: 201,
4
3
  ACCEPTED: 202,
5
4
  CLIENT_ERROR: 400,
6
5
  AUTHENTICATE: 401,
7
6
  FORBIDDEN: 403,
8
7
  NOT_FOUND: 404,
9
8
  SERVER_ERROR: 500,
10
9
  BAD_GATEWAY: 502,
11
10
  SERVICE_UNAVAILABLE: 503,
12
11
  GATEWAY_TIMEOUT: 504
13
12
  [HttpStatus.NOT_FOUND]: "请求资源不存在",
14
13
  [HttpStatus.BAD_GATEWAY]: "服务端异常,请稍后重试",
15
14
  [HttpStatus.FORBIDDEN]: "没有权限访问",
16
15
  [HttpStatus.AUTHENTICATE]: "需要鉴权",
17
16
  [HttpStatus.SUCCESS]: "成功"
18
17
  "getPagePreview"
19
18
  "getShopHomeFloorInfo",
20
19
  "getShopCategory",
21
20
  "getShopNavigationCategory",
22
21
  "receiveShopCoupon",
23
22
  "getShopHomePromotionWebPage",
24
23
  "shopGuessYouLike",
25
24
  "addRemind",
26
25
  "cancelRemind",
27
26
  "getVipDetail",
28
27
  "shopDetail",
29
28
  "address_queryAddress",
30
29
  "shopMemberSprintJoinActivity",
31
30
  "shopMemberSprintReceivePrize"
31
+ export const HttpStatus = {
32
32
  SUCCESS: 200,
33
33
  CREATED: 201,
34
34
  ACCEPTED: 202,
35
35
  CLIENT_ERROR: 400,
36
36
  AUTHENTICATE: 401,
37
37
  FORBIDDEN: 403,
38
38
  NOT_FOUND: 404,
39
39
  SERVER_ERROR: 500,
40
40
  BAD_GATEWAY: 502,
41
41
  SERVICE_UNAVAILABLE: 503,
42
42
  GATEWAY_TIMEOUT: 504
43
43
  [HttpStatus.NOT_FOUND]: "请求资源不存在",
44
44
  [HttpStatus.BAD_GATEWAY]: "服务端异常,请稍后重试",
45
45
  [HttpStatus.FORBIDDEN]: "没有权限访问",
46
46
  [HttpStatus.AUTHENTICATE]: "需要鉴权",
47
47
  [HttpStatus.SUCCESS]: "成功"
@@ -1 +1 @@
1
- import Taro, { RequestTask } from '@tarojs/taro'
2
1
  jsonHeader = 'application/json;charset=utf-8',
3
2
  formDataHeader = 'application/x-www-form-urlencoded',
4
3
  public fmInfo: {
5
4
  eid?: string
6
5
  fp?: string
7
6
  jsToken?: string
8
7
  sdkToken?: string
9
8
  }
10
9
  public api: ServiceInterFace.HttpApi
11
10
  constructor() {
12
11
  this._init()
13
12
  this.api = api
14
13
  this.fmInfo = {}
15
14
  }
16
15
  _init(): void {
17
16
  httpInterceptors.forEach((item) => {
18
17
  Taro.addInterceptor((chain) => item(chain))
19
18
  })
20
19
  }
21
20
 
22
21
  get(url: string, data: any = null, otherOptions = {}): Taro.RequestTask<any> {
23
22
  return this.request({ url, data, method: 'GET', ...otherOptions })
24
23
  }
25
24
 
26
25
  post(
27
26
  url: string,
28
27
  data: any = null,
29
28
  otherOptions = {},
30
29
  ): Taro.RequestTask<any> {
31
30
  return this.request({ url, data, method: 'POST', ...otherOptions })
32
31
  }
33
32
 
34
33
  _getMobileJsToken(): Promise<{
35
34
  ok: boolean
36
35
  data?: any
37
36
  error?: any
38
37
  }> {
39
38
  return new Promise((resolve, reject) => {
40
39
  try {
41
40
  if (window?.getJsToken) {
42
41
  window.getJsToken(function (res) {
43
42
  console.log('JS token 获取结果:', res)
44
43
  resolve({
45
44
  ok: true,
46
45
  data: res,
47
46
  })
48
47
  }, 600)
49
48
  } else {
50
49
  reject({
51
50
  ok: false,
52
51
  error: '没有识别到getJsToken全局方法',
53
52
  })
54
53
  }
55
54
  } catch (e) {
56
55
  console.log('获取指纹JS token 异常', e)
57
56
  reject({
58
57
  ok: false,
59
58
  error: e,
60
59
  })
61
60
  }
62
61
  })
63
62
  }
64
63
 
65
64
  async _getFmInfo() {
66
65
  try {
67
66
  const { ok, data } = await this._getMobileJsToken()
68
67
  this.fmInfo = ok && data ? data : this.fmInfo
69
68
  return this.fmInfo
70
69
  } catch (e) {
71
70
  console.log('获取指纹信息异常', e)
72
71
  return this.fmInfo
73
72
  }
74
73
  }
75
74
 
76
75
  async request({
77
76
  url,
78
77
  method = 'POST',
79
78
  timeout = 7000,
80
79
  ...otherOptions
81
80
  }): RequestTask<any> {
82
81
  const header = {
83
82
  'content-type':
84
83
  method === 'POST'
85
84
  ? RequestHeaderContentType.formDataHeader
86
85
  : RequestHeaderContentType.jsonHeader,
87
86
  }
88
87
  const getReqData = otherOptions.data
89
88
  if (url === this.api.apiFunc && typeof getReqData === 'object') {
90
89
  const { jsToken } = await this._getFmInfo()
91
90
  jsToken && (getReqData['x-api-eid-token'] = jsToken)
92
91
  }
93
92
  const requestTask = Taro.request({
94
93
  url,
95
94
  method,
96
95
  timeout,
97
96
  header,
98
97
  credentials: 'include',
99
98
  ...otherOptions,
100
99
  })
101
100
  const requestTimeoutPromise =
102
101
  new Promise<ServiceInterFace.RequestPromiseRes>((resolve) => {
103
102
  setTimeout(() => {
104
103
  resolve({
105
104
  statusCode: 500,
106
105
  resTimeoutState: true,
107
106
  errMsg: 'request timeout',
108
107
  })
109
108
  }, timeout)
110
109
  })
111
110
  return Promise.race([requestTask, requestTimeoutPromise]).then(
112
111
  (res: any) => {
113
112
  if (res && res.statusCode === 500 && res.resTimeoutState) {
114
113
  console.log('request 请求超时 url:' + url)
115
114
  requestTask.abort && requestTask.abort()
116
115
  }
117
116
  return res
118
117
  },
119
118
  )
120
119
  }
120
+ import Taro, { RequestTask } from "@tarojs/taro";
121
121
  jsonHeader = "application/json;charset=utf-8",
122
122
  formDataHeader = "application/x-www-form-urlencoded"
123
123
  constructor() {
124
124
  this._init()
125
125
  }
126
126
  _init(): void {
127
127
  httpInterceptors.forEach((item) => {
128
128
  Taro.addInterceptor((chain) => item(chain))
129
129
  })
130
130
  }
131
131
 
132
132
  get(url: string, data: any = null, otherOptions = {}): Taro.RequestTask<any> {
133
133
  return this.request({url, data, method:"GET", ...otherOptions})
134
134
  }
135
135
 
136
136
  post(
137
137
  url: string,
138
138
  data: any = null,
139
139
  otherOptions = {}
140
140
  ): Taro.RequestTask<any> {
141
141
  return this.request({url, data, method:"POST", ...otherOptions})
142
142
  }
143
143
 
144
144
  request({url, method = "POST", timeout = 7000, ...otherOptions}): RequestTask<any> {
145
145
  const header = {
146
146
  "content-type": method === "POST" ? RequestHeaderContentType.formDataHeader : RequestHeaderContentType.jsonHeader
147
147
  }
148
148
  const requestTask = Taro.request({
149
149
  url,
150
150
  method,
151
151
  timeout,
152
152
  header,
153
153
  credentials: 'include',
154
154
  ...otherOptions,
155
155
  })
156
156
  const requestTimeoutPromise =
157
157
  new Promise<ServiceInterFace.RequestPromiseRes>((resolve) => {
158
158
  setTimeout(() => {
159
159
  resolve({
160
160
  statusCode: 500,
161
161
  resTimeoutState: true,
162
162
  errMsg: 'request timeout',
163
163
  })
164
164
  }, timeout)
165
165
  })
166
166
  return Promise.race([requestTask, requestTimeoutPromise]).then(
167
167
  (res: any) => {
168
168
  if (res && res.statusCode === 500 && res.resTimeoutState) {
169
169
  console.log('request 请求超时 url:' + url)
170
170
  requestTask.abort && requestTask.abort()
171
171
  }
172
172
  return res
173
173
  }
174
174
  )
175
175
  }
@@ -1 +1 @@
1
- var splitOnFirst = function splitOnFirst(string, separator) {
2
1
  return Object.prototype.toString.call(obj);
3
2
  return typeof obj === 'function';
4
3
  return '[object Object]' === getType(obj);
5
4
  return '[object Array]' == getType(obj);
6
5
  return '[object Undefined]' === getType(obj);
7
6
  return '[object Null]' == getType(obj);
8
7
  return typeof obj === 'string';
9
8
  return typeof obj === 'boolean';
10
9
  return '[object Number]' === getType(num);
11
10
  ua = ua || navigator.userAgent;
12
11
  if (name === 'wx') return (/micromessenger/i.test(ua)
13
12
  );
14
13
  if (name === 'qq') return (/qq\//i.test(ua)
15
14
  );
16
15
  if (name === 'weibo') return (/weibo/i.test(ua)
17
16
  );
18
17
  if (name === 'jd') return (/^jdapp/i.test(ua)
19
18
  );
20
19
  if (name === 'jdlittle') return (/^jdltapp/i.test(ua)
21
20
  );
22
21
  if (name === 'mp') return navigator.userAgent.match(/micromessenger/i) && navigator.userAgent.match(/miniprogram/i) || window.__wxjs_environment === 'miniprogram';
23
22
  if (name === 'jdb') return (/JDBmall/i.test(ua)
24
23
  );
25
24
  return false;
26
25
  ua = ua || navigator.userAgent;
27
26
  return (/android/i.test(ua) && !isIOS()
28
27
  );
29
28
  ua = ua || navigator.userAgent;
30
29
  return (/ip(hone|od)|ipad/i.test(ua)
31
30
  );
32
31
  ua = ua || navigator.userAgent;
33
32
  return (/ipad/i.test(ua) || /android/i.test(ua) && !/mobi|mini|fennec/i.test(ua)
34
33
  );
35
34
  ua = ua || navigator.userAgent;
36
35
  return !!ua.match(/ip(hone|od)|android.+mobile|windows (ce|phone)|blackberry|bb10|symbian|webos|firefox.+fennec|opera m(ob|in)i|polaris|iemobile|lgtelecom|nokia|sonyericsson|dolfin|uzard|natebrowser|ktf;|skt;/i);
37
36
  ua = ua || navigator.userAgent;
38
37
  return !!ua.match(/iphone/i);
39
38
  ua = ua || navigator.userAgent;
40
39
  return !!ua.match(/ipad/i);
41
40
  ua = ua || navigator.userAgent;
42
41
  if (name === 'xview') return typeof window.XView !== 'undefined';
43
42
  if (name === 'wk') return !!ua.match(/supportjdshwk/i) || window._is_jdsh_wkwebview == 1;
44
43
  return false;
45
44
  ua = ua || navigator.userAgent;
46
45
  var re = /nettype\/([\S]*)/i;
47
46
  if (isApp('jd', ua)) re = /network\/([^;]*)/i;
48
47
  return re.test(ua) ? RegExp.$1.toLowerCase() : 'unknown';
49
48
  ua = ua || navigator.userAgent;
50
49
  if (!isApp('jd', ua)) return null;
51
50
  return ua.split(';')[4];
52
51
  ua = ua || navigator.userAgent;
53
52
  if (appName === 'jd') return ua.split(';')[2] || null;
54
53
  if (appName === 'wx') return (/micromessenger\/([\S]*)/i.test(ua) ? RegExp.$1 : null
55
54
  );
56
55
  if (appName === 'qq') return (/qq\/([\S]*)/i.test(ua) ? RegExp.$1 : null
57
56
  );
58
57
  return null;
59
58
  ua = ua || navigator.userAgent;
60
59
  var match = ua.match(/android\s([0-9\.]*)/i);
61
60
  return match ? match[1] : 'unknown';
62
61
  ua = ua || navigator.userAgent;
63
62
  var match = ua.match(/OS ((\d+_?){2,3})\s/i);
64
63
  return match ? match[1].replace(/_/g, '.') : 'unknown';
64
+ var splitOnFirst = function splitOnFirst(string, separator) {
65
65
  return Object.prototype.toString.call(obj);
66
66
  return typeof obj === 'function';
67
67
  return '[object Object]' === getType(obj);
68
68
  return '[object Array]' == getType(obj);
69
69
  return '[object Undefined]' === getType(obj);
70
70
  return '[object Null]' == getType(obj);
71
71
  return typeof obj === 'string';
72
72
  return typeof obj === 'boolean';
73
73
  return '[object Number]' === getType(num);
74
74
  ua = ua || navigator.userAgent;
75
75
  if (name === 'wx') return (/micromessenger/i.test(ua)
76
76
  );
77
77
  if (name === 'qq') return (/qq\//i.test(ua)
78
78
  );
79
79
  if (name === 'weibo') return (/weibo/i.test(ua)
80
80
  );
81
81
  if (name === 'jd') return (/^jdapp/i.test(ua)
82
82
  );
83
83
  if (name === 'jdlittle') return (/^jdltapp/i.test(ua)
84
84
  );
85
85
  if (name === 'mp') return navigator.userAgent.match(/micromessenger/i) && navigator.userAgent.match(/miniprogram/i) || window.__wxjs_environment === 'miniprogram';
86
86
  return false;
87
87
  ua = ua || navigator.userAgent;
88
88
  return (/android/i.test(ua) && !isIOS()
89
89
  );
90
90
  ua = ua || navigator.userAgent;
91
91
  return (/ip(hone|od)|ipad/i.test(ua)
92
92
  );
93
93
  ua = ua || navigator.userAgent;
94
94
  return (/ipad/i.test(ua) || /android/i.test(ua) && !/mobi|mini|fennec/i.test(ua)
95
95
  );
96
96
  ua = ua || navigator.userAgent;
97
97
  return !!ua.match(/ip(hone|od)|android.+mobile|windows (ce|phone)|blackberry|bb10|symbian|webos|firefox.+fennec|opera m(ob|in)i|polaris|iemobile|lgtelecom|nokia|sonyericsson|dolfin|uzard|natebrowser|ktf;|skt;/i);
98
98
  ua = ua || navigator.userAgent;
99
99
  return !!ua.match(/iphone/i);
100
100
  ua = ua || navigator.userAgent;
101
101
  return !!ua.match(/ipad/i);
102
102
  ua = ua || navigator.userAgent;
103
103
  if (name === 'xview') return typeof window.XView !== 'undefined';
104
104
  if (name === 'wk') return !!ua.match(/supportjdshwk/i) || window._is_jdsh_wkwebview == 1;
105
105
  return false;
106
106
  ua = ua || navigator.userAgent;
107
107
  var re = /nettype\/([\S]*)/i;
108
108
  if (isApp('jd', ua)) re = /network\/([^;]*)/i;
109
109
  return re.test(ua) ? RegExp.$1.toLowerCase() : 'unknown';
110
110
  ua = ua || navigator.userAgent;
111
111
  if (!isApp('jd', ua)) return null;
112
112
  return ua.split(';')[4];
113
113
  ua = ua || navigator.userAgent;
114
114
  if (appName === 'jd') return ua.split(';')[2] || null;
115
115
  if (appName === 'wx') return (/micromessenger\/([\S]*)/i.test(ua) ? RegExp.$1 : null
116
116
  );
117
117
  if (appName === 'qq') return (/qq\/([\S]*)/i.test(ua) ? RegExp.$1 : null
118
118
  );
119
119
  return null;
120
120
  ua = ua || navigator.userAgent;
121
121
  var match = ua.match(/android\s([0-9\.]*)/i);
122
122
  return match ? match[1] : 'unknown';
123
123
  ua = ua || navigator.userAgent;
124
124
  var match = ua.match(/OS ((\d+_?){2,3})\s/i);
125
125
  return match ? match[1].replace(/_/g, '.') : 'unknown';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conecli/cone-render",
3
- "version": "0.8.22-beta.0",
3
+ "version": "0.8.22",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist/"
@@ -1 +0,0 @@
1
- import { JdJumpJdApp } from './jdJumpJdApp'
2
  reportClick,
3
1
  reportToCart,
4
2
  routerInfo: {
5
3
  params: {},
6
4
  },
7
5
  nativeEvent: null,
8
6
  jumpConfig: {
9
7
  venderId: null,
10
8
  shopId: null,
11
9
  sourceValue: '',
12
10
  sourceType: 'App-H5',
13
11
  activityType: 'shopx',
14
12
  moduleId: 'none',
15
13
  entrance: 'none',
16
14
  },
17
15
  logPageParamStr: '',
18
16
  public logPageId: string
19
17
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
20
18
  constructor(opt = {}) {
21
19
  console.log("jdb加载==========")
22
20
  super(opt)
23
21
  this.getConfig(opt)
24
22
  }
25
23
 
26
24
  jdJumpToProduct(skuParams, logEventInfo) {
27
25
  if(typeof skuParams !== 'object') {
28
26
  console.error('万商app跳转商品详情参数需要对象,详情请查看文档')
29
27
  return
30
28
  }
31
29
 
32
30
  let { skuId, bMallTag, skuUniformBizInfo } = skuParams
33
31
  skuId = skuId.toString().trim()
34
32
  this.jdNavigateToNative({
35
33
  category: 'jump',
36
34
  des: 'skudetail',
37
35
  param: {
38
36
  skuId: skuId,
39
37
  bMallTag: bMallTag,
40
38
  skuUniformBizInfo
41
39
  },
42
40
  logEventInfo,
43
41
  })
44
42
  }
45
43
  jdNavigateToNative(
46
44
  console.log("otherParams", otherParams)
47
45
  const paramsStr = JSON.stringify(otherParams)
48
46
  console.log(
49
47
  '跳转web jd open协议',
50
48
  `${url}?params=${paramsStr}`,
51
49
  )
52
50
  console.log('catch', e)
53
51
  clickEventLog(
54
52
  getConfig(opt = {}) {
55
53
  return Object.assign(this, {}, defaultConfig, opt)
56
54
  }