@idsoftsource/initial-process 3.6.5 → 3.6.8
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.
|
@@ -3310,10 +3310,6 @@ class PreviewComponent {
|
|
|
3310
3310
|
sessionStorage.removeItem('providerId');
|
|
3311
3311
|
sessionStorage.removeItem('providerUserMappingId');
|
|
3312
3312
|
sessionStorage.removeItem('ip_provider_owner');
|
|
3313
|
-
// Don't trust any companyDetails still sitting on the in-memory profile
|
|
3314
|
-
// signal either — CredentialingStore is a root singleton, so it can be
|
|
3315
|
-
// carrying over another user's company data from earlier in this same
|
|
3316
|
-
// browser session (e.g. a previous signup that never hit a full reload).
|
|
3317
3313
|
const current = this.store.profileSignal();
|
|
3318
3314
|
if (current?.companyDetails) {
|
|
3319
3315
|
this.commitProfile({ ...current, companyDetails: undefined });
|
|
@@ -4322,7 +4318,6 @@ class PreviewComponent {
|
|
|
4322
4318
|
pageSize: 100,
|
|
4323
4319
|
filter: includeForUser ? `forUser=${this.resolvedForUser}` : ``,
|
|
4324
4320
|
targetUserId: this.effectiveTargetUserId,
|
|
4325
|
-
targetProviderId: this.effectiveTargetProviderId ?? undefined,
|
|
4326
4321
|
orderBy,
|
|
4327
4322
|
};
|
|
4328
4323
|
}
|
|
@@ -4480,6 +4475,8 @@ class PreviewComponent {
|
|
|
4480
4475
|
issueDate: item?.issueDate ? this.toMonthInput(item.issueDate) : null,
|
|
4481
4476
|
expiryDate: item?.expiryDate ? this.toMonthInput(item.expiryDate) : null,
|
|
4482
4477
|
credentialId: item?.number ? String(item.number) : null,
|
|
4478
|
+
professionId: item?.userProfessionId ?? null,
|
|
4479
|
+
professionName: item?.professionName ?? '',
|
|
4483
4480
|
fileId: item?.fileId ?? null,
|
|
4484
4481
|
fileUrl: item?.fileUrl ?? null,
|
|
4485
4482
|
fileName: item?.fileName ?? null,
|
|
@@ -4869,6 +4866,8 @@ class PreviewComponent {
|
|
|
4869
4866
|
this.skillServerIds[index] = id;
|
|
4870
4867
|
nextSkillMeta[index] = {
|
|
4871
4868
|
providerName: item?.providerName ?? undefined,
|
|
4869
|
+
professionId: item?.professionId ?? null,
|
|
4870
|
+
professionName: item?.professionName ?? '',
|
|
4872
4871
|
starRating: item?.starRating ?? null,
|
|
4873
4872
|
year: item?.year ?? null,
|
|
4874
4873
|
profileVisibility: !!item?.profileVisibility,
|
|
@@ -4899,6 +4898,8 @@ class PreviewComponent {
|
|
|
4899
4898
|
this.toolServerIds[index] = id;
|
|
4900
4899
|
nextToolMeta[index] = {
|
|
4901
4900
|
providerName: item?.providerName ?? undefined,
|
|
4901
|
+
professionId: item?.professionId ?? null,
|
|
4902
|
+
professionName: item?.professionName ?? '',
|
|
4902
4903
|
starRating: item?.starRating ?? null,
|
|
4903
4904
|
year: item?.year ?? null,
|
|
4904
4905
|
profileVisibility: !!item?.profileVisibility,
|
|
@@ -7477,19 +7478,12 @@ class PreviewComponent {
|
|
|
7477
7478
|
}
|
|
7478
7479
|
return false;
|
|
7479
7480
|
}
|
|
7480
|
-
// Combines the two sources: try the backend first (works across any device/browser),
|
|
7481
|
-
// then fall back to the local per-device cache if that fails or comes back empty.
|
|
7482
7481
|
async restoreProviderId() {
|
|
7483
7482
|
const restoredFromServer = await this.restoreProviderMappingFromServer();
|
|
7484
7483
|
if (!restoredFromServer) {
|
|
7485
7484
|
this.restoreProviderIdFromLocalCache();
|
|
7486
7485
|
}
|
|
7487
7486
|
}
|
|
7488
|
-
// Restores providerId/providerUserMappingId into sessionStorage from the local,
|
|
7489
|
-
// per-user cache when they're missing (e.g. sessionStorage was cleared, or the
|
|
7490
|
-
// server lookup didn't find anything) but this user already created a provider
|
|
7491
|
-
// earlier on this same device. Prevents saveProvider() from mistakenly creating a
|
|
7492
|
-
// duplicate provider for a returning user.
|
|
7493
7487
|
restoreProviderIdFromLocalCache() {
|
|
7494
7488
|
const key = this.providerCacheKey();
|
|
7495
7489
|
if (!key)
|
|
@@ -7510,8 +7504,6 @@ class PreviewComponent {
|
|
|
7510
7504
|
console.error('Unable to restore provider id from local cache', err);
|
|
7511
7505
|
}
|
|
7512
7506
|
}
|
|
7513
|
-
// Persists the current provider id/mapping so a future session on this device
|
|
7514
|
-
// (even after sessionStorage is cleared) can find it again instead of recreating it.
|
|
7515
7507
|
cacheProviderIdLocally(providerId, providerUserMappingId) {
|
|
7516
7508
|
const key = this.providerCacheKey();
|
|
7517
7509
|
if (!key || !providerId)
|
|
@@ -10252,9 +10244,8 @@ class SkillsComponent {
|
|
|
10252
10244
|
this.isEditMode = true;
|
|
10253
10245
|
this.model = { ...skill };
|
|
10254
10246
|
const group = this.createGroup(skill.skillSetId, skill.skillSetName);
|
|
10255
|
-
// GetUserSkillSet returns the real saved-profession link under
|
|
10256
|
-
|
|
10257
|
-
const linkedProfessionId = skill.userProfessionId ?? null;
|
|
10247
|
+
// GetUserSkillSet returns the real saved-profession link under professionId.
|
|
10248
|
+
const linkedProfessionId = skill.professionId ?? skill.userProfessionId ?? null;
|
|
10258
10249
|
const linkedProfessionName = skill.professionName ?? '';
|
|
10259
10250
|
// ng-select can only display a label for a value that exists in [items]. If this
|
|
10260
10251
|
// skill's saved profession isn't in the currently loaded userProfessionOptions
|
|
@@ -11451,9 +11442,8 @@ class ToolsComponent {
|
|
|
11451
11442
|
serialNumber: tool.serialNumber,
|
|
11452
11443
|
notes: tool.notes,
|
|
11453
11444
|
profileVisibility: tool.profileVisibility,
|
|
11454
|
-
// GetUserTool returns the real saved-profession link under
|
|
11455
|
-
|
|
11456
|
-
professionId: tool.userProfessionId ?? null,
|
|
11445
|
+
// GetUserTool returns the real saved-profession link under professionId.
|
|
11446
|
+
professionId: tool.professionId ?? tool.userProfessionId ?? null,
|
|
11457
11447
|
professionName: tool.professionName ?? '',
|
|
11458
11448
|
});
|
|
11459
11449
|
if (!this.tab)
|
|
@@ -12207,9 +12197,84 @@ class RoleSelectComponent {
|
|
|
12207
12197
|
sessionStorage.removeItem('ip_provider_owner');
|
|
12208
12198
|
}
|
|
12209
12199
|
if (this.roleData.role.name == 'Provider') {
|
|
12200
|
+
if (!sessionStorage.getItem('providerId')) {
|
|
12201
|
+
await this.restoreProviderId();
|
|
12202
|
+
}
|
|
12210
12203
|
this.getprovider();
|
|
12211
12204
|
}
|
|
12212
12205
|
}
|
|
12206
|
+
// Keyed by userId — the same stable identifier already used for
|
|
12207
|
+
// ip_provider_owner and every other targetUserId call in this component.
|
|
12208
|
+
providerCacheKey() {
|
|
12209
|
+
const normalized = (this.userId || '').toString().trim();
|
|
12210
|
+
return normalized ? `ip_provider_cache::${normalized}` : null;
|
|
12211
|
+
}
|
|
12212
|
+
// Authoritative, cross-device source of truth: ask the backend whether this user
|
|
12213
|
+
// already has a provider mapping. Falls back to the local per-device cache if the
|
|
12214
|
+
// call fails or the user genuinely has no mapping there either.
|
|
12215
|
+
async restoreProviderMappingFromServer() {
|
|
12216
|
+
if (!this.userId)
|
|
12217
|
+
return false;
|
|
12218
|
+
try {
|
|
12219
|
+
const res = await firstValueFrom(this.providerdetail.getProviderUserMapping({
|
|
12220
|
+
TargetUserId: this.userId,
|
|
12221
|
+
Page: 1,
|
|
12222
|
+
PageSize: 1,
|
|
12223
|
+
}));
|
|
12224
|
+
const mapping = res?.data?.[0];
|
|
12225
|
+
const providerId = mapping?.providerId ?? null;
|
|
12226
|
+
const providerUserMappingId = mapping?.id ?? null;
|
|
12227
|
+
if (providerId) {
|
|
12228
|
+
sessionStorage.setItem('providerId', providerId);
|
|
12229
|
+
if (providerUserMappingId)
|
|
12230
|
+
sessionStorage.setItem('providerUserMappingId', providerUserMappingId);
|
|
12231
|
+
sessionStorage.setItem('ip_provider_owner', this.userId);
|
|
12232
|
+
this.cacheProviderIdLocally(providerId, providerUserMappingId);
|
|
12233
|
+
return true;
|
|
12234
|
+
}
|
|
12235
|
+
}
|
|
12236
|
+
catch (err) {
|
|
12237
|
+
console.error('Unable to look up existing provider mapping from server', err);
|
|
12238
|
+
}
|
|
12239
|
+
return false;
|
|
12240
|
+
}
|
|
12241
|
+
async restoreProviderId() {
|
|
12242
|
+
const restoredFromServer = await this.restoreProviderMappingFromServer();
|
|
12243
|
+
if (!restoredFromServer) {
|
|
12244
|
+
this.restoreProviderIdFromLocalCache();
|
|
12245
|
+
}
|
|
12246
|
+
}
|
|
12247
|
+
restoreProviderIdFromLocalCache() {
|
|
12248
|
+
const key = this.providerCacheKey();
|
|
12249
|
+
if (!key)
|
|
12250
|
+
return;
|
|
12251
|
+
try {
|
|
12252
|
+
const raw = localStorage.getItem(key);
|
|
12253
|
+
if (!raw)
|
|
12254
|
+
return;
|
|
12255
|
+
const cached = JSON.parse(raw);
|
|
12256
|
+
if (cached?.providerId) {
|
|
12257
|
+
sessionStorage.setItem('providerId', cached.providerId);
|
|
12258
|
+
if (cached.providerUserMappingId)
|
|
12259
|
+
sessionStorage.setItem('providerUserMappingId', cached.providerUserMappingId);
|
|
12260
|
+
sessionStorage.setItem('ip_provider_owner', this.userId);
|
|
12261
|
+
}
|
|
12262
|
+
}
|
|
12263
|
+
catch (err) {
|
|
12264
|
+
console.error('Unable to restore provider id from local cache', err);
|
|
12265
|
+
}
|
|
12266
|
+
}
|
|
12267
|
+
cacheProviderIdLocally(providerId, providerUserMappingId) {
|
|
12268
|
+
const key = this.providerCacheKey();
|
|
12269
|
+
if (!key || !providerId)
|
|
12270
|
+
return;
|
|
12271
|
+
try {
|
|
12272
|
+
localStorage.setItem(key, JSON.stringify({ providerId, providerUserMappingId: providerUserMappingId ?? null }));
|
|
12273
|
+
}
|
|
12274
|
+
catch (err) {
|
|
12275
|
+
console.error('Unable to cache provider id locally', err);
|
|
12276
|
+
}
|
|
12277
|
+
}
|
|
12213
12278
|
getprovider() {
|
|
12214
12279
|
console.log(sessionStorage.getItem('providerId'));
|
|
12215
12280
|
if (sessionStorage.getItem('providerId')) {
|
|
@@ -12400,27 +12465,13 @@ class RoleSelectComponent {
|
|
|
12400
12465
|
};
|
|
12401
12466
|
}
|
|
12402
12467
|
async saveProvider() {
|
|
12403
|
-
|
|
12468
|
+
if (!sessionStorage.getItem('providerId')) {
|
|
12469
|
+
await this.restoreProviderId();
|
|
12470
|
+
}
|
|
12404
12471
|
const existingProviderId = sessionStorage.getItem('providerId');
|
|
12472
|
+
this.provider = this.bindProviderDetails();
|
|
12405
12473
|
if (existingProviderId) {
|
|
12406
|
-
|
|
12407
|
-
if (!providerUserMappingId) {
|
|
12408
|
-
try {
|
|
12409
|
-
const mappingRes = await firstValueFrom(this.providerdetail.getProviderUserMapping({
|
|
12410
|
-
TargetUserId: this.userId,
|
|
12411
|
-
Page: 1,
|
|
12412
|
-
PageSize: 1,
|
|
12413
|
-
}));
|
|
12414
|
-
const mapping = mappingRes?.data?.[0];
|
|
12415
|
-
if (mapping?.id) {
|
|
12416
|
-
providerUserMappingId = mapping.id;
|
|
12417
|
-
sessionStorage.setItem('providerUserMappingId', providerUserMappingId);
|
|
12418
|
-
}
|
|
12419
|
-
}
|
|
12420
|
-
catch (err) {
|
|
12421
|
-
console.error('Unable to look up existing provider mapping from server', err);
|
|
12422
|
-
}
|
|
12423
|
-
}
|
|
12474
|
+
const providerUserMappingId = sessionStorage.getItem('providerUserMappingId');
|
|
12424
12475
|
const updatePayload = { ...this.provider, providerId: existingProviderId, providerUserMappingId: providerUserMappingId };
|
|
12425
12476
|
const data = await firstValueFrom(this.providerService.updateInitialSetUpProvider(updatePayload));
|
|
12426
12477
|
if (data?.failed) {
|
|
@@ -12429,6 +12480,7 @@ class RoleSelectComponent {
|
|
|
12429
12480
|
this.userError = message;
|
|
12430
12481
|
throw new Error(message || 'Provider update failed');
|
|
12431
12482
|
}
|
|
12483
|
+
this.cacheProviderIdLocally(existingProviderId, providerUserMappingId);
|
|
12432
12484
|
return existingProviderId;
|
|
12433
12485
|
}
|
|
12434
12486
|
const data = await firstValueFrom(this.providerService.adminCreateProvider(this.provider));
|
|
@@ -12443,11 +12495,11 @@ class RoleSelectComponent {
|
|
|
12443
12495
|
sessionStorage.setItem('providerId', providerId);
|
|
12444
12496
|
sessionStorage.setItem('providerUserMappingId', data?.value[1]);
|
|
12445
12497
|
sessionStorage.setItem('ip_provider_owner', this.userId);
|
|
12498
|
+
this.cacheProviderIdLocally(providerId, data?.value[1]);
|
|
12446
12499
|
this.providerId = providerId;
|
|
12447
12500
|
}
|
|
12448
12501
|
return providerId;
|
|
12449
12502
|
}
|
|
12450
|
-
/** address1 itself is owned by im-address-verify-field; patch the sibling fields it resolved. */
|
|
12451
12503
|
onCompanyAddressResolved(address) {
|
|
12452
12504
|
this.companyForm.patchValue({
|
|
12453
12505
|
city: address.city,
|
|
@@ -12459,7 +12511,6 @@ class RoleSelectComponent {
|
|
|
12459
12511
|
longitude: address.longitude,
|
|
12460
12512
|
});
|
|
12461
12513
|
}
|
|
12462
|
-
/** Hand-typed edits invalidate the previously resolved coordinates so a stale lat/lng isn't saved. */
|
|
12463
12514
|
onCompanyAddressManualEdit() {
|
|
12464
12515
|
this.companyForm.patchValue({ latitude: null, longitude: null });
|
|
12465
12516
|
}
|
|
@@ -12849,7 +12900,6 @@ class RoleSelectComponent {
|
|
|
12849
12900
|
this.userForm.patchValue({ phoneNumber: formatted }, { emitEvent: false });
|
|
12850
12901
|
}
|
|
12851
12902
|
}
|
|
12852
|
-
/** address1 itself is owned by im-address-verify-field; patch the sibling fields it resolved. */
|
|
12853
12903
|
onUserAddressResolved(address) {
|
|
12854
12904
|
this.userForm.patchValue({
|
|
12855
12905
|
address2: address.address2,
|
|
@@ -12862,7 +12912,6 @@ class RoleSelectComponent {
|
|
|
12862
12912
|
longitude: address.longitude,
|
|
12863
12913
|
});
|
|
12864
12914
|
}
|
|
12865
|
-
/** Hand-typed edits invalidate the previously resolved coordinates so a stale lat/lng isn't saved. */
|
|
12866
12915
|
onUserAddressManualEdit() {
|
|
12867
12916
|
this.userForm.patchValue({ latitude: null, longitude: null });
|
|
12868
12917
|
}
|