From 9efed14da12e478a170479cb5557ebeccdb86206 Mon Sep 17 00:00:00 2001 From: Rayan Kanso Date: Tue, 11 May 2021 16:47:35 +0100 Subject: [PATCH 1/2] Move Address definitions/interfaces from the Payment Request API. The ContactAddress interface used to depends on the PaymentAddress interface defined in the Payment Request spec. That definition was recently removed in https://github.com/w3c/payment-request/pull/955. --- README.md | 14 +++++++- spec/index.bs | 95 ++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 100 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e43a702..f02ae27 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,19 @@ selectRecipientsButton.addEventListener('click', async () => { ```WebIDL enum ContactProperty { "address", "email", "icon", "name", "tel" }; -interface ContactAddress : PaymentAddress {}; +interface ContactAddress { + [Default] object toJSON(); + readonly attribute DOMString city; + readonly attribute DOMString country; + readonly attribute DOMString dependentLocality; + readonly attribute DOMString organization; + readonly attribute DOMString phone; + readonly attribute DOMString postalCode; + readonly attribute DOMString recipient; + readonly attribute DOMString region; + readonly attribute DOMString sortingCode; + readonly attribute FrozenArray addressLine; +}; dictionary ContactInfo { sequence address; diff --git a/spec/index.bs b/spec/index.bs index 95a28f0..01d73f0 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -19,12 +19,6 @@ spec:html; type:dfn; for:/; text:origin spec:html; type:dfn; for:/; text:valid e-mail address -
-spec: payment-request; urlPrefix: https://www.w3.org/TR/payment-request/
-  type: dfn; text: physical addresses; url: physical-addresses
-  type: interface; text: PaymentAddress; url: dom-paymentaddress
-
- # Introduction # {#intro} Contact pickers are frequently seen in various desktop and native mobile applications for a variety @@ -162,6 +156,35 @@ The contact picker task source is a [=task source=]. [=contact picker task source=] to run |steps|. +## Physical address ## {#infrastructure-physical-address} + +A physical address consists of: +
+ +* country, a {{DOMString}} representing the country of the address as an + [[ISO3166-1]] alpha-2 code stored in its canonical uppercase form or the empty string. For + example, "JP". +* address line, a [=list=] of {{DOMString}}s, containing the most specific part of the + address. It can include, for example, a street name, a house number, apartment number, a rural + delivery route, descriptive instructions, or a post office box number. +* region, a {{DOMString}} representing the top level administrative subdivision of the + country. For example, this can be a state, a province, an oblast, or a prefecture. +* city, a {{DOMString}} representing the city/town portion of the address. +* dependent locality, a {{DOMString}} representing the dependent locality or sublocality + within a city. For example, neighborhoods, boroughs, districts, or UK dependent localities. +* postal code, a {{DOMString}} representing the postal code or ZIP code, also known as + PIN code in India. +* sorting code, a {{DOMString}} representing the sorting code system, such as the CEDEX + system used in France. +* organization, a {{DOMString}} representing the organization, firm, company, or + institution at the address. +* recipient, a {{DOMString}} representing the name of the recipient or contact person at + the address. +* phone number, a {{DOMString}} representing the phone number of the recipient or contact + person at the address, optionally structured to adhere to [[E.164]]. + +
+ ## User contact ## {#infrastructure-user-contact} A user contact consists of: @@ -180,6 +203,8 @@ A user contact consists of: NOTE: An icon {{Blob}}'s {{Blob/type}} is an [=image mime type=]. + + A [=user contact=] contains data relating to a single user. Note: The lists can be of different sizes, and entries with the same index don't need to correspond @@ -243,12 +268,66 @@ field can be accessed by the user agent. : "tel" :: Associated with [=user contact=]'s [=user contact/numbers=]. -## {{ContactsManager}} ## {#contacts-manager} +## {{ContactAddress}} ## {#contact-address} + +The {{ContactAddress}} interface represents a [=physical address=]. + +
+ A {{ContactAddress}} instance has: + + * An address (a [=physical address=]). + + The city attribute's getter must return the [=context object=]'s + [=ContactAddress/address=]' [=physical address/city=]. + The country attribute's getter must return the [=context object=]'s + [=ContactAddress/address=]' [=physical address/country=]. + + The dependentLocality attribute's getter must return the [=context object=]'s + [=ContactAddress/address=]' [=physical address/dependent locality=]. + + The organization attribute's getter must return the [=context object=]'s + [=ContactAddress/address=]' [=physical address/organization=]. + + The phone attribute's getter must return the [=context object=]'s + [=ContactAddress/address=]' [=physical address/phone number=]. + + The postalCode attribute's getter must return the [=context object=]'s + [=ContactAddress/address=]' [=physical address/postal code=]. + + The recipient attribute's getter must return the [=context object=]'s + [=ContactAddress/address=]' [=physical address/recipient=]. + + The region attribute's getter must return the [=context object=]'s + [=ContactAddress/address=]' [=physical address/region=]. + + The sortingCode attribute's getter must return the [=context object=]'s + [=ContactAddress/address=]' [=physical address/sorting code=]. + + The addressLine attribute's getter must return the [=context object=]'s + [=ContactAddress/address=]' [=physical address/address line=]. +
+ +## {{ContactsManager}} ## {#contacts-manager} + +