From 525b6f84bb5d81a4b14745cb365b2b2503f4ca96 Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Thu, 28 Nov 2024 10:37:44 +0000 Subject: [PATCH] Remove references to day passes (#15079) * Remove references to day passes * lint * Point pro to branch with no day passes code * update yarn lock --- .../core/utilities/structures/licenses.ts | 6 -- .../tests/core/utilities/structures/quotas.ts | 3 - .../licensing/DayPassWarningModal.svelte | 81 ------------------- .../portal/licensing/LicensingOverlays.svelte | 15 ---- .../components/portal/licensing/constants.js | 2 - .../portal/licensing/licensingBanners.js | 40 --------- packages/builder/src/constants/index.js | 1 - .../src/pages/builder/apps/index.svelte | 2 +- .../pages/builder/portal/account/usage.svelte | 5 +- packages/pro | 2 +- packages/types/src/documents/global/quotas.ts | 1 - packages/types/src/documents/global/user.ts | 1 - packages/types/src/sdk/licensing/plan.ts | 2 - packages/types/src/sdk/licensing/quota.ts | 2 - .../src/api/routes/global/tests/self.spec.ts | 4 +- yarn.lock | 35 ++------ 16 files changed, 9 insertions(+), 193 deletions(-) delete mode 100644 packages/builder/src/components/portal/licensing/DayPassWarningModal.svelte diff --git a/packages/backend-core/tests/core/utilities/structures/licenses.ts b/packages/backend-core/tests/core/utilities/structures/licenses.ts index b4d209a7ee..77f6d57b09 100644 --- a/packages/backend-core/tests/core/utilities/structures/licenses.ts +++ b/packages/backend-core/tests/core/utilities/structures/licenses.ts @@ -22,7 +22,6 @@ export function price(): PurchasedPrice { currency: "usd", duration: PriceDuration.MONTHLY, priceId: "price_123", - dayPasses: undefined, isPerUser: true, } } @@ -50,11 +49,6 @@ export function quotas(): Quotas { value: 1, triggers: [], }, - dayPasses: { - name: "Queries", - value: 1, - triggers: [], - }, budibaseAICredits: { name: "Budibase AI Credits", value: 1, diff --git a/packages/backend-core/tests/core/utilities/structures/quotas.ts b/packages/backend-core/tests/core/utilities/structures/quotas.ts index 58817e4831..83c3a8a766 100644 --- a/packages/backend-core/tests/core/utilities/structures/quotas.ts +++ b/packages/backend-core/tests/core/utilities/structures/quotas.ts @@ -15,7 +15,6 @@ export const usage = (users: number = 0, creators: number = 0): QuotaUsage => { monthly: { "01-2023": { automations: 0, - dayPasses: 0, queries: 0, budibaseAICredits: 0, triggers: {}, @@ -45,14 +44,12 @@ export const usage = (users: number = 0, creators: number = 0): QuotaUsage => { }, "02-2023": { automations: 0, - dayPasses: 0, queries: 0, budibaseAICredits: 0, triggers: {}, }, current: { automations: 0, - dayPasses: 0, queries: 0, budibaseAICredits: 0, triggers: {}, diff --git a/packages/builder/src/components/portal/licensing/DayPassWarningModal.svelte b/packages/builder/src/components/portal/licensing/DayPassWarningModal.svelte deleted file mode 100644 index 341e427bf0..0000000000 --- a/packages/builder/src/components/portal/licensing/DayPassWarningModal.svelte +++ /dev/null @@ -1,81 +0,0 @@ - - - - {#if $auth.user.accountPortalAccess} - { - window.location.href = upgradeUrl - }} - > - - You have used {dayPassesUsed}% of - your plans Day Passes with {daysRemaining} day{daysRemaining == 1 - ? "" - : "s"} remaining. - - - - - {dayPassesBody} - - {:else} - - - You have used {dayPassesUsed}% of - your plans Day Passes with {daysRemaining} day{daysRemaining == 1 - ? "" - : "s"} remaining. - - - - - Please contact your account holder to upgrade. - - {/if} - - - diff --git a/packages/builder/src/components/portal/licensing/LicensingOverlays.svelte b/packages/builder/src/components/portal/licensing/LicensingOverlays.svelte index ab80418b6e..e2c52e3448 100644 --- a/packages/builder/src/components/portal/licensing/LicensingOverlays.svelte +++ b/packages/builder/src/components/portal/licensing/LicensingOverlays.svelte @@ -1,7 +1,6 @@ - { - const appAuth = get(auth) - const appLicensing = get(licensing) - if (get(licensing)?.usageMetrics["dayPasses"] >= 100) { - return { - key: "max_dayPasses", - type: BANNER_TYPES.NEGATIVE, - criteria: () => { - return true - }, - message: `Your apps are currently offline. You have exceeded your plans limit for Day Passes. ${ - appAuth.user.accountPortalAccess - ? "" - : "Please contact your account holder to upgrade." - }`, - ...upgradeAction(), - showCloseButton: false, - } - } - - return buildUsageInfoBanner( - "dayPasses", - "Day Passes", - ExpiringKeys.LICENSING_DAYPASS_WARNING_BANNER, - 90, - `You have used ${ - appLicensing?.usageMetrics["dayPasses"] - }% of your monthly usage of Day Passes with ${ - appLicensing?.quotaResetDaysRemaining - } day${ - get(licensing).quotaResetDaysRemaining == 1 ? "" : "s" - } remaining. All apps will be taken offline if this limit is reached. ${ - appAuth.user.accountPortalAccess - ? "" - : "Please contact your account holder to upgrade." - }` - ) -} - const buildPaymentFailedBanner = () => { return { key: "payment_Failed", @@ -166,7 +127,6 @@ const buildUsersAboveLimitBanner = EXPIRY_KEY => { export const getBanners = () => { return [ buildPaymentFailedBanner(), - buildDayPassBanner(ExpiringKeys.LICENSING_DAYPASS_WARNING_BANNER), buildUsageInfoBanner( "rows", "Rows", diff --git a/packages/builder/src/constants/index.js b/packages/builder/src/constants/index.js index 0d51f57c3e..3498183c8e 100644 --- a/packages/builder/src/constants/index.js +++ b/packages/builder/src/constants/index.js @@ -68,7 +68,6 @@ export const OnboardingType = { export const PlanModel = { PER_USER: "perUser", - DAY_PASS: "dayPass", } export const ChangelogURL = "https://docs.budibase.com/changelog" diff --git a/packages/builder/src/pages/builder/apps/index.svelte b/packages/builder/src/pages/builder/apps/index.svelte index 095bf2023b..632478748d 100644 --- a/packages/builder/src/pages/builder/apps/index.svelte +++ b/packages/builder/src/pages/builder/apps/index.svelte @@ -136,7 +136,7 @@ - {#if $licensing.usageMetrics?.dayPasses >= 100 || $licensing.errUserLimit} + {#if $licensing.errUserLimit}
spaceman diff --git a/packages/builder/src/pages/builder/portal/account/usage.svelte b/packages/builder/src/pages/builder/portal/account/usage.svelte index 7a1b1f8e14..cb0f5ea512 100644 --- a/packages/builder/src/pages/builder/portal/account/usage.svelte +++ b/packages/builder/src/pages/builder/portal/account/usage.svelte @@ -28,7 +28,7 @@ const upgradeUrl = `${$admin.accountPortalUrl}/portal/upgrade` const manageUrl = `${$admin.accountPortalUrl}/portal/billing` - const WARN_USAGE = ["Queries", "Automations", "Rows", "Day Passes", "Users"] + const WARN_USAGE = ["Queries", "Automations", "Rows", "Users"] const oneDayInSeconds = 86400 const EXCLUDE_QUOTAS = { @@ -36,9 +36,6 @@ Users: license => { return license.plan.model !== PlanModel.PER_USER }, - "Day Passes": license => { - return license.plan.model !== PlanModel.DAY_PASS - }, } function excludeQuota(name) { diff --git a/packages/pro b/packages/pro index 21a6a658e0..e8ef2205de 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 21a6a658e0765208fb6ebf21864497f2739dcb99 +Subproject commit e8ef2205de8bca5adcf18d07573096086aa9a606 diff --git a/packages/types/src/documents/global/quotas.ts b/packages/types/src/documents/global/quotas.ts index 4726dabf0d..a24fc8f9b0 100644 --- a/packages/types/src/documents/global/quotas.ts +++ b/packages/types/src/documents/global/quotas.ts @@ -44,7 +44,6 @@ export interface StaticUsage { export interface MonthlyUsage { [MonthlyQuotaName.QUERIES]: number [MonthlyQuotaName.AUTOMATIONS]: number - [MonthlyQuotaName.DAY_PASSES]: number [MonthlyQuotaName.BUDIBASE_AI_CREDITS]: number triggers: { [key in MonthlyQuotaName]?: QuotaTriggers diff --git a/packages/types/src/documents/global/user.ts b/packages/types/src/documents/global/user.ts index 1b242886b5..529223e88d 100644 --- a/packages/types/src/documents/global/user.ts +++ b/packages/types/src/documents/global/user.ts @@ -62,7 +62,6 @@ export interface User extends Document { password?: string status?: UserStatus createdAt?: number // override the default createdAt behaviour - users sdk historically set this to Date.now() - dayPassRecordedAt?: string userGroups?: string[] onboardedAt?: string freeTrialConfirmedAt?: string diff --git a/packages/types/src/sdk/licensing/plan.ts b/packages/types/src/sdk/licensing/plan.ts index af682cbad1..8cdd72dd5d 100644 --- a/packages/types/src/sdk/licensing/plan.ts +++ b/packages/types/src/sdk/licensing/plan.ts @@ -38,7 +38,6 @@ export interface AvailablePrice { export enum PlanModel { PER_USER = "perUser", PER_CREATOR_PER_USER = "per_creator_per_user", - DAY_PASS = "dayPass", } export interface PurchasedPlan { @@ -49,7 +48,6 @@ export interface PurchasedPlan { } export interface PurchasedPrice extends AvailablePrice { - dayPasses: number | undefined /** @deprecated - now at the plan level via model */ isPerUser: boolean } diff --git a/packages/types/src/sdk/licensing/quota.ts b/packages/types/src/sdk/licensing/quota.ts index 75fc18e8e6..ed541d2974 100644 --- a/packages/types/src/sdk/licensing/quota.ts +++ b/packages/types/src/sdk/licensing/quota.ts @@ -23,7 +23,6 @@ export enum StaticQuotaName { export enum MonthlyQuotaName { QUERIES = "queries", AUTOMATIONS = "automations", - DAY_PASSES = "dayPasses", BUDIBASE_AI_CREDITS = "budibaseAICredits", } @@ -63,7 +62,6 @@ export type PlanQuotas = { [key in PlanType]: Quotas | undefined } export type MonthlyQuotas = { [MonthlyQuotaName.QUERIES]: Quota [MonthlyQuotaName.AUTOMATIONS]: Quota - [MonthlyQuotaName.DAY_PASSES]: Quota [MonthlyQuotaName.BUDIBASE_AI_CREDITS]: Quota } diff --git a/packages/worker/src/api/routes/global/tests/self.spec.ts b/packages/worker/src/api/routes/global/tests/self.spec.ts index 277c11b081..bf34f14aa0 100644 --- a/packages/worker/src/api/routes/global/tests/self.spec.ts +++ b/packages/worker/src/api/routes/global/tests/self.spec.ts @@ -1,5 +1,5 @@ jest.mock("nodemailer") -import { TestConfiguration, mocks } from "../../../../tests" +import { TestConfiguration } from "../../../../tests" import { events } from "@budibase/backend-core" describe("/api/global/self", () => { @@ -39,7 +39,6 @@ describe("/api/global/self", () => { const dbUser = (await config.getUser(user.email))! user._rev = dbUser._rev - user.dayPassRecordedAt = mocks.date.MOCK_DATE.toISOString() expect(res.body._id).toBe(user._id) expect(events.user.updated).toHaveBeenCalledTimes(1) expect(events.user.updated).toHaveBeenCalledWith(dbUser) @@ -62,7 +61,6 @@ describe("/api/global/self", () => { const dbUser = (await config.getUser(user.email))! user._rev = dbUser._rev - user.dayPassRecordedAt = mocks.date.MOCK_DATE.toISOString() expect(dbUser.onboardedAt).toBe("2023-03-07T14:10:54.869Z") expect(dbUser.freeTrialConfirmedAt).toBe("2024-03-17T14:10:54.869Z") expect(res.body._id).toBe(user._id) diff --git a/yarn.lock b/yarn.lock index edf81d1f1e..90e41f0084 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4075,7 +4075,7 @@ resolved "https://registry.yarnpkg.com/@redis/time-series/-/time-series-1.0.4.tgz#af85eb080f6934580e4d3b58046026b6c2b18717" integrity sha512-ThUIgo2U/g7cCuZavucQTQzA9g9JbDDY2f64u3AbAoz/8vE2lt2U37LamDUVChhaDA3IRT9R6VvJwqnUfTJzng== -"@rollup/plugin-commonjs@^16.0.0": +"@rollup/plugin-commonjs@16.0.0", "@rollup/plugin-commonjs@^16.0.0": version "16.0.0" resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-16.0.0.tgz#169004d56cd0f0a1d0f35915d31a036b0efe281f" integrity sha512-LuNyypCP3msCGVQJ7ki8PqYdpjfEkE/xtFa5DqlF+7IBD0JsfMZ87C58heSwIMint58sAUZbt3ITqOmdQv/dXw== @@ -4153,7 +4153,7 @@ is-module "^1.0.0" resolve "^1.22.1" -"@rollup/plugin-replace@^5.0.3": +"@rollup/plugin-replace@^5.0.2", "@rollup/plugin-replace@^5.0.3": version "5.0.7" resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-5.0.7.tgz#150c9ee9db8031d9e4580a61a0edeaaed3d37687" integrity sha512-PqxSfuorkHz/SPpyngLyg5GCEkOcee9M1bkxiVDr41Pd61mqP1PLOoDPbpl44SB2mQGKwV/In74gqQmGITOhEQ== @@ -20226,16 +20226,7 @@ string-range@~1.2, string-range@~1.2.1: resolved "https://registry.yarnpkg.com/string-range/-/string-range-1.2.2.tgz#a893ed347e72299bc83befbbf2a692a8d239d5dd" integrity sha512-tYft6IFi8SjplJpxCUxyqisD3b+R2CSkomrtJYCkvuf1KuCAWgz7YXt4O0jip7efpfCemwHEzTEAO8EuOYgh3w== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -20327,7 +20318,7 @@ stringify-object@^3.2.1: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -20341,13 +20332,6 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2" @@ -22169,7 +22153,7 @@ worker-farm@1.7.0: dependencies: errno "~0.1.7" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -22187,15 +22171,6 @@ wrap-ansi@^5.1.0: string-width "^3.0.0" strip-ansi "^5.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"