@salla.sa/twilight 2.0.263 → 2.0.265
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 +1 -1
- package/dist/@salla.sa/twilight.min.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/types/api/product.d.ts +15 -1
- package/types/api/profile.d.ts +1 -2
- package/types/event/product.d.ts +4 -2
- package/types/event/profile.d.ts +2 -4
package/package.json
CHANGED
package/types/api/product.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Product, SuccessResponse} from "../common";
|
|
2
2
|
|
|
3
3
|
type ProductOption = { [key: number]: number | string | number[] };
|
|
4
4
|
|
|
@@ -25,6 +25,7 @@ export interface AvailabilityPayload {
|
|
|
25
25
|
country_code?: string | 'SA';//required when request without email
|
|
26
26
|
phone?: string | '555555555';//required when request without email
|
|
27
27
|
}
|
|
28
|
+
|
|
28
29
|
export interface ProductsSearchResponse extends SuccessResponse {
|
|
29
30
|
data: Product[];
|
|
30
31
|
cursor: {
|
|
@@ -44,8 +45,21 @@ export interface GetPriceResponse extends SuccessResponse {
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
export interface Category {
|
|
49
|
+
id: string;
|
|
50
|
+
id_: number;
|
|
51
|
+
name: string;
|
|
52
|
+
url: string;
|
|
53
|
+
sub_categories: Category[];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface GetCategoriesResponse extends SuccessResponse {
|
|
57
|
+
data: Category | Category[]; //single category when getting subCategories by passing categoryId
|
|
58
|
+
}
|
|
59
|
+
|
|
47
60
|
export default interface ProductApi {
|
|
48
61
|
getPrice: (data: /*product_id*/number | ProductPayload) => Promise<GetPriceResponse>;
|
|
49
62
|
availabilitySubscribe: (product_id: number | AvailabilityPayload) => Promise<SuccessResponse>;
|
|
50
63
|
search: (keyword: string | SearchPayload) => Promise<ProductsSearchResponse>;
|
|
64
|
+
categories: (categoryId?: number) => Promise<GetCategoriesResponse>; //get all categories or sub_categories
|
|
51
65
|
}
|
package/types/api/profile.d.ts
CHANGED
|
@@ -36,7 +36,6 @@ export interface UpdateProfileResponse extends SuccessResponse {
|
|
|
36
36
|
|
|
37
37
|
export default interface ProfileApi {
|
|
38
38
|
update: (data: ProfileUpdatePayload) => Promise<UpdateProfileResponse>;
|
|
39
|
-
updateMobile: (data: ProfileUpdateMobilePayload) => Promise<UpdateProfileResponse>;
|
|
40
|
-
updateEmail: (data: ProfileUpdateEmailPayload) => Promise<UpdateProfileResponse>;
|
|
41
39
|
verify: (data: AuthRequest.verifyByMobile | AuthRequest.verifyByEmail) => Promise<SuccessResponse>;
|
|
40
|
+
updateContacts: (data: ProfileUpdateMobilePayload | ProfileUpdateEmailPayload) => Promise<UpdateProfileResponse>;
|
|
42
41
|
}
|
package/types/event/product.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {GetPriceResponse, ProductsSearchResponse} from "../api/product";
|
|
2
|
-
import {RequestErrorEventWithData, SuccessResponse} from "../common";
|
|
1
|
+
import {GetCategoriesResponse, GetPriceResponse, ProductsSearchResponse} from "../api/product";
|
|
2
|
+
import {RequestError, RequestErrorEventWithData, SuccessResponse} from "../common";
|
|
3
3
|
|
|
4
4
|
export default interface ProductEvent {
|
|
5
5
|
onPriceUpdated: (callback: (response: GetPriceResponse, product_id: number) => void) => void;
|
|
6
6
|
onPriceUpdateFailed: RequestErrorEventWithData</*product_id*/ number>;
|
|
7
7
|
onAvailabilitySubscribed: (callback: (response: SuccessResponse, product_id: number) => void) => void;
|
|
8
8
|
onAvailabilitySubscribeFailed: RequestErrorEventWithData</*product_id*/ number>;
|
|
9
|
+
onCategoriesFetched: (callback: (response: GetCategoriesResponse) => void) => void;
|
|
10
|
+
onCategoriesFailed: RequestError;
|
|
9
11
|
onSearchResults: (callback: (response: ProductsSearchResponse, query?: string) => void) => void;
|
|
10
12
|
onSearchFailed: RequestErrorEventWithData</*query*/string|undefined>;
|
|
11
13
|
}
|
package/types/event/profile.d.ts
CHANGED
|
@@ -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
|
+
onContactsUpdated: (callback: (response: UpdateProfileResponse) => void) => void;
|
|
9
8
|
|
|
10
9
|
//errors
|
|
11
10
|
onUpdateFailed: RequestErrorEvent;
|
|
12
|
-
onUpdateMobileFailed: RequestErrorEvent;
|
|
13
|
-
onUpdateEmailFailed: RequestErrorEvent;
|
|
14
11
|
onUnverified: RequestErrorEvent;
|
|
12
|
+
onUpdateContactsFailed: RequestErrorEvent;
|
|
15
13
|
}
|