@eric-emg/symphiq-components 1.2.389 → 1.2.391

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.
@@ -88127,16 +88127,38 @@ class ShopProfileViewToggleComponent {
88127
88127
  class ProfileAnswerAnimationService {
88128
88128
  constructor() {
88129
88129
  this.previousAnswerIds = signal(new Set(), ...(ngDevMode ? [{ debugName: "previousAnswerIds" }] : []));
88130
+ this.previousAnswersMap = signal(new Map(), ...(ngDevMode ? [{ debugName: "previousAnswersMap" }] : []));
88130
88131
  this.animationState = signal({
88131
88132
  newAnswerIds: new Set(),
88132
88133
  removedAnswerIds: new Set()
88133
88134
  }, ...(ngDevMode ? [{ debugName: "animationState" }] : []));
88135
+ this.removedAnswers = computed(() => {
88136
+ const removedIds = this.animationState().removedAnswerIds;
88137
+ const map = this.previousAnswersMap();
88138
+ const removed = [];
88139
+ removedIds.forEach(id => {
88140
+ const answer = map.get(id);
88141
+ if (answer) {
88142
+ removed.push(answer);
88143
+ }
88144
+ });
88145
+ return removed;
88146
+ }, ...(ngDevMode ? [{ debugName: "removedAnswers" }] : []));
88134
88147
  }
88135
88148
  getAnimationState() {
88136
88149
  return this.animationState.asReadonly();
88137
88150
  }
88138
- snapshotCurrentAnswers(answerIds) {
88139
- this.previousAnswerIds.set(new Set(answerIds));
88151
+ snapshotCurrentAnswers(answers) {
88152
+ const ids = new Set();
88153
+ const map = new Map();
88154
+ answers.forEach(a => {
88155
+ if (a.id !== undefined) {
88156
+ ids.add(a.id);
88157
+ map.set(a.id, a);
88158
+ }
88159
+ });
88160
+ this.previousAnswerIds.set(ids);
88161
+ this.previousAnswersMap.set(map);
88140
88162
  }
88141
88163
  computeAnimationState(currentAnswerIds) {
88142
88164
  const previous = this.previousAnswerIds();
@@ -88165,6 +88187,9 @@ class ProfileAnswerAnimationService {
88165
88187
  isNewAnswer(answerId) {
88166
88188
  return this.animationState().newAnswerIds.has(answerId);
88167
88189
  }
88190
+ isRemovedAnswer(answerId) {
88191
+ return this.animationState().removedAnswerIds.has(answerId);
88192
+ }
88168
88193
  clearAnimationState() {
88169
88194
  this.animationState.set({
88170
88195
  newAnswerIds: new Set(),
@@ -88178,6 +88203,13 @@ class ProfileAnswerAnimationService {
88178
88203
  return { ...state, newAnswerIds: newIds };
88179
88204
  });
88180
88205
  }
88206
+ clearRemovedAnswer(answerId) {
88207
+ this.animationState.update(state => {
88208
+ const removedIds = new Set(state.removedAnswerIds);
88209
+ removedIds.delete(answerId);
88210
+ return { ...state, removedAnswerIds: removedIds };
88211
+ });
88212
+ }
88181
88213
  static { this.ɵfac = function ProfileAnswerAnimationService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ProfileAnswerAnimationService)(); }; }
88182
88214
  static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ProfileAnswerAnimationService, factory: ProfileAnswerAnimationService.ɵfac, providedIn: 'root' }); }
88183
88215
  }
@@ -88251,7 +88283,7 @@ function ShopProfileQuestionCardComponent_Conditional_8_For_2_Template(rf, ctx)
88251
88283
  } if (rf & 2) {
88252
88284
  const answerData_r4 = ctx.$implicit;
88253
88285
  const ctx_r0 = i0.ɵɵnextContext(2);
88254
- i0.ɵɵclassProp("animate-answer-pop-in", ctx_r0.isNewAnswer(answerData_r4.answer.id));
88286
+ i0.ɵɵclassProp("animate-answer-pop-in", ctx_r0.isNewAnswer(answerData_r4.answer.id))("animate-answer-fade-out", ctx_r0.isRemovedAnswer(answerData_r4.answer.id));
88255
88287
  i0.ɵɵproperty("ngClass", ctx_r0.answerChipClasses());
88256
88288
  i0.ɵɵadvance();
88257
88289
  i0.ɵɵproperty("ngClass", ctx_r0.answerTextClasses());
@@ -88266,12 +88298,12 @@ function ShopProfileQuestionCardComponent_Conditional_8_For_2_Template(rf, ctx)
88266
88298
  } }
