PageSourceSearch

https://www.vippidesign.com/application/assets/storefront/chunk-contact_form_initializer.0a18h0Q.js

js vippidesign.com collected 2026-10-03 23:23:18 UTC 4,725 bytes, 19 lines download raw bytes

1import{aH as n,h as f,G as c,ad as h,a as l,e as p,T as d,v as E,i as C,t as g,R as M,u as m,b as N,N as T,y as F,H as b,C as O,r as R}from"./storefrontApp.5Jl33SLO.min.js";import{b as y,d as I,$ as v,e as U}from"./chunk-vendor-lit.NvY0u02.js";import{B as H}from"./chunk-base_http_api_url.BTSaT-e.js";import{S as u}from"./chunk-storefront_settings_constants.DIF02Gz.js";import{S as $}from"./chunk-storefront_base_lit_element.BngXaMu.js";import"./chunk-vendor-di.Bh23gdA.js";import"./chunk-vendor-rxjs.Dp7kflo.js";import"./chunk-vendor-lodash.CWHFt7Z.js";import"./chunk-vendor-phoenix.cdKS79L.js";const P=n.component;class _{static{this.STATUS_CODE_CONTENT={[f.badRequest]:"Form params incorrect"}}static getMessageBasedOnStatusCode(t,s){const a=this.STATUS_CODE_CONTENT[t];return(a&&s.translate(a))??s.translate("Sending failed due to server error. Try again.")}}class A extends H{constructor(t,s){super(t,s)}getContactUrl(){return`${this.webapiUrl}/contact`}}var w=Object.defineProperty,L=(i,t,s,a)=>{for(var e=void 0,r=i.length-1,o;r>=0;r--)(o=i[r])&&(e=o(t,s,e)||e);return e&&w(t,s,e),e};class S extends ${constructor(){super(),this.moduleInstanceId="",this._formConnectorRef=y(),this._flashMessengerContainerName=c,this._id="",this._onSubmit=s=>{const a=s.detail.submitActionProps.responseObject,{flashMessages:e,status:r}=a.data;e&&(r===h.success&&(this._flashMessengerApi.parseAndAddFlashMessages(e,c),this._formConnectorRef.value?.formService.resetForm()),r===h.failed&&this._flashMessengerApi.parseAndAddFlashMessages(e,this._flashMessengerContainerName))},this._onSubmitError=s=>{const a=s.detail.submitActionProps.err.request.status,e=_.getMessageBasedOnStatusCode(a,this._translationApi);this._flashMessengerApi.addFlashMessage({content:e,type:l.error,isCloseable:!1},this._flashMessengerContainerName)},this._onFormInvalid=()=>{this._flashMessengerApi.addFlashMessage({content:this._translationApi.translate("Fill in the required fields"),type:l.error,isCloseable:!1,timeout:0},this._flashMessengerContainerName)};const t=this.getApiSync(u.api);this._contactUrl=new A(t),this._flashMessengerApi=this.getApiSync(p.api),this._translationApi=this.getApiSync(d.api)}static{this.moduleName=n.component}connectedCallback(){super.connectedCallback(),this._id=Number(this.moduleInstanceId)!==0?this.moduleInstanceId:E(),this._flashMessengerContainerName=`${P}-${this._id}`;const t=this.querySelector(p.component);t&&(t.name=this._flashMessengerContainerName)}render(){return v`
2            <form-connector
3                ${I(this._formConnectorRef)}
4                @submit=${this._onSubmit}
5                @submitError=${this._onSubmitError}
6                @formInvalid=${this._onFormInvalid}
7                id="contact-form-connector-${this._id}"
8                submit-strategy="frontApi"
9            >
10                <form
11                    id="contact-form-${this._id}"
12                    action="${this._contactUrl.getContactUrl()}"
13                    method="post"
14                    class="form-container"
15                >
16                    ${this.getSlot("form")}
17                </form>
18            </form-connector>
19        `}}L([U({type:Number,attribute:"module-instance-id"})],S.prototype,"moduleInstanceId");class B extends C{constructor({contactFormService:t}){super(),this.moduleName=n.api,this.#t=t}#t;submit(t){return this.#t.submitContactForm(t)}}class G extends g{constructor({httpApi:t,settingsApi:s,localeOptions:a}){super(t),this.moduleName=n.httpApi,this.#t=new A(s,a)}#t;submitContactForm(t){const s=this.#t.getContactUrl();return this.fetch({url:s,data:t,method:M.post},{decorators:[m.status,m.flashMessages]})}}class x extends N{#t;#s;#e;constructor({httpApi:t,settingsApi:s,localeOptions:a,flashMessengerApi:e,translationsApi:r}){super(),this.#t=new G({httpApi:t,settingsApi:s,localeOptions:a}),this.#s=e,this.#e=r}async submitContactForm(t){try{const{data:s}=await this.#t.submitContactForm(t).response,{flashMessages:a,status:e}=s;return this._displayFlashMessages(a),e}catch(s){return this._displayErrorFlashMessages(s),h.failed}}_displayFlashMessages(t){t&&this.#s.parseAndAddFlashMessages(t,c)}_displayErrorFlashMessages(t){const s=t.request,a=_.getMessageBasedOnStatusCode(s.status,this.#e);this.#s.addFlashMessage({content:a,type:l.error,isCloseable:!1},c)}}class V extends T{static{this.featureName=n.feature}static{this.dependencies=[F.feature]}
19async init(){const t=this.getApiSync(b),s=await this.getApi(u.api),a=this.getApiSync(p.api),e=await this.getApi(d.api),r=new x({httpApi:t,settingsApi:s,flashMessengerApi:a,translationsApi:e}),o=new B({contactFormService:r});return{cores:[{type:O,instance:[S]},{type:R.api,instance:[o]}]}}}export{V as ContactFormInitializer};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.