@pisell/pisellos 0.0.342 → 0.0.344

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.
@@ -52,8 +52,8 @@ var onlineStoreConfig = {
52
52
  method: 'POST',
53
53
  transformParams: function transformParams(params) {
54
54
  return {
55
- phone: params.phone,
56
- country_calling_code: params.country_calling_code
55
+ phone: String(params.phone),
56
+ country_calling_code: String(params.country_calling_code)
57
57
  };
58
58
  }
59
59
  },
@@ -105,10 +105,10 @@ var onlineStoreConfig = {
105
105
  method: 'POST',
106
106
  transformParams: function transformParams(params) {
107
107
  return {
108
- phone: params.phone,
108
+ phone: String(params.phone),
109
109
  password: params.password,
110
110
  code: params.code,
111
- country_calling_code: params.country_calling_code
111
+ country_calling_code: String(params.country_calling_code)
112
112
  };
113
113
  }
114
114
  },
@@ -135,8 +135,8 @@ var onlineStoreConfig = {
135
135
  method: 'POST',
136
136
  transformParams: function transformParams(params) {
137
137
  return {
138
- phone: params.phone,
139
- country_calling_code: params.country_calling_code
138
+ phone: String(params.phone),
139
+ country_calling_code: String(params.country_calling_code)
140
140
  };
141
141
  }
142
142
  },