88267
88299
  function ShopProfileQuestionCardComponent_Conditional_8_Template(rf, ctx) { if (rf & 1) {
88268
88300
  i0.ɵɵelementStart(0, "div", 7);
88269
- i0.ɵɵrepeaterCreate(1, ShopProfileQuestionCardComponent_Conditional_8_For_2_Template, 6, 9, null, null, _forTrack0$3);
88301
+ i0.ɵɵrepeaterCreate(1, ShopProfileQuestionCardComponent_Conditional_8_For_2_Template, 6, 11, null, null, _forTrack0$3);
88270
88302
  i0.ɵɵelementEnd();
88271
88303
  } if (rf & 2) {
88272
88304
  const ctx_r0 = i0.ɵɵnextContext();
88273
88305
  i0.ɵɵadvance();
88274
- i0.ɵɵrepeater(ctx_r0.questionAnswers());
88306
+ i0.ɵɵrepeater(ctx_r0.displayAnswers());
88275
88307
  } }
88276
88308
  function ShopProfileQuestionCardComponent_Conditional_9_Template(rf, ctx) { if (rf & 1) {
88277
88309
  i0.ɵɵelementStart(0, "div", 8)(1, "div", 22)(2, "div", 23);
@@ -88324,6 +88356,20 @@ class ShopProfileQuestionCardComponent {
88324
88356
  user: allUsers.find(u => u.id === answer.creatorUserId)
88325
88357
  }));
88326
88358
  }, ...(ngDevMode ? [{ debugName: "questionAnswers" }] : []));
88359
+ this.displayAnswers = computed(() => {
88360
+ const questionId = this.question().id;
88361
+ const current = this.questionAnswers();
88362
+ const allUsers = this.users();
88363
+ const removedAnswers = this.animationService.removedAnswers()
88364
+ .filter(a => a.profileQuestionId === questionId)
88365
+ .map(answer => ({
88366
+ answer,
88367
+ user: allUsers.find(u => u.id === answer.creatorUserId)
88368
+ }));
88369
+ const currentIds = new Set(current.map(c => c.answer.id));
88370
+ const uniqueRemoved = removedAnswers.filter(r => !currentIds.has(r.answer.id));
88371
+ return [...current, ...uniqueRemoved];
88372
+ }, ...(ngDevMode ? [{ debugName: "displayAnswers" }] : []));
88327
88373
  this.isAnswered = computed(() => {
88328
88374
  return this.questionAnswers().length > 0;
88329
88375
  }, ...(ngDevMode ? [{ debugName: "isAnswered" }] : []));
@@ -88340,9 +88386,19 @@ class ShopProfileQuestionCardComponent {
88340
88386
  return false;
88341
88387
  return this.animationService.isNewAnswer(answerId);
88342
88388
  }
88389
+ isRemovedAnswer(answerId) {
88390
+ if (answerId === undefined)
88391
+ return false;
88392
+ return this.animationService.isRemovedAnswer(answerId);
88393
+ }
88343
88394
  onAnimationEnd(answerId) {
88344
88395
  if (answerId !== undefined) {
88345
- this.animationService.clearNewAnswer(answerId);
88396
+ if (this.animationService.isNewAnswer(answerId)) {
88397
+ this.animationService.clearNewAnswer(answerId);
88398
+ }
88399
+ if (this.animationService.isRemovedAnswer(answerId)) {
88400
+ this.animationService.clearRemovedAnswer(answerId);
88401
+ }
88346
88402
  }
88347
88403
  }
88348
88404
  getFocusAreaTitle(focusArea) {
@@ -88478,12 +88534,12 @@ class ShopProfileQuestionCardComponent {
88478
88534
  i0.ɵɵadvance();
88479
88535
  i0.ɵɵconditional(ctx.showFocusAreaChips() && ctx.relatedFocusAreas().length > 0 ? 7 : -1);
88480
88536
  i0.ɵɵadvance();
88481
- i0.ɵɵconditional(ctx.questionAnswers().length > 0 ? 8 : 9);
88537
+ i0.ɵɵconditional(ctx.displayAnswers().length > 0 ? 8 : 9);
88482
88538
  i0.ɵɵadvance(3);
88483
88539
  i0.ɵɵproperty("ngClass", ctx.buttonClasses());
88484
88540
  i0.ɵɵadvance(2);
88485
88541
  i0.ɵɵtextInterpolate(ctx.isAnswered() ? "Edit Answer" : "Answer");
88486
- } }, dependencies: [CommonModule, i1$1.NgClass, UserAvatarComponent], styles: ["@keyframes _ngcontent-%COMP%_answerPopIn{0%{opacity:0;transform:scale(.8);box-shadow:0 0 #3b82f600}50%{opacity:1;transform:scale(1.05);box-shadow:0 0 20px 4px #3b82f680}to{opacity:1;transform:scale(1);box-shadow:0 0 #3b82f600}}.animate-answer-pop-in[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_answerPopIn .5s ease-out forwards}"], changeDetection: 0 }); }
88542
+ } }, dependencies: [CommonModule, i1$1.NgClass, UserAvatarComponent], styles: ["@keyframes _ngcontent-%COMP%_answerPopIn{0%{opacity:0;transform:scale(.8);box-shadow:0 0 #3b82f600}50%{opacity:1;transform:scale(1.05);box-shadow:0 0 20px 4px #3b82f680}to{opacity:1;transform:scale(1);box-shadow:0 0 #3b82f600}}.animate-answer-pop-in[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_answerPopIn .5s ease-out forwards}@keyframes _ngcontent-%COMP%_answerFadeOut{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}.animate-answer-fade-out[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_answerFadeOut .4s ease-out forwards}"], changeDetection: 0 }); }
88487
88543
  }
88488
88544
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ShopProfileQuestionCardComponent, [{
88489
88545
  type: Component,
@@ -88531,13 +88587,14 @@ class ShopProfileQuestionCardComponent {
88531
88587
  }
88532
88588
 
88533
88589
  <!-- Answer Section -->
88534
- @if (questionAnswers().length > 0) {
88590
+ @if (displayAnswers().length > 0) {
88535
88591
  <!-- Answered State - Show answer chips -->
88536
88592
  <div class="flex flex-wrap gap-3">
88537
- @for (answerData of questionAnswers(); track answerData.answer.id) {
88593
+ @for (answerData of displayAnswers(); track answerData.answer.id) {
88538
88594
  <div
88539
88595
  [ngClass]="answerChipClasses()"
88540
88596
  [class.animate-answer-pop-in]="isNewAnswer(answerData.answer.id)"
88597
+ [class.animate-answer-fade-out]="isRemovedAnswer(answerData.answer.id)"
88541
88598
  (animationend)="onAnimationEnd(answerData.answer.id)"
88542
88599
  class="flex items-center gap-2 px-4 py-2.5 rounded-full">
88543
88600
  <span [ngClass]="answerTextClasses()" class="text-sm font-medium">
@@ -88591,9 +88648,9 @@ class ShopProfileQuestionCardComponent {
88591
88648
  </button>
88592
88649
  </div>
88593
88650
  </div>
88594
- `, styles: ["@keyframes answerPopIn{0%{opacity:0;transform:scale(.8);box-shadow:0 0 #3b82f600}50%{opacity:1;transform:scale(1.05);box-shadow:0 0 20px 4px #3b82f680}to{opacity:1;transform:scale(1);box-shadow:0 0 #3b82f600}}.animate-answer-pop-in{animation:answerPopIn .5s ease-out forwards}\n"] }]
88651
+ `, styles: ["@keyframes answerPopIn{0%{opacity:0;transform:scale(.8);box-shadow:0 0 #3b82f600}50%{opacity:1;transform:scale(1.05);box-shadow:0 0 20px 4px #3b82f680}to{opacity:1;transform:scale(1);box-shadow:0 0 #3b82f600}}.animate-answer-pop-in{animation:answerPopIn .5s ease-out forwards}@keyframes answerFadeOut{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}.animate-answer-fade-out{animation:answerFadeOut .4s ease-out forwards}\n"] }]
88595
88652
  }], null, { question: [{ type: i0.Input, args: [{ isSignal: true, alias: "question", required: true }] }], viewMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewMode", required: false }] }], viewType: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewType", required: false }] }], profileShopAnswers: [{ type: i0.Input, args: [{ isSignal: true, alias: "profileShopAnswers", required: false }] }], users: [{ type: i0.Input, args: [{ isSignal: true, alias: "users", required: false }] }], answerClick: [{ type: i0.Output, args: ["answerClick"] }] }); })();
