@partium/js-sdk 15.20.0 → 16.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/core/constants/constants.d.ts +1 -2
- package/core/constants/constants.js +1 -1
- package/core/index.d.ts +2 -2
- package/core/index.js +1 -1
- package/core/integration-defaults/http/https-client/axios-https-client.service.d.ts +5 -0
- package/core/integration-defaults/http/https-client/axios-https-client.service.js +1 -1
- package/core/integration-defaults/http/https-client/fetch-api-https-client.service.js +1 -1
- package/core/integration-defaults/session/js-oauth-api-key-session.service.js +1 -1
- package/core/integration-defaults/session/js-oauth-keycloak-session.service.js +1 -1
- package/core/integration-defaults/session/js-oauth-web-cookie-session.service.js +1 -1
- package/core/models/user.d.ts +7 -43
- package/core/models/user.js +1 -1
- package/core/services/http/https.service.interface.d.ts +18 -20
- package/core/services/http/https.service.interface.js +1 -1
- package/core/services/http/oauth-https.service.d.ts +3 -3
- package/core/services/local-storage.service.interface.d.ts +1 -1
- package/core/services/log.service.d.ts +1 -1
- package/core/services/organization/index.d.ts +6 -0
- package/core/services/organization/index.js +2 -0
- package/core/services/organization/models/get-organization-by-id-request.d.ts +10 -0
- package/core/services/organization/models/get-organization-by-name-request.d.ts +10 -0
- package/core/services/organization/models/get-organizations-request.d.ts +33 -0
- package/core/services/organization/models/get-organizations-request.js +2 -0
- package/core/services/organization/models/organization.d.ts +77 -0
- package/core/services/organization/models/organization.js +2 -0
- package/core/services/organization/organization.service.d.ts +81 -0
- package/core/services/organization/organization.service.js +2 -0
- package/core/services/recent-parts.service.d.ts +1 -1
- package/core/services/session/session.service.interface.d.ts +17 -5
- package/core/services/session/session.service.interface.js +1 -1
- package/core/utils/general-helper.d.ts +2 -1
- package/core/utils/general-helper.js +1 -1
- package/core/utils/multipart-upload.helper.d.ts +20 -0
- package/core/utils/multipart-upload.helper.js +2 -0
- package/data/models/attribute.d.ts +5 -5
- package/data/models/attribute.js +1 -1
- package/data/models/csa-request.d.ts +2 -3
- package/data/models/csa-request.js +1 -1
- package/data/models/image.d.ts +10 -13
- package/data/models/image.js +1 -1
- package/data/models/part-data.d.ts +1 -1
- package/data/models/part.d.ts +13 -9
- package/data/models/part.js +1 -1
- package/data/services/customer-service-assistance.service.d.ts +3 -22
- package/data/services/customer-service-assistance.service.js +1 -1
- package/data/services/data.service.js +1 -1
- package/data/services/filter.service.d.ts +0 -21
- package/data/services/filter.service.js +1 -1
- package/enrichment/models/enrichment-job-part.d.ts +2 -2
- package/enrichment/models/enrichment-job-part.js +1 -1
- package/enrichment/models/enrichment-job.d.ts +2 -2
- package/enrichment/models/enrichment-job.js +1 -1
- package/find/index.d.ts +1 -28
- package/find/index.js +1 -1
- package/find/models/image-crop-area.d.ts +7 -0
- package/find/models/search-input.d.ts +11 -3
- package/find/models/search-input.js +1 -1
- package/find/services/asset.service.d.ts +41 -102
- package/find/services/asset.service.js +1 -1
- package/find/services/search/search.service.d.ts +5 -218
- package/find/services/search/search.service.js +1 -1
- package/gen/sdk-version.d.ts +1 -1
- package/gen/sdk-version.js +1 -1
- package/index.d.ts +14 -8
- package/index.js +1 -1
- package/ocr/index.d.ts +1 -2
- package/ocr/index.js +1 -1
- package/ocr/models/ocr-response.d.ts +5 -0
- package/ocr/models/ocr-response.js +2 -0
- package/ocr/services/ocr.service.d.ts +9 -15
- package/ocr/services/ocr.service.js +1 -1
- package/package.json +1 -1
- package/core/models/organization.d.ts +0 -127
- package/core/models/organization.js +0 -2
- package/core/services/organization.service.d.ts +0 -48
- package/core/services/organization.service.js +0 -2
- package/data/services/csa-helper.service.d.ts +0 -32
- package/data/services/csa-helper.service.js +0 -2
- package/find/models/assets/asset.d.ts +0 -24
- package/find/models/assets/asset.js +0 -2
- package/find/models/search-filter.d.ts +0 -87
- package/find/models/search-filter.js +0 -2
- package/find/models/search-result-status.d.ts +0 -33
- package/find/models/search-result-status.js +0 -2
- package/find/models/search-session-log-object.d.ts +0 -16
- package/find/models/search-session-log-object.js +0 -2
- package/find/models/search-status/cv-search-status.d.ts +0 -20
- package/find/models/search-status/cv-search-status.js +0 -2
- package/find/models/search-status/search-filter-status.d.ts +0 -33
- package/find/models/search-status/search-filter-status.js +0 -2
- package/find/models/search-status/search-status.d.ts +0 -34
- package/find/models/search-status/search-status.js +0 -2
- package/find/models/search-status/tag-search-status.d.ts +0 -16
- package/find/models/search-status/tag-search-status.js +0 -2
- package/find/models/search-status/text-search-status.d.ts +0 -15
- package/find/models/search-status/text-search-status.js +0 -2
- package/find/models/search-tag.d.ts +0 -12
- package/find/models/search-tag.js +0 -2
- package/find/models/tagable/i18n-tagable.d.ts +0 -10
- package/find/models/tagable/i18n-tagable.js +0 -2
- package/find/models/tagable/tagable-base.d.ts +0 -11
- package/find/models/tagable/tagable-base.js +0 -2
- package/find/models/tagable/tagable.d.ts +0 -10
- package/find/models/tagable/tagable.js +0 -2
- package/find/models/text-search-config.d.ts +0 -57
- package/find/models/text-search-config.js +0 -2
- package/find/models/text-search-manipulator.d.ts +0 -46
- package/find/models/text-search-manipulator.js +0 -2
- package/find/models/text-search-result-item/text-search-error.d.ts +0 -7
- package/find/models/text-search-result-item/text-search-error.js +0 -2
- package/find/models/text-search-result-item/text-search-result-item-document.d.ts +0 -10
- package/find/models/text-search-result-item/text-search-result-item-document.js +0 -2
- package/find/models/text-search-result-item/text-search-result-item-part.d.ts +0 -12
- package/find/models/text-search-result-item/text-search-result-item-part.js +0 -2
- package/find/models/text-search-result-item/text-search-result-item-recent-query.d.ts +0 -10
- package/find/models/text-search-result-item/text-search-result-item-recent-query.js +0 -2
- package/find/models/text-search-result-item/text-search-result-item-unknown.d.ts +0 -12
- package/find/models/text-search-result-item/text-search-result-item-unknown.js +0 -2
- package/find/models/text-search-result-item/text-search-result-item.d.ts +0 -16
- package/find/models/text-search-result-item/text-search-result-item.js +0 -2
- package/find/services/filter-uploaders/filter-uploader.d.ts +0 -13
- package/find/services/filter-uploaders/update-filters-uploader.d.ts +0 -17
- package/find/services/filter-uploaders/update-filters-uploader.js +0 -2
- package/find/services/filter-uploaders/update-filters.model.d.ts +0 -19
- package/find/services/filter-uploaders/update-filters.model.js +0 -2
- package/find/services/search/cv-search.service.d.ts +0 -103
- package/find/services/search/cv-search.service.js +0 -2
- package/find/services/search/search-result.service.d.ts +0 -142
- package/find/services/search/search-result.service.js +0 -2
- package/find/services/search/tag-search.service.d.ts +0 -66
- package/find/services/search/tag-search.service.js +0 -2
- package/find/services/search/text-search.service.d.ts +0 -116
- package/find/services/search/text-search.service.js +0 -2
- package/find/services/search-filter.service.d.ts +0 -223
- package/find/services/search-filter.service.js +0 -2
- package/find/utils/search-helper.d.ts +0 -14
- package/find/utils/search-helper.js +0 -2
- package/ocr/models/detect-response.d.ts +0 -5
- package/ocr/models/detected-text-entry.d.ts +0 -5
- /package/{find/services/filter-uploaders/filter-uploader.js → core/services/organization/models/get-organization-by-id-request.js} +0 -0
- /package/{ocr/models/detect-response.js → core/services/organization/models/get-organization-by-name-request.js} +0 -0
- /package/{ocr/models/detected-text-entry.js → find/models/image-crop-area.js} +0 -0
package/data/models/part.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var a in e=arguments[n])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t},__assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Part=exports.DATA_ORIGIN=exports.DUPLICATE_DATA_AREA=exports.SUBSTITUTE_ROLE=exports.RELATION_TYPE=exports.PartMountingLocation=void 0;var RELATION_TYPE,SUBSTITUTE_ROLE,DUPLICATE_DATA_AREA,DATA_ORIGIN,core_1=require("../../core"),attribute_1=require("./attribute"),image_1=require("./image"),mounting_location_1=require("./mounting-location"),part_enrichment_data_1=require("./part-enrichment-data"),mounting_location_2=require("./mounting-location");Object.defineProperty(exports,"PartMountingLocation",{enumerable:!0,get:function(){return mounting_location_2.PartMountingLocation}}),function(t){t.DUPLICATE="duplicate",t.SUBSTITUTE="substitute",t.EQUIVALENT="equivalent",t.NOT_RELATED="not_related"}(RELATION_TYPE||(exports.RELATION_TYPE=RELATION_TYPE={})),function(t){t.SUCCESSOR="successor",t.PREDECESSOR="predecessor"}(SUBSTITUTE_ROLE||(exports.SUBSTITUTE_ROLE=SUBSTITUTE_ROLE={})),function(t){t.IMAGE="IMAGE",t.NAME="NAME",t.DATA="DATA"}(DUPLICATE_DATA_AREA||(exports.DUPLICATE_DATA_AREA=DUPLICATE_DATA_AREA={})),function(t){t[t.SEARCH_RESULT=0]="SEARCH_RESULT",t[t.PARTIAL=0]="PARTIAL",t[t.SERVER=2]="SERVER",t[t.DATA_API=2]="DATA_API",t[t.FIND_API=3]="FIND_API"}(DATA_ORIGIN||(exports.DATA_ORIGIN=DATA_ORIGIN={}));var Part=function(t){function e(e){var n=t.call(this)||this;return Object.assign(n,e),n}return __extends(e,t),e.prototype.updatePart=function(t){Object.assign(this,t)},e.prototype.updateName=function(t){this.name=t},e.prototype.updateDescription=function(t){this.description=t},e.fromAPIResponse=function(t,n,r){var a;if(void 0===n&&(n=DATA_ORIGIN.DATA_API),n===DATA_ORIGIN.
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var a in e=arguments[n])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t},__assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Part=exports.DATA_ORIGIN=exports.DUPLICATE_DATA_AREA=exports.SUBSTITUTE_ROLE=exports.RELATION_TYPE=exports.PartMountingLocation=void 0;var RELATION_TYPE,SUBSTITUTE_ROLE,DUPLICATE_DATA_AREA,DATA_ORIGIN,core_1=require("../../core"),attribute_1=require("./attribute"),image_1=require("./image"),mounting_location_1=require("./mounting-location"),part_enrichment_data_1=require("./part-enrichment-data"),mounting_location_2=require("./mounting-location");Object.defineProperty(exports,"PartMountingLocation",{enumerable:!0,get:function(){return mounting_location_2.PartMountingLocation}}),function(t){t.DUPLICATE="duplicate",t.SUBSTITUTE="substitute",t.EQUIVALENT="equivalent",t.NOT_RELATED="not_related"}(RELATION_TYPE||(exports.RELATION_TYPE=RELATION_TYPE={})),function(t){t.SUCCESSOR="successor",t.PREDECESSOR="predecessor"}(SUBSTITUTE_ROLE||(exports.SUBSTITUTE_ROLE=SUBSTITUTE_ROLE={})),function(t){t.IMAGE="IMAGE",t.NAME="NAME",t.DATA="DATA"}(DUPLICATE_DATA_AREA||(exports.DUPLICATE_DATA_AREA=DUPLICATE_DATA_AREA={})),function(t){t[t.SEARCH_RESULT=0]="SEARCH_RESULT",t[t.PARTIAL=0]="PARTIAL",t[t.SERVER=2]="SERVER",t[t.DATA_API=2]="DATA_API",t[t.FIND_API=3]="FIND_API",t[t.PARTIUM_API=3]="PARTIUM_API"}(DATA_ORIGIN||(exports.DATA_ORIGIN=DATA_ORIGIN={}));var Part=function(t){function e(e){var n=t.call(this)||this;return Object.assign(n,e),n}return __extends(e,t),e.prototype.updatePart=function(t){Object.assign(this,t)},e.prototype.updateName=function(t){this.name=t},e.prototype.updateDescription=function(t){this.description=t},e.fromAPIResponse=function(t,n,r){var a;if(void 0===n&&(n=DATA_ORIGIN.DATA_API),n===DATA_ORIGIN.PARTIUM_API){var i=(u=t).mountingLocationsCount,o=u.nameLanguage||r,A=u.attributes;return new e(__assign(__assign(__assign(__assign({partiumId:u.partiumId,externalId:u.id,name:new core_1.i18nString((a={},a[o]=u.name,a)),images:u.images?u.images.map((function(t){return(0,image_1.fromPartiumAPIResponse)(t,core_1.BACKEND_SERVICE.DATA)})):[],dataOrigin:DATA_ORIGIN.PARTIUM_API},A&&{attributes:u.attributes.map((function(t){return attribute_1.Attribute.fromAPIResponse(t,n)}))}),{mountingLocationsCount:i||null,mountingLocations:null}),u.duplicateType&&{duplicateType:this.getDuplicateType(u.duplicateType)}),{highlights:u.highlights?u.highlights:null,relatedPartsSummary:u.relatedPartsSummary?u.relatedPartsSummary:null}))}var u,_=(u=t).organization,s=(A=u.attributes,u.mounting_locations);return new e(__assign(__assign(__assign({partiumId:u.uuid,externalId:u.external_id,externalPayload:u.metadata,name:new core_1.i18nString(u.name),images:u.images?u.images.filter((function(t){return"display"===t.type})).map((function(t){return(0,image_1.fromDataAPIResponse)(t,core_1.BACKEND_SERVICE.DATA)})):[],dataOrigin:DATA_ORIGIN.DATA_API},_&&{organization:{partiumId:_.uuid,name:_.name,displayName:_.name}}),A&&{attributes:u.attributes.map((function(t){return attribute_1.Attribute.fromAPIResponse(t,n)}))}),{mountingLocationsCount:u.total_mounting_locations_count||0,mountingLocations:(null==s?void 0:s.map((function(t){return mounting_location_1.PartMountingLocation.fromAPIResponse(t)})))||[],summary:u.summary?{summaryId:u.summary.summary_id,summary:u.summary.summary.map((function(t){return{key:new core_1.i18nString(t.key),values:t.values.map((function(t){return new core_1.i18nString(t)}))}}))}:null,enrichment:u.enrichment?part_enrichment_data_1.PartEnrichmentData.fromAPIResponse(u.enrichment):null,highlights:null}))},e.fromRelatedPartsAPIResponse=function(t){var n=e.fromAPIResponse(null==t?void 0:t.part,DATA_ORIGIN.DATA_API);return n.relationType=t.type,t.created&&(n.relationCreatedAt=new Date(t.created)),"anchor_part"===t.part_role?n.partRole=SUBSTITUTE_ROLE.PREDECESSOR:"related_part"===t.part_role&&(n.partRole=SUBSTITUTE_ROLE.SUCCESSOR),n},e.getDuplicateType=function(t){switch(t){case"IMAGE_NAME_AND_DATA":return[DUPLICATE_DATA_AREA.IMAGE,DUPLICATE_DATA_AREA.NAME,DUPLICATE_DATA_AREA.DATA];case"NAME_AND_DATA":return[DUPLICATE_DATA_AREA.NAME,DUPLICATE_DATA_AREA.DATA];case"IMAGE":return[DUPLICATE_DATA_AREA.IMAGE]}},e}(core_1.APIObject);exports.Part=Part;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { PaginatedRequestService, EventContext, BaseLoginInitService, PartiumConfig } from '../../core';
|
|
4
|
-
import { Organization } from '../../core/models/organization';
|
|
4
|
+
import { Organization } from '../../core/services/organization/models/organization';
|
|
5
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
6
|
import { CSARequest } from '../models/csa-request';
|
|
9
7
|
import { CSARequestStatus } from '../models/csa-request-status';
|
|
10
8
|
import { Part } from '../models/part';
|
|
@@ -35,20 +33,7 @@ export interface CustomerServiceAssistanceService {
|
|
|
35
33
|
* @returns an Observables that resolves with the result of the http-request
|
|
36
34
|
* to the Partium backend
|
|
37
35
|
*/
|
|
38
|
-
sendCSARequest(message: string, language: string, searchOutput?: SearchOutput, part?: Part, additionalAssets?:
|
|
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[]>;
|
|
36
|
+
sendCSARequest(message: string, language: string, searchOutput?: SearchOutput, part?: Part, additionalAssets?: string[], ecrEventContext?: ECREventContext): Observable<CSARequest>;
|
|
52
37
|
/**
|
|
53
38
|
* Will trigger loading the information of all CSA-requests from the backend.
|
|
54
39
|
*
|
|
@@ -130,7 +115,6 @@ export interface CustomerServiceAssistanceService {
|
|
|
130
115
|
export declare class CustomerServiceAssistanceServiceImpl extends BaseLoginInitService implements CustomerServiceAssistanceService {
|
|
131
116
|
private MAX_RESULT_LIST_LENGTH;
|
|
132
117
|
private httpsService;
|
|
133
|
-
private csaHelperService;
|
|
134
118
|
private assemblyHierarchyNodeService;
|
|
135
119
|
private logService;
|
|
136
120
|
constructor(serviceProvider: ServiceProvider);
|
|
@@ -141,14 +125,11 @@ export declare class CustomerServiceAssistanceServiceImpl extends BaseLoginInitS
|
|
|
141
125
|
* Note: Should be called at the start of a session
|
|
142
126
|
*/
|
|
143
127
|
init(config: PartiumConfig, userEmail: string, currentOrganization$: Observable<Organization>): Observable<void>;
|
|
144
|
-
sendCSARequest(message: string, language: string, searchOutput?: SearchOutput, part?: Part, additionalAssets?:
|
|
128
|
+
sendCSARequest(message: string, language: string, searchOutput?: SearchOutput, part?: Part, additionalAssets?: string[], ecrEventContext?: ECREventContext): Observable<CSARequest>;
|
|
145
129
|
resolveCSARequest(csaRequestId: string, partId: string): Observable<CSARequestStatus>;
|
|
146
130
|
private sendRequestInternal;
|
|
147
|
-
private createLogEventRequestContent;
|
|
148
131
|
private sendBackendRequest;
|
|
149
132
|
private createRequestData;
|
|
150
|
-
/** @deprecated not needed anymore as HierarchyPartiumIdFilter is already deprecated */
|
|
151
|
-
getHierarchyFilterNodesForUI(): Observable<AssemblyHierarchyNode[]>;
|
|
152
133
|
getCSARequests(paginationSize?: number, urlParams?: any[]): PaginatedRequestService<CSARequest>;
|
|
153
134
|
getMultipleExpertSearches(csaRequestId: string): Observable<MultipleExpertSearches>;
|
|
154
135
|
setExpertSearchAbandoned(csaRequestId: string, searchSessionId: string, abandoned?: boolean): Observable<CSARequestSearch>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 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";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"),organization_1=require("../../core/services/organization/models/organization"),https_service_interface_1=require("../../core/services/http/https.service.interface"),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"),find_1=require("../../find"),assembly_hierarchy_nodes_service_1=require("./assembly-hierarchy-nodes.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.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;void 0===s&&(s=[]);var 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=o[0],d=o[1];if(!(0,organization_1.organizationHasPermission)(l,"ecr.helpRequests.create"))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 v=u?c.prepareSearchQueriesObj(i.searchInput.searchQueries):null,h=u?(0,organization_1.organizationHasPermission)(l,"find.hybridSearch.use"):null,S=u?__assign(__assign(__assign({searchSessionId:null===(a=null==i?void 0:i.searchInput)||void 0===a?void 0:a.searchSessionId},h&&{textQuery:null==v?void 0:v.semanticText}),!h&&{textQueries:v}),{queryImageAssetId:null===(_=null==i?void 0:i.searchInput)||void 0===_?void 0:_.searchImageAssetId,attributeFilters:null===(p=null==i?void 0:i.searchInput)||void 0===p?void 0:p.attributeFilters,resultList:null==i?void 0:i.searchResults}):{};return c.sendBackendRequest(__assign({language:e,part:t,additionalAssets:s,nodes:d,organizationId:l.partiumId,userInput:r},S)).pipe((0,operators_1.tap)((function(o){var a;c.logService.logEvent(new core_1.EventLog({version:core_1.EVENTLOG_VERSIONS.V_2_0_0,organizationId:l.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:s}})).subscribe((function(){}),(function(e){console.log("Error while sending log event: ",e)}))})))})))},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=((_={})[find_1.TEXT_SEARCH_TYPE.SEMANTIC]="semantic_text",_[find_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(find_1.TEXT_SEARCH_TYPE).reduce((function(e,t){var r;return __assign(__assign({},e),((r={})[p[find_1.TEXT_SEARCH_TYPE[t]]]=n[find_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,user_input:u})},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(find_1.TEXT_SEARCH_TYPE).reduce((function(t,r){var s;return __assign(__assign({},t),((s={})[find_1.TEXT_SEARCH_TYPE[r]]=e[find_1.TEXT_SEARCH_TYPE[r]]||"",s))}),{})},t=__decorate([(0,injection_identifier_1.InjectionIdentifier)("CustomerServiceAssistanceService")],t)}(core_1.BaseLoginInitService);exports.CustomerServiceAssistanceServiceImpl=CustomerServiceAssistanceServiceImpl;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 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)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},__assign.apply(this,arguments)},__decorate=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,s=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var
|
|
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)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},__assign.apply(this,arguments)},__decorate=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,s=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(i<3?n(s):i>3?n(t,r,s):n(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s};Object.defineProperty(exports,"__esModule",{value:!0}),exports.DataServiceImpl=void 0;var rxjs_1=require("rxjs"),core_1=require("../../core"),DataServiceImpl=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(core_1.HttpsService)},t.prototype.getPart=function(e){return void 0===e&&(e={projection:["partiumId"]}),this.httpsService.get("part",(0,core_1.toQueryParams)(e),core_1.BACKEND_SERVICE.DATA_V2)},t.prototype.loadSelectableAttributes=function(e){return void 0===e&&(e={}),this.fetchSelectableAttributesPage(e).pipe((0,rxjs_1.map)((function(t){return{response:t,paginationContext:{initialRequest:__assign({},e),nextCursor:(0,core_1.extractNextCursor)(t)}}})))},t.prototype.loadMoreSelectableAttributes=function(e){if(!e.nextCursor)return(0,rxjs_1.throwError)((function(){return new core_1.SdkError(core_1.SDK_ERROR_CODES.NO_PAGINATION_CURSOR_AVAILABLE,null,"No cursor available")}));var t=__assign(__assign({},e.initialRequest),{cursor:e.nextCursor});return this.fetchSelectableAttributesPage(t).pipe((0,rxjs_1.map)((function(t){return{response:t,paginationContext:__assign(__assign({},e),{nextCursor:(0,core_1.extractNextCursor)(t)})}})))},t.prototype.hasMoreSelectableAttributesAvailable=function(e){return!!e.nextCursor},t.prototype.fetchSelectableAttributesPage=function(e){return this.httpsService.get("attributes",(0,core_1.toQueryParams)(e),core_1.BACKEND_SERVICE.DATA_V2)},t=__decorate([(0,core_1.InjectionIdentifier)("DataService")],t)}(core_1.BaseService);exports.DataServiceImpl=DataServiceImpl;
|
|
@@ -3,7 +3,6 @@ import { Observable } from 'rxjs';
|
|
|
3
3
|
import { BaseService, PaginatedRequestService, ServiceProvider } from '../../core';
|
|
4
4
|
import { FilterKey } from '../models/filter-key';
|
|
5
5
|
import { FilterOptionValue } from '../models/filter-option-value';
|
|
6
|
-
import { HierarchyPartiumIdFilter, KvpHardFilter } from '../../find/models/search-filter';
|
|
7
6
|
export interface FilterService {
|
|
8
7
|
/**
|
|
9
8
|
* Retrieves a filter key for a certain filter-id.
|
|
@@ -52,23 +51,6 @@ export interface FilterService {
|
|
|
52
51
|
* requested filter keys.
|
|
53
52
|
*/
|
|
54
53
|
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
54
|
/**
|
|
73
55
|
* Search for filter options by the given filter-key's partiumId and text query.
|
|
74
56
|
*
|
|
@@ -90,8 +72,5 @@ export declare class FilterServiceImpl extends BaseService implements FilterServ
|
|
|
90
72
|
getFilterKeys(language?: string, pageSize?: number, cursorPaginationEnabled?: boolean): PaginatedRequestService<FilterKey>;
|
|
91
73
|
getFilterOptions(filterKeyPartiumId: string, cursorPaginationEnabled?: boolean): PaginatedRequestService<FilterOptionValue>;
|
|
92
74
|
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
75
|
searchFilterOptions(filterKeyPartiumId: string, query: string, cursorPaginationEnabled?: boolean): PaginatedRequestService<FilterOptionValue>;
|
|
97
76
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 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
|
|
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 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.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;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
import {
|
|
2
|
+
import { Image, ImageFromDataAPI } from '../../data';
|
|
3
3
|
export interface EnrichmentJobPartFromAPI {
|
|
4
4
|
partiumId: string | null;
|
|
5
5
|
id: string;
|
|
6
6
|
name: string | null;
|
|
7
7
|
nameLanguage?: string | null;
|
|
8
|
-
image:
|
|
8
|
+
image: ImageFromDataAPI | null;
|
|
9
9
|
status: ENRICHMENT_JOB_PART_STATUS;
|
|
10
10
|
}
|
|
11
11
|
export interface EnrichmentJobPartsSummary {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.enrichmentJobPartFromAPIResponse=exports.ENRICHMENT_JOB_PART_STATUS=void 0;var ENRICHMENT_JOB_PART_STATUS,core_1=require("../../core"),data_1=require("../../data");!function(e){e.VALID="valid",e.INVALID="invalid"}(ENRICHMENT_JOB_PART_STATUS||(exports.ENRICHMENT_JOB_PART_STATUS=ENRICHMENT_JOB_PART_STATUS={}));var enrichmentJobPartFromAPIResponse=function(e){return{partiumId:e.partiumId,externalId:e.id,name:e.name,nameLanguage:e.nameLanguage,image:e.image?data_1.
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.enrichmentJobPartFromAPIResponse=exports.ENRICHMENT_JOB_PART_STATUS=void 0;var ENRICHMENT_JOB_PART_STATUS,core_1=require("../../core"),data_1=require("../../data");!function(e){e.VALID="valid",e.INVALID="invalid"}(ENRICHMENT_JOB_PART_STATUS||(exports.ENRICHMENT_JOB_PART_STATUS=ENRICHMENT_JOB_PART_STATUS={}));var enrichmentJobPartFromAPIResponse=function(e){return{partiumId:e.partiumId,externalId:e.id,name:e.name,nameLanguage:e.nameLanguage,image:e.image?(0,data_1.fromDataAPIResponse)(e.image,core_1.BACKEND_SERVICE.DATA):null,status:e.status}};exports.enrichmentJobPartFromAPIResponse=enrichmentJobPartFromAPIResponse;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
import { Image,
|
|
2
|
+
import { Image, ImageFromDataAPI } from '../../data/models/image';
|
|
3
3
|
export declare enum EnrichmentJobStatus {
|
|
4
4
|
SUBMITTED = "submitted",
|
|
5
5
|
IN_PROGRESS = "in_progress",
|
|
@@ -17,7 +17,7 @@ export interface EnrichmentJobFromAPI {
|
|
|
17
17
|
title: string;
|
|
18
18
|
jobType: EnrichmentJobType;
|
|
19
19
|
description?: string;
|
|
20
|
-
thumbnails?: Array<
|
|
20
|
+
thumbnails?: Array<ImageFromDataAPI | null>;
|
|
21
21
|
status: EnrichmentJobStatus;
|
|
22
22
|
requestDate?: string;
|
|
23
23
|
partCount?: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";var __assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},__assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.enrichmentJobDetailFromAPIResponse=exports.enrichmentJobFromAPIResponse=exports.EnrichmentJobType=exports.EnrichmentJobStatus=void 0;var EnrichmentJobStatus,EnrichmentJobType,core_1=require("../../core"),image_1=require("../../data/models/image");!function(e){e.SUBMITTED="submitted",e.IN_PROGRESS="in_progress",e.COMPLETED="completed",e.ERROR="error",e.CANCELED="canceled"}(EnrichmentJobStatus||(exports.EnrichmentJobStatus=EnrichmentJobStatus={})),function(e){e.GENERAL_PART_ATTRIBUTES="general_part_attributes",e.SUPPLIER_DISCOVERY="supplier_discovery",e.CUSTOM_ENRICHMENT="custom_enrichment"}(EnrichmentJobType||(exports.EnrichmentJobType=EnrichmentJobType={}));var enrichmentJobFromAPIResponse=function(e){return{id:e.jobId,title:e.title,jobType:e.jobType,description:e.description,partImages:e.thumbnails?e.thumbnails.map((function(e){return e?image_1.
|
|
2
|
+
"use strict";var __assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},__assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.enrichmentJobDetailFromAPIResponse=exports.enrichmentJobFromAPIResponse=exports.EnrichmentJobType=exports.EnrichmentJobStatus=void 0;var EnrichmentJobStatus,EnrichmentJobType,core_1=require("../../core"),image_1=require("../../data/models/image");!function(e){e.SUBMITTED="submitted",e.IN_PROGRESS="in_progress",e.COMPLETED="completed",e.ERROR="error",e.CANCELED="canceled"}(EnrichmentJobStatus||(exports.EnrichmentJobStatus=EnrichmentJobStatus={})),function(e){e.GENERAL_PART_ATTRIBUTES="general_part_attributes",e.SUPPLIER_DISCOVERY="supplier_discovery",e.CUSTOM_ENRICHMENT="custom_enrichment"}(EnrichmentJobType||(exports.EnrichmentJobType=EnrichmentJobType={}));var enrichmentJobFromAPIResponse=function(e){return{id:e.jobId,title:e.title,jobType:e.jobType,description:e.description,partImages:e.thumbnails?e.thumbnails.map((function(e){return e?(0,image_1.fromDataAPIResponse)(e,core_1.BACKEND_SERVICE.DATA):null})):[],status:e.status,requestDate:e.requestDate,partCount:e.partCount}};exports.enrichmentJobFromAPIResponse=enrichmentJobFromAPIResponse;var enrichmentJobDetailFromAPIResponse=function(e){return __assign(__assign({},(0,exports.enrichmentJobFromAPIResponse)(e)),{description:e.description,requestDate:e.requestDate,partCount:e.partCount})};exports.enrichmentJobDetailFromAPIResponse=enrichmentJobDetailFromAPIResponse;
|
package/find/index.d.ts
CHANGED
|
@@ -1,35 +1,8 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
export * from './models/tagable/i18n-tagable';
|
|
3
|
-
export * from './models/tagable/tagable-base';
|
|
4
|
-
export * from './models/tagable/tagable';
|
|
5
|
-
export * from './models/text-search-result-item/text-search-result-item-unknown';
|
|
6
|
-
export * from './models/text-search-result-item/text-search-result-item-part';
|
|
7
|
-
export * from './models/text-search-result-item/text-search-result-item-document';
|
|
8
|
-
export * from './models/text-search-result-item/text-search-result-item-recent-query';
|
|
9
|
-
export * from './models/text-search-result-item/text-search-error';
|
|
10
|
-
export * from './models/text-search-result-item/text-search-result-item';
|
|
11
2
|
export * from './models/smart-filter';
|
|
12
|
-
export * from './models/search-status/text-search-status';
|
|
13
|
-
export * from './models/search-status/cv-search-status';
|
|
14
|
-
export * from './models/search-status/search-filter-status';
|
|
15
|
-
export * from './models/search-status/search-status';
|
|
16
|
-
export * from './models/search-status/tag-search-status';
|
|
17
|
-
export * from './models/search-filter';
|
|
18
|
-
export * from './models/text-search-manipulator';
|
|
19
|
-
export * from './models/assets/asset';
|
|
20
|
-
export * from './models/text-search-config';
|
|
21
|
-
export * from './models/search-session-log-object';
|
|
22
|
-
export * from './models/search-tag';
|
|
23
|
-
export * from './models/search-result-status';
|
|
24
3
|
export * from './models/search-input';
|
|
25
4
|
export * from './models/search-output';
|
|
26
|
-
export * from './
|
|
5
|
+
export * from './models/image-crop-area';
|
|
27
6
|
export * from './services/search/search.service';
|
|
28
|
-
export * from './services/search/search-result.service';
|
|
29
|
-
export * from './services/search/text-search.service';
|
|
30
|
-
export * from './services/search/cv-search.service';
|
|
31
|
-
export * from './services/filter-uploaders/filter-uploader';
|
|
32
|
-
export * from './services/filter-uploaders/update-filters-uploader';
|
|
33
7
|
export * from './services/asset.service';
|
|
34
|
-
export * from './services/search/tag-search.service';
|
|
35
8
|
export * from './services/search/recent-text-search-queries.service';
|
package/find/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,
|
|
2
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,i){void 0===i&&(i=t);var s=Object.getOwnPropertyDescriptor(r,t);s&&!("get"in s?!r.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,i,s)}:function(e,r,t,i){void 0===i&&(i=t),e[i]=r[t]}),__exportStar=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||__createBinding(r,e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./models/smart-filter"),exports),__exportStar(require("./models/search-input"),exports),__exportStar(require("./models/search-output"),exports),__exportStar(require("./models/image-crop-area"),exports),__exportStar(require("./services/search/search.service"),exports),__exportStar(require("./services/asset.service"),exports),__exportStar(require("./services/search/recent-text-search-queries.service"),exports);
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
2
|
import { PFile } from '../../core';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { ImageCropArea } from './image-crop-area';
|
|
4
|
+
/** @deprecated use the text attribute instead */
|
|
5
|
+
export declare enum TEXT_SEARCH_TYPE {
|
|
6
|
+
SEMANTIC = "semanticText",
|
|
7
|
+
EXACT = "exactText"
|
|
8
|
+
}
|
|
9
|
+
/** @deprecated use the text attribute instead */
|
|
10
|
+
export type TextSearchQueries = {
|
|
11
|
+
[key in TEXT_SEARCH_TYPE]?: string;
|
|
12
|
+
};
|
|
5
13
|
/**
|
|
6
14
|
* Search-Input for searches
|
|
7
15
|
*/
|
|
@@ -17,7 +25,7 @@ export interface SearchInput {
|
|
|
17
25
|
text?: string;
|
|
18
26
|
/**
|
|
19
27
|
* either searchImageAssetId or searchImage can be set to perform image-search.
|
|
20
|
-
* An imageId obtained via
|
|
28
|
+
* An imageId obtained via AssetService.uploadImage (or from a previous search-response)
|
|
21
29
|
* can be passed here to reuse an already uploaded image without uploading it again.
|
|
22
30
|
*/
|
|
23
31
|
searchImageAssetId?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
2
|
+
"use strict";var TEXT_SEARCH_TYPE;Object.defineProperty(exports,"__esModule",{value:!0}),exports.TEXT_SEARCH_TYPE=void 0,function(T){T.SEMANTIC="semanticText",T.EXACT="exactText"}(TEXT_SEARCH_TYPE||(exports.TEXT_SEARCH_TYPE=TEXT_SEARCH_TYPE={}));
|
|
@@ -6,155 +6,94 @@ import { BaseLoginInitService } from '../../core/services/base-login-init.servic
|
|
|
6
6
|
import { DownloadStatus } from '../../core/services/http/file-transfer/file-transfer.service.interface';
|
|
7
7
|
import { BACKEND_SERVICE } from '../../core/services/http/https.service.interface';
|
|
8
8
|
import { ServiceProvider } from '../../core/services/service-provider';
|
|
9
|
-
import { Asset } from '../models/assets/asset';
|
|
10
9
|
import { EventContext, Organization } from '../../core';
|
|
11
10
|
export interface AssetEventContext extends EventContext {
|
|
11
|
+
/** Organization id used for V2 event logging (e.g. image-dimensions log). */
|
|
12
|
+
organizationId: string;
|
|
12
13
|
searchSessionId?: string;
|
|
13
14
|
}
|
|
15
|
+
export interface ImageUploadApiResponse {
|
|
16
|
+
assetId: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ImageDownloadUrlsApiResponse {
|
|
19
|
+
urls: Record<string, string>;
|
|
20
|
+
}
|
|
14
21
|
/**
|
|
15
22
|
* Service for creating and uploading assets of different types.
|
|
16
|
-
*
|
|
17
|
-
* Process:
|
|
18
|
-
* When a new asset should be created
|
|
19
|
-
* - a request is sent to the backend to request a new upload
|
|
20
|
-
* - the BE returns with an upload url
|
|
21
|
-
* - after the upload is finished the App notifies the BE about the finished upload
|
|
22
|
-
* - and the final asset will be created in the BE
|
|
23
23
|
*/
|
|
24
24
|
export interface AssetService {
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* Upload an image that can be reused in subsequent searches without uploading it again.
|
|
27
|
+
* The returned assetId can be passed as `searchImageAssetId` in the search-input of performSearch.
|
|
28
|
+
* It is also possible to use the image for other purpose, such as CSA-metadata.
|
|
29
|
+
*
|
|
30
|
+
* Only available on platforms that support multipart-upload (see PFile.supportsMultipartUpload).
|
|
31
|
+
* On other platforms an SdkError with code MULTIPART_UPLOAD_NOT_SUPPORTED is emitted.
|
|
29
32
|
*
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
*
|
|
33
|
-
* @
|
|
34
|
-
*
|
|
33
|
+
* @param image the image to upload
|
|
34
|
+
* @param organizationName (optional) organization name to associate with the uploaded image.
|
|
35
|
+
* If not provided, the authenticated user's default organization is used by the backend.
|
|
36
|
+
* @param assetEventContext AssetEventContext for V2 event logging. Must include `organizationId`; pass `searchSessionId` to associate the image-dimensions-log with an existing search-session.
|
|
37
|
+
* @returns Observable that resolves with the assetId of the uploaded image
|
|
35
38
|
*/
|
|
36
|
-
|
|
37
|
-
asset: Asset;
|
|
38
|
-
progress: number;
|
|
39
|
-
}>;
|
|
39
|
+
uploadImage(image: PFile, organizationName: string | undefined, assetEventContext: AssetEventContext): Observable<string>;
|
|
40
40
|
/**
|
|
41
41
|
* Download an image by its assetId and preferred size.
|
|
42
42
|
*
|
|
43
43
|
* @param assetId the assetId of the image that should be downloaded
|
|
44
44
|
* @param size the names of the sizes this image is available in eg: "original", "thumbnail", "medium"
|
|
45
|
+
* @param origin the origin of the image (defaults to PARTIUM; pass DATA for data-backend images)
|
|
45
46
|
* @returns an Observable that resolves with the DownloadStatus of the download, which contains
|
|
46
47
|
* the progress and the PFile as soon as it is finished
|
|
47
48
|
*/
|
|
48
49
|
downloadImage(assetId: string, size?: string, origin?: BACKEND_SERVICE): Observable<DownloadStatus>;
|
|
49
50
|
/**
|
|
50
|
-
*
|
|
51
|
-
* Download an image from Find BE
|
|
52
|
-
*
|
|
53
|
-
* @param assetId asset-id of the image to download
|
|
54
|
-
*/
|
|
55
|
-
getImageUrlFromFind(assetId: string): Observable<{
|
|
56
|
-
url: string;
|
|
57
|
-
assetId: string;
|
|
58
|
-
}>;
|
|
59
|
-
/**
|
|
60
|
-
* Download an document by its assetId.
|
|
61
|
-
*
|
|
62
|
-
* @param assetId the assetId of the document that should be downloaded
|
|
63
|
-
* @returns an Observable that resolves with the DownloadStatus of the download, which contains
|
|
64
|
-
* the progress and the PFile as soon as it is finished
|
|
51
|
+
* Get the download urls of an image by its assetId.
|
|
65
52
|
*
|
|
66
|
-
* @
|
|
53
|
+
* @param assetId the assetId of the image that should be downloaded
|
|
54
|
+
* @returns an Observable that resolves with the download urls of the image in the form of { size: url }
|
|
67
55
|
*/
|
|
68
|
-
|
|
56
|
+
getImageDownloadUrls(assetId: string): Observable<Record<string, string>>;
|
|
69
57
|
}
|
|
70
58
|
export declare class AssetServiceImpl extends BaseLoginInitService implements AssetService {
|
|
71
59
|
private httpsService;
|
|
72
60
|
private fileTransferService;
|
|
73
61
|
private fileService;
|
|
74
62
|
private logService;
|
|
75
|
-
private MAX_UPLOAD_IMAGE_WIDTH;
|
|
76
|
-
private MAX_UPLOAD_IMAGE_HEIGHT;
|
|
77
63
|
constructor(serviceProvider: ServiceProvider);
|
|
78
64
|
onCreate(): void;
|
|
79
65
|
/**
|
|
80
66
|
* Called on login
|
|
81
67
|
*/
|
|
82
68
|
init(config: PartiumConfig, userEmail: string, currentOrganization$: Observable<Organization>): Observable<void>;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}>;
|
|
69
|
+
uploadImage(image: PFile, organizationName: string | undefined, assetEventContext: AssetEventContext): Observable<string>;
|
|
70
|
+
downloadImage(assetId: string, size?: string, origin?: BACKEND_SERVICE): Observable<DownloadStatus>;
|
|
71
|
+
getImageDownloadUrls(assetId: string): Observable<Record<string, string>>;
|
|
87
72
|
/**
|
|
88
73
|
* Check if the asset is an image and, in that case, log its dimensions.
|
|
74
|
+
* Fire-and-forget: failures only get logged to the console and never affect the upload itself.
|
|
89
75
|
*
|
|
90
|
-
* @param
|
|
91
|
-
* @return Promise<boolean>
|
|
92
|
-
*/
|
|
93
|
-
private getFileDimensions;
|
|
94
|
-
/**
|
|
95
|
-
* Check if the provided dimensions are supported.
|
|
96
|
-
*
|
|
97
|
-
* @param width number
|
|
98
|
-
* @param height number
|
|
99
|
-
* @return boolean
|
|
100
|
-
*/
|
|
101
|
-
private validateDimensions;
|
|
102
|
-
/**
|
|
103
|
-
* Log image dimensions to BE-Log service.
|
|
104
|
-
*
|
|
105
|
-
* @param width number
|
|
106
|
-
* @param height number
|
|
107
|
-
* @param searchDomainId string
|
|
76
|
+
* @param image PFile
|
|
108
77
|
* @param assetEventContext AssetEventContext
|
|
109
|
-
* @return Promise<void>
|
|
110
78
|
*/
|
|
111
79
|
private logImageDimensions;
|
|
112
|
-
downloadImage(assetId: string, size?: string, origin?: BACKEND_SERVICE): Observable<DownloadStatus>;
|
|
113
80
|
/**
|
|
114
|
-
* Get the
|
|
81
|
+
* Get the download url of an image by its assetId.
|
|
115
82
|
*
|
|
116
|
-
* @param assetId the assetId of image
|
|
83
|
+
* @param assetId the assetId of the image that should be downloaded
|
|
117
84
|
* @param size the names of the sizes this image is available in eg: "original", "thumbnail", "medium"
|
|
118
|
-
* @returns Observable that resolves with an object containing the
|
|
119
|
-
* can be downloaded and the assetId of the
|
|
85
|
+
* @returns Observable that resolves with an object containing the url, where the image
|
|
86
|
+
* can be downloaded and the assetId of the image
|
|
120
87
|
*/
|
|
121
88
|
private getImageUrl;
|
|
122
|
-
getImageUrlFromFind(assetId: string): Observable<{
|
|
123
|
-
url: string;
|
|
124
|
-
assetId: string;
|
|
125
|
-
}>;
|
|
126
|
-
downloadDocument(assetId: string): Observable<DownloadStatus>;
|
|
127
89
|
/**
|
|
128
|
-
* Get the temporary download url of
|
|
129
|
-
*
|
|
130
|
-
* @param assetId the assetId of the document
|
|
131
|
-
* @returns Observable that resolves with an object containing the temporary url, where the document
|
|
132
|
-
* can be downloaded and the assetId of the asset
|
|
133
|
-
*/
|
|
134
|
-
private getDocumentUrl;
|
|
135
|
-
/**
|
|
136
|
-
* Upload a newly created asset to the BE.
|
|
137
|
-
*
|
|
138
|
-
* @param searchDomainId Search domain to upload the asset to.
|
|
139
|
-
* @param asset the asset to upload
|
|
140
|
-
* @returns Observable that resolves with an object containing the asset-object
|
|
141
|
-
* and the current upload progress
|
|
142
|
-
*/
|
|
143
|
-
private uploadAsset;
|
|
144
|
-
/**
|
|
145
|
-
* Send a request to the backend to create a new asset and retrieve the uploadUrl and
|
|
146
|
-
* Reference id. This data is then applied to the given asset object.
|
|
147
|
-
*
|
|
148
|
-
* @param searchDomainId Search domain to upload the asset to.
|
|
149
|
-
* @param asset the asset object to prepare for upload
|
|
150
|
-
* @returns Observable that resolves when the prepare-asset is finished successfully
|
|
151
|
-
*/
|
|
152
|
-
private prepareAssetUpload;
|
|
153
|
-
/**
|
|
154
|
-
* Sends a request to the backend to verify an uploaded asset.
|
|
90
|
+
* Get the temporary download url of an image by its assetId and preferred size
|
|
155
91
|
*
|
|
156
|
-
* @param
|
|
157
|
-
* @
|
|
92
|
+
* @param assetId the assetId of image
|
|
93
|
+
* @param size the names of the sizes this image is available in eg: "original", "thumbnail", "medium"
|
|
94
|
+
* @returns Observable that resolves with an object containing the temporary url, where the image
|
|
95
|
+
* can be downloaded and the assetId of the image
|
|
158
96
|
*/
|
|
159
|
-
private
|
|
97
|
+
private getDataImageUrl;
|
|
98
|
+
private resolveDownloadUrlForSize;
|
|
160
99
|
}
|