From 5c3698ad8cad97df43277db8aa175bd5df08abaf Mon Sep 17 00:00:00 2001
From: crisnicandrei <62384997+crisnicandrei@users.noreply.github.com>
Date: Tue, 13 Jun 2023 11:29:28 +0300
Subject: [PATCH 01/15] PER-9237 gift-storage-interface
This pr's purpose is the implementation of the gift storage interface.
I have added a new tab to the dropdown for the gift component. I have created a new component which in which the new form lies where the user must input the email, amount and the message. Upon confirmation a new modal pops up for confirmation.
---
.../components/storage-dialog/storage-dialog.component.ts | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/app/core/components/storage-dialog/storage-dialog.component.ts b/src/app/core/components/storage-dialog/storage-dialog.component.ts
index 650092256..8de18edec 100644
--- a/src/app/core/components/storage-dialog/storage-dialog.component.ts
+++ b/src/app/core/components/storage-dialog/storage-dialog.component.ts
@@ -2,12 +2,13 @@
import { ActivatedRoute, ParamMap } from '@angular/router';
import { Component, OnInit } from '@angular/core';
import { IsTabbedDialog, DialogRef } from '@root/app/dialog/dialog.module';
+
+import { PromoVOData, AccountVO } from '@models';
import {
UntypedFormGroup,
UntypedFormBuilder,
Validators,
} from '@angular/forms';
-import { PromoVOData, AccountVO } from '@models';
import { ApiService } from '@shared/services/api/api.service';
import {
BillingResponse,
@@ -79,6 +80,10 @@ export class StorageDialogComponent implements OnInit, IsTabbedDialog {
`Gift code redeemed for ${pipe.transform(bytes)} of storage`,
'success'
);
+ this.message.showMessage(
+ `Gift code redeemed for ${pipe.transform(bytes)} of storage`,
+ 'success'
+ );
this.promoForm.reset();
} catch (err) {
if (err instanceof BillingResponse || err instanceof AccountResponse) {
From 2b44d663e336db7c22f82aba27009e6ccb5f82a5 Mon Sep 17 00:00:00 2001
From: crisnicandrei <62384997+crisnicandrei@users.noreply.github.com>
Date: Thu, 19 Oct 2023 12:43:11 +0300
Subject: [PATCH 02/15] PER-9373 enter multiple emails.
Changed the ui
---
.../gift-storage/gift-storage.component.html | 9 ++++++---
.../gift-storage/gift-storage.component.scss | 11 ++++++++++-
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/app/core/components/gift-storage/gift-storage.component.html b/src/app/core/components/gift-storage/gift-storage.component.html
index def84b274..97e2b23a4 100644
--- a/src/app/core/components/gift-storage/gift-storage.component.html
+++ b/src/app/core/components/gift-storage/gift-storage.component.html
@@ -15,7 +15,10 @@
>
-
+
+ Separate multiple email addresses with commas
- gigabytes
+ gigabytes per recipient
Storage can only be gifted in 1GB increments.
@@ -56,7 +59,7 @@
- Optional
+ Optional; sent to all recipients
-
- The email you have entered is not valid.
-
+
+
+ {{ invalidEmail }} is not a valid email address.
+
@@ -56,10 +59,19 @@
Amount must be less than or equal to {{ availableSpace }} GB.
{{ this.availableSpace }} GB available
@@ -124,9 +134,13 @@
Storage successfully gifted
- Success! You sent {{ giftForm.value.amount }} GB of Permanent storage to
- {{ giftForm.value.email }}.
+ Success! You sent {{ giftForm.value.amount }} GB of Permanent storage to:
Success! You sent {{ giftForm.value.amount }} GB of Permanent storage to:
From afbc5b6d4b4482b5e5af20b54ee6af635a543c02 Mon Sep 17 00:00:00 2001
From: crisnicandrei <62384997+crisnicandrei@users.noreply.github.com>
Date: Wed, 1 Nov 2023 15:22:32 +0200
Subject: [PATCH 12/15] PER-9373
Added a new test and lintng
---
.../confirm-gift-dialog.component.spec.ts | 28 ++++++++++++++++---
.../gift-storage/gift-storage.component.html | 4 ++-
.../gift-storage.component.spec.ts | 27 +++++++++++++++++-
.../gift-storage/gift-storage.component.ts | 10 +++----
4 files changed, 57 insertions(+), 12 deletions(-)
diff --git a/src/app/core/components/confirm-gift-dialog/confirm-gift-dialog.component.spec.ts b/src/app/core/components/confirm-gift-dialog/confirm-gift-dialog.component.spec.ts
index b7bd0ba85..e0954ffa9 100644
--- a/src/app/core/components/confirm-gift-dialog/confirm-gift-dialog.component.spec.ts
+++ b/src/app/core/components/confirm-gift-dialog/confirm-gift-dialog.component.spec.ts
@@ -12,6 +12,7 @@ import * as Testing from '@root/test/testbedConfig';
import { cloneDeep } from 'lodash';
import { BehaviorSubject, Observable } from 'rxjs';
import { ApiService } from '@shared/services/api/api.service';
+import { GiftingResponse } from '@shared/services/api/billing.repo';
import { MessageService } from '@shared/services/message/message.service';
import { ConfirmGiftDialogComponent } from './confirm-gift-dialog.component';
@@ -46,7 +47,10 @@ describe('ConfirmGiftDialogComponent', () => {
},
};
- const mockGiftResult = new BehaviorSubject(false);
+ const mockGiftResult = new BehaviorSubject<{
+ isSuccessful: boolean;
+ response: GiftingResponse;
+ }>({ isSuccessful: false, response: null });
beforeEach(async () => {
const config: TestModuleMetadata = cloneDeep(Testing.BASE_TEST_CONFIG);
@@ -122,14 +126,27 @@ describe('ConfirmGiftDialogComponent', () => {
it('should close the dialog and send the data back when confirm method is called', fakeAsync(() => {
const dialogRefSpy = spyOn(dialogRef, 'close');
const giftResultSpy = spyOn(mockGiftResult, 'next');
- mockApiService.billing.giftStorage.and.returnValue(Promise.resolve());
+ const giftingResponse = new GiftingResponse({
+ storageGifted: 10,
+ alreadyInvited: [],
+ invitationSent: [],
+ giftDelivered: [],
+ });
+
+ const response = mockApiService.billing.giftStorage.and.returnValue(
+ Promise.resolve(giftingResponse)
+ );
component.onConfirmClick();
tick();
expect(dialogRefSpy).toHaveBeenCalled();
- expect(giftResultSpy).toHaveBeenCalledWith(true);
+
+ expect(giftResultSpy).toHaveBeenCalledWith({
+ isSuccessful: true,
+ response: giftingResponse,
+ });
}));
it('should handle failure in onConfirmClick', fakeAsync(() => {
@@ -149,7 +166,10 @@ describe('ConfirmGiftDialogComponent', () => {
expect(showErrorSpy).toHaveBeenCalledWith(
'Something went wrong! Please try again.'
);
- expect(giftResultSpy).toHaveBeenCalledWith(false);
+ expect(giftResultSpy).toHaveBeenCalledWith({
+ isSuccessful: false,
+ response: null,
+ });
expect(dialogRefSpy).toHaveBeenCalled();
}));
diff --git a/src/app/core/components/gift-storage/gift-storage.component.html b/src/app/core/components/gift-storage/gift-storage.component.html
index dd1c5037c..841783744 100644
--- a/src/app/core/components/gift-storage/gift-storage.component.html
+++ b/src/app/core/components/gift-storage/gift-storage.component.html
@@ -147,7 +147,9 @@
- The following emails were already invited
+ The following emails have already been invited and were not sent storage.
+ They must accept their invitation before they can be sent additional
+ storage.