Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ikas/localized-address

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ikas/localized-address - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

4

build/models/address/index.d.ts

@@ -27,3 +27,3 @@ import { AddressFormItem, BillingFormItem, AddressForm, IkasAddressFormFields } from "./model";

private _customAddressFormSettings?;
private _isFormSubmit;
private _isErrorsVisible;
private _message;

@@ -36,3 +36,3 @@ private _localizedAddressModel;

get address(): AddressForm;
get isFormSubmit(): boolean;
get isErrorsVisible(): boolean;
get currentCountry(): string;

@@ -39,0 +39,0 @@ get addressFormat(): AddressFormItem[][];

@@ -1,1 +0,1 @@

import{__awaiter as e,__spreadArray as t,__decorate as i,__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._isFormSubmit=!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(t){var i=setInterval((function(){e.initialized&&(clearInterval(i),t(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,"isFormSubmit",{get:function(){return this._isFormSubmit},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(this.currentCountry,this._invisibleAddressFields,this._invisibleBillingFields,this._validateAddressForm,this._validateBillingForm,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._isFormSubmit=!0},p.prototype.resetValidate=function(){this._isFormSubmit=!1},p.prototype.getPostalAddressFormat=function(e){var i=e.countryCode,r=e.address,s=e.isBillingAddress,o=void 0!==s&&s,n=e.identityNumberFormat;if(i){var l=this._localizedAddressModel.getAddressFormat(i,[d.COUNTRY,d.PHONE]),u=this._localizedAddressModel.getBillingFormat(i),p=[],c=[];return t(t([],l,!0),[[d.COUNTRY]],!1).map((function(e){var t=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(" ");t&&p.push(t)})),o&&u.map((function(e){var t=e.map((function(e){return e===a.COMPANY?r.company:e===a.TAX_NUMBER?r.taxNumber:e===a.TAX_OFFICE?r.taxOffice:null})).join(" ");t&&c.push(t)})),c.map((function(e,t){p.splice(1+t,0,e)})),p}},Object.defineProperty(p.prototype,"validationResult",{get:function(){var e=this,t=this._localizedAddressModel.getValidationResult(this.currentCountry,this.address,this._invisibleAddressFields,this._invisibleBillingFields,this._validateAddressForm,this._validateBillingForm,this._customAddressFormSettings);if(t)return l.mapValues(t,(function(t,i){return{hasError:e._isFormSubmit&&t.hasError,message:e._isFormSubmit&&t.hasError?i===d.PHONE?e._message.phoneRule?"string"==typeof e._message.phoneRule?e._message.phoneRule:e._message.phoneRule(i,e.address):"":t.isEmpty?"string"==typeof e._message.requiredRule?e._message.requiredRule:e._message.requiredRule(i,e.address):"string"==typeof e._message.invalidRule?e._message.invalidRule:e._message.invalidRule(i,e.address):""}}))},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isValidAddress",{get:function(){return this._localizedAddressModel.isValidAddress(this.currentCountry,this.address,this._invisibleAddressFields,this._invisibleBillingFields,this._validateAddressForm,this._validateBillingForm,this._customAddressFormSettings)},enumerable:!1,configurable:!0}),i([o],p.prototype,"_initialized",void 0),i([o],p.prototype,"_currentLocale",void 0),i([o],p.prototype,"_currentCountry",void 0),i([o],p.prototype,"_invisibleAddressFields",void 0),i([o],p.prototype,"_invisibleBillingFields",void 0),i([o],p.prototype,"_address",void 0),i([o],p.prototype,"_validateAddressForm",void 0),i([o],p.prototype,"_validateBillingForm",void 0),i([o],p.prototype,"_customAddressFormSettings",void 0),i([o],p.prototype,"_isFormSubmit",void 0),i([o],p.prototype,"_message",void 0),i([o],p.prototype,"_localizedAddressModel",void 0),i([s.bound],p.prototype,"waitUntilInitialized",null),i([s.bound],p.prototype,"init",null),i([n],p.prototype,"initialized",null),i([n],p.prototype,"address",null),i([n],p.prototype,"isFormSubmit",null),i([n],p.prototype,"currentCountry",null),i([n],p.prototype,"addressFormat",null),i([n],p.prototype,"addressFormatIgnoreCountry",null),i([n],p.prototype,"billingFormat",null),i([n],p.prototype,"fieldSettings",null),i([n],p.prototype,"fieldLabels",null),i([n],p.prototype,"isFreeTextCity",null),i([n],p.prototype,"isFreeTextDistrict",null),i([s.bound],p.prototype,"changeCountry",null),i([s.bound],p.prototype,"changeAddress",null),i([s.bound],p.prototype,"changeValidateAddressForm",null),i([s.bound],p.prototype,"changeValidateBillingForm",null),i([s.bound],p.prototype,"changeInvisibleAddressFields",null),i([s.bound],p.prototype,"changeInvisibleBillingFields",null),i([s.bound],p.prototype,"changeCustomAddressFormSettings",null),i([s.bound],p.prototype,"validate",null),i([s.bound],p.prototype,"resetValidate",null),i([s.bound],p.prototype,"getPostalAddressFormat",null),i([n],p.prototype,"validationResult",null),i([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: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};

@@ -14,3 +14,3 @@ export declare const COUNTRY_FORMS_LOCALES: string[];

waitUntilInitialized(): Promise<unknown>;
getFieldSettings(country: string, _invisibleAddressFields?: AddressFormItem[], _invisibleBillingFields?: BillingFormItem[], _validateAddressForm?: boolean, _validateBillingForm?: boolean, _customAddressFormSettings?: CustomAddressFormSettings): {
getFieldSettings(fieldSettingsParams: FieldSettingsParams): {
firstName: AddressFormField;

@@ -35,3 +35,3 @@ lastName: AddressFormField;

getAddressFormatIgnoreCountry(country: string, invisibleFields?: AddressFormItem[]): AddressFormItem[][];
getValidationResult(country: string, address: AddressForm, _invisibleAddressFields?: AddressFormItem[], _invisibleBillingFields?: BillingFormItem[], _validateAddressForm?: boolean, _validateBillingForm?: boolean, _customAddressFormSettings?: CustomAddressFormSettings): {
getValidationResult(validationResultParams: ValidationResultParams): {
firstName: ErrorType;

@@ -52,3 +52,3 @@ lastName: ErrorType;

} | undefined;
isValidAddress(country: string, address: AddressForm, _invisibleAddressFields?: AddressFormItem[], _invisibleBillingFields?: BillingFormItem[], _validateAddressForm?: boolean, _validateBillingForm?: boolean, _customAddressFormSettings?: CustomAddressFormSettings): boolean;
isValidAddress(validationResultParams: ValidationResultParams): boolean;
isValidField(value: string, fieldSettings: AddressFormField): ErrorType;

@@ -68,2 +68,13 @@ isFreeTextCity(country: string): boolean | undefined;

}
type FieldSettingsParams = {
country: string;
invisibleAddressFields?: AddressFormItem[];
invisibleBillingFields?: BillingFormItem[];
validateAddressForm?: boolean;
validateBillingForm?: boolean;
customAddressFormSettings?: CustomAddressFormSettings;
};
type ValidationResultParams = {
address: AddressForm;
} & FieldSettingsParams;
export type CustomAddressFormSettings = {

@@ -188,1 +199,2 @@ firstName?: AddressFormFieldSettings;

}
export {};

@@ -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,e,i,o,r,d){var n,l,s,v,p,c,g,y,m,h,f,b,F,N,A,L,x,S,C,T,_,E,O,V,I,R,B,D,q,w,M,z,P,U,Y,j,X,k,H=this.getCountrySettings(t);if(H){var W=H.fields,$=this.getAddressFormat(t),G=this.getBillingFormat(t);return{firstName:this.getAddressFormSetting(!0,null===(n=W.firstName)||void 0===n?void 0:n.type,null===(l=W.firstName)||void 0===l?void 0:l.regex,u.FIRSTNAME,$,e,o,null==d?void 0:d.firstName),lastName:this.getAddressFormSetting(!0,null===(s=W.lastName)||void 0===s?void 0:s.type,null===(v=W.lastName)||void 0===v?void 0:v.regex,u.LASTNAME,$,e,o,null==d?void 0:d.lastName),identityNumber:this.getAddressFormSetting(null===(p=W.identityNumber)||void 0===p?void 0:p.required,null===(c=W.identityNumber)||void 0===c?void 0:c.type,null===(g=W.identityNumber)||void 0===g?void 0:g.regex,u.IDENTITY_NUMBER,$,e,o,null==d?void 0:d.identityNumber),addressLine1:this.getAddressFormSetting(!0,null===(y=W.addressLine1)||void 0===y?void 0:y.type,null===(m=W.addressLine1)||void 0===m?void 0:m.regex,u.ADDRESS_LINE_1,$,e,o,null==d?void 0:d.addressLine1),addressLine2:this.getAddressFormSetting(null===(h=W.addressLine2)||void 0===h?void 0:h.required,null===(f=W.addressLine2)||void 0===f?void 0:f.type,null===(b=W.addressLine2)||void 0===b?void 0:b.regex,u.ADDRESS_LINE_2,$,e,o,null==d?void 0:d.addressLine2),postalCode:this.getAddressFormSetting(null===(F=W.postalCode)||void 0===F?void 0:F.required,null===(N=W.postalCode)||void 0===N?void 0:N.type,null===(A=W.postalCode)||void 0===A?void 0:A.regex,u.POSTAL_CODE,$,e,o,null==d?void 0:d.postalCode),country:this.getAddressFormSetting(!0,null===(L=W.country)||void 0===L?void 0:L.type,null===(x=W.country)||void 0===x?void 0:x.regex,u.COUNTRY,$,e,o,null==d?void 0:d.country),state:this.getAddressFormSetting(null===(S=W.state)||void 0===S?void 0:S.required,null===(C=W.state)||void 0===C?void 0:C.type,null===(T=W.state)||void 0===T?void 0:T.regex,u.STATE,$,e,o,null==d?void 0:d.state),city:this.getAddressFormSetting(null===(_=W.city)||void 0===_?void 0:_.required,null===(E=W.city)||void 0===E?void 0:E.type,null===(O=W.city)||void 0===O?void 0:O.regex,u.CITY,$,e,o,null==d?void 0:d.city),district:this.getAddressFormSetting(null===(V=W.district)||void 0===V?void 0:V.required,null===(I=W.district)||void 0===I?void 0:I.type,null===(R=W.district)||void 0===R?void 0:R.regex,u.DISTRICT,$,e,o,null==d?void 0:d.district),phone:this.getAddressFormSetting(null===(B=W.phone)||void 0===B?void 0:B.required,null===(D=W.phone)||void 0===D?void 0:D.type,(null===(q=W.phone)||void 0===q?void 0:q.regex)||/^\+?\d{10,}$/,u.PHONE,$,e,o,null==d?void 0:d.phone),company:this.getBillingFormSetting(null===(w=W.company)||void 0===w?void 0:w.required,null===(M=W.company)||void 0===M?void 0:M.type,null===(z=W.company)||void 0===z?void 0:z.regex,a.COMPANY,G,i,r,null==d?void 0:d.company),taxOffice:this.getBillingFormSetting(null===(P=W.taxOffice)||void 0===P?void 0:P.required,null===(U=W.taxOffice)||void 0===U?void 0:U.type,null===(Y=W.taxOffice)||void 0===Y?void 0:Y.regex,a.TAX_OFFICE,G,i,r,null==d?void 0:d.taxOffice),taxNumber:this.getBillingFormSetting(null===(j=W.taxNumber)||void 0===j?void 0:j.required,null===(X=W.taxNumber)||void 0===X?void 0:X.type,null===(k=W.taxNumber)||void 0===k?void 0:k.regex,a.TAX_NUMBER,G,i,r,null==d?void 0:d.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,N,A,L,x,S,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===(N=O.phone)||void 0===N?void 0:N.label,null===(A=O.phone)||void 0===A?void 0:A.placeholder),company:this.getAddressFormLabel(null===(L=O.company)||void 0===L?void 0:L.label,null===(x=O.company)||void 0===x?void 0:x.placeholder),taxOffice:this.getAddressFormLabel(null===(S=O.taxOffice)||void 0===S?void 0:S.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,e,i,o,r,d,n){var l=this.getFieldSettings(t,i,o,r,d,n);if(l)return{firstName:this.isValidField(e.firstName||"",l.firstName),lastName:this.isValidField(e.lastName||"",l.lastName),identityNumber:this.isValidField(e.identityNumber||"",l.identityNumber),addressLine1:this.isValidField(e.addressLine1||"",l.addressLine1),addressLine2:this.isValidField(e.addressLine2||"",l.addressLine2),postalCode:this.isValidField(e.postalCode||"",l.postalCode),country:this.isValidField(e.country||"",l.country),state:this.isValidField(e.state||"",l.state),city:this.isValidField(e.city||"",l.city),district:this.isValidField(e.district||"",l.district),phone:this.isValidField(e.phone||"",l.phone),company:this.isValidField(e.company||"",l.company),taxOffice:this.isValidField(e.taxOffice||"",l.taxOffice),taxNumber:this.isValidField(e.taxNumber||"",l.taxNumber)}},p.prototype.isValidAddress=function(t,e,i,o,r,d,n){var l=this.getValidationResult(t,e,i,o,r,d,n);return!!l&&Object.values(l).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(t);return e&&e.city&&e.city.type===s.TEXT},p.prototype.isFreeTextDistrict=function(t){var e=this.getFieldSettings(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 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};
{
"name": "@ikas/localized-address",
"version": "1.0.2",
"version": "1.0.3",
"author": "ikas",

@@ -5,0 +5,0 @@ "license": "ISC",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc