apirocket 0.10.3 → 0.11.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.
@@ -3,7 +3,7 @@ declare class CheckoutAddress implements AddressType {
3
3
  address?: string;
4
4
  address2?: string;
5
5
  city?: string;
6
- country?: CountryType;
6
+ country?: CountryRecord;
7
7
  id: number;
8
8
  state?: StateType;
9
9
  postalCode?: string;
@@ -0,0 +1,13 @@
1
+ import type { CartService } from "./cart.service";
2
+ import type { OrderType } from "@src/types/types";
3
+ declare class AnalyticsService {
4
+ constructor();
5
+ addToCart(item: CartItem, index: number, quantity: number): void;
6
+ private cartItemToItem;
7
+ private pushEcommerceEvent;
8
+ removeFromCart(item: CartItem, quantity: number): void;
9
+ viewCart(cart: CartService): void;
10
+ purchase(order: OrderType): void;
11
+ }
12
+ export declare const analyticsService: AnalyticsService;
13
+ export {};
@@ -1,12 +1,13 @@
1
1
  import { Observable } from "rxjs";
2
2
  import type { CustomerService } from './customer.service';
3
3
  import type { CheckoutService } from "./checkout.service";
4
- import type { CartItem, CartStatus, LastOrder, OrderType } from "@src/types/types";
4
+ import type { LastOrder, OrderType } from "@src/types/types";
5
+ import type { ShippingAddress } from "@src/models/shipping-address.model";
5
6
  export declare class CartService {
6
7
  #private;
7
8
  readonly change$: Observable<CartService>;
8
9
  get count(): number;
9
- get country(): CountryType;
10
+ get country(): CountryRecord;
10
11
  get items(): Array<CartItem>;
11
12
  get lastOrder(): LastOrder;
12
13
  get numItems(): number;
@@ -17,27 +18,31 @@ export declare class CartService {
17
18
  get units(): number;
18
19
  get uuid(): string;
19
20
  constructor();
20
- clearOrder(lastOrderId: number, lastOrderHash: string): void;
21
+ private changeCart;
22
+ clear(): void;
23
+ clearOrder(lastOrderId: number, lastOrderHash: string, purchaseEvent: boolean): void;
24
+ close(): void;
21
25
  private getItems;
26
+ open(fullScreen: boolean): void;
27
+ private purchaseEvent;
22
28
  private restoreStorage;
23
29
  private saveStorage;
24
30
  setServices(customer: CustomerService, checkout: CheckoutService): void;
25
31
  subscribe(cb: (cart: CartService) => void): () => void;
26
- private changeCart;
27
32
  add(data: CartItem): void;
28
- close(): void;
29
- open(fullScreen: boolean): void;
30
33
  orderSummary(id: number, hash: string): Observable<OrderType & {
31
34
  __errors: any;
32
35
  }>;
33
36
  addFromTarget(target: HTMLElement): void;
34
37
  private setStatus;
35
- clear(): void;
36
38
  private updateCart;
37
39
  cartToOrder(checkoutService: CheckoutService, customer: CustomerService): Observable<PaymentInfo>;
38
40
  removeItem(item: CartItem): void;
39
41
  updateItem(item: CartItem, quantity: number): void;
40
42
  private addItemCart;
41
- setCountryId(countryId: number): void;
43
+ setCountryData(country: CountryRecord): void;
44
+ private updateShippingData;
45
+ private cartUpdate;
42
46
  update(): void;
47
+ updateShippingAddress(shippingAddress: ShippingAddress): Observable<any>;
43
48
  }
@@ -3,7 +3,6 @@ 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, type Discount, type Discounts } from '@src/types/checkout.type';
7
6
  import { ShippingAddress } from "@src/models/shipping-address.model";
8
7
  import { BillingAddress } from '@src/models/billing-address.model';
9
8
  export declare class CheckoutService {
@@ -21,8 +20,8 @@ export declare class CheckoutService {
21
20
  get steps(): Set<CheckoutStatus>;
22
21
  get taxAmount(): number;
23
22
  get total(): number;
24
- private getShippingAddress;
25
23
  constructor(cartService: CartService, customer: CustomerService);
24
+ private getShippingAddress;
26
25
  private saveStorage;
27
26
  setStatus(newStatus: CheckoutStatus): void;
28
27
  private restoreStorage;
@@ -14,14 +14,14 @@ export declare class EcommerceService {
14
14
  get status(): EcommerceStatus;
15
15
  constructor();
16
16
  private changeStatus;
17
+ close(): void;
17
18
  private config;
18
19
  private init;
19
20
  private initStatusChange;
20
21
  private legalLinks;
21
22
  private legalLink;
23
+ private ready;
22
24
  signIn(): void;
23
- close(): void;
24
25
  rememberPassword(): void;
25
26
  updateEvents(): void;
26
- private ready;
27
27
  }
@@ -0,0 +1,3 @@
1
+ export { analyticsService } from "@src/services/analytics.service";
2
+ export { modalService } from "@src/services/modal.service";
3
+ export { lockService } from "@src/services/lock.service";
@@ -15,5 +15,5 @@ declare class LockService {
15
15
  private destroyInstance;
16
16
  open(text: string, config?: LockConfig): LockInstance;
17
17
  }
18
- export declare const lockService: Readonly<LockService>;
18
+ export declare const lockService: LockService;
19
19
  export {};
@@ -0,0 +1,14 @@
1
+ export declare const EMPTY_PAYMENTMETHOD: PaymentMethod;
2
+ export declare const EMPTY_SHIPPINGMETHOD: {
3
+ id: number;
4
+ name: string;
5
+ taxBase: number;
6
+ taxAmount: number;
7
+ total: number;
8
+ paymentMethods: never[];
9
+ };
10
+ export declare const LAST_ORDER: {
11
+ id: number;
12
+ hash: string;
13
+ purchaseEvent: boolean;
14
+ };
@@ -1,37 +1,9 @@
1
- import type { Discounts } from "./checkout.type";
2
1
  export declare enum AccountStatus {
3
2
  PERSONAL = "personal",
4
3
  SHIPPING = "shipping",
5
4
  BILLING = "billing",
6
5
  ORDERS = "orders"
7
6
  }
8
- export type CartItem = {
9
- product: {
10
- barcode: string;
11
- category: {
12
- id: number;
13
- name: string;
14
- };
15
- description: string;
16
- id: number;
17
- image: string;
18
- name: string;
19
- noShippingCost: boolean;
20
- sku: string;
21
- stockManagement: boolean;
22
- url: string;
23
- weight: number;
24
- };
25
- itemPrice: {
26
- comparePrice: number;
27
- taxBase: number;
28
- taxAmount: number;
29
- };
30
- priceTaxBase: number;
31
- priceTaxAmount: number;
32
- quantity: number;
33
- uuid: string;
34
- };
35
7
  export type OrderItem = {
36
8
  id: number;
37
9
  priceTaxAmount: number;
@@ -80,11 +52,11 @@ export type CartType = {
80
52
  units: number;
81
53
  uuid: string;
82
54
  };
83
- export type CartStatus = 'loaded' | 'loading';
84
55
  export type CustomerType = 'B2C' | 'B2B';
85
56
  export type LastOrder = {
86
57
  id: number;
87
58
  hash: string;
59
+ purchaseEvent: boolean;
88
60
  };
89
61
  export type InputCartAddItem = {
90
62
  cartUuid: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apirocket",
3
- "version": "0.10.3",
3
+ "version": "0.11.0",
4
4
  "description": " ",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,31 +0,0 @@
1
- export declare const EMPTY_PAYMENTMETHOD: PaymentMethod;
2
- export declare const EMPTY_SHIPPINGMETHOD: {
3
- id: number;
4
- name: string;
5
- taxBase: number;
6
- taxAmount: number;
7
- total: number;
8
- paymentMethods: never[];
9
- };
10
- export declare enum CheckoutStatus {
11
- INFO = "info",
12
- SHIPPING = "shipping",
13
- PAYMENT = "payment"
14
- }
15
- export type Discount = {
16
- id: number;
17
- code: string;
18
- percentaje: number;
19
- };
20
- export type Discounts = {
21
- taxBase: number;
22
- taxAmount: number;
23
- total: number;
24
- codes: Array<Discount>;
25
- };
26
- export type DiscountsMap = {
27
- taxBase: number;
28
- taxAmount: number;
29
- total: number;
30
- codes: Map<number, Discount>;
31
- };