@salla.sa/twilight 2.12.60 → 2.12.65
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 +3 -3
- 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 +4 -4
- package/types/api/advertisement.ts +42 -0
- package/types/api/auth/response.d.ts +1 -0
- package/types/api/component.d.ts +92 -0
- package/types/api/profile.d.ts +3 -3
- package/types/common.d.ts +122 -17
- package/types/event/advertisement.ts +7 -0
- package/types/event/auth.d.ts +1 -1
- package/types/event/component.d.ts +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salla.sa/twilight",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.65",
|
|
4
4
|
"description": "Salla Theme Toolkit, Webcomponents, Events, Requests, Utils",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "npx rollup --config --preserveSymlinks=true",
|
|
10
10
|
"watch": "npx rollup --watch --config --preserveSymlinks=true",
|
|
11
|
-
"test": "
|
|
11
|
+
"test": "jest --detectOpenHandles -- component.test",
|
|
12
12
|
"express": "node tests/server/index.js"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
],
|
|
34
34
|
"homepage": "https://salla.dev",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@salla.sa/base": "^2.12.
|
|
36
|
+
"@salla.sa/base": "^2.12.64",
|
|
37
37
|
"axios": "^0.27.2",
|
|
38
38
|
"infinite-scroll": "^4.0.1",
|
|
39
39
|
"jwt-decode": "^3.1.2",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"webpack": "^4 || ^5"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "4114d79a56944bb5a339ca236240538cac4f7f6f"
|
|
71
71
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {SuccessResponse} from '../common'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export interface Advertisement {
|
|
5
|
+
id?: number;
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
type?: Type;
|
|
9
|
+
style?: Style;
|
|
10
|
+
expire_date?: ExpireDate;
|
|
11
|
+
pages?: string[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ExpireDate {
|
|
15
|
+
date?: Date;
|
|
16
|
+
timezone_type?: number;
|
|
17
|
+
timezone?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface Style {
|
|
21
|
+
icon?: string;
|
|
22
|
+
font_color?: string;
|
|
23
|
+
background_color?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface Type {
|
|
27
|
+
id?: number;
|
|
28
|
+
name?: string;
|
|
29
|
+
link?: string;
|
|
30
|
+
url?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export namespace AdvertisementApiResponse {
|
|
35
|
+
export interface fetch extends SuccessResponse {
|
|
36
|
+
data: Advertisement
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default interface AdvertisementApi {
|
|
41
|
+
fetch: (productId: number, withRedirect: boolean) => Promise<AdvertisementApiResponse.fetch>
|
|
42
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {SuccessResponse, Product} from '../common'
|
|
2
|
+
|
|
3
|
+
export interface AdvertisementColor {
|
|
4
|
+
bg: string;
|
|
5
|
+
text: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface HeaderBreadcrumb {
|
|
9
|
+
title: string;
|
|
10
|
+
url: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface HeaderAdvertisement {
|
|
14
|
+
id: number;
|
|
15
|
+
icon: string;
|
|
16
|
+
title: string;
|
|
17
|
+
description: string;
|
|
18
|
+
url?: string;
|
|
19
|
+
close_url: string;
|
|
20
|
+
target: string;
|
|
21
|
+
colors: AdvertisementColor[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface HeaderMenuItem {
|
|
25
|
+
has_children?: boolean;
|
|
26
|
+
url?: string;
|
|
27
|
+
title?: string;
|
|
28
|
+
attrs?: string;
|
|
29
|
+
link_attrs?: string;
|
|
30
|
+
products?: Product[];
|
|
31
|
+
children?: Header[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface Header {
|
|
35
|
+
menu: HeaderMenuItem[];
|
|
36
|
+
advertisement?: HeaderAdvertisement[];
|
|
37
|
+
breadcrumbs: HeaderBreadcrumb[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Footer
|
|
41
|
+
export interface FooterMenu {
|
|
42
|
+
id?: number;
|
|
43
|
+
title?: string;
|
|
44
|
+
url?: string;
|
|
45
|
+
target?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface FooterContact {
|
|
49
|
+
name?: string;
|
|
50
|
+
type?: string;
|
|
51
|
+
icon?: string;
|
|
52
|
+
url?: string;
|
|
53
|
+
value?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface FooterMobileApp {
|
|
57
|
+
name?: string;
|
|
58
|
+
url?: string;
|
|
59
|
+
// TODO?: ask @jamal to add this field to the DTO,
|
|
60
|
+
// otherwise there is no way to get the image of the mobile app.
|
|
61
|
+
// (i.e. for the sake of simplicity)
|
|
62
|
+
icon?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface FooterPaymentMethod {
|
|
66
|
+
payment_methods
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface FooterSocialLink {
|
|
70
|
+
name?: string;
|
|
71
|
+
type?: string;
|
|
72
|
+
icon?: string;
|
|
73
|
+
url?: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface Footer {
|
|
77
|
+
contacts?: FooterContact[];
|
|
78
|
+
apps?: FooterMobileApp[];
|
|
79
|
+
items?: FooterMenu[];
|
|
80
|
+
payment_methods?: string[];
|
|
81
|
+
links?: FooterSocialLink[]
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export namespace ComponentApiResponse {
|
|
85
|
+
export interface menus extends SuccessResponse {
|
|
86
|
+
data: HeaderMenuItem[] | FooterMenu[] | []
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default interface ComponentApi {
|
|
91
|
+
menus?: (component: string) => Promise<ComponentApiResponse.menus>
|
|
92
|
+
}
|
package/types/api/profile.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {SuccessResponse} from "../common";
|
|
1
|
+
import {SuccessResponse, Genders} from "../common";
|
|
2
2
|
import {AuthRequest, VerificationStatus} from "./auth";
|
|
3
3
|
|
|
4
4
|
export interface ProfileUpdatePayload {
|
|
5
5
|
first_name: string;
|
|
6
6
|
last_name: string;
|
|
7
|
-
birthday?: string
|
|
8
|
-
gender?:
|
|
7
|
+
birthday?: string;
|
|
8
|
+
gender?: Genders.Male | Genders.Female;
|
|
9
9
|
avatar?: BinaryType;
|
|
10
10
|
}
|
|
11
11
|
|
package/types/common.d.ts
CHANGED
|
@@ -41,26 +41,104 @@ export interface Currency {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export interface Product {
|
|
44
|
-
id
|
|
45
|
-
name
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
id?: number;
|
|
45
|
+
name?: string;
|
|
46
|
+
sku?: null | string;
|
|
47
|
+
subtitle?: null | string;
|
|
48
|
+
url?: string;
|
|
49
|
+
promotion_title?: null | string;
|
|
50
|
+
status?: string;
|
|
51
|
+
type?: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
quantity?: number | any;
|
|
54
|
+
max_quantity?: number;
|
|
55
|
+
sold_quantity?: any;
|
|
56
|
+
price?: any[];
|
|
57
|
+
regular_price?: any[];
|
|
58
|
+
sale_price?: any[];
|
|
59
|
+
starting_price?: any;
|
|
60
|
+
discount_ends?: any;
|
|
61
|
+
discount_percentage?: string;
|
|
62
|
+
image?: MainImage;
|
|
63
|
+
calories?: any;
|
|
64
|
+
weight?: any;
|
|
65
|
+
base_currency_price?: any[];
|
|
66
|
+
currency?: string;
|
|
67
|
+
donation?: any;
|
|
68
|
+
images?: ImageElement[];
|
|
69
|
+
rating?: any;
|
|
70
|
+
options?: any[];
|
|
71
|
+
tags?: any[];
|
|
72
|
+
brand?: Brand | any;
|
|
73
|
+
notify_availability?: any;
|
|
74
|
+
category?: any;
|
|
75
|
+
can_add_note?: boolean;
|
|
76
|
+
can_donate?: boolean;
|
|
77
|
+
can_upload_file?: boolean;
|
|
78
|
+
can_show_sold?: boolean;
|
|
79
|
+
can_show_remained_quantity?: boolean;
|
|
80
|
+
has_3d_image?: boolean;
|
|
81
|
+
has_custom_form?: boolean;
|
|
82
|
+
has_options?: boolean;
|
|
83
|
+
has_read_more?: boolean;
|
|
84
|
+
has_size_guide?: boolean;
|
|
85
|
+
is_available?: boolean;
|
|
86
|
+
is_hidden_quantity?: boolean;
|
|
87
|
+
is_in_wishlist?: boolean;
|
|
88
|
+
is_on_sale?: boolean;
|
|
89
|
+
is_out_of_stock?: boolean;
|
|
90
|
+
is_require_shipping?: boolean;
|
|
91
|
+
is_taxable?: boolean;
|
|
92
|
+
is_giftable?: boolean;
|
|
93
|
+
is_donation?: boolean;
|
|
94
|
+
is_booking?: boolean;
|
|
95
|
+
brand_id?: number | any;
|
|
96
|
+
target_donating_enable?: boolean;
|
|
97
|
+
price_as_float?: number;
|
|
98
|
+
price_as_float_for_payment?: number;
|
|
99
|
+
currency_for_payment?: string;
|
|
100
|
+
sale_end?: any;
|
|
101
|
+
customized_sku_quantity?: any;
|
|
102
|
+
auto_include_tax?: any;
|
|
103
|
+
with_tax?: boolean;
|
|
104
|
+
enabled_image_upload?: any;
|
|
105
|
+
max_quantity_per_order?: any;
|
|
106
|
+
source?: any;
|
|
107
|
+
available?: any;
|
|
108
|
+
notes?: any;
|
|
109
|
+
attachments?: any;
|
|
110
|
+
add_to_cart_label?: string;
|
|
111
|
+
show_availability?: boolean;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface MainImage {
|
|
115
|
+
url?: string;
|
|
116
|
+
alt?: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface Brand {
|
|
120
|
+
id: string;
|
|
59
121
|
url: string;
|
|
60
|
-
|
|
61
|
-
|
|
122
|
+
name: string;
|
|
123
|
+
logo: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface ImageElement {
|
|
127
|
+
id?: number;
|
|
128
|
+
url?: string;
|
|
129
|
+
main?: boolean;
|
|
130
|
+
three_d_image_url?: string;
|
|
131
|
+
alt?: string;
|
|
132
|
+
video_url?: string;
|
|
133
|
+
type?: Type;
|
|
134
|
+
sort?: number;
|
|
62
135
|
}
|
|
63
136
|
|
|
137
|
+
export enum Type {
|
|
138
|
+
Image = "image",
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
64
142
|
export interface Category {
|
|
65
143
|
id: number;
|
|
66
144
|
name: string;
|
|
@@ -72,4 +150,31 @@ export interface RequestInfo {
|
|
|
72
150
|
method: string;
|
|
73
151
|
payload: any,
|
|
74
152
|
options: {},
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface UserInstance {
|
|
156
|
+
id?: number;
|
|
157
|
+
currency?: string;
|
|
158
|
+
language?: string;
|
|
159
|
+
first_name?: string;
|
|
160
|
+
last_name?: string;
|
|
161
|
+
phone?: Phone;
|
|
162
|
+
email?: string;
|
|
163
|
+
avatar?: string;
|
|
164
|
+
gender?: string;
|
|
165
|
+
birthday?: string;
|
|
166
|
+
notifications?: number;
|
|
167
|
+
loyalty_program_points?: number;
|
|
168
|
+
pending_orders?: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface Phone {
|
|
172
|
+
code?: string;
|
|
173
|
+
number?: number;
|
|
174
|
+
country?: string;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export enum Genders {
|
|
178
|
+
Female = 'female',
|
|
179
|
+
Male = 'male',
|
|
75
180
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RequestErrorEvent } from "../common";
|
|
2
|
+
import { AdvertisementApiResponse } from "../api/advertisement";
|
|
3
|
+
|
|
4
|
+
export default interface AdvertisementEvent {
|
|
5
|
+
onFetched: (callback: (response: AdvertisementApiResponse.fetch) => void) => void;
|
|
6
|
+
onFetchFailed: RequestErrorEvent;
|
|
7
|
+
}
|
package/types/event/auth.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export default interface AuthEvent {
|
|
|
8
8
|
onRegistered: (callback: (response: AuthResponse.verify) => void) => void;
|
|
9
9
|
onLoggedIn: (callback: (response: AuthResponse.verify) => void) => void;
|
|
10
10
|
onLoggedOut: (callback: (response: SuccessResponse) => void) => void;
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
//Error Responses
|
|
13
13
|
onCodeNotSent: (callback: (error: RequestError | string, type?: 'mobile' | 'email') => void) => void;
|
|
14
14
|
onVerificationFailed: (callback: (error: RequestError | string, type?: 'mobile' | 'email') => void) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RequestErrorEvent } from "../common";
|
|
2
|
+
import { ComponentApiResponse } from "../api/component";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default interface ComponentEvent {
|
|
6
|
+
onFetched: (callback: (response: ComponentApiResponse.menus) => void) => void;
|
|
7
|
+
onFetchFailed: RequestErrorEvent
|
|
8
|
+
}
|