From 62970afb36bdccd3cdb79ed8398e2d0c41bb0169 Mon Sep 17 00:00:00 2001 From: Lisa Chan Date: Mon, 16 Oct 2023 15:56:57 -0400 Subject: [PATCH] chore(contentful): Update Contentful Content Model with newsletter fields --- .../contentful/src/__generated__/graphql.ts | 82 +++++++++++++++++++ .../contentful/1697485959016_fxa-8428.js | 42 ++++++++++ 2 files changed, 124 insertions(+) create mode 100644 packages/db-migrations/contentful/1697485959016_fxa-8428.js diff --git a/libs/shared/contentful/src/__generated__/graphql.ts b/libs/shared/contentful/src/__generated__/graphql.ts index 4b809ef51f..812b9aefe8 100644 --- a/libs/shared/contentful/src/__generated__/graphql.ts +++ b/libs/shared/contentful/src/__generated__/graphql.ts @@ -40,6 +40,8 @@ export type Scalars = { HexColor: { input: any; output: any }; /** The 'Quality' type represents quality as whole numeric values between `1` and `100`. */ Quality: { input: any; output: any }; + _Any: { input: any; output: any }; + _FieldSet: { input: any; output: any }; }; /** Represents a binary file in a space. An asset can be any file type. */ @@ -418,6 +420,8 @@ export type CommonContent = Entry & { emailIcon: Maybe; internalName: Maybe; linkedFrom: Maybe; + newsletterLabelTextCode: Maybe; + newsletterSlug: Maybe>>; privacyNoticeDownloadUrl: Maybe; privacyNoticeUrl: Maybe; successActionButtonLabel: Maybe; @@ -447,6 +451,16 @@ export type CommonContentLinkedFromArgs = { allowedLocales: InputMaybe>>; }; +/** Content used on multiple pages, not specific to a certain component. [See type definition](https://app.contentful.com/spaces/l7gqxxg5i1gg/content_types/commonContent) */ +export type CommonContentNewsletterLabelTextCodeArgs = { + locale: InputMaybe; +}; + +/** Content used on multiple pages, not specific to a certain component. [See type definition](https://app.contentful.com/spaces/l7gqxxg5i1gg/content_types/commonContent) */ +export type CommonContentNewsletterSlugArgs = { + locale: InputMaybe; +}; + /** Content used on multiple pages, not specific to a certain component. [See type definition](https://app.contentful.com/spaces/l7gqxxg5i1gg/content_types/commonContent) */ export type CommonContentPrivacyNoticeDownloadUrlArgs = { locale: InputMaybe; @@ -514,6 +528,27 @@ export type CommonContentFilter = { internalName_not_in: InputMaybe< Array> >; + newsletterLabelTextCode: InputMaybe; + newsletterLabelTextCode_contains: InputMaybe; + newsletterLabelTextCode_exists: InputMaybe; + newsletterLabelTextCode_in: InputMaybe< + Array> + >; + newsletterLabelTextCode_not: InputMaybe; + newsletterLabelTextCode_not_contains: InputMaybe; + newsletterLabelTextCode_not_in: InputMaybe< + Array> + >; + newsletterSlug_contains_all: InputMaybe< + Array> + >; + newsletterSlug_contains_none: InputMaybe< + Array> + >; + newsletterSlug_contains_some: InputMaybe< + Array> + >; + newsletterSlug_exists: InputMaybe; privacyNoticeDownloadUrl: InputMaybe; privacyNoticeDownloadUrl_contains: InputMaybe; privacyNoticeDownloadUrl_exists: InputMaybe; @@ -634,6 +669,8 @@ export enum CommonContentOrder { EmailIconDesc = 'emailIcon_DESC', InternalNameAsc = 'internalName_ASC', InternalNameDesc = 'internalName_DESC', + NewsletterLabelTextCodeAsc = 'newsletterLabelTextCode_ASC', + NewsletterLabelTextCodeDesc = 'newsletterLabelTextCode_DESC', PrivacyNoticeDownloadUrlAsc = 'privacyNoticeDownloadUrl_ASC', PrivacyNoticeDownloadUrlDesc = 'privacyNoticeDownloadUrl_DESC', PrivacyNoticeUrlAsc = 'privacyNoticeUrl_ASC', @@ -1720,6 +1757,8 @@ export enum PurchaseOrder { export type Query = { __typename?: 'Query'; + _entities: Array>; + _service: _Service; asset: Maybe; assetCollection: Maybe; capability: Maybe; @@ -1743,6 +1782,10 @@ export type Query = { subGroupCollection: Maybe; }; +export type Query_EntitiesArgs = { + representations: Array; +}; + export type QueryAssetArgs = { id: Scalars['String']['input']; locale: InputMaybe; @@ -2196,6 +2239,8 @@ export type Sys = { environmentId: Scalars['String']['output']; firstPublishedAt: Maybe; id: Scalars['String']['output']; + /** The locale that was requested - mainly used for Apollo Federation. */ + locale: Maybe; publishedAt: Maybe; publishedVersion: Maybe; spaceId: Scalars['String']['output']; @@ -2246,6 +2291,22 @@ export type SysFilter = { >; }; +export type _Entity = + | Capability + | CommonContent + | CouponConfig + | Iap + | Offering + | Purchase + | PurchaseDetails + | Service + | SubGroup; + +export type _Service = { + __typename?: '_Service'; + sdl: Maybe; +}; + export type CfCapabilityNestedFilter = { AND: InputMaybe>>; OR: InputMaybe>>; @@ -2306,6 +2367,27 @@ export type CfCommonContentNestedFilter = { internalName_not_in: InputMaybe< Array> >; + newsletterLabelTextCode: InputMaybe; + newsletterLabelTextCode_contains: InputMaybe; + newsletterLabelTextCode_exists: InputMaybe; + newsletterLabelTextCode_in: InputMaybe< + Array> + >; + newsletterLabelTextCode_not: InputMaybe; + newsletterLabelTextCode_not_contains: InputMaybe; + newsletterLabelTextCode_not_in: InputMaybe< + Array> + >; + newsletterSlug_contains_all: InputMaybe< + Array> + >; + newsletterSlug_contains_none: InputMaybe< + Array> + >; + newsletterSlug_contains_some: InputMaybe< + Array> + >; + newsletterSlug_exists: InputMaybe; privacyNoticeDownloadUrl: InputMaybe; privacyNoticeDownloadUrl_contains: InputMaybe; privacyNoticeDownloadUrl_exists: InputMaybe; diff --git a/packages/db-migrations/contentful/1697485959016_fxa-8428.js b/packages/db-migrations/contentful/1697485959016_fxa-8428.js new file mode 100644 index 0000000000..de99dfa06e --- /dev/null +++ b/packages/db-migrations/contentful/1697485959016_fxa-8428.js @@ -0,0 +1,42 @@ +function migrationFunction(migration, context) { + const commonContent = migration.editContentType('commonContent'); + const commonContentNewsletterLabelTextCode = commonContent.createField( + 'newsletterLabelTextCode' + ); + commonContentNewsletterLabelTextCode + .name('Newsletter Label Text Code') + .type('Symbol') + .localized(false) + .required(false) + .validations([{ in: ['default', 'hubs', 'mdnplus', 'snp'] }]) + .defaultValue({ en: 'default' }) + .disabled(false) + .omitted(false); + + const commonContentNewsletterSlug = + commonContent.createField('newsletterSlug'); + commonContentNewsletterSlug + .name('Newsletter Slug') + .type('Array') + .localized(false) + .required(false) + .validations([]) + .defaultValue({ en: ['mozilla-accounts'] }) + .disabled(false) + .omitted(false) + .items({ + type: 'Symbol', + validations: [ + { + in: ['mozilla-accounts', 'hubs', 'mdnplus', 'security-privacy-news'], + }, + ], + }); + commonContent.changeFieldControl( + 'newsletterLabelTextCode', + 'builtin', + 'radio' + ); + commonContent.changeFieldControl('newsletterSlug', 'builtin', 'checkbox'); +} +module.exports = migrationFunction;