@idsoftsource/initial-process 3.6.7 → 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 });
|
|
@@ -4479,6 +4475,8 @@ class PreviewComponent {
|
|
|
4479
4475
|
issueDate: item?.issueDate ? this.toMonthInput(item.issueDate) : null,
|
|
4480
4476
|
expiryDate: item?.expiryDate ? this.toMonthInput(item.expiryDate) : null,
|
|
4481
4477
|
credentialId: item?.number ? String(item.number) : null,
|
|
4478
|
+
professionId: item?.userProfessionId ?? null,
|
|
4479
|
+
professionName: item?.professionName ?? '',
|
|
4482
4480
|
fileId: item?.fileId ?? null,
|
|
4483
4481
|
fileUrl: item?.fileUrl ?? null,
|
|
4484
4482
|
fileName: item?.fileName ?? null,
|
|
@@ -4868,6 +4866,8 @@ class PreviewComponent {
|
|
|
4868
4866
|
this.skillServerIds[index] = id;
|
|
4869
4867
|
nextSkillMeta[index] = {
|
|
4870
4868
|
providerName: item?.providerName ?? undefined,
|
|
4869
|
+
professionId: item?.professionId ?? null,
|
|
4870
|
+
professionName: item?.professionName ?? '',
|
|
4871
4871
|
starRating: item?.starRating ?? null,
|
|
4872
4872
|
year: item?.year ?? null,
|
|
4873
4873
|
profileVisibility: !!item?.profileVisibility,
|
|
@@ -4898,6 +4898,8 @@ class PreviewComponent {
|
|
|
4898
4898
|
this.toolServerIds[index] = id;
|
|
4899
4899
|
nextToolMeta[index] = {
|
|
4900
4900
|
providerName: item?.providerName ?? undefined,
|
|
4901
|
+
professionId: item?.professionId ?? null,
|
|
4902
|
+
professionName: item?.professionName ?? '',
|
|
4901
4903
|
starRating: item?.starRating ?? null,
|
|
4902
4904
|
year: item?.year ?? null,
|
|
4903
4905
|
profileVisibility: !!item?.profileVisibility,
|
|
@@ -7476,19 +7478,12 @@ class PreviewComponent {
|
|
|
7476
7478
|
}
|
|
7477
7479
|
return false;
|
|
7478
7480
|
}
|
|
7479
|
-
// Combines the two sources: try the backend first (works across any device/browser),
|
|
7480
|
-
// then fall back to the local per-device cache if that fails or comes back empty.
|
|
7481
7481
|
async restoreProviderId() {
|
|
7482
7482
|
const restoredFromServer = await this.restoreProviderMappingFromServer();
|
|
7483
7483
|
if (!restoredFromServer) {
|
|
7484
7484
|
this.restoreProviderIdFromLocalCache();
|
|
7485
7485
|
}
|
|
7486
7486
|
}
|
|
7487
|
-
// Restores providerId/providerUserMappingId into sessionStorage from the local,
|
|
7488
|
-
// per-user cache when they're missing (e.g. sessionStorage was cleared, or the
|
|
7489
|
-
// server lookup didn't find anything) but this user already created a provider
|
|
7490
|
-
// earlier on this same device. Prevents saveProvider() from mistakenly creating a
|
|
7491
|
-
// duplicate provider for a returning user.
|
|
7492
7487
|
restoreProviderIdFromLocalCache() {
|
|
7493
7488
|
const key = this.providerCacheKey();
|
|
7494
7489
|
if (!key)
|
|
@@ -7509,8 +7504,6 @@ class PreviewComponent {
|
|
|
7509
7504
|
console.error('Unable to restore provider id from local cache', err);
|
|
7510
7505
|
}
|
|
7511
7506
|
}
|
|
7512
|
-
// Persists the current provider id/mapping so a future session on this device
|
|
7513
|
-
// (even after sessionStorage is cleared) can find it again instead of recreating it.
|
|
7514
7507
|
cacheProviderIdLocally(providerId, providerUserMappingId) {
|
|
7515
7508
|
const key = this.providerCacheKey();
|
|
7516
7509
|
if (!key || !providerId)
|
|
@@ -10251,9 +10244,8 @@ class SkillsComponent {
|
|
|
10251
10244
|
this.isEditMode = true;
|
|
10252
10245
|
this.model = { ...skill };
|
|
10253
10246
|
const group = this.createGroup(skill.skillSetId, skill.skillSetName);
|
|
10254
|
-
// GetUserSkillSet returns the real saved-profession link under
|
|
10255
|
-
|
|
10256
|
-
const linkedProfessionId = skill.userProfessionId ?? null;
|
|
10247
|
+
// GetUserSkillSet returns the real saved-profession link under professionId.
|
|
10248
|
+
const linkedProfessionId = skill.professionId ?? skill.userProfessionId ?? null;
|
|
10257
10249
|
const linkedProfessionName = skill.professionName ?? '';
|
|
10258
10250
|
// ng-select can only display a label for a value that exists in [items]. If this
|
|
10259
10251
|
// skill's saved profession isn't in the currently loaded userProfessionOptions
|
|
@@ -11450,9 +11442,8 @@ class ToolsComponent {
|
|
|
11450
11442
|
serialNumber: tool.serialNumber,
|
|
11451
11443
|
notes: tool.notes,
|
|
11452
11444
|
profileVisibility: tool.profileVisibility,
|
|
11453
|
-
// GetUserTool returns the real saved-profession link under
|
|
11454
|
-
|
|
11455
|
-
professionId: tool.userProfessionId ?? null,
|
|
11445
|
+
// GetUserTool returns the real saved-profession link under professionId.
|
|
11446
|
+
professionId: tool.professionId ?? tool.userProfessionId ?? null,
|
|
11456
11447
|
professionName: tool.professionName ?? '',
|
|
11457
11448
|
});
|
|
11458
11449
|
if (!this.tab)
|
|
@@ -12206,9 +12197,84 @@ class RoleSelectComponent {
|
|
|
12206
12197
|
sessionStorage.removeItem('ip_provider_owner');
|
|
12207
12198
|
}
|
|
12208
12199
|
if (this.roleData.role.name == 'Provider') {
|
|
12200
|
+
if (!sessionStorage.getItem('providerId')) {
|
|
12201
|
+
await this.restoreProviderId();
|
|
12202
|
+
}
|
|
12209
12203
|
this.getprovider();
|
|
12210
12204
|
}
|
|
12211
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
|
+
}
|
|
12212
12278
|
getprovider() {
|
|
12213
12279
|
console.log(sessionStorage.getItem('providerId'));
|
|
12214
12280
|
if (sessionStorage.getItem('providerId')) {
|
|
@@ -12399,27 +12465,13 @@ class RoleSelectComponent {
|
|
|
12399
12465
|
};
|
|
12400
12466
|
}
|
|
12401
12467
|
async saveProvider() {
|
|
12402
|
-
|
|
12468
|
+
if (!sessionStorage.getItem('providerId')) {
|
|
12469
|
+
await this.restoreProviderId();
|
|
12470
|
+
}
|
|
12403
12471
|
const existingProviderId = sessionStorage.getItem('providerId');
|
|
12472
|
+
this.provider = this.bindProviderDetails();
|
|
12404
12473
|
if (existingProviderId) {
|
|
12405
|
-
|
|
12406
|
-
if (!providerUserMappingId) {
|
|
12407
|
-
try {
|
|
12408
|
-
const mappingRes = await firstValueFrom(this.providerdetail.getProviderUserMapping({
|
|
12409
|
-
TargetUserId: this.userId,
|
|
12410
|
-
Page: 1,
|
|
12411
|
-
PageSize: 1,
|
|
12412
|
-
}));
|
|
12413
|
-
const mapping = mappingRes?.data?.[0];
|
|
12414
|
-
if (mapping?.id) {
|
|
12415
|
-
providerUserMappingId = mapping.id;
|
|
12416
|
-
sessionStorage.setItem('providerUserMappingId', providerUserMappingId);
|
|
12417
|
-
}
|
|
12418
|
-
}
|
|
12419
|
-
catch (err) {
|
|
12420
|
-
console.error('Unable to look up existing provider mapping from server', err);
|
|
12421
|
-
}
|
|
12422
|
-
}
|
|
12474
|
+
const providerUserMappingId = sessionStorage.getItem('providerUserMappingId');
|
|
12423
12475
|
const updatePayload = { ...this.provider, providerId: existingProviderId, providerUserMappingId: providerUserMappingId };
|
|
12424
12476
|
const data = await firstValueFrom(this.providerService.updateInitialSetUpProvider(updatePayload));
|
|
12425
12477
|
if (data?.failed) {
|
|
@@ -12428,6 +12480,7 @@ class RoleSelectComponent {
|
|
|
12428
12480
|
this.userError = message;
|
|
12429
12481
|
throw new Error(message || 'Provider update failed');
|
|
12430
12482
|
}
|
|
12483
|
+
this.cacheProviderIdLocally(existingProviderId, providerUserMappingId);
|
|
12431
12484
|
return existingProviderId;
|
|
12432
12485
|
}
|
|
12433
12486
|
const data = await firstValueFrom(this.providerService.adminCreateProvider(this.provider));
|
|
@@ -12442,11 +12495,11 @@ class RoleSelectComponent {
|
|
|
12442
12495
|
sessionStorage.setItem('providerId', providerId);
|
|
12443
12496
|
sessionStorage.setItem('providerUserMappingId', data?.value[1]);
|
|
12444
12497
|
sessionStorage.setItem('ip_provider_owner', this.userId);
|
|
12498
|
+
this.cacheProviderIdLocally(providerId, data?.value[1]);
|
|
12445
12499
|
this.providerId = providerId;
|
|
12446
12500
|
}
|
|
12447
12501
|
return providerId;
|
|
12448
12502
|
}
|
|
12449
|
-
/** address1 itself is owned by im-address-verify-field; patch the sibling fields it resolved. */
|
|
12450
12503
|
onCompanyAddressResolved(address) {
|
|
12451
12504
|
this.companyForm.patchValue({
|
|
12452
12505
|
city: address.city,
|
|
@@ -12458,7 +12511,6 @@ class RoleSelectComponent {
|
|
|
12458
12511
|
longitude: address.longitude,
|
|
12459
12512
|
});
|
|
12460
12513
|
}
|
|
12461
|
-
/** Hand-typed edits invalidate the previously resolved coordinates so a stale lat/lng isn't saved. */
|
|
12462
12514
|
onCompanyAddressManualEdit() {
|
|
12463
12515
|
this.companyForm.patchValue({ latitude: null, longitude: null });
|
|
12464
12516
|
}
|
|
@@ -12848,7 +12900,6 @@ class RoleSelectComponent {
|
|
|
12848
12900
|
this.userForm.patchValue({ phoneNumber: formatted }, { emitEvent: false });
|
|
12849
12901
|
}
|
|
12850
12902
|
}
|
|
12851
|
-
/** address1 itself is owned by im-address-verify-field; patch the sibling fields it resolved. */
|
|
12852
12903
|
onUserAddressResolved(address) {
|
|
12853
12904
|
this.userForm.patchValue({
|
|
12854
12905
|
address2: address.address2,
|
|
@@ -12861,7 +12912,6 @@ class RoleSelectComponent {
|
|
|
12861
12912
|
longitude: address.longitude,
|
|
12862
12913
|
});
|
|
12863
12914
|
}
|
|
12864
|
-
/** Hand-typed edits invalidate the previously resolved coordinates so a stale lat/lng isn't saved. */
|
|
12865
12915
|
onUserAddressManualEdit() {
|
|
12866
12916
|
this.userForm.patchValue({ latitude: null, longitude: null });
|
|
12867
12917
|
}
|