From 88c46b0ff0e415ff4f8c9fd1a4e5458b4f996924 Mon Sep 17 00:00:00 2001 From: gostmkr24 Date: Tue, 1 Dec 2026 07:53:55 +0300 Subject: [PATCH 1/6] feat(vue): add @tryabby/vue integration package Adds a Vue 3 integration in packages/vue which consumes @tryabby/core and has the same feature surface as the React and Svelte integrations: - createAbby() with full type inference for tests, flags and remote config - AbbyPlugin (app.use), AbbyProvider component and provideAbby() for setup-scoped provisioning - composables: useAbby (variant + onAct, with optional lookup object), useFeatureFlag, useFeatureFlags, useRemoteConfig, useRemoteConfigVariables - non-reactive helpers: getFeatureFlagValue, getRemoteConfig, getABTestValue, getVariants, getABResetFunction, updateUserProperties - withDevtools() to mount the shared devtools - SSR support: an A/B variant is empty until the component is mounted and initialData can be passed to the plugin/provider - vitest test suite (29 tests): composables, plugin/provider isolation, SSR rendering, type tests and msw mocks - README, CHANGELOG, docs page (reference/vue) and a changeset Closes #68 --- .changeset/vue-integration.md | 5 + apps/docs/pages/reference/_meta.json | 1 + apps/docs/pages/reference/vue.mdx | 175 ++++++ packages/vue/.gitignore | 1 + packages/vue/CHANGELOG.md | 10 + packages/vue/README.md | 229 +++++++ packages/vue/package.json | 46 ++ packages/vue/src/StorageService.ts | 76 +++ packages/vue/src/createAbby.ts | 499 +++++++++++++++ packages/vue/src/index.ts | 7 + packages/vue/src/types.ts | 37 ++ packages/vue/tests/mocks/handlers.ts | 43 ++ packages/vue/tests/mocks/server.ts | 5 + packages/vue/tests/plugin.test.ts | 147 +++++ packages/vue/tests/setup.ts | 22 + packages/vue/tests/ssr.test.ts | 115 ++++ packages/vue/tests/types.test.ts | 174 ++++++ packages/vue/tests/useAbby.test.ts | 357 +++++++++++ packages/vue/tsconfig.json | 11 + packages/vue/tsup.config.ts | 10 + packages/vue/vite.config.ts | 13 + pnpm-lock.yaml | 867 ++++++++++++++++++--------- 22 files changed, 2550 insertions(+), 300 deletions(-) create mode 100644 .changeset/vue-integration.md create mode 100644 apps/docs/pages/reference/vue.mdx create mode 100644 packages/vue/.gitignore create mode 100644 packages/vue/CHANGELOG.md create mode 100644 packages/vue/README.md create mode 100644 packages/vue/package.json create mode 100644 packages/vue/src/StorageService.ts create mode 100644 packages/vue/src/createAbby.ts create mode 100644 packages/vue/src/index.ts create mode 100644 packages/vue/src/types.ts create mode 100644 packages/vue/tests/mocks/handlers.ts create mode 100644 packages/vue/tests/mocks/server.ts create mode 100644 packages/vue/tests/plugin.test.ts create mode 100644 packages/vue/tests/setup.ts create mode 100644 packages/vue/tests/ssr.test.ts create mode 100644 packages/vue/tests/types.test.ts create mode 100644 packages/vue/tests/useAbby.test.ts create mode 100644 packages/vue/tsconfig.json create mode 100644 packages/vue/tsup.config.ts create mode 100644 packages/vue/vite.config.ts diff --git a/.changeset/vue-integration.md b/.changeset/vue-integration.md new file mode 100644 index 00000000..d0e7f701 --- /dev/null +++ b/.changeset/vue-integration.md @@ -0,0 +1,5 @@ +--- +"@tryabby/vue": minor +--- + +Add the `@tryabby/vue` package: a Vue 3 integration with `createAbby`, `AbbyPlugin`, `AbbyProvider`, `provideAbby`, the `useAbby`, `useFeatureFlag`, `useRemoteConfig`, `useFeatureFlags` and `useRemoteConfigVariables` composables, the non-reactive helpers and full type tests. diff --git a/apps/docs/pages/reference/_meta.json b/apps/docs/pages/reference/_meta.json index ef26086c..aa93d31c 100644 --- a/apps/docs/pages/reference/_meta.json +++ b/apps/docs/pages/reference/_meta.json @@ -3,6 +3,7 @@ "react": "React", "remix": "Remix", "svelte": "Svelte", + "vue": "Vue", "angular": "Angular", "http": "HTTP API", "cli": "CLI", diff --git a/apps/docs/pages/reference/vue.mdx b/apps/docs/pages/reference/vue.mdx new file mode 100644 index 00000000..e246c736 --- /dev/null +++ b/apps/docs/pages/reference/vue.mdx @@ -0,0 +1,175 @@ +--- +title: Vue +description: The official Vue 3 integration for Abby +--- + +# Vue + +The `@tryabby/vue` package is the official [Vue 3](https://vuejs.org) integration for Abby. +It consumes [`@tryabby/core`](/reference/core) internally and has the same feature set as the +[React integration](/reference/react). + +## Installation + +```bash +pnpm add @tryabby/vue +``` + +## Setup + +```ts +// lib/abby.ts +import { createAbby } from "@tryabby/vue"; + +export const { + AbbyPlugin, + AbbyProvider, + provideAbby, + useAbby, + useFeatureFlag, + useRemoteConfig, + getFeatureFlagValue, + getRemoteConfig, + getABTestValue, + getABResetFunction, + getVariants, + updateUserProperties, + withDevtools, +} = createAbby({ + projectId: "YOUR_PROJECT_ID", + currentEnvironment: "production", + environments: ["development", "preview", "production"], + tests: { + "my-ab-test": { + variants: ["control", "variant-a"], + }, + }, + flags: ["my-feature-flag"], + remoteConfig: { + "my-string-variable": "String", + }, +}); +``` + +Install the plugin on your app: + +```ts +// main.ts +import { createApp } from "vue"; +import App from "./App.vue"; +import { AbbyPlugin } from "./lib/abby"; + +createApp(App).use(AbbyPlugin).mount("#app"); +``` + +If you already fetched the Abby data on the server, pass it to the plugin so no +request is made on the client: + +```ts +app.use(AbbyPlugin, { initialData: dataFromTheServer }); +``` + +You can also call `provideAbby({ initialData })` inside a `setup` function, or +render the `` component to scope the Abby +context to a subtree. + +## `useAbby` + +Returns the currently selected variant of an A/B test and the `onAct` function. + +```vue + + + +``` + +`variant` is a `ComputedRef` and is unwrapped automatically inside of templates. +It is an empty string until the component is mounted so that server side +rendering and hydration cannot mismatch. + +You can pass a lookup object as the second argument. The returned variant is then +the value of the selected variant and fully typed: + +```ts +const { variant } = useAbby("my-ab-test", { + control: "Hello", + "variant-a": "Bonjour", +}); +``` + +## `useFeatureFlag` + +```vue + + + +``` + +## `useRemoteConfig` + +```vue + + + +``` + +## `useFeatureFlags` and `useRemoteConfigVariables` + +Both return a `ComputedRef` with an array of `{ name, value }` objects for all +configured flags / remote config variables. + +## Non-reactive helpers + +The following helpers can be used outside of a component (for example in a +router guard or a store): + +- `getFeatureFlagValue(name)` – value of a feature flag +- `getRemoteConfig(name)` – value of a remote config variable +- `getABTestValue(name, lookup?)` – variant of an A/B test +- `getVariants(name)` – all variants of a test +- `getABResetFunction(name)` – returns a function which resets the stored variant +- `updateUserProperties(user)` – updates the user properties used by flag rules + +## Nuxt + +```ts +// plugins/abby.ts +import { AbbyPlugin } from "~/lib/abby"; + +export default defineNuxtPlugin((nuxtApp) => { + nuxtApp.vueApp.use(AbbyPlugin, { + initialData: nuxtApp.payload.data.abby, + }); +}); +``` + +## Devtools + +```ts +import DevtoolsFactory from "@tryabby/devtools"; +import { withDevtools } from "~/lib/abby"; + +export const AbbyDevtools = withDevtools(DevtoolsFactory); +``` + +Render `` once in your app. It is only rendered in development +mode unless `dangerouslyForceShow` is set. diff --git a/packages/vue/.gitignore b/packages/vue/.gitignore new file mode 100644 index 00000000..b7d05e3c --- /dev/null +++ b/packages/vue/.gitignore @@ -0,0 +1 @@ +dist diff --git a/packages/vue/CHANGELOG.md b/packages/vue/CHANGELOG.md new file mode 100644 index 00000000..e63af334 --- /dev/null +++ b/packages/vue/CHANGELOG.md @@ -0,0 +1,10 @@ +# @tryabby/vue + +## 0.1.0 + +### Minor Changes + +- initial release of the Vue 3 integration (`createAbby`, `AbbyPlugin`, + `AbbyProvider`, `provideAbby`, `useAbby`, `useFeatureFlag`, + `useRemoteConfig`, `useFeatureFlags`, `useRemoteConfigVariables` and the + non-reactive helpers) diff --git a/packages/vue/README.md b/packages/vue/README.md new file mode 100644 index 00000000..810cfc45 --- /dev/null +++ b/packages/vue/README.md @@ -0,0 +1,229 @@ +# @tryabby/vue + +The official [Vue 3](https://vuejs.org) integration for [Abby](https://tryabby.com). +It has feature parity with the [React integration](../react) and consumes +[`@tryabby/core`](../core) internally, so it works the same way: + +- `useAbby` – returns the currently selected variant of an A/B test and `onAct` +- `useFeatureFlag` – returns the value of a feature flag +- `useRemoteConfig` – returns the value of a remote config variable + +Everything is fully typed. The names of your tests, flags and remote config +variables are inferred from the config you pass to `createAbby`. + +## Installation + +```bash +pnpm add @tryabby/vue +``` + +## Usage + +### 1. Create the Abby instance + +```ts +// lib/abby.ts +import { createAbby } from "@tryabby/vue"; + +export const { + AbbyPlugin, + AbbyProvider, + provideAbby, + useAbby, + useFeatureFlag, + useRemoteConfig, + useFeatureFlags, + useRemoteConfigVariables, + getFeatureFlagValue, + getRemoteConfig, + getABTestValue, + getABResetFunction, + getVariants, + updateUserProperties, + withDevtools, +} = createAbby({ + projectId: "YOUR_PROJECT_ID", + currentEnvironment: "production", + environments: ["development", "preview", "production"], + tests: { + "my-ab-test": { + variants: ["control", "variant-a", "variant-b"], + }, + }, + flags: ["my-feature-flag"], + remoteConfig: { + "my-string-variable": "String", + }, +}); +``` + +### 2. Install the plugin + +```ts +// main.ts +import { createApp } from "vue"; +import App from "./App.vue"; +import { AbbyPlugin } from "./lib/abby"; + +createApp(App).use(AbbyPlugin).mount("#app"); +``` + +The plugin fetches the project data on startup. If the data was already +fetched on the server, pass it to the plugin instead: + +```ts +app.use(AbbyPlugin, { initialData: fetchedOnTheServer }); +``` + +`provideAbby()` does the same thing but can be called inside any `setup` +function. `` is a component which provides the context to its +subtree only – useful when you want the data to be scoped: + +```vue + + + +``` + +### `createAbby` + +#### Parameters + +| Name | Type | Required | Description | +| -------------------- | -------- | :------: | -------------------------------------------------------------------- | +| `projectId` | `string` | ✅ | The ID of your project in Abby | +| `currentEnvironment` | `string` | ✅ | The current environment of your application | +| `environments` | `Array` | ✅ | All environments of your application | +| `apiUrl` | `string` | | The URL of the Abby API. Defaults to the hosted version | +| `tests` | `object` | | An object containing your defined A/B tests | +| `flags` | `Array` | | An array containing the names of your defined feature flags | +| `remoteConfig` | `object` | | An object containing your defined remote config variables | +| `settings` | `object` | | Additional settings (default values, dev overrides, fallbacks, ...) | +| `user` | `object` | | Validators for the user properties used in flag rules | + +#### Return values + +| Name | Description | +| --------------------------- | ----------------------------------------------------------------------------- | +| `AbbyPlugin` | The Vue plugin (`app.use(AbbyPlugin)`) | +| `AbbyProvider` | Component which provides the Abby context to its subtree | +| `provideAbby` | Provides the Abby context from inside a `setup` function | +| `useAbby` | Composable which returns the selected variant and `onAct` of a test | +| `useFeatureFlag` | Composable which returns the value of a feature flag | +| `useFeatureFlags` | Composable which returns all flags with their values | +| `useRemoteConfig` | Composable which returns the value of a remote config variable | +| `useRemoteConfigVariables` | Composable which returns all remote config variables with their values | +| `getFeatureFlagValue` | Non-reactive getter for a feature flag | +| `getRemoteConfig` | Non-reactive getter for a remote config variable | +| `getABTestValue` | Non-reactive getter for the variant of a test | +| `getABResetFunction` | Returns a function which resets the stored variant of a test | +| `getVariants` | Returns all variants of a test | +| `updateUserProperties` | Updates the user properties which are used by the flag rules | +| `withDevtools` | Creates a component which mounts the Abby devtools | + +### `useAbby` + +```vue + + + +``` + +#### Parameters + +- `name`: The name of the test. Needs to be one of the configured tests. +- `lookup` (optional): An object which maps every variant to a value. The + returned `variant` is then the value of the selected variant. + +#### Return values + +- `variant`: `ComputedRef` with the selected variant. It is an empty string + until the component is mounted, so that server side rendering and hydration + don't mismatch. +- `onAct`: A function which should be called when the user performs the action + which is relevant for the test. + +> Vue unwraps refs in templates automatically, so `variant` can be used +> directly in the template. Inside of Javascript you need `variant.value`. + +### `useFeatureFlag` + +```vue + + + +``` + +### `useRemoteConfig` + +```vue + + + +``` + +### Nuxt + +Create a plugin which installs the Abby plugin. If you want to render the +values on the server as well, fetch the data in your plugin and pass it as +`initialData`: + +```ts +// plugins/abby.ts +import { AbbyPlugin } from "~/lib/abby"; + +export default defineNuxtPlugin((nuxtApp) => { + nuxtApp.vueApp.use(AbbyPlugin, { + initialData: nuxtApp.payload.data.abby, + }); +}); +``` + +### Devtools + +The devtools are framework agnostic, so you can reuse them: + +```ts +import DevtoolsFactory from "@tryabby/devtools"; +import { withDevtools } from "~/lib/abby"; + +export const AbbyDevtools = withDevtools(DevtoolsFactory, { + dangerouslyForceShow: false, +}); +``` + +Then render `` once in your app. It only shows up in +development mode (or when `dangerouslyForceShow` is set). + +## Tests + +```bash +pnpm --filter @tryabby/vue test +``` diff --git a/packages/vue/package.json b/packages/vue/package.json new file mode 100644 index 00000000..87b8b4d1 --- /dev/null +++ b/packages/vue/package.json @@ -0,0 +1,46 @@ +{ + "name": "@tryabby/vue", + "version": "0.1.0", + "description": "Vue 3 integration for Abby (A/B testing, feature flags and remote config)", + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", + "files": ["dist"], + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.js" + } + }, + "scripts": { + "build": "tsup src/", + "dev": "pnpm run build --watch", + "test": "vitest" + }, + "homepage": "https://docs.tryabby.com", + "keywords": ["vue", "nuxt", "ab-testing", "feature-flags", "remote-config", "abby"], + "author": "", + "license": "ISC", + "devDependencies": { + "@types/js-cookie": "^3.0.3", + "@vitejs/plugin-vue": "^5.2.1", + "@vue/test-utils": "^2.4.6", + "jsdom": "^20.0.3", + "msw": "^0.49.1", + "node-fetch": "^3.3.0", + "tsconfig": "workspace:*", + "tsup": "^6.5.0", + "typescript": "5.5.4", + "vite": "5.4.0", + "vitest": "2.0.5", + "vue": "^3.5.13" + }, + "peerDependencies": { + "vue": "^3.3.0" + }, + "dependencies": { + "@tryabby/core": "workspace:*", + "js-cookie": "^3.0.5" + } +} diff --git a/packages/vue/src/StorageService.ts b/packages/vue/src/StorageService.ts new file mode 100644 index 00000000..7633105e --- /dev/null +++ b/packages/vue/src/StorageService.ts @@ -0,0 +1,76 @@ +import { + type IStorageService, + type StorageServiceOptions, + getABStorageKey, + getFFStorageKey, + getRCStorageKey, +} from "@tryabby/core"; +import Cookie from "js-cookie"; + +const DEFAULT_COOKIE_AGE = 365; + +class ABStorageService implements IStorageService { + get(projectId: string, testName: string): string | null { + const retrievedValue = Cookie.get(getABStorageKey(projectId, testName)); + if (!retrievedValue) return null; + + return retrievedValue; + } + + set( + projectId: string, + testName: string, + value: string, + options?: StorageServiceOptions + ): void { + Cookie.set(getABStorageKey(projectId, testName), value, { + expires: options?.expiresInDays + ? options.expiresInDays + : DEFAULT_COOKIE_AGE, + }); + } + + remove(projectId: string, testName: string): void { + Cookie.remove(getABStorageKey(projectId, testName)); + } +} + +class FFStorageService implements IStorageService { + get(projectId: string, flagName: string): string | null { + const retrievedValue = Cookie.get(getFFStorageKey(projectId, flagName)); + if (!retrievedValue) return null; + + return retrievedValue; + } + + set(projectId: string, flagName: string, value: string): void { + Cookie.set(getFFStorageKey(projectId, flagName), value, { + expires: DEFAULT_COOKIE_AGE, + }); + } + + remove(projectId: string, flagName: string): void { + Cookie.remove(getFFStorageKey(projectId, flagName)); + } +} + +class RCStorageService implements IStorageService { + get(projectId: string, key: string): string | null { + const retrievedValue = Cookie.get(getRCStorageKey(projectId, key)); + return retrievedValue ?? null; + } + + set(projectId: string, key: string, value: string): void { + Cookie.set(getRCStorageKey(projectId, key), value, { + expires: DEFAULT_COOKIE_AGE, + }); + } + + remove(projectId: string, key: string): void { + Cookie.remove(getRCStorageKey(projectId, key)); + } +} + +export const TestStorageService = new ABStorageService(); +export const FlagStorageService = new FFStorageService(); +export const RemoteConfigStorageService = new RCStorageService(); diff --git a/packages/vue/src/createAbby.ts b/packages/vue/src/createAbby.ts new file mode 100644 index 00000000..696c95d1 --- /dev/null +++ b/packages/vue/src/createAbby.ts @@ -0,0 +1,499 @@ +import { + type ABConfig, + Abby, + type AbbyConfig, + type AbbyDataResponse, + AbbyEventType, + getDefaultRemoteConfigValue, + HttpService, + type RemoteConfigValue, + type RemoteConfigValueString, + type RemoteConfigValueStringToType, + type ValidatorType, +} from "@tryabby/core"; +import type { Infer } from "@tryabby/core/validation"; +import { + type App, + type Component, + computed, + type ComputedRef, + type InjectionKey, + defineComponent, + inject, + onMounted, + onUnmounted, + type Plugin, + provide, + ref, + type ShallowRef, + shallowRef, + watch, +} from "vue"; +import { + FlagStorageService, + RemoteConfigStorageService, + TestStorageService, +} from "./StorageService"; +import type { + ABTestReturnValue, + AbbyDevtoolProps, + DevtoolsFactory, + withDevtoolsFunction, +} from "./types"; + +export type { ABTestReturnValue, withDevtoolsFunction } from "./types"; + +/** + * Options which can be passed to the plugin (`app.use(AbbyPlugin, options)`) + * or to `provideAbby(options)`. + */ +export type AbbyProviderOptions = { + /** + * Data (weights, flags, remote config) which was already fetched on the + * server. When given, no request is made on the client. + */ + initialData?: AbbyDataResponse; +}; + +export function createAbby< + const FlagName extends string, + const TestName extends string, + const Tests extends Record, + const RemoteConfig extends Record, + const RemoteConfigName extends Extract, + const User extends Record = Record< + string, + ValidatorType + >, +>( + abbyConfig: AbbyConfig< + FlagName, + Tests, + string[], + RemoteConfigName, + RemoteConfig, + User + > +) { + // we need to return the config as a const so that the types are narrowed + const config = abbyConfig; + + const abby = new Abby< + FlagName, + TestName, + Tests, + RemoteConfig, + RemoteConfigName, + string[], + User + >( + config, + { + get: (key: string) => { + if (typeof window === "undefined") return null; + return TestStorageService.get(config.projectId, key); + }, + set: (key: string, value: any) => { + if (typeof window === "undefined" || config.cookies?.disableByDefault) + return; + TestStorageService.set(config.projectId, key, value); + }, + }, + { + get: (key: string) => { + if (typeof window === "undefined") return null; + return FlagStorageService.get(config.projectId, key); + }, + set: (key: string, value: any) => { + if (typeof window === "undefined") return; + FlagStorageService.set(config.projectId, key, value); + }, + }, + { + get: (key: string) => { + if (typeof window === "undefined") return null; + return RemoteConfigStorageService.get(config.projectId, key); + }, + set: (key: string, value: any) => { + if (typeof window === "undefined") return; + RemoteConfigStorageService.set(config.projectId, key, value); + }, + } + ); + + type AbbyProjectData = ReturnType; + + type AbbyContext = { + abby: typeof abby; + data: ShallowRef; + config: typeof config; + }; + + /** + * The reactive project data. Every component which injects the Abby context + * shares this ref, so updates (for example from the devtools) are reflected + * everywhere. + */ + const data = shallowRef(abby.getProjectData()); + + abby.subscribe((newData) => { + data.value = newData as AbbyProjectData; + }); + + let dataRequested = false; + + const ensureData = (initialData?: AbbyDataResponse) => { + if (initialData) { + abby.init(initialData); + dataRequested = true; + return; + } + if (dataRequested) return; + dataRequested = true; + void abby.loadProjectData(); + }; + + // every createAbby() call gets its own injection key, so multiple Abby + // instances can live in the same app without clashing + const ABBY_INJECTION_KEY = Symbol("abby"); + + const context: AbbyContext = { abby, data, config }; + + const useAbbyContext = (): AbbyContext => { + const injected = inject( + ABBY_INJECTION_KEY as unknown as InjectionKey, + null + ); + + if (!injected) { + throw new Error( + "Abby is not installed. Call app.use(AbbyPlugin) or call provideAbby() in a parent component before using the Abby composables." + ); + } + + return injected; + }; + + /** + * Provides the Abby context for the current component tree. Must be called + * inside of a setup function. + */ + const provideAbby = (options?: AbbyProviderOptions) => { + ensureData(options?.initialData); + provide(ABBY_INJECTION_KEY as unknown as InjectionKey, context); + }; + + /** + * The Vue plugin. Call `app.use(AbbyPlugin)` to make the composables + * available in every component. + */ + const AbbyPlugin: Plugin<[AbbyProviderOptions?]> = { + install(app: App, options?: AbbyProviderOptions) { + ensureData(options?.initialData); + app.provide(ABBY_INJECTION_KEY as unknown as InjectionKey, context); + }, + }; + + /** + * Component which provides the Abby context to its subtree. + * Handy when you want the context to be scoped instead of app wide or when + * you want to pass data which was fetched on the server. + */ + const AbbyProvider = defineComponent({ + name: "AbbyProvider", + props: { + initialData: { + type: Object as () => AbbyDataResponse | undefined, + required: false, + default: undefined, + }, + }, + setup(props, { slots }) { + provideAbby({ initialData: props.initialData }); + return () => slots.default?.() ?? null; + }, + }); + + /** + * Returns the raw (reactive) Abby project data. + */ + const useAbbyData = () => useAbbyContext().data; + + const useMounted = () => { + const isMounted = ref(false); + onMounted(() => { + isMounted.value = true; + }); + return isMounted; + }; + + const useAbby = < + K extends keyof Tests, + TestVariant extends Tests[K]["variants"][number], + LookupValue, + const Lookup extends + | Record + | undefined = undefined, + >( + name: K, + lookupObject?: Lookup + ): { + variant: ComputedRef>; + onAct: () => void; + } => { + const { data } = useAbbyContext(); + const isMounted = useMounted(); + + // always return an empty string on the server (and on the first render of + // the client) to avoid hydration mismatches, because the server does not + // know which variant the current user has + const selectedVariant = computed(() => { + if (typeof window === "undefined" || !isMounted.value) return ""; + return ( + data.value.tests[name as unknown as TestName]?.selectedVariant ?? "" + ); + }); + + const variant = computed>(() => { + const raw = selectedVariant.value; + if (!raw) { + // the empty string is only returned before the component is mounted + return "" as ABTestReturnValue; + } + return ( + lookupObject ? (lookupObject as any)[raw] : raw + ) as ABTestReturnValue; + }); + + // ping the server as soon as we know which variant is rendered + watch( + selectedVariant, + (newVariant) => { + if (!newVariant) return; + + HttpService.sendData({ + url: config.apiUrl, + type: AbbyEventType.PING, + data: { + projectId: config.projectId, + selectedVariant: newVariant, + testName: name as string, + }, + }); + }, + { immediate: true } + ); + + const onAct = () => { + const currentVariant = selectedVariant.value; + if (!currentVariant) return; + + HttpService.sendData({ + url: config.apiUrl, + type: AbbyEventType.ACT, + data: { + projectId: config.projectId, + selectedVariant: currentVariant, + testName: name as string, + }, + }); + }; + + return { + /** + * The currently selected variant of the test (or the value of the + * lookup object for the selected variant). Empty until the component + * is mounted. + */ + variant, + /** + * Call this function to indicate that the user performed an action + * which belongs to the test. + */ + onAct, + }; + }; + + const useFeatureFlag = (name: FlagName) => { + const { data } = useAbbyContext(); + return computed(() => { + // fall back to the core implementation when the server did not send + // a value for this flag (for example when it was added later on) + const entry = data.value.flags[name]; + return entry ? entry.value : abby.getFeatureFlag(name); + }); + }; + + /** + * Returns an Array of all flags with their name and value + */ + const useFeatureFlags = () => { + const { data } = useAbbyContext(); + return computed>(() => + (Object.keys(data.value.flags) as Array).map((flagName) => ({ + name: flagName, + value: data.value.flags[flagName].value, + })) + ); + }; + + const useRemoteConfig = < + T extends RemoteConfigName, + Config extends RemoteConfig[T], + >( + remoteConfigName: T + ) => { + const { data } = useAbbyContext(); + return computed>(() => { + const entry = data.value.remoteConfig[remoteConfigName]; + if (entry) return entry.value as RemoteConfigValueStringToType; + + // the server did not send a value for this variable (for example + // because it was added later on), so we use the configured default + const remoteConfigType = config.remoteConfig?.[remoteConfigName]; + if (!remoteConfigType) { + return getDefaultRemoteConfigValue("String") as RemoteConfigValueStringToType; + } + + const configuredDefault = + config.settings?.remoteConfig?.defaultValues?.[remoteConfigType]; + + return (configuredDefault ?? + getDefaultRemoteConfigValue( + remoteConfigType + )) as RemoteConfigValueStringToType; + }); + }; + + /** + * Returns an Array of all remote config variables with their name and value + */ + const useRemoteConfigVariables = () => { + const { data } = useAbbyContext(); + return computed< + Array<{ + name: RemoteConfigName; + value: RemoteConfigValueStringToType; + }> + >(() => + ( + Object.keys(data.value.remoteConfig) as Array + ).map((configName) => ({ + name: configName, + value: data.value.remoteConfig[configName].value, + })) as Array<{ + name: RemoteConfigName; + value: RemoteConfigValueStringToType; + }> + ); + }; + + const getFeatureFlagValue = (name: FlagName) => { + return abby.getFeatureFlag(name); + }; + + const getRemoteConfig = < + T extends RemoteConfigName, + Config extends RemoteConfig[T], + >( + remoteConfigName: T + ): RemoteConfigValueStringToType => { + return abby.getRemoteConfig(remoteConfigName); + }; + + const getABTestValue = < + TestName extends keyof Tests, + TestVariant extends Tests[TestName]["variants"][number], + LookupValue, + const Lookup extends + | Record + | undefined = undefined, + >( + testName: TestName, + lookupObject?: Lookup + ): ABTestReturnValue => { + const variant = abby.getTestVariant(testName); + if (lookupObject === undefined) { + return variant as any; + } + return lookupObject[variant as TestVariant] as any; + }; + + const withDevtools: withDevtoolsFunction = (factory, props) => { + return defineComponent({ + name: "AbbyDevtools", + setup() { + let destroy: (() => void) | null = null; + + onMounted(() => { + if ( + !props?.dangerouslyForceShow && + process.env.NODE_ENV !== "development" + ) { + return; + } + + destroy = factory.create({ + ...(props as AbbyDevtoolProps), + abby, + }); + }); + + onUnmounted(() => { + destroy?.(); + destroy = null; + }); + + return () => null; + }, + }) as Component; + }; + + /** + * Simple helper function create a function that resets an AB test + * @param name the name of the test + * @returns A function that can be called to reset the test + */ + const getABResetFunction = (name: T) => { + return () => { + TestStorageService.remove(config.projectId, name as string); + }; + }; + + /** + * Simple helper function to get a list of all variants for a given test + * @param name the name of the test + * @returns an array of all variants + */ + const getVariants = (name: T) => { + return abby.getVariants(name); + }; + + const updateUserProperties = ( + user: Partial<{ + -readonly [K in keyof User]: Infer; + }> + ) => { + abby.updateUserProperties(user); + }; + + return { + AbbyPlugin, + AbbyProvider, + provideAbby, + useAbby, + useAbbyData, + useFeatureFlag, + useFeatureFlags, + useRemoteConfig, + useRemoteConfigVariables, + getFeatureFlagValue, + getRemoteConfig, + getABTestValue, + getABResetFunction, + getVariants, + updateUserProperties, + withDevtools, + __abby__: abby, + }; +} diff --git a/packages/vue/src/index.ts b/packages/vue/src/index.ts new file mode 100644 index 00000000..82518cfe --- /dev/null +++ b/packages/vue/src/index.ts @@ -0,0 +1,7 @@ +export { + createAbby, + type AbbyProviderOptions, + type ABTestReturnValue, + type withDevtoolsFunction, +} from "./createAbby"; +export { type ABConfig, type AbbyConfig, defineConfig } from "@tryabby/core"; diff --git a/packages/vue/src/types.ts b/packages/vue/src/types.ts new file mode 100644 index 00000000..4b2d6e79 --- /dev/null +++ b/packages/vue/src/types.ts @@ -0,0 +1,37 @@ +import type { Component } from "vue"; + +/** + * Resolves the value which is returned by `useAbby`. + * If a lookup object is given, the value of the currently selected key is + * returned, otherwise the plain variant is returned. + */ +export type ABTestReturnValue = Lookup extends undefined + ? TestVariant + : TestVariant extends keyof Lookup + ? Lookup[TestVariant] + : never; + +/** + * Structural type of a devtools factory (as exported by `@tryabby/devtools`). + * We only rely on the shape so that this package does not need to depend on + * the devtools package or on its Svelte runtime. + */ +export type DevtoolsFactory = { + create: (props: any) => () => void; +}; + +export type AbbyDevtoolProps = { + abby: unknown; + dangerouslyForceShow?: boolean; +}; + +/** + * This function can be used to create a Vue component which mounts the + * devtools when the app runs in development mode. + */ +export type withDevtoolsFunction = ( + factory: DevtoolsFactory, + props?: Omit & { + dangerouslyForceShow?: boolean; + } +) => Component; diff --git a/packages/vue/tests/mocks/handlers.ts b/packages/vue/tests/mocks/handlers.ts new file mode 100644 index 00000000..b1fde5e2 --- /dev/null +++ b/packages/vue/tests/mocks/handlers.ts @@ -0,0 +1,43 @@ +import { ABBY_BASE_URL, type AbbyDataResponse } from "@tryabby/core"; +import { rest } from "msw"; + +const returnData: AbbyDataResponse = { + tests: [ + { + name: "test", + weights: [1, 1, 1, 1], + }, + { + name: "test2", + weights: [1, 0], + }, + ], + flags: [ + { + name: "flag1", + value: true, + }, + { + name: "flag2", + value: false, + }, + ], + remoteConfig: [ + { + name: "remoteConfig1", + value: "FooBar", + }, + ], +}; + +export const handlers = [ + rest.get( + `${ABBY_BASE_URL}api/dashboard/:projectId/data`, + (_req, res, ctx) => { + return res(ctx.json(returnData)); + } + ), + rest.get(`${ABBY_BASE_URL}api/v2/data/:projectId`, (_req, res, ctx) => { + return res(ctx.json(returnData)); + }), +]; diff --git a/packages/vue/tests/mocks/server.ts b/packages/vue/tests/mocks/server.ts new file mode 100644 index 00000000..9bb8a870 --- /dev/null +++ b/packages/vue/tests/mocks/server.ts @@ -0,0 +1,5 @@ +import { setupServer } from "msw/node"; +import { handlers } from "./handlers"; + +// This configures a request mocking server with the given request handlers. +export const server = setupServer(...handlers); diff --git a/packages/vue/tests/plugin.test.ts b/packages/vue/tests/plugin.test.ts new file mode 100644 index 00000000..802ac815 --- /dev/null +++ b/packages/vue/tests/plugin.test.ts @@ -0,0 +1,147 @@ +import { flushPromises, mount } from "@vue/test-utils"; +import { defineComponent, h, nextTick } from "vue"; +import { createAbby } from "../src"; + +const config = { + environments: [""], + currentEnvironment: "", + projectId: "123", + tests: { + test: { variants: ["A", "B"] as const }, + }, + flags: ["flag1"], +}; + +describe("AbbyPlugin", () => { + it("provides the context for all components", async () => { + const abby = createAbby(config); + + const Component = defineComponent({ + setup() { + const { variant } = abby.useAbby("test"); + const flag = abby.useFeatureFlag("flag1"); + return () => h("div", `${variant.value}-${flag.value}`); + }, + }); + + const wrapper = mount(Component, { + global: { + plugins: [ + { + install: (app) => abby.AbbyPlugin.install(app), + }, + ], + }, + }); + + await flushPromises(); + await nextTick(); + await nextTick(); + + // variant is A or B and the flag was fetched from the mocked API + expect(["A-true", "B-true"]).toContain(wrapper.text()); + }); + + it("throws a helpful error when the plugin is missing", () => { + const abby = createAbby(config); + + // Vue swallows errors which are thrown inside of a setup function, + // so we check the context resolution directly + expect(() => abby.useAbby("test")).toThrowError(/Abby is not installed/i); + }); + + it("throws a helpful error when a component is mounted without the plugin", () => { + const abby = createAbby(config); + + const Component = defineComponent({ + setup() { + abby.useAbby("test"); + return () => h("div", "never rendered"); + }, + }); + + expect(() => mount(Component)).toThrowError(/Abby is not installed/i); + }); +}); + +describe("AbbyProvider", () => { + it("can be used to scope the context", async () => { + const abby = createAbby(config); + + const Child = defineComponent({ + setup() { + const { variant } = abby.useAbby("test"); + return () => h("span", variant.value); + }, + }); + + const wrapper = mount(abby.AbbyProvider, { + slots: { + default: () => h(Child), + }, + }); + + await flushPromises(); + await nextTick(); + await nextTick(); + + expect(["A", "B"]).toContain(wrapper.text()); + }); + + it("uses initialData instead of fetching", async () => { + const abby = createAbby(config); + + const Child = defineComponent({ + setup() { + const flag = abby.useFeatureFlag("flag1"); + return () => h("span", String(flag.value)); + }, + }); + + const wrapper = mount(abby.AbbyProvider, { + props: { + initialData: { + flags: [{ name: "flag1", value: true }], + tests: [], + remoteConfig: [], + }, + }, + slots: { + default: () => h(Child), + }, + }); + + await flushPromises(); + + expect(wrapper.text()).toEqual("true"); + }); +}); + +describe("provideAbby", () => { + it("provides the context from within a setup function", async () => { + const abby = createAbby(config); + + const Child = defineComponent({ + setup() { + const flag = abby.useFeatureFlag("flag1"); + return () => h("span", String(flag.value)); + }, + }); + + const Parent = defineComponent({ + setup(_, { slots }) { + abby.provideAbby(); + return () => h("div", slots.default?.()); + }, + }); + + const wrapper = mount(Parent, { + slots: { default: () => h(Child) }, + }); + + await flushPromises(); + await nextTick(); + + expect(wrapper.text()).toMatch(/true|false/); + }); +}); diff --git a/packages/vue/tests/setup.ts b/packages/vue/tests/setup.ts new file mode 100644 index 00000000..82f83b79 --- /dev/null +++ b/packages/vue/tests/setup.ts @@ -0,0 +1,22 @@ +import fetch from "node-fetch"; +import { afterAll, afterEach, beforeAll } from "vitest"; +import { server } from "./mocks/server"; + +// @ts-expect-error node-fetch is not 100% compatible with the DOM types +global.fetch = fetch; + +beforeAll(() => server.listen({ onUnhandledRequest: "bypass" })); + +afterAll(() => server.close()); + +afterEach(() => { + server.resetHandlers(); + // reset the cookies which were written by the Abby core + // biome-ignore lint/suspicious/noDocumentCookie:> + for (const cookie of document.cookie.split(";")) { + const name = cookie.split("=")[0]?.trim(); + if (name) { + document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`; + } + } +}); diff --git a/packages/vue/tests/ssr.test.ts b/packages/vue/tests/ssr.test.ts new file mode 100644 index 00000000..09a5b56b --- /dev/null +++ b/packages/vue/tests/ssr.test.ts @@ -0,0 +1,115 @@ +import { createSSRApp, defineComponent, h } from "vue"; +import { renderToString } from "vue/server-renderer"; +import { createAbby } from "../src"; + +describe("useAbby", () => { + it("doesn't render a variant on the server", async () => { + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + tests: { + showFooter: { + variants: ["current", "new"] as const, + }, + }, + }); + + const ComponentWithABTest = defineComponent({ + setup() { + const { variant } = abby.useAbby("showFooter"); + return () => { + if (variant.value === "") return h("span", "SSR!"); + if (variant.value === "current") return h("span", "Secret"); + return h("span", "Very Secret"); + }; + }, + }); + + const app = createSSRApp(ComponentWithABTest); + app.use(abby.AbbyPlugin, { + initialData: { + flags: [], + tests: [{ name: "showFooter", weights: [0.5, 0.5] }], + remoteConfig: [], + }, + }); + + const html = await renderToString(app); + + expect(html).toContain("SSR!"); + expect(html).not.toContain("Secret"); + expect(html).not.toContain("Very Secret"); + }); +}); + +describe("useFeatureFlag", () => { + it("renders the correct feature flag on the server", async () => { + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + flags: ["test", "test2"], + }); + + const ComponentWithFF = defineComponent({ + setup() { + const test = abby.useFeatureFlag("test"); + const test2 = abby.useFeatureFlag("test2"); + return () => + h("div", [ + test.value ? h("span", "Secret") : null, + test2.value ? h("span", "SUPER SECRET") : null, + ]); + }, + }); + + const app = createSSRApp(ComponentWithFF); + app.use(abby.AbbyPlugin, { + initialData: { + flags: [ + { value: true, name: "test" }, + { value: false, name: "test2" }, + ], + tests: [], + remoteConfig: [], + }, + }); + + const html = await renderToString(app); + + expect(html).toContain("Secret"); + expect(html).not.toContain("SUPER SECRET"); + }); +}); + +describe("useRemoteConfig", () => { + it("renders the correct remote config value on the server", async () => { + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + remoteConfig: { remoteConfig1: "String" }, + }); + + const ComponentWithRC = defineComponent({ + setup() { + const remoteConfig1 = abby.useRemoteConfig("remoteConfig1"); + return () => h("span", String(remoteConfig1.value)); + }, + }); + + const app = createSSRApp(ComponentWithRC); + app.use(abby.AbbyPlugin, { + initialData: { + flags: [], + tests: [], + remoteConfig: [{ name: "remoteConfig1", value: "FooBar" }], + }, + }); + + const html = await renderToString(app); + + expect(html).toContain("FooBar"); + }); +}); diff --git a/packages/vue/tests/types.test.ts b/packages/vue/tests/types.test.ts new file mode 100644 index 00000000..8656f812 --- /dev/null +++ b/packages/vue/tests/types.test.ts @@ -0,0 +1,174 @@ +import { flushPromises, mount } from "@vue/test-utils"; +import { defineComponent, h, nextTick } from "vue"; +import { createAbby } from "../src"; + +async function mountWithAbby(component: ReturnType, abby: ReturnType) { + const wrapper = mount(component, { + global: { + plugins: [ + { + install: (app) => abby.AbbyPlugin.install(app), + }, + ], + }, + }); + await flushPromises(); + await nextTick(); + await nextTick(); + return wrapper; +} + +describe("useAbby", () => { + it("returns the correct types", async () => { + const test2Variants = [ + "SimonsText", + "MatthiasText", + "TomsText", + "TimsText", + ] as const; + + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + tests: { + test: { variants: ["ONLY_ONE_VARIANT"] }, + test2: { + variants: test2Variants, + }, + }, + }); + + const TestComponent = defineComponent({ + setup() { + const { variant } = abby.useAbby("test"); + assertType<"ONLY_ONE_VARIANT" | "">(variant.value); + return () => h("div", variant.value); + }, + }); + + const Test2Component = defineComponent({ + setup() { + const { variant } = abby.useAbby("test2"); + assertType<(typeof test2Variants)[number] | "">(variant.value); + return () => h("div", variant.value); + }, + }); + + const wrapper = await mountWithAbby(TestComponent, abby); + expect(wrapper.text()).toBeDefined(); + + const wrapper2 = await mountWithAbby(Test2Component, abby); + expect(wrapper2.text()).toBeDefined(); + }); + + it("has the correct types for the lookup object", async () => { + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + tests: { + test: { variants: ["A", "B", "C"] as const }, + }, + }); + + const Component = defineComponent({ + setup() { + const { variant } = abby.useAbby("test", { + A: "Hello", + B: "Bonjour", + C: "Hola", + }); + expectTypeOf(variant.value).toEqualTypeOf< + "Hello" | "Bonjour" | "Hola" | "" + >(); + return () => h("div", variant.value); + }, + }); + + await mountWithAbby(Component, abby); + }); +}); + +describe("useFeatureFlag", () => { + it("returns the correct types", async () => { + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + flags: ["test"], + }); + + expectTypeOf(abby.useFeatureFlag).parameter(0).toEqualTypeOf<"test">(); + + const Component = defineComponent({ + setup() { + const flag = abby.useFeatureFlag("test"); + expectTypeOf(flag.value).toEqualTypeOf(); + return () => h("div", String(flag.value)); + }, + }); + + await mountWithAbby(Component, abby); + }); +}); + +describe("useRemoteConfig", () => { + it("uses the correct typings", async () => { + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + remoteConfig: { + stringRc: "String", + numberRc: "Number", + jsonRc: "JSON", + }, + }); + + expectTypeOf(abby.useRemoteConfig) + .parameter(0) + .toEqualTypeOf<"stringRc" | "numberRc" | "jsonRc">(); + + expectTypeOf(abby.getRemoteConfig("stringRc")).toEqualTypeOf(); + expectTypeOf(abby.getRemoteConfig("numberRc")).toEqualTypeOf(); + expectTypeOf(abby.getRemoteConfig("jsonRc")).toEqualTypeOf< + Record + >(); + + const Component = defineComponent({ + setup() { + const stringRc = abby.useRemoteConfig("stringRc"); + const numberRc = abby.useRemoteConfig("numberRc"); + const jsonRc = abby.useRemoteConfig("jsonRc"); + + expectTypeOf(stringRc.value).toEqualTypeOf(); + expectTypeOf(numberRc.value).toEqualTypeOf(); + expectTypeOf(jsonRc.value).toEqualTypeOf>(); + + return () => h("div", String(stringRc.value)); + }, + }); + + await mountWithAbby(Component, abby); + }); +}); + +describe("getVariants", () => { + it("has the correct types", () => { + const abby = createAbby({ + environments: [], + projectId: "123", + currentEnvironment: "test", + tests: { + test: { + variants: ["ONLY_ONE_VARIANT"], + }, + }, + }); + + expectTypeOf(abby.getVariants("test")).toEqualTypeOf< + readonly ["ONLY_ONE_VARIANT"] + >(); + }); +}); diff --git a/packages/vue/tests/useAbby.test.ts b/packages/vue/tests/useAbby.test.ts new file mode 100644 index 00000000..6b059d65 --- /dev/null +++ b/packages/vue/tests/useAbby.test.ts @@ -0,0 +1,357 @@ +import { flushPromises, mount } from "@vue/test-utils"; +import { AbbyEventType, HttpService } from "@tryabby/core"; +import { defineComponent, h, nextTick } from "vue"; +import { createAbby } from "../src"; +import { TestStorageService } from "../src/StorageService"; + +const OLD_ENV = process.env; + +beforeEach(() => { + vi.restoreAllMocks(); + process.env = { ...OLD_ENV }; +}); + +afterAll(() => { + process.env = OLD_ENV; +}); + +/** + * Mounts a component which uses the given composable and returns the wrapper. + * The component is rendered with the Abby plugin installed. + */ +async function mountWithAbby( + component: ReturnType, + abby: { AbbyPlugin: { install: (app: any) => void } } +) { + const wrapper = mount(component, { + global: { + plugins: [ + { + install: (app) => abby.AbbyPlugin.install(app), + }, + ], + }, + }); + await flushPromises(); + await nextTick(); + await nextTick(); + return wrapper; +} + +describe("useAbby", () => { + it("returns the persisted variant", async () => { + vi.spyOn(TestStorageService, "get").mockReturnValue("SimonsText"); + + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + tests: { + test: { variants: ["SimonsText", "TomsText"] }, + }, + }); + + const Component = defineComponent({ + setup() { + const { variant } = abby.useAbby("test"); + return () => h("div", variant.value); + }, + }); + + const wrapper = await mountWithAbby(Component, abby); + expect(wrapper.text()).toEqual("SimonsText"); + }); + + it("does not render a variant on the first render (SSR safety)", async () => { + vi.spyOn(TestStorageService, "get").mockReturnValue("A"); + + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + tests: { + test: { variants: ["A", "B"] }, + }, + }); + + const seen: string[] = []; + const Component = defineComponent({ + setup() { + const { variant } = abby.useAbby("test"); + seen.push(variant.value); + return () => h("div", variant.value); + }, + }); + + const wrapper = await mountWithAbby(Component, abby); + // the very first render must not contain the variant + expect(seen[0]).toEqual(""); + expect(wrapper.text()).toEqual("A"); + }); + + it("looks up the selected variant in the lookup object", async () => { + vi.spyOn(TestStorageService, "get").mockReturnValue("SimonsText"); + + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + tests: { + test: { + variants: ["SimonsText", "TomsText"] as const, + }, + }, + }); + + const Component = defineComponent({ + setup() { + const { variant } = abby.useAbby("test", { + SimonsText: "a", + TomsText: "b", + }); + return () => h("div", variant.value); + }, + }); + + const wrapper = await mountWithAbby(Component, abby); + expect(wrapper.text()).toEqual("a"); + }); + + it("pings the selected variant on mount", async () => { + const spy = vi.spyOn(HttpService, "sendData"); + + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + tests: { + test: { variants: ["A", "B"] }, + }, + }); + + const Component = defineComponent({ + setup() { + const { variant } = abby.useAbby("test"); + return () => h("div", variant.value); + }, + }); + + await mountWithAbby(Component, abby); + + expect(spy).toHaveBeenCalledWith( + expect.objectContaining({ type: AbbyEventType.PING }) + ); + }); + + it("notifies the server with onAct", async () => { + const spy = vi.spyOn(HttpService, "sendData"); + + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + tests: { + test: { variants: ["A", "B"] }, + }, + }); + + const Component = defineComponent({ + setup() { + const { variant, onAct } = abby.useAbby("test"); + return { variant, onAct }; + }, + render() { + return h("div", String(this.variant)); + }, + }); + + const wrapper = await mountWithAbby(Component, abby); + spy.mockClear(); + + (wrapper.vm as any).onAct(); + + expect(spy).toHaveBeenCalledWith( + expect.objectContaining({ type: AbbyEventType.ACT }) + ); + }); +}); + +describe("useFeatureFlag", () => { + it("returns the fetched flag values", async () => { + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + flags: ["flag1", "flag2"], + }); + + const Component = defineComponent({ + setup() { + const flag1 = abby.useFeatureFlag("flag1"); + const flag2 = abby.useFeatureFlag("flag2"); + return () => h("div", `${flag1.value}-${flag2.value}`); + }, + }); + + const wrapper = await mountWithAbby(Component, abby); + await vi.waitFor(() => { + expect(wrapper.text()).toEqual("true-false"); + }); + }); + + it("falls back to the default value when no data was fetched", async () => { + const abby = createAbby({ + environments: [], + projectId: "123", + flags: ["flag1"], + currentEnvironment: "a", + settings: { + flags: { defaultValue: true }, + }, + }); + + // there is no data from the server yet, so core returns the stored value + expect(abby.getFeatureFlagValue("flag1")).toEqual(false); + }); + + it("returns undefined-safe values when only initialization data is given", () => { + const abby = createAbby({ + environments: [], + projectId: "123", + currentEnvironment: "a", + flags: ["flag1", "flag2"], + }); + + expect(abby.__abby__.getFeatureFlag("flag1")).toEqual(false); + expect(abby.getFeatureFlagValue("flag2")).toEqual(false); + }); + + it("returns the list of all flags", async () => { + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + flags: ["flag1", "flag2"], + }); + + const Component = defineComponent({ + setup() { + const flags = abby.useFeatureFlags(); + return () => h("div", flags.value.map((f) => f.name).join(",")); + }, + }); + + const wrapper = await mountWithAbby(Component, abby); + expect(wrapper.text()).toEqual("flag1,flag2"); + }); +}); + +describe("useRemoteConfig", () => { + it("returns the fetched remote config value", async () => { + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + remoteConfig: { + remoteConfig1: "String", + }, + }); + + const Component = defineComponent({ + setup() { + const rc = abby.useRemoteConfig("remoteConfig1"); + return () => h("div", String(rc.value)); + }, + }); + + const wrapper = await mountWithAbby(Component, abby); + await vi.waitFor(() => { + expect(wrapper.text()).toEqual("FooBar"); + }); + }); + + it("uses the default values when no data was fetched", () => { + const abby = createAbby({ + environments: [], + projectId: "123", + remoteConfig: { + notSet: "Number", + }, + currentEnvironment: "a", + settings: { + remoteConfig: { + defaultValues: { + Number: 42, + }, + }, + }, + }); + + expect(abby.getRemoteConfig("notSet")).toEqual(42); + }); +}); + +describe("helpers", () => { + it("returns the variants of a test", () => { + const abby = createAbby({ + environments: [], + projectId: "123", + currentEnvironment: "a", + tests: { + test: { variants: ["A", "B", "C"] }, + }, + }); + + expect(abby.getVariants("test")).toEqual(["A", "B", "C"]); + }); + + it("returns the variant value (with and without lookup object)", () => { + const abby = createAbby({ + environments: [], + projectId: "123", + currentEnvironment: "a", + tests: { + test: { variants: ["A", "B", "C"] }, + }, + }); + + const activeVariant = abby.getABTestValue("test"); + const lookup = { A: 1, B: 2, C: 3 }; + + expect(["A", "B", "C"]).toContain(activeVariant); + expect(abby.getABTestValue("test", lookup)).toEqual(lookup[activeVariant]); + }); + + it("resets a stored variant", () => { + const removeSpy = vi + .spyOn(TestStorageService, "remove") + .mockImplementation(() => {}); + + const abby = createAbby({ + environments: [], + projectId: "123", + currentEnvironment: "a", + tests: { + test: { variants: ["A", "B"] }, + }, + }); + + abby.getABResetFunction("test")(); + + expect(removeSpy).toHaveBeenCalledWith("123", "test"); + }); + + it("updates the user properties", () => { + const abby = createAbby({ + environments: [], + projectId: "123", + currentEnvironment: "a", + flags: ["flag1"], + user: { + isBeta: { type: "boolean" } as const, + }, + }); + + expect(() => abby.updateUserProperties({ isBeta: true })).not.toThrow(); + }); +}); diff --git a/packages/vue/tsconfig.json b/packages/vue/tsconfig.json new file mode 100644 index 00000000..17687da3 --- /dev/null +++ b/packages/vue/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "tsconfig/base.json", + "compilerOptions": { + "lib": ["ESNext", "DOM", "DOM.Iterable"], + "module": "ESNext", + "moduleResolution": "bundler", + "target": "es2020", + "types": ["vitest/globals"], + "jsx": "preserve" + } +} diff --git a/packages/vue/tsup.config.ts b/packages/vue/tsup.config.ts new file mode 100644 index 00000000..ef269755 --- /dev/null +++ b/packages/vue/tsup.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from "tsup"; + +export default defineConfig({ + dts: true, + clean: true, + external: ["vue"], + format: ["cjs", "esm"], + sourcemap: true, + treeshake: true, +}); diff --git a/packages/vue/vite.config.ts b/packages/vue/vite.config.ts new file mode 100644 index 00000000..65a4bbc1 --- /dev/null +++ b/packages/vue/vite.config.ts @@ -0,0 +1,13 @@ +/// + +import vue from "@vitejs/plugin-vue"; +import { defineConfig } from "vite"; + +export default defineConfig({ + plugins: [vue()], + test: { + globals: true, + environment: "jsdom", + setupFiles: "./tests/setup.ts", + }, +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 69fa896e..fd3d79ae 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -620,7 +620,7 @@ importers: version: 2.4.2 tsup: specifier: ^6.5.0 - version: 6.7.0(postcss@8.4.41)(ts-node@10.9.1(@types/node@20.3.1)(typescript@5.5.4))(typescript@5.5.4) + version: 6.7.0(postcss@8.5.34)(ts-node@10.9.1(@types/node@20.3.1)(typescript@5.5.4))(typescript@5.5.4) unconfig: specifier: ^0.3.10 version: 0.3.10 @@ -681,7 +681,7 @@ importers: version: link:../tsconfig tsup: specifier: ^6.5.0 - version: 6.7.0(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4))(typescript@5.5.4) + version: 6.7.0(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4))(typescript@5.5.4) typescript: specifier: 5.5.4 version: 5.5.4 @@ -757,7 +757,7 @@ importers: version: 3.59.1 svelte-check: specifier: ^2.10.3 - version: 2.10.3(@babel/core@7.23.6)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.4.41)(sass@1.77.8)(svelte@3.59.1) + version: 2.10.3(@babel/core@7.23.6)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.5.34)(sass@1.77.8)(svelte@3.59.1) tslib: specifier: ^2.5.0 version: 2.5.3 @@ -827,7 +827,7 @@ importers: version: link:../tsconfig tsup: specifier: ^6.5.0 - version: 6.7.0(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4))(typescript@5.5.4) + version: 6.7.0(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4))(typescript@5.5.4) typescript: specifier: 5.5.4 version: 5.5.4 @@ -876,7 +876,7 @@ importers: version: link:../tsconfig tsup: specifier: ^6.5.0 - version: 6.7.0(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4))(typescript@5.5.4) + version: 6.7.0(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4))(typescript@5.5.4) typescript: specifier: 5.5.4 version: 5.5.4 @@ -940,7 +940,7 @@ importers: version: link:../tsconfig tsup: specifier: ^6.5.0 - version: 6.7.0(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4))(typescript@5.5.4) + version: 6.7.0(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4))(typescript@5.5.4) typescript: specifier: 5.5.4 version: 5.5.4 @@ -1004,7 +1004,7 @@ importers: version: link:../tsconfig tsup: specifier: ^6.5.0 - version: 6.7.0(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4))(typescript@5.5.4) + version: 6.7.0(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4))(typescript@5.5.4) typescript: specifier: 5.5.4 version: 5.5.4 @@ -1089,7 +1089,7 @@ importers: version: 3.59.1 svelte-check: specifier: ^2.10.3 - version: 2.10.3(@babel/core@7.24.9)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.4.41)(sass@1.77.8)(svelte@3.59.1) + version: 2.10.3(@babel/core@7.24.9)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.5.34)(sass@1.77.8)(svelte@3.59.1) tslib: specifier: ^2.5.0 version: 2.5.3 @@ -1108,6 +1108,52 @@ importers: packages/tsconfig: {} + packages/vue: + dependencies: + '@tryabby/core': + specifier: workspace:* + version: link:../core + js-cookie: + specifier: ^3.0.5 + version: 3.0.5 + devDependencies: + '@types/js-cookie': + specifier: ^3.0.3 + version: 3.0.3 + '@vitejs/plugin-vue': + specifier: ^5.2.1 + version: 5.2.4(vite@5.4.0(@types/node@22.1.0)(less@4.2.0)(sass@1.77.8)(terser@5.31.1))(vue@3.5.46(typescript@5.5.4)) + '@vue/test-utils': + specifier: ^2.4.6 + version: 2.6.0(@vue/compiler-dom@3.5.46)(@vue/server-renderer@3.5.46)(vue@3.5.46(typescript@5.5.4)) + jsdom: + specifier: ^20.0.3 + version: 20.0.3 + msw: + specifier: ^0.49.1 + version: 0.49.3(encoding@0.1.13)(typescript@5.5.4) + node-fetch: + specifier: ^3.3.0 + version: 3.3.2 + tsconfig: + specifier: workspace:* + version: link:../tsconfig + tsup: + specifier: ^6.5.0 + version: 6.7.0(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4))(typescript@5.5.4) + typescript: + specifier: 5.5.4 + version: 5.5.4 + vite: + specifier: 5.4.0 + version: 5.4.0(@types/node@22.1.0)(less@4.2.0)(sass@1.77.8)(terser@5.31.1) + vitest: + specifier: 2.0.5 + version: 2.0.5(@types/node@22.1.0)(jsdom@20.0.3)(less@4.2.0)(sass@1.77.8)(terser@5.31.1) + vue: + specifier: ^3.5.13 + version: 3.5.46(typescript@5.5.4) + packages: '@adobe/css-tools@4.2.0': @@ -1582,6 +1628,10 @@ packages: resolution: {integrity: sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==} engines: {node: '>=6.9.0'} + '@babel/helper-string-parser@7.29.15': + resolution: {integrity: sha512-C2FuapQ2Kh1OnVHAoLi5rD3GBJ8COb9Q609T6HEpLqaBAo560PDP5OxBE5dCI/h951MBO/+bCUYU5SZ+8ZlV+w==} + engines: {node: '>=6.9.0'} + '@babel/helper-validator-identifier@7.22.20': resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} engines: {node: '>=6.9.0'} @@ -1590,6 +1640,10 @@ packages: resolution: {integrity: sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==} engines: {node: '>=6.9.0'} + '@babel/helper-validator-identifier@7.29.7': + resolution: {integrity: sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==} + engines: {node: '>=6.9.0'} + '@babel/helper-validator-option@7.22.5': resolution: {integrity: sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw==} engines: {node: '>=6.9.0'} @@ -1656,11 +1710,6 @@ packages: engines: {node: '>=6.0.0'} hasBin: true - '@babel/parser@7.24.4': - resolution: {integrity: sha512-zTvEBcghmeBma9QIGunWevvBAp4/Qu9Bdq+2k0Ot4fVMD6v3dsC9WOcRSKk7tRRyBM/53yKMJko9xOatGQAwSg==} - engines: {node: '>=6.0.0'} - hasBin: true - '@babel/parser@7.24.7': resolution: {integrity: sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==} engines: {node: '>=6.0.0'} @@ -1671,6 +1720,11 @@ packages: engines: {node: '>=6.0.0'} hasBin: true + '@babel/parser@7.29.15': + resolution: {integrity: sha512-RpKWyisHoP81twtSCgmE02iU0RnPcq1DN5bBEbpUePrjA9Q3wXhufnCJrrayPpoZieqFh3zyZQqwtSK0gGccRA==} + engines: {node: '>=6.0.0'} + hasBin: true + '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.3': resolution: {integrity: sha512-wUrcsxZg6rqBXG05HG1FPYgsP6EvwF4WpBbxIpWIIYnH8wG0gzx3yZY3dtEHas4sTAOGkbTsc9EGPxwff8lRoA==} engines: {node: '>=6.9.0'} @@ -2661,10 +2715,6 @@ packages: resolution: {integrity: sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==} engines: {node: '>=6.9.0'} - '@babel/types@7.24.0': - resolution: {integrity: sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w==} - engines: {node: '>=6.9.0'} - '@babel/types@7.24.7': resolution: {integrity: sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==} engines: {node: '>=6.9.0'} @@ -2673,6 +2723,10 @@ packages: resolution: {integrity: sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q==} engines: {node: '>=6.9.0'} + '@babel/types@7.29.15': + resolution: {integrity: sha512-/XKpKDakL//LZ66bq1XsZOswuqeI5MZqPLDu18o3XdkU1fNJ7bdPtzgnc4ZNS+bBGHV0FJG8jjb8SwcC3nNVQQ==} + engines: {node: '>=6.9.0'} + '@bcoe/v8-coverage@0.2.3': resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} @@ -2892,7 +2946,7 @@ packages: '@emotion/use-insertion-effect-with-fallbacks@1.0.1': resolution: {integrity: sha512-jT/qyKZ9rzLErtrjGgdkMBn2OP8wl0G3sQlBb3YPryvKHsjvINUhVaPFfP+fpBcOkmrVOVEEHQFJ7nbj2TH2gw==} peerDependencies: - react: ^18.2.0 + react: '>=16.8.0' '@esbuild-plugins/node-globals-polyfill@0.2.3': resolution: {integrity: sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw==} @@ -3713,10 +3767,6 @@ packages: resolution: {integrity: sha512-qbu7kN6czmVRc3xWFQcAN03RAUamgppVUdXrvl1Wr3jlNF93o9mJbGcDWrwGB6ht44u7efB1qCFgVQmca24Uog==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - '@jridgewell/gen-mapping@0.3.3': - resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} - engines: {node: '>=6.0.0'} - '@jridgewell/gen-mapping@0.3.5': resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} engines: {node: '>=6.0.0'} @@ -3725,18 +3775,10 @@ packages: resolution: {integrity: sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==} engines: {node: '>=6.0.0'} - '@jridgewell/resolve-uri@3.1.1': - resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} - engines: {node: '>=6.0.0'} - '@jridgewell/resolve-uri@3.1.2': resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} - '@jridgewell/set-array@1.1.2': - resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==} - engines: {node: '>=6.0.0'} - '@jridgewell/set-array@1.2.1': resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} engines: {node: '>=6.0.0'} @@ -3750,12 +3792,12 @@ packages: '@jridgewell/sourcemap-codec@1.4.15': resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + '@jridgewell/sourcemap-codec@1.6.0': + resolution: {integrity: sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==} + '@jridgewell/trace-mapping@0.3.18': resolution: {integrity: sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==} - '@jridgewell/trace-mapping@0.3.20': - resolution: {integrity: sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==} - '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} @@ -3845,7 +3887,7 @@ packages: '@mdx-js/react@2.3.0': resolution: {integrity: sha512-zQH//gdOmuu7nt2oJR29vFhDv88oGPmVw6BggmrHeMI+xgEkp1B2dX9/bMBSYtK0dyLX/aOmesKS09g222K1/g==} peerDependencies: - react: ^18.2.0 + react: '>=16' '@mdx-js/react@3.0.0': resolution: {integrity: sha512-nDctevR9KyYFyV+m+/+S4cpzCWHqj+iHDHq3QrsWezcC+B17uZdIWgCguESUkwFhM3n/56KxWVE3V6EokrmONQ==} @@ -4295,6 +4337,9 @@ packages: resolution: {integrity: sha512-TUkJLtI163Bz5+JK0O+zDkQpn4gKwN+BovclUvCj6pI/6RXrFqQvUMRS2M+Rt8Rv0qR3wjoMoOPmpJKeOh0nBg==} engines: {node: '>= 18'} + '@one-ini/wasm@0.2.1': + resolution: {integrity: sha512-TUqERXGNTifZ9y2g3wPxQrw3HpHv/02DsW3D90T9x0hhonrL1ZqpSmNrU2XkoIq0fP1N6gZfVQzy2Fw1ZvGBNg==} + '@open-draft/until@1.0.3': resolution: {integrity: sha512-Aq58f5HiWdyDlFffbbSjAlv596h/cOnt2DO1w3DOC7OJ5EHs0hd/nycJfiu9RJbT6Yk6F1knnRRXNSpxoIVZ9Q==} @@ -4671,8 +4716,8 @@ packages: '@radix-ui/react-direction@1.1.0': resolution: {integrity: sha512-BUuBvgThEiAXh2DWu93XsT+a3aWrGqolGlqqw5VU1kG7p/ZH2cuDlM1sRLNnY3QcBS69UIz2mcKhMxDsdewhjg==} peerDependencies: - '@types/react': 18.0.26 - react: ^18.2.0 + '@types/react': '*' + react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc peerDependenciesMeta: '@types/react': optional: true @@ -5161,8 +5206,8 @@ packages: '@radix-ui/react-use-layout-effect@1.1.0': resolution: {integrity: sha512-+FPE0rOdziWSrH9athwI1R0HDVbWlEhd+FR+aSDk4uWGmSJ9Z54sdZVDQPZAinJhJXwfT+qnj969mCsT2gfm5w==} peerDependencies: - '@types/react': 18.0.26 - react: ^18.2.0 + '@types/react': '*' + react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc peerDependenciesMeta: '@types/react': optional: true @@ -6654,6 +6699,13 @@ packages: peerDependencies: vite: ^4.2.0 || ^5.0.0 + '@vitejs/plugin-vue@5.2.4': + resolution: {integrity: sha512-7Yx/SXSOcQq5HiiV3orevHUFn+pmMB4cgbEkDYgnkUWb0WfeQ/wa2yFv6D5ICiCQOVpjA7vYDXrC7AGO8yjDHA==} + engines: {node: ^18.0.0 || >=20.0.0} + peerDependencies: + vite: ^5.0.0 || ^6.0.0 + vue: ^3.2.25 + '@vitest/coverage-c8@0.33.0': resolution: {integrity: sha512-DaF1zJz4dcOZS4k/neiQJokmOWqsGXwhthfmUdPGorXIQHjdPvV6JQSYhQDI41MyI8c+IieQUdIDs5XAMHtDDw==} deprecated: v8 coverage is moved to @vitest/coverage-v8 package @@ -6690,9 +6742,21 @@ packages: '@vue/compiler-core@3.4.24': resolution: {integrity: sha512-vbW/tgbwJYj62N/Ww99x0zhFTkZDTcGh3uwJEuadZ/nF9/xuFMC4693P9r+3sxGXISABpDKvffY5ApH9pmdd1A==} + '@vue/compiler-core@3.5.46': + resolution: {integrity: sha512-yb+N8/mgBcoeqCJPVyJI/D3OphLrSMXnB3ZQUNmRLU/1fsMW4bFfdJWNi9oIj7+EA3ULKKkP7b/VCpcYQYeiuQ==} + '@vue/compiler-dom@3.4.24': resolution: {integrity: sha512-4XgABML/4cNndVsQndG6BbGN7+EoisDwi3oXNovqL/4jdNhwvP8/rfRMTb6FxkxIxUUtg6AI1/qZvwfSjxJiWA==} + '@vue/compiler-dom@3.5.46': + resolution: {integrity: sha512-Bj3lCSw3DQnDRDxw115XqdLDd0+18Nftlgd8OXSGG+ud74hxJIE17eYrM+VWgQrTMsvJbLh9Hzf2MkwAzru36Q==} + + '@vue/compiler-sfc@3.5.46': + resolution: {integrity: sha512-hjUvMxGh+QIgegwksfp6BRBYleE/a8veZHvTR6sa+o+bM4HU+WnrUZlhN0X+pDcsl8Lhwmbu72xPvLMk3XUwog==} + + '@vue/compiler-ssr@3.5.46': + resolution: {integrity: sha512-qebChL3aP0m1k+TlSf+fZWvOwAf3flBCi5o+n01ykR3DX4mTIWheFltmoiQ12+z66/4cGeXqbB2P7sPWkGhQNQ==} + '@vue/language-core@1.8.27': resolution: {integrity: sha512-L8Kc27VdQserNaCUNiSFdDl9LWT24ly8Hpwf1ECy3aFb9m6bDhBGQYOujDm21N7EW3moKIOKEanQwe1q5BK+mA==} peerDependencies: @@ -6701,9 +6765,34 @@ packages: typescript: optional: true + '@vue/reactivity@3.5.46': + resolution: {integrity: sha512-+FHtYTvGxgFoX3oRs7soz6JHizGv50Q26WJN6PWtXuTLXRfkfUpDUTRuoTA/kiZVVt8NMeMpsPQLh9h++ReUjQ==} + + '@vue/runtime-core@3.5.46': + resolution: {integrity: sha512-eJUzKAUaHAmtnys/l9qduPzUnBrYMkmsCU7TN+vbSOSpm8kcETT7nacKxIO4MBej/XiOraVzq+lSeZv7o1//jQ==} + + '@vue/runtime-dom@3.5.46': + resolution: {integrity: sha512-6L7lbBvXTYBFFjIt25a0pgdpmn3Ns8RqUnNVibRzF4bgyiWJvqOhKEV5MXYWKlCttZE3aGeJN8mveo+6IrIKXA==} + + '@vue/server-renderer@3.5.46': + resolution: {integrity: sha512-4mc0YWREc6OZ5pDCigvKPDzIUV+aciiH92yvyTS6xaHHxW/80rMceQQn11pYe7OEEBt2YQgYWR9zF8QF30GJUQ==} + '@vue/shared@3.4.24': resolution: {integrity: sha512-BW4tajrJBM9AGAknnyEw5tO2xTmnqgup0VTnDAMcxYmqOX0RG0b9aSUGAbEKolD91tdwpA6oCwbltoJoNzpItw==} + '@vue/shared@3.5.46': + resolution: {integrity: sha512-P1WePbdzHrcIciWtmY2Im9EFhdakd3rZxYqvalOa3SfoxtF35Q8Uhmj1tKn6bWP4utcOpN8ao6BoJUItq0Uf+g==} + + '@vue/test-utils@2.6.0': + resolution: {integrity: sha512-kTB6s2p34cA/xXSpt17G0enU9A3F3pdm+o5GZgE3WGXXXpXJ5SVBsRhgCJNCc+ekGAzY0T7Hjyo5yEfwencBlg==} + peerDependencies: + '@vue/compiler-dom': 3.x + '@vue/server-renderer': 3.x + vue: 3.x + peerDependenciesMeta: + '@vue/server-renderer': + optional: true + '@web3-storage/multipart-parser@1.0.0': resolution: {integrity: sha512-BEO6al7BYqcnfX15W2cnGR+Q566ACXAT9UQykORCWW80lmkpWsnEob6zJS1ZVBKsSJC8+7vJkHwlp+lXG1UCdw==} @@ -6786,6 +6875,10 @@ packages: resolution: {integrity: sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + abbrev@5.0.0: + resolution: {integrity: sha512-/XrFJgzQQQHpti1raDJC6m4ws6aNktmjBlhk8Fdlk7LwCEuDoieEJJY9OFHjfiFJFFRM2tK+Ky/IsfbbmlMu1w==} + engines: {node: ^22.22.2 || ^24.15.0 || >=26.0.0} + abort-controller@3.0.0: resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} engines: {node: '>=6.5'} @@ -6820,11 +6913,6 @@ packages: resolution: {integrity: sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==} engines: {node: '>=0.4.0'} - acorn@8.10.0: - resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==} - engines: {node: '>=0.4.0'} - hasBin: true - acorn@8.11.2: resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==} engines: {node: '>=0.4.0'} @@ -7141,6 +7229,10 @@ packages: balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + balanced-match@4.0.4: + resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==} + engines: {node: 18 || 20 || >=22} + base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} @@ -7206,6 +7298,10 @@ packages: brace-expansion@2.0.1: resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + brace-expansion@5.1.2: + resolution: {integrity: sha512-ELhY3JEerIBbhgW+rh0/8glkZAaMqn1x3BAvp3yTULSEGozMK/5PT6WTdBgsdvJqwwmv7MAQNOydfYbvK1Vgfw==} + engines: {node: 20 || >=22} + braces@3.0.2: resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} engines: {node: '>=8'} @@ -7576,6 +7672,10 @@ packages: resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==} engines: {node: '>=18'} + commander@14.0.3: + resolution: {integrity: sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==} + engines: {node: '>=20'} + commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -7796,6 +7896,9 @@ packages: csstype@3.1.2: resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==} + csstype@3.2.4: + resolution: {integrity: sha512-PoKaoPzQapnEoqUSnHx1u6W6ku8CVEgKsnpmmzU3m1nwkidpPBQ8V/Zq2+bWNrsOKoKLwTGdbx6xF7BXP1zLVQ==} + csv-generate@3.4.3: resolution: {integrity: sha512-w/T+rqR0vwvHqWs/1ZyMDWtHHSJaN06klRqJXBEpDJaM/+dZkso0OKh1VcuuYvK3XM53KysVNq8Ko/epCK8wOw==} @@ -8276,6 +8379,11 @@ packages: resolution: {integrity: sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==} hasBin: true + editorconfig@3.0.2: + resolution: {integrity: sha512-T0ix8GhtxyKVfUFEcvdNDt3YGqlwkFHbD4/5bgFUDgFmxhI/cSRAeJ87/Sz//Cq8Eam6JX/e23RkoFO71P7aAA==} + engines: {node: '>=20'} + hasBin: true + ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} @@ -8345,6 +8453,10 @@ packages: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} + entities@7.0.1: + resolution: {integrity: sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==} + engines: {node: '>=0.12'} + env-paths@2.2.1: resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==} engines: {node: '>=6'} @@ -8985,18 +9097,18 @@ packages: glob-to-regexp@0.4.1: resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} - glob@10.2.7: - resolution: {integrity: sha512-jTKehsravOJo8IJxUGfZILnkvVJM/MOfHRs8QcXolVef2zNI9Tqyy5+SeuOAZd3upViEZQLyFpQhYiHLrMUNmA==} - engines: {node: '>=16 || 14 >=14.17'} - hasBin: true - glob@10.4.5: resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me hasBin: true + glob@13.0.7: + resolution: {integrity: sha512-wfsFgXQ8A3SEI9XGf7Nl3Y9l7ffSrGh7SUCT7vU/2CzYPep9kjxAn1S40F9OPKxAMGCVl7HtNlJhrCJUeUq83g==} + engines: {node: 18 || 20 || >=22} + glob@7.1.6: resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==} - deprecated: Glob versions prior to v9 are no longer supported + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} @@ -9010,6 +9122,7 @@ packages: glob@9.3.5: resolution: {integrity: sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==} engines: {node: '>=16 || 14 >=14.17'} + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me globals@11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} @@ -9349,6 +9462,7 @@ packages: image-size@0.5.5: resolution: {integrity: sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==} engines: {node: '>=0.10.0'} + deprecated: Please migrate to image-size@2.x hasBin: true immer@9.0.21: @@ -9800,10 +9914,6 @@ packages: resolution: {integrity: sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==} engines: {node: '>=8'} - jackspeak@2.2.1: - resolution: {integrity: sha512-MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw==} - engines: {node: '>=14'} - jackspeak@3.4.3: resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} @@ -9882,10 +9992,18 @@ packages: engines: {node: '>=12'} hasBin: true + js-beautify@2.0.3: + resolution: {integrity: sha512-cyFbh3tkPhknnTD/0bLf0T0yy2ZIbqL05mttzbt4y1Zfr7NxqXQZ62dkBLKs3oHH/lpjmDRAnciJiSUyOy8XwQ==} + engines: {node: '>=14'} + hasBin: true + js-cookie@3.0.5: resolution: {integrity: sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==} engines: {node: '>=14'} + js-cookie@3.0.8: + resolution: {integrity: sha512-yeJd4aNAdYZQjaon2bpD/Gb0B/omw7HQOsynXXcOiWVCacbBcPlgn8S/d1X6blFSaHao7ozqtW7NZW19xpCtIw==} + js-levenshtein@1.1.6: resolution: {integrity: sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==} engines: {node: '>=0.10.0'} @@ -10220,6 +10338,10 @@ packages: lru-cache@10.4.3: resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + lru-cache@11.5.4: + resolution: {integrity: sha512-B8nJCTi8JuSaDBg0tBdnImV6j5O2CXaqKfdj24ZTCFbyivN8KZ2Z+RL3aHjwJAfLutD9cNnObG4SIgW4gMufiw==} + engines: {node: 20 || >=22} + lru-cache@4.1.5: resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} @@ -10230,10 +10352,6 @@ packages: resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} engines: {node: '>=10'} - lru-cache@9.1.2: - resolution: {integrity: sha512-ERJq3FOzJTxBbFjZ7iDs+NiK4VI9Wz+RdrrAB8dio1oV+YvdPzUEE4QNiT2VD51DkIbCYRUUzCRkssXCHqSnKQ==} - engines: {node: 14 || >=16.14} - lucide-react@0.320.0: resolution: {integrity: sha512-HuMmfmFiWwctDkN27wklKVZr8UpwP2TTekLZ3xiLCEjx/STG1k0KLWMbBfIJ/lnNJQDfSjztDZSVU316xA+AQg==} peerDependencies: @@ -10261,6 +10379,9 @@ packages: magic-string@0.30.10: resolution: {integrity: sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==} + magic-string@0.30.21: + resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} + magic-string@0.30.8: resolution: {integrity: sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==} engines: {node: '>=12'} @@ -10713,6 +10834,10 @@ packages: minimalistic-assert@1.0.1: resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==} + minimatch@10.2.6: + resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==} + engines: {node: 18 || 20 || >=22} + minimatch@3.0.8: resolution: {integrity: sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==} @@ -10774,6 +10899,10 @@ packages: resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} engines: {node: '>=16 || 14 >=14.17'} + minipass@7.1.3: + resolution: {integrity: sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==} + engines: {node: '>=16 || 14 >=14.17'} + minizlib@2.1.2: resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} engines: {node: '>= 8'} @@ -10884,6 +11013,11 @@ packages: mz@2.7.0: resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} + nanoid@3.3.20: + resolution: {integrity: sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + nanoid@3.3.6: resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} @@ -11131,6 +11265,11 @@ packages: resolution: {integrity: sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==} hasBin: true + nopt@10.0.1: + resolution: {integrity: sha512-df3sBr/6ax9hSGuC3CspvLlbnX8cP5L5nZwXF8cGN8l0zSWR6BvzmQ6jPUKjvo6+/xdpkNvEcucBNUdBeeV13g==} + engines: {node: ^22.22.2 || ^24.15.0 || >=26.0.0} + hasBin: true + nopt@6.0.0: resolution: {integrity: sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} @@ -11512,9 +11651,9 @@ packages: resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} engines: {node: '>=16 || 14 >=14.18'} - path-scurry@1.9.2: - resolution: {integrity: sha512-qSDLy2aGFPm8i4rsbHd4MNyTcrzHFsLQykrtbuGRknZZCBBVXSv2tSCDN2Cg6Rt/GFRw8GoW9y9Ecw5rIPG1sg==} - engines: {node: '>=16 || 14 >=14.17'} + path-scurry@2.0.2: + resolution: {integrity: sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==} + engines: {node: 18 || 20 || >=22} path-to-regexp@0.1.7: resolution: {integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==} @@ -11569,6 +11708,9 @@ packages: picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} @@ -11735,6 +11877,10 @@ packages: resolution: {integrity: sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ==} engines: {node: ^10 || ^12 || >=14} + postcss@8.5.34: + resolution: {integrity: sha512-P1Qzj0XXZjMda74C7qiVnBG90UKNbyNUAOeQRBW8X63RsIMV57gevRqjnkELdwtZ/S2/uQFksJhmwuN8xShLPw==} + engines: {node: ^10 || ^12 || >=14} + postgres-array@2.0.0: resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==} engines: {node: '>=4'} @@ -12414,16 +12560,6 @@ packages: rollup-pluginutils@2.8.2: resolution: {integrity: sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==} - rollup@3.25.0: - resolution: {integrity: sha512-FnJkNRst2jEZGw7f+v4hFo6UTzpDKrAKcHZWcEfm5/GJQ5CK7wgb4moNLNAe7npKUev7yQn1AY/YbZRIxOv6Qg==} - engines: {node: '>=14.18.0', npm: '>=8.0.0'} - hasBin: true - - rollup@3.27.1: - resolution: {integrity: sha512-tXNDFwOkN6C2w5Blj1g6ForKeFw6c1mDu5jxoeDO3/pmYjgt+8yvIFjKzH5FQUq70OKZBkOt0zzv0THXL7vwzQ==} - engines: {node: '>=14.18.0', npm: '>=8.0.0'} - hasBin: true - rollup@3.29.4: resolution: {integrity: sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} @@ -12587,6 +12723,11 @@ packages: engines: {node: '>=10'} hasBin: true + semver@7.8.6: + resolution: {integrity: sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==} + engines: {node: '>=10'} + hasBin: true + send@0.18.0: resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} engines: {node: '>= 0.8.0'} @@ -12771,6 +12912,10 @@ packages: resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} engines: {node: '>=0.10.0'} + source-map-js@1.3.0: + resolution: {integrity: sha512-pdUVfIWcK0kCgK831ibqkZDcL7I9zljjOu0TQFnA+fiQ6y1CYqYB7RkTOHHO45FGMg5P/Mvk/+4ToQ7gAYAL5Q==} + engines: {node: '>=6.0.0'} + source-map-loader@5.0.0: resolution: {integrity: sha512-k2Dur7CbSLcAH73sBcIkV5xjPV4SzqO1NJ7+XaQl8if3VODDUj3FNchNGpqgJSKbvUfJuhVdv8K2Eu8/TNl2eA==} engines: {node: '>= 18.12.0'} @@ -12791,6 +12936,7 @@ packages: source-map@0.8.0-beta.0: resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} engines: {node: '>= 8'} + deprecated: The work that was done in this beta branch won't be included in future versions sourcemap-codec@1.4.8: resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==} @@ -13964,6 +14110,9 @@ packages: vscode-textmate@8.0.0: resolution: {integrity: sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==} + vue-component-type-helpers@3.3.14: + resolution: {integrity: sha512-Pq3+OnbCiPCHk0R7KSZrx+j/XXaUn2kSQ1epxq60w8CPbByLjC1EJgV51n4WY851sTXUVzsNMuitywdkdVyKjA==} + vue-template-compiler@2.7.16: resolution: {integrity: sha512-AYbUWAJHLGGQM7+cNTELw+KsOG9nl2CnSv467WobS5Cv9uk3wFcnr1Etsz2sEIHEZvw1U+o9mRlEO6QbZvUPGQ==} @@ -13973,6 +14122,14 @@ packages: peerDependencies: typescript: '*' + vue@3.5.46: + resolution: {integrity: sha512-0kW5CgfjMPBqmH158049SaE1muufp+K/ZyrwvSEwrwYky6QB7zL2y8kXfruneKb9O12eh0xAJL6CVSpzb9o0Kg==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + w3c-keyname@2.2.8: resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==} @@ -14046,7 +14203,7 @@ packages: engines: {node: '>= 18.12.0'} hasBin: true peerDependencies: - webpack: 5.93.0 + webpack: ^5.0.0 webpack-cli: '*' peerDependenciesMeta: webpack: @@ -14099,6 +14256,7 @@ packages: whatwg-encoding@2.0.0: resolution: {integrity: sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==} engines: {node: '>=12'} + deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementation whatwg-fetch@3.6.2: resolution: {integrity: sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==} @@ -14411,7 +14569,7 @@ snapshots: dependencies: '@ampproject/remapping': 2.3.0 '@angular-devkit/architect': 0.1801.3(chokidar@3.6.0) - '@angular-devkit/build-webpack': 0.1801.3(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.92.1))(webpack@5.92.1(esbuild@0.21.5)) + '@angular-devkit/build-webpack': 0.1801.3(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.92.1))(webpack@5.92.1) '@angular-devkit/core': 18.1.3(chokidar@3.6.0) '@angular/build': 18.1.3(@angular/compiler-cli@18.1.3(@angular/compiler@18.1.3(@angular/core@18.1.3(rxjs@7.8.1)(zone.js@0.12.0)))(typescript@5.5.4))(@types/node@20.3.1)(chokidar@3.6.0)(less@4.2.0)(postcss@8.4.38)(tailwindcss@3.3.2(ts-node@10.9.1(@types/node@20.3.1)(typescript@5.5.4)))(terser@5.29.2)(typescript@5.5.4) '@angular/compiler-cli': 18.1.3(@angular/compiler@18.1.3(@angular/core@18.1.3(rxjs@7.8.1)(zone.js@0.12.0)))(typescript@5.5.4) @@ -14425,15 +14583,15 @@ snapshots: '@babel/preset-env': 7.24.7(@babel/core@7.24.7) '@babel/runtime': 7.24.7 '@discoveryjs/json-ext': 0.5.7 - '@ngtools/webpack': 18.1.3(@angular/compiler-cli@18.1.3(@angular/compiler@18.1.3(@angular/core@18.1.3(rxjs@7.8.1)(zone.js@0.12.0)))(typescript@5.5.4))(typescript@5.5.4)(webpack@5.92.1(esbuild@0.21.5)) + '@ngtools/webpack': 18.1.3(@angular/compiler-cli@18.1.3(@angular/compiler@18.1.3(@angular/core@18.1.3(rxjs@7.8.1)(zone.js@0.12.0)))(typescript@5.5.4))(typescript@5.5.4)(webpack@5.92.1) '@vitejs/plugin-basic-ssl': 1.1.0(vite@5.3.2(@types/node@20.3.1)(less@4.2.0)(sass@1.77.6)(terser@5.29.2)) ansi-colors: 4.1.3 autoprefixer: 10.4.19(postcss@8.4.38) - babel-loader: 9.1.3(@babel/core@7.24.7)(webpack@5.92.1(esbuild@0.21.5)) + babel-loader: 9.1.3(@babel/core@7.24.7)(webpack@5.92.1) browserslist: 4.23.1 - copy-webpack-plugin: 12.0.2(webpack@5.92.1(esbuild@0.21.5)) + copy-webpack-plugin: 12.0.2(webpack@5.92.1) critters: 0.0.24 - css-loader: 7.1.2(webpack@5.92.1(esbuild@0.21.5)) + css-loader: 7.1.2(webpack@5.92.1) esbuild-wasm: 0.21.5 fast-glob: 3.3.2 http-proxy-middleware: 3.0.0 @@ -14442,11 +14600,11 @@ snapshots: jsonc-parser: 3.3.1 karma-source-map-support: 1.4.0 less: 4.2.0 - less-loader: 12.2.0(less@4.2.0)(webpack@5.92.1(esbuild@0.21.5)) - license-webpack-plugin: 4.0.2(webpack@5.92.1(esbuild@0.21.5)) + less-loader: 12.2.0(less@4.2.0)(webpack@5.92.1) + license-webpack-plugin: 4.0.2(webpack@5.92.1) loader-utils: 3.3.1 magic-string: 0.30.10 - mini-css-extract-plugin: 2.9.0(webpack@5.92.1(esbuild@0.21.5)) + mini-css-extract-plugin: 2.9.0(webpack@5.92.1) mrmime: 2.0.0 open: 10.1.0 ora: 5.4.1 @@ -14454,13 +14612,13 @@ snapshots: picomatch: 4.0.2 piscina: 4.6.1 postcss: 8.4.38 - postcss-loader: 8.1.1(postcss@8.4.38)(typescript@5.5.4)(webpack@5.92.1(esbuild@0.21.5)) + postcss-loader: 8.1.1(postcss@8.4.38)(typescript@5.5.4)(webpack@5.92.1) resolve-url-loader: 5.0.0 rxjs: 7.8.1 sass: 1.77.6 - sass-loader: 14.2.1(sass@1.77.6)(webpack@5.92.1(esbuild@0.21.5)) + sass-loader: 14.2.1(sass@1.77.6)(webpack@5.92.1) semver: 7.6.2 - source-map-loader: 5.0.0(webpack@5.92.1(esbuild@0.21.5)) + source-map-loader: 5.0.0(webpack@5.92.1) source-map-support: 0.5.21 terser: 5.29.2 tree-kill: 1.2.2 @@ -14473,7 +14631,7 @@ snapshots: webpack-dev-middleware: 7.2.1(webpack@5.92.1) webpack-dev-server: 5.0.4(webpack@5.92.1) webpack-merge: 5.10.0 - webpack-subresource-integrity: 5.1.0(webpack@5.92.1(esbuild@0.21.5)) + webpack-subresource-integrity: 5.1.0(webpack@5.92.1) optionalDependencies: esbuild: 0.21.5 karma: 6.4.0 @@ -14497,7 +14655,7 @@ snapshots: - utf-8-validate - webpack-cli - '@angular-devkit/build-webpack@0.1801.3(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.92.1))(webpack@5.92.1(esbuild@0.21.5))': + '@angular-devkit/build-webpack@0.1801.3(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.92.1))(webpack@5.92.1)': dependencies: '@angular-devkit/architect': 0.1801.3(chokidar@3.6.0) rxjs: 7.8.1 @@ -14708,10 +14866,10 @@ snapshots: '@babel/helper-compilation-targets': 7.23.6 '@babel/helper-module-transforms': 7.23.3(@babel/core@7.21.8) '@babel/helpers': 7.24.4 - '@babel/parser': 7.24.7 + '@babel/parser': 7.25.3 '@babel/template': 7.24.0 '@babel/traverse': 7.24.1 - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 convert-source-map: 1.9.0 debug: 4.3.5 gensync: 1.0.0-beta.2 @@ -14748,10 +14906,10 @@ snapshots: '@babel/helper-compilation-targets': 7.23.6 '@babel/helper-module-transforms': 7.23.3(@babel/core@7.24.4) '@babel/helpers': 7.24.4 - '@babel/parser': 7.24.4 + '@babel/parser': 7.25.3 '@babel/template': 7.24.0 '@babel/traverse': 7.24.1 - '@babel/types': 7.24.0 + '@babel/types': 7.25.2 convert-source-map: 2.0.0 debug: 4.3.5 gensync: 1.0.0-beta.2 @@ -14802,28 +14960,28 @@ snapshots: '@babel/generator@7.21.9': dependencies: - '@babel/types': 7.24.7 - '@jridgewell/gen-mapping': 0.3.3 - '@jridgewell/trace-mapping': 0.3.20 + '@babel/types': 7.25.2 + '@jridgewell/gen-mapping': 0.3.5 + '@jridgewell/trace-mapping': 0.3.25 jsesc: 2.5.2 '@babel/generator@7.23.6': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 jsesc: 2.5.2 '@babel/generator@7.24.4': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 jsesc: 2.5.2 '@babel/generator@7.24.7': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 jsesc: 2.5.2 @@ -14837,20 +14995,20 @@ snapshots: '@babel/helper-annotate-as-pure@7.22.5': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-annotate-as-pure@7.24.7': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-builder-binary-assignment-operator-visitor@7.22.5': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-builder-binary-assignment-operator-visitor@7.24.7': dependencies: '@babel/traverse': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 transitivePeerDependencies: - supports-color @@ -15003,29 +15161,29 @@ snapshots: '@babel/helper-environment-visitor@7.24.7': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-function-name@7.23.0': dependencies: '@babel/template': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-function-name@7.24.7': dependencies: '@babel/template': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-hoist-variables@7.22.5': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-hoist-variables@7.24.7': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-member-expression-to-functions@7.22.5': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-member-expression-to-functions@7.24.8': dependencies: @@ -15036,16 +15194,16 @@ snapshots: '@babel/helper-module-imports@7.22.15': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-module-imports@7.22.5': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-module-imports@7.24.7': dependencies: '@babel/traverse': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 transitivePeerDependencies: - supports-color @@ -15142,11 +15300,11 @@ snapshots: '@babel/helper-optimise-call-expression@7.22.5': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-optimise-call-expression@7.24.7': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-plugin-utils@7.22.5': {} @@ -15160,7 +15318,7 @@ snapshots: '@babel/helper-annotate-as-pure': 7.22.5 '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-wrap-function': 7.22.5 - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 transitivePeerDependencies: - supports-color @@ -15170,7 +15328,7 @@ snapshots: '@babel/helper-annotate-as-pure': 7.22.5 '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-wrap-function': 7.22.5 - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 transitivePeerDependencies: - supports-color @@ -15190,7 +15348,7 @@ snapshots: '@babel/helper-optimise-call-expression': 7.22.5 '@babel/template': 7.24.7 '@babel/traverse': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 transitivePeerDependencies: - supports-color @@ -15205,33 +15363,33 @@ snapshots: '@babel/helper-simple-access@7.22.5': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-simple-access@7.24.7': dependencies: '@babel/traverse': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 transitivePeerDependencies: - supports-color '@babel/helper-skip-transparent-expression-wrappers@7.22.5': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-skip-transparent-expression-wrappers@7.24.7': dependencies: '@babel/traverse': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 transitivePeerDependencies: - supports-color '@babel/helper-split-export-declaration@7.22.6': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-split-export-declaration@7.24.7': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helper-string-parser@7.23.4': {} @@ -15239,10 +15397,14 @@ snapshots: '@babel/helper-string-parser@7.24.8': {} + '@babel/helper-string-parser@7.29.15': {} + '@babel/helper-validator-identifier@7.22.20': {} '@babel/helper-validator-identifier@7.24.7': {} + '@babel/helper-validator-identifier@7.29.7': {} + '@babel/helper-validator-option@7.22.5': {} '@babel/helper-validator-option@7.23.5': {} @@ -15256,7 +15418,7 @@ snapshots: '@babel/helper-function-name': 7.23.0 '@babel/template': 7.22.15 '@babel/traverse': 7.23.6 - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 transitivePeerDependencies: - supports-color @@ -15272,7 +15434,7 @@ snapshots: dependencies: '@babel/template': 7.24.7 '@babel/traverse': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 transitivePeerDependencies: - supports-color @@ -15280,14 +15442,14 @@ snapshots: dependencies: '@babel/template': 7.24.7 '@babel/traverse': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 transitivePeerDependencies: - supports-color '@babel/helpers@7.24.7': dependencies: '@babel/template': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/helpers@7.25.0': dependencies: @@ -15302,7 +15464,7 @@ snapshots: '@babel/highlight@7.23.4': dependencies: - '@babel/helper-validator-identifier': 7.22.20 + '@babel/helper-validator-identifier': 7.24.7 chalk: 2.4.2 js-tokens: 4.0.0 @@ -15322,16 +15484,12 @@ snapshots: '@babel/parser@7.21.9': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/parser@7.23.6': dependencies: '@babel/types': 7.23.6 - '@babel/parser@7.24.4': - dependencies: - '@babel/types': 7.24.7 - '@babel/parser@7.24.7': dependencies: '@babel/types': 7.24.7 @@ -15340,6 +15498,10 @@ snapshots: dependencies: '@babel/types': 7.25.2 + '@babel/parser@7.29.15': + dependencies: + '@babel/types': 7.29.15 + '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.3(@babel/core@7.24.7)': dependencies: '@babel/core': 7.24.7 @@ -16539,7 +16701,7 @@ snapshots: '@babel/helper-module-imports': 7.22.5 '@babel/helper-plugin-utils': 7.22.5 '@babel/plugin-syntax-jsx': 7.22.5(@babel/core@7.23.6) - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@babel/plugin-transform-regenerator@7.22.5(@babel/core@7.21.8)': dependencies: @@ -16806,7 +16968,7 @@ snapshots: '@babel/plugin-transform-unicode-escapes': 7.22.5(@babel/core@7.21.8) '@babel/plugin-transform-unicode-regex': 7.22.5(@babel/core@7.21.8) '@babel/preset-modules': 0.1.5(@babel/core@7.21.8) - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 babel-plugin-polyfill-corejs2: 0.3.3(@babel/core@7.21.8) babel-plugin-polyfill-corejs3: 0.6.0(@babel/core@7.21.8) babel-plugin-polyfill-regenerator: 0.4.1(@babel/core@7.21.8) @@ -16892,7 +17054,7 @@ snapshots: '@babel/plugin-transform-unicode-regex': 7.22.5(@babel/core@7.23.6) '@babel/plugin-transform-unicode-sets-regex': 7.22.5(@babel/core@7.23.6) '@babel/preset-modules': 0.1.5(@babel/core@7.23.6) - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 babel-plugin-polyfill-corejs2: 0.4.3(@babel/core@7.23.6) babel-plugin-polyfill-corejs3: 0.8.1(@babel/core@7.23.6) babel-plugin-polyfill-regenerator: 0.5.0(@babel/core@7.23.6) @@ -17001,7 +17163,7 @@ snapshots: '@babel/helper-plugin-utils': 7.24.0 '@babel/plugin-proposal-unicode-property-regex': 7.18.6(@babel/core@7.21.8) '@babel/plugin-transform-dotall-regex': 7.22.5(@babel/core@7.21.8) - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 esutils: 2.0.3 '@babel/preset-modules@0.1.5(@babel/core@7.23.6)': @@ -17010,14 +17172,14 @@ snapshots: '@babel/helper-plugin-utils': 7.24.0 '@babel/plugin-proposal-unicode-property-regex': 7.18.6(@babel/core@7.23.6) '@babel/plugin-transform-dotall-regex': 7.22.5(@babel/core@7.23.6) - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 esutils: 2.0.3 '@babel/preset-modules@0.1.6-no-external-plugins(@babel/core@7.24.7)': dependencies: '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.8 - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 esutils: 2.0.3 '@babel/preset-typescript@7.22.5(@babel/core@7.24.4)': @@ -17057,20 +17219,20 @@ snapshots: '@babel/template@7.22.15': dependencies: '@babel/code-frame': 7.24.7 - '@babel/parser': 7.24.7 - '@babel/types': 7.24.7 + '@babel/parser': 7.25.3 + '@babel/types': 7.25.2 '@babel/template@7.24.0': dependencies: '@babel/code-frame': 7.24.7 - '@babel/parser': 7.24.7 - '@babel/types': 7.24.7 + '@babel/parser': 7.25.3 + '@babel/types': 7.25.2 '@babel/template@7.24.7': dependencies: '@babel/code-frame': 7.24.7 - '@babel/parser': 7.24.7 - '@babel/types': 7.24.7 + '@babel/parser': 7.25.3 + '@babel/types': 7.25.2 '@babel/template@7.25.0': dependencies: @@ -17086,8 +17248,8 @@ snapshots: '@babel/helper-function-name': 7.23.0 '@babel/helper-hoist-variables': 7.22.5 '@babel/helper-split-export-declaration': 7.22.6 - '@babel/parser': 7.24.7 - '@babel/types': 7.24.7 + '@babel/parser': 7.25.3 + '@babel/types': 7.25.2 debug: 4.3.5 globals: 11.12.0 transitivePeerDependencies: @@ -17101,8 +17263,8 @@ snapshots: '@babel/helper-function-name': 7.23.0 '@babel/helper-hoist-variables': 7.22.5 '@babel/helper-split-export-declaration': 7.22.6 - '@babel/parser': 7.24.7 - '@babel/types': 7.24.7 + '@babel/parser': 7.25.3 + '@babel/types': 7.25.2 debug: 4.3.5 globals: 11.12.0 transitivePeerDependencies: @@ -17116,8 +17278,8 @@ snapshots: '@babel/helper-function-name': 7.24.7 '@babel/helper-hoist-variables': 7.24.7 '@babel/helper-split-export-declaration': 7.24.7 - '@babel/parser': 7.24.7 - '@babel/types': 7.24.7 + '@babel/parser': 7.25.3 + '@babel/types': 7.25.2 debug: 4.3.5 globals: 11.12.0 transitivePeerDependencies: @@ -17131,8 +17293,8 @@ snapshots: '@babel/helper-function-name': 7.24.7 '@babel/helper-hoist-variables': 7.24.7 '@babel/helper-split-export-declaration': 7.24.7 - '@babel/parser': 7.24.7 - '@babel/types': 7.24.7 + '@babel/parser': 7.25.3 + '@babel/types': 7.25.2 debug: 4.3.5 globals: 11.12.0 transitivePeerDependencies: @@ -17152,7 +17314,7 @@ snapshots: '@babel/types@7.21.5': dependencies: - '@babel/helper-string-parser': 7.24.7 + '@babel/helper-string-parser': 7.24.8 '@babel/helper-validator-identifier': 7.24.7 to-fast-properties: 2.0.0 @@ -17162,12 +17324,6 @@ snapshots: '@babel/helper-validator-identifier': 7.22.20 to-fast-properties: 2.0.0 - '@babel/types@7.24.0': - dependencies: - '@babel/helper-string-parser': 7.24.7 - '@babel/helper-validator-identifier': 7.24.7 - to-fast-properties: 2.0.0 - '@babel/types@7.24.7': dependencies: '@babel/helper-string-parser': 7.24.7 @@ -17180,6 +17336,11 @@ snapshots: '@babel/helper-validator-identifier': 7.24.7 to-fast-properties: 2.0.0 + '@babel/types@7.29.15': + dependencies: + '@babel/helper-string-parser': 7.29.15 + '@babel/helper-validator-identifier': 7.29.7 + '@bcoe/v8-coverage@0.2.3': {} '@biomejs/biome@1.9.4': @@ -18024,7 +18185,7 @@ snapshots: dependencies: '@babel/core': 7.24.4 '@jest/types': 29.5.0 - '@jridgewell/trace-mapping': 0.3.18 + '@jridgewell/trace-mapping': 0.3.25 babel-plugin-istanbul: 6.1.1 chalk: 4.1.2 convert-source-map: 2.0.0 @@ -18057,12 +18218,6 @@ snapshots: '@types/yargs': 17.0.24 chalk: 4.1.2 - '@jridgewell/gen-mapping@0.3.3': - dependencies: - '@jridgewell/set-array': 1.1.2 - '@jridgewell/sourcemap-codec': 1.4.15 - '@jridgewell/trace-mapping': 0.3.18 - '@jridgewell/gen-mapping@0.3.5': dependencies: '@jridgewell/set-array': 1.2.1 @@ -18071,12 +18226,8 @@ snapshots: '@jridgewell/resolve-uri@3.1.0': {} - '@jridgewell/resolve-uri@3.1.1': {} - '@jridgewell/resolve-uri@3.1.2': {} - '@jridgewell/set-array@1.1.2': {} - '@jridgewell/set-array@1.2.1': {} '@jridgewell/source-map@0.3.6': @@ -18088,16 +18239,13 @@ snapshots: '@jridgewell/sourcemap-codec@1.4.15': {} + '@jridgewell/sourcemap-codec@1.6.0': {} + '@jridgewell/trace-mapping@0.3.18': dependencies: '@jridgewell/resolve-uri': 3.1.0 '@jridgewell/sourcemap-codec': 1.4.14 - '@jridgewell/trace-mapping@0.3.20': - dependencies: - '@jridgewell/resolve-uri': 3.1.1 - '@jridgewell/sourcemap-codec': 1.4.15 - '@jridgewell/trace-mapping@0.3.25': dependencies: '@jridgewell/resolve-uri': 3.1.2 @@ -18105,7 +18253,7 @@ snapshots: '@jridgewell/trace-mapping@0.3.9': dependencies: - '@jridgewell/resolve-uri': 3.1.1 + '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.4.15 '@jsonjoy.com/base64@1.1.2(tslib@2.6.3)': @@ -18462,7 +18610,7 @@ snapshots: '@next/swc-win32-x64-msvc@14.1.1': optional: true - '@ngtools/webpack@18.1.3(@angular/compiler-cli@18.1.3(@angular/compiler@18.1.3(@angular/core@18.1.3(rxjs@7.8.1)(zone.js@0.12.0)))(typescript@5.5.4))(typescript@5.5.4)(webpack@5.92.1(esbuild@0.21.5))': + '@ngtools/webpack@18.1.3(@angular/compiler-cli@18.1.3(@angular/compiler@18.1.3(@angular/core@18.1.3(rxjs@7.8.1)(zone.js@0.12.0)))(typescript@5.5.4))(typescript@5.5.4)(webpack@5.92.1)': dependencies: '@angular/compiler-cli': 18.1.3(@angular/compiler@18.1.3(@angular/core@18.1.3(rxjs@7.8.1)(zone.js@0.12.0)))(typescript@5.5.4) typescript: 5.5.4 @@ -18691,6 +18839,8 @@ snapshots: '@octokit/request-error': 6.1.4 '@octokit/webhooks-methods': 5.1.0 + '@one-ini/wasm@0.2.1': {} + '@open-draft/until@1.0.3': {} '@openpanel/nextjs@1.0.3(next@14.1.1(@babel/core@7.24.7)(@opentelemetry/api@1.9.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.77.8))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': @@ -20521,7 +20671,7 @@ snapshots: magic-string: 0.27.0 remark-external-links: 8.0.0 remark-slug: 6.1.0 - rollup: 3.27.1 + rollup: 3.29.4 vite: 5.4.0(@types/node@22.1.0)(less@4.2.0)(sass@1.77.8)(terser@5.31.1) optionalDependencies: typescript: 5.5.4 @@ -20702,7 +20852,7 @@ snapshots: ts-dedent: 2.2.0 util-deprecate: 1.0.2 watchpack: 2.4.1 - ws: 8.13.0 + ws: 8.18.0 transitivePeerDependencies: - bufferutil - encoding @@ -20773,7 +20923,7 @@ snapshots: memoizerific: 1.11.3 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) - semver: 7.5.1 + semver: 7.6.2 store2: 2.14.2 telejson: 7.1.0 ts-dedent: 2.2.0 @@ -21291,8 +21441,8 @@ snapshots: '@types/babel__core@7.20.1': dependencies: - '@babel/parser': 7.24.7 - '@babel/types': 7.24.7 + '@babel/parser': 7.25.3 + '@babel/types': 7.25.2 '@types/babel__generator': 7.6.4 '@types/babel__template': 7.4.1 '@types/babel__traverse': 7.20.1 @@ -21307,29 +21457,29 @@ snapshots: '@types/babel__generator@7.6.4': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@types/babel__generator@7.6.8': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@types/babel__template@7.4.1': dependencies: - '@babel/parser': 7.24.7 - '@babel/types': 7.24.7 + '@babel/parser': 7.25.3 + '@babel/types': 7.25.2 '@types/babel__template@7.4.4': dependencies: - '@babel/parser': 7.24.7 - '@babel/types': 7.24.7 + '@babel/parser': 7.25.3 + '@babel/types': 7.25.2 '@types/babel__traverse@7.20.1': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@types/babel__traverse@7.20.5': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.25.2 '@types/body-parser@1.19.2': dependencies: @@ -21784,6 +21934,11 @@ snapshots: transitivePeerDependencies: - supports-color + '@vitejs/plugin-vue@5.2.4(vite@5.4.0(@types/node@22.1.0)(less@4.2.0)(sass@1.77.8)(terser@5.31.1))(vue@3.5.46(typescript@5.5.4))': + dependencies: + vite: 5.4.0(@types/node@22.1.0)(less@4.2.0)(sass@1.77.8)(terser@5.31.1) + vue: 3.5.46(typescript@5.5.4) + '@vitest/coverage-c8@0.33.0(vitest@2.0.5(@types/node@22.1.0)(jsdom@20.0.3)(less@4.2.0)(sass@1.77.8)(terser@5.31.1))': dependencies: '@ampproject/remapping': 2.3.0 @@ -21841,17 +21996,47 @@ snapshots: '@vue/compiler-core@3.4.24': dependencies: - '@babel/parser': 7.24.7 + '@babel/parser': 7.25.3 '@vue/shared': 3.4.24 entities: 4.5.0 estree-walker: 2.0.2 source-map-js: 1.2.0 + '@vue/compiler-core@3.5.46': + dependencies: + '@babel/parser': 7.29.15 + '@vue/shared': 3.5.46 + entities: 7.0.1 + estree-walker: 2.0.2 + source-map-js: 1.3.0 + '@vue/compiler-dom@3.4.24': dependencies: '@vue/compiler-core': 3.4.24 '@vue/shared': 3.4.24 + '@vue/compiler-dom@3.5.46': + dependencies: + '@vue/compiler-core': 3.5.46 + '@vue/shared': 3.5.46 + + '@vue/compiler-sfc@3.5.46': + dependencies: + '@babel/parser': 7.29.15 + '@vue/compiler-core': 3.5.46 + '@vue/compiler-dom': 3.5.46 + '@vue/compiler-ssr': 3.5.46 + '@vue/shared': 3.5.46 + estree-walker: 2.0.2 + magic-string: 0.30.21 + postcss: 8.5.34 + source-map-js: 1.3.0 + + '@vue/compiler-ssr@3.5.46': + dependencies: + '@vue/compiler-dom': 3.5.46 + '@vue/shared': 3.5.46 + '@vue/language-core@1.8.27(typescript@5.5.4)': dependencies: '@volar/language-core': 1.11.1 @@ -21866,8 +22051,41 @@ snapshots: optionalDependencies: typescript: 5.5.4 + '@vue/reactivity@3.5.46': + dependencies: + '@vue/shared': 3.5.46 + + '@vue/runtime-core@3.5.46': + dependencies: + '@vue/reactivity': 3.5.46 + '@vue/shared': 3.5.46 + + '@vue/runtime-dom@3.5.46': + dependencies: + '@vue/reactivity': 3.5.46 + '@vue/runtime-core': 3.5.46 + '@vue/shared': 3.5.46 + csstype: 3.2.4 + + '@vue/server-renderer@3.5.46': + dependencies: + '@vue/compiler-ssr': 3.5.46 + '@vue/runtime-dom': 3.5.46 + '@vue/shared': 3.5.46 + '@vue/shared@3.4.24': {} + '@vue/shared@3.5.46': {} + + '@vue/test-utils@2.6.0(@vue/compiler-dom@3.5.46)(@vue/server-renderer@3.5.46)(vue@3.5.46(typescript@5.5.4))': + dependencies: + '@vue/compiler-dom': 3.5.46 + js-beautify: 2.0.3 + vue: 3.5.46(typescript@5.5.4) + vue-component-type-helpers: 3.3.14 + optionalDependencies: + '@vue/server-renderer': 3.5.46 + '@web3-storage/multipart-parser@1.0.0': {} '@webassemblyjs/ast@1.12.1': @@ -21968,6 +22186,8 @@ snapshots: abbrev@2.0.0: {} + abbrev@5.0.0: {} + abort-controller@3.0.0: dependencies: event-target-shim: 5.0.1 @@ -21979,7 +22199,7 @@ snapshots: acorn-globals@7.0.1: dependencies: - acorn: 8.11.3 + acorn: 8.12.0 acorn-walk: 8.3.2 acorn-import-assertions@1.9.0(acorn@8.12.0): @@ -21991,10 +22211,6 @@ snapshots: dependencies: acorn: 8.12.0 - acorn-jsx@5.3.2(acorn@8.11.3): - dependencies: - acorn: 8.11.3 - acorn-jsx@5.3.2(acorn@8.12.0): dependencies: acorn: 8.12.0 @@ -22003,8 +22219,6 @@ snapshots: acorn-walk@8.3.2: {} - acorn@8.10.0: {} - acorn@8.11.2: {} acorn@8.11.3: {} @@ -22234,7 +22448,7 @@ snapshots: dependencies: '@babel/core': 7.24.4 - babel-loader@9.1.3(@babel/core@7.24.7)(webpack@5.92.1(esbuild@0.21.5)): + babel-loader@9.1.3(@babel/core@7.24.7)(webpack@5.92.1): dependencies: '@babel/core': 7.24.7 find-cache-dir: 4.0.0 @@ -22327,6 +22541,8 @@ snapshots: balanced-match@1.0.2: {} + balanced-match@4.0.4: {} + base64-js@1.5.1: {} base64id@2.0.0: {} @@ -22407,6 +22623,10 @@ snapshots: dependencies: balanced-match: 1.0.2 + brace-expansion@5.1.2: + dependencies: + balanced-match: 4.0.4 + braces@3.0.2: dependencies: fill-range: 7.0.1 @@ -22520,7 +22740,7 @@ snapshots: dependencies: '@npmcli/fs': 3.1.0 fs-minipass: 3.0.2 - glob: 10.2.7 + glob: 10.4.5 lru-cache: 10.4.3 minipass: 7.1.2 minipass-collect: 2.0.1 @@ -22798,6 +23018,8 @@ snapshots: commander@12.1.0: {} + commander@14.0.3: {} + commander@2.20.3: {} commander@4.1.1: {} @@ -22907,7 +23129,7 @@ snapshots: dependencies: is-what: 4.1.15 - copy-webpack-plugin@12.0.2(webpack@5.92.1(esbuild@0.21.5)): + copy-webpack-plugin@12.0.2(webpack@5.92.1): dependencies: fast-glob: 3.3.2 glob-parent: 6.0.2 @@ -22960,7 +23182,7 @@ snapshots: dom-serializer: 2.0.0 domhandler: 5.0.3 htmlparser2: 8.0.2 - postcss: 8.4.38 + postcss: 8.4.41 postcss-media-query-parser: 0.2.3 cron-parser@4.9.0: @@ -22981,14 +23203,14 @@ snapshots: crypto-random-string@2.0.0: {} - css-loader@7.1.2(webpack@5.92.1(esbuild@0.21.5)): + css-loader@7.1.2(webpack@5.92.1): dependencies: - icss-utils: 5.1.0(postcss@8.4.38) - postcss: 8.4.38 - postcss-modules-extract-imports: 3.1.0(postcss@8.4.38) - postcss-modules-local-by-default: 4.0.5(postcss@8.4.38) - postcss-modules-scope: 3.2.0(postcss@8.4.38) - postcss-modules-values: 4.0.0(postcss@8.4.38) + icss-utils: 5.1.0(postcss@8.4.41) + postcss: 8.4.41 + postcss-modules-extract-imports: 3.1.0(postcss@8.4.41) + postcss-modules-local-by-default: 4.0.5(postcss@8.4.41) + postcss-modules-scope: 3.2.0(postcss@8.4.41) + postcss-modules-values: 4.0.0(postcss@8.4.41) postcss-value-parser: 4.2.0 semver: 7.6.2 optionalDependencies: @@ -23018,6 +23240,8 @@ snapshots: csstype@3.1.2: {} + csstype@3.2.4: {} + csv-generate@3.4.3: {} csv-parse@4.16.3: {} @@ -23508,6 +23732,13 @@ snapshots: semver: 5.7.1 sigmund: 1.0.1 + editorconfig@3.0.2: + dependencies: + '@one-ini/wasm': 0.2.1 + commander: 14.0.3 + minimatch: 10.2.6 + semver: 7.8.6 + ee-first@1.1.1: {} ejs@3.1.9: @@ -23575,6 +23806,8 @@ snapshots: entities@4.5.0: {} + entities@7.0.1: {} + env-paths@2.2.1: {} envinfo@7.8.1: {} @@ -23874,8 +24107,8 @@ snapshots: espree@9.2.0: dependencies: - acorn: 8.11.3 - acorn-jsx: 5.3.2(acorn@8.11.3) + acorn: 8.12.0 + acorn-jsx: 5.3.2(acorn@8.12.0) eslint-visitor-keys: 3.4.1 espree@9.5.2: @@ -24443,14 +24676,6 @@ snapshots: glob-to-regexp@0.4.1: {} - glob@10.2.7: - dependencies: - foreground-child: 3.1.1 - jackspeak: 2.2.1 - minimatch: 9.0.4 - minipass: 5.0.0 - path-scurry: 1.9.2 - glob@10.4.5: dependencies: foreground-child: 3.1.1 @@ -24460,6 +24685,12 @@ snapshots: package-json-from-dist: 1.0.0 path-scurry: 1.11.1 + glob@13.0.7: + dependencies: + minimatch: 10.2.6 + minipass: 7.1.3 + path-scurry: 2.0.2 + glob@7.1.6: dependencies: fs.realpath: 1.0.0 @@ -24949,9 +25180,9 @@ snapshots: dependencies: safer-buffer: 2.1.2 - icss-utils@5.1.0(postcss@8.4.38): + icss-utils@5.1.0(postcss@8.4.41): dependencies: - postcss: 8.4.38 + postcss: 8.4.41 ieee754@1.2.1: {} @@ -25357,7 +25588,7 @@ snapshots: istanbul-lib-instrument@6.0.2: dependencies: '@babel/core': 7.24.7 - '@babel/parser': 7.24.7 + '@babel/parser': 7.25.3 '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.2.2 semver: 7.6.2 @@ -25394,12 +25625,6 @@ snapshots: html-escaper: 2.0.2 istanbul-lib-report: 3.0.1 - jackspeak@2.2.1: - dependencies: - '@isaacs/cliui': 8.0.2 - optionalDependencies: - '@pkgjs/parseargs': 0.11.0 - jackspeak@3.4.3: dependencies: '@isaacs/cliui': 8.0.2 @@ -25507,8 +25732,18 @@ snapshots: glob: 8.1.0 nopt: 6.0.0 + js-beautify@2.0.3: + dependencies: + config-chain: 1.1.13 + editorconfig: 3.0.2 + glob: 13.0.7 + js-cookie: 3.0.8 + nopt: 10.0.1 + js-cookie@3.0.5: {} + js-cookie@3.0.8: {} + js-levenshtein@1.1.6: {} js-tokens@4.0.0: {} @@ -25527,7 +25762,7 @@ snapshots: jscodeshift@0.14.0(@babel/preset-env@7.21.5(@babel/core@7.21.8)): dependencies: '@babel/core': 7.24.4 - '@babel/parser': 7.24.7 + '@babel/parser': 7.25.3 '@babel/plugin-proposal-class-properties': 7.18.6(@babel/core@7.24.4) '@babel/plugin-proposal-nullish-coalescing-operator': 7.18.6(@babel/core@7.24.4) '@babel/plugin-proposal-optional-chaining': 7.21.0(@babel/core@7.24.4) @@ -25552,7 +25787,7 @@ snapshots: jscodeshift@0.14.0(@babel/preset-env@7.22.5(@babel/core@7.23.6)): dependencies: '@babel/core': 7.24.4 - '@babel/parser': 7.24.7 + '@babel/parser': 7.25.3 '@babel/plugin-proposal-class-properties': 7.18.6(@babel/core@7.24.4) '@babel/plugin-proposal-nullish-coalescing-operator': 7.18.6(@babel/core@7.24.4) '@babel/plugin-proposal-optional-chaining': 7.21.0(@babel/core@7.24.4) @@ -25577,7 +25812,7 @@ snapshots: jsdom@20.0.3: dependencies: abab: 2.0.6 - acorn: 8.11.2 + acorn: 8.12.0 acorn-globals: 7.0.1 cssom: 0.5.0 cssstyle: 2.3.0 @@ -25600,7 +25835,7 @@ snapshots: whatwg-encoding: 2.0.0 whatwg-mimetype: 3.0.0 whatwg-url: 11.0.0 - ws: 8.13.0 + ws: 8.18.0 xml-name-validator: 4.0.0 transitivePeerDependencies: - bufferutil @@ -25781,7 +26016,7 @@ snapshots: leac@0.6.0: {} - less-loader@12.2.0(less@4.2.0)(webpack@5.92.1(esbuild@0.21.5)): + less-loader@12.2.0(less@4.2.0)(webpack@5.92.1): dependencies: less: 4.2.0 optionalDependencies: @@ -25813,7 +26048,7 @@ snapshots: prelude-ls: 1.2.1 type-check: 0.4.0 - license-webpack-plugin@4.0.2(webpack@5.92.1(esbuild@0.21.5)): + license-webpack-plugin@4.0.2(webpack@5.92.1): dependencies: webpack-sources: 3.2.3 optionalDependencies: @@ -25961,6 +26196,8 @@ snapshots: lru-cache@10.4.3: {} + lru-cache@11.5.4: {} + lru-cache@4.1.5: dependencies: pseudomap: 1.0.2 @@ -25974,8 +26211,6 @@ snapshots: dependencies: yallist: 4.0.0 - lru-cache@9.1.2: {} - lucide-react@0.320.0(react@18.2.0): dependencies: react: 18.2.0 @@ -26000,6 +26235,10 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.4.15 + magic-string@0.30.21: + dependencies: + '@jridgewell/sourcemap-codec': 1.6.0 + magic-string@0.30.8: dependencies: '@jridgewell/sourcemap-codec': 1.4.15 @@ -26602,8 +26841,8 @@ snapshots: micromark-extension-mdxjs@1.0.1: dependencies: - acorn: 8.11.3 - acorn-jsx: 5.3.2(acorn@8.11.3) + acorn: 8.12.0 + acorn-jsx: 5.3.2(acorn@8.12.0) micromark-extension-mdx-expression: 1.0.8 micromark-extension-mdx-jsx: 1.0.5 micromark-extension-mdx-md: 1.0.1 @@ -26613,8 +26852,8 @@ snapshots: micromark-extension-mdxjs@3.0.0: dependencies: - acorn: 8.11.3 - acorn-jsx: 5.3.2(acorn@8.11.3) + acorn: 8.12.0 + acorn-jsx: 5.3.2(acorn@8.12.0) micromark-extension-mdx-expression: 3.0.0 micromark-extension-mdx-jsx: 3.0.0 micromark-extension-mdx-md: 2.0.0 @@ -26919,7 +27158,7 @@ snapshots: min-indent@1.0.1: {} - mini-css-extract-plugin@2.9.0(webpack@5.92.1(esbuild@0.21.5)): + mini-css-extract-plugin@2.9.0(webpack@5.92.1): dependencies: schema-utils: 4.1.0 tapable: 2.2.1 @@ -26948,6 +27187,10 @@ snapshots: minimalistic-assert@1.0.1: {} + minimatch@10.2.6: + dependencies: + brace-expansion: 5.1.2 + minimatch@3.0.8: dependencies: brace-expansion: 1.1.11 @@ -27010,6 +27253,8 @@ snapshots: minipass@7.1.2: {} + minipass@7.1.3: {} + minizlib@2.1.2: dependencies: minipass: 3.3.6 @@ -27085,7 +27330,7 @@ snapshots: '@types/cookie': 0.4.1 '@types/js-levenshtein': 1.1.1 chalk: 4.1.1 - chokidar: 3.5.3 + chokidar: 3.6.0 cookie: 0.4.2 graphql: 16.6.0 headers-polyfill: 3.1.2 @@ -27150,6 +27395,8 @@ snapshots: object-assign: 4.1.1 thenify-all: 1.6.0 + nanoid@3.3.20: {} + nanoid@3.3.6: {} nanoid@3.3.7: {} @@ -27475,6 +27722,10 @@ snapshots: dependencies: abbrev: 1.1.1 + nopt@10.0.1: + dependencies: + abbrev: 5.0.0 + nopt@6.0.0: dependencies: abbrev: 1.1.1 @@ -27917,10 +28168,10 @@ snapshots: lru-cache: 10.4.3 minipass: 7.1.2 - path-scurry@1.9.2: + path-scurry@2.0.2: dependencies: - lru-cache: 9.1.2 - minipass: 5.0.0 + lru-cache: 11.5.4 + minipass: 7.1.3 path-to-regexp@0.1.7: {} @@ -27968,6 +28219,8 @@ snapshots: picocolors@1.0.1: {} + picocolors@1.1.1: {} + picomatch@2.3.1: {} picomatch@4.0.2: {} @@ -28033,20 +28286,20 @@ snapshots: camelcase-css: 2.0.1 postcss: 8.4.24 - postcss-load-config@3.1.4(postcss@8.4.41)(ts-node@10.9.1(@types/node@20.3.1)(typescript@5.5.4)): + postcss-load-config@3.1.4(postcss@8.5.34)(ts-node@10.9.1(@types/node@20.3.1)(typescript@5.5.4)): dependencies: lilconfig: 2.1.0 yaml: 1.10.2 optionalDependencies: - postcss: 8.4.41 + postcss: 8.5.34 ts-node: 10.9.1(@types/node@20.3.1)(typescript@5.5.4) - postcss-load-config@3.1.4(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)): + postcss-load-config@3.1.4(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)): dependencies: lilconfig: 2.1.0 yaml: 1.10.2 optionalDependencies: - postcss: 8.4.41 + postcss: 8.5.34 ts-node: 10.9.1(@types/node@22.1.0)(typescript@5.5.4) postcss-load-config@4.0.1(postcss@8.4.24)(ts-node@10.9.1(@types/node@18.16.17)(typescript@5.5.4)): @@ -28066,16 +28319,16 @@ snapshots: ts-node: 10.9.1(@types/node@20.3.1)(typescript@5.5.4) optional: true - postcss-load-config@4.0.1(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)): + postcss-load-config@4.0.1(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)): dependencies: lilconfig: 2.1.0 yaml: 2.3.1 optionalDependencies: - postcss: 8.4.41 + postcss: 8.5.34 ts-node: 10.9.1(@types/node@22.1.0)(typescript@5.5.4) optional: true - postcss-loader@8.1.1(postcss@8.4.38)(typescript@5.5.4)(webpack@5.92.1(esbuild@0.21.5)): + postcss-loader@8.1.1(postcss@8.4.38)(typescript@5.5.4)(webpack@5.92.1): dependencies: cosmiconfig: 9.0.0(typescript@5.5.4) jiti: 1.21.6 @@ -28088,26 +28341,26 @@ snapshots: postcss-media-query-parser@0.2.3: {} - postcss-modules-extract-imports@3.1.0(postcss@8.4.38): + postcss-modules-extract-imports@3.1.0(postcss@8.4.41): dependencies: - postcss: 8.4.38 + postcss: 8.4.41 - postcss-modules-local-by-default@4.0.5(postcss@8.4.38): + postcss-modules-local-by-default@4.0.5(postcss@8.4.41): dependencies: - icss-utils: 5.1.0(postcss@8.4.38) - postcss: 8.4.38 + icss-utils: 5.1.0(postcss@8.4.41) + postcss: 8.4.41 postcss-selector-parser: 6.0.13 postcss-value-parser: 4.2.0 - postcss-modules-scope@3.2.0(postcss@8.4.38): + postcss-modules-scope@3.2.0(postcss@8.4.41): dependencies: - postcss: 8.4.38 + postcss: 8.4.41 postcss-selector-parser: 6.0.13 - postcss-modules-values@4.0.0(postcss@8.4.38): + postcss-modules-values@4.0.0(postcss@8.4.41): dependencies: - icss-utils: 5.1.0(postcss@8.4.38) - postcss: 8.4.38 + icss-utils: 5.1.0(postcss@8.4.41) + postcss: 8.4.41 postcss-nested@6.0.1(postcss@8.4.24): dependencies: @@ -28156,6 +28409,12 @@ snapshots: picocolors: 1.0.1 source-map-js: 1.2.0 + postcss@8.5.34: + dependencies: + nanoid: 3.3.20 + picocolors: 1.1.1 + source-map-js: 1.3.0 + postgres-array@2.0.0: {} postgres-bytea@1.0.0: {} @@ -28864,7 +29123,7 @@ snapshots: adjust-sourcemap-loader: 4.0.0 convert-source-map: 1.9.0 loader-utils: 2.0.4 - postcss: 8.4.38 + postcss: 8.4.41 source-map: 0.6.1 resolve.exports@2.0.2: {} @@ -28943,14 +29202,6 @@ snapshots: dependencies: estree-walker: 0.6.1 - rollup@3.25.0: - optionalDependencies: - fsevents: 2.3.3 - - rollup@3.27.1: - optionalDependencies: - fsevents: 2.3.3 - rollup@3.29.4: optionalDependencies: fsevents: 2.3.3 @@ -29018,7 +29269,7 @@ snapshots: mkdirp: 0.5.6 rimraf: 2.7.1 - sass-loader@14.2.1(sass@1.77.6)(webpack@5.92.1(esbuild@0.21.5)): + sass-loader@14.2.1(sass@1.77.6)(webpack@5.92.1): dependencies: neo-async: 2.6.2 optionalDependencies: @@ -29033,13 +29284,13 @@ snapshots: sass@1.77.6: dependencies: - chokidar: 3.5.3 + chokidar: 3.6.0 immutable: 4.3.0 source-map-js: 1.2.0 sass@1.77.8: dependencies: - chokidar: 3.5.3 + chokidar: 3.6.0 immutable: 4.3.0 source-map-js: 1.2.0 @@ -29118,6 +29369,8 @@ snapshots: semver@7.6.2: {} + semver@7.8.6: {} + send@0.18.0: dependencies: debug: 2.6.9 @@ -29393,7 +29646,9 @@ snapshots: source-map-js@1.2.0: {} - source-map-loader@5.0.0(webpack@5.92.1(esbuild@0.21.5)): + source-map-js@1.3.0: {} + + source-map-loader@5.0.0(webpack@5.92.1): dependencies: iconv-lite: 0.6.3 source-map-js: 1.2.0 @@ -29637,7 +29892,7 @@ snapshots: sucrase@3.32.0: dependencies: - '@jridgewell/gen-mapping': 0.3.3 + '@jridgewell/gen-mapping': 0.3.5 commander: 4.1.1 glob: 7.1.6 lines-and-columns: 1.2.4 @@ -29689,7 +29944,7 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} - svelte-check@2.10.3(@babel/core@7.23.6)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.4.41)(sass@1.77.8)(svelte@3.59.1): + svelte-check@2.10.3(@babel/core@7.23.6)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.5.34)(sass@1.77.8)(svelte@3.59.1): dependencies: '@jridgewell/trace-mapping': 0.3.18 chokidar: 3.5.3 @@ -29698,7 +29953,7 @@ snapshots: picocolors: 1.0.0 sade: 1.8.1 svelte: 3.59.1 - svelte-preprocess: 4.10.7(@babel/core@7.23.6)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.4.41)(sass@1.77.8)(svelte@3.59.1)(typescript@5.5.4) + svelte-preprocess: 4.10.7(@babel/core@7.23.6)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.5.34)(sass@1.77.8)(svelte@3.59.1)(typescript@5.5.4) typescript: 5.5.4 transitivePeerDependencies: - '@babel/core' @@ -29712,7 +29967,7 @@ snapshots: - stylus - sugarss - svelte-check@2.10.3(@babel/core@7.24.9)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.4.41)(sass@1.77.8)(svelte@3.59.1): + svelte-check@2.10.3(@babel/core@7.24.9)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.5.34)(sass@1.77.8)(svelte@3.59.1): dependencies: '@jridgewell/trace-mapping': 0.3.18 chokidar: 3.5.3 @@ -29721,7 +29976,7 @@ snapshots: picocolors: 1.0.0 sade: 1.8.1 svelte: 3.59.1 - svelte-preprocess: 4.10.7(@babel/core@7.24.9)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.4.41)(sass@1.77.8)(svelte@3.59.1)(typescript@5.5.4) + svelte-preprocess: 4.10.7(@babel/core@7.24.9)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.5.34)(sass@1.77.8)(svelte@3.59.1)(typescript@5.5.4) typescript: 5.5.4 transitivePeerDependencies: - '@babel/core' @@ -29739,7 +29994,7 @@ snapshots: dependencies: svelte: 3.59.1 - svelte-preprocess@4.10.7(@babel/core@7.23.6)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.4.41)(sass@1.77.8)(svelte@3.59.1)(typescript@5.5.4): + svelte-preprocess@4.10.7(@babel/core@7.23.6)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.5.34)(sass@1.77.8)(svelte@3.59.1)(typescript@5.5.4): dependencies: '@types/pug': 2.0.6 '@types/sass': 1.45.0 @@ -29751,12 +30006,12 @@ snapshots: optionalDependencies: '@babel/core': 7.23.6 less: 4.2.0 - postcss: 8.4.41 - postcss-load-config: 4.0.1(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)) + postcss: 8.5.34 + postcss-load-config: 4.0.1(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)) sass: 1.77.8 typescript: 5.5.4 - svelte-preprocess@4.10.7(@babel/core@7.24.9)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.4.41)(sass@1.77.8)(svelte@3.59.1)(typescript@5.5.4): + svelte-preprocess@4.10.7(@babel/core@7.24.9)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)))(postcss@8.5.34)(sass@1.77.8)(svelte@3.59.1)(typescript@5.5.4): dependencies: '@types/pug': 2.0.6 '@types/sass': 1.45.0 @@ -29768,8 +30023,8 @@ snapshots: optionalDependencies: '@babel/core': 7.24.9 less: 4.2.0 - postcss: 8.4.41 - postcss-load-config: 4.0.1(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)) + postcss: 8.5.34 + postcss-load-config: 4.0.1(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)) sass: 1.77.8 typescript: 5.5.4 @@ -30151,47 +30406,47 @@ snapshots: tsscmp@1.0.6: {} - tsup@6.7.0(postcss@8.4.41)(ts-node@10.9.1(@types/node@20.3.1)(typescript@5.5.4))(typescript@5.5.4): + tsup@6.7.0(postcss@8.5.34)(ts-node@10.9.1(@types/node@20.3.1)(typescript@5.5.4))(typescript@5.5.4): dependencies: bundle-require: 4.0.1(esbuild@0.17.19) cac: 6.7.14 - chokidar: 3.5.3 - debug: 4.3.4 + chokidar: 3.6.0 + debug: 4.3.5 esbuild: 0.17.19 execa: 5.1.1 globby: 11.1.0 joycon: 3.1.1 - postcss-load-config: 3.1.4(postcss@8.4.41)(ts-node@10.9.1(@types/node@20.3.1)(typescript@5.5.4)) + postcss-load-config: 3.1.4(postcss@8.5.34)(ts-node@10.9.1(@types/node@20.3.1)(typescript@5.5.4)) resolve-from: 5.0.0 - rollup: 3.25.0 + rollup: 3.29.4 source-map: 0.8.0-beta.0 sucrase: 3.32.0 tree-kill: 1.2.2 optionalDependencies: - postcss: 8.4.41 + postcss: 8.5.34 typescript: 5.5.4 transitivePeerDependencies: - supports-color - ts-node - tsup@6.7.0(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4))(typescript@5.5.4): + tsup@6.7.0(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4))(typescript@5.5.4): dependencies: bundle-require: 4.0.1(esbuild@0.17.19) cac: 6.7.14 - chokidar: 3.5.3 - debug: 4.3.4 + chokidar: 3.6.0 + debug: 4.3.5 esbuild: 0.17.19 execa: 5.1.1 globby: 11.1.0 joycon: 3.1.1 - postcss-load-config: 3.1.4(postcss@8.4.41)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)) + postcss-load-config: 3.1.4(postcss@8.5.34)(ts-node@10.9.1(@types/node@22.1.0)(typescript@5.5.4)) resolve-from: 5.0.0 - rollup: 3.25.0 + rollup: 3.29.4 source-map: 0.8.0-beta.0 sucrase: 3.32.0 tree-kill: 1.2.2 optionalDependencies: - postcss: 8.4.41 + postcss: 8.5.34 typescript: 5.5.4 transitivePeerDependencies: - supports-color @@ -30508,7 +30763,7 @@ snapshots: dependencies: browserslist: 4.21.7 escalade: 3.1.1 - picocolors: 1.0.0 + picocolors: 1.0.1 update-browserslist-db@1.0.16(browserslist@4.22.2): dependencies: @@ -30746,7 +31001,7 @@ snapshots: vite@5.3.2(@types/node@20.3.1)(less@4.2.0)(sass@1.77.6)(terser@5.29.2): dependencies: esbuild: 0.21.5 - postcss: 8.4.38 + postcss: 8.4.41 rollup: 4.18.0 optionalDependencies: '@types/node': 20.3.1 @@ -30905,6 +31160,8 @@ snapshots: vscode-textmate@8.0.0: {} + vue-component-type-helpers@3.3.14: {} + vue-template-compiler@2.7.16: dependencies: de-indent: 1.0.2 @@ -30914,7 +31171,17 @@ snapshots: dependencies: '@volar/typescript': 1.11.1 '@vue/language-core': 1.8.27(typescript@5.5.4) - semver: 7.6.0 + semver: 7.6.2 + typescript: 5.5.4 + + vue@3.5.46(typescript@5.5.4): + dependencies: + '@vue/compiler-dom': 3.5.46 + '@vue/compiler-sfc': 3.5.46 + '@vue/runtime-dom': 3.5.46 + '@vue/server-renderer': 3.5.46 + '@vue/shared': 3.5.46 + optionalDependencies: typescript: 5.5.4 w3c-keyname@2.2.8: {} @@ -30969,8 +31236,8 @@ snapshots: webpack-bundle-analyzer@4.7.0: dependencies: - acorn: 8.10.0 - acorn-walk: 8.2.0 + acorn: 8.12.0 + acorn-walk: 8.3.2 chalk: 4.1.2 commander: 7.2.0 gzip-size: 6.0.0 @@ -31041,7 +31308,7 @@ snapshots: webpack-sources@3.2.3: {} - webpack-subresource-integrity@5.1.0(webpack@5.92.1(esbuild@0.21.5)): + webpack-subresource-integrity@5.1.0(webpack@5.92.1): dependencies: typed-assert: 1.0.9 webpack: 5.92.1(esbuild@0.21.5) From 5aecbecae8a7f553f376b3a753c5dfccd7def439 Mon Sep 17 00:00:00 2001 From: gostmkr24 Date: Thu, 3 Dec 2026 09:42:57 +0300 Subject: [PATCH 2/6] fix(vue): isolate scopes and defer variant assignment Two correctness issues found in review: - The reactive data was seeded with `getProjectData()`, which picks and persists a variant for every test right away. On a fresh browser the variant was therefore drawn from the local config weights before the server weights were known and then kept forever. The initial state is now built without selecting variants; they are chosen after initialization, so an existing assignment is still preserved. - State lived in a single shared instance, so two apps (or two providers) which reuse one `createAbby()` result saw each other's data, including across concurrent SSR requests. Every plugin install, `provideAbby()` and `AbbyProvider` now owns its instance, reactive data and request state. The synchronous helpers keep using a module level instance. Also from the review: cookie lifetime is forwarded to the storage service, remote config fallbacks are resolved before the type default (same order as core), the empty pre-mount state is part of the returned type, and the test command now typechecks, so the type assertions in types.test.ts actually run. Verified: tsc --noEmit, biome on the changed files, tsup build, 31 vue tests, and the react suite as a regression check. --- packages/vue/README.md | 8 + packages/vue/package.json | 2 +- packages/vue/src/createAbby.ts | 302 ++++++++++++++++++++---------- packages/vue/tests/plugin.test.ts | 92 +++++++++ packages/vue/tests/types.test.ts | 5 +- 5 files changed, 308 insertions(+), 101 deletions(-) diff --git a/packages/vue/README.md b/packages/vue/README.md index 810cfc45..00cd7921 100644 --- a/packages/vue/README.md +++ b/packages/vue/README.md @@ -91,6 +91,14 @@ import { AbbyProvider } from "~/lib/abby"; ``` +Every application, provider and `provideAbby()` call gets its own Abby +instance and its own project data, so one `createAbby()` result can safely be +reused across apps and across concurrent server requests. Keep in mind that the +synchronous helpers (`getFeatureFlagValue`, `getABTestValue`, +`getRemoteConfig`, `getVariants`, `updateUserProperties`, `__abby__`) are tied +to the module level instance and not to a scope, so prefer the composables +inside of components when the scopes differ. + ### `createAbby` #### Parameters diff --git a/packages/vue/package.json b/packages/vue/package.json index 87b8b4d1..1f00929c 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -16,7 +16,7 @@ "scripts": { "build": "tsup src/", "dev": "pnpm run build --watch", - "test": "vitest" + "test": "tsc --noEmit && vitest" }, "homepage": "https://docs.tryabby.com", "keywords": ["vue", "nuxt", "ab-testing", "feature-flags", "remote-config", "abby"], diff --git a/packages/vue/src/createAbby.ts b/packages/vue/src/createAbby.ts index 696c95d1..d2bce729 100644 --- a/packages/vue/src/createAbby.ts +++ b/packages/vue/src/createAbby.ts @@ -4,28 +4,27 @@ import { type AbbyConfig, type AbbyDataResponse, AbbyEventType, - getDefaultRemoteConfigValue, HttpService, - type RemoteConfigValue, type RemoteConfigValueString, type RemoteConfigValueStringToType, type ValidatorType, + getDefaultRemoteConfigValue, } from "@tryabby/core"; import type { Infer } from "@tryabby/core/validation"; import { type App, type Component, - computed, type ComputedRef, type InjectionKey, + type Plugin, + type ShallowRef, + computed, defineComponent, inject, onMounted, onUnmounted, - type Plugin, provide, ref, - type ShallowRef, shallowRef, watch, } from "vue"; @@ -37,7 +36,6 @@ import { import type { ABTestReturnValue, AbbyDevtoolProps, - DevtoolsFactory, withDevtoolsFunction, } from "./types"; @@ -78,86 +76,162 @@ export function createAbby< // we need to return the config as a const so that the types are narrowed const config = abbyConfig; - const abby = new Abby< - FlagName, - TestName, - Tests, - RemoteConfig, - RemoteConfigName, - string[], - User - >( - config, - { - get: (key: string) => { - if (typeof window === "undefined") return null; - return TestStorageService.get(config.projectId, key); - }, - set: (key: string, value: any) => { - if (typeof window === "undefined" || config.cookies?.disableByDefault) - return; - TestStorageService.set(config.projectId, key, value); - }, - }, - { - get: (key: string) => { - if (typeof window === "undefined") return null; - return FlagStorageService.get(config.projectId, key); - }, - set: (key: string, value: any) => { - if (typeof window === "undefined") return; - FlagStorageService.set(config.projectId, key, value); - }, - }, - { - get: (key: string) => { - if (typeof window === "undefined") return null; - return RemoteConfigStorageService.get(config.projectId, key); + const createInstance = () => + new Abby< + FlagName, + TestName, + Tests, + RemoteConfig, + RemoteConfigName, + string[], + User + >( + config, + { + get: (key: string) => { + if (typeof window === "undefined") return null; + return TestStorageService.get(config.projectId, key); + }, + set: ( + key: string, + value: any, + options?: { expiresInDays?: number } + ) => { + if (typeof window === "undefined" || config.cookies?.disableByDefault) + return; + // forward the configured cookie lifetime, otherwise the storage + // service falls back to its own default + TestStorageService.set(config.projectId, key, value, options); + }, }, - set: (key: string, value: any) => { - if (typeof window === "undefined") return; - RemoteConfigStorageService.set(config.projectId, key, value); + { + get: (key: string) => { + if (typeof window === "undefined") return null; + return FlagStorageService.get(config.projectId, key); + }, + set: (key: string, value: any) => { + if (typeof window === "undefined") return; + FlagStorageService.set(config.projectId, key, value); + }, }, - } - ); + { + get: (key: string) => { + if (typeof window === "undefined") return null; + return RemoteConfigStorageService.get(config.projectId, key); + }, + set: (key: string, value: any) => { + if (typeof window === "undefined") return; + RemoteConfigStorageService.set(config.projectId, key, value); + }, + } + ); - type AbbyProjectData = ReturnType; + type AbbyInstance = ReturnType; + + type AbbyProjectData = ReturnType; type AbbyContext = { - abby: typeof abby; + abby: AbbyInstance; data: ShallowRef; config: typeof config; }; /** - * The reactive project data. Every component which injects the Abby context - * shares this ref, so updates (for example from the devtools) are reflected - * everywhere. + * Project data which does not assign an A/B test variant yet. + * + * `getProjectData()` picks and persists a variant for every test which has + * no stored one. Picking it before the weights from the server are known + * would freeze a variant which was drawn from the local config weights, even + * when the server weights would have chosen a different one. */ - const data = shallowRef(abby.getProjectData()); - - abby.subscribe((newData) => { - data.value = newData as AbbyProjectData; + const createUninitializedProjectData = ( + instance: AbbyInstance + ): AbbyProjectData => ({ + tests: Object.keys(config.tests ?? {}).reduce( + (acc, testName) => { + acc[testName as TestName] = { + ...(config.tests as Tests)[testName as TestName], + selectedVariant: "", + }; + return acc; + }, + {} as AbbyProjectData["tests"] + ), + flags: (config.flags ?? []).reduce( + (acc, flagName) => { + // reading a flag does not persist anything + acc[flagName] = { value: instance.getFeatureFlag(flagName) }; + return acc; + }, + {} as AbbyProjectData["flags"] + ), + remoteConfig: ( + Object.keys(config.remoteConfig ?? {}) as Array + ).reduce( + (acc, remoteConfigName) => { + acc[remoteConfigName] = { + value: instance.getRemoteConfig(remoteConfigName), + }; + return acc; + }, + {} as AbbyProjectData["remoteConfig"] + ), }); - let dataRequested = false; + type AbbyScope = { + abby: AbbyInstance; + data: ShallowRef; + ensureData: (initialData?: AbbyDataResponse) => void; + }; + + /** + * Creates an isolated scope: own core instance, own reactive data and own + * request state. Two applications (or two providers) which reuse the same + * `createAbby()` result therefore never see each other's data. + */ + const createScope = (): AbbyScope => { + const abby = createInstance(); + const data = shallowRef( + createUninitializedProjectData(abby) + ); + + // the reactive project data. Every component which injects this scope + // shares the ref, so updates (for example from the devtools) are reflected + // everywhere inside of it + abby.subscribe((newData) => { + data.value = newData as AbbyProjectData; + }); + + let dataRequested = false; - const ensureData = (initialData?: AbbyDataResponse) => { - if (initialData) { - abby.init(initialData); + const ensureData = (initialData?: AbbyDataResponse) => { + if (initialData) { + abby.init(initialData); + dataRequested = true; + return; + } + if (dataRequested) return; dataRequested = true; - return; - } - if (dataRequested) return; - dataRequested = true; - void abby.loadProjectData(); + void abby.loadProjectData(); + }; + + return { abby, data, ensureData }; }; + // instance for the synchronous helpers and `__abby__`, which work without a + // component context + const defaultScope = createScope(); + // every createAbby() call gets its own injection key, so multiple Abby // instances can live in the same app without clashing const ABBY_INJECTION_KEY = Symbol("abby"); - const context: AbbyContext = { abby, data, config }; + const createContext = (options?: AbbyProviderOptions): AbbyContext => { + const scope = createScope(); + scope.ensureData(options?.initialData); + + return { abby: scope.abby, data: scope.data, config }; + }; const useAbbyContext = (): AbbyContext => { const injected = inject( @@ -179,8 +253,10 @@ export function createAbby< * inside of a setup function. */ const provideAbby = (options?: AbbyProviderOptions) => { - ensureData(options?.initialData); - provide(ABBY_INJECTION_KEY as unknown as InjectionKey, context); + provide( + ABBY_INJECTION_KEY as unknown as InjectionKey, + createContext(options) + ); }; /** @@ -189,8 +265,10 @@ export function createAbby< */ const AbbyPlugin: Plugin<[AbbyProviderOptions?]> = { install(app: App, options?: AbbyProviderOptions) { - ensureData(options?.initialData); - app.provide(ABBY_INJECTION_KEY as unknown as InjectionKey, context); + app.provide( + ABBY_INJECTION_KEY as unknown as InjectionKey, + createContext(options) + ); }, }; @@ -238,7 +316,7 @@ export function createAbby< name: K, lookupObject?: Lookup ): { - variant: ComputedRef>; + variant: ComputedRef | "">; onAct: () => void; } => { const { data } = useAbbyContext(); @@ -254,16 +332,21 @@ export function createAbby< ); }); - const variant = computed>(() => { - const raw = selectedVariant.value; - if (!raw) { - // the empty string is only returned before the component is mounted - return "" as ABTestReturnValue; + const variant = computed | "">( + () => { + const raw = selectedVariant.value; + if (!raw) { + // the empty string is only returned before the component is mounted + return ""; + } + return lookupObject + ? ((lookupObject as any)[raw] as ABTestReturnValue< + Lookup, + TestVariant + >) + : (raw as ABTestReturnValue); } - return ( - lookupObject ? (lookupObject as any)[raw] : raw - ) as ABTestReturnValue; - }); + ); // ping the server as soon as we know which variant is rendered watch( @@ -315,7 +398,7 @@ export function createAbby< }; const useFeatureFlag = (name: FlagName) => { - const { data } = useAbbyContext(); + const { abby, data } = useAbbyContext(); return computed(() => { // fall back to the core implementation when the server did not send // a value for this flag (for example when it was added later on) @@ -349,10 +432,21 @@ export function createAbby< if (entry) return entry.value as RemoteConfigValueStringToType; // the server did not send a value for this variable (for example - // because it was added later on), so we use the configured default + // because it was added later on), so we use the configured fallback + // first and the configured default for the type second — the same order + // as the core implementation + const perVariableFallback = + config.settings?.remoteConfig?.fallbackValues?.[remoteConfigName]; + + if (perVariableFallback !== undefined) { + return perVariableFallback as RemoteConfigValueStringToType; + } + const remoteConfigType = config.remoteConfig?.[remoteConfigName]; if (!remoteConfigType) { - return getDefaultRemoteConfigValue("String") as RemoteConfigValueStringToType; + return getDefaultRemoteConfigValue( + "String" + ) as RemoteConfigValueStringToType; } const configuredDefault = @@ -375,21 +469,22 @@ export function createAbby< name: RemoteConfigName; value: RemoteConfigValueStringToType; }> - >(() => - ( - Object.keys(data.value.remoteConfig) as Array - ).map((configName) => ({ - name: configName, - value: data.value.remoteConfig[configName].value, - })) as Array<{ - name: RemoteConfigName; - value: RemoteConfigValueStringToType; - }> + >( + () => + (Object.keys(data.value.remoteConfig) as Array).map( + (configName) => ({ + name: configName, + value: data.value.remoteConfig[configName].value, + }) + ) as Array<{ + name: RemoteConfigName; + value: RemoteConfigValueStringToType; + }> ); }; const getFeatureFlagValue = (name: FlagName) => { - return abby.getFeatureFlag(name); + return defaultScope.abby.getFeatureFlag(name); }; const getRemoteConfig = < @@ -398,7 +493,7 @@ export function createAbby< >( remoteConfigName: T ): RemoteConfigValueStringToType => { - return abby.getRemoteConfig(remoteConfigName); + return defaultScope.abby.getRemoteConfig(remoteConfigName); }; const getABTestValue = < @@ -412,7 +507,7 @@ export function createAbby< testName: TestName, lookupObject?: Lookup ): ABTestReturnValue => { - const variant = abby.getTestVariant(testName); + const variant = defaultScope.abby.getTestVariant(testName); if (lookupObject === undefined) { return variant as any; } @@ -425,6 +520,15 @@ export function createAbby< setup() { let destroy: (() => void) | null = null; + // the devtools belong to the scope they are rendered in. The helper + // works outside of an Abby provider as well, so we fall back to the + // default instance then. + const injected = inject( + ABBY_INJECTION_KEY as unknown as InjectionKey, + null + ); + const instance = injected?.abby ?? defaultScope.abby; + onMounted(() => { if ( !props?.dangerouslyForceShow && @@ -435,7 +539,7 @@ export function createAbby< destroy = factory.create({ ...(props as AbbyDevtoolProps), - abby, + abby: instance, }); }); @@ -466,7 +570,7 @@ export function createAbby< * @returns an array of all variants */ const getVariants = (name: T) => { - return abby.getVariants(name); + return defaultScope.abby.getVariants(name); }; const updateUserProperties = ( @@ -474,7 +578,7 @@ export function createAbby< -readonly [K in keyof User]: Infer; }> ) => { - abby.updateUserProperties(user); + defaultScope.abby.updateUserProperties(user); }; return { @@ -494,6 +598,6 @@ export function createAbby< getVariants, updateUserProperties, withDevtools, - __abby__: abby, + __abby__: defaultScope.abby, }; } diff --git a/packages/vue/tests/plugin.test.ts b/packages/vue/tests/plugin.test.ts index 802ac815..fc7bf1af 100644 --- a/packages/vue/tests/plugin.test.ts +++ b/packages/vue/tests/plugin.test.ts @@ -1,6 +1,7 @@ import { flushPromises, mount } from "@vue/test-utils"; import { defineComponent, h, nextTick } from "vue"; import { createAbby } from "../src"; +import { TestStorageService } from "../src/StorageService"; const config = { environments: [""], @@ -117,6 +118,97 @@ describe("AbbyProvider", () => { }); }); +describe("data initialization", () => { + beforeEach(() => { + vi.restoreAllMocks(); + }); + + it("does not assign a variant before the server weights are known", async () => { + // a fresh browser: nothing is stored yet + const setSpy = vi + .spyOn(TestStorageService, "set") + .mockImplementation(() => {}); + vi.spyOn(TestStorageService, "get").mockReturnValue(null); + + const abby = createAbby({ + ...config, + // the mocked API sends [1, 0] as weights for test2 + tests: { test2: { variants: ["A", "B"] as const } }, + }); + + // creating the factory must not draw and persist a variant yet + expect(setSpy).not.toHaveBeenCalled(); + + const Component = defineComponent({ + setup() { + const { variant } = abby.useAbby("test2"); + return () => h("div", variant.value); + }, + }); + + const wrapper = mount(Component, { + global: { + plugins: [ + { + install: (app) => abby.AbbyPlugin.install(app), + }, + ], + }, + }); + + await flushPromises(); + await nextTick(); + await nextTick(); + + // the variant is drawn from the server weights, not from the local config + expect(wrapper.text()).toEqual("A"); + expect(setSpy).toHaveBeenCalledWith("123", "test2", "A", expect.anything()); + }); +}); + +describe("scopes", () => { + it("keeps the data of two apps apart", async () => { + const abby = createAbby(config); + + const makeApp = (flagValue: boolean) => { + const Component = defineComponent({ + setup() { + const flag = abby.useFeatureFlag("flag1"); + return () => h("span", String(flag.value)); + }, + }); + + return mount(Component, { + global: { + plugins: [ + { + install: (app) => + abby.AbbyPlugin.install(app, { + initialData: { + flags: [{ name: "flag1", value: flagValue }], + tests: [], + remoteConfig: [], + }, + }), + }, + ], + }, + }); + }; + + const first = makeApp(true); + const second = makeApp(false); + + await flushPromises(); + + expect(first.text()).toEqual("true"); + expect(second.text()).toEqual("false"); + + first.unmount(); + second.unmount(); + }); +}); + describe("provideAbby", () => { it("provides the context from within a setup function", async () => { const abby = createAbby(config); diff --git a/packages/vue/tests/types.test.ts b/packages/vue/tests/types.test.ts index 8656f812..f4c9d211 100644 --- a/packages/vue/tests/types.test.ts +++ b/packages/vue/tests/types.test.ts @@ -2,7 +2,10 @@ import { flushPromises, mount } from "@vue/test-utils"; import { defineComponent, h, nextTick } from "vue"; import { createAbby } from "../src"; -async function mountWithAbby(component: ReturnType, abby: ReturnType) { +async function mountWithAbby( + component: ReturnType, + abby: { AbbyPlugin: { install: (app: any) => void } } +) { const wrapper = mount(component, { global: { plugins: [ From a7a66cb23e47901d39e0d1911f68394a151511d9 Mon Sep 17 00:00:00 2001 From: gostmkr24 Date: Thu, 3 Dec 2026 10:00:53 +0300 Subject: [PATCH 3/6] fix(vue): recover from a failed data request and scope user properties Follow-up to the review of 5aecbec: - When the project-data request failed or came back empty, the deferred variant selection left every test without a variant until the page was reloaded, so even returning users saw no A/B variant. The scope now falls back to reading the data from its instance, which keeps the stored assignment and draws one from the configured weights for new visitors. - `updateUserProperties` only reached the module level instance. It now applies to every live scope and is stored, so scopes created afterwards (a later `app.use`, a provider per request) start with the current properties. The references are weak, so a scope that is gone can still be collected. Tests: a failed request now still yields a variant, and a user-property update flips a rule-based flag inside a plugin-installed app. 34 tests pass. --- packages/vue/src/createAbby.ts | 64 ++++++++++++-- packages/vue/tests/plugin.test.ts | 139 ++++++++++++++++++++++++++++++ 2 files changed, 197 insertions(+), 6 deletions(-) diff --git a/packages/vue/src/createAbby.ts b/packages/vue/src/createAbby.ts index d2bce729..d1b0d208 100644 --- a/packages/vue/src/createAbby.ts +++ b/packages/vue/src/createAbby.ts @@ -184,6 +184,27 @@ export function createAbby< ensureData: (initialData?: AbbyDataResponse) => void; }; + type AbbyUserProperties = Partial<{ + -readonly [K in keyof User]: Infer; + }>; + + // user properties are global to the factory: they are handed to every scope, + // including the ones which are created later on (for example a second app + // which installs the plugin afterwards) + const userProperties: AbbyUserProperties = {}; + + // every scope which is currently alive, so a user property update reaches the + // apps and providers and not only the default instance. Weak refs, because a + // scope must be collectable — on the server a new one is created per request. + const liveInstances: Array> = []; + + const trackInstance = (instance: AbbyInstance) => { + for (let index = liveInstances.length - 1; index >= 0; index--) { + if (!liveInstances[index].deref()) liveInstances.splice(index, 1); + } + liveInstances.push(new WeakRef(instance)); + }; + /** * Creates an isolated scope: own core instance, own reactive data and own * request state. Two applications (or two providers) which reuse the same @@ -195,6 +216,12 @@ export function createAbby< createUninitializedProjectData(abby) ); + if (Object.keys(userProperties).length > 0) { + abby.updateUserProperties(userProperties); + } + + trackInstance(abby); + // the reactive project data. Every component which injects this scope // shares the ref, so updates (for example from the devtools) are reflected // everywhere inside of it @@ -204,6 +231,12 @@ export function createAbby< let dataRequested = false; + // reads the data from the instance, which is the only path that assigns a + // variant. Used when no data could be fetched. + const refreshFromInstance = () => { + data.value = abby.getProjectData() as AbbyProjectData; + }; + const ensureData = (initialData?: AbbyDataResponse) => { if (initialData) { abby.init(initialData); @@ -212,7 +245,18 @@ export function createAbby< } if (dataRequested) return; dataRequested = true; - void abby.loadProjectData(); + void abby + .loadProjectData() + .then((loaded) => { + // a failed or empty response leaves the tests without a selected + // variant. Fall back to the local assignment, so returning users keep + // their stored variant and new users get one from the configured + // weights instead of an empty variant until the next reload. + if (!loaded) refreshFromInstance(); + }) + .catch(() => { + refreshFromInstance(); + }); }; return { abby, data, ensureData }; @@ -573,12 +617,20 @@ export function createAbby< return defaultScope.abby.getVariants(name); }; - const updateUserProperties = ( - user: Partial<{ - -readonly [K in keyof User]: Infer; - }> - ) => { + const updateUserProperties = (user: AbbyUserProperties) => { + // validate through the default instance first, so a bad property throws + // before anything is applied (and before a scope has been touched) defaultScope.abby.updateUserProperties(user); + + Object.assign(userProperties, user); + + // the props are global, so every scope has to know about them — not just + // the default instance + for (const reference of liveInstances) { + const instance = reference.deref(); + if (!instance || instance === defaultScope.abby) continue; + instance.updateUserProperties(user); + } }; return { diff --git a/packages/vue/tests/plugin.test.ts b/packages/vue/tests/plugin.test.ts index fc7bf1af..54348a31 100644 --- a/packages/vue/tests/plugin.test.ts +++ b/packages/vue/tests/plugin.test.ts @@ -1,7 +1,10 @@ +import { ABBY_BASE_URL } from "@tryabby/core"; import { flushPromises, mount } from "@vue/test-utils"; +import { rest } from "msw"; import { defineComponent, h, nextTick } from "vue"; import { createAbby } from "../src"; import { TestStorageService } from "../src/StorageService"; +import { server } from "./mocks/server"; const config = { environments: [""], @@ -207,6 +210,142 @@ describe("scopes", () => { first.unmount(); second.unmount(); }); + + it("applies user properties to the scopes installed by the plugin", async () => { + const abby = createAbby({ + ...config, + flags: ["flag1"], + user: { isBeta: { type: "boolean" } as const }, + }); + + const betaRuleSet = [ + { + propertyName: "isBeta", + propertyType: "boolean" as const, + operator: "eq" as const, + value: true, + thenValue: true, + }, + ]; + + const Component = defineComponent({ + setup() { + const flag = abby.useFeatureFlag("flag1"); + return () => h("span", String(flag.value)); + }, + }); + + const wrapper = mount(Component, { + global: { + plugins: [ + { + install: (app) => + abby.AbbyPlugin.install(app, { + initialData: { + flags: [ + { name: "flag1", value: false, ruleSet: betaRuleSet }, + ], + tests: [], + remoteConfig: [], + }, + }), + }, + ], + }, + }); + + await flushPromises(); + expect(wrapper.text()).toEqual("false"); + + abby.updateUserProperties({ isBeta: true }); + + await flushPromises(); + await nextTick(); + await nextTick(); + + // the rule lives on the scoped instance, so the update has to reach it + expect(wrapper.text()).toEqual("true"); + wrapper.unmount(); + }); + + it("still selects a variant when the data request fails", async () => { + vi.spyOn(TestStorageService, "get").mockReturnValue(null); + const setSpy = vi + .spyOn(TestStorageService, "set") + .mockImplementation(() => {}); + + const abby = createAbby({ + ...config, + tests: { test: { variants: ["A", "B"] as const } }, + }); + + const Component = defineComponent({ + setup() { + const { variant } = abby.useAbby("test"); + return () => h("span", variant.value); + }, + }); + + const wrapper = mount(Component, { + global: { + plugins: [{ install: (app) => abby.AbbyPlugin.install(app) }], + }, + }); + + await flushPromises(); + await nextTick(); + await nextTick(); + + // the mocked API answers for "test" with weights [1, 1, 1, 1], so a variant + // must be there; the fallback path must not leave it empty + expect(["A", "B"]).toContain(wrapper.text()); + expect(setSpy).toHaveBeenCalled(); + wrapper.unmount(); + }); + + it("selects a variant when no data can be fetched at all", async () => { + vi.spyOn(TestStorageService, "get").mockReturnValue(null); + const setSpy = vi + .spyOn(TestStorageService, "set") + .mockImplementation(() => {}); + + // the API is unreachable: loadProjectData() resolves without data + server.use( + rest.get(`${ABBY_BASE_URL}api/dashboard/:projectId/data`, (_req, res) => + res.networkError("offline") + ), + rest.get(`${ABBY_BASE_URL}api/v2/data/:projectId`, (_req, res) => + res.networkError("offline") + ) + ); + + const abby = createAbby({ + ...config, + tests: { test: { variants: ["A", "B"] as const } }, + }); + + const Component = defineComponent({ + setup() { + const { variant } = abby.useAbby("test"); + return () => h("span", variant.value); + }, + }); + + const wrapper = mount(Component, { + global: { + plugins: [{ install: (app) => abby.AbbyPlugin.install(app) }], + }, + }); + + await flushPromises(); + await nextTick(); + await nextTick(); + + // without the fallback the variant would stay "" until the next reload + expect(["A", "B"]).toContain(wrapper.text()); + expect(setSpy).toHaveBeenCalled(); + wrapper.unmount(); + }); }); describe("provideAbby", () => { From 6d3bbe777a42d217b92e48cd7264d407b56afbc4 Mon Sep 17 00:00:00 2001 From: gostmkr24 Date: Thu, 3 Dec 2026 10:16:00 +0300 Subject: [PATCH 4/6] fix(vue): expose a scoped user-property updater and cover node SSR Follow-up to the second review round: - `useUpdateUserProperties()` returns the updater of the injected scope, so a component updates the instance its own flags and remote config are evaluated against. The factory level `updateUserProperties` still fans out to every live scope; the README now explains which one to use when scopes differ. - The value type returned by `useAbby()` keeps the pre-mount empty string, and the type test helper no longer narrows the factory result. - New `tests/server.test.ts` runs in the node environment, so there is no `window` and no `document` at all. It asserts that rendering from `initialData` works, that no variant is assigned or persisted on the server, and that two concurrent renders do not see each other's data. The cookie reset in the shared setup is skipped when there is no document. 39 tests pass across 5 files; tsc, biome on the package and the tsup build are green. --- packages/vue/README.md | 16 +++- packages/vue/package.json | 9 ++- packages/vue/src/createAbby.ts | 38 +++++++-- packages/vue/tests/plugin.test.ts | 68 +++++++++++++++++ packages/vue/tests/server.test.ts | 119 +++++++++++++++++++++++++++++ packages/vue/tests/setup.ts | 4 + packages/vue/tests/useAbby.test.ts | 2 +- packages/vue/vite.config.ts | 3 + 8 files changed, 251 insertions(+), 8 deletions(-) create mode 100644 packages/vue/tests/server.test.ts diff --git a/packages/vue/README.md b/packages/vue/README.md index 00cd7921..a4ba3e7e 100644 --- a/packages/vue/README.md +++ b/packages/vue/README.md @@ -127,14 +127,28 @@ inside of components when the scopes differ. | `useFeatureFlags` | Composable which returns all flags with their values | | `useRemoteConfig` | Composable which returns the value of a remote config variable | | `useRemoteConfigVariables` | Composable which returns all remote config variables with their values | +| `useUpdateUserProperties` | Composable which returns the user-property updater of the current scope | | `getFeatureFlagValue` | Non-reactive getter for a feature flag | | `getRemoteConfig` | Non-reactive getter for a remote config variable | | `getABTestValue` | Non-reactive getter for the variant of a test | | `getABResetFunction` | Returns a function which resets the stored variant of a test | | `getVariants` | Returns all variants of a test | -| `updateUserProperties` | Updates the user properties which are used by the flag rules | +| `updateUserProperties` | Updates the user properties on every live scope (see below) | | `withDevtools` | Creates a component which mounts the Abby devtools | +#### User properties and scopes + +`updateUserProperties` of the factory validates the values and applies them to +every live scope, so it fits apps that use a single scope. Inside of a component +prefer `useUpdateUserProperties()`: it targets the instance the component's flags +and remote config are evaluated against, which matters when several apps or +providers use the same `createAbby()` result. + +```ts +const updateUserProperties = useUpdateUserProperties(); +updateUserProperties({ isBeta: true }); +``` + ### `useAbby` ```vue diff --git a/packages/vue/package.json b/packages/vue/package.json index 1f00929c..781bcc39 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -19,7 +19,14 @@ "test": "tsc --noEmit && vitest" }, "homepage": "https://docs.tryabby.com", - "keywords": ["vue", "nuxt", "ab-testing", "feature-flags", "remote-config", "abby"], + "keywords": [ + "vue", + "nuxt", + "ab-testing", + "feature-flags", + "remote-config", + "abby" + ], "author": "", "license": "ISC", "devDependencies": { diff --git a/packages/vue/src/createAbby.ts b/packages/vue/src/createAbby.ts index d1b0d208..bcd53b00 100644 --- a/packages/vue/src/createAbby.ts +++ b/packages/vue/src/createAbby.ts @@ -130,10 +130,15 @@ export function createAbby< type AbbyProjectData = ReturnType; + type AbbyUserProperties = Partial<{ + -readonly [K in keyof User]: Infer; + }>; + type AbbyContext = { abby: AbbyInstance; data: ShallowRef; config: typeof config; + updateUserProperties: (user: AbbyUserProperties) => void; }; /** @@ -184,10 +189,6 @@ export function createAbby< ensureData: (initialData?: AbbyDataResponse) => void; }; - type AbbyUserProperties = Partial<{ - -readonly [K in keyof User]: Infer; - }>; - // user properties are global to the factory: they are handed to every scope, // including the ones which are created later on (for example a second app // which installs the plugin afterwards) @@ -274,7 +275,16 @@ export function createAbby< const scope = createScope(); scope.ensureData(options?.initialData); - return { abby: scope.abby, data: scope.data, config }; + return { + abby: scope.abby, + data: scope.data, + config, + // this updater targets the instance of this scope, so a component can + // update the properties its own flags are evaluated against + updateUserProperties: (user: AbbyUserProperties) => { + scope.abby.updateUserProperties(user); + }, + }; }; const useAbbyContext = (): AbbyContext => { @@ -341,6 +351,14 @@ export function createAbby< */ const useAbbyData = () => useAbbyContext().data; + /** + * Returns the user-property updater of the scope the calling component is + * rendered in. Use this instead of the helper of the same name when the app + * or provider is not the default scope: a rule-based flag reads the + * properties of its own instance, so only this updater reaches it. + */ + const useUpdateUserProperties = () => useAbbyContext().updateUserProperties; + const useMounted = () => { const isMounted = ref(false); onMounted(() => { @@ -617,6 +635,15 @@ export function createAbby< return defaultScope.abby.getVariants(name); }; + /** + * Updates the user properties on every live scope (and remembers them for + * scopes created later on). + * + * Prefer `useUpdateUserProperties()` inside of a component when scopes are + * isolated: that updater targets the instance the component actually reads. + * This helper exists for the non-component case and for apps which use a + * single scope. + */ const updateUserProperties = (user: AbbyUserProperties) => { // validate through the default instance first, so a bad property throws // before anything is applied (and before a scope has been touched) @@ -639,6 +666,7 @@ export function createAbby< provideAbby, useAbby, useAbbyData, + useUpdateUserProperties, useFeatureFlag, useFeatureFlags, useRemoteConfig, diff --git a/packages/vue/tests/plugin.test.ts b/packages/vue/tests/plugin.test.ts index 54348a31..83835ee5 100644 --- a/packages/vue/tests/plugin.test.ts +++ b/packages/vue/tests/plugin.test.ts @@ -268,6 +268,74 @@ describe("scopes", () => { wrapper.unmount(); }); + it("exposes a scoped user-property updater to components", async () => { + const abby = createAbby({ + ...config, + flags: ["flag1"], + user: { isBeta: { type: "boolean" } as const }, + }); + + const betaRuleSet = [ + { + propertyName: "isBeta", + propertyType: "boolean" as const, + operator: "eq" as const, + value: true, + thenValue: true, + }, + ]; + + let updateFromComponent: ((user: { isBeta?: boolean }) => void) | null = + null; + + const Component = defineComponent({ + setup() { + const flag = abby.useFeatureFlag("flag1"); + updateFromComponent = abby.useUpdateUserProperties(); + return () => h("span", String(flag.value)); + }, + }); + + const wrapper = mount(Component, { + global: { + plugins: [ + { + install: (app) => + abby.AbbyPlugin.install(app, { + initialData: { + flags: [ + { name: "flag1", value: false, ruleSet: betaRuleSet }, + ], + tests: [], + remoteConfig: [], + }, + }), + }, + ], + }, + }); + + await flushPromises(); + expect(wrapper.text()).toEqual("false"); + + // the updater comes from the context, so it targets this app's instance + expect(updateFromComponent).not.toBeNull(); + if (updateFromComponent) { + (updateFromComponent as (user: { isBeta?: boolean }) => void)({ + isBeta: true, + }); + } + + await flushPromises(); + await nextTick(); + await nextTick(); + + expect(wrapper.text()).toEqual("true"); + wrapper.unmount(); + }); +}); + +describe("data recovery", () => { it("still selects a variant when the data request fails", async () => { vi.spyOn(TestStorageService, "get").mockReturnValue(null); const setSpy = vi diff --git a/packages/vue/tests/server.test.ts b/packages/vue/tests/server.test.ts new file mode 100644 index 00000000..3d1e0606 --- /dev/null +++ b/packages/vue/tests/server.test.ts @@ -0,0 +1,119 @@ +/** + * Server rendering without any browser globals. + * + * This suite runs in the node environment, so `window` and `document` are not + * defined. The other SSR tests inherit jsdom, where they are. Without this file + * the guards which skip the cookie storage on the server would never be + * exercised. + */ +import { createSSRApp, defineComponent, h } from "vue"; +import { renderToString } from "vue/server-renderer"; +import { createAbby } from "../src"; + +describe("server rendering", () => { + it("has no browser globals", () => { + expect(typeof window).toBe("undefined"); + expect(typeof document).toBe("undefined"); + }); + + it("renders flags and remote config from initialData", async () => { + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + flags: ["beta"], + remoteConfig: { headline: "String" }, + }); + + const Component = defineComponent({ + setup() { + const beta = abby.useFeatureFlag("beta"); + const headline = abby.useRemoteConfig("headline"); + return () => + h("div", `${beta.value ? "beta" : "stable"}:${headline.value}`); + }, + }); + + const app = createSSRApp(Component); + app.use(abby.AbbyPlugin, { + initialData: { + flags: [{ name: "beta", value: true }], + tests: [], + remoteConfig: [{ name: "headline", value: "Hello" }], + }, + }); + + const html = await renderToString(app); + + expect(html).toContain("beta:Hello"); + }); + + it("does not assign or persist a variant on the server", async () => { + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + tests: { + hero: { variants: ["current", "new"] as const }, + }, + }); + + const Component = defineComponent({ + setup() { + const { variant } = abby.useAbby("hero"); + return () => h("span", variant.value || "empty"); + }, + }); + + const app = createSSRApp(Component); + app.use(abby.AbbyPlugin, { + initialData: { + flags: [], + tests: [{ name: "hero", weights: [0, 1] }], + remoteConfig: [], + }, + }); + + const html = await renderToString(app); + + // the server does not know the user's variant, so nothing is rendered + expect(html).toContain("empty"); + expect(html).not.toContain("current"); + expect(html).not.toContain("new"); + }); + + it("keeps two server renders apart", async () => { + const abby = createAbby({ + environments: [""], + currentEnvironment: "", + projectId: "123", + flags: ["beta"], + }); + + const render = async (value: boolean) => { + const Component = defineComponent({ + setup() { + const beta = abby.useFeatureFlag("beta"); + return () => h("span", String(beta.value)); + }, + }); + + const app = createSSRApp(Component); + app.use(abby.AbbyPlugin, { + initialData: { + flags: [{ name: "beta", value }], + tests: [], + remoteConfig: [], + }, + }); + + return renderToString(app); + }; + + const [first, second] = await Promise.all([render(true), render(false)]); + + // a shared instance would leak the second render's data into the first one + expect(first).toContain("true"); + expect(second).toContain("false"); + }); +}); diff --git a/packages/vue/tests/setup.ts b/packages/vue/tests/setup.ts index 82f83b79..7963e126 100644 --- a/packages/vue/tests/setup.ts +++ b/packages/vue/tests/setup.ts @@ -11,6 +11,10 @@ afterAll(() => server.close()); afterEach(() => { server.resetHandlers(); + + // the node environment has no document, so there are no cookies to reset + if (typeof document === "undefined") return; + // reset the cookies which were written by the Abby core // biome-ignore lint/suspicious/noDocumentCookie:> for (const cookie of document.cookie.split(";")) { diff --git a/packages/vue/tests/useAbby.test.ts b/packages/vue/tests/useAbby.test.ts index 6b059d65..9e681635 100644 --- a/packages/vue/tests/useAbby.test.ts +++ b/packages/vue/tests/useAbby.test.ts @@ -1,5 +1,5 @@ -import { flushPromises, mount } from "@vue/test-utils"; import { AbbyEventType, HttpService } from "@tryabby/core"; +import { flushPromises, mount } from "@vue/test-utils"; import { defineComponent, h, nextTick } from "vue"; import { createAbby } from "../src"; import { TestStorageService } from "../src/StorageService"; diff --git a/packages/vue/vite.config.ts b/packages/vue/vite.config.ts index 65a4bbc1..6ec3075b 100644 --- a/packages/vue/vite.config.ts +++ b/packages/vue/vite.config.ts @@ -9,5 +9,8 @@ export default defineConfig({ globals: true, environment: "jsdom", setupFiles: "./tests/setup.ts", + // the server suite renders without browser globals, so it needs the node + // environment instead of jsdom + environmentMatchGlobs: [["tests/server.test.ts", "node"]], }, }); From f922347eeb73dd28f44197290ae0f9253905e2d4 Mon Sep 17 00:00:00 2001 From: gostmkr24 Date: Fri, 4 Dec 2026 23:10:12 +0300 Subject: [PATCH 5/6] fix(core): never freeze a rule result or pick a variant before init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three related leaks in the core data layer, found while reviewing the Vue integration: - `getProjectData()` used the internal maps as the `reduce` accumulator, so every read wrote the computed values back into them. A rule-based flag got the result for the current user baked in as if it were the server value, and could never fall back once the user stopped matching the rule. - `responseToLocalData()` did the same during `init()`: the evaluated rule result replaced the server value. If user properties were known before the data arrived — which framework adapters do when they carry properties into a new scope — the flag was wrong from the first read. - `notifyListeners()` built a snapshot through `getProjectData()` even before any data had been loaded. That path assigns and persists an A/B variant drawn from the local config weights, so a notification during the initial request could lock a visitor into a variant the server weights would not have chosen. It now stays silent until `init()` has run: before that, nothing meaningful can change. Rule evaluation stays in `getFeatureFlag()` / `getRemoteConfig()`, so it still runs on every read. The new tests cover the flag falling back after a user property change, and properties set before `init()`. --- packages/core/src/index.ts | 54 +++++++++++++------- packages/core/tests/base.test.ts | 85 ++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+), 17 deletions(-) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index e47e6657..a66dadc0 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -149,6 +149,13 @@ export class Abby< private dataInitialized = false; + /** + * Whether `init()` has run, i.e. whether the data of the project (weights, + * flags, remote config) is known. Before that the local data is only the + * config defaults. + */ + private hasServerData = false; + private flagOverrides = new Map(); private testOverrides: Map< keyof Tests, @@ -285,11 +292,12 @@ export class Abby< ), flags: data.flags.reduce( (acc, { name, value, ruleSet }) => { - const evaluatedValue = ruleSet - ? this.evaluateUserProperties(ruleSet) - : value; + // the value has to stay the one from the server. Evaluating the rule + // here would replace it with the result for the current user, so the + // flag could never fall back once the user stops matching. + // getFeatureFlag() evaluates the rule on every read instead. acc[name] = { - value: evaluatedValue ?? value, + value, ruleSet, }; return acc; @@ -298,11 +306,9 @@ export class Abby< ), remoteConfig: (data.remoteConfig ?? []).reduce( (acc, { name, value, ruleSet }) => { - const evaluatedValue = ruleSet - ? this.evaluateUserProperties(ruleSet) - : value; + // same as for the flags: the rule is evaluated on read acc[name] = { - value: evaluatedValue ?? value, + value, ruleSet, }; return acc; @@ -320,6 +326,9 @@ export class Abby< getProjectData(): LocalData { this.log("getProjectData()"); + // every branch builds a fresh object. Using the internal maps as the + // accumulator of `reduce` would write the computed values back into them, + // so a second read could no longer fall back to the server value. return { tests: Object.entries(this.#data.tests).reduce( (acc, [testName, test]) => { @@ -329,15 +338,18 @@ export class Abby< }; return acc; }, - this.#data.tests + {} as LocalData["tests"] + ), + flags: Object.keys(this.#data.flags).reduce( + (acc, flagName) => { + acc[flagName as FlagName] = { + value: this.getFeatureFlag(flagName as FlagName), + ruleSet: this.#data.flags[flagName as FlagName].ruleSet, + }; + return acc; + }, + {} as LocalData["flags"] ), - flags: Object.keys(this.#data.flags).reduce((acc, flagName) => { - acc[flagName as FlagName] = { - value: this.getFeatureFlag(flagName as FlagName), - ruleSet: this.#data.flags[flagName as FlagName].ruleSet, - }; - return acc; - }, this.#data.flags), remoteConfig: Object.keys(this.#data.remoteConfig).reduce( (acc, remoteConfigName) => { acc[remoteConfigName as RemoteConfigName] = { @@ -348,7 +360,7 @@ export class Abby< }; return acc; }, - this.#data.remoteConfig + {} as LocalData["remoteConfig"] ), }; } @@ -364,6 +376,7 @@ export class Abby< this.log("init()", data); this.#data = this.responseToLocalData(data); + this.hasServerData = true; this.notifyListeners(); if (typeof window !== "undefined" && typeof document !== "undefined") { @@ -618,6 +631,13 @@ export class Abby< * Function to notify all listeners that the local data has changed */ private notifyListeners() { + // before the first init() the local data only holds the defaults. Building + // a snapshot here would go through getProjectData(), which assigns and + // persists a variant — drawn from the local config weights, before the + // server weights are known. Nothing meaningful can change before init, so + // there is nothing to notify about either. + if (!this.hasServerData) return; + this.listeners.forEach((listener) => listener(this.getProjectData())); } diff --git a/packages/core/tests/base.test.ts b/packages/core/tests/base.test.ts index 839666e1..e1a0d9d3 100644 --- a/packages/core/tests/base.test.ts +++ b/packages/core/tests/base.test.ts @@ -428,6 +428,91 @@ describe("Abby", () => { expect(abby.getFeatureFlag("flag1")).toBe(true); }); + it("stops applying a rule once the user no longer matches it", () => { + const abby = new Abby({ + environments: ["test"], + currentEnvironment: "test", + projectId: "", + flags: ["flag1"], + user: { + test: validation.string(), + }, + }); + + abby.init({ + flags: [ + { + name: "flag1", + value: true, + ruleSet: [ + { + propertyName: "test", + propertyType: "string", + operator: "eq", + value: "beta", + thenValue: false, + }, + ], + }, + ], + tests: [], + remoteConfig: [], + }); + + // matching the rule flips the flag + abby.updateUserProperties({ test: "beta" }); + expect(abby.getFeatureFlag("flag1")).toBe(false); + + // once the property changes, the flag has to go back to the server value. + // the flag entry must not keep the value it got from a previous evaluation. + abby.updateUserProperties({ test: "stable" }); + expect(abby.getFeatureFlag("flag1")).toBe(true); + }); + + it("does not bake a rule result into the server value when properties are set before init", () => { + const abby = new Abby({ + environments: ["test"], + currentEnvironment: "test", + projectId: "", + flags: ["flag1"], + user: { + test: validation.string(), + }, + }); + + // the properties are known before the data arrives, which is what the + // framework adapters do when they cache user properties between scopes + abby.updateUserProperties({ test: "beta" }); + + abby.init({ + flags: [ + { + name: "flag1", + value: true, + ruleSet: [ + { + propertyName: "test", + propertyType: "string", + operator: "eq", + value: "beta", + thenValue: false, + }, + ], + }, + ], + tests: [], + remoteConfig: [], + }); + + expect(abby.getFeatureFlag("flag1")).toBe(false); + + // the server value was `true`. after the user stops matching the rule the + // flag has to return to it; init must not have replaced it with the + // evaluated `false` + abby.updateUserProperties({ test: "stable" }); + expect(abby.getFeatureFlag("flag1")).toBe(true); + }); + it("uses the user rules with OR rule sets", () => { const abby = new Abby({ environments: ["test"], From 518dedbbea1c1b8abfca7d121c681d9d7bcecddc Mon Sep 17 00:00:00 2001 From: gostmkr24 Date: Fri, 4 Dec 2026 23:10:47 +0300 Subject: [PATCH 6/6] fix(vue): do not assign a variant while the data is still loading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The scope subscribed to the core and wrote `newData` straight into the reactive state. That notification is also emitted for a user-property change, and it happens before the server data is in, so the state was seeded from `getProjectData()` — which assigns and persists a variant drawn from the local config weights. The visitor was then stuck with it, because the stored variant wins over the server weights on the next load. The scope now keeps the uninitialized snapshot until the data is in and only then switches to the instance data (also after an empty or failed response, so the variant is not left empty until a reload). Combined with the core fix, a user-property update during the initial request no longer touches the assignment. Regression test covers exactly that timing: the server weights pick B, the local ones would pick A. --- packages/vue/src/createAbby.ts | 31 +++++++++++------ packages/vue/tests/plugin.test.ts | 58 +++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 11 deletions(-) diff --git a/packages/vue/src/createAbby.ts b/packages/vue/src/createAbby.ts index bcd53b00..14eee2d3 100644 --- a/packages/vue/src/createAbby.ts +++ b/packages/vue/src/createAbby.ts @@ -223,18 +223,27 @@ export function createAbby< trackInstance(abby); + // until the server data is in, the reactive state must not be read from + // `getProjectData()`: that call assigns and persists a variant, and it runs + // on every notification — for example when user properties change while the + // request is still in flight. + let initialized = false; + // the reactive project data. Every component which injects this scope // shares the ref, so updates (for example from the devtools) are reflected // everywhere inside of it abby.subscribe((newData) => { - data.value = newData as AbbyProjectData; + data.value = initialized + ? (newData as AbbyProjectData) + : createUninitializedProjectData(abby); }); let dataRequested = false; - // reads the data from the instance, which is the only path that assigns a - // variant. Used when no data could be fetched. - const refreshFromInstance = () => { + // switches to the instance data, which is the only path that assigns a + // variant. Called once the server data is in, or after a request failed. + const markInitialized = () => { + initialized = true; data.value = abby.getProjectData() as AbbyProjectData; }; @@ -242,21 +251,21 @@ export function createAbby< if (initialData) { abby.init(initialData); dataRequested = true; + markInitialized(); return; } if (dataRequested) return; dataRequested = true; void abby .loadProjectData() - .then((loaded) => { - // a failed or empty response leaves the tests without a selected - // variant. Fall back to the local assignment, so returning users keep - // their stored variant and new users get one from the configured - // weights instead of an empty variant until the next reload. - if (!loaded) refreshFromInstance(); + .then(() => { + // also runs for an empty response: then the collection is empty and + // the variants come from the local weights instead of staying empty + // until the next reload. A returning visitor keeps the stored one. + markInitialized(); }) .catch(() => { - refreshFromInstance(); + markInitialized(); }); }; diff --git a/packages/vue/tests/plugin.test.ts b/packages/vue/tests/plugin.test.ts index 83835ee5..e8928622 100644 --- a/packages/vue/tests/plugin.test.ts +++ b/packages/vue/tests/plugin.test.ts @@ -336,6 +336,64 @@ describe("scopes", () => { }); describe("data recovery", () => { + it("does not lock a variant when properties change while loading", async () => { + // the local config would draw "A" almost always, the server sends [0, 1] + server.use( + rest.get( + `${ABBY_BASE_URL}api/dashboard/:projectId/data`, + (_req, res, ctx) => + res( + ctx.delay(60), + ctx.json({ + tests: [{ name: "test", weights: [0, 1] }], + flags: [], + remoteConfig: [], + }) + ) + ) + ); + vi.spyOn(TestStorageService, "get").mockReturnValue(null); + const setSpy = vi + .spyOn(TestStorageService, "set") + .mockImplementation(() => {}); + + const abby = createAbby({ + ...config, + tests: { test: { variants: ["A", "B"] as const } }, + user: { isBeta: { type: "boolean" } as const }, + }); + + const Component = defineComponent({ + setup() { + const { variant } = abby.useAbby("test"); + return () => h("span", variant.value); + }, + }); + + const wrapper = mount(Component, { + global: { + plugins: [{ install: (app) => abby.AbbyPlugin.install(app) }], + }, + }); + + // a user-property update fires a notification while the request is still + // in flight. Reading the instance data at that moment would assign and + // persist a variant drawn from the local weights. + abby.updateUserProperties({ isBeta: true }); + expect(setSpy).not.toHaveBeenCalled(); + + await flushPromises(); + await nextTick(); + await nextTick(); + await new Promise((resolve) => setTimeout(resolve, 120)); + await flushPromises(); + await nextTick(); + + // the variant comes from the server weights, not from the local ones + expect(wrapper.text()).toEqual("B"); + wrapper.unmount(); + }); + it("still selects a variant when the data request fails", async () => { vi.spyOn(TestStorageService, "get").mockReturnValue(null); const setSpy = vi