@salla.sa/twilight 2.0.248 → 2.0.250

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.248",
3
+ "version": "2.0.250",
4
4
  "description": "Salla Theme Toolkit, Webcomponents, Events, Requests, Utils",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,9 +1,9 @@
1
1
  import {
2
- AuthApi, CartApi, CommentApi, CouponApi, CurrencyApi, DocumentApi, RatingApi, GiftApi, OfferApi, OrderApi,
2
+ AuthApi, CartApi, CommentApi, CurrencyApi, DocumentApi, RatingApi, GiftApi, OfferApi, OrderApi,
3
3
  ProductApi, ProfileApi, SearchApi, TwilightApi, WishlistApi, LoyaltyApi
4
4
  } from "./api";
5
5
  import {
6
- AuthEvent, CartEvent, CommentEvent, CouponEvent, CurrencyEvent, DocumentEvent, RatingEvent, GiftEvent, OfferEvent,
6
+ AuthEvent, CartEvent, CommentEvent, CurrencyEvent, DocumentEvent, RatingEvent, GiftEvent, OfferEvent,
7
7
  InfiniteScrollEvent, OrderEvent, ProductEvent, ProfileEvent, SearchEvent, TwilightEvent, WishlistEvent, LoyaltyEvent
8
8
  } from "./event";
9
9
 
