@ikas/storefront 5.0.0-beta.33 → 5.0.0-beta.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/_virtual/lodash.js +1 -0
- package/build/analytics/analytics.js +1 -1
- package/build/analytics/googleAnalytics.js +1 -1
- package/build/analytics/googleTagManager.js +1 -1
- package/build/analytics/ikas.js +1 -1
- package/build/analytics/tiktokPixel.js +1 -1
- package/build/components/checkout/components/address-form/index.js +1 -1
- package/build/components/checkout/components/address-form/model.js +1 -1
- package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
- package/build/components/checkout/components/customer-addresses/model.js +1 -1
- package/build/components/checkout/components/phone-number-input/get-countries.js +1 -1
- package/build/components/checkout/components/phone-number-input/index.js +1 -1
- package/build/components/checkout/components/quick-registration/model.js +1 -1
- package/build/components/checkout/index.js +1 -1
- package/build/components/checkout/model.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
- package/build/components/checkout/steps/step-success/index.js +1 -1
- package/build/components/google-captcha/index.js +1 -1
- package/build/components/page/ThemeComponent.js +1 -1
- package/build/components/page/head.js +1 -1
- package/build/components/page/index.js +1 -1
- package/build/components/page-editor/ThemeComponentEditor.js +1 -1
- package/build/components/page-editor/model.js +1 -1
- package/build/hooks/useCustomerReviews.js +1 -1
- package/build/index.js +1 -1
- package/build/models/data/customer/address/ikas-localized-customer-address.js +1 -1
- package/build/models/data/order/address/ikas-localized-order-address.js +1 -1
- package/build/models/data/product/campaign-offer/index.js +1 -1
- package/build/models/data/product/variant/index.js +1 -1
- package/build/models/ui/blog-category-list/index.js +1 -1
- package/build/models/ui/brand-list/index.js +1 -1
- package/build/models/ui/category-list/index.js +1 -1
- package/build/models/ui/customer-review-list/index.js +1 -1
- package/build/models/ui/customer-review-summary-list/index.js +1 -1
- package/build/models/ui/product-list/index.js +1 -1
- package/build/models/ui/raffle-list/index.js +1 -1
- package/build/models/ui/validator/form/account-info.js +1 -1
- package/build/models/ui/validator/form/address.js +1 -1
- package/build/models/ui/validator/form/contact-form.js +1 -1
- package/build/models/ui/validator/form/customer-review.js +1 -1
- package/build/models/ui/validator/form/forgot-password.js +1 -1
- package/build/models/ui/validator/form/ikas-address.js +1 -1
- package/build/models/ui/validator/form/login.js +1 -1
- package/build/models/ui/validator/form/raffle-form.js +1 -1
- package/build/models/ui/validator/form/recover-password.js +1 -1
- package/build/models/ui/validator/form/register.js +1 -1
- package/build/node_modules/@ikas/localized-address/build/_virtual/_tslib.js +1 -0
- package/build/node_modules/@ikas/localized-address/build/models/address/index.js +1 -0
- package/build/node_modules/@ikas/localized-address/build/models/address/model.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouType.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternMatcher.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternParser.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.complete.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.util.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouTypeParser.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouTypeState.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/ParseError.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/PhoneNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/constants.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/format.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/formatIncompletePhoneNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/getCountries.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/RFC3966.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/getNumberType.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/isObject.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/mergeArrays.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/parseDigits.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/isPossible.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/isValid.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/metadata.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/normalizeArguments.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/parse.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/parsePhoneNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/tools/semver-compare.js +1 -0
- package/build/node_modules/libphonenumber-js/metadata.min.json.js +1 -0
- package/build/node_modules/libphonenumber-js/min/exports/formatIncompletePhoneNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/min/exports/getCountries.js +1 -0
- package/build/node_modules/libphonenumber-js/min/exports/getCountryCallingCode.js +1 -0
- package/build/node_modules/libphonenumber-js/min/exports/isSupportedCountry.js +1 -0
- package/build/node_modules/libphonenumber-js/min/exports/parsePhoneNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/min/exports/withMetadataArgument.js +1 -0
- package/build/node_modules/lodash/lodash.js +9 -0
- package/build/pages/checkout/index.page.js +1 -1
- package/build/providers/page-data-init.js +1 -1
- package/build/providers/prop-value/blog-category-list.js +1 -1
- package/build/providers/prop-value/blog-list.js +1 -1
- package/build/providers/prop-value/brand-list.js +1 -1
- package/build/providers/prop-value/category-list.js +1 -1
- package/build/providers/prop-value/product-list.js +1 -1
- package/build/providers/prop-value/raffle-list.js +1 -1
- package/build/store/blog/index.js +1 -1
- package/build/store/brand/index.js +1 -1
- package/build/store/cart/index.js +1 -1
- package/build/store/category/index.js +1 -1
- package/build/store/checkout/index.js +1 -1
- package/build/store/customer/api.js +1 -1
- package/build/store/customer/index.js +1 -1
- package/build/store/html-meta-data/index.js +1 -1
- package/build/store/location/index.js +1 -1
- package/build/store/product/index.js +1 -1
- package/package.json +12 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeObservable as e,computed as t,observable as s,action as o}from"mobx";import{Validator as i}from"../index.js";import{IkasBaseStore as r}from"../../../../store/base.js";import"../../../../node_modules/lodash/xorBy.js";import"../../../../node_modules/lodash/_baseClone.js";import"../../../../node_modules/@ikas/storefront-api/build/index.js";import"../../../data/blog/meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/category/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import{IkasCustomerAttributeRegisterPageRequirement as d}from"../../../../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import{IkasCustomerAttributeType as a}from"../../../../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../../../../node_modules/lodash/sortBy.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import"../../../../node_modules/@ikas/storefront-config/build/index.js";import"../../../data/brand/index.js";import"../../../data/html-meta-data/index.js";import"../../../data/category/conditions/index.js";import"@ikas/localized-address";import"../../blog-list/index.js";import"../../blog-category-list/index.js";import"../../brand-list/index.js";import"../../category-list/index.js";import"../../product-list/index.js";import"../../../../node_modules/lodash/_defineProperty.js";import"../../../../node_modules/lodash/isArguments.js";import"../../../../node_modules/lodash/isBuffer.js";import"../../../../node_modules/lodash/isTypedArray.js";import"../../../../node_modules/lodash/_baseGetTag.js";import"../../../../node_modules/lodash/_Stack.js";import"../../../../node_modules/lodash/_SetCache.js";import"../../../../node_modules/lodash/_equalByTag.js";import"../../../../node_modules/lodash/_getTag.js";import"../../../../node_modules/lodash/_stringToPath.js";import"../../../../node_modules/lodash/_baseToString.js";import{RequiredRule as l,EmailRule as m,MinRule as n,PhoneRule as u}from"../rules/index.js";import"fs";import"path";import"../../../../node_modules/lodash/_isFlattenable.js";import"../../../../analytics/analytics.js";import"../../../../analytics/head/index.js";import"../../../../store/cart/index.js";class p{constructor(r){this.model={firstName:"",lastName:"",email:"",password:"",attributes:void 0,isMarketingAccepted:!1,phone:null},this.isFormSubmit=!1,this._customerAttributes=void 0,this.validatorRules=(e=!1)=>[new l({fieldKey:"firstName",valuePath:"firstName",message:this.message.requiredRule}),new l({fieldKey:"lastName",valuePath:"lastName",message:this.message.requiredRule}),new l({fieldKey:"email",valuePath:"email",message:this.message.requiredRule}),new l({fieldKey:"password",valuePath:"password",message:this.message.requiredRule}),new m({fieldKey:"email",valuePath:"email",message:this.message.emailRule}),new n({fieldKey:"password",valuePath:"password",minValue:6,message:this.message.minRule}),...e?[new u({fieldKey:"phone",valuePath:"phone",message:this.message.phoneRule})]:[]],this.onFirstNameChange=e=>{this.firstName=e},this.onLastNameChange=e=>{this.lastName=e},this.onEmailChange=e=>{this.email=e},this.onPasswordChange=e=>{this.password=e},this.onPhoneChange=e=>{this.phone=e},this.setCustomerAttributes=e=>{this._customerAttributes=e?.filter((e=>e.registerPageRequirement!==d.INVISIBLE)).map((e=>({attribute:e,attributeValue:{isChecked:void 0,value:void 0,selectedIdList:void 0},validator:{isRequired:e.registerPageRequirement===d.MANDATORY,hasError:!1,message:""}})))||[]},this.onAttributeChange=(e,t)=>{if(!this._customerAttributes)return;const s=this._customerAttributes.find((t=>t.attribute.id===e));if(s){const o=this._customerAttributes?.findIndex((t=>t.attribute.id===e));void 0!==o&&-1!==o&&(this._customerAttributes[o].attributeValue=this.getAttributeValue(s.attribute,t),this.validateCustomerAttribute())}},e(this,{emailErrorMessage:t,passwordErrorMessage:t,firstNameErrorMessage:t,lastNameErrorMessage:t,phoneErrorMessage:t,hasError:t,redirect:t,model:s,validateAll:o,register:o,customerAttributes:t,_customerAttributes:s}),this.message=r.message,this.validator=new i(this.model,this.validatorRules())}get firstName(){return this.model.firstName}set firstName(e){this.model.firstName=e}get lastName(){return this.model.lastName}set lastName(e){this.model.lastName=e}get email(){return this.model.email}set email(e){this.model.email=e}get password(){return this.model.password}set password(e){this.model.password=e}get isMarketingAccepted(){return this.model.isMarketingAccepted}set isMarketingAccepted(e){this.model.isMarketingAccepted=e}get phone(){return this.model.phone}set phone(e){this.model.phone=e}get hasError(){return this.validator.hasError}get firstNameErrorMessage(){return this.validator.results.firstName.errorMessage}get lastNameErrorMessage(){return this.validator.results.lastName.errorMessage}get emailErrorMessage(){return this.validator.results.email.errorMessage}get passwordErrorMessage(){return this.validator.results.password.errorMessage}get phoneErrorMessage(){return this.validator.results.phone?.errorMessage}get attributes(){return this.model.attributes}set attributes(e){this.model.attributes=e}get redirect(){if("undefined"!=typeof window){return new URLSearchParams(window.location.search).get("redirect")}}get customerAttributes(){return this._customerAttributes}getAttributeValue(e,t){const s={isChecked:void 0,value:void 0,selectedIdList:void 0};if("string"!=typeof t||e.type!==a.TEXT&&e.type!==a.DATETIME&&e.type!==a.CHOICE||(s.value=t),"string"==typeof t&&e.type===a.NUMERIC){const e=parseInt(t);isNaN(e)?s.value=s.value||"":s.value=t}return"boolean"==typeof t&&e.type===a.BOOLEAN&&(s.isChecked=t),"object"==typeof t&&e.type===a.MULTIPLE_CHOICE&&(s.selectedIdList=t),s}get formattedAttributesInput(){if(!this._customerAttributes)return null;if(!this._customerAttributes.some((e=>void 0!==e.attributeValue.value||void 0!==e.attributeValue.isChecked||void 0!==e.attributeValue.selectedIdList)))return null;const e=[];return this._customerAttributes.map((t=>{const{selectedIdList:s,isChecked:o,value:i}=t.attributeValue;void 0!==s&&a.MULTIPLE_CHOICE&&s.map((s=>{e.push({customerAttributeId:t.attribute.id,customerAttributeOptionId:s,value:null})})),t.attribute.type===a.BOOLEAN&&e.push({customerAttributeId:t.attribute.id,customerAttributeOptionId:null,value:o?o.toString():"false"}),void 0!==i&&(t.attribute.type!==a.TEXT&&t.attribute.type!==a.NUMERIC||e.push({customerAttributeId:t.attribute.id,customerAttributeOptionId:null,value:i.toString()}),t.attribute.type===a.CHOICE&&e.push({customerAttributeId:t.attribute.id,customerAttributeOptionId:i,value:null}),t.attribute.type===a.DATETIME&&e.push({customerAttributeId:t.attribute.id,customerAttributeOptionId:null,value:new Date(i).getTime().toString()}))})),e}validateCustomerAttribute(){this._customerAttributes=this._customerAttributes?.map((e=>(e.validator.isRequired&&this.isFormSubmit&&(e.attribute.type===a.BOOLEAN||e.attributeValue.value||e.attributeValue.selectedIdList?.length?(e.validator.hasError=!1,e.validator.message=""):(e.validator.hasError=!0,e.validator.message="string"==typeof this.message.requiredRule?this.message.requiredRule:this.message.requiredRule(this.model))),e)))}async validateAll(){this.validateCustomerAttribute();const e=await this.validator.validateAll(),t=this._customerAttributes?.some((e=>e.validator.hasError));return e||t}async register(){this.isFormSubmit=!0;const e={isFormError:!1,isSuccess:!1,errorCodes:[]};this.email&&(this.email=this.email.trim()),this.phone&&this.validator.setRules(this.validatorRules(!0));if(await this.validateAll())return e.isFormError=!0,e;try{const t=await r.getInstance().customerStore.register(this.model.firstName,this.model.lastName,this.model.email,this.model.password,this.model.isMarketingAccepted,this.model.attributes||this.formattedAttributesInput||void 0,this.model.phone);return{...e,...t}}catch{return e}}}export{p as RegisterForm};
|
|
1
|
+
import{makeObservable as e,computed as t,observable as s,action as o}from"mobx";import{Validator as i}from"../index.js";import{IkasBaseStore as r}from"../../../../store/base.js";import"../../../../node_modules/lodash/xorBy.js";import"../../../../node_modules/lodash/_baseClone.js";import"../../../../node_modules/@ikas/storefront-api/build/index.js";import"../../../data/blog/meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/category/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import{IkasCustomerAttributeRegisterPageRequirement as d}from"../../../../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import{IkasCustomerAttributeType as a}from"../../../../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../../../../node_modules/lodash/sortBy.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import"../../../../node_modules/@ikas/storefront-config/build/index.js";import"../../../data/brand/index.js";import"../../../data/html-meta-data/index.js";import"../../../data/category/conditions/index.js";import"../../../../node_modules/@ikas/localized-address/build/models/address/index.js";import"../../../../node_modules/@ikas/localized-address/build/models/address/model.js";import"../../blog-list/index.js";import"../../blog-category-list/index.js";import"../../brand-list/index.js";import"../../category-list/index.js";import"../../product-list/index.js";import"../../../../node_modules/lodash/_defineProperty.js";import"../../../../node_modules/lodash/isArguments.js";import"../../../../node_modules/lodash/isBuffer.js";import"../../../../node_modules/lodash/isTypedArray.js";import"../../../../node_modules/lodash/_baseGetTag.js";import"../../../../node_modules/lodash/_Stack.js";import"../../../../node_modules/lodash/_SetCache.js";import"../../../../node_modules/lodash/_equalByTag.js";import"../../../../node_modules/lodash/_getTag.js";import"../../../../node_modules/lodash/_stringToPath.js";import"../../../../node_modules/lodash/_baseToString.js";import{RequiredRule as l,EmailRule as m,MinRule as n,PhoneRule as u}from"../rules/index.js";import"fs";import"path";import"../../../../node_modules/lodash/_isFlattenable.js";import"../../../../analytics/analytics.js";import"../../../../analytics/head/index.js";import"../../../../store/cart/index.js";class p{constructor(r){this.model={firstName:"",lastName:"",email:"",password:"",attributes:void 0,isMarketingAccepted:!1,phone:null},this.isFormSubmit=!1,this._customerAttributes=void 0,this.validatorRules=(e=!1)=>[new l({fieldKey:"firstName",valuePath:"firstName",message:this.message.requiredRule}),new l({fieldKey:"lastName",valuePath:"lastName",message:this.message.requiredRule}),new l({fieldKey:"email",valuePath:"email",message:this.message.requiredRule}),new l({fieldKey:"password",valuePath:"password",message:this.message.requiredRule}),new m({fieldKey:"email",valuePath:"email",message:this.message.emailRule}),new n({fieldKey:"password",valuePath:"password",minValue:6,message:this.message.minRule}),...e?[new u({fieldKey:"phone",valuePath:"phone",message:this.message.phoneRule})]:[]],this.onFirstNameChange=e=>{this.firstName=e},this.onLastNameChange=e=>{this.lastName=e},this.onEmailChange=e=>{this.email=e},this.onPasswordChange=e=>{this.password=e},this.onPhoneChange=e=>{this.phone=e},this.setCustomerAttributes=e=>{this._customerAttributes=e?.filter((e=>e.registerPageRequirement!==d.INVISIBLE)).map((e=>({attribute:e,attributeValue:{isChecked:void 0,value:void 0,selectedIdList:void 0},validator:{isRequired:e.registerPageRequirement===d.MANDATORY,hasError:!1,message:""}})))||[]},this.onAttributeChange=(e,t)=>{if(!this._customerAttributes)return;const s=this._customerAttributes.find((t=>t.attribute.id===e));if(s){const o=this._customerAttributes?.findIndex((t=>t.attribute.id===e));void 0!==o&&-1!==o&&(this._customerAttributes[o].attributeValue=this.getAttributeValue(s.attribute,t),this.validateCustomerAttribute())}},e(this,{emailErrorMessage:t,passwordErrorMessage:t,firstNameErrorMessage:t,lastNameErrorMessage:t,phoneErrorMessage:t,hasError:t,redirect:t,model:s,validateAll:o,register:o,customerAttributes:t,_customerAttributes:s}),this.message=r.message,this.validator=new i(this.model,this.validatorRules())}get firstName(){return this.model.firstName}set firstName(e){this.model.firstName=e}get lastName(){return this.model.lastName}set lastName(e){this.model.lastName=e}get email(){return this.model.email}set email(e){this.model.email=e}get password(){return this.model.password}set password(e){this.model.password=e}get isMarketingAccepted(){return this.model.isMarketingAccepted}set isMarketingAccepted(e){this.model.isMarketingAccepted=e}get phone(){return this.model.phone}set phone(e){this.model.phone=e}get hasError(){return this.validator.hasError}get firstNameErrorMessage(){return this.validator.results.firstName.errorMessage}get lastNameErrorMessage(){return this.validator.results.lastName.errorMessage}get emailErrorMessage(){return this.validator.results.email.errorMessage}get passwordErrorMessage(){return this.validator.results.password.errorMessage}get phoneErrorMessage(){return this.validator.results.phone?.errorMessage}get attributes(){return this.model.attributes}set attributes(e){this.model.attributes=e}get redirect(){if("undefined"!=typeof window){return new URLSearchParams(window.location.search).get("redirect")}}get customerAttributes(){return this._customerAttributes}getAttributeValue(e,t){const s={isChecked:void 0,value:void 0,selectedIdList:void 0};if("string"!=typeof t||e.type!==a.TEXT&&e.type!==a.DATETIME&&e.type!==a.CHOICE||(s.value=t),"string"==typeof t&&e.type===a.NUMERIC){const e=parseInt(t);isNaN(e)?s.value=s.value||"":s.value=t}return"boolean"==typeof t&&e.type===a.BOOLEAN&&(s.isChecked=t),"object"==typeof t&&e.type===a.MULTIPLE_CHOICE&&(s.selectedIdList=t),s}get formattedAttributesInput(){if(!this._customerAttributes)return null;if(!this._customerAttributes.some((e=>void 0!==e.attributeValue.value||void 0!==e.attributeValue.isChecked||void 0!==e.attributeValue.selectedIdList)))return null;const e=[];return this._customerAttributes.map((t=>{const{selectedIdList:s,isChecked:o,value:i}=t.attributeValue;void 0!==s&&a.MULTIPLE_CHOICE&&s.map((s=>{e.push({customerAttributeId:t.attribute.id,customerAttributeOptionId:s,value:null})})),t.attribute.type===a.BOOLEAN&&e.push({customerAttributeId:t.attribute.id,customerAttributeOptionId:null,value:o?o.toString():"false"}),void 0!==i&&(t.attribute.type!==a.TEXT&&t.attribute.type!==a.NUMERIC||e.push({customerAttributeId:t.attribute.id,customerAttributeOptionId:null,value:i.toString()}),t.attribute.type===a.CHOICE&&e.push({customerAttributeId:t.attribute.id,customerAttributeOptionId:i,value:null}),t.attribute.type===a.DATETIME&&e.push({customerAttributeId:t.attribute.id,customerAttributeOptionId:null,value:new Date(i).getTime().toString()}))})),e}validateCustomerAttribute(){this._customerAttributes=this._customerAttributes?.map((e=>(e.validator.isRequired&&this.isFormSubmit&&(e.attribute.type===a.BOOLEAN||e.attributeValue.value||e.attributeValue.selectedIdList?.length?(e.validator.hasError=!1,e.validator.message=""):(e.validator.hasError=!0,e.validator.message="string"==typeof this.message.requiredRule?this.message.requiredRule:this.message.requiredRule(this.model))),e)))}async validateAll(){this.validateCustomerAttribute();const e=await this.validator.validateAll(),t=this._customerAttributes?.some((e=>e.validator.hasError));return e||t}async register(){this.isFormSubmit=!0;const e={isFormError:!1,isSuccess:!1,errorCodes:[]};this.email&&(this.email=this.email.trim()),this.phone&&this.validator.setRules(this.validatorRules(!0));if(await this.validateAll())return e.isFormError=!0,e;try{const t=await r.getInstance().customerStore.register(this.model.firstName,this.model.lastName,this.model.email,this.model.password,this.model.isMarketingAccepted,this.model.attributes||this.formattedAttributesInput||void 0,this.model.phone);return{...e,...t}}catch{return e}}}export{p as RegisterForm};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,n,t,r){return new(t||(t=Promise))((function(o,a){function l(e){try{i(r.next(e))}catch(e){a(e)}}function c(e){try{i(r.throw(e))}catch(e){a(e)}}function i(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(l,c)}i((r=r.apply(e,n||[])).next())}))}function n(e,n){var t,r,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(i){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(l=0)),l;)try{if(t=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,r=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!((o=(o=l.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){l=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){l.label=c[1];break}if(6===c[0]&&l.label<o[1]){l.label=o[1],o=c;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(c);break}o[2]&&l.ops.pop(),l.trys.pop();continue}c=n.call(e,l)}catch(e){c=[6,e],r=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}function t(e,n,t){if(t||2===arguments.length)for(var r,o=0,a=n.length;o<a;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}export{e as __awaiter,n as __generator,t as __spreadArray};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as e,__spreadArray as i,__generator as t}from"../../_virtual/_tslib.js";import{makeAutoObservable as s}from"mobx";import{l as r}from"../../../../../lodash/lodash.js";import{AddressFormItem as n,BillingFormItem as d,LocalizedAddressModel as o}from"./model.js";!function(){function l(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 o({currentLocale:this._currentLocale}),this.init(),s(this)}l.prototype.waitUntilInitialized=function(){var e=this;return new Promise((function(i){var t=setInterval((function(){e.initialized&&(clearInterval(t),i(null))}),100)}))},l.prototype.init=function(){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,this._localizedAddressModel.waitUntilInitialized()];case 1:return e.sent(),this._initialized=!0,[2]}}))}))},Object.defineProperty(l.prototype,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"address",{get:function(){return this._address},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"isErrorsVisible",{get:function(){return this._isErrorsVisible},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"currentCountry",{get:function(){return this._currentCountry},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"addressFormat",{get:function(){return this._localizedAddressModel.getAddressFormat(this.currentCountry,this._invisibleAddressFields)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"addressFormatIgnoreCountry",{get:function(){return this._localizedAddressModel.getAddressFormatIgnoreCountry(this.currentCountry,this._invisibleAddressFields)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"billingFormat",{get:function(){return this._localizedAddressModel.getBillingFormat(this.currentCountry,this._invisibleBillingFields)},enumerable:!1,configurable:!0}),Object.defineProperty(l.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(l.prototype,"fieldLabels",{get:function(){return this._localizedAddressModel.getFieldLabels(this.currentCountry)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"isFreeTextCity",{get:function(){return this._localizedAddressModel.isFreeTextCity(this.currentCountry)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"isFreeTextDistrict",{get:function(){return this._localizedAddressModel.isFreeTextDistrict(this.currentCountry)},enumerable:!1,configurable:!0}),l.prototype.changeCountry=function(e){this._currentCountry=e},l.prototype.changeAddress=function(e){this._address=e},l.prototype.changeValidateAddressForm=function(e){this._validateAddressForm=e},l.prototype.changeValidateBillingForm=function(e){this._validateBillingForm=e},l.prototype.changeInvisibleAddressFields=function(e){this._invisibleAddressFields=e},l.prototype.changeInvisibleBillingFields=function(e){this._invisibleBillingFields=e},l.prototype.changeCustomAddressFormSettings=function(e){this._customAddressFormSettings=e},l.prototype.validate=function(){this._isErrorsVisible=!0},l.prototype.resetValidate=function(){this._isErrorsVisible=!1},l.prototype.getPostalAddressFormat=function(e){var t=e.countryCode,s=e.address,r=e.isBillingAddress,o=void 0!==r&&r,l=e.identityNumberFormat;if(t){var a=this._localizedAddressModel.getAddressFormat(t,[n.COUNTRY,n.PHONE]),u=this._localizedAddressModel.getBillingFormat(t),c=[],m=[];return i(i([],a,!0),[[n.COUNTRY]],!1).map((function(e){var i=e.map((function(e){return e===n.FIRSTNAME?s.firstName:e===n.LASTNAME?s.lastName:e===n.IDENTITY_NUMBER?l&&s.identityNumber?l(s.identityNumber||""):s.identityNumber:e===n.ADDRESS_LINE_1?s.addressLine1:e===n.ADDRESS_LINE_2?s.addressLine2:e===n.POSTAL_CODE?s.postalCode:e===n.COUNTRY?s.country:e===n.STATE?s.state:e===n.CITY?s.city:e===n.DISTRICT?s.district:e===n.REGION?s.region:null})).join(" ");i&&c.push(i)})),o&&u.map((function(e){var i=e.map((function(e){return e===d.COMPANY?s.company:e===d.TAX_NUMBER?s.taxNumber:e===d.TAX_OFFICE?s.taxOffice:null})).join(" ");i&&m.push(i)})),m.map((function(e,i){c.splice(1+i,0,e)})),c}},Object.defineProperty(l.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 r.mapValues(i,(function(i,t){return{hasError:e._isErrorsVisible&&i.hasError,message:e._isErrorsVisible&&i.hasError?t===n.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(l.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})}();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as e,__spreadArray as i,__generator as t}from"../../_virtual/_tslib.js";import{makeAutoObservable as r}from"mobx";import{l as o}from"../../../../../lodash/lodash.js";var d,n,s,l=["tr","de","en","it","es","fr","ru"],a=function(){function a(e){this._initialized=!1,this._currentLocale=e.currentLocale,this.init(),r(this)}return a.prototype.init=function(){return e(this,void 0,void 0,(function(){return t(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(a.prototype,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),a.prototype.waitUntilInitialized=function(){var e=this;return new Promise((function(i){var t=setInterval((function(){e.initialized&&(clearInterval(t),i(null))}),100)}))},a.prototype.getFieldSettings=function(e){var i,t,r,o,d,l,a,u,v,c,g,m,p,y,h,F,f,b,A,N,L,S,x,C,_,T,E,O,I,R,V,B,q,D,w,M,Y,P,U,j,z,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,ie=this.getCountrySettings(X);if(ie){var te=ie.fields,re=this.getAddressFormat(X),oe=this.getBillingFormat(X);return{firstName:this.getAddressFormSetting(!0,null===(i=te.firstName)||void 0===i?void 0:i.type,null===(t=te.firstName)||void 0===t?void 0:t.regex,n.FIRSTNAME,re,G,J,null==ee?void 0:ee.firstName),lastName:this.getAddressFormSetting(!0,null===(r=te.lastName)||void 0===r?void 0:r.type,null===(o=te.lastName)||void 0===o?void 0:o.regex,n.LASTNAME,re,G,J,null==ee?void 0:ee.lastName),identityNumber:this.getAddressFormSetting(null===(d=te.identityNumber)||void 0===d?void 0:d.required,null===(l=te.identityNumber)||void 0===l?void 0:l.type,null===(a=te.identityNumber)||void 0===a?void 0:a.regex,n.IDENTITY_NUMBER,re,G,J,null==ee?void 0:ee.identityNumber),addressLine1:this.getAddressFormSetting(!0,null===(u=te.addressLine1)||void 0===u?void 0:u.type,null===(v=te.addressLine1)||void 0===v?void 0:v.regex,n.ADDRESS_LINE_1,re,G,J,null==ee?void 0:ee.addressLine1),addressLine2:this.getAddressFormSetting(null===(c=te.addressLine2)||void 0===c?void 0:c.required,null===(g=te.addressLine2)||void 0===g?void 0:g.type,null===(m=te.addressLine2)||void 0===m?void 0:m.regex,n.ADDRESS_LINE_2,re,G,J,null==ee?void 0:ee.addressLine2),postalCode:this.getAddressFormSetting(null===(p=te.postalCode)||void 0===p?void 0:p.required,null===(y=te.postalCode)||void 0===y?void 0:y.type,null===(h=te.postalCode)||void 0===h?void 0:h.regex,n.POSTAL_CODE,re,G,J,null==ee?void 0:ee.postalCode),country:this.getAddressFormSetting(!0,null===(F=te.country)||void 0===F?void 0:F.type,null===(f=te.country)||void 0===f?void 0:f.regex,n.COUNTRY,re,G,J,null==ee?void 0:ee.country),state:this.getAddressFormSetting(null===(b=te.state)||void 0===b?void 0:b.required,null===(A=te.state)||void 0===A?void 0:A.type,null===(N=te.state)||void 0===N?void 0:N.regex,n.STATE,re,G,J,null==ee?void 0:ee.state),city:this.getAddressFormSetting(null===(L=te.city)||void 0===L?void 0:L.required,null===(S=te.city)||void 0===S?void 0:S.type,null===(x=te.city)||void 0===x?void 0:x.regex,n.CITY,re,G,J,null==ee?void 0:ee.city),district:this.getAddressFormSetting(null===(C=te.district)||void 0===C?void 0:C.required,null===(_=te.district)||void 0===_?void 0:_.type,null===(T=te.district)||void 0===T?void 0:T.regex,n.DISTRICT,re,G,J,null==ee?void 0:ee.district),region:this.getAddressFormSetting(null===(E=te.region)||void 0===E?void 0:E.required,null===(O=te.region)||void 0===O?void 0:O.type,null===(I=te.region)||void 0===I?void 0:I.regex,n.REGION,re,G,J,null==ee?void 0:ee.region),phone:this.getAddressFormSetting(null===(R=te.phone)||void 0===R?void 0:R.required,null===(V=te.phone)||void 0===V?void 0:V.type,(null===(B=te.phone)||void 0===B?void 0:B.regex)||/^\+?\d{10,}$/,n.PHONE,re,G,J,null==ee?void 0:ee.phone),company:this.getBillingFormSetting(null===(q=te.company)||void 0===q?void 0:q.required,null===(D=te.company)||void 0===D?void 0:D.type,null===(w=te.company)||void 0===w?void 0:w.regex,s.COMPANY,oe,W,Q,null==ee?void 0:ee.company),taxOffice:this.getBillingFormSetting(null===(M=te.taxOffice)||void 0===M?void 0:M.required,null===(Y=te.taxOffice)||void 0===Y?void 0:Y.type,null===(P=te.taxOffice)||void 0===P?void 0:P.regex,s.TAX_OFFICE,oe,W,Q,null==ee?void 0:ee.taxOffice),taxNumber:this.getBillingFormSetting(null===(U=te.taxNumber)||void 0===U?void 0:U.required,null===(j=te.taxNumber)||void 0===j?void 0:j.type,null===(z=te.taxNumber)||void 0===z?void 0:z.regex,s.TAX_NUMBER,oe,W,Q,null==ee?void 0:ee.taxNumber)}}},a.prototype.getFieldLabels=function(e){var i,t,r,o,d,n,s,l,a,u,v,c,g,m,p,y,h,F,f,b,A,N,L,S,x,C,_,T,E=this.getCountryLabels(e);if(E){var O=E.fields;return{firstName:this.getAddressFormLabel(null===(i=O.firstName)||void 0===i?void 0:i.label,null===(t=O.firstName)||void 0===t?void 0:t.placeholder),lastName:this.getAddressFormLabel(null===(r=O.lastName)||void 0===r?void 0:r.label,null===(o=O.lastName)||void 0===o?void 0:o.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===(s=O.addressLine1)||void 0===s?void 0:s.label,null===(l=O.addressLine1)||void 0===l?void 0:l.placeholder),addressLine2:this.getAddressFormLabel(null===(a=O.addressLine2)||void 0===a?void 0:a.label,null===(u=O.addressLine2)||void 0===u?void 0:u.placeholder),postalCode:this.getAddressFormLabel(null===(v=O.postalCode)||void 0===v?void 0:v.label,null===(c=O.postalCode)||void 0===c?void 0:c.placeholder),country:this.getAddressFormLabel(null===(g=O.country)||void 0===g?void 0:g.label,null===(m=O.country)||void 0===m?void 0:m.placeholder),state:this.getAddressFormLabel(null===(p=O.state)||void 0===p?void 0:p.label,null===(y=O.state)||void 0===y?void 0:y.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===(f=O.district)||void 0===f?void 0:f.label,null===(b=O.district)||void 0===b?void 0:b.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===(_=O.taxNumber)||void 0===_?void 0:_.label,null===(T=O.taxNumber)||void 0===T?void 0:T.placeholder)}}},a.prototype.getAddressFormat=function(e,i){var t=this.getCountrySettings(e),r=this.getAddressFormatView(t.addressFormat),d=[];return r&&i&&i.length&&r.map((function(e){return o.difference(e,i)})).map((function(e){e.length>0&&d.push(e)})),i&&i.length?d:r},a.prototype.getBillingFormat=function(e,i){var t=this.getCountrySettings(e),r=this.getBillingFormatView(t.billingFormat),d=[];return r&&i&&i.length&&r.map((function(e){return o.difference(e,i)})).map((function(e){e.length>0&&d.push(e)})),i&&i.length?d:r},a.prototype.getAddressFormatIgnoreCountry=function(e,t){return this.getAddressFormat(e,i(i([],t||[],!0),[n.COUNTRY],!1))},a.prototype.getValidationResult=function(e){var i=e.address,t=e.country,r=e.invisibleAddressFields,o=e.invisibleBillingFields,d=e.validateAddressForm,n=e.validateBillingForm,s=e.customAddressFormSettings,l=this.getFieldSettings({country:t,invisibleAddressFields:r,invisibleBillingFields:o,validateAddressForm:d,validateBillingForm:n,customAddressFormSettings:s});if(l)return{firstName:this.isValidField(i.firstName||"",l.firstName),lastName:this.isValidField(i.lastName||"",l.lastName),identityNumber:this.isValidField(i.identityNumber||"",l.identityNumber),addressLine1:this.isValidField(i.addressLine1||"",l.addressLine1),addressLine2:this.isValidField(i.addressLine2||"",l.addressLine2),postalCode:this.isValidField(i.postalCode||"",l.postalCode),country:this.isValidField(i.country||"",l.country),state:this.isValidField(i.state||"",l.state),city:this.isValidField(i.city||"",l.city),district:this.isValidField(i.district||"",l.district),region:this.isValidField(i.region||"",l.region),phone:this.isValidField(i.phone||"",l.phone),company:this.isValidField(i.company||"",l.company),taxOffice:this.isValidField(i.taxOffice||"",l.taxOffice),taxNumber:this.isValidField(i.taxNumber||"",l.taxNumber)}},a.prototype.isValidAddress=function(e){var i=this.getValidationResult(e);return!!i&&Object.values(i).every((function(e){return!e.hasError}))},a.prototype.isValidField=function(e,i){var t=!1,r=!1,o=i.required||!1,d=i.regex||!1;return o&&!d&&(r=!e),o&&d&&(r=!e,t=!this.validateByRegexString(e,i.regex)),!o&&d&&e&&(t=!this.validateByRegexString(e,i.regex)),{hasError:t||r,isInvalid:t,isEmpty:r}},a.prototype.isFreeTextCity=function(e){var i=this.getFieldSettings({country:e});return i&&i.city&&i.city.type===d.TEXT},a.prototype.isFreeTextDistrict=function(e){var i=this.getFieldSettings({country:e});return i&&i.district&&i.district.type===d.TEXT},a.prototype.getCountrySettings=function(e){return this._addressFormCountrySettings.countrySettings[e]},a.prototype.getCountryLabels=function(e){return this._addressFormCountryLabels.countryLabels[e]},a.prototype.getAddressFormatView=function(e){return this._addressFormCountrySettings.addressFormats[e]},a.prototype.getBillingFormatView=function(e){return this._addressFormCountrySettings.billingFormats[e]},a.prototype.getAddressFormCountrySettings=function(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(i){switch(i.label){case 0:return[4,fetch("https://cdn.myikas.com/sf/static/location/settings.json")];case 1:return[4,i.sent().json()];case 2:return e=i.sent(),this._addressFormCountrySettings=e,[2]}}))}))},a.prototype.getAddressFormCountryLabels=function(){return e(this,void 0,void 0,(function(){var e,i,r=this;return t(this,(function(t){switch(t.label){case 0:return l.find((function(e){return e===r._currentLocale}))||(this._currentLocale="en"),e="https://cdn.myikas.com/sf/static/location/".concat(this._currentLocale,".json"),[4,fetch(e)];case 1:return[4,t.sent().json()];case 2:return i=t.sent(),this._addressFormCountryLabels=i,[2]}}))}))},a.prototype.getAddressFormSetting=function(e,i,t,r,o,d,n,s){var l=(d||[]).some((function(e){return e===r}))||!(o||[]).some((function(e){return e.some((function(e){return e===r}))}));return{required:!!n&&!l&&(void 0===(null==s?void 0:s.required)?e||!1:null==s?void 0:s.required),type:void 0===(null==s?void 0:s.type)?i:null==s?void 0:s.type,regex:n?l?void 0:void 0===(null==s?void 0:s.regex)?t:null==s?void 0:s.regex:void 0}},a.prototype.getBillingFormSetting=function(e,i,t,r,o,d,n,s){var l=(d||[]).some((function(e){return e===r}))||!(o||[]).some((function(e){return e.some((function(e){return e===r}))}));return{required:!!n&&!l&&(void 0===(null==s?void 0:s.required)?e||!1:null==s?void 0:s.required),type:void 0===(null==s?void 0:s.type)?i:null==s?void 0:s.type,regex:n?l?void 0:void 0===(null==s?void 0:s.regex)?t:null==s?void 0:s.regex:void 0}},a.prototype.getAddressFormLabel=function(e,i){return{label:e,placeholder:i}},a.prototype.validateByRegexString=function(e,i){return new RegExp(i).test(e)},a}();!function(e){e.TEXT="text",e.DROPDOWN="dropdown"}(d||(d={})),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"}(n||(n={})),function(e){e.COMPANY="company",e.TAX_OFFICE="taxOffice",e.TAX_NUMBER="taxNumber"}(s||(s={}));export{n as AddressFormItem,s as BillingFormItem,l as COUNTRY_FORMS_LOCALES,d as IkasAddressFormInputType,a as LocalizedAddressModel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"./metadata.js";import e from"./PhoneNumber.js";import a from"./AsYouTypeState.js";import n from"./AsYouTypeFormatter.js";import r from"./AsYouTypeParser.js";import i from"./helpers/getCountryByCallingCode.js";import o from"./helpers/getCountryByNationalNumber.js";import u from"./helpers/isObject.js";import{DIGIT_PLACEHOLDER as s}from"./AsYouTypeFormatter.util.js";function l(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var n,r,i=[],o=!0,u=!1;try{for(a=a.call(t);!(o=(n=a.next()).done)&&(i.push(n.value),!e||i.length!==e);o=!0);}catch(t){u=!0,r=t}finally{try{o||null==a.return||a.return()}finally{if(u)throw r}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return f(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return f(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,n=new Array(e);a<e;a++)n[a]=t[a];return n}function h(t,e){for(var a=0;a<e.length;a++){var n=e[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var m=function(){function f(e,a){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,f),this.metadata=new t(a);var n=l(this.getCountryAndCallingCode(e),2),r=n[0],i=n[1];this.defaultCountry=r,this.defaultCallingCode=i,this.reset()}var m,d,g;return m=f,(d=[{key:"getCountryAndCallingCode",value:function(t){var e,a;return t&&(u(t)?(e=t.defaultCountry,a=t.defaultCallingCode):e=t),e&&!this.metadata.hasCountry(e)&&(e=void 0),[e,a]}},{key:"input",value:function(t){var e=this.parser.input(t,this.state),a=e.digits;if(e.justLeadingPlus)this.formattedOutput="+";else if(a){var n;if(this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state),this.metadata.hasSelectedNumberingPlan()&&(n=this.formatter.format(a,this.state)),void 0===n&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var r=this.state.getNationalDigits();r&&(n=this.formatter.format(r,this.state))}this.formattedOutput=n?this.getFullNumber(n):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var t=this;return this.state=new a({onCountryChange:function(e){t.country=e},onCallingCodeChange:function(e,a){t.metadata.selectNumberingPlan(a,e),t.formatter.reset(t.metadata.numberingPlan,t.state),t.parser.reset(t.metadata.numberingPlan)}}),this.formatter=new n({state:this.state,metadata:this.metadata}),this.parser=new r({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){t.determineTheCountryIfNeeded(),t.formatter.reset(t.metadata.numberingPlan,t.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){if(this.state.digits)return this._getCountry()}},{key:"_getCountry",value:function(){return this.state.country}},{key:"determineTheCountryIfNeeded",value:function(){this.state.country&&!this.isCountryCallingCodeAmbiguous()||this.determineTheCountry()}},{key:"getFullNumber",value:function(t){var e=this;if(this.isInternational()){var a=function(t){return e.formatter.getInternationalPrefixBeforeCountryCallingCode(e.state,{spacing:!!t})+t},n=this.state.callingCode;return a(n?t?"".concat(n," ").concat(t):n:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return t}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var t=this.state,e=t.nationalSignificantNumber,a=t.complexPrefixBeforeNationalSignificantNumber,n=t.nationalPrefix,r=e,i=a||n;return i&&(r=i+r),r}},{key:"getNonFormattedNumber",value:function(){var t=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(t?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var t=this.getNonFormattedNumber();if(t)return t.replace(/[\+\d]/g,s)}},{key:"isCountryCallingCodeAmbiguous",value:function(){var t=this.state.callingCode,e=this.metadata.getCountryCodesForCallingCode(t);return e&&e.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(i(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,defaultCountry:this.defaultCountry,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var t=this.state,e=t.digits,a=t.callingCode,n=t.country,r=t.nationalSignificantNumber;if(e)return this.isInternational()?a?"+"+a+r:"+"+e:n||a?"+"+(n?this.metadata.countryCallingCode():a)+r:void 0}},{key:"getNumber",value:function(){var a=this.state,n=a.nationalSignificantNumber,r=a.carrierCode,i=a.callingCode,u=this._getCountry();if(n&&(u||i)){if(u&&u===this.defaultCountry){var s=new t(this.metadata.metadata);s.selectNumberingPlan(u);var l=s.numberingPlan.callingCode(),f=this.metadata.getCountryCodesForCallingCode(l);if(f.length>1){var h=o(n,{countries:f,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});h&&(u=h)}}var m=new e(u||i,n,this.metadata.metadata);return r&&(m.carrierCode=r),m}}},{key:"isPossible",value:function(){var t=this.getNumber();return!!t&&t.isPossible()}},{key:"isValid",value:function(){var t=this.getNumber();return!!t&&t.isValid()}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}])&&h(m.prototype,d),g&&h(m,g),Object.defineProperty(m,"prototype",{writable:!1}),f}();export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"./AsYouTypeFormatter.PatternParser.js";function t(r,t){var a="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(a)return(a=a.call(r)).next.bind(a);if(Array.isArray(r)||(a=function(r,t){if(!r)return;if("string"==typeof r)return e(r,t);var a=Object.prototype.toString.call(r).slice(8,-1);"Object"===a&&r.constructor&&(a=r.constructor.name);if("Map"===a||"Set"===a)return Array.from(r);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return e(r,t)}(r))||t&&r&&"number"==typeof r.length){a&&(r=a);var n=0;return function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function e(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,a=new Array(t);e<t;e++)a[e]=r[e];return a}function a(r,t){for(var e=0;e<t.length;e++){var a=t[e];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}var n=function(){function t(e){!function(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.matchTree=(new r).parse(e)}var e,n,i;return e=t,n=[{key:"match",value:function(r){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).allowOverflow;if(!r)throw new Error("String is required");var e=o(r.split(""),this.matchTree,!0);if(e&&e.match&&delete e.matchedChars,!e||!e.overflow||t)return e}}],n&&a(e.prototype,n),i&&a(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function o(r,e,a){if("string"==typeof e){var n=r.join("");return 0===e.indexOf(n)?r.length===e.length?{match:!0,matchedChars:r}:{partialMatch:!0}:0===n.indexOf(e)?a&&r.length>e.length?{overflow:!0}:{match:!0,matchedChars:r.slice(0,e.length)}:void 0}if(Array.isArray(e)){for(var i=r.slice(),l=0;l<e.length;){var c=o(i,e[l],a&&l===e.length-1);if(!c)return;if(c.overflow)return c;if(!c.match){if(c.partialMatch)return{partialMatch:!0};throw new Error("Unsupported match result:\n".concat(JSON.stringify(c,null,2)))}if(0===(i=i.slice(c.matchedChars.length)).length)return l===e.length-1?{match:!0,matchedChars:r}:{partialMatch:!0};l++}return a?{overflow:!0}:{match:!0,matchedChars:r.slice(0,r.length-i.length)}}switch(e.op){case"|":for(var h,f,u=t(e.args);!(f=u()).done;){var s=o(r,f.value,a);if(s){if(s.overflow)return s;if(s.match)return{match:!0,matchedChars:s.matchedChars};if(!s.partialMatch)throw new Error("Unsupported match result:\n".concat(JSON.stringify(s,null,2)));h=!0}}return h?{partialMatch:!0}:void 0;case"[]":for(var m,d=t(e.args);!(m=d()).done;){var p=m.value;if(r[0]===p)return 1===r.length?{match:!0,matchedChars:r}:a?{overflow:!0}:{match:!0,matchedChars:[p]}}return;default:throw new Error("Unsupported instruction tree: ".concat(e))}}export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var e=function(){function e(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e)}var i,a,h;return i=e,(a=[{key:"parse",value:function(t){if(this.context=[{or:!0,instructions:[]}],this.parsePattern(t),1!==this.context.length)throw new Error("Non-finalized contexts left when pattern parse ended");var e=this.context[0],r=e.branches,n=e.instructions;if(r)return{op:"|",args:r.concat([s(n)])};if(0===n.length)throw new Error("Pattern is required");return 1===n.length?n[0]:n}},{key:"startContext",value:function(t){this.context.push(t)}},{key:"endContext",value:function(){this.context.pop()}},{key:"getContext",value:function(){return this.context[this.context.length-1]}},{key:"parsePattern",value:function(t){if(!t)throw new Error("Pattern is required");var e=t.match(o);if(e){var i=e[1],a=t.slice(0,e.index),h=t.slice(e.index+i.length);switch(i){case"(?:":a&&this.parsePattern(a),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw new Error('")" operator must be preceded by "(?:" operator');if(a&&this.parsePattern(a),0===this.getContext().instructions.length)throw new Error('No instructions found after "|" operator in an "or" group');var c=this.getContext().branches;c.push(s(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:c});break;case"|":if(!this.getContext().or)throw new Error('"|" operator can only be used inside "or" groups');if(a&&this.parsePattern(a),!this.getContext().branches){if(1!==this.context.length)throw new Error('"branches" not found in an "or" group context');this.getContext().branches=[]}this.getContext().branches.push(s(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":a&&this.parsePattern(a),this.startContext({oneOfSet:!0});break;case"]":if(!this.getContext().oneOfSet)throw new Error('"]" operator must be preceded by "[" operator');this.endContext(),this.getContext().instructions.push({op:"[]",args:r(a)});break;default:throw new Error("Unknown operator: ".concat(i))}h&&this.parsePattern(h)}else{if(n.test(t))throw new Error("Illegal characters found in a pattern: ".concat(t));this.getContext().instructions=this.getContext().instructions.concat(t.split(""))}}}])&&t(i.prototype,a),h&&t(i,h),Object.defineProperty(i,"prototype",{writable:!1}),e}();function r(t){for(var e=[],r=0;r<t.length;){if("-"===t[r]){if(0===r||r===t.length-1)throw new Error("Couldn't parse a one-of set pattern: ".concat(t));for(var n=t[r-1].charCodeAt(0)+1,o=t[r+1].charCodeAt(0)-1,s=n;s<=o;)e.push(String.fromCharCode(s)),s++}else e.push(t[r]);r++}return e}var n=/[\(\)\[\]\?\:\|]/,o=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function s(t){return 1===t.length?t[0]:t}export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import a from"./helpers/checkNumberLength.js";import t from"./helpers/parseDigits.js";import e from"./helpers/formatNationalNumberUsingFormat.js";function r(a,t,e){var r=e.metadata,i=e.shouldTryNationalPrefixFormattingRule,o=e.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(a.nationalSignificantNumber))return function(a,t,e){var r=e.metadata,i=e.shouldTryNationalPrefixFormattingRule,o=e.getSeparatorAfterNationalPrefix;if(a.nationalSignificantNumber,a.international,a.nationalPrefix,a.carrierCode,i(t)){var f=n(a,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:o,metadata:r});if(f)return f}return n(a,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:o,metadata:r})}(a,t,{metadata:r,shouldTryNationalPrefixFormattingRule:i,getSeparatorAfterNationalPrefix:o})}function i(t,e){return"IS_POSSIBLE"===a(t,e)}function n(a,r,i){var n=i.metadata,o=i.useNationalPrefixFormattingRule,f=i.getSeparatorAfterNationalPrefix,l=e(a.nationalSignificantNumber,r,{carrierCode:a.carrierCode,useInternationalFormat:a.international,withNationalPrefix:o,metadata:n});if(o||(a.nationalPrefix?l=a.nationalPrefix+f(r)+l:a.complexPrefixBeforeNationalSignificantNumber&&(l=a.complexPrefixBeforeNationalSignificantNumber+" "+l)),function(a,e){return t(a)===e.getNationalDigits()}(l,a))return l}export{i as canFormatCompleteNumber,r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DIGIT_PLACEHOLDER as t,cutAndStripNonPairedParens as e,repeat as a,populateTemplateWithDigits as r}from"./AsYouTypeFormatter.util.js";import n,{canFormatCompleteNumber as i}from"./AsYouTypeFormatter.complete.js";import o from"./AsYouTypeFormatter.PatternMatcher.js";import l from"./helpers/parseDigits.js";import{FIRST_GROUP_PATTERN as s}from"./helpers/formatNationalNumberUsingFormat.js";import{VALID_PUNCTUATION as m}from"./constants.js";import u from"./helpers/applyInternationalSeparatorStyle.js";function f(t,e){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(a)return(a=a.call(t)).next.bind(a);if(Array.isArray(t)||(a=function(t,e){if(!t)return;if("string"==typeof t)return h(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return h(t,e)}(t))||e&&t&&"number"==typeof t.length){a&&(t=a);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,r=new Array(e);a<e;a++)r[a]=t[a];return r}function p(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var c=a("9",15),g=/[- ]/,N=new RegExp("["+m+"]*\\$1["+m+"]*(\\$\\d["+m+"]*)*$"),v=function(){function m(t){t.state;var e=t.metadata;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,m),this.metadata=e,this.resetFormat()}var h,v,d;return h=m,(v=[{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function(t,e){this.resetFormat(),t?(this.isNANP="1"===t.callingCode(),this.matchingFormats=t.formats(),e.nationalSignificantNumber&&this.narrowDownMatchingFormats(e)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:"format",value:function(e,a){var r=this;if(i(a.nationalSignificantNumber,this.metadata))for(var o,l=f(this.matchingFormats);!(o=l()).done;){var s=o.value,m=n(a,s,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(t){return r.shouldTryNationalPrefixFormattingRule(t,{international:a.international,nationalPrefix:a.nationalPrefix})},getSeparatorAfterNationalPrefix:function(t){return r.getSeparatorAfterNationalPrefix(t)}});if(m)return this.resetFormat(),this.chosenFormat=s,this.setNationalNumberTemplate(m.replace(/\d/g,t),a),this.populatedNationalNumberTemplate=m,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(t),m}return this.formatNationalNumberWithNextDigits(e,a)}},{key:"formatNationalNumberWithNextDigits",value:function(t,e){var a=this.chosenFormat,r=this.chooseFormat(e);if(r)return r===a?this.formatNextNationalNumberDigits(t):this.formatNextNationalNumberDigits(e.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(t){var e=this,a=t.nationalSignificantNumber,r=t.nationalPrefix,n=t.international,i=a,o=i.length-3;o<0&&(o=0),this.matchingFormats=this.matchingFormats.filter((function(t){return e.formatSuits(t,n,r)&&e.formatMatches(t,i,o)})),this.chosenFormat&&-1===this.matchingFormats.indexOf(this.chosenFormat)&&this.resetFormat()}},{key:"formatSuits",value:function(t,e,a){return!(a&&!t.usesNationalPrefix()&&!t.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!e&&!a&&t.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:"formatMatches",value:function(t,e,a){var r=t.leadingDigitsPatterns().length;if(0===r)return!0;a=Math.min(a,r-1);var n=t.leadingDigitsPatterns()[a];if(e.length<3)try{return void 0!==new o(n).match(e,{allowOverflow:!0})}catch(t){return console.error(t),!0}return new RegExp("^(".concat(n,")")).test(e)}},{key:"getFormatFormat",value:function(t,e){return e?t.internationalFormat():t.format()}},{key:"chooseFormat",value:function(t){for(var e,a=this,r=function(){var r=e.value;return a.chosenFormat===r?"break":N.test(a.getFormatFormat(r,t.international))?a.createTemplateForFormat(r,t)?(a.chosenFormat=r,"break"):(a.matchingFormats=a.matchingFormats.filter((function(t){return t!==r})),"continue"):"continue"},n=f(this.matchingFormats.slice());!(e=n()).done;){var i=r();if("break"===i)break}return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:"createTemplateForFormat",value:function(t,e){if(!(t.pattern().indexOf("|")>=0)){var a=this.getTemplateForFormat(t,e);return a?(this.setNationalNumberTemplate(a,e),!0):void 0}}},{key:"getSeparatorAfterNationalPrefix",value:function(t){return this.isNANP||t&&t.nationalPrefixFormattingRule()&&g.test(t.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(t,e){var a=t.IDDPrefix,r=t.missingPlus;return a?e&&!1===e.spacing?a:a+" ":r?"":"+"}},{key:"getTemplate",value:function(a){if(this.template){for(var r=-1,n=0,i=a.international?this.getInternationalPrefixBeforeCountryCallingCode(a,{spacing:!1}):"";n<i.length+a.getDigitsWithoutInternationalPrefix().length;)r=this.template.indexOf(t,r+1),n++;return e(this.template,r+1)}}},{key:"setNationalNumberTemplate",value:function(e,r){this.nationalNumberTemplate=e,this.populatedNationalNumberTemplate=e,this.populatedNationalNumberTemplatePosition=-1,r.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(r).replace(/[\d\+]/g,t)+a(t,r.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,r){var n=r.nationalSignificantNumber,i=r.international,o=r.nationalPrefix,m=r.complexPrefixBeforeNationalSignificantNumber,f=e.pattern();f=f.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var h=c.match(f)[0];if(!(n.length>h.length)){var p=new RegExp("^"+f+"$"),g=n.replace(/\d/g,"9");p.test(g)&&(h=g);var N,v=this.getFormatFormat(e,i);if(this.shouldTryNationalPrefixFormattingRule(e,{international:i,nationalPrefix:o})){var d=v.replace(s,e.nationalPrefixFormattingRule());if(l(e.nationalPrefixFormattingRule())===(o||"")+l("$1")&&(v=d,N=!0,o))for(var F=o.length;F>0;)v=v.replace(/\d/,t),F--}var y=h.replace(new RegExp(f),v).replace(new RegExp("9","g"),t);return N||(m?y=a(t,m.length)+" "+y:o&&(y=a(t,o.length)+this.getSeparatorAfterNationalPrefix(e)+y)),i&&(y=u(y)),y}}},{key:"formatNextNationalNumberDigits",value:function(t){var a=r(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,t);if(a)return this.populatedNationalNumberTemplate=a[0],this.populatedNationalNumberTemplatePosition=a[1],e(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(t,e){var a=e.international,r=e.nationalPrefix;if(t.nationalPrefixFormattingRule()){var n=t.usesNationalPrefix();if(n&&r||!n&&!a)return!0}}}])&&p(h.prototype,v),d&&p(h,d),Object.defineProperty(h,"prototype",{writable:!1}),m}();export{t as DIGIT_PLACEHOLDER,v as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(r,t){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(n)return(n=n.call(r)).next.bind(n);if(Array.isArray(r)||(n=function(r,t){if(!r)return;if("string"==typeof r)return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);"Object"===n&&r.constructor&&(n=r.constructor.name);if("Map"===n||"Set"===n)return Array.from(r);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}(r))||t&&r&&"number"==typeof r.length){n&&(r=n);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function e(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}var t="x",n=new RegExp("x");function o(r,e){if(e<1)return"";for(var t="";e>1;)1&e&&(t+=r),e>>=1,r+=r;return t+r}function a(r,e){return")"===r[e]&&e++,i(r.slice(0,e))}function i(r){for(var e=[],t=0;t<r.length;)"("===r[t]?e.push(t):")"===r[t]&&e.pop(),t++;var n=0,o="";e.push(r.length);for(var a=0,i=e;a<i.length;a++){var u=i[a];o+=r.slice(n,u),n=u+1}return o}function u(e,t,o){for(var a,i=r(o.split(""));!(a=i()).done;){var u=a.value;if(e.slice(t+1).search(n)<0)return;t=e.search(n),e=e.replace(n,u)}return[e,t]}export{t as DIGIT_PLACEHOLDER,a as cutAndStripNonPairedParens,u as populateTemplateWithDigits,o as repeat,i as stripNonPairedParens};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"./helpers/extractCountryCallingCode.js";import i from"./helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js";import n from"./helpers/extractNationalNumberFromPossiblyIncompleteNumber.js";import a from"./helpers/stripIddPrefix.js";import e from"./helpers/parseDigits.js";import{VALID_PUNCTUATION as r,VALID_DIGITS as o,PLUS_CHARS as l}from"./constants.js";function u(t,i){return function(t){if(Array.isArray(t))return t}(t)||function(t,i){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var a,e,r=[],o=!0,l=!1;try{for(n=n.call(t);!(o=(a=n.next()).done)&&(r.push(a.value),!i||r.length!==i);o=!0);}catch(t){l=!0,e=t}finally{try{o||null==n.return||n.return()}finally{if(l)throw e}}return r}(t,i)||function(t,i){if(!t)return;if("string"==typeof t)return s(t,i);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(t,i)}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,i){(null==i||i>t.length)&&(i=t.length);for(var n=0,a=new Array(i);n<i;n++)a[n]=t[n];return a}function c(t,i){for(var n=0;n<i.length;n++){var a=i[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}var f=new RegExp("^"+("["+r+o+"]+")+"$","i"),d="(?:["+l+"]["+r+o+"]*|["+r+o+"]+)",g=new RegExp("[^"+r+o+"]+.*$"),h=/[^\d\[\]]/,m=function(){function r(t){var i=t.defaultCountry,n=t.defaultCallingCode,a=t.metadata,e=t.onNationalSignificantNumberChange;!function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,r),this.defaultCountry=i,this.defaultCallingCode=n,this.metadata=a,this.onNationalSignificantNumberChange=e}var o,l,s;return o=r,(l=[{key:"input",value:function(t,i){var n,a=u(b(t),2),r=a[0],o=a[1],l=e(r);return o&&(i.digits||(i.startInternationalNumber(),l||(n=!0))),l&&this.inputDigits(l,i),{digits:l,justLeadingPlus:n}}},{key:"inputDigits",value:function(t,i){var n=i.digits,a=n.length<3&&n.length+t.length>=3;if(i.appendDigits(t),a&&this.extractIddPrefix(i),this.isWaitingForCountryCallingCode(i)){if(!this.extractCountryCallingCode(i))return}else i.appendNationalSignificantNumberDigits(t);i.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(i.getNationalDigits(),(function(t){return i.update(t)}))}},{key:"isWaitingForCountryCallingCode",value:function(t){var i=t.international,n=t.callingCode;return i&&!n}},{key:"extractCountryCallingCode",value:function(i){var n=t("+"+i.getDigitsWithoutInternationalPrefix(),this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),a=n.countryCallingCode,e=n.number;if(a)return i.setCallingCode(a),i.update({nationalSignificantNumber:e}),!0}},{key:"reset",value:function(t){if(t){this.hasSelectedNumberingPlan=!0;var i=t._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=i&&h.test(i)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(t,i){if(this.hasSelectedNumberingPlan){var a=n(t,this.metadata),e=a.nationalPrefix,r=a.nationalNumber,o=a.carrierCode;if(r!==t)return this.onExtractedNationalNumber(e,o,r,t,i),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(t,i,a){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(t,a);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var e=n(t,this.metadata),r=e.nationalPrefix,o=e.nationalNumber,l=e.carrierCode;if(o!==i)return this.onExtractedNationalNumber(r,l,o,t,a),!0}}},{key:"onExtractedNationalNumber",value:function(t,i,n,a,e){var r,o,l=a.lastIndexOf(n);if(l>=0&&l===a.length-n.length){o=!0;var u=a.slice(0,l);u!==t&&(r=u)}e({nationalPrefix:t,carrierCode:i,nationalSignificantNumber:n,nationalSignificantNumberMatchesInput:o,complexPrefixBeforeNationalSignificantNumber:r}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(t){return!!this.extractAnotherNationalSignificantNumber(t.getNationalDigits(),t.nationalSignificantNumber,(function(i){return t.update(i)}))||(this.extractIddPrefix(t)||this.fixMissingPlus(t)?(this.extractCallingCodeAndNationalSignificantNumber(t),!0):void 0)}},{key:"extractIddPrefix",value:function(t){var i=t.international,n=t.IDDPrefix,e=t.digits;if(t.nationalSignificantNumber,!i&&!n){var r=a(e,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==r&&r!==e?(t.update({IDDPrefix:e.slice(0,e.length-r.length)}),this.startInternationalNumber(t,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(t){if(!t.international){var n=i(t.digits,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),a=n.countryCallingCode;if(n.number,a)return t.update({missingPlus:!0}),this.startInternationalNumber(t,{country:t.country,callingCode:a}),!0}}},{key:"startInternationalNumber",value:function(t,i){var n=i.country,a=i.callingCode;t.startInternationalNumber(n,a),t.nationalSignificantNumber&&(t.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(t){this.extractCountryCallingCode(t)&&this.extractNationalSignificantNumber(t.getNationalDigits(),(function(i){return t.update(i)}))}}])&&c(o.prototype,l),s&&c(o,s),Object.defineProperty(o,"prototype",{writable:!1}),r}();function N(t){var i=function(t){var i,n=t.search(d);if(!(n<0))return"+"===(t=t.slice(n))[0]&&(i=!0,t=t.slice(1)),t=t.replace(g,""),i&&(t="+"+t),t}(t)||"";return"+"===i[0]?[i.slice(1),!0]:[i]}function b(t){var i=u(N(t),2),n=i[0],a=i[1];return f.test(n)||(n=""),[n,a]}export{m as default,b as extractFormattedDigitsAndPlus};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function i(i,t){for(var n=0;n<t.length;n++){var e=t[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(i,e.key,e)}}var t=function(){function t(i){var n=i.onCountryChange,e=i.onCallingCodeChange;!function(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.onCountryChange=n,this.onCallingCodeChange=e}var n,e,a;return n=t,(e=[{key:"reset",value:function(i){var t=i.country,n=i.callingCode;this.international=!1,this.missingPlus=!1,this.IDDPrefix=void 0,this.callingCode=void 0,this.digits="",this.resetNationalSignificantNumber(),this.initCountryAndCallingCode(t,n)}},{key:"resetNationalSignificantNumber",value:function(){this.nationalSignificantNumber=this.getNationalDigits(),this.nationalSignificantNumberMatchesInput=!0,this.nationalPrefix=void 0,this.carrierCode=void 0,this.complexPrefixBeforeNationalSignificantNumber=void 0}},{key:"update",value:function(i){for(var t=0,n=Object.keys(i);t<n.length;t++){var e=n[t];this[e]=i[e]}}},{key:"initCountryAndCallingCode",value:function(i,t){this.setCountry(i),this.setCallingCode(t)}},{key:"setCountry",value:function(i){this.country=i,this.onCountryChange(i)}},{key:"setCallingCode",value:function(i){this.callingCode=i,this.onCallingCodeChange(i,this.country)}},{key:"startInternationalNumber",value:function(i,t){this.international=!0,this.initCountryAndCallingCode(i,t)}},{key:"appendDigits",value:function(i){this.digits+=i}},{key:"appendNationalSignificantNumberDigits",value:function(i){this.nationalSignificantNumber+=i}},{key:"getNationalDigits",value:function(){return this.international?this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0)):this.digits}},{key:"getDigitsWithoutInternationalPrefix",value:function(){return this.international&&this.IDDPrefix?this.digits.slice(this.IDDPrefix.length):this.digits}}])&&i(n.prototype,e),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),t}();export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function r(e){var r=c();return function(){var o,u=f(e);if(r){var c=f(this).constructor;o=Reflect.construct(u,arguments,c)}else o=u.apply(this,arguments);return function(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return n(e)}(this,o)}}function n(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function o(t){var e="function"==typeof Map?new Map:void 0;return o=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return u(t,arguments,f(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),i(n,t)},o(t)}function u(t,e,r){return u=c()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&i(o,r.prototype),o},u.apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function i(t,e){return i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},i(t,e)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}var p=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e)}(a,o(Error));var u,c,f,p=r(a);function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),e=p.call(this,t),Object.setPrototypeOf(n(e),a.prototype),e.name=e.constructor.name,e}return u=a,c&&e(u.prototype,c),f&&e(u,f),Object.defineProperty(u,"prototype",{writable:!1}),u}();export{p as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"./metadata.js";import e from"./isPossible.js";import r from"./isValid.js";import n from"./helpers/getNumberType.js";import o from"./helpers/getPossibleCountriesForNumber.js";import i from"./format.js";function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function u(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var c=function(){function a(e,r,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),!e)throw new TypeError("`country` or `countryCallingCode` not passed");if(!r)throw new TypeError("`nationalNumber` not passed");if(!n)throw new TypeError("`metadata` not passed");var o=function(e,r){var n,o,i=new t(r);f(e)?(n=e,i.selectNumberingPlan(n),o=i.countryCallingCode()):o=e;return{country:n,countryCallingCode:o}}(e,n),i=o.country,u=o.countryCallingCode;this.country=i,this.countryCallingCode=u,this.nationalNumber=r,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return n}}var s,c,y;return s=a,(c=[{key:"setExt",value:function(t){this.ext=t}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:o(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return e(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return r(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new t(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(t){return this.number===t.number&&this.ext===t.ext}},{key:"getType",value:function(){return n(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(t,e){return i(this,t,e?u(u({},e),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(t){return this.format("NATIONAL",t)}},{key:"formatInternational",value:function(t){return this.format("INTERNATIONAL",t)}},{key:"getURI",value:function(t){return this.format("RFC3966",t)}}])&&l(s.prototype,c),y&&l(s,y),Object.defineProperty(s,"prototype",{writable:!1}),a}(),f=function(t){return/^[A-Z]{2}$/.test(t)};export{c as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c=2,a=17,o=3,t="0-90-9٠-٩۰-۹",n=" ",r="".concat("-‐-―−ー-").concat("//").concat("..").concat(n).concat("()()[]\\[\\]").concat("~⁓∼~"),e="++";export{o as MAX_LENGTH_COUNTRY_CODE,a as MAX_LENGTH_FOR_NSN,c as MIN_LENGTH_FOR_NSN,e as PLUS_CHARS,t as VALID_DIGITS,r as VALID_PUNCTUATION,n as WHITESPACE};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"./helpers/matchesEntirely.js";import r from"./helpers/formatNationalNumberUsingFormat.js";import e,{getCountryCallingCode as n}from"./metadata.js";import o from"./helpers/getIddPrefix.js";import{formatRFC3966 as a}from"./helpers/RFC3966.js";function i(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,r){if(!t)return;if("string"==typeof t)return c(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return c(t,r)}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function u(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function f(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?u(Object(e),!0).forEach((function(r){l(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):u(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function l(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}var s={formatExtension:function(t,r,e){return"".concat(t).concat(e.ext()).concat(r)}};function m(t,r,i,c){if(i=i?f(f({},s),i):s,c=new e(c),t.country&&"001"!==t.country){if(!c.hasCountry(t.country))throw new Error("Unknown country: ".concat(t.country));c.country(t.country)}else{if(!t.countryCallingCode)return t.phone||"";c.selectNumberingPlan(t.countryCallingCode)}var u,l=c.countryCallingCode(),m=i.v2?t.nationalNumber:t.phone;switch(r){case"NATIONAL":return m?b(u=p(m,t.carrierCode,"NATIONAL",c,i),t.ext,c,i.formatExtension):"";case"INTERNATIONAL":return m?(u=p(m,null,"INTERNATIONAL",c,i),b(u="+".concat(l," ").concat(u),t.ext,c,i.formatExtension)):"+".concat(l);case"E.164":return"+".concat(l).concat(m);case"RFC3966":return a({number:"+".concat(l).concat(m),ext:t.ext});case"IDD":if(!i.fromCountry)return;var y=function(t,r,e,a,i){var c=n(a,i.metadata);if(c===e){var u=p(t,r,"NATIONAL",i);return"1"===e?e+" "+u:u}var f=o(a,void 0,i.metadata);if(f)return"".concat(f," ").concat(e," ").concat(p(t,null,"INTERNATIONAL",i))}(m,t.carrierCode,l,i.fromCountry,c);return b(y,t.ext,c,i.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(r,'"'))}}function p(t,e,n,o,a){var i=y(o.formats(),t);return i?r(t,i,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!i.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!a||!1!==a.nationalPrefix,carrierCode:e,metadata:o}):t}function y(r,e){for(var n,o=i(r);!(n=o()).done;){var a=n.value;if(a.leadingDigitsPatterns().length>0){var c=a.leadingDigitsPatterns()[a.leadingDigitsPatterns().length-1];if(0!==e.search(c))continue}if(t(e,a.pattern()))return a}}function b(t,r,e,n){return r?n(t,r,e):t}export{y as chooseFormatForNumber,m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from"./AsYouType.js";function t(t,e,n){return n||(n=e,e=void 0),new o(e,n).input(t)}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"./metadata.js";function e(e){return new t(e).getCountries()}export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(r){var t=r.number,e=r.ext;if(!t)return"";if("+"!==t[0])throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(t).concat(e?";ext="+e:"")}export{r as formatRFC3966};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{VALID_PUNCTUATION as t}from"../constants.js";function e(e){return e.replace(new RegExp("[".concat(t,"]+"),"g")," ").trim()}export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./mergeArrays.js";function r(e,r){return t(e,void 0,r)}function t(r,I,L){var n=L.type(I),O=n&&n.possibleLengths()||L.possibleLengths();if(!O)return"IS_POSSIBLE";if("FIXED_LINE_OR_MOBILE"===I){if(!L.type("FIXED_LINE"))return t(r,"MOBILE",L);var s=L.type("MOBILE");s&&(O=e(O,s.possibleLengths()))}else if(I&&!n)return"INVALID_LENGTH";var i=r.length,E=O[0];return E===i?"IS_POSSIBLE":E>i?"TOO_SHORT":O[O.length-1]<i?"TOO_LONG":O.indexOf(i,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}export{t as checkNumberLengthForType,r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{VALID_DIGITS as t}from"../../constants.js";var n=function(n){return"([".concat(t,"]{1,").concat(n,"})")};function o(t){var o="[ \\t,]*",r="[:\\..]?[ \\t,-]*",a="#?",e="[ \\t]*";return";ext="+n("20")+"|"+(o+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+r+n("20")+a)+"|"+(o+"(?:[xx##~~]|int|int)"+r+n("9")+a)+"|"+("[- ]+"+n("6")+"#")+"|"+(e+"(?:,{2}|;)"+r+n("15")+a)+"|"+(e+"(?:,)+"+r+n("9")+a)}export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./createExtensionPattern.js";var r=new RegExp("(?:"+e()+")$","i");function t(e){var t=e.search(r);if(t<0)return{};for(var n=e.slice(0,t),a=e.match(r),i=1;i<a.length;){if(a[i])return{number:n,ext:a[i]};i++}}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"./stripIddPrefix.js";import n from"./extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js";import e from"../metadata.js";import{MAX_LENGTH_COUNTRY_CODE as t}from"../constants.js";function o(o,i,u,a){if(!o)return{};var l;if("+"!==o[0]){var m=r(o,i,u,a);if(!m||m===o){if(i||u){var f=n(o,i,u,a),C=f.countryCallingCode,c=f.number;if(C)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:C,number:c}}return{number:o}}l=!0,o="+"+m}if("0"===o[1])return{};a=new e(a);for(var s=2;s-1<=t&&s<=o.length;){var d=o.slice(1,s);if(a.hasCallingCode(d))return a.selectNumberingPlan(d),{countryCallingCodeSource:l?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:d,number:o.slice(s)};s++}return{}}export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r,{getCountryCallingCode as e}from"../metadata.js";import t from"./matchesEntirely.js";import n from"./extractNationalNumber.js";import a from"./checkNumberLength.js";function m(m,i,o,u){var l=i?e(i,u):o;if(0===m.indexOf(l)){(u=new r(u)).selectNumberingPlan(i,o);var b=m.slice(l.length),f=n(b,u).nationalNumber,N=n(m,u).nationalNumber;if(!t(N,u.nationalNumberPattern())&&t(f,u.nationalNumberPattern())||"TOO_LONG"===a(N,u))return{countryCallingCode:l,number:b}}return{number:m}}export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r,{isPhoneContextValid as t,PLUS_SIGN as e,RFC3966_PREFIX_ as n,RFC3966_PHONE_CONTEXT_ as o,RFC3966_ISDN_SUBADDRESS_ as a}from"./extractPhoneContext.js";import i from"../ParseError.js";function f(f,s){var u,x=s.extractFormattedPhoneNumber,m=r(f);if(!t(m))throw new i("NOT_A_NUMBER");if(null===m)u=x(f)||"";else{u="",m.charAt(0)===e&&(u+=m);var d,h=f.indexOf(n);d=h>=0?h+n.length:0;var l=f.indexOf(o);u+=f.substring(d,l)}var c=u.indexOf(a);if(c>0&&(u=u.substring(0,c)),""!==u)return u}export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"./extractNationalNumberFromPossiblyIncompleteNumber.js";import e from"./matchesEntirely.js";import t from"./checkNumberLength.js";function n(n,a){var i=r(n,a),o=i.carrierCode,u=i.nationalNumber;if(u!==n){if(!function(r,t,n){if(e(r,n.nationalNumberPattern())&&!e(t,n.nationalNumberPattern()))return!1;return!0}(n,u,a))return{nationalNumber:n};if(a.possibleLengths()&&!function(r,e){switch(t(r,e)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(u,a))return{nationalNumber:n}}return{nationalNumber:u,carrierCode:o}}export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(n,e){if(n&&e.numberingPlan.nationalPrefixForParsing()){var a=new RegExp("^(?:"+e.numberingPlan.nationalPrefixForParsing()+")"),r=a.exec(n);if(r){var i,l,f,o=r.length-1,t=o>0&&r[o];if(e.nationalPrefixTransformRule()&&t)i=n.replace(a,e.nationalPrefixTransformRule()),o>1&&(l=r[1]);else{var P=r[0];i=n.slice(P.length),t&&(l=r[1])}if(t){var u=n.indexOf(r[1]);n.slice(0,u)===e.numberingPlan.nationalPrefix()&&(f=e.numberingPlan.nationalPrefix())}else f=r[0];return{nationalNumber:i,nationalPrefix:f,carrierCode:l}}}return{nationalNumber:n}}export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{VALID_DIGITS as n}from"../constants.js";var t="+",e="(["+n+"]|[\\-\\.\\(\\)]?)",r=new RegExp("^\\+"+e+"*["+n+"]"+e+"*$","g"),u=new RegExp("^("+("["+n+"]+((\\-)*["+n+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+n+"])*")+"\\.?$","g"),s="tel:",i=";phone-context=",a=";isub=";function f(n){var t=n.indexOf(i);if(t<0)return null;var e=t+15;if(e>=n.length)return"";var r=n.indexOf(";",e);return r>=0?n.substring(e,r):n.substring(e)}function g(n){return null===n||0!==n.length&&(r.test(n)||u.test(n))}export{t as PLUS_SIGN,a as RFC3966_ISDN_SUBADDRESS_,i as RFC3966_PHONE_CONTEXT_,s as RFC3966_PREFIX_,f as default,g as isPhoneContextValid};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import a from"./applyInternationalSeparatorStyle.js";var t=/(\$\d)/;function r(r,e,n){var o=n.useInternationalFormat,i=n.withNationalPrefix;n.carrierCode,n.metadata;var l=r.replace(new RegExp(e.pattern()),o?e.internationalFormat():i&&e.nationalPrefixFormattingRule()?e.format().replace(t,e.nationalPrefixFormattingRule()):e.format());return o?a(l):l}export{t as FIRST_GROUP_PATTERN,r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"./getCountryByNationalNumber.js";function a(a,e){var r=e.nationalNumber,o=e.defaultCountry,n=e.metadata;var u=n.getCountryCodesForCallingCode(a);if(u)return 1===u.length?u[0]:t(r,{countries:u,defaultCountry:o,metadata:n.metadata})}export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"../metadata.js";import t from"./getNumberType.js";function e(r,t){var e="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(e)return(e=e.call(r)).next.bind(e);if(Array.isArray(r)||(e=function(r,t){if(!r)return;if("string"==typeof r)return n(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return n(r,t)}(r))||t&&r&&"number"==typeof r.length){e&&(r=e);var a=0;return function(){return a>=r.length?{done:!0}:{done:!1,value:r[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function a(n,a){var o=a.countries,i=a.defaultCountry,u=a.metadata;u=new r(u);for(var f,l=[],c=e(o);!(f=c()).done;){var m=f.value;if(u.country(m),u.leadingDigits()){if(n&&0===n.search(u.leadingDigits()))return m}else if(t({phone:n,country:m},void 0,u.metadata)){if(!i)return m;if(m===i)return m;l.push(m)}}if(l.length>0)return l[0]}export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"../metadata.js";var r=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function t(t,a,f){var u=new e(f);return u.selectNumberingPlan(t,a),u.defaultIDDPrefix()?u.defaultIDDPrefix():r.test(u.IDDPrefix())?u.IDDPrefix():void 0}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"../metadata.js";import r from"./matchesEntirely.js";function e(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,r){if(!t)return;if("string"==typeof t)return n(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return n(t,r)}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}var o=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function a(n,a,u){if(a=a||{},n.country||n.countryCallingCode){(u=new t(u)).selectNumberingPlan(n.country,n.countryCallingCode);var l=a.v2?n.nationalNumber:n.phone;if(r(l,u.nationalNumberPattern())){if(i(l,"FIXED_LINE",u))return u.type("MOBILE")&&""===u.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":u.type("MOBILE")?i(l,"MOBILE",u)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var E,f=e(o);!(E=f()).done;){var I=E.value;if(i(l,I,u))return I}}}}function i(t,e,n){return!(!(e=n.type(e))||!e.pattern())&&(!(e.possibleLengths()&&e.possibleLengths().indexOf(t.length)<0)&&r(t,e.pattern()))}export{a as default,i as isNumberTypeEqualTo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n from"../metadata.js";function e(e,r,t){var i=new n(t).getCountryCodesForCallingCode(e);return i?i.filter((function(e){return function(e,r,t){var i=new n(t);if(i.selectNumberingPlan(r),i.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(r,e,t)})):[]}export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={}.constructor;function t(t){return null!=t&&t.constructor===r}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MIN_LENGTH_FOR_NSN as t,VALID_DIGITS as e,PLUS_CHARS as n,VALID_PUNCTUATION as r}from"../constants.js";import o from"./extension/createExtensionPattern.js";var s="["+e+"]{"+t+"}",i="["+n+"]{0,1}(?:["+r+"]*["+e+"]){3,}["+r+e+"]*",a=new RegExp("^["+n+"]{0,1}(?:["+r+"]*["+e+"]){1,2}$","i"),f=i+"(?:"+o()+")?",p=new RegExp("^"+s+"$|^"+f+"$","i");function u(e){return e.length>=t&&p.test(e)}function x(t){return a.test(t)}export{i as VALID_PHONE_NUMBER,f as VALID_PHONE_NUMBER_WITH_EXTENSION,u as default,x as isViablePhoneNumberStart};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(r,e){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(n)return(n=n.call(r)).next.bind(n);if(Array.isArray(r)||(n=function(r,e){if(!r)return;if("string"==typeof r)return t(r,e);var n=Object.prototype.toString.call(r).slice(8,-1);"Object"===n&&r.constructor&&(n=r.constructor.name);if("Map"===n||"Set"===n)return Array.from(r);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(r,e)}(r))||e&&r&&"number"==typeof r.length){n&&(r=n);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function e(t,e){for(var n,o=t.slice(),a=r(e);!(n=a()).done;){var i=n.value;t.indexOf(i)<0&&o.push(i)}return o.sort((function(r,t){return r-t}))}export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(r,e){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(n)return(n=n.call(r)).next.bind(n);if(Array.isArray(r)||(n=function(r,e){if(!r)return;if("string"==typeof r)return t(r,e);var n=Object.prototype.toString.call(r).slice(8,-1);"Object"===n&&r.constructor&&(n=r.constructor.name);if("Map"===n||"Set"===n)return Array.from(r);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(r,e)}(r))||e&&r&&"number"==typeof r.length){n&&(r=n);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}var e={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function n(r){return e[r]}function o(t){for(var e,o="",a=r(t.split(""));!(e=a()).done;){var i=n(e.value);i&&(o+=i)}return o}export{e as DIGITS,o as default,n as parseDigit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"../metadata.js";import{VALID_DIGITS as t}from"../constants.js";var a=new RegExp("(["+t+"])");function r(t,r,n,i){if(r){var f=new e(i);f.selectNumberingPlan(r,n);var l=new RegExp(f.IDDPrefix());if(0===t.search(l)){var m=(t=t.slice(t.match(l)[0].length)).match(a);if(!(m&&null!=m[1]&&m[1].length>0&&"0"===m[1]))return t}}}export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./metadata.js";import n from"./helpers/checkNumberLength.js";function r(n,r,t){if(void 0===r&&(r={}),t=new e(t),r.v2){if(!n.countryCallingCode)throw new Error("Invalid phone number object passed");t.selectNumberingPlan(n.countryCallingCode)}else{if(!n.phone)return!1;if(n.country){if(!t.hasCountry(n.country))throw new Error("Unknown country: ".concat(n.country));t.country(n.country)}else{if(!n.countryCallingCode)throw new Error("Invalid phone number object passed");t.selectNumberingPlan(n.countryCallingCode)}}if(t.possibleLengths())return o(n.phone||n.nationalNumber,t);if(n.countryCallingCode&&t.isNonGeographicCallingCode(n.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}function o(e,r){return"IS_POSSIBLE"===n(e,r)}export{r as default,o as isPossibleNumber};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./metadata.js";import r from"./helpers/matchesEntirely.js";import t from"./helpers/getNumberType.js";function a(a,n,o){if(n=n||{},(o=new e(o)).selectNumberingPlan(a.country,a.countryCallingCode),o.hasTypes())return void 0!==t(a,n,o.metadata);var m=n.v2?a.nationalNumber:a.phone;return r(m,o.nationalNumberPattern())}export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"./tools/semver-compare.js";import n from"./helpers/isObject.js";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function a(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function i(t,n){for(var e=0;e<n.length;e++){var a=n[e];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function r(t,n,e){return n&&i(t.prototype,n),e&&i(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var o=" ext. ",u=/^\d+$/,s=function(){function t(n){a(this,t),y(n),this.metadata=n,P.call(this,n)}return r(t,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter((function(t){return"001"!==t}))}},{key:"getCountryMetadata",value:function(t){return this.metadata.countries[t]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(t){return void 0!==this.getCountryMetadata(t)}},{key:"hasCallingCode",value:function(t){if(this.getCountryCodesForCallingCode(t))return!0;if(this.nonGeographic()){if(this.nonGeographic()[t])return!0}else{var n=this.countryCallingCodes()[t];if(n&&1===n.length&&"001"===n[0])return!0}}},{key:"isNonGeographicCallingCode",value:function(t){return this.nonGeographic()?!!this.nonGeographic()[t]:!this.getCountryCodesForCallingCode(t)}},{key:"country",value:function(t){return this.selectNumberingPlan(t)}},{key:"selectNumberingPlan",value:function(t,n){if(t&&u.test(t)&&(n=t,t=null),t&&"001"!==t){if(!this.hasCountry(t))throw new Error("Unknown country: ".concat(t));this.numberingPlan=new l(this.getCountryMetadata(t),this)}else if(n){if(!this.hasCallingCode(n))throw new Error("Unknown calling code: ".concat(n));this.numberingPlan=new l(this.getNumberingPlanMetadata(n),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(t){var n=this.countryCallingCodes()[t];if(n){if(1===n.length&&3===n[0].length)return;return n}}},{key:"getCountryCodeForCallingCode",value:function(t){var n=this.getCountryCodesForCallingCode(t);if(n)return n[0]}},{key:"getNumberingPlanMetadata",value:function(t){var n=this.getCountryCodeForCallingCode(t);if(n)return this.getCountryMetadata(n);if(this.nonGeographic()){var e=this.nonGeographic()[t];if(e)return e}else{var a=this.countryCallingCodes()[t];if(a&&1===a.length&&"001"===a[0])return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(t){return this.numberingPlan.type(t)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(t){return this.selectNumberingPlan(t)}},{key:"hasSelectedNumberingPlan",value:function(){return void 0!==this.numberingPlan}}]),t}(),l=function(){function t(n,e){a(this,t),this.globalMetadataObject=e,this.metadata=n,P.call(this,e.metadata)}return r(t,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"IDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(t){return t[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var t=this,n=this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[];return n.map((function(n){return new h(n,t)}))}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(t){return t[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return(!this.types()||0!==this.types().length)&&!!this.types()}},{key:"type",value:function(t){if(this.hasTypes()&&g(this.types(),t))return new c(g(this.types(),t),this)}},{key:"ext",value:function(){return this.v1||this.v2?o:this.metadata[13]||o}}]),t}(),h=function(){function t(n,e){a(this,t),this._format=n,this.metadata=e}return r(t,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!(!this.nationalPrefixFormattingRule()||f.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),t}(),f=/^\(?\$1\)?$/,c=function(){function t(n,e){a(this,t),this.type=n,this.metadata=e}return r(t,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),t}();function g(t,n){switch(n){case"FIXED_LINE":return t[0];case"MOBILE":return t[1];case"TOLL_FREE":return t[2];case"PREMIUM_RATE":return t[3];case"PERSONAL_NUMBER":return t[4];case"VOICEMAIL":return t[5];case"UAN":return t[6];case"PAGER":return t[7];case"VOIP":return t[8];case"SHARED_COST":return t[9]}}function y(t){if(!t)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!n(t)||!n(t.countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(n(t)?"an object of shape: { "+Object.keys(t).join(", ")+" }":"a "+m(t)+": "+t,"."))}var m=function(t){return e(t)};function v(t,n){if((n=new s(n)).hasCountry(t))return n.country(t).countryCallingCode();throw new Error("Unknown country: ".concat(t))}function d(t,n){return n.countries.hasOwnProperty(t)}function P(n){var e=n.version;"number"==typeof e?(this.v1=1===e,this.v2=2===e,this.v3=3===e,this.v4=4===e):e?-1===t(e,"1.2.0")?this.v2=!0:-1===t(e,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}export{s as default,v as getCountryCallingCode,d as isSupportedCountry,y as validateMetadata};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"./helpers/isObject.js";function t(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function e(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function n(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var e=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null==e)return;var n,o,i=[],a=!0,u=!1;try{for(e=e.call(r);!(a=(n=e.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(r){u=!0,o=r}finally{try{a||null==e.return||e.return()}finally{if(u)throw o}}return i}(r,t)||function(r,t){if(!r)return;if("string"==typeof r)return o(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return o(r,t)}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function i(o){var i,a,u,c=n(Array.prototype.slice.call(o),4),l=c[0],f=c[1],s=c[2],p=c[3];if("string"!=typeof l)throw new TypeError("A text for parsing must be a string.");if(i=l,f&&"string"!=typeof f){if(!r(f))throw new Error("Invalid second argument: ".concat(f));s?(a=f,u=s):u=f}else p?(a=s,u=p):(a=void 0,u=s),f&&(a=function(r){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(o,t))}))}return r}({defaultCountry:f},a));return{text:i,options:a,metadata:u}}export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MIN_LENGTH_FOR_NSN as r,MAX_LENGTH_FOR_NSN as e,PLUS_CHARS as t,VALID_DIGITS as n}from"./constants.js";import o from"./ParseError.js";import a,{getCountryCallingCode as i}from"./metadata.js";import u,{isViablePhoneNumberStart as l}from"./helpers/isViablePhoneNumber.js";import m from"./helpers/extension/extractExtension.js";import c from"./parseIncompletePhoneNumber.js";import{isPossibleNumber as f}from"./isPossible.js";import s from"./PhoneNumber.js";import d from"./helpers/matchesEntirely.js";import C from"./helpers/extractCountryCallingCode.js";import h from"./helpers/extractNationalNumber.js";import p from"./helpers/getCountryByCallingCode.js";import y from"./helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js";var N=250,b=new RegExp("["+t+n+"]"),g=new RegExp("[^"+n+"#]+$");function w(t,n,w){if(n=n||{},w=new a(w),n.defaultCountry&&!w.hasCountry(n.defaultCountry)){if(n.v2)throw new o("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(n.defaultCountry))}var O=function(r,e,t){var n=y(r,{extractFormattedPhoneNumber:function(r){return function(r,e,t){if(!r)return;if(r.length>N){if(t)throw new o("TOO_LONG");return}if(!1===e)return r;var n=r.search(b);if(n<0)return;return r.slice(n).replace(g,"")}(r,t,e)}});if(!n)return{};if(!u(n))return l(n)?{error:"TOO_SHORT"}:{};var a=m(n);if(a.ext)return a;return{number:n}}(t,n.v2,n.extract),v=O.number,x=O.ext,j=O.error;if(!v){if(n.v2){if("TOO_SHORT"===j)throw new o("TOO_SHORT");throw new o("NOT_A_NUMBER")}return{}}var P=function(r,e,t,n){var o,a=C(c(r),e,t,n.metadata),u=a.countryCallingCodeSource,l=a.countryCallingCode,m=a.number;if(l)n.selectNumberingPlan(l);else{if(!m||!e&&!t)return{};n.selectNumberingPlan(e,t),e&&(o=e),l=t||i(e,n.metadata)}if(!m)return{countryCallingCodeSource:u,countryCallingCode:l};var f=h(c(m),n),s=f.nationalNumber,d=f.carrierCode,y=p(l,{nationalNumber:s,defaultCountry:e,metadata:n});y&&(o=y,"001"===y||n.country(o));return{country:o,countryCallingCode:l,countryCallingCodeSource:u,nationalNumber:s,carrierCode:d}}(v,n.defaultCountry,n.defaultCallingCode,w),T=P.country,_=P.nationalNumber,S=P.countryCallingCode,R=P.countryCallingCodeSource,E=P.carrierCode;if(!w.hasSelectedNumberingPlan()){if(n.v2)throw new o("INVALID_COUNTRY");return{}}if(!_||_.length<r){if(n.v2)throw new o("TOO_SHORT");return{}}if(_.length>e){if(n.v2)throw new o("TOO_LONG");return{}}if(n.v2){var I=new s(S,_,w.metadata);return T&&(I.country=T),E&&(I.carrierCode=E),x&&(I.ext=x),I.__countryCallingCodeSource=R,I}var L=!!(n.extended?w.hasSelectedNumberingPlan():T)&&d(_,w.nationalNumberPattern());return n.extended?{country:T,countryCallingCode:S,carrierCode:E,valid:L,possible:!!L||!(!0!==n.extended||!w.possibleLengths()||!f(_,w)),phone:_,ext:x}:L?function(r,e,t){var n={country:r,phone:e};t&&(n.ext=t);return n}(T,_,x):{}}export{w as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parseDigit as r}from"./helpers/parseDigits.js";function t(r,t){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(n)return(n=n.call(r)).next.bind(n);if(Array.isArray(r)||(n=function(r,t){if(!r)return;if("string"==typeof r)return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);"Object"===n&&r.constructor&&(n=r.constructor.name);if("Map"===n||"Set"===n)return Array.from(r);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}(r))||t&&r&&"number"==typeof r.length){n&&(r=n);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function e(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function n(r){for(var e,n="",a=t(r.split(""));!(e=a()).done;){n+=o(e.value,n)||""}return n}function o(t,e){if("+"===t){if(e)return;return"+"}return r(t)}export{n as default,o as parsePhoneNumberCharacter};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"./normalizeArguments.js";import t from"./parsePhoneNumber_.js";function e(){var e=r(arguments),o=e.text,a=e.options,m=e.metadata;return t(o,a,m)}export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./parse.js";function r(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function t(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?r(Object(o),!0).forEach((function(r){n(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(r,n,o){return e(r,t(t({},n),{},{v2:!0}),o)}export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"./parsePhoneNumberWithError_.js";import e from"./ParseError.js";import{isSupportedCountry as t}from"./metadata.js";function o(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,o)}return t}function n(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?o(Object(t),!0).forEach((function(e){c(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}function c(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function i(o,c,i){c&&c.defaultCountry&&!t(c.defaultCountry,i)&&(c=n(n({},c),{},{defaultCountry:void 0}));try{return r(o,c,i)}catch(r){if(!(r instanceof e))throw r}}export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(r,i){r=r.split("-"),i=i.split("-");for(var t=r[0].split("."),N=i[0].split("."),e=0;e<3;e++){var s=Number(t[e]),u=Number(N[e]);if(s>u)return 1;if(u>s)return-1;if(!isNaN(s)&&isNaN(u))return 1;if(isNaN(s)&&!isNaN(u))return-1}return r[1]&&i[1]?r[1]>i[1]?1:r[1]<i[1]?-1:0:!r[1]&&i[1]?1:r[1]&&!i[1]?-1:0}export{r as default};
|