@salla.sa/twilight 2.0.255 → 2.0.256
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/cart/response.d.ts +1 -1
- package/types/event/index.d.ts +97 -1
- package/types/index.d.ts +1 -1
- package/types/lib/salla-config.ts +2 -2
package/package.json
CHANGED
package/types/event/index.d.ts
CHANGED
|
@@ -16,6 +16,98 @@ import WishlistEvent from "./wishlist";
|
|
|
16
16
|
import InfiniteScrollEvent from "./infiniteScroll";
|
|
17
17
|
import {EventEmitter2} from "eventemitter2";
|
|
18
18
|
|
|
19
|
+
export type event = (symbol | string);
|
|
20
|
+
export type EventName = string
|
|
21
|
+
| 'auth::login'
|
|
22
|
+
| 'auth::logout'
|
|
23
|
+
| 'auth::code.sent'
|
|
24
|
+
| 'auth::code.not-sent'
|
|
25
|
+
| 'auth::code.re-sent'
|
|
26
|
+
| 'auth::code.not.re-sent'
|
|
27
|
+
| 'auth::verified'
|
|
28
|
+
| 'auth::verification.failed'
|
|
29
|
+
| 'auth::logged.in'
|
|
30
|
+
| 'auth::registered'
|
|
31
|
+
| 'auth::registration.failed'
|
|
32
|
+
| 'auth::logged.out'
|
|
33
|
+
| 'auth::failed.logout'
|
|
34
|
+
| 'auth::token.fetched'
|
|
35
|
+
| 'auth::refresh.failed'
|
|
36
|
+
| 'cart::latest.fetched'
|
|
37
|
+
| 'cart::latest.failed'
|
|
38
|
+
| 'cart::updated'
|
|
39
|
+
| 'cart::item.updated'
|
|
40
|
+
| 'cart::item.updated.failed'
|
|
41
|
+
| 'cart::item.added'
|
|
42
|
+
| 'cart::item.added.failed'
|
|
43
|
+
| 'cart::item.deleted'
|
|
44
|
+
| 'cart::item.deleted.failed'
|
|
45
|
+
| 'cart::submitted'
|
|
46
|
+
| 'cart::submit.failed'
|
|
47
|
+
| 'cart::image.deleted'
|
|
48
|
+
| 'cart::image.not.deleted'
|
|
49
|
+
| 'cart::details.fetched'
|
|
50
|
+
| 'cart::details.not.fetched'
|
|
51
|
+
| 'cart::success.reset'
|
|
52
|
+
| 'cart::coupon.added'
|
|
53
|
+
| 'cart::coupon.deleted'
|
|
54
|
+
| 'cart::coupon.addition.failed'
|
|
55
|
+
| 'cart::coupon.deletion.failed'
|
|
56
|
+
| 'gift::buying.succeeded'
|
|
57
|
+
| 'gift::buying.failed'
|
|
58
|
+
| 'loyalty::exchange.succeeded'
|
|
59
|
+
| 'loyalty::exchange.failed'
|
|
60
|
+
| 'order::canceled'
|
|
61
|
+
| 'order::not.canceled'
|
|
62
|
+
| 'order::re.ordered'
|
|
63
|
+
| 'order::re.order.failed'
|
|
64
|
+
| 'order::invoice.sent'
|
|
65
|
+
| 'order::invoice.not.sent'
|
|
66
|
+
| 'offer::existed'
|
|
67
|
+
| 'offer::increase'
|
|
68
|
+
| 'offer::increase.failed'
|
|
69
|
+
| 'offer::fetch.details.failed'
|
|
70
|
+
| 'offer::details.fetched'
|
|
71
|
+
| 'rating::order.not.fetched'
|
|
72
|
+
| 'rating::order.fetched'
|
|
73
|
+
| 'rating::store.rated'
|
|
74
|
+
| 'rating::store.failed'
|
|
75
|
+
| 'rating::products.rated'
|
|
76
|
+
| 'rating::products.failed'
|
|
77
|
+
| 'rating::shipping.rated'
|
|
78
|
+
| 'rating::shipping.failed'
|
|
79
|
+
| 'search::finished'
|
|
80
|
+
| 'search::failed'
|
|
81
|
+
| 'product::price.updated'
|
|
82
|
+
| 'product::price.updated.failed'
|
|
83
|
+
| 'product::availability.subscribed'
|
|
84
|
+
| 'product::availability.subscribe.failed'
|
|
85
|
+
| 'profile::updated'
|
|
86
|
+
| 'profile::update.failed'
|
|
87
|
+
| 'profile::mobile.updated'
|
|
88
|
+
| 'profile::update.mobile.failed'
|
|
89
|
+
| 'profile::email.updated'
|
|
90
|
+
| 'profile::update.email.failed'
|
|
91
|
+
| 'profile::verified'
|
|
92
|
+
| 'profile::unverified'
|
|
93
|
+
| 'comment::added'
|
|
94
|
+
| 'comment::addition.failed'
|
|
95
|
+
| 'currency::changed'
|
|
96
|
+
| 'currency::failed'
|
|
97
|
+
| 'currency::fetched'
|
|
98
|
+
| 'currency::failed.to.fetch'
|
|
99
|
+
| 'document::click'
|
|
100
|
+
| 'document::change'
|
|
101
|
+
| 'document::submit'
|
|
102
|
+
| 'document::keyup'
|
|
103
|
+
| 'document::leaving'
|
|
104
|
+
| 'document::request'
|
|
105
|
+
| 'document::request.failed'
|
|
106
|
+
| 'twilight::initiated'
|
|
107
|
+
| 'wishlist::added'
|
|
108
|
+
| 'wishlist::removed'
|
|
109
|
+
| 'wishlist::addition.failed'
|
|
110
|
+
| 'wishlist::removing.failed';
|
|
19
111
|
export {
|
|
20
112
|
AuthEvent,
|
|
21
113
|
CartEvent,
|
|
@@ -53,5 +145,9 @@ export default interface SallaEvent extends EventEmitter2 {
|
|
|
53
145
|
wishlist: WishlistEvent;
|
|
54
146
|
infiniteScroll: InfiniteScrollEvent;
|
|
55
147
|
dispatchEvents: (events: { [event_name: string]: any }) => void;
|
|
56
|
-
dispatch: (event_name:
|
|
148
|
+
dispatch: (event_name: EventName, ...data: undefined | any) => void;
|
|
149
|
+
|
|
150
|
+
on(event: EventName, listener: (...values: any[]) => void, options?: boolean | Object): this;
|
|
151
|
+
|
|
152
|
+
once(event: EventName, listener: (...values: any[]) => void, options?: boolean | Object): this;
|
|
57
153
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export default interface Salla extends SallaActions {
|
|
|
31
31
|
form: SallaForm;
|
|
32
32
|
money: (money: number | Price) => string;
|
|
33
33
|
url: UrlHelper;
|
|
34
|
-
|
|
34
|
+
isInitiated: boolean; // will be true when firing event `twilight::initiated`
|
|
35
35
|
onReady: (callback: (event: Event) => unknown) => void; //don't relay on it because Salla may not existed yet
|
|
36
36
|
init: (config: SallaConfig) => void; // an alias for `salla.twilight.init(config)`
|
|
37
37
|
call: (action: ApiActionName | string) => any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Language, TwilightConfig} from "../tiwlight-config";
|
|
2
|
-
import {Currency,
|
|
2
|
+
import {Currency, Price} from "../common";
|
|
3
3
|
|
|
4
4
|
export type ConfigKey =
|
|
5
5
|
'_token'
|
|
@@ -44,7 +44,7 @@ export default interface SallaConfig {
|
|
|
44
44
|
isUser: () => boolean;
|
|
45
45
|
isGuest: () => boolean;
|
|
46
46
|
languageCode: () => string | 'ar';
|
|
47
|
-
currency: (code
|
|
47
|
+
currency: (code?: string | 'SAR') => Currency;
|
|
48
48
|
currencies: () => Promise<{ SAR: Currency, [code: string]: Currency }>;
|
|
49
49
|
languages: () => Promise<{ ar: Language, [code: string]: Language }>;
|
|
50
50
|
}
|