@partium/js-sdk 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +100 -0
- package/README.md +18 -0
- package/core/constants/constants.d.ts +12 -0
- package/core/constants/constants.js +2 -0
- package/core/decorators/injection-identifier.d.ts +10 -0
- package/core/decorators/injection-identifier.js +2 -0
- package/core/factories/paginated-request-service.factory.d.ts +22 -0
- package/core/factories/paginated-request-service.factory.js +2 -0
- package/core/index.d.ts +47 -0
- package/core/index.js +2 -0
- package/core/integration-defaults/http/fetch-api-http-error-helper.d.ts +16 -0
- package/core/integration-defaults/http/fetch-api-http-error-helper.js +2 -0
- package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.d.ts +35 -0
- package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.js +2 -0
- package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.d.ts +47 -0
- package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.js +2 -0
- package/core/integration-defaults/http/handle-axios-error-helper.d.ts +17 -0
- package/core/integration-defaults/http/handle-axios-error-helper.js +2 -0
- package/core/integration-defaults/http/https-client/axios-https-client.service.d.ts +83 -0
- package/core/integration-defaults/http/https-client/axios-https-client.service.js +2 -0
- package/core/integration-defaults/http/https-client/fetch-api-https-client.service.d.ts +85 -0
- package/core/integration-defaults/http/https-client/fetch-api-https-client.service.js +2 -0
- package/core/integration-defaults/http/js-oauth-keycloak-https.service.d.ts +8 -0
- package/core/integration-defaults/http/js-oauth-keycloak-https.service.js +2 -0
- package/core/integration-defaults/js-p-file.d.ts +8 -0
- package/core/integration-defaults/js-p-file.js +2 -0
- package/core/integration-defaults/session/js-oauth-api-key-session.service.d.ts +76 -0
- package/core/integration-defaults/session/js-oauth-api-key-session.service.js +2 -0
- package/core/integration-defaults/session/js-oauth-keycloak-auth-config.d.ts +28 -0
- package/core/integration-defaults/session/js-oauth-keycloak-auth-config.js +2 -0
- package/core/integration-defaults/session/js-oauth-keycloak-session.service.d.ts +82 -0
- package/core/integration-defaults/session/js-oauth-keycloak-session.service.js +2 -0
- package/core/integration-defaults/web-device-status.service.d.ts +24 -0
- package/core/integration-defaults/web-device-status.service.js +2 -0
- package/core/integration-defaults/web-file.service.d.ts +9 -0
- package/core/integration-defaults/web-file.service.js +2 -0
- package/core/integration-defaults/web-indexeddb.service.d.ts +19 -0
- package/core/integration-defaults/web-indexeddb.service.js +2 -0
- package/core/integration-defaults/web-local-storage.service.d.ts +157 -0
- package/core/integration-defaults/web-local-storage.service.js +2 -0
- package/core/models/api-object.d.ts +7 -0
- package/core/models/api-object.js +2 -0
- package/core/models/auth-config.d.ts +38 -0
- package/core/models/auth-config.js +2 -0
- package/core/models/device-info.d.ts +62 -0
- package/core/models/device-info.js +2 -0
- package/core/models/error.d.ts +70 -0
- package/core/models/error.js +2 -0
- package/core/models/formatted-string.d.ts +9 -0
- package/core/models/formatted-string.js +2 -0
- package/core/models/i18n-map.d.ts +34 -0
- package/core/models/i18n-map.js +2 -0
- package/core/models/i18n-string.d.ts +8 -0
- package/core/models/i18n-string.js +2 -0
- package/core/models/log.d.ts +130 -0
- package/core/models/log.js +2 -0
- package/core/models/organization.d.ts +121 -0
- package/core/models/organization.js +2 -0
- package/core/models/p-file.d.ts +17 -0
- package/core/models/p-file.js +2 -0
- package/core/models/paginated-list.d.ts +23 -0
- package/core/models/paginated-list.js +2 -0
- package/core/models/partium-config.d.ts +31 -0
- package/core/models/partium-config.js +2 -0
- package/core/models/user-token.d.ts +16 -0
- package/core/models/user-token.js +2 -0
- package/core/models/user.d.ts +48 -0
- package/core/models/user.js +2 -0
- package/core/services/backend-status.service.d.ts +46 -0
- package/core/services/backend-status.service.js +2 -0
- package/core/services/base-login-init.service.d.ts +32 -0
- package/core/services/base-login-init.service.js +2 -0
- package/core/services/base.service.d.ts +31 -0
- package/core/services/base.service.js +2 -0
- package/core/services/device-status.service.interface.d.ts +36 -0
- package/core/services/device-status.service.interface.js +2 -0
- package/core/services/file.service.interface.d.ts +24 -0
- package/core/services/file.service.interface.js +2 -0
- package/core/services/http/file-transfer/file-transfer.service.interface.d.ts +57 -0
- package/core/services/http/file-transfer/file-transfer.service.interface.js +2 -0
- package/core/services/http/https-client/https-client.service.interface.d.ts +96 -0
- package/core/services/http/https-client/https-client.service.interface.js +2 -0
- package/core/services/http/https.service.interface.d.ts +164 -0
- package/core/services/http/https.service.interface.js +2 -0
- package/core/services/http/oauth-https.service.d.ts +120 -0
- package/core/services/http/oauth-https.service.js +2 -0
- package/core/services/local-storage.service.interface.d.ts +221 -0
- package/core/services/local-storage.service.interface.js +2 -0
- package/core/services/log.service.d.ts +48 -0
- package/core/services/log.service.js +2 -0
- package/core/services/organization.service.d.ts +48 -0
- package/core/services/organization.service.js +2 -0
- package/core/services/paginated-request.service.d.ts +104 -0
- package/core/services/paginated-request.service.js +2 -0
- package/core/services/recent-parts.service.d.ts +59 -0
- package/core/services/recent-parts.service.js +2 -0
- package/core/services/service-provider.d.ts +58 -0
- package/core/services/service-provider.js +2 -0
- package/core/services/session/oauth-session.service.d.ts +76 -0
- package/core/services/session/oauth-session.service.js +2 -0
- package/core/services/session/session.service.interface.d.ts +138 -0
- package/core/services/session/session.service.interface.js +2 -0
- package/core/utils/general-helper.d.ts +35 -0
- package/core/utils/general-helper.js +2 -0
- package/data/index.d.ts +28 -0
- package/data/index.js +2 -0
- package/data/models/announcement.d.ts +30 -0
- package/data/models/announcement.js +2 -0
- package/data/models/assembly-hierarchy-node-breadcrumb.d.ts +10 -0
- package/data/models/assembly-hierarchy-node-breadcrumb.js +2 -0
- package/data/models/assembly-hierarchy-node.d.ts +16 -0
- package/data/models/assembly-hierarchy-node.js +2 -0
- package/data/models/attribute.d.ts +46 -0
- package/data/models/attribute.js +2 -0
- package/data/models/csa-request-search.d.ts +18 -0
- package/data/models/csa-request-search.js +2 -0
- package/data/models/csa-request-status.d.ts +16 -0
- package/data/models/csa-request-status.js +2 -0
- package/data/models/csa-request.d.ts +41 -0
- package/data/models/csa-request.js +2 -0
- package/data/models/document.d.ts +12 -0
- package/data/models/document.js +2 -0
- package/data/models/filter-key.d.ts +12 -0
- package/data/models/filter-key.js +2 -0
- package/data/models/filter-option-value.d.ts +18 -0
- package/data/models/filter-option-value.js +2 -0
- package/data/models/image.d.ts +36 -0
- package/data/models/image.js +2 -0
- package/data/models/inquiry.d.ts +32 -0
- package/data/models/inquiry.js +2 -0
- package/data/models/mounting-location.d.ts +32 -0
- package/data/models/mounting-location.js +2 -0
- package/data/models/multiple-expert-searches.d.ts +9 -0
- package/data/models/multiple-expert-searches.js +2 -0
- package/data/models/part-enrichment-data.d.ts +24 -0
- package/data/models/part-enrichment-data.js +2 -0
- package/data/models/part.d.ts +168 -0
- package/data/models/part.js +2 -0
- package/data/models/shopping-cart.d.ts +43 -0
- package/data/models/shopping-cart.js +2 -0
- package/data/services/announcement.service.d.ts +68 -0
- package/data/services/announcement.service.js +2 -0
- package/data/services/assembly-hierarchy-nodes.service.d.ts +113 -0
- package/data/services/assembly-hierarchy-nodes.service.js +2 -0
- package/data/services/csa-helper.service.d.ts +32 -0
- package/data/services/csa-helper.service.js +2 -0
- package/data/services/customer-service-assistance.service.d.ts +181 -0
- package/data/services/customer-service-assistance.service.js +2 -0
- package/data/services/filter.service.d.ts +97 -0
- package/data/services/filter.service.js +2 -0
- package/data/services/inquiry.service.d.ts +54 -0
- package/data/services/inquiry.service.js +2 -0
- package/data/services/part-attribute.service.d.ts +42 -0
- package/data/services/part-attribute.service.js +2 -0
- package/data/services/part-enrichment.service.d.ts +32 -0
- package/data/services/part-enrichment.service.js +2 -0
- package/data/services/part.service.d.ts +121 -0
- package/data/services/part.service.js +2 -0
- package/data/services/related-parts.service.d.ts +75 -0
- package/data/services/related-parts.service.js +2 -0
- package/data/services/shopping-cart.service.d.ts +150 -0
- package/data/services/shopping-cart.service.js +2 -0
- package/find/index.d.ts +35 -0
- package/find/index.js +2 -0
- package/find/models/assets/asset.d.ts +24 -0
- package/find/models/assets/asset.js +2 -0
- package/find/models/search-filter.d.ts +87 -0
- package/find/models/search-filter.js +2 -0
- package/find/models/search-input.d.ts +39 -0
- package/find/models/search-input.js +2 -0
- package/find/models/search-output.d.ts +10 -0
- package/find/models/search-output.js +2 -0
- package/find/models/search-result-status.d.ts +33 -0
- package/find/models/search-result-status.js +2 -0
- package/find/models/search-session-log-object.d.ts +16 -0
- package/find/models/search-session-log-object.js +2 -0
- package/find/models/search-status/cv-search-status.d.ts +20 -0
- package/find/models/search-status/cv-search-status.js +2 -0
- package/find/models/search-status/search-filter-status.d.ts +33 -0
- package/find/models/search-status/search-filter-status.js +2 -0
- package/find/models/search-status/search-status.d.ts +34 -0
- package/find/models/search-status/search-status.js +2 -0
- package/find/models/search-status/tag-search-status.d.ts +16 -0
- package/find/models/search-status/tag-search-status.js +2 -0
- package/find/models/search-status/text-search-status.d.ts +15 -0
- package/find/models/search-status/text-search-status.js +2 -0
- package/find/models/search-tag.d.ts +12 -0
- package/find/models/search-tag.js +2 -0
- package/find/models/smart-filter.d.ts +25 -0
- package/find/models/smart-filter.js +2 -0
- package/find/models/tagable/i18n-tagable.d.ts +10 -0
- package/find/models/tagable/i18n-tagable.js +2 -0
- package/find/models/tagable/tagable-base.d.ts +11 -0
- package/find/models/tagable/tagable-base.js +2 -0
- package/find/models/tagable/tagable.d.ts +10 -0
- package/find/models/tagable/tagable.js +2 -0
- package/find/models/text-search-config.d.ts +57 -0
- package/find/models/text-search-config.js +2 -0
- package/find/models/text-search-manipulator.d.ts +46 -0
- package/find/models/text-search-manipulator.js +2 -0
- package/find/models/text-search-result-item/text-search-error.d.ts +7 -0
- package/find/models/text-search-result-item/text-search-error.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-document.d.ts +10 -0
- package/find/models/text-search-result-item/text-search-result-item-document.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-part.d.ts +12 -0
- package/find/models/text-search-result-item/text-search-result-item-part.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-recent-query.d.ts +10 -0
- package/find/models/text-search-result-item/text-search-result-item-recent-query.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-unknown.d.ts +12 -0
- package/find/models/text-search-result-item/text-search-result-item-unknown.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item.d.ts +16 -0
- package/find/models/text-search-result-item/text-search-result-item.js +2 -0
- package/find/services/asset.service.d.ts +160 -0
- package/find/services/asset.service.js +2 -0
- package/find/services/filter-uploaders/filter-uploader.d.ts +13 -0
- package/find/services/filter-uploaders/filter-uploader.js +2 -0
- package/find/services/filter-uploaders/update-filters-uploader.d.ts +17 -0
- package/find/services/filter-uploaders/update-filters-uploader.js +2 -0
- package/find/services/filter-uploaders/update-filters.model.d.ts +19 -0
- package/find/services/filter-uploaders/update-filters.model.js +2 -0
- package/find/services/search/cv-search.service.d.ts +103 -0
- package/find/services/search/cv-search.service.js +2 -0
- package/find/services/search/recent-text-search-queries.service.d.ts +89 -0
- package/find/services/search/recent-text-search-queries.service.js +2 -0
- package/find/services/search/search-result.service.d.ts +142 -0
- package/find/services/search/search-result.service.js +2 -0
- package/find/services/search/search.service.d.ts +291 -0
- package/find/services/search/search.service.js +2 -0
- package/find/services/search/tag-search.service.d.ts +66 -0
- package/find/services/search/tag-search.service.js +2 -0
- package/find/services/search/text-search.service.d.ts +116 -0
- package/find/services/search/text-search.service.js +2 -0
- package/find/services/search-filter.service.d.ts +223 -0
- package/find/services/search-filter.service.js +2 -0
- package/find/utils/search-helper.d.ts +14 -0
- package/find/utils/search-helper.js +2 -0
- package/gen/sdk-version.d.ts +2 -0
- package/gen/sdk-version.js +2 -0
- package/index.d.ts +121 -0
- package/index.js +2 -0
- package/management/index.d.ts +5 -0
- package/management/index.js +2 -0
- package/management/models/api-key-list-response.d.ts +10 -0
- package/management/models/api-key-list-response.js +2 -0
- package/management/models/api-key-type.d.ts +5 -0
- package/management/models/api-key-type.js +2 -0
- package/management/models/api-key.d.ts +4 -0
- package/management/models/api-key.js +2 -0
- package/management/services/api-key.service.d.ts +39 -0
- package/management/services/api-key.service.js +2 -0
- package/ocr/index.d.ts +4 -0
- package/ocr/index.js +2 -0
- package/ocr/models/detect-response.d.ts +5 -0
- package/ocr/models/detect-response.js +2 -0
- package/ocr/models/detected-text-entry.d.ts +5 -0
- package/ocr/models/detected-text-entry.js +2 -0
- package/ocr/services/ocr.service.d.ts +36 -0
- package/ocr/services/ocr.service.js +2 -0
- package/package.json +45 -0
- package/user-data/index.d.ts +5 -0
- package/user-data/index.js +2 -0
- package/user-data/models/part-with-nullable.d.ts +5 -0
- package/user-data/models/part-with-nullable.js +2 -0
- package/user-data/models/request-list/request-list.d.ts +16 -0
- package/user-data/models/request-list/request-list.js +2 -0
- package/user-data/services/favorite/favorite.service.d.ts +45 -0
- package/user-data/services/favorite/favorite.service.js +2 -0
- package/user-data/services/request-list/request-list.service.d.ts +97 -0
- package/user-data/services/request-list/request-list.service.js +2 -0
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@partium/js-sdk",
|
|
3
|
+
"version": "13.0.0",
|
|
4
|
+
"author": "Partium Inc.",
|
|
5
|
+
"license": "(c) Partium Inc. 2020-2025. All rights reserved.",
|
|
6
|
+
"description": "SDK to provide Partium-Search features to JavaScript based applications.",
|
|
7
|
+
"typings": "index.d.ts",
|
|
8
|
+
"directories": {
|
|
9
|
+
"doc": "docs"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"extract-package-version": "cd ../publish/scripts && node extract-package-version.js",
|
|
13
|
+
"test": "jest",
|
|
14
|
+
"test-compact": "jest 2>&1 | grep -E 'FAIL|●|Tests:|Test Suites:' | grep -v '● Console'"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git@gitlab.int.partium.io:partium/js-partium-sdk.git"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@ua-parser-js/pro-enterprise": "~2.0.0-beta.3",
|
|
22
|
+
"axios": "~1.7.7",
|
|
23
|
+
"axios-observable": "~2.0.0",
|
|
24
|
+
"base-64": "~1.0.0",
|
|
25
|
+
"idb-keyval": "~6.2.1",
|
|
26
|
+
"jwt-decode": "~4.0.0",
|
|
27
|
+
"lodash": "~4.17.21",
|
|
28
|
+
"query-string": "~7.1.3",
|
|
29
|
+
"rxjs": "~7.8.1",
|
|
30
|
+
"tslib": "~2.7.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/jest": "~29.5.12",
|
|
34
|
+
"@types/lodash": "~4.17.7",
|
|
35
|
+
"jest": "~29.7.0",
|
|
36
|
+
"jest-environment-jsdom": "~29.7.0",
|
|
37
|
+
"jest-jasmine2": "~29.7.0",
|
|
38
|
+
"jest-junit": "~16.0.0",
|
|
39
|
+
"jest-mock-axios": "~4.7.3",
|
|
40
|
+
"rimraf": "~6.0.1",
|
|
41
|
+
"ts-jest": "~29.2.5",
|
|
42
|
+
"ts-node": "~10.9.2",
|
|
43
|
+
"typescript": "~5.5.4"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,i){void 0===i&&(i=t);var o=Object.getOwnPropertyDescriptor(r,t);o&&!("get"in o?!r.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,i,o)}: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/part-with-nullable"),exports),__exportStar(require("./models/request-list/request-list"),exports),__exportStar(require("./services/request-list/request-list.service"),exports),__exportStar(require("./services/favorite/favorite.service"),exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { APIObject } from "../../../core/models/api-object";
|
|
3
|
+
import { PartWithNullable } from "../part-with-nullable";
|
|
4
|
+
export interface IRequestedPart extends PartWithNullable {
|
|
5
|
+
quantity?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class RequestList extends APIObject {
|
|
8
|
+
list: Array<IRequestedPart>;
|
|
9
|
+
constructor(init?: Partial<RequestList>);
|
|
10
|
+
updateQuantity(partId: string, quantity: number): void;
|
|
11
|
+
updateRequestList(update?: Partial<RequestList>): void;
|
|
12
|
+
static fromAPIResponse(requestedPartList: Array<{
|
|
13
|
+
quantity: number;
|
|
14
|
+
part_id: string;
|
|
15
|
+
}>): RequestList;
|
|
16
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t},__assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.RequestList=void 0;var api_object_1=require("../../../core/models/api-object"),RequestList=function(t){function n(n){var e=t.call(this)||this;return e.list=[],Object.assign(e,n),e}return __extends(n,t),n.prototype.updateQuantity=function(t,n){!!this.list.find((function(n){return t===n.partiumId}))&&(this.list=this.list.map((function(e){return e.partiumId===t?__assign(__assign({},e),{quantity:n}):e})))},n.prototype.updateRequestList=function(t){Object.assign(this,t)},n.fromAPIResponse=function(t){return new n({list:t.map((function(t){return{quantity:t.quantity,partiumId:t.part_id}}))})},n}(api_object_1.APIObject);exports.RequestList=RequestList;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { BaseLoginInitService, EventContext, Organization, PartiumConfig, ServiceProvider } from '../../../core';
|
|
4
|
+
interface FavoriteEventContext extends EventContext {
|
|
5
|
+
organizationId?: string;
|
|
6
|
+
searchSessionId?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface FavoriteService {
|
|
9
|
+
/**
|
|
10
|
+
* Fetches the list of favorites.
|
|
11
|
+
*
|
|
12
|
+
* @returns Observable with an array of Partium part ids that resolves
|
|
13
|
+
* with the request to the backend.
|
|
14
|
+
*/
|
|
15
|
+
getFavoriteList(): Observable<Array<string>>;
|
|
16
|
+
/**
|
|
17
|
+
* Adds a part to the list of favorites via the parts Partium-ID
|
|
18
|
+
*
|
|
19
|
+
* @param partId the part partId to save as Favorite
|
|
20
|
+
* @returns Observable with an array of Partium part ids that resolves
|
|
21
|
+
* with the request to the backend.
|
|
22
|
+
*/
|
|
23
|
+
addToFavorites(partId: string, favoriteEventContext?: FavoriteEventContext): Observable<Array<string>>;
|
|
24
|
+
/**
|
|
25
|
+
* Removes a part to the list of favorites via the parts Partium-ID
|
|
26
|
+
*
|
|
27
|
+
* @param partId the part partId to be removed from the Favorites
|
|
28
|
+
* @returns Observable with an array of Partium part ids that resolves
|
|
29
|
+
* with the request to the backend.
|
|
30
|
+
*/
|
|
31
|
+
removeFromFavorites(partId: string, favoriteEventContext?: FavoriteEventContext): Observable<Array<string>>;
|
|
32
|
+
}
|
|
33
|
+
export declare class FavoriteServiceImpl extends BaseLoginInitService implements FavoriteService {
|
|
34
|
+
private httpsService;
|
|
35
|
+
private logService;
|
|
36
|
+
private maxFavoritesLength;
|
|
37
|
+
constructor(serviceProvider: ServiceProvider);
|
|
38
|
+
init(config: PartiumConfig, userEmail: string, currentOrganization$: Observable<Organization>): Observable<void>;
|
|
39
|
+
onCreate(): void;
|
|
40
|
+
private dispatchLogService;
|
|
41
|
+
getFavoriteList(): Observable<Array<string>>;
|
|
42
|
+
addToFavorites(partId: string, favoriteEventContext?: FavoriteEventContext): Observable<Array<string>>;
|
|
43
|
+
removeFromFavorites(partId: string, favoriteEventContext?: FavoriteEventContext): Observable<Array<string>>;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function 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.FavoriteServiceImpl=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),core_1=require("../../../core"),FavoriteServiceImpl=function(e){function t(t){var r=e.call(this,t)||this;return r.logService=t.getService(core_1.LogServiceImpl),r}return __extends(t,e),t.prototype.init=function(t,r,o){return e.prototype.init.call(this,t,r,o),this.maxFavoritesLength=t.favoritePartsMaxPartLength,console.log("Favorites Service - init: maxFavoritesLength: ",this.maxFavoritesLength),(0,rxjs_1.of)(void 0)},t.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(core_1.HttpsService)},t.prototype.dispatchLogService=function(e,t,r){var o=new core_1.EventLog({version:core_1.EVENTLOG_VERSIONS.V_2_0_0,organizationId:null==r?void 0:r.organizationId,interface:(null==r?void 0:r.eventInterface)||core_1.INTERFACE.API_ACCESS,event:e,data:{partiumId:t,searchSessionId:null==r?void 0:r.searchSessionId}});this.logService.logEvent(o).subscribe((function(){}),(function(e){console.log("Error while sending log event: ",e)}))},t.prototype.getFavoriteList=function(){return this.httpsService.get("favorites",null,core_1.BACKEND_SERVICE.USER_DATA)},t.prototype.addToFavorites=function(e,t){var r=this;return this.getFavoriteList().pipe((0,operators_1.switchMap)((function(o){if(!o.includes(e)){var i=__spreadArray([],o,!0);return i.unshift(e),i=i.splice(0,r.maxFavoritesLength),r.httpsService.post("favorites",i,null,core_1.BACKEND_SERVICE.USER_DATA).pipe((0,operators_1.tap)((function(){r.dispatchLogService(core_1.EVENT.FAVORITES_ADD,e,t)})))}return console.log("Nothing added - already part of favorites"),(0,rxjs_1.of)(o)})))},t.prototype.removeFromFavorites=function(e,t){var r=this;return this.getFavoriteList().pipe((0,operators_1.switchMap)((function(o){var i=o.indexOf(e);if(i>-1){var n=__spreadArray([],o,!0);return n.splice(i,1),r.httpsService.post("favorites",n,null,core_1.BACKEND_SERVICE.USER_DATA).pipe((0,operators_1.tap)((function(){r.dispatchLogService(core_1.EVENT.FAVORITES_REMOVE,e,t)})))}return console.log("Nothing was removed - did not exist"),(0,rxjs_1.of)(o)})))},t=__decorate([(0,core_1.InjectionIdentifier)("FavoriteService")],t)}(core_1.BaseLoginInitService);exports.FavoriteServiceImpl=FavoriteServiceImpl;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { IRequestedPart } from '../../models/request-list/request-list';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { EventContext } from '../../../core/models/log';
|
|
5
|
+
import { BaseService } from '../../../core/services/base.service';
|
|
6
|
+
import { LogService } from '../../../core/services/log.service';
|
|
7
|
+
import { ServiceProvider } from '../../../core/services/service-provider';
|
|
8
|
+
import { SearchService } from '../../../find';
|
|
9
|
+
interface RequestListEventContext extends EventContext {
|
|
10
|
+
organizationId?: string;
|
|
11
|
+
searchSessionId?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Service that provides functionality for creating and updating the request list.
|
|
15
|
+
* It allows to add, remove and edit requested parts from the request list
|
|
16
|
+
*/
|
|
17
|
+
export interface RequestListService {
|
|
18
|
+
/**
|
|
19
|
+
* Updates the request list when new quantities are added to any of the request
|
|
20
|
+
* list items is edited.
|
|
21
|
+
*
|
|
22
|
+
* @param requestedParts An array of type IRequestedPart of all the requested
|
|
23
|
+
* parts in the list
|
|
24
|
+
* @param updatedPart the part that is going to be added to the list
|
|
25
|
+
* @param requestListEventContext (optional) RequestListEventContext object to add the missing data that will be logged using the log format V2
|
|
26
|
+
* @returns Observable with an array of the parts that resolves with the request
|
|
27
|
+
* to the backend.
|
|
28
|
+
*/
|
|
29
|
+
updateRequestList(requestedParts: Array<IRequestedPart>, updatedPart: IRequestedPart, requestListEventContext?: RequestListEventContext): Observable<Array<IRequestedPart>>;
|
|
30
|
+
/**
|
|
31
|
+
* Adds a new part to the request list.
|
|
32
|
+
*
|
|
33
|
+
* @param requestedParts An array of type IRequestedPart of all the requested
|
|
34
|
+
* parts in the list
|
|
35
|
+
* @param addedPart the part that is going to be added to the list
|
|
36
|
+
* @param requestListEventContext (optional) RequestListEventContext object to add the missing data that will be logged using the log format V2
|
|
37
|
+
* @returns Observable with an array of the parts that resolves with the request
|
|
38
|
+
* to the backend.
|
|
39
|
+
*/
|
|
40
|
+
addPart(requestedParts: Array<IRequestedPart>, addedPart: IRequestedPart, requestListEventContext?: RequestListEventContext): Observable<Array<IRequestedPart>>;
|
|
41
|
+
/**
|
|
42
|
+
* Fetches the parts of the request list.
|
|
43
|
+
*
|
|
44
|
+
* @returns Observable with an array of the parts that resolves with the request
|
|
45
|
+
* to the backend.
|
|
46
|
+
*/
|
|
47
|
+
getRequestList(): Observable<Array<IRequestedPart>>;
|
|
48
|
+
/**
|
|
49
|
+
* Resets the requests list to an empty array of parts.
|
|
50
|
+
* @param requestListEventContext (optional) RequestListEventContext object to add the missing data that will be logged using the log format V2
|
|
51
|
+
* @returns Observable with an array of empty the parts that resolves with the
|
|
52
|
+
* request to the backend.
|
|
53
|
+
*/
|
|
54
|
+
resetList(requestListEventContext?: RequestListEventContext): Observable<Array<IRequestedPart>>;
|
|
55
|
+
/**
|
|
56
|
+
* Deletes one part from the requestedList.
|
|
57
|
+
*
|
|
58
|
+
* @param partiumId the id of the part that is going to be removed
|
|
59
|
+
* @param requestListEventContext (optional) RequestListEventContext object to add the missing data that will be logged using the log format V2
|
|
60
|
+
* @returns Observable with a boolean
|
|
61
|
+
*/
|
|
62
|
+
deletePart(partiumId: string, requestListEventContext?: RequestListEventContext): Observable<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* Saves a group of parts in the requestList.
|
|
65
|
+
*
|
|
66
|
+
* @param updatedParts An array of type IRequestedPart of all the requested parts
|
|
67
|
+
* that are going to be added to the list.
|
|
68
|
+
* @param requestListEventContext (optional) RequestListEventContext object to add the missing data that will be logged using the log format V2
|
|
69
|
+
* @returns Observable with an array of the request list of the saved parts.
|
|
70
|
+
*/
|
|
71
|
+
saveRequestList(updatedParts: IRequestedPart[], requestListEventContext?: RequestListEventContext): Observable<Array<IRequestedPart>>;
|
|
72
|
+
}
|
|
73
|
+
export declare class RequestListServiceImpl extends BaseService implements RequestListService {
|
|
74
|
+
private httpsService;
|
|
75
|
+
protected logService: LogService;
|
|
76
|
+
protected searchService: SearchService;
|
|
77
|
+
constructor(serviceProvider: ServiceProvider);
|
|
78
|
+
onCreate(): void;
|
|
79
|
+
saveRequestList(updatedParts: IRequestedPart[], requestListEventContext: any): Observable<Array<IRequestedPart>>;
|
|
80
|
+
updateRequestList(requestedParts: Array<IRequestedPart>, updatedPart: IRequestedPart, requestListEventContext?: RequestListEventContext): Observable<Array<IRequestedPart>>;
|
|
81
|
+
addPart(requestedParts: Array<IRequestedPart>, addedPart: IRequestedPart, requestListEventContext?: RequestListEventContext): Observable<Array<IRequestedPart>>;
|
|
82
|
+
getRequestList(): Observable<Array<IRequestedPart>>;
|
|
83
|
+
/**
|
|
84
|
+
* Resets the requests list to an empty array of parts.
|
|
85
|
+
*/
|
|
86
|
+
resetList(requestListEventContext?: RequestListEventContext): Observable<Array<IRequestedPart>>;
|
|
87
|
+
/**
|
|
88
|
+
* DELETE a part from request-list without send entire list to update
|
|
89
|
+
*/
|
|
90
|
+
deletePart(partiumId: string, requestListEventContext?: RequestListEventContext): Observable<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* Post a requestList to the server to be stored in the cloud.
|
|
93
|
+
*/
|
|
94
|
+
private postRequestList;
|
|
95
|
+
private dispatchLogService;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function 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 o,s=arguments.length,n=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(n=(s<3?o(n):s>3?o(t,r,n):o(t,r))||n);return s>3&&n&&Object.defineProperty(t,r,n),n},__spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var i,o=0,s=t.length;o<s;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.RequestListServiceImpl=void 0;var request_list_1=require("../../models/request-list/request-list"),operators_1=require("rxjs/operators"),log_1=require("../../../core/models/log"),injection_identifier_1=require("../../../core/decorators/injection-identifier"),https_service_interface_1=require("../../../core/services/http/https.service.interface"),base_service_1=require("../../../core/services/base.service"),log_service_1=require("../../../core/services/log.service"),RequestListServiceImpl=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),this.logService=this.serviceProvider.getService(log_service_1.LogServiceImpl)},t.prototype.saveRequestList=function(e,t){var r=this,i=e.map((function(e){return{partiumId:e.partiumId,quantity:e.quantity}}));return this.postRequestList(e).pipe((0,operators_1.tap)((function(){return r.dispatchLogService(log_1.EVENT.SHOPPING_CART_UPDATE,{list:__spreadArray([],i,!0)},t)})))},t.prototype.updateRequestList=function(e,t,r){var i=e.map((function(e){return e.partiumId===t.partiumId?{partiumId:e.partiumId,quantity:t.quantity}:e}));return this.addPart(i,t,r)},t.prototype.addPart=function(e,t,r){var i=this,o=!!e.find((function(e){return e.partiumId===t.partiumId})),s=o?e:__spreadArray(__spreadArray([],e,!0),[t],!1),n=o?t.quantity:1;return this.postRequestList(s).pipe((0,operators_1.tap)((function(){i.dispatchLogService(log_1.EVENT.SHOPPING_CART_ADD_PART,{partiumId:t.partiumId,quantity:n,searchSessionId:null==r?void 0:r.searchSessionId},r)})))},t.prototype.getRequestList=function(){return this.httpsService.get("request-list",null,https_service_interface_1.BACKEND_SERVICE.USER_DATA).pipe((0,operators_1.map)((function(e){return request_list_1.RequestList.fromAPIResponse(e).list})))},t.prototype.resetList=function(e){var t=this;return this.postRequestList([]).pipe((0,operators_1.tap)((function(){return t.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_ALL_PARTS,{},e)})),(0,operators_1.catchError)((function(e){console.log("Reset list log error",e)})))},t.prototype.deletePart=function(e,t){var r=this;return this.httpsService.delete("request-list/items/".concat(e),null,[],https_service_interface_1.BACKEND_SERVICE.USER_DATA).pipe((0,operators_1.tap)((function(){return r.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_PART,{partiumId:e},t)})),(0,operators_1.map)((function(){return!0})))},t.prototype.postRequestList=function(e){var t=e.map((function(e){return{quantity:e.quantity,part_id:e.partiumId}}));return this.httpsService.post("request-list",t,[],https_service_interface_1.BACKEND_SERVICE.USER_DATA).pipe((0,operators_1.map)((function(e){return request_list_1.RequestList.fromAPIResponse(e).list})))},t.prototype.dispatchLogService=function(e,t,r){this.logService.logEvent(new log_1.EventLog({version:log_1.EVENTLOG_VERSIONS.V_2_0_0,organizationId:null==r?void 0:r.organizationId,interface:(null==r?void 0:r.eventInterface)||log_1.INTERFACE.API_ACCESS,event:e,data:t})).subscribe((function(){}),(function(e){console.log("Error while sending log event: ",e)}))},t=__decorate([(0,injection_identifier_1.InjectionIdentifier)("RequestListService")],t)}(base_service_1.BaseService);exports.RequestListServiceImpl=RequestListServiceImpl;
|