@esolve/ng-esolve-connect 0.10.2 → 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.
Files changed (50) hide show
  1. package/esm2020/lib/account/esolve-account.service.mjs +52 -61
  2. package/esm2020/lib/auth/esolve-auth-interceptor.service.mjs +7 -6
  3. package/esm2020/lib/auth/esolve-auth.service.mjs +36 -37
  4. package/esm2020/lib/banners/esolve-banner.service.mjs +9 -10
  5. package/esm2020/lib/cart/esolve-cart.service.mjs +30 -31
  6. package/esm2020/lib/category-tree/esolve-category-tree.service.mjs +20 -15
  7. package/esm2020/lib/locations/esolve-locations.service.mjs +10 -9
  8. package/esm2020/lib/media/esolve-heading-record.mjs +2 -0
  9. package/esm2020/lib/media/esolve-heading.mjs +7 -0
  10. package/esm2020/lib/media/esolve-media.service.mjs +58 -23
  11. package/esm2020/lib/menu/esolve-menu.service.mjs +8 -10
  12. package/esm2020/lib/news/esolve-news.service.mjs +14 -18
  13. package/esm2020/lib/ng-esolve-connect.module.mjs +4 -4
  14. package/esm2020/lib/payment/esolve-payment.service.mjs +65 -76
  15. package/esm2020/lib/session/esolve-session.mjs +8 -11
  16. package/esm2020/lib/session/esolve-session.service.mjs +42 -30
  17. package/esm2020/lib/session/esolve-stored-session.mjs +1 -1
  18. package/esm2020/lib/shared/cookie/esolve-cookie.service.mjs +106 -0
  19. package/esm2020/lib/shared/error-handler/esolve-error-handler.service.mjs +3 -3
  20. package/esm2020/lib/shared/response-handler/esolve-response-handler.service.mjs +3 -3
  21. package/esm2020/lib/shared/seo/esolve-seo.service.mjs +4 -4
  22. package/esm2020/lib/shipping/esolve-shipping.service.mjs +39 -39
  23. package/esm2020/lib/stock/esolve-stock-item.mjs +6 -1
  24. package/esm2020/lib/stock/esolve-stock-record.mjs +1 -1
  25. package/esm2020/lib/stock/esolve-stock.service.mjs +38 -39
  26. package/esm2020/lib/topics/esolve-topic.service.mjs +6 -10
  27. package/esm2020/public-api.mjs +3 -1
  28. package/fesm2015/esolve-ng-esolve-connect.mjs +570 -436
  29. package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
  30. package/fesm2020/esolve-ng-esolve-connect.mjs +566 -436
  31. package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
  32. package/lib/auth/esolve-auth.service.d.ts +2 -2
  33. package/lib/cart/esolve-cart.service.d.ts +8 -1
  34. package/lib/category-tree/esolve-category-tree.service.d.ts +4 -1
  35. package/lib/locations/esolve-locations.service.d.ts +2 -0
  36. package/lib/media/esolve-heading-record.d.ts +5 -0
  37. package/lib/media/esolve-heading.d.ts +5 -0
  38. package/lib/media/esolve-media.service.d.ts +25 -4
  39. package/lib/news/esolve-news.service.d.ts +1 -1
  40. package/lib/payment/esolve-payment.service.d.ts +16 -14
  41. package/lib/session/esolve-session.d.ts +3 -4
  42. package/lib/session/esolve-session.service.d.ts +7 -3
  43. package/lib/session/esolve-stored-session.d.ts +2 -2
  44. package/lib/shared/cookie/esolve-cookie.service.d.ts +36 -0
  45. package/lib/shipping/esolve-shipping.service.d.ts +11 -11
  46. package/lib/stock/esolve-stock-item.d.ts +8 -0
  47. package/lib/stock/esolve-stock-record.d.ts +1 -0
  48. package/lib/stock/esolve-stock.service.d.ts +10 -10
  49. package/package.json +5 -4
  50. package/public-api.d.ts +2 -0
@@ -1,9 +1,9 @@
1
1
  import { HttpClient } from '@angular/common/http';
2
2
  import { Observable } from 'rxjs';
