@partium/js-sdk 14.4.1 → 14.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/catalog/index.js +1 -21
  2. package/catalog/models/catalog-image-info.js +1 -22
  3. package/catalog/models/catalog-image.js +1 -40
  4. package/catalog/models/upsert-catalog-images-dto.js +1 -3
  5. package/catalog/models/upsert-images-result.js +1 -3
  6. package/catalog/services/images.service.js +1 -62
  7. package/core/constants/constants.d.ts +1 -0
  8. package/core/constants/constants.js +1 -16
  9. package/core/decorators/injection-identifier.js +1 -19
  10. package/core/factories/paginated-request-service.factory.js +1 -33
  11. package/core/index.js +1 -63
  12. package/core/integration-defaults/http/fetch-api-http-error-helper.js +1 -129
  13. package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.js +1 -138
  14. package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.js +1 -210
  15. package/core/integration-defaults/http/handle-axios-error-helper.js +1 -79
  16. package/core/integration-defaults/http/https-client/axios-https-client.service.js +1 -182
  17. package/core/integration-defaults/http/https-client/fetch-api-https-client.service.js +1 -198
  18. package/core/integration-defaults/http/js-oauth-keycloak-https.service.js +1 -32
  19. package/core/integration-defaults/js-p-file.js +1 -36
  20. package/core/integration-defaults/session/js-oauth-api-key-session.service.js +1 -206
  21. package/core/integration-defaults/session/js-oauth-keycloak-auth-config.js +1 -64
  22. package/core/integration-defaults/session/js-oauth-keycloak-session.service.js +1 -257
  23. package/core/integration-defaults/web-device-status.service.js +1 -125
  24. package/core/integration-defaults/web-file.service.js +1 -135
  25. package/core/integration-defaults/web-indexeddb.service.js +1 -142
  26. package/core/integration-defaults/web-local-storage.service.js +1 -310
  27. package/core/models/api-object.js +1 -16
  28. package/core/models/auth-config.js +1 -72
  29. package/core/models/device-info.js +1 -34
  30. package/core/models/error.js +1 -107
  31. package/core/models/formatted-string.js +1 -14
  32. package/core/models/i18n-map.js +1 -61
  33. package/core/models/i18n-string.js +1 -35
  34. package/core/models/log.js +1 -137
  35. package/core/models/organization.js +1 -159
  36. package/core/models/p-file.js +1 -23
  37. package/core/models/paginated-list.js +1 -41
  38. package/core/models/partium-config.js +1 -43
  39. package/core/models/user-token.js +1 -11
  40. package/core/models/user.js +1 -89
  41. package/core/services/backend-status.service.js +1 -147
  42. package/core/services/base-login-init.service.js +1 -57
  43. package/core/services/base.service.js +1 -37
  44. package/core/services/device-status.service.interface.js +1 -117
  45. package/core/services/file.service.interface.js +1 -61
  46. package/core/services/http/file-transfer/file-transfer.service.interface.js +1 -125
  47. package/core/services/http/https-client/https-client.service.interface.js +1 -152
  48. package/core/services/http/https.service.interface.d.ts +3 -1
  49. package/core/services/http/https.service.interface.js +1 -294
  50. package/core/services/http/oauth-https.service.js +1 -218
  51. package/core/services/local-storage.service.interface.js +1 -378
  52. package/core/services/log.service.js +1 -139
  53. package/core/services/organization.service.js +1 -202
  54. package/core/services/paginated-request.service.js +1 -154
  55. package/core/services/recent-parts.service.js +1 -194
  56. package/core/services/service-provider.js +1 -114
  57. package/core/services/session/oauth-session.service.js +1 -104
  58. package/core/services/session/session.service.interface.js +1 -367
  59. package/core/utils/general-helper.js +1 -110
  60. package/data/index.js +1 -44
  61. package/data/models/announcement.js +1 -70
  62. package/data/models/assembly-hierarchy-node-breadcrumb.js +1 -51
  63. package/data/models/assembly-hierarchy-node.js +1 -46
  64. package/data/models/attribute.js +1 -106
  65. package/data/models/csa-request-search.js +1 -46
  66. package/data/models/csa-request-status.js +1 -51
  67. package/data/models/csa-request.js +1 -112
  68. package/data/models/document.js +1 -17
  69. package/data/models/filter-key.js +1 -36
  70. package/data/models/filter-option-value.js +1 -41
  71. package/data/models/image.js +1 -77
  72. package/data/models/inquiry.js +1 -71
  73. package/data/models/mounting-location.js +1 -58
  74. package/data/models/multiple-expert-searches.js +1 -40
  75. package/data/models/part-enrichment-data.js +1 -50
  76. package/data/models/part.d.ts +1 -1
  77. package/data/models/part.js +1 -168
  78. package/data/models/shopping-cart.js +1 -60
  79. package/data/services/announcement.service.js +1 -89
  80. package/data/services/assembly-hierarchy-nodes.service.js +1 -193
  81. package/data/services/csa-helper.service.js +1 -158
  82. package/data/services/customer-service-assistance.service.js +1 -276
  83. package/data/services/filter.service.js +1 -97
  84. package/data/services/inquiry.service.js +1 -68
  85. package/data/services/part-attribute.service.js +1 -118
  86. package/data/services/part-enrichment.service.js +1 -56
  87. package/data/services/part.service.js +1 -182
  88. package/data/services/related-parts.service.js +1 -83
  89. package/data/services/shopping-cart.service.js +1 -152
  90. package/datacuration/index.d.ts +2 -0
  91. package/datacuration/index.js +2 -0
  92. package/datacuration/models/image-submission-request.d.ts +55 -0
  93. package/datacuration/models/image-submission-request.js +2 -0
  94. package/datacuration/models/submitted-image-response.d.ts +27 -0
  95. package/datacuration/models/submitted-image-response.js +2 -0
  96. package/datacuration/services/image-submission.service.d.ts +26 -0
  97. package/datacuration/services/image-submission.service.js +2 -0
  98. package/find/index.js +1 -51
  99. package/find/models/assets/asset.js +1 -32
  100. package/find/models/search-filter.js +1 -205
  101. package/find/models/search-input.js +1 -3
  102. package/find/models/search-output.js +1 -3
  103. package/find/models/search-result-status.js +1 -40
  104. package/find/models/search-session-log-object.js +1 -22
  105. package/find/models/search-status/cv-search-status.js +1 -22
  106. package/find/models/search-status/search-filter-status.js +1 -36
  107. package/find/models/search-status/search-status.js +1 -56
  108. package/find/models/search-status/tag-search-status.js +1 -23
  109. package/find/models/search-status/text-search-status.js +1 -18
  110. package/find/models/search-tag.js +1 -16
  111. package/find/models/smart-filter.js +1 -49
  112. package/find/models/tagable/i18n-tagable.js +1 -37
  113. package/find/models/tagable/tagable-base.js +1 -22
  114. package/find/models/tagable/tagable.js +1 -37
  115. package/find/models/text-search-config.js +1 -70
  116. package/find/models/text-search-manipulator.js +1 -90
  117. package/find/models/text-search-result-item/text-search-error.js +1 -12
  118. package/find/models/text-search-result-item/text-search-result-item-document.js +1 -34
  119. package/find/models/text-search-result-item/text-search-result-item-part.js +1 -36
  120. package/find/models/text-search-result-item/text-search-result-item-recent-query.js +1 -35
  121. package/find/models/text-search-result-item/text-search-result-item-unknown.js +1 -38
  122. package/find/models/text-search-result-item/text-search-result-item.js +1 -22
  123. package/find/services/asset.service.js +1 -348
  124. package/find/services/filter-uploaders/filter-uploader.js +1 -3
  125. package/find/services/filter-uploaders/update-filters-uploader.js +1 -77
  126. package/find/services/filter-uploaders/update-filters.model.js +1 -7
  127. package/find/services/search/cv-search.service.js +1 -214
  128. package/find/services/search/recent-text-search-queries.service.js +1 -260
  129. package/find/services/search/search-result.service.js +1 -539
  130. package/find/services/search/search.service.js +1 -514
  131. package/find/services/search/tag-search.service.js +1 -124
  132. package/find/services/search/text-search.service.js +1 -316
  133. package/find/services/search-filter.service.js +1 -292
  134. package/find/utils/search-helper.js +1 -75
  135. package/gen/sdk-version.d.ts +1 -1
  136. package/gen/sdk-version.js +1 -5
  137. package/index.d.ts +2 -0
  138. package/index.js +1 -392
  139. package/management/index.js +1 -21
  140. package/management/models/api-key-list-response.js +1 -3
  141. package/management/models/api-key-type.js +1 -9
  142. package/management/models/api-key.js +1 -3
  143. package/management/services/api-key.service.js +1 -53
  144. package/ocr/index.js +1 -20
  145. package/ocr/models/detect-response.js +1 -3
  146. package/ocr/models/detected-text-entry.js +1 -3
  147. package/ocr/services/ocr.service.js +1 -59
  148. package/package.json +1 -1
  149. package/user-data/index.js +1 -21
  150. package/user-data/models/part-with-nullable.js +1 -3
  151. package/user-data/models/request-list/request-list.js +1 -63
  152. package/user-data/services/favorite/favorite.service.js +1 -108
  153. package/user-data/services/request-list/request-list.service.js +1 -133
