@salla.sa/twilight 2.9.43 → 2.9.44

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.43",
3
+ "version": "2.9.44",
4
4
  "description": "Salla Theme Toolkit, Webcomponents, Events, Requests, Utils",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -31,8 +31,8 @@
31
31
  ],
32
32
  "homepage": "https://salla.dev",
33
33
  "dependencies": {
34
- "@salla.sa/base": "^2.9.43",
35
- "@salla.sa/twilight-tailwind-theme": "^2.9.39",
34
+ "@salla.sa/base": "^2.9.44",
35
+ "@salla.sa/twilight-tailwind-theme": "^2.9.44",
36
36
  "axios": "^0.27.2",
37
37
  "infinite-scroll": "^4.0.1",
38
38
  "jwt-decode": "^3.1.2",
@@ -61,5 +61,5 @@
61
61
  "peerDependencies": {
62
62
  "webpack": "^4 || ^5"
63
63
  },
64
- "gitHead": "ce9b39835aa79fa932cdd4e816fabba0fbd5900b"
64
+ "gitHead": "fddddf788da74800f95e2c94faaa46f158f7e399"
65
65
  }
@@ -1,8 +1,8 @@
1
1
  export * from "./request";
2
2
  export * from "./response";
3
- import {SuccessResponse} from "../../common";
4
- import {CartResponse} from "./response";
5
- import {CartRequest} from "./request";
3
+ import { SuccessResponse } from "../../common";
4
+ import { CartResponse } from "./response";
5
+ import { CartRequest } from "./request";
6
6
 
7
7
  export default interface CartApi {
8
8
  latest: () => Promise<CartResponse.update>;
@@ -18,6 +18,9 @@ export default interface CartApi {
18
18
 
19
19
  getUploadImageEndpoint: (cartId?: number) => string;
20
20
 
21
+ getQuickCheckoutSettings: () => Promise<CartResponse.checkoutSetting>;
22
+ createQuickCheckout: (payload: CartRequest.quickCheckoutPayload) => void;
23
+
21
24
  //coupons
22
25
  addCoupon: (coupon: string) => Promise<CartResponse.update>;
23
26
  deleteCoupon: () => Promise<CartResponse.update>;
@@ -5,4 +5,14 @@ export namespace CartRequest {
5
5
  notes?: string;
6
6
  file?: BinaryType | string;
7
7
  }
8
+
9
+ export interface quickCheckoutPayload {
10
+ email: string;
11
+ phone: string;
12
+ country_code: string;
13
+ name: string;
14
+ product_ids: string[];
15
+ agreement: boolean;
16
+ }
17
+
8
18
  }
@@ -13,6 +13,10 @@ export namespace CartResponse {
13
13
  };
14
14
  }
15
15
  }
16
+
17
+ export interface checkoutSetting extends SuccessResponse {
18
+ data: CheckoutSetting
19
+ }
16
20
  }
17
21
 
18
22
 
@@ -63,4 +67,17 @@ export interface CartSummary {
63
67
  export interface OfferSummary {
64
68
  id: number;
65
69
  product_id: number;
70
+ }
71
+
72
+ export interface CheckoutSetting {
73
+ title: string;
74
+ sub_title: string;
75
+ thanks_message: string;
76
+ order_now_button: string;
77
+ is_email_required: number;
78
+ show_agreement: boolean;
79
+ allowed_countries: string[];
80
+ style: 'default'|'white'|'gray';
81
+ confirm_button: string;
82
+ agreement: string;
66
83
  }
@@ -46,6 +46,8 @@ export type ApiActionName =
46
46
  | 'cart.status'
47
47
  | 'cart.addCoupon'
48
48
  | 'cart.deleteCoupon'
49
+ | 'cart.quickCheckout'
50
+ | 'cart.createQuickCheckout'
49
51
  | 'loyalty.exchange'
50
52
  | 'loyalty.getProgram'
51
53
  | 'loyalty.reset'
@@ -1,5 +1,5 @@
1
- import {CartResponse, CartSummary} from "../api/cart";
2
- import { RequestError, SuccessResponse} from "../common";
1
+ import { CartResponse, CartSummary } from "../api/cart";
2
+ import { ErrorResponse, RequestError, SuccessResponse } from "../common";
3
3
 
4
4
  export default interface CartEvent {
5
5
  // listeners
@@ -27,4 +27,11 @@ export default interface CartEvent {
27
27
  onCouponDeleted: (callback: (response: CartResponse.update, cart_id: number) => void) => void;
28
28
  onCouponAdditionFailed: (callback: (error: RequestError, cart_id?: number) => void) => void;
29
29
  onCouponDeletionFailed: (callback: (error: RequestError, cart_id?: number) => void) => void;
30
+
31
+ // Checkout
32
+ onQuickCheckoutSettingFetched: (callback: (response: CartResponse.checkoutSetting) => void) => void;
33
+ onQuickCheckoutSettingFailed: (callback: (error: ErrorResponse) => void) => void;
34
+
35
+ onQuickCheckoutSucceeded: (callback: () => void) => void;
36
+ onQuickCheckoutFailed: (callback: (error: RequestError) => void) => void;
30
37
  }