@salla.sa/twilight 2.0.215 → 2.0.217
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/dist/@salla.sa/twilight.min.js +2 -2
- package/dist/@salla.sa/twilight.min.js.map +1 -1
- package/dist/cjs/main.js +2 -2
- package/dist/cjs/main.js.map +1 -1
- package/dist/esm/main.js +2 -2
- package/dist/esm/main.js.map +1 -1
- package/package.json +1 -1
- package/types/api/order.d.ts +3 -3
- package/types/api/profile.d.ts +33 -0
- package/types/event/profile.d.ts +10 -0
- package/types/index.d.ts +24 -8
- package/types/lib/salla-config.ts +1 -1
package/package.json
CHANGED
package/types/api/order.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface ReOrderResponse extends TwilightResponse {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export default interface OrderApi {
|
|
11
|
-
reOrder: (order_id
|
|
12
|
-
cancel: (order_id
|
|
13
|
-
send: (order_id
|
|
11
|
+
reOrder: (order_id?: Nullable<number>) => Promise<ReOrderResponse>;
|
|
12
|
+
cancel: (order_id?: Nullable<number>) => Promise<TwilightResponse>;
|
|
13
|
+
send: (order_id?: Nullable<number>) => Promise<TwilightResponse>;
|
|
14
14
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {Nullable, TwilightResponse} from "../common";
|
|
2
|
+
|
|
3
|
+
export interface ProfilePayload {
|
|
4
|
+
first_name: string;
|
|
5
|
+
last_name: string;
|
|
6
|
+
birthday?: Nullable<string | '2022-02-22'>;
|
|
7
|
+
gender: Nullable<'male' | 'female'>;
|
|
8
|
+
email: string;
|
|
9
|
+
mobile: string | number;
|
|
10
|
+
country_code: string | 'SA';
|
|
11
|
+
country_key: string | '+966';
|
|
12
|
+
avatar?: BinaryType;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface UpdateProfileResponse extends TwilightResponse {
|
|
16
|
+
data: {
|
|
17
|
+
first_name: string;
|
|
18
|
+
last_name: string;
|
|
19
|
+
phone: {
|
|
20
|
+
code: string | "+966";
|
|
21
|
+
number: string | number;
|
|
22
|
+
country: string | "SA";
|
|
23
|
+
},
|
|
24
|
+
email: string;
|
|
25
|
+
avatar: string;
|
|
26
|
+
gender: Nullable<'male' | 'female'>;
|
|
27
|
+
birthday: string | '2022-02-22';
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default interface ProfileApi {
|
|
32
|
+
update: (data: ProfilePayload) => Promise<UpdateProfileResponse>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {UpdateProfileResponse} from "../api/profile";
|
|
2
|
+
import {Nullable, RequestError} from "../common";
|
|
3
|
+
|
|
4
|
+
export default interface ProfileEvent {
|
|
5
|
+
updated: (response: UpdateProfileResponse) => void; //fire the event
|
|
6
|
+
updateFailed: (RequestError) => void;//fire the event
|
|
7
|
+
|
|
8
|
+
onUpdated: (callback: (response: UpdateProfileResponse) => void) => void;
|
|
9
|
+
onUpdateFailed: (callback: (error: RequestError) => void) => void;
|
|
10
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ import AuthApi from "./api/auth";
|
|
|
10
10
|
import AuthEvent from "./event/auth";
|
|
11
11
|
import OrderApi from "./api/order";
|
|
12
12
|
import OrderEvent from "./event/order";
|
|
13
|
+
import ProfileApi from "./api/profile";
|
|
14
|
+
import ProfileEvent from "./event/profile";
|
|
13
15
|
|
|
14
16
|
export * from "./all";
|
|
15
17
|
|
|
@@ -26,11 +28,21 @@ export default interface Salla {
|
|
|
26
28
|
comment: any;
|
|
27
29
|
loyalty: any;
|
|
28
30
|
product: any;
|
|
31
|
+
profile: ProfileApi;
|
|
29
32
|
currency: any;
|
|
30
33
|
document: any;
|
|
31
34
|
feedback: any;
|
|
32
35
|
twilight: any;
|
|
33
36
|
wishlist: any;
|
|
37
|
+
getHeaders: () => {
|
|
38
|
+
"Accept": string | 'application/json, text/plain, */*',
|
|
39
|
+
"X-Requested-With": 'XMLHttpRequest',
|
|
40
|
+
"S-SOURCE": 'twilight',
|
|
41
|
+
"Store-Identifier"?: number,
|
|
42
|
+
"currency"?: string | 'SAR',
|
|
43
|
+
"accept-language"?: string | 'ar',
|
|
44
|
+
"Authorization"?: string
|
|
45
|
+
}
|
|
34
46
|
};
|
|
35
47
|
event: {
|
|
36
48
|
auth: AuthEvent,
|
|
@@ -43,6 +55,7 @@ export default interface Salla {
|
|
|
43
55
|
comment: any;
|
|
44
56
|
loyalty: any;
|
|
45
57
|
product: any;
|
|
58
|
+
profile: ProfileEvent;
|
|
46
59
|
currency: any;
|
|
47
60
|
document: any;
|
|
48
61
|
feedback: any;
|
|
@@ -53,28 +66,31 @@ export default interface Salla {
|
|
|
53
66
|
infiniteScroll: any;
|
|
54
67
|
helpers: SallaHelpers;
|
|
55
68
|
config: SallaConfig;
|
|
56
|
-
|
|
69
|
+
storage: any;
|
|
70
|
+
form: any;
|
|
57
71
|
|
|
58
72
|
//Aliases
|
|
59
|
-
cart: CartApi
|
|
60
|
-
auth: AuthApi
|
|
73
|
+
cart: CartApi & { api: CartApi, event: CartEvent };
|
|
74
|
+
auth: AuthApi & { api: AuthApi, event: AuthEvent };
|
|
61
75
|
gift: { api: any, event: any };
|
|
62
|
-
order: OrderApi
|
|
76
|
+
order: OrderApi & { api: OrderApi, event: OrderEvent };
|
|
63
77
|
offer: { api: any, event: any };
|
|
64
78
|
search: { api: any, event: any };
|
|
65
|
-
coupon: CouponApi
|
|
79
|
+
coupon: CouponApi & { api: CouponApi, event: CouponEvent };
|
|
66
80
|
comment: { api: any, event: any };
|
|
67
81
|
loyalty: { api: any, event: any };
|
|
68
82
|
product: { api: any, event: any };
|
|
83
|
+
profile: ProfileApi & { api: ProfileApi, event: ProfileEvent };
|
|
69
84
|
currency: { api: any, event: any };
|
|
70
85
|
document: { api: any, event: any };
|
|
71
86
|
feedback: { api: any, event: any };
|
|
72
87
|
twilight: { api: any, event: any };
|
|
73
88
|
wishlist: { api: any, event: any };
|
|
74
89
|
|
|
75
|
-
log: any;
|
|
76
|
-
success:
|
|
77
|
-
error:
|
|
90
|
+
log: (message: string | any) => void;
|
|
91
|
+
success: (message: string) => void;
|
|
92
|
+
error: (message: string) => void;
|
|
93
|
+
lang: any;
|
|
78
94
|
onReady: any; //don't relay on it because Salla may not existed yet
|
|
79
95
|
AppHelpers: any;
|
|
80
96
|
money: (money: number | Price) => string;
|
|
@@ -4,7 +4,7 @@ import {Price} from "../common";
|
|
|
4
4
|
export interface SallaConfig {
|
|
5
5
|
merge: (config: TwilightConfig) => SallaConfig;
|
|
6
6
|
set: (key: string, value: string) => SallaConfig;
|
|
7
|
-
get: (key: string, default_
|
|
7
|
+
get: (key: string, default_?: any) => any;
|
|
8
8
|
isRTL: () => boolean;
|
|
9
9
|
money: (money: number | Price) => string;
|
|
10
10
|
isUser: () => boolean;
|