@idsoftsource/initial-process 3.6.7 → 3.6.9

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.
@@ -2649,8 +2649,8 @@ class UserSkillSetService {
2649
2649
  // --------------------------------
2650
2650
  // Update User Skill Set
2651
2651
  // --------------------------------
2652
- updateUserSkillSet(model) {
2653
- return this.httpClient.put(`${this.baseUrl}/UpdateUserSkillSet`, model);
2652
+ updateUserSkillSet(models) {
2653
+ return this.httpClient.put(`${this.baseUrl}/UpdateUserSkillSet`, models);
2654
2654
  }
2655
2655
  // --------------------------------
2656
2656
  // Bulk Delete User Skill Set
@@ -2659,14 +2659,6 @@ class UserSkillSetService {
2659
2659
  return this.httpClient.post(`FrontEndUser/UserSkillSetBulkDelete`, ids);
2660
2660
  }
2661
2661
  // --------------------------------
2662
- // Delete User Skill Set
2663
- // --------------------------------
2664
- deleteUserSkillSet(ids) {
2665
- return this.httpClient.delete(`${this.baseUrl}/DeleteUserSkillSet`, {
2666
- body: ids,
2667
- });
2668
- }
2669
- // --------------------------------
2670
2662
  // Get User Skill Set (Gridify)
2671
2663
  // --------------------------------
2672
2664
  getUserSkillSet(query) {
@@ -2776,8 +2768,8 @@ class UserToolService {
2776
2768
  /* ==============================
2777
2769
  UPDATE USER TOOL
2778
2770
  ============================== */
2779
- updateUserTool(model) {
2780
- return this.httpClient.put(`${this.baseUrl}/UpdateNewUserTool`, model);
2771
+ updateUserTool(models) {
2772
+ return this.httpClient.put(`${this.baseUrl}/UpdateNewUserTool`, models);
2781
2773
  }
2782
2774
  /* ==============================
2783
2775
  BULK DELETE USER TOOL
@@ -2924,10 +2916,12 @@ class UserDocumentService {
2924
2916
  });
2925
2917
  }
2926
2918
  /* ==============================
2927
- BULK DELETE USER DOCUMENT
2919
+ DELETE USER DOCUMENT
2928
2920
  ============================== */
2929
- bulkDelete(ids) {
2930
- return this.httpClient.post(`FrontEndUser/UserDocumentBulkDelete`, ids);
2921
+ deleteUserDocument(ids) {
2922
+ return this.httpClient.delete(`${this.baseUrl}/DeleteNewUserDocument`, {
2923
+ body: ids,
2924
+ });
2931
2925
  }
2932
2926
  buildParams(query) {
2933
2927
  let params = new HttpParams();
@@ -3310,10 +3304,6 @@ class PreviewComponent {
3310
3304
  sessionStorage.removeItem('providerId');
3311
3305
  sessionStorage.removeItem('providerUserMappingId');
3312
3306
  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
3307
  const current = this.store.profileSignal();
3318
3308
  if (current?.companyDetails) {
3319
3309
  this.commitProfile({ ...current, companyDetails: undefined });
@@ -4479,6 +4469,8 @@ class PreviewComponent {
4479
4469
  issueDate: item?.issueDate ? this.toMonthInput(item.issueDate) : null,
4480
4470
  expiryDate: item?.expiryDate ? this.toMonthInput(item.expiryDate) : null,
4481
4471
  credentialId: item?.number ? String(item.number) : null,
4472
+ professionId: item?.userProfessionId ?? null,
4473
+ professionName: item?.professionName ?? '',
4482
4474
  fileId: item?.fileId ?? null,
4483
4475
  fileUrl: item?.fileUrl ?? null,
4484
4476
  fileName: item?.fileName ?? null,
@@ -4868,6 +4860,8 @@ class PreviewComponent {
4868
4860
  this.skillServerIds[index] = id;
4869
4861
  nextSkillMeta[index] = {
4870
4862
  providerName: item?.providerName ?? undefined,
4863
+ professionId: item?.professionId ?? null,
4864
+ professionName: item?.professionName ?? '',
4871
4865
  starRating: item?.starRating ?? null,
4872
4866
  year: item?.year ?? null,
4873
4867
  profileVisibility: !!item?.profileVisibility,
@@ -4898,6 +4892,8 @@ class PreviewComponent {
4898
4892
  this.toolServerIds[index] = id;
4899
4893
  nextToolMeta[index] = {
4900
4894
  providerName: item?.providerName ?? undefined,
4895
+ professionId: item?.professionId ?? null,
4896
+ professionName: item?.professionName ?? '',
4901
4897
  starRating: item?.starRating ?? null,
4902
4898
  year: item?.year ?? null,
4903
4899
  profileVisibility: !!item?.profileVisibility,
@@ -5339,7 +5335,7 @@ class PreviewComponent {
5339
5335
  try {
5340
5336
  const serverId = this.skillServerIds[index];
5341
5337
  if (serverId) {
5342
- await firstValueFrom(this.userSkillSetService.deleteUserSkillSet([serverId]));
5338
+ await firstValueFrom(this.userSkillSetService.bulkDelete([serverId]));
5343
5339
  }
5344
5340
  }
5345
5341
  finally {
@@ -5945,9 +5941,12 @@ class PreviewComponent {
5945
5941
  return;
5946
5942
  this.deletingCertificationIndex.set(index);
5947
5943
  try {
5944
+ if (!this.certificationServerIds[index]) {
5945
+ await this.ensureCertificationServerId(index, current.certifications[index]);
5946
+ }
5948
5947
  const serverId = this.certificationServerIds[index];
5949
5948
  if (serverId) {
5950
- await firstValueFrom(this.userDocumentService.bulkDelete([serverId]));
5949
+ await firstValueFrom(this.userDocumentService.deleteUserDocument([serverId]));
5951
5950
  }
5952
5951
  }
5953
5952
  finally {
@@ -6116,9 +6115,12 @@ class PreviewComponent {
6116
6115
  return;
6117
6116
  this.deletingLicenseIndex.set(index);
6118
6117
  try {
6118
+ if (!this.licenseServerIds[index]) {
6119
+ await this.ensureLicenseServerId(index, current.licenses[index]);
6120
+ }
6119
6121
  const serverId = this.licenseServerIds[index];
6120
6122
  if (serverId) {
6121
- await firstValueFrom(this.userDocumentService.bulkDelete([serverId]));
6123
+ await firstValueFrom(this.userDocumentService.deleteUserDocument([serverId]));
6122
6124
  }
6123
6125
  }
6124
6126
  finally {
@@ -6574,7 +6576,7 @@ class PreviewComponent {
6574
6576
  payload.id = this.skillServerIds[index];
6575
6577
  try {
6576
6578
  const res = (isEdit && hasServerId)
6577
- ? await firstValueFrom(this.userSkillSetService.updateUserSkillSet(payload))
6579
+ ? await firstValueFrom(this.userSkillSetService.updateUserSkillSet([payload]))
6578
6580
  : await firstValueFrom(this.userSkillSetService.createUserSkillSet([payload]));
6579
6581
  const createdId = this.getCreatedId(res);
6580
6582
  this.markItemSaved(this.skillServerIds, this.skillLocallySaved, index, createdId);
@@ -6680,7 +6682,7 @@ class PreviewComponent {
6680
6682
  payload.id = this.toolServerIds[index];
6681
6683
  try {
6682
6684
  const res = (isEdit && hasServerId)
6683
- ? await firstValueFrom(this.userToolService.updateUserTool(payload))
6685
+ ? await firstValueFrom(this.userToolService.updateUserTool([payload]))
6684
6686
  : await firstValueFrom(this.userToolService.createUserTool([payload]));
6685
6687
  const createdId = this.getCreatedId(res);
6686
6688
  this.markItemSaved(this.toolServerIds, this.toolLocallySaved, index, createdId);
@@ -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)
@@ -9323,7 +9316,7 @@ class CertificationComponent {
9323
9316
  if (!confirm('Delete this certification?'))
9324
9317
  return;
9325
9318
  this.deletingIndex.set(index);
9326
- this.userDocumentService.bulkDelete([exp.id]).subscribe({
9319
+ this.userDocumentService.deleteUserDocument([exp.id]).subscribe({
9327
9320
  next: () => {
9328
9321
  this.workStore.loadFromApi(this.userId);
9329
9322
  this.certificateForm.reset();
@@ -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 userProfessionId;
10255
- // professionId comes back as an unused empty-GUID placeholder on this endpoint.
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
@@ -10305,7 +10297,7 @@ class SkillsComponent {
10305
10297
  if (!confirm('Delete this skill?'))
10306
10298
  return;
10307
10299
  this.deletingSkillKey.set(this.getSkillKey(skill));
10308
- this.userSkillSetService.deleteUserSkillSet([skill.id]).subscribe({
10300
+ this.userSkillSetService.bulkDelete([skill.id]).subscribe({
10309
10301
  next: () => {
10310
10302
  this.getuserSkillsData();
10311
10303
  this.deletingSkillKey.set(null);
@@ -10524,7 +10516,7 @@ class SkillsComponent {
10524
10516
  };
10525
10517
  delete payload.professionName;
10526
10518
  delete payload.forUser;
10527
- this.userSkillSetService.updateUserSkillSet(payload).subscribe((response) => {
10519
+ this.userSkillSetService.updateUserSkillSet([payload]).subscribe((response) => {
10528
10520
  this.showLoader = false;
10529
10521
  this.userSkillSubmitted = false;
10530
10522
  if (!response.failed) {
@@ -10843,7 +10835,7 @@ class LicensesComponent {
10843
10835
  if (!confirm('Delete this license?'))
10844
10836
  return;
10845
10837
  this.deletingIndex.set(index);
10846
- this.userDocumentService.bulkDelete([exp.id]).subscribe({
10838
+ this.userDocumentService.deleteUserDocument([exp.id]).subscribe({
10847
10839
  next: () => {
10848
10840
  this.workStore.loadFromApi(this.userId);
10849
10841
  this.certificateForm.reset();
@@ -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 userProfessionId;
11454
- // professionId comes back as an unused empty-GUID placeholder on this endpoint.
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)
@@ -11833,7 +11824,7 @@ class ToolsComponent {
11833
11824
  };
11834
11825
  delete updatedTool.professionName;
11835
11826
  delete updatedTool.forUser;
11836
- this.userToolService.updateUserTool(updatedTool).subscribe((response) => {
11827
+ this.userToolService.updateUserTool([updatedTool]).subscribe((response) => {
11837
11828
  this.showLoader = false;
11838
11829
  this.userToolSubmitted = false;
11839
11830
  if (!response.failed) {
@@ -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
- this.provider = this.bindProviderDetails();
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
- let providerUserMappingId = sessionStorage.getItem('providerUserMappingId');
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
  }