From 4f67040e8cadc4172632296f912d431c21aeff20 Mon Sep 17 00:00:00 2001 From: sheilagomes Date: Thu, 10 Nov 2022 12:17:42 -0300 Subject: [PATCH] Add Greece country rules --- CHANGELOG.md | 4 ++ react/countries.js | 2 + react/country/GRC.js | 156 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 162 insertions(+) create mode 100644 react/country/GRC.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 18c94e0c..6685a7c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Added + +- Greece country rules. + ## [4.15.6] - 2022-08-08 ### Removed diff --git a/react/countries.js b/react/countries.js index bc2ddb99..76328857 100644 --- a/react/countries.js +++ b/react/countries.js @@ -12,6 +12,7 @@ import ECU from './country/ECU' import ESP from './country/ESP' import FRA from './country/FRA' import GBR from './country/GBR' +import GRC from './country/GRC' import GTM from './country/GTM' import IDN from './country/IDN' import KOR from './country/KOR' @@ -39,6 +40,7 @@ export default { ESP, FRA, GBR, + GRC, GTM, IDN, KOR, diff --git a/react/country/GRC.js b/react/country/GRC.js new file mode 100644 index 00000000..8dd0a0d0 --- /dev/null +++ b/react/country/GRC.js @@ -0,0 +1,156 @@ +import { POSTAL_CODE } from '../constants' + +export default { + country: 'GRC', + abbr: 'GR', + postalCodeFrom: POSTAL_CODE, + fields: [ + { + hidden: true, + name: 'country', + maxLength: 100, + label: 'country', + size: 'medium', + }, + { + name: 'postalCode', + maxLength: 5, + label: 'postalCode', + size: 'small', + autoComplete: 'nope', + postalCodeAPI: false, + regex: /^([\d]{5})$/, + required: true, + }, + { + name: 'street', + label: 'addressLine1', + required: true, + size: 'xlarge', + }, + { + name: 'number', + maxLength: 750, + label: 'number', + size: 'small', + autoComplete: 'nope', + }, + { + name: 'complement', + maxLength: 750, + label: 'addressLine2', + size: 'xlarge', + }, + { + hidden: true, + name: 'reference', + maxLength: 750, + label: 'reference', + size: 'xlarge', + }, + { + hidden: true, + name: 'neighborhood', + maxLength: 100, + label: 'neighborhood', + size: 'large', + }, + { + name: 'city', + maxLength: 100, + label: 'city', + required: true, + size: 'large', + }, + { + name: 'state', + maxLength: 100, + label: 'province', + required: true, + size: 'large', + }, + { + name: 'receiverName', + elementName: 'receiver', + maxLength: 750, + label: 'receiverName', + size: 'xlarge', + required: true, + }, + ], + geolocation: { + postalCode: { + valueIn: 'long_name', + types: ['postal_code'], + required: false, + }, + + number: { + valueIn: 'long_name', + types: ['street_number'], + required: false, + notApplicable: true, + }, + + street: { valueIn: 'long_name', types: ['route'] }, + + neighborhood: { + valueIn: 'long_name', + types: [ + 'neighborhood', + 'sublocality_level_1', + 'sublocality_level_2', + 'sublocality_level_3', + 'sublocality_level_4', + 'sublocality_level_5', + ], + }, + + state: { + valueIn: 'short_name', + types: ['administrative_area_level_2'], + }, + + city: { + valueIn: 'long_name', + types: ['administrative_area_level_3', 'locality'], + }, + + receiverName: { + required: true, + }, + }, + summary: [ + [ + { + name: 'street', + }, + { + delimiter: ' ', + name: 'number', + }, + { + delimiter: ', ', + name: 'complement', + }, + ], + [ + { + name: 'neighborhood', + delimiterAfter: ' - ', + }, + { + name: 'city', + }, + { + delimiter: ' - ', + name: 'state', + }, + ], + [ + { + name: 'postalCode', + }, + ], + ], +}