3
- import { CookieService } from 'ngx-cookie-service';
4
3
  import { EsolveConnectConfig } from '../esolve-connect.config';
5
4
  import { EsolveSessionService } from '../session/esolve-session.service';
6
5
  import { EsolveErrorHandlerService } from '../shared/error-handler/esolve-error-handler.service';
6
+ import { EsolveCookieService } from '../shared/cookie/esolve-cookie.service';
7
7
  import * as i0 from "@angular/core";
8
8
  interface EsolveAuthResponseData {
9
9
  service_type: string;
@@ -23,7 +23,7 @@ export declare class EsolveAuthService {
23
23
  private session;
24
24
  private errorHandler;
25
25
  private cookieService;
26
- constructor(config: EsolveConnectConfig, http: HttpClient, session: EsolveSessionService, errorHandler: EsolveErrorHandlerService, cookieService: CookieService);
26
+ constructor(config: EsolveConnectConfig, http: HttpClient, session: EsolveSessionService, errorHandler: EsolveErrorHandlerService, cookieService: EsolveCookieService);
27
27
  getAccessToken(email: string, password: string, anonymous?: boolean): Observable<EsolveAuthResponseData>;
28
28
  autoLogin(): void;
29
29
  login(email: string, password: string): Observable<number>;
@@ -17,11 +17,13 @@ export declare class EsolveCartService {
17
17
  constructor(config: EsolveConnectConfig, http: HttpClient, errorHandler: EsolveErrorHandlerService, responseHandler: EsolveResponseHandlerService);
18
18
  /**
19
19
  * Retrieves the current cart
20
+ *
20
21
  * @returns An `Observable` with an array of cart items
21
22
  */
22
23
  getCart(): Observable<EsolveCart>;
23
24
  /**
24
25
  * Updates the cart by preforming various actions, such as adding, editing or removing items from the cart.
26
+ *
25
27
  * @param items An array of options to update the cart
26
28
  * @param action The default action to preform
27
29
  * @returns An `Observable` with an array of responses that gives feedback on the requested changes
@@ -29,16 +31,19 @@ export declare class EsolveCartService {
29
31
  setCart(items: EsolveCartSetItem[], action?: EsolveCartSetAction): Observable<EsolveCartItemResponse[]>;
30
32
  /**
31
33
  * Retrieves the totals of the cart with all the totals calculated
34
+ *
32
35
  * @returns An `Observable` with an object containing cart totals
33
36
  */
34
37
  getTotals(): Observable<EsolveCartTotals>;
35
38
  /**
36
39
  * Retrieves a tracking code for the cart
40
+ *
37
41
  * @returns An `Observable` with the cart tracking code
38
42
  */
39
43
  getTrackingCode(): Observable<number>;
40
44
  /**
41
45
  * Initiates checkout of the cart items
46
+ *
42
47
  * @param type The cart type that needs to be checked out
43
48
  * @param addresses_id The ID of the delivery address
44
49
  * @param shipping_id The ID of the shipping method
@@ -49,13 +54,15 @@ export declare class EsolveCartService {
49
54
  */
50
55
  checkout(type: 'order' | 'quote', addresses_id: number, shipping_id: number, payment_method_id?: number, location_id?: number, comments?: string): Observable<EsolveCheckoutResult>;
51
56
  /**
52
- * Processes the eSolve tree records.
57
+ * Processes the eSolve tree records
58
+ *
53
59
  * @param cart_item_records Records to process
54
60
  * @returns An array of processed cart items
55
61
  */
56
62
  private processCart;
57
63
  /**
58
64
  * Processes the eSolve cart totals
65
+ *
59
66
  * @param record Data to process
60
67
  * @returns Processed cart totals
61
68
  */
@@ -13,12 +13,15 @@ export declare class EsolveCategoryTreeService {
13
13
  */
14
14
  getCategoryTree(): Observable<EsolveCategoryTreeItem[]>;
15
15
  /**
16
- * Retrieve the details of a category tree item from the eSolve instance and converts it to the correct format.
16
+ * Retrieve the details of a category tree item from the eSolve instance and
17
+ * converts it to the correct format.
18
+ *
17
19
  * @param options Filter options
18
20
  */
19
21
  getCategoryTreeItem(options: EsolveCategoryTreeItemOptions): Observable<EsolveCategoryTreeItem>;
20
22
  /**
21
23
  * Processes the eSolve tree records and converts them into the correct format.
24
+ *
22
25
  * @param tree_records Records to process
23
26
  */
24
27
  private processTree;
@@ -9,11 +9,13 @@ export declare class EsolveLocationsService {
9
9
  constructor(config: EsolveConnectConfig, http: HttpClient);
10
10
  /**
11
11
  * Retrieves a list of stock locations
12
+ *
12
13
  * @returns An `Observable` with an array of stock locations
13
14
  */
14
15
  getStockLocations(): Observable<EsolveStockLocation[]>;
15
16
  /**
16
17
  * Processes the eSolve stock location records.
18
+ *
17
19
  * @param records Records to process
18
20
  * @returns An array of processed stock location records
19
21
  */
@@ -0,0 +1,5 @@
1
+ export interface EsolveHeadingRecord {
2
+ id: number;
3
+ identifier: string;
4
+ value: string;
5
+ }
@@ -0,0 +1,5 @@
1
+ export declare class EsolveHeading {
2
+ identifier: string;
3
+ value: string;
4
+ constructor(identifier: string, value: string);
5
+ }
@@ -2,25 +2,46 @@ import { HttpClient } from '@angular/common/http';
2
2
  import { Observable } from 'rxjs';
3
3
  import { EsolveConnectConfig } from '../esolve-connect.config';
4
4
  import { EsolveMediaArticle } from './esolve-media-article';
5
+ import { EsolveHeading } from './esolve-heading';
5
6
  import * as i0 from "@angular/core";
6
7
  export declare class EsolveMediaService {
7
8
  private config;
8
9
  private http;
9
10
  constructor(config: EsolveConnectConfig, http: HttpClient);
10
11
  /**
11
- * Retrieves the media record from the eSolve instance using the identifier.
12
- * @param identifier String representing the eSolve media indentifier
12
+ * Retrieves the media record from the eSolve instance using the identifier
13
+ *
14
+ * @param identifier String representing the eSolve media identifier
13
15
  */
14
16
  getMediaArticle(identifier: string): Observable<EsolveMediaArticle>;
15
17
  /**
16
- * Retrieves a group of media records from the eSolve instance linked to a group.
18
+ * Retrieves a group of media records from the eSolve instance linked to a group
19
+ *
17
20
  * @param media_group String representing the eSolve media group
18
21
  */
19
22
  getGroupedMediaArticles(media_group: string): Observable<EsolveMediaArticle[]>;
23
+ /**
24
+ * Retrieves the media heading records from the eSolve instance using the identifiers
25
+ *
26
+ * @param identifiers Array of strings representing the eSolve heading identifiers
27
+ */
28
+ getHeadings(identifiers: string[]): Observable<EsolveHeading[]>;
29
+ /**
30
+ * Processes media article record
31
+ *
32
+ * @param record Record from eSolve instance
33
+ */
20
34
  private processMediaRecord;
35
+ /**
36
+ * Processes media heading record
37
+ *
38
+ * @param record Record from eSolve instance
39
+ */
40
+ private processHeadingRecord;
21
41
  /**
22
42
  * Retrieves media records from eSolve instance.
23
- * @param params Header params
43
+ *
44
+ * @param params HTTP params
24
45
  */
25
46
  private getMediaRecords;
26
47
  static ɵfac: i0.ɵɵFactoryDeclaration<EsolveMediaService, never>;
@@ -10,11 +10,11 @@ export declare class EsolveNewsService {
10
10
  private config;
11
11
  private http;
12
12
  constructor(config: EsolveConnectConfig, http: HttpClient);
13
- private getNewsRecords;
14
13
  getNewsArticle(identifier: string): Observable<EsolveNewsArticle>;
15
14
  getNewsArticles(options: EsolveNewsArticleOptions): Observable<EsolveNewsArticleList>;
16
15
  getNewsGroups(): Observable<EsolveNewsGroup[]>;
17
16
  private processNewsArticle;
17
+ private getNewsRecords;
18
18
  static ɵfac: i0.ɵɵFactoryDeclaration<EsolveNewsService, never>;
19
19
  static ɵprov: i0.ɵɵInjectableDeclaration<EsolveNewsService>;
20
20
  }
@@ -17,19 +17,6 @@ export declare class EsolvePaymentService {
17
17
  private errorHandler;
18
18
  private responseHandler;
19
19
  constructor(config: EsolveConnectConfig, http: HttpClient, errorHandler: EsolveErrorHandlerService, responseHandler: EsolveResponseHandlerService);
20
- /**
21
- * Processes the eSolve payment method records.
22
- * @param records Records to process
23
- * @returns An array of processed payment methods.
24
- */
25
- private processPaymentMethods;
26
- /**
27
- * Processes the eSolve vault records.
28
- * @param records Records to process
29
- * @returns An array of processed vault items (a.k.a. cards)
30
- */
31
- private processVaultItems;
32
- private generateExpiry;
33
20
  /**
34
21
  * Retrieves a list of payment methods.
35
22
  * @param options Filter options
@@ -51,13 +38,28 @@ export declare class EsolvePaymentService {
51
38
  setVaultItem(payment_methods_id: number, card_data: EsolveCardData): Observable<EsolveVaultItemResult>;
52
39
  deleteVaultItem(id: number): Observable<EsolveResult>;
53
40
  /**
54
- * Sets the payment for the specified transaction using selected payment method.
41
+ * Sets the payment for the specified transaction using selected payment
42
+ * method.
43
+ *
55
44
  * @param transaction_id eSolve ID to the transaction
56
45
  * @param payment_methods_id eSolve ID to the selected payment method
57
46
  * @param card ID of selected card from the vault or information to a brand new card
58
47
  * @returns An `Observable` with the result of the payment
59
48
  */
60
49
  setPayment(transaction_id: number, payment_methods_id: number, card: EsolveCardData | number): Observable<EsolvePaymentResult>;
50
+ /**
51
+ * Processes the eSolve payment method records.
52
+ * @param records Records to process
53
+ * @returns An array of processed payment methods.
54
+ */
55
+ private processPaymentMethods;
56
+ /**
57
+ * Processes the eSolve vault records.
58
+ * @param records Records to process
59
+ * @returns An array of processed vault items (a.k.a. cards)
60
+ */
61
+ private processVaultItems;
62
+ private generateExpiry;
61
63
  static ɵfac: i0.ɵɵFactoryDeclaration<EsolvePaymentService, never>;
62
64
  static ɵprov: i0.ɵɵInjectableDeclaration<EsolvePaymentService>;
63
65
  }
@@ -1,9 +1,8 @@
1
1
  export declare class EsolveSession {
2
2
  id: number;
3
- private _key;
4
- private _key_expiration_date?;
5
- constructor(id?: number, _key?: string, _key_expiration_date?: Date | undefined);
6
- get key(): string;
3
+ readonly key: string;
4
+ readonly expiration_date?: Date | undefined;
5
+ constructor(id?: number, key?: string, expiration_date?: Date | undefined);
7
6
  get expired(): boolean;
8
7
  get authenticated(): boolean;
9
8
  get valid(): boolean;
@@ -1,15 +1,19 @@
1
1
  import { Observable } from 'rxjs';
2
+ import { EsolveCookieService } from '../shared/cookie/esolve-cookie.service';
2
3
  import { EsolveConnectConfig } from '../esolve-connect.config';
3
4
  import { EsolveSession } from './esolve-session';
4
5
  import * as i0 from "@angular/core";
5
6
  export declare class EsolveSessionService {
7
+ private platformId;
6
8
  private config;
9
+ private cookieService;
10
+ session: Observable<EsolveSession>;
11
+ private _session;
7
12
  private key_expiration_timer;
8
13
  private storage_key;
9
- private _session;
10
- session: Observable<EsolveSession>;
14
+ private is_browser;
11
15
  get currentSession(): EsolveSession;
12
- constructor(config: EsolveConnectConfig);
16
+ constructor(platformId: Object, config: EsolveConnectConfig, cookieService: EsolveCookieService);
13
17
  private setStorageKey;
14
18
  private startTimer;
15
19
  clearTimer(): void;
@@ -1,5 +1,5 @@
1
1
  export interface EsolveStoredSession {
2
2
  id: number;
3
- _key: string;
4
- _key_expiration_date: string;
3
+ key: string;
4
+ expiration_date: string;
5
5
  }
@@ -0,0 +1,36 @@
1
+ import { Request, Response } from 'express';
2
+ import { CookieService } from 'ngx-cookie-service';
3
+ import * as i0 from "@angular/core";
4
+ export declare class EsolveCookieService {
5
+ private ngxCookies;
6
+ private platformId;
7
+ private request;
8
+ private response;
9
+ private is_browser;
10
+ constructor(ngxCookies: CookieService, platformId: Object, request: Request, response: Response);
11
+ check(name: string): boolean;
12
+ get(name: string): string;
13
+ set(name: string, value: string, expires?: Date, path?: string, domain?: string, secure?: boolean): void;
14
+ delete(name: string, path?: string, domain?: string, secure?: boolean): void;
15
+ /**
16
+ * Get cookie Regular Expression
17
+ *
18
+ * @param name Cookie name
19
+ * @returns property RegExp
20
+ *
21
+ * @link https://github.com/stevermeister/ngx-cookie-service/blob/bcb6ac203487c487fcd126896bffaa14981c709c/projects/ngx-cookie-service/src/lib/cookie.service.ts#L31
22
+ */
23
+ private getCookieRegExp;
24
+ /**
25
+ * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).
26
+ *
27
+ * @param encodedURIComponent A value representing an encoded URI component.
28
+ *
29
+ * @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).
30
+ *
31
+ * @link https://github.com/stevermeister/ngx-cookie-service/blob/bcb6ac203487c487fcd126896bffaa14981c709c/projects/ngx-cookie-service/src/lib/cookie.service.ts#L47
32
+ */
33
+ private safeDecodeURIComponent;
34
+ static ɵfac: i0.ɵɵFactoryDeclaration<EsolveCookieService, [null, null, { optional: true; }, { optional: true; }]>;
35
+ static ɵprov: i0.ɵɵInjectableDeclaration<EsolveCookieService>;
36
+ }
@@ -9,6 +9,17 @@ export declare class EsolveShippingService {
9
9
  private config;
10
10
  private http;
11
11
  constructor(config: EsolveConnectConfig, http: HttpClient);
12
+ /**
13
+ * Retrieves a list of shipping methods
14
+ * @returns An `Observable` with an array of shipping methods
15
+ */
16
+ getShippingMethods(options?: EsolveShippingMethodOptions): Observable<EsolveShippingMethod[]>;
17
+ /**
18
+ * Retrieves the shipping costs
19
+ * @param options Shipping cost options
20
+ * @returns An `Observable` with the shipping costs
21
+ */
22
+ getShippingCost(shipping_id: number, addresses_id: number, location_id?: number): Observable<EsolveShippingCost>;
12
23
  /**
13
24
  * Processes the eSolve shipping method records.
14
25
  * @param records Records to process
@@ -21,17 +32,6 @@ export declare class EsolveShippingService {
21
32
  * @returns Processed shipping costs
22
33
  */
23
34
  private processShippingCost;
24
- /**
25
- * Retrieves a list of shipping methods
26
- * @returns An `Observable` with an array of shipping methods
27
- */
28
- getShippingMethods(options?: EsolveShippingMethodOptions): Observable<EsolveShippingMethod[]>;
29
- /**
30
- * Retrieves the shipping costs
31
- * @param options Shipping cost options
32
- * @returns An `Observable` with the shipping costs
33
- */
34
- getShippingCost(shipping_id: number, addresses_id: number, location_id?: number): Observable<EsolveShippingCost>;
35
35
  static ɵfac: i0.ɵɵFactoryDeclaration<EsolveShippingService, never>;
36
36
  static ɵprov: i0.ɵɵInjectableDeclaration<EsolveShippingService>;
37
37
  }
@@ -27,6 +27,10 @@ export declare class EsolveStockItem implements EsolveSEODetails {
27
27
  * Short description of stock item
28
28
  */
29
29
  description: string;
30
+ /**
31
+ * Full description of stock item
32
+ */
33
+ extended_description: string;
30
34
  /**
31
35
  * Active state
32
36
  */
@@ -105,6 +109,10 @@ export declare class EsolveStockItem implements EsolveSEODetails {
105
109
  * Short description of stock item
106
110
  */
107
111
  description: string,
112
+ /**
113
+ * Full description of stock item
114
+ */
115
+ extended_description: string,
108
116
  /**
109
117
  * Active state
110
118
  */
@@ -12,6 +12,7 @@ export interface EsolveStockRecord {
12
12
  seo_page_title: string;
13
13
  seo_keywords: string;
14
14
  description: string;
15
+ extended_description: string;
15
16
  category_id: string;
16
17
  category_description: string;
17
18
  subcategory_id: number;
@@ -9,16 +9,6 @@ export declare class EsolveStockService {
9
9
  private config;
10
10
  private http;
11
11
  constructor(config: EsolveConnectConfig, http: HttpClient);
12
- /**
13
- * Processes the eSolve stock item record and converts it to StockItem object.
14
- * @param record eSolve stock item record
15
- */
16
- private processStockItem;
17
- /**
18
- * Retrieves stock records from HTTP params.
19
- * @param params HTTP client parameters
20
- */
21
- private getStockRecords;
22
12
  /**
23
13
  * Retrieves the stock record from the eSolve instance using the code.
24
14
  * @param code eSolve stock code
@@ -34,6 +24,16 @@ export declare class EsolveStockService {
34
24
  * @param options Stock filter options
35
25
  */
36
26
  getStockItems(options: EsolveStockItemOptions): Observable<EsolveStockItemList>;
27
+ /**
28
+ * Processes the eSolve stock item record and converts it to StockItem object.
29
+ * @param record eSolve stock item record
30
+ */
31
+ private processStockItem;
32
+ /**
33
+ * Retrieves stock records from HTTP params.
34
+ * @param params HTTP client parameters
35
+ */
36
+ private getStockRecords;
37
37
  static ɵfac: i0.ɵɵFactoryDeclaration<EsolveStockService, never>;
38
38
  static ɵprov: i0.ɵɵInjectableDeclaration<EsolveStockService>;
39
39
  }
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@esolve/ng-esolve-connect",
3
- "version": "0.10.2",
3
+ "version": "0.11.0",
4
4
  "description": "An Angular library that speaks to an eSolve instance's API",
5
5
  "peerDependencies": {
6
- "@angular/common": "^13.0.0",
7
- "@angular/core": "^13.0.0",
8
- "ngx-cookie-service": "^13.0.0"
6
+ "@angular/common": ">=12.0.0",
7
+ "@angular/core": ">=12.0.0",
8
+ "ngx-cookie-service": "^13.0.0",
9
+ "@types/express": "^4.17.0"
9
10
  },
10
11
  "dependencies": {
11
12
  "tslib": "^2.3.0"
package/public-api.d.ts CHANGED
@@ -3,6 +3,7 @@ export { EsolveConnectConfig } from './lib/esolve-connect.config';
3
3
  export * from './lib/shared/esolve-list';
4
4
  export * from './lib/shared/esolve-result';
5
5
  export * from './lib/shared/esolve-response';
6
+ export * from './lib/shared/cookie/esolve-cookie.service';
6
7
  export * from './lib/shared/error-handler/esolve-http-error';
7
8
  export * from './lib/shared/error-handler/esolve-error-handler.service';
8
9
  export * from './lib/shared/response-handler/esolve-response-result';
@@ -26,6 +27,7 @@ export * from './lib/account/esolve-registration-result';
26
27
  export * from './lib/account/esolve-change-password-result';
27
28
  export * from './lib/account/esolve-reset-password-result';
28
29
  export * from './lib/account/esolve-account.service';
30
+ export * from './lib/media/esolve-heading';
29
31
  export * from './lib/media/esolve-media-article';
30
32
  export * from './lib/media/esolve-media.service';
31
33
  export * from './lib/news/esolve-news-group';