88596
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ShopProfileQuestionCardComponent, { className: "ShopProfileQuestionCardComponent", filePath: "lib/components/profile-analysis-dashboard/cards/shop-profile-question-card.component.ts", lineNumber: 147 }); })();
88653
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ShopProfileQuestionCardComponent, { className: "ShopProfileQuestionCardComponent", filePath: "lib/components/profile-analysis-dashboard/cards/shop-profile-question-card.component.ts", lineNumber: 161 }); })();
88597
88654
 
88598
88655
  const _c0$5 = ["scrollContainer"];
88599
88656
  const _c1$2 = ["stickySentinel"];
@@ -89765,7 +89822,7 @@ class ShopProfileQuestionsModalComponent {
89765
89822
  this.questionForAnswer = signal(null, ...(ngDevMode ? [{ debugName: "questionForAnswer" }] : []));
89766
89823
  this.navigationHistory = signal([], ...(ngDevMode ? [{ debugName: "navigationHistory" }] : []));
89767
89824
  this.modalMovedToBody = false;
89768
- this.savePending = signal(false, ...(ngDevMode ? [{ debugName: "savePending" }] : []));
89825
+ this.snapshotAnswerIds = signal(null, ...(ngDevMode ? [{ debugName: "snapshotAnswerIds" }] : []));
89769
89826
  this.viewType = computed(() => {
89770
89827
  if (this.showAllQuestions())
89771
89828
  return 'all';
@@ -89854,14 +89911,19 @@ class ShopProfileQuestionsModalComponent {
89854
89911
  });
89855
89912
  effect(() => {
89856
89913
  const answers = this.profileShopAnswers();
89857
- const pending = this.savePending();
89858
- if (pending && answers.length > 0) {
89859
- const answerIds = answers
89860
- .map(a => a.id)
89861
- .filter((id) => id !== undefined);
89862
- console.log('[Modal] Save completed, computing animation state');
89863
- this.animationService.computeAnimationState(answerIds);
89864
- this.savePending.set(false);
89914
+ const snapshot = this.snapshotAnswerIds();
89915
+ if (snapshot === null)
89916
+ return;
89917
+ const currentIds = new Set(answers.map(a => a.id).filter((id) => id !== undefined));
89918
+ const hasNewIds = [...currentIds].some(id => !snapshot.has(id));
89919
+ const hasRemovedIds = [...snapshot].some(id => !currentIds.has(id));
89920
+ if (hasNewIds || hasRemovedIds) {
89921
+ console.log('[Modal] Answers changed, computing animation state', {
89922
+ snapshot: Array.from(snapshot),
89923
+ current: Array.from(currentIds)
89924
+ });
89925
+ this.animationService.computeAnimationState(Array.from(currentIds));
89926
+ this.snapshotAnswerIds.set(null);
89865
89927
  }
89866
89928
  });
89867
89929
  }
@@ -89911,12 +89973,10 @@ class ShopProfileQuestionsModalComponent {
89911
89973
  }
89912
89974
  snapshotAnswersForAnimation() {
89913
89975
  const answers = this.profileShopAnswers();
89914
- const answerIds = answers
89915
- .map(a => a.id)
89916
- .filter((id) => id !== undefined);
89917
- console.log('[Modal] Snapshotting current answers before save:', answerIds);
89918
- this.animationService.snapshotCurrentAnswers(answerIds);
89919
- this.savePending.set(true);
89976
+ const answerIds = new Set(answers.map(a => a.id).filter((id) => id !== undefined));
89977
+ console.log('[Modal] Snapshotting current answers before save:', Array.from(answerIds));
89978
+ this.snapshotAnswerIds.set(answerIds);
89979
+ this.animationService.snapshotCurrentAnswers(answers);
89920
89980
  }
89921
89981
  onNavigateToList() {
89922
89982
  this.answerModeActive.set(false);