whoami7 - Manager
:
/
home
/
dataiclx
/
vielorbe.com
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
surecart
/
Upload File:
files >> //home/dataiclx/vielorbe.com/wp-content/plugins/surecart/dist/components/surecart/p-8b323bfb.js.map
{"version":3,"names":["FormSubmitController","constructor","input","options","this","form","_a","_b","closestElement","shadowRoot","querySelector","name","value","disabled","handleFormData","bind","selector","el","document","window","closest","getRootNode","host","addFormData","addEventListener","removeFormData","removeEventListener","event","Array","isArray","forEach","val","formData","append","toString","parseFormData","data","email","first_name","last_name","phone","password","shipping_city","shipping_country","shipping_line_1","shipping_line_2","shipping_postal_code","shipping_state","billing_city","billing_country","billing_line_1","billing_line_2","billing_postal_code","billing_state","tax_number_type","tax_number","rest","shipping_address","city","country","line_1","line_2","postal_code","state","billing_address","Object","keys","length","tax_identifier","number","number_type","metadata","reportChildrenValidity","async","element","items","querySelectorAll","filter","reportValidity","isValid"],"sources":["src/functions/form-data.ts"],"sourcesContent":["interface FormDataEvent extends Event {\n readonly formData: FormData;\n}\ninterface FormDataEventInit extends EventInit {\n formData: FormData;\n}\ndeclare var FormDataEvent: {\n prototype: FormDataEvent;\n new (type: string, eventInitDict?: FormDataEventInit): FormDataEvent;\n};\n\nexport interface FormSubmitControllerOptions {\n /** A function that returns the form containing the form control. */\n form: (input: unknown) => HTMLFormElement | null;\n /** A function that returns the form control's name, which will be submitted with the form data. */\n name: (input: unknown) => string;\n /** A function that returns the form control's current value. */\n value: (input: unknown) => unknown | unknown[];\n /** A function that returns the form control's current disabled state. If disabled, the value won't be submitted. */\n disabled: (input: unknown) => boolean;\n}\n\nexport class FormSubmitController {\n form: HTMLFormElement | null = null;\n input: any;\n options: FormSubmitControllerOptions;\n constructor(input: any, options?: Partial<FormSubmitControllerOptions>) {\n this.input = input;\n this.options = {\n form: (input: HTMLInputElement) => this.closestElement('sc-form', input)?.shadowRoot?.querySelector('form') || this.closestElement('form', input),\n name: (input: HTMLInputElement) => input.name,\n value: (input: HTMLInputElement) => input.value,\n disabled: (input: HTMLInputElement) => input.disabled,\n ...options,\n };\n\n this.form = this.options.form(this.input);\n this.handleFormData = this.handleFormData.bind(this);\n }\n\n closestElement(selector, el) {\n if (!el) return null;\n return (el && el != document && el != window && el.closest(selector)) || this.closestElement(selector, el.getRootNode().host);\n }\n\n addFormData() {\n if (!this.form) return;\n this.form.addEventListener('formdata', this.handleFormData);\n }\n\n removeFormData() {\n if (!this.form) return;\n this.form.removeEventListener('formdata', this.handleFormData);\n }\n\n handleFormData(event: FormDataEvent) {\n const name = this.options.name(this.input);\n const value = this.options.value(this.input);\n\n if (typeof name === 'string' && typeof value !== 'undefined') {\n if (Array.isArray(value)) {\n (value as unknown[]).forEach(val => {\n if (val) {\n event.formData.append(name, (val as string | number | boolean).toString());\n }\n });\n } else {\n if (value) {\n event.formData.append(name, (value as string | number | boolean).toString());\n }\n }\n }\n }\n}\n\nexport const parseFormData = (data: any) => {\n const {\n email,\n name,\n first_name,\n last_name,\n phone,\n password,\n shipping_city,\n shipping_country,\n shipping_line_1,\n shipping_line_2,\n shipping_postal_code,\n shipping_state,\n billing_city,\n billing_country,\n billing_line_1,\n billing_line_2,\n billing_postal_code,\n billing_state,\n 'tax_identifier.number_type': tax_number_type,\n 'tax_identifier.number': tax_number,\n ...rest\n } = data;\n\n const shipping_address = {\n ...(shipping_city ? { city: shipping_city } : {}),\n ...(shipping_country ? { country: shipping_country } : {}),\n ...(shipping_line_1 ? { line_1: shipping_line_1 } : {}),\n ...(shipping_line_2 ? { line_2: shipping_line_2 } : {}),\n ...(shipping_postal_code ? { postal_code: shipping_postal_code } : {}),\n ...(shipping_state ? { state: shipping_state } : {}),\n };\n\n const billing_address = {\n ...(billing_city ? { city: billing_city } : {}),\n ...(billing_country ? { country: billing_country } : {}),\n ...(billing_line_1 ? { line_1: billing_line_1 } : {}),\n ...(billing_line_2 ? { line_2: billing_line_2 } : {}),\n ...(billing_postal_code ? { postal_code: billing_postal_code } : {}),\n ...(billing_state ? { state: billing_state } : {}),\n };\n\n return {\n ...(name ? { name } : {}),\n ...(email ? { email } : {}),\n ...(first_name ? { first_name } : {}),\n ...(last_name ? { last_name } : {}),\n ...(phone ? { phone } : {}),\n ...(password ? { password } : {}),\n ...(Object.keys(shipping_address || {}).length ? { shipping_address } : {}),\n ...(Object.keys(billing_address || {}).length ? { billing_address } : {}),\n ...(tax_number_type && tax_number ? { tax_identifier: { number: tax_number, number_type: tax_number_type } } : {}),\n ...(Object.keys(rest)?.length ? { metadata: rest } : {}),\n };\n};\n\nexport const reportChildrenValidity = async (element: HTMLElement) => {\n const items = ([...element.shadowRoot.querySelectorAll('*')] as HTMLElement[]).filter((el: any) => typeof el.reportValidity === 'function') as any;\n for (const el of items) {\n const isValid = await el.reportValidity();\n if (!isValid) {\n return false;\n }\n }\n return true;\n};\n"],"mappings":"MAsBaA,EAIX,WAAAC,CAAYC,EAAYC,GAHxBC,KAAAC,KAA+B,KAI7BD,KAAKF,MAAQA,EACbE,KAAKD,QAAU,CACbE,KAAOH,IAAuB,IAAAI,EAAAC,EAAK,QAAAA,GAAAD,EAAAF,KAAKI,eAAe,UAAWN,MAAM,MAAAI,SAAA,SAAAA,EAAEG,cAAU,MAAAF,SAAA,SAAAA,EAAEG,cAAc,UAAWN,KAAKI,eAAe,OAAQN,EAAM,EACjJS,KAAOT,GAA4BA,EAAMS,KACzCC,MAAQV,GAA4BA,EAAMU,MAC1CC,SAAWX,GAA4BA,EAAMW,YAC1CV,GAGLC,KAAKC,KAAOD,KAAKD,QAAQE,KAAKD,KAAKF,OACnCE,KAAKU,eAAiBV,KAAKU,eAAeC,KAAKX,K,CAGjD,cAAAI,CAAeQ,EAAUC,GACvB,IAAKA,EAAI,OAAO,KAChB,OAAQA,GAAMA,GAAMC,UAAYD,GAAME,QAAUF,EAAGG,QAAQJ,IAAcZ,KAAKI,eAAeQ,EAAUC,EAAGI,cAAcC,K,CAG1H,WAAAC,GACE,IAAKnB,KAAKC,KAAM,OAChBD,KAAKC,KAA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