{"version":3,"file":"static/js/application.initial~9a8b795a.7ef69bec.js","mappings":"mLAAA,IAAIA,EAAM,CACT,eAAgB,OAChB,eAAgB,OAChB,eAAgB,OAChB,eAAgB,OAChB,eAAgB,OAChB,eAAgB,OAChB,eAAgB,OAChB,eAAgB,MAChB,eAAgB,OAChB,eAAgB,OAChB,eAAgB,MAChB,eAAgB,OAChB,eAAgB,OAChB,eAAgB,OAChB,eAAgB,OAChB,YAAa,OACb,YAAa,OACb,YAAa,OACb,eAAgB,OAChB,eAAgB,OAChB,YAAa,OACb,YAAa,MACb,eAAgB,OAChB,eAAgB,OAChB,eAAgB,OAChB,eAAgB,OAChB,eAAgB,OAChB,eAAgB,OAChB,eAAgB,MAChB,eAAgB,OAChB,eAAgB,OAChB,YAAa,OACb,eAAgB,OAChB,eAAgB,OAChB,eAAgB,MAChB,eAAgB,MAChB,eAAgB,OAChB,eAAgB,OAChB,YAAa,MACb,YAAa,OACb,aAAc,OACd,eAAgB,OAChB,YAAa,OACb,YAAa,OACb,YAAa,OACb,YAAa,OACb,YAAa,OACb,YAAa,OACb,YAAa,OACb,YAAa,MACb,YAAa,OACb,YAAa,MACb,eAAgB,OAChB,YAAa,OACb,YAAa,OACb,YAAa,MACb,YAAa,OACb,YAAa,OACb,YAAa,OACb,YAAa,OACb,YAAa,OACb,eAAgB,OAChB,YAAa,MACb,YAAa,OACb,YAAa,OACb,YAAa,OACb,YAAa,MACb,iBAAkB,OAClB,oBAAqB,OACrB,iBAAkB,QAInB,SAASC,EAAeC,GACvB,IAAIC,EAAKC,EAAsBF,GAC/B,OAAOG,EAAoBF,EAC5B,CACA,SAASC,EAAsBF,GAC9B,IAAIG,EAAoBC,EAAEN,EAAKE,GAAM,CACpC,IAAIK,EAAI,IAAIC,MAAM,uBAAyBN,EAAM,KAEjD,MADAK,EAAEE,KAAO,mBACHF,CACP,CACA,OAAOP,EAAIE,EACZ,CACAD,EAAeS,KAAO,WACrB,OAAOC,OAAOD,KAAKV,EACpB,EACAC,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,cAAekU,GAAkB,cAAgB,KAAOD,GAAoB,KAAK,GAAM,GAAS,OACxV,EACAN,GAAsB,mNACtBG,EAAsB,UAAE,0CAA2C,GAAIt7B,EAAK0B,UAAU,sCACtFy5B,GAAsB,8VACtBG,EAAsB,UAAE,mCAAoC,GAAIt7B,EAAK0B,UAAU,+BAC/Ey5B,GAAsB,iOAAyU,EAAE9Q,KAAK5vB,KAAK,SAAU8gC,EAAgBA,EAAgBv7B,KAAmB,qBAAPA,KAAmBA,UAAKsJ,GAAoB6xB,CAAS,C,iGCR1cU,E,qBAKL,SAASC,EAAehkC,EAAO4lB,OAAOzB,SAASnkB,MACpD,MAEMikC,EAFM,IAAI,IAAJ,CAAQjkC,GACDohB,QAAO,GACN2iB,YACpB,OAAIE,GAAQ5nC,OAAOklB,OAAOwiB,GAAahf,SAASkf,GACvCA,EAEFF,EAAYG,OACrB,EAbA,SAAYH,GACV,wBACA,mBACD,CAHD,CAAYA,IAAAA,EAAW,I","sources":["../../../../crud-ad/packages/ad-customizers-next/node_modules/@bingads-webui-universal/i18n-cldr-data-modern/locales-simplified|sync|nonrecursive|/.json$","../../../../crud-ad/packages/ad-customizers-next/src/style/styles.js","../../../../crud-ad/packages/ad-customizers-next/src/picker-editor-container.js","../../../../crud-ad/packages/ad-customizers-next/src/string-utils.js","../../../../crud-ad/packages/ad-customizers-next/src/instrumentation.js","../../../../crud-ad/packages/ad-customizers-next/src/controller.js","../../../../crud-ad/packages/ad-customizers-next/src/base-analyzer.js","../../../../crud-ad/packages/ad-customizers-next/src/keyword/editor.js","../../../../crud-ad/packages/ad-customizers-next/src/keyword/parser.js","../../../../crud-ad/packages/ad-customizers-next/src/keyword/constants.js","../../../../crud-ad/packages/ad-customizers-next/src/keyword/analyzer.js","../../../../crud-ad/packages/ad-customizers-next/src/iff/analyzer.js","../../../../crud-ad/packages/ad-customizers-next/src/countdown/countdown-language.js","../../../../crud-ad/packages/ad-customizers-next/src/countdown/utils.js","../../../../crud-ad/packages/ad-customizers-next/src/countdown/countdown-editor.js","../../../../crud-ad/packages/ad-customizers-next/src/countdown/i18n-dummy.js","../../../../crud-ad/packages/ad-customizers-next/src/countdown/parser.js","../../../../crud-ad/packages/ad-customizers-next/src/countdown/analyzer.js","../../../../crud-ad/packages/ad-customizers-next/src/location/parser.js","../../../../crud-ad/packages/ad-customizers-next/src/location/editor.js","../../../../crud-ad/packages/ad-customizers-next/src/location/analyzer.js","../../../../crud-ad/packages/ad-customizers-next/src/rsa-ad-customizer/parser.js","../../../../crud-ad/packages/ad-customizers-next/src/rsa-ad-customizer/styles.js","../../../../crud-ad/packages/ad-customizers-next/src/rsa-ad-customizer/editor.js","../../../../crud-ad/packages/ad-customizers-next/src/rsa-ad-customizer/analyzer.js","../../../../crud-ad/packages/ad-customizers-next/src/hooks.js","../../../../crud-ad/packages/ad-customizers-next/src/index.js","../../../../crud-ad/packages/ad-customizers-next/src/rsa-ad-customizer/legacy-string-map.js","../../../../crud-ad/packages/ad-customizers/src/picker.js","../../../../crud-ad/packages/ad-customizers/src/string-utils.js","../../../../crud-ad/packages/ad-customizers/src/instrumentation.js","../../../../crud-ad/packages/ad-customizers/src/controller.js","../../../../crud-ad/packages/ad-customizers/src/base-analyzer.js","../../../../crud-ad/packages/ad-customizers/src/feeds/parser.js","../../../../crud-ad/packages/ad-customizers/src/feeds/query-feeds-by-name.js","../../../../crud-ad/packages/ad-customizers/src/feeds/analyzer.js","../../../../crud-ad/packages/ad-customizers/src/feeds/query-feed-attribute-sample-value.js","../../../../crud-ad/packages/ad-customizers/src/keyword/editor/keyword-editor-view.js","../../../../crud-ad/packages/ad-customizers/src/keyword/parser.js","../../../../crud-ad/packages/ad-customizers/src/keyword/constants.js","../../../../crud-ad/packages/ad-customizers/src/keyword/analyzer.js","../../../../crud-ad/packages/ad-customizers/src/countdown/countdown-language.js","../../../../crud-ad/packages/ad-customizers/src/countdown/editor/date-picker-view.js","../../../../crud-ad/packages/ad-customizers/src/countdown/utils.js","../../../../crud-ad/packages/ad-customizers/src/countdown/editor/editor-view.js","../../../../crud-ad/packages/ad-customizers/src/countdown/parser.js","../../../../crud-ad/packages/ad-customizers/src/countdown/analyzer.js","../../../../crud-ad/packages/ad-customizers/src/iff/analyzer.js","../../../../crud-ad/packages/ad-customizers/src/location/parser.js","../../../../crud-ad/packages/ad-customizers/src/location/editor.js","../../../../crud-ad/packages/ad-customizers/src/location/analyzer.js","../../../../crud-ad/packages/ad-customizers/src/index.js","../../../../crud-ad/packages/ad-customizers/src/iff/editor/audience-selector.js","../../../../crud-ad/packages/ad-customizers/src/iff/editor/iff-editor.js","../../../../crud-ad/packages/ad-customizers/src/iff/escape.js","../../../../crud-ad/packages/ad-customizers/src/iff/if-function-type.js","../../../../crud-ad/packages/ad-customizers/src/iff/regex/iff-in-progress-syntax.js","../../../../crud-ad/packages/ad-customizers/src/iff/regex/audience-list-syntax.js","../../../../crud-ad/packages/ad-customizers/src/iff/parser.js","../../conversion-tracking-page-menu/src/pages/mock-data.js","../../conversion-tracking-page-menu/src/pages/page-menu.js","../../conversion-tracking-page-menu/src/styles/page-menu-styles.js","../../conversion-tracking-page-menu/src/styles/uet-tag-item-styles.js","../../conversion-tracking-page-menu/src/pages/text-span-with-forwarded-ref.js","../../conversion-tracking-page-menu/src/pages/uet-tags-tree-node-with-tooltip.js","../../conversion-tracking-page-menu/src/pages/uet-tags-tree-node.js","../../conversion-tracking-page-menu/src/pages/uet-tags-page-menu.js","../../conversion-tracking-page-menu/src/pages/uet-tags-repository.js","../../custom-reports-page-teaching-bubble-config/src/styles.js","../../custom-reports-page-teaching-bubble-config/src/teaching-bubble-configs.js","../../custom-reports-page-teaching-bubble-config/src/bubble-render.js","../../../../crud-ad/packages/ad-customizers/src/countdown/editor/date-picker-template.pug","../../../../crud-ad/packages/ad-customizers/src/countdown/editor/template.pug","../../../../crud-ad/packages/ad-customizers/src/iff/editor/association-section-for-iff.pug","../../../../crud-ad/packages/ad-customizers/src/iff/editor/double-list-box-layout.pug","../../../../crud-ad/packages/ad-customizers/src/keyword/editor/keyword-editor-template.pug","../../display-mode/src/display-mode.ts"],"sourcesContent":["var map = {\n\t\"./ar-AE.json\": 783698,\n\t\"./ar-BH.json\": 959578,\n\t\"./ar-DZ.json\": 181778,\n\t\"./ar-EG.json\": 522420,\n\t\"./ar-IQ.json\": 912646,\n\t\"./ar-JO.json\": 634671,\n\t\"./ar-KW.json\": 433442,\n\t\"./ar-LB.json\": 79490,\n\t\"./ar-LY.json\": 672283,\n\t\"./ar-MA.json\": 780018,\n\t\"./ar-OM.json\": 31484,\n\t\"./ar-QA.json\": 525214,\n\t\"./ar-SA.json\": 988260,\n\t\"./ar-TN.json\": 639022,\n\t\"./ar-YE.json\": 562410,\n\t\"./bg.json\": 544233,\n\t\"./cs.json\": 972448,\n\t\"./da.json\": 618053,\n\t\"./de-AT.json\": 888865,\n\t\"./de-CH.json\": 688443,\n\t\"./de.json\": 932497,\n\t\"./el.json\": 52779,\n\t\"./en-AU.json\": 617970,\n\t\"./en-CA.json\": 893956,\n\t\"./en-GB.json\": 272445,\n\t\"./en-IE.json\": 468810,\n\t\"./en-IN.json\": 509123,\n\t\"./en-MY.json\": 950506,\n\t\"./en-NZ.json\": 74828,\n\t\"./en-PH.json\": 556196,\n\t\"./en-SG.json\": 129386,\n\t\"./en.json\": 484645,\n\t\"./es-AR.json\": 381582,\n\t\"./es-CL.json\": 635990,\n\t\"./es-CO.json\": 82359,\n\t\"./es-MX.json\": 16312,\n\t\"./es-PE.json\": 521506,\n\t\"./es-VE.json\": 804956,\n\t\"./es.json\": 77486,\n\t\"./fi.json\": 726335,\n\t\"./fil.json\": 634421,\n\t\"./fr-CA.json\": 264933,\n\t\"./fr.json\": 354886,\n\t\"./hi.json\": 192465,\n\t\"./hr.json\": 902524,\n\t\"./hu.json\": 372413,\n\t\"./id.json\": 248079,\n\t\"./it.json\": 736991,\n\t\"./ja.json\": 915771,\n\t\"./ko.json\": 84204,\n\t\"./lt.json\": 146558,\n\t\"./lv.json\": 16748,\n\t\"./ms-BN.json\": 670373,\n\t\"./ms.json\": 335142,\n\t\"./nb.json\": 979726,\n\t\"./nl.json\": 50520,\n\t\"./pl.json\": 111170,\n\t\"./pt.json\": 123722,\n\t\"./ro.json\": 656273,\n\t\"./ru.json\": 646095,\n\t\"./sl.json\": 490497,\n\t\"./sv-FI.json\": 772347,\n\t\"./sv.json\": 93343,\n\t\"./th.json\": 159762,\n\t\"./tr.json\": 623912,\n\t\"./uk.json\": 944326,\n\t\"./vi.json\": 45551,\n\t\"./zh-Hans.json\": 931239,\n\t\"./zh-Hant-HK.json\": 448712,\n\t\"./zh-Hant.json\": 785418\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 413665;","/* eslint-disable no-unused-vars */\r\nexport const adCustomizersStyle = ({ palette = {}, iconFontFamily = 'MsAds MDL2 Assets' }) => ({\r\n adCustomizerPickerEditorContainer: {\r\n '&.picker-list': {\r\n maxHeight: 432,\r\n overflowY: 'auto',\r\n\r\n '& > li ~ li, & > .adcustomizerpicker-syntax-container ~ li': {\r\n borderTop: `1px solid ${palette.neutralSecondary}`,\r\n },\r\n\r\n '& > li > a': {\r\n fontSize: 14,\r\n height: 'auto',\r\n },\r\n },\r\n\r\n '& .adcustomizerpicker-syntax-container': {\r\n padding: '27px 32px 16px 32px',\r\n\r\n '& ~ li > a': {\r\n padding: '0 32px',\r\n },\r\n },\r\n\r\n '&.dropdown-menu.adCustomizersEditor': {\r\n fontSize: 14,\r\n lineHeight: '19px',\r\n\r\n '& label': {\r\n padding: '0 0 7px 0',\r\n '& .ms-ChoiceFieldLabel': {\r\n fontWeight: '400',\r\n },\r\n },\r\n\r\n '& .ms-Stack > span': {\r\n paddingTop: '6px',\r\n },\r\n\r\n '& .picker-content': {\r\n borderTop: `1px solid ${palette.neutralSecondary}`,\r\n padding: '16px 32px 32px 32px',\r\n\r\n '& .countdownEditor': {\r\n '& .ms-TextField': {\r\n width: '150px',\r\n },\r\n\r\n '& .ms-Stack': {\r\n marginBottom: '32px',\r\n },\r\n\r\n '& .ms-Stack:last-child': {\r\n marginBottom: '0px',\r\n },\r\n\r\n '& .language-dropdown': {\r\n width: 'fit-content',\r\n minWidth: '180px',\r\n },\r\n },\r\n },\r\n\r\n '& .location-editor': {\r\n '& input[type=\"radio\"]': {\r\n marginLeft: '0px',\r\n },\r\n '& label.control-label': {\r\n marginTop: '10px',\r\n },\r\n },\r\n\r\n '& .keyword-editor': {\r\n '& .ms-TextField': {\r\n marginBottom: '36px',\r\n },\r\n },\r\n },\r\n },\r\n});\r\n\r\n","/* eslint-disable jsx-a11y/anchor-is-valid */\r\nimport React from 'react';\r\nimport PropTypes from 'prop-types';\r\nimport classnames from 'classnames';\r\nimport { useDefaultStyles } from '@bingads-webui-react/with-default-styles';\r\nimport { adCustomizersStyle } from './style/styles';\r\n\r\n/** Picker for ad customizer\r\n * all editor are on top of this\r\n * it will do following things\r\n * 1 show syntax when syntax is not null\r\n * 2 show editor when editorView not null\r\n * 3 show the selectable items when itemsToDisplay not empty and editorview null\r\n * @param {number} props - analyzer index\r\n * @returns {Object} PickerEditorContainer\r\n */\r\nexport function AdCustomizerPickerEditorContainer(props) {\r\n const classes = useDefaultStyles(adCustomizersStyle);\r\n\r\n // eslint-disable-next-line arrow-body-style\r\n const getDisplayPosition = (target, container) => {\r\n // Calculate the position of the popup relative to the container.\r\n // The container needs to be non-statically positioned, either fixed, relative or absolute,\r\n // because the popup is position: absolute.\r\n const targetRect = target.getBoundingClientRect();\r\n const containerRect = container.getBoundingClientRect();\r\n return {\r\n top: (targetRect.bottom - containerRect.top) + 1,\r\n left: targetRect.left - containerRect.left - 1,\r\n };\r\n };\r\n\r\n\r\n const {\r\n target,\r\n editorView,\r\n syntax,\r\n itemsToDisplay,\r\n adType,\r\n activity,\r\n container,\r\n } = props;\r\n const position = getDisplayPosition(target, container);\r\n\r\n const containerStyle = { display: 'block', left: `${position.left}px`, top: `${position.top}px` };\r\n let syntaxToUse = null;\r\n\r\n if (syntax) {\r\n syntaxToUse = (\r\n
\r\n {syntax}\r\n
);\r\n }\r\n\r\n let contentView = null;\r\n let contentClasses = [];\r\n\r\n if (editorView) {\r\n contentView = (
{editorView}
);\r\n contentClasses = ['adCustomizersEditor'];\r\n } else {\r\n contentClasses = ['picker-list'];\r\n contentView = itemsToDisplay.map(({ name, description, onClick }, index) => {\r\n const updatedOnClick = (event) => {\r\n activity.trace(`${adType} AdCustomizersPicker`, `${name} selected`);\r\n onClick(event);\r\n event.stopPropagation();\r\n event.preventDefault();\r\n };\r\n return (\r\n
  • \r\n \r\n
    {name}
    \r\n { description ?
    {description}
    : null}\r\n \r\n
  • );\r\n });\r\n }\r\n\r\n return (\r\n \r\n );\r\n}\r\n\r\nAdCustomizerPickerEditorContainer.propTypes = {\r\n itemsToDisplay: PropTypes.arrayOf(PropTypes.shape({\r\n name: PropTypes.string,\r\n description: PropTypes.string,\r\n onClick: PropTypes.func,\r\n })),\r\n syntax: PropTypes.shape({}),\r\n editorView: PropTypes.shape({}),\r\n target: PropTypes.shape({}),\r\n activity: PropTypes.shape({ trace: PropTypes.func }).isRequired,\r\n container: PropTypes.shape({ offset: PropTypes.func }),\r\n adType: PropTypes.string.isRequired,\r\n};\r\n\r\nAdCustomizerPickerEditorContainer.defaultProps = {\r\n itemsToDisplay: [],\r\n syntax: '',\r\n editorView: null,\r\n target: null,\r\n container: '',\r\n};\r\n","import { isString } from 'underscore';\r\n/**\r\n * Regex Pattern for wide characters\r\n */\r\nconst wideCharPattern = new RegExp(\r\n '[\\\\u1100-\\\\u11FF]' + // IsHangulJamo\r\n '|[\\\\u2E80-\\\\u2EFF]' + // IsCJKRadicalsSupplement\r\n '|[\\\\u3000-\\\\u303F]' + // IsCJKSymbolsandPunctuation\r\n '|[\\\\u3040-\\\\u309F]' + // IsHiragana\r\n '|[\\\\u30A0-\\\\u30FF]' + // IsKatakana\r\n '|[\\\\u3130-\\\\u318F]' + // IsHangulCompatibilityJamo\r\n '|[\\\\u3200-\\\\u32FF]' + // IsEnclosedCJKLettersandMonths\r\n '|[\\\\u3300-\\\\u33FF]' + // IsCJKCompatibility\r\n '|[\\\\u3400-\\\\u4DBF]' + // IsCJKUnifiedIdeographsExtensionA\r\n '|[\\\\u4E00-\\\\u9FFF]' + // IsCJKUnifiedIdeographs\r\n '|[\\\\uAC00-\\\\uD7AF]' + // IsHangulSyllables\r\n '|[\\\\uF900-\\\\uFAFF]' + // IsCJKCompatibilityIdeographs\r\n '|[\\\\uFE30-\\\\uFE4F]' + // IsCJKCompatibilityForms\r\n '|[\\\\uFF01-\\\\uFF60]' + // Fullwidth Forms Part 1\r\n '|[\\\\uFFE0-\\\\uFFE6]' + // Fullwidth Forms Part 2\r\n '|[\\\\uD800-\\\\uDBFF][\\\\uDC00-\\\\uDFFF]' // Astral Planes\r\n , 'g'\r\n);\r\n\r\n/**\r\n * Get string length, which counting CJK character or Emojis as 2\r\n * @param {string} str - string to count\r\n * @returns {int} - length of string\r\n */\r\nexport function displayLength(str) {\r\n return isString(str) ? str.replace(wideCharPattern, '12').length : 0;\r\n}\r\n","const schema = {\r\n scenario: [\r\n {\r\n name: 'adCustomizersInAdsEditor',\r\n value: 'AdCustomizersInAdsEditor',\r\n setting: {},\r\n activity: [\r\n {\r\n name: 'picker',\r\n value: 'Picker',\r\n },\r\n {\r\n name: 'feeds',\r\n value: 'Feeds',\r\n },\r\n {\r\n name: 'countdown',\r\n value: 'Countdown',\r\n },\r\n {\r\n name: 'keyword',\r\n value: 'Keyword',\r\n },\r\n {\r\n name: 'iffEditor',\r\n value: 'IF-function',\r\n },\r\n {\r\n name: 'location',\r\n value: 'Location',\r\n },\r\n {\r\n name: 'RSAAdCustomizer',\r\n value: 'RSAAdCustomizer',\r\n },\r\n ],\r\n },\r\n ],\r\n};\r\n\r\nlet senario = null;\r\nexport function createActivity(instrumentation, activityName) {\r\n if (!senario) {\r\n if (!instrumentation.adCustomizersInAdsEditor) {\r\n instrumentation.addScenario(schema);\r\n }\r\n senario = instrumentation.adCustomizersInAdsEditor.create();\r\n }\r\n\r\n return senario[activityName].create();\r\n}\r\n","import { extend, pluck, isEmpty, flatten, all, size, filter, findIndex, isString } from 'underscore';\r\nimport Promise from 'bluebird';\r\nimport React from 'react';\r\nimport ReactDOM from 'react-dom';\r\n\r\nimport { AdCustomizerPickerEditorContainer } from './picker-editor-container';\r\nimport { displayLength } from './string-utils';\r\nimport { createActivity } from './instrumentation';\r\n\r\n/** controller for ad customizer analyze\r\n it is a single instance and the main function is :\r\n .register(priority, analyzer) -->for analyzer to register itself\r\n .analyzeInput({text, cursorIndex, isSelectedByUser, updateAction, target, adType})\r\n --> analyze input and update the picker accordingly\r\n .getCharCountExcludingAdCustomizers(text) -->get chart count excluding rules\r\n .evaluateAdCustomizers(text) --> get the preview text\r\n */\r\nexport class AdCustomizerController {\r\n constructor(props) {\r\n this.analyzers = [];\r\n this.pickerContainer = null;\r\n\r\n this.clickedAway = this.clickedAway.bind(this);\r\n this.keydown = this.keydown.bind(this);\r\n this.target = null;\r\n this.container = null;\r\n this.instrumentation = props.instrumentation;\r\n }\r\n /** Registers an analyzer and then ordering according to its priority\r\n * update target & close the picker after editor closes\r\n * @param {number} priority - to order menu items in ascending order\r\n * @param {Object} analyzer - the analyzer to use\r\n * @returns {Object} null\r\n */\r\n register(priority, analyzer) {\r\n // order by priority asc\r\n this.analyzers.push({ priority, analyzer });\r\n this.analyzers.sort((b, a) => b.priority - a.priority);\r\n }\r\n\r\n /**\r\n * getAnalyzerByIndex\r\n * @private\r\n * @param {Array} analyzers - analyzers array\r\n * @param {number} index - analyzer index\r\n * @returns {Object} analyzer\r\n */\r\n getAnalyzerByIndex(analyzers, index) {\r\n return analyzers[index].analyzer;\r\n }\r\n\r\n getAnalyzerByName(analyzers, name) {\r\n const analyzerIndex = findIndex(\r\n analyzers,\r\n ({ analyzer: { name: analyzerName } }) => analyzerName === name\r\n );\r\n if (analyzerIndex === -1) {\r\n throw new Error(`Ad customizer syntax analyzer with name '${name}' could not be found`);\r\n }\r\n\r\n return {\r\n analyzer: analyzers[analyzerIndex].analyzer,\r\n analyzerIndex,\r\n };\r\n }\r\n\r\n /* analyze input\r\n run analyzerInput for all of analyzers\r\n each analyzer return result format of\r\n {\r\n itemsToDisplay: {\r\n name, // Title of the menu item\r\n description: string, // description line for the menu item\r\n onClick: func, // menu item's click handler\r\n }\r\n type: string,\r\n defaultHandlerForInput: true/false,\r\n // means in senario when no items to display, is this still default processor\r\n }\r\n\r\n then combine those result and generate result with format of:\r\n {\r\n fallBackResult,\r\n hitResults, // if in-progress or compolete expression detected by analyzer\r\n fallBackAnalyzer\r\n } */\r\n analyzeInput({\r\n analyzers, text, cursorIndex, isSelectedByUser, analyzerName,\r\n updateAction, setCursorPostion, target, adType, field,\r\n }) {\r\n const hitResults = [];\r\n let fallBackAnalyzer = null;\r\n let fallBackResult = null;\r\n const pipeNextEvaluator = (previewPromise, currentPosition, resolve) => {\r\n previewPromise.then((result) => {\r\n // Analyzer the result of current analyzer\r\n if (result && (result.match || !isEmpty(result.itemsToDisplay))) {\r\n hitResults.push(extend({ analyzerId: currentPosition - 1 }, result));\r\n } else if (!fallBackAnalyzer && result && result.defaultHandlerForInput) {\r\n fallBackAnalyzer = this.getAnalyzerByIndex(analyzers, currentPosition - 1);\r\n fallBackResult = result;\r\n }\r\n\r\n if (analyzerName || currentPosition >= analyzers.length) {\r\n // Done with all analyzers, when either \"sticking\" to single named\r\n // analyzer or already went through all of them\r\n resolve({\r\n fallBackResult,\r\n hitResults,\r\n fallBackAnalyzer,\r\n });\r\n } else {\r\n // Switch to another analyzer\r\n const analyzer = this.getAnalyzerByIndex(analyzers, currentPosition);\r\n pipeNextEvaluator(\r\n analyzer.analyzeInput({\r\n text,\r\n cursorIndex,\r\n isSelectedByUser,\r\n updateAction,\r\n setCursorPostion,\r\n target,\r\n updateAndCloseCallback: this.updateAndCloseCallback(\r\n updateAction, setCursorPostion, target,\r\n analyzer, adType\r\n ),\r\n adType,\r\n field,\r\n }),\r\n currentPosition + 1,\r\n resolve\r\n );\r\n }\r\n });\r\n };\r\n\r\n let nextAnalyzerPosition = 1;\r\n let firstAnalyzer;\r\n if (analyzerName) {\r\n const { analyzer, analyzerIndex } = this.getAnalyzerByName(analyzers, analyzerName);\r\n firstAnalyzer = analyzer;\r\n nextAnalyzerPosition = analyzerIndex + 1;\r\n } else {\r\n firstAnalyzer = this.getAnalyzerByIndex(analyzers, 0);\r\n nextAnalyzerPosition = 1;\r\n }\r\n return new Promise((resolve) => {\r\n pipeNextEvaluator(firstAnalyzer.analyzeInput({\r\n text,\r\n cursorIndex,\r\n isSelectedByUser,\r\n updateAction,\r\n setCursorPostion,\r\n target,\r\n updateAndCloseCallback: this.updateAndCloseCallback(\r\n updateAction, setCursorPostion, target,\r\n firstAnalyzer, adType\r\n ),\r\n adType,\r\n field,\r\n }), nextAnalyzerPosition, resolve);\r\n });\r\n }\r\n\r\n /** updateAndCloseCallback\r\n * update target & close the picker after editor closes\r\n * @param {func} updateAction - update call back\r\n * @param {func} setCursorPostion - update cursorPostion call back\r\n * @param {Object} target - whether this is selected option\r\n * @param {Object} analyzer - the analyzer to use\r\n * @param {Object} adType - adType\r\n * @returns {Object} null\r\n */\r\n updateAndCloseCallback = (updateAction, setCursorPostion, target, analyzer, adType) =>\r\n ({\r\n newValue, cursorPosition, isSelectedByUser, event, isCancel,\r\n }) => {\r\n if (!isCancel) {\r\n updateAction(newValue);\r\n setCursorPostion(cursorPosition);\r\n analyzer.traceUpdate(target.value, newValue, analyzer.name, adType);\r\n\r\n // Setting the \"sticky\" flags regarding the user actions.\r\n // isSelectedUser is used to distinguish between the user's interactions\r\n // through the helper menus and the user interactions through typing\r\n // in a target field.\r\n // eslint-disable-next-line no-param-reassign\r\n target.isSelectedByUser = isSelectedByUser;\r\n // eslint-disable-next-line no-param-reassign\r\n target.analyzerName = analyzer.name;\r\n\r\n target.focus();\r\n }\r\n this.hidePicker();\r\n if (event) {\r\n event.stopPropagation();\r\n event.preventDefault();\r\n }\r\n };\r\n\r\n /**\r\n * OnInput update\r\n * got analyed result from analyzeInput\r\n then for the result\r\n -->when multiple results, just display them, each item with { name, description, onClick }\r\n -->when single result\r\n ask the analyzer whether need editor (for countdown/if/keywordinseration, it need show editor)\r\n --> [result 1] show editor (using the passed in container)\r\n --> [result 2] do nothing, then just continue will the display, with its syntax\r\n\r\n --> when no result, find the 1st fallback hander\r\n --> when no result & no default\r\n In the end it calls updateAction callback if there is an actual change.\r\n * @param {Object} options - options for parametr\r\n * @param {Object} options.event - event\r\n * @param {func} options.updateAction - update call back for Ads editor\r\n * @param {func} options.setCursorPostion - cursor postion call back\r\n * to get updates to the text fields\r\n * @param {bool} options.isSelectedByUser - whether this is selected option\r\n * (true - user clicked an item in the pop-up; false - user typed text)\r\n * @param { Object} options.container -- container to show the picker\r\n * @param { Object} options.remainingCountCallBack -- remaining count call back func\r\n * @param { Object} options.instrumentation -- instrumentation\r\n * @param { Object} options.adType -- adType\r\n * @param { Object} options.field -- field\r\n * @returns {Object} null\r\n */\r\n onInputUpdate({\r\n availableAnalyzers,\r\n event,\r\n isSelectedByUser,\r\n analyzerName,\r\n updateAction,\r\n setCursorPostion,\r\n container,\r\n remainingCountCallBack,\r\n adType,\r\n field,\r\n }) {\r\n const { target, key } = event;\r\n // selectionEnd - native prop to tell cursor position\r\n const { selectionEnd, value } = target;\r\n\r\n this.target = target;\r\n this.container = container;\r\n if (isString(this.container)) {\r\n this.container = document.querySelector(container);\r\n }\r\n\r\n let syntax = null;\r\n let items = [];\r\n let editorView = null;\r\n\r\n // for empty input, directly hide the picker\r\n if (isEmpty(value) || isEmpty(value.trim())) {\r\n return this.updatePicker({\r\n syntax,\r\n items,\r\n container: this.container,\r\n editorView,\r\n target,\r\n instrumentation: this.instrumentation,\r\n adType,\r\n });\r\n }\r\n\r\n return this.analyzeInput({\r\n analyzers: availableAnalyzers,\r\n text: value,\r\n cursorIndex: selectionEnd,\r\n isSelectedByUser,\r\n analyzerName,\r\n updateAction,\r\n setCursorPostion,\r\n target,\r\n remainingCountCallBack,\r\n adType,\r\n field,\r\n })\r\n .then(({\r\n hitResults,\r\n fallBackResult,\r\n fallBackAnalyzer,\r\n }) => {\r\n if (!isEmpty(hitResults)) {\r\n // Removing hits without itemsToDisplay to decide if there are multiple\r\n // hits with items that would need a menu as the result\r\n const hitResultsWithItems =\r\n filter(hitResults, hitResult => !isEmpty(hitResult.itemsToDisplay));\r\n if (size(hitResultsWithItems) > 1) {\r\n items = flatten(pluck(hitResultsWithItems, 'itemsToDisplay'));\r\n } else {\r\n const [analyzeResult] = size(hitResultsWithItems) > 0 ?\r\n hitResultsWithItems : hitResults;\r\n const analyzer = this.getAnalyzerByIndex(availableAnalyzers, analyzeResult.analyzerId);\r\n syntax = analyzer.getSyntax(analyzeResult, adType);\r\n\r\n if (analyzer.needEditor(analyzeResult)) {\r\n editorView = analyzer.getEditor({\r\n target,\r\n analyzeResult,\r\n remainingCountCallBack,\r\n key,\r\n updateAndCloseCallback: this.updateAndCloseCallback(\r\n updateAction, setCursorPostion, target,\r\n analyzer, adType\r\n ),\r\n adType,\r\n });\r\n } else {\r\n items = analyzeResult.itemsToDisplay;\r\n }\r\n }\r\n }\r\n\r\n // If, after looking at the results, no syntax, no items and no editor\r\n // were selected, we try to use fallback analyzer's syntax\r\n if (!syntax && isEmpty(items) && !editorView && fallBackAnalyzer) {\r\n syntax = fallBackAnalyzer.getSyntax(fallBackResult, adType);\r\n }\r\n\r\n return this.updatePicker({\r\n syntax, items, container: this.container, editorView, target, adType,\r\n });\r\n });\r\n }\r\n\r\n registerGlobalEvents(target) {\r\n document.addEventListener('click', this.clickedAway);\r\n target.addEventListener('keydown', this.keydown);\r\n }\r\n\r\n hidePicker() {\r\n ReactDOM.unmountComponentAtNode(this.pickerContainer);\r\n document.removeEventListener('click', this.clickedAway);\r\n this.target.removeEventListener('keydown', this.keydown);\r\n }\r\n\r\n clickedAway(event) {\r\n if (all(this.analyzers, ({ analyzer }) => analyzer.isClickedAway(event)) &&\r\n event.target !== this.target &&\r\n event.target.closest('.ad-customizer-container') === null) {\r\n this.hidePicker();\r\n }\r\n }\r\n\r\n /**\r\n * Handles key down events.\r\n * Hides editor when user hits escape.\r\n * @param {object} event - click event\r\n * @returns {undefined}\r\n */\r\n keydown(event) {\r\n switch (event.key) {\r\n case 'Escape':\r\n this.hidePicker();\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * getCharCountExcludingAdCustomizers\r\n * get chart count exluding the ad customizers\r\n * @param {array} analyzers - analyzers array\r\n * @param {string} text - text to analyze\r\n * @param {string} adType - ad type\r\n * @param {string} field - target field\r\n * @returns {number} count\r\n */\r\n getCharCountExcludingAdCustomizers(analyzers, text, adType, field) {\r\n if (!text) {\r\n return 0;\r\n }\r\n let resultText = text;\r\n let charCount = 0;\r\n let phaseCharCount;\r\n let toContinue;\r\n do {\r\n phaseCharCount = 0;\r\n toContinue = false;\r\n // Running parsers one after another, requesting evaluation of\r\n // a first complete expression found only, until no character contributions\r\n // detected\r\n for (let i = 0; i < analyzers.length; i += 1) {\r\n const analyzer = this.getAnalyzerByIndex(analyzers, i);\r\n const result = analyzer.getCharCountExcludingAdCustomizers(resultText, adType, field);\r\n resultText = result.processedText;\r\n phaseCharCount += result.charCount;\r\n toContinue = toContinue || result.toContinue;\r\n }\r\n charCount += phaseCharCount;\r\n } while (phaseCharCount > 0 || toContinue);\r\n\r\n return displayLength(resultText) + charCount;\r\n }\r\n\r\n /**\r\n * evaluateAdCustomizers\r\n * get text replacing ad customizer rules with its default text\r\n * @param {Array} analyzers - analyzers array\r\n * @param {string} text - text to analyze\r\n * @param {string} adType - ad type\r\n * @param {string} field - target field\r\n * @returns {Object} a promise which will resolve the final test\r\n */\r\n evaluateAdCustomizers(analyzers, text, adType) {\r\n if (!text) {\r\n return Promise.resolve(text);\r\n }\r\n const pipeNextEvaluator = (previewPromise, currentPosition, resolve) => {\r\n previewPromise.then((result) => {\r\n if (currentPosition >= analyzers.length) {\r\n resolve(result);\r\n } else {\r\n pipeNextEvaluator(\r\n this.getAnalyzerByIndex(analyzers, currentPosition).evaluateText(result, adType),\r\n currentPosition + 1, resolve\r\n );\r\n }\r\n });\r\n };\r\n return new Promise((resolve) => {\r\n pipeNextEvaluator(\r\n this.getAnalyzerByIndex(analyzers, 0).evaluateText(text, adType),\r\n 1, resolve\r\n );\r\n });\r\n }\r\n\r\n /* Renders or updates the picker or hide it */\r\n // as we will use dom.unmountComponentAtNode(container), we make a specific container\r\n updatePicker({\r\n syntax, items, container, editorView, target, instrumentation, adType,\r\n }) {\r\n if (this.pickerContainer === null) {\r\n this.pickerContainer = document.createElement('div');\r\n this.pickerContainer.className = 'ad-customizer-container open';\r\n }\r\n\r\n if (container && !container.contains(this.pickerContainer)) {\r\n container.appendChild(this.pickerContainer);\r\n }\r\n\r\n if (!this.pickerActivity) {\r\n this.pickerActivity = createActivity(instrumentation, 'picker');\r\n }\r\n\r\n if (syntax || !isEmpty(items) || editorView) {\r\n // render latest picker\r\n ReactDOM.render(React.createElement(AdCustomizerPickerEditorContainer, {\r\n itemsToDisplay: items,\r\n editorView,\r\n syntax,\r\n target,\r\n activity: this.pickerActivity,\r\n container,\r\n adType,\r\n }), this.pickerContainer);\r\n this.registerGlobalEvents(target);\r\n } else {\r\n this.hidePicker();\r\n }\r\n }\r\n}\r\n","import Promise from 'bluebird';\r\nimport { createActivity } from './instrumentation';\r\n\r\n/** Base analyzer\r\n * all analyzer should implement the functions of\r\n * 1 analyzeInput\r\n * 2 getSyntax\r\n * 3 needEditor\r\n * 4 getEditor (reactjs object)\r\n * 5 evaluateRule\r\n * 6 getCharCountExcludingAdCustomizers\r\n */\r\nexport class AdCustomizerBaseAnalyzer {\r\n constructor({\r\n name,\r\n priority,\r\n instrumentation,\r\n i18n,\r\n activityName,\r\n scope = {},\r\n controller,\r\n }) {\r\n this.name = name;\r\n this.instrumentation = instrumentation;\r\n this.priority = priority;\r\n this.editor = null;\r\n this.i18n = i18n;\r\n this.activityName = activityName;\r\n this.activity = createActivity(instrumentation, activityName);\r\n this.scope = scope;\r\n controller.register(this.priority, this);\r\n }\r\n\r\n /*\r\n base response: {\r\n itemsToDisplay: {\r\n name, // Title of the menu item\r\n description: string, // description line for the menu item\r\n onClick: func, // menu item's click handler\r\n }\r\n type: string,\r\n // whether the rule matches, if only one rule match then editor might be shown\r\n match: true/false,\r\n defaultHandlerForInput: true/false,\r\n },\r\n can also add item that has information for inline edit & syntax\r\n */\r\n analyzeInput(/* { text, cursorIndex, updateAndCloseCallback, target, adType} */) {\r\n }\r\n\r\n /* return a reactjs object here */\r\n getSyntax(/* analyzeResult */) {\r\n }\r\n\r\n needEditor(/* analyzeResult */) {\r\n }\r\n\r\n getEditor(/* {target, container, analyzeResult, key, updateAction,remainingCountCallBack} */) {\r\n }\r\n\r\n // return a promise of evaluted text\r\n evaluateRule(/* {text, adType} */) {\r\n }\r\n\r\n /**\r\n * Should return `true` if the analyzer considers that the click happened outside the\r\n * controller boundaries.\r\n * @param {Object} event the click event.\r\n * @returns {Boolean} `true` if clicked outside the analyzer managed area.\r\n * Otherwise, `false`. The default return value is `true`.\r\n */\r\n isClickedAway(/* event */) {\r\n return true;\r\n }\r\n\r\n // evaluate rules and update text for the evaluated values, do not override this\r\n evaluateText(text, adType) {\r\n if (!text) {\r\n return Promise.resolve(text);\r\n }\r\n\r\n const pipeNextEvaluator = (previewPromise, previousResult, resolve) => {\r\n previewPromise.then((result) => {\r\n if (!result) {\r\n resolve(text);\r\n }\r\n // evaluate till no new rules found, in case there are multiple rules in text\r\n if (result === previousResult) {\r\n resolve(result);\r\n } else {\r\n pipeNextEvaluator(this.evaluateRule(result, adType), result, resolve);\r\n }\r\n });\r\n };\r\n\r\n return new Promise((resolve) => {\r\n pipeNextEvaluator(this.evaluateRule(text, adType), text, resolve);\r\n });\r\n }\r\n\r\n /* get chart count excluding adcustomizers rules{\r\n processedText: text,\r\n charCount: 0,\r\n } */\r\n getCharCountExcludingAdCustomizers(text) {\r\n return {\r\n processedText: text,\r\n charCount: 0,\r\n };\r\n }\r\n\r\n traceUpdate(oldValue, newValue, customizerName, adType) {\r\n this.activity.trace(\r\n `${adType} targetUpdateFromAdCustomizer ${customizerName}`,\r\n `updating field value from ${oldValue} to ${newValue}`\r\n );\r\n }\r\n}\r\n","import React from 'react';\r\nimport PropTypes from 'prop-types';\r\nimport classNames from 'classnames';\r\nimport _ from 'underscore';\r\nimport { withDefaultStyles } from '@bingads-webui-react/with-default-styles';\r\nimport { Label, TextField, ChoiceGroup, DefaultButton, PrimaryButton, Stack } from '@bingads-webui-react/fabric-control';\r\nimport { HelpPopupInline } from '@bingads-webui-react/help-popup';\r\n\r\nconst getStyles = () => ({\r\n keywordEditor: {\r\n '& .ms-Stack': {\r\n marginTop: '36px',\r\n },\r\n },\r\n});\r\n\r\n\r\nconst keywords = {\r\n TitleCase: 'KeyWord',\r\n SentenceCase: 'Keyword',\r\n LowerCase: 'keyword',\r\n};\r\n\r\nclass UnstyledKeywordEditor extends React.PureComponent {\r\n constructor(props) {\r\n super(props);\r\n const {\r\n i18n, options,\r\n } = props;\r\n\r\n this.keywordCaseOptions = [\r\n { key: 'TitleCase', text: `${i18n.getString(_TL_('Title Case'))} ` },\r\n { key: 'SentenceCase', text: `${i18n.getString(_TL_('Sentence Case'))} ` },\r\n { key: 'LowerCase', text: `${i18n.getString(_TL_('Lower Case'))} ` },\r\n ];\r\n\r\n this.state = {\r\n keywordText: options.defaultText,\r\n keywordCase: options.keywordCase,\r\n defaultTextErrorMessage: '',\r\n };\r\n }\r\n\r\n componentDidUpdate(prevProps) {\r\n if (this.props.options.defaultText !== prevProps.options.defaultText) {\r\n // eslint-disable-next-line react/no-did-update-set-state\r\n this.setState({ keywordText: this.props.options.defaultText });\r\n }\r\n }\r\n\r\n onCancel = () => {\r\n this.props.updateAndCloseCallback(({ isCancel: true }));\r\n }\r\n\r\n onSave = () => {\r\n const {\r\n options, updateAndCloseCallback, i18n,\r\n } = this.props;\r\n\r\n if (_.isEmpty(this.state.keywordText)) {\r\n this.setState({\r\n defaultTextErrorMessage: i18n.getString(_TL_('Default text is required.')),\r\n });\r\n return;\r\n }\r\n\r\n const { prefix, suffix } = options;\r\n\r\n const keywordCaseText = keywords[this.state.keywordCase];\r\n\r\n const newValue = `${prefix}{${keywordCaseText}:${this.state.keywordText}}${suffix}`;\r\n const cursorPosition = newValue.length - options.suffix.length;\r\n updateAndCloseCallback({\r\n newValue,\r\n cursorPosition,\r\n isSelectedByUser: true,\r\n });\r\n }\r\n\r\n onDefaultTextChange = (event) => {\r\n this.setState({ keywordText: event.target.value });\r\n if (!_.isEmpty(event.target.value)) {\r\n this.setState({\r\n defaultTextErrorMessage: '',\r\n });\r\n } else {\r\n this.setState({\r\n defaultTextErrorMessage: this.props.i18n.getString(_TL_('Default text is required.')),\r\n });\r\n }\r\n }\r\n\r\n render() {\r\n const {\r\n i18n, classes,\r\n } = this.props;\r\n\r\n return (\r\n
    \r\n \r\n \r\n \r\n { this.setState({ keywordCase: option.key }); }}\r\n />\r\n \r\n this.onSave()} />\r\n this.onCancel()} />\r\n \r\n
    );\r\n }\r\n}\r\n\r\nUnstyledKeywordEditor.propTypes = {\r\n i18n: PropTypes.shape({\r\n getString: PropTypes.func,\r\n }).isRequired,\r\n classes: PropTypes.shape({\r\n keywordEditor: PropTypes.string.isRequired,\r\n }).isRequired,\r\n options: PropTypes.shape({\r\n defaultText: PropTypes.string.isRequired,\r\n keywordCase: PropTypes.string.isRequired,\r\n }).isRequired,\r\n updateAndCloseCallback: PropTypes.func.isRequired,\r\n};\r\n\r\nconst KeywordEditor = withDefaultStyles(UnstyledKeywordEditor, getStyles);\r\nexport default KeywordEditor;\r\n","import { some, pick } from 'underscore';\r\nimport Promise from 'bluebird';\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: keyword text\r\n * [2]: default value\r\n */\r\nconst keywordRuleSyntax = /\\{(keyword)\\s*:([^{}]*)}/i;\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: keyword text (could be incomplete)\r\n * [2]: default value (could be empty)\r\n */\r\nconst keywordRuleInProgressSyntax = /{(k(?:e|$)(?:y|$)(?:w|$)(?:o|$)(?:r|$)(?:d|$))(?::|$)([^}]*)/i;\r\n\r\n/*\r\n * Matches Title Case keyword text (could be incomplete)\r\n */\r\nconst keywordRuleTitleCaseSyntax = /KeyW(?:o|$)(?:r|$)(?:d|$)/;\r\n\r\n/**\r\n * Looks for keyword rules in given text and substitutes them with their values.\r\n * @param {string} text - input text\r\n * @returns {string} text after substitutions\r\n */\r\nexport function evaluateKeywordRules(text) {\r\n if (text && text.length > 0) {\r\n const keywordReplaceSyntax = new RegExp(keywordRuleSyntax.source, 'gi');\r\n\r\n return Promise.resolve(text.replace(keywordReplaceSyntax, (match, p1, p2) => {\r\n if (p2 !== '') return p2;\r\n return match;\r\n }));\r\n }\r\n return Promise.resolve(text);\r\n}\r\n\r\n/**\r\n * Supported keyword case types\r\n */\r\nconst caseTypes = {\r\n titleCase: 'TitleCase',\r\n sentenceCase: 'SentenceCase',\r\n lowerCase: 'LowerCase',\r\n};\r\n\r\n/**\r\n * Check an incomplete string of \"keyword\" and determine the case\r\n * @param {string} text - text input\r\n * @returns {string} Case type: TitleCase, SentenceCase, LowerCase\r\n */\r\nfunction getKeywordCase(text) {\r\n if (keywordRuleTitleCaseSyntax.test(text)) {\r\n return caseTypes.titleCase;\r\n } else if (text[0] === 'K') {\r\n return caseTypes.sentenceCase;\r\n }\r\n\r\n return caseTypes.lowerCase;\r\n}\r\n\r\n/**\r\n * Looks for a keyword rule definition in given text starting from passed index.\r\n * If found, it parses the definition.\r\n * @param {string} text - text to search in\r\n * @param {string} syntax - regex syntax use for matching\r\n * @param {int} startIndex - starts searching at this index\r\n * @param {int} cursorIndex - current cursor position\r\n * @returns {Object} parses rule definition properties or undefined if a definiton is not found.\r\n */\r\nexport function parseKeywordRule(text, syntax, startIndex, cursorIndex) {\r\n const tokens = syntax.exec(text);\r\n\r\n if ((tokens === null) ||\r\n (tokens.length !== 3) ||\r\n (cursorIndex && cursorIndex <= (startIndex + tokens.index))) {\r\n return null;\r\n }\r\n\r\n return {\r\n source: tokens[0],\r\n defaultText: tokens[2],\r\n keywordCase: getKeywordCase(tokens[1]),\r\n };\r\n}\r\n\r\n\r\n/**\r\n * Parses out properties to initialize a keyword helper using current cursor position\r\n * @param {string} text - input text\r\n * @param {int} cursorIndex - current cursor position\r\n * @returns {Object} properties to initialize a keyword helper\r\n * if cursor is placed within a valid definition or at the end of a partial definition.\r\n * Returns undefined; otherwise.\r\n */\r\nexport function parseRule(text, cursorIndex) {\r\n const processedText = text || '';\r\n const startIndex = processedText.lastIndexOf('{', cursorIndex);\r\n\r\n if (startIndex === -1 || cursorIndex === startIndex) {\r\n return null;\r\n }\r\n\r\n const parsers = [\r\n {\r\n input: processedText.substring(startIndex),\r\n syntax: keywordRuleSyntax,\r\n inclusive: false,\r\n },\r\n {\r\n input: processedText.slice(startIndex, cursorIndex),\r\n syntax: keywordRuleInProgressSyntax,\r\n inclusive: true,\r\n },\r\n ];\r\n\r\n let properties = null;\r\n\r\n some(parsers, (parser) => {\r\n const rule = parseKeywordRule(parser.input, parser.syntax, startIndex, cursorIndex);\r\n\r\n if ((rule !== null) &&\r\n (cursorIndex < startIndex + rule.source.length + (parser.inclusive ? 1 : 0))) {\r\n const options = pick(rule, 'defaultText', 'keywordCase');\r\n\r\n options.prefix = processedText.substring(0, startIndex);\r\n options.suffix = processedText.substring(startIndex + rule.source.length);\r\n options.startIndex = startIndex;\r\n options.endIndex = startIndex + rule.source.length;\r\n\r\n properties = {\r\n type: 'keyword',\r\n options,\r\n };\r\n\r\n return true;\r\n }\r\n return false;\r\n });\r\n\r\n return properties;\r\n}\r\n","export const keywords = {\r\n TitleCase: 'KeyWord',\r\n SentenceCase: 'Keyword',\r\n LowerCase: 'keyword',\r\n};\r\n","/* eslint-disable react/react-in-jsx-scope */\r\nimport { isEmpty, extend } from 'underscore';\r\nimport { endsWith } from 'underscore.string';\r\nimport Promise from 'bluebird';\r\nimport React from 'react';\r\nimport { HelpPopupInline } from '@bingads-webui-react/help-popup';\r\nimport { AdCustomizerBaseAnalyzer } from '../base-analyzer';\r\n\r\nimport KeywordEditor from './editor';\r\nimport { parseRule, evaluateKeywordRules } from './parser';\r\nimport { keywords } from './constants';\r\nimport { displayLength } from '../string-utils';\r\n\r\n// Replacement text (insert) for when keyword is selected in ad customizer picker\r\nconst pickerKeywordInsert = '{KeyWord:}';\r\nconst pickerKeywordInsertCursorPosition = pickerKeywordInsert.length - 1;\r\n\r\nexport class AdCustomizerKeywordAnalyzer extends AdCustomizerBaseAnalyzer {\r\n constructor({ deps: { i18n, instrumentation }, controller }) {\r\n super({\r\n name: 'keyword',\r\n priority: 1000,\r\n i18n,\r\n activityName: 'keyword',\r\n instrumentation,\r\n controller,\r\n });\r\n this.controller = controller;\r\n this.defaultAnalyzeResult = parseRule(pickerKeywordInsert, pickerKeywordInsertCursorPosition);\r\n }\r\n\r\n /* return a reactjs object here */\r\n getSyntax(analyzeResult) {\r\n if (!analyzeResult.options) return null;\r\n\r\n const { options: { keywordCase } } = analyzeResult;\r\n const keywordText = keywords[keywordCase];\r\n this.syntax = `${this.i18n.getString(_TL_('Syntax:'))} {${keywordText}:${this.i18n.getString(_TL_('default text'))}}`;\r\n return (\r\n
    \r\n {this.syntax}\r\n \r\n \r\n
    );\r\n }\r\n\r\n needEditor(analyzeResult) {\r\n const { options } = analyzeResult || {};\r\n return !isEmpty(options);\r\n }\r\n\r\n getEditor({\r\n target, analyzeResult, updateAndCloseCallback,\r\n }) {\r\n const { options } = analyzeResult || {};\r\n\r\n return (\r\n );\r\n }\r\n\r\n\r\n // get menu item\r\n getMenuItem({\r\n startIndex, endIndex, updateAndCloseCallback, target,\r\n }) {\r\n return {\r\n name: this.i18n.getString(_TL_('Keyword insertion')),\r\n description: this.i18n.getString(_TL_('Insert the keyword that triggers your ad')),\r\n onClick: () => {\r\n const beginning = target.value.substring(0, startIndex);\r\n const end = target.value.substring(endIndex);\r\n const newValue = `${beginning}${pickerKeywordInsert}${end}`;\r\n const suffix = target.value.substring(endIndex);\r\n this.defaultAnalyzeResult =\r\n parseRule(newValue, newValue.length - suffix.length - 1);\r\n\r\n updateAndCloseCallback({\r\n newValue,\r\n cursorPosition: beginning.length + pickerKeywordInsertCursorPosition,\r\n isSelectedByUser: true,\r\n });\r\n\r\n this.controller.updatePicker({\r\n target,\r\n syntax: this.getSyntax(this.defaultAnalyzeResult),\r\n editorView: this.getEditor({\r\n target,\r\n analyzeResult: this.defaultAnalyzeResult,\r\n updateAndCloseCallback,\r\n }),\r\n container: this.controller.container,\r\n });\r\n },\r\n };\r\n }\r\n\r\n analyzeInput({\r\n text, cursorIndex, updateAndCloseCallback, target,\r\n }) {\r\n const rule = parseRule(text, cursorIndex);\r\n\r\n if (rule) {\r\n const { options: { startIndex } } = rule;\r\n return Promise.resolve(extend(\r\n {\r\n match: true,\r\n type: this.name,\r\n defaultHandlerForInput: false,\r\n itemsToDisplay: [this.getMenuItem({\r\n startIndex, endIndex: cursorIndex, updateAndCloseCallback, target,\r\n })],\r\n },\r\n rule\r\n ));\r\n }\r\n // when not match, see whether to show menu item\r\n if (text && endsWith(text, '{', cursorIndex)) {\r\n return Promise.resolve({\r\n type: this.name,\r\n defaultHandlerForInput: false,\r\n itemsToDisplay: [this.getMenuItem({\r\n startIndex: text.length - 1,\r\n endIndex: cursorIndex,\r\n updateAndCloseCallback,\r\n target,\r\n })],\r\n });\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n evaluateRule(text) {\r\n return evaluateKeywordRules(text);\r\n }\r\n\r\n getCharCountExcludingAdCustomizers(text) {\r\n let charCount = 0;\r\n let processedText = text || '';\r\n let toContinue = false;\r\n\r\n let tokens = /\\{(?:param[123]|keyword)}/i.exec(processedText);\r\n if (tokens) {\r\n processedText = processedText.replace(tokens[0], '');\r\n toContinue = true;\r\n } else {\r\n tokens = /\\{(?:param[123]|keyword):([^}]*)}/i.exec(processedText);\r\n if (tokens) {\r\n processedText = processedText.replace(tokens[0], '');\r\n charCount += tokens[1] ? displayLength(tokens[1]) : 0;\r\n toContinue = true;\r\n }\r\n }\r\n\r\n return {\r\n processedText,\r\n charCount,\r\n toContinue,\r\n };\r\n }\r\n}\r\n","import _ from 'underscore';\r\nimport Promise from 'bluebird';\r\nimport React from 'react';\r\nimport { HelpPopupInline } from '@bingads-webui-react/help-popup';\r\nimport { IffEditor } from '@bingads-webui-campaign/ad-customizers/src/iff/editor/iff-editor';\r\nimport { AudienceSelectorLegacyViewManager } from '@bingads-webui-campaign/ad-customizers/src/iff/editor/audience-selector';\r\nimport { parseRule } from '@bingads-webui-campaign/ad-customizers/src/iff/parser';\r\nimport { IF_FUNCTION_TYPE } from '@bingads-webui-campaign/ad-customizers/src/iff/if-function-type';\r\nimport { escapeIffAudienceName, escapeIffInsertText, escapeIffDefaultText } from '@bingads-webui-campaign/ad-customizers/src/iff/escape';\r\nimport { AdCustomizerBaseAnalyzer } from '../base-analyzer';\r\n\r\nconst isSelectArrow = element =>\r\n _.isFunction(element.className.indexOf) && element.className.indexOf('arrow-button') !== -1 &&\r\n element.parentElement !== null &&\r\n _.isFunction(element.parentElement.className.indexOf) && element.parentElement.className.indexOf('dlbItem-actions') !== -1;\r\n\r\nconst isRemoveArrow = element =>\r\n _.isFunction(element.className.indexOf) && element.className.indexOf('arrow-button') !== -1 &&\r\n element.className.indexOf('remove') !== -1 &&\r\n element.parentElement !== null &&\r\n _.isFunction(element.parentElement.className.indexOf) && element.parentElement.className.indexOf('dlbItem') !== -1;\r\n\r\n\r\nexport class AdCustomizerIffAnalyzer extends AdCustomizerBaseAnalyzer {\r\n constructor({\r\n deps: {\r\n i18n, instrumentation, audienceSelectorLegacyViewManager, perfMarker, permissions,\r\n }, controller,\r\n }) {\r\n super({\r\n name: 'iff',\r\n priority: 6000,\r\n i18n,\r\n activityName: 'iffEditor',\r\n instrumentation,\r\n controller,\r\n });\r\n this.controller = controller;\r\n this.audienceSelectorLegacyViewManager =\r\n audienceSelectorLegacyViewManager || new AudienceSelectorLegacyViewManager({ perfMarker });\r\n\r\n this.onEditorSave = this.onEditorSave.bind(this);\r\n this.onEditorCancel = this.onEditorCancel.bind(this);\r\n\r\n const { IsNewAudienceEnabled, IsIFFAudienceSyntaxUpdateEnabled } = permissions;\r\n this.IsNewAudienceEnabled = IsNewAudienceEnabled;\r\n this.IsIFFAudienceSyntaxUpdateEnabled = IsIFFAudienceSyntaxUpdateEnabled;\r\n }\r\n\r\n getSyntax(/* analyzeResult */) {\r\n // {=IF(Condition, insert text):default text}\r\n const syntax = this.i18n.getString(_TL_('Syntax:'));\r\n const condition = this.i18n.getString(_TL_('Condition'));\r\n const insertText = this.i18n.getString(_TL_('insert text'));\r\n const defaultText = this.i18n.getString(_TL_('default text'));\r\n const ifExpression = ' {=IF(';\r\n this.syntax = `${syntax}${ifExpression}${condition}, ${insertText}):${defaultText}}`;\r\n return (\r\n
    \r\n {this.syntax}\r\n \r\n \r\n
    \r\n );\r\n }\r\n\r\n needEditor(analyzeResult) {\r\n return !!analyzeResult;\r\n }\r\n\r\n onEditorSave({\r\n target, analyzeResult, updateAndCloseCallback,\r\n }, eventData) {\r\n const {\r\n source,\r\n startIndex,\r\n } = analyzeResult;\r\n const {\r\n insertText,\r\n defaultText,\r\n type,\r\n audienceList,\r\n } = eventData;\r\n\r\n const { newValue, cursorPosition } = this.formatExpression({\r\n audienceList,\r\n buildCompleteExpression: true,\r\n defaultText,\r\n insertText,\r\n source,\r\n startIndex,\r\n type,\r\n value: target.value,\r\n });\r\n\r\n\r\n updateAndCloseCallback({\r\n newValue,\r\n cursorPosition,\r\n isSelectedByUser: true,\r\n });\r\n }\r\n\r\n onEditorCancel({ updateAndCloseCallback }/* , eventData */) {\r\n updateAndCloseCallback({ isCancel: true });\r\n }\r\n\r\n getEditor({\r\n target, analyzeResult, updateAndCloseCallback,\r\n }) {\r\n const {\r\n source,\r\n insertText = 'insert text',\r\n defaultText = 'default text',\r\n type,\r\n audienceList = [],\r\n } = analyzeResult;\r\n\r\n const editorProps = {\r\n i18n: this.i18n,\r\n source,\r\n type,\r\n audienceList,\r\n insertText,\r\n defaultText,\r\n audienceTargetsView: this.audienceSelectorLegacyViewManager.audienceTargetsView,\r\n IsNewAudienceEnabled: this.IsNewAudienceEnabled,\r\n onSave: _.partial(this.onEditorSave, {\r\n target, analyzeResult, updateAndCloseCallback,\r\n }),\r\n onCancel: _.partial(this.onEditorCancel, {\r\n updateAndCloseCallback,\r\n }),\r\n };\r\n\r\n return (\r\n \r\n );\r\n }\r\n\r\n formatExpression({\r\n audienceList,\r\n buildCompleteExpression = false,\r\n defaultText,\r\n insertText,\r\n source,\r\n startIndex = 0,\r\n type,\r\n value,\r\n }) {\r\n let actualType = '';\r\n let conditionText = '';\r\n if (type === IF_FUNCTION_TYPE.AUDIENCE_IN) {\r\n actualType = this.IsIFFAudienceSyntaxUpdateEnabled ? 'audience IN ' : 'audience in';\r\n conditionText = `(${audienceList.map(escapeIffAudienceName).join(',')})`;\r\n } else if (buildCompleteExpression || type === IF_FUNCTION_TYPE.DEVICE_MOBILE) {\r\n actualType = 'device=mobile';\r\n }\r\n const endIndex = startIndex + source.length;\r\n const beginning = value.substring(0, startIndex);\r\n const end = value.substring(endIndex);\r\n const expressionStart = '{=IF(';\r\n const insertTextPart = escapeIffInsertText(insertText);\r\n const defaultTextPart = _.isEmpty(defaultText) ? '' : (`:${escapeIffDefaultText(defaultText)}`);\r\n const newValue = `${beginning}${expressionStart}${actualType}${conditionText},${insertTextPart})${defaultTextPart}}${end}`;\r\n const cursorPosition = buildCompleteExpression ?\r\n newValue.length - end.length :\r\n beginning.length + expressionStart.length;\r\n\r\n return {\r\n newValue,\r\n cursorPosition,\r\n };\r\n }\r\n\r\n // get menu item\r\n getMenuItem({\r\n startIndex, rule, updateAndCloseCallback, target,\r\n }) {\r\n return {\r\n name: this.i18n.getString(_TL_('IF function')),\r\n description: this.i18n.getString(_TL_('Insert text when a condition is met')),\r\n onClick: () => {\r\n const beginning = target.value.substring(0, startIndex);\r\n const end = target.value.substring(startIndex + rule.source.length);\r\n const expressionStart = '{=IF(';\r\n const newValue = `${beginning}{=IF(,insert text):default text}${end}`;\r\n const cursorPosition = beginning.length + expressionStart.length;\r\n updateAndCloseCallback({\r\n newValue,\r\n cursorPosition,\r\n isSelectedByUser: true,\r\n });\r\n\r\n const analyzeResult = parseRule({\r\n text: newValue,\r\n cursorIndex: cursorPosition,\r\n startIndex,\r\n });\r\n\r\n\r\n this.controller.updatePicker({\r\n target,\r\n syntax: this.getSyntax(),\r\n editorView: this.getEditor({\r\n target,\r\n analyzeResult,\r\n updateAndCloseCallback,\r\n }),\r\n container: this.controller.container,\r\n });\r\n },\r\n };\r\n }\r\n\r\n analyzeInput({\r\n text, cursorIndex, updateAndCloseCallback, target,\r\n }) {\r\n const startIndex = text.lastIndexOf('{', cursorIndex);\r\n\r\n if (startIndex === -1 || startIndex === cursorIndex) {\r\n return Promise.resolve(null);\r\n }\r\n\r\n const rule = parseRule({\r\n text,\r\n cursorIndex,\r\n startIndex,\r\n });\r\n\r\n // The parser should have found an exression on the left from\r\n // the cursor AND cursor should be within the matched part of the string\r\n if (rule && cursorIndex <= startIndex + rule.source.length &&\r\n // AND cursor shouldn't be at the expression's closing \"}\"\r\n !(\r\n rule.isComplete &&\r\n cursorIndex === startIndex + rule.source.length\r\n ) &&\r\n // AND either we have found first significant character (isStarted)\r\n // or we are not past two characters after startIndex, inclusive\r\n (rule.isStarted || cursorIndex <= startIndex + 2)\r\n ) {\r\n return Promise.resolve(_.defaults({\r\n itemsToDisplay: [this.getMenuItem({\r\n startIndex,\r\n rule,\r\n target,\r\n updateAndCloseCallback,\r\n })],\r\n match: rule.isComplete,\r\n startIndex,\r\n }, rule));\r\n }\r\n\r\n return Promise.resolve(null);\r\n }\r\n\r\n /**\r\n * Returns `true` if click was not on an audience selection or removal buttons.\r\n * The default logic in the controller, which traces the event's target up\r\n * the UI tree to see if it was under one of the controller's managed elements\r\n * doesn't work with audiences, because by the time the click handler of controller\r\n * is called, the audience selector has already removed the arrow button from DOM.\r\n * @param {Object} event the click event.\r\n * @returns {Boolean} Returns `true` if click was not on an audience selection or removal buttons.\r\n * Otherwise, `false`.\r\n */\r\n isClickedAway(event) {\r\n return !isSelectArrow(event.target) &&\r\n !isRemoveArrow(event.target);\r\n }\r\n\r\n getCharCountExcludingAdCustomizers(text, isComplete) {\r\n let processedText = text;\r\n let charCount = 0;\r\n const rule = parseRule({\r\n text: processedText,\r\n startIndex: 0,\r\n });\r\n\r\n if (rule && rule.source && (!isComplete || rule.isComplete)) {\r\n const {\r\n insertText = '',\r\n defaultText = '',\r\n } = rule;\r\n if (rule.isComplete) {\r\n charCount += Math.max(insertText.length, defaultText.length);\r\n } else {\r\n charCount += rule.source.length;\r\n }\r\n processedText = processedText.replace(rule.source, '');\r\n }\r\n\r\n return {\r\n processedText,\r\n charCount,\r\n };\r\n }\r\n\r\n evaluateRule(text) {\r\n let processedText = text;\r\n let rule = parseRule({\r\n text: processedText,\r\n startIndex: 0,\r\n });\r\n\r\n while (rule && rule.source) {\r\n if (rule.isComplete) {\r\n const {\r\n insertText = '',\r\n } = rule;\r\n processedText = processedText.replace(rule.source, insertText);\r\n }\r\n\r\n rule = parseRule({\r\n text: processedText,\r\n startIndex: rule.index + rule.source.length,\r\n });\r\n }\r\n\r\n return Promise.resolve(processedText);\r\n }\r\n}\r\n","import { find, pick, contains, map } from 'underscore';\r\n\r\nconst defaultMaxLength = 8;\r\n\r\n/**\r\n * Default countdown language is English.\r\n */\r\n// const defaultLanguageIndex = 2;\r\nlet supportedLanguages = null;\r\n\r\n/**\r\n * Languages supported for countdown.\r\n * The ones that have \"locale\" property are also supported for on-the-fly translation.\r\n * @param {Object} i18n - i18n\r\n * @param {Object} permissions - UI permissions\r\n * @returns {Array} supported langauges with format of [{codes, displayName, maxLength}]\r\n */\r\nconst intializeAndGetSupportedLanguages = (i18n, permissions = {}) => {\r\n if (!supportedLanguages) {\r\n supportedLanguages = [\r\n {\r\n codes: ['da'],\r\n locale: 'da',\r\n displayName: i18n.getString(_TL_('Danish')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['nl'],\r\n locale: 'nl',\r\n displayName: i18n.getString(_TL_('Dutch')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['en-us', 'en-au', 'en-gb'],\r\n locale: 'en-us',\r\n displayName: i18n.getString(_TL_('English')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['fi'],\r\n locale: 'fi',\r\n displayName: i18n.getString(_TL_('Finnish')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['fr'],\r\n locale: 'fr',\r\n displayName: i18n.getString(_TL_('French')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['de'],\r\n locale: 'de',\r\n displayName: i18n.getString(_TL_('German')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['it'],\r\n locale: 'it',\r\n displayName: i18n.getString(_TL_('Italian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['no'],\r\n displayName: i18n.getString(_TL_('Norwegian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['pt-br', 'pt-pt'],\r\n locale: 'pt-br',\r\n displayName: i18n.getString(_TL_('Portuguese')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['es', 'es-419'],\r\n locale: 'es',\r\n displayName: i18n.getString(_TL_('Spanish')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['sv'],\r\n locale: 'sv',\r\n displayName: i18n.getString(_TL_('Swedish')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['zh-hk', 'zh-tw'],\r\n locale: 'zh-hant',\r\n displayName: i18n.getString(_TL_('Traditional Chinese')),\r\n maxLength: defaultMaxLength,\r\n },\r\n ];\r\n if (permissions.IsAdsGlobalizationPhase1Enabled) {\r\n supportedLanguages = supportedLanguages.concat([\r\n {\r\n codes: ['el'],\r\n displayName: i18n.getString(_TL_('Greek')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['pl'],\r\n locale: 'pl',\r\n displayName: i18n.getString(_TL_('Polish')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['bg'],\r\n displayName: i18n.getString(_TL_('Bulgarian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['cs'],\r\n displayName: i18n.getString(_TL_('Czech')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['et'],\r\n displayName: i18n.getString(_TL_('Estonian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['hr'],\r\n displayName: i18n.getString(_TL_('Croatian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['hu'],\r\n displayName: i18n.getString(_TL_('Hungarian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['lt'],\r\n displayName: i18n.getString(_TL_('Lithuanian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['lv'],\r\n displayName: i18n.getString(_TL_('Latvian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['mt'],\r\n displayName: i18n.getString(_TL_('Maltese')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['ro'],\r\n displayName: i18n.getString(_TL_('Romanian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['sk'],\r\n displayName: i18n.getString(_TL_('Slovak')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['sl'],\r\n displayName: i18n.getString(_TL_('Slovenian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n ]);\r\n }\r\n if (permissions.IsAdsGlobalizationPhase2Enabled) {\r\n supportedLanguages = supportedLanguages.concat([\r\n {\r\n codes: ['tr'],\r\n displayName: i18n.getString(_TL_('Turkish')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['sr'],\r\n displayName: i18n.getString(_TL_('Serbian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['bs'],\r\n displayName: i18n.getString(_TL_('Bosnian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['sq'],\r\n displayName: i18n.getString(_TL_('Albanian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['mk'],\r\n displayName: i18n.getString(_TL_('Macedonian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['is'],\r\n displayName: i18n.getString(_TL_('Icelandic')),\r\n maxLength: defaultMaxLength,\r\n },\r\n ]);\r\n }\r\n if (permissions.IsAdsGlobalizationPhase6Enabled) {\r\n supportedLanguages = supportedLanguages.concat([\r\n {\r\n codes: ['ar'],\r\n locale: 'ar',\r\n displayName: i18n.getString(_TL_('Arabic')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['iw'],\r\n displayName: i18n.getString(_TL_('Hebrew')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['ru'],\r\n displayName: i18n.getString(_TL_('Russian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n ]);\r\n }\r\n if (permissions.IsAdsGlobalizationPhase2JapanEnabled) {\r\n supportedLanguages = supportedLanguages.concat([\r\n {\r\n codes: ['ja'],\r\n locale: 'ja',\r\n displayName: i18n.getString(_TL_('Japanese')),\r\n maxLength: defaultMaxLength,\r\n },\r\n ]);\r\n }\r\n if (permissions.dynamic && permissions.dynamic.AdsGlobalizationPhase9DSA) {\r\n supportedLanguages = supportedLanguages.concat([\r\n {\r\n codes: ['hi'],\r\n locale: 'hi',\r\n displayName: i18n.getString(_TL_('Hindi')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['ms'],\r\n displayName: i18n.getString(_TL_('Malay')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['th'],\r\n locale: 'th',\r\n displayName: i18n.getString(_TL_('Thai')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['in'],\r\n locale: 'in',\r\n displayName: i18n.getString(_TL_('Indonesian')),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['tl'],\r\n displayName: i18n.getString(_TL_('Tagalog')),\r\n maxLength: defaultMaxLength,\r\n },\r\n ]);\r\n }\r\n if (permissions.IsAdsGlobalizationPhase9VIEnabled) {\r\n supportedLanguages = supportedLanguages.concat([\r\n {\r\n codes: ['vi'],\r\n displayName: i18n.getString(_TL_('Vietnamese')),\r\n maxLength: defaultMaxLength,\r\n },\r\n ]);\r\n }\r\n if (permissions.IsDomesticSimplifiedChineseEnabled) {\r\n supportedLanguages = [\r\n {\r\n codes: ['zh-CN'],\r\n locale: 'zh-hans',\r\n displayName: i18n.getString(_TL_('Simplified Chinese')),\r\n maxLength: defaultMaxLength,\r\n },\r\n ];\r\n }\r\n }\r\n\r\n return supportedLanguages;\r\n};\r\n\r\nexport const languageParseMode = {\r\n ForPreview: 0,\r\n ForEditor: 1,\r\n ForCharacterCount: 2,\r\n};\r\n\r\n/**\r\n * Gets default language for count down\r\n * @param {Object} i18n - i18n\r\n * @param {Object} permissions - UI permissions\r\n * @returns {Object} a language construct that holds locale and display name\r\n */\r\nexport function getDefaultLanguage(i18n, permissions) {\r\n const defaultLanguageIndex = permissions.IsDomesticSimplifiedChineseEnabled ? 0 : 2; // Simplified Chinese : English\r\n const language = intializeAndGetSupportedLanguages(i18n, permissions)[defaultLanguageIndex];\r\n\r\n return pick(language, 'locale', 'displayName', 'maxLength');\r\n}\r\n\r\n/**\r\n * Gets the appropriate language object for given language code\r\n * @param {string} code - language code\r\n * @param {int} parseMode - flag for whether we are parsing for preview, editor or char count\r\n * @param {Object} i18n - i18n\r\n * @param {Object} permissions - UI permissions\r\n * @returns {Object} a language construct that holds locale and display name\r\n * For preview:\r\n * - language is not supported => null\r\n * - language is supported but not for translation => default\r\n * For editor:\r\n * - language is not supported => default\r\n * - language is supported but not for translation => language\r\n * For character count:\r\n * - language is not supported => null\r\n * - language is supported but not for translation => language\r\n * For all:\r\n * - language is undefined => default\r\n * - language is fully supported => language\r\n */\r\nexport function getLanguage(code, parseMode, i18n, permissions) {\r\n let language = getDefaultLanguage(i18n, permissions);\r\n\r\n if (code) {\r\n const match = find(\r\n intializeAndGetSupportedLanguages(i18n, permissions),\r\n lang => contains(lang.codes, code.toLowerCase())\r\n );\r\n\r\n if (match && match.locale) {\r\n language = match;\r\n } else if (match) {\r\n language = parseMode === languageParseMode.ForPreview ? language : match;\r\n } else {\r\n language = parseMode === languageParseMode.ForEditor ? language : null;\r\n }\r\n }\r\n\r\n return language ? pick(language, 'locale', 'displayName', 'maxLength') : null;\r\n}\r\n\r\n/**\r\n * Gets all supported language display names\r\n * @param {Object} i18n - i18n\r\n * @param {Object} permissions - UI permissions\r\n * @returns {array} display names\r\n */\r\nexport function getSupportedLanguages(i18n, permissions) {\r\n return map(\r\n intializeAndGetSupportedLanguages(i18n, permissions),\r\n lang => lang.displayName\r\n );\r\n}\r\n\r\n/**\r\n * Gets the default language code for given display name\r\n * @param {string} displayName - display name\r\n * @param {Object} i18n - i18n\r\n * @param {Object} permissions - UI permissions\r\n * @returns {string} language code\r\n */\r\nexport function getLanguageCode(displayName, i18n, permissions) {\r\n const match = find(\r\n intializeAndGetSupportedLanguages(i18n, permissions),\r\n lang => lang.displayName === displayName\r\n );\r\n\r\n return match ? match.codes[0] : null;\r\n}\r\n","import _ from 'underscore';\r\n\r\n/**\r\n * Creates a string that contains a countdown definition\r\n * @param {string} prefix - text to be concatenated in front of countdown definition (optional)\r\n * @param {string} type - countdown type\r\n * @param {string} date - countdown end date (optional, defaults to 'yyyy/MM/dd')\r\n * @param {string} time - countdown end time (optional, defaults to 'HH:mm:ss')\r\n * @param {string} language - countdown language\r\n * @param {string} days - duration of countdown in days\r\n * @param {string} suffix - text to be concatenated at the end of countdown definition (optional)\r\n * @param {string} isResponsiveSearchAd - boolean\r\n * @returns {string} formatted string\r\n */\r\nexport function formatCountdown(\r\n prefix, type, date, time, language,\r\n days, suffix, isResponsiveSearchAd\r\n) {\r\n let ret;\r\n if (isResponsiveSearchAd) {\r\n ret = '{prefix}{{type}({date} {time},{days})}{suffix}';\r\n } else {\r\n ret = '{prefix}{={type}(\"{date} {time}\", \"{language}\", {days})}{suffix}';\r\n }\r\n\r\n ret = ret.replace('{prefix}', prefix || '');\r\n ret = ret.replace('{type}', type);\r\n ret = isResponsiveSearchAd ? ret.replace('{date}', date || 'yyyy-MM-dd') : ret.replace('{date}', date || 'yyyy/MM/dd');\r\n ret = ret.replace('{time}', time || 'HH:mm:ss');\r\n ret = ret.replace('{language}', language);\r\n ret = ret.replace('{days}', days);\r\n ret = ret.replace('{suffix}', suffix || '');\r\n\r\n return ret;\r\n}\r\nexport const defaultCountdownDays = 5;\r\nexport const defaultMaxLength = 8;\r\n\r\nexport const DayPickerStrings = i18n => ({\r\n months: _.range(1, 13).map(num => i18n.getMonth(num, { style: 'wide' })),\r\n shortMonths: _.range(1, 13).map(num => i18n.getMonth(num, { style: 'abbreviated' })),\r\n days: _.map(\r\n ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'],\r\n day => i18n.getDayOfWeek(day, { style: 'wide' })\r\n ),\r\n shortDays: _.map(\r\n ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'],\r\n day => i18n.getDayOfWeek(day, { style: 'narrow' })\r\n ),\r\n goToToday: i18n.getString(_TL_('Go to today')),\r\n prevMonthAriaLabel: i18n.getString(_TL_('Go to previous month')),\r\n nextMonthAriaLabel: i18n.getString(_TL_('Go to next month')),\r\n prevYearAriaLabel: i18n.getString(_TL_('Go to previous year')),\r\n nextYearAriaLabel: i18n.getString(_TL_('Go to next year')),\r\n closeButtonAriaLabel: i18n.getString(_TL_('Close date picker')),\r\n isRequiredErrorMessage: i18n.getString(_TL_('Start date is required.')),\r\n invalidInputErrorMessage: i18n.getString(_TL_('Invalid date format.')),\r\n});\r\n","import React, { useCallback, useEffect, useState } from 'react';\r\nimport _ from 'underscore';\r\nimport PropTypes from 'prop-types';\r\nimport { Dropdown, Label, TextField, DatePicker, Stack, ChoiceGroup, DefaultButton, PrimaryButton } from '@fluentui/react';\r\nimport { HelpPopupInline } from '@bingads-webui-react/help-popup';\r\nimport { getTimezoneI18nString } from '@bingads-webui-campaign-react/help';\r\nimport { formatCountdown, DayPickerStrings, defaultCountdownDays } from './utils';\r\nimport { getSupportedLanguages, getLanguageCode } from './countdown-language';\r\n\r\nconst today = new Date(Date.now());\r\nconst getTimeZoneText = (timeZoneId, i18n) => {\r\n const text = i18n.getString(getTimezoneI18nString(timeZoneId));\r\n return _.isString(text) ? text.replace(/\\{0\\}\\s*\\{1\\}\\s*/, '') : null;\r\n};\r\nconst getLocalDate = (date, fromUTC = true) => {\r\n if (_.isNull(date) || _.isUndefined(date)) {\r\n return null;\r\n }\r\n\r\n const parsed = new Date(date);\r\n if (fromUTC) {\r\n const offset = parsed.getTimezoneOffset();\r\n // eslint-disable-next-line no-mixed-operators\r\n return new Date(parsed.getTime() + offset * 60000);\r\n }\r\n\r\n return parsed;\r\n};\r\n\r\nconst testDatePattern = (adType, value) => {\r\n const datePattern = adType === 'ResponsiveSearchAd' || adType === 'ResponsiveAd' ?\r\n /^[0-9]{4}-([1-9]|0[1-9]|1[0-2])-([1-9]|0[1-9]|[1-2][0-9]|3[0-1])$/ :\r\n /^[0-9]{4}\\/([1-9]|0[1-9]|1[0-2])\\/([1-9]|0[1-9]|[1-2][0-9]|3[0-1])$/;\r\n return datePattern.test(value);\r\n};\r\n\r\nexport function CountdownEditor(props) {\r\n const {\r\n i18n, adType, target, options, updateAndCloseCallback, timeZone, permissions = {},\r\n } = props;\r\n\r\n const [date, setDate] = useState(options.date ? getLocalDate(options.date, adType === 'ResponsiveSearchAd' || adType === 'ResponsiveAd') : '');\r\n const [time, setTime] = useState(options.time || '');\r\n const [days, setDays] = useState(options.days || defaultCountdownDays);\r\n const [countdownType, setCountdownType] = useState(options.type);\r\n const [language, setLanguage] = useState(options.language && options.language.displayName);\r\n const [supportedLanguages] = useState(() => _.map(getSupportedLanguages(i18n, permissions), lang => ({ key: lang, text: lang })));\r\n const [isTimeValid, setIsTimeValid] = useState(true);\r\n const [isDateValid, setIsDateValid] = useState(true);\r\n const [isDaysValid, setIsDaysValid] = useState(true);\r\n\r\n const onChangeTime = useCallback((event, value) => {\r\n setTime(value);\r\n }, []);\r\n const onChangeDays = useCallback((event, value) => {\r\n setDays(value);\r\n }, []);\r\n const onChangeCountdownType = useCallback((event, option) => {\r\n setCountdownType(option.key);\r\n }, []);\r\n const onChangeLanguage = useCallback((event, value) => {\r\n setLanguage(value.key);\r\n }, []);\r\n\r\n const getDaysErrorMessage = (value) => {\r\n setIsDaysValid(false);\r\n if (_.isEmpty(value)) return i18n.getString(_TL_('Number of countdown days is required.'));\r\n if (!Number.isInteger(Number(value)) || !/^\\d*$/.test(value)) return i18n.getString(_TL_('Countdown days must be an integer value.'));\r\n if (!(value >= 1 && value <= 999)) return i18n.getString(_TL_('Countdown days must be between 1 and 999.'));\r\n setIsDaysValid(true);\r\n return '';\r\n };\r\n\r\n const getTimeErrorMessage = (value) => {\r\n setIsTimeValid(false);\r\n if (!/^(?:((?:[0-1][0-9]|2[0-3]):(?:[0-5][0-9]):(?:[0-5][0-9]))|)$/.test(value)) return i18n.getString(_TL_('Enter countdown end time in HH:mm:ss format or leave it blank.'));\r\n setIsTimeValid(true);\r\n return '';\r\n };\r\n\r\n const getDateErrorMessage = (value) => {\r\n setIsDateValid(false);\r\n if (_.isEmpty(value)) return i18n.getString(_TL_('Countdown end date is required.'));\r\n if (!testDatePattern(adType, value)) {\r\n return i18n.getString(adType === 'ResponsiveSearchAd' || adType === 'ResponsiveAd' ?\r\n _TL_('Enter a future date in yyyy-MM-dd format.') :\r\n _TL_('Enter a future date in yyyy/MM/dd format.'));\r\n }\r\n setIsDateValid(true);\r\n return '';\r\n };\r\n\r\n const timeZoneOptions = [\r\n { key: 'global_countdown', text: `${i18n.getString(_TL_('Account time zone'))} ${timeZone ? getTimeZoneText(timeZone, i18n) : ''}` },\r\n { key: 'countdown', text: `${i18n.getString(_TL_(\"Ad viewer's time zone\"))} ` },\r\n ];\r\n\r\n const onFormatDate = rawDate =>\r\n i18n.formatDate(rawDate, { raw: adType === 'ResponsiveSearchAd' || adType === 'ResponsiveAd' ? 'yyyy-MM-dd' : 'yyyy/MM/dd' });\r\n\r\n const set = () => {\r\n if (!isTimeValid || !isDateValid || !isDaysValid) return;\r\n\r\n const prefix = target.value.substring(0, options.startIndex);\r\n const suffix = target.value.substring(options.endIndex);\r\n\r\n const newValue = formatCountdown(\r\n prefix,\r\n countdownType,\r\n onFormatDate(date),\r\n time.length === 0 ? '00:00:00' : time,\r\n getLanguageCode(language, i18n, permissions),\r\n days,\r\n suffix,\r\n adType === 'ResponsiveSearchAd' || adType === 'ResponsiveAd'\r\n );\r\n\r\n const cursorPosition = newValue.length - suffix.length;\r\n updateAndCloseCallback({ newValue, cursorPosition, isSelectedByUser: true });\r\n };\r\n\r\n const cancel = () => {\r\n updateAndCloseCallback({ isCancel: true });\r\n };\r\n\r\n useEffect(() => {\r\n setDate(options.date ? getLocalDate(options.date, adType === 'ResponsiveSearchAd' || adType === 'ResponsiveAd') : '');\r\n setTime(options.time || '');\r\n setDays(options.days || defaultCountdownDays);\r\n }, [adType, options]);\r\n\r\n return (\r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n {i18n.getString(_TL_('(24-hour time)'))}\r\n \r\n \r\n \r\n \r\n {i18n.getString(_TL_('day(s) before countdown end date'))}\r\n \r\n \r\n \r\n \r\n \r\n {adType !== 'ResponsiveSearchAd' && adType !== 'ResponsiveAd' && (\r\n <>\r\n \r\n \r\n \r\n \r\n \r\n )}\r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n );\r\n}\r\n\r\nCountdownEditor.propTypes = {\r\n i18n: PropTypes.shape({\r\n getString: PropTypes.func.isRequired,\r\n formatDate: PropTypes.func.isRequired,\r\n }).isRequired,\r\n adType: PropTypes.string,\r\n target: PropTypes.shape({\r\n value: PropTypes.shape({\r\n substring: PropTypes.func.isRequired,\r\n }).isRequired,\r\n }).isRequired,\r\n options: PropTypes.shape({\r\n date: PropTypes.string,\r\n time: PropTypes.string,\r\n days: PropTypes.string,\r\n language: PropTypes.string,\r\n type: PropTypes.string,\r\n startIndex: PropTypes.number.isRequired,\r\n endIndex: PropTypes.number.isRequired,\r\n }).isRequired,\r\n updateAndCloseCallback: PropTypes.func.isRequired,\r\n permissions: PropTypes.shape({}).isRequired,\r\n timeZone: PropTypes.func.isRequired,\r\n};\r\n\r\nCountdownEditor.defaultProps = {\r\n adType: 'ResponsiveSearchAd',\r\n};\r\n","import Promise from 'bluebird';\r\nimport { getCldrLocale } from '@bingads-webui/i18n-model-setup';\r\nimport { I18nModel } from '@bingads-webui-universal/i18n-model';\r\n\r\nconst cldrContext = require.context(\r\n '@bingads-webui-universal/i18n-cldr-data-modern/locales-simplified',\r\n false,\r\n /\\.json$/\r\n);\r\n\r\nexport const i18nDummy = new I18nModel({\r\n name: 'dummy',\r\n failFast: true,\r\n loadCLDRData: (locale) => {\r\n const cldrLocale = getCldrLocale(locale);\r\n const modulePath = `./${cldrLocale}.json`;\r\n return Promise.resolve(cldrContext(modulePath))\r\n .then(data => I18nModel.loadCLDRData(data))\r\n .then(() => cldrLocale);\r\n },\r\n loadTranslationData: () => ({}),\r\n});\r\n","import Promise from 'bluebird';\r\nimport { some, pick } from 'underscore';\r\nimport { getLanguage, getDefaultLanguage, languageParseMode } from './countdown-language';\r\nimport { i18nDummy } from './i18n-dummy';\r\nimport { defaultCountdownDays } from './utils';\r\n\r\n/**\r\n * Task queue for substituting countdown rule\r\n * definitions with their evaluated values\r\n */\r\nlet countdownEvalTaskChain = Promise.resolve('');\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: function name\r\n * [2]: date\r\n * [3]: time (may be undefined)\r\n * [4]: locale (may be undefined)\r\n * [5]: number of days to countdown from (may be undefined)\r\n */\r\nconst countdownRuleSyntax = /\\{=\\s*(global_countdown|countdown)\\s*\\(\\s*\"(?:(\\d{4}\\/\\d{1,2}\\/\\d{1,2})(?:\\s((?:[0-1][0-9]|2[0-3]):(?:[0-5][0-9]):(?:[0-5][0-9]))|))\"\\s*(?:,\\s*\"([a-zA-Z]{2}(?:-[a-zA-Z\\d]{2,3}|))\"\\s*(?:,\\s*([1-9]\\d{0,2})|)|)\\s*\\)\\s*\\}/i;\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: function name\r\n * [2]: date\r\n * [3]: time (may be undefined)\r\n * [4]: number of days to countdown from (may be undefined)\r\n */\r\nconst RSACountdownRuleSyntax = /\\{\\s*(global_countdown|countdown)\\s*\\(\\s*(?:(\\d{4}-\\d{1,2}-\\d{1,2})(?:\\s((?:[0-1][0-9]|2[0-3]):(?:[0-5][0-9]):(?:[0-5][0-9]))|))\\s*(?:,\\s*([1-9]\\d{0,2})|)\\s*\\)\\s*\\}/i;\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: first letter of function name\r\n */\r\nconst countdownRuleInProgressSyntax = /\\{=\\s*(c|g)[a-z]*(?:\\s*\\([a-z0-9/\":\\s,-]*(?:\\)\\s*|)|)/i;\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: first letter of function name\r\n */\r\nconst RSACountdownRuleInProgressSyntax = /\\{\\s*(c(?:o|$)(?:u|$)|g(?:l|$)(?:o|$))[a-z_]*(?:\\s*\\([a-z0-9/\":\\s,-]*(?:\\)\\s*|)|)/i;\r\n\r\n/**\r\n * Produces \" days\" in current locale\r\n * @param {int} days - number of days\r\n * @param {Object} i18n - i18n in a target countdown locale\r\n * @returns {string} \" days\" in current locale\r\n */\r\nfunction translateDays(days, i18n) {\r\n const translation = i18n.formatUnit(days, 'day');\r\n\r\n return translation;\r\n}\r\n\r\n/**\r\n * Looks for a countdown rule time definition part in given text starting from passed index.\r\n * If found, it parses the definition.\r\n * @param {string} text - text to search in\r\n * @param {int} startIndex - starts searching at this index\r\n * @param {int} parseMode - flag for whether we are parsing for preview, editor or character count\r\n * @param {int} cursorIndex - current cursor position\r\n * @returns {Object} parses rule definition properties or undefined if a definiton is not found.\r\n */\r\nexport function parseCountdownRule({\r\n text, startIndex, cursorIndex, parseMode, i18n, adType, permissions = {},\r\n}) {\r\n const input = text ? text.substring(startIndex) : '';\r\n\r\n if (adType === 'ResponsiveSearchAd' || adType === 'ResponsiveAd') {\r\n const tokens = RSACountdownRuleSyntax.exec(input);\r\n\r\n if ((tokens !== null) &&\r\n (tokens.length === 5) &&\r\n !Number.isNaN(Date.parse(tokens[2])) &&\r\n (!cursorIndex || (cursorIndex > (startIndex + tokens.index)))) {\r\n return {\r\n source: tokens[0],\r\n isComplete: true,\r\n type: tokens[1].toLowerCase(),\r\n date: tokens[2],\r\n time: tokens[3],\r\n days: tokens[4] ? parseInt(tokens[4], 10) : defaultCountdownDays,\r\n language: getDefaultLanguage(i18n, permissions),\r\n includeAdCustomizerFeed: false,\r\n };\r\n }\r\n } else {\r\n const tokens = countdownRuleSyntax.exec(input);\r\n\r\n // first try to parse countdown rule without adcustomizer\r\n // Not an acceptable rule if syntax is invalid, date is invalid, or has an unsupported language\r\n if ((tokens !== null) &&\r\n (tokens.length === 6) &&\r\n !Number.isNaN(Date.parse(tokens[2])) &&\r\n (!cursorIndex || (cursorIndex > (startIndex + tokens.index)))) {\r\n const language = getLanguage(tokens[4], parseMode, i18n, permissions);\r\n\r\n if (language) {\r\n return {\r\n source: tokens[0],\r\n isComplete: true,\r\n type: tokens[1].toLowerCase(),\r\n date: tokens[2],\r\n time: tokens[3],\r\n language,\r\n days: tokens[5] ? parseInt(tokens[5], 10) : defaultCountdownDays,\r\n includeAdCustomizerFeed: false,\r\n };\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\n\r\n/**\r\n * Looks for an incomplete countdown rule definition in given text\r\n * starting from passed index. If found, it returns countdown type.\r\n * @param {Object} options needed\r\n * @returns {Object} parses rule definition properties or undefined if a definiton is not found.\r\n */\r\nexport function parseCountdownRuleInProgress({\r\n text, startIndex, cursorIndex, i18n, adType, permissions = {},\r\n}) {\r\n const input = text.substring(startIndex);\r\n if (adType === 'ResponsiveSearchAd' || adType === 'ResponsiveAd') {\r\n const tokens = RSACountdownRuleInProgressSyntax.exec(input);\r\n\r\n if ((tokens === null) ||\r\n (cursorIndex && cursorIndex <= (startIndex + tokens.index))) {\r\n return null;\r\n }\r\n\r\n if (tokens.length !== 2 ||\r\n (!tokens[1].startsWith('c') && !tokens[1].startsWith('g'))) {\r\n return null;\r\n }\r\n\r\n return {\r\n source: tokens[0],\r\n type: tokens[1] === 'countdown(' || tokens[1].startsWith('c') ?\r\n 'countdown' :\r\n 'global_countdown',\r\n days: defaultCountdownDays,\r\n };\r\n }\r\n const tokens = countdownRuleInProgressSyntax.exec(input);\r\n\r\n if ((tokens === null) ||\r\n (cursorIndex && cursorIndex <= (startIndex + tokens.index))) {\r\n return null;\r\n }\r\n\r\n if ((tokens.length !== 2) ||\r\n ((tokens[1] !== 'c') && (tokens[1] !== 'g'))) {\r\n return null;\r\n }\r\n\r\n return {\r\n source: tokens[0],\r\n type: tokens[1] === 'countdown(' || tokens[1] === 'c' ?\r\n 'countdown' :\r\n 'global_countdown',\r\n language: getDefaultLanguage(i18n, permissions),\r\n days: defaultCountdownDays,\r\n };\r\n}\r\n\r\n/**\r\n * Looks for countdown rule definitions in given text\r\n * and substitutes them with their evaluated and translated values.\r\n * @param {string} text - input text\r\n * @param {Object} i18n - i18n which has formatUnit function\r\n * @returns {object} a promise that resolves to a modified version of input text\r\n * where all valid countdown rules\r\n * are substituted with their evaluated values\r\n */\r\nexport function evaluateCountdownRules({\r\n text, i18n, adType, permissions = {},\r\n}) {\r\n let processedText = text;\r\n\r\n function queueSubstitution(rule) {\r\n countdownEvalTaskChain = countdownEvalTaskChain.then((lang) => {\r\n const currentLanguage = lang.toLowerCase();\r\n\r\n if (rule.language.locale === currentLanguage) {\r\n const translation = translateDays(rule.days, i18nDummy);\r\n\r\n processedText = processedText.replace(rule.source, translation);\r\n return Promise.resolve(rule.language.locale);\r\n }\r\n return i18nDummy.setLocale(rule.language.locale).then(() => {\r\n const translation = translateDays(rule.days, i18nDummy);\r\n\r\n processedText = processedText.replace(rule.source, translation);\r\n return rule.language.locale;\r\n });\r\n });\r\n }\r\n\r\n let searchStartIndex = 0;\r\n let rule = parseCountdownRule({\r\n text,\r\n startIndex: searchStartIndex,\r\n parseMode: languageParseMode.ForPreview,\r\n i18n,\r\n permissions,\r\n adType,\r\n });\r\n\r\n // We need to use this global task chain to avoid interrupting\r\n // ongoing get/set locale requests.\r\n // Each evaluation cycle begins with getting current locale and then\r\n // for each countdown rule found,\r\n // we queue a task to set locale (if needed) and do substitution.\r\n if (rule !== null) {\r\n countdownEvalTaskChain = countdownEvalTaskChain.then(() => i18nDummy.getLocale());\r\n\r\n while (rule !== null) {\r\n queueSubstitution(rule);\r\n searchStartIndex += rule.source.length;\r\n rule = parseCountdownRule({\r\n text,\r\n startIndex: searchStartIndex,\r\n parseMode: languageParseMode.ForPreview,\r\n i18n,\r\n permissions,\r\n adType,\r\n });\r\n }\r\n }\r\n\r\n return countdownEvalTaskChain.then(() => processedText);\r\n}\r\n\r\n/**\r\n * Parses out properties to initialize a countdown helper using current cursor position\r\n * @param {string} text - input text\r\n * @param {int} cursorIndex - current cursor position\r\n * @param {Object} i18n - i18n which has formatUnit function\r\n * @returns {Object} properties to initialize a countdown helper\r\n * if cursor is placed within a valid definition or at the end of a partial definition.\r\n * Returns undefined; otherwise.\r\n */\r\nexport function parseRule({\r\n text, cursorIndex, i18n, adType, permissions = {},\r\n}) {\r\n const startIndex = text.lastIndexOf('{', cursorIndex);\r\n\r\n if (startIndex === -1 || cursorIndex === startIndex) {\r\n return null;\r\n }\r\n\r\n const parsers = [\r\n {\r\n // Check if cursor is placed in the middle of a valid syntax\r\n parse() {\r\n return parseCountdownRule({\r\n text,\r\n startIndex,\r\n parseMode: languageParseMode.ForEditor,\r\n cursorIndex,\r\n i18n,\r\n permissions,\r\n adType,\r\n });\r\n },\r\n keys: ['type', 'date', 'time', 'language', 'days', 'includeAdCustomizerFeed', 'feed', 'attributeWithOthers', 'isComplete', 'source'],\r\n inclusive: false,\r\n },\r\n {\r\n // Check if we are, instead, just starting to type a countdown rule\r\n parse() {\r\n return parseCountdownRuleInProgress({\r\n text,\r\n startIndex,\r\n cursorIndex,\r\n i18n,\r\n permissions,\r\n adType,\r\n });\r\n },\r\n keys: ['type', 'language', 'days', 'includeAdCustomizerFeed', 'source'],\r\n inclusive: true,\r\n },\r\n ];\r\n\r\n let properties = null;\r\n\r\n some(parsers, (parser) => {\r\n const rule = parser.parse();\r\n\r\n if ((rule !== null) &&\r\n (cursorIndex < startIndex + rule.source.length + (parser.inclusive ? 1 : 0))) {\r\n const options = pick(rule, parser.keys);\r\n\r\n options.startIndex = startIndex;\r\n options.endIndex = startIndex + rule.source.length;\r\n\r\n properties = {\r\n type: 'countdown',\r\n options,\r\n };\r\n\r\n return true;\r\n }\r\n return false;\r\n });\r\n\r\n return properties;\r\n}\r\n","/* eslint-disable react/react-in-jsx-scope */\r\nimport { isEmpty, extend } from 'underscore';\r\nimport { endsWith } from 'underscore.string';\r\nimport Promise from 'bluebird';\r\nimport React from 'react';\r\nimport moment from 'moment';\r\nimport { HelpPopupInline } from '@bingads-webui-react/help-popup';\r\nimport { languageParseMode } from './countdown-language';\r\n\r\nimport { CountdownEditor } from './countdown-editor';\r\nimport { AdCustomizerBaseAnalyzer } from '../base-analyzer';\r\nimport { parseRule, evaluateCountdownRules, parseCountdownRule } from './parser';\r\nimport { formatCountdown, defaultCountdownDays } from './utils';\r\n\r\nconst countDownDefaultDaysString = moment(new Date()).add(defaultCountdownDays, 'days').format('YYYY/MM/DD');\r\nconst RSACountDownDefaultDaysString = moment(new Date()).add(defaultCountdownDays, 'days').format('YYYY-MM-DD');\r\n\r\nconst pickerCountdownInsert = `{=countdown(\"${countDownDefaultDaysString}\")}`;\r\nconst RSAPickerCountdownInsert = `{countdown(${RSACountDownDefaultDaysString})}`;\r\n\r\nconst isDatePicker = target =>\r\n target.closest('.ms-DatePicker-picker') !== null ||\r\n target.closest('.ms-DatePicker-dayPicker') !== null ||\r\n target.closest('.ms-DatePicker-monthPicker') !== null ||\r\n target.closest('.ms-DatePicker-yearPicker') !== null;\r\n\r\nexport class AdCustomizerCountdownAnalyzer extends AdCustomizerBaseAnalyzer {\r\n constructor({\r\n deps: {\r\n instrumentation,\r\n i18n,\r\n permissions,\r\n timeZone,\r\n },\r\n controller,\r\n }) {\r\n super({\r\n name: 'countdown',\r\n priority: 10,\r\n instrumentation,\r\n i18n,\r\n activityName: 'countdown',\r\n controller,\r\n });\r\n this.controller = controller;\r\n this.permissions = permissions;\r\n this.timeZone = timeZone;\r\n }\r\n\r\n getMenuItem({\r\n startIndex, source, target, updateAndCloseCallback, adType,\r\n }) {\r\n return {\r\n name: this.i18n.getString(_TL_('Countdown')),\r\n description: this.i18n.getString(_TL_('Insert a timer that counts down to an event')),\r\n onClick: (event) => {\r\n const endIndex = startIndex + source.length;\r\n\r\n const prefix = target.value.substring(0, startIndex);\r\n const suffix = target.value.substring(endIndex);\r\n let newValue;\r\n if (adType === 'ResponsiveSearchAd' || adType === 'ResponsiveAd') {\r\n newValue = `${prefix}${RSAPickerCountdownInsert}${suffix}`;\r\n } else {\r\n newValue = `${prefix}${pickerCountdownInsert}${suffix}`;\r\n }\r\n this.defaultAnalyzeResult = parseRule({\r\n text: newValue,\r\n cursorIndex: newValue.length - suffix.length - 1,\r\n i18n: this.i18n,\r\n permissions: this.permissions,\r\n adType,\r\n });\r\n\r\n const cursorPosition = newValue.length - suffix.length - 1;\r\n\r\n updateAndCloseCallback({\r\n newValue,\r\n cursorPosition,\r\n event,\r\n isSelectedByUser: true,\r\n });\r\n\r\n this.controller.updatePicker({\r\n target,\r\n syntax: this.getSyntax(this.defaultAnalyzeResult, adType),\r\n editorView: this.getEditor({\r\n target,\r\n analyzeResult: this.defaultAnalyzeResult,\r\n updateAndCloseCallback,\r\n adType,\r\n }),\r\n container: this.controller.container,\r\n adType,\r\n });\r\n },\r\n };\r\n }\r\n\r\n isClickedAway(event) {\r\n return !isDatePicker(event.target);\r\n }\r\n\r\n analyzeInput({\r\n text, cursorIndex, updateAndCloseCallback, target, adType,\r\n }) {\r\n const processedText = text ? text.toLowerCase() : '';\r\n const rule = parseRule({\r\n text: processedText,\r\n cursorIndex,\r\n i18n: this.i18n,\r\n permissions: this.permissions,\r\n adType,\r\n });\r\n\r\n if (rule) {\r\n const { options: { startIndex, source } } = rule;\r\n return Promise.resolve(extend(\r\n {\r\n match: true,\r\n type: this.name,\r\n defaultHandlerForInput: false,\r\n itemsToDisplay: [this.getMenuItem({\r\n startIndex,\r\n source,\r\n updateAndCloseCallback,\r\n target,\r\n adType,\r\n })],\r\n },\r\n rule\r\n ));\r\n }\r\n\r\n // not match whole rule, see whether to show menu item\r\n let startIndex1 = -1;\r\n let source;\r\n if (endsWith(processedText, '{=', cursorIndex) && adType !== 'ResponsiveSearchAd' && adType !== 'ResponsiveAd') {\r\n startIndex1 = cursorIndex - 2;\r\n source = '{=';\r\n } else if (endsWith(processedText, '{', cursorIndex)) {\r\n startIndex1 = cursorIndex - 1;\r\n source = '{';\r\n }\r\n\r\n if (startIndex1 >= 0 && startIndex1 !== cursorIndex) {\r\n return Promise.resolve(extend({\r\n type: this.name,\r\n defaultHandlerForInput: false,\r\n itemsToDisplay: [this.getMenuItem({\r\n startIndex: startIndex1,\r\n source,\r\n updateAndCloseCallback,\r\n target,\r\n adType,\r\n })],\r\n }));\r\n }\r\n\r\n return Promise.resolve(null);\r\n }\r\n\r\n getSyntax(analyzeResult, adType) {\r\n const { options } = analyzeResult || {};\r\n const { type } = options || {};\r\n if (isEmpty(type)) {\r\n return null;\r\n }\r\n\r\n const syntax = formatCountdown(\r\n `${this.i18n.getString(_TL_('Syntax:'))} `,\r\n type,\r\n null,\r\n null,\r\n this.i18n.getString(_TL_('language')),\r\n this.i18n.getString(_TL_('daysBefore')),\r\n null,\r\n adType === 'ResponsiveSearchAd' || adType === 'ResponsiveAd'\r\n );\r\n return (\r\n
    {syntax}\r\n \r\n
    \r\n );\r\n }\r\n\r\n // as long as the rule match (means has type), we can show the editor\r\n needEditor(analyzeResult) {\r\n const { options } = analyzeResult || {};\r\n const { type, includeAdCustomizerFeed } = options || {};\r\n return !includeAdCustomizerFeed && !isEmpty(type);\r\n }\r\n\r\n getEditor({\r\n target, analyzeResult, updateAndCloseCallback, adType,\r\n }) {\r\n const { options } = analyzeResult || {};\r\n\r\n return (\r\n \r\n );\r\n }\r\n\r\n evaluateRule(text, adType) {\r\n return evaluateCountdownRules({\r\n text, i18n: this.i18n, permissions: this.permissions, adType,\r\n });\r\n }\r\n\r\n getCharCountExcludingAdCustomizers(text, adType) {\r\n let processedText = text;\r\n let charCount = 0;\r\n const rule = parseCountdownRule({\r\n text: processedText,\r\n startIndex: 0,\r\n languageParseMode: languageParseMode.ForCharacterCount,\r\n i18n: this.i18n,\r\n permissions: this.permissions,\r\n adType,\r\n });\r\n\r\n if (rule && rule.source) {\r\n if (rule.isComplete) {\r\n charCount += rule.language.maxLength;\r\n } else {\r\n charCount += rule.source.length;\r\n }\r\n processedText = processedText.replace(rule.source, '');\r\n }\r\n\r\n return {\r\n processedText,\r\n charCount,\r\n };\r\n }\r\n}\r\n","import Promise from 'bluebird';\r\nimport { some, pick } from 'underscore';\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: location level text\r\n * [2]: default value\r\n */\r\nconst locationRuleSyntax = /\\{location\\((city|state|country)\\)(?:}|:([^{}]+)})/i;\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: location level text (could be incomplete)\r\n * [2]: default value (could be empty)\r\n */\r\nconst locationRuleInProgressSyntax = /\\{l(?:o|$)(?:c|$)(?:a|$)(?:t|$)(?:i|$)(?:o|$)(?:n|$)(?:\\(|$)((?:c|$)(?:i|$)(?:t|$)(?:y|$)|(?:s|$)(?:t|$)(?:a|$)(?:t|$)(?:e|$)|(?:c|$)(?:o|$)(?:u|$)(?:n|$)(?:t|$)(?:r|$)(?:y|$))(?:\\)|$)(?::|$)([^{}]*)/i;\r\n\r\n/**\r\n * Looks for location rules in given text and substitutes them with their values.\r\n * {location(city): Seattle} => Seattle\r\n * @param {string} text - input text\r\n * @returns {string} text after substitutions\r\n */\r\nexport function evaluatelocationRules(text) {\r\n if (text && text.length > 0) {\r\n const locationReplaceSyntax = new RegExp(locationRuleSyntax.source, 'gi');\r\n\r\n return Promise.resolve(text.replace(locationReplaceSyntax, (match, p1, p2) => {\r\n if (p2) return p2;\r\n return match;\r\n }));\r\n }\r\n return Promise.resolve(text);\r\n}\r\n\r\n/**\r\n * Looks for a keyword rule definition in given text starting from passed index.\r\n * If found, it parses the definition.\r\n * @param {string} text - text to search in\r\n * @param {string} syntax - regex syntax use for matching\r\n * @param {int} startIndex - starts searching at this index\r\n * @param {int} cursorIndex - current cursor position\r\n * @returns {Object} parses rule definition properties or undefined if a definiton is not found.\r\n */\r\nexport function parseLocationRule(text, syntax, startIndex, cursorIndex) {\r\n const tokens = syntax.exec(text);\r\n\r\n if ((tokens === null) ||\r\n (tokens.length !== 3) ||\r\n (cursorIndex && cursorIndex <= (startIndex + tokens.index))) {\r\n return null;\r\n }\r\n\r\n return {\r\n source: tokens[0],\r\n defaultText: tokens[2],\r\n locationFormat: tokens[1],\r\n };\r\n}\r\n\r\n/**\r\n * Parses out properties to initialize a keyword helper using current cursor position\r\n * @param {string} text - input text\r\n * @param {int} cursorIndex - current cursor position\r\n * @returns {Object} properties to initialize a keyword helper\r\n * if cursor is placed within a valid definition or at the end of a partial definition.\r\n * Returns undefined; otherwise.\r\n */\r\nexport function parseRule(text, cursorIndex) {\r\n const processedText = text || '';\r\n const startIndex = processedText.lastIndexOf('{', cursorIndex);\r\n\r\n if (startIndex === -1 || cursorIndex === startIndex) {\r\n return null;\r\n }\r\n\r\n const parsers = [\r\n {\r\n input: processedText.substring(startIndex),\r\n syntax: locationRuleSyntax,\r\n inclusive: false,\r\n },\r\n {\r\n input: processedText.slice(startIndex, cursorIndex),\r\n syntax: locationRuleInProgressSyntax,\r\n inclusive: true,\r\n },\r\n ];\r\n\r\n let properties = null;\r\n\r\n some(parsers, (parser) => {\r\n const rule = parseLocationRule(parser.input, parser.syntax, startIndex, cursorIndex);\r\n\r\n if ((rule !== null) &&\r\n (cursorIndex < startIndex + rule.source.length + (parser.inclusive ? 1 : 0))) {\r\n const options = pick(rule, 'defaultText', 'locationFormat');\r\n\r\n options.prefix = processedText.substring(0, startIndex);\r\n options.suffix = processedText.substring(startIndex + rule.source.length);\r\n options.startIndex = startIndex;\r\n options.endIndex = startIndex + rule.source.length;\r\n\r\n properties = {\r\n type: 'location',\r\n options,\r\n };\r\n\r\n return true;\r\n }\r\n return false;\r\n });\r\n\r\n return properties;\r\n}\r\n","import React from 'react';\r\nimport PropTypes from 'prop-types';\r\nimport classNames from 'classnames';\r\nimport _, { isEmpty } from 'underscore';\r\nimport { withDefaultStyles } from '@bingads-webui-react/with-default-styles';\r\nimport { Label, TextField, ChoiceGroup, DefaultButton, PrimaryButton, Stack } from '@fluentui/react';\r\n\r\nconst getStyles = () => ({\r\n locationEditor: {\r\n '& .ms-Stack': {\r\n marginTop: '36px',\r\n },\r\n '& .ms-ChoiceFieldGroup': {\r\n marginBottom: '32px',\r\n },\r\n },\r\n});\r\n\r\nclass UnstyledLocationEditor extends React.PureComponent {\r\n constructor(props) {\r\n super(props);\r\n const {\r\n i18n, options,\r\n } = props;\r\n\r\n this.locationOptions = [\r\n { key: 'COUNTRY', text: i18n.getString(_TL_('Country/Region')) },\r\n { key: 'STATE', text: i18n.getString(_TL_('State/Province')) },\r\n { key: 'CITY', text: i18n.getString(_TL_('City')) },\r\n ];\r\n this.state = {\r\n defaultText: options.defaultText,\r\n locationFormat: this.getLocationFormat(options.locationFormat),\r\n };\r\n }\r\n\r\n componentDidUpdate(prevProps) {\r\n if (this.props.options.defaultText !== prevProps.options.defaultText) {\r\n // eslint-disable-next-line react/no-did-update-set-state\r\n this.setState({ defaultText: this.props.options.defaultText });\r\n }\r\n\r\n if (this.props.options.locationFormat !== prevProps.options.locationFormat) {\r\n // eslint-disable-next-line react/no-did-update-set-state\r\n this.setState({ locationFormat: this.getLocationFormat(this.props.options.locationFormat) });\r\n }\r\n }\r\n\r\n onCancel = () => {\r\n this.props.updateAndCloseCallback(({ isCancel: true }));\r\n }\r\n\r\n onSave = () => {\r\n const {\r\n options, updateAndCloseCallback,\r\n } = this.props;\r\n const { defaultText, locationFormat } = this.state;\r\n\r\n const isDefaultTextEmpty = isEmpty(this.state.defaultText);\r\n const newValue = `${options.prefix}{LOCATION(${locationFormat})${isDefaultTextEmpty ? '' : `:${defaultText}`}}${options.suffix}`;\r\n const cursorPosition = newValue.length - options.suffix.length;\r\n updateAndCloseCallback({\r\n newValue,\r\n cursorPosition,\r\n isSelectedByUser: true,\r\n });\r\n }\r\n\r\n getLocationFormat(locationFormat) {\r\n return _.find(this.locationOptions, option => option.key === locationFormat.toUpperCase()) ? locationFormat.toUpperCase() : 'CITY';\r\n }\r\n\r\n render() {\r\n const {\r\n i18n, classes,\r\n } = this.props;\r\n\r\n return (\r\n
    \r\n \r\n { this.setState({ locationFormat: option.key }); }}\r\n selectedKey={this.state.locationFormat}\r\n />\r\n \r\n this.setState({ defaultText: value })}\r\n />\r\n \r\n this.onSave()} >\r\n {i18n.getString(_TL_('Set'))}\r\n \r\n this.onCancel()} >\r\n {i18n.getString(_TL_('Cancel'))}\r\n \r\n \r\n
    );\r\n }\r\n}\r\n\r\nUnstyledLocationEditor.propTypes = {\r\n i18n: PropTypes.shape({\r\n getString: PropTypes.func,\r\n }).isRequired,\r\n classes: PropTypes.shape({\r\n locationEditor: PropTypes.string.isRequired,\r\n }).isRequired,\r\n options: PropTypes.shape({\r\n defaultText: PropTypes.string.isRequired,\r\n locationFormat: PropTypes.string.isRequired,\r\n }).isRequired,\r\n updateAndCloseCallback: PropTypes.func.isRequired,\r\n};\r\n\r\nconst LocationEditor = withDefaultStyles(UnstyledLocationEditor, getStyles);\r\nexport default LocationEditor;\r\n","import Promise from 'bluebird';\r\nimport React from 'react';\r\nimport { HelpPopupInline } from '@bingads-webui-react/help-popup';\r\nimport { extend, isEmpty } from 'underscore';\r\nimport { endsWith } from 'underscore.string';\r\nimport { AdCustomizerBaseAnalyzer } from '../base-analyzer';\r\nimport { evaluatelocationRules, parseRule } from './parser';\r\nimport LocationEditor from './editor';\r\nimport { displayLength } from '../string-utils';\r\n\r\nconst pickerLocationInsert = '{LOCATION(CITY)}';\r\nconst pickerLocationInsertCursorPosition = pickerLocationInsert.length - 1;\r\nexport class AdCustomizerLocationAnalyzer extends AdCustomizerBaseAnalyzer {\r\n constructor({ deps: { i18n, instrumentation }, controller }) {\r\n super({\r\n name: 'location',\r\n priority: 3000,\r\n i18n,\r\n activityName: 'location',\r\n instrumentation,\r\n controller,\r\n });\r\n this.controller = controller;\r\n this.defaultAnalyzeResult = parseRule(pickerLocationInsert, pickerLocationInsertCursorPosition);\r\n }\r\n\r\n /* return a reactjs object here */\r\n getSyntax(analyzeResult) {\r\n if (!analyzeResult.options) return null;\r\n const locationText = `LOCATION(${this.i18n.getString(_TL_('Level'))})`;\r\n const syntax = `${this.i18n.getString(_TL_('Syntax:'))} {${locationText}:${this.i18n.getString(_TL_('Default text'))}}`;\r\n return (\r\n
    \r\n {syntax}\r\n \r\n \r\n
    );\r\n }\r\n\r\n // get menu item\r\n getMenuItem({\r\n startIndex, endIndex, updateAndCloseCallback, target,\r\n }) {\r\n return {\r\n name: this.i18n.getString(_TL_('Location insertion')),\r\n description: this.i18n.getString(_TL_('Insert the location that triggers your ad')),\r\n onClick: () => {\r\n const beginning = target.value.substring(0, startIndex);\r\n const end = target.value.substring(endIndex);\r\n const newValue = `${beginning}${pickerLocationInsert}${end}`;\r\n const suffix = target.value.substring(endIndex);\r\n this.defaultAnalyzeResult = parseRule(newValue, newValue.length - suffix.length - 1);\r\n\r\n updateAndCloseCallback({\r\n newValue,\r\n cursorPosition: beginning.length + pickerLocationInsertCursorPosition,\r\n isSelectedByUser: true,\r\n });\r\n\r\n this.controller.updatePicker({\r\n target,\r\n syntax: this.getSyntax(this.defaultAnalyzeResult),\r\n editorView: this.getEditor({\r\n target,\r\n analyzeResult: this.defaultAnalyzeResult,\r\n updateAndCloseCallback,\r\n }),\r\n container: this.controller.container,\r\n });\r\n },\r\n };\r\n }\r\n\r\n needEditor(analyzeResult) {\r\n const { options } = analyzeResult || {};\r\n return !isEmpty(options);\r\n }\r\n\r\n getEditor({ analyzeResult, updateAndCloseCallback }) {\r\n const { options } = analyzeResult || {};\r\n\r\n return ();\r\n }\r\n\r\n analyzeInput({\r\n text, cursorIndex, updateAndCloseCallback, target,\r\n }) {\r\n const rule = parseRule(text, cursorIndex);\r\n\r\n if (rule) {\r\n const { options: { startIndex } } = rule;\r\n return Promise.resolve(extend(\r\n {\r\n match: true,\r\n type: this.name,\r\n defaultHandlerForInput: false,\r\n itemsToDisplay: [this.getMenuItem({\r\n startIndex, endIndex: cursorIndex, updateAndCloseCallback, target,\r\n })],\r\n },\r\n rule\r\n ));\r\n }\r\n // when not match, see whether to show menu item\r\n if (text && endsWith(text, '{', cursorIndex)) {\r\n return Promise.resolve({\r\n type: this.name,\r\n defaultHandlerForInput: false,\r\n itemsToDisplay: [this.getMenuItem({\r\n startIndex: text.length - 1,\r\n endIndex: cursorIndex,\r\n updateAndCloseCallback,\r\n target,\r\n })],\r\n });\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n evaluateRule(text) {\r\n return evaluatelocationRules(text);\r\n }\r\n\r\n getCharCountExcludingAdCustomizers(text) {\r\n let charCount = 0;\r\n let processedText = text || '';\r\n\r\n let tokens = /\\{location\\((city|state|country)\\)}/i.exec(processedText);\r\n if (tokens) {\r\n processedText = processedText.replace(tokens[0], '');\r\n charCount = 10;\r\n } else {\r\n tokens = /\\{location\\((city|state|country)\\):([^{}]*)}/i.exec(processedText);\r\n if (tokens) {\r\n processedText = processedText.replace(tokens[0], '');\r\n charCount += tokens[2] ? displayLength(tokens[2]) : 0;\r\n }\r\n }\r\n\r\n return {\r\n processedText,\r\n charCount,\r\n };\r\n }\r\n}\r\n","import { chain, find, isEmpty, pick, some } from 'underscore';\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: rsa ad customizer attribute name\r\n * [2]: default value\r\n */\r\nconst RSAAdCustomizerRuleSyntax = /\\{customizer.([^{}():/\"'“‘$*-+=[\\]\\\\:,.]*)(?::?}|:([^{}]+)})/i;\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: rsa ad customizer attribute name (could be empty)\r\n * [2]: default value (could be empty)\r\n */\r\nconst RSAAdCustomizerRuleInProgressSyntax = /\\{c(?:u|$)(?:s|$)(?:t|$)(?:o|$)(?:m|$)(?:i|$)(?:z|$)(?:e|$)(?:r|$)(?:\\.|$)([^{}():/\"'“‘$*-+=[\\]\\\\:,.]*)(?::|$)([^{}]*)/i;\r\n\r\n/**\r\n * Looks for rsa ad customizer rules in given text and substitutes them with their values.\r\n * {rsa ad customizer.ProductName:CocaCola} => CocaCola\r\n * @param {string} text - input text\r\n * @param {Array} attributes - attributes\r\n * @returns {string} text after substitutions\r\n */\r\nexport function evaluateRSAAdCustomizerRules(text, attributes) {\r\n if (text && text.length > 0) {\r\n const RSAAdCustomizerReplaceSyntax = new RegExp(RSAAdCustomizerRuleSyntax.source, 'gi');\r\n\r\n return text.replace(RSAAdCustomizerReplaceSyntax, (match, p1, p2) => {\r\n const matchedAttribute = find(attributes, attribute => attribute.Name === p1);\r\n if (matchedAttribute) {\r\n const values = chain([matchedAttribute.AdGroupValue, matchedAttribute.CampaignValue, matchedAttribute.AccountValue])\r\n .compact()\r\n .value();\r\n if (!isEmpty(values)) {\r\n return values[0];\r\n }\r\n }\r\n if (p2) return p2;\r\n return match;\r\n });\r\n }\r\n return text;\r\n}\r\n\r\n/**\r\n * Looks for a rsa ad customizer rule definition in given text starting from passed index.\r\n * If found, it parses the definition.\r\n * @param {string} text - text to search in\r\n * @param {string} syntax - regex syntax use for matching\r\n * @param {int} startIndex - starts searching at this index\r\n * @param {int} cursorIndex - current cursor position\r\n * @returns {Object} parses rule definition properties or undefined if a definiton is not found.\r\n */\r\nexport function parseRSAAdCustomizerRule(text, syntax, startIndex, cursorIndex) {\r\n const tokens = syntax.exec(text);\r\n\r\n if ((tokens === null) ||\r\n (tokens.length !== 3) ||\r\n (cursorIndex && cursorIndex <= (startIndex + tokens.index))) {\r\n return null;\r\n }\r\n\r\n return {\r\n source: tokens[0],\r\n defaultText: tokens[2],\r\n attributeName: tokens[1],\r\n };\r\n}\r\n\r\n/**\r\n * Parses out properties to initialize a rsa ad customizer helper using current cursor position\r\n * @param {string} text - input text\r\n * @param {int} cursorIndex - current cursor position\r\n * @returns {Object} properties to initialize a rsa ad customizer helper\r\n * if cursor is placed within a valid definition or at the end of a partial definition.\r\n * Returns undefined; otherwise.\r\n */\r\nexport function parseRule(text, cursorIndex) {\r\n const processedText = text || '';\r\n const startIndex = processedText.lastIndexOf('{', cursorIndex);\r\n\r\n if (startIndex === -1 || cursorIndex === startIndex) {\r\n return null;\r\n }\r\n\r\n const parsers = [\r\n {\r\n input: processedText.substring(startIndex),\r\n syntax: RSAAdCustomizerRuleSyntax,\r\n inclusive: false,\r\n },\r\n {\r\n input: processedText.slice(startIndex, cursorIndex),\r\n syntax: RSAAdCustomizerRuleInProgressSyntax,\r\n inclusive: true,\r\n },\r\n ];\r\n\r\n let properties = null;\r\n\r\n some(parsers, (parser) => {\r\n const rule = parseRSAAdCustomizerRule(parser.input, parser.syntax, startIndex, cursorIndex);\r\n\r\n if ((rule !== null) &&\r\n (cursorIndex < startIndex + rule.source.length + (parser.inclusive ? 1 : 0))) {\r\n const options = pick(rule, 'defaultText', 'attributeName');\r\n\r\n options.prefix = processedText.substring(0, startIndex);\r\n options.suffix = processedText.substring(startIndex + rule.source.length);\r\n options.startIndex = startIndex;\r\n options.endIndex = startIndex + rule.source.length;\r\n\r\n properties = {\r\n type: 'RSAAdCustomizer',\r\n options,\r\n };\r\n\r\n return true;\r\n }\r\n return false;\r\n });\r\n\r\n return properties;\r\n}\r\n","const dropdownItemStyle = {\r\n minHeight: '48px',\r\n selectors: {\r\n '& div.attribute-item': {\r\n width: '290px',\r\n padding: '4px',\r\n whiteSpace: 'nowrap',\r\n overflow: 'hidden',\r\n textOverflow: 'ellipsis',\r\n },\r\n '& span.attribute-sample': {\r\n color: '#767676',\r\n fontSize: '12px',\r\n },\r\n },\r\n};\r\n\r\nexport const dropdownStyles = {\r\n root: {\r\n marginBottom: '32px',\r\n },\r\n dropdown: {\r\n selectors: {\r\n ':focus:after': {\r\n border: '1px solid #0078d4',\r\n },\r\n },\r\n },\r\n dropdownItem: dropdownItemStyle,\r\n dropdownItemSelected: dropdownItemStyle,\r\n title: {\r\n borderColor: '#b3b0ad',\r\n },\r\n};\r\n\r\nexport const textFieldStyles = {\r\n root: {\r\n marginBottom: '32px',\r\n },\r\n};\r\n","import React, { useEffect, useState } from 'react';\r\nimport _ from 'underscore';\r\nimport { Dropdown, TextField, Stack, PrimaryButton, DefaultButton, Label } from '@fluentui/react';\r\nimport PropTypes from 'prop-types';\r\nimport { HelpPopupInline } from '@bingads-webui-react/help-popup';\r\nimport { dropdownStyles, textFieldStyles } from './styles';\r\n\r\nexport default function RSAAdCustomizerEditor(props) {\r\n const {\r\n options, updateAndCloseCallback, i18n, getAttributes,\r\n } = props;\r\n\r\n const [defaultText, setDefaultText] = useState(options.defaultText);\r\n const [showDropdownError, setShowDropdownError] = useState(false);\r\n const [adCustomizerAttibutes, setAdCustomizerAttibutes] = useState([]);\r\n const [selectedAttribute, setSelectedAttribute] = useState(_.find(\r\n adCustomizerAttibutes,\r\n attribute => attribute.text === options.attributeName\r\n ));\r\n\r\n useEffect(() => {\r\n getAttributes().then((attributes) => {\r\n setAdCustomizerAttibutes(_.map(attributes, attribute => ({\r\n key: attribute.Id,\r\n text: attribute.Name,\r\n value: _.chain([attribute.AdGroupValue, attribute.CampaignValue, attribute.AccountValue])\r\n .compact()\r\n .value()\r\n .join(i18n.getString('RSAAdCustomizer_Attribute_Seperator')),\r\n datatype: attribute.Datatype,\r\n })));\r\n });\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, []);\r\n\r\n useEffect(() => {\r\n setDefaultText(options.defaultText);\r\n }, [options.defaultText]);\r\n\r\n useEffect(() => {\r\n setSelectedAttribute(_.find(\r\n adCustomizerAttibutes,\r\n attribute => attribute.text === options.attributeName\r\n ));\r\n }, [adCustomizerAttibutes, options.attributeName]);\r\n\r\n const onSave = () => {\r\n if (!selectedAttribute) {\r\n setShowDropdownError(true);\r\n return;\r\n }\r\n\r\n const isDefaultTextEmpty =\r\n _.isUndefined(defaultText) ||\r\n _.isNull(defaultText) || _.isEmpty(defaultText);\r\n\r\n const newValue = `${options.prefix}{CUSTOMIZER.${selectedAttribute.text}${isDefaultTextEmpty ? '' : `:${defaultText}`}}${options.suffix}`;\r\n const cursorPosition = newValue.length - options.suffix.length;\r\n updateAndCloseCallback({\r\n newValue,\r\n cursorPosition,\r\n isSelectedByUser: true,\r\n });\r\n };\r\n\r\n const onCancel = () => {\r\n updateAndCloseCallback(({ isCancel: true }));\r\n };\r\n\r\n const onChange = (event, attribute) => {\r\n setSelectedAttribute(attribute);\r\n };\r\n\r\n const onRenderOption = option =>\r\n (\r\n
    \r\n {option.text} ({i18n.getString(`RSAAdCustomizer_Attribute_${option.datatype}`)})\r\n
    \r\n {i18n.getString('RSAAdCustomizer_Samples')}: {option.value ? option.value : i18n.getString('RSAAdCustomizer_Attribute_None')}\r\n
    \r\n );\r\n\r\n const onRenderTitle = (selectedOptions) => {\r\n const option = selectedOptions[0];\r\n return (\r\n
    \r\n {option.text} ({i18n.getString(`RSAAdCustomizer_Attribute_${option.datatype}`)})\r\n
    \r\n );\r\n };\r\n\r\n const onRenderLabel = () => (\r\n \r\n );\r\n return (\r\n
    \r\n
    \r\n \r\n \r\n setDefaultText(newValue)}\r\n />\r\n \r\n \r\n \r\n \r\n \r\n
    \r\n );\r\n}\r\n\r\nRSAAdCustomizerEditor.propTypes = {\r\n i18n: PropTypes.shape({\r\n getString: PropTypes.func.isRequired,\r\n }).isRequired,\r\n options: PropTypes.shape({\r\n defaultText: PropTypes.string,\r\n }).isRequired,\r\n updateAndCloseCallback: PropTypes.func.isRequired,\r\n getAttributes: PropTypes.func.isRequired,\r\n};\r\n","import Promise from 'bluebird';\r\nimport React from 'react';\r\nimport { extend, isEmpty, bind, map } from 'underscore';\r\nimport { endsWith } from 'underscore.string';\r\nimport { AdCustomizerBaseAnalyzer } from '../base-analyzer';\r\nimport { evaluateRSAAdCustomizerRules, parseRule } from './parser';\r\nimport RSAAdCustomizerEditor from './editor';\r\n\r\nconst pickerRSAAdCustomizerInsert = '{CUSTOMIZER.}';\r\nconst pickerRSAAdCustomizerCursorPosition = pickerRSAAdCustomizerInsert.length - 1;\r\nexport class RSAAdCustomizerAnalyzer extends AdCustomizerBaseAnalyzer {\r\n constructor({\r\n deps: {\r\n i18n, instrumentation, edmCampaign, jsDataCampaign, permissions, scope,\r\n }, controller,\r\n }) {\r\n super({\r\n name: 'rsa-adcustomizer',\r\n priority: 5000,\r\n i18n,\r\n activityName: 'RSAAdCustomizer',\r\n instrumentation,\r\n scope,\r\n controller,\r\n });\r\n this.edmCampaign = edmCampaign;\r\n this.jsDataCampaign = jsDataCampaign;\r\n this.permissions = permissions;\r\n this.controller = controller;\r\n this.defaultAnalyzeResult =\r\n parseRule(pickerRSAAdCustomizerInsert, pickerRSAAdCustomizerCursorPosition);\r\n }\r\n\r\n getAllAttributes() {\r\n const { campaignId, adGroupId } = this.scope;\r\n let adCustomizerAttributes = [];\r\n return this.jsDataCampaign.AdCustomizerAttribute\r\n .findAll({\r\n query: {\r\n $top: 100,\r\n $orderby: 'Name asc',\r\n ...this.permissions && this.permissions.dynamic && this.permissions.dynamic.RSAAdPreviewEnhancement\r\n && campaignId && adGroupId ? {\r\n entitySet: this.edmCampaign\r\n .currentAccount\r\n .Campaigns\r\n .$withKey(Number(campaignId))\r\n .AdGroups\r\n .$withKey(Number(adGroupId))\r\n .AdCustomizerAttributes\r\n .toJSON(),\r\n } : {},\r\n },\r\n })\r\n .then((returnResult) => {\r\n if (returnResult.totalCount > 0 || returnResult.length > 0) {\r\n adCustomizerAttributes = map(returnResult, (item) => {\r\n const {\r\n Name, AccountValue, CampaignValue, AdGroupValue, Id, Datatype,\r\n } = item || {};\r\n return {\r\n Name,\r\n AccountValue,\r\n CampaignValue,\r\n AdGroupValue,\r\n Id,\r\n Datatype,\r\n };\r\n });\r\n }\r\n return adCustomizerAttributes;\r\n });\r\n }\r\n\r\n /* return a reactjs object here */\r\n getSyntax(analyzeResult) {\r\n if (!analyzeResult.options) return null;\r\n const adcustomizerText = `CUSTOMIZER.${this.i18n.getString('RSAAdCustomizer_Attribute_Name')}`;\r\n const syntax = `${this.i18n.getString('AdCustomizers_Editor_Syntax_Prefix_Label')} {${adcustomizerText}:${this.i18n.getString('KeywordEditor_DefaultText')}}`;\r\n return (\r\n
    \r\n {syntax}\r\n \r\n
    \r\n );\r\n }\r\n\r\n // get menu item\r\n getMenuItem({\r\n startIndex, endIndex, updateAndCloseCallback, target,\r\n }) {\r\n return {\r\n name: this.i18n.getString('Picker_RSA_AdCustomizer_Label'),\r\n description: this.i18n.getString('Picker_RSA_AdCustomizer_Description'),\r\n onClick: () => {\r\n const beginning = target.value.substring(0, startIndex);\r\n const end = target.value.substring(endIndex);\r\n const newValue = `${beginning}${pickerRSAAdCustomizerInsert}${end}`;\r\n const suffix = target.value.substring(endIndex);\r\n this.defaultAnalyzeResult = parseRule(newValue, newValue.length - suffix.length - 1);\r\n updateAndCloseCallback({\r\n newValue: `${beginning}${pickerRSAAdCustomizerInsert}${end}`,\r\n cursorPosition: beginning.length + pickerRSAAdCustomizerCursorPosition,\r\n isSelectedByUser: true,\r\n });\r\n\r\n if (this.controller.container) {\r\n this.controller.updatePicker({\r\n target,\r\n syntax: this.getSyntax(this.defaultAnalyzeResult),\r\n editorView: this.getEditor({\r\n target,\r\n analyzeResult: this.defaultAnalyzeResult,\r\n updateAndCloseCallback,\r\n }),\r\n container: this.controller.container,\r\n });\r\n }\r\n },\r\n };\r\n }\r\n\r\n needEditor(analyzeResult) {\r\n const { options } = analyzeResult || {};\r\n return !isEmpty(options);\r\n }\r\n\r\n getEditor({ analyzeResult, updateAndCloseCallback }) {\r\n const { options } = analyzeResult || {};\r\n\r\n return ();\r\n }\r\n\r\n analyzeInput({\r\n text, cursorIndex, updateAndCloseCallback, target,\r\n }) {\r\n const rule = parseRule(text, cursorIndex);\r\n\r\n if (rule) {\r\n const { options: { startIndex } } = rule;\r\n return Promise.resolve(extend(\r\n {\r\n match: true,\r\n type: this.name,\r\n defaultHandlerForInput: false,\r\n itemsToDisplay: [this.getMenuItem({\r\n startIndex, endIndex: cursorIndex, updateAndCloseCallback, target,\r\n })],\r\n },\r\n rule\r\n ));\r\n }\r\n // when not match, see whether to show menu item\r\n if (text && endsWith(text, '{', cursorIndex)) {\r\n return Promise.resolve({\r\n type: this.name,\r\n defaultHandlerForInput: false,\r\n itemsToDisplay: [this.getMenuItem({\r\n startIndex: text.length - 1,\r\n endIndex: cursorIndex,\r\n updateAndCloseCallback,\r\n target,\r\n })],\r\n });\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n evaluateRule(text) {\r\n if (text && text.length > 0 && text.search(/{CUSTOMIZER/i) !== -1) {\r\n return new Promise((resolve) => {\r\n this.getAllAttributes().then((attributes) => {\r\n resolve(evaluateRSAAdCustomizerRules(text, attributes));\r\n });\r\n });\r\n }\r\n return Promise.resolve(text);\r\n }\r\n\r\n getCharCountExcludingAdCustomizers(text) {\r\n let charCount = 0;\r\n let processedText = text || '';\r\n let toContinue = false;\r\n\r\n let tokens = /\\{CUSTOMIZER.[^{}():/\"'“‘$*-+=[\\]\\\\:,.]*}/i.exec(processedText);\r\n if (tokens) {\r\n processedText = processedText.replace(tokens[0], '');\r\n toContinue = true;\r\n charCount = 1;\r\n } else {\r\n tokens = /\\{CUSTOMIZER.[^{}():/\"'“‘$*-+=[\\]\\\\:,.]*:([^}]*)}/i.exec(processedText);\r\n if (tokens) {\r\n processedText = processedText.replace(tokens[0], '');\r\n charCount += tokens[1] ? tokens[1].length : 1;\r\n toContinue = true;\r\n }\r\n }\r\n\r\n return {\r\n processedText,\r\n charCount,\r\n toContinue,\r\n };\r\n }\r\n\r\n isValidField() {\r\n return true;\r\n }\r\n}\r\n","import { useEffect, useState } from 'react';\r\nimport { attachAdCustomizersHelpers } from './index';\r\n\r\nexport function useAdCustomizers({\r\n ref, updateAction, adType, container, field,\r\n}) {\r\n const [cursorPosition, setCursorPostion] = useState(0);\r\n\r\n useEffect(() => {\r\n ref.current.setSelectionRange(cursorPosition, cursorPosition);\r\n }, [cursorPosition, ref]);\r\n\r\n\r\n useEffect(() => {\r\n const removeAdCustomizer = attachAdCustomizersHelpers({\r\n element: ref.current,\r\n updateAction,\r\n setCursorPostion,\r\n container,\r\n adType,\r\n field,\r\n });\r\n\r\n return () => removeAdCustomizer();\r\n }, [adType, container, field, ref, updateAction]);\r\n}\r\n","/* eslint-disable no-new */\r\nimport _ from 'underscore';\r\nimport Promise from 'bluebird';\r\nimport { buildLegacyI18n } from '@bingads-webui/build-legacy-i18n';\r\nimport { AdCustomizerController } from './controller';\r\nimport { AdCustomizerKeywordAnalyzer } from './keyword/analyzer';\r\nimport { AdCustomizerIffAnalyzer } from './iff/analyzer';\r\nimport { AdCustomizerCountdownAnalyzer } from './countdown/analyzer';\r\nimport { AdCustomizerLocationAnalyzer } from './location/analyzer';\r\nimport { RSAAdCustomizerAnalyzer } from './rsa-ad-customizer/analyzer';\r\nimport { useAdCustomizers } from './hooks';\r\nimport { displayLength } from './string-utils';\r\nimport { LegacyStringMap } from './rsa-ad-customizer/legacy-string-map';\r\n\r\n// These singletons orchestrate the controllers and analyzers for each ad type\r\n// that supports Ad Customizers. This is needed to allow certain ad types to use a subset of the\r\n// available Ad Customizers (specifically the analyzers).\r\nconst instances = {\r\n ResponsiveSearchAd: {\r\n controller: null,\r\n initialized: false,\r\n },\r\n ResponsiveAd: {\r\n controller: null,\r\n initialized: false,\r\n },\r\n DynamicSearchAd: {\r\n controller: null,\r\n initialized: false,\r\n },\r\n};\r\n\r\nconst AdCustomizerAvailableFields = {\r\n ResponsiveSearchAd: {\r\n countdown: ['Headlines', 'Descriptions'],\r\n location: ['Headlines', 'Descriptions', 'Path1', 'Path2'],\r\n keyword: ['Headlines', 'Descriptions', 'Path1', 'Path2'],\r\n 'rsa-adcustomizer': ['Headlines', 'Descriptions', 'Path1', 'Path2'],\r\n iff: ['Headlines', 'Descriptions', 'Path1', 'Path2'],\r\n },\r\n ResponsiveAd: {\r\n countdown: ['Headlines', 'Descriptions', 'LongHeadlines'],\r\n location: ['Headlines', 'Descriptions', 'LongHeadlines'],\r\n keyword: ['Headlines', 'Descriptions', 'LongHeadlines'],\r\n 'rsa-adcustomizer': ['Headlines', 'Descriptions', 'LongHeadlines'], // pilot?\r\n },\r\n DynamicSearchAd: {\r\n countdown: ['Descriptions', 'Path1', 'Path2'],\r\n iff: ['Descriptions', 'Path1', 'Path2'],\r\n keyword: [],\r\n location: [],\r\n 'rsa-adcustomizer': [],\r\n },\r\n};\r\n\r\nfunction checkAdType(adType) {\r\n if (!_.has(instances, adType)) {\r\n throw new Error(`Ad customizer for ad type '${adType}' may not be supported.`);\r\n }\r\n}\r\n\r\nfunction initializeAdCustomizer({\r\n deps,\r\n adType,\r\n}) {\r\n checkAdType(adType);\r\n\r\n if (!instances[adType].initialized) {\r\n instances[adType].controller = new AdCustomizerController(deps);\r\n const { permissions = {}, showAdCustomizers } = deps;\r\n const {\r\n IsRSAAdCustomizerEnabled, IsMMAAdCustomizerInsertionEnabled,\r\n } = permissions;\r\n const dynamic = permissions && permissions.dynamic;\r\n const IsIffPopupEnabled = adType === 'DynamicSearchAd' || (adType === 'ResponsiveSearchAd' && dynamic && dynamic.IsRSAIffPopupEnabled);\r\n\r\n const { controller } = instances[adType];\r\n if (showAdCustomizers) {\r\n new AdCustomizerCountdownAnalyzer({\r\n deps,\r\n controller,\r\n });\r\n new AdCustomizerKeywordAnalyzer({ deps, controller });\r\n new AdCustomizerLocationAnalyzer({ deps, controller });\r\n if ((adType === 'ResponsiveAd' && IsMMAAdCustomizerInsertionEnabled) || (adType === 'ResponsiveSearchAd' && IsRSAAdCustomizerEnabled)) {\r\n new RSAAdCustomizerAnalyzer({\r\n deps: _.defaults({ i18n: buildLegacyI18n(deps.i18n, [LegacyStringMap]) }, deps),\r\n controller,\r\n });\r\n }\r\n if (IsIffPopupEnabled) {\r\n new AdCustomizerIffAnalyzer({ deps, controller });\r\n }\r\n }\r\n instances[adType].initialized = true;\r\n } else if (deps.scope) {\r\n // update scope if already initialized\r\n const { controller: { analyzers } } = instances[adType];\r\n _.each(analyzers, ({ analyzer }) => {\r\n // eslint-disable-next-line no-param-reassign\r\n analyzer.scope = deps.scope;\r\n });\r\n }\r\n}\r\n\r\nfunction getController(adType) {\r\n if (instances[adType].initialized === false || instances[adType].controller === null) {\r\n throw new Error(`Ad customizer for ad type '${adType}' not be initialized.`);\r\n }\r\n\r\n return instances[adType].controller;\r\n}\r\n\r\nfunction getAvailableAnalyzers(controller, adType, field) {\r\n return controller.analyzers.filter(analyzer =>\r\n AdCustomizerAvailableFields[adType][analyzer.analyzer.name].includes(field));\r\n}\r\n\r\nfunction testResetState(adType) {\r\n instances[adType].initialized = false;\r\n instances[adType].controller = null;\r\n}\r\n\r\n/*\r\n * Attaches focus, input event listeners to ad text fields\r\n */\r\nfunction attachAdCustomizersHelpers({\r\n container = document.body, // to attach popups to\r\n element,\r\n updateAction,\r\n setCursorPostion,\r\n adType,\r\n field = '',\r\n}) {\r\n const controller = getController(adType);\r\n const availableAnalyzers = getAvailableAnalyzers(controller, adType, field);\r\n\r\n const textFieldEventHandler = (event) => {\r\n const { type, key, target } = event;\r\n const {\r\n isSelectedByUser, analyzerName, selectionStart, selectionEnd,\r\n } = target;\r\n target.isSelectedByUser = false;\r\n target.analyzerName = undefined;\r\n\r\n // Ignore if any text is selected, we are only interested in the cursor\r\n if (selectionStart !== selectionEnd) {\r\n return;\r\n }\r\n\r\n // Ignore escape key up since it shouldn't prompt any helper\r\n if (type === 'keyup' && key === 'Escape') {\r\n return;\r\n }\r\n\r\n controller.onInputUpdate({\r\n availableAnalyzers,\r\n event,\r\n isSelectedByUser,\r\n analyzerName,\r\n updateAction,\r\n setCursorPostion,\r\n container, // to attach popups to\r\n adType,\r\n field,\r\n });\r\n };\r\n\r\n if (availableAnalyzers.length !== 0) {\r\n element.addEventListener('click', textFieldEventHandler, false);\r\n element.addEventListener('keyup', textFieldEventHandler, false);\r\n element.addEventListener('change', textFieldEventHandler, false);\r\n }\r\n\r\n return () => {\r\n element.removeEventListener('click', textFieldEventHandler);\r\n element.removeEventListener('keyup', textFieldEventHandler);\r\n element.removeEventListener('change', textFieldEventHandler);\r\n };\r\n}\r\n\r\n// Calculates how much space ad customizer adds to the ad text field\r\nfunction getCharCountExcludingAdCustomizers({\r\n text,\r\n adType,\r\n field = '',\r\n}) {\r\n const controller = getController(adType);\r\n const availableAnalyzers = getAvailableAnalyzers(controller, adType, field);\r\n if (availableAnalyzers.length === 0) {\r\n return displayLength(text);\r\n }\r\n\r\n return controller.getCharCountExcludingAdCustomizers(availableAnalyzers, text, adType, field);\r\n}\r\n\r\n/**\r\n * Looks for ad customizers in given text and substitutes them with their evaluated values.\r\n * Used for preview generation.\r\n * @param {string} text - input text\r\n * @returns {Object} A promise that resolves to modified input text that contains substitutions\r\n */\r\nfunction evaluateAdCustomizers({\r\n text,\r\n adType,\r\n field = '',\r\n}) {\r\n const controller = getController(adType);\r\n const availableAnalyzers = getAvailableAnalyzers(controller, adType, field);\r\n if (availableAnalyzers.length === 0) {\r\n return Promise.resolve(text);\r\n }\r\n\r\n return controller.evaluateAdCustomizers(availableAnalyzers, text, adType, field);\r\n}\r\n\r\nexport {\r\n initializeAdCustomizer,\r\n evaluateAdCustomizers,\r\n getCharCountExcludingAdCustomizers,\r\n attachAdCustomizersHelpers,\r\n useAdCustomizers,\r\n testResetState,\r\n checkAdType,\r\n};\r\n","export const LegacyStringMap = {\r\n RSAAdCustomizer_Attribute_Name: _TL_('Attribute name'),\r\n AdCustomizers_Editor_Syntax_Prefix_Label: _TL_('Syntax:'),\r\n KeywordEditor_DefaultText: _TL_('default text'),\r\n Picker_RSA_AdCustomizer_Label: _TL_('Ad customizer'),\r\n Picker_RSA_AdCustomizer_Description: _TL_('Insert custom text, number, price or percentage'),\r\n RSAAdCustomizer_Attribute_String: _TL_('Text'),\r\n RSAAdCustomizer_Attribute_Text: _TL_('Text'),\r\n RSAAdCustomizer_Attribute_Percent: _TL_('Percent'),\r\n RSAAdCustomizer_Attribute_Price: _TL_('Price'),\r\n RSAAdCustomizer_Attribute_Number: _TL_('Number'),\r\n RSAAdCustomizer_Samples: _TL_('Samples'),\r\n RSAAdCustomizer_Attribute_None: _TL_('None'),\r\n RSAAdCustomizer_Select: _TL_('Select'),\r\n RSAAdCustomizer_Attribute: _TL_('Attribute'),\r\n RSAAdCustomizer_Attribute_Seperator: _TL_(', '),\r\n RSAAdCustomizer_Select_Error: _TL_('Select an attribute'),\r\n DefaultText_Label: _TL_('Default text'),\r\n AdCustomizers_Editor_Set_Button: _TL_('Set'),\r\n Cancel: _TL_('Cancel'),\r\n 'Click to learn more about {{item}}': _TL_('Click to learn more about {{item}}'),\r\n};\r\n","/* eslint-disable jsx-a11y/anchor-is-valid */\r\nimport React from 'react';\r\nimport PropTypes from 'prop-types';\r\nimport $ from 'jquery';\r\nimport classnames from 'classnames';\r\n\r\n/** Picker for ad customizer\r\n * all editor are on top of this\r\n * it will do following things\r\n * 1 show syntax when syntax is not null\r\n * 2 show editor when editorView not null\r\n * 3 show the selectable items when itemsToDisplay not empty and editorview null\r\n */\r\nexport class AdCustomizerPicker extends React.Component {\r\n static defaultProps = {\r\n itemsToDisplay: [],\r\n syntax: '',\r\n editorView: null,\r\n target: null,\r\n container: $('body'),\r\n }\r\n\r\n constructor(props) {\r\n super(props);\r\n\r\n const {\r\n itemsToDisplay, syntax, editorView, target, activity,\r\n } = this.props;\r\n\r\n this.state = {\r\n itemsToDisplay,\r\n syntax,\r\n editorView,\r\n target,\r\n };\r\n this.activity = activity;\r\n }\r\n\r\n // update state when props update\r\n static getDerivedStateFromProps(nextProps) {\r\n const {\r\n itemsToDisplay, syntax, editorView, target,\r\n } = nextProps;\r\n\r\n return {\r\n target,\r\n itemsToDisplay,\r\n syntax,\r\n editorView,\r\n };\r\n }\r\n\r\n getDisplayPosition(target, container) {\r\n const $target = $(target);\r\n const targetOffset = $target.offset();\r\n const containerOffset = container.offset();\r\n\r\n // Calculate the position of the popup relative to the container.\r\n // The container needs to be non-statically positioned, either fixed, relative or absolute,\r\n // because the popup is position: absolute.\r\n return {\r\n top: (targetOffset.top - containerOffset.top) + $target.outerHeight(),\r\n left: targetOffset.left - containerOffset.left,\r\n };\r\n }\r\n\r\n render() {\r\n const {\r\n target,\r\n editorView,\r\n syntax,\r\n itemsToDisplay,\r\n } = this.state;\r\n const position = this.getDisplayPosition(target, this.props.container);\r\n\r\n const containerStyle = { display: 'block', left: `${position.left}px`, top: `${position.top}px` };\r\n let syntaxToUse = null;\r\n\r\n if (syntax) {\r\n syntaxToUse = (\r\n
    \r\n {syntax}\r\n
    );\r\n }\r\n\r\n let contentView = null;\r\n let contentClasses = [];\r\n\r\n if (editorView) {\r\n contentView = (
    {editorView}
    );\r\n contentClasses = ['adCustomizersEditor'];\r\n } else {\r\n contentClasses = ['picker-list'];\r\n contentView = itemsToDisplay.map(({ name, description, onClick }, index) => {\r\n const updatedOnClick = (event) => {\r\n this.activity.trace(`${this.props.adType} AdCustomizersPicker`, `${name} selected`);\r\n onClick(event);\r\n event.stopPropagation();\r\n event.preventDefault();\r\n };\r\n return (\r\n
  • \r\n \r\n
    {name}
    \r\n { description ?
    {description}
    : null}\r\n \r\n
  • );\r\n }, this);\r\n }\r\n\r\n return (\r\n
      \r\n {syntaxToUse}\r\n {contentView}\r\n
    \r\n );\r\n }\r\n}\r\n\r\nAdCustomizerPicker.propTypes = {\r\n itemsToDisplay: PropTypes.arrayOf(PropTypes.shape({\r\n name: PropTypes.string,\r\n description: PropTypes.string,\r\n onClick: PropTypes.func,\r\n })),\r\n syntax: PropTypes.shape({}),\r\n editorView: PropTypes.shape({}),\r\n target: PropTypes.shape({}),\r\n activity: PropTypes.shape({ trace: PropTypes.func }).isRequired,\r\n container: PropTypes.shape({ offset: PropTypes.func }),\r\n adType: PropTypes.string.isRequired,\r\n};\r\n","import { isString } from 'underscore';\r\n/**\r\n * Regex Pattern for wide characters\r\n */\r\nconst wideCharPattern = new RegExp(\r\n '[\\\\u1100-\\\\u11FF]' + // IsHangulJamo\r\n '|[\\\\u2E80-\\\\u2EFF]' + // IsCJKRadicalsSupplement\r\n '|[\\\\u3000-\\\\u303F]' + // IsCJKSymbolsandPunctuation\r\n '|[\\\\u3040-\\\\u309F]' + // IsHiragana\r\n '|[\\\\u30A0-\\\\u30FF]' + // IsKatakana\r\n '|[\\\\u3130-\\\\u318F]' + // IsHangulCompatibilityJamo\r\n '|[\\\\u3200-\\\\u32FF]' + // IsEnclosedCJKLettersandMonths\r\n '|[\\\\u3300-\\\\u33FF]' + // IsCJKCompatibility\r\n '|[\\\\u3400-\\\\u4DBF]' + // IsCJKUnifiedIdeographsExtensionA\r\n '|[\\\\u4E00-\\\\u9FFF]' + // IsCJKUnifiedIdeographs\r\n '|[\\\\uAC00-\\\\uD7AF]' + // IsHangulSyllables\r\n '|[\\\\uF900-\\\\uFAFF]' + // IsCJKCompatibilityIdeographs\r\n '|[\\\\uFE30-\\\\uFE4F]' + // IsCJKCompatibilityForms\r\n '|[\\\\uFF01-\\\\uFF60]' + // Fullwidth Forms Part 1\r\n '|[\\\\uFFE0-\\\\uFFE6]' + // Fullwidth Forms Part 2\r\n '|[\\\\uD800-\\\\uDBFF][\\\\uDC00-\\\\uDFFF]' // Astral Planes\r\n , 'g'\r\n);\r\n\r\n/**\r\n * Get string length, which counting CJK character or Emojis as 2\r\n * @param {string} str - string to count\r\n * @returns {int} - length of string\r\n */\r\nexport function displayLength(str) {\r\n return isString(str) ? str.replace(wideCharPattern, '12').length : 0;\r\n}\r\n","const schema = {\r\n scenario: [\r\n {\r\n name: 'adCustomizersInAdsEditor',\r\n value: 'AdCustomizersInAdsEditor',\r\n setting: {},\r\n activity: [\r\n {\r\n name: 'picker',\r\n value: 'Picker',\r\n },\r\n {\r\n name: 'feeds',\r\n value: 'Feeds',\r\n },\r\n {\r\n name: 'countdown',\r\n value: 'Countdown',\r\n },\r\n {\r\n name: 'keyword',\r\n value: 'Keyword',\r\n },\r\n {\r\n name: 'iffEditor',\r\n value: 'IF-function',\r\n },\r\n {\r\n name: 'location',\r\n value: 'Location',\r\n },\r\n {\r\n name: 'RSAAdCustomizer',\r\n value: 'RSAAdCustomizer',\r\n },\r\n ],\r\n },\r\n ],\r\n};\r\n\r\nlet senario = null;\r\nexport function createActivity(instrumentation, activityName) {\r\n if (!senario) {\r\n if (!instrumentation.adCustomizersInAdsEditor) {\r\n instrumentation.addScenario(schema);\r\n }\r\n senario = instrumentation.adCustomizersInAdsEditor.create();\r\n }\r\n\r\n return senario[activityName].create();\r\n}\r\n","import $ from 'jquery';\r\nimport { extend, pluck, isEmpty, flatten, all, size, filter, findIndex } from 'underscore';\r\nimport Promise from 'bluebird';\r\nimport React from 'react';\r\nimport ReactDOM from 'react-dom';\r\n\r\nimport { AdCustomizerPicker } from './picker';\r\nimport { displayLength } from './string-utils';\r\nimport { createActivity } from './instrumentation';\r\n\r\n/** controller for ad customizer analyze\r\n it is a single instance and the main function is :\r\n .register(priority, analyzer) -->for analyzer to register itself\r\n .analyzeInput({text, cursorIndex, isSelectedByUser, updateAction, target, adType})\r\n --> analyze input and update the picker accordingly\r\n .getCharCountExcludingAdCustomizers(text) -->get chart count excluding rules\r\n .evaluateAdCustomizers(text) --> get the preview text\r\n */\r\nexport class AdCustomizerController {\r\n constructor() {\r\n this.analyzers = [];\r\n this.containerToUse = null;\r\n\r\n this.clickedAway = this.clickedAway.bind(this);\r\n this.keydown = this.keydown.bind(this);\r\n }\r\n /** Registers an analyzer and then ordering according to its priority\r\n * update target & close the picker after editor closes\r\n * @param {number} priority - to order menu items in ascending order\r\n * @param {Object} analyzer - the analyzer to use\r\n * @returns {Object} null\r\n */\r\n register(priority, analyzer) {\r\n // order by priority asc\r\n this.analyzers.push({ priority, analyzer });\r\n this.analyzers.sort((b, a) => b.priority - a.priority);\r\n }\r\n\r\n /**\r\n * getAnalyzerByIndex\r\n * @private\r\n * @param {number} index - analyzer index\r\n * @returns {Object} analyzer\r\n */\r\n getAnalyzerByIndex(index) {\r\n return this.analyzers[index].analyzer;\r\n }\r\n\r\n getAnalyzerByName(name) {\r\n const analyzerIndex = findIndex(\r\n this.analyzers,\r\n ({ analyzer: { name: analyzerName } }) => analyzerName === name\r\n );\r\n if (analyzerIndex === -1) {\r\n throw new Error(`Ad customizer syntax analyzer with name '${name}' could not be found`);\r\n }\r\n\r\n return {\r\n analyzer: this.analyzers[analyzerIndex].analyzer,\r\n analyzerIndex,\r\n };\r\n }\r\n\r\n /* analyze input\r\n run analyzerInput for all of analyzers\r\n each analyzer return result format of\r\n {\r\n itemsToDisplay: {\r\n name, // Title of the menu item\r\n description: string, // description line for the menu item\r\n onClick: func, // menu item's click handler\r\n }\r\n type: string,\r\n defaultHandlerForInput: true/false,\r\n // means in senario when no items to display, is this still default processor\r\n }\r\n\r\n then combine those result and generate result with format of:\r\n {\r\n fallBackResult,\r\n hitResults, // if in-progress or compolete expression detected by analyzer\r\n fallBackAnalyzer\r\n } */\r\n analyzeInput({\r\n text, cursorIndex, isSelectedByUser, analyzerName, updateAction, target, adType, field,\r\n }) {\r\n const hitResults = [];\r\n let fallBackAnalyzer = null;\r\n let fallBackResult = null;\r\n const pipeNextEvaluator = (previewPromise, currentPosition, resolve) => {\r\n previewPromise.then((result) => {\r\n // Analyzer the result of current analyzer\r\n if (result && (result.match || !isEmpty(result.itemsToDisplay))) {\r\n hitResults.push(extend({ analyzerId: currentPosition - 1 }, result));\r\n } else if (!fallBackAnalyzer && result && result.defaultHandlerForInput) {\r\n fallBackAnalyzer = this.getAnalyzerByIndex(currentPosition - 1);\r\n fallBackResult = result;\r\n }\r\n\r\n if (analyzerName || currentPosition >= this.analyzers.length) {\r\n // Done with all analyzers, when either \"sticking\" to single named\r\n // analyzer or already went through all of them\r\n resolve({\r\n fallBackResult,\r\n hitResults,\r\n fallBackAnalyzer,\r\n });\r\n } else {\r\n // Switch to another analyzer\r\n const analyzer = this.getAnalyzerByIndex(currentPosition);\r\n pipeNextEvaluator(\r\n analyzer.analyzeInput({\r\n text,\r\n cursorIndex,\r\n isSelectedByUser,\r\n updateAction,\r\n target,\r\n updateAndCloseCallback: this.updateAndCloseCallback(\r\n updateAction, target,\r\n analyzer, adType\r\n ),\r\n adType,\r\n field,\r\n }),\r\n currentPosition + 1,\r\n resolve\r\n );\r\n }\r\n });\r\n };\r\n\r\n let nextAnalyzerPosition = 1;\r\n let firstAnalyzer;\r\n if (analyzerName) {\r\n const { analyzer, analyzerIndex } = this.getAnalyzerByName(analyzerName);\r\n firstAnalyzer = analyzer;\r\n nextAnalyzerPosition = analyzerIndex + 1;\r\n } else {\r\n firstAnalyzer = this.getAnalyzerByIndex(0);\r\n nextAnalyzerPosition = 1;\r\n }\r\n return new Promise((resolve) => {\r\n pipeNextEvaluator(firstAnalyzer.analyzeInput({\r\n text,\r\n cursorIndex,\r\n isSelectedByUser,\r\n updateAction,\r\n target,\r\n updateAndCloseCallback: this.updateAndCloseCallback(\r\n updateAction, target,\r\n firstAnalyzer, adType\r\n ),\r\n adType,\r\n field,\r\n }), nextAnalyzerPosition, resolve);\r\n });\r\n }\r\n\r\n /** updateAndCloseCallback\r\n * update target & close the picker after editor closes\r\n * @param {func} updateAction - update call back\r\n * @param {Object} target - whether this is selected option\r\n * @param {Object} analyzer - the analyzer to use\r\n * @param {Object} adType - adType\r\n * @returns {Object} null\r\n */\r\n updateAndCloseCallback = (updateAction, target, analyzer, adType) =>\r\n ({\r\n newValue, cursorPosition, isSelectedByUser, event, isCancel,\r\n }) => {\r\n if (!isCancel) {\r\n updateAction(newValue);\r\n analyzer.traceUpdate(target.value, newValue, analyzer.name, adType);\r\n target.setSelectionRange(cursorPosition, cursorPosition);\r\n\r\n // Setting the \"sticky\" flags regarding the user actions.\r\n // isSelectedUser is used to distinguish between the user's interactions\r\n // through the helper menus and the user interactions through typing\r\n // in a target field.\r\n // eslint-disable-next-line no-param-reassign\r\n target.isSelectedByUser = isSelectedByUser;\r\n // eslint-disable-next-line no-param-reassign\r\n target.analyzerName = analyzer.name;\r\n\r\n target.focus();\r\n }\r\n this.hidePicker();\r\n if (event) {\r\n event.stopPropagation();\r\n event.preventDefault();\r\n }\r\n }\r\n\r\n /**\r\n * OnInput update\r\n * got analyed result from analyzeInput\r\n then for the result\r\n -->when multiple results, just display them, each item with { name, description, onClick }\r\n -->when single result\r\n ask the analyzer whether need editor (for countdown/if/keywordinseration, it need show editor)\r\n --> [result 1] show editor (using the passed in container)\r\n --> [result 2] do nothing, then just continue will the display, with its syntax\r\n\r\n --> when no result, find the 1st fallback hander\r\n --> when no result & no default\r\n In the end it calls updateAction callback if there is an actual change.\r\n * @param {Object} options - options for parametr\r\n * @param {Object} options.event - event\r\n * @param {func} options.updateAction - update call back for Ads editor\r\n * to get updates to the text fields\r\n * @param {bool} options.isSelectedByUser - whether this is selected option\r\n * (true - user clicked an item in the pop-up; false - user typed text)\r\n * @param { Object} options.container -- container to show the picker\r\n * @param { Object} options.remainingCountCallBack -- remaining count call back func\r\n * @param { Object} options.instrumentation -- instrumentation\r\n * @param { Object} options.adType -- adType\r\n * @param { Object} options.field -- field\r\n * @returns {Object} null\r\n */\r\n onInputUpdate({\r\n event,\r\n isSelectedByUser,\r\n analyzerName,\r\n updateAction,\r\n container,\r\n remainingCountCallBack,\r\n instrumentation,\r\n adType,\r\n field,\r\n }) {\r\n const { target, key } = event;\r\n // selectionEnd - native prop to tell cursor position\r\n const { selectionEnd, value } = target;\r\n\r\n let syntax = null;\r\n let items = [];\r\n let editorView = null;\r\n\r\n // for empty input, directly hide the picker\r\n if (isEmpty(value) || isEmpty(value.trim())) {\r\n return this.updatePicker({\r\n syntax, items, container, editorView, target, instrumentation, adType,\r\n });\r\n }\r\n\r\n return this.analyzeInput({\r\n text: value,\r\n cursorIndex: selectionEnd,\r\n isSelectedByUser,\r\n analyzerName,\r\n updateAction,\r\n target,\r\n remainingCountCallBack,\r\n adType,\r\n field,\r\n })\r\n .then(({\r\n hitResults,\r\n fallBackResult,\r\n fallBackAnalyzer,\r\n }) => {\r\n if (!isEmpty(hitResults)) {\r\n // Removing hits without itemsToDisplay to decide if there are multiple\r\n // hits with items that would need a menu as the result\r\n const hitResultsWithItems =\r\n filter(hitResults, hitResult => !isEmpty(hitResult.itemsToDisplay));\r\n if (size(hitResultsWithItems) > 1) {\r\n items = flatten(pluck(hitResultsWithItems, 'itemsToDisplay'));\r\n } else {\r\n const [analyzeResult] = size(hitResultsWithItems) > 0 ?\r\n hitResultsWithItems : hitResults;\r\n const analyzer = this.getAnalyzerByIndex(analyzeResult.analyzerId);\r\n syntax = analyzer.getSyntax(analyzeResult, adType);\r\n\r\n if (analyzer.needEditor(analyzeResult)) {\r\n editorView = analyzer.getEditor({\r\n target,\r\n analyzeResult,\r\n remainingCountCallBack,\r\n key,\r\n updateAndCloseCallback: this.updateAndCloseCallback(\r\n updateAction, target,\r\n analyzer, adType\r\n ),\r\n adType,\r\n });\r\n } else {\r\n items = analyzeResult.itemsToDisplay;\r\n }\r\n }\r\n }\r\n\r\n // If, after looking at the results, no syntax, no items and no editor\r\n // were selected, we try to use fallback analyzer's syntax\r\n if (!syntax && isEmpty(items) && !editorView && fallBackAnalyzer) {\r\n syntax = fallBackAnalyzer.getSyntax(fallBackResult, adType);\r\n }\r\n\r\n return this.updatePicker({\r\n syntax, items, container, editorView, target, adType,\r\n });\r\n });\r\n }\r\n\r\n registerGlobalEvents(target) {\r\n $(window).on('click', this.clickedAway);\r\n $(target).on('keydown', this.keydown);\r\n }\r\n\r\n hidePicker() {\r\n ReactDOM.unmountComponentAtNode(this.containerToUse[0]);\r\n $(window).off('click', this.clickedAway);\r\n $(this.target).off('keydown', this.keydown);\r\n }\r\n\r\n clickedAway(event) {\r\n const $target = $(event.target);\r\n\r\n if (all(this.analyzers, ({ analyzer }) => analyzer.isClickedAway(event)) &&\r\n $target.closest('.ac-helper-area').length === 0 &&\r\n $target.closest('.ad-customizer-container').length === 0) {\r\n this.hidePicker();\r\n }\r\n }\r\n\r\n /**\r\n * Handles key down events.\r\n * Hides editor when user hits escape.\r\n * @param {object} event - click event\r\n * @returns {undefined}\r\n */\r\n keydown(event) {\r\n switch (event.key) {\r\n case 'Escape':\r\n this.hidePicker();\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * getCharCountExcludingAdCustomizers\r\n * get chart count exluding the ad customizers\r\n * @param {string} text - text to analyze\r\n * @param {string} adType - ad type\r\n * @param {string} field - target field\r\n * @returns {number} count\r\n */\r\n getCharCountExcludingAdCustomizers(text, adType = 'ExpandedTextAd', field = '') {\r\n if (!text) {\r\n return 0;\r\n }\r\n let resultText = text;\r\n let charCount = 0;\r\n let cycleCharCount;\r\n do {\r\n cycleCharCount = 0;\r\n let phase1CharCount;\r\n let toContinue;\r\n do {\r\n phase1CharCount = 0;\r\n toContinue = false;\r\n // Running parsers one after another, requesting evaluation of\r\n // a first complete expression found only, until no character contributions\r\n // detected\r\n for (let i = 0; i < this.analyzers.length; i += 1) {\r\n const analyzer = this.getAnalyzerByIndex(i);\r\n if (analyzer.isValidField(field)) {\r\n const result = analyzer.getCharCountExcludingAdCustomizers(resultText, true, adType);\r\n resultText = result.processedText;\r\n phase1CharCount += result.charCount;\r\n toContinue = toContinue || result.toContinue;\r\n }\r\n }\r\n charCount += phase1CharCount;\r\n cycleCharCount += phase1CharCount;\r\n } while (phase1CharCount > 0 || toContinue);\r\n let phase2CharCount;\r\n do {\r\n phase2CharCount = 0;\r\n // Running parsers one after another, requesting evaluation of\r\n // a first in-complete expression found only, until no character contributions\r\n // detected\r\n for (let i = 0; i < this.analyzers.length; i += 1) {\r\n const analyzer = this.getAnalyzerByIndex(i);\r\n if (analyzer.isValidField(field)) {\r\n const result = analyzer.getCharCountExcludingAdCustomizers(resultText, true, adType);\r\n resultText = result.processedText;\r\n phase2CharCount += result.charCount;\r\n }\r\n }\r\n charCount += phase2CharCount;\r\n cycleCharCount += phase2CharCount;\r\n } while (phase2CharCount > 0);\r\n } while (cycleCharCount > 0);\r\n\r\n return displayLength(resultText) + charCount;\r\n }\r\n\r\n /**\r\n * evaluateAdCustomizers\r\n * get text replacing ad customizer rules with its default text\r\n * @param {string} text - text to analyze\r\n * @param {string} adType - ad type\r\n * @param {string} field - target field\r\n * @returns {Object} a promise which will resolve the final test\r\n */\r\n evaluateAdCustomizers(text, adType = 'ExpandedTextAd', field = '') {\r\n if (!text) {\r\n return Promise.resolve(text);\r\n }\r\n const pipeNextEvaluator = (previewPromise, currentPosition, resolve) => {\r\n previewPromise.then((result) => {\r\n if (currentPosition >= this.analyzers.length) {\r\n resolve(result);\r\n } else {\r\n const analyzer = this.getAnalyzerByIndex(currentPosition);\r\n pipeNextEvaluator(analyzer.isValidField(field) ?\r\n this.getAnalyzerByIndex(currentPosition).evaluateText(result, adType) :\r\n Promise.resolve(text), currentPosition + 1, resolve);\r\n }\r\n });\r\n };\r\n return new Promise((resolve) => {\r\n const analyzer = this.getAnalyzerByIndex(0);\r\n pipeNextEvaluator(analyzer.isValidField(field) ?\r\n this.getAnalyzerByIndex(0).evaluateText(text, adType) : Promise.resolve(text), 1, resolve);\r\n });\r\n }\r\n\r\n /* Renders or updates the picker or hide it */\r\n // as we will use dom.unmountComponentAtNode(container), we make a specific container\r\n updatePicker({\r\n syntax, items, container, editorView, target, instrumentation, adType,\r\n }) {\r\n if (this.containerToUse === null || container.find(this.containerToUse).length === 0) {\r\n let containerToUse = container.find('.ad-customizer-container');\r\n if (containerToUse.length === 0) {\r\n containerToUse = $('
    ');\r\n containerToUse.appendTo(container);\r\n }\r\n this.containerToUse = containerToUse;\r\n }\r\n\r\n if (!this.pickerActivity) {\r\n this.pickerActivity = createActivity(instrumentation, 'picker');\r\n }\r\n\r\n if (syntax || !isEmpty(items) || editorView) {\r\n // render latest picker\r\n ReactDOM.render(React.createElement(AdCustomizerPicker, {\r\n itemsToDisplay: items,\r\n editorView,\r\n syntax,\r\n target,\r\n activity: this.pickerActivity,\r\n container,\r\n adType,\r\n }), this.containerToUse[0]);\r\n this.registerGlobalEvents(target);\r\n } else {\r\n this.hidePicker();\r\n }\r\n }\r\n}\r\n","import Promise from 'bluebird';\r\nimport { createActivity } from './instrumentation';\r\n\r\n/** Base analyzer\r\n * all analyzer should implement the functions of\r\n * 1 analyzeInput\r\n * 2 getSyntax\r\n * 3 needEditor\r\n * 4 getEditor (reactjs object)\r\n * 5 evaluateRule\r\n * 6 getCharCountExcludingAdCustomizers\r\n */\r\nexport class AdCustomizerBaseAnalyzer {\r\n constructor({\r\n name,\r\n config,\r\n priority,\r\n instrumentation,\r\n i18n,\r\n activityName,\r\n controller,\r\n excludedFields = [],\r\n }) {\r\n this.name = name;\r\n this.instrumentation = instrumentation;\r\n this.priority = priority;\r\n this.editor = null;\r\n this.i18n = i18n;\r\n this.activityName = activityName;\r\n this.excludedFields = excludedFields;\r\n this.activity = createActivity(instrumentation, activityName);\r\n this.config = config;\r\n controller.register(this.priority, this);\r\n }\r\n\r\n isValidField(field) {\r\n return this.excludedFields.indexOf(field) === -1;\r\n }\r\n\r\n /*\r\n base response: {\r\n itemsToDisplay: {\r\n name, // Title of the menu item\r\n description: string, // description line for the menu item\r\n onClick: func, // menu item's click handler\r\n }\r\n type: string,\r\n // whether the rule matches, if only one rule match then editor might be shown\r\n match: true/false,\r\n defaultHandlerForInput: true/false,\r\n },\r\n can also add item that has information for inline edit & syntax\r\n */\r\n analyzeInput(/* { text, cursorIndex, updateAndCloseCallback, target, adType} */) {\r\n }\r\n\r\n /* return a reactjs object here */\r\n getSyntax(/* analyzeResult */) {\r\n }\r\n\r\n needEditor(/* analyzeResult */) {\r\n }\r\n\r\n getEditor(/* {target, container, analyzeResult, key, updateAction,remainingCountCallBack} */) {\r\n }\r\n\r\n // return a promise of evaluted text\r\n evaluateRule(/* {text, adType} */) {\r\n }\r\n\r\n /**\r\n * Should return `true` if the analyzer considers that the click happened outside the\r\n * controller boundaries.\r\n * @param {Object} event the click event.\r\n * @returns {Boolean} `true` if clicked outside the analyzer managed area.\r\n * Otherwise, `false`. The default return value is `true`.\r\n */\r\n isClickedAway(/* event */) {\r\n return true;\r\n }\r\n\r\n // evaluate rules and update text for the evaluated values, do not override this\r\n evaluateText(text, adType = 'ExpandedTextAd') {\r\n if (!text) {\r\n return Promise.resolve(text);\r\n }\r\n\r\n const pipeNextEvaluator = (previewPromise, previousResult, resolve) => {\r\n previewPromise.then((result) => {\r\n if (!result) {\r\n resolve(text);\r\n }\r\n // evaluate till no new rules found, in case there are multiple rules in text\r\n if (result === previousResult) {\r\n resolve(result);\r\n } else {\r\n pipeNextEvaluator(this.evaluateRule(result, adType), result, resolve);\r\n }\r\n });\r\n };\r\n\r\n return new Promise((resolve) => {\r\n pipeNextEvaluator(this.evaluateRule(text, adType), text, resolve);\r\n });\r\n }\r\n\r\n /* get chart count excluding adcustomizers rules{\r\n processedText: text,\r\n charCount: 0,\r\n } */\r\n getCharCountExcludingAdCustomizers(text) {\r\n return {\r\n processedText: text,\r\n charCount: 0,\r\n };\r\n }\r\n\r\n traceUpdate(oldValue, newValue, customizerName, adType) {\r\n this.activity.trace(\r\n `${adType} targetUpdateFromAdCustomizer ${customizerName}`,\r\n `updating field value from ${oldValue} to ${newValue}`\r\n );\r\n }\r\n}\r\n","import { some, pick } from 'underscore';\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: data feed name\r\n * [2]: attribute name\r\n * [3]: default text(not null)\r\n */\r\n// for IsAdCustomizerMilestone5Enabled, it enable all characters other than {}\r\n// Looks for a feed name separator\r\nconst adCustomizerFeedNameSyntaxWithSpecialCharacter = /{(?:=(?:((?:[^\\s{}.\\\\]|\\\\[^{}])(?:[^{}.\\\\]|\\\\[^{}])*))?}?)?/i;\r\n// Looks for a attribute name starting from the \".\"\r\n/*\r\n * Captures:\r\n * [0]: whole match starting from '.'\r\n * [1]: attribute name\r\n * [2]: the '}' character - mark of a complete expression\r\n */\r\nconst adCustomizerFeedAttributeSyntaxWithSpecialCharacter = /^\\.((?:[^{}:\\\\]*|(?:\\\\[^{}])*)*)(})?/i;\r\n/**\r\n * Looks for default text starting from the \":\".\r\n * Capture:\r\n * [0]: whole match starting from ':'\r\n * [1]: default text\r\n * [2]: the '}' character - mark of a complete expression\r\n */\r\nconst adCustomizerFeedDefaultTextSyntaxWithSpecialCharacter = /^:(?:(?:\\s*(?:((?:[^}\\\\]|\\\\\\S)*))?)?(?:(}))?)?/i;\r\n\r\nfunction removeEscapedStringFromFeedName(ori) {\r\n if (ori) {\r\n return ori.replace(/\\\\./g, '.');\r\n }\r\n return '';\r\n}\r\nfunction removeEscapedStringFromAttribute(ori) {\r\n if (ori) {\r\n return ori.replace(/\\\\:/g, ':');\r\n }\r\n return '';\r\n}\r\n\r\n/**\r\n * Looks for a ad customizer feed definition in given text starting from passed index.\r\n * If found, it parses the definition.\r\n * with special character support (character other than {})\r\n * @param {string} text - text to search in\r\n * @param {int} startIndex - starts searching at this index\r\n * @param {int} cursorIndex - current cursor position\r\n * @returns {Object} parses rule definition properties or undefined if a definiton is not found.\r\n */\r\nexport function parseAdCustomizerFeedsRuleForSpecialChracter(text, startIndex, cursorIndex) {\r\n let input = text.substring(startIndex);\r\n\r\n // first find the feedName\r\n const nameTokens = adCustomizerFeedNameSyntaxWithSpecialCharacter.exec(input);\r\n\r\n // Check if cursor is at the \"{\" or before that, then exist. Otherwise, continue.\r\n if (nameTokens === null ||\r\n (cursorIndex && cursorIndex <= (startIndex + nameTokens.index))) {\r\n return null;\r\n }\r\n\r\n const feed = removeEscapedStringFromFeedName(nameTokens[1]);\r\n // source stores full expression we parsed\r\n let source = nameTokens[0];\r\n let attribute = '';\r\n let defaultText = '';\r\n const { index } = nameTokens;\r\n\r\n let isComplete = false;\r\n let specificFeedName = false;\r\n let specificAttributeName = false;\r\n // then find the feed attribute\r\n\r\n input = input.substring(index).substring(source.length);\r\n\r\n if (input) {\r\n const attributeTokens = adCustomizerFeedAttributeSyntaxWithSpecialCharacter.exec(input);\r\n\r\n if (attributeTokens) {\r\n attribute = attributeTokens.length >= 2 ? removeEscapedStringFromAttribute(attributeTokens[1]) : '';\r\n isComplete = !!attributeTokens[2];\r\n\r\n if (attributeTokens.length > 0) {\r\n specificFeedName = true;\r\n\r\n if (attributeTokens[0]) {\r\n source += attributeTokens[0];\r\n input = input.substring(attributeTokens[0].length);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // If there was an attribute part after a feed part, and still some text remains to parse\r\n if (specificFeedName && input) {\r\n const defaultTextToken = adCustomizerFeedDefaultTextSyntaxWithSpecialCharacter.exec(input);\r\n\r\n if (defaultTextToken) {\r\n defaultText = defaultTextToken[1] || '';\r\n if (defaultTextToken[0]) {\r\n source += defaultTextToken[0];\r\n }\r\n specificAttributeName = true;\r\n isComplete = isComplete || !!defaultTextToken[2];\r\n }\r\n }\r\n\r\n return {\r\n source,\r\n isComplete,\r\n index: nameTokens.index,\r\n feed,\r\n attribute,\r\n defaultText,\r\n specificFeedName,\r\n specificAttributeName,\r\n };\r\n}\r\n\r\nexport function parseRule({\r\n processedText,\r\n startIndex,\r\n selectionEnd,\r\n // needFullRule actually means - allow full rule\r\n needFullRule,\r\n isSelectedByUser,\r\n}) {\r\n // the { and we do have ad customizer feeds case\r\n const parsers = [{\r\n // Check if cursor is placed in the middle of a valid syntax\r\n parse() {\r\n return parseAdCustomizerFeedsRuleForSpecialChracter(\r\n processedText,\r\n startIndex, selectionEnd\r\n );\r\n },\r\n keys: ['feed', 'attribute', 'defaultText', 'specificFeedName', 'source', 'specificAttributeName', 'isComplete'],\r\n inclusive: false,\r\n }];\r\n\r\n let options = null;\r\n some(parsers, (parser) => {\r\n const rule = parser.parse();\r\n\r\n if (!rule) {\r\n return null;\r\n }\r\n\r\n let isValid = needFullRule;\r\n\r\n if (!isValid) {\r\n isValid = isSelectedByUser;\r\n // for not fullRule and not selected, there should be no '}' in source\r\n if (!isValid) {\r\n isValid = rule.source.indexOf('}') < 0;\r\n\r\n if (!isValid) {\r\n // if all } are the \\\\}, special characters, then it's fine\r\n isValid = rule.source.split('}').length === rule.source.split('\\\\}').length;\r\n }\r\n }\r\n\r\n // for the whole rule match, it either did not have } or behind it\r\n isValid = isValid || (selectionEnd < startIndex + rule.source.length);\r\n }\r\n\r\n if (isValid) {\r\n options = pick(rule, parser.keys);\r\n\r\n options.startIndex = startIndex;\r\n options.endIndex = startIndex + rule.source.length;\r\n\r\n return true;\r\n }\r\n\r\n return false;\r\n });\r\n\r\n return options;\r\n}\r\n","import _ from 'underscore';\r\nimport Promise from 'bluebird';\r\nimport { withUiBlock as originalWithUiBlock } from '@bingads-webui/uiblocker';\r\n\r\nconst {\r\n map, clone, pluck, isEmpty, filter, noop,\r\n} = _;\r\n\r\nconst withUiBlock =\r\n _.partial(originalWithUiBlock, /* target */ _, /* loadingText */ _, /* shouldFocus */ false);\r\n\r\n// current limitation is 100, the 1200000 is just to be a safe number\r\nconst FeedsToFetch = 200;\r\nlet feeds = [];\r\n\r\nconst getAllFeeds = _.once((el, jsDataCampaign) => {\r\n if (isEmpty(feeds)) {\r\n const filterQuery = 'Status eq Enum.FeedStatus\\'Active\\' and FeedCategories/any(c:c eq Enum.FeedCategory\\'AdCustomizer\\')';\r\n const uiBlock = el ? withUiBlock(el) : noop;\r\n\r\n return jsDataCampaign.Feed\r\n .findAll({ query: { $filter: filterQuery }, limit: FeedsToFetch })\r\n .finally(uiBlock)\r\n .then((returnResult) => {\r\n if (returnResult.totalCount > 0) {\r\n feeds = map(returnResult, (item) => {\r\n const { Name, Attributes, Id } = item || {};\r\n\r\n return {\r\n Name,\r\n AttributeNames: pluck(Attributes, 'Name'),\r\n Id,\r\n };\r\n });\r\n }\r\n\r\n return feeds;\r\n }).catch(() => []);\r\n }\r\n return Promise.resolve(feeds);\r\n});\r\n\r\nexport function cloneFeed(orignalFeed) {\r\n const { Id, AttributeNames, Name } = orignalFeed;\r\n\r\n return {\r\n Id,\r\n Name,\r\n AttributeNames: clone(AttributeNames),\r\n };\r\n}\r\n\r\nfunction cloneFeeds(originalFeeds) {\r\n return map(originalFeeds, cloneFeed);\r\n}\r\n\r\n// the feeds will be returned as the structure of\r\n// [{Name, AttributeNames}]\r\nexport function queryFeedsByName({\r\n jsDataCampaign, namePrefix: rawNamePrefix = '', container = null, useExactMatch = false,\r\n}) {\r\n const namePrefix = (rawNamePrefix || '').trim().toLowerCase();\r\n return getAllFeeds(container, jsDataCampaign).then((allFeeds) => {\r\n if (isEmpty(namePrefix)) {\r\n return cloneFeeds(allFeeds);\r\n }\r\n\r\n return filter(allFeeds, (feed) => {\r\n const feedNameToUse = feed && feed.Name ? feed.Name.toLowerCase() : '';\r\n\r\n return feedNameToUse &&\r\n (useExactMatch ?\r\n feedNameToUse === namePrefix :\r\n feedNameToUse.indexOf(namePrefix) === 0);\r\n });\r\n });\r\n}\r\n","/* eslint-disable react/react-in-jsx-scope */\r\nimport { extendOwn, defaults, map, isEmpty, filter, first } from 'underscore';\r\nimport Promise from 'bluebird';\r\nimport React from 'react';\r\nimport { FeedSyntaxView, DefaultTextEditorView } from '@bingads-webui-campaign-react/feed-and-attribute-selector';\r\n\r\nimport { AdCustomizerBaseAnalyzer } from '../base-analyzer';\r\nimport { parseRule, parseAdCustomizerFeedsRuleForSpecialChracter } from './parser';\r\nimport { queryFeedAttributeSampleValue } from './query-feed-attribute-sample-value';\r\nimport { queryFeedsByName } from './query-feeds-by-name';\r\n\r\nconst escapeFeedName = str => (str ? str.replace(/\\./g, '\\\\.') : '');\r\nconst escapeAttrbuteName = str => (str ? str.replace(/:/g, '\\\\:') : '');\r\n\r\n/** Feeds analyzer, the most complicated analyzer\r\n */\r\nexport class AdCustomizerFeedAnalyzer extends AdCustomizerBaseAnalyzer {\r\n constructor({\r\n deps: {\r\n config,\r\n instrumentation,\r\n i18n,\r\n jsDataCampaign,\r\n edmCampaign,\r\n },\r\n controller,\r\n }) {\r\n super({\r\n name: 'adCustomizer',\r\n config,\r\n priority: 100,\r\n instrumentation,\r\n i18n,\r\n activityName: 'feeds',\r\n controller,\r\n });\r\n\r\n this.jsDataCampaign = jsDataCampaign;\r\n this.edmCampaign = edmCampaign;\r\n }\r\n\r\n /*\r\n * To generate Ad customizer root static menu item\r\n */\r\n getMenuItem({\r\n startIndex, rule, target, updateAndCloseCallback,\r\n }) {\r\n return {\r\n name: this.i18n.getString('Picker_AdCustomizer_Label'),\r\n description: this.i18n.getString('Picker_AdCustomizer_Description'),\r\n onClick: (event) => {\r\n const {\r\n defaultText, feed, attribute, source,\r\n } = rule;\r\n\r\n const { newValue, cursorPosition } = this.formatAdCustomizerFeed({\r\n feedName: feed,\r\n attributeName: attribute,\r\n defaultText,\r\n value: target.value,\r\n startIndex,\r\n buildCompleteExpression: false,\r\n source,\r\n });\r\n updateAndCloseCallback({\r\n newValue,\r\n cursorPosition,\r\n event,\r\n isSelectedByUser: true,\r\n });\r\n },\r\n };\r\n }\r\n\r\n formatAdCustomizerFeed({\r\n feedName,\r\n attributeName,\r\n defaultText,\r\n value,\r\n startIndex,\r\n buildCompleteExpression = false,\r\n source,\r\n }) {\r\n const trimmedDefaultText = defaultText ? defaultText.trim() : '';\r\n const endIndex = startIndex + source.length;\r\n\r\n const prefix = value.substring(0, startIndex);\r\n const suffix = value.substring(endIndex);\r\n const feedNamePart = escapeFeedName(feedName);\r\n const expressionStart = '{=';\r\n const selectedAttributeNamePart = attributeName ? `.${escapeAttrbuteName(attributeName)}` : '';\r\n const defaultTextSelectedPart = trimmedDefaultText ? `:${trimmedDefaultText}` : '';\r\n const newValue = `${prefix}${expressionStart}${feedNamePart}${selectedAttributeNamePart}${defaultTextSelectedPart}}${suffix}`;\r\n\r\n const cursorPosition = buildCompleteExpression ?\r\n newValue.length - suffix.length :\r\n newValue.length - suffix.length - 1;\r\n\r\n return {\r\n newValue,\r\n cursorPosition,\r\n };\r\n }\r\n\r\n updateTargetOnUserSelectionUpdate({\r\n feedName, attributeName, defaultText, target, startIndex,\r\n updateAndCloseCallback, event, source,\r\n }) {\r\n const { newValue, cursorPosition } = this.formatAdCustomizerFeed({\r\n feedName,\r\n attributeName,\r\n defaultText,\r\n value: target.value,\r\n startIndex,\r\n buildCompleteExpression: false,\r\n source,\r\n });\r\n\r\n updateAndCloseCallback({\r\n newValue, cursorPosition, isSelectedByUser: true, event,\r\n });\r\n }\r\n\r\n getStartIndex(value, cursorIndex) {\r\n return value.lastIndexOf('{', cursorIndex);\r\n }\r\n\r\n evaluateRule(text) {\r\n const processedText = text || '';\r\n const parseResult = parseRule({\r\n needFullRule: true,\r\n isSelectedByUser: false,\r\n processedText,\r\n startIndex: this.getStartIndex(processedText, processedText.length),\r\n selectionEnd: processedText.length,\r\n config: this.config,\r\n });\r\n\r\n if (parseResult) {\r\n const {\r\n feed, attribute, startIndex, endIndex,\r\n } = parseResult;\r\n\r\n if (feed && attribute) {\r\n return queryFeedAttributeSampleValue({\r\n feedName: feed,\r\n attributeName: attribute,\r\n edmCampaign: this.edmCampaign,\r\n jsDataCampaign: this.jsDataCampaign,\r\n }).then(sample => (sample ?\r\n text.replace(text.substring(startIndex, endIndex), sample) :\r\n text));\r\n }\r\n }\r\n\r\n return Promise.resolve(text);\r\n }\r\n\r\n /** analyze input\r\n * the rule is that\r\n * --> when there is {= and the { is before the cursor, then\r\n * 1 first parse the rule, see whether it has feed/attribute/defaultText\r\n * 2 if there is no feed in rule, return all the feeds got for the customer\r\n * 3 if there is feed in rule, but no attribute, fetch feeds (with name filter)\r\n * and analyze result count\r\n * .only one the feed already have full name, return attributes under it\r\n * .more than one or feed name not full in one case, return feeds to display\r\n * .no feed found, then return empty itemsToDisplay but defaultHandlerForInput to true\r\n * 4 if there is attribute in rule, but no default text, fetch specific feed\r\n * and filter attributes by name, and analyze result count\r\n * .only one attribute and attribute name already full, return specificAttributeName true\r\n * (which means will show default text editor)\r\n * .more than one or attribute not full, return attributes to display\r\n * .no feed found, then return empty itemsToDisplay but defaultHandlerForInput to true\r\n * --> else when no {= but { is the last character before cursor, return menu item\r\n * --> else return null\r\n *\r\n * @param {Object} options - options for parametr\r\n * @param {String} options.text - the whole contents of the Ads text field\r\n * @param {Number} options.cursorIndex - the cursor position within the options.text\r\n * @param {Object} options.target - the input HTML element\r\n * @param {func} options.updateAndCloseCallback - update call back\r\n * @param {bool} options.isSelectedByUser - whether this is selected option\r\n * @returns {Object} promise which will resolve the result\r\n */\r\n analyzeInput({\r\n text, cursorIndex, isSelectedByUser, target, updateAndCloseCallback,\r\n }) {\r\n const processedText = text || '';\r\n const startIndex = this.getStartIndex(processedText, cursorIndex);\r\n\r\n // If cursor is right infornt of {= we don't exit here\r\n // when not contains {, see whether ends with {, if so, then show the menu item\r\n if (startIndex === -1 || startIndex === cursorIndex) {\r\n return Promise.resolve(null);\r\n }\r\n\r\n const rule = parseRule({\r\n needFullRule: false,\r\n isSelectedByUser,\r\n processedText,\r\n selectionEnd: cursorIndex,\r\n startIndex,\r\n });\r\n\r\n // The parser should have found an exression on the left from\r\n // the cursor AND cursor should be within the matched part of the string\r\n if (rule && cursorIndex <= startIndex + rule.source.length &&\r\n // AND cursor shouldn't be at the expression's closing \"}\"\r\n !(\r\n rule.isComplete &&\r\n cursorIndex === startIndex + rule.source.length\r\n )\r\n ) {\r\n const {\r\n feed, attribute,\r\n } = rule;\r\n\r\n extendOwn(rule, {\r\n type: this.name,\r\n defaultHandlerForInput: true,\r\n itemsToDisplay: [], // items have empty son so that be picked\r\n });\r\n\r\n if (attribute && isSelectedByUser) {\r\n rule.specificAttributeName = true;\r\n } else if (feed && isSelectedByUser) {\r\n rule.specificFeedName = true;\r\n }\r\n\r\n if (\r\n !rule.specificAttributeName &&\r\n cursorIndex > startIndex + 1 &&\r\n (!isEmpty(feed) || cursorIndex === startIndex + 2)\r\n ) {\r\n return queryFeedsByName({\r\n namePrefix: feed,\r\n useExactMatch: rule.specificFeedName,\r\n jsDataCampaign: this.jsDataCampaign,\r\n }).then((results) => {\r\n // feed did not exist, directly return, it will be backup solution\r\n if (!isEmpty(results)) {\r\n // when user already selected feed name\r\n if (rule.specificFeedName) {\r\n const attributeLowerCased = attribute.toLowerCase();\r\n const attributesToDisplay = isEmpty(attribute) ?\r\n results[0].AttributeNames :\r\n filter(\r\n results[0].AttributeNames,\r\n name => name.toLowerCase().indexOf(attributeLowerCased) === 0\r\n );\r\n\r\n // show picker when there are attributes and user input attribute has not ended\r\n if (!isEmpty(attributesToDisplay) &&\r\n ((attributesToDisplay.length > 1) ||\r\n (attributesToDisplay[0].length > attribute.length))) {\r\n rule.itemsToDisplay = map(attributesToDisplay, name => ({\r\n name,\r\n description: '',\r\n onClick: event => this.updateTargetOnUserSelectionUpdate({\r\n feedName: feed,\r\n attributeName: name,\r\n defaultText: '',\r\n updateAndCloseCallback,\r\n target,\r\n startIndex,\r\n event,\r\n source: rule.source,\r\n }),\r\n }));\r\n } else if (!isEmpty(attributesToDisplay) && (attributesToDisplay.length === 1)) {\r\n // when only one attribute and it is same length as input, show default text\r\n // and also provide the top-level menu item in case there is ambiguity in which\r\n // analyzer to use\r\n rule.match = true;\r\n rule.specificAttributeName = true;\r\n rule.itemsToDisplay = [this.getMenuItem({\r\n startIndex,\r\n rule,\r\n target,\r\n updateAndCloseCallback,\r\n })];\r\n return Promise.resolve(rule);\r\n }\r\n } else {\r\n // when no feed name specified\r\n rule.itemsToDisplay = map(results, ({ Name, AttributeNames }) => {\r\n const processAttributeNames = first(AttributeNames, 3);\r\n\r\n if (AttributeNames.length > 3) {\r\n processAttributeNames.push('...');\r\n }\r\n const attributeDescriptionPre = this.i18n.getString('Feeds_FeedItemsPage_Attributes_Description');\r\n return {\r\n name: Name,\r\n description: `${attributeDescriptionPre}${processAttributeNames.join(', ')}`,\r\n onClick: event => this.updateTargetOnUserSelectionUpdate({\r\n feedName: Name,\r\n attributeName: '',\r\n defaultText: '',\r\n updateAndCloseCallback,\r\n event,\r\n target,\r\n startIndex,\r\n source: rule.source,\r\n }),\r\n };\r\n });\r\n }\r\n }\r\n\r\n rule.match = !isEmpty(rule.itemsToDisplay);\r\n return Promise.resolve(rule);\r\n });\r\n }\r\n\r\n // We get here if feed name is empty and we are not at position two characters\r\n // past startIndex.\r\n // Show menu only if we are not past two characters after startIndex, exclusive\r\n if (rule.specificAttributeName || cursorIndex < startIndex + 2) {\r\n return Promise.resolve(defaults({\r\n itemsToDisplay: [this.getMenuItem({\r\n startIndex,\r\n rule,\r\n target,\r\n updateAndCloseCallback,\r\n })],\r\n type: this.name,\r\n match: rule.specificAttributeName,\r\n }, rule));\r\n }\r\n }\r\n\r\n return Promise.resolve(null);\r\n }\r\n\r\n /* return a reactjs object here */\r\n getSyntax(analyzeResult) {\r\n const { specificAttributeName, specificFeedName } = analyzeResult || {};\r\n\r\n return ();\r\n }\r\n\r\n needEditor(analyzeResult) {\r\n const { specificAttributeName } = analyzeResult || {};\r\n return specificAttributeName;\r\n }\r\n\r\n getEditor({\r\n target, analyzeResult, updateAndCloseCallback, remainingCountCallBack,\r\n }) {\r\n const {\r\n defaultText, feed, attribute, startIndex, source,\r\n } = analyzeResult;\r\n let maxLength;\r\n if (remainingCountCallBack) {\r\n maxLength = remainingCountCallBack() + (defaultText ? defaultText.length : 1);\r\n }\r\n return ( {\r\n const { newValue, cursorPosition } = this.formatAdCustomizerFeed({\r\n feedName: feed,\r\n attributeName: attribute,\r\n defaultText: newDefaultText,\r\n value: target.value,\r\n startIndex,\r\n buildCompleteExpression: true,\r\n source,\r\n });\r\n updateAndCloseCallback({\r\n newValue,\r\n cursorPosition,\r\n event,\r\n isSelectedByUser: true,\r\n });\r\n }}\r\n />);\r\n }\r\n\r\n getCharCountExcludingAdCustomizers(text, isComplete) {\r\n let processedText = text;\r\n let charCount = 0;\r\n const rule = parseAdCustomizerFeedsRuleForSpecialChracter(processedText, 0);\r\n if (rule && rule.source && (!isComplete || rule.isComplete)) {\r\n if (rule.isComplete) {\r\n charCount += rule.defaultText ? rule.defaultText.length : 1;\r\n } else {\r\n charCount += rule.source.length;\r\n }\r\n processedText = processedText.replace(rule.source, '');\r\n }\r\n\r\n return {\r\n processedText,\r\n charCount,\r\n };\r\n }\r\n}\r\n","import { find } from 'underscore';\r\nimport { queryFeedsByName } from './query-feeds-by-name';\r\n\r\nconst defaultValue = '';\r\n\r\nexport function queryFeedAttributeSampleValue({\r\n feedName,\r\n attributeName,\r\n edmCampaign,\r\n jsDataCampaign,\r\n}) {\r\n return queryFeedsByName({ namePrefix: feedName, useExactMatch: true, jsDataCampaign })\r\n .then((feeds) => {\r\n if (feeds.length > 1 || feeds.length === 0) {\r\n return null;\r\n }\r\n\r\n const { Id, AttributeNames } = feeds[0];\r\n\r\n const attributeNameToUse = find(\r\n AttributeNames,\r\n name => name.toUpperCase() === attributeName.toUpperCase()\r\n );\r\n\r\n if (!attributeNameToUse) {\r\n return null;\r\n }\r\n\r\n const entitySet = edmCampaign.currentAccount.Feeds.$withKey(Id).FeedItems.toJSON({});\r\n\r\n return jsDataCampaign.FeedItem\r\n .findAll({ query: { entitySet }, limit: 100, select: ['Id', 'AttributeValues'] })\r\n .then((feedItems) => {\r\n const firstItemHasAttributeValue = find(feedItems, (feedItem) => {\r\n const { AttributeValues } = feedItem || {};\r\n\r\n return AttributeValues[attributeNameToUse];\r\n });\r\n\r\n if (firstItemHasAttributeValue) {\r\n return firstItemHasAttributeValue.AttributeValues[attributeNameToUse];\r\n }\r\n\r\n return defaultValue;\r\n }).catch(() => null);\r\n });\r\n}\r\n","import { keys } from 'underscore';\r\nimport Backbone from 'backbone';\r\n\r\nimport { SimpleForm } from '@bingads-webui/simple-form';\r\n\r\nimport template from './keyword-editor-template.pug';\r\n\r\n/**\r\n * Keyword editor view\r\n * @private\r\n */\r\nexport class KeywordEditor extends Backbone.View {\r\n /**\r\n * init Keyword Editor, it will generate a view based on\r\n * options, and show the view based on the target location\r\n * @private\r\n * @param {Object} target - the input element that keyword editor should attach to\r\n * @param {Object} options - editor model and cursor position info\r\n * @param {I18n} i18n - i18n object that provides getString\r\n * @returns {undefined} - initialize view\r\n */\r\n initialize({\r\n target,\r\n options: {\r\n defaultText = '',\r\n keywordCase,\r\n prefix = '',\r\n suffix = '',\r\n },\r\n updateAndCloseCallback,\r\n i18n,\r\n }) {\r\n this.target = target;\r\n this.updateAndCloseCallback = updateAndCloseCallback;\r\n\r\n const keywords = {\r\n TitleCase: 'KeyWord',\r\n SentenceCase: 'Keyword',\r\n LowerCase: 'keyword',\r\n };\r\n\r\n const schema = {\r\n name: 'Keyword',\r\n type: 'object',\r\n properties: {\r\n defaultText: {\r\n type: 'string',\r\n },\r\n keywordCase: {\r\n type: 'string',\r\n enum: [...keys(keywords)],\r\n },\r\n syntax: {\r\n type: 'string',\r\n },\r\n },\r\n required: ['defaultText'],\r\n };\r\n\r\n const fields = [\r\n {\r\n property: 'defaultText',\r\n label: i18n.getString('KeywordEditor_DefaultText_Label'),\r\n validators: {\r\n required: {\r\n message: i18n.getString('KeywordEditor_DefaultText_RequiredValidationMessage'),\r\n },\r\n },\r\n },\r\n {\r\n property: 'keywordCase',\r\n label: i18n.getString('KeywordEditor_Case_Label'),\r\n control: 'radios',\r\n valueMessages: {\r\n TitleCase: i18n.getString('KeywordEditor_Case_TitleCase'),\r\n SentenceCase: i18n.getString('KeywordEditor_Case_SentenceCase'),\r\n LowerCase: i18n.getString('KeywordEditor_Case_LowerCase'),\r\n },\r\n },\r\n ];\r\n\r\n const model = {\r\n defaultText,\r\n keywordCase,\r\n };\r\n\r\n this.form = new SimpleForm({\r\n schema,\r\n fields,\r\n model,\r\n template,\r\n i18n,\r\n });\r\n\r\n this.form.on('save', (newModel) => {\r\n const keywordText = keywords[newModel.keywordCase];\r\n const newValue = `${prefix}{${keywordText}:${newModel.defaultText}}${suffix}`;\r\n const cursorPosition = newValue.length - suffix.length;\r\n this.updateAndCloseCallback({\r\n newValue,\r\n cursorPosition,\r\n isSelectedByUser: true,\r\n });\r\n });\r\n\r\n this.form.on('cancel', () => {\r\n this.updateAndCloseCallback({ isCancel: true });\r\n });\r\n\r\n return this;\r\n }\r\n\r\n render() {\r\n this.$el.append(this.form.render().el);\r\n return this;\r\n }\r\n}\r\n","import { some, pick } from 'underscore';\r\nimport Promise from 'bluebird';\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: keyword text\r\n * [2]: default value\r\n */\r\nconst keywordRuleSyntax = /\\{(keyword)\\s*:([^{}]*)}/i;\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: keyword text (could be incomplete)\r\n * [2]: default value (could be empty)\r\n */\r\nconst keywordRuleInProgressSyntax = /{(k(?:e|$)(?:y|$)(?:w|$)(?:o|$)(?:r|$)(?:d|$))(?::|$)([^}]*)/i;\r\n\r\n/*\r\n * Matches Title Case keyword text (could be incomplete)\r\n */\r\nconst keywordRuleTitleCaseSyntax = /KeyW(?:o|$)(?:r|$)(?:d|$)/;\r\n\r\n/**\r\n * Looks for keyword rules in given text and substitutes them with their values.\r\n * @param {string} text - input text\r\n * @returns {string} text after substitutions\r\n */\r\nexport function evaluateKeywordRules(text) {\r\n if (text && text.length > 0) {\r\n const keywordReplaceSyntax = new RegExp(keywordRuleSyntax.source, 'gi');\r\n\r\n return Promise.resolve(text.replace(keywordReplaceSyntax, (match, p1, p2) => {\r\n if (p2 !== '') return p2;\r\n return match;\r\n }));\r\n }\r\n return Promise.resolve(text);\r\n}\r\n\r\n/**\r\n * Supported keyword case types\r\n */\r\nconst caseTypes = {\r\n titleCase: 'TitleCase',\r\n sentenceCase: 'SentenceCase',\r\n lowerCase: 'LowerCase',\r\n};\r\n\r\n/**\r\n * Check an incomplete string of \"keyword\" and determine the case\r\n * @param {string} text - text input\r\n * @returns {string} Case type: TitleCase, SentenceCase, LowerCase\r\n */\r\nfunction getKeywordCase(text) {\r\n if (keywordRuleTitleCaseSyntax.test(text)) {\r\n return caseTypes.titleCase;\r\n } else if (text[0] === 'K') {\r\n return caseTypes.sentenceCase;\r\n }\r\n\r\n return caseTypes.lowerCase;\r\n}\r\n\r\n/**\r\n * Looks for a keyword rule definition in given text starting from passed index.\r\n * If found, it parses the definition.\r\n * @param {string} text - text to search in\r\n * @param {string} syntax - regex syntax use for matching\r\n * @param {int} startIndex - starts searching at this index\r\n * @param {int} cursorIndex - current cursor position\r\n * @returns {Object} parses rule definition properties or undefined if a definiton is not found.\r\n */\r\nexport function parseKeywordRule(text, syntax, startIndex, cursorIndex) {\r\n const tokens = syntax.exec(text);\r\n\r\n if ((tokens === null) ||\r\n (tokens.length !== 3) ||\r\n (cursorIndex && cursorIndex <= (startIndex + tokens.index))) {\r\n return null;\r\n }\r\n\r\n return {\r\n source: tokens[0],\r\n defaultText: tokens[2],\r\n keywordCase: getKeywordCase(tokens[1]),\r\n };\r\n}\r\n\r\n\r\n/**\r\n * Parses out properties to initialize a keyword helper using current cursor position\r\n * @param {string} text - input text\r\n * @param {int} cursorIndex - current cursor position\r\n * @returns {Object} properties to initialize a keyword helper\r\n * if cursor is placed within a valid definition or at the end of a partial definition.\r\n * Returns undefined; otherwise.\r\n */\r\nexport function parseRule(text, cursorIndex) {\r\n const processedText = text || '';\r\n const startIndex = processedText.lastIndexOf('{', cursorIndex);\r\n\r\n if (startIndex === -1 || cursorIndex === startIndex) {\r\n return null;\r\n }\r\n\r\n const parsers = [\r\n {\r\n input: processedText.substring(startIndex),\r\n syntax: keywordRuleSyntax,\r\n inclusive: false,\r\n },\r\n {\r\n input: processedText.slice(startIndex, cursorIndex),\r\n syntax: keywordRuleInProgressSyntax,\r\n inclusive: true,\r\n },\r\n ];\r\n\r\n let properties = null;\r\n\r\n some(parsers, (parser) => {\r\n const rule = parseKeywordRule(parser.input, parser.syntax, startIndex, cursorIndex);\r\n\r\n if ((rule !== null) &&\r\n (cursorIndex < startIndex + rule.source.length + (parser.inclusive ? 1 : 0))) {\r\n const options = pick(rule, 'defaultText', 'keywordCase');\r\n\r\n options.prefix = processedText.substring(0, startIndex);\r\n options.suffix = processedText.substring(startIndex + rule.source.length);\r\n options.startIndex = startIndex;\r\n options.endIndex = startIndex + rule.source.length;\r\n\r\n properties = {\r\n type: 'keyword',\r\n options,\r\n };\r\n\r\n return true;\r\n }\r\n return false;\r\n });\r\n\r\n return properties;\r\n}\r\n","export const keywords = {\r\n TitleCase: 'KeyWord',\r\n SentenceCase: 'Keyword',\r\n LowerCase: 'keyword',\r\n};\r\n","/* eslint-disable react/react-in-jsx-scope */\r\nimport { isEmpty, extend } from 'underscore';\r\nimport { endsWith } from 'underscore.string';\r\nimport Promise from 'bluebird';\r\nimport React from 'react';\r\nimport { HelpIcon } from '@bingads-webui-campaign-react/help';\r\nimport { BackboneInstanceWrapper } from '@bingads-webui-react/backbone-instance-wrapper';\r\nimport { AdCustomizerBaseAnalyzer } from '../base-analyzer';\r\n\r\nimport { KeywordEditor } from './editor/keyword-editor-view';\r\nimport { parseRule, evaluateKeywordRules } from './parser';\r\nimport { keywords } from './constants';\r\n\r\n// Replacement text (insert) for when countdown is selected in ad customizer picker\r\nconst pickerKeywordInsert = '{KeyWord:}';\r\nconst pickerKeywordInsertCursorPosition = pickerKeywordInsert.length - 1;\r\n\r\nexport class AdCustomizerKeywordAnalyzer extends AdCustomizerBaseAnalyzer {\r\n constructor({ deps: { i18n, instrumentation }, controller }) {\r\n super({\r\n name: 'keyword',\r\n priority: 1000,\r\n i18n,\r\n activityName: 'keyword',\r\n instrumentation,\r\n controller,\r\n });\r\n }\r\n\r\n /* return a reactjs object here */\r\n getSyntax(analyzeResult) {\r\n if (!analyzeResult.options) return null;\r\n\r\n const { options: { keywordCase } } = analyzeResult;\r\n const keywordText = keywords[keywordCase];\r\n const syntax = `${this.i18n.getString('AdCustomizers_Editor_Syntax_Prefix_Label')} {${keywordText}:${this.i18n.getString('KeywordEditor_DefaultText')}}`;\r\n return (\r\n
    \r\n {syntax}\r\n \r\n \r\n
    );\r\n }\r\n\r\n needEditor(analyzeResult) {\r\n const { options } = analyzeResult || {};\r\n return !isEmpty(options);\r\n }\r\n\r\n getEditor({\r\n target, analyzeResult, updateAndCloseCallback,\r\n }) {\r\n const { options } = analyzeResult || {};\r\n\r\n const editor = new KeywordEditor({\r\n target,\r\n options,\r\n i18n: this.i18n,\r\n updateAndCloseCallback,\r\n }).render();\r\n\r\n return ();\r\n }\r\n\r\n\r\n // get menu item\r\n getMenuItem({\r\n startIndex, endIndex, updateAndCloseCallback, target,\r\n }) {\r\n return {\r\n name: this.i18n.getString('Picker_Keyword_Label'),\r\n description: this.i18n.getString('Picker_Keyword_Description'),\r\n onClick: () => {\r\n const beginning = target.value.substring(0, startIndex);\r\n const end = target.value.substring(endIndex);\r\n updateAndCloseCallback({\r\n newValue: `${beginning}${pickerKeywordInsert}${end}`,\r\n cursorPosition: beginning.length + pickerKeywordInsertCursorPosition,\r\n isSelectedByUser: true,\r\n });\r\n },\r\n };\r\n }\r\n\r\n analyzeInput({\r\n text, cursorIndex, updateAndCloseCallback, target,\r\n }) {\r\n const rule = parseRule(text, cursorIndex);\r\n\r\n if (rule) {\r\n const { options: { startIndex } } = rule;\r\n return Promise.resolve(extend(\r\n {\r\n match: true,\r\n type: this.name,\r\n defaultHandlerForInput: false,\r\n itemsToDisplay: [this.getMenuItem({\r\n startIndex, endIndex: cursorIndex, updateAndCloseCallback, target,\r\n })],\r\n },\r\n rule\r\n ));\r\n }\r\n // when not match, see whether to show menu item\r\n if (text && endsWith(text, '{', cursorIndex)) {\r\n return Promise.resolve({\r\n type: this.name,\r\n defaultHandlerForInput: false,\r\n itemsToDisplay: [this.getMenuItem({\r\n startIndex: text.length - 1,\r\n endIndex: cursorIndex,\r\n updateAndCloseCallback,\r\n target,\r\n })],\r\n });\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n evaluateRule(text) {\r\n return evaluateKeywordRules(text);\r\n }\r\n\r\n getCharCountExcludingAdCustomizers(text) {\r\n let charCount = 0;\r\n let processedText = text || '';\r\n let toContinue = false;\r\n\r\n let tokens = /\\{(?:param[123]|keyword)}/i.exec(processedText);\r\n if (tokens) {\r\n processedText = processedText.replace(tokens[0], '');\r\n toContinue = true;\r\n } else {\r\n tokens = /\\{(?:param[123]|keyword):([^}]*)}/i.exec(processedText);\r\n if (tokens) {\r\n processedText = processedText.replace(tokens[0], '');\r\n charCount += tokens[1] ? tokens[1].length : 0;\r\n toContinue = true;\r\n }\r\n }\r\n\r\n return {\r\n processedText,\r\n charCount,\r\n toContinue,\r\n };\r\n }\r\n}\r\n","import { find, pick, contains, map } from 'underscore';\r\n\r\nconst defaultMaxLength = 8;\r\n\r\n/**\r\n * Default countdown language is English.\r\n */\r\n// const defaultLanguageIndex = 2;\r\nlet supportedLanguages = null;\r\n\r\n/**\r\n * Languages supported for countdown.\r\n * The ones that have \"locale\" property are also supported for on-the-fly translation.\r\n * @param {Object} i18n - i18n\r\n * @param {Object} config - UI config settings\r\n * @returns {Array} supported langauges with format of [{codes, displayName, maxLength}]\r\n */\r\nconst intializeAndGetSupportedLanguages = (i18n, config) => {\r\n if (!supportedLanguages) {\r\n const permissions = config.get('Permissions') || {};\r\n\r\n supportedLanguages = [\r\n {\r\n codes: ['da'],\r\n locale: 'da',\r\n displayName: i18n.getString('Language_Danish'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['nl'],\r\n locale: 'nl',\r\n displayName: i18n.getString('Language_Dutch'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['en-us', 'en-au', 'en-gb'],\r\n locale: 'en-us',\r\n displayName: i18n.getString('Language_English'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['fi'],\r\n locale: 'fi',\r\n displayName: i18n.getString('Language_Finnish'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['fr'],\r\n locale: 'fr',\r\n displayName: i18n.getString('Language_French'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['de'],\r\n locale: 'de',\r\n displayName: i18n.getString('Language_German'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['it'],\r\n locale: 'it',\r\n displayName: i18n.getString('Language_Italian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['no'],\r\n displayName: i18n.getString('Language_Norwegian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['pt-br', 'pt-pt'],\r\n locale: 'pt-br',\r\n displayName: i18n.getString('Language_Portuguese'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['es', 'es-419'],\r\n locale: 'es',\r\n displayName: i18n.getString('Language_Spanish'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['sv'],\r\n locale: 'sv',\r\n displayName: i18n.getString('Language_Swedish'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['zh-hk', 'zh-tw'],\r\n locale: 'zh-hant',\r\n displayName: i18n.getString('Language_TraditionalChinese'),\r\n maxLength: defaultMaxLength,\r\n },\r\n ];\r\n if (permissions.IsAdsGlobalizationPhase1Enabled) {\r\n supportedLanguages = supportedLanguages.concat([\r\n {\r\n codes: ['el'],\r\n displayName: i18n.getString('Language_Greek'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['pl'],\r\n locale: 'pl',\r\n displayName: i18n.getString('Language_Polish'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['bg'],\r\n displayName: i18n.getString('Language_Bulgarian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['cs'],\r\n displayName: i18n.getString('Language_Czech'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['et'],\r\n displayName: i18n.getString('Language_Estonian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['hr'],\r\n displayName: i18n.getString('Language_Croatian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['hu'],\r\n displayName: i18n.getString('Language_Hungarian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['lt'],\r\n displayName: i18n.getString('Language_Lithuanian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['lv'],\r\n displayName: i18n.getString('Language_Latvian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['mt'],\r\n displayName: i18n.getString('Language_Maltese'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['ro'],\r\n displayName: i18n.getString('Language_Romanian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['sk'],\r\n displayName: i18n.getString('Language_Slovak'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['sl'],\r\n displayName: i18n.getString('Language_Slovenian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n ]);\r\n }\r\n if (permissions.IsAdsGlobalizationPhase2Enabled) {\r\n supportedLanguages = supportedLanguages.concat([\r\n {\r\n codes: ['tr'],\r\n displayName: i18n.getString('Language_Turkish'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['sr'],\r\n displayName: i18n.getString('Language_Serbian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['bs'],\r\n displayName: i18n.getString('Language_Bosnian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['sq'],\r\n displayName: i18n.getString('Language_Albanian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['mk'],\r\n displayName: i18n.getString('Language_Macedonian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['is'],\r\n displayName: i18n.getString('Language_Icelandic'),\r\n maxLength: defaultMaxLength,\r\n },\r\n ]);\r\n }\r\n if (permissions.IsAdsGlobalizationPhase6Enabled) {\r\n supportedLanguages = supportedLanguages.concat([\r\n {\r\n codes: ['ar'],\r\n locale: 'ar',\r\n displayName: i18n.getString('Language_Arabic'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['iw'],\r\n displayName: i18n.getString('Language_Hebrew'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['ru'],\r\n displayName: i18n.getString('Language_Russian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n ]);\r\n }\r\n if (permissions.IsAdsGlobalizationPhase2JapanEnabled) {\r\n supportedLanguages = supportedLanguages.concat([\r\n {\r\n codes: ['ja'],\r\n locale: 'ja',\r\n displayName: i18n.getString('Language_Japanese'),\r\n maxLength: defaultMaxLength,\r\n },\r\n ]);\r\n }\r\n if (permissions.dynamic && permissions.dynamic.AdsGlobalizationPhase9DSA) {\r\n supportedLanguages = supportedLanguages.concat([\r\n {\r\n codes: ['hi'],\r\n locale: 'hi',\r\n displayName: i18n.getString('Language_Hindi'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['ms'],\r\n displayName: i18n.getString('Language_Malay'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['th'],\r\n locale: 'th',\r\n displayName: i18n.getString('Language_Thai'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['in'],\r\n locale: 'in',\r\n displayName: i18n.getString('Language_Indonesian'),\r\n maxLength: defaultMaxLength,\r\n },\r\n {\r\n codes: ['tl'],\r\n displayName: i18n.getString('Language_Tagalog'),\r\n maxLength: defaultMaxLength,\r\n },\r\n ]);\r\n }\r\n if (permissions.IsAdsGlobalizationPhase9VIEnabled) {\r\n supportedLanguages = supportedLanguages.concat([\r\n {\r\n codes: ['vi'],\r\n displayName: i18n.getString('Language_Vietnamese'),\r\n maxLength: defaultMaxLength,\r\n },\r\n ]);\r\n }\r\n if (permissions.IsDomesticSimplifiedChineseEnabled) {\r\n supportedLanguages = [\r\n {\r\n codes: ['zh-CN'],\r\n locale: 'zh-hans',\r\n displayName: i18n.getString('Language_SimplifiedChinese'),\r\n maxLength: defaultMaxLength,\r\n },\r\n ];\r\n }\r\n }\r\n\r\n return supportedLanguages;\r\n};\r\n\r\nexport const languageParseMode = {\r\n ForPreview: 0,\r\n ForEditor: 1,\r\n ForCharacterCount: 2,\r\n};\r\n\r\n/**\r\n * Gets default language for count down\r\n * @param {Object} i18n - i18n\r\n * @param {Object} config - UI config settings\r\n * @returns {Object} a language construct that holds locale and display name\r\n */\r\nexport function getDefaultLanguage(i18n, config) {\r\n const permissions = config.get('Permissions') || {};\r\n const defaultLanguageIndex = permissions.IsDomesticSimplifiedChineseEnabled ? 0 : 2; // Simplified Chinese : English\r\n const language = intializeAndGetSupportedLanguages(i18n, config)[defaultLanguageIndex];\r\n\r\n return pick(language, 'locale', 'displayName', 'maxLength');\r\n}\r\n\r\n/**\r\n * Gets the appropriate language object for given language code\r\n * @param {string} code - language code\r\n * @param {int} parseMode - flag for whether we are parsing for preview, editor or char count\r\n * @param {Object} i18n - i18n\r\n * @param {Object} config - UI config settings\r\n * @returns {Object} a language construct that holds locale and display name\r\n * For preview:\r\n * - language is not supported => null\r\n * - language is supported but not for translation => default\r\n * For editor:\r\n * - language is not supported => default\r\n * - language is supported but not for translation => language\r\n * For character count:\r\n * - language is not supported => null\r\n * - language is supported but not for translation => language\r\n * For all:\r\n * - language is undefined => default\r\n * - language is fully supported => language\r\n */\r\nexport function getLanguage(code, parseMode, i18n, config) {\r\n let language = getDefaultLanguage(i18n, config);\r\n\r\n if (code) {\r\n const match = find(\r\n intializeAndGetSupportedLanguages(i18n, config),\r\n lang => contains(lang.codes, code.toLowerCase())\r\n );\r\n\r\n if (match && match.locale) {\r\n language = match;\r\n } else if (match) {\r\n language = parseMode === languageParseMode.ForPreview ? language : match;\r\n } else {\r\n language = parseMode === languageParseMode.ForEditor ? language : null;\r\n }\r\n }\r\n\r\n return language ? pick(language, 'locale', 'displayName', 'maxLength') : null;\r\n}\r\n\r\n/**\r\n * Gets all supported language display names\r\n * @param {Object} i18n - i18n\r\n * @param {Object} config - UI config settings\r\n * @returns {array} display names\r\n */\r\nexport function getSupportedLanguages(i18n, config) {\r\n return map(\r\n intializeAndGetSupportedLanguages(i18n, config),\r\n lang => lang.displayName\r\n );\r\n}\r\n\r\n/**\r\n * Gets the default language code for given display name\r\n * @param {string} displayName - display name\r\n * @param {Object} i18n - i18n\r\n * @param {Object} config - UI config settings\r\n * @returns {string} language code\r\n */\r\nexport function getLanguageCode(displayName, i18n, config) {\r\n const match = find(\r\n intializeAndGetSupportedLanguages(i18n, config),\r\n lang => lang.displayName === displayName\r\n );\r\n\r\n return match ? match.codes[0] : null;\r\n}\r\n","import Backbone from 'backbone';\r\nimport kendo from '@bingads-webui/kendo/kendo.core';\r\nimport '@bingads-webui/kendo/kendo.datepicker';\r\n\r\nimport template from './date-picker-template.pug';\r\n\r\n\r\n/**\r\n * Date picker view that is specialized for countdown editor\r\n * can not use the shared-component date-picker as date format is fixed, not cultrue-specific\r\n */\r\nexport class DatePickerView extends Backbone.View {\r\n initialize({ observable, field }) {\r\n this.observable = observable;\r\n this.config = field.config;\r\n this.i18n = field.i18n;\r\n }\r\n\r\n render() {\r\n this.$el.html(template());\r\n const parameters = {\r\n culture: this.config.get('culture') || 'en-US',\r\n format: this.config.isResponsiveSearchAd ? 'yyyy-MM-dd' : 'yyyy/MM/dd',\r\n min: new Date(),\r\n animation: false,\r\n footer: false,\r\n value: this.observable(),\r\n };\r\n\r\n const elementDatePickerElement = this.$('#countdowndatepicker');\r\n\r\n elementDatePickerElement.kendoDatePicker(parameters);\r\n const datePickerWidget = elementDatePickerElement.data('kendoDatePicker');\r\n\r\n elementDatePickerElement.on('click', () => {\r\n datePickerWidget.open();\r\n });\r\n\r\n datePickerWidget.bind('change', () => {\r\n const value = kendo.toString(datePickerWidget.value(), parameters.format);\r\n\r\n this.observable(value);\r\n });\r\n\r\n datePickerWidget.one('open', () => {\r\n datePickerWidget.dateView.div.click((event) => {\r\n event.stopPropagation();\r\n });\r\n // Fix Bug 3133928: Bad gradient effect of the date picker\r\n // https://www.telerik.com/forums/how-do-i-change-or-disable-datepicker-animations-for-selecting-months-and-years\r\n // http://dojo.telerik.com/@ggkrustev/AdexI\r\n datePickerWidget.dateView.calendar.setOptions({ animation: false });\r\n });\r\n\r\n elementDatePickerElement.addClass('form-control');\r\n\r\n return this;\r\n }\r\n}\r\n","/**\r\n * Creates a string that contains a countdown definition\r\n * @param {string} prefix - text to be concatenated in front of countdown definition (optional)\r\n * @param {string} type - countdown type\r\n * @param {string} date - countdown end date (optional, defaults to 'yyyy/MM/dd')\r\n * @param {string} time - countdown end time (optional, defaults to 'HH:mm:ss')\r\n * @param {string} language - countdown language\r\n * @param {string} days - duration of countdown in days\r\n * @param {string} suffix - text to be concatenated at the end of countdown definition (optional)\r\n * @param {string} isResponsiveSearchAd - boolean\r\n * @returns {string} formatted string\r\n */\r\nexport function formatCountdown(\r\n prefix, type, date, time, language,\r\n days, suffix, isResponsiveSearchAd\r\n) {\r\n let ret;\r\n if (isResponsiveSearchAd) {\r\n ret = '{prefix}{{type}({date} {time},{days})}{suffix}';\r\n } else {\r\n ret = '{prefix}{={type}(\"{date} {time}\", \"{language}\", {days})}{suffix}';\r\n }\r\n\r\n ret = ret.replace('{prefix}', prefix || '');\r\n ret = ret.replace('{type}', type);\r\n ret = isResponsiveSearchAd ? ret.replace('{date}', date || 'yyyy-MM-dd') : ret.replace('{date}', date || 'yyyy/MM/dd');\r\n ret = ret.replace('{time}', time || 'HH:mm:ss');\r\n ret = ret.replace('{language}', language);\r\n ret = ret.replace('{days}', days);\r\n ret = ret.replace('{suffix}', suffix || '');\r\n\r\n return ret;\r\n}\r\nexport const defaultCountdownDays = 5;\r\n","import $ from 'jquery';\r\nimport { isString, wrap, defaults } from 'underscore';\r\nimport Backbone from 'backbone';\r\nimport { SimpleForm } from '@bingads-webui/simple-form';\r\nimport { fromLegacyTimeZone } from '@bingads-webui-universal/time-zone-converter';\r\nimport template from './template.pug';\r\nimport { getSupportedLanguages, getLanguageCode } from '../countdown-language';\r\nimport { DatePickerView } from './date-picker-view';\r\nimport { formatCountdown } from '../utils';\r\n\r\nconst getTimeZoneText = (timeZoneId, i18n) => {\r\n const text = i18n.getString(`TimeZone_${fromLegacyTimeZone(Number(timeZoneId))}`);\r\n return isString(text) ? text.replace(/\\{0\\}\\s*\\{1\\}\\s*/, '') : null;\r\n};\r\n\r\n/**\r\n * Get Countdown editor form schema\r\n * @param {Object} i18n - i18n\r\n * @param {Object} config - UI config settings\r\n * @returns {Array} supported langauges with format of [{codes, displayName, maxLength}]\r\n */\r\nconst getSchema = (i18n, config) => ({\r\n name: 'Countdown',\r\n type: 'object',\r\n properties: {\r\n date: {\r\n type: 'string',\r\n pattern: config.isResponsiveSearchAd ?\r\n '^[0-9]{4}-([1-9]|0[1-9]|1[0-2])-([1-9]|0[1-9]|[1-2][0-9]|3[0-1])$' :\r\n '^[0-9]{4}/([1-9]|0[1-9]|1[0-2])/([1-9]|0[1-9]|[1-2][0-9]|3[0-1])$',\r\n },\r\n time: {\r\n type: 'string',\r\n pattern: '^(?:((?:[0-1][0-9]|2[0-3]):(?:[0-5][0-9]):(?:[0-5][0-9]))|)$',\r\n },\r\n days: {\r\n type: 'integer',\r\n minimum: 1,\r\n maximum: 999,\r\n },\r\n isGlobal: {\r\n type: 'boolean',\r\n },\r\n language: {\r\n type: 'string',\r\n enum: getSupportedLanguages(i18n, config),\r\n },\r\n },\r\n required: ['date', 'days', 'language'],\r\n});\r\n\r\n/**\r\n * Countdown editor form fields\r\n */\r\n\r\nconst getFields = (i18n, config) => [\r\n {\r\n property: 'date',\r\n placeholder: 'yyyy/MM/dd',\r\n label: i18n.getString('CountdownEditor_CountdownEnds_Label'),\r\n control: DatePickerView,\r\n i18n,\r\n config,\r\n culture: config.get('culture') || 'en-US',\r\n validators: {\r\n pattern: {\r\n message: i18n.getString('CountdownEditor_CountdownEnds_PatternValidationMessage'),\r\n },\r\n required: {\r\n message: i18n.getString('CountdownEditor_CountdownEnds_RequiredValidationMessage'),\r\n },\r\n },\r\n },\r\n {\r\n property: 'time',\r\n placeholder: 'HH:mm:ss',\r\n id: 'CountdownEditor-CountdownEnds',\r\n label: i18n.getString('CountdownEditor_CountdownEndsTime_Label'),\r\n showLabel: false,\r\n validators: {\r\n pattern: {\r\n message: i18n.getString('CountdownEditor_CountdownEndsTime_PatternValidationMessage'),\r\n },\r\n },\r\n },\r\n {\r\n property: 'days',\r\n label: i18n.getString('CountdownEditor_CountdownStarts_Label'),\r\n id: 'CountdownEditor-CountdownStarts',\r\n validators: {\r\n type: {\r\n message: i18n.getString('CountdownEditor_CountdownStarts_TypeValidationMessage'),\r\n },\r\n range: {\r\n message: i18n.getString('CountdownEditor_CountdownStarts_RangeValidationMessage'),\r\n },\r\n required: {\r\n message: i18n.getString('CountdownEditor_CountdownStarts_RequiredValidationMessage'),\r\n },\r\n decimalLength: {\r\n message: i18n.getString('CountdownEditor_CountdownStarts_TypeValidationMessage'),\r\n },\r\n },\r\n },\r\n {\r\n property: 'isGlobal',\r\n control: 'radios',\r\n valueMessages: {\r\n true: `${i18n.getString('CountdownEditor_AccountTimeZone_Label')} ${getTimeZoneText(config.get('AccountTimeZone'), i18n)}`,\r\n false: i18n.getString('CountdownEditor_AdViewersTimeZone_Label'),\r\n },\r\n label: i18n.getString('CountdownEditor_TimeZone_Label'),\r\n id: 'CountdownEditor-TimeZone',\r\n },\r\n {\r\n property: 'language',\r\n label: i18n.getString('CountdownEditor_Language_Label'),\r\n id: 'CountdownEditor-Language',\r\n },\r\n];\r\n\r\n/**\r\n * Countdown editor view\r\n */\r\nexport class CountdownEditor extends Backbone.View {\r\n get className() {\r\n return 'countdownEditor';\r\n }\r\n\r\n initialize({\r\n updateAndCloseCallback,\r\n options,\r\n i18n,\r\n config,\r\n target,\r\n adType,\r\n }) {\r\n this.updateAndCloseCallback = updateAndCloseCallback;\r\n this.config = config;\r\n this.target = target;\r\n this.config.isResponsiveSearchAd = adType === 'ResponsiveSearchAd' || adType === 'ResponsiveAd';\r\n\r\n const model = {\r\n date: options.date,\r\n time: options.time,\r\n days: options.days,\r\n isGlobal: options.type === 'global_countdown',\r\n language: options.language ? options.language.displayName : '',\r\n };\r\n\r\n this.form = new SimpleForm({\r\n i18n,\r\n schema: getSchema(i18n, config),\r\n fields: getFields(i18n, config),\r\n model,\r\n template: wrap(\r\n template,\r\n (func, params) => func(defaults(\r\n params,\r\n { i18n, showLanguage: !config.isResponsiveSearchAd }\r\n ))\r\n ),\r\n });\r\n\r\n this.form.on('save', (newModel) => {\r\n const prefix = target.value.substring(0, options.startIndex);\r\n const suffix = target.value.substring(options.endIndex);\r\n\r\n const newValue = formatCountdown(\r\n prefix,\r\n newModel.isGlobal ? 'global_countdown' : 'countdown',\r\n newModel.date,\r\n newModel.time.length === 0 ? '00:00:00' : newModel.time,\r\n getLanguageCode(newModel.language, i18n, config),\r\n newModel.days,\r\n suffix,\r\n this.config.isResponsiveSearchAd\r\n );\r\n\r\n const cursorPosition = newValue.length - suffix.length;\r\n $('.k-calendar-container').remove();\r\n this.updateAndCloseCallback({ newValue, cursorPosition, isSelectedByUser: true });\r\n });\r\n\r\n this.form.on('cancel', () => {\r\n $('.k-calendar-container').remove();\r\n this.updateAndCloseCallback({ isCancel: true });\r\n });\r\n\r\n this.$el.attr('role', 'dialog');\r\n\r\n return this;\r\n }\r\n\r\n render() {\r\n this.$el.append(this.form.render().el);\r\n\r\n return this;\r\n }\r\n}\r\n","import Promise from 'bluebird';\r\nimport { some, pick } from 'underscore';\r\nimport { getLanguage, getDefaultLanguage, languageParseMode } from './countdown-language';\r\nimport { defaultCountdownDays } from './utils';\r\n\r\n/**\r\n * Task queue for getting/setting locales and substituting countdown rule\r\n * definitions with their evaluated values\r\n */\r\nlet countdownEvalTaskChain = Promise.resolve('');\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: function name\r\n * [2]: date\r\n * [3]: time (may be undefined)\r\n * [4]: locale (may be undefined)\r\n * [5]: number of days to countdown from (may be undefined)\r\n */\r\nconst countdownRuleSyntax = /\\{=\\s*(global_countdown|countdown)\\s*\\(\\s*\"(?:(\\d{4}\\/\\d{1,2}\\/\\d{1,2})(?:\\s((?:[0-1][0-9]|2[0-3]):(?:[0-5][0-9]):(?:[0-5][0-9]))|))\"\\s*(?:,\\s*\"([a-zA-Z]{2}(?:-[a-zA-Z\\d]{2,3}|))\"\\s*(?:,\\s*([1-9]\\d{0,2})|)|)\\s*\\)\\s*\\}/i;\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: function name\r\n * [2]: date\r\n * [3]: time (may be undefined)\r\n * [4]: number of days to countdown from (may be undefined)\r\n */\r\nconst RSACountdownRuleSyntax = /\\{\\s*(global_countdown|countdown)\\s*\\(\\s*(?:(\\d{4}-\\d{1,2}-\\d{1,2})(?:\\s((?:[0-1][0-9]|2[0-3]):(?:[0-5][0-9]):(?:[0-5][0-9]))|))\\s*(?:,\\s*([1-9]\\d{0,2})|)\\s*\\)\\s*\\}/i;\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: first letter of function name\r\n */\r\nconst countdownRuleInProgressSyntax = /\\{=\\s*(c|g)[a-z]*(?:\\s*\\([a-z0-9/\":\\s,-]*(?:\\)\\s*|)|)/i;\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: first letter of function name\r\n */\r\nconst RSACountdownRuleInProgressSyntax = /\\{\\s*(c(?:o|$)(?:u|$)|g(?:l|$)(?:o|$))[a-z_]*(?:\\s*\\([a-z0-9/\":\\s,-]*(?:\\)\\s*|)|)/i;\r\n\r\nconst coutndownRuleInProgressWithAdCustomizerSyntax = /\\{=\\s*(global_countdown|countdown)\\s*\\(((?:[^{}.\\\\]|(?:\\\\.)|\\\\[^.]?)*)\\.((?:[^{}:\\\\]|(?:\\\\:)|\\\\[^:]?)*)?/i;\r\n\r\n/*\r\n * Captures: Countdown feedname match\r\n * Note: as feedname is too flexble which basically support everything\r\n * we will just try to see whether it contains feedname.attributename format\r\n * and leave others validation for MT\r\n * [0]: whole match\r\n * [1]: function name\r\n * [2]: feedname\r\n * [3]: attribute & other part\r\n * [4]: the '}' character - mark of a complete expression\r\n */\r\nconst countdownRuleWithAdCustomizerSyntax = /\\{=\\s*(global_countdown|countdown)\\s*\\(((?:[^{}.\\\\]|(?:\\\\.)|\\\\[^.]?)*)\\.((?:[^{}:\\\\]|(?:\\\\:)|\\\\[^:]?)*)\\)(?:(}))?/i;\r\n\r\n/**\r\n * Looks for a countdown rule time definition part in given text starting from passed index.\r\n * If found, it parses the definition.\r\n * it will only capture the feedname as accurate\r\n * then leave attributeWithOther part as one match (as feed name is too flexible)\r\n * @param {Object} options - options for the parse\r\n * @param {string} options.text - text to search in\r\n * @param {int} options.startIndex - starts searching at this index\r\n * @param {int} parseMode - flag for whether we are parsing for preview, editor or character count\r\n * @param {int} options.cursorIndex - current cursor position\r\n * @returns {Object} parses rule definition properties or undefined if a definiton is not found.\r\n */\r\nfunction parseCountdownRuleUsingAdCustomizerFeedSyntax({\r\n text, startIndex, cursorIndex, i18n, config,\r\n}) {\r\n const input = text.substring(startIndex);\r\n const tokens = countdownRuleWithAdCustomizerSyntax.exec(input);\r\n\r\n // Not an acceptable rule if syntax is invalid, no attribute name\r\n if ((tokens === null) ||\r\n tokens.length < 4 ||\r\n !tokens[3] ||\r\n (cursorIndex && cursorIndex <= (startIndex + tokens.index))) {\r\n return null;\r\n }\r\n\r\n // if it ends with ., then it is not valid\r\n return {\r\n // includeAdCustomizerFeed will be used by analyzer as editor will not shown when it is true\r\n includeAdCustomizerFeed: true,\r\n source: tokens[0],\r\n isComplete: !!tokens[4],\r\n type: tokens[1].toLowerCase(),\r\n feed: tokens[2],\r\n index: tokens.index,\r\n // as feed name/attribute name is too flexible, we use default langauge & default days here\r\n // for char counting purpose\r\n language: getDefaultLanguage(i18n, config),\r\n days: defaultCountdownDays,\r\n };\r\n}\r\n\r\n/**\r\n * Looks for a countdown rule definition in given text\r\n * starting from passed index. If found, it parses the definition.\r\n * @param {string} text - text to search in\r\n * @param {int} startIndex - starts searching at this index\r\n * @param {int} parseMode - flag for whether we are parsing for preview, editor or character count\r\n * @param {int} cursorIndex - current cursor position\r\n * @returns {Object} parses rule definition properties or undefined if a definiton is not found.\r\n */\r\n\r\n\r\n/**\r\n * Produces \" days\" in current locale\r\n * @param {int} days - number of days\r\n * @param {Object} i18nDummy - i18n in a target countdown locale\r\n * @returns {string} \" days\" in current locale\r\n */\r\nfunction translateDays(days, i18nDummy) {\r\n const translation = i18nDummy.formatUnit(days, 'day');\r\n\r\n return translation;\r\n}\r\n\r\n/**\r\n * Looks for a countdown rule time definition part in given text starting from passed index.\r\n * If found, it parses the definition.\r\n * @param {string} text - text to search in\r\n * @param {int} startIndex - starts searching at this index\r\n * @param {int} parseMode - flag for whether we are parsing for preview, editor or character count\r\n * @param {int} cursorIndex - current cursor position\r\n * @param {Object} config - config\r\n * @returns {Object} parses rule definition properties or undefined if a definiton is not found.\r\n */\r\nexport function parseCountdownRule({\r\n text, startIndex, parseMode, cursorIndex, config, i18n, adType = 'ExpandedTextAd',\r\n}) {\r\n const { IsAdCustomizerEnabled } = config.get('Permissions');\r\n const input = text ? text.substring(startIndex) : '';\r\n\r\n if (adType === 'ResponsiveSearchAd' || adType === 'ResponsiveAd') {\r\n const tokens = RSACountdownRuleSyntax.exec(input);\r\n\r\n if ((tokens !== null) &&\r\n (tokens.length === 5) &&\r\n !Number.isNaN(Date.parse(tokens[2])) &&\r\n (!cursorIndex || (cursorIndex > (startIndex + tokens.index)))) {\r\n return {\r\n source: tokens[0],\r\n isComplete: true,\r\n type: tokens[1].toLowerCase(),\r\n date: tokens[2],\r\n time: tokens[3],\r\n days: tokens[4] ? parseInt(tokens[4], 10) : defaultCountdownDays,\r\n language: getDefaultLanguage(i18n, config),\r\n includeAdCustomizerFeed: false,\r\n };\r\n }\r\n } else {\r\n const tokens = countdownRuleSyntax.exec(input);\r\n\r\n // first try to parse countdown rule without adcustomizer\r\n // Not an acceptable rule if syntax is invalid, date is invalid, or has an unsupported language\r\n if ((tokens !== null) &&\r\n (tokens.length === 6) &&\r\n !Number.isNaN(Date.parse(tokens[2])) &&\r\n (!cursorIndex || (cursorIndex > (startIndex + tokens.index)))) {\r\n const language = getLanguage(tokens[4], parseMode, i18n, config);\r\n\r\n if (language) {\r\n return {\r\n source: tokens[0],\r\n isComplete: true,\r\n type: tokens[1].toLowerCase(),\r\n date: tokens[2],\r\n time: tokens[3],\r\n language,\r\n days: tokens[5] ? parseInt(tokens[5], 10) : defaultCountdownDays,\r\n includeAdCustomizerFeed: false,\r\n };\r\n }\r\n }\r\n\r\n // if countdown rule without ad customizer did not match\r\n // then try to parse it with adcustomizer feed\r\n if (IsAdCustomizerEnabled) {\r\n return parseCountdownRuleUsingAdCustomizerFeedSyntax({\r\n text: input, startIndex, cursorIndex, i18n, config,\r\n });\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\n\r\n/**\r\n * Looks for an incomplete countdown rule definition in given text\r\n * starting from passed index. If found, it returns countdown type.\r\n * @param {Object} options needed\r\n * @returns {Object} parses rule definition properties or undefined if a definiton is not found.\r\n */\r\nexport function parseCountdownRuleInProgress({\r\n text, startIndex, cursorIndex, i18n, config, adType,\r\n}) {\r\n const input = text.substring(startIndex);\r\n if (adType === 'ResponsiveSearchAd' || adType === 'ResponsiveAd') {\r\n const tokens = RSACountdownRuleInProgressSyntax.exec(input);\r\n\r\n if ((tokens === null) ||\r\n (cursorIndex && cursorIndex <= (startIndex + tokens.index))) {\r\n return null;\r\n }\r\n\r\n if (tokens.length !== 2 ||\r\n (!tokens[1].startsWith('c') && !tokens[1].startsWith('g'))) {\r\n return null;\r\n }\r\n\r\n return {\r\n source: tokens[0],\r\n type: tokens[1] === 'countdown(' || tokens[1].startsWith('c') ?\r\n 'countdown' :\r\n 'global_countdown',\r\n days: defaultCountdownDays,\r\n };\r\n }\r\n const tokens = countdownRuleInProgressSyntax.exec(input);\r\n\r\n if ((tokens === null) ||\r\n (cursorIndex && cursorIndex <= (startIndex + tokens.index))) {\r\n return null;\r\n }\r\n\r\n if ((tokens.length !== 2) ||\r\n ((tokens[1] !== 'c') && (tokens[1] !== 'g'))) {\r\n return null;\r\n }\r\n\r\n let includeAdCustomizerFeed = false;\r\n let source = tokens[0];\r\n\r\n // consider the countdown to contains feed after make sure it already contains the source\r\n const { IsAdCustomizerEnabled } = config.get('Permissions');\r\n if (source && IsAdCustomizerEnabled) {\r\n const matchedAdCustomizerTokens = coutndownRuleInProgressWithAdCustomizerSyntax.exec(input);\r\n\r\n if (matchedAdCustomizerTokens !== null) {\r\n includeAdCustomizerFeed = true;\r\n // eslint-disable-next-line prefer-destructuring\r\n source = matchedAdCustomizerTokens[0];\r\n }\r\n }\r\n\r\n return {\r\n source,\r\n type: tokens[1] === 'countdown(' || tokens[1] === 'c' ?\r\n 'countdown' :\r\n 'global_countdown',\r\n language: getDefaultLanguage(i18n, config),\r\n days: defaultCountdownDays,\r\n includeAdCustomizerFeed,\r\n };\r\n}\r\n\r\n/**\r\n * Looks for countdown rule definitions in given text\r\n * and substitutes them with their evaluated and translated values.\r\n * @param {string} text - input text\r\n * @param {Object} i18n - i18n which has formatUnit function\r\n * @returns {object} a promise that resolves to a modified version of input text\r\n * where all valid countdown rules\r\n * @param {Object} config - config\r\n * are substituted with their evaluated values\r\n */\r\nexport function evaluateCountdownRules({\r\n text, i18n, i18nDummy, config, adType = 'ExpandedTextAd',\r\n}) {\r\n let processedText = text;\r\n\r\n function queueSubstitution(rule) {\r\n countdownEvalTaskChain = countdownEvalTaskChain.then((lang) => {\r\n const currentLanguage = lang.toLowerCase();\r\n\r\n if (rule.language.locale === currentLanguage) {\r\n const translation = translateDays(rule.days, i18nDummy);\r\n\r\n processedText = processedText.replace(rule.source, translation);\r\n return Promise.resolve(rule.language.locale);\r\n }\r\n return i18nDummy.setLocale(rule.language.locale).then(() => {\r\n const translation = translateDays(rule.days, i18nDummy);\r\n\r\n processedText = processedText.replace(rule.source, translation);\r\n return rule.language.locale;\r\n });\r\n });\r\n }\r\n\r\n let searchStartIndex = 0;\r\n let rule = parseCountdownRule({\r\n text,\r\n startIndex: searchStartIndex,\r\n parseMode: languageParseMode.ForPreview,\r\n i18n,\r\n config,\r\n adType,\r\n });\r\n\r\n // We need to use this global task chain to avoid interrupting\r\n // ongoing get/set locale requests.\r\n // Each evaluation cycle begins with getting current locale and then\r\n // for each countdown rule found,\r\n // we queue a task to set locale (if needed) and do substitution.\r\n if (rule !== null) {\r\n countdownEvalTaskChain = countdownEvalTaskChain.then(() => i18nDummy.getLocale());\r\n\r\n while (rule !== null) {\r\n queueSubstitution(rule);\r\n searchStartIndex += rule.source.length;\r\n rule = parseCountdownRule({\r\n text,\r\n startIndex: searchStartIndex,\r\n parseMode: languageParseMode.ForPreview,\r\n i18n,\r\n config,\r\n adType,\r\n });\r\n }\r\n }\r\n\r\n return countdownEvalTaskChain.then(() => processedText);\r\n}\r\n\r\n/**\r\n * Parses out properties to initialize a countdown helper using current cursor position\r\n * @param {string} text - input text\r\n * @param {int} cursorIndex - current cursor position\r\n * @param {Object} i18n - i18n which has formatUnit function\r\n * @param {Object} config - config\r\n * @returns {Object} properties to initialize a countdown helper\r\n * if cursor is placed within a valid definition or at the end of a partial definition.\r\n * Returns undefined; otherwise.\r\n */\r\nexport function parseRule({\r\n text, cursorIndex, i18n, config, adType,\r\n}) {\r\n const startIndex = text.lastIndexOf('{', cursorIndex);\r\n\r\n if (startIndex === -1 || cursorIndex === startIndex) {\r\n return null;\r\n }\r\n\r\n const parsers = [\r\n {\r\n // Check if cursor is placed in the middle of a valid syntax\r\n parse() {\r\n return parseCountdownRule({\r\n text,\r\n startIndex,\r\n parseMode: languageParseMode.ForEditor,\r\n cursorIndex,\r\n i18n,\r\n config,\r\n adType,\r\n });\r\n },\r\n keys: ['type', 'date', 'time', 'language', 'days', 'includeAdCustomizerFeed', 'feed', 'attributeWithOthers', 'isComplete', 'source'],\r\n inclusive: false,\r\n },\r\n {\r\n // Check if we are, instead, just starting to type a countdown rule\r\n parse() {\r\n return parseCountdownRuleInProgress({\r\n text,\r\n startIndex,\r\n cursorIndex,\r\n i18n,\r\n config,\r\n adType,\r\n });\r\n },\r\n keys: ['type', 'language', 'days', 'includeAdCustomizerFeed', 'source'],\r\n inclusive: true,\r\n },\r\n ];\r\n\r\n let properties = null;\r\n\r\n some(parsers, (parser) => {\r\n const rule = parser.parse();\r\n\r\n if ((rule !== null) &&\r\n (cursorIndex < startIndex + rule.source.length + (parser.inclusive ? 1 : 0))) {\r\n const options = pick(rule, parser.keys);\r\n\r\n options.startIndex = startIndex;\r\n options.endIndex = startIndex + rule.source.length;\r\n\r\n properties = {\r\n type: 'countdown',\r\n options,\r\n };\r\n\r\n return true;\r\n }\r\n return false;\r\n });\r\n\r\n return properties;\r\n}\r\n","/* eslint-disable react/react-in-jsx-scope */\r\nimport $ from 'jquery';\r\nimport { isEmpty, extend } from 'underscore';\r\nimport { endsWith } from 'underscore.string';\r\nimport Promise from 'bluebird';\r\nimport React from 'react';\r\nimport kendo from '@bingads-webui/kendo/kendo.core';\r\nimport { HelpIcon } from '@bingads-webui-campaign-react/help';\r\nimport { BackboneInstanceWrapper } from '@bingads-webui-react/backbone-instance-wrapper';\r\nimport { languageParseMode } from './countdown-language';\r\n\r\nimport { CountdownEditor } from './editor/editor-view';\r\nimport { AdCustomizerBaseAnalyzer } from '../base-analyzer';\r\nimport { parseRule, evaluateCountdownRules, parseCountdownRule } from './parser';\r\nimport { formatCountdown, defaultCountdownDays } from './utils';\r\n\r\nconst countDownDefaultDaysString = kendo.toString(kendo.date.addDays(new Date(), defaultCountdownDays), 'yyyy/MM/dd', 'en-Us');\r\nconst RSACountDownDefaultDaysString = kendo.toString(kendo.date.addDays(new Date(), defaultCountdownDays), 'yyyy-MM-dd', 'en-Us');\r\n\r\nconst pickerCountdownInsert = `{=countdown(\"${countDownDefaultDaysString}\")}`;\r\nconst RSAPickerCountdownInsert = `{countdown(${RSACountDownDefaultDaysString})}`;\r\n\r\nconst isDatePicker = (element) => {\r\n const $target = $(element);\r\n return $target.closest('#countdowndatepicker_dateview').length > 0 ||\r\n $target.closest('.k-calendar-container').length > 0 ||\r\n $target.closest('.k-content').length > 0;\r\n};\r\n\r\nexport class AdCustomizerCountdownAnalyzer extends AdCustomizerBaseAnalyzer {\r\n constructor({\r\n deps: {\r\n config,\r\n instrumentation,\r\n i18n,\r\n countdownI18nDummy,\r\n },\r\n controller,\r\n excludedFields = [],\r\n }) {\r\n super({\r\n name: 'countdown',\r\n config,\r\n priority: 10,\r\n instrumentation,\r\n i18n,\r\n activityName: 'countdown',\r\n controller,\r\n excludedFields,\r\n });\r\n\r\n this.i18nDummy = countdownI18nDummy;\r\n }\r\n\r\n getMenuItem({\r\n startIndex, source, target: { value }, updateAndCloseCallback, adType,\r\n }) {\r\n return {\r\n name: this.i18n.getString('Picker_Countdown_Label'),\r\n description: this.i18n.getString('Picker_Countdown_Description'),\r\n onClick: (event) => {\r\n const endIndex = startIndex + source.length;\r\n\r\n const prefix = value.substring(0, startIndex);\r\n const suffix = value.substring(endIndex);\r\n let newValue;\r\n if (adType === 'ResponsiveSearchAd' || adType === 'ResponsiveAd') {\r\n newValue = `${prefix}${RSAPickerCountdownInsert}${suffix}`;\r\n } else {\r\n newValue = `${prefix}${pickerCountdownInsert}${suffix}`;\r\n }\r\n\r\n const cursorPosition = newValue.length - suffix.length - 1;\r\n\r\n updateAndCloseCallback({\r\n newValue,\r\n cursorPosition,\r\n event,\r\n isSelectedByUser: true,\r\n });\r\n },\r\n };\r\n }\r\n\r\n isClickedAway(event) {\r\n return !isDatePicker(event.target);\r\n }\r\n\r\n analyzeInput({\r\n text, cursorIndex, updateAndCloseCallback, target, adType, field,\r\n }) {\r\n const processedText = text ? text.toLowerCase() : '';\r\n const rule = parseRule({\r\n text: processedText,\r\n cursorIndex,\r\n i18n: this.i18n,\r\n config: this.config,\r\n adType,\r\n });\r\n\r\n if (rule) {\r\n const { options: { includeAdCustomizerFeed, startIndex, source } } = rule;\r\n return Promise.resolve(extend(\r\n {\r\n match: true,\r\n type: this.name,\r\n defaultHandlerForInput: false,\r\n itemsToDisplay: (includeAdCustomizerFeed || this.excludedFields.indexOf(field) !== -1) ?\r\n [] : [this.getMenuItem({\r\n startIndex,\r\n source,\r\n updateAndCloseCallback,\r\n target,\r\n adType,\r\n })],\r\n },\r\n rule\r\n ));\r\n }\r\n\r\n // not match whole rule, see whether to show menu item\r\n let startIndex1 = -1;\r\n let source;\r\n if (endsWith(processedText, '{=', cursorIndex) && adType !== 'ResponsiveSearchAd' && adType !== 'ResponsiveAd') {\r\n startIndex1 = cursorIndex - 2;\r\n source = '{=';\r\n } else if (endsWith(processedText, '{', cursorIndex)) {\r\n startIndex1 = cursorIndex - 1;\r\n source = '{';\r\n }\r\n\r\n if (startIndex1 >= 0 && startIndex1 !== cursorIndex) {\r\n return Promise.resolve(extend({\r\n type: this.name,\r\n defaultHandlerForInput: false,\r\n itemsToDisplay: this.excludedFields.indexOf(field) !== -1 ? [] : [this.getMenuItem({\r\n startIndex: startIndex1,\r\n source,\r\n updateAndCloseCallback,\r\n target,\r\n adType,\r\n })],\r\n }));\r\n }\r\n\r\n return Promise.resolve(null);\r\n }\r\n\r\n getSyntax(analyzeResult, adType) {\r\n const { options } = analyzeResult || {};\r\n const { type } = options || {};\r\n if (isEmpty(type)) {\r\n return null;\r\n }\r\n\r\n const syntax = formatCountdown(\r\n `${this.i18n.getString('AdCustomizers_Editor_Syntax_Prefix_Label')} `,\r\n type,\r\n null,\r\n null,\r\n this.i18n.getString('CountdownEditor_Syntax_Language_Label'),\r\n this.i18n.getString('CountdownEditor_Syntax_DaysBefore_Label'),\r\n null,\r\n adType === 'ResponsiveSearchAd' || adType === 'ResponsiveAd'\r\n );\r\n return (\r\n
    {syntax}\r\n \r\n
    \r\n );\r\n }\r\n\r\n // as long as the rule match (means has type), we can show the editor\r\n needEditor(analyzeResult) {\r\n const { options } = analyzeResult || {};\r\n const { type, includeAdCustomizerFeed } = options || {};\r\n return !includeAdCustomizerFeed && !isEmpty(type);\r\n }\r\n\r\n getEditor({\r\n target, analyzeResult, updateAndCloseCallback, adType,\r\n }) {\r\n const { options } = analyzeResult || {};\r\n const editor = new CountdownEditor({\r\n options,\r\n updateAndCloseCallback,\r\n i18n: this.i18n,\r\n target,\r\n config: this.config,\r\n adType,\r\n }).render();\r\n\r\n return ();\r\n }\r\n\r\n evaluateRule(text, adType = 'ExpandedTextAd') {\r\n return evaluateCountdownRules({\r\n text, i18n: this.i18n, i18nDummy: this.i18nDummy, config: this.config, adType,\r\n });\r\n }\r\n\r\n getCharCountExcludingAdCustomizers(text, isComplete, adType = 'ExpandedTextAd') {\r\n let processedText = text;\r\n let charCount = 0;\r\n const rule = parseCountdownRule({\r\n text: processedText,\r\n startIndex: 0,\r\n languageParseMode: languageParseMode.ForCharacterCount,\r\n config: this.config,\r\n i18n: this.i18n,\r\n adType,\r\n });\r\n\r\n if (rule && rule.source && (!isComplete || rule.isComplete)) {\r\n if (rule.isComplete) {\r\n charCount += rule.language.maxLength;\r\n } else {\r\n charCount += rule.source.length;\r\n }\r\n processedText = processedText.replace(rule.source, '');\r\n }\r\n\r\n return {\r\n processedText,\r\n charCount,\r\n };\r\n }\r\n}\r\n","import _ from 'underscore';\r\nimport Promise from 'bluebird';\r\nimport React from 'react';\r\nimport { HelpIcon } from '@bingads-webui-campaign-react/help';\r\n\r\nimport { AdCustomizerBaseAnalyzer } from '../base-analyzer';\r\nimport { parseRule } from './parser';\r\nimport { IffEditor } from './editor/iff-editor';\r\nimport { AudienceSelectorLegacyViewManager } from './editor/audience-selector';\r\nimport { IF_FUNCTION_TYPE } from './if-function-type';\r\nimport { escapeIffAudienceName, escapeIffInsertText, escapeIffDefaultText } from './escape';\r\n\r\nconst isSelectArrow = element =>\r\n _.isFunction(element.className.indexOf) && element.className.indexOf('arrow-button') !== -1 &&\r\n element.parentElement !== null &&\r\n _.isFunction(element.parentElement.className.indexOf) && element.parentElement.className.indexOf('dlbItem-actions') !== -1;\r\n\r\nconst isRemoveArrow = element =>\r\n _.isFunction(element.className.indexOf) && element.className.indexOf('arrow-button') !== -1 &&\r\n element.className.indexOf('remove') !== -1 &&\r\n element.parentElement !== null &&\r\n _.isFunction(element.parentElement.className.indexOf) && element.parentElement.className.indexOf('dlbItem') !== -1;\r\n\r\n/**\r\n * Feeds analyzer, the most complicated analyzer\r\n */\r\nexport class AdCustomizerIffAnalyzer extends AdCustomizerBaseAnalyzer {\r\n constructor({\r\n deps: {\r\n config,\r\n instrumentation,\r\n i18n,\r\n jsDataCampaign,\r\n edmCampaign,\r\n audienceSelectorLegacyViewManager,\r\n perfMarker,\r\n },\r\n controller,\r\n }) {\r\n super({\r\n name: 'iff',\r\n config,\r\n priority: 2000,\r\n instrumentation,\r\n i18n,\r\n activityName: 'iffEditor',\r\n controller,\r\n });\r\n\r\n this.jsDataCampaign = jsDataCampaign;\r\n this.edmCampaign = edmCampaign;\r\n\r\n this.audienceSelectorLegacyViewManager =\r\n audienceSelectorLegacyViewManager || new AudienceSelectorLegacyViewManager({ perfMarker });\r\n this.onEditorSave = this.onEditorSave.bind(this);\r\n this.onEditorCancel = this.onEditorCancel.bind(this);\r\n\r\n const { IsNewAudienceEnabled, IsIFFAudienceSyntaxUpdateEnabled } = config.get('Permissions') || {};\r\n this.IsNewAudienceEnabled = IsNewAudienceEnabled;\r\n this.IsIFFAudienceSyntaxUpdateEnabled = IsIFFAudienceSyntaxUpdateEnabled;\r\n }\r\n\r\n formatExpression({\r\n audienceList,\r\n buildCompleteExpression = false,\r\n defaultText,\r\n insertText,\r\n source,\r\n startIndex,\r\n type,\r\n value,\r\n }) {\r\n let actualType = '';\r\n let conditionText = '';\r\n if (type === IF_FUNCTION_TYPE.AUDIENCE_IN) {\r\n actualType = this.IsIFFAudienceSyntaxUpdateEnabled ? 'audience IN ' : 'audience in';\r\n conditionText = `(${audienceList.map(escapeIffAudienceName).join(',')})`;\r\n } else if (buildCompleteExpression || type === IF_FUNCTION_TYPE.DEVICE_MOBILE) {\r\n actualType = 'device=mobile';\r\n }\r\n\r\n const endIndex = startIndex + source.length;\r\n const beginning = value.substring(0, startIndex);\r\n const end = value.substring(endIndex);\r\n const expressionStart = '{=IF(';\r\n const insertTextPart = escapeIffInsertText(insertText);\r\n const defaultTextPart = _.isEmpty(defaultText) ? '' : (`:${escapeIffDefaultText(defaultText)}`);\r\n const newValue = `${beginning}${expressionStart}${actualType}${conditionText},${insertTextPart})${defaultTextPart}}${end}`;\r\n const cursorPosition = buildCompleteExpression ?\r\n newValue.length - end.length :\r\n beginning.length + expressionStart.length;\r\n\r\n return {\r\n newValue,\r\n cursorPosition,\r\n };\r\n }\r\n\r\n /**\r\n * Gets the menu item\r\n * @private\r\n * @returns {Object} the menu item description\r\n */\r\n getMenuItem({\r\n startIndex, rule, target, updateAndCloseCallback,\r\n }) {\r\n return {\r\n name: this.i18n.getString('Picker_IFFunction_Label'),\r\n description: this.i18n.getString('Picker_IFFunction_Description'),\r\n onClick: (event) => {\r\n const {\r\n source,\r\n insertText = 'insert text',\r\n defaultText = 'default text',\r\n type,\r\n audienceList = [],\r\n } = rule;\r\n\r\n const { newValue, cursorPosition } = this.formatExpression({\r\n audienceList,\r\n buildCompleteExpression: false,\r\n defaultText,\r\n insertText,\r\n source,\r\n startIndex,\r\n type,\r\n value: target.value,\r\n });\r\n\r\n updateAndCloseCallback({\r\n newValue,\r\n cursorPosition,\r\n isSelectedByUser: true,\r\n event,\r\n });\r\n },\r\n };\r\n }\r\n\r\n getSyntax(/* analyzeResult */) {\r\n // {=IF(Condition, insert text):default text}\r\n const prefix = this.i18n.getString('AdCustomizers_Editor_Syntax_Prefix_Label');\r\n const condition = this.i18n.getString('IffEditor_Condition');\r\n const insertText = this.i18n.getString('IffEditor_InsertText');\r\n const defaultText = this.i18n.getString('IffEditor_DefaultText');\r\n const syntax = `${prefix} {=IF(${condition}, ${insertText}):${defaultText}}`;\r\n return (\r\n
    \r\n {syntax}\r\n \r\n \r\n
    );\r\n }\r\n\r\n getStartIndex(value, cursorIndex) {\r\n return value.lastIndexOf('{', cursorIndex);\r\n }\r\n\r\n needEditor(analyzeResult) {\r\n return !!analyzeResult;\r\n }\r\n\r\n getEditor({\r\n target, analyzeResult, updateAndCloseCallback, /* remainingCountCallBack, */\r\n }) {\r\n const {\r\n source,\r\n type,\r\n audienceList,\r\n insertText,\r\n defaultText,\r\n } = analyzeResult;\r\n const editorProps = {\r\n i18n: this.i18n,\r\n source,\r\n type,\r\n audienceList,\r\n insertText,\r\n defaultText,\r\n audienceTargetsView: this.audienceSelectorLegacyViewManager.audienceTargetsView,\r\n onSave: _.partial(this.onEditorSave, {\r\n target, analyzeResult, updateAndCloseCallback,\r\n }),\r\n onCancel: _.partial(this.onEditorCancel, {\r\n updateAndCloseCallback,\r\n }),\r\n IsNewAudienceEnabled: this.IsNewAudienceEnabled,\r\n };\r\n return ();\r\n }\r\n\r\n onEditorSave({\r\n target, analyzeResult, updateAndCloseCallback,\r\n }, eventData) {\r\n const {\r\n source,\r\n startIndex,\r\n } = analyzeResult;\r\n const {\r\n insertText,\r\n defaultText,\r\n type,\r\n audienceList,\r\n event,\r\n } = eventData;\r\n\r\n const { newValue, cursorPosition } = this.formatExpression({\r\n audienceList,\r\n buildCompleteExpression: true,\r\n defaultText,\r\n insertText,\r\n source,\r\n startIndex,\r\n type,\r\n value: target.value,\r\n });\r\n\r\n updateAndCloseCallback({\r\n newValue,\r\n cursorPosition,\r\n isSelectedByUser: true,\r\n event,\r\n });\r\n }\r\n\r\n onEditorCancel({ updateAndCloseCallback }/* , eventData */) {\r\n updateAndCloseCallback({ isCancel: true });\r\n }\r\n\r\n /**\r\n * Returns `true` if click was not on an audience selection or removal buttons.\r\n * The default logic in the controller, which traces the event's target up\r\n * the UI tree to see if it was under one of the controller's managed elements\r\n * doesn't work with audiences, because by the time the click handler of controller\r\n * is called, the audience selector has already removed the arrow button from DOM.\r\n * @param {Object} event the click event.\r\n * @returns {Boolean} Returns `true` if click was not on an audience selection or removal buttons.\r\n * Otherwise, `false`.\r\n */\r\n isClickedAway(event) {\r\n return !isSelectArrow(event.target) &&\r\n !isRemoveArrow(event.target);\r\n }\r\n\r\n /**\r\n * analyze input\r\n * @param {Object} options - options for parametr\r\n * @param {Object} options.event - event\r\n * @param {func} options.updateAction - update call back\r\n * @param {Object} options.i18n - whether this is selected option\r\n * @param { Object} options.container -- container to show the picker\r\n * @returns {Object} promise which will resolve the result\r\n */\r\n analyzeInput({\r\n text, cursorIndex, target, updateAndCloseCallback,\r\n }) {\r\n // const processedText = text ? text.toLowerCase() : '';\r\n const startIndex = this.getStartIndex(text, cursorIndex);\r\n\r\n if (startIndex === -1 || startIndex === cursorIndex) {\r\n return Promise.resolve(null);\r\n }\r\n\r\n const rule = parseRule({\r\n text,\r\n cursorIndex,\r\n startIndex,\r\n });\r\n\r\n // The parser should have found an exression on the left from\r\n // the cursor AND cursor should be within the matched part of the string\r\n if (rule && cursorIndex <= startIndex + rule.source.length &&\r\n // AND cursor shouldn't be at the expression's closing \"}\"\r\n !(\r\n rule.isComplete &&\r\n cursorIndex === startIndex + rule.source.length\r\n ) &&\r\n // AND either we have found first significant character (isStarted)\r\n // or we are not past two characters after startIndex, inclusive\r\n (rule.isStarted || cursorIndex <= startIndex + 2)\r\n ) {\r\n return Promise.resolve(_.defaults({\r\n itemsToDisplay: [this.getMenuItem({\r\n startIndex,\r\n rule,\r\n target,\r\n updateAndCloseCallback,\r\n })],\r\n match: rule.isComplete,\r\n startIndex,\r\n }, rule));\r\n }\r\n\r\n return Promise.resolve(null);\r\n }\r\n\r\n getCharCountExcludingAdCustomizers(text, isComplete) {\r\n let processedText = text;\r\n let charCount = 0;\r\n const rule = parseRule({\r\n text: processedText,\r\n startIndex: 0,\r\n });\r\n\r\n if (rule && rule.source && (!isComplete || rule.isComplete)) {\r\n const {\r\n insertText = '',\r\n defaultText = '',\r\n } = rule;\r\n if (rule.isComplete) {\r\n charCount += Math.max(insertText.length, defaultText.length);\r\n } else {\r\n charCount += rule.source.length;\r\n }\r\n processedText = processedText.replace(rule.source, '');\r\n }\r\n\r\n return {\r\n processedText,\r\n charCount,\r\n };\r\n }\r\n\r\n evaluateRule(text) {\r\n let processedText = text;\r\n let rule = parseRule({\r\n text: processedText,\r\n startIndex: 0,\r\n });\r\n\r\n while (rule && rule.source) {\r\n if (rule.isComplete) {\r\n const {\r\n insertText = '',\r\n } = rule;\r\n processedText = processedText.replace(rule.source, insertText);\r\n }\r\n\r\n rule = parseRule({\r\n text: processedText,\r\n startIndex: rule.index + rule.source.length,\r\n });\r\n }\r\n\r\n return Promise.resolve(processedText);\r\n }\r\n}\r\n","import Promise from 'bluebird';\r\nimport { some, pick } from 'underscore';\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: location level text\r\n * [2]: default value\r\n */\r\nconst locationRuleSyntax = /\\{location\\((city|state|country)\\)(?:}|:([^{}]+)})/i;\r\n\r\n/*\r\n * Captures:\r\n * [0]: whole match\r\n * [1]: location level text (could be incomplete)\r\n * [2]: default value (could be empty)\r\n */\r\nconst locationRuleInProgressSyntax = /\\{l(?:o|$)(?:c|$)(?:a|$)(?:t|$)(?:i|$)(?:o|$)(?:n|$)(?:\\(|$)((?:c|$)(?:i|$)(?:t|$)(?:y|$)|(?:s|$)(?:t|$)(?:a|$)(?:t|$)(?:e|$)|(?:c|$)(?:o|$)(?:u|$)(?:n|$)(?:t|$)(?:r|$)(?:y|$))(?:\\)|$)(?::|$)([^{}]*)/i;\r\n\r\n/**\r\n * Looks for location rules in given text and substitutes them with their values.\r\n * {location(city): Seattle} => Seattle\r\n * @param {string} text - input text\r\n * @returns {string} text after substitutions\r\n */\r\nexport function evaluatelocationRules(text) {\r\n if (text && text.length > 0) {\r\n const locationReplaceSyntax = new RegExp(locationRuleSyntax.source, 'gi');\r\n\r\n return Promise.resolve(text.replace(locationReplaceSyntax, (match, p1, p2) => {\r\n if (p2) return p2;\r\n return match;\r\n }));\r\n }\r\n return Promise.resolve(text);\r\n}\r\n\r\n/**\r\n * Looks for a keyword rule definition in given text starting from passed index.\r\n * If found, it parses the definition.\r\n * @param {string} text - text to search in\r\n * @param {string} syntax - regex syntax use for matching\r\n * @param {int} startIndex - starts searching at this index\r\n * @param {int} cursorIndex - current cursor position\r\n * @returns {Object} parses rule definition properties or undefined if a definiton is not found.\r\n */\r\nexport function parseLocationRule(text, syntax, startIndex, cursorIndex) {\r\n const tokens = syntax.exec(text);\r\n\r\n if ((tokens === null) ||\r\n (tokens.length !== 3) ||\r\n (cursorIndex && cursorIndex <= (startIndex + tokens.index))) {\r\n return null;\r\n }\r\n\r\n return {\r\n source: tokens[0],\r\n defaultText: tokens[2],\r\n locationFormat: tokens[1],\r\n };\r\n}\r\n\r\n/**\r\n * Parses out properties to initialize a keyword helper using current cursor position\r\n * @param {string} text - input text\r\n * @param {int} cursorIndex - current cursor position\r\n * @returns {Object} properties to initialize a keyword helper\r\n * if cursor is placed within a valid definition or at the end of a partial definition.\r\n * Returns undefined; otherwise.\r\n */\r\nexport function parseRule(text, cursorIndex) {\r\n const processedText = text || '';\r\n const startIndex = processedText.lastIndexOf('{', cursorIndex);\r\n\r\n if (startIndex === -1 || cursorIndex === startIndex) {\r\n return null;\r\n }\r\n\r\n const parsers = [\r\n {\r\n input: processedText.substring(startIndex),\r\n syntax: locationRuleSyntax,\r\n inclusive: false,\r\n },\r\n {\r\n input: processedText.slice(startIndex, cursorIndex),\r\n syntax: locationRuleInProgressSyntax,\r\n inclusive: true,\r\n },\r\n ];\r\n\r\n let properties = null;\r\n\r\n some(parsers, (parser) => {\r\n const rule = parseLocationRule(parser.input, parser.syntax, startIndex, cursorIndex);\r\n\r\n if ((rule !== null) &&\r\n (cursorIndex < startIndex + rule.source.length + (parser.inclusive ? 1 : 0))) {\r\n const options = pick(rule, 'defaultText', 'locationFormat');\r\n\r\n options.prefix = processedText.substring(0, startIndex);\r\n options.suffix = processedText.substring(startIndex + rule.source.length);\r\n options.startIndex = startIndex;\r\n options.endIndex = startIndex + rule.source.length;\r\n\r\n properties = {\r\n type: 'location',\r\n options,\r\n };\r\n\r\n return true;\r\n }\r\n return false;\r\n });\r\n\r\n return properties;\r\n}\r\n","import React from 'react';\r\nimport PropTypes from 'prop-types';\r\nimport classNames from 'classnames';\r\nimport _, { isEmpty } from 'underscore';\r\nimport { withDefaultStyles } from '@bingads-webui-react/with-default-styles';\r\nimport { Form, Label, RadioGroup, Button } from '@bingads-webui-react/primitive';\r\nimport { Input } from '@bingads-webui-react/primitive-validation';\r\n\r\nconst getStyles = () => ({\r\n locationEditor: {\r\n '& .ms-Stack': {\r\n marginTop: '36px',\r\n },\r\n '& label': {\r\n paddingLeft: '0px',\r\n textAlign: 'left !important',\r\n },\r\n '& .default-text-label': {\r\n marginTop: '20px',\r\n },\r\n },\r\n buttonContainer: {\r\n marginTop: '36px',\r\n '& button.cancel': {\r\n marginLeft: '8px',\r\n },\r\n },\r\n});\r\n\r\nclass UnstyledLocationEditor extends React.PureComponent {\r\n constructor(props) {\r\n super(props);\r\n const {\r\n i18n, options,\r\n } = props;\r\n\r\n this.locationOptions = {\r\n COUNTRY: { val: 'COUNTRY', name: i18n.getString('LocationFormatLevelCountry') },\r\n STATE: { val: 'STATE', name: i18n.getString('LocationFormatLevelState') },\r\n CITY: { val: 'CITY', name: i18n.getString('LocationFormatLevelCity') },\r\n };\r\n\r\n this.state = {\r\n defaultText: options.defaultText,\r\n locationFormat: this.getLocationFormat(options.locationFormat),\r\n };\r\n }\r\n\r\n componentDidUpdate(prevProps) {\r\n if (this.props.options.defaultText !== prevProps.options.defaultText) {\r\n // eslint-disable-next-line react/no-did-update-set-state\r\n this.setState({ defaultText: this.props.options.defaultText });\r\n }\r\n if (this.props.options.locationFormat !== prevProps.options.locationFormat) {\r\n // eslint-disable-next-line react/no-did-update-set-state\r\n this.setState({ locationFormat: this.getLocationFormat(this.props.options.locationFormat) });\r\n }\r\n }\r\n\r\n onCancel = () => {\r\n this.props.updateAndCloseCallback(({ isCancel: true }));\r\n }\r\n\r\n onSave = () => {\r\n const {\r\n options, updateAndCloseCallback,\r\n } = this.props;\r\n const { defaultText, locationFormat } = this.state;\r\n\r\n const isDefaultTextEmpty =\r\n _.isUndefined(this.state.defaultText) ||\r\n _.isNull(this.state.defaultText) || isEmpty(this.state.defaultText);\r\n const newValue = `${options.prefix}{LOCATION(${locationFormat})${isDefaultTextEmpty ? '' : `:${defaultText}`}}${options.suffix}`;\r\n const cursorPosition = newValue.length - options.suffix.length;\r\n updateAndCloseCallback({\r\n newValue,\r\n cursorPosition,\r\n isSelectedByUser: true,\r\n });\r\n }\r\n\r\n getLocationFormat(locationFormat) {\r\n return _.keys(this.locationOptions).includes(locationFormat.toUpperCase()) ? locationFormat.toUpperCase() : 'CITY';\r\n }\r\n\r\n render() {\r\n const {\r\n i18n, classes,\r\n } = this.props;\r\n\r\n return (\r\n
    \r\n
    \r\n \r\n { this.setState({ locationFormat: item.val }); }}\r\n checked={this.locationOptions[this.state.locationFormat]}\r\n renderItem={item => item.name}\r\n />\r\n \r\n this.setState({ defaultText: event.target.value })}\r\n />\r\n
    \r\n \r\n \r\n
    \r\n \r\n
    );\r\n }\r\n}\r\n\r\nUnstyledLocationEditor.propTypes = {\r\n i18n: PropTypes.shape({\r\n getString: PropTypes.func,\r\n }).isRequired,\r\n classes: PropTypes.shape({\r\n locationEditor: PropTypes.string.isRequired,\r\n }).isRequired,\r\n options: PropTypes.shape({\r\n defaultText: PropTypes.string.isRequired,\r\n locationFormat: PropTypes.string.isRequired,\r\n }).isRequired,\r\n updateAndCloseCallback: PropTypes.func.isRequired,\r\n};\r\n\r\nconst LocationEditor = withDefaultStyles(UnstyledLocationEditor, getStyles);\r\nexport default LocationEditor;\r\n","import Promise from 'bluebird';\r\nimport React from 'react';\r\nimport { HelpIcon } from '@bingads-webui-campaign-react/help';\r\nimport { extend, isEmpty } from 'underscore';\r\nimport { endsWith } from 'underscore.string';\r\nimport { AdCustomizerBaseAnalyzer } from '../base-analyzer';\r\nimport { evaluatelocationRules, parseRule } from './parser';\r\nimport LocationEditor from './editor';\r\n\r\nconst pickerLocationInsert = '{LOCATION(CITY)}';\r\nconst pickerLocationInsertCursorPosition = pickerLocationInsert.length - 1;\r\nexport class AdCustomizerLocationAnalyzer extends AdCustomizerBaseAnalyzer {\r\n constructor({ deps: { i18n, instrumentation }, controller }) {\r\n super({\r\n name: 'location',\r\n priority: 3000,\r\n i18n,\r\n activityName: 'location',\r\n instrumentation,\r\n controller,\r\n });\r\n }\r\n\r\n /* return a reactjs object here */\r\n getSyntax(analyzeResult) {\r\n if (!analyzeResult.options) return null;\r\n const locationText = `LOCATION(${this.i18n.getString('Location_Level')})`;\r\n const syntax = `${this.i18n.getString('AdCustomizers_Editor_Syntax_Prefix_Label')} {${locationText}:${this.i18n.getString('KeywordEditor_DefaultText')}}`;\r\n return (\r\n
    \r\n {syntax}\r\n \r\n \r\n
    );\r\n }\r\n\r\n // get menu item\r\n getMenuItem({\r\n startIndex, endIndex, updateAndCloseCallback, target,\r\n }) {\r\n return {\r\n name: this.i18n.getString('Picker_Location_Label'),\r\n description: this.i18n.getString('Picker_Location_Description'),\r\n onClick: () => {\r\n const beginning = target.value.substring(0, startIndex);\r\n const end = target.value.substring(endIndex);\r\n updateAndCloseCallback({\r\n newValue: `${beginning}${pickerLocationInsert}${end}`,\r\n cursorPosition: beginning.length + pickerLocationInsertCursorPosition,\r\n isSelectedByUser: true,\r\n });\r\n },\r\n };\r\n }\r\n\r\n needEditor(analyzeResult) {\r\n const { options } = analyzeResult || {};\r\n return !isEmpty(options);\r\n }\r\n\r\n getEditor({ analyzeResult, updateAndCloseCallback }) {\r\n const { options } = analyzeResult || {};\r\n\r\n return ();\r\n }\r\n\r\n analyzeInput({\r\n text, cursorIndex, updateAndCloseCallback, target,\r\n }) {\r\n const rule = parseRule(text, cursorIndex);\r\n\r\n if (rule) {\r\n const { options: { startIndex } } = rule;\r\n return Promise.resolve(extend(\r\n {\r\n match: true,\r\n type: this.name,\r\n defaultHandlerForInput: false,\r\n itemsToDisplay: [this.getMenuItem({\r\n startIndex, endIndex: cursorIndex, updateAndCloseCallback, target,\r\n })],\r\n },\r\n rule\r\n ));\r\n }\r\n // when not match, see whether to show menu item\r\n if (text && endsWith(text, '{', cursorIndex)) {\r\n return Promise.resolve({\r\n type: this.name,\r\n defaultHandlerForInput: false,\r\n itemsToDisplay: [this.getMenuItem({\r\n startIndex: text.length - 1,\r\n endIndex: cursorIndex,\r\n updateAndCloseCallback,\r\n target,\r\n })],\r\n });\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n evaluateRule(text) {\r\n return evaluatelocationRules(text);\r\n }\r\n\r\n getCharCountExcludingAdCustomizers(text) {\r\n let charCount = 0;\r\n let processedText = text || '';\r\n\r\n let tokens = /\\{location\\((city|state|country)\\)}/i.exec(processedText);\r\n if (tokens) {\r\n processedText = processedText.replace(tokens[0], '');\r\n charCount = 10;\r\n } else {\r\n tokens = /\\{location\\((city|state|country)\\):([^{}]*)}/i.exec(processedText);\r\n if (tokens) {\r\n processedText = processedText.replace(tokens[0], '');\r\n charCount += tokens[2] ? tokens[2].length : 0;\r\n }\r\n }\r\n\r\n return {\r\n processedText,\r\n charCount,\r\n };\r\n }\r\n}\r\n","/* eslint-disable no-new */\r\nimport $ from 'jquery';\r\nimport _ from 'underscore';\r\nimport { RSAAdCustomizerAnalyzer } from '@bingads-webui-campaign/ad-customizers-next';\r\nimport { AdCustomizerController } from './controller';\r\nimport { AdCustomizerFeedAnalyzer } from './feeds/analyzer';\r\nimport { AdCustomizerKeywordAnalyzer } from './keyword/analyzer';\r\nimport { AdCustomizerCountdownAnalyzer } from './countdown/analyzer';\r\nimport { AdCustomizerIffAnalyzer } from './iff/analyzer';\r\nimport { AdCustomizerLocationAnalyzer } from './location/analyzer';\r\n\r\n// These singletons orchestrate the controllers and analyzers for each ad type\r\n// that supports Ad Customizers. This is needed to allow certain ad types to use a subset of the\r\n// available Ad Customizers (specifically the analyzers).\r\nconst instances = {\r\n ExpandedTextAd: {\r\n controller: null,\r\n initialized: false,\r\n },\r\n DynamicSearchAd: {\r\n controller: null,\r\n initialized: false,\r\n },\r\n ResponsiveSearchAd: {\r\n controller: null,\r\n initialized: false,\r\n },\r\n ResponsiveAd: {\r\n controller: null,\r\n initialized: false,\r\n },\r\n};\r\n\r\nconst excludedAdCustomizerFields = {\r\n ResponsiveSearchAd: {\r\n countdown: ['Path1', 'Path2', 'ParsedPath1', 'ParsedPath2'],\r\n },\r\n};\r\n\r\nfunction getExcludedAdCustomizerFields(adType, customizer) {\r\n return excludedAdCustomizerFields[adType][customizer];\r\n}\r\n\r\nfunction checkAdType(adType) {\r\n if (!_.has(instances, adType)) {\r\n throw new Error(`Ad customizer for ad type '${adType}' may not be supported.`);\r\n }\r\n}\r\n\r\nfunction initialize(deps, adType = 'ExpandedTextAd') {\r\n checkAdType(adType);\r\n\r\n if (!instances[adType].initialized) {\r\n instances[adType].controller = new AdCustomizerController();\r\n const { config } = deps;\r\n const permissions = config.get('Permissions') || {};\r\n const {\r\n IsAdCustomizerEnabled, IsKeywordDefaultEnabled, IsIfFunctionMilestone1Enabled,\r\n IsIffCountdownForDSAEnabled, IsRSACountdownsPopupEnabled,\r\n IsRSALocationInsertionPopupEnabled, IsRSAAdCustomizerEnabled,\r\n IsMMACountdownInsertionEnabled, IsMMAKeywordInsertionEnabled, IsMMALocationInsertionEnabled,\r\n IsMMAAdCustomizerInsertionEnabled,\r\n } = permissions;\r\n\r\n const { controller } = instances[adType];\r\n if (IsIffCountdownForDSAEnabled && adType === 'DynamicSearchAd') {\r\n new AdCustomizerCountdownAnalyzer({ deps, controller });\r\n if (IsIfFunctionMilestone1Enabled) {\r\n new AdCustomizerIffAnalyzer({ deps, controller });\r\n }\r\n } else if (adType === 'ResponsiveSearchAd') {\r\n if (IsRSACountdownsPopupEnabled) {\r\n new AdCustomizerCountdownAnalyzer({\r\n deps,\r\n controller,\r\n excludedFields: getExcludedAdCustomizerFields(adType, 'countdown'),\r\n });\r\n }\r\n new AdCustomizerKeywordAnalyzer({ deps, controller });\r\n if (IsRSALocationInsertionPopupEnabled) {\r\n new AdCustomizerLocationAnalyzer({ deps, controller });\r\n }\r\n if (IsRSAAdCustomizerEnabled) {\r\n new RSAAdCustomizerAnalyzer({ deps, controller });\r\n }\r\n } else if (adType === 'ResponsiveAd') {\r\n if (IsMMACountdownInsertionEnabled) {\r\n new AdCustomizerCountdownAnalyzer({ deps, controller });\r\n }\r\n if (IsMMAKeywordInsertionEnabled) {\r\n new AdCustomizerKeywordAnalyzer({ deps, controller });\r\n }\r\n if (IsMMALocationInsertionEnabled) {\r\n new AdCustomizerLocationAnalyzer({ deps, controller });\r\n }\r\n if (IsMMAAdCustomizerInsertionEnabled) {\r\n new RSAAdCustomizerAnalyzer({ deps, controller });\r\n }\r\n } else {\r\n new AdCustomizerCountdownAnalyzer({ deps, controller });\r\n if (IsAdCustomizerEnabled) {\r\n new AdCustomizerFeedAnalyzer({ deps, controller });\r\n }\r\n if (IsKeywordDefaultEnabled) {\r\n new AdCustomizerKeywordAnalyzer({ deps, controller });\r\n }\r\n if (IsIfFunctionMilestone1Enabled) {\r\n new AdCustomizerIffAnalyzer({ deps, controller });\r\n }\r\n }\r\n instances[adType].initialized = true;\r\n } else if (deps.scope) {\r\n // update scope if already initialized\r\n const { controller: { analyzers } } = instances[adType];\r\n _.each(analyzers, ({ analyzer }) => {\r\n // eslint-disable-next-line no-param-reassign\r\n analyzer.scope = deps.scope;\r\n });\r\n }\r\n}\r\n\r\nfunction getController(deps, adType) {\r\n checkAdType(adType);\r\n\r\n let controller;\r\n if (adType === 'DynamicSearchAd') {\r\n initialize(deps, 'DynamicSearchAd');\r\n ({ controller } = instances.DynamicSearchAd);\r\n } else if (adType === 'ExpandedTextAd') {\r\n initialize(deps, 'ExpandedTextAd');\r\n ({ controller } = instances.ExpandedTextAd);\r\n } else if (adType === 'ResponsiveSearchAd') {\r\n initialize(deps, 'ResponsiveSearchAd');\r\n ({ controller } = instances.ResponsiveSearchAd);\r\n } else if (adType === 'ResponsiveAd') {\r\n initialize(deps, 'ResponsiveAd');\r\n ({ controller } = instances.ResponsiveAd);\r\n }\r\n\r\n return controller;\r\n}\r\n\r\nfunction testResetState(adType = 'ExpandedTextAd') {\r\n instances[adType].initialized = false;\r\n instances[adType].controller = null;\r\n}\r\n\r\n/*\r\n * Attaches focus, input event listeners to ad text fields\r\n */\r\nfunction attachAdCustomizersHelpers({\r\n container = $('body'), // to attach popups to\r\n element,\r\n updateAction,\r\n remainingCountCallBack,\r\n deps,\r\n adType = 'ExpandedTextAd',\r\n field = '',\r\n}) {\r\n const { instrumentation } = deps;\r\n const controller = getController(deps, adType);\r\n\r\n // add the class so that click in the input will not trigger picker to be hide\r\n element.addClass('ac-helper-area');\r\n\r\n element.on('input keyup focus click', (event) => {\r\n const { type, key, target } = event;\r\n const {\r\n isSelectedByUser, analyzerName, selectionStart, selectionEnd,\r\n } = target;\r\n target.isSelectedByUser = false;\r\n target.analyzerName = undefined;\r\n\r\n // Ignore if any text is selected, we are only interested in the cursor\r\n if (selectionStart !== selectionEnd) {\r\n return;\r\n }\r\n\r\n // Ignore escape key up since it shouldn't prompt any helper\r\n if (type === 'keyup' && key === 'Escape') {\r\n return;\r\n }\r\n\r\n controller.onInputUpdate({\r\n remainingCountCallBack,\r\n event,\r\n isSelectedByUser,\r\n analyzerName,\r\n updateAction,\r\n instrumentation,\r\n container, // to attach popups to\r\n adType,\r\n field,\r\n });\r\n });\r\n}\r\n\r\n// Calculates how much space ad customizer adds to the ad text field\r\nfunction getCharCountExcludingAdCustomizers({\r\n text,\r\n deps,\r\n adType = 'ExpandedTextAd',\r\n field = '',\r\n}) {\r\n const controller = getController(deps, adType);\r\n return controller.getCharCountExcludingAdCustomizers(text, adType, field);\r\n}\r\n\r\n/**\r\n * Looks for ad customizers in given text and substitutes them with their evaluated values.\r\n * Used for preview generation.\r\n * @param {string} text - input text\r\n * @returns {Object} A promise that resolves to modified input text that contains substitutions\r\n */\r\nfunction evaluateAdCustomizers({\r\n text,\r\n deps,\r\n adType = 'ExpandedTextAd',\r\n field = '',\r\n}) {\r\n const controller = getController(deps, adType);\r\n return controller.evaluateAdCustomizers(text, adType, field);\r\n}\r\n\r\nexport {\r\n evaluateAdCustomizers,\r\n getCharCountExcludingAdCustomizers,\r\n attachAdCustomizersHelpers,\r\n testResetState,\r\n checkAdType,\r\n};\r\n","import _ from 'underscore';\r\nimport React from 'react';\r\nimport PropTypes from 'prop-types';\r\nimport { BackboneInstanceWrapper } from '@bingads-webui-react/backbone-instance-wrapper';\r\nimport { DependencyResolver } from '@bingads-webui-campaign/dependency-resolver';\r\nimport containerTemplate from './association-section-for-iff.pug';\r\nimport layoutTemplate from './double-list-box-layout.pug';\r\n\r\nconst trim = Function.prototype.call.bind(String.prototype.trim);\r\n\r\n/**\r\n * Normalizes an audience coming form IFF analyzer. It removes whitespaces\r\n * around the name as well as around the separators /.\r\n * For example, a raw name `\" Lipstick / Lip Liner and Eyeliner / Eye Shadow \"`\r\n * will be turned into `\"Lipstick/Lip Liner and Eyeliner/Eye Shadow\"`.\r\n * Another example: `\" / Real Estate / Residential Properties \"` will be turned into\r\n * `\"/Real Estate/Residential Properties\"`.\r\n * @param {String} audienceName the raw audience name, parsed by IFF analyzer.\r\n * It can contain extra whitespaces around the text, as well as around the separators /\r\n * @returns {String} the normalized audience name\r\n */\r\nconst normalizeAudienceName = (audienceName = '') => {\r\n const audienceNamePath = audienceName.split('/');\r\n const addLeadingSlash = !((_.first(audienceNamePath) || '').trim());\r\n const trimmedParts = _.chain(audienceNamePath)\r\n .filter(Boolean)\r\n .map(trim)\r\n .join('/')\r\n .value();\r\n return `${addLeadingSlash ? '/' : ''}${trimmedParts}`;\r\n};\r\n\r\n/**\r\n * Contructs and hold a reference to AudienceTargetInfo.\r\n * AudienceTargetInfo is expensive to construct as it needs\r\n * to request the data from the server. This class is designed to\r\n * be used by code that establishes a session during which\r\n * AudienceTargetInfo (audience selection control) is needed.\r\n */\r\nexport class AudienceSelectorLegacyViewManager {\r\n constructor({ perfMarker }) {\r\n const AudienceAssociationView\r\n = DependencyResolver.get('campaignui/feature/audience/association/view/base-association-view');\r\n this.audienceTargetsView = new AudienceAssociationView({\r\n scope: {}, // this is needed to request audiences for all delivery channels\r\n campaignType: null, // this is needed to request audiences for all delivery channels\r\n associationType: null, // this is needed to remove all \"create audience\" links\r\n refreshOnInitialize: true,\r\n shouldShowUiBlockOnRender: false,\r\n customizedTemplates: {\r\n dlbContainerTemplate: containerTemplate,\r\n dlbLayoutTemplate: layoutTemplate,\r\n },\r\n isFromIFFunction: true,\r\n perfMarker,\r\n });\r\n this.audienceTargetsView.canExpandAssociation = true;\r\n this.audienceTargetsView.render();\r\n this.audienceTargetsView.expandAssociation();\r\n }\r\n}\r\n\r\nexport class AudienceSelector extends React.PureComponent {\r\n constructor(props) {\r\n super(props);\r\n\r\n this.audienceTargetsView = props.audienceTargetsView;\r\n\r\n this.state = {\r\n loaded: false,\r\n };\r\n\r\n this.audienceTargetsView.ensureLoadedAsync().then(() => {\r\n this.mapTargetingIdsToCriterions();\r\n this.setState({ loaded: true });\r\n this.subscribeToSelectionChanges();\r\n this.onAudienceListChanged(true);\r\n });\r\n\r\n this.onAudienceListChanged = this.onAudienceListChanged.bind(this);\r\n }\r\n\r\n componentWillUnmount() {\r\n this.unsubscribeFromSelectionChanges();\r\n }\r\n\r\n onAudienceListChanged(isInitialLoad = false) {\r\n this.props.onAudienceListChanged(this.getAudienceList(), isInitialLoad);\r\n }\r\n\r\n getAudienceList() {\r\n const { associationList } = this.audienceTargetsView.getLists();\r\n return _.map(associationList, _.property('Name'));\r\n }\r\n\r\n mapAudienceNamesToCriterion = audiencesList =>\r\n _.chain(audiencesList)\r\n .map(this.mapAudienceNameToCriterion)\r\n .compact()\r\n .value();\r\n\r\n mapAudienceNameToCriterion = (audienceName) => {\r\n const normalizedAudienceName = normalizeAudienceName(audienceName);\r\n return _.find(this.audienceTargetsView.doubleListBoxViewModel.allAudiences, audience =>\r\n audience.Name === normalizedAudienceName);\r\n };\r\n\r\n mapTargetingIdsToCriterions = () => {\r\n this.criterions = {\r\n associationList: this.mapAudienceNamesToCriterion(this.props.audienceList),\r\n exclusionList: [],\r\n };\r\n this.audienceTargetsView.setLists(this.criterions);\r\n };\r\n\r\n subscribeToSelectionChanges() {\r\n if (!this.isSubscribedToSelectionChanges) {\r\n this.audienceTargetsView.on('selectionChanged', () => this.onAudienceListChanged());\r\n this.isSubscribedToSelectionChanges = true;\r\n }\r\n }\r\n\r\n unsubscribeFromSelectionChanges() {\r\n if (this.isSubscribedToSelectionChanges) {\r\n this.audienceTargetsView.off('selectionChanged', () => this.onAudienceListChanged());\r\n this.isSubscribedToSelectionChanges = false;\r\n }\r\n }\r\n\r\n render() {\r\n return this.state.loaded ? (\r\n
    \r\n \r\n
    \r\n ) : null;\r\n }\r\n}\r\n\r\nAudienceSelector.propTypes = {\r\n audienceTargetsView: PropTypes.shape({\r\n render: PropTypes.func.isRequired,\r\n }).isRequired,\r\n audienceList: PropTypes.arrayOf(PropTypes.string),\r\n className: PropTypes.string,\r\n data: PropTypes.shape({\r\n Includes: PropTypes.array,\r\n Excludes: PropTypes.array,\r\n }),\r\n onAudienceListChanged: PropTypes.func.isRequired,\r\n};\r\n\r\nAudienceSelector.defaultProps = {\r\n audienceList: [],\r\n className: undefined,\r\n data: {},\r\n};\r\n","import _ from 'underscore';\r\nimport PropTypes from 'prop-types';\r\nimport React from 'react';\r\nimport classnames from 'classnames';\r\nimport {\r\n Form, Label, Button, Select,\r\n} from '@bingads-webui-react/primitive';\r\nimport { ErrorMessages } from '@bingads-webui-react/validation';\r\nimport { ValidationStringMap } from '@bingads-webui/validation-string-map';\r\nimport { buildLegacyI18n } from '@bingads-webui/build-legacy-i18n';\r\nimport { Input, ValidationGroup } from '@bingads-webui-react/primitive-validation';\r\nimport { HelpIcon } from '@bingads-webui-campaign-react/help';\r\nimport { IF_FUNCTION_TYPE } from '../if-function-type';\r\nimport { AudienceSelector } from './audience-selector';\r\n\r\nconst IFF_ENTITY_SCHEMA = {\r\n name: 'IFF',\r\n type: 'object',\r\n properties: {\r\n insertText: {\r\n type: 'string',\r\n required: true,\r\n },\r\n defaultText: {\r\n type: 'string',\r\n required: false,\r\n },\r\n audienceList: {\r\n type: 'array',\r\n items: {\r\n type: 'string',\r\n },\r\n },\r\n },\r\n};\r\n\r\nconst initialInputText = (autoInsertedText, fieldText) =>\r\n (autoInsertedText === fieldText ? undefined : fieldText);\r\n\r\n/* eslint-disable react/prefer-stateless-function */\r\nexport class IffEditor extends React.Component {\r\n static propTypes = {\r\n IsNewAudienceEnabled: PropTypes.bool,\r\n audienceTargetsView: PropTypes.shape({\r\n render: PropTypes.func.isRequired,\r\n }).isRequired,\r\n audienceList: PropTypes.arrayOf(PropTypes.string),\r\n defaultText: PropTypes.string,\r\n i18n: PropTypes.shape({\r\n getString: PropTypes.func.isRequired,\r\n }).isRequired,\r\n insertText: PropTypes.string,\r\n type: PropTypes.string,\r\n onSave: PropTypes.func,\r\n onCancel: PropTypes.func,\r\n };\r\n static defaultProps = {\r\n IsNewAudienceEnabled: false,\r\n audienceList: [],\r\n defaultText: undefined,\r\n insertText: undefined,\r\n type: undefined,\r\n onSave: _.noop,\r\n onCancel: _.noop,\r\n };\r\n\r\n constructor(props) {\r\n super(props);\r\n\r\n const {\r\n i18n,\r\n defaultText,\r\n insertText,\r\n type,\r\n } = props;\r\n\r\n this.conditionTypeLabel = i18n.getString(_TL_('If'));\r\n this.conditionTypeHelpId = 'pop_BA_NewAdCreate_IFfunction_IF';\r\n this.conditionDeviceOptionText = i18n.getString(_TL_('Device'));\r\n this.conditionDeviceIsMobileStaticText = i18n.getString(_TL_('is mobile'));\r\n this.conditionAudienceOptionText = i18n.getString(_TL_('Audience'));\r\n this.conditionAudienceInStaticText = i18n.getString(_TL_('is one of the selected audiences below:'));\r\n this.insertTextLabel = i18n.getString(_TL_('Then insert'));\r\n this.insertTextHelpId = 'pop_BA_NewAdCreate_IFfunction_Then';\r\n this.insertTextPlaceholder = i18n.getString(_TL_('Text'));\r\n this.defaultTextLabel = i18n.getString(_TL_('Otherwise (optional)'));\r\n this.defaultTextHelpId = 'pop_BA_NewAdCreate_IFfunction_Optional';\r\n this.defaultTextPlaceholder = i18n.getString(_TL_('Default text'));\r\n this.syntaxInsertText = i18n.getString(_TL_('insert text'));\r\n this.syntaxDefaultText = i18n.getString(_TL_('default text'));\r\n this.saveButtonText = i18n.getString(_TL_('Apply'));\r\n this.cancelButtonText = i18n.getString(_TL_('Cancel'));\r\n\r\n this.errorNoAudiencesSelected = i18n.getString(_TL_('Select at least one audience'));\r\n\r\n this.onAudienceListChanged = this.onAudienceListChanged.bind(this);\r\n this.onConditionTypeChange = this.onConditionTypeChange.bind(this);\r\n\r\n this.onCancelClicked = this.onCancelClicked.bind(this);\r\n this.onSaveClicked = this.onSaveClicked.bind(this);\r\n\r\n this.state = {\r\n isValid: false,\r\n type,\r\n data: {\r\n defaultText: initialInputText(this.syntaxDefaultText, defaultText),\r\n insertText: initialInputText(this.syntaxInsertText, insertText),\r\n },\r\n audienceErrorMessages: [],\r\n selectedAudiences: [],\r\n };\r\n }\r\n\r\n onAudienceListChanged(selectedAudiences, isInitialLoad) {\r\n if (!isInitialLoad && _.isEmpty(selectedAudiences)) {\r\n this.setState({\r\n selectedAudiences,\r\n audienceErrorMessages: [this.errorNoAudiencesSelected],\r\n });\r\n } else {\r\n this.setState({\r\n selectedAudiences,\r\n audienceErrorMessages: [],\r\n });\r\n }\r\n }\r\n\r\n onConditionTypeChange(event) {\r\n this.setState({ type: event.target.value });\r\n }\r\n\r\n onSaveClicked(event) {\r\n const {\r\n type,\r\n data: {\r\n defaultText,\r\n insertText,\r\n },\r\n } = this.state;\r\n\r\n this.props.onSave(_.extend({\r\n event,\r\n defaultText,\r\n insertText,\r\n type,\r\n }, (type === IF_FUNCTION_TYPE.AUDIENCE_IN ? { audienceList: this.getAudienceList() } : {})));\r\n }\r\n\r\n onCancelClicked(event) {\r\n this.props.onCancel(event);\r\n }\r\n\r\n onValidate = (result) => {\r\n this.setState({\r\n isValid: result.isValid,\r\n data: result.data,\r\n });\r\n };\r\n\r\n getAudienceList() {\r\n return this.audienceSelector.getAudienceList();\r\n }\r\n\r\n render() {\r\n const { i18n, audienceTargetsView, audienceList } = this.props;\r\n const {\r\n type,\r\n data,\r\n isValid: areBaseInputsValid,\r\n selectedAudiences,\r\n } = this.state;\r\n\r\n const actualType = type === IF_FUNCTION_TYPE.AUDIENCE_IN ? type :\r\n IF_FUNCTION_TYPE.DEVICE_MOBILE;\r\n\r\n let isModeInputsValid = true;\r\n if (actualType === IF_FUNCTION_TYPE.AUDIENCE_IN) {\r\n isModeInputsValid = !_.isEmpty(selectedAudiences);\r\n }\r\n\r\n const isValid = areBaseInputsValid && isModeInputsValid;\r\n\r\n const audienceSelectorClass = this.props.IsNewAudienceEnabled ? 'iff-audience-selector--new' : 'iff-audience-selector--old';\r\n const legacyi18n = buildLegacyI18n(i18n, [ValidationStringMap]);\r\n\r\n return (\r\n
    \r\n \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n \r\n \r\n {actualType === IF_FUNCTION_TYPE.AUDIENCE_IN ?\r\n this.conditionAudienceInStaticText :\r\n this.conditionDeviceIsMobileStaticText}\r\n \r\n
    \r\n\r\n {actualType === IF_FUNCTION_TYPE.AUDIENCE_IN ?\r\n
    \r\n\r\n { this.audienceSelector = component; }}\r\n />\r\n \r\n
    : null}\r\n\r\n
    \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n\r\n
    \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n\r\n
    \r\n \r\n {this.saveButtonText}\r\n \r\n \r\n
    \r\n
    \r\n );\r\n }\r\n}\r\n","export function escapeIffAudienceName(audienceName) {\r\n return audienceName.replace(/([\\\\),])/g, '\\\\$1');\r\n}\r\n\r\nexport function escapeIffInsertText(insertText) {\r\n return insertText.replace(/([\\\\)])/g, '\\\\$1');\r\n}\r\n\r\nexport function escapeIffDefaultText(defaultText) {\r\n return defaultText.replace(/([\\\\}])/g, '\\\\$1');\r\n}\r\n\r\nexport function unescapeIff(text) {\r\n return text.replace(/\\\\(.)/g, '$1');\r\n}\r\n","export const IF_FUNCTION_TYPE = {\r\n UNKNOWN: 'unknown',\r\n DEVICE_MOBILE: 'device=mobile',\r\n AUDIENCE_IN: 'audience IN',\r\n};\r\n","/*\r\n // The in-progress device-based IF-function expression syntax's regex is built from the\r\n // following code:\r\n var inProgRegEx = (blocks) =>\r\n _.reverse([...blocks]).reduce((memo, block) => `(?:${block}${memo})?`, '');\r\n var start = '{';\r\n var deviceConditionBlocks = ['d', 'e', 'v', 'i', 'c', 'e', '\\\\s*', '=', '\\\\s*',\r\n 'm', 'o', 'b', 'i', 'l', 'e'];\r\n var insertTextBlocks = ['((?:[^)\\\\\\\\]|\\\\\\\\\\\\S)*)'];\r\n var defaultTextBlocks = [':', '\\\\s*', '((?:[^{}\\\\\\\\]|\\\\\\\\\\\\S)*)'];\r\n var blocks = ['=\\\\s*', 'i', 'f', '\\\\s*', '\\\\(', '\\\\s*', `(${inProgRegEx(deviceConditionBlocks)})`,\r\n '\\\\s*', ',', '\\\\s*', ...insertTextBlocks, '\\\\)', '\\\\s*', `${inProgRegEx(defaultTextBlocks)}`,\r\n '(})'\r\n ];\r\n start + inProgRegEx(blocks);\r\n*/\r\n/**\r\n * **GENERATED REGULAR EXPRESSION!** Use the above code snippet to generate a different version.\r\n * Matches an in-progress device-based IF-function expression. Captures the following information:\r\n * [0]: whole match starting from '{=' and finishing with '}'\r\n * [1]: the 'i' character - mark of first significant part of the express\r\n * [2]: condition text, eg. 'device=mobile'\r\n * [3]: insert text\r\n * [4]: default text\r\n * [5]: the '}' character - mark of a complete expression\r\n * index: 0-based index of the whole match within the parsed string\r\n */\r\nexport const iffInProgressSyntax = /{(?:=\\s*(?:(i)(?:f(?:\\s*(?:\\((?:\\s*(?:((?:d(?:e(?:v(?:i(?:c(?:e(?:\\s*(?:=(?:\\s*(?:m(?:o(?:b(?:i(?:l(?:e)?)?)?)?)?)?)?)?)?)?)?)?)?)?)?)(?:\\s*(?:,(?:\\s*(?:((?:[^)\\\\]|\\\\\\S)*)(?:\\)(?:\\s*(?:(?::(?:\\s*(?:((?:[^{}\\\\]|\\\\\\S)*))?)?)?(?:(}))?)?)?)?)?)?)?)?)?)?)?)?)?)?)?/i;\r\n\r\n/*\r\n // The in-progress audience-based IF-function expression syntax's regex is built from the\r\n // following code:\r\n var inProgRegEx = (blocks) =>\r\n _.reverse([...blocks]).reduce((memo, block) => `(?:${block}${memo})?`, '');\r\n var normalRegEx = (blocks) =>\r\n _.reverse([...blocks]).reduce((memo, block) => `${block}${memo}`, '');\r\n var start = '{';\r\n var audienceInBlocks = ['a', 'u', 'd', 'i', 'e', 'n', 'c', 'e', '\\\\s*', 'i', 'n'];\r\n var audienceListBlocks = ['(?:(?:[^,)\\\\\\\\]|\\\\\\\\\\\\S),?)*'];\r\n var audienceConditionBlocks = [`(${inProgRegEx(audienceInBlocks)})`, '\\\\s*', '\\\\(',\r\n '\\\\s*', `(${normalRegEx(audienceListBlocks)})`, '\\\\)'];\r\n var insertTextBlocks = ['((?:[^)\\\\\\\\]|\\\\\\\\\\\\S)*)'];\r\n var defaultTextBlocks = [':', '\\\\s*', '((?:[^{}\\\\\\\\]|\\\\\\\\\\\\S)*)'];\r\n var blocks = ['=\\\\s*', 'i', 'f', '\\\\s*', '\\\\(', '\\\\s*',\r\n `${inProgRegEx(audienceConditionBlocks)}`, '\\\\s*', ',', '\\\\s*', ...insertTextBlocks, '\\\\)',\r\n '\\\\s*', `${inProgRegEx(defaultTextBlocks)}`, '(})'\r\n ];\r\n start + inProgRegEx(blocks);\r\n*/\r\n/**\r\n * **GENERATED REGULAR EXPRESSION!** Use the above code snippet to generate a different version.\r\n * Matches an in-progress device-based IF-function expression. Captures the following information:\r\n * [0]: whole match starting from '{=' and finishing with '}'\r\n * [1]: the 'i' character - mark of first significant part of the express\r\n * [2]: condition text, eg. 'audience in'\r\n * [3]: audience in condition body, eg. 'audience 1, audience 2'\r\n * [4]: insert text\r\n * [5]: default text\r\n * [6]: the '}' character - mark of a complete expression\r\n * index: 0-based index of the whole match within the parsed string\r\n */\r\nexport const iffInProgressAudienceSyntax = /{(?:=\\s*(?:(i)(?:f(?:\\s*(?:\\((?:\\s*(?:(?:((?:a(?:u(?:d(?:i(?:e(?:n(?:c(?:e(?:\\s*(?:i(?:n)?)?)?)?)?)?)?)?)?)?)?)(?:\\s*(?:\\((?:\\s*(?:((?:(?:[^,)\\\\]|\\\\\\S),?)*)(?:\\))?)?)?)?)?)?(?:\\s*(?:,(?:\\s*(?:((?:[^)\\\\]|\\\\\\S)*)(?:\\)(?:\\s*(?:(?::(?:\\s*(?:((?:[^{}\\\\]|\\\\\\S)*))?)?)?(?:(}))?)?)?)?)?)?)?)?)?)?)?)?)?)?)?/i;\r\n","/**\r\n * Matches audience names separated by ','. Captures the following information:\r\n * [0]: whole match starting\r\n * index: 0-based index of the whole match within the parsed string\r\n */\r\nexport const audienceListSyntax = /(?:[^,\\\\]|\\\\\\S)+/ig;\r\n","import _ from 'underscore';\r\nimport {\r\n iffInProgressSyntax, iffInProgressAudienceSyntax,\r\n} from './regex/iff-in-progress-syntax';\r\nimport { audienceListSyntax } from './regex/audience-list-syntax';\r\nimport { unescapeIff } from './escape';\r\nimport { IF_FUNCTION_TYPE } from './if-function-type';\r\n\r\nconst SPECIFICITY = {\r\n TYPE: 1,\r\n};\r\n\r\n/**\r\n * Removes spaces before and after the text, as well as\r\n * keeps only one space between words.\r\n * @param {String} text the text to normalize\r\n * @returns {String} the normalized text\r\n */\r\nexport function normalizeInsertText(text) {\r\n return text.trim().replace(/(?:\\s+)/g, ' ');\r\n}\r\n\r\n/**\r\n * Unescapes and normalizes insert or default text.\r\n * @param {String} text an insert or default text to parse\r\n * @returns {String} the parsed text\r\n */\r\nexport function parseInsertText(text) {\r\n const unescapedText = unescapeIff(text);\r\n return normalizeInsertText(unescapedText);\r\n}\r\n\r\n/**\r\n * Looks for an incomplete device-based IF-function rule definition in given text,\r\n * starting from the passed index. If found, it returns the rule's paramenters/parts.\r\n * Otherwise, returns null.\r\n * @param {Object} options the options\r\n * @param {String} options.text the whole text\r\n * @param {Number} options.startIndex the 0-based index of '{' in the whole text. Optionally,\r\n * relative to the cursorIndex.\r\n * @param {Number} [options.cursorIndex] the 0-based position of the cursor in the whole text. Can\r\n * be undefined for scenarios where we are parsing the expression for preview, where there is no\r\n * cursor\r\n * @returns {Object} parsed rule definition parameters, or null, if a definiton is not found.\r\n */\r\nexport function parseIffDeviceRuleInProgress({\r\n text, startIndex = 0, cursorIndex,\r\n}) {\r\n const input = text.substring(startIndex);\r\n const tokens = iffInProgressSyntax.exec(input);\r\n\r\n if ((tokens === null) ||\r\n (cursorIndex && cursorIndex <= (startIndex + tokens.index))) {\r\n return null;\r\n }\r\n\r\n const type = tokens[2] ? IF_FUNCTION_TYPE.DEVICE_MOBILE : IF_FUNCTION_TYPE.UNKNOWN;\r\n\r\n /* eslint-disable no-bitwise */\r\n const specificity = (type && type !== IF_FUNCTION_TYPE.UNKNOWN && SPECIFICITY.TYPE) |\r\n (0);\r\n /* eslint-enable no-bitwise */\r\n\r\n\r\n return {\r\n defaultText: tokens[4] ? parseInsertText(tokens[4]) : undefined,\r\n insertText: tokens[3] ? parseInsertText(tokens[3]) : undefined,\r\n isStarted: !!tokens[1],\r\n isComplete: !!tokens[5],\r\n source: tokens[0],\r\n specificity,\r\n type,\r\n index: startIndex + tokens.index,\r\n startIndex,\r\n };\r\n}\r\n\r\n/**\r\n * Parses the raw audience list part of the audience-based\r\n * IF-function into an array of audience names\r\n * @param {String} audienceListRaw the raw audience list text\r\n * @returns {String[]} the array of audience names\r\n */\r\nexport function parseAudienceList(audienceListRaw) {\r\n const audienceList = [];\r\n let tokens;\r\n // eslint-disable-next-line no-cond-assign\r\n while ((tokens = audienceListSyntax.exec(audienceListRaw)) !== null) {\r\n // This is necessary to avoid infinite loops with zero-width matches\r\n if (tokens.index === audienceListSyntax.lastIndex) {\r\n audienceListSyntax.lastIndex += 1;\r\n }\r\n\r\n const finalAudience = unescapeIff(tokens[0]).trim();\r\n // Ignoring empty entries\r\n if (finalAudience) {\r\n audienceList.push(finalAudience);\r\n }\r\n }\r\n\r\n return audienceList;\r\n}\r\n\r\n/**\r\n * Looks for an incomplete audience-based IF-function rule definition in given text,\r\n * starting from the passed index. If found, it returns the rule's paramenters/parts.\r\n * Otherwise, returns null.\r\n * @param {Object} options the options\r\n * @param {String} options.text the whole text\r\n * @param {Number} options.startIndex the 0-based index of '{' in the whole text. Optionally,\r\n * relative to the cursorIndex.\r\n * @param {Number} [options.cursorIndex] the 0-based position of the cursor in the whole text. Can\r\n * be undefined for scenarios where we are parsing the expression for preview, where there is no\r\n * cursor\r\n * @returns {Object} parsed rule definition parameters, or null, if a definiton is not found.\r\n */\r\nexport function parseIffAudienceRuleInProgress({\r\n text, startIndex = 0, cursorIndex,\r\n}) {\r\n const input = text.substring(startIndex);\r\n const tokens = iffInProgressAudienceSyntax.exec(input);\r\n\r\n if ((tokens === null) ||\r\n (cursorIndex && cursorIndex <= (startIndex + tokens.index))) {\r\n return null;\r\n }\r\n\r\n const type = tokens[2] ? IF_FUNCTION_TYPE.AUDIENCE_IN : IF_FUNCTION_TYPE.UNKNOWN;\r\n\r\n /* eslint-disable no-bitwise */\r\n const specificity = (type && type !== IF_FUNCTION_TYPE.UNKNOWN && SPECIFICITY.TYPE) |\r\n (0);\r\n /* eslint-enable no-bitwise */\r\n\r\n return {\r\n audienceList: tokens[3] ? parseAudienceList(tokens[3]) : [],\r\n audienceListRaw: tokens[3],\r\n defaultText: tokens[5] ? parseInsertText(tokens[5]) : undefined,\r\n insertText: tokens[4] ? parseInsertText(tokens[4]) : undefined,\r\n isStarted: !!tokens[1],\r\n isComplete: !!tokens[6],\r\n source: tokens[0],\r\n specificity,\r\n type,\r\n index: startIndex + tokens.index,\r\n startIndex,\r\n };\r\n}\r\n\r\nexport function parseRule({\r\n text, startIndex, cursorIndex,\r\n}) {\r\n const parserArgs = {\r\n text, startIndex, cursorIndex,\r\n };\r\n const parsers = [\r\n parseIffDeviceRuleInProgress,\r\n parseIffAudienceRuleInProgress,\r\n ];\r\n\r\n return _.chain(parsers)\r\n .map(parser => parser(parserArgs))\r\n .sortBy(_.property('specificity'))\r\n .last()\r\n .value();\r\n}\r\n","/* eslint-disable quotes */\r\nexport const mockedTags = {\r\n '@odata.context': 'http://c1-si-odataapi.trafficmanager.net:8080/Advertiser/v2/$metadata#Tags',\r\n '@odata.count': 12,\r\n value: [\r\n {\r\n Id: 6302851,\r\n Name: 'xytestTag1',\r\n TrackingCode: '',\r\n IsPreferredTag: false,\r\n Owner: {\r\n Id: 257194955, Name: \"xytest\", Number: \"F10400ZC4Z\", Account: null,\r\n },\r\n },\r\n {\r\n Id: 1103231,\r\n Name: 'preferredTag',\r\n TrackingCode: '',\r\n IsPreferredTag: true,\r\n Owner: {\r\n Id: 257194955, Name: \"xytest\", Number: \"F10400ZC4Z\", Account: null,\r\n },\r\n },\r\n {\r\n Id: 104000491,\r\n Name: 'xytesttag111122',\r\n TrackingCode: '',\r\n IsPreferredTag: false,\r\n Owner: {\r\n Id: 257194955, Name: \"xytest\", Number: \"F10400ZC4Z\", Account: null,\r\n },\r\n },\r\n ],\r\n};\r\n","import classNames from 'classnames';\r\nimport React from 'react';\r\nimport PropTypes from 'prop-types';\r\nimport _ from 'underscore';\r\nimport { AccessibleTreeView } from '@bingads-webui-react/accessible-tree-view';\r\nimport { NodeProps } from '@bingads-webui-react/tree-view';\r\nimport { withDefaultStyles } from '@bingads-webui-react/with-default-styles';\r\nimport { getPageMenuStyles } from '../styles/page-menu-styles';\r\n\r\nclass PageMenu extends React.PureComponent {\r\n componentDidUpdate() {\r\n if (this.props.perfMarker &&\r\n !this.props.perfMarker.isDone\r\n ) {\r\n this.props.perfMarker.done();\r\n }\r\n }\r\n\r\n render() {\r\n const { classes } = this.props;\r\n\r\n return (\r\n \r\n {}}\r\n />\r\n \r\n );\r\n }\r\n}\r\n\r\nPageMenu.propTypes = {\r\n classes: PropTypes.shape(_.mapObject(\r\n getPageMenuStyles({}, {}),\r\n _.constant(PropTypes.string.isRequired)\r\n )).isRequired,\r\n treeNodes: PropTypes.arrayOf(NodeProps).isRequired,\r\n nodeChildRenderer: PropTypes.func.isRequired,\r\n perfMarker: PropTypes.shape({\r\n done: PropTypes.func.isRequired,\r\n isDone: PropTypes.bool.isRequired,\r\n }),\r\n ariaLabel: PropTypes.string,\r\n};\r\n\r\nPageMenu.defaultProps = {\r\n perfMarker: null,\r\n ariaLabel: '',\r\n};\r\n\r\nexport default withDefaultStyles(PageMenu, getPageMenuStyles);\r\n","import { getUetTagItemStyles } from './uet-tag-item-styles';\r\n\r\nexport const getPageMenuStyles = ({ pageMenu = {} }, { palette = {} }) => ({\r\n ...getUetTagItemStyles({ pageMenu }, { palette }),\r\n\r\n treeViewContainer: {\r\n position: 'relative',\r\n overflowY: 'auto',\r\n overflowX: 'hidden',\r\n height: 'calc(100vh - 200px) !important',\r\n color: '#f3f2f1',\r\n backgroundColor: '#fff',\r\n flex: '1 1 1px',\r\n maxHeight: 'calc(100vh - 160px)',\r\n '& .ReactVirtualized__Grid': {\r\n overflowY: 'hidden !important',\r\n '&:hover': {\r\n overflowY: 'visible !important',\r\n },\r\n '& .ReactVirtualized__Grid__innerScrollContainer': {\r\n overflow: 'hidden !important',\r\n '& .tree-node button': {\r\n background: '#fff !important',\r\n },\r\n },\r\n },\r\n },\r\n statusIconContainer: {\r\n width: 12,\r\n height: 12,\r\n marginLeft: 12,\r\n marginTop: 4,\r\n marginBottom: 12,\r\n marginRight: 12,\r\n },\r\n labelContainer: {\r\n color: palette.white,\r\n },\r\n});\r\n","import { getButtonFocusOverrideStyle } from '@bingads-webui-campaign-react/main-menu';\r\n\r\nexport const getUetTagItemStyles = (menuItem, { palette = {} }) => ({\r\n baseMenuItem: {\r\n height: 36,\r\n fontFamily: 'Segoe UI',\r\n fontWeight: 'normal',\r\n lineHeight: 'normal',\r\n display: 'flex',\r\n flexDirection: 'row',\r\n paddingLeft: 20,\r\n paddingRight: 10,\r\n border: 0,\r\n textDecoration: 'none',\r\n color: '#f3f2f1',\r\n backgroundColor: '#f3f2f1',\r\n alignItems: 'center',\r\n textAlign: 'left',\r\n borderRadius: 'unset',\r\n // menu item is using Button, but states' style should not act the same as Button.\r\n '& a': {\r\n color: palette.white,\r\n },\r\n '&:focus': getButtonFocusOverrideStyle(palette.neutralSecondary),\r\n '&:active': {\r\n '&:focus': {\r\n '&:after': {\r\n border: 0,\r\n },\r\n },\r\n },\r\n '& .spinner_label': {\r\n color: palette.white,\r\n },\r\n },\r\n normalMenuItem: {\r\n backgroundColor: '#f3f2f1 !important',\r\n '&:focus': {\r\n backgroundColor: palette.neutralLight,\r\n fontWeight: 'bold',\r\n },\r\n '&:hover': {\r\n backgroundColor: palette.neutralLight,\r\n fontWeight: 'bold',\r\n },\r\n },\r\n selectedMenuItem: {\r\n paddingLeft: 16,\r\n fontWeight: 'bold',\r\n backgroundColor: '#DEECF9 !important',\r\n borderLeft: `4px solid ${palette.themePrimary}`,\r\n alignSelf: 'stretch',\r\n },\r\n menuItemAnchor: {\r\n width: '98px',\r\n marginTop: 3,\r\n },\r\n iconContainer: {\r\n marginLeft: 8,\r\n marginTop: 2,\r\n marginBottom: 6,\r\n marginRight: 8,\r\n height: 16,\r\n fontSize: 16,\r\n color: palette.white,\r\n },\r\n textContainer: {\r\n display: 'inline-block',\r\n width: '100px',\r\n overflow: 'hidden',\r\n marginTop: 8,\r\n marginBottom: 9,\r\n textOverflow: 'ellipsis',\r\n flex: '1 1 1px',\r\n whiteSpace: 'nowrap',\r\n fontSize: 14,\r\n color: 'black',\r\n },\r\n typeSelectionIcon: {\r\n fontSize: 16,\r\n margin: '0px !important',\r\n top: '0px !important',\r\n },\r\n placeholderTextContainer: {\r\n marginLeft: 22,\r\n },\r\n});\r\n","import React from 'react';\r\nimport PropTypes from 'prop-types';\r\nimport classNames from 'classnames';\r\n\r\nexport const TextSpanWithForwardedRef = ({\r\n classes, node, forwardedRef,\r\n}) => {\r\n const textContainerClassNames = [classes.textContainer];\r\n\r\n return (\r\n \r\n {node.Name}\r\n \r\n );\r\n};\r\n\r\nTextSpanWithForwardedRef.propTypes = {\r\n classes: PropTypes.shape({\r\n textContainer: PropTypes.string.isRequired,\r\n }).isRequired,\r\n node: PropTypes.shape({\r\n Name: PropTypes.string.isRequired,\r\n entityType: PropTypes.string.isRequired,\r\n TrackingStatus: PropTypes.string,\r\n }).isRequired,\r\n forwardedRef: PropTypes.shape({ current: PropTypes.instanceOf(Element) }),\r\n};\r\n\r\nTextSpanWithForwardedRef.defaultProps = {\r\n forwardedRef: null,\r\n};\r\n","import classNames from 'classnames';\r\nimport PropTypes from 'prop-types';\r\nimport React from 'react';\r\nimport { Glyphicon, Button } from '@bingads-webui-react/primitive';\r\nimport { withOverflowProp } from '@bingads-webui-react/with-overflow-prop';\r\nimport { QueryParam, withScope } from '@bingads-webui-react/scope-service';\r\nimport { GetNodeClassNames } from '@bingads-webui-campaign-react/main-menu';\r\nimport { TextSpanWithForwardedRef } from './text-span-with-forwarded-ref';\r\n\r\nfunction getNodeText(scope, classes, node, forwardedRef) {\r\n function getNodeUrl() {\r\n const { location, processor, allowedKeys } = scope || {};\r\n const params = new QueryParam(location, null, null, processor, allowedKeys);\r\n params.append({ tagId: node.Id });\r\n return location && location.pathname ? `${location.pathname}?${params.stringify()}` : null;\r\n }\r\n\r\n // disable clicking on links, only allow to open in new tabs/windows\r\n function onClick(e) {\r\n if (e && e.preventDefault) {\r\n e.preventDefault();\r\n }\r\n }\r\n\r\n function getNodeTextImpl() {\r\n return (\r\n \r\n );\r\n }\r\n\r\n const nodeUrl = getNodeUrl(node, location);\r\n const nodeText = getNodeTextImpl(classes, node, forwardedRef);\r\n\r\n return nodeUrl\r\n ? ({nodeText})\r\n : nodeText;\r\n}\r\n\r\nconst UetTagsTreeNodeWithTooltip = ({\r\n classes, node, forwardedRef, scope,\r\n}) => {\r\n const nodeClasses = [GetNodeClassNames(node, classes), 'main-menu-tree-node', 'uet-tree-node'];\r\n\r\n const iconContainerClassName = classNames([\r\n classes.iconContainer,\r\n classes.statusIconContainer]);\r\n\r\n const iconStatusClassName = classes.uetTagStatusIcon;\r\n\r\n const uetTagGlyphIcon = ((node.TrackingStatus === 'Unverified' || node.TrackingStatus === 'Inactive') && !node.IsReadOnly) ? 'ba-Warning' : '';\r\n const changeUrl = () => {\r\n scope.append({\r\n tagId: node.Id,\r\n });\r\n scope.save();\r\n };\r\n\r\n return (\r\n \r\n { changeUrl(); }}\r\n btnStyle=\"command\"\r\n className={classNames(nodeClasses)}\r\n key={node.Id}\r\n id={`id-${node.Id}`}\r\n title={node.Name}\r\n >\r\n {getNodeText(scope, classes, node, forwardedRef)}\r\n
    \r\n \r\n
    \r\n \r\n
    \r\n );\r\n};\r\n\r\nUetTagsTreeNodeWithTooltip.propTypes = {\r\n classes: PropTypes.shape({\r\n baseMenuItem: PropTypes.string.isRequired,\r\n textContainer: PropTypes.string.isRequired,\r\n iconContainer: PropTypes.string.isRequired,\r\n uetTagStatusIcon: PropTypes.string.isRequired,\r\n hiddenTooltip: PropTypes.string.isRequired,\r\n }).isRequired,\r\n node: PropTypes.shape({\r\n Id: PropTypes.oneOfType([\r\n PropTypes.string,\r\n PropTypes.number,\r\n ]).isRequired,\r\n Name: PropTypes.string.isRequired,\r\n entityType: PropTypes.string.isRequired,\r\n TrackingStatus: PropTypes.string,\r\n IsReadOnly: PropTypes.bool,\r\n isSelected: PropTypes.bool,\r\n }).isRequired,\r\n forwardedRef: PropTypes.shape({ current: PropTypes.instanceOf(Element) }),\r\n scope: PropTypes.instanceOf(QueryParam).isRequired,\r\n};\r\n\r\nUetTagsTreeNodeWithTooltip.defaultProps = {\r\n forwardedRef: null,\r\n};\r\n\r\nexport default withScope(withOverflowProp(UetTagsTreeNodeWithTooltip));\r\n","import classNames from 'classnames';\r\nimport PropTypes from 'prop-types';\r\nimport React from 'react';\r\nimport { StyledSpinnerWithLabel } from '@bingads-webui-campaign-react/shell-ui-common';\r\nimport UetTagsTreeNodeWithTooltip from './uet-tags-tree-node-with-tooltip';\r\n\r\nconst UetTagTreeNode = ({\r\n classes, node,\r\n}) => {\r\n if (node.isPlaceholderNode) {\r\n if (node.isLoadingData) {\r\n return (\r\n
    \r\n \r\n
    \r\n );\r\n }\r\n\r\n const rootPlaceholderNodeTextContainerClassName = classNames([\r\n 'uet-tag-tree-node-place-holder',\r\n classes.textContainer,\r\n classes.placeholderTextContainer,\r\n ]);\r\n\r\n return (\r\n
    \r\n \r\n {node.Name}\r\n \r\n
    \r\n );\r\n }\r\n\r\n return (\r\n \r\n );\r\n};\r\n\r\nUetTagTreeNode.propTypes = {\r\n classes: PropTypes.shape({\r\n baseMenuItem: PropTypes.string.isRequired,\r\n textContainer: PropTypes.string.isRequired,\r\n placeholderTextContainer: PropTypes.string.isRequired,\r\n iconContainer: PropTypes.string.isRequired,\r\n rootNodeSpinnerContainer: PropTypes.string.isRequired,\r\n hiddenTooltip: PropTypes.string.isRequired,\r\n }).isRequired,\r\n node: PropTypes.shape({\r\n Id: PropTypes.oneOfType([\r\n PropTypes.string,\r\n PropTypes.number,\r\n ]).isRequired,\r\n Name: PropTypes.string.isRequired,\r\n entityType: PropTypes.string.isRequired,\r\n TrackingStatus: PropTypes.string,\r\n isSelected: PropTypes.bool,\r\n isPlaceholderNode: PropTypes.bool,\r\n isLoadingData: PropTypes.bool,\r\n }).isRequired,\r\n};\r\n\r\nexport function UetTagTreeNodeChildRenderer(classes) {\r\n return node => (\r\n \r\n );\r\n}\r\n","import React from 'react';\r\nimport PropTypes from 'prop-types';\r\nimport { Button } from '@bingads-webui-react/primitive';\r\nimport { getRoutePathById } from '@bingads-webui-campaign-react/with-site-map';\r\nimport { withScope, QueryParam } from '@bingads-webui-react/scope-service';\r\nimport { withI18nConsumer } from '@bingads-webui-react/i18n-context';\r\n// eslint-disable-next-line import/no-unresolved\r\nimport { withServerContext } from '@bingads-webui-campaign-react/server-context';\r\nimport { getTags } from './uet-tags-repository';\r\nimport PageMenu from './page-menu';\r\nimport { UetTagTreeNodeChildRenderer } from './uet-tags-tree-node';\r\n\r\nclass UetTagsPageMenuInternal extends React.Component {\r\n constructor(props) {\r\n super(props);\r\n this.state = {\r\n tags: [],\r\n siteMap: props.siteMap,\r\n };\r\n }\r\n\r\n componentDidMount() {\r\n const { aid, cid: scopeCid } = this.props.scope.values;\r\n const { CurrentAccount } = this.props.serverContext;\r\n const cid = aid ? CurrentAccount.AdvertiserCustomerID : scopeCid;\r\n\r\n getTags(cid, aid).then((response) => {\r\n const Inactive = response.filter(tag => tag.TrackingStatus === 'Inactive' && !tag.IsReadOnly).sort((a, b) => a.Name.localeCompare(b.Name));\r\n const Unverified = response.filter(tag => tag.TrackingStatus === 'Unverified' && !tag.IsReadOnly).sort((a, b) => a.Name.localeCompare(b.Name));\r\n const Active = response.filter(tag => tag.TrackingStatus === 'Active' || tag.IsReadOnly).sort((a, b) => a.Name.localeCompare(b.Name));\r\n const tag = Inactive.concat(Unverified).concat(Active);\r\n this.setState({ tags: tag });\r\n });\r\n }\r\n\r\n getTreeNodesProps() {\r\n const uetTagsInTree =\r\n this.state.tags.map(tag => ({\r\n ...tag,\r\n iconHidden: true,\r\n isSelected: this.props.scope.values.tagId === tag.Id,\r\n hideFallback: () => this.setState({}),\r\n }));\r\n\r\n return {\r\n uetTagsInTree,\r\n };\r\n }\r\n\r\n render() {\r\n const {\r\n uetTagsInTree,\r\n } = this.getTreeNodesProps();\r\n\r\n const updateUrl = () => {\r\n this.props.scope.remove('tagId');\r\n this.props.scope.save();\r\n\r\n const queryParam = new QueryParam(this.props.scope.history.location, this.props.scope.history);\r\n this.props.scope.history.push({\r\n pathname: getRoutePathById(this.state.siteMap, 'uet-tag'),\r\n search: queryParam.stringify(),\r\n });\r\n };\r\n\r\n return (\r\n
    \r\n { updateUrl(); }}\r\n style={{\r\n width: 164,\r\n textAlign: 'left',\r\n backgroundColor: '#fff',\r\n borderTop: 0,\r\n borderLeft: 0,\r\n borderBottom: 0,\r\n borderRight: 'solid 1px #e1dfdd',\r\n fontWeight: 'normal',\r\n outline: 'none',\r\n }}\r\n >{this.props.i18n.getString(_TL_('All tags'))}\r\n \r\n
    \r\n \r\n
    \r\n );\r\n }\r\n}\r\n\r\nUetTagsPageMenuInternal.propTypes = {\r\n serverContext: PropTypes.shape({\r\n CurrentAccount: PropTypes.shape({\r\n AdvertiserCustomerID: PropTypes.number,\r\n }).isRequired,\r\n }),\r\n i18n: PropTypes.shape({\r\n getString: PropTypes.func,\r\n }).isRequired,\r\n permissions: PropTypes.shape({\r\n dynamic: PropTypes.shape({\r\n UETDashboard: PropTypes.bool.isRequired,\r\n }),\r\n }).isRequired,\r\n scope: PropTypes.instanceOf(QueryParam).isRequired,\r\n siteMap: PropTypes.shape({}).isRequired,\r\n perfMarker: PropTypes.isRequired,\r\n};\r\n\r\nUetTagsPageMenuInternal.defaultProps = {\r\n serverContext: {},\r\n};\r\n\r\nexport const UetTagsPageMenu = withServerContext(withI18nConsumer(withScope(UetTagsPageMenuInternal)));\r\n","import { edmCampaign } from '@bingads-webui/edm-campaign';\r\nimport { mockedTags } from './mock-data';\r\n\r\nexport const getTags = (cid, aid) => {\r\n if (cid && aid) {\r\n return edmCampaign\r\n .Customers.$withKey(cid)\r\n .Accounts.$withKey(aid)\r\n .Tags\r\n .get({\r\n top: 200,\r\n select: ['Id', 'Name', 'TrackingStatus', 'IsReadOnly'],\r\n }).toPromise().then((tagResponse) => {\r\n if (tagResponse && tagResponse.value) {\r\n if (tagResponse.value.length > 0) {\r\n return tagResponse.value;\r\n }\r\n return [];\r\n }\r\n\r\n return [];\r\n });\r\n } else if (cid) {\r\n return edmCampaign\r\n .Customers.$withKey(cid)\r\n .Tags\r\n .get({\r\n top: 200,\r\n select: ['Id', 'Name', 'TrackingStatus', 'IsReadOnly'],\r\n }).toPromise().then((tagResponse) => {\r\n if (tagResponse && tagResponse.value) {\r\n if (tagResponse.value.length > 0) {\r\n return tagResponse.value;\r\n }\r\n return [];\r\n }\r\n\r\n return [];\r\n });\r\n }\r\n return new Promise((resolve) => {\r\n resolve(mockedTags.value);\r\n });\r\n};\r\n","\r\nexport const getStyles = () => ({\r\n\r\n});\r\n","import React, { useContext } from 'react';\r\nimport { DirectionalHint } from '@fluentui/react';\r\nimport { Body1, Image } from '@fluentui/react-components';\r\nimport { I18nContext } from '@bingads-webui-react/i18n-context';\r\nimport { useDefaultStyles } from '@bingads-webui-react/with-default-styles';\r\nimport { defaultUserGovernanceConfig } from '@bingads-webui-campaign-react/multi-step-teaching-bubble';\r\nimport { getRoutePathById } from '@bingads-webui-campaign-react/with-site-map';\r\n\r\nimport { getStyles } from './styles';\r\nimport CreateReportFreImg from './media/create-report.png';\r\nimport CustomizeColumnFreImg from './media/customize-column.png';\r\nimport SaveReportFreImg from './media/save-report.png';\r\n\r\nconst CreateReportFreContent = () => {\r\n const classes = useDefaultStyles(getStyles);\r\n const i18n = useContext(I18nContext);\r\n\r\n return (\r\n
    \r\n \r\n
    \r\n {i18n.getString(_TL_('Build a custom report from scratch by choosing the breakdowns and metrics you need using the column modifier. You can customize any report to align with your specific account requirements.'))}\r\n
    \r\n
    );\r\n};\r\n\r\nconst CustomizeColumnsFreContent = () => {\r\n const classes = useDefaultStyles(getStyles);\r\n const i18n = useContext(I18nContext);\r\n\r\n return (\r\n
    \r\n \r\n
    \r\n {i18n.getString(_TL_('Use the column modifier to add, reorder, or remove breakdowns and metrics, which are now conveniently sub-categorized.'))}\r\n
      \r\n
    • {i18n.getString(_TL_('Metrics are the key performance indicators you are interested in, like impressions, clicks, or conversions, for example.'))}
    • \r\n
    • {i18n.getString(_TL_('Breakdowns are the categories you want to group performance by, like device type, region, or campaign type, for example.'))}
    • \r\n
    \r\n
    \r\n
    );\r\n};\r\n\r\nconst SaveReportFreContent = () => {\r\n const classes = useDefaultStyles(getStyles);\r\n const i18n = useContext(I18nContext);\r\n\r\n return (\r\n
    \r\n \r\n
    \r\n {i18n.getString(_TL_('Save your custom report to both your user profile and the account to make it accessible across all the accounts you manage. This way, if you manage multiple accounts, you can easily reuse this report template in each one.'))}\r\n
    \r\n
    );\r\n};\r\n\r\nexport const ReportHomePageTeachingBubbleConfig = {\r\n featureName: 'report-home-page',\r\n userGovernanceConfig: defaultUserGovernanceConfig,\r\n steps: [\r\n {\r\n title: _TL_('Create a new report'),\r\n content: ,\r\n primaryButtonText: _TL_('Try now'),\r\n secondaryButtonText: _TL_('Try later'),\r\n targetElement: '.reporting-landing-page #button-create',\r\n directionalHint: DirectionalHint.rightCenter,\r\n onNext: (_scope, _siteMap) => {\r\n _scope.save(getRoutePathById(_siteMap, 'reporting-build-custom-report'));\r\n },\r\n },\r\n ],\r\n};\r\n\r\nexport const CustomReportBuilderTeachingBubbleConfig = {\r\n featureName: 'custom-report-builder',\r\n userGovernanceConfig: defaultUserGovernanceConfig,\r\n steps: [\r\n {\r\n title: _TL_('Customize your columns'),\r\n content: ,\r\n primaryButtonText: _TL_('Next'),\r\n secondaryButtonText: _TL_('Remind me later'),\r\n targetElement: '.breakdown-container button',\r\n directionalHint: DirectionalHint.rightCenter,\r\n },\r\n {\r\n title: _TL_('Save and share your custom report'),\r\n content: ,\r\n primaryButtonText: _TL_('Done'),\r\n secondaryButtonText: _TL_('Remind me later'),\r\n targetElement: '#SaveAsButton .fui-SplitButton__primaryActionButton',\r\n directionalHint: DirectionalHint.leftCenter,\r\n },\r\n ],\r\n};\r\n","import React, { useContext, useEffect } from 'react';\r\nimport {\r\n triggerMultiStepTeachingBubbleWithLock,\r\n MultiStepTeachingBubbleContext,\r\n} from '@bingads-webui-campaign-react/multi-step-teaching-bubble';\r\nimport { CustomReportBuilderTeachingBubbleConfig, ReportHomePageTeachingBubbleConfig } from './teaching-bubble-configs';\r\n\r\nexport const ReportHomePageBubbleRenderer = () => {\r\n const bubbleContext = useContext(MultiStepTeachingBubbleContext);\r\n\r\n useEffect(() => {\r\n triggerMultiStepTeachingBubbleWithLock({\r\n ...bubbleContext,\r\n featureName: ReportHomePageTeachingBubbleConfig.featureName,\r\n });\r\n }, [bubbleContext]);\r\n\r\n return
    ;\r\n};\r\n\r\nexport const CustomReportBuilderBubbleRenderer = () => {\r\n const bubbleContext = useContext(MultiStepTeachingBubbleContext);\r\n\r\n useEffect(() => {\r\n triggerMultiStepTeachingBubbleWithLock({\r\n ...bubbleContext,\r\n featureName: CustomReportBuilderTeachingBubbleConfig.featureName,\r\n });\r\n }, [bubbleContext]);\r\n\r\n return
    ;\r\n};\r\n","var pug = require(\"!../../../../../../node_modules/.pnpm/pug@2.0.4/node_modules/pug-runtime/index.js\");\n\nfunction template(locals) {var pug_html = \"\", pug_mixins = {}, pug_interp;pug_html = pug_html + \"\\u003Cinput id=\\\"countdowndatepicker\\\" aria-labelledby=\\\"CountdownEditor-CountdownEnds-Label\\\" aria-describedby=\\\"CountdownEditor-CountdownEndsDate-Remaining\\\"\\u003E\";;return pug_html;};\nmodule.exports = template;","var pug = require(\"!../../../../../../node_modules/.pnpm/pug@2.0.4/node_modules/pug-runtime/index.js\");\n\nfunction template(locals) {var pug_html = \"\", pug_mixins = {}, pug_interp;;var locals_for_with = (locals || {});(function (i18n, showLanguage) {pug_mixins[\"popupHelp\"] = pug_interp = function(popupId, ariaLabelContext, arialLabelText){\nvar block = (this && this.block), attributes = (this && this.attributes) || {};\npug_html = pug_html + \"\\u003Ca\" + (\" class=\\\"helpbutton\\\"\"+\" type=\\\"helppopup\\\"\"+pug.attr(\"topic\", popupId, true, true)+pug.attr(\"data-help\", true, true, true)+\" onclick=\\\"PopupController.PopupJsClick(this)\\\" href=\\\"javascript:void(0);\\\"\"+pug.attr(\"aria-label\", (arialLabelText || 'Learn more') + ' ' + (ariaLabelContext || ''), true, true)) + \"\\u003E\\u003C\\u002Fa\\u003E\";\n};\npug_html = pug_html + \"\\u003Cform class=\\\"form-horizontal form-grid\\\"\\u003E\\u003Cdiv class=\\\"flexible-grid-row-1 form-label control-label\\\"\\u003E\\u003Clabel id=\\\"CountdownEditor-CountdownEnds-Label\\\"\\u003E\" + (pug.escape(null == (pug_interp = i18n.getString('CountdownEditor_CountdownEnds_Label')) ? \"\" : pug_interp)) + \"\\u003C\\u002Flabel\\u003E\\u003Cspan class=\\\"sr-only\\\" id=\\\"CountdownEditor-CountdownEndsDate-Remaining\\\"\\u003E\" + (pug.escape(null == (pug_interp = i18n.getString('CountdownEditor_CountdownEndsDate_Label')) ? \"\" : pug_interp)) + \"\\u003C\\u002Fspan\\u003E\\u003Cspan class=\\\"sr-only\\\" id=\\\"CountdownEditor-CountdownEnds-Remaining\\\"\\u003E\" + (pug.escape(null == (pug_interp = i18n.getString('CountdownEditor_CountdownEndsTime_Label')) ? \"\" : pug_interp)) + \"\\u003C\\u002Fspan\\u003E\";\npug_mixins[\"popupHelp\"]('pop_BA_NewAdCreate_Countdown_End', '', i18n.getString('CountdownEditor_CountdownEnds_Tooltip'));\npug_html = pug_html + \"\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"form-input-container flexible-grid-row-1 form-date\\\" data-property=\\\"date\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"form-input-container flexible-grid-row-1 form-time\\\" data-property=\\\"time\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cspan class=\\\"flexible-grid-row-1 form-time-format countdownEditor-description\\\"\\u003E\" + (pug.escape(null == (pug_interp = i18n.getString('CountdownEditor_TimeFormat_Description')) ? \"\" : pug_interp)) + \"\\u003C\\u002Fspan\\u003E\\u003Cdiv class=\\\"form-validation-container flexible-grid-row-2 form-validation\\\" data-property=\\\"date\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"form-validation-container flexible-grid-row-3 form-validation\\\" data-property=\\\"time\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"flexible-grid-row-4 form-label control-label\\\"\\u003E\\u003Clabel id=\\\"CountdownEditor_CountdownStarts-Label\\\"\\u003E\" + (pug.escape(null == (pug_interp = i18n.getString('CountdownEditor_CountdownStarts_Label')) ? \"\" : pug_interp)) + \"\\u003C\\u002Flabel\\u003E\";\npug_mixins[\"popupHelp\"]('pop_BA_NewAdCreate_Countdown_Start', '', i18n.getString('CountdownEditor_CountdownStarts_Tooltip'));\npug_html = pug_html + \"\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"form-input-container flexible-grid-row-4 form-days\\\" data-property=\\\"days\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cspan class=\\\"flexible-grid-row-4 form-days-description countdownEditor-description\\\"\\u003E\" + (pug.escape(null == (pug_interp = i18n.getString('CountdownEditor_DaysBefore_Description')) ? \"\" : pug_interp)) + \"\\u003C\\u002Fspan\\u003E\\u003Cdiv class=\\\"form-validation-container flexible-grid-row-5 form-validation\\\" data-property=\\\"days\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"flexible-grid-row-6 form-label control-label\\\"\\u003E\\u003Clabel id=\\\"CountdownEditor-TimeZone-Label\\\"\\u003E\" + (pug.escape(null == (pug_interp = i18n.getString('CountdownEditor_TimeZone_Label')) ? \"\" : pug_interp)) + \"\\u003C\\u002Flabel\\u003E\";\npug_mixins[\"popupHelp\"]('pop_BA_NewAdCreate_Countdown_TimeZone', '', i18n.getString('CountdownEditor_TimeZone_Tooltip'));\npug_html = pug_html + \"\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"form-input-container flexible-grid-row-6 form-time-zone\\\" data-property=\\\"isGlobal\\\"\\u003E\\u003C\\u002Fdiv\\u003E\";\nif (showLanguage) {\npug_html = pug_html + \"\\u003Cdiv class=\\\"flexible-grid-row-7 form-label control-label\\\"\\u003E\\u003Clabel id=\\\"CountdownEditor-Language-Label\\\"\\u003E\" + (pug.escape(null == (pug_interp = i18n.getString('CountdownEditor_Language_Label')) ? \"\" : pug_interp)) + \"\\u003C\\u002Flabel\\u003E\";\npug_mixins[\"popupHelp\"]('pop_BA_NewAdCreate_Countdown_Language', '', i18n.getString('CountdownEditor_Language_Tooltip'));\npug_html = pug_html + \"\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"form-input-container flexible-grid-row-7 form-language\\\" data-property=\\\"language\\\"\\u003E\\u003C\\u002Fdiv\\u003E\";\n}\npug_html = pug_html + \"\\u003Cdiv class=\\\"form-validation-container flexible-grid-row-8 form-validation\\\" data-property=\\\"$overall\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"form-input-container flexible-grid-row-9 form-buttons\\\" data-property=\\\"$buttons\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fform\\u003E\";}.call(this,\"i18n\" in locals_for_with?locals_for_with.i18n:typeof i18n!==\"undefined\"?i18n:undefined,\"showLanguage\" in locals_for_with?locals_for_with.showLanguage:typeof showLanguage!==\"undefined\"?showLanguage:undefined));;return pug_html;};\nmodule.exports = template;","var pug = require(\"!../../../../../../node_modules/.pnpm/pug@2.0.4/node_modules/pug-runtime/index.js\");\n\nfunction template(locals) {var pug_html = \"\", pug_mixins = {}, pug_interp;;var locals_for_with = (locals || {});(function (appendLearnMoreLink, i18n) {pug_html = pug_html + \"\\u003Cdiv class=\\\"audience__association\\\"\\u003E\\u003Cdiv class=\\\"association__setting\\\" data-bind=\\\"visible: isAssocExpanded()\\\"\\u003E\\u003Cdiv class=\\\"association__body\\\"\\u003E\\u003Cdiv class=\\\"form-horizontal\\\"\\u003E\\u003Cdiv class=\\\"row\\\"\\u003E\\u003Cdiv class=\\\"col-sm-12\\\"\\u003E\\u003Cdiv class=\\\"DMP_doublelistbox_section\\\"\\u003E\\u003C!-- ko foreach: configSettings--\\u003E\\u003Cdiv class=\\\"dmp\\\"\\u003E\\u003Cdiv class=\\\"associationDoubleListBoxControl\\\" data-bind=\\\" attr: { "id": "targeting-" + $data.type }, visible: $data.targeting.isSelected(), doubleListBox: $data.targeting.selectedLists, dlbData: { sourceItems: $data.targeting.listDataCallback, itemIdField: "Id", selectedPageSize: 10, pageSize: 11, useCallbackForFetchOnly: true, emptyMessageClick: $data.emptyMessageClick, }, dlbItemActions: {}, dlbProcessItem: $data.targeting.processItem, dlbFeatures: { selectAll: true, deselectAll: true, filtering: true, dragAndDrop: false, paging: $data.paging, treeView: $data.treeView, extraOptions: $data.extraOptions, extraEvents: $data.extraEvents, }, dlbTemplates: $data.templates, dlbStrings: $data.strings, dlbCustomData: { visible: $parent.isNewAudienceEnabled, value: $parent.selectedCategory, options: $parent.configSettingsOptions(), }, \\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C!-- \\u002Fko--\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"col-sm-12 noListSelectedError\\\"\\u003E\\u003Cdiv class=\\\"form-group\\\" data-bind=\\\"visible:showError()\\\"\\u003E\\u003C!-- ko foreach: errors--\\u003E\\u003Cdiv class=\\\"alert\\\" id=\\\"doubleListBoxSelectErrorLabel\\\" role=\\\"alert\\\" data-bind=\\\"css: {'alert-danger': $data.property.isCritical, 'alert-warning': !$data.property.isCritical}\\\"\\u003E\\u003Cspan class=\\\"alert-image\\\" data-bind=\\\"visible: !$data.property.isCritical\\\"\\u003E\\u003C\\u002Fspan\\u003E\\u003Cdiv data-bind=\\\"html: $data.getErrorWithLearnMore()\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C!-- \\u002Fko--\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"audience__exclusion\\\"\\u003E\\u003Cdiv class=\\\"exclusion__setting\\\" data-bind=\\\"visible: isExclExpanded()\\\"\\u003E\\u003Cdiv class=\\\"exclusion__header\\\"\\u003E\\u003Ch5 class=\\\"type-bold\\\"\\u003E\\u003Cspan class=\\\"icon-left glyphicon glyphicon-offset-left5 icon-status-exclude\\\"\\u003E\\u003C\\u002Fspan\\u003E\\u003Cspan\\u003E\" + (pug.escape(null == (pug_interp = i18n.get('Audience_Dashboard_Target_Setting_Audience_Exclude_Link')) ? \"\" : pug_interp)) + \"\\u003C\\u002Fspan\\u003E\\u003C\\u002Fh5\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"exclusion__body\\\"\\u003E\\u003Cdiv class=\\\"form-horizontal\\\"\\u003E\\u003Cdiv class=\\\"row\\\"\\u003E\\u003Cdiv class=\\\"col-sm-12\\\"\\u003E\\u003Cdiv class=\\\"DMP_doublelistbox_section\\\"\\u003E\\u003C!-- ko foreach: configSettings--\\u003E\\u003Cdiv class=\\\"dmp\\\"\\u003E\\u003Cdiv class=\\\"exclusionDoubleListBoxControl\\\" data-bind=\\\" attr: { "id": "exclusion-" + $data.type }, visible: $data.exclusion.isSelected(), doubleListBox: $data.exclusion.selectedLists, dlbData: { sourceItems: $data.exclusion.listDataCallback, itemIdField: "Id", selectedPageSize: 10, pageSize: 11, useCallbackForFetchOnly: true, }, dlbItemActions: {}, dlbProcessItem: $data.exclusion.processItem, dlbFeatures: { selectAll: true, deselectAll: true, filtering: true, dragAndDrop: false, paging: $data.paging, treeView: $data.treeView, extraOptions: $data.extraOptions, extraEvents: $data.extraEvents, }, dlbTemplates: $data.templates, dlbStrings: $data.strings, dlbCustomData: { visible: $parent.isNewAudienceEnabled, value: $parent.excludeSelectedCategory, options: $parent.configSettingsOptions(), }, \\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C!-- \\u002Fko--\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"col-sm-12 custom_audience_restriction\\\" href=\\\"javascript:void(0);\\\" data-bind=\\\"visible: isCustomRestrictionDisplayedOnExclusion()\\\"\\u003E\\u003Cdiv class=\\\"form-group\\\"\\u003E\\u003Clabel class=\\\"checkbox-label\\\" id=\\\"customRestrictionLabel\\\"\\u003E\\u003Cinput name=\\\"\\\" type=\\\"checkbox\\\" data-bind=\\\"checked: $root.customRestrictionAccepted\\\"\\u003E\\u003Cspan\\u003E\" + (null == (pug_interp = appendLearnMoreLink(i18n.get('AudiencesAssociation_Custom_RestrictionMessage'), 'app54627')) ? \"\" : pug_interp) + \"\\u003C\\u002Fspan\\u003E\\u003Cdiv class=\\\"error\\\" role=\\\"alert\\\" data-bind=\\\"visible: isCustomRestrictionNotAcceptedOnExclusion()\\\"\\u003E\" + (pug.escape(null == (pug_interp = i18n.get('AudiencesAssociation_Custom_RestrictionError')) ? \"\" : pug_interp)) + \"\\u003C\\u002Fdiv\\u003E\\u003C\\u002Flabel\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"col-sm-12 noListSelectedError\\\"\\u003E\\u003Cdiv class=\\\"form-group\\\" data-bind=\\\"visible:showError()\\\"\\u003E\\u003C!-- ko foreach: errors--\\u003E\\u003Cdiv class=\\\"alert\\\" id=\\\"doubleListBoxSelectErrorLabel\\\" role=\\\"alert\\\" data-bind=\\\"css: {'alert-danger': $data.property.isCritical, 'alert-warning': !$data.property.isCritical}\\\"\\u003E\\u003Cspan class=\\\"alert-image\\\" data-bind=\\\"visible: !$data.property.isCritical\\\"\\u003E\\u003C\\u002Fspan\\u003E\\u003Cdiv data-bind=\\\"html: $data.getErrorWithLearnMore()\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C!-- \\u002Fko--\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\";}.call(this,\"appendLearnMoreLink\" in locals_for_with?locals_for_with.appendLearnMoreLink:typeof appendLearnMoreLink!==\"undefined\"?appendLearnMoreLink:undefined,\"i18n\" in locals_for_with?locals_for_with.i18n:typeof i18n!==\"undefined\"?i18n:undefined));;return pug_html;};\nmodule.exports = template;","var pug = require(\"!../../../../../../node_modules/.pnpm/pug@2.0.4/node_modules/pug-runtime/index.js\");\n\nfunction template(locals) {var pug_html = \"\", pug_mixins = {}, pug_interp;pug_html = pug_html + \"\\u003Cdiv class=\\\"doubleListBox layout-columns iff-audience-selector-double-list-box\\\"\\u003E\\u003Cdiv class=\\\"layout-columns-container row\\\"\\u003E\\u003Cdiv class=\\\"layout-columns-element col-sm-6\\\"\\u003E\\u003Cdiv class=\\\"row\\\"\\u003E\\u003Cdiv class=\\\"col-sm-12\\\"\\u003E\\u003Cdiv class=\\\"panel-form noPadding\\\"\\u003E\\u003Cdiv class=\\\"panel-heading\\\"\\u003E\\u003Cdiv class=\\\"dmp_select_section\\\" data-bind=\\\"visible: customData.visible\\\"\\u003E\\u003Cselect class=\\\"form-control\\\" data-bind=\\\" options: customData.options, value: customData.value, optionsText: "text", optionsValue: "value", attr: {"aria-label" : strings.selectCategoryLabel}, \\\"\\u003E\\u003C\\u002Fselect\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"panel-body\\\"\\u003E\\u003Cdiv class=\\\"layout-columns-element\\\" data-bind=\\\"visible: features.filtering || showMaximumSelectionAlert\\\"\\u003E\\u003Cdiv data-bind=\\\"visible: features.filtering\\\"\\u003E\\u003Cdiv class=\\\"dlb-filter-alignPlaceholder\\\"\\u003E\\u003Cdiv data-bind=\\\"searchbox: filterText, defaultText:strings.filterWatermark, visible: features.filtering\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"search-result live-region\\\" role=\\\"status\\\" aria-live=\\\"assertive\\\" data-bind=\\\"attr: { "aria-label": ariaLiveResultsText, visible: features.filtering }\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv data-bind=\\\"visible: showMaximumSelectionAlert\\\"\\u003E\\u003Cdiv class=\\\"alert alert-info\\\"\\u003E\\u003Cspan data-bind=\\\"text: strings.maximumSelectionAlertString\\\"\\u003E\\u003C\\u002Fspan\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"form-group\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"dlb-source-container\\\" data-bind=\\\"visible: !showEmptyMessage()\\\"\\u003E\\u003Cdiv class=\\\"dlb-source-summary\\\"\\u003E\\u003Ch5 class=\\\"type-bold\\\"\\u003E\\u003Cspan data-bind=\\\"text : strings.sourceItems\\\"\\u003E\\u003C\\u002Fspan\\u003E\\u003Cspan\\u003E:  \\u003C\\u002Fspan\\u003E\\u003Cspan data-bind=\\\"text: sourceItemsCount\\\"\\u003E\\u003C\\u002Fspan\\u003E\\u003C\\u002Fh5\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"dlb-source-header\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"dlb-selectAll clickable\\\" data-bind=\\\"visible: features.selectAll, click: selectAll, attr: {"aria-label": strings.selectAll}\\\" tabindex=\\\"0\\\" role=\\\"button\\\"\\u003E\\u003Cspan data-bind=\\\"text: strings.selectAll\\\"\\u003E\\u003C\\u002Fspan\\u003E\\u003Ca class=\\\"enabled arrow-button\\\"\\u003E\\u003C\\u002Fa\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"dlb-source dlb-source-list\\\" data-bind=\\\"attr: {'aria-label' : strings.sourceItems}\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"dlb-source-footer\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"dlb-emptyMessage\\\" data-bind=\\\"visible: showEmptyMessage()\\\"\\u003E\\u003Cp data-bind=\\\"text: strings.emptyMessage\\\"\\u003E\\u003C\\u002Fp\\u003E\\u003C!-- ko if: emptyMessageVisible() --\\u003E\\u003Cp class=\\\"empty-message-action\\\"\\u003E\\u003Cspan data-bind=\\\"text: strings.emptyMessageAction.prefix\\\"\\u003E\\u003C\\u002Fspan\\u003E\\u003Ca data-bind=\\\"text: strings.emptyMessageAction.link, click: emptyMessageClick\\\"\\u003E\\u003C\\u002Fa\\u003E\\u003Cspan data-bind=\\\"text: strings.emptyMessageAction.suffix\\\"\\u003E\\u003C\\u002Fspan\\u003E\\u003C\\u002Fp\\u003E\\u003C!-- \\u002Fko --\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"dlb-pager-container\\\" data-bind=\\\"visible: features.paging\\\"\\u003E\\u003Cdiv class=\\\"pager-container\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"layout-columns-element col-sm-6\\\"\\u003E\\u003Cdiv class=\\\"row non-empty\\\"\\u003E\\u003Cdiv class=\\\"col-sm-12\\\"\\u003E\\u003Cdiv class=\\\"panel-form noPadding\\\"\\u003E\\u003Cdiv class=\\\"panel-heading\\\"\\u003E\\u003Ch5 class=\\\"type-bold\\\"\\u003E\\u003Cspan class=\\\"selectedItemsHeader\\\" data-bind=\\\"text: strings.selectedItems\\\"\\u003E\\u003C\\u002Fspan\\u003E\\u003Cspan class=\\\"headerDelimiter\\\"\\u003E:  \\u003C\\u002Fspan\\u003E\\u003Cspan class=\\\"selectedItemsCount\\\" data-bind=\\\"text: selectedItemsCount\\\"\\u003E\\u003C\\u002Fspan\\u003E\\u003Cspan class=\\\"headerDelimiter\\\"\\u003E \\u003C\\u002Fspan\\u003E\\u003Cspan class=\\\"selectedItemsHeader\\\" data-bind=\\\"text: strings.maxSelectedItems\\\"\\u003E\\u003C\\u002Fspan\\u003E\\u003C\\u002Fh5\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"panel-body noPadding\\\"\\u003E\\u003Cdiv class=\\\"dlb-selected-container\\\" data-bind=\\\"visible: !showEmptySelectedMessage()\\\"\\u003E\\u003Cdiv class=\\\"dlb-selected-header\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"dlb-deselectAll clickable\\\" data-bind=\\\"visible: features.deselectAll, click: deselectAll, attr: {"aria-label": strings.deselectAll}\\\" tabindex=\\\"0\\\" role=\\\"button\\\"\\u003E\\u003Ca class=\\\"remove arrow-button\\\"\\u003E\\u003C\\u002Fa\\u003E\\u003Cspan data-bind=\\\"text: strings.deselectAll\\\"\\u003E\\u003C\\u002Fspan\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"dlb-selected dlb-selected-list\\\" data-bind=\\\"attr: {'aria-label' : strings.selectedItems}\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"dlb-selected-footer\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"dlb-emptySelectedMessage\\\" data-bind=\\\"visible: showEmptySelectedMessage()\\\"\\u003E\\u003Cp data-bind=\\\"text: strings.emptySelectedMessage\\\"\\u003E\\u003C\\u002Fp\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"dlb-pager-container\\\" data-bind=\\\"visible: features.paging\\\"\\u003E\\u003Cdiv class=\\\"pager-selected-container\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fdiv\\u003E\";;return pug_html;};\nmodule.exports = template;","var pug = require(\"!../../../../../../node_modules/.pnpm/pug@2.0.4/node_modules/pug-runtime/index.js\");\n\nfunction template(locals) {var pug_html = \"\", pug_mixins = {}, pug_interp;;var locals_for_with = (locals || {});(function (i18n) {pug_mixins[\"popupHelp\"] = pug_interp = function(popupId, ariaLabelContext, arialLabelText){\nvar block = (this && this.block), attributes = (this && this.attributes) || {};\npug_html = pug_html + \"\\u003Ca\" + (\" class=\\\"helpbutton\\\"\"+\" type=\\\"helppopup\\\"\"+pug.attr(\"topic\", popupId, true, true)+pug.attr(\"data-help\", true, true, true)+\" onclick=\\\"PopupController.PopupJsClick(this)\\\" href=\\\"javascript:void(0);\\\"\"+pug.attr(\"aria-label\", (arialLabelText || 'Learn more') + ' ' + (ariaLabelContext || ''), true, true)) + \"\\u003E\\u003C\\u002Fa\\u003E\";\n};\npug_html = pug_html + \"\\u003Cdiv class=\\\"keyword-editor\\\" role=\\\"dialog\\\"\\u003E\\u003Cform class=\\\"form-horizontal form-grid\\\"\\u003E\\u003Cdiv class=\\\"flexible-grid-row-1 control-label\\\"\\u003E\\u003Clabel data-property=\\\"defaultText\\\" data-bind=\\\"text: defaultText.label\\\"\\u003E\\u003C\\u002Flabel\\u003E\";\npug_mixins[\"popupHelp\"]('pop_BA_NewAdCreate_KWInsert_DefaultText', '', i18n.getString('KeywordEditor_DefaultText_Tooltip'));\npug_html = pug_html + \"\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"form-input-container flexible-grid-row-1 form-default-text\\\" data-property=\\\"defaultText\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"form-validation-container flexible-grid-row-2 form-validation\\\" data-property=\\\"defaultText\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"flexible-grid-row-3 control-label\\\"\\u003E\\u003Clabel data-property=\\\"keywordCase\\\" data-bind=\\\"text: keywordCase.label\\\"\\u003E\\u003C\\u002Flabel\\u003E\";\npug_mixins[\"popupHelp\"]('pop_BA_NewAdCreate_KWInsert_Case', '', i18n.getString('KeywordEditor_Case_Tooltip'));\npug_html = pug_html + \"\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"form-input-container flexible-grid-row-3 form-keyword-case\\\" data-property=\\\"keywordCase\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003Cdiv class=\\\"form-input-container flexible-grid-row-4 form-buttons\\\" data-property=\\\"$buttons\\\"\\u003E\\u003C\\u002Fdiv\\u003E\\u003C\\u002Fform\\u003E\\u003C\\u002Fdiv\\u003E\";}.call(this,\"i18n\" in locals_for_with?locals_for_with.i18n:typeof i18n!==\"undefined\"?i18n:undefined));;return pug_html;};\nmodule.exports = template;","import URI from 'urijs';\r\n\r\nexport enum DisplayMode {\r\n Shellless = 'shellless',\r\n Default = 'default'\r\n}\r\n\r\nexport function getDisplayMode(href = window.location.href): DisplayMode {\r\n const uri = new URI(href);\r\n const search = uri.search(true);\r\n const mode = search.DisplayMode;\r\n if (mode && Object.values(DisplayMode).includes(mode as DisplayMode)) {\r\n return mode as DisplayMode;\r\n }\r\n return DisplayMode.Default;\r\n}\r\n"],"names":["map","webpackContext","req","id","webpackContextResolve","__webpack_require__","o","e","Error","code","keys","Object","resolve","module","exports","adCustomizersStyle","_ref","_ref$palette","palette","iconFontFamily","adCustomizerPickerEditorContainer","maxHeight","overflowY","borderTop","concat","neutralSecondary","fontSize","height","padding","lineHeight","fontWeight","paddingTop","width","marginBottom","minWidth","marginLeft","marginTop","AdCustomizerPickerEditorContainer","props","classes","useDefaultStyles","target","editorView","syntax","itemsToDisplay","adType","activity","position","container","targetRect","getBoundingClientRect","containerRect","top","bottom","left","getDisplayPosition","containerStyle","display","syntaxToUse","_jsx","className","children","contentView","contentClasses","index","name","description","onClick","_jsxs","role","href","event","trace","stopPropagation","preventDefault","classnames","_toConsumableArray","style","defaultProps","wideCharPattern","RegExp","displayLength","str","isString","replace","length","schema","scenario","value","setting","senario","createActivity","instrumentation","activityName","adCustomizersInAdsEditor","addScenario","create","AdCustomizerController","_createClass","_this","_classCallCheck","updateAndCloseCallback","updateAction","setCursorPostion","analyzer","newValue","cursorPosition","isSelectedByUser","isCancel","traceUpdate","analyzerName","focus","hidePicker","this","analyzers","pickerContainer","clickedAway","bind","keydown","key","priority","push","sort","b","a","analyzerIndex","findIndex","_ref2","_ref3","firstAnalyzer","_this2","text","cursorIndex","field","hitResults","fallBackAnalyzer","fallBackResult","pipeNextEvaluator","previewPromise","currentPosition","then","result","match","isEmpty","defaultHandlerForInput","getAnalyzerByIndex","extend","analyzerId","analyzeInput","nextAnalyzerPosition","_this$getAnalyzerByNa","getAnalyzerByName","Promise","_ref4","_this3","availableAnalyzers","remainingCountCallBack","selectionEnd","document","querySelector","items","trim","updatePicker","_ref5","hitResultsWithItems","filter","hitResult","size","flatten","pluck","_ref6","analyzeResult","_slicedToArray","getSyntax","needEditor","getEditor","addEventListener","ReactDOM","removeEventListener","all","_ref8","isClickedAway","closest","phaseCharCount","toContinue","resultText","charCount","i","getCharCountExcludingAdCustomizers","processedText","_this4","evaluateText","_ref9","createElement","contains","appendChild","pickerActivity","React","registerGlobalEvents","AdCustomizerBaseAnalyzer","i18n","_ref$scope","scope","controller","editor","register","previousResult","evaluateRule","oldValue","customizerName","keywords","TitleCase","SentenceCase","LowerCase","UnstyledKeywordEditor","_React$PureComponent","_callSuper","onCancel","onSave","_this$props","options","_","state","keywordText","setState","defaultTextErrorMessage","getString","_TL_","prefix","suffix","keywordCaseText","keywordCase","onDefaultTextChange","keywordCaseOptions","defaultText","_inherits","prevProps","_this$props2","classNames","keywordEditor","Label","htmlFor","HelpPopupInline","topic","ariaLabel","TextField","validateOnLoad","onChange","errorMessage","ChoiceGroup","selectedKey","option","Stack","horizontal","gap","PrimaryButton","DefaultButton","withDefaultStyles","keywordRuleSyntax","keywordRuleInProgressSyntax","keywordRuleTitleCaseSyntax","caseTypes","getKeywordCase","test","parseRule","startIndex","lastIndexOf","parsers","input","substring","inclusive","slice","properties","some","parser","rule","tokens","exec","source","parseKeywordRule","pick","endIndex","type","pickerKeywordInsert","AdCustomizerKeywordAnalyzer","_AdCustomizerBaseAnal","_ref$deps","deps","defaultAnalyzeResult","KeywordEditor","beginning","end","getMenuItem","endsWith","keywordReplaceSyntax","p1","p2","evaluateKeywordRules","AdCustomizerIffAnalyzer","audienceSelectorLegacyViewManager","perfMarker","permissions","AudienceSelectorLegacyViewManager","onEditorSave","onEditorCancel","IsNewAudienceEnabled","IsIFFAudienceSyntaxUpdateEnabled","condition","insertText","eventData","audienceList","_this$formatExpressio","formatExpression","buildCompleteExpression","_analyzeResult$insert","_analyzeResult$defaul","_analyzeResult$audien","editorProps","audienceTargetsView","IffEditor","_objectSpread","_ref5$buildCompleteEx","_ref5$startIndex","actualType","conditionText","IF_FUNCTION_TYPE","AUDIENCE_IN","escapeIffAudienceName","join","DEVICE_MOBILE","expressionStart","insertTextPart","escapeIffInsertText","defaultTextPart","escapeIffDefaultText","_ref7","isComplete","isStarted","element","indexOf","parentElement","isRemoveArrow","_rule$insertText","_rule$defaultText","Math","max","_rule$insertText2","supportedLanguages","intializeAndGetSupportedLanguages","arguments","undefined","codes","locale","displayName","maxLength","IsAdsGlobalizationPhase1Enabled","IsAdsGlobalizationPhase2Enabled","IsAdsGlobalizationPhase6Enabled","IsAdsGlobalizationPhase2JapanEnabled","dynamic","AdsGlobalizationPhase9DSA","IsAdsGlobalizationPhase9VIEnabled","IsDomesticSimplifiedChineseEnabled","languageParseMode","getDefaultLanguage","defaultLanguageIndex","language","formatCountdown","date","time","days","isResponsiveSearchAd","ret","DayPickerStrings","months","num","getMonth","shortMonths","day","getDayOfWeek","shortDays","goToToday","prevMonthAriaLabel","nextMonthAriaLabel","prevYearAriaLabel","nextYearAriaLabel","closeButtonAriaLabel","isRequiredErrorMessage","invalidInputErrorMessage","today","Date","now","getTimeZoneText","timeZoneId","getTimezoneI18nString","getLocalDate","fromUTC","parsed","offset","getTimezoneOffset","getTime","CountdownEditor","timeZone","_props$permissions","_useState","useState","_useState2","setDate","_useState3","_useState4","setTime","_useState5","_useState6","setDays","_useState7","_useState8","countdownType","setCountdownType","_useState9","_useState10","setLanguage","_useState11","lang","getSupportedLanguages","_useState13","_useState14","isTimeValid","setIsTimeValid","_useState15","_useState16","isDateValid","setIsDateValid","_useState17","_useState18","isDaysValid","setIsDaysValid","onChangeTime","useCallback","onChangeDays","onChangeCountdownType","onChangeLanguage","timeZoneOptions","onFormatDate","rawDate","formatDate","raw","useEffect","DatePicker","strings","minDate","onSelectDate","showMonthPickerAsOverlay","textField","onGetErrorMessage","testDatePattern","allowTextInput","validateOnFocusOut","placeholder","Number","isInteger","_Fragment","Dropdown","find","getLanguageCode","cldrContext","require","i18nDummy","I18nModel","failFast","loadCLDRData","cldrLocale","getCldrLocale","modulePath","data","loadTranslationData","countdownEvalTaskChain","countdownRuleSyntax","RSACountdownRuleSyntax","countdownRuleInProgressSyntax","RSACountdownRuleInProgressSyntax","translateDays","formatUnit","parseCountdownRule","parseMode","_ref$permissions","isNaN","parse","toLowerCase","parseInt","includeAdCustomizerFeed","getLanguage","_ref4$permissions","_ref2$permissions","startsWith","parseCountdownRuleInProgress","countDownDefaultDaysString","moment","add","format","RSACountDownDefaultDaysString","pickerCountdownInsert","RSAPickerCountdownInsert","AdCustomizerCountdownAnalyzer","_rule$options","startIndex1","_ref3$permissions","queueSubstitution","currentLanguage","translation","setLocale","searchStartIndex","getLocale","evaluateCountdownRules","locationRuleSyntax","locationRuleInProgressSyntax","locationFormat","parseLocationRule","UnstyledLocationEditor","_this$state","isDefaultTextEmpty","locationOptions","getLocationFormat","toUpperCase","locationEditor","pickerLocationInsert","AdCustomizerLocationAnalyzer","locationText","LocationEditor","locationReplaceSyntax","evaluatelocationRules","RSAAdCustomizerRuleSyntax","RSAAdCustomizerRuleInProgressSyntax","attributeName","parseRSAAdCustomizerRule","dropdownItemStyle","minHeight","selectors","whiteSpace","overflow","textOverflow","color","dropdownStyles","root","dropdown","border","dropdownItem","dropdownItemSelected","title","borderColor","textFieldStyles","RSAAdCustomizerEditor","getAttributes","setDefaultText","showDropdownError","setShowDropdownError","adCustomizerAttibutes","setAdCustomizerAttibutes","attribute","selectedAttribute","setSelectedAttribute","attributes","Id","Name","AdGroupValue","CampaignValue","AccountValue","compact","datatype","Datatype","label","required","styles","onRenderOption","onRenderTitle","selectedOptions","onRenderLabel","item","pickerRSAAdCustomizerInsert","RSAAdCustomizerAnalyzer","edmCampaign","jsDataCampaign","_this$scope","campaignId","adGroupId","adCustomizerAttributes","AdCustomizerAttribute","findAll","query","$top","$orderby","RSAAdPreviewEnhancement","entitySet","currentAccount","Campaigns","$withKey","AdGroups","AdCustomizerAttributes","toJSON","returnResult","totalCount","adcustomizerText","getAllAttributes","search","RSAAdCustomizerReplaceSyntax","matchedAttribute","values","chain","evaluateRSAAdCustomizerRules","useAdCustomizers","ref","current","setSelectionRange","removeAdCustomizer","_ref3$container","body","_ref3$field","getController","getAvailableAnalyzers","textFieldEventHandler","selectionStart","onInputUpdate","attachAdCustomizersHelpers","LegacyStringMap","RSAAdCustomizer_Attribute_Name","AdCustomizers_Editor_Syntax_Prefix_Label","KeywordEditor_DefaultText","Picker_RSA_AdCustomizer_Label","Picker_RSA_AdCustomizer_Description","RSAAdCustomizer_Attribute_String","RSAAdCustomizer_Attribute_Text","RSAAdCustomizer_Attribute_Percent","RSAAdCustomizer_Attribute_Price","RSAAdCustomizer_Attribute_Number","RSAAdCustomizer_Samples","RSAAdCustomizer_Attribute_None","RSAAdCustomizer_Select","RSAAdCustomizer_Attribute","RSAAdCustomizer_Attribute_Seperator","RSAAdCustomizer_Select_Error","DefaultText_Label","AdCustomizers_Editor_Set_Button","Cancel","instances","ResponsiveSearchAd","initialized","ResponsiveAd","DynamicSearchAd","AdCustomizerAvailableFields","countdown","location","keyword","iff","initializeAdCustomizer","checkAdType","_deps$permissions","showAdCustomizers","IsRSAAdCustomizerEnabled","IsMMAAdCustomizerInsertionEnabled","IsIffPopupEnabled","IsRSAIffPopupEnabled","buildLegacyI18n","includes","_ref4$field","evaluateAdCustomizers","_ref5$field","AdCustomizerPicker","_React$Component","$target","$","targetOffset","containerOffset","outerHeight","nextProps","containerToUse","window","on","off","cycleCharCount","phase1CharCount","isValidField","phase2CharCount","appendTo","config","_ref$excludedFields","excludedFields","adCustomizerFeedNameSyntaxWithSpecialCharacter","adCustomizerFeedAttributeSyntaxWithSpecialCharacter","adCustomizerFeedDefaultTextSyntaxWithSpecialCharacter","parseAdCustomizerFeedsRuleForSpecialChracter","nameTokens","ori","feed","specificFeedName","specificAttributeName","attributeTokens","removeEscapedStringFromAttribute","defaultTextToken","needFullRule","isValid","split","clone","noop","withUiBlock","originalWithUiBlock","feeds","getAllFeeds","el","uiBlock","Feed","$filter","limit","finally","Attributes","AttributeNames","catch","cloneFeed","orignalFeed","queryFeedsByName","_ref2$namePrefix","namePrefix","rawNamePrefix","_ref2$container","_ref2$useExactMatch","useExactMatch","allFeeds","feedNameToUse","AdCustomizerFeedAnalyzer","_this2$formatAdCustom","formatAdCustomizerFeed","feedName","_ref3$buildCompleteEx","trimmedDefaultText","feedNamePart","selectedAttributeNamePart","escapeAttrbuteName","defaultTextSelectedPart","_this$formatAdCustomi","parseResult","getStartIndex","_feeds$","attributeNameToUse","Feeds","FeedItems","FeedItem","select","feedItems","firstItemHasAttributeValue","feedItem","AttributeValues","queryFeedAttributeSampleValue","sample","extendOwn","results","attributeLowerCased","attributesToDisplay","updateTargetOnUserSelectionUpdate","processAttributeNames","first","attributeDescriptionPre","defaults","FeedSyntaxView","selectedFeed","DefaultTextEditorView","onSaveOrOnCancel","newDefaultText","_this4$formatAdCustom","_Backbone$View","_ref$options","_ref$options$defaultT","_ref$options$prefix","_ref$options$suffix","enum","fields","property","validators","message","control","valueMessages","model","form","SimpleForm","template","newModel","$el","append","render","Backbone","HelpIcon","BackboneInstanceWrapper","managed","instance","get","ForPreview","ForEditor","ForCharacterCount","DatePickerView","observable","html","parameters","culture","min","animation","footer","elementDatePickerElement","kendoDatePicker","datePickerWidget","open","kendo","one","dateView","div","click","calendar","setOptions","addClass","fromLegacyTimeZone","getSchema","pattern","minimum","maximum","isGlobal","getFields","showLabel","range","decimalLength","true","false","wrap","func","params","showLanguage","remove","attr","coutndownRuleInProgressWithAdCustomizerSyntax","countdownRuleWithAdCustomizerSyntax","_ref2$adType","IsAdCustomizerEnabled","parseCountdownRuleUsingAdCustomizerFeedSyntax","matchedAdCustomizerTokens","addDays","countdownI18nDummy","isDatePicker","_ref4$adType","_rule$audienceList","_this2$formatExpressi","_rule$defaultText2","_rule$insertText3","COUNTRY","val","STATE","CITY","Form","RadioGroup","checked","renderItem","Input","buttonContainer","Button","paddingLeft","textAlign","ExpandedTextAd","excludedAdCustomizerFields","getExcludedAdCustomizerFields","customizer","initialize","IsKeywordDefaultEnabled","IsIfFunctionMilestone1Enabled","IsIffCountdownForDSAEnabled","IsRSACountdownsPopupEnabled","IsRSALocationInsertionPopupEnabled","IsMMACountdownInsertionEnabled","IsMMAKeywordInsertionEnabled","IsMMALocationInsertionEnabled","_ref2$field","_ref3$adType","Function","prototype","call","String","AudienceAssociationView","DependencyResolver","campaignType","associationType","refreshOnInitialize","shouldShowUiBlockOnRender","customizedTemplates","dlbContainerTemplate","containerTemplate","dlbLayoutTemplate","layoutTemplate","isFromIFFunction","canExpandAssociation","expandAssociation","AudienceSelector","mapAudienceNamesToCriterion","audiencesList","mapAudienceNameToCriterion","audienceName","normalizedAudienceName","audienceNamePath","addLeadingSlash","trimmedParts","Boolean","normalizeAudienceName","doubleListBoxViewModel","allAudiences","audience","mapTargetingIdsToCriterions","criterions","associationList","exclusionList","setLists","loaded","ensureLoadedAsync","subscribeToSelectionChanges","onAudienceListChanged","unsubscribeFromSelectionChanges","isInitialLoad","getAudienceList","getLists","isSubscribedToSelectionChanges","IFF_ENTITY_SCHEMA","initialInputText","autoInsertedText","fieldText","onValidate","conditionTypeLabel","conditionTypeHelpId","conditionDeviceOptionText","conditionDeviceIsMobileStaticText","conditionAudienceOptionText","conditionAudienceInStaticText","insertTextLabel","insertTextHelpId","insertTextPlaceholder","defaultTextLabel","defaultTextHelpId","defaultTextPlaceholder","syntaxInsertText","syntaxDefaultText","saveButtonText","cancelButtonText","errorNoAudiencesSelected","onConditionTypeChange","onCancelClicked","onSaveClicked","audienceErrorMessages","selectedAudiences","_this$state$data","audienceSelector","_this$state2","areBaseInputsValid","isModeInputsValid","audienceSelectorClass","legacyi18n","ValidationStringMap","ValidationGroup","validationProps","Select","component","ErrorMessages","messages","IffEditor_InsertText_Label","bsStyle","btnStyle","disabled","unescapeIff","UNKNOWN","iffInProgressSyntax","iffInProgressAudienceSyntax","audienceListSyntax","SPECIFICITY","TYPE","parseInsertText","normalizeInsertText","parseIffDeviceRuleInProgress","_ref$startIndex","specificity","parseAudienceList","audienceListRaw","lastIndex","finalAudience","parseIffAudienceRuleInProgress","_ref2$startIndex","parserArgs","sortBy","last","mockedTags","TrackingCode","IsPreferredTag","Owner","Account","PageMenu","isDone","done","AccessibleTreeView","nodes","treeNodes","treeViewClassNames","treeViewContainer","nodeChildRenderer","nodePaddingLeft","pageMenu","_ref2$palette","menuItem","baseMenuItem","fontFamily","flexDirection","paddingRight","textDecoration","backgroundColor","alignItems","borderRadius","white","getButtonFocusOverrideStyle","normalMenuItem","neutralLight","selectedMenuItem","borderLeft","themePrimary","alignSelf","menuItemAnchor","iconContainer","marginRight","textContainer","flex","typeSelectionIcon","margin","placeholderTextContainer","getUetTagItemStyles","overflowX","background","statusIconContainer","labelContainer","TextSpanWithForwardedRef","node","forwardedRef","textContainerClassNames","getNodeText","nodeUrl","processor","allowedKeys","QueryParam","tagId","pathname","stringify","getNodeUrl","nodeText","UetTagsTreeNodeWithTooltip","nodeClasses","GetNodeClassNames","iconContainerClassName","iconStatusClassName","uetTagStatusIcon","uetTagGlyphIcon","TrackingStatus","IsReadOnly","save","Glyphicon","glyph","iconStyle","withScope","withOverflowProp","UetTagTreeNode","isPlaceholderNode","isLoadingData","rootNodeSpinnerContainer","StyledSpinnerWithLabel","rootPlaceholderNodeTextContainerClassName","UetTagTreeNodeChildRenderer","UetTagsPageMenuInternal","tags","siteMap","_this$props$scope$val","aid","scopeCid","cid","CurrentAccount","serverContext","Customers","Accounts","Tags","toPromise","tagResponse","getTags","AdvertiserCustomerID","response","Inactive","tag","localeCompare","Unverified","Active","uetTagsInTree","iconHidden","isSelected","hideFallback","getTreeNodesProps","borderRight","queryParam","history","getRoutePathById","updateUrl","borderBottom","outline","UetTagsPageMenu","withServerContext","withI18nConsumer","getStyles","CreateReportFreContent","useContext","I18nContext","createReportFre","Image","src","CreateReportFreImg","alt","fit","Body1","block","CustomizeColumnsFreContent","customizeColumnsFre","SaveReportFreContent","saveReportFre","SaveReportFreImg","ReportHomePageTeachingBubbleConfig","featureName","userGovernanceConfig","defaultUserGovernanceConfig","steps","content","primaryButtonText","secondaryButtonText","targetElement","directionalHint","DirectionalHint","rightCenter","onNext","_scope","_siteMap","CustomReportBuilderTeachingBubbleConfig","leftCenter","ReportHomePageBubbleRenderer","bubbleContext","MultiStepTeachingBubbleContext","triggerMultiStepTeachingBubbleWithLock","CustomReportBuilderBubbleRenderer","locals","pug_html","pug","pug_interp","pug_mixins","locals_for_with","popupId","ariaLabelContext","arialLabelText","escape","appendLearnMoreLink","DisplayMode","getDisplayMode","mode","Default"],"sourceRoot":""}