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U,EAAIC,GAEtC,IAAII,EAAcL,EAAGM,QACrBN,EAAGO,UAAY,EAIf,IAHA,IAEIC,EAFAC,EAAI,GACJvC,EAAI,EAEgC,QAAhCsC,EAASlB,EAAWU,EAAIC,KAAc,CAC5C,IAAIS,EAAWxB,EAASsB,EAAO,IAC/BC,EAAEvC,GAAKwC,EACU,KAAbA,IAAiBV,EAAGO,UAAYlB,EAAmBY,EAAGhB,EAASe,EAAGO,WAAYF,IAClFnC,IAEF,OAAa,IAANA,EAAU,KAAOuC","sources":["webpack://henrys-ecommerce/./src/modules/hei-sailthru-signup-form/hei-sailthru-signup-form.tsx?2eab","webpack://henrys-ecommerce/./src/modules/hei-sailthru-signup-form/hei-sailthru-signup-form.view.tsx?2bda","webpack://henrys-ecommerce/./lib/hei-sailthru-signup-form/module-registration.js?b110","webpack://henrys-ecommerce/external var \"React\"?0d3b","webpack://henrys-ecommerce/external var \"ReactDOM\"?853b","webpack://henrys-ecommerce/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/modules/es.string.match.js?ecbe"],"sourcesContent":["/*!\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 { IHeiSailthruSignupFormData } from './hei-sailthru-signup-form.data';\r\nimport { IHeiSailthruSignupFormProps } from './hei-sailthru-signup-form.props.autogenerated';\r\n\r\nexport interface IHeiSailthruSignupFormViewProps extends IHeiSailthruSignupFormProps {}\r\n\r\n/**\r\n *\r\n * HeiSailthruSignupForm component\r\n * @extends {React.PureComponent>}\r\n */\r\nclass HeiSailthruSignupForm 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 HeiSailthruSignupForm;\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 { HtmlHeadInclude } from '@msdyn365-commerce/core';\r\nimport * as React from 'react';\r\nimport { IHeiSailthruSignupFormViewProps } from './hei-sailthru-signup-form';\r\n\r\nconst validateEmail = (email: string) => {\r\n return email.toLowerCase().match(\r\n // eslint-disable-next-line security/detect-unsafe-regex\r\n /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/\r\n );\r\n};\r\n\r\nexport default (props: IHeiSailthruSignupFormViewProps) => {\r\n const locale = props.context.request.locale ?? 'en-CA';\r\n const { template, source, creatorTypeOptions, className } = props.config;\r\n const [email, setEmail] = React.useState('');\r\n const [creatorType, setCreatorType] = React.useState('');\r\n const [isSubmited, setIsSubmited] = React.useState(false);\r\n const [emailError, setEmailError] = React.useState(false);\r\n const [creatorTypeError, setCreatorTypeError] = React.useState(false);\r\n\r\n const options = React.useMemo(() => {\r\n const optionText = creatorTypeOptions;\r\n\r\n if (!optionText) {\r\n return [];\r\n }\r\n\r\n return optionText\r\n .split(';')\r\n .filter(s => !!s)\r\n .map(s => {\r\n const opt = s.split(':');\r\n return {\r\n val: opt[0],\r\n label: opt[1]\r\n };\r\n });\r\n }, [creatorTypeOptions]);\r\n\r\n const showCreatorType = options.length > 0;\r\n let wrapperCls = 'hei-sailthru-signup-form';\r\n if (className) {\r\n wrapperCls += ` ${className}`;\r\n }\r\n\r\n if (showCreatorType) {\r\n wrapperCls += ` hei-sailthru-vertical`;\r\n }\r\n\r\n return (\r\n
\r\n \r\n \r\n \r\n\r\n {isSubmited ? (\r\n
{props.resources.postNewsletterSubscribeMsg}
\r\n ) : (\r\n <>\r\n
\r\n {emailError &&
{props.resources.emailErrorMessage}
}\r\n setEmail(e.target.value)}\r\n />\r\n
\r\n {showCreatorType && (\r\n
\r\n {creatorTypeError &&
{props.resources.creatorTypeErrorMessage}
}\r\n \r\n
\r\n )}\r\n
\r\n {\r\n const Sailthru = window['Sailthru'];\r\n if (!Sailthru) {\r\n return;\r\n }\r\n\r\n setCreatorTypeError(false);\r\n setEmailError(false);\r\n\r\n var hasError = false;\r\n if (!email || !validateEmail(email)) {\r\n setEmailError(true);\r\n hasError = true;\r\n }\r\n\r\n if (showCreatorType && !creatorType) {\r\n setCreatorTypeError(true);\r\n hasError = true;\r\n }\r\n\r\n if (hasError) {\r\n return;\r\n }\r\n\r\n const varsPayload = showCreatorType\r\n ? {\r\n creator_type: creatorType,\r\n language: locale\r\n }\r\n : {\r\n language: locale\r\n };\r\n\r\n const payload = {\r\n id: email,\r\n key: 'email',\r\n template: { name: template },\r\n source: source,\r\n vars: varsPayload,\r\n onSuccess: () => {\r\n setIsSubmited(true);\r\n },\r\n onError: () => {\r\n console.warn('Sailthru subscription failed.');\r\n }\r\n };\r\n\r\n Sailthru.integration('userSignUpConfirmedOptIn', payload);\r\n }}\r\n >\r\n {props.resources.submitBtnLabel}\r\n \r\n
\r\n \r\n )}\r\n
\r\n );\r\n};\r\n","const binding = { modules: {}, dataActions: {} };\n\n (binding.modules['hei-sailthru-signup-form'] = {\n c: () => require('partner/modules/hei-sailthru-signup-form/hei-sailthru-signup-form.tsx'),\n $type: 'contentModule',\n da: [],\n \n iNM: false,\n ns: '__local__',\n n: 'hei-sailthru-signup-form',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/hei-sailthru-signup-form'\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-sailthru-signup-form|hei-sailthru-signup-form'] = {\n c: () => require('partner/modules/hei-sailthru-signup-form/hei-sailthru-signup-form.view.tsx'),\n cn: '__local__-__local__-hei-sailthru-signup-form'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\n };","module.exports = React;","module.exports = ReactDOM;","'use strict';\nvar call = require('../internals/function-call');\nvar fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');\nvar anObject = require('../internals/an-object');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\nvar toLength = require('../internals/to-length');\nvar toString = require('../internals/to-string');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar getMethod = require('../internals/get-method');\nvar advanceStringIndex = require('../internals/advance-string-index');\nvar regExpExec = require('../internals/regexp-exec-abstract');\n\n// @@match logic\nfixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {\n return [\n // `String.prototype.match` method\n // https://tc39.es/ecma262/#sec-string.prototype.match\n function match(regexp) {\n var O = requireObjectCoercible(this);\n var matcher = isNullOrUndefined(regexp) ? undefined : getMethod(regexp, MATCH);\n return matcher ? call(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString(O));\n },\n // `RegExp.prototype[@@match]` method\n // https://tc39.es/ecma262/#sec-regexp.prototype-@@match\n function (string) {\n var rx = anObject(this);\n var S = toString(string);\n var res = maybeCallNative(nativeMatch, rx, S);\n\n if (res.done) return res.value;\n\n if (!rx.global) return regExpExec(rx, S);\n\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n var A = [];\n var n = 0;\n var result;\n while ((result = regExpExec(rx, S)) !== null) {\n var matchStr = toString(result[0]);\n A[n] = matchStr;\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n n++;\n }\n return n === 0 ? null : A;\n }\n ];\n});\n"],"names":["HeiSailthruSignupForm","React","render","this","props","renderView","_props$context$reques","locale","context","request","template","source","creatorTypeOptions","className","config","email","setEmail","creatorType","setCreatorType","isSubmited","setIsSubmited","emailError","setEmailError","creatorTypeError","setCreatorTypeError","options","split","filter","s","map","opt","val","label","showCreatorType","length","wrapperCls","HtmlHeadInclude","src","async","resources","postNewsletterSubscribeMsg","emailErrorMessage","type","placeholder","emailInputPlaceholder","value","onChange","e","target","creatorTypeErrorMessage","creatorTypeInputPlaceholder","o","key","selected","onClick","Sailthru","window","hasError","toLowerCase","match","validateEmail","payload","id","name","vars","creator_type","language","onSuccess","onError","console","warn","integration","submitBtnLabel","binding","modules","dataActions","c","require","$type","da","iNM","ns","n","p","pdp","md","__bindings__","_objectSpread","viewDictionary","cn","module","exports","ReactDOM","call","fixRegExpWellKnownSymbolLogic","anObject","isNullOrUndefined","toLength","toString","requireObjectCoercible","getMethod","advanceStringIndex","regExpExec","MATCH","nativeMatch","maybeCallNative","regexp","O","matcher","undefined","RegExp","string","rx","S","res","done","global","fullUnicode","unicode","lastIndex","result","A","matchStr"],"sourceRoot":""}