apirocket 0.7.4 → 0.8.0

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/lib/api.d.ts CHANGED
@@ -1,16 +1,14 @@
1
- import type { CartType, InputCartAddItem, InputCartRemoveItem, InputCartToOrderType, InputCartUpdate, InputCartUpdateItem, OrderType } from '@src/types/types';
1
+ import type { CartType, InputCartRemoveItem, InputCartUpdate, InputCartUpdateItem, OrderType } from '@src/types/types';
2
2
  import type { CustomerService } from '@src/services/customer.service';
3
3
  import { Observable } from 'rxjs';
4
4
  declare const ID_ESPANA = 199;
5
- declare const cartToOrder: (input: InputCartToOrderType, customer: CustomerService) => Observable<OrderType>;
5
+ export { cartRemoveItem, cartUpdate, cartUpdateItem, countries, myAccount, orderSummary, paymentMethods, paymentInfo, provinces, shippingMethods, ID_ESPANA };
6
6
  declare const paymentInfo: (id: number, hash: string) => Observable<PaymentInfoType>;
7
- declare const cartAddItem: (input: InputCartAddItem, customer: CustomerService) => Observable<CartType>;
8
7
  declare const cartRemoveItem: (input: InputCartRemoveItem, customer: CustomerService) => Observable<CartType>;
9
8
  declare const cartUpdate: (input: InputCartUpdate, customer: CustomerService) => Observable<CartType>;
10
9
  declare const cartUpdateItem: (input: InputCartUpdateItem, customer: CustomerService) => Observable<CartType>;
11
10
  declare const countries: (customer: CustomerService) => Observable<Array<CountryType>>;
12
11
  declare const provinces: (country: number, customer: CustomerService) => Observable<Array<ProvinceType>>;
13
- export { cartAddItem, cartRemoveItem, cartToOrder, cartUpdate, cartUpdateItem, countries, myAccount, orderSummary, paymentMethods, paymentInfo, provinces, shippingMethods, ID_ESPANA };
14
12
  declare const orderSummary: (id: number, hash: string, customer: CustomerService) => Observable<OrderType>;
15
13
  declare const shippingMethods: (customer: CustomerService) => Observable<Array<ShippingMethodType>>;
16
14
  declare const paymentMethods: (customer: CustomerService) => Observable<Array<PaymentMethodOption>>;
@@ -17,3 +17,4 @@ export declare const post: <T>(url: string, data: any, customer?: CustomerServic
17
17
  } & T>;
18
18
  export declare const get: (url: string, data: any, customer: CustomerService | undefined) => Observable<AjaxResponse<any>>;
19
19
  export declare const query: <T>(query: string, variables: QueryVariables, customer?: CustomerService) => Observable<T>;
20
+ export declare const postEcommerce: <T>(url: string, data: any, customer?: CustomerService) => Observable<T>;
@@ -3,7 +3,7 @@ import type { FormControl } from "@e-xisto/form-control";
3
3
  import type { CartService } from '@src/services/cart.service';
4
4
  import type { AccountService } from './account.service';
5
5
  import type { CustomerService } from './customer.service';
6
- import { CheckoutStatus } from '@src/types/checkout.type';
6
+ import { CheckoutStatus, type Discount, type Discounts } from '@src/types/checkout.type';
7
7
  import { ShippingAddress } from "@src/models/shipping-address.model";
8
8
  import { BillingAddress } from '@src/models/billing-address.model';
