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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/common/const.ts +1 -1
  3. package/dist/common/index.h5.ts +1 -1
  4. package/dist/common/index.jd.ts +1 -1
  5. package/dist/common/index.ts +1 -1
  6. package/dist/common/index.weapp.ts +1 -1
  7. package/dist/common/jssdk.ts +1 -1
  8. package/dist/common/token/index.h5.ts +1 -1
  9. package/dist/common/token/token.jd.ts +1 -1
  10. package/dist/common/wxappApi.ts +1 -1
  11. package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
  12. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  13. package/dist/components/base/CustomScrollView/index-back.tsx +1 -0
  14. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  15. package/dist/components/base/Dialog/index.module.scss +11 -0
  16. package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
  17. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  18. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  19. package/dist/components/base/InViewRender/index.tsx +1 -1
  20. package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
  21. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  22. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  23. package/dist/components/floorItem.weapp.tsx +1 -1
  24. package/dist/interface/common.ts +1 -1
  25. package/dist/interface/jumpEventReport.ts +1 -1
  26. package/dist/interface/service.ts +1 -1
  27. package/dist/jumpEventReport/base.ts +1 -1
  28. package/dist/jumpEventReport/const.ts +1 -1
  29. package/dist/jumpEventReport/index.weapp.ts +1 -1
  30. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  31. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  32. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  33. package/dist/jumpEventReport/web/report.ts +1 -1
  34. package/dist/jumpEventReport/web.base.ts +1 -1
  35. package/dist/jumpEventReport/web.jd.ts +1 -1
  36. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  37. package/dist/libs/taroAppReport.js +2 -2
  38. package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -53
  39. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  40. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  41. package/dist/open/api/environment.ts +1 -1
  42. package/dist/open/api/shopMember.ts +1 -1
  43. package/dist/open/api/util.ts +1 -1
  44. package/dist/sass/app.h5.scss +273 -224
  45. package/dist/service/fetchGateway.ts +1 -1
  46. package/dist/service/fetchGateway.weapp.ts +1 -0
  47. package/dist/service/http/colorSign.ts +1 -1
  48. package/dist/service/http/const.ts +1 -1
  49. package/dist/service/http/h5Http.ts +1 -1
  50. package/dist/service/requestServer.h5.ts +1 -1
  51. package/dist/service/requestServer.ts +1 -1
  52. package/dist/service/requestServer.weapp.ts +1 -0
  53. package/dist/utils/connectNativeJsBridge.ts +1 -1
  54. package/dist/utils/h5Utils.ts +1 -1
  55. package/dist/utils/index.h5.ts +1 -1
  56. package/dist/utils/index.ts +1 -1
  57. package/dist/utils/index.weapp.ts +1 -1
  58. package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
  59. package/dist/utils/jumpExtMapUtil.ts +1 -0
  60. package/dist/utils/log.ts +1 -0
  61. package/dist/utils/sColor.js +1 -0
  62. package/dist/utils/utils.ts +1 -1
  63. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  64. package/dist/wxapp/common/user_info.js +1 -1
  65. package/package.json +158 -141
@@ -0,0 +1 @@
1
+ import Taro from '@tarojs/taro';
2
  APPID,
1
3
  JshopxColorFunctionIdList,
2
4
  PagesColorFunctionIdList,
3
5
  PAGES_DOMAIN,
4
6
  B2BColorFunctionIdList,
5
7
  MobileVerifyColorList,
6
8
  AppVerifyColorList,
7
9
  JshopxVerifyColorList,
8
10
  BMallVerifyColorList,
9
11
  shopMemberColorFunctionIdList,
10
12
  isLanguageForEn,
11
13
  isJdApp,
12
14
  showSuccessToast,
13
15
  showFailToast,
14
16
  isH5,
15
17
  isWxMinAndWxapp,
16
18
  isMin,
17
19
  isPc,
18
20
  cookiesStr: '',
19
21
  requestHeaderContentType: {
20
22
  jsonHeader: {
21
23
  'content-type': 'application/json;charset=utf-8',
22
24
  },
23
25
  formDataHeader: {
24
26
  'content-type': 'application/x-www-form-urlencoded',
25
27
  },
26
28
  },
27
29
  requestBaseParam: {
28
30
  data: null,
29
31
  header: {
30
32
  'content-type': 'application/json;charset=utf-8',
31
33
  },
32
34
  },
33
35
  timeOut: 7000,
