@partium/js-sdk 13.0.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/LICENSE.txt +100 -0
- package/README.md +18 -0
- package/core/constants/constants.d.ts +12 -0
- package/core/constants/constants.js +2 -0
- package/core/decorators/injection-identifier.d.ts +10 -0
- package/core/decorators/injection-identifier.js +2 -0
- package/core/factories/paginated-request-service.factory.d.ts +22 -0
- package/core/factories/paginated-request-service.factory.js +2 -0
- package/core/index.d.ts +47 -0
- package/core/index.js +2 -0
- package/core/integration-defaults/http/fetch-api-http-error-helper.d.ts +16 -0
- package/core/integration-defaults/http/fetch-api-http-error-helper.js +2 -0
- package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.d.ts +35 -0
- package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.js +2 -0
- package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.d.ts +47 -0
- package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.js +2 -0
- package/core/integration-defaults/http/handle-axios-error-helper.d.ts +17 -0
- package/core/integration-defaults/http/handle-axios-error-helper.js +2 -0
- package/core/integration-defaults/http/https-client/axios-https-client.service.d.ts +83 -0
- package/core/integration-defaults/http/https-client/axios-https-client.service.js +2 -0
- package/core/integration-defaults/http/https-client/fetch-api-https-client.service.d.ts +85 -0
- package/core/integration-defaults/http/https-client/fetch-api-https-client.service.js +2 -0
- package/core/integration-defaults/http/js-oauth-keycloak-https.service.d.ts +8 -0
- package/core/integration-defaults/http/js-oauth-keycloak-https.service.js +2 -0
- package/core/integration-defaults/js-p-file.d.ts +8 -0
- package/core/integration-defaults/js-p-file.js +2 -0
- package/core/integration-defaults/session/js-oauth-api-key-session.service.d.ts +76 -0
- package/core/integration-defaults/session/js-oauth-api-key-session.service.js +2 -0
- package/core/integration-defaults/session/js-oauth-keycloak-auth-config.d.ts +28 -0
- package/core/integration-defaults/session/js-oauth-keycloak-auth-config.js +2 -0
- package/core/integration-defaults/session/js-oauth-keycloak-session.service.d.ts +82 -0
- package/core/integration-defaults/session/js-oauth-keycloak-session.service.js +2 -0
- package/core/integration-defaults/web-device-status.service.d.ts +24 -0
- package/core/integration-defaults/web-device-status.service.js +2 -0
- package/core/integration-defaults/web-file.service.d.ts +9 -0
- package/core/integration-defaults/web-file.service.js +2 -0
- package/core/integration-defaults/web-indexeddb.service.d.ts +19 -0
- package/core/integration-defaults/web-indexeddb.service.js +2 -0
- package/core/integration-defaults/web-local-storage.service.d.ts +157 -0
- package/core/integration-defaults/web-local-storage.service.js +2 -0
- package/core/models/api-object.d.ts +7 -0
- package/core/models/api-object.js +2 -0
- package/core/models/auth-config.d.ts +38 -0
- package/core/models/auth-config.js +2 -0
- package/core/models/device-info.d.ts +62 -0
- package/core/models/device-info.js +2 -0
- package/core/models/error.d.ts +70 -0
- package/core/models/error.js +2 -0
- package/core/models/formatted-string.d.ts +9 -0
- package/core/models/formatted-string.js +2 -0
- package/core/models/i18n-map.d.ts +34 -0
- package/core/models/i18n-map.js +2 -0
- package/core/models/i18n-string.d.ts +8 -0
- package/core/models/i18n-string.js +2 -0
- package/core/models/log.d.ts +130 -0
- package/core/models/log.js +2 -0
- package/core/models/organization.d.ts +121 -0
- package/core/models/organization.js +2 -0
- package/core/models/p-file.d.ts +17 -0
- package/core/models/p-file.js +2 -0
- package/core/models/paginated-list.d.ts +23 -0
- package/core/models/paginated-list.js +2 -0
- package/core/models/partium-config.d.ts +31 -0
- package/core/models/partium-config.js +2 -0
- package/core/models/user-token.d.ts +16 -0
- package/core/models/user-token.js +2 -0
- package/core/models/user.d.ts +48 -0
- package/core/models/user.js +2 -0
- package/core/services/backend-status.service.d.ts +46 -0
- package/core/services/backend-status.service.js +2 -0
- package/core/services/base-login-init.service.d.ts +32 -0
- package/core/services/base-login-init.service.js +2 -0
- package/core/services/base.service.d.ts +31 -0
- package/core/services/base.service.js +2 -0
- package/core/services/device-status.service.interface.d.ts +36 -0
- package/core/services/device-status.service.interface.js +2 -0
- package/core/services/file.service.interface.d.ts +24 -0
- package/core/services/file.service.interface.js +2 -0
- package/core/services/http/file-transfer/file-transfer.service.interface.d.ts +57 -0
- package/core/services/http/file-transfer/file-transfer.service.interface.js +2 -0
- package/core/services/http/https-client/https-client.service.interface.d.ts +96 -0
- package/core/services/http/https-client/https-client.service.interface.js +2 -0
- package/core/services/http/https.service.interface.d.ts +164 -0
- package/core/services/http/https.service.interface.js +2 -0
- package/core/services/http/oauth-https.service.d.ts +120 -0
- package/core/services/http/oauth-https.service.js +2 -0
- package/core/services/local-storage.service.interface.d.ts +221 -0
- package/core/services/local-storage.service.interface.js +2 -0
- package/core/services/log.service.d.ts +48 -0
- package/core/services/log.service.js +2 -0
- package/core/services/organization.service.d.ts +48 -0
- package/core/services/organization.service.js +2 -0
- package/core/services/paginated-request.service.d.ts +104 -0
- package/core/services/paginated-request.service.js +2 -0
- package/core/services/recent-parts.service.d.ts +59 -0
- package/core/services/recent-parts.service.js +2 -0
- package/core/services/service-provider.d.ts +58 -0
- package/core/services/service-provider.js +2 -0
- package/core/services/session/oauth-session.service.d.ts +76 -0
- package/core/services/session/oauth-session.service.js +2 -0
- package/core/services/session/session.service.interface.d.ts +138 -0
- package/core/services/session/session.service.interface.js +2 -0
- package/core/utils/general-helper.d.ts +35 -0
- package/core/utils/general-helper.js +2 -0
- package/data/index.d.ts +28 -0
- package/data/index.js +2 -0
- package/data/models/announcement.d.ts +30 -0
- package/data/models/announcement.js +2 -0
- package/data/models/assembly-hierarchy-node-breadcrumb.d.ts +10 -0
- package/data/models/assembly-hierarchy-node-breadcrumb.js +2 -0
- package/data/models/assembly-hierarchy-node.d.ts +16 -0
- package/data/models/assembly-hierarchy-node.js +2 -0
- package/data/models/attribute.d.ts +46 -0
- package/data/models/attribute.js +2 -0
- package/data/models/csa-request-search.d.ts +18 -0
- package/data/models/csa-request-search.js +2 -0
- package/data/models/csa-request-status.d.ts +16 -0
- package/data/models/csa-request-status.js +2 -0
- package/data/models/csa-request.d.ts +41 -0
- package/data/models/csa-request.js +2 -0
- package/data/models/document.d.ts +12 -0
- package/data/models/document.js +2 -0
- package/data/models/filter-key.d.ts +12 -0
- package/data/models/filter-key.js +2 -0
- package/data/models/filter-option-value.d.ts +18 -0
- package/data/models/filter-option-value.js +2 -0
- package/data/models/image.d.ts +36 -0
- package/data/models/image.js +2 -0
- package/data/models/inquiry.d.ts +32 -0
- package/data/models/inquiry.js +2 -0
- package/data/models/mounting-location.d.ts +32 -0
- package/data/models/mounting-location.js +2 -0
- package/data/models/multiple-expert-searches.d.ts +9 -0
- package/data/models/multiple-expert-searches.js +2 -0
- package/data/models/part-enrichment-data.d.ts +24 -0
- package/data/models/part-enrichment-data.js +2 -0
- package/data/models/part.d.ts +168 -0
- package/data/models/part.js +2 -0
- package/data/models/shopping-cart.d.ts +43 -0
- package/data/models/shopping-cart.js +2 -0
- package/data/services/announcement.service.d.ts +68 -0
- package/data/services/announcement.service.js +2 -0
- package/data/services/assembly-hierarchy-nodes.service.d.ts +113 -0
- package/data/services/assembly-hierarchy-nodes.service.js +2 -0
- package/data/services/csa-helper.service.d.ts +32 -0
- package/data/services/csa-helper.service.js +2 -0
- package/data/services/customer-service-assistance.service.d.ts +181 -0
- package/data/services/customer-service-assistance.service.js +2 -0
- package/data/services/filter.service.d.ts +97 -0
- package/data/services/filter.service.js +2 -0
- package/data/services/inquiry.service.d.ts +54 -0
- package/data/services/inquiry.service.js +2 -0
- package/data/services/part-attribute.service.d.ts +42 -0
- package/data/services/part-attribute.service.js +2 -0
- package/data/services/part-enrichment.service.d.ts +32 -0
- package/data/services/part-enrichment.service.js +2 -0
- package/data/services/part.service.d.ts +121 -0
- package/data/services/part.service.js +2 -0
- package/data/services/related-parts.service.d.ts +75 -0
- package/data/services/related-parts.service.js +2 -0
- package/data/services/shopping-cart.service.d.ts +150 -0
- package/data/services/shopping-cart.service.js +2 -0
- package/find/index.d.ts +35 -0
- package/find/index.js +2 -0
- package/find/models/assets/asset.d.ts +24 -0
- package/find/models/assets/asset.js +2 -0
- package/find/models/search-filter.d.ts +87 -0
- package/find/models/search-filter.js +2 -0
- package/find/models/search-input.d.ts +39 -0
- package/find/models/search-input.js +2 -0
- package/find/models/search-output.d.ts +10 -0
- package/find/models/search-output.js +2 -0
- package/find/models/search-result-status.d.ts +33 -0
- package/find/models/search-result-status.js +2 -0
- package/find/models/search-session-log-object.d.ts +16 -0
- package/find/models/search-session-log-object.js +2 -0
- package/find/models/search-status/cv-search-status.d.ts +20 -0
- package/find/models/search-status/cv-search-status.js +2 -0
- package/find/models/search-status/search-filter-status.d.ts +33 -0
- package/find/models/search-status/search-filter-status.js +2 -0
- package/find/models/search-status/search-status.d.ts +34 -0
- package/find/models/search-status/search-status.js +2 -0
- package/find/models/search-status/tag-search-status.d.ts +16 -0
- package/find/models/search-status/tag-search-status.js +2 -0
- package/find/models/search-status/text-search-status.d.ts +15 -0
- package/find/models/search-status/text-search-status.js +2 -0
- package/find/models/search-tag.d.ts +12 -0
- package/find/models/search-tag.js +2 -0
- package/find/models/smart-filter.d.ts +25 -0
- package/find/models/smart-filter.js +2 -0
- package/find/models/tagable/i18n-tagable.d.ts +10 -0
- package/find/models/tagable/i18n-tagable.js +2 -0
- package/find/models/tagable/tagable-base.d.ts +11 -0
- package/find/models/tagable/tagable-base.js +2 -0
- package/find/models/tagable/tagable.d.ts +10 -0
- package/find/models/tagable/tagable.js +2 -0
- package/find/models/text-search-config.d.ts +57 -0
- package/find/models/text-search-config.js +2 -0
- package/find/models/text-search-manipulator.d.ts +46 -0
- package/find/models/text-search-manipulator.js +2 -0
- package/find/models/text-search-result-item/text-search-error.d.ts +7 -0
- package/find/models/text-search-result-item/text-search-error.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-document.d.ts +10 -0
- package/find/models/text-search-result-item/text-search-result-item-document.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-part.d.ts +12 -0
- package/find/models/text-search-result-item/text-search-result-item-part.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-recent-query.d.ts +10 -0
- package/find/models/text-search-result-item/text-search-result-item-recent-query.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-unknown.d.ts +12 -0
- package/find/models/text-search-result-item/text-search-result-item-unknown.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item.d.ts +16 -0
- package/find/models/text-search-result-item/text-search-result-item.js +2 -0
- package/find/services/asset.service.d.ts +160 -0
- package/find/services/asset.service.js +2 -0
- package/find/services/filter-uploaders/filter-uploader.d.ts +13 -0
- package/find/services/filter-uploaders/filter-uploader.js +2 -0
- package/find/services/filter-uploaders/update-filters-uploader.d.ts +17 -0
- package/find/services/filter-uploaders/update-filters-uploader.js +2 -0
- package/find/services/filter-uploaders/update-filters.model.d.ts +19 -0
- package/find/services/filter-uploaders/update-filters.model.js +2 -0
- package/find/services/search/cv-search.service.d.ts +103 -0
- package/find/services/search/cv-search.service.js +2 -0
- package/find/services/search/recent-text-search-queries.service.d.ts +89 -0
- package/find/services/search/recent-text-search-queries.service.js +2 -0
- package/find/services/search/search-result.service.d.ts +142 -0
- package/find/services/search/search-result.service.js +2 -0
- package/find/services/search/search.service.d.ts +291 -0
- package/find/services/search/search.service.js +2 -0
- package/find/services/search/tag-search.service.d.ts +66 -0
- package/find/services/search/tag-search.service.js +2 -0
- package/find/services/search/text-search.service.d.ts +116 -0
- package/find/services/search/text-search.service.js +2 -0
- package/find/services/search-filter.service.d.ts +223 -0
- package/find/services/search-filter.service.js +2 -0
- package/find/utils/search-helper.d.ts +14 -0
- package/find/utils/search-helper.js +2 -0
- package/gen/sdk-version.d.ts +2 -0
- package/gen/sdk-version.js +2 -0
- package/index.d.ts +121 -0
- package/index.js +2 -0
- package/management/index.d.ts +5 -0
- package/management/index.js +2 -0
- package/management/models/api-key-list-response.d.ts +10 -0
- package/management/models/api-key-list-response.js +2 -0
- package/management/models/api-key-type.d.ts +5 -0
- package/management/models/api-key-type.js +2 -0
- package/management/models/api-key.d.ts +4 -0
- package/management/models/api-key.js +2 -0
- package/management/services/api-key.service.d.ts +39 -0
- package/management/services/api-key.service.js +2 -0
- package/ocr/index.d.ts +4 -0
- package/ocr/index.js +2 -0
- package/ocr/models/detect-response.d.ts +5 -0
- package/ocr/models/detect-response.js +2 -0
- package/ocr/models/detected-text-entry.d.ts +5 -0
- package/ocr/models/detected-text-entry.js +2 -0
- package/ocr/services/ocr.service.d.ts +36 -0
- package/ocr/services/ocr.service.js +2 -0
- package/package.json +45 -0
- package/user-data/index.d.ts +5 -0
- package/user-data/index.js +2 -0
- package/user-data/models/part-with-nullable.d.ts +5 -0
- package/user-data/models/part-with-nullable.js +2 -0
- package/user-data/models/request-list/request-list.d.ts +16 -0
- package/user-data/models/request-list/request-list.js +2 -0
- package/user-data/services/favorite/favorite.service.d.ts +45 -0
- package/user-data/services/favorite/favorite.service.js +2 -0
- package/user-data/services/request-list/request-list.service.d.ts +97 -0
- package/user-data/services/request-list/request-list.service.js +2 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { BaseService, ServiceProvider, PaginatedRequestService } from '../../core';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { AssemblyHierarchyNode } from '../models/assembly-hierarchy-node';
|
|
5
|
+
export type AssemblyHierarchyTreeOrder = 'root' | 'leaf';
|
|
6
|
+
/**
|
|
7
|
+
* Service for getting and setting assembly hierarchy nodes.
|
|
8
|
+
*/
|
|
9
|
+
export interface AssemblyHierarchyNodesService {
|
|
10
|
+
/**
|
|
11
|
+
* Retrieve all assembly hierarchy root nodes.
|
|
12
|
+
* The returned array of AssemblyHierarchyNode will be ordered by their name.
|
|
13
|
+
* @param cursorPaginationEnabled if true, the data will be fetched using the cursor as a paginator and return a string with the next and previous pages
|
|
14
|
+
* @param treeOrder the order in which the assembly hierarchy nodes should be returned
|
|
15
|
+
* @returns observable that emits with a Service of type PaginatedRequestService.
|
|
16
|
+
* This service can be used to retrieve a paginated list of the
|
|
17
|
+
* requested nodes.
|
|
18
|
+
*/
|
|
19
|
+
getAssemblyHierarchyRootNodes(cursorPaginationEnabled?: boolean, treeOrder?: AssemblyHierarchyTreeOrder): PaginatedRequestService<AssemblyHierarchyNode>;
|
|
20
|
+
/**
|
|
21
|
+
* Request the information of all assembly hierarchy nodes that have the given
|
|
22
|
+
* node as parent.
|
|
23
|
+
*
|
|
24
|
+
* The returned array of AssemblyHierarchyNode will be ordered by their name.
|
|
25
|
+
*
|
|
26
|
+
* @param parentPartiumId parent-id of node from which the children should be
|
|
27
|
+
* fetched (if null -> root-nodes will be returned)
|
|
28
|
+
* @param cursorPaginationEnabled if true, the data will be fetched using the cursor as a paginator and return a string with the next and previous pages
|
|
29
|
+
* @param treeOrder the order in which the assembly hierarchy nodes should be returned
|
|
30
|
+
* @returns observable that emits with a Service of type PaginatedRequestService.
|
|
31
|
+
* This service can be used to retrieve a paginated list of the
|
|
32
|
+
* requested nodes.
|
|
33
|
+
*/
|
|
34
|
+
getAssemblyHierarchyNodesByParentId(parentPartiumId: string, cursorPaginationEnabled?: boolean, treeOrder?: AssemblyHierarchyTreeOrder): PaginatedRequestService<AssemblyHierarchyNode>;
|
|
35
|
+
/**
|
|
36
|
+
* Search for assembly hierarchy nodes by the given query.
|
|
37
|
+
*
|
|
38
|
+
* @param query the query to search for
|
|
39
|
+
* @param parentPartiumId (optional) parent-id of node from which the children
|
|
40
|
+
* should be searched (if null, all nodes will be searched)
|
|
41
|
+
* @param language (optional) language field the query should be searched in
|
|
42
|
+
* (default all languages are searched)
|
|
43
|
+
* Language is expected to be a two-letter string, according to
|
|
44
|
+
* ISO 639-1 (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
|
|
45
|
+
* @param maxDepth (optional) maximum depth of nodes to be searched (0 = only direct children)
|
|
46
|
+
* @param cursorPaginationEnabled if true, the data will be fetched using the cursor as a paginator and return a string with the next and previous pages
|
|
47
|
+
* @param treeOrder the order in which the assembly hierarchy nodes should be returned
|
|
48
|
+
*
|
|
49
|
+
* @returns observable that emits with a Service of type PaginatedRequestService.
|
|
50
|
+
* This service can be used to retrieve a paginated list of the
|
|
51
|
+
* requested nodes.
|
|
52
|
+
*/
|
|
53
|
+
searchAssemblyHierarchyNodesByText(query: string, parentPartiumId?: string, language?: string, maxDepth?: number, cursorPaginationEnabled?: boolean, treeOrder?: AssemblyHierarchyTreeOrder): PaginatedRequestService<AssemblyHierarchyNode>;
|
|
54
|
+
/**
|
|
55
|
+
* Will trigger loading the information of an assembly hierarchy node from the
|
|
56
|
+
* backend.
|
|
57
|
+
*
|
|
58
|
+
* @param partiumId partium-id of the assembly hierarchy node to retrieve *
|
|
59
|
+
* @param treeOrder the order in which the assembly hierarchy nodes should be returned
|
|
60
|
+
* @returns observable that emits when the requested assembly hierarchy node was
|
|
61
|
+
* loaded from the backend.
|
|
62
|
+
*/
|
|
63
|
+
getAssemblyHierarchyNode(partiumId: string, treeOrder?: AssemblyHierarchyTreeOrder): Observable<AssemblyHierarchyNode>;
|
|
64
|
+
/**
|
|
65
|
+
* Will trigger loading the information of all requested assembly hierarchy nodes
|
|
66
|
+
* from the backend.
|
|
67
|
+
*
|
|
68
|
+
* The returned array of AssemblyHierarchyNode will be in the same order as the
|
|
69
|
+
* requested partium-ids. For every assembly hierarchy node that could not be
|
|
70
|
+
* found, the array contains null instead.
|
|
71
|
+
*
|
|
72
|
+
* @param partiumIds partium-ids of all assembly hierarchy nodes to retrieve
|
|
73
|
+
* @param treeOrder the order in which the assembly hierarchy nodes should be returned
|
|
74
|
+
* @returns observable that emits when the requested assembly hierarchy node was
|
|
75
|
+
* loaded from the backend.
|
|
76
|
+
*/
|
|
77
|
+
getAssemblyHierarchyNodes(partiumIds: string[], treeOrder?: AssemblyHierarchyTreeOrder): Observable<AssemblyHierarchyNode[]>;
|
|
78
|
+
}
|
|
79
|
+
export declare class AssemblyHierarchyNodesServiceImpl extends BaseService implements AssemblyHierarchyNodesService {
|
|
80
|
+
private DOWNLOAD_PAGE_SIZE;
|
|
81
|
+
private PAGINATION_PAGE_SIZE;
|
|
82
|
+
private httpsService;
|
|
83
|
+
constructor(serviceProvider: ServiceProvider);
|
|
84
|
+
onCreate(): void;
|
|
85
|
+
getAssemblyHierarchyRootNodes(cursorPaginationEnabled?: boolean, treeOrder?: AssemblyHierarchyTreeOrder): PaginatedRequestService<AssemblyHierarchyNode>;
|
|
86
|
+
getAssemblyHierarchyNodesByParentId(parentPartiumId: string, cursorPaginationEnabled?: boolean, treeOrder?: AssemblyHierarchyTreeOrder): PaginatedRequestService<AssemblyHierarchyNode>;
|
|
87
|
+
searchAssemblyHierarchyNodesByText(query: string, parentPartiumId?: string, language?: string, maxDepth?: number, cursorPaginationEnabled?: boolean, treeOrder?: AssemblyHierarchyTreeOrder): PaginatedRequestService<AssemblyHierarchyNode>;
|
|
88
|
+
getAssemblyHierarchyNode(partiumId: string, treeOrder?: AssemblyHierarchyTreeOrder): Observable<AssemblyHierarchyNode>;
|
|
89
|
+
getAssemblyHierarchyNodes(partiumIds: string[], treeOrder?: AssemblyHierarchyTreeOrder): Observable<AssemblyHierarchyNode[]>;
|
|
90
|
+
/**
|
|
91
|
+
* Load all requested assembly hierarchy nodes from the server.
|
|
92
|
+
* Since the response is paginated, it is necessary to do as many request as needed until
|
|
93
|
+
* all nodes are loaded.
|
|
94
|
+
*
|
|
95
|
+
* @param partiumIds the partium-ids of the assembly hierarchy nodes to get
|
|
96
|
+
*/
|
|
97
|
+
private loadAssemblyHierarchyNodesFromServer;
|
|
98
|
+
/**
|
|
99
|
+
* Send request for one page of nodes
|
|
100
|
+
*
|
|
101
|
+
* @param page the current page of the pagination (1-indexed)
|
|
102
|
+
*/
|
|
103
|
+
private requestPaginatedAssemblyHierarchyNodes;
|
|
104
|
+
/**
|
|
105
|
+
* Order the given assembly hierarchy nodes by the part-ids given in the part-id-array.
|
|
106
|
+
* If any part is not found in unorderedAssemblyHierarchyNodes, the array contains null instead.
|
|
107
|
+
*
|
|
108
|
+
* @param unorderedAssemblyHierarchyNodes the assembly hierarchy nodes to order
|
|
109
|
+
* @param partiumIds the order in which to sort
|
|
110
|
+
* @returns array of given assembly hierarchy nodes, ordered by partiumIds (contains null for assembly hierarchy nodes not found)
|
|
111
|
+
*/
|
|
112
|
+
private orderAssemblyHierarchyNodes;
|
|
113
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},e(r,t)};return function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}}(),__decorate=this&&this.__decorate||function(e,r,t,o){var s,i=arguments.length,n=i<3?r:null===o?o=Object.getOwnPropertyDescriptor(r,t):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,r,t,o);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(i<3?s(n):i>3?s(r,t,n):s(r,t))||n);return i>3&&n&&Object.defineProperty(r,t,n),n},__spreadArray=this&&this.__spreadArray||function(e,r,t){if(t||2===arguments.length)for(var o,s=0,i=r.length;s<i;s++)!o&&s in r||(o||(o=Array.prototype.slice.call(r,0,s)),o[s]=r[s]);return e.concat(o||Array.prototype.slice.call(r))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.AssemblyHierarchyNodesServiceImpl=void 0;var core_1=require("../../core"),rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),assembly_hierarchy_node_1=require("../models/assembly-hierarchy-node"),AssemblyHierarchyNodesServiceImpl=function(e){function r(r){var t=e.call(this,r)||this;return t.DOWNLOAD_PAGE_SIZE=250,t.PAGINATION_PAGE_SIZE=25,t}return __extends(r,e),r.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(core_1.HttpsService)},r.prototype.getAssemblyHierarchyRootNodes=function(e,r){return void 0===r&&(r="root"),this.getAssemblyHierarchyNodesByParentId(null,e,r)},r.prototype.getAssemblyHierarchyNodesByParentId=function(e,r,t){void 0===t&&(t="root");var o=[];return o.push({max_depth:1}),o.push({tree_order:t}),e?o.push({assembly_uuid:e}):o.push({root_nodes:!0}),r&&o.push({paginator:"cursor"}),core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(assembly_hierarchy_node_1.AssemblyHierarchyNode.fromAPIResponse,this.httpsService,"assemblies",core_1.BACKEND_SERVICE.DATA,o,this.PAGINATION_PAGE_SIZE,r)},r.prototype.searchAssemblyHierarchyNodesByText=function(e,r,t,o,s,i){void 0===i&&(i="root");var n=[];return n.push({search:e}),n.push({tree_order:i}),r&&n.push({assembly_uuid:r}),t&&n.push({lang:t}),void 0!==o&&n.push({max_depth:o}),core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(assembly_hierarchy_node_1.AssemblyHierarchyNode.fromAPIResponse,this.httpsService,"assemblies",core_1.BACKEND_SERVICE.DATA,n,this.PAGINATION_PAGE_SIZE,s)},r.prototype.getAssemblyHierarchyNode=function(e,r){return void 0===r&&(r="root"),this.getAssemblyHierarchyNodes([e],r).pipe((0,operators_1.map)((function(e){return e[0]})))},r.prototype.getAssemblyHierarchyNodes=function(e,r){var t=this;return void 0===r&&(r="root"),this.loadAssemblyHierarchyNodesFromServer(e,r).pipe((0,operators_1.map)((function(r){return t.orderAssemblyHierarchyNodes(r,e)})),(0,operators_1.catchError)((function(e){return console.log("Error while loading assembly hierarchy node-information from server.",e),(0,rxjs_1.throwError)(e)})))},r.prototype.loadAssemblyHierarchyNodesFromServer=function(e,r){var t=this;void 0===r&&(r="root");var o,s=1,i=new rxjs_1.Subject;return(0,rxjs_1.defer)((function(){return t.requestPaginatedAssemblyHierarchyNodes(e,s,o,!0,r)})).pipe((0,operators_1.map)((function(e){if(!e.pagination.page_size||e.pagination.items_count){var r=e.pagination.next&&e.pagination.next.split("?");r?(o=new URLSearchParams(r[1]).get("cursor"),i.next()):i.complete()}else{var t=e.pagination.page_size,n=e.pagination.items_count,a=Math.ceil(n/t);s>=a?i.complete():s++<a&&setTimeout((function(){i.next()}))}return e.results})),(0,operators_1.repeatWhen)((function(){return i.asObservable()})),(0,operators_1.reduce)((function(e,r){return __spreadArray(__spreadArray([],e,!0),r,!0)})),(0,operators_1.map)((function(e){return e.map((function(e){return assembly_hierarchy_node_1.AssemblyHierarchyNode.fromAPIResponse(e)}))})))},r.prototype.requestPaginatedAssemblyHierarchyNodes=function(e,r,t,o,s){void 0===o&&(o=!0),void 0===s&&(s="root");var i=[];return i.push({page_size:this.DOWNLOAD_PAGE_SIZE}),i.push({tree_order:s}),r&&i.push({page:r}),o&&i.push({paginator:"cursor"}),t&&i.push({cursor:t}),this.httpsService.post("assemblies/many",{uuids:e},i,core_1.BACKEND_SERVICE.DATA)},r.prototype.orderAssemblyHierarchyNodes=function(e,r){for(var t=[],o=function(r){t.push(e.find((function(e){return e&&e.partiumId===r})))},s=0,i=r;s<i.length;s++){o(i[s])}return t},r=__decorate([(0,core_1.InjectionIdentifier)("AssemblyHierarchyNodesService")],r)}(core_1.BaseService);exports.AssemblyHierarchyNodesServiceImpl=AssemblyHierarchyNodesServiceImpl;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
import { BaseService } from "../../core/services/base.service";
|
|
4
|
+
import { ServiceProvider } from "../../core/services/service-provider";
|
|
5
|
+
import { AssemblyHierarchyNode } from "../models/assembly-hierarchy-node";
|
|
6
|
+
export declare class CSAHelperService extends BaseService {
|
|
7
|
+
private searchFilterService;
|
|
8
|
+
private assemblyHierarchyNodesService;
|
|
9
|
+
constructor(serviceProvider: ServiceProvider);
|
|
10
|
+
onCreate(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Returns all hierarchy-nodes that should be displayed to the user
|
|
13
|
+
* as applied hierarchy-filters. This considers excluded nodes.
|
|
14
|
+
* The list of filters does not equal the applied hierarchy-filters,
|
|
15
|
+
* but it contains also siblings of excluded nodes, which don't
|
|
16
|
+
* explicitly have to be added in the filter-service, but it's more
|
|
17
|
+
* readable to the user like this.
|
|
18
|
+
* Also loads nodes from later pages than page one.
|
|
19
|
+
*
|
|
20
|
+
* @returns Observable that resolves with an array of AssemblyHierarchyNodes that represent all applied filters
|
|
21
|
+
* @deprecated not needed anymore as HierarchyPartiumIdFilter is deprecated
|
|
22
|
+
*/
|
|
23
|
+
getHierarchyFilterNodesForUI(): Observable<AssemblyHierarchyNode[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Loads all direct children of the node with the given id.
|
|
26
|
+
* (Does not only load the first page, but iteratively loads all pages)
|
|
27
|
+
*
|
|
28
|
+
* @param partiumId id of the parent node
|
|
29
|
+
* @returns Observable that resolves with all direct child nodes
|
|
30
|
+
*/
|
|
31
|
+
private loadAllChildren;
|
|
32
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},e(r,t)};return function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}}(),__decorate=this&&this.__decorate||function(e,r,t,i){var o,n=arguments.length,s=n<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,t):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,r,t,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(s=(n<3?o(s):n>3?o(r,t,s):o(r,t))||s);return n>3&&s&&Object.defineProperty(r,t,s),s};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CSAHelperService=void 0;var lodash_1=require("lodash"),rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),injection_identifier_1=require("../../core/decorators/injection-identifier"),base_service_1=require("../../core/services/base.service"),search_filter_1=require("../../find/models/search-filter"),search_filter_service_1=require("../../find/services/search-filter.service"),assembly_hierarchy_nodes_service_1=require("./assembly-hierarchy-nodes.service"),CSAHelperService=function(e){function r(r){return e.call(this,r)||this}return __extends(r,e),r.prototype.onCreate=function(){this.searchFilterService=this.serviceProvider.getService(search_filter_service_1.SearchFilterServiceImpl),this.assemblyHierarchyNodesService=this.serviceProvider.getService(assembly_hierarchy_nodes_service_1.AssemblyHierarchyNodesServiceImpl)},r.prototype.getHierarchyFilterNodesForUI=function(){var e,r,t,i=this,o=this.searchFilterService.getSearchFilters().pipe((0,operators_1.first)()),n=this.searchFilterService.getExcludedHierarchyFilterNodes().pipe((0,operators_1.first)());return(0,rxjs_1.forkJoin)([o,n]).pipe((0,operators_1.mergeMap)((function(o){var n=o[0],s=o[1];e=[],r=[],t=s;var c=n.find((function(e){return e instanceof search_filter_1.HierarchyPartiumIdFilter}));c&&e.push.apply(e,c.include);for(var a=0,l=Object.values(t);a<l.length;a++)for(var u=function(t){r.filter((function(e){return e===t.partiumId})).length<1&&r.push(t.partiumId),e=e.filter((function(e){return e!==t.partiumId}))},p=0,f=l[a].breadcrumbs;p<f.length;p++){u(f[p])}for(var _=[],h=0,d=r;h<d.length;h++){var v=d[h];_.push(i.loadAllChildren(v))}return _.length>0?(0,rxjs_1.forkJoin)(_):(0,rxjs_1.of)([])})),(0,operators_1.mergeMap)((function(o){for(var n=0,s=o;n<s.length;n++)for(var c=0,a=s[n];c<a.length;c++){var l=a[c];Object.keys(t).includes(l.partiumId)||r.includes(l.partiumId)||e.includes(l.partiumId)||e.push(l.partiumId)}return i.assemblyHierarchyNodesService.getAssemblyHierarchyNodes(e).pipe((0,operators_1.map)((function(e){return e.filter((function(e){return null!=e}))})))})),(0,operators_1.map)((function(e){return(0,lodash_1.sortBy)(e,(function(e){return e.breadcrumbs.length}))})))},r.prototype.loadAllChildren=function(e){var r=new rxjs_1.Subject,t=this.assemblyHierarchyNodesService.getAssemblyHierarchyNodesByParentId(e);return t.loadInitialPage(!0).pipe((0,operators_1.first)(),(0,operators_1.mergeMap)((function(e){return e.moreResultsAvailable()?(0,rxjs_1.defer)((function(){return t.loadMore()})).pipe((0,operators_1.first)(),(0,operators_1.tap)((function(e){e.moreResultsAvailable()?setTimeout((function(){r.next()})):r.complete()})),(0,operators_1.repeatWhen)((function(){return r.asObservable()}))):(0,rxjs_1.of)(e)})),(0,operators_1.map)((function(e){return e.items})))},r=__decorate([(0,injection_identifier_1.InjectionIdentifier)("CSAHelperService")],r)}(base_service_1.BaseService);exports.CSAHelperService=CSAHelperService;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { PaginatedRequestService, EventContext, BaseLoginInitService, PartiumConfig } from '../../core';
|
|
4
|
+
import { Organization } from '../../core/models/organization';
|
|
5
|
+
import { ServiceProvider } from '../../core/services/service-provider';
|
|
6
|
+
import { Asset } from '../../find/models/assets/asset';
|
|
7
|
+
import { AssemblyHierarchyNode } from '../models/assembly-hierarchy-node';
|
|
8
|
+
import { CSARequest } from '../models/csa-request';
|
|
9
|
+
import { CSARequestStatus } from '../models/csa-request-status';
|
|
10
|
+
import { Part } from '../models/part';
|
|
11
|
+
import { MultipleExpertSearches } from '../models/multiple-expert-searches';
|
|
12
|
+
import { CSARequestSearch } from '../models/csa-request-search';
|
|
13
|
+
import { SearchOutput } from '../../find';
|
|
14
|
+
interface ECREventContext extends EventContext {
|
|
15
|
+
languageUi?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Service providing methods related to customer service assistance (also known as expert confirmation)
|
|
19
|
+
*/
|
|
20
|
+
export interface CustomerServiceAssistanceService {
|
|
21
|
+
/**
|
|
22
|
+
* Trigger the Partium-Backend to send a Customer-Service-Assistance request
|
|
23
|
+
* with the given information. Additionally to the information passed to this
|
|
24
|
+
* function, the call will also contain the state of the current
|
|
25
|
+
* search-session.
|
|
26
|
+
*
|
|
27
|
+
* @param message an additional text-message for the CSA-support to read
|
|
28
|
+
* @param language the language to display part- and filter-names in the
|
|
29
|
+
* request
|
|
30
|
+
* @param searchOutput (optional) the search-output-object containing the search-input and results to send along with the request
|
|
31
|
+
* @param part reference to a part that this CSA-request is about
|
|
32
|
+
* (optional)
|
|
33
|
+
* @param additionalAssets additional image- or video-assets (optional)
|
|
34
|
+
* @param ecrEventContext (optional) ECREventContext object to add the missing data that will be logged using the log format V2
|
|
35
|
+
* @returns an Observables that resolves with the result of the http-request
|
|
36
|
+
* to the Partium backend
|
|
37
|
+
*/
|
|
38
|
+
sendCSARequest(message: string, language: string, searchOutput?: SearchOutput, part?: Part, additionalAssets?: Asset[], ecrEventContext?: ECREventContext): Observable<CSARequest>;
|
|
39
|
+
/**
|
|
40
|
+
* Fetch an array of Hierarchy-Filter-Nodes, that can be displayed to the
|
|
41
|
+
* user, representing the currently applied Hierarchy-Search-Filters.
|
|
42
|
+
* This might defer from the applied Hierarchy-Filters, because we want
|
|
43
|
+
* to hide the principle of exclusion from the user, to make the filters
|
|
44
|
+
* more understandable.
|
|
45
|
+
*
|
|
46
|
+
* @returns Array of AssemblyHierarchyNodes that represent the currently
|
|
47
|
+
* applied Hierarchy-Filters-Nodes in user a way that is
|
|
48
|
+
* understandable by the user.
|
|
49
|
+
* @deprecated not needed anymore as HierarchyPartiumIdFilter is deprecated
|
|
50
|
+
*/
|
|
51
|
+
getHierarchyFilterNodesForUI(): Observable<AssemblyHierarchyNode[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Will trigger loading the information of all CSA-requests from the backend.
|
|
54
|
+
*
|
|
55
|
+
* @param paginationSize the size of page when fetching the csaRequests
|
|
56
|
+
* (optional)
|
|
57
|
+
* @param urlParams the params to be passed to the request for filtered results
|
|
58
|
+
* (optional)
|
|
59
|
+
* @returns observable that emits when all csa-requests were loaded from the
|
|
60
|
+
* backend.
|
|
61
|
+
*/
|
|
62
|
+
getCSARequests(paginationSize?: number, urlParams?: Array<Object>): PaginatedRequestService<CSARequest>;
|
|
63
|
+
/**
|
|
64
|
+
* Will trigger loading the multiple search data linked to a CSA-requests from the backend.
|
|
65
|
+
|
|
66
|
+
* @param csaRequestId the id of the csa request linked to the multiple searches
|
|
67
|
+
* @returns observable of type MultipleExpertSearches that emits when all from the
|
|
68
|
+
* backend.
|
|
69
|
+
*/
|
|
70
|
+
getMultipleExpertSearches(csaRequestId: string): Observable<MultipleExpertSearches>;
|
|
71
|
+
/**
|
|
72
|
+
* Will link a search session to an ECR
|
|
73
|
+
|
|
74
|
+
* @param csaRequestId the id of the csa request
|
|
75
|
+
* @param searchSessionId the id of the searchSession to be linked to the CSARequest
|
|
76
|
+
* @returns observable of type CSARequestSearch
|
|
77
|
+
*/
|
|
78
|
+
associateExpertSearchToCsaRequest(csaRequestId: string, searchSessionId: string): Observable<CSARequestSearch>;
|
|
79
|
+
/**
|
|
80
|
+
* Will set the abandoned status of a search session related to an ECR. It can be true or false.
|
|
81
|
+
|
|
82
|
+
* @param csaRequestId the id of the csa request
|
|
83
|
+
* @param searchSessionId the id of the searchSession to be unlinked to the CSARequest
|
|
84
|
+
* @param abandoned boolean value that sets whether the state of the search linked to the CSARequest is true or false. Being true, linked while false is unlinked
|
|
85
|
+
* @returns observable of type CSARequestSearch
|
|
86
|
+
*/
|
|
87
|
+
setExpertSearchAbandoned(csaRequestId: string, searchSessionId: string, abandoned: boolean): Observable<CSARequestSearch>;
|
|
88
|
+
/**
|
|
89
|
+
* Will update the quantity of the CSARequest.
|
|
90
|
+
*
|
|
91
|
+
* @param csaRequestId id of the request to be updated
|
|
92
|
+
* (optional)
|
|
93
|
+
* @param quantity the new quantity of the request
|
|
94
|
+
* (optional)
|
|
95
|
+
* @returns observable that emits when the updated csa-request
|
|
96
|
+
*/
|
|
97
|
+
updateCSARequestQuantity(csaRequestId: string, quantity: number): Observable<CSARequest>;
|
|
98
|
+
/**
|
|
99
|
+
* Will trigger loading the information of the requested CSA-request from the backend.
|
|
100
|
+
*
|
|
101
|
+
* @param csaRequestId id of the CSA-request to load
|
|
102
|
+
* @returns observable that emits the csa-request is loaded from the backend.
|
|
103
|
+
*/
|
|
104
|
+
getCSARequest(csaRequestId: string): Observable<CSARequest>;
|
|
105
|
+
/**
|
|
106
|
+
* Set the status of a CSA-request as open.
|
|
107
|
+
* Should be called when a CSA-agent first looked at the CSA-request.
|
|
108
|
+
*
|
|
109
|
+
* @param csaRequestId id of the CSA-request to set as open
|
|
110
|
+
* @returns observable that emits a CSARequestStatus object.
|
|
111
|
+
*/
|
|
112
|
+
openCSARequest(csaRequestId: string): Observable<CSARequestStatus>;
|
|
113
|
+
/**
|
|
114
|
+
* Resolve a CSA-request with the correct part that was requested.
|
|
115
|
+
*
|
|
116
|
+
* @param csaRequestId id of the CSA-request to resolve
|
|
117
|
+
* @param partId id of the correct part
|
|
118
|
+
* @returns observable that emits a CSARequestStatus object.
|
|
119
|
+
*/
|
|
120
|
+
resolveCSARequest(csaRequestId: string, partId: string): Observable<CSARequestStatus>;
|
|
121
|
+
/**
|
|
122
|
+
* Will mark the CSA-request as not resolved.
|
|
123
|
+
* Should be called, if the CSA-request could not be resolved
|
|
124
|
+
*
|
|
125
|
+
* @param csaRequestId id of the CSA-request that could not be resolved
|
|
126
|
+
* @returns observable that emits a CSARequestStatus object.
|
|
127
|
+
*/
|
|
128
|
+
markNotResolvedCSARequest(csaRequestId: string): Observable<CSARequestStatus>;
|
|
129
|
+
}
|
|
130
|
+
export declare class CustomerServiceAssistanceServiceImpl extends BaseLoginInitService implements CustomerServiceAssistanceService {
|
|
131
|
+
private MAX_RESULT_LIST_LENGTH;
|
|
132
|
+
private httpsService;
|
|
133
|
+
private csaHelperService;
|
|
134
|
+
private assemblyHierarchyNodeService;
|
|
135
|
+
private logService;
|
|
136
|
+
constructor(serviceProvider: ServiceProvider);
|
|
137
|
+
onCreate(): void;
|
|
138
|
+
/**
|
|
139
|
+
* Initializes the CustomerServiceAssistanceService
|
|
140
|
+
*
|
|
141
|
+
* Note: Should be called at the start of a session
|
|
142
|
+
*/
|
|
143
|
+
init(config: PartiumConfig, userEmail: string, currentOrganization$: Observable<Organization>): Observable<void>;
|
|
144
|
+
sendCSARequest(message: string, language: string, searchOutput?: SearchOutput, part?: Part, additionalAssets?: Asset[], ecrEventContext?: ECREventContext): Observable<CSARequest>;
|
|
145
|
+
resolveCSARequest(csaRequestId: string, partId: string): Observable<CSARequestStatus>;
|
|
146
|
+
private sendRequestInternal;
|
|
147
|
+
private createLogEventRequestContent;
|
|
148
|
+
private sendBackendRequest;
|
|
149
|
+
private createRequestData;
|
|
150
|
+
/** @deprecated not needed anymore as HierarchyPartiumIdFilter is already deprecated */
|
|
151
|
+
getHierarchyFilterNodesForUI(): Observable<AssemblyHierarchyNode[]>;
|
|
152
|
+
getCSARequests(paginationSize?: number, urlParams?: any[]): PaginatedRequestService<CSARequest>;
|
|
153
|
+
getMultipleExpertSearches(csaRequestId: string): Observable<MultipleExpertSearches>;
|
|
154
|
+
setExpertSearchAbandoned(csaRequestId: string, searchSessionId: string, abandoned?: boolean): Observable<CSARequestSearch>;
|
|
155
|
+
associateExpertSearchToCsaRequest(csaRequestId: string, searchSessionId: string): Observable<CSARequestSearch>;
|
|
156
|
+
getCSARequest(csaRequestId: string): Observable<CSARequest>;
|
|
157
|
+
openCSARequest(csaRequestId: string): Observable<CSARequestStatus>;
|
|
158
|
+
markNotResolvedCSARequest(csaRequestId: string): Observable<CSARequestStatus>;
|
|
159
|
+
/**
|
|
160
|
+
* Will update the quantity of the CSARequest.
|
|
161
|
+
*
|
|
162
|
+
* @param requestId id of the request to be updated
|
|
163
|
+
* (optional)
|
|
164
|
+
* @param quantity the new quantity of the request
|
|
165
|
+
* (optional)
|
|
166
|
+
* @returns observable that emits when the updated csa-request
|
|
167
|
+
*/
|
|
168
|
+
updateCSARequestQuantity(csaRequestId: string, quantity: number): Observable<CSARequest>;
|
|
169
|
+
/**
|
|
170
|
+
* Load the requested CSA-requests from the server.
|
|
171
|
+
*
|
|
172
|
+
* @param csaRequestId the partium-ids of the CSA-request to fetch
|
|
173
|
+
*/
|
|
174
|
+
private loadCSARequestFromServer;
|
|
175
|
+
/**
|
|
176
|
+
* Ensure that fore every available text-search-type we send a value or ''. This is required to distinguish on the
|
|
177
|
+
* backend-side, whether an smms-search was performed or not.
|
|
178
|
+
*/
|
|
179
|
+
private prepareSearchQueriesObj;
|
|
180
|
+
}
|
|
181
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function s(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(s.prototype=r.prototype,new s)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},__assign.apply(this,arguments)},__decorate=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,s);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n<3?i(o):n>3?i(t,r,o):i(t,r))||o);return n>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CustomerServiceAssistanceServiceImpl=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),core_1=require("../../core"),injection_identifier_1=require("../../core/decorators/injection-identifier"),https_service_interface_1=require("../../core/services/http/https.service.interface"),text_search_service_1=require("../../find/services/search/text-search.service"),csa_request_1=require("../models/csa-request"),csa_request_status_1=require("../models/csa-request-status"),multiple_expert_searches_1=require("../models/multiple-expert-searches"),general_helper_1=require("../../core/utils/general-helper"),assembly_hierarchy_nodes_service_1=require("./assembly-hierarchy-nodes.service"),csa_helper_service_1=require("./csa-helper.service"),CustomerServiceAssistanceServiceImpl=function(e){function t(t){var r=e.call(this,t)||this;return r.MAX_RESULT_LIST_LENGTH=10,r}return __extends(t,e),t.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(https_service_interface_1.HttpsService),this.csaHelperService=this.serviceProvider.getService(csa_helper_service_1.CSAHelperService),this.assemblyHierarchyNodeService=this.serviceProvider.getService(assembly_hierarchy_nodes_service_1.AssemblyHierarchyNodesServiceImpl),this.logService=this.serviceProvider.getService(core_1.LogServiceImpl)},t.prototype.init=function(t,r,s){return e.prototype.init.call(this,t,r,s),(0,rxjs_1.of)(void 0)},t.prototype.sendCSARequest=function(e,t,r,s,i,n){return void 0===i&&(i=[]),this.sendRequestInternal(t,s,e,i,r,n)},t.prototype.resolveCSARequest=function(e,t){return this.httpsService.post("requests/".concat(e,"/actions/resolve/"),{confirmed_part:t},null,https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(e){return new csa_request_status_1.CSARequestStatus(__assign({confirmedPart:e.confirmed_part},e))})))},t.prototype.sendRequestInternal=function(e,t,r,s,i,n){var o,a,c=this,u=!!i,_=u&&(null===(o=i.searchInput)||void 0===o?void 0:o.hierarchyFilters)?this.assemblyHierarchyNodeService.getAssemblyHierarchyNodes(null===(a=i.searchInput)||void 0===a?void 0:a.hierarchyFilters):(0,rxjs_1.of)([]);return(0,rxjs_1.forkJoin)([this.currentOrganization$.pipe((0,operators_1.take)(1)),_]).pipe((0,operators_1.mergeMap)((function(o){var a,_,p,l,d=o[0],v=o[1];if(!(null===(a=d.featureFlags)||void 0===a?void 0:a.ecrEnabled))return(0,rxjs_1.throwError)(new core_1.SdkError(core_1.SDK_ERROR_CODES.USER_UNAUTHORIZED,null,"Customer Service Assistance is disabled for this organization."));var h=u?c.prepareSearchQueriesObj(i.searchInput.searchQueries):null,S=u?d.featureFlags.hybridTextSearchEnabled:null,f=u?__assign(__assign(__assign({searchSessionId:null===(_=null==i?void 0:i.searchInput)||void 0===_?void 0:_.searchSessionId},S&&{textQuery:null==h?void 0:h.semanticText}),!S&&{textQueries:h}),{queryImageAssetId:null===(p=null==i?void 0:i.searchInput)||void 0===p?void 0:p.searchImageAssetId,attributeFilters:null===(l=null==i?void 0:i.searchInput)||void 0===l?void 0:l.attributeFilters,resultList:null==i?void 0:i.searchResults}):{};return c.sendBackendRequest(__assign({language:e,part:t,additionalAssets:s,nodes:v,organizationId:d.partiumId,userInput:r},f)).pipe((0,operators_1.tap)((function(o){var a,u=s&&s.length>0?s.map((function(e){return e.referenceId})):s;c.logService.logEvent(new core_1.EventLog({version:core_1.EVENTLOG_VERSIONS.V_2_0_0,organizationId:d.partiumId,interface:(null==n?void 0:n.eventInterface)||core_1.INTERFACE.API_ACCESS,event:core_1.EVENT.ECR_FORM_SUBMIT,data:{partiumId:null==t?void 0:t.partiumId,searchSessionId:null===(a=null==i?void 0:i.searchInput)||void 0===a?void 0:a.searchSessionId,ecrType:t?core_1.ECR_TYPE.ASK_FOR_CONFIRMATION:core_1.ECR_TYPE.ASK_FOR_HELP,expertRequestId:o.request_id,userInput:r,languageUi:null==n?void 0:n.languageUi,languageSearch:e,mediaAssets:u}})).subscribe((function(){}),(function(e){console.log("Error while sending log event: ",e)}))})))})))},t.prototype.createLogEventRequestContent=function(e,t,r,s,i){return void 0===s&&(s=[]),{requestId:e,language:t,mediaAssets:s.map((function(e){return e.referenceId})),userInput:r,partPartiumId:i?i.partiumId:void 0}},t.prototype.sendBackendRequest=function(e){var t=e.organizationId,r=e.language,s=e.part,i=e.userInput,n=e.additionalAssets,o=void 0===n?[]:n,a=e.searchSessionId,c=void 0===a?null:a,u=e.nodes,_=void 0===u?[]:u,p=e.attributeFilters,l=void 0===p?{}:p,d=e.textQuery,v=void 0===d?null:d,h=e.textQueries,S=void 0===h?null:h,f=e.queryImageAssetId,E=void 0===f?null:f,g=e.resultList,m=void 0===g?[]:g;return this.httpsService.post("requests/",{session_id:c||null,organization_id:t,language:r,request_data:this.createRequestData(s,r,_,l,v,S,E,m,o,i)},null,https_service_interface_1.BACKEND_SERVICE.CSA)},t.prototype.createRequestData=function(e,t,r,s,i,n,o,a,c,u){var _,p=((_={})[text_search_service_1.TEXT_SEARCH_TYPE.SEMANTIC]="semantic_text",_[text_search_service_1.TEXT_SEARCH_TYPE.EXACT]="exact_text",_);return __assign(__assign(__assign(__assign(__assign(__assign({},e?{part:{part_id:e.partiumId,part_external_id:e.externalId,part_name:e.name.getText(t)||""}}:{}),{assemblies:r.map((function(e){return{assembly_id:e.partiumId,assembly_external_id:e.externalId,assembly_name:e.name.getText(t),breadcrumbs:e.breadcrumbs.map((function(e){return e.name.getText(t)}))}})),hard_filters:Object.keys(s).map((function(e){return{label:e,values:s[e]}}))}),i||""===i?{text_query:i}:{}),n?{text_search:Object.keys(text_search_service_1.TEXT_SEARCH_TYPE).reduce((function(e,t){var r;return __assign(__assign({},e),((r={})[p[text_search_service_1.TEXT_SEARCH_TYPE[t]]]=n[text_search_service_1.TEXT_SEARCH_TYPE[t]]||"",r))}),{})}:{}),o?{query_image_asset:o}:{}),{result_list:(a||[]).map((function(e){return{part_id:e.partiumId,part_external_id:e.externalId,part_name:e.name.getText(t)||""}})).slice(0,this.MAX_RESULT_LIST_LENGTH),media_assets:c.map((function(e){return e.referenceId})),user_input:u})},t.prototype.getHierarchyFilterNodesForUI=function(){return this.csaHelperService.getHierarchyFilterNodesForUI()},t.prototype.getCSARequests=function(e,t){return void 0===e&&(e=25),void 0===t&&(t=[]),core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(csa_request_1.CSARequest.fromAPIResponse,this.httpsService,"requests",https_service_interface_1.BACKEND_SERVICE.CSA,t,e)},t.prototype.getMultipleExpertSearches=function(e){return this.httpsService.get("requests/".concat(e,"/expert-searches"),[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(e){return multiple_expert_searches_1.MultipleExpertSearches.fromAPIResponse(e)})))},t.prototype.setExpertSearchAbandoned=function(e,t,r){return void 0===r&&(r=!0),this.httpsService.put("requests/".concat(e,"/expert-searches/").concat(t,"/abandoned"),{abandoned:r},null,https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(e){return(0,general_helper_1.snakeToCamelCase)(e)})))},t.prototype.associateExpertSearchToCsaRequest=function(e,t){return this.httpsService.post("requests/".concat(e,"/expert-searches"),{search_session_id:t},null,https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(e){return(0,general_helper_1.snakeToCamelCase)(e)})))},t.prototype.getCSARequest=function(e){return this.loadCSARequestFromServer(e).pipe((0,operators_1.catchError)((function(e){return console.log("Error while loading csa-request-information from server.",e),(0,rxjs_1.throwError)(e)})))},t.prototype.openCSARequest=function(e){return this.httpsService.post("requests/".concat(e,"/actions/open"),{},null,https_service_interface_1.BACKEND_SERVICE.CSA)},t.prototype.markNotResolvedCSARequest=function(e){return this.httpsService.post("requests/".concat(e,"/actions/not-resolve"),{},null,https_service_interface_1.BACKEND_SERVICE.CSA)},t.prototype.updateCSARequestQuantity=function(e,t){return this.httpsService.put("requests/".concat(e,"/quantity/"),{quantity:t},[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(e){return csa_request_1.CSARequest.fromAPIResponse(e)})))},t.prototype.loadCSARequestFromServer=function(e){return this.httpsService.get("requests/".concat(e),[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(e){return csa_request_1.CSARequest.fromAPIResponse(e)})))},t.prototype.prepareSearchQueriesObj=function(e){return e=e||{},Object.keys(text_search_service_1.TEXT_SEARCH_TYPE).reduce((function(t,r){var s;return __assign(__assign({},t),((s={})[text_search_service_1.TEXT_SEARCH_TYPE[r]]=e[text_search_service_1.TEXT_SEARCH_TYPE[r]]||"",s))}),{})},t=__decorate([(0,injection_identifier_1.InjectionIdentifier)("CustomerServiceAssistanceService")],t)}(core_1.BaseLoginInitService);exports.CustomerServiceAssistanceServiceImpl=CustomerServiceAssistanceServiceImpl;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { BaseService, PaginatedRequestService, ServiceProvider } from '../../core';
|
|
4
|
+
import { FilterKey } from '../models/filter-key';
|
|
5
|
+
import { FilterOptionValue } from '../models/filter-option-value';
|
|
6
|
+
import { HierarchyPartiumIdFilter, KvpHardFilter } from '../../find/models/search-filter';
|
|
7
|
+
export interface FilterService {
|
|
8
|
+
/**
|
|
9
|
+
* Retrieves a filter key for a certain filter-id.
|
|
10
|
+
*
|
|
11
|
+
* @param filterKeyPartiumId the filterKeyPartiumId of the FilterKey.
|
|
12
|
+
* @returns observable that emits with a FilterKey object.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
getFilterKey(filterKeyPartiumId: string): Observable<FilterKey>;
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves all filter keys for a certain language.
|
|
18
|
+
*
|
|
19
|
+
* @param language (optional) language for which the filter keys should be
|
|
20
|
+
* @param pageSize (optional) the amount of items in a page
|
|
21
|
+
* @param cursorPaginationEnabled if true, the data will be fetched using the cursor as a paginator and return a string with the next and previous pages
|
|
22
|
+
* retrieved for (if not provided default organization language will be used)
|
|
23
|
+
* Language is expected to be a two-letter string, according to
|
|
24
|
+
* ISO 639-1 (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
|
|
25
|
+
* @returns observable that emits with a Service of type PaginatedRequestService.
|
|
26
|
+
* This service can be used to retrieve a paginated list of the
|
|
27
|
+
* requested filter keys.
|
|
28
|
+
*/
|
|
29
|
+
getFilterKeys(language?: string, pageSize?: number, cursorPaginationEnabled?: boolean): PaginatedRequestService<FilterKey>;
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves all filter options for the provided filter key partiumId.
|
|
32
|
+
*
|
|
33
|
+
* @param filterKeyPartiumId the partiumId of the FilterKey
|
|
34
|
+
* @param cursorPaginationEnabled if true, the data will be fetched using the cursor as a paginator and return a string with the next and previous pages
|
|
35
|
+
* @returns observable that emits with a Service of type PaginatedRequestService.
|
|
36
|
+
* This service can be used to retrieve a paginated list of the
|
|
37
|
+
* requested filter options.
|
|
38
|
+
*/
|
|
39
|
+
getFilterOptions(filterKeyPartiumId: string, cursorPaginationEnabled?: boolean): PaginatedRequestService<FilterOptionValue>;
|
|
40
|
+
/**
|
|
41
|
+
* Search for filter keys by the given text query.
|
|
42
|
+
*
|
|
43
|
+
* @param query the text query to search for
|
|
44
|
+
* @param language (optional) language field the query should be searched in
|
|
45
|
+
* (if not provided default organization language will be used)
|
|
46
|
+
* Language is expected to be a two-letter string, according to
|
|
47
|
+
* ISO 639-1 (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
|
|
48
|
+
* @param pageSize the amount of items per page
|
|
49
|
+
* @param cursorPaginationEnabled if true, the data will be fetched using the cursor as a paginator and return a string with the next and previous pages
|
|
50
|
+
* @returns observable that emits with a Service of type PaginatedRequestService.
|
|
51
|
+
* This service can be used to retrieve a paginated list of the
|
|
52
|
+
* requested filter keys.
|
|
53
|
+
*/
|
|
54
|
+
searchFilterKeys(query: string, language?: string, pageSize?: number, cursorPaginationEnabled?: boolean): PaginatedRequestService<FilterKey>;
|
|
55
|
+
/**
|
|
56
|
+
* Search for multiple filter keys by the given text query.
|
|
57
|
+
*
|
|
58
|
+
* @param filters filters that contain the search queries and values
|
|
59
|
+
* @param language (optional) language field the query should be searched in
|
|
60
|
+
* (if not provided default organization language will be used)
|
|
61
|
+
* Language is expected to be a two-letter string, according to
|
|
62
|
+
* ISO 639-1 (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
|
|
63
|
+
*
|
|
64
|
+
* @param pageSize the amount of items per page
|
|
65
|
+
* @returns observable that emits with a Service of type PaginatedRequestService.
|
|
66
|
+
* This service can be used to retrieve a paginated list of the
|
|
67
|
+
* requested filter keys.
|
|
68
|
+
*/
|
|
69
|
+
searchMultipleFilterKeys(filters: {
|
|
70
|
+
[filterKey: string]: KvpHardFilter[] | HierarchyPartiumIdFilter[];
|
|
71
|
+
}, language?: string, pageSize?: number): Observable<FilterKey[]>;
|
|
72
|
+
/**
|
|
73
|
+
* Search for filter options by the given filter-key's partiumId and text query.
|
|
74
|
+
*
|
|
75
|
+
* @param filterKeyPartiumId the partiumId of the FilterKey
|
|
76
|
+
* @param query the text query to search for
|
|
77
|
+
* @param cursorPaginationEnabled if true, the data will be fetched using the cursor as a paginator and return a string with the next and previous pages
|
|
78
|
+
* @returns observable that emits with a Service of type PaginatedRequestService.
|
|
79
|
+
* This service can be used to retrieve a paginated list of the
|
|
80
|
+
* requested filter values.
|
|
81
|
+
*/
|
|
82
|
+
searchFilterOptions(filterKeyPartiumId: string, query: string, cursorPaginationEnabled?: boolean): PaginatedRequestService<FilterOptionValue>;
|
|
83
|
+
}
|
|
84
|
+
export declare class FilterServiceImpl extends BaseService implements FilterService {
|
|
85
|
+
private PAGINATION_PAGE_SIZE;
|
|
86
|
+
private httpsService;
|
|
87
|
+
constructor(serviceProvider: ServiceProvider);
|
|
88
|
+
onCreate(): void;
|
|
89
|
+
getFilterKey(filterKeyPartiumId: string): Observable<FilterKey>;
|
|
90
|
+
getFilterKeys(language?: string, pageSize?: number, cursorPaginationEnabled?: boolean): PaginatedRequestService<FilterKey>;
|
|
91
|
+
getFilterOptions(filterKeyPartiumId: string, cursorPaginationEnabled?: boolean): PaginatedRequestService<FilterOptionValue>;
|
|
92
|
+
searchFilterKeys(query: string, language?: string, pageSize?: number, cursorPaginationEnabled?: boolean): PaginatedRequestService<FilterKey>;
|
|
93
|
+
searchMultipleFilterKeys(filters: {
|
|
94
|
+
[filterKey: string]: KvpHardFilter[] | HierarchyPartiumIdFilter[];
|
|
95
|
+
}, language?: string, pageSize?: number): Observable<FilterKey[]>;
|
|
96
|
+
searchFilterOptions(filterKeyPartiumId: string, query: string, cursorPaginationEnabled?: boolean): PaginatedRequestService<FilterOptionValue>;
|
|
97
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),__decorate=this&&this.__decorate||function(e,t,r,o){var i,n=arguments.length,c=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(c=(n<3?i(c):n>3?i(t,r,c):i(t,r))||c);return n>3&&c&&Object.defineProperty(t,r,c),c},__spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var o,i=0,n=t.length;i<n;i++)!o&&i in t||(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return e.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.FilterServiceImpl=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),core_1=require("../../core"),filter_key_1=require("../models/filter-key"),filter_option_value_1=require("../models/filter-option-value"),FilterServiceImpl=function(e){function t(t){var r=e.call(this,t)||this;return r.PAGINATION_PAGE_SIZE=25,r}return __extends(t,e),t.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(core_1.HttpsService)},t.prototype.getFilterKey=function(e){return this.httpsService.get("filters/".concat(e),[],core_1.BACKEND_SERVICE.DATA).pipe((0,operators_1.map)((function(e){return filter_key_1.FilterKey.fromAPIResponse(e)})))},t.prototype.getFilterKeys=function(e,t,r){return void 0===t&&(t=this.PAGINATION_PAGE_SIZE),core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(filter_key_1.FilterKey.fromAPIResponse,this.httpsService,"filters",core_1.BACKEND_SERVICE.DATA,__spreadArray([],e?[{lang:e}]:[],!0),t,r)},t.prototype.getFilterOptions=function(e,t){return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(filter_option_value_1.FilterOptionValue.fromAPIResponse,this.httpsService,"filters/".concat(e,"/options"),core_1.BACKEND_SERVICE.DATA,[],this.PAGINATION_PAGE_SIZE,t)},t.prototype.searchFilterKeys=function(e,t,r,o){return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(filter_key_1.FilterKey.fromAPIResponse,this.httpsService,"filters",core_1.BACKEND_SERVICE.DATA,__spreadArray([{search:e}],t?[{lang:t}]:[],!0),r||this.PAGINATION_PAGE_SIZE,o)},t.prototype.searchMultipleFilterKeys=function(e,t,r){var o=this;void 0===r&&(r=25);var i=[];for(var n in e)"hardFilters"===n&&i.push.apply(i,e[n].map((function(e){return e.label})));return 0===i.length?(0,rxjs_1.of)([]):(0,rxjs_1.from)(i).pipe((0,operators_1.mergeMap)((function(e){return o.searchFilterKeys(e,t,r,!0).loadInitialPage(!0).pipe((0,operators_1.map)((function(t){return t.items.find((function(t){return t.name===e}))})))})),(0,operators_1.scan)((function(e,t){return e.concat(t)}),[]))},t.prototype.searchFilterOptions=function(e,t,r){return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(filter_option_value_1.FilterOptionValue.fromAPIResponse,this.httpsService,"filters/".concat(e,"/options"),core_1.BACKEND_SERVICE.DATA,[{search:t}],this.PAGINATION_PAGE_SIZE,r)},t=__decorate([(0,core_1.InjectionIdentifier)("FilterService")],t)}(core_1.BaseService);exports.FilterServiceImpl=FilterServiceImpl;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { ServiceProvider } from '../../core';
|
|
3
|
+
import { BaseService } from '../../core/services/base.service';
|
|
4
|
+
import { PaginatedRequestService } from '../../core/services/paginated-request.service';
|
|
5
|
+
import { INQUIRY_STATUS, Inquiry, InquiryStatusResponse } from '../models/inquiry';
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
export interface InquiryService {
|
|
8
|
+
/**
|
|
9
|
+
* Fetch an array of inquiries
|
|
10
|
+
*
|
|
11
|
+
* @param paginationSize the size of the pagination
|
|
12
|
+
* @param urlParams the size of the pagination
|
|
13
|
+
* @returns Array of inquiries
|
|
14
|
+
*/
|
|
15
|
+
getInquiries(paginationSize?: number, urlParams?: Array<Object>): PaginatedRequestService<Inquiry>;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new inquiry
|
|
18
|
+
*
|
|
19
|
+
* @returns the new inquiry
|
|
20
|
+
*/
|
|
21
|
+
createInquiry(): Observable<Inquiry>;
|
|
22
|
+
/**
|
|
23
|
+
* Fetch an existing inquiry
|
|
24
|
+
* @param inquiryId id of the inquiry to load
|
|
25
|
+
* @returns the requested inquiry as an observable
|
|
26
|
+
*/
|
|
27
|
+
getInquiry(inquiryId: string): Observable<Inquiry>;
|
|
28
|
+
/**
|
|
29
|
+
* Update the state of an existing inquiry
|
|
30
|
+
* @param inquiryId id of the inquiry to update
|
|
31
|
+
* @param status new status of the inquiry
|
|
32
|
+
* @returns the requested inquiry status with the timestamp as an observable
|
|
33
|
+
*/
|
|
34
|
+
updateInquiryStatus(inquiryId: string, status: INQUIRY_STATUS): Observable<InquiryStatusResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Exports the shopping cart of an inquiry as an email
|
|
37
|
+
* @param inquiryId id of the inquiry to export
|
|
38
|
+
* @param recipients comma separated list of recipients
|
|
39
|
+
* @param subject subject of the email
|
|
40
|
+
* @param message message of the email
|
|
41
|
+
* @return an observable that completes when the email is sent
|
|
42
|
+
*/
|
|
43
|
+
exportInquiryAsEmail(inquiryId: string, recipients: string, subject: string, message: string): Observable<void>;
|
|
44
|
+
}
|
|
45
|
+
export declare class InquiryServiceImpl extends BaseService implements InquiryService {
|
|
46
|
+
private httpsService;
|
|
47
|
+
constructor(serviceProvider: ServiceProvider);
|
|
48
|
+
onCreate(): void;
|
|
49
|
+
getInquiries(paginationSize?: number, urlParams?: any[]): PaginatedRequestService<Inquiry>;
|
|
50
|
+
getInquiry(inquiryId: string): Observable<Inquiry>;
|
|
51
|
+
createInquiry(): Observable<Inquiry>;
|
|
52
|
+
updateInquiryStatus(inquiryId: string, status: INQUIRY_STATUS): Observable<InquiryStatusResponse>;
|
|
53
|
+
exportInquiryAsEmail(inquiryId: string, recipients: string, subject: string, message: string): Observable<void>;
|
|
54
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),__decorate=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s};Object.defineProperty(exports,"__esModule",{value:!0}),exports.InquiryServiceImpl=void 0;var operators_1=require("rxjs/operators"),core_1=require("../../core"),injection_identifier_1=require("../../core/decorators/injection-identifier"),base_service_1=require("../../core/services/base.service"),https_service_interface_1=require("../../core/services/http/https.service.interface"),inquiry_1=require("../models/inquiry"),InquiryServiceImpl=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(https_service_interface_1.HttpsService)},t.prototype.getInquiries=function(e,t){return void 0===e&&(e=25),void 0===t&&(t=[]),core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(inquiry_1.Inquiry.fromAPIResponse,this.httpsService,"inquiries",https_service_interface_1.BACKEND_SERVICE.CSA,t,e)},t.prototype.getInquiry=function(e){return this.httpsService.get("inquiries/".concat(e),[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(e){return inquiry_1.Inquiry.fromAPIResponse(e)})))},t.prototype.createInquiry=function(){return this.httpsService.post("inquiries/",{},[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(e){return inquiry_1.Inquiry.fromAPIResponse(e)})))},t.prototype.updateInquiryStatus=function(e,t){return this.httpsService.put("inquiries/".concat(e,"/status"),{status:t},[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(e){return new inquiry_1.InquiryStatusResponse(e)})))},t.prototype.exportInquiryAsEmail=function(e,t,r,i){return this.httpsService.post("inquiries/".concat(e,"/actions/email"),{recipients:t,subject:r,message:i},[],https_service_interface_1.BACKEND_SERVICE.CSA)},t=__decorate([(0,injection_identifier_1.InjectionIdentifier)("InquiryService")],t)}(base_service_1.BaseService);exports.InquiryServiceImpl=InquiryServiceImpl;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
import { BaseLoginInitService, ServiceProvider } from "../../core";
|
|
4
|
+
import { Attribute } from "../models/attribute";
|
|
5
|
+
/**
|
|
6
|
+
* Service for getting part attributes.
|
|
7
|
+
*
|
|
8
|
+
* @deprecated The operations of this service are not supported anymore and will be removed in the future. No replacement is planned.
|
|
9
|
+
*/
|
|
10
|
+
export interface PartAttributeService {
|
|
11
|
+
/**
|
|
12
|
+
* Will trigger loading the information of all requested parts from the backend.
|
|
13
|
+
*
|
|
14
|
+
* @param partPartiumId part id for which to load the attributes
|
|
15
|
+
* @returns observable that emits when the requested part-attributes were loaded from the backend.
|
|
16
|
+
*
|
|
17
|
+
* @deprecated This function will not be supported anymore in the future. Use getPart method of PartService.
|
|
18
|
+
*/
|
|
19
|
+
getAttributesForPart(partPartiumId: string): Observable<Attribute[]>;
|
|
20
|
+
}
|
|
21
|
+
export declare class PartAttributeServiceImpl extends BaseLoginInitService implements PartAttributeService {
|
|
22
|
+
private DOWNLOAD_PAGE_SIZE;
|
|
23
|
+
private httpsService;
|
|
24
|
+
constructor(serviceProvider: ServiceProvider);
|
|
25
|
+
onCreate(): void;
|
|
26
|
+
getAttributesForPart(partPartiumId: string): Observable<Attribute[] | never>;
|
|
27
|
+
/**
|
|
28
|
+
* Load all attributes of a part from the server.
|
|
29
|
+
* Since the response is paginated, it is necessary to do as many request as needed until
|
|
30
|
+
* all attributes are loaded.
|
|
31
|
+
*
|
|
32
|
+
* @returns observable that emits when the requested attributes were loaded
|
|
33
|
+
*/
|
|
34
|
+
private loadPartAttributesFromServer;
|
|
35
|
+
/**
|
|
36
|
+
* Sent request for one page of attributes
|
|
37
|
+
*
|
|
38
|
+
* @returns partPartiumId id of the Part
|
|
39
|
+
* @param page the current page of the pagination (1-indexed)
|
|
40
|
+
*/
|
|
41
|
+
private requestPaginatedAttributes;
|
|
42
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])},t(r,e)};return function(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}(),__decorate=this&&this.__decorate||function(t,r,e,o){var n,i=arguments.length,a=i<3?r:null===o?o=Object.getOwnPropertyDescriptor(r,e):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,r,e,o);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(a=(i<3?n(a):i>3?n(r,e,a):n(r,e))||a);return i>3&&a&&Object.defineProperty(r,e,a),a},__spreadArray=this&&this.__spreadArray||function(t,r,e){if(e||2===arguments.length)for(var o,n=0,i=r.length;n<i;n++)!o&&n in r||(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return t.concat(o||Array.prototype.slice.call(r))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PartAttributeServiceImpl=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),core_1=require("../../core"),attribute_1=require("../models/attribute"),part_1=require("../models/part"),PartAttributeServiceImpl=function(t){function r(r){var e=t.call(this,r)||this;return e.DOWNLOAD_PAGE_SIZE=250,e}return __extends(r,t),r.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(core_1.HttpsService)},r.prototype.getAttributesForPart=function(t){return this.loadPartAttributesFromServer(t).pipe((0,operators_1.catchError)((function(t){return console.log("Error while loading part-information from server.",t),(0,rxjs_1.throwError)(t)})))},r.prototype.loadPartAttributesFromServer=function(t){var r=this,e=1,o=new rxjs_1.Subject;return(0,rxjs_1.defer)((function(){return r.requestPaginatedAttributes(t,e)})).pipe((0,operators_1.map)((function(t){var r=t.pagination.page_size,n=t.pagination.items_count,i=Math.ceil(n/r);return e>=i?o.complete():e++<i&&setTimeout((function(){o.next()})),t.results})),(0,operators_1.repeatWhen)((function(){return o.asObservable()})),(0,operators_1.reduce)((function(t,r){return __spreadArray(__spreadArray([],t,!0),r,!0)})),(0,operators_1.map)((function(t){return t.filter((function(t){var r=t.metadata&&t.metadata.source;return!r||!["__HITL_ANNOTATIONS__","__ENRICHED_METADATA__"].some((function(t){return t===r}))})).map((function(t){return attribute_1.Attribute.fromAPIResponse(t,part_1.DATA_ORIGIN.DATA_API)}))})))},r.prototype.requestPaginatedAttributes=function(t,r){return this.httpsService.get("/part_types/".concat(t,"/attributes"),[{page:r},{page_size:this.DOWNLOAD_PAGE_SIZE}],core_1.BACKEND_SERVICE.DATA)},r=__decorate([(0,core_1.InjectionIdentifier)("PartAttributeService")],r)}(core_1.BaseLoginInitService);exports.PartAttributeServiceImpl=PartAttributeServiceImpl;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { BaseService, ServiceProvider } from '../../core';
|
|
4
|
+
import { PartEnrichmentData } from '../models/part-enrichment-data';
|
|
5
|
+
/**
|
|
6
|
+
* Service for enriching parts metadata.
|
|
7
|
+
*/
|
|
8
|
+
export interface PartEnrichmentService {
|
|
9
|
+
/**
|
|
10
|
+
* Start Metadata-Enrichment for part.
|
|
11
|
+
* Will resolve, once the enrichment is started succesfully.
|
|
12
|
+
* Will throw an error, if starting the enrichment fails, e.g. if the part has no UPIs.
|
|
13
|
+
*
|
|
14
|
+
* @param partiumPartId partiumId of the part to enrich
|
|
15
|
+
*/
|
|
16
|
+
enrichPart(partiumPartId: string): Observable<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Get the enrichment-status of a part.
|
|
19
|
+
* This function can be used repetitively after triggering the part-enrichment to poll for the current status of the enrichment.
|
|
20
|
+
* Enrichment will usually take a few minutes, but can also last up to 30 minutes or more.
|
|
21
|
+
*
|
|
22
|
+
* @param partiumPartId partiumId of the part to get the enrichment-status for
|
|
23
|
+
*/
|
|
24
|
+
getEnrichedData(partiumPartId: string): Observable<PartEnrichmentData>;
|
|
25
|
+
}
|
|
26
|
+
export declare class PartEnrichmentServiceImpl extends BaseService implements PartEnrichmentService {
|
|
27
|
+
private httpsService;
|
|
28
|
+
constructor(serviceProvider: ServiceProvider);
|
|
29
|
+
onCreate(): void;
|
|
30
|
+
enrichPart(partiumPartId: string): Observable<void>;
|
|
31
|
+
getEnrichedData(partiumPartId: string): Observable<PartEnrichmentData>;
|
|
32
|
+
}
|