9
9
  export declare class CheckoutService {
@@ -11,6 +11,7 @@ export declare class CheckoutService {
11
11
  readonly change$: Observable<CheckoutService>;
12
12
  get billingAddress(): BillingAddress;
13
13
  get customerOrder(): string;
14
+ get discounts(): Discounts;
14
15
  get notes(): string;
15
16
  get paymentAddress(): boolean;
16
17
  get paymentMethod(): PaymentMethod;
@@ -36,8 +37,8 @@ export declare class CheckoutService {
36
37
  paymentForm(formElement: HTMLFormElement, paymentMethods: Array<PaymentMethodOption>): FormControl;
37
38
  shippingMethodForm(formElement: HTMLFormElement, shippingMethods: Array<ShippingMethodType>): FormControl;
38
39
  shippingMethodSet(form: FormControl, methods: Array<ShippingMethodType>, cartService: CartService, gotoPayment: boolean): void;
40
+ changeShippingMethod(cartService: CartService, methods: Array<ShippingMethodType>, shippingMethodId: number): void;
39
41
  shippingMethods(): Observable<Array<ShippingMethodType>>;
40
- updateTotal(cartService: CartService): void;
41
42
  resetPassword(form: FormControl): void;
42
43
  private otherShippingAddress;
43
44
  stripeSettings(methodId: number): Observable<StripeSettings>;
@@ -49,4 +50,9 @@ export declare class CheckoutService {
49
50
  clearOrder(): void;
50
51
  paypalSettings(methodId: number): Observable<PaypalSettings>;
51
52
  paypalApprobe(data: any): Observable<any>;
53
+ private updateDiscounts;
54
+ updateTotal(cartService: CartService, changeNotification: boolean): void;
55
+ discountCode(cartService: CartService, code: string): Observable<Discount>;
56
+ removeDiscountCode(cartService: CartService, code: Discount): void;
57
+ private getDiscounts;
52
58
  }
@@ -0,0 +1,19 @@
1
+ import LockComponent from '../components/shared/lock-screen.component.svelte';
2
+ export interface LockInstance {
3
+ afterClosed?: () => void;
4
+ index: number;
5
+ lock: LockComponent;
6
+ }
7
+ export interface LockConfig {
8
+ afterClosed?: () => void;
9
+ }
10
+ declare class LockService {
11
+ #private;
12
+ constructor();
13
+ close(instance?: LockInstance): void;
14
+ private closeInstance;
15
+ private destroyInstance;
16
+ open(text: string, config?: LockConfig): LockInstance;
17
+ }
18
+ export declare const lockService: Readonly<LockService>;
19
+ export {};
@@ -3,3 +3,20 @@ export declare enum CheckoutStatus {
3
3
  SHIPPING = "shipping",
4
4
  PAYMENT = "payment"
5
5
  }
6
+ export type Discount = {
7
+ id: number;
8
+ code: string;
9
+ percentaje: number;
10
+ };
11
+ export type Discounts = {
12
+ taxBase: number;
13
+ taxAmount: number;
14
+ total: number;
15
+ codes: Array<Discount>;
16
+ };
17
+ export type DiscountsMap = {
18
+ taxBase: number;
19
+ taxAmount: number;
20
+ total: number;
21
+ codes: Map<number, Discount>;
22
+ };
@@ -1,3 +1,4 @@
1
+ import type { Discounts } from "./checkout.type";
1
2
  export type CartItem = {
2
3
  product: {
3
4
  barcode: string;
@@ -49,11 +50,12 @@ export type OrderProduct = {
49
50
  url?: string;
50
51
  weight: number;
51
52
  };
52
- export interface InputCartToOrderType {
53
+ export interface InputCartToOrder {
53
54
  billingAddress?: BillingAddressType;
54
55
  cartUuid: string;
55
56
  customer: OrderCustomer;
56
57
  customerOrder: string;
58
+ discounts: Discounts;
57
59
  notes: string;
58
60
  numItems: number;
59
61
  paymentMethod: OrderPaymentMethodType;
@@ -116,6 +118,7 @@ export interface OrderType {
116
118
  customer: OrderCustomer;
117
119
  customerOrder: string;
118
120
  date: Date;
121
+ discounts: Discounts;
119
122
  hash: string;
120
123
  id: number;
121
124
  items: Array<OrderItem>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apirocket",
3
- "version": "0.7.4",
3
+ "version": "0.8.0",
4
4
  "description": " ",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",