@salla.sa/twilight 2.0.270 → 2.0.272

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.270",
3
+ "version": "2.0.272",
4
4
  "description": "Salla Theme Toolkit, Webcomponents, Events, Requests, Utils",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -15,10 +15,13 @@ export interface ProfileUpdateContactPayload {
15
15
  email?: string; //required if there is no phone
16
16
  }
17
17
 
18
- export interface UpdateProfileResponse extends SuccessResponse {
18
+ export interface ProfileResponse extends SuccessResponse {
19
19
  data: {
20
+ id: number;
20
21
  first_name: string;
21
22
  last_name: string;
23
+ currency: string | 'SAR';
24
+ language: string | 'ar';
22
25
  phone: {
23
26
  code: string | "+966";
24
27
  number: string | number;
@@ -33,7 +36,8 @@ export interface UpdateProfileResponse extends SuccessResponse {
33
36
  }
34
37
 
35
38
  export default interface ProfileApi {
36
- update: (data: ProfileUpdatePayload) => Promise<UpdateProfileResponse>;
39
+ info: () => Promise<ProfileResponse>;
40
+ update: (data: ProfileUpdatePayload) => Promise<ProfileResponse>;
37
41
  verify: (data: AuthRequest.verifyByMobile | AuthRequest.verifyByEmail) => Promise<SuccessResponse>;
38
- updateContacts: (data: ProfileUpdateContactPayload) => Promise<UpdateProfileResponse>;//should verify after success event
42
+ updateContacts: (data: ProfileUpdateContactPayload) => Promise<ProfileResponse>;//should verify after success event
39
43
  }
@@ -1,10 +1,10 @@
1
- import {UpdateProfileResponse} from "../api/profile";
1
+ import {ProfileResponse} from "../api/profile";
2
2
  import {RequestErrorEvent, SuccessResponse} from "../common";
3
3
 
4
4
  export default interface ProfileEvent {
5
- onUpdated: (callback: (response: UpdateProfileResponse) => void) => void;
5
+ onUpdated: (callback: (response: ProfileResponse) => void) => void;
6
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(...)
7
+ onVerificationCodeSent: (callback: (response: ProfileResponse) => void) => void; //should trigger action to fill verify code, then calling salla.profile.verify(...)
8
8
 
9
9
  //errors
10
10
  onUpdateFailed: RequestErrorEvent;
@@ -35,7 +35,7 @@ export type ConfigKey = 'maintenance'
35
35
  | 'page.id';
36
36
  export default interface SallaConfig {
37
37
  merge: (config: TwilightConfig) => SallaConfig;
38
- set: (key: ConfigKey | string, value: string) => SallaConfig;
38
+ set: (key: ConfigKey | string, value: string|any) => SallaConfig;
39
39
  get: (key: ConfigKey | string, default_?: any) => any;
40
40
  isRTL: () => boolean;
41
41
  money: (money: number | Price) => string;
@@ -43,6 +43,6 @@ export default interface SallaConfig {
43
43
  isGuest: () => boolean;
44
44
  languageCode: () => string | 'ar';
45
45
  currency: (code?: string | 'SAR') => Currency;
46
- currencies: () => Promise<Currency[]>;
46
+ currencies: () => Promise<{ SAR: Currency, [iso_code: string]: Currency }>;
47
47
  languages: () => Promise<Language[]>;
48
48
  }
@@ -53,10 +53,7 @@ export interface TwilightConfig {
53
53
  reverse_text: string | '#005544';
54
54
  }
55
55
  };
56
- languages?: {
57
- ar?: Language;
58
- [key: string]: Language;
59
- };
56
+ languages?: Language[];
60
57
  currencies?: {
61
58
  SAR?: Currency;
62
59
  [key: string]: Currency;