@wix/auto_sdk_seo_page-optimization 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.d.ts +8 -2
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +18 -8
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +8 -5
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +8 -2
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +18 -8
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +8 -5
- package/build/es/meta.mjs.map +1 -1
- package/build/internal/cjs/index.d.ts +8 -2
- package/build/internal/cjs/index.typings.d.ts +18 -8
- package/build/internal/cjs/meta.d.ts +8 -5
- package/build/internal/es/index.d.mts +8 -2
- package/build/internal/es/index.typings.d.mts +18 -8
- package/build/internal/es/meta.d.mts +8 -5
- package/package.json +2 -2
package/build/cjs/index.d.ts
CHANGED
|
@@ -16,7 +16,9 @@ interface TriggerPageOptimizationSignature {
|
|
|
16
16
|
* progress, calling again returns the same `predictionId` instead of
|
|
17
17
|
* starting a new job, unless the page's focus keyword changed since the
|
|
18
18
|
* job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.
|
|
19
|
-
*
|
|
19
|
+
*
|
|
20
|
+
* Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.
|
|
21
|
+
* @param - ID of the site page to optimize. The page's focus keyword must be set.
|
|
20
22
|
*/
|
|
21
23
|
(pageId: string, options: NonNullablePaths<TriggerPageOptimizationOptions, `pagePath`, 2>): Promise<NonNullablePaths<TriggerPageOptimizationResponse, `predictionId`, 2> & {
|
|
22
24
|
__applicationErrorsType?: TriggerPageOptimizationApplicationErrors;
|
|
@@ -32,6 +34,8 @@ interface TriggerHomePageOptimizationSignature {
|
|
|
32
34
|
* topic. Same contract as Trigger Page Optimization: the homepage's focus
|
|
33
35
|
* keyword must be set first, the call returns a `predictionId` to poll,
|
|
34
36
|
* and triggering is idempotent per page while a job is in progress.
|
|
37
|
+
*
|
|
38
|
+
* Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.
|
|
35
39
|
* @param - ID of the site's homepage.
|
|
36
40
|
*/
|
|
37
41
|
(pageId: string, options: NonNullablePaths<TriggerHomePageOptimizationOptions, `pagePath`, 2>): Promise<NonNullablePaths<TriggerHomePageOptimizationResponse, `predictionId`, 2> & {
|
|
@@ -51,7 +55,9 @@ interface GetPageOptimizationResultsSignature {
|
|
|
51
55
|
* are stored per page, so a later trigger for the same page replaces them,
|
|
52
56
|
* and a replaced job's lookup reports `NOT_FOUND`.
|
|
53
57
|
*
|
|
54
|
-
* Look up by `predictionId` (from the trigger call), or by `pageId`.
|
|
58
|
+
* Look up by `predictionId` (from the trigger call), or by `pageId`. A
|
|
59
|
+
* `predictionId` can be looked up for 2 hours after the trigger call; after
|
|
60
|
+
* that, look up by `pageId`, which returns the page's latest generation.
|
|
55
61
|
*/
|
|
56
62
|
(options?: GetPageOptimizationResultsOptions): Promise<NonNullablePaths<GetPageOptimizationResultsResponse, `pageOptimization.metaTitle.after` | `pageOptimization.content` | `status`, 4> & {
|
|
57
63
|
__applicationErrorsType?: GetPageOptimizationResultsApplicationErrors;
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.universal.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.http.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.public.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.context.ts"],"sourcesContent":["export * from './src/seo-suggestions-v1-page-optimization-page-optimization.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixSeoSuggestionsV1PageOptimization from './seo-suggestions-v1-page-optimization-page-optimization.http.js';\n\n/**\n * A whole-page set of SEO optimization suggestions, generated for one page\n * and focus keyword.\n *\n * Each suggestion is a before/after pair: `before` is the page's current\n * text (empty when the page has none, such as a missing meta description),\n * and `after` is the suggested replacement. Locate the element to change by\n * its `before` text.\n */\nexport interface PageOptimization {\n /**\n * ID of this suggestion set.\n * @format GUID\n * @readonly\n */\n _id?: string | null;\n /**\n * Suggested title tag.\n * @readonly\n */\n metaTitle?: TextSuggestion;\n /**\n * Suggested description tag.\n * @readonly\n */\n metaDescription?: TextSuggestion;\n /**\n * Suggested H1 heading.\n * @readonly\n */\n h1?: TextSuggestion;\n /**\n * Suggested H2 or H3 heading.\n * @readonly\n */\n h2OrH3?: TextSuggestion;\n /**\n * Suggested body text rewrites.\n * @readonly\n * @maxSize 100\n */\n content?: TextSuggestion[];\n}\n\n/** One suggested text change. */\nexport interface TextSuggestion {\n /**\n * The page's current text. Empty when the page has no text in this slot,\n * for example, a missing meta description.\n * @readonly\n * @maxLength 1000\n */\n before?: string | null;\n /**\n * The suggested text.\n * @readonly\n * @maxLength 1000\n */\n after?: string;\n}\n\nexport interface TriggerPageOptimizationRequest {\n /**\n * ID of the site page to optimize.\n * @maxLength 1000\n * @minLength 1\n */\n pageId: string;\n /**\n * URL path of the page, relative to the site's domain. For example,\n * `/about`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\nexport interface TriggerPageOptimizationResponse {\n /**\n * ID of the generation job. Pass to Get Page Optimization Results.\n * @readonly\n * @maxLength 200\n */\n predictionId?: string;\n}\n\nexport interface TriggerHomePageOptimizationRequest {\n /**\n * ID of the site's homepage.\n * @maxLength 1000\n * @minLength 1\n */\n pageId: string;\n /**\n * URL path of the homepage. Usually `/`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\nexport interface TriggerHomePageOptimizationResponse {\n /**\n * ID of the generation job. Pass to Get Page Optimization Results.\n * @readonly\n * @maxLength 200\n */\n predictionId?: string;\n}\n\nexport interface GetPageOptimizationResultsRequest {\n /**\n * ID of the generation job, from the trigger call.\n * @maxLength 200\n */\n predictionId?: string | null;\n /**\n * ID of the page to retrieve suggestions for. An alternative to\n * `predictionId` that returns the page's latest generation.\n * @maxLength 1000\n */\n pageId?: string | null;\n}\n\nexport interface GetPageOptimizationResultsResponse {\n /** The generated suggestions. Returned only when `status` is `COMPLETED`. */\n pageOptimization?: PageOptimization;\n /**\n * Status of the generation job the lookup matched.\n * @readonly\n */\n status?: OptimizationStatusWithLiterals;\n}\n\n/** Status of a page optimization generation job. */\nexport enum OptimizationStatus {\n UNKNOWN_OPTIMIZATION_STATUS = 'UNKNOWN_OPTIMIZATION_STATUS',\n /**\n * No generation job matches the lookup. It never existed, or a later\n * trigger for the same page replaced it.\n */\n NOT_FOUND = 'NOT_FOUND',\n /** Generation is still running. Poll again. */\n IN_PROGRESS = 'IN_PROGRESS',\n /** Generation finished; the response carries the suggestions. */\n COMPLETED = 'COMPLETED',\n /** Generation failed. Trigger again to retry. */\n FAILED = 'FAILED',\n}\n\n/** @enumType */\nexport type OptimizationStatusWithLiterals =\n | OptimizationStatus\n | 'UNKNOWN_OPTIMIZATION_STATUS'\n | 'NOT_FOUND'\n | 'IN_PROGRESS'\n | 'COMPLETED'\n | 'FAILED';\n/** @docsIgnore */\nexport type TriggerPageOptimizationApplicationErrors =\n | {\n code?: 'SITE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FOCUS_KEYWORD_NOT_SET';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTENT_TOO_SHORT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'SUGGESTIONS_ALREADY_IN_PROGRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n/** @docsIgnore */\nexport type TriggerHomePageOptimizationApplicationErrors =\n | {\n code?: 'SITE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FOCUS_KEYWORD_NOT_SET';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTENT_TOO_SHORT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'SUGGESTIONS_ALREADY_IN_PROGRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n/** @docsIgnore */\nexport type GetPageOptimizationResultsApplicationErrors =\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Starts generating optimization suggestions for a site page.\n *\n * The suggestions target the page's focus keyword, so set it first: run\n * keyword research, set the chosen keyword as the page's focus keyword,\n * then trigger. Returns a `predictionId` to poll Get Page Optimization\n * Results with.\n *\n * Triggering is idempotent per page: while a generation for the page is in\n * progress, calling again returns the same `predictionId` instead of\n * starting a new job, unless the page's focus keyword changed since the\n * job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.\n * @param pageId - ID of the site page to optimize.\n * @public\n * @documentationMaturity preview\n * @requiredField options\n * @requiredField options.pagePath\n * @requiredField pageId\n * @permissionId seo:suggestions:v1:page_optimization:trigger_page_optimization\n * @applicableIdentity APP\n * @fqn wix.seo.suggestions.v1.PageOptimizationService.TriggerPageOptimization\n */\nexport async function triggerPageOptimization(\n pageId: string,\n options: NonNullablePaths<TriggerPageOptimizationOptions, `pagePath`, 2>\n): Promise<\n NonNullablePaths<TriggerPageOptimizationResponse, `predictionId`, 2> & {\n __applicationErrorsType?: TriggerPageOptimizationApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n pageId: pageId,\n pagePath: options?.pagePath,\n });\n\n const reqOpts =\n ambassadorWixSeoSuggestionsV1PageOptimization.triggerPageOptimization(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { pageId: '$[0]', pagePath: '$[1].pagePath' },\n singleArgumentUnchanged: false,\n },\n ['pageId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface TriggerPageOptimizationOptions {\n /**\n * URL path of the page, relative to the site's domain. For example,\n * `/about`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\n/**\n * Starts generating optimization suggestions for the site's homepage.\n *\n * The homepage gets its own method because its suggestions are generated\n * with homepage-specific guidance, representing the whole site, not one\n * topic. Same contract as Trigger Page Optimization: the homepage's focus\n * keyword must be set first, the call returns a `predictionId` to poll,\n * and triggering is idempotent per page while a job is in progress.\n * @param pageId - ID of the site's homepage.\n * @public\n * @documentationMaturity preview\n * @requiredField options\n * @requiredField options.pagePath\n * @requiredField pageId\n * @permissionId seo:suggestions:v1:page_optimization:trigger_home_page_optimization\n * @applicableIdentity APP\n * @fqn wix.seo.suggestions.v1.PageOptimizationService.TriggerHomePageOptimization\n */\nexport async function triggerHomePageOptimization(\n pageId: string,\n options: NonNullablePaths<TriggerHomePageOptimizationOptions, `pagePath`, 2>\n): Promise<\n NonNullablePaths<TriggerHomePageOptimizationResponse, `predictionId`, 2> & {\n __applicationErrorsType?: TriggerHomePageOptimizationApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n pageId: pageId,\n pagePath: options?.pagePath,\n });\n\n const reqOpts =\n ambassadorWixSeoSuggestionsV1PageOptimization.triggerHomePageOptimization(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { pageId: '$[0]', pagePath: '$[1].pagePath' },\n singleArgumentUnchanged: false,\n },\n ['pageId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface TriggerHomePageOptimizationOptions {\n /**\n * URL path of the homepage. Usually `/`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\n/**\n * Retrieves the optimization suggestions generated for a page.\n *\n * Poll this method after a trigger call. The response's `status` reports\n * where the job stands: while generation is still in progress the\n * suggestions are empty and `status` is `IN_PROGRESS`; when it completes,\n * the response carries the full suggestion set with `status` `COMPLETED`.\n * A job that failed reports `FAILED`. Trigger again to retry. Suggestions\n * are stored per page, so a later trigger for the same page replaces them,\n * and a replaced job's lookup reports `NOT_FOUND`.\n *\n * Look up by `predictionId` (from the trigger call), or by `pageId`.\n * @public\n * @documentationMaturity preview\n * @permissionId seo:suggestions:v1:page_optimization:get_page_optimization_results\n * @applicableIdentity APP\n * @fqn wix.seo.suggestions.v1.PageOptimizationService.GetPageOptimizationResults\n */\nexport async function getPageOptimizationResults(\n options?: GetPageOptimizationResultsOptions\n): Promise<\n NonNullablePaths<\n GetPageOptimizationResultsResponse,\n `pageOptimization.metaTitle.after` | `pageOptimization.content` | `status`,\n 4\n > & {\n __applicationErrorsType?: GetPageOptimizationResultsApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n predictionId: options?.predictionId,\n pageId: options?.pageId,\n });\n\n const reqOpts =\n ambassadorWixSeoSuggestionsV1PageOptimization.getPageOptimizationResults(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n predictionId: '$[0].predictionId',\n pageId: '$[0].pageId',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetPageOptimizationResultsOptions {\n /**\n * ID of the generation job, from the trigger call.\n * @maxLength 200\n */\n predictionId?: string | null;\n /**\n * ID of the page to retrieve suggestions for. An alternative to\n * `predictionId` that returns the page's latest generation.\n * @maxLength 1000\n */\n pageId?: string | null;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixSeoSuggestionsV1PageOptimizationServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'bo._base_domain_': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'wixbo.ai': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'wix-bo.com': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n _: [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/seo/suggestions/v1',\n destPath: '/v1',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_seo_page-optimization';\n\n/**\n * Starts generating optimization suggestions for a site page.\n *\n * The suggestions target the page's focus keyword, so set it first: run\n * keyword research, set the chosen keyword as the page's focus keyword,\n * then trigger. Returns a `predictionId` to poll Get Page Optimization\n * Results with.\n *\n * Triggering is idempotent per page: while a generation for the page is in\n * progress, calling again returns the same `predictionId` instead of\n * starting a new job, unless the page's focus keyword changed since the\n * job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.\n */\nexport function triggerPageOptimization(\n payload: object\n): RequestOptionsFactory<any> {\n function __triggerPageOptimization({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'POST' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.TriggerPageOptimization',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/trigger',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __triggerPageOptimization;\n}\n\n/**\n * Starts generating optimization suggestions for the site's homepage.\n *\n * The homepage gets its own method because its suggestions are generated\n * with homepage-specific guidance, representing the whole site, not one\n * topic. Same contract as Trigger Page Optimization: the homepage's focus\n * keyword must be set first, the call returns a `predictionId` to poll,\n * and triggering is idempotent per page while a job is in progress.\n */\nexport function triggerHomePageOptimization(\n payload: object\n): RequestOptionsFactory<any> {\n function __triggerHomePageOptimization({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'POST' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.TriggerHomePageOptimization',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/trigger-home',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __triggerHomePageOptimization;\n}\n\n/**\n * Retrieves the optimization suggestions generated for a page.\n *\n * Poll this method after a trigger call. The response's `status` reports\n * where the job stands: while generation is still in progress the\n * suggestions are empty and `status` is `IN_PROGRESS`; when it completes,\n * the response carries the full suggestion set with `status` `COMPLETED`.\n * A job that failed reports `FAILED`. Trigger again to retry. Suggestions\n * are stored per page, so a later trigger for the same page replaces them,\n * and a replaced job's lookup reports `NOT_FOUND`.\n *\n * Look up by `predictionId` (from the trigger call), or by `pageId`.\n */\nexport function getPageOptimizationResults(\n payload: object\n): RequestOptionsFactory<any> {\n function __getPageOptimizationResults({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'GET' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.GetPageOptimizationResults',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/results',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __getPageOptimizationResults;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n GetPageOptimizationResultsApplicationErrors,\n GetPageOptimizationResultsOptions,\n GetPageOptimizationResultsResponse,\n TriggerHomePageOptimizationApplicationErrors,\n TriggerHomePageOptimizationOptions,\n TriggerHomePageOptimizationResponse,\n TriggerPageOptimizationApplicationErrors,\n TriggerPageOptimizationOptions,\n TriggerPageOptimizationResponse,\n getPageOptimizationResults as universalGetPageOptimizationResults,\n triggerHomePageOptimization as universalTriggerHomePageOptimization,\n triggerPageOptimization as universalTriggerPageOptimization,\n} from './seo-suggestions-v1-page-optimization-page-optimization.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/seo' };\n\nexport function triggerPageOptimization(\n httpClient: HttpClient\n): TriggerPageOptimizationSignature {\n return (\n pageId: string,\n options: NonNullablePaths<TriggerPageOptimizationOptions, `pagePath`, 2>\n ) =>\n universalTriggerPageOptimization(\n pageId,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface TriggerPageOptimizationSignature {\n /**\n * Starts generating optimization suggestions for a site page.\n *\n * The suggestions target the page's focus keyword, so set it first: run\n * keyword research, set the chosen keyword as the page's focus keyword,\n * then trigger. Returns a `predictionId` to poll Get Page Optimization\n * Results with.\n *\n * Triggering is idempotent per page: while a generation for the page is in\n * progress, calling again returns the same `predictionId` instead of\n * starting a new job, unless the page's focus keyword changed since the\n * job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.\n * @param - ID of the site page to optimize.\n */\n (\n pageId: string,\n options: NonNullablePaths<TriggerPageOptimizationOptions, `pagePath`, 2>\n ): Promise<\n NonNullablePaths<TriggerPageOptimizationResponse, `predictionId`, 2> & {\n __applicationErrorsType?: TriggerPageOptimizationApplicationErrors;\n }\n >;\n}\n\nexport function triggerHomePageOptimization(\n httpClient: HttpClient\n): TriggerHomePageOptimizationSignature {\n return (\n pageId: string,\n options: NonNullablePaths<TriggerHomePageOptimizationOptions, `pagePath`, 2>\n ) =>\n universalTriggerHomePageOptimization(\n pageId,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface TriggerHomePageOptimizationSignature {\n /**\n * Starts generating optimization suggestions for the site's homepage.\n *\n * The homepage gets its own method because its suggestions are generated\n * with homepage-specific guidance, representing the whole site, not one\n * topic. Same contract as Trigger Page Optimization: the homepage's focus\n * keyword must be set first, the call returns a `predictionId` to poll,\n * and triggering is idempotent per page while a job is in progress.\n * @param - ID of the site's homepage.\n */\n (\n pageId: string,\n options: NonNullablePaths<TriggerHomePageOptimizationOptions, `pagePath`, 2>\n ): Promise<\n NonNullablePaths<TriggerHomePageOptimizationResponse, `predictionId`, 2> & {\n __applicationErrorsType?: TriggerHomePageOptimizationApplicationErrors;\n }\n >;\n}\n\nexport function getPageOptimizationResults(\n httpClient: HttpClient\n): GetPageOptimizationResultsSignature {\n return (options?: GetPageOptimizationResultsOptions) =>\n universalGetPageOptimizationResults(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GetPageOptimizationResultsSignature {\n /**\n * Retrieves the optimization suggestions generated for a page.\n *\n * Poll this method after a trigger call. The response's `status` reports\n * where the job stands: while generation is still in progress the\n * suggestions are empty and `status` is `IN_PROGRESS`; when it completes,\n * the response carries the full suggestion set with `status` `COMPLETED`.\n * A job that failed reports `FAILED`. Trigger again to retry. Suggestions\n * are stored per page, so a later trigger for the same page replaces them,\n * and a replaced job's lookup reports `NOT_FOUND`.\n *\n * Look up by `predictionId` (from the trigger call), or by `pageId`.\n */\n (options?: GetPageOptimizationResultsOptions): Promise<\n NonNullablePaths<\n GetPageOptimizationResultsResponse,\n | `pageOptimization.metaTitle.after`\n | `pageOptimization.content`\n | `status`,\n 4\n > & {\n __applicationErrorsType?: GetPageOptimizationResultsApplicationErrors;\n }\n >;\n}\n\nexport {\n GetPageOptimizationResultsOptions,\n GetPageOptimizationResultsRequest,\n GetPageOptimizationResultsResponse,\n OptimizationStatus,\n PageOptimization,\n TextSuggestion,\n TriggerHomePageOptimizationOptions,\n TriggerHomePageOptimizationRequest,\n TriggerHomePageOptimizationResponse,\n TriggerPageOptimizationOptions,\n TriggerPageOptimizationRequest,\n TriggerPageOptimizationResponse,\n} from './seo-suggestions-v1-page-optimization-page-optimization.universal.js';\n","import {\n triggerPageOptimization as publicTriggerPageOptimization,\n triggerHomePageOptimization as publicTriggerHomePageOptimization,\n getPageOptimizationResults as publicGetPageOptimizationResults,\n} from './seo-suggestions-v1-page-optimization-page-optimization.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const triggerPageOptimization: MaybeContext<\n BuildRESTFunction<typeof publicTriggerPageOptimization> &\n typeof publicTriggerPageOptimization\n> = /*#__PURE__*/ createRESTModule(publicTriggerPageOptimization);\nexport const triggerHomePageOptimization: MaybeContext<\n BuildRESTFunction<typeof publicTriggerHomePageOptimization> &\n typeof publicTriggerHomePageOptimization\n> = /*#__PURE__*/ createRESTModule(publicTriggerHomePageOptimization);\nexport const getPageOptimizationResults: MaybeContext<\n BuildRESTFunction<typeof publicGetPageOptimizationResults> &\n typeof publicGetPageOptimizationResults\n> = /*#__PURE__*/ createRESTModule(publicGetPageOptimizationResults);\n\nexport { OptimizationStatus } from './seo-suggestions-v1-page-optimization-page-optimization.universal.js';\nexport {\n PageOptimization,\n TextSuggestion,\n TriggerPageOptimizationRequest,\n TriggerPageOptimizationResponse,\n TriggerHomePageOptimizationRequest,\n TriggerHomePageOptimizationResponse,\n GetPageOptimizationResultsRequest,\n GetPageOptimizationResultsResponse,\n TriggerPageOptimizationOptions,\n TriggerHomePageOptimizationOptions,\n GetPageOptimizationResultsOptions,\n} from './seo-suggestions-v1-page-optimization-page-optimization.universal.js';\nexport {\n OptimizationStatusWithLiterals,\n TriggerPageOptimizationApplicationErrors,\n TriggerHomePageOptimizationApplicationErrors,\n GetPageOptimizationResultsApplicationErrors,\n} from './seo-suggestions-v1-page-optimization-page-optimization.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,oCAAAA;AAAA,EAAA,mCAAA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c,SAAS;AAAA,IACvB,QAAQ,SAAS;AAAA,EACnB,CAAC;AAED,QAAM,UAC0C;AAAA,IAC5C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAF;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,cAAc;AAAA,UACd,QAAQ;AAAA,QACV;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AE5bO,SAASG,yBACd,YACkC;AAClC,SAAO,CACL,QACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AA2BO,SAASC,6BACd,YACsC;AACtC,SAAO,CACL,QACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAuBO,SAASC,4BACd,YACqC;AACrC,SAAO,CAAC,YACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;AClGA,IAAAC,uBAAiC;AAG1B,IAAMC,2BAGK,2DAAiBA,wBAA6B;AACzD,IAAMC,+BAGK,2DAAiBA,4BAAiC;AAC7D,IAAMC,8BAGK,2DAAiBA,2BAAgC;","names":["getPageOptimizationResults","triggerHomePageOptimization","triggerPageOptimization","import_rest_modules","OptimizationStatus","triggerPageOptimization","sdkTransformError","triggerHomePageOptimization","getPageOptimizationResults","triggerPageOptimization","triggerHomePageOptimization","getPageOptimizationResults","import_rest_modules","triggerPageOptimization","triggerHomePageOptimization","getPageOptimizationResults"]}
|
|
1
|
+
{"version":3,"sources":["../../index.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.universal.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.http.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.public.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.context.ts"],"sourcesContent":["export * from './src/seo-suggestions-v1-page-optimization-page-optimization.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixSeoSuggestionsV1PageOptimization from './seo-suggestions-v1-page-optimization-page-optimization.http.js';\n\n/**\n * A whole-page set of SEO optimization suggestions, generated for one page\n * and focus keyword.\n *\n * Each suggestion is a before/after pair: `before` is the page's current\n * text (empty when the page has none, such as a missing meta description),\n * and `after` is the suggested replacement. Locate the element to change by\n * its `before` text. Suggestions are stored per page, so a later generation\n * for the same page replaces this set.\n */\nexport interface PageOptimization {\n /**\n * ID of this suggestion set.\n * @format GUID\n * @readonly\n */\n _id?: string | null;\n /**\n * Suggested title tag.\n * @readonly\n */\n metaTitle?: TextSuggestion;\n /**\n * Suggested description tag.\n * @readonly\n */\n metaDescription?: TextSuggestion;\n /**\n * Suggested H1 heading.\n * @readonly\n */\n h1?: TextSuggestion;\n /**\n * Suggested subheading, for an H2 or H3 element of the page.\n * @readonly\n */\n h2OrH3?: TextSuggestion;\n /**\n * Suggested rewrites of the page's body text, one per text element.\n * @readonly\n * @maxSize 100\n */\n content?: TextSuggestion[];\n}\n\n/** One suggested text change. */\nexport interface TextSuggestion {\n /**\n * The page's current text. Empty when the page has no text in this slot,\n * for example, a missing meta description.\n * @readonly\n * @maxLength 1000\n */\n before?: string | null;\n /**\n * The suggested text.\n * @readonly\n * @maxLength 1000\n */\n after?: string;\n}\n\nexport interface TriggerPageOptimizationRequest {\n /**\n * ID of the site page to optimize. The page's focus keyword must be set.\n * @maxLength 1000\n * @minLength 1\n */\n pageId: string;\n /**\n * URL path of the page, relative to the site's domain. For example,\n * `/about`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\nexport interface TriggerPageOptimizationResponse {\n /**\n * ID of the generation job. Pass to Get Page Optimization Results.\n * @readonly\n * @maxLength 200\n */\n predictionId?: string;\n}\n\nexport interface TriggerHomePageOptimizationRequest {\n /**\n * ID of the site's homepage.\n * @maxLength 1000\n * @minLength 1\n */\n pageId: string;\n /**\n * URL path of the homepage. Usually `/`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\nexport interface TriggerHomePageOptimizationResponse {\n /**\n * ID of the generation job. Pass to Get Page Optimization Results.\n * @readonly\n * @maxLength 200\n */\n predictionId?: string;\n}\n\nexport interface GetPageOptimizationResultsRequest {\n /**\n * ID of the generation job, from the trigger call. Can be looked up for 2\n * hours after the trigger call.\n * @maxLength 200\n */\n predictionId?: string | null;\n /**\n * ID of the page to retrieve suggestions for. An alternative to\n * `predictionId` that returns the page's latest generation.\n * @maxLength 1000\n */\n pageId?: string | null;\n}\n\nexport interface GetPageOptimizationResultsResponse {\n /** The generated suggestions. Returned only when `status` is `COMPLETED`. */\n pageOptimization?: PageOptimization;\n /**\n * Status of the generation job the lookup matched.\n * @readonly\n */\n status?: OptimizationStatusWithLiterals;\n}\n\n/** Status of a page optimization generation job. */\nexport enum OptimizationStatus {\n /** Unknown status. */\n UNKNOWN_OPTIMIZATION_STATUS = 'UNKNOWN_OPTIMIZATION_STATUS',\n /**\n * No generation job matches the lookup. It never existed, or a later\n * trigger for the same page replaced it.\n */\n NOT_FOUND = 'NOT_FOUND',\n /** Generation is still running. Poll again. */\n IN_PROGRESS = 'IN_PROGRESS',\n /** Generation finished; the response carries the suggestions. */\n COMPLETED = 'COMPLETED',\n /** Generation failed. Trigger again to retry. */\n FAILED = 'FAILED',\n}\n\n/** @enumType */\nexport type OptimizationStatusWithLiterals =\n | OptimizationStatus\n | 'UNKNOWN_OPTIMIZATION_STATUS'\n | 'NOT_FOUND'\n | 'IN_PROGRESS'\n | 'COMPLETED'\n | 'FAILED';\n/** @docsIgnore */\nexport type TriggerPageOptimizationApplicationErrors =\n | {\n code?: 'SITE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FOCUS_KEYWORD_NOT_SET';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTENT_TOO_SHORT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'SUGGESTIONS_ALREADY_IN_PROGRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n/** @docsIgnore */\nexport type TriggerHomePageOptimizationApplicationErrors =\n | {\n code?: 'SITE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FOCUS_KEYWORD_NOT_SET';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTENT_TOO_SHORT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'SUGGESTIONS_ALREADY_IN_PROGRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n/** @docsIgnore */\nexport type GetPageOptimizationResultsApplicationErrors =\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Starts generating optimization suggestions for a site page.\n *\n * The suggestions target the page's focus keyword, so set it first: run\n * keyword research, set the chosen keyword as the page's focus keyword,\n * then trigger. Returns a `predictionId` to poll Get Page Optimization\n * Results with.\n *\n * Triggering is idempotent per page: while a generation for the page is in\n * progress, calling again returns the same `predictionId` instead of\n * starting a new job, unless the page's focus keyword changed since the\n * job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.\n *\n * Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.\n * @param pageId - ID of the site page to optimize. The page's focus keyword must be set.\n * @public\n * @documentationMaturity preview\n * @requiredField options\n * @requiredField options.pagePath\n * @requiredField pageId\n * @permissionId seo:suggestions:v1:page_optimization:trigger_page_optimization\n * @applicableIdentity APP\n * @fqn wix.seo.suggestions.v1.PageOptimizationService.TriggerPageOptimization\n */\nexport async function triggerPageOptimization(\n pageId: string,\n options: NonNullablePaths<TriggerPageOptimizationOptions, `pagePath`, 2>\n): Promise<\n NonNullablePaths<TriggerPageOptimizationResponse, `predictionId`, 2> & {\n __applicationErrorsType?: TriggerPageOptimizationApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n pageId: pageId,\n pagePath: options?.pagePath,\n });\n\n const reqOpts =\n ambassadorWixSeoSuggestionsV1PageOptimization.triggerPageOptimization(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { pageId: '$[0]', pagePath: '$[1].pagePath' },\n singleArgumentUnchanged: false,\n },\n ['pageId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface TriggerPageOptimizationOptions {\n /**\n * URL path of the page, relative to the site's domain. For example,\n * `/about`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\n/**\n * Starts generating optimization suggestions for the site's homepage.\n *\n * The homepage gets its own method because its suggestions are generated\n * with homepage-specific guidance, representing the whole site, not one\n * topic. Same contract as Trigger Page Optimization: the homepage's focus\n * keyword must be set first, the call returns a `predictionId` to poll,\n * and triggering is idempotent per page while a job is in progress.\n *\n * Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.\n * @param pageId - ID of the site's homepage.\n * @public\n * @documentationMaturity preview\n * @requiredField options\n * @requiredField options.pagePath\n * @requiredField pageId\n * @permissionId seo:suggestions:v1:page_optimization:trigger_home_page_optimization\n * @applicableIdentity APP\n * @fqn wix.seo.suggestions.v1.PageOptimizationService.TriggerHomePageOptimization\n */\nexport async function triggerHomePageOptimization(\n pageId: string,\n options: NonNullablePaths<TriggerHomePageOptimizationOptions, `pagePath`, 2>\n): Promise<\n NonNullablePaths<TriggerHomePageOptimizationResponse, `predictionId`, 2> & {\n __applicationErrorsType?: TriggerHomePageOptimizationApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n pageId: pageId,\n pagePath: options?.pagePath,\n });\n\n const reqOpts =\n ambassadorWixSeoSuggestionsV1PageOptimization.triggerHomePageOptimization(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { pageId: '$[0]', pagePath: '$[1].pagePath' },\n singleArgumentUnchanged: false,\n },\n ['pageId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface TriggerHomePageOptimizationOptions {\n /**\n * URL path of the homepage. Usually `/`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\n/**\n * Retrieves the optimization suggestions generated for a page.\n *\n * Poll this method after a trigger call. The response's `status` reports\n * where the job stands: while generation is still in progress the\n * suggestions are empty and `status` is `IN_PROGRESS`; when it completes,\n * the response carries the full suggestion set with `status` `COMPLETED`.\n * A job that failed reports `FAILED`. Trigger again to retry. Suggestions\n * are stored per page, so a later trigger for the same page replaces them,\n * and a replaced job's lookup reports `NOT_FOUND`.\n *\n * Look up by `predictionId` (from the trigger call), or by `pageId`. A\n * `predictionId` can be looked up for 2 hours after the trigger call; after\n * that, look up by `pageId`, which returns the page's latest generation.\n * @public\n * @documentationMaturity preview\n * @permissionId seo:suggestions:v1:page_optimization:get_page_optimization_results\n * @applicableIdentity APP\n * @fqn wix.seo.suggestions.v1.PageOptimizationService.GetPageOptimizationResults\n */\nexport async function getPageOptimizationResults(\n options?: GetPageOptimizationResultsOptions\n): Promise<\n NonNullablePaths<\n GetPageOptimizationResultsResponse,\n `pageOptimization.metaTitle.after` | `pageOptimization.content` | `status`,\n 4\n > & {\n __applicationErrorsType?: GetPageOptimizationResultsApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n predictionId: options?.predictionId,\n pageId: options?.pageId,\n });\n\n const reqOpts =\n ambassadorWixSeoSuggestionsV1PageOptimization.getPageOptimizationResults(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n predictionId: '$[0].predictionId',\n pageId: '$[0].pageId',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetPageOptimizationResultsOptions {\n /**\n * ID of the generation job, from the trigger call. Can be looked up for 2\n * hours after the trigger call.\n * @maxLength 200\n */\n predictionId?: string | null;\n /**\n * ID of the page to retrieve suggestions for. An alternative to\n * `predictionId` that returns the page's latest generation.\n * @maxLength 1000\n */\n pageId?: string | null;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixSeoSuggestionsV1PageOptimizationServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'bo._base_domain_': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'wixbo.ai': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'wix-bo.com': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n _: [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/seo/suggestions/v1',\n destPath: '/v1',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_seo_page-optimization';\n\n/**\n * Starts generating optimization suggestions for a site page.\n *\n * The suggestions target the page's focus keyword, so set it first: run\n * keyword research, set the chosen keyword as the page's focus keyword,\n * then trigger. Returns a `predictionId` to poll Get Page Optimization\n * Results with.\n *\n * Triggering is idempotent per page: while a generation for the page is in\n * progress, calling again returns the same `predictionId` instead of\n * starting a new job, unless the page's focus keyword changed since the\n * job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.\n *\n * Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.\n */\nexport function triggerPageOptimization(\n payload: object\n): RequestOptionsFactory<any> {\n function __triggerPageOptimization({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'POST' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.TriggerPageOptimization',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/trigger',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __triggerPageOptimization;\n}\n\n/**\n * Starts generating optimization suggestions for the site's homepage.\n *\n * The homepage gets its own method because its suggestions are generated\n * with homepage-specific guidance, representing the whole site, not one\n * topic. Same contract as Trigger Page Optimization: the homepage's focus\n * keyword must be set first, the call returns a `predictionId` to poll,\n * and triggering is idempotent per page while a job is in progress.\n *\n * Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.\n */\nexport function triggerHomePageOptimization(\n payload: object\n): RequestOptionsFactory<any> {\n function __triggerHomePageOptimization({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'POST' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.TriggerHomePageOptimization',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/trigger-home',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __triggerHomePageOptimization;\n}\n\n/**\n * Retrieves the optimization suggestions generated for a page.\n *\n * Poll this method after a trigger call. The response's `status` reports\n * where the job stands: while generation is still in progress the\n * suggestions are empty and `status` is `IN_PROGRESS`; when it completes,\n * the response carries the full suggestion set with `status` `COMPLETED`.\n * A job that failed reports `FAILED`. Trigger again to retry. Suggestions\n * are stored per page, so a later trigger for the same page replaces them,\n * and a replaced job's lookup reports `NOT_FOUND`.\n *\n * Look up by `predictionId` (from the trigger call), or by `pageId`. A\n * `predictionId` can be looked up for 2 hours after the trigger call; after\n * that, look up by `pageId`, which returns the page's latest generation.\n */\nexport function getPageOptimizationResults(\n payload: object\n): RequestOptionsFactory<any> {\n function __getPageOptimizationResults({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'GET' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.GetPageOptimizationResults',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/results',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __getPageOptimizationResults;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n GetPageOptimizationResultsApplicationErrors,\n GetPageOptimizationResultsOptions,\n GetPageOptimizationResultsResponse,\n TriggerHomePageOptimizationApplicationErrors,\n TriggerHomePageOptimizationOptions,\n TriggerHomePageOptimizationResponse,\n TriggerPageOptimizationApplicationErrors,\n TriggerPageOptimizationOptions,\n TriggerPageOptimizationResponse,\n getPageOptimizationResults as universalGetPageOptimizationResults,\n triggerHomePageOptimization as universalTriggerHomePageOptimization,\n triggerPageOptimization as universalTriggerPageOptimization,\n} from './seo-suggestions-v1-page-optimization-page-optimization.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/seo' };\n\nexport function triggerPageOptimization(\n httpClient: HttpClient\n): TriggerPageOptimizationSignature {\n return (\n pageId: string,\n options: NonNullablePaths<TriggerPageOptimizationOptions, `pagePath`, 2>\n ) =>\n universalTriggerPageOptimization(\n pageId,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface TriggerPageOptimizationSignature {\n /**\n * Starts generating optimization suggestions for a site page.\n *\n * The suggestions target the page's focus keyword, so set it first: run\n * keyword research, set the chosen keyword as the page's focus keyword,\n * then trigger. Returns a `predictionId` to poll Get Page Optimization\n * Results with.\n *\n * Triggering is idempotent per page: while a generation for the page is in\n * progress, calling again returns the same `predictionId` instead of\n * starting a new job, unless the page's focus keyword changed since the\n * job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.\n *\n * Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.\n * @param - ID of the site page to optimize. The page's focus keyword must be set.\n */\n (\n pageId: string,\n options: NonNullablePaths<TriggerPageOptimizationOptions, `pagePath`, 2>\n ): Promise<\n NonNullablePaths<TriggerPageOptimizationResponse, `predictionId`, 2> & {\n __applicationErrorsType?: TriggerPageOptimizationApplicationErrors;\n }\n >;\n}\n\nexport function triggerHomePageOptimization(\n httpClient: HttpClient\n): TriggerHomePageOptimizationSignature {\n return (\n pageId: string,\n options: NonNullablePaths<TriggerHomePageOptimizationOptions, `pagePath`, 2>\n ) =>\n universalTriggerHomePageOptimization(\n pageId,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface TriggerHomePageOptimizationSignature {\n /**\n * Starts generating optimization suggestions for the site's homepage.\n *\n * The homepage gets its own method because its suggestions are generated\n * with homepage-specific guidance, representing the whole site, not one\n * topic. Same contract as Trigger Page Optimization: the homepage's focus\n * keyword must be set first, the call returns a `predictionId` to poll,\n * and triggering is idempotent per page while a job is in progress.\n *\n * Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.\n * @param - ID of the site's homepage.\n */\n (\n pageId: string,\n options: NonNullablePaths<TriggerHomePageOptimizationOptions, `pagePath`, 2>\n ): Promise<\n NonNullablePaths<TriggerHomePageOptimizationResponse, `predictionId`, 2> & {\n __applicationErrorsType?: TriggerHomePageOptimizationApplicationErrors;\n }\n >;\n}\n\nexport function getPageOptimizationResults(\n httpClient: HttpClient\n): GetPageOptimizationResultsSignature {\n return (options?: GetPageOptimizationResultsOptions) =>\n universalGetPageOptimizationResults(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GetPageOptimizationResultsSignature {\n /**\n * Retrieves the optimization suggestions generated for a page.\n *\n * Poll this method after a trigger call. The response's `status` reports\n * where the job stands: while generation is still in progress the\n * suggestions are empty and `status` is `IN_PROGRESS`; when it completes,\n * the response carries the full suggestion set with `status` `COMPLETED`.\n * A job that failed reports `FAILED`. Trigger again to retry. Suggestions\n * are stored per page, so a later trigger for the same page replaces them,\n * and a replaced job's lookup reports `NOT_FOUND`.\n *\n * Look up by `predictionId` (from the trigger call), or by `pageId`. A\n * `predictionId` can be looked up for 2 hours after the trigger call; after\n * that, look up by `pageId`, which returns the page's latest generation.\n */\n (options?: GetPageOptimizationResultsOptions): Promise<\n NonNullablePaths<\n GetPageOptimizationResultsResponse,\n | `pageOptimization.metaTitle.after`\n | `pageOptimization.content`\n | `status`,\n 4\n > & {\n __applicationErrorsType?: GetPageOptimizationResultsApplicationErrors;\n }\n >;\n}\n\nexport {\n GetPageOptimizationResultsOptions,\n GetPageOptimizationResultsRequest,\n GetPageOptimizationResultsResponse,\n OptimizationStatus,\n PageOptimization,\n TextSuggestion,\n TriggerHomePageOptimizationOptions,\n TriggerHomePageOptimizationRequest,\n TriggerHomePageOptimizationResponse,\n TriggerPageOptimizationOptions,\n TriggerPageOptimizationRequest,\n TriggerPageOptimizationResponse,\n} from './seo-suggestions-v1-page-optimization-page-optimization.universal.js';\n","import {\n triggerPageOptimization as publicTriggerPageOptimization,\n triggerHomePageOptimization as publicTriggerHomePageOptimization,\n getPageOptimizationResults as publicGetPageOptimizationResults,\n} from './seo-suggestions-v1-page-optimization-page-optimization.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const triggerPageOptimization: MaybeContext<\n BuildRESTFunction<typeof publicTriggerPageOptimization> &\n typeof publicTriggerPageOptimization\n> = /*#__PURE__*/ createRESTModule(publicTriggerPageOptimization);\nexport const triggerHomePageOptimization: MaybeContext<\n BuildRESTFunction<typeof publicTriggerHomePageOptimization> &\n typeof publicTriggerHomePageOptimization\n> = /*#__PURE__*/ createRESTModule(publicTriggerHomePageOptimization);\nexport const getPageOptimizationResults: MaybeContext<\n BuildRESTFunction<typeof publicGetPageOptimizationResults> &\n typeof publicGetPageOptimizationResults\n> = /*#__PURE__*/ createRESTModule(publicGetPageOptimizationResults);\n\nexport { OptimizationStatus } from './seo-suggestions-v1-page-optimization-page-optimization.universal.js';\nexport {\n PageOptimization,\n TextSuggestion,\n TriggerPageOptimizationRequest,\n TriggerPageOptimizationResponse,\n TriggerHomePageOptimizationRequest,\n TriggerHomePageOptimizationResponse,\n GetPageOptimizationResultsRequest,\n GetPageOptimizationResultsResponse,\n TriggerPageOptimizationOptions,\n TriggerHomePageOptimizationOptions,\n GetPageOptimizationResultsOptions,\n} from './seo-suggestions-v1-page-optimization-page-optimization.universal.js';\nexport {\n OptimizationStatusWithLiterals,\n TriggerPageOptimizationApplicationErrors,\n TriggerHomePageOptimizationApplicationErrors,\n GetPageOptimizationResultsApplicationErrors,\n} from './seo-suggestions-v1-page-optimization-page-optimization.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,oCAAAA;AAAA,EAAA,mCAAAC;AAAA,EAAA,+BAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAAkC;AAClC,IAAAC,uBAA2B;AAI3B,SAAS,qDACP,MACA;AAC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AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAF;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,cAAc;AAAA,UACd,QAAQ;AAAA,QACV;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AErcO,SAASG,yBACd,YACkC;AAClC,SAAO,CACL,QACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AA6BO,SAASC,6BACd,YACsC;AACtC,SAAO,CACL,QACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAyBO,SAASC,4BACd,YACqC;AACrC,SAAO,CAAC,YACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACtGA,IAAAC,uBAAiC;AAG1B,IAAMC,2BAGK,2DAAiBA,wBAA6B;AACzD,IAAMC,+BAGK,2DAAiBA,4BAAiC;AAC7D,IAAMC,8BAGK,2DAAiBA,2BAAgC;","names":["getPageOptimizationResults","triggerHomePageOptimization","triggerPageOptimization","import_rest_modules","OptimizationStatus","triggerPageOptimization","sdkTransformError","triggerHomePageOptimization","getPageOptimizationResults","triggerPageOptimization","triggerHomePageOptimization","getPageOptimizationResults","import_rest_modules","triggerPageOptimization","triggerHomePageOptimization","getPageOptimizationResults"]}
|
|
@@ -7,7 +7,8 @@ import { NonNullablePaths } from '@wix/sdk-types';
|
|
|
7
7
|
* Each suggestion is a before/after pair: `before` is the page's current
|
|
8
8
|
* text (empty when the page has none, such as a missing meta description),
|
|
9
9
|
* and `after` is the suggested replacement. Locate the element to change by
|
|
10
|
-
* its `before` text.
|
|
10
|
+
* its `before` text. Suggestions are stored per page, so a later generation
|
|
11
|
+
* for the same page replaces this set.
|
|
11
12
|
*/
|
|
12
13
|
interface PageOptimization {
|
|
13
14
|
/**
|
|
@@ -32,12 +33,12 @@ interface PageOptimization {
|
|
|
32
33
|
*/
|
|
33
34
|
h1?: TextSuggestion;
|
|
34
35
|
/**
|
|
35
|
-
* Suggested H2 or H3
|
|
36
|
+
* Suggested subheading, for an H2 or H3 element of the page.
|
|
36
37
|
* @readonly
|
|
37
38
|
*/
|
|
38
39
|
h2OrH3?: TextSuggestion;
|
|
39
40
|
/**
|
|
40
|
-
* Suggested body text
|
|
41
|
+
* Suggested rewrites of the page's body text, one per text element.
|
|
41
42
|
* @readonly
|
|
42
43
|
* @maxSize 100
|
|
43
44
|
*/
|
|
@@ -61,7 +62,7 @@ interface TextSuggestion {
|
|
|
61
62
|
}
|
|
62
63
|
interface TriggerPageOptimizationRequest {
|
|
63
64
|
/**
|
|
64
|
-
* ID of the site page to optimize.
|
|
65
|
+
* ID of the site page to optimize. The page's focus keyword must be set.
|
|
65
66
|
* @maxLength 1000
|
|
66
67
|
* @minLength 1
|
|
67
68
|
*/
|
|
@@ -106,7 +107,8 @@ interface TriggerHomePageOptimizationResponse {
|
|
|
106
107
|
}
|
|
107
108
|
interface GetPageOptimizationResultsRequest {
|
|
108
109
|
/**
|
|
109
|
-
* ID of the generation job, from the trigger call.
|
|
110
|
+
* ID of the generation job, from the trigger call. Can be looked up for 2
|
|
111
|
+
* hours after the trigger call.
|
|
110
112
|
* @maxLength 200
|
|
111
113
|
*/
|
|
112
114
|
predictionId?: string | null;
|
|
@@ -128,6 +130,7 @@ interface GetPageOptimizationResultsResponse {
|
|
|
128
130
|
}
|
|
129
131
|
/** Status of a page optimization generation job. */
|
|
130
132
|
declare enum OptimizationStatus {
|
|
133
|
+
/** Unknown status. */
|
|
131
134
|
UNKNOWN_OPTIMIZATION_STATUS = "UNKNOWN_OPTIMIZATION_STATUS",
|
|
132
135
|
/**
|
|
133
136
|
* No generation job matches the lookup. It never existed, or a later
|
|
@@ -217,7 +220,9 @@ type GetPageOptimizationResultsApplicationErrors = {
|
|
|
217
220
|
* progress, calling again returns the same `predictionId` instead of
|
|
218
221
|
* starting a new job, unless the page's focus keyword changed since the
|
|
219
222
|
* job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.
|
|
220
|
-
*
|
|
223
|
+
*
|
|
224
|
+
* Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.
|
|
225
|
+
* @param pageId - ID of the site page to optimize. The page's focus keyword must be set.
|
|
221
226
|
* @public
|
|
222
227
|
* @documentationMaturity preview
|
|
223
228
|
* @requiredField options
|
|
@@ -247,6 +252,8 @@ interface TriggerPageOptimizationOptions {
|
|
|
247
252
|
* topic. Same contract as Trigger Page Optimization: the homepage's focus
|
|
248
253
|
* keyword must be set first, the call returns a `predictionId` to poll,
|
|
249
254
|
* and triggering is idempotent per page while a job is in progress.
|
|
255
|
+
*
|
|
256
|
+
* Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.
|
|
250
257
|
* @param pageId - ID of the site's homepage.
|
|
251
258
|
* @public
|
|
252
259
|
* @documentationMaturity preview
|
|
@@ -279,7 +286,9 @@ interface TriggerHomePageOptimizationOptions {
|
|
|
279
286
|
* are stored per page, so a later trigger for the same page replaces them,
|
|
280
287
|
* and a replaced job's lookup reports `NOT_FOUND`.
|
|
281
288
|
*
|
|
282
|
-
* Look up by `predictionId` (from the trigger call), or by `pageId`.
|
|
289
|
+
* Look up by `predictionId` (from the trigger call), or by `pageId`. A
|
|
290
|
+
* `predictionId` can be looked up for 2 hours after the trigger call; after
|
|
291
|
+
* that, look up by `pageId`, which returns the page's latest generation.
|
|
283
292
|
* @public
|
|
284
293
|
* @documentationMaturity preview
|
|
285
294
|
* @permissionId seo:suggestions:v1:page_optimization:get_page_optimization_results
|
|
@@ -291,7 +300,8 @@ declare function getPageOptimizationResults(options?: GetPageOptimizationResults
|
|
|
291
300
|
}>;
|
|
292
301
|
interface GetPageOptimizationResultsOptions {
|
|
293
302
|
/**
|
|
294
|
-
* ID of the generation job, from the trigger call.
|
|
303
|
+
* ID of the generation job, from the trigger call. Can be looked up for 2
|
|
304
|
+
* hours after the trigger call.
|
|
295
305
|
* @maxLength 200
|
|
296
306
|
*/
|
|
297
307
|
predictionId?: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.typings.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.universal.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.http.ts"],"sourcesContent":["export * from './src/seo-suggestions-v1-page-optimization-page-optimization.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixSeoSuggestionsV1PageOptimization from './seo-suggestions-v1-page-optimization-page-optimization.http.js';\n\n/**\n * A whole-page set of SEO optimization suggestions, generated for one page\n * and focus keyword.\n *\n * Each suggestion is a before/after pair: `before` is the page's current\n * text (empty when the page has none, such as a missing meta description),\n * and `after` is the suggested replacement. Locate the element to change by\n * its `before` text.\n */\nexport interface PageOptimization {\n /**\n * ID of this suggestion set.\n * @format GUID\n * @readonly\n */\n _id?: string | null;\n /**\n * Suggested title tag.\n * @readonly\n */\n metaTitle?: TextSuggestion;\n /**\n * Suggested description tag.\n * @readonly\n */\n metaDescription?: TextSuggestion;\n /**\n * Suggested H1 heading.\n * @readonly\n */\n h1?: TextSuggestion;\n /**\n * Suggested H2 or H3 heading.\n * @readonly\n */\n h2OrH3?: TextSuggestion;\n /**\n * Suggested body text rewrites.\n * @readonly\n * @maxSize 100\n */\n content?: TextSuggestion[];\n}\n\n/** One suggested text change. */\nexport interface TextSuggestion {\n /**\n * The page's current text. Empty when the page has no text in this slot,\n * for example, a missing meta description.\n * @readonly\n * @maxLength 1000\n */\n before?: string | null;\n /**\n * The suggested text.\n * @readonly\n * @maxLength 1000\n */\n after?: string;\n}\n\nexport interface TriggerPageOptimizationRequest {\n /**\n * ID of the site page to optimize.\n * @maxLength 1000\n * @minLength 1\n */\n pageId: string;\n /**\n * URL path of the page, relative to the site's domain. For example,\n * `/about`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\nexport interface TriggerPageOptimizationResponse {\n /**\n * ID of the generation job. Pass to Get Page Optimization Results.\n * @readonly\n * @maxLength 200\n */\n predictionId?: string;\n}\n\nexport interface TriggerHomePageOptimizationRequest {\n /**\n * ID of the site's homepage.\n * @maxLength 1000\n * @minLength 1\n */\n pageId: string;\n /**\n * URL path of the homepage. Usually `/`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\nexport interface TriggerHomePageOptimizationResponse {\n /**\n * ID of the generation job. Pass to Get Page Optimization Results.\n * @readonly\n * @maxLength 200\n */\n predictionId?: string;\n}\n\nexport interface GetPageOptimizationResultsRequest {\n /**\n * ID of the generation job, from the trigger call.\n * @maxLength 200\n */\n predictionId?: string | null;\n /**\n * ID of the page to retrieve suggestions for. An alternative to\n * `predictionId` that returns the page's latest generation.\n * @maxLength 1000\n */\n pageId?: string | null;\n}\n\nexport interface GetPageOptimizationResultsResponse {\n /** The generated suggestions. Returned only when `status` is `COMPLETED`. */\n pageOptimization?: PageOptimization;\n /**\n * Status of the generation job the lookup matched.\n * @readonly\n */\n status?: OptimizationStatusWithLiterals;\n}\n\n/** Status of a page optimization generation job. */\nexport enum OptimizationStatus {\n UNKNOWN_OPTIMIZATION_STATUS = 'UNKNOWN_OPTIMIZATION_STATUS',\n /**\n * No generation job matches the lookup. It never existed, or a later\n * trigger for the same page replaced it.\n */\n NOT_FOUND = 'NOT_FOUND',\n /** Generation is still running. Poll again. */\n IN_PROGRESS = 'IN_PROGRESS',\n /** Generation finished; the response carries the suggestions. */\n COMPLETED = 'COMPLETED',\n /** Generation failed. Trigger again to retry. */\n FAILED = 'FAILED',\n}\n\n/** @enumType */\nexport type OptimizationStatusWithLiterals =\n | OptimizationStatus\n | 'UNKNOWN_OPTIMIZATION_STATUS'\n | 'NOT_FOUND'\n | 'IN_PROGRESS'\n | 'COMPLETED'\n | 'FAILED';\n/** @docsIgnore */\nexport type TriggerPageOptimizationApplicationErrors =\n | {\n code?: 'SITE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FOCUS_KEYWORD_NOT_SET';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTENT_TOO_SHORT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'SUGGESTIONS_ALREADY_IN_PROGRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n/** @docsIgnore */\nexport type TriggerHomePageOptimizationApplicationErrors =\n | {\n code?: 'SITE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FOCUS_KEYWORD_NOT_SET';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTENT_TOO_SHORT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'SUGGESTIONS_ALREADY_IN_PROGRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n/** @docsIgnore */\nexport type GetPageOptimizationResultsApplicationErrors =\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Starts generating optimization suggestions for a site page.\n *\n * The suggestions target the page's focus keyword, so set it first: run\n * keyword research, set the chosen keyword as the page's focus keyword,\n * then trigger. Returns a `predictionId` to poll Get Page Optimization\n * Results with.\n *\n * Triggering is idempotent per page: while a generation for the page is in\n * progress, calling again returns the same `predictionId` instead of\n * starting a new job, unless the page's focus keyword changed since the\n * job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.\n * @param pageId - ID of the site page to optimize.\n * @public\n * @documentationMaturity preview\n * @requiredField options\n * @requiredField options.pagePath\n * @requiredField pageId\n * @permissionId seo:suggestions:v1:page_optimization:trigger_page_optimization\n * @applicableIdentity APP\n * @fqn wix.seo.suggestions.v1.PageOptimizationService.TriggerPageOptimization\n */\nexport async function triggerPageOptimization(\n pageId: string,\n options: NonNullablePaths<TriggerPageOptimizationOptions, `pagePath`, 2>\n): Promise<\n NonNullablePaths<TriggerPageOptimizationResponse, `predictionId`, 2> & {\n __applicationErrorsType?: TriggerPageOptimizationApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n pageId: pageId,\n pagePath: options?.pagePath,\n });\n\n const reqOpts =\n ambassadorWixSeoSuggestionsV1PageOptimization.triggerPageOptimization(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { pageId: '$[0]', pagePath: '$[1].pagePath' },\n singleArgumentUnchanged: false,\n },\n ['pageId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface TriggerPageOptimizationOptions {\n /**\n * URL path of the page, relative to the site's domain. For example,\n * `/about`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\n/**\n * Starts generating optimization suggestions for the site's homepage.\n *\n * The homepage gets its own method because its suggestions are generated\n * with homepage-specific guidance, representing the whole site, not one\n * topic. Same contract as Trigger Page Optimization: the homepage's focus\n * keyword must be set first, the call returns a `predictionId` to poll,\n * and triggering is idempotent per page while a job is in progress.\n * @param pageId - ID of the site's homepage.\n * @public\n * @documentationMaturity preview\n * @requiredField options\n * @requiredField options.pagePath\n * @requiredField pageId\n * @permissionId seo:suggestions:v1:page_optimization:trigger_home_page_optimization\n * @applicableIdentity APP\n * @fqn wix.seo.suggestions.v1.PageOptimizationService.TriggerHomePageOptimization\n */\nexport async function triggerHomePageOptimization(\n pageId: string,\n options: NonNullablePaths<TriggerHomePageOptimizationOptions, `pagePath`, 2>\n): Promise<\n NonNullablePaths<TriggerHomePageOptimizationResponse, `predictionId`, 2> & {\n __applicationErrorsType?: TriggerHomePageOptimizationApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n pageId: pageId,\n pagePath: options?.pagePath,\n });\n\n const reqOpts =\n ambassadorWixSeoSuggestionsV1PageOptimization.triggerHomePageOptimization(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { pageId: '$[0]', pagePath: '$[1].pagePath' },\n singleArgumentUnchanged: false,\n },\n ['pageId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface TriggerHomePageOptimizationOptions {\n /**\n * URL path of the homepage. Usually `/`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\n/**\n * Retrieves the optimization suggestions generated for a page.\n *\n * Poll this method after a trigger call. The response's `status` reports\n * where the job stands: while generation is still in progress the\n * suggestions are empty and `status` is `IN_PROGRESS`; when it completes,\n * the response carries the full suggestion set with `status` `COMPLETED`.\n * A job that failed reports `FAILED`. Trigger again to retry. Suggestions\n * are stored per page, so a later trigger for the same page replaces them,\n * and a replaced job's lookup reports `NOT_FOUND`.\n *\n * Look up by `predictionId` (from the trigger call), or by `pageId`.\n * @public\n * @documentationMaturity preview\n * @permissionId seo:suggestions:v1:page_optimization:get_page_optimization_results\n * @applicableIdentity APP\n * @fqn wix.seo.suggestions.v1.PageOptimizationService.GetPageOptimizationResults\n */\nexport async function getPageOptimizationResults(\n options?: GetPageOptimizationResultsOptions\n): Promise<\n NonNullablePaths<\n GetPageOptimizationResultsResponse,\n `pageOptimization.metaTitle.after` | `pageOptimization.content` | `status`,\n 4\n > & {\n __applicationErrorsType?: GetPageOptimizationResultsApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n predictionId: options?.predictionId,\n pageId: options?.pageId,\n });\n\n const reqOpts =\n ambassadorWixSeoSuggestionsV1PageOptimization.getPageOptimizationResults(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n predictionId: '$[0].predictionId',\n pageId: '$[0].pageId',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetPageOptimizationResultsOptions {\n /**\n * ID of the generation job, from the trigger call.\n * @maxLength 200\n */\n predictionId?: string | null;\n /**\n * ID of the page to retrieve suggestions for. An alternative to\n * `predictionId` that returns the page's latest generation.\n * @maxLength 1000\n */\n pageId?: string | null;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixSeoSuggestionsV1PageOptimizationServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'bo._base_domain_': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'wixbo.ai': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'wix-bo.com': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n _: [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/seo/suggestions/v1',\n destPath: '/v1',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_seo_page-optimization';\n\n/**\n * Starts generating optimization suggestions for a site page.\n *\n * The suggestions target the page's focus keyword, so set it first: run\n * keyword research, set the chosen keyword as the page's focus keyword,\n * then trigger. Returns a `predictionId` to poll Get Page Optimization\n * Results with.\n *\n * Triggering is idempotent per page: while a generation for the page is in\n * progress, calling again returns the same `predictionId` instead of\n * starting a new job, unless the page's focus keyword changed since the\n * job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.\n */\nexport function triggerPageOptimization(\n payload: object\n): RequestOptionsFactory<any> {\n function __triggerPageOptimization({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'POST' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.TriggerPageOptimization',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/trigger',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __triggerPageOptimization;\n}\n\n/**\n * Starts generating optimization suggestions for the site's homepage.\n *\n * The homepage gets its own method because its suggestions are generated\n * with homepage-specific guidance, representing the whole site, not one\n * topic. Same contract as Trigger Page Optimization: the homepage's focus\n * keyword must be set first, the call returns a `predictionId` to poll,\n * and triggering is idempotent per page while a job is in progress.\n */\nexport function triggerHomePageOptimization(\n payload: object\n): RequestOptionsFactory<any> {\n function __triggerHomePageOptimization({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'POST' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.TriggerHomePageOptimization',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/trigger-home',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __triggerHomePageOptimization;\n}\n\n/**\n * Retrieves the optimization suggestions generated for a page.\n *\n * Poll this method after a trigger call. The response's `status` reports\n * where the job stands: while generation is still in progress the\n * suggestions are empty and `status` is `IN_PROGRESS`; when it completes,\n * the response carries the full suggestion set with `status` `COMPLETED`.\n * A job that failed reports `FAILED`. Trigger again to retry. Suggestions\n * are stored per page, so a later trigger for the same page replaces them,\n * and a replaced job's lookup reports `NOT_FOUND`.\n *\n * Look up by `predictionId` (from the trigger call), or by `pageId`.\n */\nexport function getPageOptimizationResults(\n payload: object\n): RequestOptionsFactory<any> {\n function __getPageOptimizationResults({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'GET' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.GetPageOptimizationResults',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/results',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __getPageOptimizationResults;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,oCAAAA;AAAA,EAAA,mCAAAC;AAAA,EAAA,+BAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAAkC;AAClC,IAAAC,uBAA2B;AAI3B,SAAS,qDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,oBAAoB;AAAA,MAClB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,cAAc;AAAA,MACZ;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE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UAAU,SAAS;AAAA,EACrB,CAAC;AAED,QAAM,UAC0C;AAAA,IAC5C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAD;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,QAAQ,QAAQ,UAAU,gBAAgB;AAAA,QACtE,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,UAAU,SAAS;AAAA,IACtB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;AA6BA,eAAsBE,4BACpB,SASA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD,cAAc,SAAS;AAAA,IACvB,QAAQ,SAAS;AAAA,EACnB,CAAC;AAED,QAAM,UAC0C;AAAA,IAC5C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAF;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,cAAc;AAAA,UACd,QAAQ;AAAA,QACV;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["getPageOptimizationResults","triggerHomePageOptimization","triggerPageOptimization","import_rest_modules","OptimizationStatus","triggerPageOptimization","sdkTransformError","triggerHomePageOptimization","getPageOptimizationResults"]}
|
|
1
|
+
{"version":3,"sources":["../../index.typings.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.universal.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.http.ts"],"sourcesContent":["export * from './src/seo-suggestions-v1-page-optimization-page-optimization.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixSeoSuggestionsV1PageOptimization from './seo-suggestions-v1-page-optimization-page-optimization.http.js';\n\n/**\n * A whole-page set of SEO optimization suggestions, generated for one page\n * and focus keyword.\n *\n * Each suggestion is a before/after pair: `before` is the page's current\n * text (empty when the page has none, such as a missing meta description),\n * and `after` is the suggested replacement. Locate the element to change by\n * its `before` text. Suggestions are stored per page, so a later generation\n * for the same page replaces this set.\n */\nexport interface PageOptimization {\n /**\n * ID of this suggestion set.\n * @format GUID\n * @readonly\n */\n _id?: string | null;\n /**\n * Suggested title tag.\n * @readonly\n */\n metaTitle?: TextSuggestion;\n /**\n * Suggested description tag.\n * @readonly\n */\n metaDescription?: TextSuggestion;\n /**\n * Suggested H1 heading.\n * @readonly\n */\n h1?: TextSuggestion;\n /**\n * Suggested subheading, for an H2 or H3 element of the page.\n * @readonly\n */\n h2OrH3?: TextSuggestion;\n /**\n * Suggested rewrites of the page's body text, one per text element.\n * @readonly\n * @maxSize 100\n */\n content?: TextSuggestion[];\n}\n\n/** One suggested text change. */\nexport interface TextSuggestion {\n /**\n * The page's current text. Empty when the page has no text in this slot,\n * for example, a missing meta description.\n * @readonly\n * @maxLength 1000\n */\n before?: string | null;\n /**\n * The suggested text.\n * @readonly\n * @maxLength 1000\n */\n after?: string;\n}\n\nexport interface TriggerPageOptimizationRequest {\n /**\n * ID of the site page to optimize. The page's focus keyword must be set.\n * @maxLength 1000\n * @minLength 1\n */\n pageId: string;\n /**\n * URL path of the page, relative to the site's domain. For example,\n * `/about`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\nexport interface TriggerPageOptimizationResponse {\n /**\n * ID of the generation job. Pass to Get Page Optimization Results.\n * @readonly\n * @maxLength 200\n */\n predictionId?: string;\n}\n\nexport interface TriggerHomePageOptimizationRequest {\n /**\n * ID of the site's homepage.\n * @maxLength 1000\n * @minLength 1\n */\n pageId: string;\n /**\n * URL path of the homepage. Usually `/`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\nexport interface TriggerHomePageOptimizationResponse {\n /**\n * ID of the generation job. Pass to Get Page Optimization Results.\n * @readonly\n * @maxLength 200\n */\n predictionId?: string;\n}\n\nexport interface GetPageOptimizationResultsRequest {\n /**\n * ID of the generation job, from the trigger call. Can be looked up for 2\n * hours after the trigger call.\n * @maxLength 200\n */\n predictionId?: string | null;\n /**\n * ID of the page to retrieve suggestions for. An alternative to\n * `predictionId` that returns the page's latest generation.\n * @maxLength 1000\n */\n pageId?: string | null;\n}\n\nexport interface GetPageOptimizationResultsResponse {\n /** The generated suggestions. Returned only when `status` is `COMPLETED`. */\n pageOptimization?: PageOptimization;\n /**\n * Status of the generation job the lookup matched.\n * @readonly\n */\n status?: OptimizationStatusWithLiterals;\n}\n\n/** Status of a page optimization generation job. */\nexport enum OptimizationStatus {\n /** Unknown status. */\n UNKNOWN_OPTIMIZATION_STATUS = 'UNKNOWN_OPTIMIZATION_STATUS',\n /**\n * No generation job matches the lookup. It never existed, or a later\n * trigger for the same page replaced it.\n */\n NOT_FOUND = 'NOT_FOUND',\n /** Generation is still running. Poll again. */\n IN_PROGRESS = 'IN_PROGRESS',\n /** Generation finished; the response carries the suggestions. */\n COMPLETED = 'COMPLETED',\n /** Generation failed. Trigger again to retry. */\n FAILED = 'FAILED',\n}\n\n/** @enumType */\nexport type OptimizationStatusWithLiterals =\n | OptimizationStatus\n | 'UNKNOWN_OPTIMIZATION_STATUS'\n | 'NOT_FOUND'\n | 'IN_PROGRESS'\n | 'COMPLETED'\n | 'FAILED';\n/** @docsIgnore */\nexport type TriggerPageOptimizationApplicationErrors =\n | {\n code?: 'SITE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FOCUS_KEYWORD_NOT_SET';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTENT_TOO_SHORT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'SUGGESTIONS_ALREADY_IN_PROGRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n/** @docsIgnore */\nexport type TriggerHomePageOptimizationApplicationErrors =\n | {\n code?: 'SITE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FOCUS_KEYWORD_NOT_SET';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTENT_TOO_SHORT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'SUGGESTIONS_ALREADY_IN_PROGRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n/** @docsIgnore */\nexport type GetPageOptimizationResultsApplicationErrors =\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Starts generating optimization suggestions for a site page.\n *\n * The suggestions target the page's focus keyword, so set it first: run\n * keyword research, set the chosen keyword as the page's focus keyword,\n * then trigger. Returns a `predictionId` to poll Get Page Optimization\n * Results with.\n *\n * Triggering is idempotent per page: while a generation for the page is in\n * progress, calling again returns the same `predictionId` instead of\n * starting a new job, unless the page's focus keyword changed since the\n * job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.\n *\n * Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.\n * @param pageId - ID of the site page to optimize. The page's focus keyword must be set.\n * @public\n * @documentationMaturity preview\n * @requiredField options\n * @requiredField options.pagePath\n * @requiredField pageId\n * @permissionId seo:suggestions:v1:page_optimization:trigger_page_optimization\n * @applicableIdentity APP\n * @fqn wix.seo.suggestions.v1.PageOptimizationService.TriggerPageOptimization\n */\nexport async function triggerPageOptimization(\n pageId: string,\n options: NonNullablePaths<TriggerPageOptimizationOptions, `pagePath`, 2>\n): Promise<\n NonNullablePaths<TriggerPageOptimizationResponse, `predictionId`, 2> & {\n __applicationErrorsType?: TriggerPageOptimizationApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n pageId: pageId,\n pagePath: options?.pagePath,\n });\n\n const reqOpts =\n ambassadorWixSeoSuggestionsV1PageOptimization.triggerPageOptimization(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { pageId: '$[0]', pagePath: '$[1].pagePath' },\n singleArgumentUnchanged: false,\n },\n ['pageId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface TriggerPageOptimizationOptions {\n /**\n * URL path of the page, relative to the site's domain. For example,\n * `/about`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\n/**\n * Starts generating optimization suggestions for the site's homepage.\n *\n * The homepage gets its own method because its suggestions are generated\n * with homepage-specific guidance, representing the whole site, not one\n * topic. Same contract as Trigger Page Optimization: the homepage's focus\n * keyword must be set first, the call returns a `predictionId` to poll,\n * and triggering is idempotent per page while a job is in progress.\n *\n * Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.\n * @param pageId - ID of the site's homepage.\n * @public\n * @documentationMaturity preview\n * @requiredField options\n * @requiredField options.pagePath\n * @requiredField pageId\n * @permissionId seo:suggestions:v1:page_optimization:trigger_home_page_optimization\n * @applicableIdentity APP\n * @fqn wix.seo.suggestions.v1.PageOptimizationService.TriggerHomePageOptimization\n */\nexport async function triggerHomePageOptimization(\n pageId: string,\n options: NonNullablePaths<TriggerHomePageOptimizationOptions, `pagePath`, 2>\n): Promise<\n NonNullablePaths<TriggerHomePageOptimizationResponse, `predictionId`, 2> & {\n __applicationErrorsType?: TriggerHomePageOptimizationApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n pageId: pageId,\n pagePath: options?.pagePath,\n });\n\n const reqOpts =\n ambassadorWixSeoSuggestionsV1PageOptimization.triggerHomePageOptimization(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { pageId: '$[0]', pagePath: '$[1].pagePath' },\n singleArgumentUnchanged: false,\n },\n ['pageId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface TriggerHomePageOptimizationOptions {\n /**\n * URL path of the homepage. Usually `/`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\n/**\n * Retrieves the optimization suggestions generated for a page.\n *\n * Poll this method after a trigger call. The response's `status` reports\n * where the job stands: while generation is still in progress the\n * suggestions are empty and `status` is `IN_PROGRESS`; when it completes,\n * the response carries the full suggestion set with `status` `COMPLETED`.\n * A job that failed reports `FAILED`. Trigger again to retry. Suggestions\n * are stored per page, so a later trigger for the same page replaces them,\n * and a replaced job's lookup reports `NOT_FOUND`.\n *\n * Look up by `predictionId` (from the trigger call), or by `pageId`. A\n * `predictionId` can be looked up for 2 hours after the trigger call; after\n * that, look up by `pageId`, which returns the page's latest generation.\n * @public\n * @documentationMaturity preview\n * @permissionId seo:suggestions:v1:page_optimization:get_page_optimization_results\n * @applicableIdentity APP\n * @fqn wix.seo.suggestions.v1.PageOptimizationService.GetPageOptimizationResults\n */\nexport async function getPageOptimizationResults(\n options?: GetPageOptimizationResultsOptions\n): Promise<\n NonNullablePaths<\n GetPageOptimizationResultsResponse,\n `pageOptimization.metaTitle.after` | `pageOptimization.content` | `status`,\n 4\n > & {\n __applicationErrorsType?: GetPageOptimizationResultsApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n predictionId: options?.predictionId,\n pageId: options?.pageId,\n });\n\n const reqOpts =\n ambassadorWixSeoSuggestionsV1PageOptimization.getPageOptimizationResults(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n predictionId: '$[0].predictionId',\n pageId: '$[0].pageId',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetPageOptimizationResultsOptions {\n /**\n * ID of the generation job, from the trigger call. Can be looked up for 2\n * hours after the trigger call.\n * @maxLength 200\n */\n predictionId?: string | null;\n /**\n * ID of the page to retrieve suggestions for. An alternative to\n * `predictionId` that returns the page's latest generation.\n * @maxLength 1000\n */\n pageId?: string | null;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixSeoSuggestionsV1PageOptimizationServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'bo._base_domain_': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'wixbo.ai': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'wix-bo.com': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n _: [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/seo/suggestions/v1',\n destPath: '/v1',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_seo_page-optimization';\n\n/**\n * Starts generating optimization suggestions for a site page.\n *\n * The suggestions target the page's focus keyword, so set it first: run\n * keyword research, set the chosen keyword as the page's focus keyword,\n * then trigger. Returns a `predictionId` to poll Get Page Optimization\n * Results with.\n *\n * Triggering is idempotent per page: while a generation for the page is in\n * progress, calling again returns the same `predictionId` instead of\n * starting a new job, unless the page's focus keyword changed since the\n * job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.\n *\n * Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.\n */\nexport function triggerPageOptimization(\n payload: object\n): RequestOptionsFactory<any> {\n function __triggerPageOptimization({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'POST' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.TriggerPageOptimization',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/trigger',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __triggerPageOptimization;\n}\n\n/**\n * Starts generating optimization suggestions for the site's homepage.\n *\n * The homepage gets its own method because its suggestions are generated\n * with homepage-specific guidance, representing the whole site, not one\n * topic. Same contract as Trigger Page Optimization: the homepage's focus\n * keyword must be set first, the call returns a `predictionId` to poll,\n * and triggering is idempotent per page while a job is in progress.\n *\n * Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.\n */\nexport function triggerHomePageOptimization(\n payload: object\n): RequestOptionsFactory<any> {\n function __triggerHomePageOptimization({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'POST' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.TriggerHomePageOptimization',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/trigger-home',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __triggerHomePageOptimization;\n}\n\n/**\n * Retrieves the optimization suggestions generated for a page.\n *\n * Poll this method after a trigger call. The response's `status` reports\n * where the job stands: while generation is still in progress the\n * suggestions are empty and `status` is `IN_PROGRESS`; when it completes,\n * the response carries the full suggestion set with `status` `COMPLETED`.\n * A job that failed reports `FAILED`. Trigger again to retry. Suggestions\n * are stored per page, so a later trigger for the same page replaces them,\n * and a replaced job's lookup reports `NOT_FOUND`.\n *\n * Look up by `predictionId` (from the trigger call), or by `pageId`. A\n * `predictionId` can be looked up for 2 hours after the trigger call; after\n * that, look up by `pageId`, which returns the page's latest generation.\n */\nexport function getPageOptimizationResults(\n payload: object\n): RequestOptionsFactory<any> {\n function __getPageOptimizationResults({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'GET' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.GetPageOptimizationResults',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/results',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __getPageOptimizationResults;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,oCAAAA;AAAA,EAAA,mCAAAC;AAAA,EAAA,+BAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAAkC;AAClC,IAAAC,uBAA2B;AAI3B,SAAS,qDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,oBAAoB;AAAA,MAClB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,cAAc;AAAA,MACZ;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAA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ACV;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["getPageOptimizationResults","triggerHomePageOptimization","triggerPageOptimization","import_rest_modules","OptimizationStatus","triggerPageOptimization","sdkTransformError","triggerHomePageOptimization","getPageOptimizationResults"]}
|
package/build/cjs/meta.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ import '@wix/sdk-types';
|
|
|
8
8
|
* Each suggestion is a before/after pair: `before` is the page's current
|
|
9
9
|
* text (empty when the page has none, such as a missing meta description),
|
|
10
10
|
* and `after` is the suggested replacement. Locate the element to change by
|
|
11
|
-
* its `before` text.
|
|
11
|
+
* its `before` text. Suggestions are stored per page, so a later generation
|
|
12
|
+
* for the same page replaces this set.
|
|
12
13
|
*/
|
|
13
14
|
interface PageOptimization {
|
|
14
15
|
/**
|
|
@@ -33,12 +34,12 @@ interface PageOptimization {
|
|
|
33
34
|
*/
|
|
34
35
|
h1?: TextSuggestion;
|
|
35
36
|
/**
|
|
36
|
-
* Suggested H2 or H3
|
|
37
|
+
* Suggested subheading, for an H2 or H3 element of the page.
|
|
37
38
|
* @readonly
|
|
38
39
|
*/
|
|
39
40
|
h2OrH3?: TextSuggestion;
|
|
40
41
|
/**
|
|
41
|
-
* Suggested body text
|
|
42
|
+
* Suggested rewrites of the page's body text, one per text element.
|
|
42
43
|
* @readonly
|
|
43
44
|
* @maxSize 100
|
|
44
45
|
*/
|
|
@@ -62,7 +63,7 @@ interface TextSuggestion {
|
|
|
62
63
|
}
|
|
63
64
|
interface TriggerPageOptimizationRequest {
|
|
64
65
|
/**
|
|
65
|
-
* ID of the site page to optimize.
|
|
66
|
+
* ID of the site page to optimize. The page's focus keyword must be set.
|
|
66
67
|
* @maxLength 1000
|
|
67
68
|
* @minLength 1
|
|
68
69
|
*/
|
|
@@ -107,7 +108,8 @@ interface TriggerHomePageOptimizationResponse {
|
|
|
107
108
|
}
|
|
108
109
|
interface GetPageOptimizationResultsRequest {
|
|
109
110
|
/**
|
|
110
|
-
* ID of the generation job, from the trigger call.
|
|
111
|
+
* ID of the generation job, from the trigger call. Can be looked up for 2
|
|
112
|
+
* hours after the trigger call.
|
|
111
113
|
* @maxLength 200
|
|
112
114
|
*/
|
|
113
115
|
predictionId?: string | null;
|
|
@@ -129,6 +131,7 @@ interface GetPageOptimizationResultsResponse {
|
|
|
129
131
|
}
|
|
130
132
|
/** Status of a page optimization generation job. */
|
|
131
133
|
declare enum OptimizationStatus {
|
|
134
|
+
/** Unknown status. */
|
|
132
135
|
UNKNOWN_OPTIMIZATION_STATUS = "UNKNOWN_OPTIMIZATION_STATUS",
|
|
133
136
|
/**
|
|
134
137
|
* No generation job matches the lookup. It never existed, or a later
|
package/build/cjs/meta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../meta.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.http.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.types.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.meta.ts"],"sourcesContent":["export * from './src/seo-suggestions-v1-page-optimization-page-optimization.meta.js';\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixSeoSuggestionsV1PageOptimizationServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'bo._base_domain_': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'wixbo.ai': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'wix-bo.com': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n _: [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/seo/suggestions/v1',\n destPath: '/v1',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_seo_page-optimization';\n\n/**\n * Starts generating optimization suggestions for a site page.\n *\n * The suggestions target the page's focus keyword, so set it first: run\n * keyword research, set the chosen keyword as the page's focus keyword,\n * then trigger. Returns a `predictionId` to poll Get Page Optimization\n * Results with.\n *\n * Triggering is idempotent per page: while a generation for the page is in\n * progress, calling again returns the same `predictionId` instead of\n * starting a new job, unless the page's focus keyword changed since the\n * job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.\n */\nexport function triggerPageOptimization(\n payload: object\n): RequestOptionsFactory<any> {\n function __triggerPageOptimization({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'POST' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.TriggerPageOptimization',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/trigger',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __triggerPageOptimization;\n}\n\n/**\n * Starts generating optimization suggestions for the site's homepage.\n *\n * The homepage gets its own method because its suggestions are generated\n * with homepage-specific guidance, representing the whole site, not one\n * topic. Same contract as Trigger Page Optimization: the homepage's focus\n * keyword must be set first, the call returns a `predictionId` to poll,\n * and triggering is idempotent per page while a job is in progress.\n */\nexport function triggerHomePageOptimization(\n payload: object\n): RequestOptionsFactory<any> {\n function __triggerHomePageOptimization({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'POST' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.TriggerHomePageOptimization',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/trigger-home',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __triggerHomePageOptimization;\n}\n\n/**\n * Retrieves the optimization suggestions generated for a page.\n *\n * Poll this method after a trigger call. The response's `status` reports\n * where the job stands: while generation is still in progress the\n * suggestions are empty and `status` is `IN_PROGRESS`; when it completes,\n * the response carries the full suggestion set with `status` `COMPLETED`.\n * A job that failed reports `FAILED`. Trigger again to retry. Suggestions\n * are stored per page, so a later trigger for the same page replaces them,\n * and a replaced job's lookup reports `NOT_FOUND`.\n *\n * Look up by `predictionId` (from the trigger call), or by `pageId`.\n */\nexport function getPageOptimizationResults(\n payload: object\n): RequestOptionsFactory<any> {\n function __getPageOptimizationResults({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'GET' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.GetPageOptimizationResults',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/results',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __getPageOptimizationResults;\n}\n","/**\n * A whole-page set of SEO optimization suggestions, generated for one page\n * and focus keyword.\n *\n * Each suggestion is a before/after pair: `before` is the page's current\n * text (empty when the page has none, such as a missing meta description),\n * and `after` is the suggested replacement. Locate the element to change by\n * its `before` text.\n */\nexport interface PageOptimization {\n /**\n * ID of this suggestion set.\n * @format GUID\n * @readonly\n */\n id?: string | null;\n /**\n * Suggested title tag.\n * @readonly\n */\n metaTitle?: TextSuggestion;\n /**\n * Suggested description tag.\n * @readonly\n */\n metaDescription?: TextSuggestion;\n /**\n * Suggested H1 heading.\n * @readonly\n */\n h1?: TextSuggestion;\n /**\n * Suggested H2 or H3 heading.\n * @readonly\n */\n h2OrH3?: TextSuggestion;\n /**\n * Suggested body text rewrites.\n * @readonly\n * @maxSize 100\n */\n content?: TextSuggestion[];\n}\n\n/** One suggested text change. */\nexport interface TextSuggestion {\n /**\n * The page's current text. Empty when the page has no text in this slot,\n * for example, a missing meta description.\n * @readonly\n * @maxLength 1000\n */\n before?: string | null;\n /**\n * The suggested text.\n * @readonly\n * @maxLength 1000\n */\n after?: string;\n}\n\nexport interface TriggerPageOptimizationRequest {\n /**\n * ID of the site page to optimize.\n * @maxLength 1000\n * @minLength 1\n */\n pageId: string;\n /**\n * URL path of the page, relative to the site's domain. For example,\n * `/about`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\nexport interface TriggerPageOptimizationResponse {\n /**\n * ID of the generation job. Pass to Get Page Optimization Results.\n * @readonly\n * @maxLength 200\n */\n predictionId?: string;\n}\n\nexport interface TriggerHomePageOptimizationRequest {\n /**\n * ID of the site's homepage.\n * @maxLength 1000\n * @minLength 1\n */\n pageId: string;\n /**\n * URL path of the homepage. Usually `/`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\nexport interface TriggerHomePageOptimizationResponse {\n /**\n * ID of the generation job. Pass to Get Page Optimization Results.\n * @readonly\n * @maxLength 200\n */\n predictionId?: string;\n}\n\nexport interface GetPageOptimizationResultsRequest {\n /**\n * ID of the generation job, from the trigger call.\n * @maxLength 200\n */\n predictionId?: string | null;\n /**\n * ID of the page to retrieve suggestions for. An alternative to\n * `predictionId` that returns the page's latest generation.\n * @maxLength 1000\n */\n pageId?: string | null;\n}\n\nexport interface GetPageOptimizationResultsResponse {\n /** The generated suggestions. Returned only when `status` is `COMPLETED`. */\n pageOptimization?: PageOptimization;\n /**\n * Status of the generation job the lookup matched.\n * @readonly\n */\n status?: OptimizationStatusWithLiterals;\n}\n\n/** Status of a page optimization generation job. */\nexport enum OptimizationStatus {\n UNKNOWN_OPTIMIZATION_STATUS = 'UNKNOWN_OPTIMIZATION_STATUS',\n /**\n * No generation job matches the lookup. It never existed, or a later\n * trigger for the same page replaced it.\n */\n NOT_FOUND = 'NOT_FOUND',\n /** Generation is still running. Poll again. */\n IN_PROGRESS = 'IN_PROGRESS',\n /** Generation finished; the response carries the suggestions. */\n COMPLETED = 'COMPLETED',\n /** Generation failed. Trigger again to retry. */\n FAILED = 'FAILED',\n}\n\n/** @enumType */\nexport type OptimizationStatusWithLiterals =\n | OptimizationStatus\n | 'UNKNOWN_OPTIMIZATION_STATUS'\n | 'NOT_FOUND'\n | 'IN_PROGRESS'\n | 'COMPLETED'\n | 'FAILED';\n/** @docsIgnore */\nexport type TriggerPageOptimizationApplicationErrors =\n | {\n code?: 'SITE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FOCUS_KEYWORD_NOT_SET';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTENT_TOO_SHORT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'SUGGESTIONS_ALREADY_IN_PROGRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n/** @docsIgnore */\nexport type TriggerHomePageOptimizationApplicationErrors =\n | {\n code?: 'SITE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FOCUS_KEYWORD_NOT_SET';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTENT_TOO_SHORT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'SUGGESTIONS_ALREADY_IN_PROGRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n/** @docsIgnore */\nexport type GetPageOptimizationResultsApplicationErrors =\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n","import * as ambassadorWixSeoSuggestionsV1PageOptimization from './seo-suggestions-v1-page-optimization-page-optimization.http.js';\nimport * as ambassadorWixSeoSuggestionsV1PageOptimizationTypes from './seo-suggestions-v1-page-optimization-page-optimization.types.js';\nimport * as ambassadorWixSeoSuggestionsV1PageOptimizationUniversalTypes from './seo-suggestions-v1-page-optimization-page-optimization.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function triggerPageOptimization(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSeoSuggestionsV1PageOptimizationUniversalTypes.TriggerPageOptimizationRequest,\n ambassadorWixSeoSuggestionsV1PageOptimizationTypes.TriggerPageOptimizationRequest,\n ambassadorWixSeoSuggestionsV1PageOptimizationUniversalTypes.TriggerPageOptimizationResponse,\n ambassadorWixSeoSuggestionsV1PageOptimizationTypes.TriggerPageOptimizationResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSeoSuggestionsV1PageOptimization.triggerPageOptimization(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/page-optimization/trigger',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport function triggerHomePageOptimization(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSeoSuggestionsV1PageOptimizationUniversalTypes.TriggerHomePageOptimizationRequest,\n ambassadorWixSeoSuggestionsV1PageOptimizationTypes.TriggerHomePageOptimizationRequest,\n ambassadorWixSeoSuggestionsV1PageOptimizationUniversalTypes.TriggerHomePageOptimizationResponse,\n ambassadorWixSeoSuggestionsV1PageOptimizationTypes.TriggerHomePageOptimizationResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSeoSuggestionsV1PageOptimization.triggerHomePageOptimization(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/page-optimization/trigger-home',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport function getPageOptimizationResults(): __PublicMethodMetaInfo<\n 'GET',\n {},\n ambassadorWixSeoSuggestionsV1PageOptimizationUniversalTypes.GetPageOptimizationResultsRequest,\n ambassadorWixSeoSuggestionsV1PageOptimizationTypes.GetPageOptimizationResultsRequest,\n ambassadorWixSeoSuggestionsV1PageOptimizationUniversalTypes.GetPageOptimizationResultsResponse,\n ambassadorWixSeoSuggestionsV1PageOptimizationTypes.GetPageOptimizationResultsResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSeoSuggestionsV1PageOptimization.getPageOptimizationResults(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'GET',\n path: '/v1/page-optimization/results',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n PageOptimization as PageOptimizationOriginal,\n TextSuggestion as TextSuggestionOriginal,\n TriggerPageOptimizationRequest as TriggerPageOptimizationRequestOriginal,\n TriggerPageOptimizationResponse as TriggerPageOptimizationResponseOriginal,\n TriggerHomePageOptimizationRequest as TriggerHomePageOptimizationRequestOriginal,\n TriggerHomePageOptimizationResponse as TriggerHomePageOptimizationResponseOriginal,\n GetPageOptimizationResultsRequest as GetPageOptimizationResultsRequestOriginal,\n GetPageOptimizationResultsResponse as GetPageOptimizationResultsResponseOriginal,\n OptimizationStatus as OptimizationStatusOriginal,\n OptimizationStatusWithLiterals as OptimizationStatusWithLiteralsOriginal,\n TriggerPageOptimizationApplicationErrors as TriggerPageOptimizationApplicationErrorsOriginal,\n TriggerHomePageOptimizationApplicationErrors as TriggerHomePageOptimizationApplicationErrorsOriginal,\n GetPageOptimizationResultsApplicationErrors as GetPageOptimizationResultsApplicationErrorsOriginal,\n} from './seo-suggestions-v1-page-optimization-page-optimization.types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,oCAAAA;AAAA,EAAA,mCAAAC;AAAA,EAAA,+BAAAC;AAAA;AAAA;;;ACAA,0BAAkC;AAClC,IAAAC,uBAA2B;AAI3B,SAAS,qDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,oBAAoB;AAAA,MAClB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,cAAc;AAAA,MACZ;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA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AAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;AAEO,SAASC,8BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC0C;AAAA,IAC5C;AAAA,EACF;AAEF,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["getPageOptimizationResults","triggerHomePageOptimization","triggerPageOptimization","import_rest_modules","OptimizationStatus","triggerPageOptimization","triggerHomePageOptimization","getPageOptimizationResults"]}
|
|
1
|
+
{"version":3,"sources":["../../meta.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.http.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.types.ts","../../src/seo-suggestions-v1-page-optimization-page-optimization.meta.ts"],"sourcesContent":["export * from './src/seo-suggestions-v1-page-optimization-page-optimization.meta.js';\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixSeoSuggestionsV1PageOptimizationServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'bo._base_domain_': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'wixbo.ai': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'wix-bo.com': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_serverless/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n _: [\n {\n srcPath: '/_api/seo-tags-suggestions-service',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/seo/suggestions/v1',\n destPath: '/v1',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_seo_page-optimization';\n\n/**\n * Starts generating optimization suggestions for a site page.\n *\n * The suggestions target the page's focus keyword, so set it first: run\n * keyword research, set the chosen keyword as the page's focus keyword,\n * then trigger. Returns a `predictionId` to poll Get Page Optimization\n * Results with.\n *\n * Triggering is idempotent per page: while a generation for the page is in\n * progress, calling again returns the same `predictionId` instead of\n * starting a new job, unless the page's focus keyword changed since the\n * job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.\n *\n * Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.\n */\nexport function triggerPageOptimization(\n payload: object\n): RequestOptionsFactory<any> {\n function __triggerPageOptimization({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'POST' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.TriggerPageOptimization',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/trigger',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __triggerPageOptimization;\n}\n\n/**\n * Starts generating optimization suggestions for the site's homepage.\n *\n * The homepage gets its own method because its suggestions are generated\n * with homepage-specific guidance, representing the whole site, not one\n * topic. Same contract as Trigger Page Optimization: the homepage's focus\n * keyword must be set first, the call returns a `predictionId` to poll,\n * and triggering is idempotent per page while a job is in progress.\n *\n * Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.\n */\nexport function triggerHomePageOptimization(\n payload: object\n): RequestOptionsFactory<any> {\n function __triggerHomePageOptimization({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'POST' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.TriggerHomePageOptimization',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/trigger-home',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __triggerHomePageOptimization;\n}\n\n/**\n * Retrieves the optimization suggestions generated for a page.\n *\n * Poll this method after a trigger call. The response's `status` reports\n * where the job stands: while generation is still in progress the\n * suggestions are empty and `status` is `IN_PROGRESS`; when it completes,\n * the response carries the full suggestion set with `status` `COMPLETED`.\n * A job that failed reports `FAILED`. Trigger again to retry. Suggestions\n * are stored per page, so a later trigger for the same page replaces them,\n * and a replaced job's lookup reports `NOT_FOUND`.\n *\n * Look up by `predictionId` (from the trigger call), or by `pageId`. A\n * `predictionId` can be looked up for 2 hours after the trigger call; after\n * that, look up by `pageId`, which returns the page's latest generation.\n */\nexport function getPageOptimizationResults(\n payload: object\n): RequestOptionsFactory<any> {\n function __getPageOptimizationResults({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.seo.suggestions.v1.page_optimization',\n method: 'GET' as any,\n methodFqn:\n 'wix.seo.suggestions.v1.PageOptimizationService.GetPageOptimizationResults',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixSeoSuggestionsV1PageOptimizationServiceUrl({\n protoPath: '/v1/page-optimization/results',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __getPageOptimizationResults;\n}\n","/**\n * A whole-page set of SEO optimization suggestions, generated for one page\n * and focus keyword.\n *\n * Each suggestion is a before/after pair: `before` is the page's current\n * text (empty when the page has none, such as a missing meta description),\n * and `after` is the suggested replacement. Locate the element to change by\n * its `before` text. Suggestions are stored per page, so a later generation\n * for the same page replaces this set.\n */\nexport interface PageOptimization {\n /**\n * ID of this suggestion set.\n * @format GUID\n * @readonly\n */\n id?: string | null;\n /**\n * Suggested title tag.\n * @readonly\n */\n metaTitle?: TextSuggestion;\n /**\n * Suggested description tag.\n * @readonly\n */\n metaDescription?: TextSuggestion;\n /**\n * Suggested H1 heading.\n * @readonly\n */\n h1?: TextSuggestion;\n /**\n * Suggested subheading, for an H2 or H3 element of the page.\n * @readonly\n */\n h2OrH3?: TextSuggestion;\n /**\n * Suggested rewrites of the page's body text, one per text element.\n * @readonly\n * @maxSize 100\n */\n content?: TextSuggestion[];\n}\n\n/** One suggested text change. */\nexport interface TextSuggestion {\n /**\n * The page's current text. Empty when the page has no text in this slot,\n * for example, a missing meta description.\n * @readonly\n * @maxLength 1000\n */\n before?: string | null;\n /**\n * The suggested text.\n * @readonly\n * @maxLength 1000\n */\n after?: string;\n}\n\nexport interface TriggerPageOptimizationRequest {\n /**\n * ID of the site page to optimize. The page's focus keyword must be set.\n * @maxLength 1000\n * @minLength 1\n */\n pageId: string;\n /**\n * URL path of the page, relative to the site's domain. For example,\n * `/about`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\nexport interface TriggerPageOptimizationResponse {\n /**\n * ID of the generation job. Pass to Get Page Optimization Results.\n * @readonly\n * @maxLength 200\n */\n predictionId?: string;\n}\n\nexport interface TriggerHomePageOptimizationRequest {\n /**\n * ID of the site's homepage.\n * @maxLength 1000\n * @minLength 1\n */\n pageId: string;\n /**\n * URL path of the homepage. Usually `/`.\n * @maxLength 1000\n * @minLength 1\n */\n pagePath: string;\n}\n\nexport interface TriggerHomePageOptimizationResponse {\n /**\n * ID of the generation job. Pass to Get Page Optimization Results.\n * @readonly\n * @maxLength 200\n */\n predictionId?: string;\n}\n\nexport interface GetPageOptimizationResultsRequest {\n /**\n * ID of the generation job, from the trigger call. Can be looked up for 2\n * hours after the trigger call.\n * @maxLength 200\n */\n predictionId?: string | null;\n /**\n * ID of the page to retrieve suggestions for. An alternative to\n * `predictionId` that returns the page's latest generation.\n * @maxLength 1000\n */\n pageId?: string | null;\n}\n\nexport interface GetPageOptimizationResultsResponse {\n /** The generated suggestions. Returned only when `status` is `COMPLETED`. */\n pageOptimization?: PageOptimization;\n /**\n * Status of the generation job the lookup matched.\n * @readonly\n */\n status?: OptimizationStatusWithLiterals;\n}\n\n/** Status of a page optimization generation job. */\nexport enum OptimizationStatus {\n /** Unknown status. */\n UNKNOWN_OPTIMIZATION_STATUS = 'UNKNOWN_OPTIMIZATION_STATUS',\n /**\n * No generation job matches the lookup. It never existed, or a later\n * trigger for the same page replaced it.\n */\n NOT_FOUND = 'NOT_FOUND',\n /** Generation is still running. Poll again. */\n IN_PROGRESS = 'IN_PROGRESS',\n /** Generation finished; the response carries the suggestions. */\n COMPLETED = 'COMPLETED',\n /** Generation failed. Trigger again to retry. */\n FAILED = 'FAILED',\n}\n\n/** @enumType */\nexport type OptimizationStatusWithLiterals =\n | OptimizationStatus\n | 'UNKNOWN_OPTIMIZATION_STATUS'\n | 'NOT_FOUND'\n | 'IN_PROGRESS'\n | 'COMPLETED'\n | 'FAILED';\n/** @docsIgnore */\nexport type TriggerPageOptimizationApplicationErrors =\n | {\n code?: 'SITE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FOCUS_KEYWORD_NOT_SET';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTENT_TOO_SHORT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'SUGGESTIONS_ALREADY_IN_PROGRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n/** @docsIgnore */\nexport type TriggerHomePageOptimizationApplicationErrors =\n | {\n code?: 'SITE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FOCUS_KEYWORD_NOT_SET';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTENT_TOO_SHORT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'SUGGESTIONS_ALREADY_IN_PROGRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n/** @docsIgnore */\nexport type GetPageOptimizationResultsApplicationErrors =\n | {\n code?: 'GENERATION_FAILED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'QUOTA_LIMIT_REACHED';\n description?: string;\n data?: Record<string, any>;\n };\n","import * as ambassadorWixSeoSuggestionsV1PageOptimization from './seo-suggestions-v1-page-optimization-page-optimization.http.js';\nimport * as ambassadorWixSeoSuggestionsV1PageOptimizationTypes from './seo-suggestions-v1-page-optimization-page-optimization.types.js';\nimport * as ambassadorWixSeoSuggestionsV1PageOptimizationUniversalTypes from './seo-suggestions-v1-page-optimization-page-optimization.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function triggerPageOptimization(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSeoSuggestionsV1PageOptimizationUniversalTypes.TriggerPageOptimizationRequest,\n ambassadorWixSeoSuggestionsV1PageOptimizationTypes.TriggerPageOptimizationRequest,\n ambassadorWixSeoSuggestionsV1PageOptimizationUniversalTypes.TriggerPageOptimizationResponse,\n ambassadorWixSeoSuggestionsV1PageOptimizationTypes.TriggerPageOptimizationResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSeoSuggestionsV1PageOptimization.triggerPageOptimization(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/page-optimization/trigger',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport function triggerHomePageOptimization(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSeoSuggestionsV1PageOptimizationUniversalTypes.TriggerHomePageOptimizationRequest,\n ambassadorWixSeoSuggestionsV1PageOptimizationTypes.TriggerHomePageOptimizationRequest,\n ambassadorWixSeoSuggestionsV1PageOptimizationUniversalTypes.TriggerHomePageOptimizationResponse,\n ambassadorWixSeoSuggestionsV1PageOptimizationTypes.TriggerHomePageOptimizationResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSeoSuggestionsV1PageOptimization.triggerHomePageOptimization(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/page-optimization/trigger-home',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport function getPageOptimizationResults(): __PublicMethodMetaInfo<\n 'GET',\n {},\n ambassadorWixSeoSuggestionsV1PageOptimizationUniversalTypes.GetPageOptimizationResultsRequest,\n ambassadorWixSeoSuggestionsV1PageOptimizationTypes.GetPageOptimizationResultsRequest,\n ambassadorWixSeoSuggestionsV1PageOptimizationUniversalTypes.GetPageOptimizationResultsResponse,\n ambassadorWixSeoSuggestionsV1PageOptimizationTypes.GetPageOptimizationResultsResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSeoSuggestionsV1PageOptimization.getPageOptimizationResults(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'GET',\n path: '/v1/page-optimization/results',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n PageOptimization as PageOptimizationOriginal,\n TextSuggestion as TextSuggestionOriginal,\n TriggerPageOptimizationRequest as TriggerPageOptimizationRequestOriginal,\n TriggerPageOptimizationResponse as TriggerPageOptimizationResponseOriginal,\n TriggerHomePageOptimizationRequest as TriggerHomePageOptimizationRequestOriginal,\n TriggerHomePageOptimizationResponse as TriggerHomePageOptimizationResponseOriginal,\n GetPageOptimizationResultsRequest as GetPageOptimizationResultsRequestOriginal,\n GetPageOptimizationResultsResponse as GetPageOptimizationResultsResponseOriginal,\n OptimizationStatus as OptimizationStatusOriginal,\n OptimizationStatusWithLiterals as OptimizationStatusWithLiteralsOriginal,\n TriggerPageOptimizationApplicationErrors as TriggerPageOptimizationApplicationErrorsOriginal,\n TriggerHomePageOptimizationApplicationErrors as TriggerHomePageOptimizationApplicationErrorsOriginal,\n GetPageOptimizationResultsApplicationErrors as GetPageOptimizationResultsApplicationErrorsOriginal,\n} from './seo-suggestions-v1-page-optimization-page-optimization.types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,oCAAAA;AAAA,EAAA,mCAAAC;AAAA,EAAA,+BAAAC;AAAA;AAAA;;;ACAA,0BAAkC;AAClC,IAAAC,uBAA2B;AAI3B,SAAS,qDACP,MACA;AAC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AAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;AAEO,SAASC,+BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC0C;AAAA,IAC5C;AAAA,EACF;AAEF,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;AAEO,SAASC,8BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC0C;AAAA,IAC5C;AAAA,EACF;AAEF,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["getPageOptimizationResults","triggerHomePageOptimization","triggerPageOptimization","import_rest_modules","OptimizationStatus","triggerPageOptimization","triggerHomePageOptimization","getPageOptimizationResults"]}
|
package/build/es/index.d.mts
CHANGED
|
@@ -16,7 +16,9 @@ interface TriggerPageOptimizationSignature {
|
|
|
16
16
|
* progress, calling again returns the same `predictionId` instead of
|
|
17
17
|
* starting a new job, unless the page's focus keyword changed since the
|
|
18
18
|
* job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.
|
|
19
|
-
*
|
|
19
|
+
*
|
|
20
|
+
* Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.
|
|
21
|
+
* @param - ID of the site page to optimize. The page's focus keyword must be set.
|
|
20
22
|
*/
|
|
21
23
|
(pageId: string, options: NonNullablePaths<TriggerPageOptimizationOptions, `pagePath`, 2>): Promise<NonNullablePaths<TriggerPageOptimizationResponse, `predictionId`, 2> & {
|
|
22
24
|
__applicationErrorsType?: TriggerPageOptimizationApplicationErrors;
|
|
@@ -32,6 +34,8 @@ interface TriggerHomePageOptimizationSignature {
|
|
|
32
34
|
* topic. Same contract as Trigger Page Optimization: the homepage's focus
|
|
33
35
|
* keyword must be set first, the call returns a `predictionId` to poll,
|
|
34
36
|
* and triggering is idempotent per page while a job is in progress.
|
|
37
|
+
*
|
|
38
|
+
* Must be called with a [Wix user identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities). Calls made with an API key fail.
|
|
35
39
|
* @param - ID of the site's homepage.
|
|
36
40
|
*/
|
|
37
41
|
(pageId: string, options: NonNullablePaths<TriggerHomePageOptimizationOptions, `pagePath`, 2>): Promise<NonNullablePaths<TriggerHomePageOptimizationResponse, `predictionId`, 2> & {
|
|
@@ -51,7 +55,9 @@ interface GetPageOptimizationResultsSignature {
|
|
|
51
55
|
* are stored per page, so a later trigger for the same page replaces them,
|
|
52
56
|
* and a replaced job's lookup reports `NOT_FOUND`.
|
|
53
57
|
*
|
|
54
|
-
* Look up by `predictionId` (from the trigger call), or by `pageId`.
|
|
58
|
+
* Look up by `predictionId` (from the trigger call), or by `pageId`. A
|
|
59
|
+
* `predictionId` can be looked up for 2 hours after the trigger call; after
|
|
60
|
+
* that, look up by `pageId`, which returns the page's latest generation.
|
|
55
61
|
*/
|
|
56
62
|
(options?: GetPageOptimizationResultsOptions): Promise<NonNullablePaths<GetPageOptimizationResultsResponse, `pageOptimization.metaTitle.after` | `pageOptimization.content` | `status`, 4> & {
|
|
57
63
|
__applicationErrorsType?: GetPageOptimizationResultsApplicationErrors;
|