34
36
  apiClientParams: {
35
37
  appid: 'wx_mini_app',
36
38
  clientVersion: '11.0.0',
37
39
  client: 'wh5',
38
40
  area: '1_72_2799_0',
39
41
  screen: `${Math.ceil(getSystemInfo?.screenWidth * devicePixelRatio)}*${Math.ceil(
40
42
  getSystemInfo?.screenHeight * devicePixelRatio,
41
43
  )}`,
42
44
  uuid: UUID,
43
45
  loginType: '11',
44
46
  },
45
47
  public addressFetchInfo: {
46
48
  reqState: boolean;
47
49
  promiseInstance: null | Promise<any>;
48
50
  };
49
51
  public getPromotionConfig: {
50
52
  projectId: null | string | number;
51
53
  pageId: null | string | number;
52
54
  };
53
55
  public resInfo: ServiceInterFace.HttpRequestInfo;
54
56
  public api: ServiceInterFace.HttpApi;
55
57
  public isPageDomain: boolean;
56
58
  public verifyColorList: string[];
57
59
  constructor(opt) {
58
60
  this._init();
59
61
  this.addressFetchInfo = {
60
62
  reqState: false,
61
63
  promiseInstance: null,
62
64
  };
63
65
  this.getPromotionConfig = {
64
66
  projectId: null,
65
67
  pageId: null,
66
68
  };
67
69
  this._userAreaUpdateListen();
68
70
  this.resInfo = this._getResConfig(opt);
69
71
  this.api = api;
70
72
  this.isPageDomain = isH5 ? window?.location?.hostname === PAGES_DOMAIN : false;
71
73
  this.verifyColorList = [
72
74
  ...MobileVerifyColorList,
73
75
  ...AppVerifyColorList,
74
76
  ...JshopxVerifyColorList,
75
77
  ...BMallVerifyColorList,
76
78
  ];
77
79
  }
78
80
  _init(): void {
79
81
  httpInterceptors.forEach((item) => {
80
82
  Taro.addInterceptor((chain) => item(chain));
81
83
  });
82
84
  }
83
85
  _getResConfig(opt = {}): ServiceInterFace.HttpRequestInfo {
84
86
  return Object.assign({}, DefaultConfig, opt);
85
87
  }
86
88
 
87
89
  _userAreaUpdateListen() {
88
90
  Taro.eventCenter.on(TaroEventType.USER_AREA_UPDATE, (areaInfo) => {
89
91
  this.updateApiClientParamsResInfo(areaInfo);
90
92
  });
91
93
  }
92
94
  updateApiClientParamsResInfo(opt = {}) {
93
95
  const { area, realTimeArea, ...others } = opt;
94
96
  this.resInfo.apiClientParams = {
95
97
  ...this.resInfo.apiClientParams,
96
98
  ...others,
97
99
  };
98
100
  area && area !== '' && (this.resInfo.apiClientParams.area = area);
99
101
  realTimeArea &&
100
102
  realTimeArea !== '' &&
101
103
  (this.resInfo.apiClientParams.realTimeArea = realTimeArea);
102
104
  }
103
105
 
104
106
  checkFunctionIdToReturnAppId(functionId) {
105
107
  if (JshopxColorFunctionIdList.includes(functionId)) {
106
108
  return APPID.JSHOPX_COLOR_APPID;
107
109
  } else if (this.isPageDomain && PagesColorFunctionIdList.includes(functionId)) {
108
110
  return APPID.PAGES_COLOR_APPID;
109
111
  } else if (shopMemberColorFunctionIdList.includes(functionId)) {
110
112
  return APPID.SHOP_MEMBER_COLOR_APPID;
111
113
  } else if (B2BColorFunctionIdList.includes(functionId)) {
112
114
  return APPID.B2B_COLOR_APPID;
113
115
  } else if (isPc) {
114
116
  return APPID.MALL_COLOR_APPID;
115
117
  } else {
116
118
  return APPID.SHOP_COLOR_APPID;
117
119
  }
118
120
  }
119
121
 