@@ -1,277 +1,2 @@
1
1
  // Copyright © 2022-2025 Partium, Inc. DBA Partium
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
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;
@@ -1,98 +1,2 @@
1
1
  // Copyright © 2022-2025 Partium, Inc. DBA Partium
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
2
+ "use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),__decorate=this&&this.__decorate||function(e,t,r,o){var i,n=arguments.length,c=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(c=(n<3?i(c):n>3?i(t,r,c):i(t,r))||c);return n>3&&c&&Object.defineProperty(t,r,c),c},__spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var o,i=0,n=t.length;i<n;i++)!o&&i in t||(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return e.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.FilterServiceImpl=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),core_1=require("../../core"),filter_key_1=require("../models/filter-key"),filter_option_value_1=require("../models/filter-option-value"),FilterServiceImpl=function(e){function t(t){var r=e.call(this,t)||this;return r.PAGINATION_PAGE_SIZE=25,r}return __extends(t,e),t.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(core_1.HttpsService)},t.prototype.getFilterKey=function(e){return this.httpsService.get("filters/".concat(e),[],core_1.BACKEND_SERVICE.DATA).pipe((0,operators_1.map)((function(e){return filter_key_1.FilterKey.fromAPIResponse(e)})))},t.prototype.getFilterKeys=function(e,t,r){return void 0===t&&(t=this.PAGINATION_PAGE_SIZE),core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(filter_key_1.FilterKey.fromAPIResponse,this.httpsService,"filters",core_1.BACKEND_SERVICE.DATA,__spreadArray([],e?[{lang:e}]:[],!0),t,r)},t.prototype.getFilterOptions=function(e,t){return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(filter_option_value_1.FilterOptionValue.fromAPIResponse,this.httpsService,"filters/".concat(e,"/options"),core_1.BACKEND_SERVICE.DATA,[],this.PAGINATION_PAGE_SIZE,t)},t.prototype.searchFilterKeys=function(e,t,r,o){return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(filter_key_1.FilterKey.fromAPIResponse,this.httpsService,"filters",core_1.BACKEND_SERVICE.DATA,__spreadArray([{search:e}],t?[{lang:t}]:[],!0),r||this.PAGINATION_PAGE_SIZE,o)},t.prototype.searchMultipleFilterKeys=function(e,t,r){var o=this;void 0===r&&(r=25);var i=[];for(var n in e)"hardFilters"===n&&i.push.apply(i,e[n].map((function(e){return e.label})));return 0===i.length?(0,rxjs_1.of)([]):(0,rxjs_1.from)(i).pipe((0,operators_1.mergeMap)((function(e){return o.searchFilterKeys(e,t,r,!0).loadInitialPage(!0).pipe((0,operators_1.map)((function(t){return t.items.find((function(t){return t.name===e}))})))})),(0,operators_1.scan)((function(e,t){return e.concat(t)}),[]))},t.prototype.searchFilterOptions=function(e,t,r){return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(filter_option_value_1.FilterOptionValue.fromAPIResponse,this.httpsService,"filters/".concat(e,"/options"),core_1.BACKEND_SERVICE.DATA,[{search:t}],this.PAGINATION_PAGE_SIZE,r)},t=__decorate([(0,core_1.InjectionIdentifier)("FilterService")],t)}(core_1.BaseService);exports.FilterServiceImpl=FilterServiceImpl;
@@ -1,69 +1,2 @@
1
1
  // Copyright © 2022-2025 Partium, Inc. DBA Partium
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
2
+ "use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),__decorate=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s};Object.defineProperty(exports,"__esModule",{value:!0}),exports.InquiryServiceImpl=void 0;var operators_1=require("rxjs/operators"),core_1=require("../../core"),injection_identifier_1=require("../../core/decorators/injection-identifier"),base_service_1=require("../../core/services/base.service"),https_service_interface_1=require("../../core/services/http/https.service.interface"),inquiry_1=require("../models/inquiry"),InquiryServiceImpl=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(https_service_interface_1.HttpsService)},t.prototype.getInquiries=function(e,t){return void 0===e&&(e=25),void 0===t&&(t=[]),core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(inquiry_1.Inquiry.fromAPIResponse,this.httpsService,"inquiries",https_service_interface_1.BACKEND_SERVICE.CSA,t,e)},t.prototype.getInquiry=function(e){return this.httpsService.get("inquiries/".concat(e),[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(e){return inquiry_1.Inquiry.fromAPIResponse(e)})))},t.prototype.createInquiry=function(){return this.httpsService.post("inquiries/",{},[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(e){return inquiry_1.Inquiry.fromAPIResponse(e)})))},t.prototype.updateInquiryStatus=function(e,t){return this.httpsService.put("inquiries/".concat(e,"/status"),{status:t},[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(e){return new inquiry_1.InquiryStatusResponse(e)})))},t.prototype.exportInquiryAsEmail=function(e,t,r,i){return this.httpsService.post("inquiries/".concat(e,"/actions/email"),{recipients:t,subject:r,message:i},[],https_service_interface_1.BACKEND_SERVICE.CSA)},t=__decorate([(0,injection_identifier_1.InjectionIdentifier)("InquiryService")],t)}(base_service_1.BaseService);exports.InquiryServiceImpl=InquiryServiceImpl;
@@ -1,119 +1,2 @@
1
1
  // Copyright © 2022-2025 Partium, Inc. DBA Partium
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
2
+ "use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])},t(r,e)};return function(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}(),__decorate=this&&this.__decorate||function(t,r,e,o){var n,i=arguments.length,a=i<3?r:null===o?o=Object.getOwnPropertyDescriptor(r,e):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,r,e,o);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(a=(i<3?n(a):i>3?n(r,e,a):n(r,e))||a);return i>3&&a&&Object.defineProperty(r,e,a),a},__spreadArray=this&&this.__spreadArray||function(t,r,e){if(e||2===arguments.length)for(var o,n=0,i=r.length;n<i;n++)!o&&n in r||(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return t.concat(o||Array.prototype.slice.call(r))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PartAttributeServiceImpl=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),core_1=require("../../core"),attribute_1=require("../models/attribute"),part_1=require("../models/part"),PartAttributeServiceImpl=function(t){function r(r){var e=t.call(this,r)||this;return e.DOWNLOAD_PAGE_SIZE=250,e}return __extends(r,t),r.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(core_1.HttpsService)},r.prototype.getAttributesForPart=function(t){return this.loadPartAttributesFromServer(t).pipe((0,operators_1.catchError)((function(t){return console.log("Error while loading part-information from server.",t),(0,rxjs_1.throwError)(t)})))},r.prototype.loadPartAttributesFromServer=function(t){var r=this,e=1,o=new rxjs_1.Subject;return(0,rxjs_1.defer)((function(){return r.requestPaginatedAttributes(t,e)})).pipe((0,operators_1.map)((function(t){var r=t.pagination.page_size,n=t.pagination.items_count,i=Math.ceil(n/r);return e>=i?o.complete():e++<i&&setTimeout((function(){o.next()})),t.results})),(0,operators_1.repeatWhen)((function(){return o.asObservable()})),(0,operators_1.reduce)((function(t,r){return __spreadArray(__spreadArray([],t,!0),r,!0)})),(0,operators_1.map)((function(t){return t.filter((function(t){var r=t.metadata&&t.metadata.source;return!r||!["__HITL_ANNOTATIONS__","__ENRICHED_METADATA__"].some((function(t){return t===r}))})).map((function(t){return attribute_1.Attribute.fromAPIResponse(t,part_1.DATA_ORIGIN.DATA_API)}))})))},r.prototype.requestPaginatedAttributes=function(t,r){return this.httpsService.get("/part_types/".concat(t,"/attributes"),[{page:r},{page_size:this.DOWNLOAD_PAGE_SIZE}],core_1.BACKEND_SERVICE.DATA)},r=__decorate([(0,core_1.InjectionIdentifier)("PartAttributeService")],r)}(core_1.BaseLoginInitService);exports.PartAttributeServiceImpl=PartAttributeServiceImpl;