@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.
- package/catalog/index.js +1 -21
- package/catalog/models/catalog-image-info.js +1 -22
- package/catalog/models/catalog-image.js +1 -40
- package/catalog/models/upsert-catalog-images-dto.js +1 -3
- package/catalog/models/upsert-images-result.js +1 -3
- package/catalog/services/images.service.js +1 -62
- package/core/constants/constants.d.ts +1 -0
- package/core/constants/constants.js +1 -16
- package/core/decorators/injection-identifier.js +1 -19
- package/core/factories/paginated-request-service.factory.js +1 -33
- package/core/index.js +1 -63
- package/core/integration-defaults/http/fetch-api-http-error-helper.js +1 -129
- package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.js +1 -138
- package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.js +1 -210
- package/core/integration-defaults/http/handle-axios-error-helper.js +1 -79
- package/core/integration-defaults/http/https-client/axios-https-client.service.js +1 -182
- package/core/integration-defaults/http/https-client/fetch-api-https-client.service.js +1 -198
- package/core/integration-defaults/http/js-oauth-keycloak-https.service.js +1 -32
- package/core/integration-defaults/js-p-file.js +1 -36
- package/core/integration-defaults/session/js-oauth-api-key-session.service.js +1 -206
- package/core/integration-defaults/session/js-oauth-keycloak-auth-config.js +1 -64
- package/core/integration-defaults/session/js-oauth-keycloak-session.service.js +1 -257
- package/core/integration-defaults/web-device-status.service.js +1 -125
- package/core/integration-defaults/web-file.service.js +1 -135
- package/core/integration-defaults/web-indexeddb.service.js +1 -142
- package/core/integration-defaults/web-local-storage.service.js +1 -310
- package/core/models/api-object.js +1 -16
- package/core/models/auth-config.js +1 -72
- package/core/models/device-info.js +1 -34
- package/core/models/error.js +1 -107
- package/core/models/formatted-string.js +1 -14
- package/core/models/i18n-map.js +1 -61
- package/core/models/i18n-string.js +1 -35
- package/core/models/log.js +1 -137
- package/core/models/organization.js +1 -159
- package/core/models/p-file.js +1 -23
- package/core/models/paginated-list.js +1 -41
- package/core/models/partium-config.js +1 -43
- package/core/models/user-token.js +1 -11
- package/core/models/user.js +1 -89
- package/core/services/backend-status.service.js +1 -147
- package/core/services/base-login-init.service.js +1 -57
- package/core/services/base.service.js +1 -37
- package/core/services/device-status.service.interface.js +1 -117
- package/core/services/file.service.interface.js +1 -61
- package/core/services/http/file-transfer/file-transfer.service.interface.js +1 -125
- package/core/services/http/https-client/https-client.service.interface.js +1 -152
- package/core/services/http/https.service.interface.d.ts +3 -1
- package/core/services/http/https.service.interface.js +1 -294
- package/core/services/http/oauth-https.service.js +1 -218
- package/core/services/local-storage.service.interface.js +1 -378
- package/core/services/log.service.js +1 -139
- package/core/services/organization.service.js +1 -202
- package/core/services/paginated-request.service.js +1 -154
- package/core/services/recent-parts.service.js +1 -194
- package/core/services/service-provider.js +1 -114
- package/core/services/session/oauth-session.service.js +1 -104
- package/core/services/session/session.service.interface.js +1 -367
- package/core/utils/general-helper.js +1 -110
- package/data/index.js +1 -44
- package/data/models/announcement.js +1 -70
- package/data/models/assembly-hierarchy-node-breadcrumb.js +1 -51
- package/data/models/assembly-hierarchy-node.js +1 -46
- package/data/models/attribute.js +1 -106
- package/data/models/csa-request-search.js +1 -46
- package/data/models/csa-request-status.js +1 -51
- package/data/models/csa-request.js +1 -112
- package/data/models/document.js +1 -17
- package/data/models/filter-key.js +1 -36
- package/data/models/filter-option-value.js +1 -41
- package/data/models/image.js +1 -77
- package/data/models/inquiry.js +1 -71
- package/data/models/mounting-location.js +1 -58
- package/data/models/multiple-expert-searches.js +1 -40
- package/data/models/part-enrichment-data.js +1 -50
- package/data/models/part.d.ts +1 -1
- package/data/models/part.js +1 -168
- package/data/models/shopping-cart.js +1 -60
- package/data/services/announcement.service.js +1 -89
- package/data/services/assembly-hierarchy-nodes.service.js +1 -193
- package/data/services/csa-helper.service.js +1 -158
- package/data/services/customer-service-assistance.service.js +1 -276
- package/data/services/filter.service.js +1 -97
- package/data/services/inquiry.service.js +1 -68
- package/data/services/part-attribute.service.js +1 -118
- package/data/services/part-enrichment.service.js +1 -56
- package/data/services/part.service.js +1 -182
- package/data/services/related-parts.service.js +1 -83
- package/data/services/shopping-cart.service.js +1 -152
- package/datacuration/index.d.ts +2 -0
- package/datacuration/index.js +2 -0
- package/datacuration/models/image-submission-request.d.ts +55 -0
- package/datacuration/models/image-submission-request.js +2 -0
- package/datacuration/models/submitted-image-response.d.ts +27 -0
- package/datacuration/models/submitted-image-response.js +2 -0
- package/datacuration/services/image-submission.service.d.ts +26 -0
- package/datacuration/services/image-submission.service.js +2 -0
- package/find/index.js +1 -51
- package/find/models/assets/asset.js +1 -32
- package/find/models/search-filter.js +1 -205
- package/find/models/search-input.js +1 -3
- package/find/models/search-output.js +1 -3
- package/find/models/search-result-status.js +1 -40
- package/find/models/search-session-log-object.js +1 -22
- package/find/models/search-status/cv-search-status.js +1 -22
- package/find/models/search-status/search-filter-status.js +1 -36
- package/find/models/search-status/search-status.js +1 -56
- package/find/models/search-status/tag-search-status.js +1 -23
- package/find/models/search-status/text-search-status.js +1 -18
- package/find/models/search-tag.js +1 -16
- package/find/models/smart-filter.js +1 -49
- package/find/models/tagable/i18n-tagable.js +1 -37
- package/find/models/tagable/tagable-base.js +1 -22
- package/find/models/tagable/tagable.js +1 -37
- package/find/models/text-search-config.js +1 -70
- package/find/models/text-search-manipulator.js +1 -90
- package/find/models/text-search-result-item/text-search-error.js +1 -12
- package/find/models/text-search-result-item/text-search-result-item-document.js +1 -34
- package/find/models/text-search-result-item/text-search-result-item-part.js +1 -36
- package/find/models/text-search-result-item/text-search-result-item-recent-query.js +1 -35
- package/find/models/text-search-result-item/text-search-result-item-unknown.js +1 -38
- package/find/models/text-search-result-item/text-search-result-item.js +1 -22
- package/find/services/asset.service.js +1 -348
- package/find/services/filter-uploaders/filter-uploader.js +1 -3
- package/find/services/filter-uploaders/update-filters-uploader.js +1 -77
- package/find/services/filter-uploaders/update-filters.model.js +1 -7
- package/find/services/search/cv-search.service.js +1 -214
- package/find/services/search/recent-text-search-queries.service.js +1 -260
- package/find/services/search/search-result.service.js +1 -539
- package/find/services/search/search.service.js +1 -514
- package/find/services/search/tag-search.service.js +1 -124
- package/find/services/search/text-search.service.js +1 -316
- package/find/services/search-filter.service.js +1 -292
- package/find/utils/search-helper.js +1 -75
- package/gen/sdk-version.d.ts +1 -1
- package/gen/sdk-version.js +1 -5
- package/index.d.ts +2 -0
- package/index.js +1 -392
- package/management/index.js +1 -21
- package/management/models/api-key-list-response.js +1 -3
- package/management/models/api-key-type.js +1 -9
- package/management/models/api-key.js +1 -3
- package/management/services/api-key.service.js +1 -53
- package/ocr/index.js +1 -20
- package/ocr/models/detect-response.js +1 -3
- package/ocr/models/detected-text-entry.js +1 -3
- package/ocr/services/ocr.service.js +1 -59
- package/package.json +1 -1
- package/user-data/index.js +1 -21
- package/user-data/models/part-with-nullable.js +1 -3
- package/user-data/models/request-list/request-list.js +1 -63
- package/user-data/services/favorite/favorite.service.js +1 -108
- package/user-data/services/request-list/request-list.service.js +1 -133
package/user-data/index.js
CHANGED
|
@@ -1,22 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
__exportStar(require("./models/part-with-nullable"), exports);
|
|
19
|
-
__exportStar(require("./models/request-list/request-list"), exports);
|
|
20
|
-
__exportStar(require("./services/request-list/request-list.service"), exports);
|
|
21
|
-
__exportStar(require("./services/favorite/favorite.service"), exports);
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
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);
|
|
@@ -1,64 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.RequestList = void 0;
|
|
31
|
-
var api_object_1 = require("../../../core/models/api-object");
|
|
32
|
-
var RequestList = /** @class */ (function (_super) {
|
|
33
|
-
__extends(RequestList, _super);
|
|
34
|
-
function RequestList(init) {
|
|
35
|
-
var _this = _super.call(this) || this;
|
|
36
|
-
_this.list = []; // the list containing partiumId and quantity
|
|
37
|
-
Object.assign(_this, init);
|
|
38
|
-
return _this;
|
|
39
|
-
}
|
|
40
|
-
RequestList.prototype.updateQuantity = function (partId, quantity) {
|
|
41
|
-
var isPartInArray = !!this.list.find(function (part) { return partId === part.partiumId; });
|
|
42
|
-
if (isPartInArray) {
|
|
43
|
-
this.list = this.list.map(function (part) {
|
|
44
|
-
if (part.partiumId === partId) {
|
|
45
|
-
return __assign(__assign({}, part), { quantity: quantity });
|
|
46
|
-
}
|
|
47
|
-
return part;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
RequestList.prototype.updateRequestList = function (update) {
|
|
52
|
-
Object.assign(this, update);
|
|
53
|
-
};
|
|
54
|
-
RequestList.fromAPIResponse = function (requestedPartList) {
|
|
55
|
-
var requestedPartArray = requestedPartList.map(function (part) { return ({
|
|
56
|
-
quantity: part.quantity,
|
|
57
|
-
partiumId: part.part_id,
|
|
58
|
-
}); });
|
|
59
|
-
return new RequestList({ list: requestedPartArray });
|
|
60
|
-
};
|
|
61
|
-
return RequestList;
|
|
62
|
-
}(api_object_1.APIObject));
|
|
63
|
-
exports.RequestList = RequestList;
|
|
64
|
-
//# sourceMappingURL=request-list.js.map
|
|
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;
|
|
@@ -1,109 +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.FavoriteServiceImpl = void 0;
|
|
35
|
-
var rxjs_1 = require("rxjs");
|
|
36
|
-
var operators_1 = require("rxjs/operators");
|
|
37
|
-
var core_1 = require("../../../core");
|
|
38
|
-
var FavoriteServiceImpl = /** @class */ (function (_super) {
|
|
39
|
-
__extends(FavoriteServiceImpl, _super);
|
|
40
|
-
function FavoriteServiceImpl(serviceProvider) {
|
|
41
|
-
var _this = _super.call(this, serviceProvider) || this;
|
|
42
|
-
_this.logService = serviceProvider.getService(core_1.LogServiceImpl);
|
|
43
|
-
return _this;
|
|
44
|
-
}
|
|
45
|
-
FavoriteServiceImpl.prototype.init = function (config, userEmail, currentOrganization$) {
|
|
46
|
-
_super.prototype.init.call(this, config, userEmail, currentOrganization$);
|
|
47
|
-
this.maxFavoritesLength = config.favoritePartsMaxPartLength;
|
|
48
|
-
console.log('Favorites Service - init: maxFavoritesLength: ', this.maxFavoritesLength);
|
|
49
|
-
return (0, rxjs_1.of)(undefined); // resolve
|
|
50
|
-
};
|
|
51
|
-
FavoriteServiceImpl.prototype.onCreate = function () {
|
|
52
|
-
this.httpsService = this.serviceProvider.getService(core_1.HttpsService);
|
|
53
|
-
};
|
|
54
|
-
FavoriteServiceImpl.prototype.dispatchLogService = function (event, partId, favoriteEventContext) {
|
|
55
|
-
var eventLog = new core_1.EventLog({
|
|
56
|
-
version: core_1.EVENTLOG_VERSIONS.V_2_0_0,
|
|
57
|
-
organizationId: favoriteEventContext === null || favoriteEventContext === void 0 ? void 0 : favoriteEventContext.organizationId,
|
|
58
|
-
interface: (favoriteEventContext === null || favoriteEventContext === void 0 ? void 0 : favoriteEventContext.eventInterface) || core_1.INTERFACE.API_ACCESS,
|
|
59
|
-
event: event,
|
|
60
|
-
data: {
|
|
61
|
-
partiumId: partId,
|
|
62
|
-
searchSessionId: favoriteEventContext === null || favoriteEventContext === void 0 ? void 0 : favoriteEventContext.searchSessionId,
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
this.logService.logEvent(eventLog).subscribe(function () { }, function (error) {
|
|
66
|
-
console.log('Error while sending log event: ', error);
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
FavoriteServiceImpl.prototype.getFavoriteList = function () {
|
|
70
|
-
return this.httpsService
|
|
71
|
-
.get('favorites', null, core_1.BACKEND_SERVICE.USER_DATA);
|
|
72
|
-
};
|
|
73
|
-
FavoriteServiceImpl.prototype.addToFavorites = function (partId, favoriteEventContext) {
|
|
74
|
-
var _this = this;
|
|
75
|
-
return this.getFavoriteList().pipe((0, operators_1.switchMap)(function (favorites) {
|
|
76
|
-
if (!favorites.includes(partId)) {
|
|
77
|
-
var newFavorites = __spreadArray([], favorites, true);
|
|
78
|
-
newFavorites.unshift(partId);
|
|
79
|
-
newFavorites = newFavorites.splice(0, _this.maxFavoritesLength);
|
|
80
|
-
return _this.httpsService.post('favorites', newFavorites, null, core_1.BACKEND_SERVICE.USER_DATA).pipe((0, operators_1.tap)(function () {
|
|
81
|
-
_this.dispatchLogService(core_1.EVENT.FAVORITES_ADD, partId, favoriteEventContext);
|
|
82
|
-
}));
|
|
83
|
-
}
|
|
84
|
-
console.log("Nothing added - already part of favorites");
|
|
85
|
-
return (0, rxjs_1.of)(favorites);
|
|
86
|
-
}));
|
|
87
|
-
};
|
|
88
|
-
FavoriteServiceImpl.prototype.removeFromFavorites = function (partId, favoriteEventContext) {
|
|
89
|
-
var _this = this;
|
|
90
|
-
return this.getFavoriteList().pipe((0, operators_1.switchMap)(function (favorites) {
|
|
91
|
-
var index = favorites.indexOf(partId);
|
|
92
|
-
if (index > -1) {
|
|
93
|
-
var newFavorites = __spreadArray([], favorites, true);
|
|
94
|
-
newFavorites.splice(index, 1);
|
|
95
|
-
return _this.httpsService.post('favorites', newFavorites, null, core_1.BACKEND_SERVICE.USER_DATA).pipe((0, operators_1.tap)(function () {
|
|
96
|
-
_this.dispatchLogService(core_1.EVENT.FAVORITES_REMOVE, partId, favoriteEventContext);
|
|
97
|
-
}));
|
|
98
|
-
}
|
|
99
|
-
console.log("Nothing was removed - did not exist");
|
|
100
|
-
return (0, rxjs_1.of)(favorites);
|
|
101
|
-
}));
|
|
102
|
-
};
|
|
103
|
-
FavoriteServiceImpl = __decorate([
|
|
104
|
-
(0, core_1.InjectionIdentifier)('FavoriteService')
|
|
105
|
-
], FavoriteServiceImpl);
|
|
106
|
-
return FavoriteServiceImpl;
|
|
107
|
-
}(core_1.BaseLoginInitService));
|
|
108
|
-
exports.FavoriteServiceImpl = FavoriteServiceImpl;
|
|
109
|
-
//# sourceMappingURL=favorite.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.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;
|
|
@@ -1,134 +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.RequestListServiceImpl = void 0;
|
|
35
|
-
var request_list_1 = require("../../models/request-list/request-list");
|
|
36
|
-
var operators_1 = require("rxjs/operators");
|
|
37
|
-
var log_1 = require("../../../core/models/log");
|
|
38
|
-
var injection_identifier_1 = require("../../../core/decorators/injection-identifier");
|
|
39
|
-
var https_service_interface_1 = require("../../../core/services/http/https.service.interface");
|
|
40
|
-
var base_service_1 = require("../../../core/services/base.service");
|
|
41
|
-
var log_service_1 = require("../../../core/services/log.service");
|
|
42
|
-
;
|
|
43
|
-
var RequestListServiceImpl = /** @class */ (function (_super) {
|
|
44
|
-
__extends(RequestListServiceImpl, _super);
|
|
45
|
-
function RequestListServiceImpl(serviceProvider) {
|
|
46
|
-
return _super.call(this, serviceProvider) || this;
|
|
47
|
-
}
|
|
48
|
-
RequestListServiceImpl.prototype.onCreate = function () {
|
|
49
|
-
this.httpsService = this.serviceProvider.getService(https_service_interface_1.HttpsService);
|
|
50
|
-
this.logService = this.serviceProvider.getService(log_service_1.LogServiceImpl);
|
|
51
|
-
};
|
|
52
|
-
RequestListServiceImpl.prototype.saveRequestList = function (updatedParts, requestListEventContext) {
|
|
53
|
-
var _this = this;
|
|
54
|
-
var updatedRequestedParts = updatedParts.map(function (part) { return ({
|
|
55
|
-
partiumId: part.partiumId,
|
|
56
|
-
quantity: part.quantity,
|
|
57
|
-
}); });
|
|
58
|
-
return this.postRequestList(updatedParts).pipe((0, operators_1.tap)(function () { return _this.dispatchLogService(log_1.EVENT.SHOPPING_CART_UPDATE, { list: __spreadArray([], updatedRequestedParts, true) }, requestListEventContext); }));
|
|
59
|
-
};
|
|
60
|
-
RequestListServiceImpl.prototype.updateRequestList = function (requestedParts, updatedPart, requestListEventContext) {
|
|
61
|
-
var updatedRequestedParts = requestedParts.map(function (part) {
|
|
62
|
-
if (part.partiumId === updatedPart.partiumId) {
|
|
63
|
-
return { partiumId: part.partiumId, quantity: updatedPart.quantity };
|
|
64
|
-
}
|
|
65
|
-
return part;
|
|
66
|
-
});
|
|
67
|
-
return this.addPart(updatedRequestedParts, updatedPart, requestListEventContext);
|
|
68
|
-
};
|
|
69
|
-
RequestListServiceImpl.prototype.addPart = function (requestedParts, addedPart, requestListEventContext) {
|
|
70
|
-
var _this = this;
|
|
71
|
-
var isPartAdded = !!requestedParts.find(function (part) { return part.partiumId === addedPart.partiumId; });
|
|
72
|
-
var list = isPartAdded ? requestedParts : __spreadArray(__spreadArray([], requestedParts, true), [addedPart], false);
|
|
73
|
-
var quantity = isPartAdded ? addedPart.quantity : 1;
|
|
74
|
-
return this.postRequestList(list).pipe((0, operators_1.tap)(function () {
|
|
75
|
-
_this.dispatchLogService(log_1.EVENT.SHOPPING_CART_ADD_PART, { partiumId: addedPart.partiumId, quantity: quantity, searchSessionId: requestListEventContext === null || requestListEventContext === void 0 ? void 0 : requestListEventContext.searchSessionId }, requestListEventContext);
|
|
76
|
-
}));
|
|
77
|
-
};
|
|
78
|
-
RequestListServiceImpl.prototype.getRequestList = function () {
|
|
79
|
-
return this.httpsService.get('request-list', null, https_service_interface_1.BACKEND_SERVICE.USER_DATA).pipe((0, operators_1.map)(function (list) {
|
|
80
|
-
var requestList = request_list_1.RequestList.fromAPIResponse(list);
|
|
81
|
-
return requestList.list;
|
|
82
|
-
}));
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Resets the requests list to an empty array of parts.
|
|
86
|
-
*/
|
|
87
|
-
RequestListServiceImpl.prototype.resetList = function (requestListEventContext) {
|
|
88
|
-
var _this = this;
|
|
89
|
-
var requestedParts = [];
|
|
90
|
-
return this.postRequestList(requestedParts).pipe((0, operators_1.tap)(function () { return _this.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_ALL_PARTS, {}, requestListEventContext); }), (0, operators_1.catchError)(function (error) {
|
|
91
|
-
console.log('Reset list log error', error);
|
|
92
|
-
return;
|
|
93
|
-
}));
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* DELETE a part from request-list without send entire list to update
|
|
97
|
-
*/
|
|
98
|
-
RequestListServiceImpl.prototype.deletePart = function (partiumId, requestListEventContext) {
|
|
99
|
-
var _this = this;
|
|
100
|
-
return this.httpsService.delete("request-list/items/".concat(partiumId), null, [], https_service_interface_1.BACKEND_SERVICE.USER_DATA).pipe((0, operators_1.tap)(function () { return _this.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_PART, { partiumId: partiumId }, requestListEventContext); }), (0, operators_1.map)(function () { return true; }));
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* Post a requestList to the server to be stored in the cloud.
|
|
104
|
-
*/
|
|
105
|
-
RequestListServiceImpl.prototype.postRequestList = function (requestedParts) {
|
|
106
|
-
var payload = requestedParts.map(function (part) { return ({
|
|
107
|
-
quantity: part.quantity,
|
|
108
|
-
part_id: part.partiumId,
|
|
109
|
-
}); });
|
|
110
|
-
return this.httpsService.post('request-list', payload, [], https_service_interface_1.BACKEND_SERVICE.USER_DATA).pipe((0, operators_1.map)(function (list) {
|
|
111
|
-
var requestList = request_list_1.RequestList.fromAPIResponse(list);
|
|
112
|
-
return requestList.list;
|
|
113
|
-
}));
|
|
114
|
-
};
|
|
115
|
-
RequestListServiceImpl.prototype.dispatchLogService = function (event, data, requestListEventContext) {
|
|
116
|
-
this.logService
|
|
117
|
-
.logEvent(new log_1.EventLog({
|
|
118
|
-
version: log_1.EVENTLOG_VERSIONS.V_2_0_0,
|
|
119
|
-
organizationId: requestListEventContext === null || requestListEventContext === void 0 ? void 0 : requestListEventContext.organizationId,
|
|
120
|
-
interface: (requestListEventContext === null || requestListEventContext === void 0 ? void 0 : requestListEventContext.eventInterface) || log_1.INTERFACE.API_ACCESS,
|
|
121
|
-
event: event,
|
|
122
|
-
data: data,
|
|
123
|
-
}))
|
|
124
|
-
.subscribe(function () { }, function (error) {
|
|
125
|
-
console.log('Error while sending log event: ', error);
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
RequestListServiceImpl = __decorate([
|
|
129
|
-
(0, injection_identifier_1.InjectionIdentifier)('RequestListService')
|
|
130
|
-
], RequestListServiceImpl);
|
|
131
|
-
return RequestListServiceImpl;
|
|
132
|
-
}(base_service_1.BaseService));
|
|
133
|
-
exports.RequestListServiceImpl = RequestListServiceImpl;
|
|
134
|
-
//# sourceMappingURL=request-list.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 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),void 0,[],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;
|