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A,UCtC3BE,EAAOC,QAAUzJ,cCAjBwJ,EAAOC,QAAUC","sources":["webpack://Dobbies.Commerce/./src/dotdigital-extension/DataServiceEntities.g.ts?cecd","webpack://Dobbies.Commerce/./src/dotdigital-extension/DataActionExtension.g.ts?36a7","webpack://Dobbies.Commerce/./src/modules/dobbies-vendor-on-board/dobbies-vendor-on-board.tsx?3f8c","webpack://Dobbies.Commerce/./src/modules/dobbies-vendor-on-board/dobbies-vendor-on-board.view.tsx?2003","webpack://Dobbies.Commerce/./lib/dobbies-vendor-on-board/module-registration.js?9d9e","webpack://Dobbies.Commerce/external var \"React\"?0d3b","webpack://Dobbies.Commerce/external var \"ReactDOM\"?853b"],"sourcesContent":["// tslint:disable\r\n/* eslint-disable security/detect-object-injection */\r\nimport * as EntityClasses from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceModels.g';\r\nimport * as Entities from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\n\r\n/**\r\n * VSIRestAPIHandler entity interface.\r\n */\r\nexport interface IVSIRestAPIHandler {\r\n Id: number;\r\n result?: string;\r\n ExtensionProperties?: Entities.CommerceProperty[];\r\n}\r\n\r\n/**\r\n * VSIRestAPIHandler entity class.\r\n */\r\nexport class VSIRestAPIHandlerExtensionClass implements IVSIRestAPIHandler {\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n public Id: number;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n public result: string;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n public ExtensionProperties: Entities.CommerceProperty[];\r\n\r\n // Navigation properties names\r\n\r\n /**\r\n * Construct an object from odata response.\r\n * @param {any} odataObject The odata result object.\r\n */\r\n constructor(odataObject?: any) {\r\n odataObject = odataObject || {};\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.Id = odataObject.Id;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.result = odataObject.result;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.ExtensionProperties = undefined;\r\n if (odataObject.ExtensionProperties) {\r\n this.ExtensionProperties = [];\r\n for (var i = 0; i < odataObject.ExtensionProperties.length; i++) {\r\n if (odataObject.ExtensionProperties[i]) {\r\n if (odataObject.ExtensionProperties[i]['@odata.type']) {\r\n var className: string = odataObject.ExtensionProperties[i]['@odata.type'];\r\n className = className.substr(className.lastIndexOf('.') + 1).concat('Class');\r\n if (EntityClasses[className]) {\r\n this.ExtensionProperties[i] = new EntityClasses[className](odataObject.ExtensionProperties[i]);\r\n }\r\n } else {\r\n this.ExtensionProperties[i] = new EntityClasses.CommercePropertyClass(odataObject.ExtensionProperties[i]);\r\n }\r\n } else {\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.ExtensionProperties[i] = undefined;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n * THIS FILE IS AN AUTOGENERATED TYPESCRIPT PROXY EXTENSION.\r\n * TO USE THIS FILE, IT MUST BE ADDED TO A D365COMMERCE APPLICATION\r\n */\r\n// tslint:disable\r\nimport { AsyncResult, callActionOrExecute, DataServiceQuery, IContext, IDataServiceRequest } from '@msdyn365-commerce/retail-proxy';\r\n// @ts-ignore\r\nimport * as EntityClasses from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceModels.g';\r\nimport * as DataServiceEntities from './DataServiceEntities.g';\r\n\r\n// @ts-ignore\r\nfunction vSIGetAPIResponseQuery(id?: number): DataServiceQuery {\r\n const key = id ? { Id: id } : null;\r\n return new DataServiceQuery('VSIGetRestAPIResponse', 'VSIRestAPIHandler', DataServiceEntities.VSIRestAPIHandlerExtensionClass, key);\r\n}\r\n\r\nexport function createVSIInitiateRestCallInput(\r\n targetSystem: string,\r\n methodType: string,\r\n requestHeader: string,\r\n requestBody: string,\r\n urlParams: string,\r\n servicePath: string\r\n): IDataServiceRequest {\r\n const query = vSIGetAPIResponseQuery();\r\n return query.createDataServiceRequestForOperation(\r\n 'VSI_CallGenericRestAPIHandler',\r\n true,\r\n DataServiceEntities.VSIRestAPIHandlerExtensionClass,\r\n 'false',\r\n { bypassCache: 'get', returnEntity: 'DataServiceEntities.IVSIRestAPIHandler' },\r\n {\r\n targetSystem: targetSystem,\r\n methodType: methodType,\r\n requestHeader: requestHeader,\r\n requestBody: requestBody,\r\n urlParams: urlParams,\r\n servicePath: servicePath\r\n }\r\n );\r\n}\r\n\r\nexport function vSIInitiateRestCallAsync(\r\n context: IContext,\r\n targetSystem: string,\r\n methodType: string,\r\n requestHeader: string,\r\n requestBody: string,\r\n urlParams: string,\r\n servicePath: string\r\n): AsyncResult {\r\n const request = createVSIInitiateRestCallInput(targetSystem, methodType, requestHeader, requestBody, urlParams, servicePath);\r\n return callActionOrExecute(request, context.callerContext);\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable security/detect-object-injection */\r\n/* eslint-disable security/detect-unsafe-regex */\r\n\r\nimport * as React from 'react';\r\n\r\n// @ts-ignore\r\nimport { Node } from '@msdyn365-commerce-modules/utilities';\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { IContext } from '@msdyn365-commerce/retail-proxy';\r\nimport { GoogleReCaptcha, GoogleReCaptchaProvider } from 'react-google-recaptcha-v3';\r\nimport { vSIInitiateRestCallAsync } from '../../dotdigital-extension/DataActionExtension.g';\r\nimport { IDobbiesVendorOnBoardProps } from './dobbies-vendor-on-board.props.autogenerated';\r\n\r\nexport interface IDobbiesVendorOnBoardViewProps extends IDobbiesVendorOnBoardProps<{}> {\r\n companyInfoForm: React.ReactNode;\r\n contactInfoForm: React.ReactNode;\r\n recaptcha: React.ReactNode;\r\n formButton: React.ReactNode;\r\n formFunction?: ((event: React.FormEvent) => void) | undefined;\r\n heading: React.ReactNode;\r\n description: React.ReactNode;\r\n}\r\n\r\ninterface IVendorOnBoardInputProps {\r\n id?: string;\r\n // tslint:disable-next-line:no-any\r\n type: any;\r\n pattern?: string;\r\n gridClass?: string;\r\n}\r\n\r\ninterface IState {\r\n companyName?: string;\r\n businessType?: string;\r\n companyInfo?: string;\r\n companyNumber?: string;\r\n companyWebsite?: string;\r\n country?: string;\r\n zipCode?: string;\r\n street?: string;\r\n city?: string;\r\n state?: string;\r\n firstName?: string;\r\n lastName?: string;\r\n email?: string;\r\n confirmEmail?: string;\r\n phoneNumber?: string;\r\n isBtnEnable?: boolean;\r\n submissionErrorMsg?: string;\r\n submissionSuccessMsg?: string;\r\n}\r\n\r\ninterface IVendorData {\r\n '@odata.type': '#Microsoft.Dynamics.DataEntities.ProspectiveVendorRegistrationRequest';\r\n EmailAddress: string;\r\n OrganizationNumber?: string;\r\n RequestCompany?: string;\r\n BusinessLineDescription?: string;\r\n LanguageId?: string;\r\n ContactPersonMiddleName?: string;\r\n ProcessedDate?: string;\r\n SubmittedDate?: string;\r\n BusinessJustificationDescription?: string;\r\n ContactPersonFirstName?: string;\r\n ContactPersonLastName?: string;\r\n OrganizationType?: string;\r\n CompanyName?: string;\r\n}\r\n\r\ninterface IElementProps {\r\n id?: string;\r\n // tslint:disable-next-line:no-any\r\n type: any;\r\n gridClass?: string;\r\n}\r\n\r\n/**\r\n *\r\n * DobbiesVendorOnBoard component\r\n * @extends {React.PureComponent>}\r\n */\r\nclass DobbiesVendorOnBoard extends React.PureComponent, IState> {\r\n private moduleClassName: string = 'ms-vendor-on-board';\r\n\r\n constructor(props: IDobbiesVendorOnBoardProps<{}>, state: IState) {\r\n super(props);\r\n\r\n this.state = {\r\n companyName: '',\r\n businessType: '',\r\n companyInfo: '',\r\n companyNumber: '',\r\n companyWebsite: '',\r\n country: '',\r\n zipCode: '',\r\n street: '',\r\n city: '',\r\n state: '',\r\n firstName: '',\r\n lastName: '',\r\n email: '',\r\n confirmEmail: '',\r\n phoneNumber: '',\r\n isBtnEnable: false\r\n };\r\n }\r\n\r\n public onFormSubmit = async (event: React.SyntheticEvent) => {\r\n event.preventDefault();\r\n\r\n const {\r\n companyName = '',\r\n businessType = '',\r\n companyInfo = '',\r\n companyNumber = '',\r\n companyWebsite = '',\r\n country = '',\r\n zipCode = '',\r\n street = '',\r\n city = '',\r\n state = '',\r\n firstName = '',\r\n lastName = '',\r\n email = '',\r\n confirmEmail = '',\r\n phoneNumber = '',\r\n isBtnEnable\r\n }: IState = this.state;\r\n\r\n if (isBtnEnable) {\r\n const data = {\r\n companyName,\r\n businessType,\r\n companyInfo,\r\n companyNumber,\r\n companyWebsite,\r\n country,\r\n zipCode,\r\n street,\r\n city,\r\n state,\r\n firstName,\r\n lastName,\r\n email,\r\n confirmEmail,\r\n phoneNumber\r\n };\r\n\r\n const requiredFieds = [\r\n 'companyName',\r\n 'businessType',\r\n 'companyInfo',\r\n 'country',\r\n 'firstName',\r\n 'lastName',\r\n 'email',\r\n 'confirmEmail'\r\n ];\r\n\r\n document.querySelectorAll('.ms-vendor-error').forEach(e => e.remove());\r\n let isError: boolean = false;\r\n\r\n requiredFieds.forEach(field => {\r\n if (!data[field]) {\r\n this.addError(field, this.props.resources.requiredFieldMissingError);\r\n isError = true;\r\n }\r\n });\r\n\r\n if (!isError) {\r\n const emailRegex = new RegExp(\r\n '^[a-zA-Z0-9!#$%&'+^_`{}~-]+(?:.[a-zA-Z0-9!#$%&'+^_`{}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'\r\n );\r\n\r\n if (!emailRegex.test(email)) {\r\n this.addError('email', this.props.resources.invalidEmailAddressError);\r\n isError = true;\r\n }\r\n if (!emailRegex.test(confirmEmail)) {\r\n this.addError('confirmEmail', this.props.resources.invalidEmailAddressError);\r\n isError = true;\r\n }\r\n if (email !== confirmEmail) {\r\n this.addError('confirmEmail', this.props.resources.emailEntryMismatchError);\r\n isError = true;\r\n }\r\n if (!isError) {\r\n // First hybrid vendorObject\r\n const today = new Date();\r\n const formattedDate = today.toISOString();\r\n const vendorData: IVendorData = {\r\n '@odata.type': '#Microsoft.Dynamics.DataEntities.ProspectiveVendorRegistrationRequest',\r\n EmailAddress: email,\r\n OrganizationNumber: companyNumber,\r\n RequestCompany: 'DGC',\r\n BusinessLineDescription: businessType,\r\n LanguageId: 'en-GB',\r\n ContactPersonFirstName: firstName,\r\n ContactPersonLastName: lastName,\r\n ContactPersonMiddleName: firstName,\r\n // ProcessedDate: formattedDate, // today's date in this data_formatted '1900-01-01T00:00:00Z'\r\n SubmittedDate: formattedDate, // today's date in this data_formatted\r\n BusinessJustificationDescription: companyInfo, // rich text field\r\n OrganizationType: 'Organization', // add optional field\r\n CompanyName: companyName\r\n };\r\n this._registerVendor(vendorData).catch(error => error);\r\n }\r\n }\r\n }\r\n };\r\n // Following function first calls retail proxy to get token and then sends this token in headers of second request to register vendor\r\n public _registerVendor = async (vendorInfo: IVendorData) => {\r\n const {\r\n context: { actionContext },\r\n resources: { submissionErrorMessage, submissionSuccessMessage }\r\n } = this.props;\r\n\r\n try {\r\n const context: IContext = { callerContext: actionContext };\r\n console.log('Api Data :>> ', vendorInfo);\r\n // const requestHeader = {\r\n // grant_type: 'client_credentials'\r\n // };\r\n const vendorResponse = await vSIInitiateRestCallAsync(\r\n context,\r\n 'D365HQ',\r\n 'post',\r\n \"{'TargetProviderSystem':'STSWindows' , 'ProviderType':'Microsoft'}\",\r\n JSON.stringify(vendorInfo),\r\n '',\r\n 'data/ProspectiveVendorRegistrationRequests'\r\n );\r\n if (vendorResponse.result) {\r\n const vendorSubmissionError = JSON.parse(vendorResponse.result);\r\n if (vendorSubmissionError.error && vendorSubmissionError.error.message) {\r\n // Error in getting token\r\n console.log('error in submitting vendor details');\r\n this.setState({ submissionErrorMsg: submissionErrorMessage, submissionSuccessMsg: undefined });\r\n return;\r\n } else {\r\n this.setState({ submissionSuccessMsg: submissionSuccessMessage, submissionErrorMsg: '' });\r\n console.log('submitted', vendorResponse);\r\n // Now clear all fields\r\n }\r\n }\r\n // First get token\r\n // const tokenResponse = await vSIInitiateRestCallAsync(context, 'Stswindows', 'get', '\"cache-control\",\"no-cache\"', JSON.stringify(requestHeader), '', '');\r\n // if (tokenResponse.result) {\r\n // const errorMessage: IErrorMessage = JSON.parse(tokenResponse.result);\r\n // if (errorMessage.message && errorMessage.message.length > 0) {\r\n // // Error in getting token\r\n // console.log('error in getting token');\r\n // this.setState({ submissionErrorMsg: submissionErrorMessage, submissionSuccessMsg: undefined });\r\n // return;\r\n // } else {\r\n // /* Call api to register vendor with this token & vendor data,\r\n // Send this token in headers to submit vendor registration */\r\n // const vendorResponse = await vSIInitiateRestCallAsync(context, 'Stswindows', 'get', '\"cache-control\",\"no-cache\"', JSON.stringify(vendorInfo), '', '');\r\n // const vendorSubmissionError: IErrorMessage = JSON.parse(tokenResponse.result);\r\n // if (vendorSubmissionError.message && vendorSubmissionError.message.length > 0) {\r\n // // Error in getting token\r\n // console.log('error in submitting vendor details');\r\n // this.setState({ submissionErrorMsg: submissionErrorMessage, submissionSuccessMsg: undefined });\r\n // return;\r\n // } else {\r\n // this.setState({ submissionSuccessMsg: submissionSuccessMessage, submissionErrorMsg: undefined });\r\n // console.log('submitted', vendorResponse);\r\n // // Now clear all fields\r\n\r\n // }\r\n // }\r\n // } else {\r\n // this.setState({ submissionErrorMsg: submissionErrorMessage, submissionSuccessMsg: undefined });\r\n // console.log('error in calling api');\r\n // }\r\n } catch (error) {\r\n this.props.telemetry.trace(error);\r\n this.setState({ submissionErrorMsg: submissionErrorMessage, submissionSuccessMsg: undefined });\r\n console.log('error in calling api', error);\r\n }\r\n };\r\n /**\r\n * this function is for rendering valiadtion error messages\r\n * @props element: string, message: string\r\n */\r\n public addError = (elem: string, message: string) => {\r\n const parent = document.getElementById(elem);\r\n const error = document.createElement('SPAN');\r\n error.innerText = message;\r\n error.classList.add('ms-vendor-error');\r\n parent?.parentNode!.appendChild(error);\r\n };\r\n\r\n public render(): JSX.Element | null {\r\n const { config, context } = this.props;\r\n\r\n const propsData = {\r\n ...this.props,\r\n formFunction: this.onFormSubmit,\r\n companyInfoForm: this.formSections('company'),\r\n contactInfoForm: this.formSections('contact'),\r\n recaptcha: this.captcha(),\r\n formButton: this._renderButton(),\r\n heading: (\r\n \r\n ),\r\n description: config.description && (\r\n \r\n )\r\n };\r\n return this.props.renderView(propsData);\r\n }\r\n\r\n public handleHeadingChange = (event: Msdyn365.ContentEditableEvent) => (this.props.config.heading!.text = event.target.value);\r\n public handleParagraphChange = (event: Msdyn365.ContentEditableEvent) => (this.props.config.description = event.target.value);\r\n\r\n /**\r\n * name\r\n */\r\n public formSections = (type: string) => {\r\n const types = {\r\n company: [\r\n { id: 'companyName', type: 'input', pattern: undefined, gridClass: 'col-md-6 col-sm-12' },\r\n { id: 'businessType', type: 'input', pattern: undefined, gridClass: 'col-md-6 col-sm-12' },\r\n { id: 'companyInfo', type: 'text', pattern: undefined, gridClass: 'col-md-12 col-sm-12' },\r\n { id: 'companyNumber', type: 'input', pattern: undefined, gridClass: 'col-md-6 col-sm-12' },\r\n { id: 'companyWebsite', type: 'input', pattern: undefined, gridClass: 'col-md-6 col-sm-12' },\r\n { id: 'country', type: 'input', pattern: undefined, gridClass: 'col-md-6 col-sm-12' },\r\n { id: 'zipCode', type: 'input', pattern: undefined, gridClass: 'col-md-6 col-sm-12' },\r\n { id: 'street', type: 'input', pattern: undefined, gridClass: 'col-md-12 col-sm-12' },\r\n { id: 'city', type: 'input', pattern: undefined, gridClass: 'col-md-6 col-sm-12' },\r\n { id: 'state', type: 'input', pattern: undefined, gridClass: 'col-md-6 col-sm-12' }\r\n ],\r\n contact: [\r\n { id: 'firstName', type: 'input', pattern: undefined, gridClass: 'col-md-6 col-sm-12' },\r\n { id: 'lastName', type: 'input', pattern: undefined, gridClass: 'col-md-6 col-sm-12' },\r\n { id: 'email', type: 'email', pattern: undefined, gridClass: 'col-md-6 col-sm-12' },\r\n { id: 'confirmEmail', type: 'email', pattern: undefined, gridClass: 'col-md-6 col-sm-12' },\r\n { id: 'phoneNumber', type: 'input', pattern: undefined, gridClass: 'col-md-6 col-sm-12' }\r\n ]\r\n };\r\n\r\n return types[type].map((elem: IElementProps) => this._renderInput(elem));\r\n };\r\n\r\n public onChangeInputState = (stateName: string) => (event: React.ChangeEvent) => {\r\n this.setState({ [stateName]: event.target.value });\r\n };\r\n /**\r\n * name\r\n */\r\n public _renderInput = (props: IVendorOnBoardInputProps) => {\r\n const { id = '', type, pattern, gridClass } = props;\r\n const className = `${this.moduleClassName}__item`;\r\n // tslint:disable-next-line: no-constant-condition\r\n if (type !== 'text') {\r\n return (\r\n
\r\n \r\n \r\n
\r\n );\r\n } else {\r\n return (\r\n
\r\n \r\n \r\n
\r\n );\r\n }\r\n };\r\n\r\n public captcha = () => {\r\n const key = this.props.config.googleSiteKey;\r\n return (\r\n
\r\n \r\n \r\n \r\n
\r\n );\r\n };\r\n\r\n public _renderButton = () => {\r\n const { isBtnEnable, submissionErrorMsg, submissionSuccessMsg } = this.state;\r\n return (\r\n
\r\n {submissionErrorMsg && {submissionErrorMsg}}\r\n {submissionSuccessMsg && {submissionSuccessMsg}}\r\n \r\n
\r\n );\r\n };\r\n\r\n public onCaptchaChange = () => {\r\n this.setState({\r\n isBtnEnable: true\r\n });\r\n };\r\n}\r\n\r\nexport default DobbiesVendorOnBoard;\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport { Node } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\nimport { IDobbiesVendorOnBoardViewProps } from './dobbies-vendor-on-board';\r\n\r\nexport default (props: IDobbiesVendorOnBoardViewProps) => {\r\n const {\r\n resources: { companyHeading, contactHeading },\r\n heading,\r\n description,\r\n companyInfoForm,\r\n contactInfoForm,\r\n recaptcha,\r\n formButton,\r\n formFunction\r\n } = props;\r\n return (\r\n
\r\n
\r\n
\r\n \r\n {heading}\r\n {description}\r\n \r\n
\r\n
\r\n
\r\n

{companyHeading}

\r\n
{companyInfoForm}
\r\n

{contactHeading}

\r\n
{contactInfoForm}
\r\n {formButton}\r\n {recaptcha}\r\n
\r\n
\r\n
\r\n
\r\n );\r\n};\r\n","const binding = { modules: {}, dataActions: {} };\n\n (binding.modules['dobbies-vendor-on-board'] = {\n c: () => require('partner/modules/dobbies-vendor-on-board/dobbies-vendor-on-board.tsx'),\n $type: 'contentModule',\n da: [],\n \n iNM: false,\n ns: '__local__',\n n: 'dobbies-vendor-on-board',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/dobbies-vendor-on-board'\n });\n \n\n \n window.__bindings__ = window.__bindings__ || {};\n window.__bindings__.modules = {\n ...window.__bindings__.modules || {},\n ...binding.modules\n };\n \n window.__bindings__.dataActions = {\n ...window.__bindings__.dataActions || {},\n ...binding.dataActions\n };\n export const viewDictionary = {};\n viewDictionary['__local__|__local__|modules|dobbies-vendor-on-board|dobbies-vendor-on-board'] = {\n c: () => require('partner/modules/dobbies-vendor-on-board/dobbies-vendor-on-board.view.tsx'),\n cn: '__local__-__local__-dobbies-vendor-on-board'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\n };","module.exports = React;","module.exports = ReactDOM;"],"names":["VSIRestAPIHandlerExtensionClass","constructor","odataObject","this","Id","result","ExtensionProperties","undefined","i","length","className","substr","lastIndexOf","concat","EntityClasses","createVSIInitiateRestCallInput","targetSystem","methodType","requestHeader","requestBody","urlParams","servicePath","id","key","DataServiceQuery","DataServiceEntities","vSIGetAPIResponseQuery","createDataServiceRequestForOperation","bypassCache","returnEntity","vSIInitiateRestCallAsync","context","request","callActionOrExecute","callerContext","DobbiesVendorOnBoard","React","props","state","super","moduleClassName","onFormSubmit","async","event","preventDefault","companyName","businessType","companyInfo","companyNumber","companyWebsite","country","zipCode","street","city","firstName","lastName","email","confirmEmail","phoneNumber","isBtnEnable","data","requiredFieds","document","querySelectorAll","forEach","e","remove","isError","field","addError","resources","requiredFieldMissingError","emailRegex","RegExp","test","invalidEmailAddressError","emailEntryMismatchError","vendorData","EmailAddress","OrganizationNumber","RequestCompany","BusinessLineDescription","LanguageId","ContactPersonFirstName","ContactPersonLastName","ContactPersonMiddleName","SubmittedDate","Date","toISOString","BusinessJustificationDescription","OrganizationType","CompanyName","_registerVendor","catch","error","actionContext","submissionErrorMessage","submissionSuccessMessage","console","log","vendorInfo","vendorResponse","JSON","stringify","vendorSubmissionError","parse","message","setState","submissionErrorMsg","submissionSuccessMsg","telemetry","trace","elem","parent","getElementById","createElement","innerText","classList","add","parentNode","appendChild","handleHeadingChange","config","heading","text","target","value","handleParagraphChange","description","formSections","type","company","pattern","gridClass","contact","map","_renderInput","onChangeInputState","stateName","htmlFor","onChange","captcha","googleSiteKey","GoogleReCaptchaProvider","reCaptchaKey","GoogleReCaptcha","onVerify","onCaptchaChange","_renderButton","Node","disabled","onClick","buttonText","render","propsData","_objectSpread","formFunction","companyInfoForm","contactInfoForm","recaptcha","formButton","Msdyn365","Object","assign","editProps","onEdit","requestContext","renderView","companyHeading","contactHeading","onSubmit","binding","modules","dataActions","c","require","$type","da","iNM","ns","n","p","pdp","md","window","__bindings__","viewDictionary","cn","module","exports","ReactDOM"],"sourceRoot":""}