type HostModule = { __type: 'host'; create(host: H): T; }; type HostModuleAPI> = T extends HostModule ? U : never; type Host = { channel: { observeState(callback: (props: unknown, environment: Environment) => unknown): { disconnect: () => void; } | Promise<{ disconnect: () => void; }>; }; environment?: Environment; /** * Optional name of the environment, use for logging */ name?: string; /** * Optional bast url to use for API requests, for example `www.wixapis.com` */ apiBaseUrl?: string; /** * Possible data to be provided by every host, for cross cutting concerns * like internationalization, billing, etc. */ essentials?: { /** * The language of the currently viewed session */ language?: string; /** * The locale of the currently viewed session */ locale?: string; /** * Any headers that should be passed through to the API requests */ passThroughHeaders?: Record; }; }; type RESTFunctionDescriptor any = (...args: any[]) => any> = (httpClient: HttpClient) => T; interface HttpClient { request(req: RequestOptionsFactory): Promise>; fetchWithAuth: typeof fetch; wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise; getActiveToken?: () => string | undefined; } type RequestOptionsFactory = (context: any) => RequestOptions; type HttpResponse = { data: T; status: number; statusText: string; headers: any; request?: any; }; type RequestOptions<_TResponse = any, Data = any> = { method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS'; url: string; data?: Data; params?: URLSearchParams; } & APIMetadata; type APIMetadata = { methodFqn?: string; entityFqdn?: string; packageName?: string; }; type BuildRESTFunction = T extends RESTFunctionDescriptor ? U : never; type EventDefinition = { __type: 'event-definition'; type: Type; isDomainEvent?: boolean; transformations?: (envelope: unknown) => Payload; __payload: Payload; }; declare function EventDefinition(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): () => EventDefinition; type EventHandler = (payload: T['__payload']) => void | Promise; type BuildEventDefinition> = (handler: EventHandler) => void; type ServicePluginMethodInput = { request: any; metadata: any; }; type ServicePluginContract = Record unknown | Promise>; type ServicePluginMethodMetadata = { name: string; primaryHttpMappingPath: string; transformations: { fromREST: (...args: unknown[]) => ServicePluginMethodInput; toREST: (...args: unknown[]) => unknown; }; }; type ServicePluginDefinition = { __type: 'service-plugin-definition'; componentType: string; methods: ServicePluginMethodMetadata[]; __contract: Contract; }; declare function ServicePluginDefinition(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition; type BuildServicePluginDefinition> = (implementation: T['__contract']) => void; declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error"; type RequestContext = { isSSR: boolean; host: string; protocol?: string; }; type ResponseTransformer = (data: any, headers?: any) => any; /** * Ambassador request options types are copied mostly from AxiosRequestConfig. * They are copied and not imported to reduce the amount of dependencies (to reduce install time). * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315 */ type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK'; type AmbassadorRequestOptions = { _?: T; url?: string; method?: Method; params?: any; data?: any; transformResponse?: ResponseTransformer | ResponseTransformer[]; }; type AmbassadorFactory = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions) & { __isAmbassador: boolean; }; type AmbassadorFunctionDescriptor = AmbassadorFactory; type BuildAmbassadorFunction = T extends AmbassadorFunctionDescriptor ? (req: Request) => Promise : never; declare global { // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged. interface SymbolConstructor { readonly observable: symbol; } } declare const emptyObjectSymbol: unique symbol; /** Represents a strictly empty plain object, the `{}` value. When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)). @example ``` import type {EmptyObject} from 'type-fest'; // The following illustrates the problem with `{}`. const foo1: {} = {}; // Pass const foo2: {} = []; // Pass const foo3: {} = 42; // Pass const foo4: {} = {a: 1}; // Pass // With `EmptyObject` only the first case is valid. const bar1: EmptyObject = {}; // Pass const bar2: EmptyObject = 42; // Fail const bar3: EmptyObject = []; // Fail const bar4: EmptyObject = {a: 1}; // Fail ``` Unfortunately, `Record`, `Record` and `Record` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}. @category Object */ type EmptyObject = {[emptyObjectSymbol]?: never}; /** Returns a boolean for whether the two given types are equal. @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650 @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796 Use-cases: - If you want to make a conditional branch based on the result of a comparison of two types. @example ``` import type {IsEqual} from 'type-fest'; // This type returns a boolean for whether the given array includes the given item. // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal. type Includes = Value extends readonly [Value[0], ...infer rest] ? IsEqual extends true ? true : Includes : false; ``` @category Type Guard @category Utilities */ type IsEqual = (() => G extends A ? 1 : 2) extends (() => G extends B ? 1 : 2) ? true : false; /** Filter out keys from an object. Returns `never` if `Exclude` is strictly equal to `Key`. Returns `never` if `Key` extends `Exclude`. Returns `Key` otherwise. @example ``` type Filtered = Filter<'foo', 'foo'>; //=> never ``` @example ``` type Filtered = Filter<'bar', string>; //=> never ``` @example ``` type Filtered = Filter<'bar', 'foo'>; //=> 'bar' ``` @see {Except} */ type Filter = IsEqual extends true ? never : (KeyType extends ExcludeType ? never : KeyType); type ExceptOptions = { /** Disallow assigning non-specified properties. Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`. @default false */ requireExactProps?: boolean; }; /** Create a type from an object type without certain keys. We recommend setting the `requireExactProps` option to `true`. This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically. This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)). @example ``` import type {Except} from 'type-fest'; type Foo = { a: number; b: string; }; type FooWithoutA = Except; //=> {b: string} const fooWithoutA: FooWithoutA = {a: 1, b: '2'}; //=> errors: 'a' does not exist in type '{ b: string; }' type FooWithoutB = Except; //=> {a: number} & Partial> const fooWithoutB: FooWithoutB = {a: 1, b: '2'}; //=> errors at 'b': Type 'string' is not assignable to type 'undefined'. ``` @category Object */ type Except = { [KeyType in keyof ObjectType as Filter]: ObjectType[KeyType]; } & (Options['requireExactProps'] extends true ? Partial> : {}); /** Returns a boolean for whether the given type is `never`. @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919 @link https://stackoverflow.com/a/53984913/10292952 @link https://www.zhenghao.io/posts/ts-never Useful in type utilities, such as checking if something does not occur. @example ``` import type {IsNever, And} from 'type-fest'; // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts type AreStringsEqual = And< IsNever> extends true ? true : false, IsNever> extends true ? true : false >; type EndIfEqual = AreStringsEqual extends true ? never : void; function endIfEqual(input: I, output: O): EndIfEqual { if (input === output) { process.exit(0); } } endIfEqual('abc', 'abc'); //=> never endIfEqual('abc', '123'); //=> void ``` @category Type Guard @category Utilities */ type IsNever = [T] extends [never] ? true : false; /** An if-else-like type that resolves depending on whether the given type is `never`. @see {@link IsNever} @example ``` import type {IfNever} from 'type-fest'; type ShouldBeTrue = IfNever; //=> true type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>; //=> 'bar' ``` @category Type Guard @category Utilities */ type IfNever = ( IsNever extends true ? TypeIfNever : TypeIfNotNever ); /** Extract the keys from a type where the value type of the key extends the given `Condition`. Internally this is used for the `ConditionalPick` and `ConditionalExcept` types. @example ``` import type {ConditionalKeys} from 'type-fest'; interface Example { a: string; b: string | number; c?: string; d: {}; } type StringKeysOnly = ConditionalKeys; //=> 'a' ``` To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below. @example ``` import type {ConditionalKeys} from 'type-fest'; type StringKeysAndUndefined = ConditionalKeys; //=> 'a' | 'c' ``` @category Object */ type ConditionalKeys = { // Map through all the keys of the given base type. [Key in keyof Base]-?: // Pick only keys with types extending the given `Condition` type. Base[Key] extends Condition // Retain this key // If the value for the key extends never, only include it if `Condition` also extends never ? IfNever, Key> // Discard this key since the condition fails. : never; // Convert the produced object into a union type of the keys which passed the conditional test. }[keyof Base]; /** Exclude keys from a shape that matches the given `Condition`. This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties. @example ``` import type {Primitive, ConditionalExcept} from 'type-fest'; class Awesome { name: string; successes: number; failures: bigint; run() {} } type ExceptPrimitivesFromAwesome = ConditionalExcept; //=> {run: () => void} ``` @example ``` import type {ConditionalExcept} from 'type-fest'; interface Example { a: string; b: string | number; c: () => void; d: {}; } type NonStringKeysOnly = ConditionalExcept; //=> {b: string | number; c: () => void; d: {}} ``` @category Object */ type ConditionalExcept = Except< Base, ConditionalKeys >; /** * Descriptors are objects that describe the API of a module, and the module * can either be a REST module or a host module. * This type is recursive, so it can describe nested modules. */ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule | EventDefinition | ServicePluginDefinition | { [key: string]: Descriptors | PublicMetadata | any; }; /** * This type takes in a descriptors object of a certain Host (including an `unknown` host) * and returns an object with the same structure, but with all descriptors replaced with their API. * Any non-descriptor properties are removed from the returned object, including descriptors that * do not match the given host (as they will not work with the given host). */ type BuildDescriptors | undefined, Depth extends number = 5> = { done: T; recurse: T extends { __type: typeof SERVICE_PLUGIN_ERROR_TYPE; } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction : T extends RESTFunctionDescriptor ? BuildRESTFunction : T extends EventDefinition ? BuildEventDefinition : T extends ServicePluginDefinition ? BuildServicePluginDefinition : T extends HostModule ? HostModuleAPI : ConditionalExcept<{ [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors : never; }, EmptyObject>; }[Depth extends -1 ? 'done' : 'recurse']; type PublicMetadata = { PACKAGE_NAME?: string; }; declare global { interface ContextualClient { } } /** * A type used to create concerete types from SDK descriptors in * case a contextual client is available. */ type MaybeContext = globalThis.ContextualClient extends { host: Host; } ? BuildDescriptors : T; interface User { /** User ID. */ _id?: string; /** * Deprecated. * @deprecated */ roles?: string[]; /** User's email address. */ email?: string; /** User's name. */ name?: Name; /** URL to user's profile image, when provided. */ profileImage?: string | null; /** Date the user joined the team. */ joinedTeamAt?: Date | null; /** * Deprecated. * @deprecated */ policyIds?: string[]; /** Resources the user can access. */ assignments?: Assignment[]; } interface Name { /** User's first name. */ firstName?: string; /** User's last name. */ lastName?: string; } interface Assignment { /** Role assigned to the user. */ policy?: AssignedPolicy; /** Unique ID for this specific assignment. */ assignmentId?: string; /** Identity assigned to the asset in an assignment, referred to as subject. Supported subjects include user IDs, account IDs, and app IDs. */ subject?: Subject; } interface AssignedPolicy { /** Role ID. */ policyId?: string; /** Role title. */ title?: string | null; /** Role description. */ description?: string | null; } interface Restriction extends RestrictionRestrictionsOneOf { /** * Deprecated. * @deprecated */ resource?: ApiResource; /** List of conditions restricting the user's access. Currently only folder conditions are supported. */ conditions?: Conditions; /** Site where the assignment restrictions apply. */ site?: SiteRestriction; } /** @oneof */ interface RestrictionRestrictionsOneOf { /** * Deprecated. * @deprecated */ resource?: ApiResource; /** List of conditions restricting the user's access. Currently only folder conditions are supported. */ conditions?: Conditions; /** Site where the assignment restrictions apply. */ site?: SiteRestriction; } interface ApiResource { /** Resource type. */ resourceType?: ResourceType; /** Resource ID. */ _id?: string; value?: string | null; } declare enum ResourceType { UNKNOWN_RESOURCE_TYPE = "UNKNOWN_RESOURCE_TYPE", SITE = "SITE" } interface Conditions { /** List of conditions. */ conditions?: ApiCondition[]; } interface ApiCondition { /** Condition type. */ conditionType?: ConditionAttributeType; /** Condition ID. */ _id?: string; /** Expected value of the condition. When `conditionType` = "FOLDER", this is the folder path. */ value?: string | null; } declare enum ConditionAttributeType { UNKNOWN_CONDITION_TYPE = "UNKNOWN_CONDITION_TYPE", FOLDER = "FOLDER" } interface SiteRestriction { /** Site ID. */ _id?: string; /** Site name. */ value?: string | null; } interface CompanionResource { /** Asset ID (referred to here as resource ID). */ _id?: string; /** Asset type (referred to here as resource type). as predefined in the authorization system */ resourceType?: string; } interface Subject { /** ID of identity assigned to the asset. */ _id?: string; /** Type of identity assigned to the asset. Supported subject types include user IDs, account IDs, and app IDs. */ subjectType?: SubjectType; /** Context of identity assigned to the asset. For example, a `subjectType` = `USER` will have `context` = `ACCOUNT`. */ context?: SubjectContext; } declare enum SubjectType { UNKNOWN = "UNKNOWN", ACCOUNT = "ACCOUNT", USER = "USER", USER_GROUP = "USER_GROUP", MEMBER_GROUP = "MEMBER_GROUP", VISITOR_GROUP = "VISITOR_GROUP", EXTERNAL_APP = "EXTERNAL_APP", ACCOUNT_GROUP = "ACCOUNT_GROUP", WIX_APP = "WIX_APP" } interface SubjectContext { _id?: string; contextType?: SubjectContextType; } declare enum SubjectContextType { UNKNOWN_CTX = "UNKNOWN_CTX", ORG_CTX = "ORG_CTX", ACCOUNT_CTX = "ACCOUNT_CTX" } interface GetTeamRequest { /** @deprecated */ usersLimit?: number | null; /** The locale of the request. Defaults to en */ locale?: string | null; paging?: Paging; } interface Paging { /** Number of items to load. */ limit?: number | null; /** Number of items to skip in the current sort order. */ offset?: number | null; } interface GetTeamResponse { users?: User[]; invites?: AccountInvite[]; accountInfo?: AccountInfo; permissions?: string[]; userId?: string; targetAccountId?: string; policies?: ApiPolicy[]; totalUsersInAccount?: string; predefinedRoles?: PredefinedRoles; } interface AccountInvite { /** * Invite ID. * @readonly */ _id?: string; /** * Account ID. * @readonly */ accountId?: string; /** Email address where the invite was sent. */ email?: string; /** * Deprecated. Use `policyIds`. * @deprecated */ role?: string; /** * Deprecated. Use `inviterAccountId`. * @readonly * @deprecated */ inviterId?: string; /** * Invite status. * * Supported values: * - **Pending:** The invite has been sent and is valid, waiting for the user's response. * - **Used:** The invite has been accepted. * - **Deleted:** The invite has been deleted or revoked. * - **Declined:** The user has declined the invite. * - **Expired:** The invite has expired without being accepted. */ status?: InviteStatus; /** Link to accept the invite. */ acceptLink?: string; /** * Inviting account ID. * @readonly */ inviterAccountId?: string; /** * Account ID that accepted the invite. Populated only once the invite is accepted. * @readonly */ acceptedByAccountId?: string | null; /** Date the invite was created. */ dateCreated?: Date | null; /** Role IDs included in the invite. */ policyIds?: string[]; /** Date the invite was last updated. */ dateUpdated?: Date | null; /** Assets the users are invited to join. */ assignments?: InviteResourceAssignment[]; /** Invite expiration date. */ expirationDate?: Date | null; } /** Invite status stating whether the invite was accepted, waiting to be accepted, deleted etc.. */ declare enum InviteStatus { Pending = "Pending", Used = "Used", Deleted = "Deleted", Declined = "Declined", Expired = "Expired" } interface InviteResourceAssignment { /** Role ID. */ policyId?: string; /** Resources the user will be able to access. */ assignments?: InviteAssignment[]; } interface InviteAssignment { /** Full name of resource to be assigned. */ fullNameResource?: FullNameResource; } interface FullNameResource extends FullNameResourceResourceContextOneOf { /** Specific site details. */ siteContext?: SiteResourceContext; /** Specific account details. */ accountContext?: AccountResourceContext; } /** @oneof */ interface FullNameResourceResourceContextOneOf { /** Specific site details. */ siteContext?: SiteResourceContext; /** Specific account details. */ accountContext?: AccountResourceContext; } /** Site resource context. It indicates that the resource is under a site (can be the site itself or some asset of a site, like a blog post) */ interface SiteResourceContext { /** Site ID. */ metasiteId?: string; } /** Account resource contexts. It indicates that the resource is under the account (can be the account itself or some asset of an account, like a logo or a domain) */ interface AccountResourceContext { /** Account ID. */ accountId?: string; } interface OrganizationResourceContext { } /** * A custom resource. Is used to represent some asset that is not a direct resource context (site or account), but something custom. * For example: payment method, blog post, domain, logo. */ interface Resource { /** The resource id. */ _id?: string | null; /** The resource type */ type?: string | null; } interface PolicyCondition { /** The type of the condition */ condition?: ConditionType; } interface ConditionType extends ConditionTypeOfOneOf { /** @deprecated */ simpleCondition?: SimpleCondition; /** A logic combination between several conditions, with an operator between them */ joinedConditions?: JoinedCondition; /** @deprecated */ environmentCondition?: EnvironmentCondition; /** A single condition */ condition?: Condition; } /** @oneof */ interface ConditionTypeOfOneOf { /** @deprecated */ simpleCondition?: SimpleCondition; /** A logic combination between several conditions, with an operator between them */ joinedConditions?: JoinedCondition; /** @deprecated */ environmentCondition?: EnvironmentCondition; /** A single condition */ condition?: Condition; } interface SimpleCondition { attrName?: string; value?: SimpleConditionValue; op?: SimpleConditionOperator; conditionModelId?: string; } interface SimpleConditionValue extends SimpleConditionValueValueOneOf { attrName?: string; stringValue?: string; boolValue?: boolean; } /** @oneof */ interface SimpleConditionValueValueOneOf { attrName?: string; stringValue?: string; boolValue?: boolean; } declare enum SimpleConditionOperator { UNKNOWN_SIMPLE_OP = "UNKNOWN_SIMPLE_OP", EQUAL = "EQUAL" } interface JoinedCondition { /** The operator that should be used when evaluating the condition */ op?: JoinedConditionOperator; /** The conditions that should be evaluated, and then joined using the operator provided */ conditions?: ConditionType[]; } declare enum JoinedConditionOperator { UNKNOWN_JOIN_OP = "UNKNOWN_JOIN_OP", OR = "OR", AND = "AND" } interface EnvironmentCondition extends EnvironmentConditionConditionOneOf { experimentCondition?: ExperimentCondition; } /** @oneof */ interface EnvironmentConditionConditionOneOf { experimentCondition?: ExperimentCondition; } interface ExperimentCondition { spec?: string; fallbackValue?: string; expectedValue?: string; } interface Condition { /** The unique identifier of the condition model. Indicates which actions the condition is working on */ conditionModelId?: string; /** The operator that should be evaluated */ operator?: ConditionOperator; } interface ConditionOperator extends ConditionOperatorOperatorsOneOf { /** Comparison of equality - will be evaluated to true if the given parties are equal */ equals?: EqualOperator; /** Regex operator - will be evaluated to true if the given value matches the provided regex */ like?: LikeOperator; /** Petri experiment - will be evaluated using petri. */ experiment?: ExperimentOperator; /** Operator that indicates a dependency on another subject being allowed to perform something. */ dependOn?: DependOnOperator; } /** @oneof */ interface ConditionOperatorOperatorsOneOf { /** Comparison of equality - will be evaluated to true if the given parties are equal */ equals?: EqualOperator; /** Regex operator - will be evaluated to true if the given value matches the provided regex */ like?: LikeOperator; /** Petri experiment - will be evaluated using petri. */ experiment?: ExperimentOperator; /** Operator that indicates a dependency on another subject being allowed to perform something. */ dependOn?: DependOnOperator; } interface EqualOperator { /** The attribute which should be compared. The attribute will be first evaluated to a value, and then compared the other side (attribute/value) */ attrName?: string; /** The value to compare to. If the two parties are equal - we will return true. */ value?: ConditionValue; } interface ConditionValue extends ConditionValueValueOneOf { /** an attribute. We'll first retrieve the value of the attribute (from the request or from pre-indexed values), and then compare to what it needs to be compared with. */ attrName?: string; /** a value with a string type. Will be compared to the attribute provided, and be true only if they match the operator. */ stringValue?: string; /** a value with a boolean type. Will be compared to the attribute provided, and be true only if they match the operator. */ boolValue?: boolean; } /** @oneof */ interface ConditionValueValueOneOf { /** an attribute. We'll first retrieve the value of the attribute (from the request or from pre-indexed values), and then compare to what it needs to be compared with. */ attrName?: string; /** a value with a string type. Will be compared to the attribute provided, and be true only if they match the operator. */ stringValue?: string; /** a value with a boolean type. Will be compared to the attribute provided, and be true only if they match the operator. */ boolValue?: boolean; } interface LikeOperator { /** The attribute which should be compared. The attribute will be first evaluated to a value, and then compared the regex values provided. */ attrName?: string; /** The regex values which the attribute value should be evaluated on. If the attribute value matches at least one of the regular expressions provided - we will return true */ values?: string[]; } interface ExperimentOperator { /** The spec to conduct the experiment on. */ spec?: string; /** The value to use if the experiment could not be conducted */ fallbackValue?: string; /** The expected value of the experiment conduction. If it matches the actual value - true will be returned. Otherwise - false. */ expectedValue?: string; } /** Implies that the policy takes affect only if the depend on subject is permitted as well. */ interface DependOnOperator { /** The subject on which the current entry depends on. If the subject is allowed to perform what the query was about - the condition will be evaluated to true. Otherwise - false */ dependOnSubject?: Subject; } interface AccountInfo { accountName?: string; accountImage?: string; isTeam?: boolean; } interface ApiPolicy { _id?: string; description?: string | null; name?: string | null; isCustom?: boolean; scopes?: string[]; } interface PredefinedRoles { roles?: PredefinedRole[]; } interface PredefinedRole { titleKey?: string; roles?: Role[]; title?: string | null; areaId?: string; } interface Role { _id?: string; deprecatedKey?: string; /** @deprecated */ titleKey?: string; /** @deprecated */ descriptionKey?: string; deprecated?: boolean; restrictFromLevel?: string; experiments?: string[]; appDefIds?: string[]; title?: string | null; description?: string | null; isCustom?: boolean; scopes?: string[]; availableResourceTypes?: ResourceType[]; availableConditions?: ConditionAttributeType[]; limitToEditorTypes?: string[]; } interface ChangeRoleRequest { /** User ID. */ _id?: string; /** * Deprecated. Use `policyIds`. * @deprecated */ role?: string; /** Role IDs to be assigned. */ policyIds?: string[]; } interface ChangeRoleResponse { } interface RemoveMemberRequest { /** User ID of the team member to remove. */ userId: string; } interface RemoveMemberResponse { } interface GetUsersRequest { /** The number of items to load */ limit?: number | null; /** number of items to skip in the current sort order */ offset?: number | null; } interface GetUsersResponse { users?: User[]; } interface GetScopesRequest { /** The locale of the request. Defaults to en */ locale?: string | null; } interface GetScopesResponse { scopeAreas?: ScopeArea[]; } interface ScopeArea { title?: string; appDefIds?: string[]; scopes?: PermissionScope[]; restrictFromLevel?: ScopeLevel; } interface PermissionScope { _id?: string; title?: string; description?: string; level?: ScopeLevel; experiments?: string[]; dependantScopes?: string[]; restrictFromLevel?: ScopeLevel; deprecated?: boolean | null; /** The visibility of the scope for the caller */ visibility?: Visibility; appDefIds?: string[]; } declare enum ScopeLevel { None = "None", SITE = "SITE", ACCOUNT = "ACCOUNT" } declare enum Visibility { /** The scope should be visible to the caller */ VISIBLE = "VISIBLE", /** The scope shouldn't be visible for the caller, because the capability that blocks it is turned on for the caller */ BLOCKED_BY_CAPABILITY = "BLOCKED_BY_CAPABILITY" } interface GetPeopleRequest { resource?: PeopleResource; peopleType?: PeopleType; paging?: Paging; /** The locale of the request. Defaults to en */ locale?: string | null; } interface PeopleResource extends PeopleResourceResourceTypeOneOf { site?: string; folder?: FolderResource; } /** @oneof */ interface PeopleResourceResourceTypeOneOf { site?: string; folder?: FolderResource; } interface FolderResource { folderId?: string; folderFullPath?: string; } declare enum PeopleType { UNDEF_PEOPLE_TYPE = "UNDEF_PEOPLE_TYPE", CONTRIBUTOR = "CONTRIBUTOR", TEAM_MEMBER = "TEAM_MEMBER" } interface GetPeopleResponse { people?: People; } interface People { people?: Person[]; totalPeople?: number; } interface Person extends PersonPersonOneOf { contributor?: Contributor; teamMember?: TeamMember; } /** @oneof */ interface PersonPersonOneOf { contributor?: Contributor; teamMember?: TeamMember; } interface Contributor { /** Contributor's metadata. */ metaData?: PersonMetaData; /** Whether the contributor account is a team account. */ isTeam?: boolean | null; /** Date that the contributor joined the site. */ joinedAt?: Date | null; /** Email address that received the invite. */ invitedEmail?: string | null; /** Whether the contributor account is a client account. */ isClient?: boolean | null; /** * Contributor's user ID. * @readonly */ _id?: string; } interface PersonMetaData { /** Contributor's account ID. */ _id?: string; /** Contributor's full name. */ fullName?: string | null; /** URL for contributor's profile image. */ imageUrl?: string | null; /** Contributor's email address. */ email?: string | null; /** Contributor's access to assets and their assigned role (`policy`) for that asset. */ assignments?: Assignment[]; } interface TeamMember { metaData?: PersonMetaData; } interface GetTeamV2Response { users?: User[]; totalUsersInAccount?: string; } interface GetTeamInvitesRequest { /** The locale of the request. Defaults to en */ locale?: string | null; } interface GetTeamInvitesResponse { invites?: Invite[]; } interface Invite { /** @readonly */ _id?: string; /** @readonly */ accountId?: string; email?: string; status?: InviteStatus; acceptLink?: string; dateCreated?: Date | null; dateUpdated?: Date | null; assignments?: ApiInviteAssignment[]; /** Invite expiration date */ expirationDate?: Date | null; } interface ApiInviteAssignment { policy?: AssignedPolicy; restrictions?: Restriction; } interface GetPoliciesRequest { /** The locale of the request. Defaults to en */ locale?: string | null; /** Areas filter to include only roles from areas that pass this filter. When not provided, roles from all areas will be returned */ areasFilter?: AreasFilter; /** Role level filter to include only roles that are not restricted from the requested resource level (site/account). When set to ALL, all levels are returned */ roleLevel?: RoleLevel; } interface AreasFilter { /** A list of role area ids, to filter only roles belonging to these areas */ areaIds?: string[]; } declare enum RoleLevel { ALL = "ALL", SITE_LEVEL = "SITE_LEVEL", ACCOUNT_LEVEL = "ACCOUNT_LEVEL" } interface GetPoliciesResponse { policies?: PredefinedRoles; } interface SearchTeamRequest { /** Free text to search for within team member name and email address fields. */ query?: string | null; /** Sort data. */ orderBy?: Ordering[]; /** * Filter object. Supported values: `inviteType` and `roleId`. For example, `{'inviteType': {'$eq': 'Expired'}}`. * See [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language) for more information. */ filter?: Record | null; /** * A list of facets to return in the response. Facets count the items within logical groupings. * See [Filters and Facets: An Explainer](https://medium.com/@westontt/filters-and-facets-an-explainer-3b73a9538eca) for more information. */ facets?: FacetType[]; /** Pagination. */ paging?: Paging; } interface Ordering { /** Field to sort by. */ fieldName?: OrderField; /** Sort order. */ direction?: Direction; } declare enum OrderField { /** For internal use. */ Undefined = "Undefined", /** Team member name. */ Name = "Name", /** Date team member joined the account. */ JoinedAt = "JoinedAt" } declare enum Direction { /** For internal use. */ UninitializedDirection = "UninitializedDirection", /** Ascending. */ ASC = "ASC", /** Descending. */ DESC = "DESC" } declare enum FacetType { Undefined = "Undefined", /** How many team members with each role */ Roles = "Roles", /** How many team members by invite status */ InviteStatus = "InviteStatus", /** How many team members in total in the account */ Users = "Users" } interface SearchTeamResponse { /** List of facets, as requested. */ facets?: Facet[]; /** Existing team members and invites sent to join the account. */ teamMembers?: TeamMemberV3[]; } interface Facet { /** Facet type. */ facetType?: FacetType; /** Values and their counters. Values with count = 0 are not returned. */ values?: FacetValue[]; } interface FacetValue { /** Supported values: `Roles`, `InviteStatus`, `Users`. */ value?: string; /** Number of existing items for the value. */ count?: number; } interface TeamMemberV3 extends TeamMemberV3MembersOneOf { /** Existing team member data. */ user?: UserV3; /** Invited team member data. */ invite?: InviteV3; } /** @oneof */ interface TeamMemberV3MembersOneOf { /** Existing team member data. */ user?: UserV3; /** Invited team member data. */ invite?: InviteV3; } interface UserV3 { /** User ID. */ _id?: string; /** User's email address. */ email?: string | null; /** User's name, when provided. */ name?: Name; /** URL to user's profile image, when provided. */ profileImage?: string | null; /** Date the user joined the team. */ joinedTeamAt?: Date | null; /** Mapping of the user's access to an asset and their assigned role. */ assignments?: AssignmentV3[]; } interface AssignmentV3 { /** Role assigned to the user. To retrieve all available roles, call Get Roles Info. */ policyId?: string | null; /** * Unique ID for this specific assignment. * @readonly */ assignmentId?: string | null; /** The asset where a user is assigned access in an assignment. When empty, the role covers all assets, with no restrictions to specific sites or folders. */ restrictions?: Restriction; /** Identity assigned to the asset in an assignment, referred to as subject. Supported subjects include user IDs, account IDs, and app IDs. */ subject?: AssignedSubject; } interface AssignedSubject { /** * Identity ID. * @readonly */ _id?: string; /** Identity type. */ subjectType?: SubjectType; } interface InviteV3 { /** * Invite ID. * @readonly */ _id?: string; /** Invitee's email address. */ email?: string | null; /** Invite status. */ status?: InviteStatus; /** URL of direct link to accept the invite. */ acceptLink?: string | null; /** Date the invite was created. */ dateCreated?: Date | null; /** Date the invite was last updated. */ dateUpdated?: Date | null; /** A list of assignments that will be applied to the invitees when they accept the invite. */ assignments?: InviteAssignmentV3[]; /** Invite expiration date. */ expirationDate?: Date | null; } interface InviteAssignmentV3 { /** Role ID that will be assigned once the invite is accepted. */ policyId?: string | null; /** Assets where the user will be assigned access. When empty, the role covers all assets, with no restrictions to specific sites or folders. */ restrictions?: Restriction; } interface GetRolesRequest { /** The locale of the predefined roles names and descriptions. Defaults to English */ locale?: string | null; } interface GetRolesResponse { /** The predefined roles (by areas) */ predefinedRolesAreas?: PredefinedRolesArea[]; /** The custom roles */ customRoles?: CustomRole[]; } interface PredefinedRolesArea { /** The id of the area (e.g "Blog") */ areaId?: string; /** The translated area title, according to the request locale, or the original title if translation failed */ title?: string; /** The predefined roles belonging to this area */ roles?: PredefinedRoleV2[]; } interface PredefinedRoleV2 { /** The policy id of this role */ _id?: string; /** The title of this role, translated according to the request locale, or the original title if translation failed */ title?: string; /** The description of this role, translated according to the request locale, or the original description if translation failed */ description?: string; /** The permission-scopes this role's policy contains */ scopes?: string[]; /** Indicates if the role is deprecated (shouldn't be granted, and only exists for backward compatability) */ deprecated?: boolean; /** Indicates if this role should be restricted from assignments of a specific resource type (if RoleLevelRestriction = None, there is no restriction) */ restrictFromLevel?: RoleLevelRestriction; /** Experiments that should be open for this role to be visible */ experiments?: string[]; /** Applications that should be installed for this role to be visible */ appDefIds?: string[]; /** Editor types this role should be limited to (if empty, available in all editors) */ limitToEditorTypes?: EditorType[]; /** The visibility of the role */ visibility?: RoleVisibility; } declare enum RoleLevelRestriction { NoRestriction = "NoRestriction", Site = "Site", Account = "Account" } declare enum EditorType { UNINITIALIZED = "UNINITIALIZED", EDITORX = "EDITORX", BLOCKS = "BLOCKS", STUDIO = "STUDIO" } declare enum RoleVisibility { /** the role should be visible to the caller */ Visible = "Visible", /** the role should be disabled for the caller, because it contains permissions the caller wasn't granted on the call context (site/account) */ Disabled_Dependency = "Disabled_Dependency", /** the role should be disabled for the caller, because the role's capability is disabled for the caller */ Disabled_Capability = "Disabled_Capability" } interface CustomRole { /** The policy this role grants */ policy?: ApiPolicy; /** The visibility of the role */ visibility?: RoleVisibility; } interface GetRolesInfoRequest { /** Language of predefined roles names and descriptions to return, in ISO 639 format. Default: `en`. */ locale?: string | null; /** Roles to return. */ filter?: RolesInfoFilter; } interface RolesInfoFilter { /** Role level to return. Default: ALL. */ roleLevel?: RoleLevel; /** Filter for editor-specific roles. Default: ALL. */ editorTypes?: EditorType[]; } interface GetRolesInfoResponse { /** Predefined roles. */ predefinedRoles?: RoleInfo[]; /** Custom roles. */ customRoles?: RoleInfo[]; } interface RoleInfo { /** Role ID. */ _id?: string; /** Role title, translated according to the request locale. If translation fails, the original title is returned. */ title?: string; /** Role description, translated according to the request locale. If translation fails, the original description is returned. */ description?: string; /** Whether this role is restricted from accessing a specific resource type. Default: `NoRestriction`. */ restrictFromLevel?: RoleLevelRestriction; } interface CreateCustomRoleRequest { /** The custom role to create */ role?: Policy; } interface Policy { /** @readonly */ _id?: string | null; name?: string | null; description?: string | null; /** @readonly */ status?: string; policyType?: PolicyType; statements?: PolicyStatement[]; } declare enum PolicyType { UNKNOWN_STATUS = "UNKNOWN_STATUS", PREDEFINED = "PREDEFINED", CUSTOM = "CUSTOM", INLINE_CUSTOM = "INLINE_CUSTOM" } interface PolicyStatement { /** @readonly */ _id?: string | null; permissions?: string[]; scopes?: string[]; effect?: Effect; condition?: PolicyCondition; } declare enum Effect { UNKNOWN_EFFECT = "UNKNOWN_EFFECT", ALLOW = "ALLOW", DENY = "DENY" } interface CreateCustomRoleResponse { /** The newly created custom role */ roleCreated?: Policy; } interface ChangeRoleV2Request { /** ID of team member being affected. */ userId?: string; /** New assignments, including roles, to apply to the team member in this account. To retrieve all available roles, call Get Roles Info. */ roles?: AssignmentV3[]; /** Existing assignment IDs to remove. To retrieve all existing assignment IDs for a team member, call Search Team. */ assignmentIdsToReplace?: string[]; } interface ChangeRoleV2Response { /** New roles assigned to the given team member. */ roles?: AssignmentV3[]; } interface UpdateTeamMemberAssignmentsRequest { /** ID of team member being affected. */ userId: string; /** New assignments to apply to the team member in this account. */ newAssignments: AssignmentV3[]; /** Existing assignment IDs to remove. To retrieve all existing assignment IDs for a team member, call Search Team. */ assignmentIdsToRemove: string[]; } interface UpdateTeamMemberAssignmentsResponse { /** The new assignments, assigned to the given team member. */ assignments?: AssignmentV3[]; } interface GetSubjectsAssignmentsRequest { /** The locale of the request. Defaults to en */ locale?: string | null; /** list of subjects */ subjects?: Subject[]; } interface GetSubjectsAssignmentsResponse { /** list of subjects with assignments */ subjectsAssignments?: SubjectAssignments[]; } interface SubjectAssignments { subject?: Subject; assignments?: Assignment[]; } interface FacetValueNonNullableFields { value: string; count: number; } interface FacetNonNullableFields { facetType: FacetType; values: FacetValueNonNullableFields[]; } interface NameNonNullableFields { firstName: string; lastName: string; } interface ApiResourceNonNullableFields { resourceType: ResourceType; _id: string; } interface ApiConditionNonNullableFields { conditionType: ConditionAttributeType; _id: string; } interface ConditionsNonNullableFields { conditions: ApiConditionNonNullableFields[]; } interface CompanionResourceNonNullableFields { _id: string; resourceType: string; } interface SiteRestrictionNonNullableFields { _id: string; resource?: CompanionResourceNonNullableFields; } interface RestrictionNonNullableFields { resource?: ApiResourceNonNullableFields; conditions?: ConditionsNonNullableFields; site?: SiteRestrictionNonNullableFields; } interface AssignedSubjectNonNullableFields { _id: string; subjectType: SubjectType; } interface AssignmentV3NonNullableFields { restrictions?: RestrictionNonNullableFields; subject?: AssignedSubjectNonNullableFields; } interface UserV3NonNullableFields { _id: string; name?: NameNonNullableFields; assignments: AssignmentV3NonNullableFields[]; } interface InviteAssignmentV3NonNullableFields { restrictions?: RestrictionNonNullableFields; } interface InviteV3NonNullableFields { _id: string; status: InviteStatus; assignments: InviteAssignmentV3NonNullableFields[]; } interface TeamMemberV3NonNullableFields { user?: UserV3NonNullableFields; invite?: InviteV3NonNullableFields; } interface SearchTeamResponseNonNullableFields { facets: FacetNonNullableFields[]; teamMembers: TeamMemberV3NonNullableFields[]; } interface RoleInfoNonNullableFields { _id: string; title: string; description: string; restrictFromLevel: RoleLevelRestriction; } interface GetRolesInfoResponseNonNullableFields { predefinedRoles: RoleInfoNonNullableFields[]; customRoles: RoleInfoNonNullableFields[]; } interface UpdateTeamMemberAssignmentsResponseNonNullableFields { assignments: AssignmentV3NonNullableFields[]; } interface SearchTeamOptions { /** Free text to search for within team member name and email address fields. */ query?: string | null; /** Sort data. */ orderBy?: Ordering[]; /** * Filter object. Supported values: `inviteType` and `roleId`. For example, `{'inviteType': {'$eq': 'Expired'}}`. * See [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language) for more information. */ filter?: Record | null; /** * A list of facets to return in the response. Facets count the items within logical groupings. * See [Filters and Facets: An Explainer](https://medium.com/@westontt/filters-and-facets-an-explainer-3b73a9538eca) for more information. */ facets?: FacetType[]; /** Pagination. */ paging?: Paging; } interface GetRolesInfoOptions { /** Language of predefined roles names and descriptions to return, in ISO 639 format. Default: `en`. */ locale?: string | null; /** Roles to return. */ filter?: RolesInfoFilter; } interface UpdateTeamMemberAssignmentsOptions { /** New assignments to apply to the team member in this account. */ newAssignments: AssignmentV3[]; /** Existing assignment IDs to remove. To retrieve all existing assignment IDs for a team member, call Search Team. */ assignmentIdsToRemove: string[]; } declare function removeMember$1(httpClient: HttpClient): RemoveMemberSignature; interface RemoveMemberSignature { /** * Removes a team member from the requesting account. * > **Important**: This call requires an account level API key and cannot be authenticated with the standard authorization header. API keys are currently available to selected beta users only. * @param - User ID of the team member to remove. */ (userId: string): Promise; } declare function searchTeam$1(httpClient: HttpClient): SearchTeamSignature; interface SearchTeamSignature { /** * Retrieves all team members of the requesting account, based on the provided filters and free text queries. * > **Important**: This call requires an account level API key and cannot be authenticated with the standard authorization header. API keys are currently available to selected beta users only. */ (options?: SearchTeamOptions | undefined): Promise; } declare function getRolesInfo$1(httpClient: HttpClient): GetRolesInfoSignature; interface GetRolesInfoSignature { /** * Retrieves all available roles in the requesting account, including predefined and custom roles. * > **Important**: This call requires an account level API key and cannot be authenticated with the standard authorization header. API keys are currently available to selected beta users only. */ (options?: GetRolesInfoOptions | undefined): Promise; } declare function updateTeamMemberAssignments$1(httpClient: HttpClient): UpdateTeamMemberAssignmentsSignature; interface UpdateTeamMemberAssignmentsSignature { /** * Updates the assignments of roles and conditions for an existing team member. Changing assignments changes the team member’s access to account assets. * > **Important**: This call requires an account level API key and cannot be authenticated with the standard authorization header. API keys are currently available to selected beta users only. * @param - ID of team member being affected. */ (userId: string, options: UpdateTeamMemberAssignmentsOptions): Promise; } declare const removeMember: MaybeContext & typeof removeMember$1>; declare const searchTeam: MaybeContext & typeof searchTeam$1>; declare const getRolesInfo: MaybeContext & typeof getRolesInfo$1>; declare const updateTeamMemberAssignments: MaybeContext & typeof updateTeamMemberAssignments$1>; export { type AccountInfo, type AccountInvite, type AccountResourceContext, type ApiCondition, type ApiInviteAssignment, type ApiPolicy, type ApiResource, type AreasFilter, type AssignedPolicy, type AssignedSubject, type Assignment, type AssignmentV3, type ChangeRoleRequest, type ChangeRoleResponse, type ChangeRoleV2Request, type ChangeRoleV2Response, type CompanionResource, type Condition, ConditionAttributeType, type ConditionOperator, type ConditionOperatorOperatorsOneOf, type ConditionType, type ConditionTypeOfOneOf, type ConditionValue, type ConditionValueValueOneOf, type Conditions, type Contributor, type CreateCustomRoleRequest, type CreateCustomRoleResponse, type CustomRole, type DependOnOperator, Direction, EditorType, Effect, type EnvironmentCondition, type EnvironmentConditionConditionOneOf, type EqualOperator, type ExperimentCondition, type ExperimentOperator, type Facet, FacetType, type FacetValue, type FolderResource, type FullNameResource, type FullNameResourceResourceContextOneOf, type GetPeopleRequest, type GetPeopleResponse, type GetPoliciesRequest, type GetPoliciesResponse, type GetRolesInfoOptions, type GetRolesInfoRequest, type GetRolesInfoResponse, type GetRolesInfoResponseNonNullableFields, type GetRolesRequest, type GetRolesResponse, type GetScopesRequest, type GetScopesResponse, type GetSubjectsAssignmentsRequest, type GetSubjectsAssignmentsResponse, type GetTeamInvitesRequest, type GetTeamInvitesResponse, type GetTeamRequest, type GetTeamResponse, type GetTeamV2Response, type GetUsersRequest, type GetUsersResponse, type Invite, type InviteAssignment, type InviteAssignmentV3, type InviteResourceAssignment, InviteStatus, type InviteV3, type JoinedCondition, JoinedConditionOperator, type LikeOperator, type Name, OrderField, type Ordering, type OrganizationResourceContext, type Paging, type People, type PeopleResource, type PeopleResourceResourceTypeOneOf, PeopleType, type PermissionScope, type Person, type PersonMetaData, type PersonPersonOneOf, type Policy, type PolicyCondition, type PolicyStatement, PolicyType, type PredefinedRole, type PredefinedRoleV2, type PredefinedRoles, type PredefinedRolesArea, type RemoveMemberRequest, type RemoveMemberResponse, type Resource, ResourceType, type Restriction, type RestrictionRestrictionsOneOf, type Role, type RoleInfo, RoleLevel, RoleLevelRestriction, RoleVisibility, type RolesInfoFilter, type ScopeArea, ScopeLevel, type SearchTeamOptions, type SearchTeamRequest, type SearchTeamResponse, type SearchTeamResponseNonNullableFields, type SimpleCondition, SimpleConditionOperator, type SimpleConditionValue, type SimpleConditionValueValueOneOf, type SiteResourceContext, type SiteRestriction, type Subject, type SubjectAssignments, type SubjectContext, SubjectContextType, SubjectType, type TeamMember, type TeamMemberV3, type TeamMemberV3MembersOneOf, type UpdateTeamMemberAssignmentsOptions, type UpdateTeamMemberAssignmentsRequest, type UpdateTeamMemberAssignmentsResponse, type UpdateTeamMemberAssignmentsResponseNonNullableFields, type User, type UserV3, Visibility, getRolesInfo, removeMember, searchTeam, updateTeamMemberAssignments };