120
122
  gatewayReq(functionId: string, bodyParams = {}, clientParams = {}): Promise<any> {
121
123
  if (functionId === 'receiveShopCoupon') {
122
124
  clientParams = Object.assign(
123
125
  {},
124
126
  {
125
127
  loginType: '1',
126
128
  loginWQBiz: WXAPP_BIZ_KEY,
127
129
  },
128
130
  clientParams,
129
131
  );
130
132
  }
131
133
  const apiClientParams = Object.assign({}, this.resInfo.apiClientParams, clientParams);
132
134
  const isColorVerify = this.verifyColorList.includes(functionId);
133
135
  const getReqData = {
134
136
  functionId: functionId,
135
137
  body: JSON.stringify(bodyParams),
136
138
  t: Date.now(),
137
139
  ...apiClientParams,
138
140
  };
139
141
  return http
140
142
  .request({
141
143
  url: this.api.apiFunc,
142
144
  data: getReqData,
143
145
  isColorVerify,
144
146
  })
145
147
  .then((res: ServiceInterFace.RequestPromiseRes) => {
146
148
  const { statusCode, data } = res;
147
149
  let changeRes: ServiceInterFace.RequestResponseFormatRes = {
148
150
  ok: true,
149
151
  };
150
152
  if (statusCode === 200 && data) {
151
153
  const resCode = Object.prototype.hasOwnProperty.call(res.data, 'code')
152
154
  ? Number(res.data.code)
153
155
  : -1;
154
156
  const subCode = Object.prototype.hasOwnProperty.call(res.data, 'subCode')
155
157
  ? Number(res.data.subCode)
156
158
  : -1;
157
159
  if (
158
160
  data.success === true ||
159
161
  data.isSuccess ||
160
162
  resCode === 0 ||
161
163
  resCode === 200 ||
162
164
  subCode === 0
163
165
  ) {
164
166
  changeRes = {
165
167
  result: Object.prototype.hasOwnProperty.call(data, 'result')
166
168
  ? data.result
167
169
  : Object.prototype.hasOwnProperty.call(data, 'data')
168
170
  ? data.data
169
171
  : data,
170
172
  code: data.code || 200,
171
173
  ok: true,
172
174
  source: data,
173
175
  };
174
176
  return changeRes;
175
177
  } else {
176
178
  changeRes = {
177
179
  ...data,
178
180
  ok: false,
179
181
  statusCode: res.statusCode,
180
182
  };
181
183
  return changeRes;
182
184
  }
183
185
  } else {
184
186
  changeRes = {
185
187
  ...data,
186
188
  ok: false,
187
189
  statusCode: res.statusCode,
188
190
  };
189
191
  return changeRes;
190
192
  }
191
193
  })
192
194
  .catch((res) => {
193
195
  return {
194
196
  ...res,
195
197
  ok: false,
196
198
  } as ServiceInterFace.RequestResponseFormatRes;
197
199
  });
198
200
  }
199
201
 
200
202
  async receiveCoupon(param = {}, clientParams) {
201
203
  console.warn('receiveCoupon 方法在微信京购小程序环境未经验证,请不要使用!');
202
204
  return await this.gatewayReq(
203
205
  'receiveShopCoupon',
204
206
  {
205
207
  operation: '3',
206
208
  ...param,
207
209
  },
208
210
  { ...clientParams },
209
211
  );
210
212
  }
211
213
 
212
214
  getCustomerCenterDispatch(params = {}) {
213
215
  return this.gatewayReq('customerCenterDispatch', params, {
214
216
  clientVersion: '9.2.0',
215
217
  client: 'H5',
216
218
  uuid: 88888,
217
219
  appid: 'shopmember_m_jd_com',
218
220
  });
219
221
  }
220
222
 
