@wix/auto_sdk_seo_page-optimization 1.0.4 → 1.0.6

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.
@@ -1,5 +1,5 @@
1
1
  import { HttpClient, NonNullablePaths, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
2
- import { TriggerPageOptimizationOptions, TriggerPageOptimizationResponse, TriggerPageOptimizationApplicationErrors, TriggerHomePageOptimizationOptions, TriggerHomePageOptimizationResponse, TriggerHomePageOptimizationApplicationErrors, GetPageOptimizationResultsOptions, GetPageOptimizationResultsResponse, GetPageOptimizationResultsApplicationErrors } from './index.typings.js';
2
+ import { TriggerPageOptimizationOptions, TriggerPageOptimizationResponse, TriggerPageOptimizationApplicationErrors, TriggerHomePageOptimizationResponse, TriggerHomePageOptimizationApplicationErrors, GetPageOptimizationResultsOptions, GetPageOptimizationResultsResponse, GetPageOptimizationResultsApplicationErrors } from './index.typings.js';
3
3
  export { GetPageOptimizationResultsRequest, OptimizationStatus, OptimizationStatusWithLiterals, PageOptimization, TextSuggestion, TriggerHomePageOptimizationRequest, TriggerPageOptimizationRequest } from './index.typings.js';
4
4
 
5
5
  declare function triggerPageOptimization$1(httpClient: HttpClient): TriggerPageOptimizationSignature;
@@ -16,11 +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
- *
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
19
  * @param - ID of the site page to optimize. The page's focus keyword must be set.
22
20
  */
23
- (pageId: string, options: NonNullablePaths<TriggerPageOptimizationOptions, `pagePath`, 2>): Promise<NonNullablePaths<TriggerPageOptimizationResponse, `predictionId`, 2> & {
21
+ (pageId: string, options: NonNullablePaths<TriggerPageOptimizationOptions, `pagePath`, 0>): Promise<NonNullablePaths<TriggerPageOptimizationResponse, `predictionId`, 0> & {
24
22
  __applicationErrorsType?: TriggerPageOptimizationApplicationErrors;
25
23
  }>;
26
24
  }
@@ -35,10 +33,11 @@ interface TriggerHomePageOptimizationSignature {
35
33
  * keyword must be set first, the call returns a `predictionId` to poll,
36
34
  * and triggering is idempotent per page while a job is in progress.
37
35
  *
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.
39
- * @param - ID of the site's homepage.
36
+ * The method takes no parameters. Wix resolves which page is the site's
37
+ * homepage, so callers don't have to identify it. The response returns the
38
+ * resolved `pageId`, for later lookups with Get Page Optimization Results.
40
39
  */
41
- (pageId: string, options: NonNullablePaths<TriggerHomePageOptimizationOptions, `pagePath`, 2>): Promise<NonNullablePaths<TriggerHomePageOptimizationResponse, `predictionId`, 2> & {
40
+ (): Promise<NonNullablePaths<TriggerHomePageOptimizationResponse, `predictionId` | `pageId`, 0> & {
42
41
  __applicationErrorsType?: TriggerHomePageOptimizationApplicationErrors;
43
42
  }>;
44
43
  }
@@ -59,7 +58,7 @@ interface GetPageOptimizationResultsSignature {
59
58
  * `predictionId` can be looked up for 2 hours after the trigger call; after
60
59
  * that, look up by `pageId`, which returns the page's latest generation.
61
60
  */
62
- (options?: GetPageOptimizationResultsOptions): Promise<NonNullablePaths<GetPageOptimizationResultsResponse, `pageOptimization.metaTitle.after` | `pageOptimization.content` | `status`, 4> & {
61
+ (options?: GetPageOptimizationResultsOptions): Promise<NonNullablePaths<GetPageOptimizationResultsResponse, `pageOptimization.metaTitle.after` | `pageOptimization.content` | `status`, 2> & {
63
62
  __applicationErrorsType?: GetPageOptimizationResultsApplicationErrors;
64
63
  }>;
65
64
  }
@@ -68,4 +67,4 @@ declare const triggerPageOptimization: MaybeContext<BuildRESTFunction<typeof tri
68
67
  declare const triggerHomePageOptimization: MaybeContext<BuildRESTFunction<typeof triggerHomePageOptimization$1> & typeof triggerHomePageOptimization$1>;
69
68
  declare const getPageOptimizationResults: MaybeContext<BuildRESTFunction<typeof getPageOptimizationResults$1> & typeof getPageOptimizationResults$1>;
70
69
 
71
- export { GetPageOptimizationResultsApplicationErrors, GetPageOptimizationResultsOptions, GetPageOptimizationResultsResponse, TriggerHomePageOptimizationApplicationErrors, TriggerHomePageOptimizationOptions, TriggerHomePageOptimizationResponse, TriggerPageOptimizationApplicationErrors, TriggerPageOptimizationOptions, TriggerPageOptimizationResponse, getPageOptimizationResults, triggerHomePageOptimization, triggerPageOptimization };
70
+ export { GetPageOptimizationResultsApplicationErrors, GetPageOptimizationResultsOptions, GetPageOptimizationResultsResponse, TriggerHomePageOptimizationApplicationErrors, TriggerHomePageOptimizationResponse, TriggerPageOptimizationApplicationErrors, TriggerPageOptimizationOptions, TriggerPageOptimizationResponse, getPageOptimizationResults, triggerHomePageOptimization, triggerPageOptimization };
@@ -195,12 +195,9 @@ async function triggerPageOptimization2(pageId, options) {
195
195
  throw transformedError;
196
196
  }
197
197
  }
198
- async function triggerHomePageOptimization2(pageId, options) {
199
- const { httpClient, sideEffects } = arguments[2];
200
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
201
- pageId,
202
- pagePath: options?.pagePath
203
- });
198
+ async function triggerHomePageOptimization2() {
199
+ const { httpClient, sideEffects } = arguments[0];
200
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({});
204
201
  const reqOpts = triggerHomePageOptimization(
205
202
  payload
206
203
  );
@@ -214,10 +211,10 @@ async function triggerHomePageOptimization2(pageId, options) {
214
211
  err,
215
212
  {
216
213
  spreadPathsToArguments: {},
217
- explicitPathsToArguments: { pageId: "$[0]", pagePath: "$[1].pagePath" },
214
+ explicitPathsToArguments: {},
218
215
  singleArgumentUnchanged: false
219
216
  },
220
- ["pageId", "options"]
217
+ []
221
218
  );
222
219
  sideEffects?.onError?.(err);
223
220
  throw transformedError;
@@ -265,9 +262,7 @@ function triggerPageOptimization3(httpClient) {
265
262
  );
266
263
  }
267
264
  function triggerHomePageOptimization3(httpClient) {
268
- return (pageId, options) => triggerHomePageOptimization2(
269
- pageId,
270
- options,
265
+ return () => triggerHomePageOptimization2(
271
266
  // @ts-ignore
272
267
  { httpClient }
273
268
  );
@@ -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. 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":";;;;;;;;;;;;;;;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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;;;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"]}
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\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 * ID of the page the service resolved as the site's homepage. Pass to Get\n * Page Optimization Results to retrieve the homepage's latest generation\n * after the `predictionId` expires.\n * @readonly\n * @maxLength 1000\n */\n pageId?: 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 * @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`, 0>\n): Promise<\n NonNullablePaths<TriggerPageOptimizationResponse, `predictionId`, 0> & {\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 * The method takes no parameters. Wix resolves which page is the site's\n * homepage, so callers don't have to identify it. The response returns the\n * resolved `pageId`, for later lookups with Get Page Optimization Results.\n * @public\n * @documentationMaturity preview\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(): Promise<\n NonNullablePaths<\n TriggerHomePageOptimizationResponse,\n `predictionId` | `pageId`,\n 0\n > & {\n __applicationErrorsType?: TriggerHomePageOptimizationApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\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: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\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 2\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 */\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 * The method takes no parameters. Wix resolves which page is the site's\n * homepage, so callers don't have to identify it. The response returns the\n * resolved `pageId`, for later lookups with Get Page Optimization Results.\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 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`, 0>\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. The page's focus keyword must be set.\n */\n (\n pageId: string,\n options: NonNullablePaths<TriggerPageOptimizationOptions, `pagePath`, 0>\n ): Promise<\n NonNullablePaths<TriggerPageOptimizationResponse, `predictionId`, 0> & {\n __applicationErrorsType?: TriggerPageOptimizationApplicationErrors;\n }\n >;\n}\n\nexport function triggerHomePageOptimization(\n httpClient: HttpClient\n): TriggerHomePageOptimizationSignature {\n return () =>\n universalTriggerHomePageOptimization(\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 * The method takes no parameters. Wix resolves which page is the site's\n * homepage, so callers don't have to identify it. The response returns the\n * resolved `pageId`, for later lookups with Get Page Optimization Results.\n */\n (): Promise<\n NonNullablePaths<\n TriggerHomePageOptimizationResponse,\n `predictionId` | `pageId`,\n 0\n > & {\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 2\n > & {\n __applicationErrorsType?: GetPageOptimizationResultsApplicationErrors;\n }\n >;\n}\n\nexport {\n GetPageOptimizationResultsOptions,\n GetPageOptimizationResultsRequest,\n GetPageOptimizationResultsResponse,\n OptimizationStatus,\n PageOptimization,\n TextSuggestion,\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 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;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,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA,MAChB;AAAA,QACE,SAAS;AAAA,Q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AE,WAAW;AAAA,EACf;AACJ;;;AChGA,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"]}
@@ -84,18 +84,6 @@ interface TriggerPageOptimizationResponse {
84
84
  predictionId?: string;
85
85
  }
86
86
  interface TriggerHomePageOptimizationRequest {
87
- /**
88
- * ID of the site's homepage.
89
- * @maxLength 1000
90
- * @minLength 1
91
- */
92
- pageId: string;
93
- /**
94
- * URL path of the homepage. Usually `/`.
95
- * @maxLength 1000
96
- * @minLength 1
97
- */
98
- pagePath: string;
99
87
  }
100
88
  interface TriggerHomePageOptimizationResponse {
101
89
  /**
@@ -104,6 +92,14 @@ interface TriggerHomePageOptimizationResponse {
104
92
  * @maxLength 200
105
93
  */
106
94
  predictionId?: string;
95
+ /**
96
+ * ID of the page the service resolved as the site's homepage. Pass to Get
97
+ * Page Optimization Results to retrieve the homepage's latest generation
98
+ * after the `predictionId` expires.
99
+ * @readonly
100
+ * @maxLength 1000
101
+ */
102
+ pageId?: string;
107
103
  }
108
104
  interface GetPageOptimizationResultsRequest {
109
105
  /**
@@ -220,8 +216,6 @@ type GetPageOptimizationResultsApplicationErrors = {
220
216
  * progress, calling again returns the same `predictionId` instead of
221
217
  * starting a new job, unless the page's focus keyword changed since the
222
218
  * job started, which returns a `SUGGESTIONS_ALREADY_IN_PROGRESS` error.
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
219
  * @param pageId - ID of the site page to optimize. The page's focus keyword must be set.
226
220
  * @public
227
221
  * @documentationMaturity preview
@@ -232,7 +226,7 @@ type GetPageOptimizationResultsApplicationErrors = {
232
226
  * @applicableIdentity APP
233
227
  * @fqn wix.seo.suggestions.v1.PageOptimizationService.TriggerPageOptimization
234
228
  */
235
- declare function triggerPageOptimization(pageId: string, options: NonNullablePaths<TriggerPageOptimizationOptions, `pagePath`, 2>): Promise<NonNullablePaths<TriggerPageOptimizationResponse, `predictionId`, 2> & {
229
+ declare function triggerPageOptimization(pageId: string, options: NonNullablePaths<TriggerPageOptimizationOptions, `pagePath`, 0>): Promise<NonNullablePaths<TriggerPageOptimizationResponse, `predictionId`, 0> & {
236
230
  __applicationErrorsType?: TriggerPageOptimizationApplicationErrors;
237
231
  }>;
238
232
  interface TriggerPageOptimizationOptions {
@@ -253,28 +247,18 @@ interface TriggerPageOptimizationOptions {
253
247
  * keyword must be set first, the call returns a `predictionId` to poll,
254
248
  * and triggering is idempotent per page while a job is in progress.
255
249
  *
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.
257
- * @param pageId - ID of the site's homepage.
250
+ * The method takes no parameters. Wix resolves which page is the site's
251
+ * homepage, so callers don't have to identify it. The response returns the
252
+ * resolved `pageId`, for later lookups with Get Page Optimization Results.
258
253
  * @public
259
254
  * @documentationMaturity preview
260
- * @requiredField options
261
- * @requiredField options.pagePath
262
- * @requiredField pageId
263
255
  * @permissionId seo:suggestions:v1:page_optimization:trigger_home_page_optimization
264
256
  * @applicableIdentity APP
265
257
  * @fqn wix.seo.suggestions.v1.PageOptimizationService.TriggerHomePageOptimization
266
258
  */
267
- declare function triggerHomePageOptimization(pageId: string, options: NonNullablePaths<TriggerHomePageOptimizationOptions, `pagePath`, 2>): Promise<NonNullablePaths<TriggerHomePageOptimizationResponse, `predictionId`, 2> & {
259
+ declare function triggerHomePageOptimization(): Promise<NonNullablePaths<TriggerHomePageOptimizationResponse, `predictionId` | `pageId`, 0> & {
268
260
  __applicationErrorsType?: TriggerHomePageOptimizationApplicationErrors;
269
261
  }>;
270
- interface TriggerHomePageOptimizationOptions {
271
- /**
272
- * URL path of the homepage. Usually `/`.
273
- * @maxLength 1000
274
- * @minLength 1
275
- */
276
- pagePath: string;
277
- }
278
262
  /**
279
263
  * Retrieves the optimization suggestions generated for a page.
280
264
  *
@@ -295,7 +279,7 @@ interface TriggerHomePageOptimizationOptions {
295
279
  * @applicableIdentity APP
296
280
  * @fqn wix.seo.suggestions.v1.PageOptimizationService.GetPageOptimizationResults
297
281
  */
298
- declare function getPageOptimizationResults(options?: GetPageOptimizationResultsOptions): Promise<NonNullablePaths<GetPageOptimizationResultsResponse, `pageOptimization.metaTitle.after` | `pageOptimization.content` | `status`, 4> & {
282
+ declare function getPageOptimizationResults(options?: GetPageOptimizationResultsOptions): Promise<NonNullablePaths<GetPageOptimizationResultsResponse, `pageOptimization.metaTitle.after` | `pageOptimization.content` | `status`, 2> & {
299
283
  __applicationErrorsType?: GetPageOptimizationResultsApplicationErrors;
300
284
  }>;
301
285
  interface GetPageOptimizationResultsOptions {
@@ -313,4 +297,4 @@ interface GetPageOptimizationResultsOptions {
313
297
  pageId?: string | null;
314
298
  }
315
299
 
316
- export { type GetPageOptimizationResultsApplicationErrors, type GetPageOptimizationResultsOptions, type GetPageOptimizationResultsRequest, type GetPageOptimizationResultsResponse, OptimizationStatus, type OptimizationStatusWithLiterals, type PageOptimization, type TextSuggestion, type TriggerHomePageOptimizationApplicationErrors, type TriggerHomePageOptimizationOptions, type TriggerHomePageOptimizationRequest, type TriggerHomePageOptimizationResponse, type TriggerPageOptimizationApplicationErrors, type TriggerPageOptimizationOptions, type TriggerPageOptimizationRequest, type TriggerPageOptimizationResponse, getPageOptimizationResults, triggerHomePageOptimization, triggerPageOptimization };
300
+ export { type GetPageOptimizationResultsApplicationErrors, type GetPageOptimizationResultsOptions, type GetPageOptimizationResultsRequest, type GetPageOptimizationResultsResponse, OptimizationStatus, type OptimizationStatusWithLiterals, type PageOptimization, type TextSuggestion, type TriggerHomePageOptimizationApplicationErrors, type TriggerHomePageOptimizationRequest, type TriggerHomePageOptimizationResponse, type TriggerPageOptimizationApplicationErrors, type TriggerPageOptimizationOptions, type TriggerPageOptimizationRequest, type TriggerPageOptimizationResponse, getPageOptimizationResults, triggerHomePageOptimization, triggerPageOptimization };
@@ -195,12 +195,9 @@ async function triggerPageOptimization2(pageId, options) {
195
195
  throw transformedError;
196
196
  }
197
197
  }
198
- async function triggerHomePageOptimization2(pageId, options) {
199
- const { httpClient, sideEffects } = arguments[2];
200
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
201
- pageId,
202
- pagePath: options?.pagePath
203
- });
198
+ async function triggerHomePageOptimization2() {
199
+ const { httpClient, sideEffects } = arguments[0];
200
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({});
204
201
  const reqOpts = triggerHomePageOptimization(
205
202
  payload
206
203
  );
@@ -214,10 +211,10 @@ async function triggerHomePageOptimization2(pageId, options) {
214
211
  err,
215
212
  {
216
213
  spreadPathsToArguments: {},
217
- explicitPathsToArguments: { pageId: "$[0]", pagePath: "$[1].pagePath" },
214
+ explicitPathsToArguments: {},
218
215
  singleArgumentUnchanged: false
219
216
  },
220
- ["pageId", "options"]
217
+ []
221
218
  );
222
219
  sideEffects?.onError?.(err);
223
220
  throw transformedError;
@@ -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. 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;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,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA,MAChB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,GAA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;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;AA+BA,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\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 * ID of the page the service resolved as the site's homepage. Pass to Get\n * Page Optimization Results to retrieve the homepage's latest generation\n * after the `predictionId` expires.\n * @readonly\n * @maxLength 1000\n */\n pageId?: 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 * @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`, 0>\n): Promise<\n NonNullablePaths<TriggerPageOptimizationResponse, `predictionId`, 0> & {\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 * The method takes no parameters. Wix resolves which page is the site's\n * homepage, so callers don't have to identify it. The response returns the\n * resolved `pageId`, for later lookups with Get Page Optimization Results.\n * @public\n * @documentationMaturity preview\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(): Promise<\n NonNullablePaths<\n TriggerHomePageOptimizationResponse,\n `predictionId` | `pageId`,\n 0\n > & {\n __applicationErrorsType?: TriggerHomePageOptimizationApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\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: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\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 2\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 */\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 * The method takes no parameters. Wix resolves which page is the site's\n * homepage, so callers don't have to identify it. The response returns the\n * resolved `pageId`, for later lookups with Get Page Optimization Results.\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;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,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA,MAChB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;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C3B;AAAA,MACA,CAAC;AAAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;AAsBA,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"]}
@@ -85,18 +85,6 @@ interface TriggerPageOptimizationResponse {
85
85
  predictionId?: string;
86
86
  }
87
87
  interface TriggerHomePageOptimizationRequest {
88
- /**
89
- * ID of the site's homepage.
90
- * @maxLength 1000
91
- * @minLength 1
92
- */
93
- pageId: string;
94
- /**
95
- * URL path of the homepage. Usually `/`.
96
- * @maxLength 1000
97
- * @minLength 1
98
- */
99
- pagePath: string;
100
88
  }
101
89
  interface TriggerHomePageOptimizationResponse {
102
90
  /**
@@ -105,6 +93,14 @@ interface TriggerHomePageOptimizationResponse {
105
93
  * @maxLength 200
106
94
  */
107
95
  predictionId?: string;
96
+ /**
97
+ * ID of the page the service resolved as the site's homepage. Pass to Get
98
+ * Page Optimization Results to retrieve the homepage's latest generation
99
+ * after the `predictionId` expires.
100
+ * @readonly
101
+ * @maxLength 1000
102
+ */
103
+ pageId?: string;
108
104
  }
109
105
  interface GetPageOptimizationResultsRequest {
110
106
  /**