{"version":3,"sources":["webpack:///./lib/szf-contact-us/module-registration.js?faa5","webpack:///./src/actions/post-contact-us-form.action.ts?4c7d","webpack:///./src/actions/get-crm-token.action.ts?9dd2","webpack:///./src/actions/get-existing-contact.action.ts?deef","webpack:///./src/actions/get-inquery-options.action.ts?ea32","webpack:///./src/modules/szf-contact-us/szf-contact-us.view.tsx?432b","webpack:///./src/modules/szf-contact-us/szf-contact-us.tsx?1554","webpack:///external \"React\"?c481","webpack:///external \"ReactDOM\"?4b2d","webpack:///./src/actions/post-new-contact.action.ts?8eb0","webpack:///./src/utilities/szf-modal.component.tsx?b73e"],"names":["binding","modules","dataActions","c","require","$type","da","name","path","runOn","iNM","ns","n","p","pdp","md","registerSanitizedActionPath","sanitizedActionPath","dataAction","default","Error","prototype","RegistrationId","id","window","__bindings__","_objectSpread","viewDictionary","cn","PostContactUsFormInput","constructor","data","file","fileBase64Code","CRMtoken","contactID","getCacheKey","getCacheObjectType","dataCacheType","this","Inquiry","description","email","firstName","lastName","phone","countryCode","updateNpromotion","token","Msdyn365","action","async","input","ctx","szfCRMDomain","requestContext","app","config","_input$file","_input$file2","response","timeout","headers","incidentid","status","msg","error","message","undefined","contactFormInput","args","inputData","GetCrmTokenInput","szfCRMClientSecret","qs","stringify","access_token","GetExistingContactInput","value","length","contactid","createExistingContactInput","GetInqueryOptionsInput","createInqueryOptionInput","props","_props$context$reques","_props$config$success","_props$context$reques2","_props$config$failMod","_props$config$success2","_props$config$failMod2","loading","setLoading","React","state","setState","firstNameInvalid","lastNameInvalid","emailInvalid","phoneInvalid","InquiryInvalid","descriptionInvalid","fileInvalid","isModalOpen","setIsModalOpen","contactUsError","setContactUsError","fileRef","inquiryOptionsData","setInquiryOptionsData","setFile","setFileBase64Code","inquiryOptions","locale","context","request","updateAndPromotionCheckboxLabel","successImageProps","gridSettings","imageSettings","successModalImage","failureImageProps","failModalImage","imageContainer","className","successImage","Node","Object","assign","MsDyn365","preserveImageSpace","editProps","key","moduleType","typeName","imagePropertyName","moduleId","shouldSkipToMainImage","failureImage","firstnameLabel","lastnameLabel","emailLabel","phoneLabel","inquirySelectLabel","descriptionLabel","fileLabel","submitButtonLabel","genericErrorMessage","invalidOrEmptyFieldError","dropdownChooseOptionMessage","maxFileSize","fileInvalidMessage","szfSuccessModalHeading","szfSuccessModalMessage","szfFailModalHeading","descriptionInvalidMessage","resources","fileSizeKB","fileSize","updateAndPromotionLabel","text","onEdit","event","target","fetchInqueryOptions","_await$props$data$crm","crmToken","result","getInqueryOptionsDataAction","actionContext","inquiryOptionsLowercase","map","item","toLowerCase","filteredResult","includes","szf_arabic","szf_casetypeid","szf_name","filter","i","console","log","onChangeHandler","e","test","obj","handleFileChange","files","size","imagefile","reader","FileReader","readAsDataURL","onload","base64","toString","split","getbase64","resetForm","current","toggleModal","onSubmitForm","preventDefault","_document$getElementB","_document$getElementB2","_document$getElementB3","_document$getElementB4","_document$getElementB5","_document$getElementB6","_fileRef$current","document","getElementById","focus","mergePhoneWithCountryCode","_await$props$data$crm2","isContactAlreadyExist","contactExistInput","existingContactDataAction","checkExistingContact","createCaseInput","createCaseResponse","contactFormDataAction","createInputData","createContactInput","PostNewContactInput","createNewContactResponse","createNewContactDataAction","handlePhoneCountryCodeOnChange","country","numberWithoutCountryCode","dialCode","contactUsParagraph","SZFModal","isOpen","onModalToggle","modalTitle","onClick","src","alt","modalBody","Form","onSubmit","FormGroup","floating","Input","type","placeholder","onChange","invalid","required","Label","for","FormFeedback","PhoneInput","inputProps","enableAreaCodes","localization","arabicLocale","inputClass","autoFormat","enableSearch","optionItem","InputGroup","innerRef","Button","check","defaultChecked","checked","handleCheckboxChange","disabled","MoonLoader","color","SzfContactUs","render","renderView","module","exports","ReactDOM","createNewContactInput","modalFooter","createElement","Modal","zIndex","applicationNode","autoFocus","toggle","ModalHeader","ModalBody","ModalFooter"],"mappings":";wvBAAA,MAAMA,EAAU,CAAEC,QAAS,GAAIC,YAAa,IAwCvCF,EAAQC,QAAQ,kBAAoB,CACjCE,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,GAAgBpM,EAEjF,OACIS,IAAA4L,cAACC,QAAK,CACFhD,OAAQA,EACRiD,OAAQ,MACRC,gBAAiB,aACjBC,WAAW,EACXC,OAAQnD,GAAiBA,EACzB/G,UAAW,aAAaA,GAEvBgH,GAAc/I,IAAA4L,cAACM,cAAW,KAAEnD,GAC5BI,GAAanJ,IAAA4L,cAACO,YAAS,CAACpK,UAAU,kBAAkBoH,GACpDwC,GAAe3L,IAAA4L,cAACQ,cAAW,KAAET,O","file":"static/js/151.944cd6c10291a9035074.chunk.js","sourcesContent":["const binding = { modules: {}, dataActions: {} };\n\n const registerActionId = (actionPath) => {\n if (binding.dataActions[actionPath] &&\n binding.dataActions[actionPath].default &&\n binding.dataActions[actionPath].default.prototype &&\n binding.dataActions[actionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[actionPath].default.prototype.id] = binding.dataActions[actionPath];\n } else {\n Object.keys(binding.dataActions[actionPath] || {}).forEach(exportName => {\n if (binding.dataActions[actionPath][exportName] &&\n binding.dataActions[actionPath][exportName].prototype &&\n binding.dataActions[actionPath][exportName].prototype.Action) {\n binding.dataActions[binding.dataActions[actionPath][exportName].prototype.id] = binding.dataActions[actionPath][exportName];\n }\n })\n }\n };\n\n const registerSanitizedActionPath = (sanitizedActionPath, dataAction) => {\n if (process.env.NODE_ENV === 'development') {\n if (!dataAction.default) {\n throw new Error('Data action path does not have a default export');\n }\n if (!(dataAction.default.prototype.id && binding.dataActions[dataAction.default.prototype.id]) || !binding.dataActions[sanitizedActionPath]) {\n binding.dataActions[sanitizedActionPath] = dataAction;\n }\n } else {\n binding.dataActions[sanitizedActionPath] = dataAction;\n if (!binding.dataActions[sanitizedActionPath].default) {\n throw new Error('Data action path ' + sanitizedActionPath + ' does not have a default export');\n }\n binding.dataActions[sanitizedActionPath].default.prototype.RegistrationId = sanitizedActionPath;\n if (binding.dataActions[sanitizedActionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[sanitizedActionPath].default.prototype.id] = sanitizedActionPath;\n }\n }\n };\n \n\n (binding.modules['szf-contact-us'] = {\n c: () => require('partner/modules/szf-contact-us/szf-contact-us.tsx'),\n $type: 'contentModule',\n da: [{name:'crmToken', path:'actions/get-crm-token.action', runOn: 0}],\n \n iNM: false,\n ns: '__local__',\n n: 'szf-contact-us',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/szf-contact-us'\n });\n \n\n {\n const sanitizedActionPath = 'actions/get-crm-token.action';\n let dataAction = require('partner/actions/get-crm-token.action');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\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|szf-contact-us|szf-contact-us'] = {\n c: () => require('partner/modules/szf-contact-us/szf-contact-us.view.tsx'),\n cn: '__local__-__local__-szf-contact-us'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\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 * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\n/**\r\n * PostContactUsForm Input Action\r\n */\r\n\r\nimport { IPostContactUsFormInput } from './../modules/szf-contact-us/szf-contact-us.view';\r\nexport class PostContactUsFormInput implements Msdyn365.IActionInput {\r\n public Inquiry:string;\r\n public description: string;\r\n public email: string;\r\n public firstName: string;\r\n public lastName: string;\r\n public phone: string;\r\n // public termNcondition: boolean;\r\n public updateNpromotion: boolean;\r\n public fileBase64Code: string | ArrayBuffer | null | undefined;\r\n public file: File | undefined | null;\r\n public token: string | undefined;\r\n public contactID: string | undefined;\r\n constructor(\r\n data:IPostContactUsFormInput,\r\n file: File | undefined | null,\r\n fileBase64Code: string | ArrayBuffer | null | undefined,\r\n CRMtoken: string | undefined,\r\n contactID: string | undefined\r\n ) {\r\n this.Inquiry = data.Inquiry;\r\n this.description = data.description;\r\n this.email = data.email;\r\n this.firstName = data.firstName;\r\n this.lastName = data.lastName;\r\n this.phone = `+${data.countryCode}${data.phone}`;\r\n // this.termNcondition = data.termNcondition;\r\n this.updateNpromotion = data.updateNpromotion;\r\n this.file = file;\r\n this.fileBase64Code = fileBase64Code;\r\n this.token = CRMtoken;\r\n this.contactID = contactID;\r\n }\r\n // TODO: Determine if the results of this get action should cache the results and if so provide\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `CONTACTUSFORM`;\r\n public getCacheObjectType = () => 'CONTACTUSFORM';\r\n public dataCacheType = (): Msdyn365.CacheType => 'none';\r\n}\r\n\r\n// TODO: Create a data model here or import one to capture the response of the action\r\nexport interface IPostContactUsFormData {\r\n status: boolean;\r\n msg:string | undefined;\r\n id: string | undefined;\r\n}\r\n\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call\r\n */\r\nconst contactFormInput = (args: Msdyn365.ICreateActionContext,inputData:IPostContactUsFormInput,file: File | undefined | null,fileBase64Code: string | ArrayBuffer | null | undefined , CRMtoken: string | undefined, contactID:string|undefined ): Msdyn365.IActionInput => {\r\n return new PostContactUsFormInput(inputData,file,fileBase64Code,CRMtoken,contactID);\r\n};\r\n\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nasync function contactFormDataAction(input: PostContactUsFormInput, ctx: Msdyn365.IActionContext): Promise {\r\n try{\r\n const token = input.token;\r\n const szfCRMDomain = ctx.requestContext.app.config.szfCRMDomain;\r\n let data = {};\r\n if(input.file && input.file.name){\r\n data = {\r\n \"title\" : `Case by {${input.firstName} ${input.lastName}_${input.email}}`,\r\n \"customerid_contact@odata.bind\": `/contacts(${input.contactID})`, //Contact, to be replaced by contact created\r\n \"szf_CaseType@odata.bind\": `/szf_casetypes(${input.Inquiry})`, //Get case type first, then replace it with the ID\r\n \"caseorigincode\":3, //Website, will remain hardcoded\r\n \"prioritycode\": 2, //Normal, will remain hardcoded\r\n \"szf_description\":`${input.description}`, // Details of case\r\n \"Incident_Annotation\":[{ //File\r\n \"filename\" :`${input.file?.name}`,\r\n \"isdocument\" : true,\r\n \"subject\":`${input.file?.name}`,\r\n \"documentbody\" : `${input.fileBase64Code}`\r\n }]\r\n };\r\n }else{\r\n data = {\r\n \"title\" : `Case by {${input.firstName} ${input.lastName}_${input.email}}`,\r\n \"customerid_contact@odata.bind\": `/contacts(${input.contactID})`, //Contact, to be replaced by contact created\r\n \"szf_CaseType@odata.bind\": `/szf_casetypes(${input.Inquiry})`, //Get case type first, then replace it with the ID\r\n \"caseorigincode\":3, //Website, will remain hardcoded\r\n \"prioritycode\": 2, //Normal, will remain hardcoded\r\n \"szf_description\":`${input.description}`, // Details of case\r\n };\r\n }\r\n \r\n const response = await Msdyn365.sendRequest(`${szfCRMDomain}/api/data/v9.2//incidents`, \"post\", data, {\r\n timeout: 15000,\r\n headers: {\r\n 'Prefer': 'return=representation',\r\n 'Authorization':`Bearer ${token}`,\r\n 'Content-Type': 'application/json'\r\n }\r\n });\r\n if(response && response.data && response.data.incidentid){\r\n return {\r\n status: true,\r\n msg: 'success',\r\n id: response.data.incidentid\r\n };\r\n }else if (response && response.data && response.data.error){\r\n return {\r\n status: false,\r\n msg: response.data.error.message,\r\n id: undefined\r\n };\r\n }else{\r\n return {\r\n status: false,\r\n msg: undefined,\r\n id: undefined\r\n };\r\n }\r\n }catch(error){\r\n return {\r\n status: false,\r\n id: undefined,\r\n msg: 'Something went wrong, Please try again later.'\r\n };\r\n }\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >contactFormDataAction,\r\n // TODO: Give your data action a unique id\r\n id: 'PostContactUsForm',\r\n input: contactFormInput\r\n // TODO: Uncomment the below line if this is a meant to be a batched data action\r\n // isBatched: true\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 */\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport qs from 'querystring';\r\n/**\r\n * GetCrmToken Input Action\r\n */\r\n\r\n export interface IToken {\r\n token_type: string;\r\n expires_in: string;\r\n ext_expires_in: string;\r\n expires_on: string;\r\n not_before: string;\r\n resource: string;\r\n access_token: string;\r\n}\r\n\r\nexport class GetCrmTokenInput implements Msdyn365.IActionInput {\r\n // TODO: Construct the input needed to run the action\r\n constructor() {}\r\n\r\n // TODO: Determine if the results of this get action should cache the results and if so provide\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `CRMTOKEN`;\r\n public getCacheObjectType = () => 'CRMTOKEN';\r\n public dataCacheType = (): Msdyn365.CacheType => 'none';\r\n}\r\n\r\n// TODO: Create a data model here or import one to capture the response of the action\r\nexport interface IGetCrmTokenData {\r\n token: string;\r\n}\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call\r\n */\r\nconst createInput = (args: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n return new GetCrmTokenInput();\r\n};\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nasync function action(input: GetCrmTokenInput, ctx: Msdyn365.IActionContext): Promise {\r\n // const apiSettings = Msdyn365.msdyn365Commerce.apiSettings;\r\n\r\n // TODO: Uncomment the below line to get the value from a service\r\n // const response = await Msdyn365.sendRequest('/get/example/id/1', 'get');\r\n const { szfCRMDomain, szfCRMClientSecret} = ctx.requestContext.app.config;\r\n const data = qs.stringify({\r\n 'resource': `${szfCRMDomain}`,\r\n 'client_id': '1d4d5b5c-c710-472d-b8ac-104788da8da1',\r\n 'client_secret': `${szfCRMClientSecret}`,\r\n 'grant_type': 'client_credentials'\r\n });\r\n const response = await Msdyn365.sendRequest(\"https://login.microsoftonline.com/c03a7c9b-0691-48f2-a884-93fe49a74786/oauth2/token\", \"post\", data, {\r\n headers: {\r\n 'Content-Type': 'application/x-www-form-urlencoded',\r\n 'Cookie': 'fpc=AopThjyphGZIqV8tMvZOskskZZdbAQAAAETfudgOAAAA; stsservicecookie=estsfd; x-ms-gateway-slice=estsfd'\r\n }\r\n });\r\n if(response && response.status===200){\r\n return {\r\n token : response.data.access_token\r\n };\r\n }else{\r\n return {token : ''};\r\n }\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >action,\r\n // TODO: Give your data action a unique id\r\n id: 'GetCrmToken',\r\n input: createInput\r\n // TODO: Uncomment the below line if this is a meant to be a batched data action\r\n // isBatched: true\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 */\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\n/**\r\n * GetExistingContact Input Action\r\n */\r\n\r\nexport class GetExistingContactInput implements Msdyn365.IActionInput {\r\n // TODO: Construct the input needed to run the action\r\n public token: string | undefined;\r\n public email: string | undefined;\r\n public phone: string | undefined;\r\n constructor(token : string | undefined, email: string | undefined,phone:string | undefined) {\r\n this.phone = phone;\r\n this.email = email;\r\n this.token = token;\r\n }\r\n // TODO: Determine if the results of this get action should cache the results and if so provide\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `SZFEXISTINGCONTACT`;\r\n public getCacheObjectType = () => 'SZFEXISTINGCONTACT';\r\n public dataCacheType = (): Msdyn365.CacheType => 'none';\r\n}\r\n\r\n// TODO: Create a data model here or import one to capture the response of the action\r\nexport interface IGetExistingContactData {\r\n status: boolean;\r\n id: string | undefined;\r\n}\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call\r\n */\r\nconst createExistingContactInput = (args: Msdyn365.ICreateActionContext, token: string, email: string,phone: string): Msdyn365.IActionInput => {\r\n return new GetExistingContactInput(token, email,phone);\r\n};\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nasync function existingContactDataAction(input: GetExistingContactInput, ctx: Msdyn365.IActionContext): Promise {\r\n const token = input.token;\r\n const email = input.email;\r\n const phone = input.phone;\r\n const szfCRMDomain = ctx.requestContext.app.config.szfCRMDomain;\r\n const response = await Msdyn365.sendRequest(`${szfCRMDomain}/api/data/v9.2//contacts?$select=emailaddress1,firstname,lastname,mobilephone &$filter=emailaddress1 eq \\'${email}\\' or mobilephone eq \\'%2B${phone}\\'`, \"get\", {}, {\r\n headers: {\r\n 'Authorization':`Bearer ${token}`\r\n }\r\n });\r\n if(response && response.data && response.data.value && response.data.value.length > 0 && response.data.value[0].contactid){\r\n return {\r\n status: true,\r\n id: response.data.value[0].contactid\r\n };\r\n }else{\r\n return {\r\n status: false,\r\n id: undefined\r\n };\r\n }\r\n // const apiSettings = Msdyn365.msdyn365Commerce.apiSettings;\r\n\r\n // TODO: Uncomment the below line to get the value from a service\r\n // const response = await Msdyn365.sendRequest('/get/example/id/1', 'get');\r\n // return { text: 'Static data from action' };\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >existingContactDataAction,\r\n // TODO: Give your data action a unique id\r\n id: 'GetExistingContact',\r\n input: createExistingContactInput\r\n // TODO: Uncomment the below line if this is a meant to be a batched data action\r\n // isBatched: true\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 */\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\n/**\r\n * GetInqueryOptions Input Action\r\n */\r\nexport class GetInqueryOptionsInput implements Msdyn365.IActionInput {\r\n // TODO: Construct the input needed to run the action\r\n public token: string | undefined;\r\n constructor(token: string| undefined) {\r\n this.token = token;\r\n }\r\n\r\n // TODO: Determine if the results of this get action should cache the results and if so provide\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `SZFCONTACTUSINQUERYOPTIONS`;\r\n public getCacheObjectType = () => 'SZFCONTACTUSINQUERYOPTIONS';\r\n public dataCacheType = (): Msdyn365.CacheType => 'none';\r\n}\r\n\r\n// TODO: Create a data model here or import one to capture the response of the action\r\nexport interface IGetInqueryOptionsData {\r\n status: boolean,\r\n data: any[] | undefined,\r\n}\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call\r\n */\r\nconst createInqueryOptionInput = (args: Msdyn365.ICreateActionContext,token:string): Msdyn365.IActionInput => {\r\n return new GetInqueryOptionsInput(token);\r\n};\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nasync function getInqueryOptionsDataAction(input: GetInqueryOptionsInput, ctx: Msdyn365.IActionContext): Promise {\r\n const token = input.token;\r\n const szfCRMDomain = ctx.requestContext.app.config.szfCRMDomain;\r\n const response = await Msdyn365.sendRequest(`${szfCRMDomain}/api/data/v9.2//szf_casetypes?$select=szf_name,szf_arabic`, \"get\", {}, {\r\n headers: {\r\n 'Authorization':`Bearer ${token}`\r\n }\r\n });\r\n if(response && response.data && response.data.value && response.data.value.length > 0){\r\n return {\r\n status: true,\r\n data: response.data.value\r\n };\r\n }else{\r\n return {\r\n status: false,\r\n data: undefined\r\n };\r\n }\r\n\r\n // const apiSettings = Msdyn365.msdyn365Commerce.apiSettings;\r\n\r\n // TODO: Uncomment the below line to get the value from a service\r\n // const response = await Msdyn365.sendRequest('/get/example/id/1', 'get');\r\n // return { text: 'Static data from action' };\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >getInqueryOptionsDataAction,\r\n // TODO: Give your data action a unique id\r\n id: 'GetInqueryOptions',\r\n input: createInqueryOptionInput\r\n // TODO: Uncomment the below line if this is a meant to be a batched data action\r\n // isBatched: true\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 */\r\n\r\nimport * as React from 'react';\r\nimport * as MsDyn365 from '@msdyn365-commerce/core';\r\nimport { Node } from '@msdyn365-commerce-modules/utilities';\r\nimport { ISzfContactUsViewProps } from './szf-contact-us';\r\nimport {\r\n Form,\r\n Input,\r\n FormGroup,\r\n Label,\r\n Button,\r\n FormFeedback,\r\n // Spinner,\r\n InputGroup,\r\n // InputGroup\r\n} from 'reactstrap';\r\nimport { MoonLoader } from 'react-spinners';\r\nimport contactFormDataAction, { PostContactUsFormInput } from './../../actions/post-contact-us-form.action';\r\n\r\nimport getInqueryOptionsDataAction, { GetInqueryOptionsInput } from './../../actions/get-inquery-options.action';\r\nimport existingContactDataAction, { GetExistingContactInput } from './../../actions/get-existing-contact.action';\r\nimport createNewContactDataAction, { PostNewContactInput } from './../../actions/post-new-contact.action';\r\nimport SZFModal from '../../utilities/szf-modal.component';\r\nimport PhoneInput from 'react-phone-input-2';\r\nimport arabicLocale from 'react-phone-input-2/lang/ar.json';\r\nexport interface IPostContactUsFormInput {\r\n Inquiry: string;\r\n InquiryInvalid: boolean;\r\n description: string;\r\n descriptionInvalid: boolean;\r\n email: string;\r\n emailInvalid: boolean;\r\n firstName: string;\r\n firstNameInvalid: boolean;\r\n lastName: string;\r\n lastNameInvalid: boolean;\r\n phone: string;\r\n countryCode: string;\r\n phoneInvalid: boolean;\r\n fileInvalid: boolean;\r\n // termNcondition: boolean;\r\n updateNpromotion: boolean;\r\n}\r\nexport interface INewContactCreation {\r\n firstName: string;\r\n lastName: string;\r\n email: string;\r\n phone: string;\r\n countryCode: string;\r\n updateNpromotion: boolean;\r\n}\r\nexport interface IcountryCodeInput {\r\n countryCode: string;\r\n dialCode: string;\r\n format: string;\r\n name: string;\r\n}\r\nexport interface IInqueryOptions {\r\n szf_casetypeid: string;\r\n szf_name: string;\r\n}\r\n\r\nexport default (props: ISzfContactUsViewProps) => {\r\n const [loading, setLoading] = React.useState(false);\r\n const [state, setState] = React.useState({\r\n firstName: '',\r\n firstNameInvalid: false,\r\n lastName: '',\r\n lastNameInvalid: false,\r\n email: '',\r\n emailInvalid: false,\r\n phone: '',\r\n countryCode: '',\r\n phoneInvalid: false,\r\n Inquiry: '',\r\n InquiryInvalid: false,\r\n description: '',\r\n descriptionInvalid: false,\r\n fileInvalid: false,\r\n // termNcondition: false,\r\n updateNpromotion: false,\r\n });\r\n const [isModalOpen, setIsModalOpen] = React.useState(false);\r\n const [contactUsError, setContactUsError] = React.useState('');\r\n const fileRef = React.useRef(null);\r\n const [inquiryOptionsData, setInquiryOptionsData] = React.useState<(IInqueryOptions | null)[]>();\r\n const [file, setFile] = React.useState();\r\n const [fileBase64Code, setFileBase64Code] = React.useState();\r\n const inquiryOptions = props.config.inquiryOptions;\r\n const locale = props.context.request.locale;\r\n // const termAndConditionCheckboxLabel = props.config.termAndConditionCheckboxLabel;\r\n const updateAndPromotionCheckboxLabel = props.config.updateAndPromotionCheckboxLabel;\r\n const successImageProps = {\r\n gridSettings: props.context.request.gridSettings ?? {},\r\n imageSettings: props.config.successModalImage?.imageSettings,\r\n };\r\n const failureImageProps = {\r\n gridSettings: props.context.request.gridSettings ?? {},\r\n imageSettings: props.config.failModalImage?.imageSettings,\r\n };\r\n const imageContainer = { className: 'ms-content-block__image' };\r\n const successImage = (\r\n \r\n \r\n \r\n );\r\n const failureImage = (\r\n \r\n \r\n \r\n );\r\n\r\n // const cuCountryCodeOptions = props.config.cuCountryCodeOptions;\r\n const {\r\n firstnameLabel,\r\n lastnameLabel,\r\n emailLabel,\r\n phoneLabel,\r\n inquirySelectLabel,\r\n descriptionLabel,\r\n fileLabel,\r\n submitButtonLabel,\r\n } = props.config;\r\n const {\r\n genericErrorMessage,\r\n invalidOrEmptyFieldError,\r\n dropdownChooseOptionMessage,\r\n maxFileSize,\r\n fileInvalidMessage,\r\n szfSuccessModalHeading,\r\n szfSuccessModalMessage,\r\n szfFailModalHeading,\r\n descriptionInvalidMessage,\r\n } = props.resources;\r\n const fileSize = props.config.fileSize || 20;\r\n const fileSizeKB = fileSize * 1024;\r\n const handleUpdateAndPromotionLabelChange = (event: MsDyn365.ContentEditableEvent) =>\r\n (props.config.updateAndPromotionCheckboxLabel = event.target.value);\r\n // const handleTermAndConditionLabelChange = (event: MsDyn365.ContentEditableEvent) => (props.config.termAndConditionCheckboxLabel = event.target.value);\r\n const updateAndPromotionLabel = updateAndPromotionCheckboxLabel && (\r\n \r\n );\r\n // const termAndConditionCheckboxText = termAndConditionCheckboxLabel && (\r\n // \r\n // );\r\n const fetchInqueryOptions = React.useCallback(async () => {\r\n try {\r\n const CRMtoken = (await props.data.crmToken)?.token || undefined;\r\n const input = new GetInqueryOptionsInput(CRMtoken);\r\n const result = await getInqueryOptionsDataAction(input, props.context.actionContext);\r\n const inquiryOptionsLowercase = inquiryOptions?.map((item) => {\r\n return item.toLowerCase();\r\n });\r\n if (result.data && result.data.length > 0) {\r\n const filteredResult: (IInqueryOptions | null)[] = result.data\r\n .map((item) => {\r\n if (locale.toLowerCase() === 'ar-ae') {\r\n if (inquiryOptionsLowercase?.includes(item.szf_arabic.toLowerCase())) {\r\n return {\r\n szf_casetypeid: item.szf_casetypeid,\r\n szf_name: item.szf_arabic,\r\n };\r\n } else {\r\n return null;\r\n }\r\n } else {\r\n if (inquiryOptionsLowercase?.includes(item.szf_name.toLowerCase())) {\r\n return {\r\n szf_casetypeid: item.szf_casetypeid,\r\n szf_name: item.szf_name,\r\n };\r\n } else {\r\n return null;\r\n }\r\n }\r\n })\r\n .filter((i) => i);\r\n setInquiryOptionsData(filteredResult);\r\n }\r\n }catch(error){\r\n console.log(error);\r\n }\r\n }, []);\r\n React.useEffect(() => {\r\n fetchInqueryOptions();\r\n }, []);\r\n const onChangeHandler = (e: React.ChangeEvent) => {\r\n const name: string = e.target.name;\r\n const value = e.target.value;\r\n\r\n if (name === 'email') {\r\n const emailPattern: RegExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}$/i;\r\n if (emailPattern.test(value)) {\r\n const obj = { ...state, [name]: value, emailInvalid: false };\r\n setState(obj);\r\n } else {\r\n const obj = { ...state, [name]: value, emailInvalid: true };\r\n setState(obj);\r\n }\r\n } else if (name === 'phone') {\r\n const obj = { ...state, [name]: value, phoneInvalid: false };\r\n setState(obj);\r\n } else {\r\n const obj = { ...state, [name]: value };\r\n setState(obj);\r\n }\r\n };\r\n const getbase64 = (imagefile: File) => {\r\n const reader = new FileReader();\r\n reader.readAsDataURL(imagefile);\r\n reader.onload = () => {\r\n const result = reader.result;\r\n const base64 = result?.toString().split('base64,');\r\n setFileBase64Code(base64 && base64[1]);\r\n };\r\n };\r\n const handleFileChange = (e: React.ChangeEvent) => {\r\n if (e.target.files) {\r\n if (e.target.files[0] && e.target.files[0].size / 1024 > fileSizeKB) {\r\n setState({ ...state, fileInvalid: true });\r\n } else {\r\n setState({ ...state, fileInvalid: false });\r\n const imagefile = e.target.files[0];\r\n if (imagefile) {\r\n getbase64(imagefile);\r\n setFile(imagefile);\r\n }\r\n }\r\n }\r\n };\r\n const handleCheckboxChange = (e: any) => {\r\n const name: string = e.target.name;\r\n setState({ ...state, [name]: !state.updateNpromotion });\r\n };\r\n const checkExistingContact = async (token: string, email: string, phone: string) => {\r\n const contactExistInput = new GetExistingContactInput(token, email, phone);\r\n const result = await existingContactDataAction(contactExistInput, props.context.actionContext);\r\n return result;\r\n };\r\n const resetFileField = () => {\r\n setState({\r\n ...state,\r\n fileInvalid: false,\r\n });\r\n if (fileRef.current && fileRef.current.value) {\r\n fileRef.current.value = '';\r\n }\r\n setFile(undefined);\r\n setFileBase64Code(null);\r\n };\r\n const resetForm = () => {\r\n setState({\r\n firstName: '',\r\n firstNameInvalid: false,\r\n lastName: '',\r\n lastNameInvalid: false,\r\n email: '',\r\n emailInvalid: false,\r\n phone: '',\r\n countryCode: '971',\r\n phoneInvalid: false,\r\n Inquiry: '',\r\n InquiryInvalid: false,\r\n description: '',\r\n descriptionInvalid: false,\r\n fileInvalid: false,\r\n // termNcondition: false,\r\n updateNpromotion: false,\r\n });\r\n\r\n if (fileRef.current && fileRef.current.value) {\r\n fileRef.current.value = '';\r\n }\r\n setFile(undefined);\r\n setFileBase64Code(null);\r\n setContactUsError('');\r\n };\r\n const toggleModal = () => {\r\n setIsModalOpen(!isModalOpen);\r\n };\r\n const onSubmitForm = async (e: any): Promise => {\r\n e.preventDefault();\r\n const emailPattern: RegExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}$/i;\r\n if (state.firstName.length <= 0) {\r\n setState({ ...state, firstNameInvalid: true });\r\n setLoading(false);\r\n document.getElementById('firstName')?.focus();\r\n return;\r\n } else if (state.lastName.length <= 0) {\r\n setState({\r\n ...state,\r\n firstNameInvalid: false,\r\n lastNameInvalid: true,\r\n });\r\n setLoading(false);\r\n document.getElementById('lastName')?.focus();\r\n return;\r\n } else if (state.email.length <= 0 || !emailPattern.test(state.email)) {\r\n setState({\r\n ...state,\r\n firstNameInvalid: false,\r\n lastNameInvalid: false,\r\n emailInvalid: true,\r\n });\r\n setLoading(false);\r\n document.getElementById('email')?.focus();\r\n return;\r\n } else if (!state.phone || state.phone.length < 4 || state.phone.length > 20) {\r\n setState({\r\n ...state,\r\n firstNameInvalid: false,\r\n lastNameInvalid: false,\r\n phoneInvalid: true,\r\n });\r\n setLoading(false);\r\n document.getElementById('phone')?.focus();\r\n return;\r\n } else if (state.Inquiry.length <= 0) {\r\n setState({\r\n ...state,\r\n firstNameInvalid: false,\r\n lastNameInvalid: false,\r\n emailInvalid: false,\r\n phoneInvalid: false,\r\n InquiryInvalid: true,\r\n });\r\n setLoading(false);\r\n document.getElementById('Inquiry')?.focus();\r\n return;\r\n } else if (state.description.length <= 0 || state.description.length >= 300) {\r\n setState({\r\n ...state,\r\n firstNameInvalid: false,\r\n lastNameInvalid: false,\r\n emailInvalid: false,\r\n phoneInvalid: false,\r\n InquiryInvalid: false,\r\n descriptionInvalid: true,\r\n });\r\n setLoading(false);\r\n document.getElementById('description')?.focus();\r\n return;\r\n } else if (file && file?.size && file.size / 1024 > fileSizeKB) {\r\n setState({\r\n ...state,\r\n firstNameInvalid: false,\r\n lastNameInvalid: false,\r\n emailInvalid: false,\r\n phoneInvalid: false,\r\n InquiryInvalid: false,\r\n descriptionInvalid: false,\r\n fileInvalid: true,\r\n });\r\n setLoading(false);\r\n fileRef?.current?.focus();\r\n return;\r\n } else {\r\n setState({\r\n ...state,\r\n firstNameInvalid: false,\r\n lastNameInvalid: false,\r\n emailInvalid: false,\r\n phoneInvalid: false,\r\n InquiryInvalid: false,\r\n descriptionInvalid: false,\r\n fileInvalid: false,\r\n });\r\n }\r\n const mergePhoneWithCountryCode = `${state.countryCode}${state.phone}`;\r\n try {\r\n const CRMtoken = (await props.data.crmToken)?.token || undefined;\r\n const isContactAlreadyExist = await checkExistingContact(CRMtoken, state.email, mergePhoneWithCountryCode);\r\n if (isContactAlreadyExist.status) {\r\n const createCaseInput = new PostContactUsFormInput(state, file, fileBase64Code, CRMtoken, isContactAlreadyExist.id);\r\n const createCaseResponse = await contactFormDataAction(createCaseInput, props.context.actionContext);\r\n if (createCaseResponse.status) {\r\n resetForm();\r\n setLoading(false);\r\n setIsModalOpen(true);\r\n } else {\r\n setContactUsError(createCaseResponse.msg || genericErrorMessage);\r\n setLoading(false);\r\n setIsModalOpen(true);\r\n }\r\n } else {\r\n const createInputData: INewContactCreation = {\r\n firstName: state.firstName,\r\n lastName: state.lastName,\r\n email: state.email,\r\n phone: `${state.phone}`,\r\n countryCode: `${state.countryCode}`,\r\n updateNpromotion: state.updateNpromotion,\r\n };\r\n const createContactInput = new PostNewContactInput(CRMtoken, createInputData);\r\n const createNewContactResponse = await createNewContactDataAction(createContactInput, props.context.actionContext);\r\n if (createNewContactResponse.status) {\r\n const createCaseInput = new PostContactUsFormInput(state, file, fileBase64Code, CRMtoken, createNewContactResponse.id);\r\n const createCaseResponse = await contactFormDataAction(createCaseInput, props.context.actionContext);\r\n if (createCaseResponse.status) {\r\n resetForm();\r\n setLoading(false);\r\n setIsModalOpen(true);\r\n } else {\r\n setLoading(false);\r\n setContactUsError(createCaseResponse?.msg || genericErrorMessage);\r\n setIsModalOpen(true);\r\n }\r\n } else {\r\n setLoading(false);\r\n setContactUsError(createNewContactResponse.msg ? createNewContactResponse.msg : genericErrorMessage);\r\n setIsModalOpen(true);\r\n }\r\n }\r\n setLoading(false);\r\n } catch (error) {\r\n setContactUsError(genericErrorMessage);\r\n setLoading(false);\r\n setIsModalOpen(true);\r\n console.log('error', error);\r\n }\r\n };\r\n const handlePhoneCountryCodeOnChange = (value: string, country: IcountryCodeInput) => {\r\n const numberWithoutCountryCode = value.toString().split(`${country.dialCode}`);\r\n setState({\r\n ...state,\r\n phone: numberWithoutCountryCode[1],\r\n countryCode: country.dialCode,\r\n });\r\n };\r\n return (\r\n <>\r\n
\r\n

{props.resources.contactUsParagraph}

\r\n \r\n

{contactUsError ? szfFailModalHeading : szfSuccessModalHeading}

\r\n \r\n \r\n }\r\n modalBody={\r\n isModalOpen ? (\r\n
\r\n {contactUsError ? failureImage : successImage}\r\n

{contactUsError ? contactUsError : szfSuccessModalMessage}

\r\n
\r\n ) : null\r\n }\r\n />\r\n
\r\n \r\n ) => {\r\n onChangeHandler(event);\r\n }}\r\n className='form-control'\r\n invalid={state.firstNameInvalid}\r\n required\r\n />\r\n \r\n {invalidOrEmptyFieldError && invalidOrEmptyFieldError}\r\n \r\n \r\n ) => {\r\n onChangeHandler(event);\r\n }}\r\n className='form-control'\r\n invalid={state.lastNameInvalid}\r\n required\r\n />\r\n \r\n {invalidOrEmptyFieldError && invalidOrEmptyFieldError}\r\n \r\n \r\n ) => {\r\n onChangeHandler(event);\r\n }}\r\n className='form-control'\r\n required\r\n invalid={state.emailInvalid}\r\n />\r\n \r\n {invalidOrEmptyFieldError && invalidOrEmptyFieldError}\r\n \r\n
\r\n {' '}\r\n \r\n {locale.toLowerCase() === 'ar-ae' ? (\r\n \r\n ) : (\r\n \r\n )}\r\n {state.phoneInvalid && (\r\n
\r\n {state.phoneInvalid && invalidOrEmptyFieldError && invalidOrEmptyFieldError}\r\n
\r\n )}\r\n
\r\n \r\n ) => {\r\n onChangeHandler(event);\r\n }}\r\n className='form-control'\r\n invalid={state.InquiryInvalid}\r\n required\r\n >\r\n {inquiryOptions && inquiryOptions.length > 0 && (\r\n \r\n )}\r\n {inquiryOptionsData &&\r\n inquiryOptionsData?.map((optionItem, i) => {\r\n return (\r\n <>\r\n \r\n \r\n );\r\n })}\r\n \r\n \r\n {invalidOrEmptyFieldError && invalidOrEmptyFieldError}\r\n \r\n \r\n ) => {\r\n onChangeHandler(event);\r\n }}\r\n invalid={state.descriptionInvalid}\r\n className='form-control'\r\n required\r\n />\r\n \r\n {descriptionInvalidMessage && descriptionInvalidMessage}\r\n \r\n \r\n \r\n ) => {\r\n handleFileChange(event);\r\n }}\r\n invalid={state.fileInvalid}\r\n className='form-control contact-us-file'\r\n />\r\n {\r\n resetFileField();\r\n }}\r\n >\r\n x\r\n \r\n \r\n {maxFileSize && (\r\n
\r\n
\r\n \r\n
\r\n

{maxFileSize}

\r\n
\r\n )}\r\n {fileInvalidMessage && fileInvalidMessage}\r\n
\r\n
\r\n \r\n \r\n \r\n {\r\n setLoading(true);\r\n onSubmitForm(e);\r\n }}\r\n disabled={loading}\r\n >\r\n {loading && (\r\n <>\r\n \r\n \r\n )}\r\n {submitButtonLabel && submitButtonLabel}\r\n \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 */\r\n\r\nimport * as React from 'react';\r\n\r\nimport { ISzfContactUsData } from './szf-contact-us.data';\r\nimport { ISzfContactUsProps } from './szf-contact-us.props.autogenerated';\r\n\r\nexport interface ISzfContactUsViewProps extends ISzfContactUsProps {}\r\n\r\n/**\r\n *\r\n * SzfContactUs component\r\n * @extends {React.PureComponent>}\r\n */\r\nclass SzfContactUs extends React.PureComponent> {\r\n public render(): JSX.Element | null {\r\n return this.props.renderView(this.props);\r\n }\r\n}\r\n\r\nexport default SzfContactUs;\r\n","module.exports = React;","module.exports = ReactDOM;","/*!\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 * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { INewContactCreation } from './../modules/szf-contact-us/szf-contact-us.view';\r\n/**\r\n * PostNewContact Input Action\r\n */\r\nexport class PostNewContactInput implements Msdyn365.IActionInput {\r\n // TODO: Construct the input needed to run the action\r\n public token: string;\r\n public firstName: string;\r\n public lastName: string;\r\n public email: string;\r\n public phone: string;\r\n public countryCode: string;\r\n public updateNpromotion: boolean;\r\n constructor(token:string,data:INewContactCreation) {\r\n this.token= token;\r\n this.email= data.email;\r\n this.firstName= data.firstName;\r\n this.lastName= data.lastName;\r\n this.phone= data.phone;\r\n this.countryCode= data.countryCode;\r\n this.updateNpromotion= data.updateNpromotion;\r\n }\r\n\r\n // TODO: Determine if the results of this get action should cache the results and if so provide\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `SZFCREATECONTACT`;\r\n public getCacheObjectType = () => 'SZFCREATECONTACT';\r\n public dataCacheType = (): Msdyn365.CacheType => 'none';\r\n}\r\n\r\n// TODO: Create a data model here or import one to capture the response of the action\r\nexport interface IPostNewContactData {\r\n status: boolean;\r\n msg:string | undefined;\r\n id: string | undefined;\r\n}\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call\r\n */\r\nconst createNewContactInput = (args: Msdyn365.ICreateActionContext,token:string, inputData:INewContactCreation): Msdyn365.IActionInput => {\r\n return new PostNewContactInput(token, inputData);\r\n};\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nasync function createNewContactDataAction(input: PostNewContactInput, ctx: Msdyn365.IActionContext): Promise {\r\n // const apiSettings = Msdyn365.msdyn365Commerce.apiSettings;\r\n const token = input.token;\r\n const szfCRMDomain = ctx.requestContext.app.config.szfCRMDomain;\r\n const data = {\r\n \"firstname\": input.firstName,\r\n \"lastname\": input.lastName,\r\n \"emailaddress1\": input.email,\r\n \"szf_mblregion\": input.countryCode,\r\n \"szf_mbllocalnumber\": input.phone,\r\n \"donotsendmm\": !input.updateNpromotion\r\n };\r\n const response = await Msdyn365.sendRequest(`${szfCRMDomain}/api/data/v9.2//contacts`, \"post\", data, {\r\n headers: {\r\n 'Prefer': 'return=representation',\r\n 'MSCRM.SuppressDuplicateDetection': 'false',\r\n 'Authorization':`Bearer ${token}`,\r\n 'Content-Type': 'application/json'\r\n }\r\n });\r\n if(response && response.data && response.data.contactid){\r\n return {\r\n status: true,\r\n msg: 'success',\r\n id: response.data.contactid\r\n };\r\n }else if (response && response.data && response.data.error){\r\n return {\r\n status: false,\r\n msg: response.data.error.message,\r\n id: undefined\r\n };\r\n }else{\r\n return {\r\n status: false,\r\n msg: undefined,\r\n id: undefined\r\n };\r\n }\r\n // TODO: Uncomment the below line to get the value from a service\r\n // const response = await Msdyn365.sendRequest('/get/example/id/1', 'get');\r\n // return { text: 'Static data from action' };\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >createNewContactDataAction,\r\n // TODO: Give your data action a unique id\r\n id: 'PostNewContact',\r\n input: createNewContactInput\r\n // TODO: Uncomment the below line if this is a meant to be a batched data action\r\n // isBatched: true\r\n});\r\n","import React from 'react';\r\nimport { Modal, ModalBody, ModalFooter, ModalHeader } from '@msdyn365-commerce-modules/utilities';\r\n\r\ninterface ISZFModalProps {\r\n isOpen: boolean;\r\n onModalToggle?: (e?: React.MouseEvent) => void;\r\n className: string;\r\n modalTitle?: React.ReactNode;\r\n modalBody?: React.ReactNode;\r\n modalFooter?: React.ReactNode;\r\n}\r\n\r\nexport default function SZFModal(props: ISZFModalProps) {\r\n const { isOpen, onModalToggle, className, modalTitle, modalBody, modalFooter } = props;\r\n\r\n return (\r\n \r\n {modalTitle && {modalTitle}}\r\n {modalBody && {modalBody}}\r\n {modalFooter && {modalFooter}}\r\n \r\n );\r\n}\r\n"],"sourceRoot":""}