UNPKG

@adyen/adyen-web

Version:

[![npm](https://img.shields.io/npm/v/@adyen/adyen-web.svg)](https://www.npmjs.com/package/@adyen/adyen-web)

3 lines (2 loc) 2.24 kB
import{ADDRESS_SPECIFICATIONS as i}from"./constants.js";function t(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}class e{countryHasDataset(i){var t,e;return!!(null===(e=this.specifications)||void 0===e||null===(t=e[i])||void 0===t?void 0:t.hasDataset)}countryHasOptionalField(i,t){var e,o,l;return!!(null===(l=this.specifications)||void 0===l||null===(o=l[i])||void 0===o||null===(e=o.optionalFields)||void 0===e?void 0:e.includes(t))}getAddressSchemaForCountry(i){var t,e;return(null===(e=this.specifications)||void 0===e||null===(t=e[i])||void 0===t?void 0:t.schema)||this.specifications.default.schema}getAddressLabelsForCountry(i){var t,e;return(null===(e=this.specifications)||void 0===e||null===(t=e[i])||void 0===t?void 0:t.labels)||this.specifications.default.labels}getOptionalFieldsForCountry(i){var t,e,o;return(null===(e=this.specifications)||void 0===e||null===(t=e[i])||void 0===t?void 0:t.optionalFields)||(null===(o=this.specifications.default)||void 0===o?void 0:o.optionalFields)||[]}getKeyForField(i,t){var e,o,l,n,s,r;return(null===(l=this.specifications)||void 0===l||null===(o=l[t])||void 0===o||null===(e=o.labels)||void 0===e?void 0:e[i])||(null===(r=this.specifications)||void 0===r||null===(s=r.default)||void 0===s||null===(n=s.labels)||void 0===n?void 0:n[i])||i}getPlaceholderKeyForField(i,t){var e,o,l,n,s,r;return(null===(l=this.specifications)||void 0===l||null===(o=l[t])||void 0===o||null===(e=o.placeholders)||void 0===e?void 0:e[i])||(null===(r=this.specifications)||void 0===r||null===(s=r.default)||void 0===s||null===(n=s.placeholders)||void 0===n?void 0:n[i])}getAddressSchemaForCountryFlat(i){return this.getAddressSchemaForCountry(i).flat(2).filter(i=>"string"==typeof i)}constructor(e){t(this,"specifications",void 0),this.specifications=function(i){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},l=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(l=l.concat(Object.getOwnPropertySymbols(o).filter(function(i){return Object.getOwnPropertyDescriptor(o,i).enumerable}))),l.forEach(function(e){t(i,e,o[e])})}return i}({},i,e)}}export{e as default}; //# sourceMappingURL=Specifications.js.map