@salla.sa/twilight 2.5.0 → 2.5.2

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.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "Salla Theme Toolkit, Webcomponents, Events, Requests, Utils",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -50,6 +50,8 @@ export type ApiActionName =
50
50
  | 'cart.deleteCoupon'
51
51
  | 'gift.buy'
52
52
  | 'loyalty.exchange'
53
+ | 'loyalty.getProgram'
54
+ | 'loyalty.reset'
53
55
  | 'order.cancel'
54
56
  | 'order.reOrder'
55
57
  | 'order.send'
@@ -1,4 +1,4 @@
1
- import {SuccessResponse} from '../common'
1
+ import { SuccessResponse } from '../common'
2
2
 
3
3
 
4
4
  export interface Loyalty {
@@ -54,12 +54,12 @@ export interface Condition {
54
54
  key: string;
55
55
  points: number;
56
56
  condition: null | string;
57
- value?: 'fixed_amount'|'total_order';
57
+ value?: 'fixed_amount' | 'total_order';
58
58
  op: string;
59
59
  }
60
60
 
61
61
  export interface Prize {
62
- type: string|'free_shipping'|'free_product'|'coupon';
62
+ type: string | 'free_shipping' | 'free_product' | 'coupon';
63
63
  title: string;
64
64
  items: Item[];
65
65
  }
@@ -222,4 +222,5 @@ export namespace LoyaltyApiResponse {
222
222
  export default interface LoyaltyApi {
223
223
  getProgram: () => Promise<LoyaltyApiResponse.program>
224
224
  exchange: (prize_id: number, cart_id?: number) => Promise<LoyaltyApiResponse.point>
225
+ reset: () => Promise<SuccessResponse>
225
226
  }
@@ -56,6 +56,10 @@ export type EventName = string
56
56
  | 'gift::buying.failed'
57
57
  | 'loyalty::exchange.succeeded'
58
58
  | 'loyalty::exchange.failed'
59
+ | 'loyalty::program.fetched'
60
+ | 'loyalty::program.not.fetched'
61
+ | 'loyalty::reset.succeeded'
62
+ | 'loyalty::reset.failed'
59
63
  | 'order::canceled'
60
64
  | 'order::not.canceled'
61
65
  | 'order::re.ordered'
@@ -153,4 +157,4 @@ export default interface SallaEvent extends EventEmitter2 {
153
157
  on(event: EventName, listener: (...values: any[]) => void, options?: boolean | Object): this;
154
158
 
155
159
  once(event: EventName, listener: (...values: any[]) => void, options?: boolean | Object): this;
156
- }
160
+ }
@@ -1,4 +1,4 @@
1
- import { RequestErrorEvent } from "../common";
1
+ import { RequestErrorEvent, SuccessResponse } from "../common";
2
2
  import { LoyaltyApiResponse } from '../api/loyalty'
3
3
 
4
4
  export default interface LoyaltyEvent {
@@ -8,4 +8,7 @@ export default interface LoyaltyEvent {
8
8
  // Point
9
9
  onExchangeFetched: (callback: (response: LoyaltyApiResponse.point, prod_id: number) => void) => void;
10
10
  onExchangeFetchFailed: RequestErrorEvent;
11
+ // Reset Exchange
12
+ onResetSucceeded: (callback: (response: SuccessResponse) => void) => void;
13
+ onResetFailed: RequestErrorEvent
11
14
  }