@@ -14,7 +14,6 @@ export default interface SallaActions {
14
14
  order: OrderApi & { api: OrderApi, event: OrderEvent };
15
15
  offer: OfferApi & { api: OfferApi, event: OfferEvent };
16
16
  search: SearchApi & { api: SearchApi, event: SearchEvent };
17
- coupon: CouponApi & { api: CouponApi, event: CouponEvent };
18
17
  rating: RatingApi & { api: RatingApi, event: RatingEvent };
19
18
  comment: CommentApi & { api: CommentApi, event: CommentEvent };
20
19
  loyalty: LoyaltyApi & { api: LoyaltyApi, event: LoyaltyEvent };
@@ -26,7 +26,6 @@ export namespace AuthRequest {
26
26
  last_name: string;
27
27
  phone: string;
28
28
  country_code: string | 'SA';
29
- country_key: string | '+966';
30
29
  verified_by: 'email' | 'phone';
31
30
  email?: string;
32
31
  code: number;
@@ -5,7 +5,7 @@ import {CartResponse} from "./response";
5
5
  import {CartRequest} from "./request";
6
6
 
7
7
  export default interface CartApi {
8
- latest: () => Promise<CartResponse.latest>;
8
+ latest: () => Promise<CartResponse.update>;
9
9
  details: () => Promise<CartResponse.update>;
10
10
  summary: () => Promise<CartResponse.update>;
11
11
  quickAdd: (/*product_id*/id: number) => Promise<CartResponse.update>;
@@ -16,4 +16,8 @@ export default interface CartApi {
16
16
  status: () => Promise<CartResponse.status>;
17
17
  reset: () => void;
18
18
  submit: () => void;
19
+
20
+ //coupons
21
+ addCoupon: (coupon: string) => Promise<CartResponse.update>;
22
+ deleteCoupon: () => Promise<CartResponse.update>;
19
23
  }
@@ -1,15 +1,6 @@
1
1
  import {SuccessResponse} from "../../common";
2
2
  export {SuccessResponse} from "../../common";
3
3
  export namespace CartResponse {
4
- export interface latest extends SuccessResponse {
5
- data: {
6
- cart: {
7
- id: number;
8
- user_id: number | string;
9
- }
10
- };
11
- }
12
-
13
4
  export interface update extends SuccessResponse {
14
5
  data: CartUpdatedData;
15
6
  }
@@ -5,7 +5,6 @@ import GiftApi from "./gift";
5
5
  import OrderApi from "./order";
6
6
  import OfferApi from "./offer";
7
7
  import SearchApi from "./search";
8
- import CouponApi from "./coupon";
9
8
  import RatingApi from "./rating";
10
9
  import CommentApi from "./comment";
11
10
  import LoyaltyApi from "./loyalty";
@@ -23,7 +22,6 @@ export {
23
22
  OrderApi,
24
23
  OfferApi,
25
24
  SearchApi,
26
- CouponApi,
27
25
  RatingApi,
28
26
  CommentApi,
29
27
  LoyaltyApi,
@@ -50,6 +48,8 @@ export type ApiActionName =
50
48
  | 'cart.updateItem'
51
49
  | 'cart.deleteImage'
52
50
  | 'cart.status'
51
+ | 'cart.addCoupon'
52
+ | 'cart.deleteCoupon'
53
53
  | 'gift.buy'
54
54
  | 'loyalty.exchange'
55
55
  | 'order.cancel'
@@ -58,8 +58,6 @@ export type ApiActionName =
58
58
  | 'offer.increase'
59
59
  | 'offer.details'
60
60
  | 'search.search'
61
- | 'coupon.add'
62
- | 'coupon.remove'
63
61
  | 'product.getPrice'
64
62
  | 'product.availabilitySubscribe'
65
63
  | 'product.purchaseNow'
@@ -83,7 +81,6 @@ export default interface SallaApi extends Axios {
83
81
  order: OrderApi;
84
82
  offer: OfferApi;
85
83
  search: SearchApi;
86
- coupon: CouponApi;
87
84
  rating: RatingApi;
88
85
  comment: CommentApi;
89
86
  loyalty: LoyaltyApi;
@@ -6,7 +6,7 @@ export default interface CartEvent {
6
6
  onItemAdded: (callback: (response: CartResponse.update, product_id: number) => void) => void;
7
7
  onItemUpdated: (callback: (response: CartResponse.update, product_id: number) => void) => void;
8
8
  onItemDeleted: (callback: (response: CartResponse.update, product_id: number) => void) => void;
9
- onLatestFetched: (callback: (response: CartResponse.latest) => void) => void;
9
+ onLatestFetched: (callback: (response: CartResponse.update) => void) => void;
10
10
  onSubmitted: (callback: (response: CartResponse.status) => void) => void;
11
11
  onImageDeleted: (callback: (response: SuccessResponse, file_id: number) => void) => void;
12
12
  onSummaryFetched: (callback: (response: CartResponse.status) => void) => void;
@@ -22,4 +22,10 @@ export default interface CartEvent {
22
22
  onImageNotDeleted: (callback: (error: RequestError | 'There is no "id"!', file_id?: number) => void) => void;
23
23
  onSummaryNotFetched: (callback: (error: RequestError) => void) => void;
24
24
  onDetailsNotFetched: (callback: (error: RequestError) => void) => void;
25
+
26
+ //coupons
27
+ onCouponAdded: (callback: (response: CartResponse.update, cart_id: number) => void) => void;
28
+ onCouponDeleted: (callback: (response: CartResponse.update, cart_id: number) => void) => void;
29
+ onCouponAdditionFailed: (callback: (error: RequestError, cart_id?: number) => void) => void;
30
+ onCouponDeletionFailed: (callback: (error: RequestError, cart_id?: number) => void) => void;
25
31
  }
@@ -4,7 +4,6 @@ import GiftEvent from "./gift";
4
4
  import OrderEvent from "./order";
5
5
  import OfferEvent from "./offer";
6
6
  import SearchEvent from "./search";
7
- import CouponEvent from "./coupon";
8
7
  import RatingEvent from "./rating";
9
8
  import CommentEvent from "./comment";
10
9
  import LoyaltyEvent from "./loyalty";
@@ -24,7 +23,6 @@ export {
24
23
  OrderEvent,
25
24
  OfferEvent,
26
25
  SearchEvent,
27
- CouponEvent,
28
26
  RatingEvent,
29
27
  CommentEvent,
30
28
  LoyaltyEvent,
@@ -44,7 +42,6 @@ export default interface SallaEvent extends EventEmitter2 {
44
42
  order: OrderEvent;
45
43
  offer: OfferEvent;
46
44
  search: SearchEvent;
47
- coupon: CouponEvent;
48
45
  rating: RatingEvent;
49
46
  comment: CommentEvent;
50
47
  loyalty: LoyaltyEvent;
@@ -1,6 +0,0 @@
1
- import {CartResponse} from "./cart";
2
-
3
- export default interface CouponApi {
4
- add: (coupon: string) => Promise<CartResponse.update>;
5
- remove: () => Promise<CartResponse.update>;
6
- }
@@ -1,9 +0,0 @@
1
- import {CartResponse} from "../api/cart";
2
- import {RequestError} from "../common";
3
-
4
- export default interface CouponEvent {
5
- onAdded: (callback: (response: CartResponse.update, cart_id: number) => void) => void;
6
- onRemoved: (callback: (response: CartResponse.update, cart_id: number) => void) => void;
7
- onAddedFailed: (callback: (error: RequestError, cart_id?: number) => void) => void;
8
- onRemovedFailed: (callback: (error: RequestError, cart_id?: number) => void) => void;
9
- }