@ikas/localized-address
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -51,2 +51,3 @@ import { AddressFormItem, BillingFormItem, AddressForm, IkasAddressFormFields } from "./model"; | ||
district: import("./model").AddressFormField; | ||
region: import("./model").AddressFormField; | ||
phone: import("./model").AddressFormField; | ||
@@ -111,2 +112,6 @@ company: import("./model").AddressFormField; | ||
}; | ||
region: { | ||
hasError: boolean; | ||
message: string; | ||
}; | ||
phone: { | ||
@@ -113,0 +118,0 @@ hasError: boolean; |
@@ -1,1 +0,1 @@ | ||
import{__awaiter as e,__spreadArray as i,__decorate as t,__generator as r}from"../../_virtual/_tslib.js";import{action as s,observable as o,computed as n}from"mobx";import*as l from"lodash";import{AddressFormItem as d,BillingFormItem as a,LocalizedAddressModel as u}from"./model.js";var p=function(){function p(e){this._initialized=!1,this._isErrorsVisible=!1,this._currentLocale=e.currentLocale||"tr",this._currentCountry=e.currentCountry||"TR",this._invisibleAddressFields=e.invisibleAddressFields,this._invisibleBillingFields=e.invisibleBillingFields,this._address={firstName:"",lastName:"",identityNumber:"",addressLine1:"",addressLine2:"",postalCode:"",country:"",state:"",city:"",district:"",phone:"",company:"",taxOffice:"",taxNumber:""},this._validateAddressForm=void 0===e.validateAddressForm||e.validateAddressForm,this._validateBillingForm=void 0!==e.validateBillingForm&&e.validateBillingForm,this._customAddressFormSettings=e.customAddressFormSettings||{},this._message=e.message,this._localizedAddressModel=new u({currentLocale:this._currentLocale}),this.init()}return p.prototype.waitUntilInitialized=function(){var e=this;return new Promise((function(i){var t=setInterval((function(){e.initialized&&(clearInterval(t),i(null))}),100)}))},p.prototype.init=function(){return e(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this._localizedAddressModel.waitUntilInitialized()];case 1:return e.sent(),this._initialized=!0,[2]}}))}))},Object.defineProperty(p.prototype,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"address",{get:function(){return this._address},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isErrorsVisible",{get:function(){return this._isErrorsVisible},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"currentCountry",{get:function(){return this._currentCountry},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"addressFormat",{get:function(){return this._localizedAddressModel.getAddressFormat(this.currentCountry,this._invisibleAddressFields)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"addressFormatIgnoreCountry",{get:function(){return this._localizedAddressModel.getAddressFormatIgnoreCountry(this.currentCountry,this._invisibleAddressFields)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"billingFormat",{get:function(){return this._localizedAddressModel.getBillingFormat(this.currentCountry,this._invisibleBillingFields)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"fieldSettings",{get:function(){return this._localizedAddressModel.getFieldSettings({country:this.currentCountry,invisibleAddressFields:this._invisibleAddressFields,invisibleBillingFields:this._invisibleBillingFields,validateAddressForm:this._validateAddressForm,validateBillingForm:this._validateBillingForm,customAddressFormSettings:this._customAddressFormSettings})},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"fieldLabels",{get:function(){return this._localizedAddressModel.getFieldLabels(this.currentCountry)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isFreeTextCity",{get:function(){return this._localizedAddressModel.isFreeTextCity(this.currentCountry)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isFreeTextDistrict",{get:function(){return this._localizedAddressModel.isFreeTextDistrict(this.currentCountry)},enumerable:!1,configurable:!0}),p.prototype.changeCountry=function(e){this._currentCountry=e},p.prototype.changeAddress=function(e){this._address=e},p.prototype.changeValidateAddressForm=function(e){this._validateAddressForm=e},p.prototype.changeValidateBillingForm=function(e){this._validateBillingForm=e},p.prototype.changeInvisibleAddressFields=function(e){this._invisibleAddressFields=e},p.prototype.changeInvisibleBillingFields=function(e){this._invisibleBillingFields=e},p.prototype.changeCustomAddressFormSettings=function(e){this._customAddressFormSettings=e},p.prototype.validate=function(){this._isErrorsVisible=!0},p.prototype.resetValidate=function(){this._isErrorsVisible=!1},p.prototype.getPostalAddressFormat=function(e){var t=e.countryCode,r=e.address,s=e.isBillingAddress,o=void 0!==s&&s,n=e.identityNumberFormat;if(t){var l=this._localizedAddressModel.getAddressFormat(t,[d.COUNTRY,d.PHONE]),u=this._localizedAddressModel.getBillingFormat(t),p=[],c=[];return i(i([],l,!0),[[d.COUNTRY]],!1).map((function(e){var i=e.map((function(e){return e===d.FIRSTNAME?r.firstName:e===d.LASTNAME?r.lastName:e===d.IDENTITY_NUMBER?n&&r.identityNumber?n(r.identityNumber||""):r.identityNumber:e===d.ADDRESS_LINE_1?r.addressLine1:e===d.ADDRESS_LINE_2?r.addressLine2:e===d.POSTAL_CODE?r.postalCode:e===d.COUNTRY?r.country:e===d.STATE?r.state:e===d.CITY?r.city:e===d.DISTRICT?r.district:null})).join(" ");i&&p.push(i)})),o&&u.map((function(e){var i=e.map((function(e){return e===a.COMPANY?r.company:e===a.TAX_NUMBER?r.taxNumber:e===a.TAX_OFFICE?r.taxOffice:null})).join(" ");i&&c.push(i)})),c.map((function(e,i){p.splice(1+i,0,e)})),p}},Object.defineProperty(p.prototype,"validationResult",{get:function(){var e=this,i=this._localizedAddressModel.getValidationResult({country:this.currentCountry,address:this.address,invisibleAddressFields:this._invisibleAddressFields,invisibleBillingFields:this._invisibleBillingFields,validateAddressForm:this._validateAddressForm,validateBillingForm:this._validateBillingForm,customAddressFormSettings:this._customAddressFormSettings});if(i)return l.mapValues(i,(function(i,t){return{hasError:e._isErrorsVisible&&i.hasError,message:e._isErrorsVisible&&i.hasError?t===d.PHONE?e._message.phoneRule?"string"==typeof e._message.phoneRule?e._message.phoneRule:e._message.phoneRule(t,e.address):"":i.isEmpty?"string"==typeof e._message.requiredRule?e._message.requiredRule:e._message.requiredRule(t,e.address):"string"==typeof e._message.invalidRule?e._message.invalidRule:e._message.invalidRule(t,e.address):""}}))},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isValidAddress",{get:function(){return this._localizedAddressModel.isValidAddress({country:this.currentCountry,address:this.address,invisibleAddressFields:this._invisibleAddressFields,invisibleBillingFields:this._invisibleBillingFields,validateAddressForm:this._validateAddressForm,validateBillingForm:this._validateBillingForm,customAddressFormSettings:this._customAddressFormSettings})},enumerable:!1,configurable:!0}),t([o],p.prototype,"_initialized",void 0),t([o],p.prototype,"_currentLocale",void 0),t([o],p.prototype,"_currentCountry",void 0),t([o],p.prototype,"_invisibleAddressFields",void 0),t([o],p.prototype,"_invisibleBillingFields",void 0),t([o],p.prototype,"_address",void 0),t([o],p.prototype,"_validateAddressForm",void 0),t([o],p.prototype,"_validateBillingForm",void 0),t([o],p.prototype,"_customAddressFormSettings",void 0),t([o],p.prototype,"_isErrorsVisible",void 0),t([o],p.prototype,"_message",void 0),t([o],p.prototype,"_localizedAddressModel",void 0),t([s.bound],p.prototype,"waitUntilInitialized",null),t([s.bound],p.prototype,"init",null),t([n],p.prototype,"initialized",null),t([n],p.prototype,"address",null),t([n],p.prototype,"isErrorsVisible",null),t([n],p.prototype,"currentCountry",null),t([n],p.prototype,"addressFormat",null),t([n],p.prototype,"addressFormatIgnoreCountry",null),t([n],p.prototype,"billingFormat",null),t([n],p.prototype,"fieldSettings",null),t([n],p.prototype,"fieldLabels",null),t([n],p.prototype,"isFreeTextCity",null),t([n],p.prototype,"isFreeTextDistrict",null),t([s.bound],p.prototype,"changeCountry",null),t([s.bound],p.prototype,"changeAddress",null),t([s.bound],p.prototype,"changeValidateAddressForm",null),t([s.bound],p.prototype,"changeValidateBillingForm",null),t([s.bound],p.prototype,"changeInvisibleAddressFields",null),t([s.bound],p.prototype,"changeInvisibleBillingFields",null),t([s.bound],p.prototype,"changeCustomAddressFormSettings",null),t([s.bound],p.prototype,"validate",null),t([s.bound],p.prototype,"resetValidate",null),t([s.bound],p.prototype,"getPostalAddressFormat",null),t([n],p.prototype,"validationResult",null),t([n],p.prototype,"isValidAddress",null),p}();export{p as LocalizedAddress}; | ||
import{__awaiter as e,__spreadArray as i,__decorate as t,__generator as r}from"../../_virtual/_tslib.js";import{action as s,observable as o,computed as n}from"mobx";import*as l from"lodash";import{AddressFormItem as d,BillingFormItem as a,LocalizedAddressModel as u}from"./model.js";var p=function(){function p(e){this._initialized=!1,this._isErrorsVisible=!1,this._currentLocale=e.currentLocale||"tr",this._currentCountry=e.currentCountry||"TR",this._invisibleAddressFields=e.invisibleAddressFields,this._invisibleBillingFields=e.invisibleBillingFields,this._address={firstName:"",lastName:"",identityNumber:"",addressLine1:"",addressLine2:"",postalCode:"",country:"",state:"",city:"",district:"",phone:"",company:"",taxOffice:"",taxNumber:""},this._validateAddressForm=void 0===e.validateAddressForm||e.validateAddressForm,this._validateBillingForm=void 0!==e.validateBillingForm&&e.validateBillingForm,this._customAddressFormSettings=e.customAddressFormSettings||{},this._message=e.message,this._localizedAddressModel=new u({currentLocale:this._currentLocale}),this.init()}return p.prototype.waitUntilInitialized=function(){var e=this;return new Promise((function(i){var t=setInterval((function(){e.initialized&&(clearInterval(t),i(null))}),100)}))},p.prototype.init=function(){return e(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this._localizedAddressModel.waitUntilInitialized()];case 1:return e.sent(),this._initialized=!0,[2]}}))}))},Object.defineProperty(p.prototype,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"address",{get:function(){return this._address},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isErrorsVisible",{get:function(){return this._isErrorsVisible},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"currentCountry",{get:function(){return this._currentCountry},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"addressFormat",{get:function(){return this._localizedAddressModel.getAddressFormat(this.currentCountry,this._invisibleAddressFields)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"addressFormatIgnoreCountry",{get:function(){return this._localizedAddressModel.getAddressFormatIgnoreCountry(this.currentCountry,this._invisibleAddressFields)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"billingFormat",{get:function(){return this._localizedAddressModel.getBillingFormat(this.currentCountry,this._invisibleBillingFields)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"fieldSettings",{get:function(){return this._localizedAddressModel.getFieldSettings({country:this.currentCountry,invisibleAddressFields:this._invisibleAddressFields,invisibleBillingFields:this._invisibleBillingFields,validateAddressForm:this._validateAddressForm,validateBillingForm:this._validateBillingForm,customAddressFormSettings:this._customAddressFormSettings})},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"fieldLabels",{get:function(){return this._localizedAddressModel.getFieldLabels(this.currentCountry)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isFreeTextCity",{get:function(){return this._localizedAddressModel.isFreeTextCity(this.currentCountry)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isFreeTextDistrict",{get:function(){return this._localizedAddressModel.isFreeTextDistrict(this.currentCountry)},enumerable:!1,configurable:!0}),p.prototype.changeCountry=function(e){this._currentCountry=e},p.prototype.changeAddress=function(e){this._address=e},p.prototype.changeValidateAddressForm=function(e){this._validateAddressForm=e},p.prototype.changeValidateBillingForm=function(e){this._validateBillingForm=e},p.prototype.changeInvisibleAddressFields=function(e){this._invisibleAddressFields=e},p.prototype.changeInvisibleBillingFields=function(e){this._invisibleBillingFields=e},p.prototype.changeCustomAddressFormSettings=function(e){this._customAddressFormSettings=e},p.prototype.validate=function(){this._isErrorsVisible=!0},p.prototype.resetValidate=function(){this._isErrorsVisible=!1},p.prototype.getPostalAddressFormat=function(e){var t=e.countryCode,r=e.address,s=e.isBillingAddress,o=void 0!==s&&s,n=e.identityNumberFormat;if(t){var l=this._localizedAddressModel.getAddressFormat(t,[d.COUNTRY,d.PHONE]),u=this._localizedAddressModel.getBillingFormat(t),p=[],c=[];return i(i([],l,!0),[[d.COUNTRY]],!1).map((function(e){var i=e.map((function(e){return e===d.FIRSTNAME?r.firstName:e===d.LASTNAME?r.lastName:e===d.IDENTITY_NUMBER?n&&r.identityNumber?n(r.identityNumber||""):r.identityNumber:e===d.ADDRESS_LINE_1?r.addressLine1:e===d.ADDRESS_LINE_2?r.addressLine2:e===d.POSTAL_CODE?r.postalCode:e===d.COUNTRY?r.country:e===d.STATE?r.state:e===d.CITY?r.city:e===d.DISTRICT?r.district:e===d.REGION?r.region:null})).join(" ");i&&p.push(i)})),o&&u.map((function(e){var i=e.map((function(e){return e===a.COMPANY?r.company:e===a.TAX_NUMBER?r.taxNumber:e===a.TAX_OFFICE?r.taxOffice:null})).join(" ");i&&c.push(i)})),c.map((function(e,i){p.splice(1+i,0,e)})),p}},Object.defineProperty(p.prototype,"validationResult",{get:function(){var e=this,i=this._localizedAddressModel.getValidationResult({country:this.currentCountry,address:this.address,invisibleAddressFields:this._invisibleAddressFields,invisibleBillingFields:this._invisibleBillingFields,validateAddressForm:this._validateAddressForm,validateBillingForm:this._validateBillingForm,customAddressFormSettings:this._customAddressFormSettings});if(i)return l.mapValues(i,(function(i,t){return{hasError:e._isErrorsVisible&&i.hasError,message:e._isErrorsVisible&&i.hasError?t===d.PHONE?e._message.phoneRule?"string"==typeof e._message.phoneRule?e._message.phoneRule:e._message.phoneRule(t,e.address):"":i.isEmpty?"string"==typeof e._message.requiredRule?e._message.requiredRule:e._message.requiredRule(t,e.address):"string"==typeof e._message.invalidRule?e._message.invalidRule:e._message.invalidRule(t,e.address):""}}))},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isValidAddress",{get:function(){return this._localizedAddressModel.isValidAddress({country:this.currentCountry,address:this.address,invisibleAddressFields:this._invisibleAddressFields,invisibleBillingFields:this._invisibleBillingFields,validateAddressForm:this._validateAddressForm,validateBillingForm:this._validateBillingForm,customAddressFormSettings:this._customAddressFormSettings})},enumerable:!1,configurable:!0}),t([o],p.prototype,"_initialized",void 0),t([o],p.prototype,"_currentLocale",void 0),t([o],p.prototype,"_currentCountry",void 0),t([o],p.prototype,"_invisibleAddressFields",void 0),t([o],p.prototype,"_invisibleBillingFields",void 0),t([o],p.prototype,"_address",void 0),t([o],p.prototype,"_validateAddressForm",void 0),t([o],p.prototype,"_validateBillingForm",void 0),t([o],p.prototype,"_customAddressFormSettings",void 0),t([o],p.prototype,"_isErrorsVisible",void 0),t([o],p.prototype,"_message",void 0),t([o],p.prototype,"_localizedAddressModel",void 0),t([s.bound],p.prototype,"waitUntilInitialized",null),t([s.bound],p.prototype,"init",null),t([n],p.prototype,"initialized",null),t([n],p.prototype,"address",null),t([n],p.prototype,"isErrorsVisible",null),t([n],p.prototype,"currentCountry",null),t([n],p.prototype,"addressFormat",null),t([n],p.prototype,"addressFormatIgnoreCountry",null),t([n],p.prototype,"billingFormat",null),t([n],p.prototype,"fieldSettings",null),t([n],p.prototype,"fieldLabels",null),t([n],p.prototype,"isFreeTextCity",null),t([n],p.prototype,"isFreeTextDistrict",null),t([s.bound],p.prototype,"changeCountry",null),t([s.bound],p.prototype,"changeAddress",null),t([s.bound],p.prototype,"changeValidateAddressForm",null),t([s.bound],p.prototype,"changeValidateBillingForm",null),t([s.bound],p.prototype,"changeInvisibleAddressFields",null),t([s.bound],p.prototype,"changeInvisibleBillingFields",null),t([s.bound],p.prototype,"changeCustomAddressFormSettings",null),t([s.bound],p.prototype,"validate",null),t([s.bound],p.prototype,"resetValidate",null),t([s.bound],p.prototype,"getPostalAddressFormat",null),t([n],p.prototype,"validationResult",null),t([n],p.prototype,"isValidAddress",null),p}();export{p as LocalizedAddress}; |
@@ -25,2 +25,3 @@ export declare const COUNTRY_FORMS_LOCALES: string[]; | ||
district: AddressFormField; | ||
region: AddressFormField; | ||
phone: AddressFormField; | ||
@@ -46,2 +47,3 @@ company: AddressFormField; | ||
district: ErrorType; | ||
region: ErrorType; | ||
phone: ErrorType; | ||
@@ -89,2 +91,3 @@ company: ErrorType; | ||
district?: AddressFormFieldSettings; | ||
region?: AddressFormFieldSettings; | ||
phone?: AddressFormFieldSettings; | ||
@@ -116,2 +119,3 @@ company?: AddressFormFieldSettings; | ||
district?: string; | ||
region?: string; | ||
phone?: string; | ||
@@ -143,2 +147,3 @@ company?: string; | ||
district?: AddressFormField; | ||
region?: AddressFormField; | ||
phone?: AddressFormField; | ||
@@ -173,2 +178,3 @@ company?: AddressFormField; | ||
district?: AddressFormLabel; | ||
region?: AddressFormLabel; | ||
phone?: AddressFormLabel; | ||
@@ -194,2 +200,3 @@ company?: AddressFormLabel; | ||
DISTRICT = "district", | ||
REGION = "region", | ||
PHONE = "phone" | ||
@@ -196,0 +203,0 @@ } |
@@ -1,1 +0,1 @@ | ||
import{__awaiter as t,__spreadArray as e,__decorate as i,__generator as o}from"../../_virtual/_tslib.js";import{action as r,observable as d,computed as n}from"mobx";import*as l from"lodash";var s,u,a,v=["tr","de","en","it","es","fr","ru"],p=function(){function p(t){this._initialized=!1,this._currentLocale=t.currentLocale,this.init()}return p.prototype.init=function(){return t(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.getAddressFormCountrySettings()];case 1:return t.sent(),[4,this.getAddressFormCountryLabels()];case 2:return t.sent(),this._initialized=!0,[2]}}))}))},Object.defineProperty(p.prototype,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),p.prototype.waitUntilInitialized=function(){var t=this;return new Promise((function(e){var i=setInterval((function(){t.initialized&&(clearInterval(i),e(null))}),100)}))},p.prototype.getFieldSettings=function(t){var e,i,o,r,d,n,l,s,v,p,c,g,y,m,h,F,b,f,A,N,L,S,x,C,T,_,E,O,V,B,I,R,D,q,w,M,z,P,U=t.country,Y=t.invisibleAddressFields,j=void 0===Y?[]:Y,X=t.invisibleBillingFields,k=void 0===X?[]:X,H=t.validateAddressForm,W=void 0===H||H,$=t.validateBillingForm,G=void 0!==$&&$,J=t.customAddressFormSettings,K=void 0===J?{}:J,Q=this.getCountrySettings(U);if(Q){var Z=Q.fields,tt=this.getAddressFormat(U),et=this.getBillingFormat(U);return{firstName:this.getAddressFormSetting(!0,null===(e=Z.firstName)||void 0===e?void 0:e.type,null===(i=Z.firstName)||void 0===i?void 0:i.regex,u.FIRSTNAME,tt,j,W,null==K?void 0:K.firstName),lastName:this.getAddressFormSetting(!0,null===(o=Z.lastName)||void 0===o?void 0:o.type,null===(r=Z.lastName)||void 0===r?void 0:r.regex,u.LASTNAME,tt,j,W,null==K?void 0:K.lastName),identityNumber:this.getAddressFormSetting(null===(d=Z.identityNumber)||void 0===d?void 0:d.required,null===(n=Z.identityNumber)||void 0===n?void 0:n.type,null===(l=Z.identityNumber)||void 0===l?void 0:l.regex,u.IDENTITY_NUMBER,tt,j,W,null==K?void 0:K.identityNumber),addressLine1:this.getAddressFormSetting(!0,null===(s=Z.addressLine1)||void 0===s?void 0:s.type,null===(v=Z.addressLine1)||void 0===v?void 0:v.regex,u.ADDRESS_LINE_1,tt,j,W,null==K?void 0:K.addressLine1),addressLine2:this.getAddressFormSetting(null===(p=Z.addressLine2)||void 0===p?void 0:p.required,null===(c=Z.addressLine2)||void 0===c?void 0:c.type,null===(g=Z.addressLine2)||void 0===g?void 0:g.regex,u.ADDRESS_LINE_2,tt,j,W,null==K?void 0:K.addressLine2),postalCode:this.getAddressFormSetting(null===(y=Z.postalCode)||void 0===y?void 0:y.required,null===(m=Z.postalCode)||void 0===m?void 0:m.type,null===(h=Z.postalCode)||void 0===h?void 0:h.regex,u.POSTAL_CODE,tt,j,W,null==K?void 0:K.postalCode),country:this.getAddressFormSetting(!0,null===(F=Z.country)||void 0===F?void 0:F.type,null===(b=Z.country)||void 0===b?void 0:b.regex,u.COUNTRY,tt,j,W,null==K?void 0:K.country),state:this.getAddressFormSetting(null===(f=Z.state)||void 0===f?void 0:f.required,null===(A=Z.state)||void 0===A?void 0:A.type,null===(N=Z.state)||void 0===N?void 0:N.regex,u.STATE,tt,j,W,null==K?void 0:K.state),city:this.getAddressFormSetting(null===(L=Z.city)||void 0===L?void 0:L.required,null===(S=Z.city)||void 0===S?void 0:S.type,null===(x=Z.city)||void 0===x?void 0:x.regex,u.CITY,tt,j,W,null==K?void 0:K.city),district:this.getAddressFormSetting(null===(C=Z.district)||void 0===C?void 0:C.required,null===(T=Z.district)||void 0===T?void 0:T.type,null===(_=Z.district)||void 0===_?void 0:_.regex,u.DISTRICT,tt,j,W,null==K?void 0:K.district),phone:this.getAddressFormSetting(null===(E=Z.phone)||void 0===E?void 0:E.required,null===(O=Z.phone)||void 0===O?void 0:O.type,(null===(V=Z.phone)||void 0===V?void 0:V.regex)||/^\+?\d{10,}$/,u.PHONE,tt,j,W,null==K?void 0:K.phone),company:this.getBillingFormSetting(null===(B=Z.company)||void 0===B?void 0:B.required,null===(I=Z.company)||void 0===I?void 0:I.type,null===(R=Z.company)||void 0===R?void 0:R.regex,a.COMPANY,et,k,G,null==K?void 0:K.company),taxOffice:this.getBillingFormSetting(null===(D=Z.taxOffice)||void 0===D?void 0:D.required,null===(q=Z.taxOffice)||void 0===q?void 0:q.type,null===(w=Z.taxOffice)||void 0===w?void 0:w.regex,a.TAX_OFFICE,et,k,G,null==K?void 0:K.taxOffice),taxNumber:this.getBillingFormSetting(null===(M=Z.taxNumber)||void 0===M?void 0:M.required,null===(z=Z.taxNumber)||void 0===z?void 0:z.type,null===(P=Z.taxNumber)||void 0===P?void 0:P.regex,a.TAX_NUMBER,et,k,G,null==K?void 0:K.taxNumber)}}},p.prototype.getFieldLabels=function(t){var e,i,o,r,d,n,l,s,u,a,v,p,c,g,y,m,h,F,b,f,A,N,L,S,x,C,T,_,E=this.getCountryLabels(t);if(E){var O=E.fields;return{firstName:this.getAddressFormLabel(null===(e=O.firstName)||void 0===e?void 0:e.label,null===(i=O.firstName)||void 0===i?void 0:i.placeholder),lastName:this.getAddressFormLabel(null===(o=O.lastName)||void 0===o?void 0:o.label,null===(r=O.lastName)||void 0===r?void 0:r.placeholder),identityNumber:this.getAddressFormLabel(null===(d=O.identityNumber)||void 0===d?void 0:d.label,null===(n=O.identityNumber)||void 0===n?void 0:n.placeholder),addressLine1:this.getAddressFormLabel(null===(l=O.addressLine1)||void 0===l?void 0:l.label,null===(s=O.addressLine1)||void 0===s?void 0:s.placeholder),addressLine2:this.getAddressFormLabel(null===(u=O.addressLine2)||void 0===u?void 0:u.label,null===(a=O.addressLine2)||void 0===a?void 0:a.placeholder),postalCode:this.getAddressFormLabel(null===(v=O.postalCode)||void 0===v?void 0:v.label,null===(p=O.postalCode)||void 0===p?void 0:p.placeholder),country:this.getAddressFormLabel(null===(c=O.country)||void 0===c?void 0:c.label,null===(g=O.country)||void 0===g?void 0:g.placeholder),state:this.getAddressFormLabel(null===(y=O.state)||void 0===y?void 0:y.label,null===(m=O.state)||void 0===m?void 0:m.placeholder),city:this.getAddressFormLabel(null===(h=O.city)||void 0===h?void 0:h.label,null===(F=O.city)||void 0===F?void 0:F.placeholder),district:this.getAddressFormLabel(null===(b=O.district)||void 0===b?void 0:b.label,null===(f=O.district)||void 0===f?void 0:f.placeholder),phone:this.getAddressFormLabel(null===(A=O.phone)||void 0===A?void 0:A.label,null===(N=O.phone)||void 0===N?void 0:N.placeholder),company:this.getAddressFormLabel(null===(L=O.company)||void 0===L?void 0:L.label,null===(S=O.company)||void 0===S?void 0:S.placeholder),taxOffice:this.getAddressFormLabel(null===(x=O.taxOffice)||void 0===x?void 0:x.label,null===(C=O.taxOffice)||void 0===C?void 0:C.placeholder),taxNumber:this.getAddressFormLabel(null===(T=O.taxNumber)||void 0===T?void 0:T.label,null===(_=O.taxNumber)||void 0===_?void 0:_.placeholder)}}},p.prototype.getAddressFormat=function(t,e){var i=this.getCountrySettings(t),o=this.getAddressFormatView(i.addressFormat),r=[];return o&&e&&e.length&&o.map((function(t){return l.difference(t,e)})).map((function(t){t.length>0&&r.push(t)})),e&&e.length?r:o},p.prototype.getBillingFormat=function(t,e){var i=this.getCountrySettings(t),o=this.getBillingFormatView(i.billingFormat),r=[];return o&&e&&e.length&&o.map((function(t){return l.difference(t,e)})).map((function(t){t.length>0&&r.push(t)})),e&&e.length?r:o},p.prototype.getAddressFormatIgnoreCountry=function(t,i){return this.getAddressFormat(t,e(e([],i||[],!0),[u.COUNTRY],!1))},p.prototype.getValidationResult=function(t){var e=t.address,i=t.country,o=t.invisibleAddressFields,r=t.invisibleBillingFields,d=t.validateAddressForm,n=t.validateBillingForm,l=t.customAddressFormSettings,s=this.getFieldSettings({country:i,invisibleAddressFields:o,invisibleBillingFields:r,validateAddressForm:d,validateBillingForm:n,customAddressFormSettings:l});if(s)return{firstName:this.isValidField(e.firstName||"",s.firstName),lastName:this.isValidField(e.lastName||"",s.lastName),identityNumber:this.isValidField(e.identityNumber||"",s.identityNumber),addressLine1:this.isValidField(e.addressLine1||"",s.addressLine1),addressLine2:this.isValidField(e.addressLine2||"",s.addressLine2),postalCode:this.isValidField(e.postalCode||"",s.postalCode),country:this.isValidField(e.country||"",s.country),state:this.isValidField(e.state||"",s.state),city:this.isValidField(e.city||"",s.city),district:this.isValidField(e.district||"",s.district),phone:this.isValidField(e.phone||"",s.phone),company:this.isValidField(e.company||"",s.company),taxOffice:this.isValidField(e.taxOffice||"",s.taxOffice),taxNumber:this.isValidField(e.taxNumber||"",s.taxNumber)}},p.prototype.isValidAddress=function(t){var e=this.getValidationResult(t);return!!e&&Object.values(e).every((function(t){return!t.hasError}))},p.prototype.isValidField=function(t,e){var i=!1,o=!1,r=e.required||!1,d=e.regex||!1;return r&&!d&&(o=!t),r&&d&&(o=!t,i=!this.validateByRegexString(t,e.regex)),!r&&d&&t&&(i=!this.validateByRegexString(t,e.regex)),{hasError:i||o,isInvalid:i,isEmpty:o}},p.prototype.isFreeTextCity=function(t){var e=this.getFieldSettings({country:t});return e&&e.city&&e.city.type===s.TEXT},p.prototype.isFreeTextDistrict=function(t){var e=this.getFieldSettings({country:t});return e&&e.district&&e.district.type===s.TEXT},p.prototype.getCountrySettings=function(t){return this._addressFormCountrySettings.countrySettings[t]},p.prototype.getCountryLabels=function(t){return this._addressFormCountryLabels.countryLabels[t]},p.prototype.getAddressFormatView=function(t){return this._addressFormCountrySettings.addressFormats[t]},p.prototype.getBillingFormatView=function(t){return this._addressFormCountrySettings.billingFormats[t]},p.prototype.getAddressFormCountrySettings=function(){return t(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return"https://cdn.myikas.com/sf/static/location/settings.json",[4,fetch("https://cdn.myikas.com/sf/static/location/settings.json")];case 1:return[4,e.sent().json()];case 2:return t=e.sent(),this._addressFormCountrySettings=t,[2]}}))}))},p.prototype.getAddressFormCountryLabels=function(){return t(this,void 0,void 0,(function(){var t,e,i=this;return o(this,(function(o){switch(o.label){case 0:return v.find((function(t){return t===i._currentLocale}))||(this._currentLocale="en"),t="https://cdn.myikas.com/sf/static/location/".concat(this._currentLocale,".json"),[4,fetch(t)];case 1:return[4,o.sent().json()];case 2:return e=o.sent(),this._addressFormCountryLabels=e,[2]}}))}))},p.prototype.getAddressFormSetting=function(t,e,i,o,r,d,n,l){var s=(d||[]).some((function(t){return t===o}))||!(r||[]).some((function(t){return t.some((function(t){return t===o}))}));return{required:!!n&&(!s&&(void 0===(null==l?void 0:l.required)?t||!1:null==l?void 0:l.required)),type:void 0===(null==l?void 0:l.type)?e:null==l?void 0:l.type,regex:n?s?void 0:void 0===(null==l?void 0:l.regex)?i:null==l?void 0:l.regex:void 0}},p.prototype.getBillingFormSetting=function(t,e,i,o,r,d,n,l){var s=(d||[]).some((function(t){return t===o}))||!(r||[]).some((function(t){return t.some((function(t){return t===o}))}));return{required:!!n&&(!s&&(void 0===(null==l?void 0:l.required)?t||!1:null==l?void 0:l.required)),type:void 0===(null==l?void 0:l.type)?e:null==l?void 0:l.type,regex:n?s?void 0:void 0===(null==l?void 0:l.regex)?i:null==l?void 0:l.regex:void 0}},p.prototype.getAddressFormLabel=function(t,e){return{label:t,placeholder:e}},p.prototype.validateByRegexString=function(t,e){return new RegExp(e).test(t)},i([d],p.prototype,"_initialized",void 0),i([d],p.prototype,"_currentLocale",void 0),i([d],p.prototype,"_addressFormCountrySettings",void 0),i([d],p.prototype,"_addressFormCountryLabels",void 0),i([r.bound],p.prototype,"init",null),i([n],p.prototype,"initialized",null),i([r.bound],p.prototype,"waitUntilInitialized",null),i([r.bound],p.prototype,"getFieldSettings",null),i([r.bound],p.prototype,"getFieldLabels",null),i([r.bound],p.prototype,"getAddressFormat",null),i([r.bound],p.prototype,"getBillingFormat",null),i([r.bound],p.prototype,"getAddressFormatIgnoreCountry",null),i([r.bound],p.prototype,"getValidationResult",null),i([r.bound],p.prototype,"isValidAddress",null),i([r.bound],p.prototype,"isValidField",null),i([r.bound],p.prototype,"isFreeTextCity",null),i([r.bound],p.prototype,"isFreeTextDistrict",null),i([r.bound],p.prototype,"getCountrySettings",null),i([r.bound],p.prototype,"getCountryLabels",null),i([r.bound],p.prototype,"getAddressFormatView",null),i([r.bound],p.prototype,"getBillingFormatView",null),i([r.bound],p.prototype,"getAddressFormCountrySettings",null),i([r.bound],p.prototype,"getAddressFormCountryLabels",null),i([r.bound],p.prototype,"getAddressFormSetting",null),i([r.bound],p.prototype,"getBillingFormSetting",null),i([r.bound],p.prototype,"getAddressFormLabel",null),i([r.bound],p.prototype,"validateByRegexString",null),p}();!function(t){t.TEXT="text",t.DROPDOWN="dropdown"}(s||(s={})),function(t){t.FIRSTNAME="firstName",t.LASTNAME="lastName",t.IDENTITY_NUMBER="identityNumber",t.ADDRESS_LINE_1="addressLine1",t.ADDRESS_LINE_2="addressLine2",t.POSTAL_CODE="postalCode",t.COUNTRY="country",t.STATE="state",t.CITY="city",t.DISTRICT="district",t.PHONE="phone"}(u||(u={})),function(t){t.COMPANY="company",t.TAX_OFFICE="taxOffice",t.TAX_NUMBER="taxNumber"}(a||(a={}));export{u as AddressFormItem,a as BillingFormItem,v as COUNTRY_FORMS_LOCALES,s as IkasAddressFormInputType,p as LocalizedAddressModel}; | ||
import{__awaiter as e,__spreadArray as t,__decorate as i,__generator as o}from"../../_virtual/_tslib.js";import{action as r,observable as d,computed as n}from"mobx";import*as l from"lodash";var s,u,a,v=["tr","de","en","it","es","fr","ru"],p=function(){function p(e){this._initialized=!1,this._currentLocale=e.currentLocale,this.init()}return p.prototype.init=function(){return e(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.getAddressFormCountrySettings()];case 1:return e.sent(),[4,this.getAddressFormCountryLabels()];case 2:return e.sent(),this._initialized=!0,[2]}}))}))},Object.defineProperty(p.prototype,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),p.prototype.waitUntilInitialized=function(){var e=this;return new Promise((function(t){var i=setInterval((function(){e.initialized&&(clearInterval(i),t(null))}),100)}))},p.prototype.getFieldSettings=function(e){var t,i,o,r,d,n,l,s,v,p,g,c,y,m,h,F,b,f,A,N,L,S,x,C,T,E,_,O,V,I,R,B,q,D,w,M,z,P,U,Y,j,X=e.country,k=e.invisibleAddressFields,G=void 0===k?[]:k,H=e.invisibleBillingFields,W=void 0===H?[]:H,$=e.validateAddressForm,J=void 0===$||$,K=e.validateBillingForm,Q=void 0!==K&&K,Z=e.customAddressFormSettings,ee=void 0===Z?{}:Z,te=this.getCountrySettings(X);if(te){var ie=te.fields,oe=this.getAddressFormat(X),re=this.getBillingFormat(X);return{firstName:this.getAddressFormSetting(!0,null===(t=ie.firstName)||void 0===t?void 0:t.type,null===(i=ie.firstName)||void 0===i?void 0:i.regex,u.FIRSTNAME,oe,G,J,null==ee?void 0:ee.firstName),lastName:this.getAddressFormSetting(!0,null===(o=ie.lastName)||void 0===o?void 0:o.type,null===(r=ie.lastName)||void 0===r?void 0:r.regex,u.LASTNAME,oe,G,J,null==ee?void 0:ee.lastName),identityNumber:this.getAddressFormSetting(null===(d=ie.identityNumber)||void 0===d?void 0:d.required,null===(n=ie.identityNumber)||void 0===n?void 0:n.type,null===(l=ie.identityNumber)||void 0===l?void 0:l.regex,u.IDENTITY_NUMBER,oe,G,J,null==ee?void 0:ee.identityNumber),addressLine1:this.getAddressFormSetting(!0,null===(s=ie.addressLine1)||void 0===s?void 0:s.type,null===(v=ie.addressLine1)||void 0===v?void 0:v.regex,u.ADDRESS_LINE_1,oe,G,J,null==ee?void 0:ee.addressLine1),addressLine2:this.getAddressFormSetting(null===(p=ie.addressLine2)||void 0===p?void 0:p.required,null===(g=ie.addressLine2)||void 0===g?void 0:g.type,null===(c=ie.addressLine2)||void 0===c?void 0:c.regex,u.ADDRESS_LINE_2,oe,G,J,null==ee?void 0:ee.addressLine2),postalCode:this.getAddressFormSetting(null===(y=ie.postalCode)||void 0===y?void 0:y.required,null===(m=ie.postalCode)||void 0===m?void 0:m.type,null===(h=ie.postalCode)||void 0===h?void 0:h.regex,u.POSTAL_CODE,oe,G,J,null==ee?void 0:ee.postalCode),country:this.getAddressFormSetting(!0,null===(F=ie.country)||void 0===F?void 0:F.type,null===(b=ie.country)||void 0===b?void 0:b.regex,u.COUNTRY,oe,G,J,null==ee?void 0:ee.country),state:this.getAddressFormSetting(null===(f=ie.state)||void 0===f?void 0:f.required,null===(A=ie.state)||void 0===A?void 0:A.type,null===(N=ie.state)||void 0===N?void 0:N.regex,u.STATE,oe,G,J,null==ee?void 0:ee.state),city:this.getAddressFormSetting(null===(L=ie.city)||void 0===L?void 0:L.required,null===(S=ie.city)||void 0===S?void 0:S.type,null===(x=ie.city)||void 0===x?void 0:x.regex,u.CITY,oe,G,J,null==ee?void 0:ee.city),district:this.getAddressFormSetting(null===(C=ie.district)||void 0===C?void 0:C.required,null===(T=ie.district)||void 0===T?void 0:T.type,null===(E=ie.district)||void 0===E?void 0:E.regex,u.DISTRICT,oe,G,J,null==ee?void 0:ee.district),region:this.getAddressFormSetting(null===(_=ie.region)||void 0===_?void 0:_.required,null===(O=ie.region)||void 0===O?void 0:O.type,null===(V=ie.region)||void 0===V?void 0:V.regex,u.REGION,oe,G,J,null==ee?void 0:ee.region),phone:this.getAddressFormSetting(null===(I=ie.phone)||void 0===I?void 0:I.required,null===(R=ie.phone)||void 0===R?void 0:R.type,(null===(B=ie.phone)||void 0===B?void 0:B.regex)||/^\+?\d{10,}$/,u.PHONE,oe,G,J,null==ee?void 0:ee.phone),company:this.getBillingFormSetting(null===(q=ie.company)||void 0===q?void 0:q.required,null===(D=ie.company)||void 0===D?void 0:D.type,null===(w=ie.company)||void 0===w?void 0:w.regex,a.COMPANY,re,W,Q,null==ee?void 0:ee.company),taxOffice:this.getBillingFormSetting(null===(M=ie.taxOffice)||void 0===M?void 0:M.required,null===(z=ie.taxOffice)||void 0===z?void 0:z.type,null===(P=ie.taxOffice)||void 0===P?void 0:P.regex,a.TAX_OFFICE,re,W,Q,null==ee?void 0:ee.taxOffice),taxNumber:this.getBillingFormSetting(null===(U=ie.taxNumber)||void 0===U?void 0:U.required,null===(Y=ie.taxNumber)||void 0===Y?void 0:Y.type,null===(j=ie.taxNumber)||void 0===j?void 0:j.regex,a.TAX_NUMBER,re,W,Q,null==ee?void 0:ee.taxNumber)}}},p.prototype.getFieldLabels=function(e){var t,i,o,r,d,n,l,s,u,a,v,p,g,c,y,m,h,F,b,f,A,N,L,S,x,C,T,E,_=this.getCountryLabels(e);if(_){var O=_.fields;return{firstName:this.getAddressFormLabel(null===(t=O.firstName)||void 0===t?void 0:t.label,null===(i=O.firstName)||void 0===i?void 0:i.placeholder),lastName:this.getAddressFormLabel(null===(o=O.lastName)||void 0===o?void 0:o.label,null===(r=O.lastName)||void 0===r?void 0:r.placeholder),identityNumber:this.getAddressFormLabel(null===(d=O.identityNumber)||void 0===d?void 0:d.label,null===(n=O.identityNumber)||void 0===n?void 0:n.placeholder),addressLine1:this.getAddressFormLabel(null===(l=O.addressLine1)||void 0===l?void 0:l.label,null===(s=O.addressLine1)||void 0===s?void 0:s.placeholder),addressLine2:this.getAddressFormLabel(null===(u=O.addressLine2)||void 0===u?void 0:u.label,null===(a=O.addressLine2)||void 0===a?void 0:a.placeholder),postalCode:this.getAddressFormLabel(null===(v=O.postalCode)||void 0===v?void 0:v.label,null===(p=O.postalCode)||void 0===p?void 0:p.placeholder),country:this.getAddressFormLabel(null===(g=O.country)||void 0===g?void 0:g.label,null===(c=O.country)||void 0===c?void 0:c.placeholder),state:this.getAddressFormLabel(null===(y=O.state)||void 0===y?void 0:y.label,null===(m=O.state)||void 0===m?void 0:m.placeholder),city:this.getAddressFormLabel(null===(h=O.city)||void 0===h?void 0:h.label,null===(F=O.city)||void 0===F?void 0:F.placeholder),district:this.getAddressFormLabel(null===(b=O.district)||void 0===b?void 0:b.label,null===(f=O.district)||void 0===f?void 0:f.placeholder),phone:this.getAddressFormLabel(null===(A=O.phone)||void 0===A?void 0:A.label,null===(N=O.phone)||void 0===N?void 0:N.placeholder),company:this.getAddressFormLabel(null===(L=O.company)||void 0===L?void 0:L.label,null===(S=O.company)||void 0===S?void 0:S.placeholder),taxOffice:this.getAddressFormLabel(null===(x=O.taxOffice)||void 0===x?void 0:x.label,null===(C=O.taxOffice)||void 0===C?void 0:C.placeholder),taxNumber:this.getAddressFormLabel(null===(T=O.taxNumber)||void 0===T?void 0:T.label,null===(E=O.taxNumber)||void 0===E?void 0:E.placeholder)}}},p.prototype.getAddressFormat=function(e,t){var i=this.getCountrySettings(e),o=this.getAddressFormatView(i.addressFormat),r=[];return o&&t&&t.length&&o.map((function(e){return l.difference(e,t)})).map((function(e){e.length>0&&r.push(e)})),t&&t.length?r:o},p.prototype.getBillingFormat=function(e,t){var i=this.getCountrySettings(e),o=this.getBillingFormatView(i.billingFormat),r=[];return o&&t&&t.length&&o.map((function(e){return l.difference(e,t)})).map((function(e){e.length>0&&r.push(e)})),t&&t.length?r:o},p.prototype.getAddressFormatIgnoreCountry=function(e,i){return this.getAddressFormat(e,t(t([],i||[],!0),[u.COUNTRY],!1))},p.prototype.getValidationResult=function(e){var t=e.address,i=e.country,o=e.invisibleAddressFields,r=e.invisibleBillingFields,d=e.validateAddressForm,n=e.validateBillingForm,l=e.customAddressFormSettings,s=this.getFieldSettings({country:i,invisibleAddressFields:o,invisibleBillingFields:r,validateAddressForm:d,validateBillingForm:n,customAddressFormSettings:l});if(s)return{firstName:this.isValidField(t.firstName||"",s.firstName),lastName:this.isValidField(t.lastName||"",s.lastName),identityNumber:this.isValidField(t.identityNumber||"",s.identityNumber),addressLine1:this.isValidField(t.addressLine1||"",s.addressLine1),addressLine2:this.isValidField(t.addressLine2||"",s.addressLine2),postalCode:this.isValidField(t.postalCode||"",s.postalCode),country:this.isValidField(t.country||"",s.country),state:this.isValidField(t.state||"",s.state),city:this.isValidField(t.city||"",s.city),district:this.isValidField(t.district||"",s.district),region:this.isValidField(t.region||"",s.region),phone:this.isValidField(t.phone||"",s.phone),company:this.isValidField(t.company||"",s.company),taxOffice:this.isValidField(t.taxOffice||"",s.taxOffice),taxNumber:this.isValidField(t.taxNumber||"",s.taxNumber)}},p.prototype.isValidAddress=function(e){var t=this.getValidationResult(e);return!!t&&Object.values(t).every((function(e){return!e.hasError}))},p.prototype.isValidField=function(e,t){var i=!1,o=!1,r=t.required||!1,d=t.regex||!1;return r&&!d&&(o=!e),r&&d&&(o=!e,i=!this.validateByRegexString(e,t.regex)),!r&&d&&e&&(i=!this.validateByRegexString(e,t.regex)),{hasError:i||o,isInvalid:i,isEmpty:o}},p.prototype.isFreeTextCity=function(e){var t=this.getFieldSettings({country:e});return t&&t.city&&t.city.type===s.TEXT},p.prototype.isFreeTextDistrict=function(e){var t=this.getFieldSettings({country:e});return t&&t.district&&t.district.type===s.TEXT},p.prototype.getCountrySettings=function(e){return this._addressFormCountrySettings.countrySettings[e]},p.prototype.getCountryLabels=function(e){return this._addressFormCountryLabels.countryLabels[e]},p.prototype.getAddressFormatView=function(e){return this._addressFormCountrySettings.addressFormats[e]},p.prototype.getBillingFormatView=function(e){return this._addressFormCountrySettings.billingFormats[e]},p.prototype.getAddressFormCountrySettings=function(){return e(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return"https://cdn.myikas.com/sf/static/location/settings.json",[4,fetch("https://cdn.myikas.com/sf/static/location/settings.json")];case 1:return[4,t.sent().json()];case 2:return e=t.sent(),this._addressFormCountrySettings=e,[2]}}))}))},p.prototype.getAddressFormCountryLabels=function(){return e(this,void 0,void 0,(function(){var e,t,i=this;return o(this,(function(o){switch(o.label){case 0:return v.find((function(e){return e===i._currentLocale}))||(this._currentLocale="en"),e="https://cdn.myikas.com/sf/static/location/".concat(this._currentLocale,".json"),[4,fetch(e)];case 1:return[4,o.sent().json()];case 2:return t=o.sent(),this._addressFormCountryLabels=t,[2]}}))}))},p.prototype.getAddressFormSetting=function(e,t,i,o,r,d,n,l){var s=(d||[]).some((function(e){return e===o}))||!(r||[]).some((function(e){return e.some((function(e){return e===o}))}));return{required:!!n&&(!s&&(void 0===(null==l?void 0:l.required)?e||!1:null==l?void 0:l.required)),type:void 0===(null==l?void 0:l.type)?t:null==l?void 0:l.type,regex:n?s?void 0:void 0===(null==l?void 0:l.regex)?i:null==l?void 0:l.regex:void 0}},p.prototype.getBillingFormSetting=function(e,t,i,o,r,d,n,l){var s=(d||[]).some((function(e){return e===o}))||!(r||[]).some((function(e){return e.some((function(e){return e===o}))}));return{required:!!n&&(!s&&(void 0===(null==l?void 0:l.required)?e||!1:null==l?void 0:l.required)),type:void 0===(null==l?void 0:l.type)?t:null==l?void 0:l.type,regex:n?s?void 0:void 0===(null==l?void 0:l.regex)?i:null==l?void 0:l.regex:void 0}},p.prototype.getAddressFormLabel=function(e,t){return{label:e,placeholder:t}},p.prototype.validateByRegexString=function(e,t){return new RegExp(t).test(e)},i([d],p.prototype,"_initialized",void 0),i([d],p.prototype,"_currentLocale",void 0),i([d],p.prototype,"_addressFormCountrySettings",void 0),i([d],p.prototype,"_addressFormCountryLabels",void 0),i([r.bound],p.prototype,"init",null),i([n],p.prototype,"initialized",null),i([r.bound],p.prototype,"waitUntilInitialized",null),i([r.bound],p.prototype,"getFieldSettings",null),i([r.bound],p.prototype,"getFieldLabels",null),i([r.bound],p.prototype,"getAddressFormat",null),i([r.bound],p.prototype,"getBillingFormat",null),i([r.bound],p.prototype,"getAddressFormatIgnoreCountry",null),i([r.bound],p.prototype,"getValidationResult",null),i([r.bound],p.prototype,"isValidAddress",null),i([r.bound],p.prototype,"isValidField",null),i([r.bound],p.prototype,"isFreeTextCity",null),i([r.bound],p.prototype,"isFreeTextDistrict",null),i([r.bound],p.prototype,"getCountrySettings",null),i([r.bound],p.prototype,"getCountryLabels",null),i([r.bound],p.prototype,"getAddressFormatView",null),i([r.bound],p.prototype,"getBillingFormatView",null),i([r.bound],p.prototype,"getAddressFormCountrySettings",null),i([r.bound],p.prototype,"getAddressFormCountryLabels",null),i([r.bound],p.prototype,"getAddressFormSetting",null),i([r.bound],p.prototype,"getBillingFormSetting",null),i([r.bound],p.prototype,"getAddressFormLabel",null),i([r.bound],p.prototype,"validateByRegexString",null),p}();!function(e){e.TEXT="text",e.DROPDOWN="dropdown"}(s||(s={})),function(e){e.FIRSTNAME="firstName",e.LASTNAME="lastName",e.IDENTITY_NUMBER="identityNumber",e.ADDRESS_LINE_1="addressLine1",e.ADDRESS_LINE_2="addressLine2",e.POSTAL_CODE="postalCode",e.COUNTRY="country",e.STATE="state",e.CITY="city",e.DISTRICT="district",e.REGION="region",e.PHONE="phone"}(u||(u={})),function(e){e.COMPANY="company",e.TAX_OFFICE="taxOffice",e.TAX_NUMBER="taxNumber"}(a||(a={}));export{u as AddressFormItem,a as BillingFormItem,v as COUNTRY_FORMS_LOCALES,s as IkasAddressFormInputType,p as LocalizedAddressModel}; |
{ | ||
"name": "@ikas/localized-address", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"author": "ikas", | ||
@@ -37,2 +37,2 @@ "license": "ISC", | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36978
438