@partium/js-sdk 14.0.3 → 14.2.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/catalog/index.js +21 -1
- package/catalog/models/catalog-image-info.js +22 -1
- package/catalog/models/catalog-image.js +40 -1
- package/catalog/models/upsert-catalog-images-dto.js +3 -1
- package/catalog/models/upsert-images-result.js +3 -1
- package/catalog/services/images.service.js +62 -1
- package/core/constants/constants.js +16 -1
- package/core/decorators/injection-identifier.js +19 -1
- package/core/factories/paginated-request-service.factory.js +33 -1
- package/core/index.js +63 -1
- package/core/integration-defaults/http/fetch-api-http-error-helper.js +129 -1
- package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.js +138 -1
- package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.js +210 -1
- package/core/integration-defaults/http/handle-axios-error-helper.js +79 -1
- package/core/integration-defaults/http/https-client/axios-https-client.service.js +182 -1
- package/core/integration-defaults/http/https-client/fetch-api-https-client.service.js +198 -1
- package/core/integration-defaults/http/js-oauth-keycloak-https.service.js +32 -1
- package/core/integration-defaults/js-p-file.js +36 -1
- package/core/integration-defaults/session/js-oauth-api-key-session.service.js +206 -1
- package/core/integration-defaults/session/js-oauth-keycloak-auth-config.js +64 -1
- package/core/integration-defaults/session/js-oauth-keycloak-session.service.js +257 -1
- package/core/integration-defaults/web-device-status.service.js +125 -1
- package/core/integration-defaults/web-file.service.js +135 -1
- package/core/integration-defaults/web-indexeddb.service.js +142 -1
- package/core/integration-defaults/web-local-storage.service.js +310 -1
- package/core/models/api-object.js +16 -1
- package/core/models/auth-config.js +72 -1
- package/core/models/device-info.js +34 -1
- package/core/models/error.js +107 -1
- package/core/models/formatted-string.js +14 -1
- package/core/models/i18n-map.js +61 -1
- package/core/models/i18n-string.js +35 -1
- package/core/models/log.js +137 -1
- package/core/models/organization.js +159 -1
- package/core/models/p-file.js +23 -1
- package/core/models/paginated-list.js +41 -1
- package/core/models/partium-config.js +43 -1
- package/core/models/user-token.js +11 -1
- package/core/models/user.d.ts +2 -1
- package/core/models/user.js +89 -1
- package/core/services/backend-status.service.js +147 -1
- package/core/services/base-login-init.service.js +57 -1
- package/core/services/base.service.js +37 -1
- package/core/services/device-status.service.interface.js +117 -1
- package/core/services/file.service.interface.js +61 -1
- package/core/services/http/file-transfer/file-transfer.service.interface.js +125 -1
- package/core/services/http/https-client/https-client.service.interface.js +152 -1
- package/core/services/http/https.service.interface.js +294 -1
- package/core/services/http/oauth-https.service.js +218 -1
- package/core/services/local-storage.service.interface.js +378 -1
- package/core/services/log.service.js +139 -1
- package/core/services/organization.service.js +202 -1
- package/core/services/paginated-request.service.js +160 -1
- package/core/services/recent-parts.service.js +194 -1
- package/core/services/service-provider.js +114 -1
- package/core/services/session/oauth-session.service.js +104 -1
- package/core/services/session/session.service.interface.js +367 -1
- package/core/utils/general-helper.js +110 -1
- package/data/index.js +44 -1
- package/data/models/announcement.js +70 -1
- package/data/models/assembly-hierarchy-node-breadcrumb.js +51 -1
- package/data/models/assembly-hierarchy-node.js +46 -1
- package/data/models/attribute.js +106 -1
- package/data/models/csa-request-search.js +46 -1
- package/data/models/csa-request-status.js +51 -1
- package/data/models/csa-request.js +112 -1
- package/data/models/document.js +17 -1
- package/data/models/filter-key.js +36 -1
- package/data/models/filter-option-value.js +41 -1
- package/data/models/image.d.ts +3 -1
- package/data/models/image.js +77 -1
- package/data/models/inquiry.js +71 -1
- package/data/models/mounting-location.js +58 -1
- package/data/models/multiple-expert-searches.js +40 -1
- package/data/models/part-enrichment-data.js +50 -1
- package/data/models/part.js +168 -1
- package/data/models/shopping-cart.js +60 -1
- package/data/services/announcement.service.js +89 -1
- package/data/services/assembly-hierarchy-nodes.service.js +193 -1
- package/data/services/csa-helper.service.js +158 -1
- package/data/services/customer-service-assistance.service.js +276 -1
- package/data/services/filter.service.js +97 -1
- package/data/services/inquiry.service.js +68 -1
- package/data/services/part-attribute.service.js +118 -1
- package/data/services/part-enrichment.service.js +56 -1
- package/data/services/part.service.js +182 -1
- package/data/services/related-parts.service.js +83 -1
- package/data/services/shopping-cart.service.js +152 -1
- package/find/index.js +51 -1
- package/find/models/assets/asset.js +32 -1
- package/find/models/search-filter.js +205 -1
- package/find/models/search-input.js +3 -1
- package/find/models/search-output.js +3 -1
- package/find/models/search-result-status.js +40 -1
- package/find/models/search-session-log-object.js +22 -1
- package/find/models/search-status/cv-search-status.js +22 -1
- package/find/models/search-status/search-filter-status.js +36 -1
- package/find/models/search-status/search-status.js +56 -1
- package/find/models/search-status/tag-search-status.js +23 -1
- package/find/models/search-status/text-search-status.js +18 -1
- package/find/models/search-tag.js +16 -1
- package/find/models/smart-filter.js +49 -1
- package/find/models/tagable/i18n-tagable.js +37 -1
- package/find/models/tagable/tagable-base.js +22 -1
- package/find/models/tagable/tagable.js +37 -1
- package/find/models/text-search-config.js +70 -1
- package/find/models/text-search-manipulator.js +90 -1
- package/find/models/text-search-result-item/text-search-error.js +12 -1
- package/find/models/text-search-result-item/text-search-result-item-document.js +34 -1
- package/find/models/text-search-result-item/text-search-result-item-part.js +36 -1
- package/find/models/text-search-result-item/text-search-result-item-recent-query.js +35 -1
- package/find/models/text-search-result-item/text-search-result-item-unknown.js +38 -1
- package/find/models/text-search-result-item/text-search-result-item.js +22 -1
- package/find/services/asset.service.js +348 -1
- package/find/services/filter-uploaders/filter-uploader.js +3 -1
- package/find/services/filter-uploaders/update-filters-uploader.js +77 -1
- package/find/services/filter-uploaders/update-filters.model.js +7 -1
- package/find/services/search/cv-search.service.js +214 -1
- package/find/services/search/recent-text-search-queries.service.js +260 -1
- package/find/services/search/search-result.service.js +539 -1
- package/find/services/search/search.service.js +514 -1
- package/find/services/search/tag-search.service.js +124 -1
- package/find/services/search/text-search.service.js +316 -1
- package/find/services/search-filter.service.js +292 -1
- package/find/utils/search-helper.js +75 -1
- package/gen/sdk-version.d.ts +1 -1
- package/gen/sdk-version.js +5 -1
- package/index.js +392 -1
- package/management/index.js +21 -1
- package/management/models/api-key-list-response.js +3 -1
- package/management/models/api-key-type.js +9 -1
- package/management/models/api-key.js +3 -1
- package/management/services/api-key.service.js +53 -1
- package/ocr/index.js +20 -1
- package/ocr/models/detect-response.js +3 -1
- package/ocr/models/detected-text-entry.js +3 -1
- package/ocr/services/ocr.service.js +59 -1
- package/package.json +1 -1
- package/user-data/index.js +21 -1
- package/user-data/models/part-with-nullable.js +3 -1
- package/user-data/models/request-list/request-list.js +63 -1
- package/user-data/services/favorite/favorite.service.js +108 -1
- package/user-data/services/request-list/request-list.service.js +133 -1
|
@@ -1,2 +1,277 @@
|
|
|
1
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;
|
|
2
|
+
"use strict";
|
|
3
|
+
var __extends = (this && this.__extends) || (function () {
|
|
4
|
+
var extendStatics = function (d, b) {
|
|
5
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
8
|
+
return extendStatics(d, b);
|
|
9
|
+
};
|
|
10
|
+
return function (d, b) {
|
|
11
|
+
if (typeof b !== "function" && b !== null)
|
|
12
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13
|
+
extendStatics(d, b);
|
|
14
|
+
function __() { this.constructor = d; }
|
|
15
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
var __assign = (this && this.__assign) || function () {
|
|
19
|
+
__assign = Object.assign || function(t) {
|
|
20
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
21
|
+
s = arguments[i];
|
|
22
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
23
|
+
t[p] = s[p];
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
};
|
|
27
|
+
return __assign.apply(this, arguments);
|
|
28
|
+
};
|
|
29
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
30
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
31
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
32
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
33
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
34
|
+
};
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.CustomerServiceAssistanceServiceImpl = void 0;
|
|
37
|
+
var rxjs_1 = require("rxjs");
|
|
38
|
+
var operators_1 = require("rxjs/operators");
|
|
39
|
+
var core_1 = require("../../core");
|
|
40
|
+
var injection_identifier_1 = require("../../core/decorators/injection-identifier");
|
|
41
|
+
var https_service_interface_1 = require("../../core/services/http/https.service.interface");
|
|
42
|
+
var text_search_service_1 = require("../../find/services/search/text-search.service");
|
|
43
|
+
var csa_request_1 = require("../models/csa-request");
|
|
44
|
+
var csa_request_status_1 = require("../models/csa-request-status");
|
|
45
|
+
var multiple_expert_searches_1 = require("../models/multiple-expert-searches");
|
|
46
|
+
var general_helper_1 = require("../../core/utils/general-helper");
|
|
47
|
+
var assembly_hierarchy_nodes_service_1 = require("./assembly-hierarchy-nodes.service");
|
|
48
|
+
var csa_helper_service_1 = require("./csa-helper.service");
|
|
49
|
+
var CustomerServiceAssistanceServiceImpl = /** @class */ (function (_super) {
|
|
50
|
+
__extends(CustomerServiceAssistanceServiceImpl, _super);
|
|
51
|
+
function CustomerServiceAssistanceServiceImpl(serviceProvider) {
|
|
52
|
+
var _this = _super.call(this, serviceProvider) || this;
|
|
53
|
+
_this.MAX_RESULT_LIST_LENGTH = 10;
|
|
54
|
+
return _this;
|
|
55
|
+
}
|
|
56
|
+
CustomerServiceAssistanceServiceImpl.prototype.onCreate = function () {
|
|
57
|
+
this.httpsService = this.serviceProvider.getService(https_service_interface_1.HttpsService);
|
|
58
|
+
this.csaHelperService = this.serviceProvider.getService(csa_helper_service_1.CSAHelperService);
|
|
59
|
+
this.assemblyHierarchyNodeService = this.serviceProvider.getService(assembly_hierarchy_nodes_service_1.AssemblyHierarchyNodesServiceImpl);
|
|
60
|
+
this.logService = this.serviceProvider.getService(core_1.LogServiceImpl);
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Initializes the CustomerServiceAssistanceService
|
|
64
|
+
*
|
|
65
|
+
* Note: Should be called at the start of a session
|
|
66
|
+
*/
|
|
67
|
+
CustomerServiceAssistanceServiceImpl.prototype.init = function (config, userEmail, currentOrganization$) {
|
|
68
|
+
_super.prototype.init.call(this, config, userEmail, currentOrganization$);
|
|
69
|
+
return (0, rxjs_1.of)(undefined); // resolve
|
|
70
|
+
};
|
|
71
|
+
CustomerServiceAssistanceServiceImpl.prototype.sendCSARequest = function (message, language, searchOutput, part, additionalAssets, ecrEventContext) {
|
|
72
|
+
if (additionalAssets === void 0) { additionalAssets = []; }
|
|
73
|
+
return this.sendRequestInternal(language, part, message, additionalAssets, searchOutput, ecrEventContext);
|
|
74
|
+
};
|
|
75
|
+
CustomerServiceAssistanceServiceImpl.prototype.resolveCSARequest = function (csaRequestId, partId) {
|
|
76
|
+
return this.httpsService
|
|
77
|
+
.post("requests/".concat(csaRequestId, "/actions/resolve/"), {
|
|
78
|
+
confirmed_part: partId,
|
|
79
|
+
}, null, https_service_interface_1.BACKEND_SERVICE.CSA)
|
|
80
|
+
.pipe((0, operators_1.map)(function (csaRequestRawStatus) {
|
|
81
|
+
return new csa_request_status_1.CSARequestStatus(__assign({ confirmedPart: csaRequestRawStatus['confirmed_part'] }, csaRequestRawStatus));
|
|
82
|
+
}));
|
|
83
|
+
};
|
|
84
|
+
CustomerServiceAssistanceServiceImpl.prototype.sendRequestInternal = function (language, part, message, additionalAssets, searchOutput, ecrEventContext) {
|
|
85
|
+
var _this = this;
|
|
86
|
+
var _a, _b;
|
|
87
|
+
var includeSearchStatus = !!searchOutput;
|
|
88
|
+
var getHierarchyNodes$ = includeSearchStatus && ((_a = searchOutput.searchInput) === null || _a === void 0 ? void 0 : _a.hierarchyFilters) ?
|
|
89
|
+
this.assemblyHierarchyNodeService.getAssemblyHierarchyNodes((_b = searchOutput.searchInput) === null || _b === void 0 ? void 0 : _b.hierarchyFilters) :
|
|
90
|
+
(0, rxjs_1.of)([]);
|
|
91
|
+
return (0, rxjs_1.forkJoin)([this.currentOrganization$.pipe((0, operators_1.take)(1)), getHierarchyNodes$]).pipe((0, operators_1.mergeMap)(function (_a) {
|
|
92
|
+
var _b, _c, _d, _e;
|
|
93
|
+
var organization = _a[0], nodes = _a[1];
|
|
94
|
+
if (!((_b = organization.featureFlags) === null || _b === void 0 ? void 0 : _b.ecrEnabled)) {
|
|
95
|
+
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.'));
|
|
96
|
+
}
|
|
97
|
+
var queries = includeSearchStatus ? _this.prepareSearchQueriesObj(searchOutput.searchInput.searchQueries) : null;
|
|
98
|
+
var isHybrid = includeSearchStatus ? organization.featureFlags.hybridTextSearchEnabled : null;
|
|
99
|
+
//BE ERROR: Value error, text_search and text_query are not allowed to be both set
|
|
100
|
+
var searchStatusRequestData = includeSearchStatus
|
|
101
|
+
? __assign(__assign(__assign({ searchSessionId: (_c = searchOutput === null || searchOutput === void 0 ? void 0 : searchOutput.searchInput) === null || _c === void 0 ? void 0 : _c.searchSessionId }, (isHybrid && { textQuery: queries === null || queries === void 0 ? void 0 : queries.semanticText })), (!isHybrid && { textQueries: queries })), { queryImageAssetId: (_d = searchOutput === null || searchOutput === void 0 ? void 0 : searchOutput.searchInput) === null || _d === void 0 ? void 0 : _d.searchImageAssetId, attributeFilters: (_e = searchOutput === null || searchOutput === void 0 ? void 0 : searchOutput.searchInput) === null || _e === void 0 ? void 0 : _e.attributeFilters, resultList: searchOutput === null || searchOutput === void 0 ? void 0 : searchOutput.searchResults }) : {};
|
|
102
|
+
return _this.sendBackendRequest(__assign({ language: language, part: part, additionalAssets: additionalAssets, nodes: nodes, organizationId: organization.partiumId, userInput: message }, searchStatusRequestData)).pipe((0, operators_1.tap)(function (result) {
|
|
103
|
+
var _a;
|
|
104
|
+
// log csa request send event
|
|
105
|
+
var additionalAssetsStrings = additionalAssets && additionalAssets.length > 0
|
|
106
|
+
? additionalAssets.map(function (asset) { return asset.referenceId; })
|
|
107
|
+
: additionalAssets;
|
|
108
|
+
_this.logService
|
|
109
|
+
.logEvent(new core_1.EventLog({
|
|
110
|
+
version: core_1.EVENTLOG_VERSIONS.V_2_0_0,
|
|
111
|
+
organizationId: organization.partiumId,
|
|
112
|
+
interface: (ecrEventContext === null || ecrEventContext === void 0 ? void 0 : ecrEventContext.eventInterface) || core_1.INTERFACE.API_ACCESS,
|
|
113
|
+
event: core_1.EVENT.ECR_FORM_SUBMIT,
|
|
114
|
+
data: {
|
|
115
|
+
partiumId: part === null || part === void 0 ? void 0 : part.partiumId,
|
|
116
|
+
searchSessionId: (_a = searchOutput === null || searchOutput === void 0 ? void 0 : searchOutput.searchInput) === null || _a === void 0 ? void 0 : _a.searchSessionId,
|
|
117
|
+
ecrType: part ? core_1.ECR_TYPE.ASK_FOR_CONFIRMATION : core_1.ECR_TYPE.ASK_FOR_HELP,
|
|
118
|
+
expertRequestId: result['request_id'],
|
|
119
|
+
userInput: message,
|
|
120
|
+
languageUi: ecrEventContext === null || ecrEventContext === void 0 ? void 0 : ecrEventContext.languageUi,
|
|
121
|
+
languageSearch: language,
|
|
122
|
+
mediaAssets: additionalAssetsStrings,
|
|
123
|
+
},
|
|
124
|
+
}))
|
|
125
|
+
.subscribe(function () { }, function (error) {
|
|
126
|
+
console.log('Error while sending log event: ', error);
|
|
127
|
+
});
|
|
128
|
+
}));
|
|
129
|
+
}));
|
|
130
|
+
};
|
|
131
|
+
CustomerServiceAssistanceServiceImpl.prototype.createLogEventRequestContent = function (requestId, language, userInput, additionalAssets, part) {
|
|
132
|
+
if (additionalAssets === void 0) { additionalAssets = []; }
|
|
133
|
+
return {
|
|
134
|
+
requestId: requestId,
|
|
135
|
+
language: language,
|
|
136
|
+
mediaAssets: additionalAssets.map(function (asset) { return asset.referenceId; }),
|
|
137
|
+
userInput: userInput,
|
|
138
|
+
partPartiumId: part ? part.partiumId : undefined,
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
CustomerServiceAssistanceServiceImpl.prototype.sendBackendRequest = function (_a) {
|
|
142
|
+
var organizationId = _a.organizationId, language = _a.language, part = _a.part, userInput = _a.userInput, _b = _a.additionalAssets, additionalAssets = _b === void 0 ? [] : _b, _c = _a.searchSessionId, searchSessionId = _c === void 0 ? null : _c, _d = _a.nodes, nodes = _d === void 0 ? [] : _d, _e = _a.attributeFilters, attributeFilters = _e === void 0 ? {} : _e, _f = _a.textQuery, textQuery = _f === void 0 ? null : _f, _g = _a.textQueries, textQueries = _g === void 0 ? null : _g, _h = _a.queryImageAssetId, queryImageAssetId = _h === void 0 ? null : _h, _j = _a.resultList, resultList = _j === void 0 ? [] : _j;
|
|
143
|
+
return this.httpsService.post("requests/", {
|
|
144
|
+
session_id: searchSessionId || null,
|
|
145
|
+
organization_id: organizationId,
|
|
146
|
+
language: language,
|
|
147
|
+
request_data: this.createRequestData(part, language, nodes, attributeFilters, textQuery, textQueries, queryImageAssetId, resultList, additionalAssets, userInput),
|
|
148
|
+
}, null, https_service_interface_1.BACKEND_SERVICE.CSA);
|
|
149
|
+
};
|
|
150
|
+
CustomerServiceAssistanceServiceImpl.prototype.createRequestData = function (part, language, nodes, attributeFilters, textQuery, textQueries, queryImageAssetId, resultList, additionalAssets, userInput) {
|
|
151
|
+
var _a;
|
|
152
|
+
var TEXT_SEARCH_TYPE_PARAM_NAMES = (_a = {},
|
|
153
|
+
_a[text_search_service_1.TEXT_SEARCH_TYPE.SEMANTIC] = 'semantic_text',
|
|
154
|
+
_a[text_search_service_1.TEXT_SEARCH_TYPE.EXACT] = 'exact_text',
|
|
155
|
+
_a);
|
|
156
|
+
return __assign(__assign(__assign(__assign(__assign(__assign({}, (part
|
|
157
|
+
? {
|
|
158
|
+
part: {
|
|
159
|
+
part_id: part.partiumId,
|
|
160
|
+
part_external_id: part.externalId,
|
|
161
|
+
part_name: part.name.getText(language) || '',
|
|
162
|
+
},
|
|
163
|
+
}
|
|
164
|
+
: {})), { assemblies: nodes.map(function (node) {
|
|
165
|
+
return {
|
|
166
|
+
assembly_id: node.partiumId,
|
|
167
|
+
assembly_external_id: node.externalId,
|
|
168
|
+
assembly_name: node.name.getText(language),
|
|
169
|
+
breadcrumbs: node.breadcrumbs.map(function (breadcrumb) {
|
|
170
|
+
return breadcrumb.name.getText(language);
|
|
171
|
+
}),
|
|
172
|
+
};
|
|
173
|
+
}), hard_filters: Object.keys(attributeFilters).map(function (key) { return ({
|
|
174
|
+
label: key,
|
|
175
|
+
values: attributeFilters[key],
|
|
176
|
+
}); }) }), (!!textQuery || textQuery === '' // include text-query even if is empty-string
|
|
177
|
+
? { text_query: textQuery }
|
|
178
|
+
: {})), (!!textQueries
|
|
179
|
+
? {
|
|
180
|
+
text_search: Object.keys(text_search_service_1.TEXT_SEARCH_TYPE).reduce(function (obj, type) {
|
|
181
|
+
var _a;
|
|
182
|
+
return (__assign(__assign({}, obj), (_a = {}, _a[TEXT_SEARCH_TYPE_PARAM_NAMES[text_search_service_1.TEXT_SEARCH_TYPE[type]]] = textQueries[text_search_service_1.TEXT_SEARCH_TYPE[type]] || '', _a)));
|
|
183
|
+
}, {}),
|
|
184
|
+
}
|
|
185
|
+
: {})), (queryImageAssetId ? { query_image_asset: queryImageAssetId } : {})), { result_list: (resultList || [])
|
|
186
|
+
.map(function (part) {
|
|
187
|
+
return {
|
|
188
|
+
part_id: part.partiumId,
|
|
189
|
+
part_external_id: part.externalId,
|
|
190
|
+
part_name: part.name.getText(language) || '',
|
|
191
|
+
};
|
|
192
|
+
})
|
|
193
|
+
.slice(0, this.MAX_RESULT_LIST_LENGTH), media_assets: additionalAssets.map(function (asset) { return asset.referenceId; }), user_input: userInput });
|
|
194
|
+
};
|
|
195
|
+
/** @deprecated not needed anymore as HierarchyPartiumIdFilter is already deprecated */
|
|
196
|
+
CustomerServiceAssistanceServiceImpl.prototype.getHierarchyFilterNodesForUI = function () {
|
|
197
|
+
return this.csaHelperService.getHierarchyFilterNodesForUI();
|
|
198
|
+
};
|
|
199
|
+
CustomerServiceAssistanceServiceImpl.prototype.getCSARequests = function (paginationSize, urlParams) {
|
|
200
|
+
if (paginationSize === void 0) { paginationSize = 25; }
|
|
201
|
+
if (urlParams === void 0) { urlParams = []; }
|
|
202
|
+
return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(csa_request_1.CSARequest.fromAPIResponse, this.httpsService, 'requests', https_service_interface_1.BACKEND_SERVICE.CSA, urlParams, paginationSize);
|
|
203
|
+
};
|
|
204
|
+
CustomerServiceAssistanceServiceImpl.prototype.getMultipleExpertSearches = function (csaRequestId) {
|
|
205
|
+
return this.httpsService
|
|
206
|
+
.get("requests/".concat(csaRequestId, "/expert-searches"), [], https_service_interface_1.BACKEND_SERVICE.CSA)
|
|
207
|
+
.pipe((0, operators_1.map)(function (csaRequestData) { return multiple_expert_searches_1.MultipleExpertSearches.fromAPIResponse(csaRequestData); }));
|
|
208
|
+
};
|
|
209
|
+
CustomerServiceAssistanceServiceImpl.prototype.setExpertSearchAbandoned = function (csaRequestId, searchSessionId, abandoned) {
|
|
210
|
+
if (abandoned === void 0) { abandoned = true; }
|
|
211
|
+
// returns the CSARequestSearch values in snake case
|
|
212
|
+
return this.httpsService
|
|
213
|
+
.put("requests/".concat(csaRequestId, "/expert-searches/").concat(searchSessionId, "/abandoned"), { abandoned: abandoned }, null, https_service_interface_1.BACKEND_SERVICE.CSA)
|
|
214
|
+
.pipe((0, operators_1.map)(function (csaRequestData) { return (0, general_helper_1.snakeToCamelCase)(csaRequestData); }));
|
|
215
|
+
};
|
|
216
|
+
CustomerServiceAssistanceServiceImpl.prototype.associateExpertSearchToCsaRequest = function (csaRequestId, searchSessionId) {
|
|
217
|
+
// returns the CSARequestSearch values in snake case
|
|
218
|
+
return this.httpsService
|
|
219
|
+
.post("requests/".concat(csaRequestId, "/expert-searches"), { search_session_id: searchSessionId }, null, https_service_interface_1.BACKEND_SERVICE.CSA)
|
|
220
|
+
.pipe((0, operators_1.map)(function (csaRequestData) { return (0, general_helper_1.snakeToCamelCase)(csaRequestData); }));
|
|
221
|
+
};
|
|
222
|
+
CustomerServiceAssistanceServiceImpl.prototype.getCSARequest = function (csaRequestId) {
|
|
223
|
+
return this.loadCSARequestFromServer(csaRequestId).pipe((0, operators_1.catchError)(function (error) {
|
|
224
|
+
console.log('Error while loading csa-request-information from server.', error);
|
|
225
|
+
return (0, rxjs_1.throwError)(error);
|
|
226
|
+
}));
|
|
227
|
+
};
|
|
228
|
+
CustomerServiceAssistanceServiceImpl.prototype.openCSARequest = function (csaRequestId) {
|
|
229
|
+
return this.httpsService.post("requests/".concat(csaRequestId, "/actions/open"), {}, null, https_service_interface_1.BACKEND_SERVICE.CSA);
|
|
230
|
+
};
|
|
231
|
+
CustomerServiceAssistanceServiceImpl.prototype.markNotResolvedCSARequest = function (csaRequestId) {
|
|
232
|
+
return this.httpsService.post("requests/".concat(csaRequestId, "/actions/not-resolve"), {}, null, https_service_interface_1.BACKEND_SERVICE.CSA);
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Will update the quantity of the CSARequest.
|
|
236
|
+
*
|
|
237
|
+
* @param requestId id of the request to be updated
|
|
238
|
+
* (optional)
|
|
239
|
+
* @param quantity the new quantity of the request
|
|
240
|
+
* (optional)
|
|
241
|
+
* @returns observable that emits when the updated csa-request
|
|
242
|
+
*/
|
|
243
|
+
CustomerServiceAssistanceServiceImpl.prototype.updateCSARequestQuantity = function (csaRequestId, quantity) {
|
|
244
|
+
// NOTE: the ending slash is REQUIRED
|
|
245
|
+
return this.httpsService
|
|
246
|
+
.put("requests/".concat(csaRequestId, "/quantity/"), { quantity: quantity }, [], https_service_interface_1.BACKEND_SERVICE.CSA)
|
|
247
|
+
.pipe((0, operators_1.map)(function (csaRequestData) { return csa_request_1.CSARequest.fromAPIResponse(csaRequestData); }));
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Load the requested CSA-requests from the server.
|
|
251
|
+
*
|
|
252
|
+
* @param csaRequestId the partium-ids of the CSA-request to fetch
|
|
253
|
+
*/
|
|
254
|
+
CustomerServiceAssistanceServiceImpl.prototype.loadCSARequestFromServer = function (csaRequestId) {
|
|
255
|
+
// NOTE: the ending slash is REQUIRED
|
|
256
|
+
return this.httpsService
|
|
257
|
+
.get("requests/".concat(csaRequestId), [], https_service_interface_1.BACKEND_SERVICE.CSA)
|
|
258
|
+
.pipe((0, operators_1.map)(function (csaRequestData) { return csa_request_1.CSARequest.fromAPIResponse(csaRequestData); }));
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Ensure that fore every available text-search-type we send a value or ''. This is required to distinguish on the
|
|
262
|
+
* backend-side, whether an smms-search was performed or not.
|
|
263
|
+
*/
|
|
264
|
+
CustomerServiceAssistanceServiceImpl.prototype.prepareSearchQueriesObj = function (searchQueries) {
|
|
265
|
+
searchQueries = searchQueries || {};
|
|
266
|
+
return Object.keys(text_search_service_1.TEXT_SEARCH_TYPE).reduce(function (obj, type) {
|
|
267
|
+
var _a;
|
|
268
|
+
return (__assign(__assign({}, obj), (_a = {}, _a[text_search_service_1.TEXT_SEARCH_TYPE[type]] = searchQueries[text_search_service_1.TEXT_SEARCH_TYPE[type]] || '', _a)));
|
|
269
|
+
}, {});
|
|
270
|
+
};
|
|
271
|
+
CustomerServiceAssistanceServiceImpl = __decorate([
|
|
272
|
+
(0, injection_identifier_1.InjectionIdentifier)('CustomerServiceAssistanceService')
|
|
273
|
+
], CustomerServiceAssistanceServiceImpl);
|
|
274
|
+
return CustomerServiceAssistanceServiceImpl;
|
|
275
|
+
}(core_1.BaseLoginInitService));
|
|
276
|
+
exports.CustomerServiceAssistanceServiceImpl = CustomerServiceAssistanceServiceImpl;
|
|
277
|
+
//# sourceMappingURL=customer-service-assistance.service.js.map
|
|
@@ -1,2 +1,98 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __extends = (this && this.__extends) || (function () {
|
|
4
|
+
var extendStatics = function (d, b) {
|
|
5
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
8
|
+
return extendStatics(d, b);
|
|
9
|
+
};
|
|
10
|
+
return function (d, b) {
|
|
11
|
+
if (typeof b !== "function" && b !== null)
|
|
12
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13
|
+
extendStatics(d, b);
|
|
14
|
+
function __() { this.constructor = d; }
|
|
15
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
25
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
26
|
+
if (ar || !(i in from)) {
|
|
27
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
28
|
+
ar[i] = from[i];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.FilterServiceImpl = void 0;
|
|
35
|
+
var rxjs_1 = require("rxjs");
|
|
36
|
+
var operators_1 = require("rxjs/operators");
|
|
37
|
+
var core_1 = require("../../core");
|
|
38
|
+
var filter_key_1 = require("../models/filter-key");
|
|
39
|
+
var filter_option_value_1 = require("../models/filter-option-value");
|
|
40
|
+
var FilterServiceImpl = /** @class */ (function (_super) {
|
|
41
|
+
__extends(FilterServiceImpl, _super);
|
|
42
|
+
function FilterServiceImpl(serviceProvider) {
|
|
43
|
+
var _this = _super.call(this, serviceProvider) || this;
|
|
44
|
+
_this.PAGINATION_PAGE_SIZE = 25; // size of page when retrieving page of items and user decides when to load next page
|
|
45
|
+
return _this;
|
|
46
|
+
}
|
|
47
|
+
FilterServiceImpl.prototype.onCreate = function () {
|
|
48
|
+
this.httpsService = this.serviceProvider.getService(core_1.HttpsService);
|
|
49
|
+
};
|
|
50
|
+
FilterServiceImpl.prototype.getFilterKey = function (filterKeyPartiumId) {
|
|
51
|
+
return this.httpsService.get("filters/".concat(filterKeyPartiumId), [], core_1.BACKEND_SERVICE.DATA).pipe((0, operators_1.map)(function (response) {
|
|
52
|
+
return filter_key_1.FilterKey.fromAPIResponse(response);
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
55
|
+
FilterServiceImpl.prototype.getFilterKeys = function (language, pageSize, cursorPaginationEnabled) {
|
|
56
|
+
if (pageSize === void 0) { pageSize = this.PAGINATION_PAGE_SIZE; }
|
|
57
|
+
return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(filter_key_1.FilterKey.fromAPIResponse, this.httpsService, 'filters', core_1.BACKEND_SERVICE.DATA, __spreadArray([], (!!language ? [{ lang: language }] : []), true), pageSize, cursorPaginationEnabled);
|
|
58
|
+
};
|
|
59
|
+
FilterServiceImpl.prototype.getFilterOptions = function (filterKeyPartiumId, cursorPaginationEnabled) {
|
|
60
|
+
return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(filter_option_value_1.FilterOptionValue.fromAPIResponse, this.httpsService, "filters/".concat(filterKeyPartiumId, "/options"), core_1.BACKEND_SERVICE.DATA, [], this.PAGINATION_PAGE_SIZE, cursorPaginationEnabled);
|
|
61
|
+
};
|
|
62
|
+
FilterServiceImpl.prototype.searchFilterKeys = function (query, language, pageSize, cursorPaginationEnabled) {
|
|
63
|
+
return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(filter_key_1.FilterKey.fromAPIResponse, this.httpsService, 'filters', core_1.BACKEND_SERVICE.DATA, __spreadArray([{ search: query }], (!!language ? [{ lang: language }] : []), true), pageSize || this.PAGINATION_PAGE_SIZE, cursorPaginationEnabled);
|
|
64
|
+
};
|
|
65
|
+
/* This only works as long as the selected filters that are the result of a filter key search by query are on the first page.
|
|
66
|
+
Since we only load the first page. The pageSize is crucial */
|
|
67
|
+
FilterServiceImpl.prototype.searchMultipleFilterKeys = function (filters, language, pageSize) {
|
|
68
|
+
var _this = this;
|
|
69
|
+
if (pageSize === void 0) { pageSize = 25; }
|
|
70
|
+
var kvpHardFiltersLabels = [];
|
|
71
|
+
for (var key in filters) {
|
|
72
|
+
if (key === 'hardFilters') {
|
|
73
|
+
kvpHardFiltersLabels.push.apply(kvpHardFiltersLabels, filters[key].map(function (filter) { return filter.label; }));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (kvpHardFiltersLabels.length === 0) {
|
|
77
|
+
return (0, rxjs_1.of)([]);
|
|
78
|
+
}
|
|
79
|
+
return (0, rxjs_1.from)(kvpHardFiltersLabels).pipe((0, operators_1.mergeMap)(function (hardFilterLabel) {
|
|
80
|
+
return _this.searchFilterKeys(hardFilterLabel, language, pageSize, true)
|
|
81
|
+
.loadInitialPage(true)
|
|
82
|
+
.pipe((0, operators_1.map)(function (filterKeyPage) {
|
|
83
|
+
var filterKeys = filterKeyPage.items;
|
|
84
|
+
var singleKey = filterKeys.find(function (filterKey) { return filterKey.name === hardFilterLabel; });
|
|
85
|
+
return singleKey;
|
|
86
|
+
}));
|
|
87
|
+
}), (0, operators_1.scan)(function (kvpFilters, kvpFilter) { return kvpFilters.concat(kvpFilter); }, []));
|
|
88
|
+
};
|
|
89
|
+
FilterServiceImpl.prototype.searchFilterOptions = function (filterKeyPartiumId, query, cursorPaginationEnabled) {
|
|
90
|
+
return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(filter_option_value_1.FilterOptionValue.fromAPIResponse, this.httpsService, "filters/".concat(filterKeyPartiumId, "/options"), core_1.BACKEND_SERVICE.DATA, [{ search: query }], this.PAGINATION_PAGE_SIZE, cursorPaginationEnabled);
|
|
91
|
+
};
|
|
92
|
+
FilterServiceImpl = __decorate([
|
|
93
|
+
(0, core_1.InjectionIdentifier)('FilterService')
|
|
94
|
+
], FilterServiceImpl);
|
|
95
|
+
return FilterServiceImpl;
|
|
96
|
+
}(core_1.BaseService));
|
|
97
|
+
exports.FilterServiceImpl = FilterServiceImpl;
|
|
98
|
+
//# sourceMappingURL=filter.service.js.map
|
|
@@ -1,2 +1,69 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __extends = (this && this.__extends) || (function () {
|
|
4
|
+
var extendStatics = function (d, b) {
|
|
5
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
8
|
+
return extendStatics(d, b);
|
|
9
|
+
};
|
|
10
|
+
return function (d, b) {
|
|
11
|
+
if (typeof b !== "function" && b !== null)
|
|
12
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13
|
+
extendStatics(d, b);
|
|
14
|
+
function __() { this.constructor = d; }
|
|
15
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.InquiryServiceImpl = void 0;
|
|
26
|
+
var operators_1 = require("rxjs/operators");
|
|
27
|
+
var core_1 = require("../../core");
|
|
28
|
+
var injection_identifier_1 = require("../../core/decorators/injection-identifier");
|
|
29
|
+
var base_service_1 = require("../../core/services/base.service");
|
|
30
|
+
var https_service_interface_1 = require("../../core/services/http/https.service.interface");
|
|
31
|
+
var inquiry_1 = require("../models/inquiry");
|
|
32
|
+
var InquiryServiceImpl = /** @class */ (function (_super) {
|
|
33
|
+
__extends(InquiryServiceImpl, _super);
|
|
34
|
+
function InquiryServiceImpl(serviceProvider) {
|
|
35
|
+
return _super.call(this, serviceProvider) || this;
|
|
36
|
+
}
|
|
37
|
+
InquiryServiceImpl.prototype.onCreate = function () {
|
|
38
|
+
this.httpsService = this.serviceProvider.getService(https_service_interface_1.HttpsService);
|
|
39
|
+
};
|
|
40
|
+
InquiryServiceImpl.prototype.getInquiries = function (paginationSize, urlParams) {
|
|
41
|
+
if (paginationSize === void 0) { paginationSize = 25; }
|
|
42
|
+
if (urlParams === void 0) { urlParams = []; }
|
|
43
|
+
return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(inquiry_1.Inquiry.fromAPIResponse, this.httpsService, 'inquiries', https_service_interface_1.BACKEND_SERVICE.CSA, urlParams, paginationSize);
|
|
44
|
+
};
|
|
45
|
+
InquiryServiceImpl.prototype.getInquiry = function (inquiryId) {
|
|
46
|
+
return this.httpsService
|
|
47
|
+
.get("inquiries/".concat(inquiryId), [], https_service_interface_1.BACKEND_SERVICE.CSA)
|
|
48
|
+
.pipe((0, operators_1.map)(function (inquiryData) { return inquiry_1.Inquiry.fromAPIResponse(inquiryData); }));
|
|
49
|
+
};
|
|
50
|
+
InquiryServiceImpl.prototype.createInquiry = function () {
|
|
51
|
+
return this.httpsService
|
|
52
|
+
.post("inquiries/", {}, [], https_service_interface_1.BACKEND_SERVICE.CSA)
|
|
53
|
+
.pipe((0, operators_1.map)(function (inquiryData) { return inquiry_1.Inquiry.fromAPIResponse(inquiryData); }));
|
|
54
|
+
};
|
|
55
|
+
InquiryServiceImpl.prototype.updateInquiryStatus = function (inquiryId, status) {
|
|
56
|
+
return this.httpsService
|
|
57
|
+
.put("inquiries/".concat(inquiryId, "/status"), { status: status }, [], https_service_interface_1.BACKEND_SERVICE.CSA)
|
|
58
|
+
.pipe((0, operators_1.map)(function (statusData) { return new inquiry_1.InquiryStatusResponse(statusData); }));
|
|
59
|
+
};
|
|
60
|
+
InquiryServiceImpl.prototype.exportInquiryAsEmail = function (inquiryId, recipients, subject, message) {
|
|
61
|
+
return this.httpsService.post("inquiries/".concat(inquiryId, "/actions/email"), { recipients: recipients, subject: subject, message: message }, [], https_service_interface_1.BACKEND_SERVICE.CSA);
|
|
62
|
+
};
|
|
63
|
+
InquiryServiceImpl = __decorate([
|
|
64
|
+
(0, injection_identifier_1.InjectionIdentifier)('InquiryService')
|
|
65
|
+
], InquiryServiceImpl);
|
|
66
|
+
return InquiryServiceImpl;
|
|
67
|
+
}(base_service_1.BaseService));
|
|
68
|
+
exports.InquiryServiceImpl = InquiryServiceImpl;
|
|
69
|
+
//# sourceMappingURL=inquiry.service.js.map
|
|
@@ -1,2 +1,119 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __extends = (this && this.__extends) || (function () {
|
|
4
|
+
var extendStatics = function (d, b) {
|
|
5
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
8
|
+
return extendStatics(d, b);
|
|
9
|
+
};
|
|
10
|
+
return function (d, b) {
|
|
11
|
+
if (typeof b !== "function" && b !== null)
|
|
12
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13
|
+
extendStatics(d, b);
|
|
14
|
+
function __() { this.constructor = d; }
|
|
15
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
25
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
26
|
+
if (ar || !(i in from)) {
|
|
27
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
28
|
+
ar[i] = from[i];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.PartAttributeServiceImpl = void 0;
|
|
35
|
+
var rxjs_1 = require("rxjs");
|
|
36
|
+
var operators_1 = require("rxjs/operators");
|
|
37
|
+
var core_1 = require("../../core");
|
|
38
|
+
var attribute_1 = require("../models/attribute");
|
|
39
|
+
var part_1 = require("../models/part");
|
|
40
|
+
var PartAttributeServiceImpl = /** @class */ (function (_super) {
|
|
41
|
+
__extends(PartAttributeServiceImpl, _super);
|
|
42
|
+
function PartAttributeServiceImpl(serviceProvider) {
|
|
43
|
+
var _this = _super.call(this, serviceProvider) || this;
|
|
44
|
+
_this.DOWNLOAD_PAGE_SIZE = 250;
|
|
45
|
+
return _this;
|
|
46
|
+
}
|
|
47
|
+
PartAttributeServiceImpl.prototype.onCreate = function () {
|
|
48
|
+
this.httpsService = this.serviceProvider.getService(core_1.HttpsService);
|
|
49
|
+
};
|
|
50
|
+
PartAttributeServiceImpl.prototype.getAttributesForPart = function (partPartiumId) {
|
|
51
|
+
return this.loadPartAttributesFromServer(partPartiumId)
|
|
52
|
+
.pipe((0, operators_1.catchError)(function (error) {
|
|
53
|
+
console.log("Error while loading part-information from server.", error);
|
|
54
|
+
return (0, rxjs_1.throwError)(error);
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Load all attributes of a part from the server.
|
|
59
|
+
* Since the response is paginated, it is necessary to do as many request as needed until
|
|
60
|
+
* all attributes are loaded.
|
|
61
|
+
*
|
|
62
|
+
* @returns observable that emits when the requested attributes were loaded
|
|
63
|
+
*/
|
|
64
|
+
PartAttributeServiceImpl.prototype.loadPartAttributesFromServer = function (partPartiumId) {
|
|
65
|
+
var _this = this;
|
|
66
|
+
var i = 1;
|
|
67
|
+
var repeat$ = new rxjs_1.Subject();
|
|
68
|
+
// do as many requests (1 per page) until all attributes are loaded
|
|
69
|
+
// we use "defer" here instead of using requestPaginatedAttributes directly, because this allows us to increase the page-number, which is passed to the function. Otherwise it would always be called with the same value.
|
|
70
|
+
return (0, rxjs_1.defer)(function () {
|
|
71
|
+
return _this.requestPaginatedAttributes(partPartiumId, i);
|
|
72
|
+
}).pipe((0, operators_1.map)(function (res) {
|
|
73
|
+
var pageSize = res["pagination"]["page_size"];
|
|
74
|
+
var itemsCnt = res["pagination"]["items_count"];
|
|
75
|
+
var pageCnt = Math.ceil(itemsCnt / pageSize);
|
|
76
|
+
if (i >= pageCnt) {
|
|
77
|
+
repeat$.complete(); // final page reached
|
|
78
|
+
}
|
|
79
|
+
else if (i++ < pageCnt) {
|
|
80
|
+
setTimeout(function () {
|
|
81
|
+
repeat$.next(); // more pages to load
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return res["results"];
|
|
85
|
+
}), (0, operators_1.repeatWhen)(function () { return repeat$.asObservable(); }), (0, operators_1.reduce)(function (cum, newItems) {
|
|
86
|
+
return __spreadArray(__spreadArray([], cum, true), newItems, true);
|
|
87
|
+
}), (0, operators_1.map)(function (attributesData) {
|
|
88
|
+
return attributesData.filter(function (attributeData) {
|
|
89
|
+
// It is a temporary implementation, planned implementation on the BE (https://partium.atlassian.net/browse/PPD-1172).
|
|
90
|
+
var attributeSource = attributeData["metadata"] && attributeData["metadata"]["source"];
|
|
91
|
+
return !attributeSource || !(["__HITL_ANNOTATIONS__", "__ENRICHED_METADATA__"].some(function (x) { return x === attributeSource; }));
|
|
92
|
+
}).map(function (attributeData) {
|
|
93
|
+
return attribute_1.Attribute.fromAPIResponse(attributeData, part_1.DATA_ORIGIN.DATA_API);
|
|
94
|
+
});
|
|
95
|
+
}));
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Sent request for one page of attributes
|
|
99
|
+
*
|
|
100
|
+
* @returns partPartiumId id of the Part
|
|
101
|
+
* @param page the current page of the pagination (1-indexed)
|
|
102
|
+
*/
|
|
103
|
+
PartAttributeServiceImpl.prototype.requestPaginatedAttributes = function (partPartiumId, page) {
|
|
104
|
+
return this.httpsService.get("/part_types/".concat(partPartiumId, "/attributes"), [
|
|
105
|
+
{
|
|
106
|
+
page: page,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
page_size: this.DOWNLOAD_PAGE_SIZE,
|
|
110
|
+
},
|
|
111
|
+
], core_1.BACKEND_SERVICE.DATA);
|
|
112
|
+
};
|
|
113
|
+
PartAttributeServiceImpl = __decorate([
|
|
114
|
+
(0, core_1.InjectionIdentifier)("PartAttributeService")
|
|
115
|
+
], PartAttributeServiceImpl);
|
|
116
|
+
return PartAttributeServiceImpl;
|
|
117
|
+
}(core_1.BaseLoginInitService));
|
|
118
|
+
exports.PartAttributeServiceImpl = PartAttributeServiceImpl;
|
|
119
|
+
//# sourceMappingURL=part-attribute.service.js.map
|