221
223
  batchAddCart(...args) {
222
224
  let skuIds, num, showToast, giftCard;
223
225
  if (['number', 'string'].includes(typeof args[0])) {
224
226
  [skuIds, num = 1, showToast = true, giftCard = false] = args;
225
227
  } else if (typeof args[0] === 'object' && args[0] !== null) {
226
228
  const params = args[0];
227
229
  skuIds = params.skuIds;
228
230
  num = params.num || 1;
229
231
  showToast = params.showToast !== undefined ? params.showToast : true;
230
232
  giftCard = params.giftCard !== undefined ? params.giftCard : false;
231
233
  } else {
232
234
  console.error('batchAddCart() Invalid arguments!', args);
233
235
  const msg = isLanguageForEn ? 'Please retry later' : '加入购物车失败,请稍后重试!';
234
236
  showFailToast({
235
237
  title: msg,
236
238
  });
237
239
  return Promise.resolve({
238
240
  ok: false,
239
241
  msg,
240
242
  });
241
243
  }
242
244
  const addToWhereText = giftCard ? '购物清单' : '购物车';
243
245
  const successMsg = isLanguageForEn ? 'Success' : `加入${addToWhereText}成功`;
244
246
  const failMsg = isLanguageForEn
245
247
  ? 'Please retry later'
246
248
  : `加入${addToWhereText}失败,请稍后重试!`;
247
249
  if (skuIds) {
248
250
  return this._addShopGoodCart(`${skuIds}`, `${num}`, { giftCard })
249
251
  .then((res: ServiceInterFace.SkuToCartDataRes) => {
250
252
  if (res?.ok) {
251
253
  if (showToast && !res?.isOpenApp)
252
254
  showSuccessToast({
253
255
  title: successMsg,
254
256
  });
255
257
  } else {
256
258
  showToast &&
257
259
  showFailToast({
258
260
  title: res?.errMsg || failMsg,
259
261
  });
260
262
  }
261
263
  return Promise.resolve(res);
262
264
  })
263
265
  .catch((e) => {
264
266
  console.log('调用加购方法异常=======>', e);
265
267
  return Promise.resolve({
266
268
  ok: false,
267
269
  msg: failMsg,
268
270
  });
269
271
  });
270
272
  } else {
271
273
  return Promise.resolve({
272
274
  ok: false,
273
275
  msg: failMsg,
274
276
  });
275
277
  }
276
278
  }
277
279
 
278
280
  async giftCardAddCart(skuList, num) {
279
281
  return this.gatewayReq('giftCardAddCart', {
280
282
  skuList,
281
283
  num: Number(num),
282
284
  });
283
285
  }
284
286
 
285
287
  _addShopGoodCart(skuIdsStr, addCardNum = '1', { giftCard }) {
286
288
  return new Promise((resolve) => {
287
289
  const productIdsArr = skuIdsStr ? `${skuIdsStr}`.split(',') : [];
288
290
  if (productIdsArr.length > 0) {
289
291
  if (giftCard) {
290
292
  this.giftCardAddCart(productIdsArr, addCardNum)
291
293
  .then((res) => {
292
294
  if (res?.code === '0' && res?.result?.value) {
293
295
  resolve({
294
296
  ok: true,
295
297
  });
296
298
  } else {
297
299
  resolve({
298
300
  ok: false,
299
301
  msg: '加购失败,请稍后重试',
300
302
  });
301
303
  }
302
304
  })
303
305
  .catch((e) => {
304
306
  console.error('礼品卡加车失败: ', e);
305
307
  resolve({
306
308
  ok: false,
307
309
  msg: '加购失败,请稍后重试',
308
310
  });
309
311
  });
310
312
  } else if (isJdApp) {
311
313
  console.log('==========>', 'app原生批量加车!,小程序端暂不涉及');
312
314
  } else if (isMin) {
313
315
  console.log('==========>', '京购批量加车!');
314
316
  const productsAddCartList = productIdsArr.map((skuItem) => {
315
317
  return {
316
318
  skuId: skuItem,
317
319
  buyNum: addCardNum,
318
320
  };
319
321
  });
320
322
  global.wxAppBizInstance
321
323
  .addCart({ commArr: productsAddCartList })
322
324
  .then((res) => {
323
325
  console.log('dealCartSuccess: ', res);
324
326
  resolve({
325
327
  ok: true,
326
328
  msg: '已加入购物车!',
327
329
  data: res,
328
330
  });
329
331
  })
330
332
  .catch((e) => {
331
333
  console.log('京购小程序批量加车失败dealCartFail: ', e);
332
334
  resolve({
333
335
  ok: false,
334
336
  msg: '加购失败,请稍后重试',
335
337
  });
336
338
  });
337
339
  } else {
338
340
  console.log('==========>', 'M站批量加车!');
339
341
  return this.productAddToCart(skuIdsStr, addCardNum).then((res) => resolve(res));
340
342
  }
341
343
  } else {
342
344
  resolve({
343
345
  ok: false,
344
346
  msg: '加购sku不能为空',
345
347
  });
346
348
  }
347
349
  });
348
350
  }
349
351
 
350
352
  productAddToCart() {
351
353
  return Promise.resolve({
352
354
  ok: false,
353
355
  msg: 'productAddToCart暂不支持小程序',
354
356
  });
355
357
  }
356
358
  bMallGetUserInfo = () => {
357
359
  return getBMallUserInfo();
358
360
  };
