@salla.sa/twilight 2.0.264 → 2.0.266

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/twilight",
3
- "version": "2.0.264",
3
+ "version": "2.0.266",
4
4
  "description": "Salla Theme Toolkit, Webcomponents, Events, Requests, Utils",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -54,7 +54,7 @@ export interface Category {
54
54
  }
55
55
 
56
56
  export interface GetCategoriesResponse extends SuccessResponse {
57
- data: Category[];
57
+ data: Category | Category[]; //single category when getting subCategories by passing categoryId
58
58
  }
59
59
 
60
60
  export default interface ProductApi {
@@ -9,13 +9,10 @@ export interface ProfileUpdatePayload {
9
9
  avatar?: BinaryType;
10
10
  }
11
11
 
12
- export interface ProfileUpdateMobilePayload {
13
- phone: string | number;
14
- country_code: string | 'SA';
15
- }
16
-
17
- export interface ProfileUpdateEmailPayload {
18
- email: string;
12
+ export interface ProfileUpdateContactPayload {
13
+ phone?: string | number; //required if there is no email
14
+ country_code?: string | 'SA'; //required if there is phone
15
+ email?: string; //required if there is no phone
19
16
  }
20
17
 
21
18
  export interface UpdateProfileResponse extends SuccessResponse {
@@ -31,12 +28,12 @@ export interface UpdateProfileResponse extends SuccessResponse {
31
28
  avatar: string;
32
29
  gender?: 'male' | 'female';
33
30
  birthday: string | '2022-02-22';
31
+ verification_type?: 'email' | 'mobile'; //exists when trying to update email/phone
34
32
  };
35
33
  }
36
34
 
37
35
  export default interface ProfileApi {
38
36
  update: (data: ProfileUpdatePayload) => Promise<UpdateProfileResponse>;
39
- updateMobile: (data: ProfileUpdateMobilePayload) => Promise<UpdateProfileResponse>;
40
- updateEmail: (data: ProfileUpdateEmailPayload) => Promise<UpdateProfileResponse>;
41
37
  verify: (data: AuthRequest.verifyByMobile | AuthRequest.verifyByEmail) => Promise<SuccessResponse>;
38
+ updateContacts: (data: ProfileUpdateContactPayload) => Promise<UpdateProfileResponse>;//should verify after success event
42
39
  }
@@ -3,13 +3,11 @@ import {RequestErrorEvent, SuccessResponse} from "../common";
3
3
 
4
4
  export default interface ProfileEvent {
5
5
  onUpdated: (callback: (response: UpdateProfileResponse) => void) => void;
6
- onMobileUpdated: (callback: (response: UpdateProfileResponse) => void) => void;
7
- onEmailUpdated: (callback: (response: UpdateProfileResponse) => void) => void;
8
6
  onVerified: (callback: (response: SuccessResponse) => void) => void;
7
+ onVerificationCodeSent: (callback: (response: UpdateProfileResponse) => void) => void; //should trigger action to fill verify code, then calling salla.profile.verify(...)
9
8
 
10
9
  //errors
11
10
  onUpdateFailed: RequestErrorEvent;
12
- onUpdateMobileFailed: RequestErrorEvent;
13
- onUpdateEmailFailed: RequestErrorEvent;
14
11
  onUnverified: RequestErrorEvent;
12
+ onUpdateContactsFailed: RequestErrorEvent;
15
13
  }