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ecommerce/./src/modules/hei-store-contact/hei-store-contact.view.tsx?33f9","webpack://henrys-ecommerce/./lib/hei-store-contact/module-registration.js?1903","webpack://henrys-ecommerce/external var \"React\"?0d3b"],"sourcesContent":["import { OrgUnitContact, OrgUnitLocation, OrgUnitsDataActions } from '@msdyn365-commerce/retail-proxy';\r\nimport { useEffect, useState } from 'react';\r\nimport { IHeiStoreContactData } from './hei-store-contact.data';\r\nimport { IHeiStoreContactProps } from './hei-store-contact.props.autogenerated';\r\n\r\nexport type IHeiStoreContactViewProps = IHeiStoreContactProps & {\r\n phoneNumber: string;\r\n emailAddress: string;\r\n};\r\n\r\nconst HeiStoreContact = (props: IHeiStoreContactProps) => {\r\n const {\r\n context,\r\n config: { orgUnitNumber }\r\n } = props;\r\n\r\n const [orgUnitLocation, setOrgUnitLocation] = useState();\r\n const [storeInfoLoaded, setStoreInfoLoaded] = useState(false);\r\n\r\n useEffect(() => {\r\n const ctx = { callerContext: context.actionContext };\r\n\r\n if (storeInfoLoaded) {\r\n return;\r\n }\r\n\r\n setStoreInfoLoaded(true);\r\n\r\n void (async () => {\r\n try {\r\n const allStores = await OrgUnitsDataActions.searchOrgUnitLocationsAsync(ctx, {\r\n OrgUnitNumber: orgUnitNumber\r\n });\r\n\r\n const store = allStores?.find(s => s.OrgUnitNumber === orgUnitNumber);\r\n\r\n if (store) {\r\n setOrgUnitLocation(store);\r\n }\r\n } catch (error) {\r\n context.telemetry.exception(error as Error);\r\n }\r\n })();\r\n }, [orgUnitNumber]);\r\n\r\n if (!orgUnitLocation) {\r\n return null;\r\n }\r\n\r\n const [phoneNumber, emailAddress] = extractContacts(orgUnitLocation.Contacts);\r\n\r\n return props.renderView({\r\n ...props,\r\n phoneNumber,\r\n emailAddress\r\n });\r\n};\r\n\r\nconst extractContacts = (contacts: OrgUnitContact[] | undefined) => {\r\n if (!contacts) {\r\n return ['', ''];\r\n }\r\n\r\n const allPhoneContacts = contacts.filter(contact => contact.ContactTypeValue === 1 && !contact.IsPrivate);\r\n const allEmailPhoneContacts = contacts.filter(contact => contact.ContactTypeValue === 2 && !contact.IsPrivate);\r\n\r\n let phoneContact = '';\r\n if (allPhoneContacts && allPhoneContacts.length > 0) {\r\n const primaryPhoneContact = allPhoneContacts.find(contact => contact.IsPrimary);\r\n\r\n if (primaryPhoneContact) {\r\n phoneContact = primaryPhoneContact.Locator || '';\r\n }\r\n\r\n if (!phoneContact) {\r\n phoneContact = allPhoneContacts[0].Locator || '';\r\n }\r\n }\r\n\r\n let emailContact = '';\r\n if (allEmailPhoneContacts && allEmailPhoneContacts.length > 0) {\r\n const primaryEmailContact = allEmailPhoneContacts.find(contact => contact.IsPrimary);\r\n\r\n if (primaryEmailContact) {\r\n emailContact = primaryEmailContact.Locator || '';\r\n }\r\n\r\n if (!emailContact) {\r\n emailContact = allEmailPhoneContacts[0].Locator || '';\r\n }\r\n }\r\n\r\n return [phoneContact, emailContact];\r\n};\r\n\r\nexport default HeiStoreContact;\r\n","import * as React from 'react';\r\nimport { IHeiStoreContactViewProps } from './hei-store-contact';\r\nimport classnames from 'classnames';\r\n\r\nexport default (props: IHeiStoreContactViewProps) => {\r\n const {\r\n phoneNumber,\r\n emailAddress,\r\n resources: { emailLabel, phoneLabel },\r\n config: { className }\r\n } = props;\r\n\r\n return (\r\n
\r\n {phoneNumber && (\r\n

\r\n \r\n {` `}\r\n {phoneNumber}\r\n

\r\n )}\r\n {emailAddress && (\r\n

\r\n \r\n {` `}\r\n {emailAddress}\r\n

\r\n )}\r\n
\r\n );\r\n};\r\n","const binding = { modules: {}, dataActions: {} };\n\n (binding.modules['hei-store-contact'] = {\n c: () => require('partner/modules/hei-store-contact/hei-store-contact.tsx'),\n $type: 'contentModule',\n da: [],\n \n iNM: false,\n ns: '__local__',\n n: 'hei-store-contact',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/hei-store-contact'\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|hei-store-contact|hei-store-contact'] = {\n c: () => require('partner/modules/hei-store-contact/hei-store-contact.view.tsx'),\n cn: '__local__-__local__-hei-store-contact'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\n };","module.exports = React;"],"names":["extractContacts","contacts","allPhoneContacts","filter","contact","ContactTypeValue","IsPrivate","allEmailPhoneContacts","phoneContact","length","primaryPhoneContact","find","IsPrimary","Locator","emailContact","primaryEmailContact","props","context","config","orgUnitNumber","orgUnitLocation","setOrgUnitLocation","useState","storeInfoLoaded","setStoreInfoLoaded","useEffect","ctx","callerContext","actionContext","allStores","OrgUnitsDataActions","OrgUnitNumber","store","s","error","telemetry","exception","phoneNumber","emailAddress","Contacts","renderView","_objectSpread","resources","emailLabel","phoneLabel","className","React","classnames","href","binding","modules","dataActions","c","require","$type","da","iNM","ns","n","p","pdp","md","window","__bindings__","viewDictionary","cn","module","exports"],"sourceRoot":""}