apirocket 0.17.17 → 0.18.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.
@@ -1,6 +1,4 @@
1
1
  import { Observable } from 'rxjs';
2
- import { AjaxResponse } from 'rxjs/ajax';
3
- import type { CustomerService } from '@src/services/customer.service';
4
2
  import type { SalesService } from '@src/services/sales.service';
5
3
  export type QueryErrors = {
6
4
  __errors?: Array<string>;
@@ -12,22 +10,7 @@ export type QueryOptions = {
12
10
  debug?: boolean;
13
11
  retry?: number;
14
12
  };
15
- export { getApi, getEcommerce, getSales, post, post2, postEcommerce, postSales, query };
16
- declare const getEcommerce: <T>(url: string, inputData: any, customer: CustomerService | undefined) => Observable<{
17
- __errors: any;
18
- status: number;
19
- } & T>;
20
- declare const postEcommerce: <T>(url: string, inputData: any, customer?: CustomerService) => Observable<{
21
- __errors: any;
22
- status: number;
23
- } & T>;
24
- declare const post: <T>(url: string, data: any, token: string | undefined) => Observable<{
25
- __errors: any;
26
- status: number;
27
- } & T>;
28
- declare const query: <T>(query: string, variables: QueryVariables, customer?: CustomerService) => Observable<T>;
29
- declare const getApi: (url: string, data: any, customer: CustomerService | undefined) => Observable<AjaxResponse<any>>;
30
- declare const post2: <T>(url: string, data: any, customer?: CustomerService) => Observable<any>;
13
+ export { getSales, postSales };
31
14
  declare const getSales: <T>(url: string, { search, page }: CustomersFilter, sales: SalesService | undefined) => Observable<{
32
15
  __errors: any;
33
16
  status: number;
@@ -7,16 +7,16 @@ import { ShippingAddress } from "@src/models/addresses-models";
7
7
  export declare class AccountService {
8
8
  #private;
9
9
  readonly status$: Observable<AccountStatus>;
10
- get account$(): Observable<CustomerAccount>;
11
- get orders$(): Observable<CustomerOrders>;
10
+ get account(): Promise<CustomerAccount>;
11
+ get orders(): Promise<CustomerOrders>;
12
12
  constructor();
13
- private accountData;
14
- private getOrders$;
13
+ private getAccount;
14
+ private getOrders;
15
+ private invalidateOrders;
15
16
  private ordersData;
16
- ordersSearch(filter: OrdersFilter): Observable<CustomerOrders>;
17
+ ordersSearch(filter: OrdersFilter): Promise<CustomerOrders>;
17
18
  private otherBillingAddress;
18
19
  private otherShippingAddress;
19
- private setAccountData;
20
20
  setServices(customer: CustomerService, checkout: CheckoutService): void;
21
21
  private setOrdersData;
22
22
  passwordForm(formElement: HTMLFormElement, canChange: (canChange: boolean) => void): FormControl;
@@ -28,4 +28,5 @@ export declare class AccountService {
28
28
  reset(): void;
29
29
  pdfOrder(orderId: number): Promise<boolean>;
30
30
  showOrder(ecommerceService: EcommerceService, order: Order): void;
31
+ private accountData;
31
32
  }
@@ -0,0 +1,21 @@
1
+ import type { CustomerService } from '@src/services/customer.service';
2
+ export { countries, geolocation, getCountry, getEcommerce, getPayment, postAuth, postEcommerce, rememberPassword, resetPassword, states };
3
+ declare const countries: (customer: CustomerService) => Promise<Array<Country>>;
4
+ declare const geolocation: () => Promise<any>;
5
+ declare const getCountry: (countryIso: string) => Promise<Country>;
6
+ declare const getEcommerce: <T>(url: string, inputData: any, customer: CustomerService | undefined) => Promise<{
7
+ __errors: any;
8
+ } & T>;
9
+ declare const getPayment: <T>(url: string, inputData: any, customer?: CustomerService) => Promise<{
10
+ __errors: any;
11
+ } & T>;
12
+ declare const postAuth: <T>(url: string, inputData: any) => Promise<{
13
+ __errors: any;
14
+ status: number;
15
+ } & T>;
16
+ declare const postEcommerce: <T>(url: string, inputData: any, customer?: CustomerService) => Promise<{
17
+ __errors: any;
18
+ } & T>;
19
+ declare const rememberPassword: (email: string, sales: boolean) => Promise<number>;
20
+ declare const resetPassword: (hash: string, email: string, password: string, sales: boolean) => Promise<LoginData>;
21
+ declare const states: (countryId: number, customer: CustomerService) => Promise<Array<State>>;
@@ -21,12 +21,10 @@ export declare class CartService {
21
21
  constructor();
22
22
  cartWeight(): number;
23
23
  private changeCart;
24
- discountCode(code: string): Observable<Cart & {
25
- __errors: any;
26
- }>;
27
- discountCodeRemove(discountId: number): Observable<Cart & {
24
+ discountCode(code: string): Promise<Cart & {
28
25
  __errors: any;
29
26
  }>;
27
+ discountCodeRemove(discountId: number): Promise<void>;
30
28
  private getDiscounts;
31
29
  private restoreStorage;
32
30
  private saveStorage;
@@ -39,19 +37,19 @@ export declare class CartService {
39
37
  private purchaseEvent;
40
38
  setServices(customer: CustomerService): void;
41
39
  add(data: CartAddItem): void;
42
- orderSummary(id: number, hash: string): Observable<Order & {
40
+ orderSummary(id: number, hash: string): Promise<Order & {
43
41
  __errors: any;
44
42
  }>;
45
43
  addFromTarget(target: HTMLElement): void;
46
44
  private setStatus;
47
- cartToOrder(checkoutService: CheckoutService, customer: CustomerService): Observable<PaymentInfo>;
45
+ cartToOrder(checkoutService: CheckoutService, customer: CustomerService): Promise<PaymentInfo | null>;
48
46
  removeItem(item: CartItem): void;
49
47
  private addItemCart;
50
48
  setCountryData(country: Country): void;
51
49
  private updateShippingData;
52
50
  private cartUpdate;
53
51
  update(): void;
54
- updateShippingAddress(shippingAddress: ShippingAddress): Observable<void>;
52
+ updateShippingAddress(shippingAddress: ShippingAddress): Promise<void>;
55
53
  updateItem(item: CartItem, quantity: number): void;
56
54
  orderToCart(orderId: number, orderHash: string): void;
57
55
  }
@@ -23,17 +23,16 @@ export declare class CheckoutService {
23
23
  get envioUrgente(): boolean;
24
24
  get envioParcial(): boolean;
25
25
  constructor(cartService: CartService, customer: CustomerService, account: AccountService);
26
- aplazameSettings(methodId: number): Observable<AplazameSettings>;
26
+ aplazameSettings(methodId: number): Promise<AplazameSettings>;
27
27
  private getShippingAddress;
28
28
  paymentForm(formElement: HTMLFormElement, paymentMethods: Array<PaymentMethodOption>, editAddress: boolean): Observable<{
29
29
  form: FormControl;
30
30
  addresses: Array<BillingAddress>;
31
31
  }>;
32
32
  paymentSet(form: FormControl, payments: Array<PaymentMethodOption>): Observable<any>;
33
- paypalSettings(methodId: number): Observable<PaypalSettings>;
33
+ paypalSettings(methodId: number): Promise<PaypalSettings>;
34
34
  private restoreStorage;
35
35
  setStatus(newStatus: CheckoutStatus): void;
36
- stripeSettings(methodId: number): Observable<StripeSettings>;
37
36
  formSignIn(form: HTMLFormElement): FormControl;
38
37
  signInSubmit(_form: FormControl): void;
39
38
  close(): void;
@@ -41,12 +40,10 @@ export declare class CheckoutService {
41
40
  shippingMethodForm(formElement: HTMLFormElement, shippingMethods: Array<ShippingMethod>): FormControl;
42
41
  shippingMethodSet(form: FormControl, methods: Array<ShippingMethod>, cartService: CartService, gotoPayment: boolean): void;
43
42
  changeShippingMethod(cartService: CartService, methods: Array<ShippingMethod>, shippingMethodId: number): void;
44
- stripePayment(orderId: number, hash: string): Observable<any>;
45
- stripePaymentConfirm(orderId: number, paymentId: string): Observable<PaymentInfo>;
43
+ stripePayment(orderId: number, hash: string): Promise<any>;
46
44
  clearOrder(): void;
47
- paypalApprobe(data: any): Observable<void>;
48
45
  updateTotal(cartService: CartService, changeNotification: boolean): void;
49
- shippingMethods(): Observable<Array<ShippingMethod> | false>;
46
+ shippingMethods(): Promise<Array<ShippingMethod> | false>;
50
47
  shippingAddressForm(formElement: HTMLFormElement, editAddress: boolean, settings: CheckoutSettings): Observable<{
51
48
  form: FormControl;
52
49
  addresses: Array<ShippingAddress>;
@@ -54,4 +51,5 @@ export declare class CheckoutService {
54
51
  shippingAddressSet(form: FormControl): void;
55
52
  updateState(saveState: boolean, checkoutString: string): void;
56
53
  private saveStorage;
54
+ stripeSettings(methodId: number): Promise<StripeSettings>;
57
55
  }
@@ -24,6 +24,9 @@ type CustomerData = {
24
24
  type: CustomerType;
25
25
  contact?: ContactData;
26
26
  };
27
+ type State = {
28
+ customer: CustomerData;
29
+ };
27
30
  export declare class CustomerService implements Authentication {
28
31
  #private;
29
32
  readonly change$: Observable<CustomerService>;
@@ -38,18 +41,16 @@ export declare class CustomerService implements Authentication {
38
41
  get id(): number;
39
42
  get lastName(): string;
40
43
  get phone(): string;
41
- get refreshToken(): string;
42
- get token(): string;
43
44
  get type(): CustomerType;
44
45
  get isB2B(): boolean;
45
46
  get isContact(): boolean;
46
47
  get isLogged(): boolean;
47
48
  constructor();
48
49
  private changeCustomer;
49
- createBillingAddress(input: Omit<BillingAddress, 'id'>): Promise<unknown>;
50
- createShippingAddress(input: Omit<ShippingAddress, 'id'>): Promise<unknown>;
51
- deleteBillingAddress(id: number): Promise<unknown>;
52
- deleteShippingAddress(id: number): Promise<unknown>;
50
+ createBillingAddress(input: Omit<BillingAddress, 'id'>): Promise<any>;
51
+ createShippingAddress(input: Omit<ShippingAddress, 'id'>): Promise<any>;
52
+ deleteBillingAddress(id: number): Promise<any>;
53
+ deleteShippingAddress(id: number): Promise<any>;
53
54
  myAccount(): Promise<CustomerAccount>;
54
55
  orders(filter?: Partial<OrdersFilter>): Promise<CustomerOrders>;
55
56
  rememberPassword(email: string): Promise<number>;
@@ -64,9 +65,9 @@ export declare class CustomerService implements Authentication {
64
65
  phone?: string;
65
66
  }): void;
66
67
  setServices(cart: CartService, account: AccountService, checkout: CheckoutService): void;
67
- updateBillingAddress(input: BillingAddress): Promise<unknown>;
68
+ updateBillingAddress(input: BillingAddress): Promise<any>;
68
69
  updateMyAccount(data: InputUpdateAccount): Promise<boolean>;
69
- updateShippingAddress(input: ShippingAddress): Promise<unknown>;
70
+ updateShippingAddress(input: ShippingAddress): Promise<any>;
70
71
  logout(): Promise<{
71
72
  status: number;
72
73
  }>;
@@ -81,7 +82,7 @@ export declare class CustomerService implements Authentication {
81
82
  updateState(data: LoginData, emitUpdated: boolean): void;
82
83
  order(id: number): Promise<Order>;
83
84
  updatePassword(oldPassword: string, newPassword: string): Promise<boolean>;
84
- updateAddressData(endPoint: string, input: any): Promise<unknown>;
85
+ updateAddressData(endPoint: string, input: any): Promise<any>;
85
86
  }
86
87
  export declare function customerProxy(customer: CustomerService): {
87
88
  acceptEmailMarketing: boolean;
@@ -92,11 +93,11 @@ export declare function customerProxy(customer: CustomerService): {
92
93
  phone: string;
93
94
  type: CustomerType;
94
95
  isLogged: boolean;
95
- countries: () => Promise<Country[]>;
96
- createBillingAddress: (input: Omit<BillingAddress, "id">) => Promise<unknown>;
97
- createShippingAddress: (input: Omit<ShippingAddress, "id">) => Promise<unknown>;
98
- deleteShippingAddress: (id: number) => Promise<unknown>;
99
- deleteBillingAddress: (id: number) => Promise<unknown>;
96
+ countries: () => Promise<Array<Country>>;
97
+ createBillingAddress: (input: Omit<BillingAddress, "id">) => Promise<any>;
98
+ createShippingAddress: (input: Omit<ShippingAddress, "id">) => Promise<any>;
99
+ deleteShippingAddress: (id: number) => Promise<any>;
100
+ deleteBillingAddress: (id: number) => Promise<any>;
100
101
  login: (email: string, password: string) => Promise<{
101
102
  status: number;
102
103
  token?: string;
@@ -109,11 +110,11 @@ export declare function customerProxy(customer: CustomerService): {
109
110
  order: (id: number) => Promise<Order>;
110
111
  orders: (filter?: Partial<OrdersFilter>) => Promise<CustomerOrders>;
111
112
  price: (productId: number) => Promise<any>;
112
- states: (countryId: number) => Promise<globalThis.State[]>;
113
+ states: (countryId: number) => Promise<Array<State>>;
113
114
  subscribe: (cb: (customer: CustomerService) => void) => () => void;
114
115
  updateMyAccount: (input: InputUpdateAccount) => Promise<boolean>;
115
116
  updatePassword: (oldPassword: string, newPassword: string) => Promise<boolean>;
116
- updateBillingAddress: (input: BillingAddress) => Promise<unknown>;
117
- updateShippingAddress: (input: ShippingAddress) => Promise<unknown>;
117
+ updateBillingAddress: (input: BillingAddress) => Promise<any>;
118
+ updateShippingAddress: (input: ShippingAddress) => Promise<any>;
118
119
  };
119
120
  export {};
@@ -0,0 +1 @@
1
+ export declare const VERSION = "0.18.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apirocket",
3
- "version": "0.17.17",
3
+ "version": "0.18.0",
4
4
  "description": " ",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,10 @@
8
8
  "scripts": {
9
9
  "prepublish": "rm -Rf dist && npm run build && npm run check",
10
10
  "publish": "npm publish",
11
+ "version:gen": "node scripts/gen-version.js",
12
+ "prebuild": "npm run version:gen",
11
13
  "build": "rollup -c",
14
+ "predev": "npm run version:gen",
12
15
  "dev": "rollup -c -w",
13
16
  "start": "sirv dev --host --port 5050 --no-clear",
14
17
  "check": "svelte-check --tsconfig ./tsconfig.json"
package/dist/lib/api.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import type { CustomerService } from '@src/services/customer.service';
3
- export { countries, geolocation, getCountry, rememberPassword, resetPassword, states };
4
- declare const countries: (customer: CustomerService) => Promise<Array<Country>>;
5
- declare const getCountry: (countryIso: string) => Promise<Country>;
6
- declare const states: (countryId: number, customer: CustomerService) => Promise<Array<State>>;
7
- declare const geolocation: () => Observable<any>;
8
- declare const rememberPassword: (email: string, sales: boolean) => Promise<number>;
9
- declare const resetPassword: (hash: string, email: string, password: string, sales: boolean) => Promise<LoginData>;