Update Serving API - from backend PR #6302#367
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request synchronizes the TypeScript Serving API definitions with recent updates from the backend repository. It introduces new enumerations for account billing statuses and product lines, enhances the custom domain configuration with a version identifier, and expands the recognized traffic sources to include AI tools. These changes ensure that the frontend applications consume the most current and accurate data structures from the backend. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
There was a problem hiding this comment.
Code Review
This pull request updates the TypeScript serving API types to align with backend changes. The changes include adding new types for billing (PlanStatus, Products), updating the project configuration to include a version for custom domains, and extending the source type for visitor segments. My review focuses on improving the maintainability of the newly added types by reducing code duplication. I've suggested refactoring the new type and constant object pairs to derive the type from the constant, which is a common and recommended practice in TypeScript for ensuring consistency and reducing boilerplate.
| /** | ||
| * Account billing status | ||
| */ | ||
| export type PlanStatus = 'paid' | 'trial' | 'trialExpired' | 'canceled' | 'paused'; | ||
|
|
||
| /** | ||
| * Account billing status | ||
| */ | ||
| export const PlanStatus = { | ||
| PAID: 'paid', | ||
| TRIAL: 'trial', | ||
| TRIAL_EXPIRED: 'trialExpired', | ||
| CANCELED: 'canceled', | ||
| PAUSED: 'paused' | ||
| } as const; |
There was a problem hiding this comment.
To improve maintainability and reduce redundancy, you can define the PlanStatus type from the constant object. This avoids duplicating the string literals and the JSDoc comments, ensuring they are always in sync.
/**
* Account billing status
*/
export const PlanStatus = {
PAID: 'paid',
TRIAL: 'trial',
TRIAL_EXPIRED: 'trialExpired',
CANCELED: 'canceled',
PAUSED: 'paused'
} as const;
export type PlanStatus = (typeof PlanStatus)[keyof typeof PlanStatus];| /** | ||
| * The Convert product line this billing plan pertains to. | ||
| * - `experiences`: Relates to A/B testing, MVT, Split URL, and personalization features. | ||
| * - `deploy`: Relates to the "Deploy" feature for rolling out changes to specific audiences without A/B testing reports. Knowledge Base: "Deployments have the potential to contain small segments...and this could be interpreted by Privacy Authorities in Europe as identification of data subjects." | ||
| * - `addons`: Relates to add-on products that extend the core platform capabilities. | ||
| * | ||
| */ | ||
| export type Products = 'experiences' | 'deploy' | 'addons'; | ||
|
|
||
| /** | ||
| * The Convert product line this billing plan pertains to. | ||
| * - `experiences`: Relates to A/B testing, MVT, Split URL, and personalization features. | ||
| * - `deploy`: Relates to the "Deploy" feature for rolling out changes to specific audiences without A/B testing reports. Knowledge Base: "Deployments have the potential to contain small segments...and this could be interpreted by Privacy Authorities in Europe as identification of data subjects." | ||
| * - `addons`: Relates to add-on products that extend the core platform capabilities. | ||
| * | ||
| */ | ||
| export const Products = { | ||
| EXPERIENCES: 'experiences', | ||
| DEPLOY: 'deploy', | ||
| ADDONS: 'addons' | ||
| } as const; |
There was a problem hiding this comment.
To improve maintainability and reduce redundancy, you can define the Products type from the constant object. This avoids duplicating the string literals and the JSDoc comments, ensuring they are always in sync.
/**
* The Convert product line this billing plan pertains to.
* - `experiences`: Relates to A/B testing, MVT, Split URL, and personalization features.
* - `deploy`: Relates to the "Deploy" feature for rolling out changes to specific audiences without A/B testing reports. Knowledge Base: "Deployments have the potential to contain small segments...and this could be interpreted by Privacy Authorities in Europe as identification of data subjects."
* - `addons`: Relates to add-on products that extend the core platform capabilities.
*
*/
export const Products = {
EXPERIENCES: 'experiences',
DEPLOY: 'deploy',
ADDONS: 'addons'
} as const;
export type Products = (typeof Products)[keyof typeof Products];| * Traffic source | ||
| */ | ||
| export type source = 'campaign' | 'search' | 'referral' | 'direct'; | ||
| export type source = 'campaign' | 'search' | 'referral' | 'direct' | 'ai_tool'; |
There was a problem hiding this comment.
This type definition is coupled with the source constant object defined below. To improve maintainability and avoid redundancy, consider defining the type from the constant object. This would also involve moving the constant definition before this type definition.
For example:
/**
* Traffic source
*/
export const source = {
CAMPAIGN: 'campaign',
SEARCH: 'search',
REFERRAL: 'referral',
DIRECT: 'direct',
AI_TOOL: 'ai_tool'
} as const;
export type source = (typeof source)[keyof typeof source];Since this change spans across areas not fully covered by the diff, a direct code suggestion is not provided.



Updating TS Serving API after the latest changes from backend repo,
PR #6302