@partium/js-sdk 14.0.2 → 14.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/catalog/index.js +21 -1
- package/catalog/models/catalog-image-info.js +22 -1
- package/catalog/models/catalog-image.js +40 -1
- package/catalog/models/upsert-catalog-images-dto.js +3 -1
- package/catalog/models/upsert-images-result.js +3 -1
- package/catalog/services/images.service.js +62 -1
- package/core/constants/constants.js +16 -1
- package/core/decorators/injection-identifier.js +19 -1
- package/core/factories/paginated-request-service.factory.js +33 -1
- package/core/index.js +63 -1
- package/core/integration-defaults/http/fetch-api-http-error-helper.js +129 -1
- package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.js +138 -1
- package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.js +210 -1
- package/core/integration-defaults/http/handle-axios-error-helper.js +79 -1
- package/core/integration-defaults/http/https-client/axios-https-client.service.js +182 -1
- package/core/integration-defaults/http/https-client/fetch-api-https-client.service.js +198 -1
- package/core/integration-defaults/http/js-oauth-keycloak-https.service.js +32 -1
- package/core/integration-defaults/js-p-file.js +36 -1
- package/core/integration-defaults/session/js-oauth-api-key-session.service.js +206 -1
- package/core/integration-defaults/session/js-oauth-keycloak-auth-config.js +64 -1
- package/core/integration-defaults/session/js-oauth-keycloak-session.service.js +257 -1
- package/core/integration-defaults/web-device-status.service.js +125 -1
- package/core/integration-defaults/web-file.service.js +135 -1
- package/core/integration-defaults/web-indexeddb.service.js +142 -1
- package/core/integration-defaults/web-local-storage.service.js +310 -1
- package/core/models/api-object.js +16 -1
- package/core/models/auth-config.js +72 -1
- package/core/models/device-info.js +34 -1
- package/core/models/error.js +107 -1
- package/core/models/formatted-string.js +14 -1
- package/core/models/i18n-map.js +61 -1
- package/core/models/i18n-string.js +35 -1
- package/core/models/log.js +137 -1
- package/core/models/organization.js +159 -1
- package/core/models/p-file.js +23 -1
- package/core/models/paginated-list.js +41 -1
- package/core/models/partium-config.js +43 -1
- package/core/models/user-token.js +11 -1
- package/core/models/user.js +88 -1
- package/core/services/backend-status.service.js +147 -1
- package/core/services/base-login-init.service.js +57 -1
- package/core/services/base.service.js +37 -1
- package/core/services/device-status.service.interface.js +117 -1
- package/core/services/file.service.interface.js +61 -1
- package/core/services/http/file-transfer/file-transfer.service.interface.js +125 -1
- package/core/services/http/https-client/https-client.service.interface.js +152 -1
- package/core/services/http/https.service.interface.js +294 -1
- package/core/services/http/oauth-https.service.js +218 -1
- package/core/services/local-storage.service.interface.js +378 -1
- package/core/services/log.service.js +139 -1
- package/core/services/organization.service.js +202 -1
- package/core/services/paginated-request.service.js +160 -1
- package/core/services/recent-parts.service.js +194 -1
- package/core/services/service-provider.js +114 -1
- package/core/services/session/oauth-session.service.js +104 -1
- package/core/services/session/session.service.interface.js +367 -1
- package/core/utils/general-helper.js +110 -1
- package/data/index.js +44 -1
- package/data/models/announcement.js +70 -1
- package/data/models/assembly-hierarchy-node-breadcrumb.js +51 -1
- package/data/models/assembly-hierarchy-node.js +46 -1
- package/data/models/attribute.js +106 -1
- package/data/models/csa-request-search.js +46 -1
- package/data/models/csa-request-status.js +51 -1
- package/data/models/csa-request.js +112 -1
- package/data/models/document.js +17 -1
- package/data/models/filter-key.js +36 -1
- package/data/models/filter-option-value.js +41 -1
- package/data/models/image.d.ts +6 -1
- package/data/models/image.js +77 -1
- package/data/models/inquiry.js +71 -1
- package/data/models/mounting-location.js +58 -1
- package/data/models/multiple-expert-searches.js +40 -1
- package/data/models/part-enrichment-data.js +50 -1
- package/data/models/part.js +168 -1
- package/data/models/shopping-cart.js +60 -1
- package/data/services/announcement.service.js +89 -1
- package/data/services/assembly-hierarchy-nodes.service.js +193 -1
- package/data/services/csa-helper.service.js +158 -1
- package/data/services/customer-service-assistance.service.js +276 -1
- package/data/services/filter.service.js +97 -1
- package/data/services/inquiry.service.js +68 -1
- package/data/services/part-attribute.service.js +118 -1
- package/data/services/part-enrichment.service.js +56 -1
- package/data/services/part.service.js +182 -1
- package/data/services/related-parts.service.js +83 -1
- package/data/services/shopping-cart.service.js +152 -1
- package/find/index.js +51 -1
- package/find/models/assets/asset.js +32 -1
- package/find/models/search-filter.js +205 -1
- package/find/models/search-input.js +3 -1
- package/find/models/search-output.js +3 -1
- package/find/models/search-result-status.js +40 -1
- package/find/models/search-session-log-object.js +22 -1
- package/find/models/search-status/cv-search-status.js +22 -1
- package/find/models/search-status/search-filter-status.js +36 -1
- package/find/models/search-status/search-status.js +56 -1
- package/find/models/search-status/tag-search-status.js +23 -1
- package/find/models/search-status/text-search-status.js +18 -1
- package/find/models/search-tag.js +16 -1
- package/find/models/smart-filter.js +49 -1
- package/find/models/tagable/i18n-tagable.js +37 -1
- package/find/models/tagable/tagable-base.js +22 -1
- package/find/models/tagable/tagable.js +37 -1
- package/find/models/text-search-config.js +70 -1
- package/find/models/text-search-manipulator.js +90 -1
- package/find/models/text-search-result-item/text-search-error.js +12 -1
- package/find/models/text-search-result-item/text-search-result-item-document.js +34 -1
- package/find/models/text-search-result-item/text-search-result-item-part.js +36 -1
- package/find/models/text-search-result-item/text-search-result-item-recent-query.js +35 -1
- package/find/models/text-search-result-item/text-search-result-item-unknown.js +38 -1
- package/find/models/text-search-result-item/text-search-result-item.js +22 -1
- package/find/services/asset.service.js +348 -1
- package/find/services/filter-uploaders/filter-uploader.js +3 -1
- package/find/services/filter-uploaders/update-filters-uploader.js +77 -1
- package/find/services/filter-uploaders/update-filters.model.js +7 -1
- package/find/services/search/cv-search.service.js +214 -1
- package/find/services/search/recent-text-search-queries.service.js +260 -1
- package/find/services/search/search-result.service.js +539 -1
- package/find/services/search/search.service.js +514 -1
- package/find/services/search/tag-search.service.js +124 -1
- package/find/services/search/text-search.service.js +316 -1
- package/find/services/search-filter.service.js +292 -1
- package/find/utils/search-helper.js +75 -1
- package/gen/sdk-version.d.ts +1 -1
- package/gen/sdk-version.js +5 -1
- package/index.js +392 -1
- package/management/index.js +21 -1
- package/management/models/api-key-list-response.js +3 -1
- package/management/models/api-key-type.js +9 -1
- package/management/models/api-key.js +3 -1
- package/management/services/api-key.service.js +53 -1
- package/ocr/index.js +20 -1
- package/ocr/models/detect-response.js +3 -1
- package/ocr/models/detected-text-entry.js +3 -1
- package/ocr/services/ocr.service.js +59 -1
- package/package.json +1 -1
- package/user-data/index.js +21 -1
- package/user-data/models/part-with-nullable.js +3 -1
- package/user-data/models/request-list/request-list.js +63 -1
- package/user-data/services/favorite/favorite.service.js +108 -1
- package/user-data/services/request-list/request-list.service.js +133 -1
|
@@ -1,2 +1,368 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __extends = (this && this.__extends) || (function () {
|
|
4
|
+
var extendStatics = function (d, b) {
|
|
5
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
8
|
+
return extendStatics(d, b);
|
|
9
|
+
};
|
|
10
|
+
return function (d, b) {
|
|
11
|
+
if (typeof b !== "function" && b !== null)
|
|
12
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13
|
+
extendStatics(d, b);
|
|
14
|
+
function __() { this.constructor = d; }
|
|
15
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
25
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
26
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
27
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
28
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
29
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
30
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
34
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
35
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
36
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
37
|
+
function step(op) {
|
|
38
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
39
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
40
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
41
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
42
|
+
switch (op[0]) {
|
|
43
|
+
case 0: case 1: t = op; break;
|
|
44
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
45
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
46
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
47
|
+
default:
|
|
48
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
49
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
50
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
51
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
52
|
+
if (t[2]) _.ops.pop();
|
|
53
|
+
_.trys.pop(); continue;
|
|
54
|
+
}
|
|
55
|
+
op = body.call(thisArg, _);
|
|
56
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
57
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
61
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
62
|
+
if (ar || !(i in from)) {
|
|
63
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
64
|
+
ar[i] = from[i];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
68
|
+
};
|
|
69
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
70
|
+
exports.SessionService = exports.LoginConfig = exports.SESSION_STATUS_EVENT = void 0;
|
|
71
|
+
var rxjs_1 = require("rxjs");
|
|
72
|
+
var operators_1 = require("rxjs/operators");
|
|
73
|
+
var injection_identifier_1 = require("../../decorators/injection-identifier");
|
|
74
|
+
var base_service_1 = require("../base.service");
|
|
75
|
+
var organization_service_1 = require("../organization.service");
|
|
76
|
+
var log_1 = require("../../models/log");
|
|
77
|
+
var log_service_1 = require("../log.service");
|
|
78
|
+
var device_status_service_interface_1 = require("../device-status.service.interface");
|
|
79
|
+
var sdk_version_1 = require("../../../gen/sdk-version");
|
|
80
|
+
var error_1 = require("../../models/error");
|
|
81
|
+
var local_storage_service_interface_1 = require("../local-storage.service.interface");
|
|
82
|
+
var SESSION_STATUS_EVENT;
|
|
83
|
+
(function (SESSION_STATUS_EVENT) {
|
|
84
|
+
SESSION_STATUS_EVENT[SESSION_STATUS_EVENT["SESSION_STARTED"] = 0] = "SESSION_STARTED";
|
|
85
|
+
SESSION_STATUS_EVENT[SESSION_STATUS_EVENT["SESSION_ENDED"] = 1] = "SESSION_ENDED";
|
|
86
|
+
})(SESSION_STATUS_EVENT || (exports.SESSION_STATUS_EVENT = SESSION_STATUS_EVENT = {}));
|
|
87
|
+
/**
|
|
88
|
+
* Login-Configuration, such as username and password, or api-key
|
|
89
|
+
*/
|
|
90
|
+
var LoginConfig = /** @class */ (function () {
|
|
91
|
+
function LoginConfig() {
|
|
92
|
+
}
|
|
93
|
+
return LoginConfig;
|
|
94
|
+
}());
|
|
95
|
+
exports.LoginConfig = LoginConfig;
|
|
96
|
+
/**
|
|
97
|
+
* Defines the structure of a session-service implementation.
|
|
98
|
+
* It contains functions that are required for handling user sessions and
|
|
99
|
+
* authentication-mechanisms.
|
|
100
|
+
* The implementations of this interface will be based on the chosen
|
|
101
|
+
* authentication method and platform that is used in the application,
|
|
102
|
+
*
|
|
103
|
+
* An implementation of this service is required and has to be configured during
|
|
104
|
+
* the initialization phase of Partium.
|
|
105
|
+
*
|
|
106
|
+
* This class file is called interface, even though it is not an interface,
|
|
107
|
+
* but we need it to be a concrete class for the serviceProvider.
|
|
108
|
+
*/
|
|
109
|
+
var SessionService = /** @class */ (function (_super) {
|
|
110
|
+
__extends(SessionService, _super);
|
|
111
|
+
function SessionService(serviceProvider) {
|
|
112
|
+
var _this = _super.call(this, serviceProvider) || this;
|
|
113
|
+
_this.currentOrganization$ = new rxjs_1.BehaviorSubject(undefined);
|
|
114
|
+
// registered services, where init-method must run successfully through, during login
|
|
115
|
+
_this.servicesToInitDuringLogin = [];
|
|
116
|
+
_this.sessionStatus$ = new rxjs_1.BehaviorSubject(null);
|
|
117
|
+
return _this;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Called by HttpsService to pass config info
|
|
121
|
+
*
|
|
122
|
+
* @param config the Partium configuration
|
|
123
|
+
*/
|
|
124
|
+
SessionService.prototype.init = function (config) {
|
|
125
|
+
var _this = this;
|
|
126
|
+
return new rxjs_1.Observable(function (subscriber) {
|
|
127
|
+
_this.authenticationConfig = config.authenticationConfig;
|
|
128
|
+
_this.partiumConfig = config;
|
|
129
|
+
subscriber.next();
|
|
130
|
+
subscriber.complete();
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Login user based on the given configuration.
|
|
135
|
+
*
|
|
136
|
+
* Method should be overridden by child-class
|
|
137
|
+
*
|
|
138
|
+
* @param config the login configuration, which differs per authentication-method
|
|
139
|
+
*/
|
|
140
|
+
SessionService.prototype.login = function (config) {
|
|
141
|
+
throw new Error("In order to use the SessionService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().");
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Logout currently logged in user
|
|
145
|
+
*
|
|
146
|
+
* Method should be overridden by child-class
|
|
147
|
+
*/
|
|
148
|
+
SessionService.prototype.logout = function () {
|
|
149
|
+
throw new Error("In order to use the SessionService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().");
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Returns an Observable that always emits an event when a session has just
|
|
153
|
+
* started or ended.
|
|
154
|
+
*/
|
|
155
|
+
SessionService.prototype.getSessionStatusEvents = function () {
|
|
156
|
+
return this.sessionStatus$.asObservable();
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Get the currently configured authentication configuration
|
|
160
|
+
*
|
|
161
|
+
* @returns the authentication configuration
|
|
162
|
+
*/
|
|
163
|
+
SessionService.prototype.getAuthConfig = function () {
|
|
164
|
+
return this.authenticationConfig;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Set the user-object of the currently logged in user.
|
|
168
|
+
* This class should be called by any of the deriving classes.
|
|
169
|
+
*
|
|
170
|
+
* @param user the currently logged in user
|
|
171
|
+
*/
|
|
172
|
+
SessionService.prototype.setUser = function (user) {
|
|
173
|
+
this.user = user;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Retrieve the currently logged in user
|
|
177
|
+
*
|
|
178
|
+
* @returns the currently logged in user
|
|
179
|
+
*/
|
|
180
|
+
SessionService.prototype.getUser = function () {
|
|
181
|
+
return this.user;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Set organization with the given identifier as the current organization to be used in the session.
|
|
185
|
+
*
|
|
186
|
+
* @param organizationIdentifier can be organization-id or organization-name
|
|
187
|
+
* @returns void if organization is found, otherwise throws an error
|
|
188
|
+
*/
|
|
189
|
+
SessionService.prototype.useOrganization = function (organizationIdentifier) {
|
|
190
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
191
|
+
var organizations, flattenedOrganizations, _i, flattenedOrganizations_1, org;
|
|
192
|
+
return __generator(this, function (_a) {
|
|
193
|
+
switch (_a.label) {
|
|
194
|
+
case 0: return [4 /*yield*/, this.organizationService.getOrganizations()];
|
|
195
|
+
case 1:
|
|
196
|
+
organizations = _a.sent();
|
|
197
|
+
flattenedOrganizations = this.getFlattenedOrganizations(organizations);
|
|
198
|
+
for (_i = 0, flattenedOrganizations_1 = flattenedOrganizations; _i < flattenedOrganizations_1.length; _i++) {
|
|
199
|
+
org = flattenedOrganizations_1[_i];
|
|
200
|
+
if (org.partiumId === organizationIdentifier || org.name === organizationIdentifier) {
|
|
201
|
+
this.currentOrganization$.next(org);
|
|
202
|
+
this.localStorageService.setItem('lastUsedOrganizationId', org.partiumId, { organizationName: false, userEmail: false });
|
|
203
|
+
return [2 /*return*/];
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
throw new error_1.SdkError(error_1.SDK_ERROR_CODES.ORGANIZATION_NOT_FOUND, { organizationIdentifier: organizationIdentifier }, "Could not find organization with id/name ".concat(organizationIdentifier));
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Get an observable that always emits when the currently selected organization changed.
|
|
213
|
+
*
|
|
214
|
+
* @returns Observable, emitting the currently used organization.
|
|
215
|
+
*/
|
|
216
|
+
SessionService.prototype.getCurrentOrganization$ = function () {
|
|
217
|
+
return this.currentOrganization$.asObservable();
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Register a service to be initialized during login-process.
|
|
221
|
+
* The passed service must extend the BaseLoginInitService and implement an init-function,
|
|
222
|
+
* that returns an Observable, that resolves, when the initialization was finished successfully
|
|
223
|
+
*
|
|
224
|
+
* @param service the service to init during login
|
|
225
|
+
* @param priority services with lower prio will be initialized first. Services with the same prio will be initialized in parallel. Can be used if there are dependencies between the services.
|
|
226
|
+
*/
|
|
227
|
+
SessionService.prototype.registerLoginInitService = function (service, priority) {
|
|
228
|
+
if (priority === void 0) { priority = 100; }
|
|
229
|
+
this.servicesToInitDuringLogin.push({ service: service, priority: priority });
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* Needs to be called during the login-process, after the user is authenticated,
|
|
233
|
+
* to download and prepare all the data needed in the session.
|
|
234
|
+
*
|
|
235
|
+
* @param eventContext (optional) additional event context for event logs emitted during session setup
|
|
236
|
+
*/
|
|
237
|
+
SessionService.prototype.sessionSetup = function (eventContext) {
|
|
238
|
+
var _this = this;
|
|
239
|
+
this.organizationService = this.serviceProvider.getService(organization_service_1.OrganizationService);
|
|
240
|
+
this.localStorageService = this.serviceProvider.getService(local_storage_service_interface_1.LocalStorageService);
|
|
241
|
+
var logService = this.serviceProvider.getService(log_service_1.LogServiceImpl);
|
|
242
|
+
var deviceStatusService = this.serviceProvider.getService(device_status_service_interface_1.DeviceStatusService);
|
|
243
|
+
return (0, rxjs_1.from)(Promise.all([
|
|
244
|
+
this.localStorageService.getItem('lastUsedOrganizationId', { organizationName: false, userEmail: false }),
|
|
245
|
+
this.organizationService.init().then(function () { return _this.organizationService.getOrganizations(); }),
|
|
246
|
+
])).pipe((0, operators_1.mergeMap)(function (_a) {
|
|
247
|
+
var lastUsedOrganizationId = _a[0], organizations = _a[1];
|
|
248
|
+
if (lastUsedOrganizationId) {
|
|
249
|
+
var organization = _this.getFlattenedOrganizations(organizations).find(function (org) { return org.partiumId === lastUsedOrganizationId; });
|
|
250
|
+
if (organization && !organization.requiresAdditionalAuthentication) { // only use recent organization, if it does not require additional authentication
|
|
251
|
+
return (0, rxjs_1.of)(organization);
|
|
252
|
+
;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return (0, rxjs_1.from)(_this.organizationService.getFirstOrganization());
|
|
256
|
+
}), (0, operators_1.map)(function (organization) {
|
|
257
|
+
_this.currentOrganization$.next(organization);
|
|
258
|
+
return organization;
|
|
259
|
+
}), (0, operators_1.mergeMap)(function (organization) {
|
|
260
|
+
return _this.initializeRegisteredServices().pipe((0, operators_1.mergeMap)(function () {
|
|
261
|
+
return (0, rxjs_1.from)(deviceStatusService.getDeviceInfo()).pipe((0, operators_1.tap)(function (deviceInfo) {
|
|
262
|
+
_this.logUserSessionInfoEvent(deviceInfo, logService, organization, eventContext);
|
|
263
|
+
}));
|
|
264
|
+
}));
|
|
265
|
+
}), (0, operators_1.map)(function () {
|
|
266
|
+
_this.sessionStatus$.next(SESSION_STATUS_EVENT.SESSION_STARTED);
|
|
267
|
+
}), (0, operators_1.catchError)(function (error) {
|
|
268
|
+
_this.logout().subscribe();
|
|
269
|
+
return (0, rxjs_1.throwError)(error);
|
|
270
|
+
}));
|
|
271
|
+
};
|
|
272
|
+
SessionService.prototype.logUserSessionInfoEvent = function (deviceInfo, logService, organization, eventContext) {
|
|
273
|
+
var languageUi = this.getValidLanguageUiForEvent(organization, eventContext === null || eventContext === void 0 ? void 0 : eventContext.languageUi);
|
|
274
|
+
var eventLogData = {
|
|
275
|
+
deviceId: deviceInfo.deviceId,
|
|
276
|
+
manufacturer: deviceInfo.manufacturer,
|
|
277
|
+
model: deviceInfo.model,
|
|
278
|
+
os: deviceInfo.os,
|
|
279
|
+
osVersion: deviceInfo.osVersion,
|
|
280
|
+
deviceType: deviceInfo.deviceType,
|
|
281
|
+
deviceLanguage: deviceInfo.deviceLanguage,
|
|
282
|
+
appVersionCode: deviceInfo.appVersionCode,
|
|
283
|
+
appVersionName: deviceInfo.appVersionName,
|
|
284
|
+
partiumSdkVersion: sdk_version_1.SDK_VERSION_NUMBER,
|
|
285
|
+
languageUi: languageUi,
|
|
286
|
+
browserName: deviceInfo.browserName,
|
|
287
|
+
browserVersion: deviceInfo.browserVersion,
|
|
288
|
+
cpuArchitecture: deviceInfo.cpuArchitecture,
|
|
289
|
+
engineName: deviceInfo.engineName,
|
|
290
|
+
engineVersion: deviceInfo.engineVersion,
|
|
291
|
+
};
|
|
292
|
+
logService
|
|
293
|
+
.logEvent(new log_1.EventLog({
|
|
294
|
+
organizationId: organization.partiumId,
|
|
295
|
+
version: log_1.EVENTLOG_VERSIONS.V_2_0_0,
|
|
296
|
+
interface: (eventContext === null || eventContext === void 0 ? void 0 : eventContext.eventInterface) || log_1.INTERFACE.API_ACCESS,
|
|
297
|
+
event: log_1.EVENT.USER_SESSION_INFO,
|
|
298
|
+
data: eventLogData,
|
|
299
|
+
}))
|
|
300
|
+
.subscribe({
|
|
301
|
+
next: function () {
|
|
302
|
+
// do nothing (console.log will be called in log-service)
|
|
303
|
+
},
|
|
304
|
+
error: function (error) {
|
|
305
|
+
console.error("Error while sending log event ".concat(log_1.EVENT.USER_SESSION_INFO, ": "), error);
|
|
306
|
+
},
|
|
307
|
+
});
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Returns the passed languageUiCandidate if it is valid for the organization config.
|
|
311
|
+
* Returns null if invalid.
|
|
312
|
+
*/
|
|
313
|
+
SessionService.prototype.getValidLanguageUiForEvent = function (organization, languageUiCandidate) {
|
|
314
|
+
var _a;
|
|
315
|
+
if (languageUiCandidate) {
|
|
316
|
+
var languages = ((_a = organization.config) === null || _a === void 0 ? void 0 : _a.availableUiLanguages) || ['en'];
|
|
317
|
+
if (languages.includes(languageUiCandidate)) {
|
|
318
|
+
return languageUiCandidate;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return null;
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* Needs to be called when a session ended,
|
|
325
|
+
* to notify other services that need to tear down.
|
|
326
|
+
*/
|
|
327
|
+
SessionService.prototype.sessionEnded = function () {
|
|
328
|
+
this.sessionStatus$.next(SESSION_STATUS_EVENT.SESSION_ENDED);
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* Initializes all services, which are registered for initialization during login.
|
|
332
|
+
* First all services with priority 1 will be registered in parallel, then all services with priority 2, and so on.
|
|
333
|
+
*
|
|
334
|
+
* @returns Observable that resolves once all services have been initialized.
|
|
335
|
+
*/
|
|
336
|
+
SessionService.prototype.initializeRegisteredServices = function () {
|
|
337
|
+
var _this = this;
|
|
338
|
+
var sortedServices = this.servicesToInitDuringLogin.sort(function (a, b) {
|
|
339
|
+
return a.priority - b.priority;
|
|
340
|
+
});
|
|
341
|
+
var groupedServices = [];
|
|
342
|
+
var curPrio = -1;
|
|
343
|
+
for (var i = 0; i < sortedServices.length; i++) {
|
|
344
|
+
var service = sortedServices[i];
|
|
345
|
+
if (service.priority === curPrio) {
|
|
346
|
+
groupedServices[groupedServices.length - 1].push(service.service);
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
curPrio = service.priority;
|
|
350
|
+
groupedServices.push([service.service]);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return rxjs_1.concat.apply(void 0, groupedServices.map(function (services) {
|
|
354
|
+
return (0, rxjs_1.forkJoin)(services.map(function (service) {
|
|
355
|
+
return service.init(_this.partiumConfig, _this.user.email, _this.getCurrentOrganization$());
|
|
356
|
+
}));
|
|
357
|
+
})).pipe((0, operators_1.last)());
|
|
358
|
+
};
|
|
359
|
+
SessionService.prototype.getFlattenedOrganizations = function (organizations) {
|
|
360
|
+
return organizations.reduce(function (acc, curr) { return __spreadArray(__spreadArray(__spreadArray([], acc, true), [curr], false), curr.subOrgs || [], true); }, []);
|
|
361
|
+
};
|
|
362
|
+
SessionService = __decorate([
|
|
363
|
+
(0, injection_identifier_1.InjectionIdentifier)('SessionService')
|
|
364
|
+
], SessionService);
|
|
365
|
+
return SessionService;
|
|
366
|
+
}(base_service_1.BaseService));
|
|
367
|
+
exports.SessionService = SessionService;
|
|
368
|
+
//# sourceMappingURL=session.service.interface.js.map
|
|
@@ -1,2 +1,111 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Converts camel case to snake case
|
|
5
|
+
*
|
|
6
|
+
* @param data object with properties in camel case format
|
|
7
|
+
* @returns object in snake case format
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.addUrlParameter = exports.addUrlParameters = exports.snakeToCamelCase = exports.camelToSnake = void 0;
|
|
11
|
+
var camelToSnake = function (data) {
|
|
12
|
+
var snakeCaseData = {};
|
|
13
|
+
Object.keys(data).forEach(function (key) {
|
|
14
|
+
var snakeCaseKey = key.replace(/[A-Z]/g, function (letter) { return "_".concat(letter.toLowerCase()); });
|
|
15
|
+
snakeCaseData[snakeCaseKey] = data[key];
|
|
16
|
+
if (Array.isArray(data[snakeCaseKey])) {
|
|
17
|
+
var list = data[snakeCaseKey];
|
|
18
|
+
list = list.map(function (item) {
|
|
19
|
+
var isObject = item && typeof item === 'object' && item.constructor === Object;
|
|
20
|
+
return isObject ? (0, exports.camelToSnake)(item) : item;
|
|
21
|
+
});
|
|
22
|
+
snakeCaseData[snakeCaseKey] = list;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return snakeCaseData;
|
|
26
|
+
};
|
|
27
|
+
exports.camelToSnake = camelToSnake;
|
|
28
|
+
/**
|
|
29
|
+
* Converts snake case to camel case
|
|
30
|
+
*
|
|
31
|
+
* @param data object with properties in snake case format
|
|
32
|
+
* @returns object in camel case format
|
|
33
|
+
*/
|
|
34
|
+
var snakeToCamelCase = function (data) {
|
|
35
|
+
var camelCaseData = {};
|
|
36
|
+
Object.keys(data).forEach(function (key) {
|
|
37
|
+
var camelKey = key
|
|
38
|
+
.toLowerCase()
|
|
39
|
+
.replace(/([-_][a-z])/g, function (group) { return group.toUpperCase().replace('-', '').replace('_', ''); });
|
|
40
|
+
camelCaseData[camelKey] = data[key];
|
|
41
|
+
if (Array.isArray(data[camelKey])) {
|
|
42
|
+
var list = data[camelKey];
|
|
43
|
+
list = list.map(function (item) {
|
|
44
|
+
var isObject = item && typeof item === 'object' && item.constructor === Object;
|
|
45
|
+
return isObject ? (0, exports.snakeToCamelCase)(item) : item;
|
|
46
|
+
});
|
|
47
|
+
camelCaseData[camelKey] = list;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return camelCaseData;
|
|
51
|
+
};
|
|
52
|
+
exports.snakeToCamelCase = snakeToCamelCase;
|
|
53
|
+
/**
|
|
54
|
+
* Add url parameters to the given url and return it as string.
|
|
55
|
+
* If one of the parameter already exists, it will be added another time.
|
|
56
|
+
* If an object of the array contains multiple params, all are added.
|
|
57
|
+
*
|
|
58
|
+
* @param url the url to add the parameters to
|
|
59
|
+
* @param paramObjects array of objects with parameters that should be appended, eg: [{ pageNumber: 4 }]
|
|
60
|
+
* @returns the given url with the appended parameters
|
|
61
|
+
*/
|
|
62
|
+
var addUrlParameters = function (url, paramObjects) {
|
|
63
|
+
if (!paramObjects || paramObjects.length < 1) {
|
|
64
|
+
return url;
|
|
65
|
+
}
|
|
66
|
+
for (var _i = 0, paramObjects_1 = paramObjects; _i < paramObjects_1.length; _i++) {
|
|
67
|
+
var paramObject = paramObjects_1[_i];
|
|
68
|
+
url = (0, exports.addUrlParameter)(url, paramObject);
|
|
69
|
+
}
|
|
70
|
+
return url;
|
|
71
|
+
};
|
|
72
|
+
exports.addUrlParameters = addUrlParameters;
|
|
73
|
+
/**
|
|
74
|
+
* Add an url parameter to the given url and return it as string.
|
|
75
|
+
* If the same parameter already exists, it will be added another time.
|
|
76
|
+
* If an object of the array contains multiple params, all are added.
|
|
77
|
+
*
|
|
78
|
+
* @param url the url to add the parameter to
|
|
79
|
+
* @param paramObject the object with one or more params to append, eg: { pageNumber: 4 }
|
|
80
|
+
* @returns the given url with the appended parameter
|
|
81
|
+
*/
|
|
82
|
+
var addUrlParameter = function (url, paramObject) {
|
|
83
|
+
if (!paramObject) {
|
|
84
|
+
return url;
|
|
85
|
+
}
|
|
86
|
+
var splittedUrl = url.split('?');
|
|
87
|
+
var baseUrl = splittedUrl[0];
|
|
88
|
+
var curUrlParams = [];
|
|
89
|
+
if (splittedUrl.length > 1) {
|
|
90
|
+
curUrlParams = splittedUrl[1].split('&').map(function (param) { return param.split('='); });
|
|
91
|
+
}
|
|
92
|
+
for (var _i = 0, _a = Object.keys(paramObject); _i < _a.length; _i++) {
|
|
93
|
+
var newUrlParam = _a[_i];
|
|
94
|
+
var value = paramObject[newUrlParam];
|
|
95
|
+
if (value == null) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
newUrlParam = encodeURIComponent(newUrlParam);
|
|
99
|
+
value = encodeURIComponent(value);
|
|
100
|
+
curUrlParams.push([newUrlParam, value]);
|
|
101
|
+
}
|
|
102
|
+
var joinedPairs = curUrlParams.map(function (pair) { return pair.join('='); });
|
|
103
|
+
if (joinedPairs.length > 0) {
|
|
104
|
+
return "".concat(baseUrl, "?").concat(joinedPairs.join('&'));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
return baseUrl;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
exports.addUrlParameter = addUrlParameter;
|
|
111
|
+
//# sourceMappingURL=general-helper.js.map
|
package/data/index.js
CHANGED
|
@@ -1,2 +1,45 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
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"), exports);
|
|
19
|
+
__exportStar(require("./models/document"), exports);
|
|
20
|
+
__exportStar(require("./models/assembly-hierarchy-node"), exports);
|
|
21
|
+
__exportStar(require("./models/assembly-hierarchy-node-breadcrumb"), exports);
|
|
22
|
+
__exportStar(require("./models/image"), exports);
|
|
23
|
+
__exportStar(require("./models/attribute"), exports);
|
|
24
|
+
__exportStar(require("./models/csa-request"), exports);
|
|
25
|
+
__exportStar(require("./models/csa-request-status"), exports);
|
|
26
|
+
__exportStar(require("./models/filter-key"), exports);
|
|
27
|
+
__exportStar(require("./models/filter-option-value"), exports);
|
|
28
|
+
__exportStar(require("./models/shopping-cart"), exports);
|
|
29
|
+
__exportStar(require("./models/multiple-expert-searches"), exports);
|
|
30
|
+
__exportStar(require("./models/csa-request-search"), exports);
|
|
31
|
+
__exportStar(require("./models/announcement"), exports);
|
|
32
|
+
__exportStar(require("./models/inquiry"), exports);
|
|
33
|
+
__exportStar(require("./models/mounting-location"), exports);
|
|
34
|
+
__exportStar(require("./models/part-enrichment-data"), exports);
|
|
35
|
+
__exportStar(require("./services/part.service"), exports);
|
|
36
|
+
__exportStar(require("./services/part-enrichment.service"), exports);
|
|
37
|
+
__exportStar(require("./services/related-parts.service"), exports);
|
|
38
|
+
__exportStar(require("./services/assembly-hierarchy-nodes.service"), exports);
|
|
39
|
+
__exportStar(require("./services/part-attribute.service"), exports);
|
|
40
|
+
__exportStar(require("./services/customer-service-assistance.service"), exports);
|
|
41
|
+
__exportStar(require("./services/filter.service"), exports);
|
|
42
|
+
__exportStar(require("./services/shopping-cart.service"), exports);
|
|
43
|
+
__exportStar(require("./services/inquiry.service"), exports);
|
|
44
|
+
__exportStar(require("./services/announcement.service"), exports);
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,71 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __extends = (this && this.__extends) || (function () {
|
|
4
|
+
var extendStatics = function (d, b) {
|
|
5
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
8
|
+
return extendStatics(d, b);
|
|
9
|
+
};
|
|
10
|
+
return function (d, b) {
|
|
11
|
+
if (typeof b !== "function" && b !== null)
|
|
12
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13
|
+
extendStatics(d, b);
|
|
14
|
+
function __() { this.constructor = d; }
|
|
15
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.Announcement = exports.AnnouncementRecipient = exports.ANNOUNCEMENT_TYPE = exports.ANNOUNCEMENTS_STATUS = void 0;
|
|
20
|
+
var core_1 = require("../../core");
|
|
21
|
+
var ANNOUNCEMENTS_STATUS;
|
|
22
|
+
(function (ANNOUNCEMENTS_STATUS) {
|
|
23
|
+
ANNOUNCEMENTS_STATUS["PUBLISHED"] = "PUBLISHED";
|
|
24
|
+
ANNOUNCEMENTS_STATUS["UNPUBLISHED"] = "UNPUBLISHED";
|
|
25
|
+
ANNOUNCEMENTS_STATUS["UNPUBLISHED_CHANGES"] = "UNPUBLISHED CHANGES";
|
|
26
|
+
})(ANNOUNCEMENTS_STATUS || (exports.ANNOUNCEMENTS_STATUS = ANNOUNCEMENTS_STATUS = {}));
|
|
27
|
+
var ANNOUNCEMENT_TYPE;
|
|
28
|
+
(function (ANNOUNCEMENT_TYPE) {
|
|
29
|
+
ANNOUNCEMENT_TYPE["APP"] = "app";
|
|
30
|
+
ANNOUNCEMENT_TYPE["COMPANY"] = "company";
|
|
31
|
+
})(ANNOUNCEMENT_TYPE || (exports.ANNOUNCEMENT_TYPE = ANNOUNCEMENT_TYPE = {}));
|
|
32
|
+
var AnnouncementRecipient = /** @class */ (function (_super) {
|
|
33
|
+
__extends(AnnouncementRecipient, _super);
|
|
34
|
+
function AnnouncementRecipient(init) {
|
|
35
|
+
var _this = _super.call(this) || this;
|
|
36
|
+
Object.assign(_this, init);
|
|
37
|
+
return _this;
|
|
38
|
+
}
|
|
39
|
+
AnnouncementRecipient.fromAPIResponse = function (requestData) {
|
|
40
|
+
return new AnnouncementRecipient({
|
|
41
|
+
partiumId: requestData['uuid'],
|
|
42
|
+
name: requestData['name'],
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
return AnnouncementRecipient;
|
|
46
|
+
}(core_1.APIObject));
|
|
47
|
+
exports.AnnouncementRecipient = AnnouncementRecipient;
|
|
48
|
+
var Announcement = /** @class */ (function (_super) {
|
|
49
|
+
__extends(Announcement, _super);
|
|
50
|
+
function Announcement(init) {
|
|
51
|
+
var _this = _super.call(this) || this;
|
|
52
|
+
Object.assign(_this, init);
|
|
53
|
+
return _this;
|
|
54
|
+
}
|
|
55
|
+
Announcement.fromAPIResponse = function (requestData) {
|
|
56
|
+
return new Announcement({
|
|
57
|
+
status: requestData['status'],
|
|
58
|
+
title: requestData['title'],
|
|
59
|
+
contents: requestData['contents'],
|
|
60
|
+
timestamp: requestData['timestamp'],
|
|
61
|
+
terminatesAt: requestData['terminatesAt'],
|
|
62
|
+
announcementType: requestData['type'],
|
|
63
|
+
recipients: requestData['recipients'],
|
|
64
|
+
includeSubOrgs: requestData['includeSubOrgs'],
|
|
65
|
+
sendEmails: requestData['sendEmails'],
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
return Announcement;
|
|
69
|
+
}(core_1.APIObject));
|
|
70
|
+
exports.Announcement = Announcement;
|
|
71
|
+
//# sourceMappingURL=announcement.js.map
|