interface TemplateSettings { /** * Auto generated ID. * @readonly */ _id?: string | null; /** Wix app definition ID. */ appSlug?: string | null; /** The type of the template. */ templateType?: string | null; /** The id of the template. */ templateId?: string | null; /** * Template settings external ID. For example ticket definition ID. * Must be unique per tenant where tenant is taken from authorization (wix_app_id + meta_site_id) */ externalId?: string | null; /** * Date settings were created. * @readonly */ _createdDate?: Date; /** * Date settings were updated. * @readonly */ _updatedDate?: Date; settingGroups?: SettingsGroup[]; /** Paper size */ paperSize?: PaperSize; } interface TextSetting { /** Font family class name */ fontFamily?: string | null; /** Font style class names */ fontStyle?: string[]; /** Text alignment class name */ textAlignment?: string | null; /** Text color hex code */ textColor?: string | null; /** Font size */ fontSize?: number | null; /** Text content setting */ textContent?: TextContent[]; } interface TextContent { _id?: string; value?: string | null; visible?: boolean; } interface ImageSetting { /** Wix media Image */ image?: string; /** Image resizing mode */ resize?: ResizeOption; } declare enum ResizeOption { /** Automatically resizes full image to fit image field */ FIT = "FIT", /** Enables user to manually crop image to fit image field */ CROP = "CROP" } interface SelectSetting { /** Selected value */ value?: string | null; /** Color hex code */ primaryColor?: string | null; /** Color hex code */ secondaryColor?: string | null; /** Size */ size?: number | null; } interface BackgroundSetting { /** Color of the background hex code */ color?: string | null; /** Wix media Image */ image?: string; } interface SettingsGroup { /** Id of the control group */ groupId?: string; /** Display settings. */ display?: Record; /** Texts settings. */ texts?: Record; /** Images settings. */ images?: Record; /** Select option settings. */ selects?: Record; /** Backgrounds settings. */ backgrounds?: Record; } declare enum PaperSize { A4_PORTRAIT = "A4_PORTRAIT", A4_LANDSCAPE = "A4_LANDSCAPE" } interface CreateTemplateSettingsRequest { /** Settings to be created. */ settings?: TemplateSettings; } interface CreateTemplateSettingsResponse { /** Created settings. */ settings?: TemplateSettings; } interface BulkCreateTemplateSettingsRequest { /** Settings to be created. */ settings?: TemplateSettings[]; } interface BulkCreateTemplateSettingsResponse { /** Created settings */ settings?: TemplateSettings[]; } interface UpsertTemplateSettingsRequest { /** Settings to be upserted. */ settings?: TemplateSettings; } interface UpsertTemplateSettingsResponse { /** Upserted settings. */ settings?: TemplateSettings; } interface GetTemplateSettingsRequest { /** Settings ID. */ templateSettingsId?: string; } interface GetTemplateSettingsResponse { /** Retrieved settings. */ settings?: TemplateSettings; } interface UpdateTemplateSettingsRequest { /** Template Settings to be updated. */ settings?: TemplateSettings; } interface UpdateTemplateSettingsResponse { /** Updated settings. */ settings?: TemplateSettings; } interface DeleteTemplateSettingsRequest { /** Settings ID. */ templateSettingsId?: string; } interface DeleteTemplateSettingsResponse { /** Deleted settings. */ settings?: TemplateSettings; } interface QueryTemplateSettingsRequest { /** Generic query object. */ query: QueryV2; } interface QueryV2 extends QueryV2PagingMethodOneOf { /** Paging options to limit and skip the number of items. */ paging?: Paging; /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */ cursorPaging?: CursorPaging; /** * Filter object in the following format: * `"filter" : { * "fieldName1": "value1", * "fieldName2":{"$operator":"value2"} * }` * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains` */ filter?: Record | null; /** * Sort object in the following format: * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]` */ sort?: Sorting[]; /** Array of projected fields. A list of specific field names to return. If `fieldsets` are also specified, the union of `fieldsets` and `fields` is returned. */ fields?: string[]; /** Array of named, predefined sets of projected fields. A array of predefined named sets of fields to be returned. Specifying multiple `fieldsets` will return the union of fields from all sets. If `fields` are also specified, the union of `fieldsets` and `fields` is returned. */ fieldsets?: string[]; } /** @oneof */ interface QueryV2PagingMethodOneOf { /** Paging options to limit and skip the number of items. */ paging?: Paging; /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */ cursorPaging?: CursorPaging; } interface Sorting { /** Name of the field to sort by. */ fieldName?: string; /** Sort order. */ order?: SortOrder; } declare enum SortOrder { ASC = "ASC", DESC = "DESC" } interface Paging { /** Number of items to load. */ limit?: number | null; /** Number of items to skip in the current sort order. */ offset?: number | null; } interface CursorPaging { /** Maximum number of items to return in the results. */ limit?: number | null; /** * Pointer to the next or previous page in the list of results. * * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. * Not relevant for the first request. */ cursor?: string | null; } interface QueryTemplateSettingsResponse { /** Template settings results. */ settings?: TemplateSettings[]; /** Query result's metadata. */ metadata?: PagingMetadataV2; } interface PagingMetadataV2 { /** Number of items returned in the response. */ count?: number | null; /** Offset that was requested. */ offset?: number | null; /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */ total?: number | null; /** Flag that indicates the server failed to calculate the `total` field. */ tooManyToCount?: boolean | null; /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */ cursors?: Cursors; } interface Cursors { /** Cursor string pointing to the next page in the list of results. */ next?: string | null; /** Cursor pointing to the previous page in the list of results. */ prev?: string | null; } interface ResolveTemplateSettingsRequest { /** The id of the settings. */ templateSettingsId?: string | null; /** External ID. */ templateSettingsExternalId?: string | null; /** The type of the template. Used to resolve default settings. */ templateType: string | null; /** Wix app slug. */ appSlug: string | null; /** The id of template. */ templateId?: string | null; } interface ResolveTemplateSettingsResponse { /** Retrieved settings. */ settings?: TemplateSettings; } interface GetTemplateControlsRequest { } interface GetTemplateControlsResponse { templateControls?: TemplateControls; } interface TemplateControls { /** The name of the template */ templateName?: string; /** The controls groups configuration */ controlGroups?: ControlGroup[]; } /** Represents control groups on the left side of the UI */ interface ControlGroup { groupId?: string; icon?: string; labelKey?: string; titleKey?: string; descriptionKey?: string; linkKey?: string | null; linkUrl?: string | null; tooltipKey?: string | null; /** Display controls */ display?: DisplayControl[]; /** Text controls */ texts?: TextControl[]; /** Image controls */ images?: ImageControl[]; /** Select controls */ selects?: SelectControl[]; /** Background controls */ backgrounds?: BackgroundControl[]; } interface DisplayControl { /** The id of the setting */ _id?: string; /** Optional label key for translations */ labelKey?: string | null; /** Default setting for this control */ default?: boolean; } interface TextControl { /** The id of the setting */ _id?: string; /** Optional label key for translations */ labelKey?: string | null; /** Default setting for this control */ default?: TextSetting; /** Text properties */ textProperties?: TextPropertyControl[]; textContent?: TextContentControl[]; } interface TextPropertyControl { /** One of "fontFamily", "fontStyle", "fontSize", "textAlignment" */ type?: string; /** Optional label key for translations */ labelKey?: string | null; /** List of possible options. Used for "fontFamily", "fontStyle", "textAlignment" */ options?: ValueOption[]; /** Optional range of the value. Used for "fontSize" */ range?: Range; } interface ValueOption { /** The label key for translations */ labelKey?: string; /** The value */ value?: string; } interface Range { /** Minimum value. */ min?: number | null; /** Maximum value. */ max?: number | null; } interface TextContentControl { _id?: string; labelKey?: string | null; maxLength?: number | null; } interface ImageControl { /** The id of the setting */ _id?: string; /** Optional label key for translations */ labelKey?: string | null; /** Default setting for this control */ default?: ImageSetting; /** Optional description key for translations */ descriptionKey?: string | null; /** Enable logo builder support */ showLogoBuilder?: boolean; } interface SelectControl { /** The id of the setting */ _id?: string; /** Optional label key for translations */ labelKey?: string | null; /** Default setting for this control */ default?: SelectSetting; /** List of possible options */ options?: ValueOption[]; /** Allows to use primary colour setting from template designer */ showPrimaryColorPicker?: boolean; /** Allows to use secondary colour setting from template designer */ showSecondaryColorPicker?: boolean; /** Allows to use size setting from template designer. */ showSize?: boolean; /** Optional range of the size value. */ sizeRange?: Range; } interface BackgroundControl { /** The id of the setting */ _id?: string; /** Optional label key for translations */ labelKey?: string | null; /** Default setting for this control */ default?: BackgroundSetting; /** Allows to use colour setting from template designer */ showColorPicker?: boolean; /** Allows to use image setting from template designer */ showImagePicker?: boolean; /** Enables background opacity control */ opacityEnabled?: boolean | null; /** Enables background image opacity control */ imageOpacityEnabled?: boolean | null; /** Default media manager folder with background images */ mediaRootFolder?: string | null; } interface GetTemplateRegistryRequest { } interface GetTemplateRegistryResponse { templateRegistry?: TemplateRegistry; } interface TemplateRegistry { /** Templates. */ templates?: WixAppTemplate[]; } /** Defines a template and it's styles. */ interface WixAppTemplate { /** Wix App Id */ wixAppId?: string; /** App Slug */ appSlug?: string; /** Template type. */ templateType?: string; /** Templates */ templates?: TemplateStyle[]; } /** * Defines a template style. * * Path to TemplateControls json file: * papyrus-templates-lib/ * src/ * templates/ * {app_slug}/ * {template_type}/ * {id}/ * controls.json */ interface TemplateStyle { /** The id of the template. */ _id?: string; /** * Determines which template should be used if user did not choose it yet. * Only single template per wix_app_id can be default. */ default?: boolean; /** Determines if template cannot be selected for a new entity. */ inactive?: boolean; /** Paper size */ paperSize?: PaperSize; } interface DomainEvent extends DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; /** * Unique event ID. * Allows clients to ignore duplicate webhooks. */ _id?: string; /** * Assumes actions are also always typed to an entity_type * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction */ entityFqdn?: string; /** * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug) * This is although the created/updated/deleted notion is duplication of the oneof types * Example: created/updated/deleted/started/completed/email_opened */ slug?: string; /** ID of the entity associated with the event. */ entityId?: string; /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */ eventTime?: Date; /** * Whether the event was triggered as a result of a privacy regulation application * (for example, GDPR). */ triggeredByAnonymizeRequest?: boolean | null; /** If present, indicates the action that triggered the event. */ originatedFrom?: string | null; /** * A sequence number defining the order of updates to the underlying entity. * For example, given that some entity was updated at 16:00 and than again at 16:01, * it is guaranteed that the sequence number of the second update is strictly higher than the first. * As the consumer, you can use this value to ensure that you handle messages in the correct order. * To do so, you will need to persist this number on your end, and compare the sequence number from the * message against the one you have stored. Given that the stored number is higher, you should ignore the message. */ entityEventSequence?: string | null; } /** @oneof */ interface DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; } interface EntityCreatedEvent { entity?: string; } interface RestoreInfo { deletedDate?: Date; } interface EntityUpdatedEvent { /** * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff. * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects. * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it. */ currentEntity?: string; } interface EntityDeletedEvent { /** Entity that was deleted */ deletedEntity?: string | null; } interface ActionEvent { body?: string; } interface MessageEnvelope { /** App instance ID. */ instanceId?: string | null; /** Event type. */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Stringify payload. */ data?: string; } interface IdentificationData extends IdentificationDataIdOneOf { /** ID of a site visitor that has not logged in to the site. */ anonymousVisitorId?: string; /** ID of a site visitor that has logged in to the site. */ memberId?: string; /** ID of a Wix user (site owner, contributor, etc.). */ wixUserId?: string; /** ID of an app. */ appId?: string; /** @readonly */ identityType?: WebhookIdentityType; } /** @oneof */ interface IdentificationDataIdOneOf { /** ID of a site visitor that has not logged in to the site. */ anonymousVisitorId?: string; /** ID of a site visitor that has logged in to the site. */ memberId?: string; /** ID of a Wix user (site owner, contributor, etc.). */ wixUserId?: string; /** ID of an app. */ appId?: string; } declare enum WebhookIdentityType { UNKNOWN = "UNKNOWN", ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR", MEMBER = "MEMBER", WIX_USER = "WIX_USER", APP = "APP" } interface SettingsGroupNonNullableFields { groupId: string; } interface TemplateSettingsNonNullableFields { settingGroups: SettingsGroupNonNullableFields[]; paperSize: PaperSize; } interface UpsertTemplateSettingsResponseNonNullableFields { settings?: TemplateSettingsNonNullableFields; } interface QueryTemplateSettingsResponseNonNullableFields { settings: TemplateSettingsNonNullableFields[]; } interface ResolveTemplateSettingsResponseNonNullableFields { settings?: TemplateSettingsNonNullableFields; } interface BaseEventMetadata { /** App instance ID. */ instanceId?: string | null; /** Event type. */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; } interface EventMetadata extends BaseEventMetadata { /** * Unique event ID. * Allows clients to ignore duplicate webhooks. */ _id?: string; /** * Assumes actions are also always typed to an entity_type * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction */ entityFqdn?: string; /** * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug) * This is although the created/updated/deleted notion is duplication of the oneof types * Example: created/updated/deleted/started/completed/email_opened */ slug?: string; /** ID of the entity associated with the event. */ entityId?: string; /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */ eventTime?: Date; /** * Whether the event was triggered as a result of a privacy regulation application * (for example, GDPR). */ triggeredByAnonymizeRequest?: boolean | null; /** If present, indicates the action that triggered the event. */ originatedFrom?: string | null; /** * A sequence number defining the order of updates to the underlying entity. * For example, given that some entity was updated at 16:00 and than again at 16:01, * it is guaranteed that the sequence number of the second update is strictly higher than the first. * As the consumer, you can use this value to ensure that you handle messages in the correct order. * To do so, you will need to persist this number on your end, and compare the sequence number from the * message against the one you have stored. Given that the stored number is higher, you should ignore the message. */ entityEventSequence?: string | null; } interface TemplateSettingsCreatedEnvelope { entity: TemplateSettings; metadata: EventMetadata; } interface TemplateSettingsUpdatedEnvelope { entity: TemplateSettings; metadata: EventMetadata; } interface UpsertTemplateSettingsOptions { /** Settings to be upserted. */ settings?: TemplateSettings; } interface QueryCursorResult { cursors: Cursors; hasNext: () => boolean; hasPrev: () => boolean; length: number; pageSize: number; } interface SettingsQueryResult extends QueryCursorResult { items: TemplateSettings[]; query: SettingsQueryBuilder; next: () => Promise; prev: () => Promise; } interface SettingsQueryBuilder { /** @param limit - Number of items to return, which is also the `pageSize` of the results object. * @documentationMaturity preview */ limit: (limit: number) => SettingsQueryBuilder; /** @param cursor - A pointer to specific record * @documentationMaturity preview */ skipTo: (cursor: string) => SettingsQueryBuilder; /** @documentationMaturity preview */ find: () => Promise; } interface ResolveTemplateSettingsOptions { /** The id of the settings. */ templateSettingsId?: string | null; /** External ID. */ templateSettingsExternalId?: string | null; /** The type of the template. Used to resolve default settings. */ templateType: string | null; /** Wix app slug. */ appSlug: string | null; /** The id of template. */ templateId?: string | null; } 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; } } type HTTPMethod = 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS'; 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 ResponseTransformer$1 = (data: any) => any; type RequestOptions<_TResponse = any, Data = any> = { method: HTTPMethod; url: string; data?: Data; params?: URLSearchParams; fallback?: RequestOptions[]; /** * The array option is for interoperability, defacto only the first function is used * if an array is provided */ transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[]; } & APIMetadata; type APIMetadata = { methodFqn?: string; entityFqdn?: string; packageName?: string; migrationOptions?: MigrationOptions; }; type MigrationOptions = { optInTransformResponse?: boolean; }; 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; declare global { interface ContextualClient { } } declare global { /** * A global interface to set the exposure toggle for the SDK. * @example * ```ts * declare global { * interface SDKExposureToggle { * alpha: true; * } * } */ interface SDKExposureToggle { } } declare global { /** * A global interface to set the type mode for the SDK. * @example * ```ts * declare global { * interface SDKTypeMode { * strict: true; * } * } */ interface SDKTypeMode { } } declare function createRESTModule(descriptor: T, elevated?: boolean): BuildRESTFunction & T; declare function createEventModule>(eventDefinition: T): BuildEventDefinition & T; declare const upsertTemplateSettings: ReturnType>; declare const queryTemplateSettings: ReturnType>; declare const resolveTemplateSettings: ReturnType>; declare const onTemplateSettingsCreated: ReturnType>; declare const onTemplateSettingsUpdated: ReturnType>; export { type ActionEvent, type BackgroundControl, type BackgroundSetting, type BaseEventMetadata, type BulkCreateTemplateSettingsRequest, type BulkCreateTemplateSettingsResponse, type ControlGroup, type CreateTemplateSettingsRequest, type CreateTemplateSettingsResponse, type CursorPaging, type Cursors, type DeleteTemplateSettingsRequest, type DeleteTemplateSettingsResponse, type DisplayControl, type DomainEvent, type DomainEventBodyOneOf, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type EventMetadata, type GetTemplateControlsRequest, type GetTemplateControlsResponse, type GetTemplateRegistryRequest, type GetTemplateRegistryResponse, type GetTemplateSettingsRequest, type GetTemplateSettingsResponse, type IdentificationData, type IdentificationDataIdOneOf, type ImageControl, type ImageSetting, type MessageEnvelope, type Paging, type PagingMetadataV2, PaperSize, type QueryTemplateSettingsRequest, type QueryTemplateSettingsResponse, type QueryTemplateSettingsResponseNonNullableFields, type QueryV2, type QueryV2PagingMethodOneOf, type Range, ResizeOption, type ResolveTemplateSettingsOptions, type ResolveTemplateSettingsRequest, type ResolveTemplateSettingsResponse, type ResolveTemplateSettingsResponseNonNullableFields, type RestoreInfo, type SelectControl, type SelectSetting, type SettingsGroup, type SettingsQueryBuilder, type SettingsQueryResult, SortOrder, type Sorting, type TemplateControls, type TemplateRegistry, type TemplateSettings, type TemplateSettingsCreatedEnvelope, type TemplateSettingsUpdatedEnvelope, type TemplateStyle, type TextContent, type TextContentControl, type TextControl, type TextPropertyControl, type TextSetting, type UpdateTemplateSettingsRequest, type UpdateTemplateSettingsResponse, type UpsertTemplateSettingsOptions, type UpsertTemplateSettingsRequest, type UpsertTemplateSettingsResponse, type UpsertTemplateSettingsResponseNonNullableFields, type ValueOption, WebhookIdentityType, type WixAppTemplate, onTemplateSettingsCreated, onTemplateSettingsUpdated, queryTemplateSettings, resolveTemplateSettings, upsertTemplateSettings };