@salla.sa/twilight 2.9.13 → 2.9.19

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.9.13",
3
+ "version": "2.9.19",
4
4
  "description": "Salla Theme Toolkit, Webcomponents, Events, Requests, Utils",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -31,7 +31,7 @@
31
31
  ],
32
32
  "homepage": "https://salla.dev",
33
33
  "dependencies": {
34
- "@salla.sa/base": "^2.9.13",
34
+ "@salla.sa/base": "^2.9.19",
35
35
  "@salla.sa/twilight-tailwind-theme": "^2.9.13",
36
36
  "axios": "^0.27.2",
37
37
  "infinite-scroll": "^4.0.1",
@@ -61,5 +61,5 @@
61
61
  "peerDependencies": {
62
62
  "webpack": "^4 || ^5"
63
63
  },
64
- "gitHead": "6c1d0f6d71e445dca18557b7ffe90c99457355c7"
64
+ "gitHead": "0e9ff15d75f2a279cc8de60dcc0e5a81dc33b87d"
65
65
  }
@@ -0,0 +1,21 @@
1
+ import { SuccessResponse } from '../common'
2
+
3
+
4
+ export interface RedirectPayload {
5
+ to: 'login' | 'booking',
6
+ url: null | string
7
+ }
8
+
9
+ export interface Booking {
10
+ redirect: RedirectPayload
11
+ }
12
+
13
+ export namespace BookingApiResponse {
14
+ export interface add extends SuccessResponse {
15
+ data: Booking
16
+ }
17
+ }
18
+
19
+ export default interface BookingApi {
20
+ add: (productId: number) => Promise<BookingApiResponse.add>
21
+ }
@@ -10,7 +10,8 @@ import CurrencyApi from "./currency";
10
10
  import DocumentApi from "./document";
11
11
  import WishlistApi from "./wishlist";
12
12
  import ScopeApi from "./scope";
13
- import {ErrorResponse, SuccessResponse} from "@salla.sa/base/types/common";
13
+ import BookingApi, { Booking } from "./booking";
14
+ import { ErrorResponse, SuccessResponse } from "@salla.sa/base/types/common";
14
15
 
15
16
  export {
16
17
  CartApi,
@@ -25,6 +26,7 @@ export {
25
26
  DocumentApi,
26
27
  WishlistApi,
27
28
  ScopeApi,
29
+ BookingApi,
28
30
  };
29
31
  export type ApiActionName =
30
32
  'auth.login'
@@ -73,7 +75,8 @@ export type ApiActionName =
73
75
  | 'scope.get'
74
76
  | 'scope.change'
75
77
  | 'scope.getProductAvailability'
76
- | 'withoutNotifier';
78
+ | 'withoutNotifier'
79
+ | 'booking.add';
77
80
 
78
81
  export default interface Api {
79
82
  cart: CartApi;
@@ -88,6 +91,7 @@ export default interface Api {
88
91
  document: DocumentApi;
89
92
  wishlist: WishlistApi;
90
93
  scope: ScopeApi;
94
+ booking: BookingApi;
91
95
  withoutNotifier: (callback: Function) => Promise<void>;
92
96
  getHeaders: () => {
93
97
  Accept: string | 'application/json, text/plain, */*',
@@ -99,9 +103,9 @@ export default interface Api {
99
103
  Authorization?: string
100
104
  }
101
105
  request(endPoint: string, formData: undefined | object, method: string, options: object): Promise<any>
102
- handleAfterResponseActions(response: SuccessResponse|ErrorResponse|any): void;
103
- fireEventsForResponse(response: SuccessResponse|ErrorResponse|any): void;
104
- showAlert(response: SuccessResponse|ErrorResponse|any): void;
106
+ handleAfterResponseActions(response: SuccessResponse | ErrorResponse | any): void;
107
+ fireEventsForResponse(response: SuccessResponse | ErrorResponse | any): void;
108
+ showAlert(response: SuccessResponse | ErrorResponse | any): void;
105
109
  handleErrorResponse(error: object): void;
106
110
  handleInvalidFields(error: object): void;
107
111
  errorPromise(data: any): Promise<any>;
@@ -0,0 +1,7 @@
1
+ import { RequestErrorEvent } from "../common";
2
+ import { BookingApiResponse } from "../api/booking";
3
+
4
+ export default interface BookingEvent {
5
+ onAdded: (callback: (response: BookingApiResponse.add) => void) => void;
6
+ onAdditionFailed: RequestErrorEvent;
7
+ }
@@ -11,6 +11,7 @@ import DocumentEvent from "./document";
11
11
  import WishlistEvent from "./wishlist";
12
12
  import InfiniteScrollEvent from "./infiniteScroll";
13
13
  import ScopeEvents from "./scope";
14
+ import BookingEvent from "./booking";
14
15
  import Emitter from "@salla.sa/base/types/event";
15
16
 
16
17
  export type event = (symbol | string);
@@ -29,6 +30,7 @@ export {
29
30
  WishlistEvent,
30
31
  InfiniteScrollEvent,
31
32
  ScopeEvents,
33
+ BookingEvent,
32
34
  }
33
35
 
34
36
  export default interface TwilightEmitter extends Emitter {
@@ -43,6 +45,7 @@ export default interface TwilightEmitter extends Emitter {
43
45
  currency: CurrencyEvent;
44
46
  document: DocumentEvent;
45
47
  wishlist: WishlistEvent;
46
- scope: ScopeEvents,
48
+ scope: ScopeEvents;
49
+ booking: BookingEvent;
47
50
  infiniteScroll: InfiniteScrollEvent;
48
51
  }