Skip to content

Commit 80b93f6

Browse files
Adjust address validation setting (#6355)
* Allow changing preserve all address fields setting * Add changeset * Update .changeset/clean-eggs-shop.md Co-authored-by: Jonatan Witoszek <jonatanwitoszek@gmail.com> --------- Co-authored-by: Jonatan Witoszek <jonatanwitoszek@gmail.com>
1 parent 1efe6c2 commit 80b93f6

13 files changed

Lines changed: 132 additions & 7 deletions

File tree

.changeset/clean-eggs-shop.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"saleor-dashboard": patch
3+
---
4+
5+
Added "Address Validation" setting to the site settings page, allowing admins to preserve address fields that fall outside a country's standard format instead of having them removed during validation.
6+
7+
Requires Saleor [3.22.38](https://github.com/saleor/saleor/releases/tag/3.22.38)

locale/defaultMessages.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,10 @@
11411141
"context": "order history message",
11421142
"string": "Other event"
11431143
},
1144+
"4k38A6": {
1145+
"context": "card header and checkbox label",
1146+
"string": "Preserve non-standard address fields"
1147+
},
11441148
"4k9rMQ": {
11451149
"context": "variant attribute checkbox",
11461150
"string": "Variant Selection"
@@ -1517,6 +1521,10 @@
15171521
"context": "input placeholder",
15181522
"string": "Search by name, email, etc..."
15191523
},
1524+
"6vf8AS": {
1525+
"context": "section title",
1526+
"string": "Address Validation"
1527+
},
15201528
"6xC/Ls": {
15211529
"context": "informations about product seo, header",
15221530
"string": "SEO Information"
@@ -4803,6 +4811,10 @@
48034811
"context": "set balance button label",
48044812
"string": "Set Balance"
48054813
},
4814+
"PJGv35": {
4815+
"context": "section description",
4816+
"string": "Controls how address fields that are not part of a country's standard format are handled. By default, such fields are removed during validation — enabling this setting preserves them as entered."
4817+
},
48064818
"PKJqcq": {
48074819
"string": "Invoice is Generating"
48084820
},

schema-main.graphql

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10165,10 +10165,19 @@ type Shop implements ObjectWithMetadata {
1016510165

1016610166
"""
1016710167
Use legacy update webhook emission. When enabled, update webhooks (e.g. `customerUpdated`,`productVariantUpdated`) are sent even when only metadata changes. When disabled, update webhooks are not sent for metadata-only changes; only metadata-specific webhooks (e.g., `customerMetadataUpdated`, `productVariantMetadataUpdated`) are sent.
10168-
10168+
1016910169
Added in Saleor 3.22.
1017010170
"""
1017110171
useLegacyUpdateWebhookEmission: Boolean @deprecated
10172+
10173+
"""
10174+
When enabled, address fields that are not valid for a given country (according to Google's i18n address data) will be preserved instead of being removed during validation. Validation errors are still returned.
10175+
10176+
Added in Saleor 3.22.
10177+
10178+
Requires one of the following permissions: MANAGE_SETTINGS.
10179+
"""
10180+
preserveAllAddressFields: Boolean!
1017210181
}
1017310182

1017410183
"""
@@ -20761,14 +20770,21 @@ input ShopSettingsInput {
2076120770

2076220771
"""
2076320772
Use legacy update webhook emission. When enabled, update webhooks (e.g. `customerUpdated`,`productVariantUpdated`) are sent even when only metadata changes. When disabled, update webhooks are not sent for metadata-only changes; only metadata-specific webhooks (e.g., `customerMetadataUpdated`, `productVariantMetadataUpdated`) are sent.
20764-
20773+
2076520774
Added in Saleor 3.22.
2076620775
"""
2076720776
useLegacyUpdateWebhookEmission: Boolean @deprecated
20777+
20778+
"""
20779+
When enabled, address fields that are not valid for a given country (according to Google's i18n address data) will be preserved instead of being removed during validation. Validation errors are still returned.
20780+
20781+
Added in Saleor 3.22.
20782+
"""
20783+
preserveAllAddressFields: Boolean
2076820784
}
2076920785

2077020786
"""
20771-
Fetch tax rates.
20787+
Fetch tax rates.
2077220788

2077320789
Requires one of the following permissions: MANAGE_SETTINGS.
2077420790
"""

src/fragments/shop.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ export const shopFragment = gql`
5757
limitQuantityPerCheckout
5858
enableAccountConfirmationByEmail
5959
useLegacyUpdateWebhookEmission
60+
preserveAllAddressFields
6061
}
6162
`;

src/graphql/fabbrica.generated.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30797,6 +30797,14 @@ export type OptionalShop = {
3079730797
permissions?: OptionalPermission[] | undefined;
3079830798
/** List of possible phone prefixes. */
3079930799
phonePrefixes?: Shop['phonePrefixes'] | undefined;
30800+
/**
30801+
* When enabled, address fields that are not valid for a given country (according to Google's i18n address data) will be preserved instead of being removed during validation. Validation errors are still returned.
30802+
*
30803+
* Added in Saleor 3.22.
30804+
*
30805+
* Requires one of the following permissions: MANAGE_SETTINGS.
30806+
*/
30807+
preserveAllAddressFields?: Shop['preserveAllAddressFields'] | undefined;
3080030808
/** List of private metadata items. Requires staff permissions to access. */
3080130809
privateMetadata?: OptionalMetadataItem[] | undefined;
3080230810
/**
@@ -31018,6 +31026,12 @@ export type OptionalShopSettingsInput = {
3101831026
*/
3101931027
metadata?: Maybe<OptionalMetadataInput[]> | undefined;
3102031028
/**
31029+
* When enabled, address fields that are not valid for a given country (according to Google's i18n address data) will be preserved instead of being removed during validation. Validation errors are still returned.
31030+
*
31031+
* Added in Saleor 3.22.
31032+
*/
31033+
preserveAllAddressFields?: ShopSettingsInput['preserveAllAddressFields'] | undefined;
31034+
/**
3102131035
* Shop private metadata. Requires permissions to modify and to read the metadata of the object it's attached to.
3102231036
*
3102331037
* Warning: never store sensitive information, including financial data such as credit card details.

src/graphql/fabbricaTypes.generated.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26223,6 +26223,14 @@ export type Shop = ObjectWithMetadata & {
2622326223
permissions: Array<Permission>;
2622426224
/** List of possible phone prefixes. */
2622526225
phonePrefixes: Array<Scalars['String']>;
26226+
/**
26227+
* When enabled, address fields that are not valid for a given country (according to Google's i18n address data) will be preserved instead of being removed during validation. Validation errors are still returned.
26228+
*
26229+
* Added in Saleor 3.22.
26230+
*
26231+
* Requires one of the following permissions: MANAGE_SETTINGS.
26232+
*/
26233+
preserveAllAddressFields: Scalars['Boolean'];
2622626234
/** List of private metadata items. Requires staff permissions to access. */
2622726235
privateMetadata: Array<MetadataItem>;
2622826236
/**
@@ -26449,6 +26457,12 @@ export type ShopSettingsInput = {
2644926457
* Warning: never store sensitive information, including financial data such as credit card details.
2645026458
*/
2645126459
metadata: InputMaybe<Array<MetadataInput>>;
26460+
/**
26461+
* When enabled, address fields that are not valid for a given country (according to Google's i18n address data) will be preserved instead of being removed during validation. Validation errors are still returned.
26462+
*
26463+
* Added in Saleor 3.22.
26464+
*/
26465+
preserveAllAddressFields: InputMaybe<Scalars['Boolean']>;
2645226466
/**
2645326467
* Shop private metadata. Requires permissions to modify and to read the metadata of the object it's attached to.
2645426468
*

src/graphql/hooks.generated.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3387,6 +3387,7 @@ export const ShopFragmentDoc = gql`
33873387
limitQuantityPerCheckout
33883388
enableAccountConfirmationByEmail
33893389
useLegacyUpdateWebhookEmission
3390+
preserveAllAddressFields
33903391
}
33913392
${AddressFragmentDoc}`;
33923393
export const StaffMemberDetailsFragmentDoc = gql`

src/graphql/typePolicies.generated.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5930,7 +5930,7 @@ export type ShippingZoneUpdatedFieldPolicy = {
59305930
shippingZone?: FieldPolicy<any> | FieldReadFunction<any>,
59315931
version?: FieldPolicy<any> | FieldReadFunction<any>
59325932
};
5933-
export type ShopKeySpecifier = ('allowLoginWithoutConfirmation' | 'automaticFulfillmentDigitalProducts' | 'availableExternalAuthentications' | 'availablePaymentGateways' | 'availableShippingMethods' | 'availableTaxApps' | 'channelCurrencies' | 'chargeTaxesOnShipping' | 'companyAddress' | 'countries' | 'customerSetPasswordUrl' | 'defaultCountry' | 'defaultDigitalMaxDownloads' | 'defaultDigitalUrlValidDays' | 'defaultMailSenderAddress' | 'defaultMailSenderName' | 'defaultWeightUnit' | 'description' | 'displayGrossPrices' | 'domain' | 'enableAccountConfirmationByEmail' | 'fulfillmentAllowUnpaid' | 'fulfillmentAutoApprove' | 'headerText' | 'id' | 'includeTaxesInPrices' | 'languages' | 'limitQuantityPerCheckout' | 'limits' | 'metadata' | 'metafield' | 'metafields' | 'name' | 'permissions' | 'phonePrefixes' | 'privateMetadata' | 'privateMetafield' | 'privateMetafields' | 'reserveStockDurationAnonymousUser' | 'reserveStockDurationAuthenticatedUser' | 'schemaVersion' | 'staffNotificationRecipients' | 'trackInventoryByDefault' | 'translation' | 'useLegacyUpdateWebhookEmission' | 'version' | ShopKeySpecifier)[];
5933+
export type ShopKeySpecifier = ('allowLoginWithoutConfirmation' | 'automaticFulfillmentDigitalProducts' | 'availableExternalAuthentications' | 'availablePaymentGateways' | 'availableShippingMethods' | 'availableTaxApps' | 'channelCurrencies' | 'chargeTaxesOnShipping' | 'companyAddress' | 'countries' | 'customerSetPasswordUrl' | 'defaultCountry' | 'defaultDigitalMaxDownloads' | 'defaultDigitalUrlValidDays' | 'defaultMailSenderAddress' | 'defaultMailSenderName' | 'defaultWeightUnit' | 'description' | 'displayGrossPrices' | 'domain' | 'enableAccountConfirmationByEmail' | 'fulfillmentAllowUnpaid' | 'fulfillmentAutoApprove' | 'headerText' | 'id' | 'includeTaxesInPrices' | 'languages' | 'limitQuantityPerCheckout' | 'limits' | 'metadata' | 'metafield' | 'metafields' | 'name' | 'permissions' | 'phonePrefixes' | 'preserveAllAddressFields' | 'privateMetadata' | 'privateMetafield' | 'privateMetafields' | 'reserveStockDurationAnonymousUser' | 'reserveStockDurationAuthenticatedUser' | 'schemaVersion' | 'staffNotificationRecipients' | 'trackInventoryByDefault' | 'translation' | 'useLegacyUpdateWebhookEmission' | 'version' | ShopKeySpecifier)[];
59345934
export type ShopFieldPolicy = {
59355935
allowLoginWithoutConfirmation?: FieldPolicy<any> | FieldReadFunction<any>,
59365936
automaticFulfillmentDigitalProducts?: FieldPolicy<any> | FieldReadFunction<any>,
@@ -5967,6 +5967,7 @@ export type ShopFieldPolicy = {
59675967
name?: FieldPolicy<any> | FieldReadFunction<any>,
59685968
permissions?: FieldPolicy<any> | FieldReadFunction<any>,
59695969
phonePrefixes?: FieldPolicy<any> | FieldReadFunction<any>,
5970+
preserveAllAddressFields?: FieldPolicy<any> | FieldReadFunction<any>,
59705971
privateMetadata?: FieldPolicy<any> | FieldReadFunction<any>,
59715972
privateMetafield?: FieldPolicy<any> | FieldReadFunction<any>,
59725973
privateMetafields?: FieldPolicy<any> | FieldReadFunction<any>,

src/graphql/types.generated.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6898,6 +6898,12 @@ export type ShopSettingsInput = {
68986898
* Warning: never store sensitive information, including financial data such as credit card details.
68996899
*/
69006900
metadata?: InputMaybe<Array<MetadataInput>>;
6901+
/**
6902+
* When enabled, address fields that are not valid for a given country (according to Google's i18n address data) will be preserved instead of being removed during validation. Validation errors are still returned.
6903+
*
6904+
* Added in Saleor 3.22.
6905+
*/
6906+
preserveAllAddressFields?: InputMaybe<Scalars['Boolean']>;
69016907
/**
69026908
* Shop private metadata. Requires permissions to modify and to read the metadata of the object it's attached to.
69036909
*
@@ -10519,7 +10525,7 @@ export type LimitInfoFragment = { __typename: 'Limits', channels?: number | null
1051910525

1052010526
export type ShopLimitFragment = { __typename: 'Shop', limits: { __typename: 'LimitInfo', currentUsage: { __typename: 'Limits', channels?: number | null, orders?: number | null, productVariants?: number | null, staffUsers?: number | null, warehouses?: number | null }, allowedUsage: { __typename: 'Limits', channels?: number | null, orders?: number | null, productVariants?: number | null, staffUsers?: number | null, warehouses?: number | null } } };
1052110527

10522-
export type ShopFragment = { __typename: 'Shop', customerSetPasswordUrl: string | null, defaultMailSenderAddress: string | null, defaultMailSenderName: string | null, description: string | null, name: string, reserveStockDurationAnonymousUser: number | null, reserveStockDurationAuthenticatedUser: number | null, limitQuantityPerCheckout: number | null, enableAccountConfirmationByEmail: boolean | null, useLegacyUpdateWebhookEmission: boolean | null, companyAddress: { __typename: 'Address', city: string, cityArea: string, companyName: string, countryArea: string, firstName: string, id: string, lastName: string, phone: string | null, postalCode: string, streetAddress1: string, streetAddress2: string, country: { __typename: 'CountryDisplay', code: string, country: string } } | null, countries: Array<{ __typename: 'CountryDisplay', code: string, country: string }>, domain: { __typename: 'Domain', host: string } };
10528+
export type ShopFragment = { __typename: 'Shop', customerSetPasswordUrl: string | null, defaultMailSenderAddress: string | null, defaultMailSenderName: string | null, description: string | null, name: string, reserveStockDurationAnonymousUser: number | null, reserveStockDurationAuthenticatedUser: number | null, limitQuantityPerCheckout: number | null, enableAccountConfirmationByEmail: boolean | null, useLegacyUpdateWebhookEmission: boolean | null, preserveAllAddressFields: boolean, companyAddress: { __typename: 'Address', city: string, cityArea: string, companyName: string, countryArea: string, firstName: string, id: string, lastName: string, phone: string | null, postalCode: string, streetAddress1: string, streetAddress2: string, country: { __typename: 'CountryDisplay', code: string, country: string } } | null, countries: Array<{ __typename: 'CountryDisplay', code: string, country: string }>, domain: { __typename: 'Domain', host: string } };
1052310529

1052410530
export type StaffMemberFragment = { __typename: 'User', id: string, email: string, firstName: string, isActive: boolean, lastName: string };
1052510531

@@ -12172,7 +12178,7 @@ export type ShopSettingsUpdateMutationVariables = Exact<{
1217212178
}>;
1217312179

1217412180

12175-
export type ShopSettingsUpdateMutation = { __typename: 'Mutation', shopSettingsUpdate: { __typename: 'ShopSettingsUpdate', errors: Array<{ __typename: 'ShopError', code: ShopErrorCode, field: string | null, message: string | null }>, shop: { __typename: 'Shop', customerSetPasswordUrl: string | null, defaultMailSenderAddress: string | null, defaultMailSenderName: string | null, description: string | null, name: string, reserveStockDurationAnonymousUser: number | null, reserveStockDurationAuthenticatedUser: number | null, limitQuantityPerCheckout: number | null, enableAccountConfirmationByEmail: boolean | null, useLegacyUpdateWebhookEmission: boolean | null, companyAddress: { __typename: 'Address', city: string, cityArea: string, companyName: string, countryArea: string, firstName: string, id: string, lastName: string, phone: string | null, postalCode: string, streetAddress1: string, streetAddress2: string, country: { __typename: 'CountryDisplay', code: string, country: string } } | null, countries: Array<{ __typename: 'CountryDisplay', code: string, country: string }>, domain: { __typename: 'Domain', host: string } } | null } | null, shopAddressUpdate: { __typename: 'ShopAddressUpdate', errors: Array<{ __typename: 'ShopError', code: ShopErrorCode, field: string | null, message: string | null }>, shop: { __typename: 'Shop', companyAddress: { __typename: 'Address', city: string, cityArea: string, companyName: string, countryArea: string, firstName: string, id: string, lastName: string, phone: string | null, postalCode: string, streetAddress1: string, streetAddress2: string, country: { __typename: 'CountryDisplay', code: string, country: string } } | null } | null } | null };
12181+
export type ShopSettingsUpdateMutation = { __typename: 'Mutation', shopSettingsUpdate: { __typename: 'ShopSettingsUpdate', errors: Array<{ __typename: 'ShopError', code: ShopErrorCode, field: string | null, message: string | null }>, shop: { __typename: 'Shop', customerSetPasswordUrl: string | null, defaultMailSenderAddress: string | null, defaultMailSenderName: string | null, description: string | null, name: string, reserveStockDurationAnonymousUser: number | null, reserveStockDurationAuthenticatedUser: number | null, limitQuantityPerCheckout: number | null, enableAccountConfirmationByEmail: boolean | null, useLegacyUpdateWebhookEmission: boolean | null, preserveAllAddressFields: boolean, companyAddress: { __typename: 'Address', city: string, cityArea: string, companyName: string, countryArea: string, firstName: string, id: string, lastName: string, phone: string | null, postalCode: string, streetAddress1: string, streetAddress2: string, country: { __typename: 'CountryDisplay', code: string, country: string } } | null, countries: Array<{ __typename: 'CountryDisplay', code: string, country: string }>, domain: { __typename: 'Domain', host: string } } | null } | null, shopAddressUpdate: { __typename: 'ShopAddressUpdate', errors: Array<{ __typename: 'ShopError', code: ShopErrorCode, field: string | null, message: string | null }>, shop: { __typename: 'Shop', companyAddress: { __typename: 'Address', city: string, cityArea: string, companyName: string, countryArea: string, firstName: string, id: string, lastName: string, phone: string | null, postalCode: string, streetAddress1: string, streetAddress2: string, country: { __typename: 'CountryDisplay', code: string, country: string } } | null } | null } | null };
1217612182

1217712183
export type RefundSettingsUpdateMutationVariables = Exact<{
1217812184
refundSettingsInput: RefundSettingsUpdateInput;
@@ -12189,7 +12195,7 @@ export type RefundReasonReferenceClearMutation = { __typename: 'Mutation', refun
1218912195
export type SiteSettingsQueryVariables = Exact<{ [key: string]: never; }>;
1219012196

1219112197

12192-
export type SiteSettingsQuery = { __typename: 'Query', shop: { __typename: 'Shop', customerSetPasswordUrl: string | null, defaultMailSenderAddress: string | null, defaultMailSenderName: string | null, description: string | null, name: string, reserveStockDurationAnonymousUser: number | null, reserveStockDurationAuthenticatedUser: number | null, limitQuantityPerCheckout: number | null, enableAccountConfirmationByEmail: boolean | null, useLegacyUpdateWebhookEmission: boolean | null, companyAddress: { __typename: 'Address', city: string, cityArea: string, companyName: string, countryArea: string, firstName: string, id: string, lastName: string, phone: string | null, postalCode: string, streetAddress1: string, streetAddress2: string, country: { __typename: 'CountryDisplay', code: string, country: string } } | null, countries: Array<{ __typename: 'CountryDisplay', code: string, country: string }>, domain: { __typename: 'Domain', host: string } } };
12198+
export type SiteSettingsQuery = { __typename: 'Query', shop: { __typename: 'Shop', customerSetPasswordUrl: string | null, defaultMailSenderAddress: string | null, defaultMailSenderName: string | null, description: string | null, name: string, reserveStockDurationAnonymousUser: number | null, reserveStockDurationAuthenticatedUser: number | null, limitQuantityPerCheckout: number | null, enableAccountConfirmationByEmail: boolean | null, useLegacyUpdateWebhookEmission: boolean | null, preserveAllAddressFields: boolean, companyAddress: { __typename: 'Address', city: string, cityArea: string, companyName: string, countryArea: string, firstName: string, id: string, lastName: string, phone: string | null, postalCode: string, streetAddress1: string, streetAddress2: string, country: { __typename: 'CountryDisplay', code: string, country: string } } | null, countries: Array<{ __typename: 'CountryDisplay', code: string, country: string }>, domain: { __typename: 'Domain', host: string } } };
1219312199

1219412200
export type StaffMemberAddMutationVariables = Exact<{
1219512201
input: StaffCreateInput;

0 commit comments

Comments
 (0)