359
361
  async bMallAddCart(params = {}) {
360
362
  console.warn('bMallAddCart 方法在微信京购小程序环境未经验证,请不要使用!');
361
363
  return await this.gatewayReq('bmall_cartAdd', params, {
362
364
  client: 'H5',
363
365
  clientVersion: '5.5.0',
364
366
  });
365
367
  }
366
368
  async bMallChangeCart(params = {}) {
367
369
  console.warn('bMallChangeCart 方法在微信京购小程序环境未经验证,请不要使用!');
368
370
  return await this.gatewayReq('bmall_cartChange', params, {
369
371
  client: 'H5',
370
372
  clientVersion: '5.5.0',
371
373
  });
372
374
  }
373
375
  async bMallRemoveCart(params = {}) {
374
376
  console.warn('bMallRemoveCart 方法在微信京购小程序环境未经验证,请不要使用!');
375
377
  return await this.gatewayReq(
376
378
  'bmall_cartRemove',
377
379
  params,
378
380
  {
379
381
  client: 'H5',
380
382
  clientVersion: '5.5.0',
381
383
  },
382
384
  );
383
385
  }
384
386
  async bMallGetOmittedProduct(params = {}) {
385
387
  return await this.gatewayReq('bmall_getOmittedProduct', params, {
386
388
  client: 'H5',
387
389
  clientVersion: '5.5.0',
388
390
  });
389
391
  }
390
392
  async bMallAddCartService({ skuId, bMallTag, num, data = {} }) {
391
393
  const params = await getParams({ ...data, skuId, bMallTag, num });
392
394
  return await this.bMallAddCart(params);
393
395
  }
394
396
  async bMallGetSkuNumService(bMallTag = 1) {
395
397
  const params = await getParams({ bMallTag });
396
398
  delete params.operations;
397
399
  return await this.bMallGetOmittedProduct(params);
398
400
  }
399
401
  async bMallRemoveCartService({ skuId, bMallTag, num, skuUuid, data = {} }) {
400
402
  let params = await getParams({ ...data, skuId, bMallTag, num, skuUuid });
401
403
  return await this.bMallRemoveCart(params);
402
404
  }
403
405
  async bMallChangeCartService({ skuId, bMallTag, num, skuUuid, data = {} }) {
404
406
  let params = await getParams({ ...data, skuId, bMallTag, num, skuUuid });
405
407
  return await this.bMallChangeCart(params);
406
408
  }
407
409
 
408
410
  async bMallGetSkuNumApi(needRequest = false, bMallTag = 1) {
409
411
  if (!needRequest && isH5 && window?.bMallCartData) {
410
412
  return window?.bMallCartData;
411
413
  }
412
414
  const cartData = await this.bMallGetSkuNumService(bMallTag);
413
415
  let items;
414
416
  if (cartData.ok && cartData.result) {
415
417
  items = cartData?.result?.items || {};
416
418
  }
417
419
  if (isH5) {
418
420
  window.bMallCartData = items;
419
421
  }
420
422
  return items;
421
423
  }
422
424
 
423
425
  async bMallCartHandle(goodItem, num) {
424
426
  try {
425
427
  const {
426
428
  skuUuid,
427
429
  limitUpper,
428
430
  limitLower,
429
431
  } = goodItem;
430
432
  let cartNum = Number(num);
431
433
  if (limitLower && cartNum && cartNum < limitLower) {
432
434
  cartNum = limitLower;
433
435
  } else if (limitUpper && cartNum && cartNum > limitUpper) {
434
436
  cartNum = limitUpper;
435
437
  }
436
438
  if (skuUuid && cartNum > 0) {
437
439
  return this.bMallChangeCartService({
438
440
  ...goodItem,
439
441
  skuUuid,
440
442
  num: cartNum,
441
443
  });
442
444
  } else if (!skuUuid && cartNum > 0) {
443
445
  return this.bMallAddCartService({ ...goodItem, num: cartNum });
444
446
  } else if (skuUuid && !cartNum) {
445
447
  return this.bMallRemoveCartService({
446
448
  ...goodItem,
447
449
  skuUuid,
448
450
  num: cartNum,
449
451
  });
450
452
  } else {
451
453
  console.error('参数不全');
452
454
  return false;
453
455
  }
454
456
  } catch (e) {
455
457
  console.error(e);
456
458
  }
457
459
  }