@@ -145,8 +145,8 @@ var onlineStoreConfig = {
145
145
  method: 'POST',
146
146
  transformParams: function transformParams(params) {
147
147
  return {
148
- phone: params.phone,
149
- country_calling_code: params.country_calling_code,
148
+ phone: String(params.phone),
149
+ country_calling_code: String(params.country_calling_code),
150
150
  code: params.code
151
151
  };
152
152
  }
@@ -155,7 +155,9 @@ var onlineStoreConfig = {
155
155
  url: '/auth/guest/login',
156
156
  method: 'POST',
157
157
  transformParams: function transformParams(params) {
158
- return params;
158
+ return {
159
+ login_channel: params.login_channel
160
+ };
159
161
  }
160
162
  },
161
163
  checkEmailExists: {
@@ -164,7 +166,6 @@ var onlineStoreConfig = {
164
166
  transformParams: function transformParams(params) {
165
167
  return {
166
168
  email: params.email,
167
- shop_id: params.shop_id,
168
169
  sales_channel: 'online_store'
169
170
  };
170
171
  }
@@ -175,7 +176,6 @@ var onlineStoreConfig = {
175
176
  transformParams: function transformParams(params) {
176
177
  return {
177
178
  email: params.email,
178
- shop_id: params.shop_id,
179
179
  code: params.code
180
180
  };
181
181
  }
@@ -185,10 +185,9 @@ var onlineStoreConfig = {
185
185
  method: 'GET',
186
186
  transformParams: function transformParams(params) {
187
187
  return {
188
- phone: params.phone,
189
- shop_id: params.shop_id,
188
+ phone: String(params.phone),
190
189
  code: params.code,
191
- country_calling_code: params.country_calling_code
190
+ country_calling_code: String(params.country_calling_code)
192
191
  };
193
192
  }
194
193
  },
@@ -197,9 +196,9 @@ var onlineStoreConfig = {
197
196
  method: 'POST',
198
197
  transformParams: function transformParams(params) {
199
198
  return {
200
- phone: params.phone,
199
+ phone: String(params.phone),
201
200
  password: params.password,
202
- country_calling_code: params.country_calling_code
201
+ country_calling_code: String(params.country_calling_code)
203
202
  };
204
203
  }
205
204
  },
@@ -217,8 +216,8 @@ var onlineStoreConfig = {
217
216
  method: 'POST',
218
217
  transformParams: function transformParams(params) {
219
218
  return {
220
- phone: params.phone,
221
- country_calling_code: params.country_calling_code
219
+ phone: String(params.phone),
220
+ country_calling_code: String(params.country_calling_code)
222
221
  };
223
222
  }
224
223
  },
@@ -266,10 +265,10 @@ var onlineStoreConfig = {
266
265
  method: 'POST',
267
266
  transformParams: function transformParams(params) {
268
267
  return {
269
- phone: params.phone,
268
+ phone: String(params.phone),
270
269
  password: params.password,
271
270
  code: params.code,
272
- country_calling_code: params.country_calling_code
271
+ country_calling_code: String(params.country_calling_code)
273
272
  };
274
273
  }
275
274
  },
@@ -380,8 +379,8 @@ var defaultConfig = {
380
379
  method: 'POST',
381
380
  transformParams: function transformParams(params) {
382
381
  return {
383
- phone: params.phone,
384
- country_calling_code: params.country_calling_code
382
+ phone: String(params.phone),
383
+ country_calling_code: String(params.country_calling_code)
385
384
  };
386
385
  }
387
386
  },
@@ -429,10 +428,10 @@ var defaultConfig = {
429
428
  method: 'POST',
430
429
  transformParams: function transformParams(params) {
431
430
  return {
432
- phone: params.phone,
431
+ phone: String(params.phone),
433
432
  password: params.password,
434
433
  code: params.code,
435
- country_calling_code: params.country_calling_code
434
+ country_calling_code: String(params.country_calling_code)
436
435
  };
437
436
  }
438
437
  },
@@ -459,8 +458,8 @@ var defaultConfig = {
459
458
  method: 'POST',
460
459
  transformParams: function transformParams(params) {
461
460
  return {
462
- phone: params.phone,
463
- country_calling_code: params.country_calling_code
461
+ phone: String(params.phone),
462
+ country_calling_code: String(params.country_calling_code)
464
463
  };
465
464
  }
466
465
  },
@@ -469,8 +468,8 @@ var defaultConfig = {
469
468
  method: 'POST',
470
469
  transformParams: function transformParams(params) {
471
470
  return {
472
- phone: params.phone,
473
- country_calling_code: params.country_calling_code,
471
+ phone: String(params.phone),
472
+ country_calling_code: String(params.country_calling_code),
474
473
  code: params.code
475
474
  };
476
475
  }
@@ -489,8 +488,7 @@ var defaultConfig = {
489
488
  method: 'GET',
490
489
  transformParams: function transformParams(params) {
491
490
  return {
492
- email: params.email,
493
- shop_id: params.shop_id
491
+ email: params.email
494
492
  };
495
493
  }
496
494
  },
@@ -500,7 +498,6 @@ var defaultConfig = {
500
498
  transformParams: function transformParams(params) {
501
499
  return {
502
500
  email: params.email,
503
- shop_id: params.shop_id,
504
501
  code: params.code
505
502
  };
506
503
  }
@@ -510,10 +507,9 @@ var defaultConfig = {
510
507
  method: 'GET',
511
508
  transformParams: function transformParams(params) {
512
509
  return {
513
- phone: params.phone,
514
- shop_id: params.shop_id,
510
+ phone: String(params.phone),
515
511
  code: params.code,
516
- country_calling_code: params.country_calling_code
512
+ country_calling_code: String(params.country_calling_code)
517
513
  };
518
514
  }
519
515
  },
@@ -522,9 +518,9 @@ var defaultConfig = {
522
518
  method: 'POST',
523
519
  transformParams: function transformParams(params) {
524
520
  return {
525
- phone: params.phone,
521
+ phone: String(params.phone),
526
522
  password: params.password,
527
- country_calling_code: params.country_calling_code
523
+ country_calling_code: String(params.country_calling_code)
528
524
  };
529
525
  }
530
526
  },
@@ -542,8 +538,8 @@ var defaultConfig = {
542
538
  method: 'POST',
543
539
  transformParams: function transformParams(params) {
544
540
  return {
545
- phone: params.phone,
546
- country_calling_code: params.country_calling_code
541
+ phone: String(params.phone),
542
+ country_calling_code: String(params.country_calling_code)
547
543
  };
548
544
  }
549
545
  },
@@ -591,10 +587,10 @@ var defaultConfig = {
591
587
  method: 'POST',
592
588
  transformParams: function transformParams(params) {
593
589
  return {
594
- phone: params.phone,
590
+ phone: String(params.phone),
595
591
  password: params.password,
596
592
  code: params.code,
597
- country_calling_code: params.country_calling_code
593
+ country_calling_code: String(params.country_calling_code)
598
594
  };
599
595
  }
600
596
  },
@@ -1692,7 +1692,7 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
1692
1692
  key: "guestLogin",
1693
1693
  value: (function () {
1694
1694
  var _guestLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1695
- var guestCode, param, response;
1695
+ var guestCode, param, response, _response$data7;
1696
1696
  return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1697
1697
  while (1) switch (_context25.prev = _context25.next) {
1698
1698
  case 0:
@@ -1727,6 +1727,11 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
1727
1727
  if (response.data.refreshToken) {
1728
1728
  this.store.refreshToken = response.data.refreshToken;
1729
1729
  }
1730
+
1731
+ // 设置匿名登录code
1732
+ if ((_response$data7 = response.data) !== null && _response$data7 !== void 0 && (_response$data7 = _response$data7.customer) !== null && _response$data7 !== void 0 && _response$data7.guest_code) {
1733
+ this.window.localStorage.setItem('guest_code', response.data.customer.guest_code);
1734
+ }
1730
1735
  this.core.effects.emit(RegisterAndLoginHooks.onLoginSuccess, {
1731
1736
  user: response.data.user,
1732
1737
  token: response.data.token,
@@ -296,6 +296,7 @@ export interface GuestLoginResponse {
296
296
  user: UserInfo;
297
297
  token: string;
298
298
  refreshToken?: string;
299
+ customer: any;
299
300
  }
300
301
  /**
301
302
  * 检查邮箱是否已注册参数接口
@@ -46,8 +46,8 @@ var onlineStoreConfig = {
46
46
  url: "/auth/mobile/sms-register",
47
47
  method: "POST",
48
48
  transformParams: (params) => ({
49
- phone: params.phone,
50
- country_calling_code: params.country_calling_code
49
+ phone: String(params.phone),
50
+ country_calling_code: String(params.country_calling_code)
51
51
  })
52
52
  },
53
53
  sendEmailRegisterLink: {
@@ -89,10 +89,10 @@ var onlineStoreConfig = {
89
89
  url: "/auth/mobile/register",
90
90
  method: "POST",
91
91
  transformParams: (params) => ({
92
- phone: params.phone,
92
+ phone: String(params.phone),
93
93
  password: params.password,
94
94
  code: params.code,
95
- country_calling_code: params.country_calling_code
95
+ country_calling_code: String(params.country_calling_code)
96
96
  })
97
97
  },
98
98
  resendEmailRegisterLink: {
@@ -113,30 +113,31 @@ var onlineStoreConfig = {
113
113
  url: "/auth/send-login-msg",
114
114
  method: "POST",
115
115
  transformParams: (params) => ({
116
- phone: params.phone,
117
- country_calling_code: params.country_calling_code
116
+ phone: String(params.phone),
117
+ country_calling_code: String(params.country_calling_code)
118
118
  })
119
119
  },
120
120
  phoneCodeLogin: {
121
121
  url: "/auth/mobile-login",
122
122
  method: "POST",
123
123
  transformParams: (params) => ({
124
- phone: params.phone,
125
- country_calling_code: params.country_calling_code,
124
+ phone: String(params.phone),
125
+ country_calling_code: String(params.country_calling_code),
126
126
  code: params.code
127
127
  })
128
128
  },
129
129
  guestLogin: {
130
130
  url: "/auth/guest/login",
131
131
  method: "POST",
132
- transformParams: (params) => params
132
+ transformParams: (params) => ({
133
+ login_channel: params.login_channel
134
+ })
133
135
  },
134
136
  checkEmailExists: {
135
137
  url: "/auth/email/check-email",
136
138
  method: "GET",
137
139
  transformParams: (params) => ({
138
140
  email: params.email,
139
- shop_id: params.shop_id,
140
141
  sales_channel: "online_store"
141
142
  })
142
143
  },
@@ -145,7 +146,6 @@ var onlineStoreConfig = {
145
146
  method: "GET",
146
147
  transformParams: (params) => ({
147
148
  email: params.email,
148
- shop_id: params.shop_id,
149
149
  code: params.code
150
150
  })
151
151
  },
@@ -153,19 +153,18 @@ var onlineStoreConfig = {
153
153
  url: "/auth/mobile/check-mobile-code",
154
154
  method: "GET",
155
155
  transformParams: (params) => ({
156
- phone: params.phone,
157
- shop_id: params.shop_id,
156
+ phone: String(params.phone),
158
157
  code: params.code,
159
- country_calling_code: params.country_calling_code
158
+ country_calling_code: String(params.country_calling_code)
160
159
  })
161
160
  },
162
161
  phonePasswordLogin: {
163
162
  url: "/auth/mobile/login",
164
163
  method: "POST",
165
164
  transformParams: (params) => ({
166
- phone: params.phone,
165
+ phone: String(params.phone),
167
166
  password: params.password,
168
- country_calling_code: params.country_calling_code
167
+ country_calling_code: String(params.country_calling_code)
169
168
  })
170
169
  },
171
170
  sendPasswordResetEmail: {
@@ -179,8 +178,8 @@ var onlineStoreConfig = {
179
178
  url: "/auth/mobile/sms-forget",
180
179
  method: "POST",
181
180
  transformParams: (params) => ({
182
- phone: params.phone,
183
- country_calling_code: params.country_calling_code
181
+ phone: String(params.phone),
182
+ country_calling_code: String(params.country_calling_code)
184
183
  })
185
184
  },
186
185
  sendResetPasswordLink: {
@@ -218,10 +217,10 @@ var onlineStoreConfig = {
218
217
  url: "/auth/mobile/reset-password",
219
218
  method: "POST",
220
219
  transformParams: (params) => ({
221
- phone: params.phone,
220
+ phone: String(params.phone),
222
221
  password: params.password,
223
222
  code: params.code,
224
- country_calling_code: params.country_calling_code
223
+ country_calling_code: String(params.country_calling_code)
225
224
  })
226
225
  },
227
226
  verifyCode: {
@@ -302,8 +301,8 @@ var defaultConfig = {
302
301
  url: "/auth/send-sms-register",
303
302
  method: "POST",
304
303
  transformParams: (params) => ({
305
- phone: params.phone,
306
- country_calling_code: params.country_calling_code
304
+ phone: String(params.phone),
305
+ country_calling_code: String(params.country_calling_code)
307
306
  })
308
307
  },
309
308
  sendEmailRegisterLink: {
@@ -341,10 +340,10 @@ var defaultConfig = {
341
340
  url: "/auth/mobile/register",
342
341
  method: "POST",
343
342
  transformParams: (params) => ({
344
- phone: params.phone,
343
+ phone: String(params.phone),
345
344
  password: params.password,
346
345
  code: params.code,
347
- country_calling_code: params.country_calling_code
346
+ country_calling_code: String(params.country_calling_code)
348
347
  })
349
348
  },
350
349
  resendEmailRegisterLink: {
@@ -365,16 +364,16 @@ var defaultConfig = {
365
364
  url: "/auth/send-sms-login-code",
366
365
  method: "POST",
367
366
  transformParams: (params) => ({
368
- phone: params.phone,
369
- country_calling_code: params.country_calling_code
367
+ phone: String(params.phone),
368
+ country_calling_code: String(params.country_calling_code)
370
369
  })
371
370
  },
372
371
  phoneCodeLogin: {
373
372
  url: "/auth/phone-code-login",
374
373
  method: "POST",
375
374
  transformParams: (params) => ({
376
- phone: params.phone,
377
- country_calling_code: params.country_calling_code,
375
+ phone: String(params.phone),
376
+ country_calling_code: String(params.country_calling_code),
378
377
  code: params.code
379
378
  })
380
379
  },
@@ -389,8 +388,7 @@ var defaultConfig = {
389
388
  url: "/auth/check-email-exists",
390
389
  method: "GET",
391
390
  transformParams: (params) => ({
392
- email: params.email,
393
- shop_id: params.shop_id
391
+ email: params.email
394
392
  })
395
393
  },
396
394
  checkEmailCode: {
@@ -398,7 +396,6 @@ var defaultConfig = {
398
396
  method: "GET",
399
397
  transformParams: (params) => ({
400
398
  email: params.email,
401
- shop_id: params.shop_id,
402
399
  code: params.code
403
400
  })
404
401
  },
@@ -406,19 +403,18 @@ var defaultConfig = {
406
403
  url: "/auth/check-mobile-code",
407
404
  method: "GET",
408
405
  transformParams: (params) => ({
409
- phone: params.phone,
410
- shop_id: params.shop_id,
406
+ phone: String(params.phone),
411
407
  code: params.code,
412
- country_calling_code: params.country_calling_code
408
+ country_calling_code: String(params.country_calling_code)
413
409
  })
414
410
  },
415
411
  phonePasswordLogin: {
416
412
  url: "/auth/mobile-password-login",
417
413
  method: "POST",
418
414
  transformParams: (params) => ({
419
- phone: params.phone,
415
+ phone: String(params.phone),
420
416
  password: params.password,
421
- country_calling_code: params.country_calling_code
417
+ country_calling_code: String(params.country_calling_code)
422
418
  })
423
419
  },
424
420
  sendPasswordResetEmail: {
@@ -432,8 +428,8 @@ var defaultConfig = {
432
428
  url: "/auth/send-password-reset-sms",
433
429
  method: "POST",
434
430
  transformParams: (params) => ({
435
- phone: params.phone,
436
- country_calling_code: params.country_calling_code
431
+ phone: String(params.phone),
432
+ country_calling_code: String(params.country_calling_code)
437
433
  })
438
434
  },
439
435
  sendResetPasswordLink: {
@@ -471,10 +467,10 @@ var defaultConfig = {
471
467
  url: "/auth/reset-password-phone",
472
468
  method: "POST",
473
469
  transformParams: (params) => ({
474
- phone: params.phone,
470
+ phone: String(params.phone),
475
471
  password: params.password,
476
472
  code: params.code,
477
- country_calling_code: params.country_calling_code
473
+ country_calling_code: String(params.country_calling_code)
478
474
  })
479
475
  },
480
476
  verifyCode: {
@@ -1026,6 +1026,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
1026
1026
  }
1027
1027
  /** Guest 登录 */
1028
1028
  async guestLogin() {
1029
+ var _a, _b;
1029
1030
  try {
1030
1031
  this.store.isLoading = true;
1031
1032
  this.store.error = null;
@@ -1048,6 +1049,9 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
1048
1049
  if (response.data.refreshToken) {
1049
1050
  this.store.refreshToken = response.data.refreshToken;
1050
1051
  }
1052
+ if ((_b = (_a = response.data) == null ? void 0 : _a.customer) == null ? void 0 : _b.guest_code) {
1053
+ this.window.localStorage.setItem("guest_code", response.data.customer.guest_code);
1054
+ }
1051
1055
  this.core.effects.emit(import_types.RegisterAndLoginHooks.onLoginSuccess, {
1052
1056
  user: response.data.user,
1053
1057
  token: response.data.token,
@@ -296,6 +296,7 @@ export interface GuestLoginResponse {
296
296
  user: UserInfo;
297
297
  token: string;
298
298
  refreshToken?: string;
299
+ customer: any;
299
300
  }
300
301
  /**
301
302
  * 检查邮箱是否已注册参数接口
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.342",
4
+ "version": "0.0.344",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",