Skip to content
Merged

v1.9.0 #1130

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
522cace
feat: Added The New Pricing Stashed Changes
thisismayuresh Oct 3, 2025
4e06774
feat: Implemented Fetching Plans,Transactions and Active Subscription
thisismayuresh Oct 9, 2025
9b21efd
feat: Implemented Restriction on Widget Download Sample, Manual Entry…
thisismayuresh Oct 10, 2025
868f1b1
feat: Merging Next into Current
thisismayuresh Oct 13, 2025
7b1b5ef
feat: Added File Enums in the accept prop of UploadDropzone
thisismayuresh Oct 13, 2025
be986e9
feat: Added File Enums in the accept prop of UploadDropzone (#1112)
thisismayuresh Oct 13, 2025
eea0551
feat: Added FileMimeTypesEnum.TEXT_PLAIN in the accept prop
thisismayuresh Oct 13, 2025
673112f
feat: Added FileMimeTypesEnum.TEXT_PLAIN in the accept prop (#1113)
thisismayuresh Oct 13, 2025
7ac8585
feat: Added the majorly supported file formats for rows and column ba…
thisismayuresh Oct 14, 2025
3eddf47
feat: Added the majorly supported file formats for rows and column ba…
thisismayuresh Oct 14, 2025
2c773a8
Merge branch 'next' into feat/subos-itegration-and-new-pricing
thisismayuresh Oct 14, 2025
fcd966b
feat: Added the Restriction for BINARY type based Charges
thisismayuresh Oct 17, 2025
22f6bcb
fix: spelling
thisismayuresh Oct 29, 2025
f082516
fix: spelling (#1115)
thisismayuresh Oct 29, 2025
72a498f
feat: Refactored the createEvent method to accept only necessary params
thisismayuresh Oct 30, 2025
c8fb289
feat: Added corrected grammer for the maxRecord exception
thisismayuresh Oct 30, 2025
4f9a66e
feat: Added corrected grammer for the maxRecord exception (#1116)
thisismayuresh Oct 30, 2025
f951ce3
feat: Added Icons in Menu
thisismayuresh Nov 3, 2025
0f3549a
feat: SubOS version Update
thisismayuresh Nov 3, 2025
54640b1
feat: Added the Refatored UI to display and purchase plans
thisismayuresh Nov 5, 2025
06da07c
feat: Added the proper UI for Starter plan Team Member allocation
thisismayuresh Nov 6, 2025
1d17e58
Merge branch 'next' into feat/subos-itegration-and-new-pricing
thisismayuresh Nov 6, 2025
d377968
feat: Removed unnecessary files and code cleanup
thisismayuresh Nov 6, 2025
82f8ffe
feat: Removed the commented and imported Defaults
thisismayuresh Nov 6, 2025
9a74a0d
feat: Removed the MetricItem component and updated the version of SubOS
thisismayuresh Nov 6, 2025
8928b62
feat: Added smooth scroll to show user plans if user do not have any …
thisismayuresh Nov 6, 2025
f19742a
feat: Removed PlansModal and consolidated logic into PlanPricingTable
thisismayuresh Nov 6, 2025
b5073a0
feat: Refactored the hook - useSubOSIntegration and added TypeScript …
thisismayuresh Nov 6, 2025
d0fc7ef
feat: Added TextArea for specifying other cancellation reason
thisismayuresh Nov 6, 2025
0753441
feat: Added the payment-cancel page
thisismayuresh Nov 6, 2025
93e7760
feat: Added the navigation to Home Page on success or failed transaction
thisismayuresh Nov 6, 2025
2b6085c
feat: Removed the VITE_ keys
thisismayuresh Nov 6, 2025
dda7c06
feat: Removed the commented imports
thisismayuresh Nov 6, 2025
22af81f
feat: Removed the Nested try catch block
thisismayuresh Nov 6, 2025
06631f2
Feat/subos itegration and new pricing (#1117)
thisismayuresh Nov 6, 2025
4ab8b29
feat: Changed the SUBOS_API_ENDPOINT to PAYMENT_GATEWAY_UR
thisismayuresh Nov 7, 2025
6199349
feat: Added pnpm-lock file
thisismayuresh Nov 7, 2025
7b512e5
feat: Updated subos-frontend version
thisismayuresh Nov 7, 2025
554fe5a
feat: Changed the SUBOS_API_ENDPOINT to PAYMENT_GATEWAY_UR
thisismayuresh Nov 7, 2025
4f74bf9
feat: Changed usePlanDetails to useActiveSubscriptionDetails
thisismayuresh Nov 7, 2025
681ad1c
feat: Renamed the Compnents
thisismayuresh Nov 7, 2025
8ff1fe2
feat: Changed usePlanDetails to useActiveSubscriptionDetails
thisismayuresh Nov 7, 2025
5554710
feat: Refactored PlanCard to use the sub-os library hooks
thisismayuresh Nov 7, 2025
e13958a
feat: Added the cancel plan and Removed the unnecessary plan details …
thisismayuresh Nov 7, 2025
9507321
feat: Renamed the component and hooks
thisismayuresh Nov 7, 2025
d454998
feat: Refactored useCancelPlan to use the subos hooks
thisismayuresh Nov 7, 2025
6e8fdb9
feat: Removed unessential subscription and transaction functions from…
thisismayuresh Nov 7, 2025
79081be
feat: Removed the usage of fetchTransactions from useSubOSIntegration…
thisismayuresh Nov 7, 2025
c474ab9
feat: Renamed the usePlanDetails to useActiveSubscriptionDetails
thisismayuresh Nov 7, 2025
3af5d16
feat: Removed/Deleted the Subscription Related files
thisismayuresh Nov 7, 2025
6d2e93d
feat: Cleaned up the /user route and removed the unessential subscrip…
thisismayuresh Nov 7, 2025
cbaa167
feat: Cleaned up and Removed the unessential subscription related imp…
thisismayuresh Nov 7, 2025
7e2cc22
feat: Renamed PaymentSuccessConfirmationModal to PaymentStatusConfirm…
thisismayuresh Nov 7, 2025
11d7035
feat: Renamed useSubscriptionInfo to useSubscriptionMetaDataInformation
thisismayuresh Nov 7, 2025
def6e22
feat: Renamed useSubscriptionInfo to useSubscriptionMetaDataInformation
thisismayuresh Nov 7, 2025
c95df4f
feat: Removed the unessential exported members
thisismayuresh Nov 7, 2025
1b84605
feat: Renamed useSubscriptionInfo to useSubscriptionMetaDataInformation
thisismayuresh Nov 7, 2025
39a5261
feat: Renamed useSubscriptionInfo to useSubscriptionMetaDataInformation
thisismayuresh Nov 7, 2025
89f78e5
feat: Renamed useSubscriptionInfo to useSubscriptionMetaDataInformation
thisismayuresh Nov 7, 2025
73ec5af
feat: Removed the unused API Routes of the /user
thisismayuresh Nov 7, 2025
af8c553
feat: Renamed PaymentSuccessConfirmationModal to PaymentStatusConfirm…
thisismayuresh Nov 7, 2025
e3458ec
feat: Removed the unused code of paymentGateway api calls
thisismayuresh Nov 7, 2025
a355c01
feat: Removed the eslint-disable-next-line @typescript-eslint/naming…
thisismayuresh Nov 7, 2025
be930c4
feat: Clubbed up the features to look more appealing
thisismayuresh Nov 7, 2025
3800e6a
Merge branch 'next' into feat/subos-itegration-and-new-pricing
chavda-bhavik Nov 7, 2025
997c7f2
Feat/subos itegration and new pricing (#1118)
chavda-bhavik Nov 7, 2025
c08b1cc
feat: Added the credentials to subos from publicRunTimeConfig
thisismayuresh Nov 7, 2025
e018f90
feat: Added the credentials to subos from publicRunTimeConfig (#1119)
thisismayuresh Nov 7, 2025
375b3a2
feat: Removed the Static message if no activePlanDetails is found
thisismayuresh Nov 7, 2025
695130b
feat: Removed the Static message if no activePlanDetails is found (#1…
thisismayuresh Nov 7, 2025
46f7a1e
feat: Added the proper error messages as a toast notifications if err…
thisismayuresh Nov 10, 2025
0b94b05
feat: Added the proper error messages as a toast notifications if err…
thisismayuresh Nov 10, 2025
f6935dc
feat: Added Log to Debug
thisismayuresh Nov 10, 2025
4b3a22f
feat: Added Log to Debug (#1122)
thisismayuresh Nov 10, 2025
26c0c8b
feat: Added a default property in the WIDGET_TEXTS
thisismayuresh Nov 10, 2025
320fdf0
feat: Added a default property in the WIDGET_TEXTS (#1123)
thisismayuresh Nov 10, 2025
b2bd2d3
feat: Added gradient animated informative view while onboarding
thisismayuresh Nov 11, 2025
2b24ef8
feat: Added the Basic Onboarding Welcome Modals
thisismayuresh Nov 12, 2025
194435e
feat: Merge Branch Next (SubOS Integration Changes) into Current
thisismayuresh Nov 12, 2025
fd80dc4
feat: Added and updated some property from the widget text object
thisismayuresh Nov 12, 2025
1014cbd
feat: Renamed the WelcomeConfigureDestinationModal to WelcomeConfigur…
thisismayuresh Nov 12, 2025
209eba2
feat: Renamed the WelcomeConfigureDestinationModal to WelcomeConfigur…
thisismayuresh Nov 12, 2025
419f126
feat: Added extensive Types and Typing in WelcomeConfigureStepModal
thisismayuresh Nov 12, 2025
ead7dcf
feat: Added the flow of modal closing and switching
thisismayuresh Nov 12, 2025
f6c6533
feat: Added the Modal Flow
thisismayuresh Nov 12, 2025
acfa06a
feat: Using Localstorage
thisismayuresh Nov 12, 2025
0495c2d
feat: Using Localstorage
thisismayuresh Nov 12, 2025
39d6c4a
feat: Added the Welcome Modals and Introductory Modals
thisismayuresh Nov 13, 2025
2c8bfba
feat: Removed the log
thisismayuresh Nov 13, 2025
27c0d7e
feat: Implemented the restriction for the Retry Count and Retry Interval
thisismayuresh Nov 13, 2025
4e95921
feat: Implemented the restrction on certain validation elements as pe…
thisismayuresh Nov 13, 2025
b115298
feat: Added webhookRetrySettingsUnavailable
thisismayuresh Nov 13, 2025
67f3f68
feat: Added other essential restriction as per requirement
thisismayuresh Nov 13, 2025
8204abc
feat: Removed the welcome flag onClose of the welcome modal
thisismayuresh Nov 13, 2025
3cc4678
feat: Added certain meta metrics
thisismayuresh Nov 13, 2025
ba3924d
feat: Refactored the buisness logic of Find and Replace button disabi…
thisismayuresh Nov 13, 2025
60bd55e
feat: Removed non essential logs
thisismayuresh Nov 13, 2025
b6425b4
feat: Merging Sub OS Integration Branch
thisismayuresh Nov 13, 2025
ee81b74
feat: Removed unused import member React
thisismayuresh Nov 13, 2025
13a1f1d
feat: Added the styles in the LeftSideContent.style
thisismayuresh Nov 13, 2025
4beacc4
feat: Added the constant welcome message key from localstorage
thisismayuresh Nov 13, 2025
9e4f0ad
feat: Added the Action Anchrt for file download
thisismayuresh Nov 13, 2025
787e999
feat: Added the yellow message of the Get in Touch
thisismayuresh Nov 13, 2025
a6c4872
feat: Removed the duplicated restriction on find and replace modal
thisismayuresh Nov 13, 2025
6d673c3
feat: Added the file download sample functionality on welcome modal
thisismayuresh Nov 13, 2025
365f27f
feat: Added key for Object BILLABLEMETRIC_CODE_ENUM and wrapped took …
thisismayuresh Nov 14, 2025
a8ca798
feat: Removed the redundant Plan Details
thisismayuresh Nov 14, 2025
eac27a8
feat: Added the scrollable content under the plan header pricing
thisismayuresh Nov 14, 2025
fbf5fa7
feat: Replaced the icons and updated as displayed in the website
thisismayuresh Nov 14, 2025
9923008
feat: Added the complete returned value IErrorDetails
thisismayuresh Nov 14, 2025
ccc17ce
feat: Removed the Error and only returning the extracted formatted st…
thisismayuresh Nov 14, 2025
5ee6074
feat: Added the new messages of onboarding flow
thisismayuresh Nov 14, 2025
1822efc
feat: Removed the redundant IImportConfig
thisismayuresh Nov 14, 2025
1871d82
feat: Changed the file name to be easily noticable
thisismayuresh Nov 14, 2025
199944e
feat: Changed the file name to be easily noticable
thisismayuresh Nov 14, 2025
fb7a935
feat: Added and modified properties in the constant configuration
thisismayuresh Nov 14, 2025
ed8416a
feat: Added the logo and contents in the static csv file
thisismayuresh Nov 17, 2025
aa23daf
feat: Opened the link in new tab
thisismayuresh Nov 17, 2025
91d32dc
feat: Added the redable message of the DirectEntryView table header
thisismayuresh Nov 17, 2025
c3fb73a
feat: Added the dynamic color to the image logo image for redability
thisismayuresh Nov 17, 2025
827facb
feat: Added the light logo for better visibility
thisismayuresh Nov 17, 2025
dbfdcfd
feat: Removed the dependency clearWelcomeFlag
thisismayuresh Nov 17, 2025
fddfc58
feat: Added the new message for Divider label
thisismayuresh Nov 17, 2025
897e454
feat: Dynamically shown the component and lock based on active plan d…
thisismayuresh Nov 17, 2025
e743102
feat: Moved the Recommended badge at the corner of the Card
thisismayuresh Nov 17, 2025
8611a06
feat: Handeled the better handling of closing of WelcomeImpoterModal
thisismayuresh Nov 17, 2025
66c8e47
feat: Added the initial TRIAL Plan when user onboards
thisismayuresh Nov 17, 2025
384ef82
feat: Organized import of mantine modal
thisismayuresh Nov 18, 2025
057ad65
feat: Added type Partial<IColumn>[] in sampleColumns
thisismayuresh Nov 18, 2025
122c7e6
feat: Safely extracted the column properties from column.selectValues
thisismayuresh Nov 18, 2025
77fc288
feat: Added JSX specific strokeWidth
thisismayuresh Nov 18, 2025
f0c1d70
feat: Called the onDoWelcomeWidgetAction parent function
thisismayuresh Nov 18, 2025
36064f9
feat: Fixed the modal welcome opening and closing
thisismayuresh Nov 18, 2025
371e27a
feat: Properly shown modal, and added 1K records in the csv file and …
thisismayuresh Nov 19, 2025
5473e92
feat: Removed the logs
thisismayuresh Nov 19, 2025
2426a49
feat: Removed the projectId and Added invalid records in the CSV file…
thisismayuresh Nov 24, 2025
e40c8be
Feat/new user onboarding flow and UI changes (#1124)
thisismayuresh Nov 24, 2025
07d007c
feat: Added a saftey check if getting a appereance (not undefined) ob…
thisismayuresh Nov 24, 2025
465b37f
feat: Cleared the welcome flag and added the APPEARANCE_CUSTOMIZATION…
thisismayuresh Nov 24, 2025
a196972
Feat/new user onboarding flow and UI changes (#1126)
thisismayuresh Nov 24, 2025
3c1c677
feat: Added the hover tooltip on Locked Validatior Tab and added the …
thisismayuresh Dec 1, 2025
f7992be
feat: SubOS Package Update
thisismayuresh Dec 1, 2025
569b655
Merge branch 'next' into feat/new-user-onboarding-flow-and-ui-changes
thisismayuresh Dec 1, 2025
84b2980
Feat/new user onboarding flow and UI changes (#1127)
thisismayuresh Dec 1, 2025
a6f85ba
feat: Version Update SubOs-Frontend to 1.0.95 and added the dynamic c…
thisismayuresh Dec 1, 2025
361a756
Merge branch 'next' of github.com:implerhq/impler.io into feat/new-us…
thisismayuresh Dec 1, 2025
6663ea7
Feat/new user onboarding flow and UI changes (#1128)
thisismayuresh Dec 1, 2025
347adcf
v1.9.0
thisismayuresh Dec 2, 2025
7cca380
feat: Updated docker-compose images version
thisismayuresh Dec 2, 2025
2373f65
Release/1.9.0 (#1129)
thisismayuresh Dec 2, 2025
82dde9e
Merge branch 'main' into next
thisismayuresh Dec 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SubOS Configuration
NEXT_PUBLIC_PAYMENT_GATEWAY_URL=
NEXT_PUBLIC_SUBOS_PROJECT_ID=
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=

# App Configuration
NEXT_PUBLIC_APP_NAME=Impler.io
NEXT_PUBLIC_APP_VERSION=1.0.0

# Environment is automatically set by NODE_ENV
# NODE_ENV=development
2 changes: 1 addition & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/api",
"version": "1.8.1",
"version": "1.9.0",
"author": "implerhq",
"license": "MIT",
"private": true,
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/app/column/dtos/column-request.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ValidationTypesEnum } from '@impler/client';
import { IsValidRegex } from '@shared/framework/is-valid-regex.validator';
import { IsValidDigitsConstraint } from '@shared/framework/is-valid-digits.validator';
import { IsNumberOrString } from '@shared/framework/number-or-string.validator';
import { ColumnDelimiterEnum, ColumnTypesEnum, Defaults } from '@impler/shared';
import { ColumnDelimiterEnum, ColumnTypesEnum } from '@impler/shared';

export class ValidationDto {
@ApiProperty({
Expand Down Expand Up @@ -154,7 +154,7 @@ export class ColumnRequestDto {
})
@ValidateIf((object) => object.type === ColumnTypesEnum.DATE)
@Type(() => Array<string>)
dateFormats: string[] = Defaults.DATE_FORMATS;
dateFormats: string[];

@ApiProperty({
description: 'Sequence of column',
Expand Down
6 changes: 3 additions & 3 deletions apps/api/src/app/common/common.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {
UploadedFile,
} from '@nestjs/common';

import { ACCESS_KEY_NAME } from '@impler/shared';
import { ACCESS_KEY_NAME, IImportConfig } from '@impler/shared';
import { JwtAuthGuard } from '@shared/framework/auth.gaurd';
import { ValidRequestDto, SignedUrlDto, ImportConfigResponseDto } from './dtos';
import { ValidRequestDto, SignedUrlDto } from './dtos';
import { ValidImportFile } from '@shared/validations/valid-import-file.validation';
import { ValidRequestCommand, GetSignedUrl, ValidRequest, GetImportConfig, GetSheetNames } from './usecases';

Expand Down Expand Up @@ -60,7 +60,7 @@ export class CommonController {
async getImportConfigRoute(
@Query('projectId') projectId: string,
@Query('templateId') templateId: string
): Promise<ImportConfigResponseDto> {
): Promise<IImportConfig> {
if (!projectId) {
throw new BadRequestException();
}
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/app/common/dtos/Schema.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
ValidateNested,
} from 'class-validator';
import { Type } from 'class-transformer';
import { ColumnTypesEnum, Defaults } from '@impler/shared';
import { ColumnTypesEnum } from '@impler/shared';
import { IsValidRegex } from '@shared/framework/is-valid-regex.validator';
import { ValidationDto } from 'app/column/dtos/column-request.dto';

Expand Down Expand Up @@ -101,7 +101,7 @@ export class SchemaDto {
@Type(() => Array<string>)
@IsArray({ message: "'dateFormats' must be an array, when type is Date" })
@ArrayMinSize(1, { message: "'dateFormats' must not be empty, when type is Date" })
dateFormats: string[] = Defaults.DATE_FORMATS;
dateFormats: string[];

@ApiProperty({
description: 'Sequence of column',
Expand Down
18 changes: 0 additions & 18 deletions apps/api/src/app/common/dtos/import-config-response.dto.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/api/src/app/common/dtos/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { SignedUrlDto } from './signed-url.dto';
export { ValidRequestDto } from './valid.dto';
export { SheetNamesDto } from './sheet-names.dto';
export { ImportConfigResponseDto } from './import-config-response.dto';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BadRequestException, Injectable } from '@nestjs/common';
import { UserRepository, TemplateRepository, TemplateEntity } from '@impler/dal';
import { AVAILABLE_BILLABLEMETRIC_CODE_ENUM, IImportConfig } from '@impler/shared';
import { BILLABLEMETRIC_CODE_ENUM, IImportConfig } from '@impler/shared';
import { PaymentAPIService } from '@impler/services';
import { APIMessages } from '@shared/constants';

Expand All @@ -14,12 +14,22 @@ export class GetImportConfig {

async execute(projectId: string, templateId?: string): Promise<IImportConfig> {
const userEmail = await this.userRepository.findUserEmailFromProjectId(projectId);
const isFeatureAvailableMap = new Map<string, boolean>();

const removeBrandingAvailable = await this.paymentAPIService.checkEvent({
email: userEmail,
billableMetricCode: AVAILABLE_BILLABLEMETRIC_CODE_ENUM.REMOVE_BRANDING,
Object.values(BILLABLEMETRIC_CODE_ENUM).forEach((code) => {
isFeatureAvailableMap.set(code, false);
});

for (const billableMetricCode of Object.values(BILLABLEMETRIC_CODE_ENUM)) {
try {
const isAvailable = await this.paymentAPIService.checkEvent({
email: userEmail,
billableMetricCode: BILLABLEMETRIC_CODE_ENUM[billableMetricCode],
});
isFeatureAvailableMap.set(billableMetricCode, isAvailable);
} catch (error) {}
}

let template: TemplateEntity;
if (templateId) {
template = await this.templateRepository.findOne({
Expand All @@ -32,6 +42,11 @@ export class GetImportConfig {
}
}

return { showBranding: !removeBrandingAvailable, mode: template?.mode, title: template?.name };
return {
...Object.fromEntries(isFeatureAvailableMap),
showBranding: !isFeatureAvailableMap.get(BILLABLEMETRIC_CODE_ENUM.REMOVE_BRANDING),
mode: template?.mode,
title: template?.name,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { PaymentAPIService } from '@impler/services';
import { ValidRequestCommand } from './valid-request.command';
import { ProjectRepository, TemplateRepository, UserEntity } from '@impler/dal';
import { UniqueColumnException } from '@shared/exceptions/unique-column.exception';
import { AVAILABLE_BILLABLEMETRIC_CODE_ENUM, ColumnTypesEnum } from '@impler/shared';
import { BILLABLEMETRIC_CODE_ENUM, ColumnTypesEnum } from '@impler/shared';
import { DocumentNotFoundException } from '@shared/exceptions/document-not-found.exception';

@Injectable()
Expand Down Expand Up @@ -98,7 +98,7 @@ export class ValidRequest {
if (hasImageColumns && email) {
const imageImportAvailable = await this.paymentAPIService.checkEvent({
email,
billableMetricCode: AVAILABLE_BILLABLEMETRIC_CODE_ENUM.IMAGE_IMPORT,
billableMetricCode: BILLABLEMETRIC_CODE_ENUM.IMAGE_IMPORT,
});

if (!imageImportAvailable) {
Expand All @@ -108,7 +108,7 @@ export class ValidRequest {
if (hasValidations && email) {
const validationsAvailable = await this.paymentAPIService.checkEvent({
email,
billableMetricCode: AVAILABLE_BILLABLEMETRIC_CODE_ENUM.ADVANCED_VALIDATORS,
billableMetricCode: BILLABLEMETRIC_CODE_ENUM.ADVANCED_VALIDATORS,
});

if (!validationsAvailable) {
Expand Down
13 changes: 12 additions & 1 deletion apps/api/src/app/mapping/usecases/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ReanameFileHeadings } from './rename-file-headings/rename-file-headings

import { DoMappingCommand } from './do-mapping/do-mapping.command';
import { ValidateMappingCommand } from './validate-mapping/validate-mapping.command';
import { PaymentAPIService } from '@impler/services';

export const USE_CASES = [
DoMapping,
Expand All @@ -17,9 +18,19 @@ export const USE_CASES = [
ValidateMapping,
ReanameFileHeadings,
GetUpload,
PaymentAPIService,
//
];

export { DoMapping, ValidateMapping, GetMappings, UpdateMappings, FinalizeUpload, ReanameFileHeadings, GetUpload };
export {
DoMapping,
ValidateMapping,
GetMappings,
UpdateMappings,
FinalizeUpload,
ReanameFileHeadings,
GetUpload,
PaymentAPIService,
};

export { DoMappingCommand, ValidateMappingCommand };
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ export class CreateProjectCommand extends AuthenticatedCommand {
@IsBoolean()
@IsOptional()
onboarding?: boolean;

@IsBoolean()
@IsOptional()
autoGenerated?: boolean;
}
113 changes: 86 additions & 27 deletions apps/api/src/app/review/usecases/do-review/do-review.usecase.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* eslint-disable multiline-comment-style */
import { Model } from 'mongoose';
import { Writable } from 'stream';
import { Injectable, BadRequestException, InternalServerErrorException } from '@nestjs/common';

import { APIMessages } from '@shared/constants';
import { EMAIL_SUBJECT } from '@impler/shared';
import { BILLABLEMETRIC_CODE_ENUM, EMAIL_SUBJECT } from '@impler/shared';
import { BaseReview } from './base-review.usecase';
import { UniqueWithValidationType, ValidationTypesEnum } from '@impler/client';
import { BATCH_LIMIT } from '@shared/services/sandbox';
Expand All @@ -16,7 +17,9 @@ import {
DalService,
TemplateEntity,
TemplateRepository,
EnvironmentRepository,
} from '@impler/dal';
import { UsageLimitExceededException } from '@shared/exceptions/import-limit-exceeded.exception';

interface ISaveResults {
uploadId: string;
Expand All @@ -32,6 +35,7 @@ export class DoReview extends BaseReview {

constructor(
private templateRepository: TemplateRepository,
private environmentRepository: EnvironmentRepository,
private storageService: StorageService,
private uploadRepository: UploadRepository,
private validatorRepository: ValidatorRepository,
Expand All @@ -44,6 +48,7 @@ export class DoReview extends BaseReview {
}

async execute(_uploadId: string) {
console.log('Called The Do Review.execute');
this._modal = this.dalService.getRecordCollection(_uploadId);
const userEmail = await this.uploadRepository.getUserEmailFromUploadId(_uploadId);

Expand Down Expand Up @@ -205,7 +210,28 @@ export class DoReview extends BaseReview {
throw new InternalServerErrorException(APIMessages.ERROR_DURING_VALIDATION);
}

await this.saveResults(response);
try {
await this.saveResults(response);
} catch (error) {
const emailContents = this.emailService.getEmailContent({
type: 'IMPORT_LIMIT_EXCEEDED_EMAIL',
data: {
limitType: 'Import Rows',
currentUsage: 'All available units including grace percentage',
planName: 'Current Plan',
upgradeUrl: `${process.env.WEB_BASE_URL}/pricing`,
},
});
await this.emailService.sendEmail({
from: process.env.EMAIL_FROM,
html: emailContents,
subject: 'Usage limit exceeded',
to: userEmail,
senderName: process.env.EMAIL_FROM_NAME,
});

throw new UsageLimitExceededException(error.message);
}

return response;
}
Expand Down Expand Up @@ -235,32 +261,65 @@ export class DoReview extends BaseReview {
}

private async saveResults({ uploadId, totalRecords, validRecords, invalidRecords, _templateId }: ISaveResults) {
await this.uploadRepository.update(
{ _id: uploadId },
{
status: UploadStatusEnum.REVIEWING,
totalRecords,
validRecords,
invalidRecords,
}
);
await this.templateRepository.findOneAndUpdate(
{
_id: _templateId,
},
{
$inc: {
totalUploads: 1,
totalRecords: totalRecords,
totalInvalidRecords: invalidRecords,
},
}
);
const userExternalIdOrEmail = await this.uploadRepository.getUserEmailFromUploadId(uploadId);

await this.paymentAPIService.createEvent(
{ uploadId, totalRecords, validRecords, invalidRecords },
userExternalIdOrEmail
);
try {
await this.paymentAPIService.createEvent(
{ units: totalRecords, billableMetricCode: BILLABLEMETRIC_CODE_ENUM.ROWS },
userExternalIdOrEmail
);

// Only update database if payment event creation succeeds
await this.uploadRepository.update(
{ _id: uploadId },
{
status: UploadStatusEnum.REVIEWING,
totalRecords,
validRecords,
invalidRecords,
}
);

await this.templateRepository.findOneAndUpdate(
{
_id: _templateId,
},
{
$inc: {
totalUploads: 1,
totalRecords: totalRecords,
totalInvalidRecords: invalidRecords,
},
}
);
} catch (error) {
const template = await this.templateRepository.findById(_templateId);
const environment = await this.environmentRepository.getProjectTeamMembers(template._projectId);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const teamMemberEmails = environment.map((teamMember) => teamMember._userId.email);

const emailContents = this.emailService.getEmailContent({
type: 'IMPORT_LIMIT_EXCEEDED_EMAIL',
data: {
limitType: 'Import Rows',
currentUsage: 'All available units including grace percentage',
planName: 'Current Plan',
upgradeUrl: `${process.env.WEB_BASE_URL}/pricing`,
},
});

teamMemberEmails.forEach(async (email) => {
await this.emailService.sendEmail({
to: email,
subject: EMAIL_SUBJECT.IMPORT_LIMIT_EXCEEDED,
html: emailContents,
from: process.env.ALERT_EMAIL_FROM,
senderName: process.env.EMAIL_FROM_NAME,
});
});

throw new UsageLimitExceededException(error.message);
}
}
}
Loading
Loading