{"version":3,"sources":["messages/messagesRoutes.js","signup/signUpRoutes.js","core/components/snMenuButton.js","core/localisation/LocalisationActions.js","core/localisation/localisationCollectionParser.js","core/localisation/LocalisationDateParser.js","core/localisation/LocalisationNumberParser.js","core/localisation/LocalisationParamParser.js","core/localisation/LocalisationStore.js","core/localisation/LocalisationUtils.js","core/localisation/localiser.js","core/localisation/snDateDirective.js","core/localisation/snNumberDirective.js","core/localisation/snTranslateDirective.js","core/localisation/snTranslatePlaceholderDirective.js","core/segment/segmentEvents.js","core/segment/segmentIdentify.js","core/segment/segmentPageview.js","core/services/currencyActions.js","core/services/currencyStore.js","core/services/organisationActions.js","core/services/organisationStore.js","core/services/organisationUpdateStore.js","core/services/roleListActions.js","core/services/roleListStore.js","core/services/screenSizeService.js","core/services/statusIconTextStore.js","core/components/snAccountStatus/snAccountStatusDirective.js","core/components/snButton/snButtonDirective.js","core/components/snFocusOn/snFocusOnDirective.js","core/components/snHideOnMobile/snHideOnMobileDirective.js","core/components/snImageCircle/snImageCircleDirective.js","core/components/snKeydownArrowDown/snKeydownArrowDownDirective.js","core/components/snKeydownArrowLeft/snKeydownArrowLeftDirective.js","core/components/snKeydownArrowRight/snKeydownArrowRightDirective.js","core/components/snKeydownArrowUp/snKeydownArrowUpDirective.js","core/components/snKeydownBackspace/snKeydownBackspaceDirective.js","core/components/snKeydownEnter/snKeydownEnterDirective.js","core/components/snKeydownEscape/snKeydownEscapeDirective.js","core/components/snKeydownTab/snKeydownTabDirective.js","core/components/snMessageBarDirective/snMessageBarDirective.js","core/components/snOnEnter/snOnEnterDirective.js","core/components/snOrganisationProfilePicture/snOrganisationProfilePictureDirective.js","core/components/snPersonProfilePicture/snPersonProfilePictureDirective.js","core/components/snPopout/snPopoutDirective.js","core/components/snPopoutListItem/snPopoutListItem.js","core/components/snRadioButton/snRadioButtonDirective.js","core/components/snScrollBar/snScrollBarDirective.js","core/components/snShowOnMobile/snShowOnMobileDirective.js","core/components/snSkipToContent/snSkipToContentDirective.js","core/components/snTag/snTagDirective.js","core/components/snTooltip/snTooltipDirective.js","core/components/snTransition/snTransitionDirective.js","core/viewDirectives/snAddAddress/snAddAddressViewDirective.js","core/viewDirectives/snHeaderDirective/snHeaderDirective.js"],"names":["angular","module","config","$stateProvider","state","url","templateUrl","ng","$locationProvider","controller","directive","restrict","require","scope","buttontext","route","link","$scope","elm","attrs","snProfileMenuController","register","localisationActionsController","$http","localisationUtils","httpService","$state","signedInUserStore","getDateFormat","locale","hasDateFormat","Rx","Observable","fromPromise","get","headers","languageCultureName","map","data","result","countries","dateLongFormat","subscribe","dateFormat","resultSubjects","getDateFormatSuccess","onNext","noop","getLabel","label","languageCode","baseNamespace","getNamespaceBase","currentLanguageCode","labelCache","R","contains","getCachedLabel","push","getLocalisation","labels","getLabelSuccess","err","go","requestSubjects","getLabels","Subject","Sonovate","Config","Localisation","Labels","subjects","factory","localisationCollectionParserService","$q","localisationActions","localisationStore","getForSingleNamespace","array","callback","resolveTranslatedArray","localisedArray","getLocalisedArray","_","first","length","defer","resolve","subscription","dispose","labelName","getForLabel","promise","localeDateService","formatDate","date","moment","format","dateFormatNameToFormat","big-endian","little-endian","middle-endian","localeNumberService","formatNumber","number","localeName","finalNumber","formatSymbols","realAndDecimalNumber","getRealAndDecimalNumber","getFormatSybmolsForLocale","formatRealNumber","realNumber","decimalNumber","formatSymbol","splitRealNumber","splitRealNumberIntoDenotableParts","reduce","slice","numberPart","getFormatSymbolsFromNumberFormat","getNumberFormatForLocale","numberFormat","symbols","match","splitEvenRealNumberIntoDenotableParts","splitUnevenRealNumberIntoDenotableParts","times","index","cutFrom","cutTo","skipNumbers","denotableParts","Math","floor","concat","numberParts","localeToNumberFormat","getAllLocalesToNumberFormat","hasOwnProperty","console","warn","localesByNumberFormat","each","numberFormatToLocale","locales","extend","makeLocaleToNumberFormatObject","object","n,n.n","n.n,n","n'n.n","n n,n","n,n/n","n n-n","n n.n","localisationParamParserController","localisationDateParser","localisationNumberParser","getLocaleLabel","text","labelParamaters","localeString","dateFormatString","parseLabelExpression","expression","variables","expressionVariables","prepareVariablesForParsing","replace","variableName","formatedVariables","formatVariablesToLocale","keys","key","values","variable","splitVariablesIntoKeysAndValues","variableHasFormat","value","parseFormatedVariable","variableFormatName","getVariableFormatName","variableFormatExists","expressionVariableFormats","variableFormat","localisationStoreController","localisationParamParser","addNewLabels","Object","forEach","subject","setDateFormat","loading","namespacedLabel","params","ReplaySubject","localisationUtilsController","this","getNamespaceArray","split","generateFiller","charLength","generateString","pipe","range","mapAccum","string","num","numberOfBlankSpaces","round","random","substr","localiser","$rootScope","requestLabels","observable","BehaviorSubject","getLabelCacheSubset","toJS","cleanUpObjects","cached","String_NamespaceAndLabel","namespace","getSingleLabelSubsetFromCache","subsetName","cachedSubset","interpolate","interpolateParams","watcher","$watch","watchParams","cleanUp","reloadAll","mapObject","Immutable","fromJS","triggerGetLabelAction","makeObjectFromLabelsArray","obj","subset","toObject","set","filteredLabels","filter","requestedNamespaces","indexOf","language","observers","addNewLabelsToCache","responseLabels","setIn","interpolatedSets","setKey","labelKey","parseParams","labelString","vars","snTranslate","snDate","template","$timeout","sub","safeApply","$on","snNumber","snLabel","snLength","snParams","getNewLabelText","newLabel","getLabelText","setTranslatedText","getParams","JSON","parse","storeSubscription","$elm","$attrs","attr","snTranslatePlaceholder","$window","AuthenticationActions","run","signIn","user","analytics","track","firstName","lastName","id","email","emailAddress","signUp","identify","$location","page","currencyListActions","$cookies","$stateParams","getCurrencyList","response","getCurrencyListOnSuccess","getCurrency","mapToItems","currencies","currency","organisationActions","Upload","ErrorUtilitiesService","APP_URL","getOrganisation","getOrganisationOnSuccess","model","permissions","metadata","getOrganisationOnFail","updateOrganisationStore","organisation","create","observer","onupdateOrganisationStore","getOrganisationNumbers","getOrganisationNumbersOnSuccess","getOrganisationNumbersOnFail","putProfilePicture","file","upload","putOrganisationProfilePictureOnSuccess","pictureUrl","putOrganisationProfilePictureOnFail","messages","deleteProfilePicture","onDeleteNumberSuccess","onFonDeleteNumberFail","addPhoneNumber","deletePhoneNumber","phoneNumber","deleteItem","phoneId","changePhoneNumber","put","dialPrefix","countryCode","changePhoneNumberOnSuccess","changePhoneNumberOnFail","putOrganisationDetails","webSite","website","vatRegistrationDate","vatNumber","currencyCode","organisationClassification","putOrganisationDetailsOnSuccess","putOrganisationDetailsOnFail","getBankAccounts","onGetBankAccountOnSuccess","onGetBankAccountOnFail","publishBankAccount","organisationId","bankAccountId","post","onPublishBankAccountOnSuccess","onPublishBankAccountOnFail","discardBankAccount","onDiscardBankAccountOnSuccess","updateStore","getOrganisationCurrencyOnSuccess","getOrganisationCurrencyOnFail","onAddNumberSuccess","onAddNumberFail","onDeleteNumberFail","onPostBankAccountOnSuccess","onPostBankAccountOnFail","onPostBankAccountOnFailValidation","onPutBankAccountOnSuccess","onPutBankAccountOnFail","clearErrors","onDiscardBankAccountOnFail","OrganisationsActions","RiskEvents","setAssessmentType","isEmpty","assessments","assessmentSummary","assessmentType","removeErrors","errors","getOrganisationError","getNumbersError","addNumbersError","changeNumbersError","getCurrencyError","profilePictureError","putOrganisationDetailsError","billingProfileFormErrors","billingProfileError","publishFacetError","discardFacetError","_this","resetState","organisationSubject","organisationName","registeredNumber","links","billingProfiles","organisationPhoneNumbers","baseCurrency","companyName","registrationNumber","showBillingProfileSaveSuccess","successfulResponse","bankAccounts","accountName","sortCode","accountNumber","bankBranchName","iban","bic","status","bankAccountPostError","bankAccountFormErrors","isoCountryCode","tradingStyles","copy","httpResults","submittedRiskStatusSuccessful","assessmentStatus","error","getOrganisationPhoneNumbersCompleted","numbers","publishOrganisationPhoneNumber","request","phoneNumberId","discardOrganisationPhoneNumber","addPhoneNumberToOrganisationCompleted","addPhoneNumberToOrganisationFailed","formError","form","updatedNumber","phoneNumberTarget","i","dialingCode","person","bankAccountError","bankAccount","updatedBankAccount","bankAccountTarget","getBillingProfileCompleted","saveBillingProfileCompleted","billingProfile","profile","saveBillingProfileValidationFormError","saveBillingProfileFail","createBillingProfileFail","createBillingProfileCompleted","discardBillingProfileCompleted","deleteBillingProfileCompleted","publishBillingProfileCompleted","dissmissBillingProfileSaveSuccessComplete","getTradingStylesForOrganisationSuccess","addTradingStyleToOrganisationSuccess","tradingStyle","formErrors","add","saveTradingStyleOnOrganisationSuccess","tradingStyleItem","deleteTradingStyleFromOrganisation","intent","discardTradingStyleOnOrganisation","publishTradingStyleOnOrganisation","clearOrganisationStore","roleListActions","getRoleList","roleList","store","screenSizeServiceService","isMobile","innerWidth","statusIconTextStore","referenceDataActions","setState","statuses","getStatusIconDetails","getStatusDetails","mergeWith","merge","getStatusToIcon","convertStatusesToIconDetailsObject","fromPairs","prefix","statusId","isValidStatusId","findStatusDetails","isNil","AccountStatus.Suspended","icon","color","AccountStatus.Active","AccountStatus.Pending","AccountStatus.Locked","AccountStatus.Verified","OrganisationAccountStatus.Proposed","OrganisationAccountStatus.Verified","OrganisationAccountStatus.Rejected","getStatusesComplete","snAccountStatus","snStatus","controllerAs","bindToController","snStatusText","snIcon","snButton","snButtonLabel","snSref","snIconClass","snIconColor","snButtonClass","snModifiers","snOnClick","snTabindex","snType","snModifier","snTextModifier","sref","onClick","snFocusOn","element","attributes","snFocusOnLink","focusElement","focus","snHideOnMobile","snShowOnMobileLink","css","display","snImageCircle","snImageCircleController","snImageUrl","snWidth","snKeydownArrowDown","keyboardEventGeneratorService","snKeydownArrowDownLink","bindEvent","eventName","keyCode","callbackAttribute","stopPropagation","snKeydownArrowDownStopPropagation","snKeydownArrowLeft","snKeydownArrowUpLink","snKeydownArrowUpDownStopPropagation","snKeydownArrowRight","snKeydownArrowUp","snKeydownBackspace","snKeydownEnter","snKeydownEnterLink","snKeydownEnterStopPropagation","snKeydownEscape","snKeydownEscapeLink","snKeydownEscapeStopPropagation","snKeydownTab","snKeydownTabLink","snKeydownTabStopPropagation","snMessageBar","snShow","snColor","snShowCancel","snShowConfirm","snCancelLabel","snConfirmLabel","snOnDismiss","snOnConfirm","snNonLocalisedLabel","snShowReload","snReloadText","dismiss","confirm","onEnter","bind","event","which","$apply","$eval","snOnEnter","preventDefault","snOrganisationProfilePicture","snOrganisationProfilePictureController","snSrc","snBackgroundColor","snOrganisationProfilePictureLink","snPersonProfilePicture","snClassString","snFontColor","snFirstName","snLastName","snFontSize","snShowUploadIcon","getFirstCharacterOfString","charAt","setWidth","width","vm","height","setFontSize","font-size","snPopout","snListItems","snPopoutColor","snOnClickLink","snVerticalArrowPosition","snHorizontalArrowPosition","snShowMenu","snPositions","snTabIndexStartAt","snBlur","snFocus","snPopoutController","snPopoutLink","clickLink","listItem","isFunction","action","item","blurTriggered","lastIndex","toggleItemFocused","menuItemFocused","closeMenu","focusTriggered","positions","stringify","children","addClass","snPopoutListItem","snText","snAction","snIndex","snCloseMenu","snPopoutListItemController","snPopoutListItemLink","firstIndex","snRadioButton","snId","snName","snDescription","snModel","snValue","snChange","snItem","snReturnCurrentSelectedValue","snRadioButtonController","setChecked","isChecked","isObject","snScrollBar","$parse","snScrollBarLink","Ps","initialize","suppressScrollX","snMarginRight","find","snScrollBarScroll","scrollTop","update","snShowOnMobile","transclude","isVisible","show","hide","snFirstLine","snSecondLine","snTitle","snLink","snTooltip","message","subMessage","disabledSubMessage","disabledIcon","isDisabled","arrowPosition","compile","snTransition","snShowLink","beginTransition","revertBackToBaseClass","assignClasses","classMap","reverse","classDelay","removeClassesAfterTimeout","last","timeoutDelay","removeAllMapClassesFromElement","classList","clearTimeouts","setClassTimeouts","timeouts","changeToNextClassAfterTimeout","className","timeout","cancel","hasClass","removeClass","getStepDelay","snTransitionDelay","parseDelayFromAttribute","Error","exception","getClassMap","snTransitionClass","parseClassMapFromAttribute","delayTime","snAddAddressViewDirectiveController","snShowForm","snHeader","userId","popoutListItems","popoutPositions","toggleSettings","showSettings"],"mappings":"CAAC,SAASA,SACN,YAEAA,SAAQC,OAAO,qBACdC,QACG,iBACA,SAAUC,gBACNA,eACCC,MAAM,qBACHC,IAAK,YACLC,YAAa,0BAEhBF,MAAM,yBACHC,IAAK,OACLC,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AAOqN,OAAO0S,WAAW2J,aAAcE,iBA1B3C7qB,QAAQC,OAAO,iBACdS,UACG,gBAEI,WACAiqB,gBA+HV3qB;CCvID,SAAUA,SACP,YAKA,SAAS0sB,uCACL,OACI/rB,SAAU,IACVL,YAAa,kEACbO,OACI8rB,WAAY,KAEhBliB,SAAS,EACToV,kBAAkB,EAClBpf,WAAY,kCACZmf,aAAc,KACd5e,KAAM,SAAUC,OAAQ8f,QAASC,eAdzChhB,QAAQC,OAAO,iBACdS,UAAU,6BAA8BgsB,sCAmBzC1sB,QAAQC,OAAO,iBACdQ,WAAW,mCAAoC,SAAU,SAASiB,aAKrE1B;CC7BD,SAAUO,IAEV,YAKA,SAASqsB,YACR,OACCjsB,SAAU,IACVE,OACCgsB,OAAO,IACPC,gBAAiB,IACjBC,gBAAiB,IACjBlF,QAAS,KAEVvnB,YAAa,+DACbsf,aAAc,KACdC,kBAAkB,EAClBpf,WAAY,SAAUQ,QAQrB,QAAS+rB,kBACRjU,MAAMkU,cAAiBlU,MAAMkU,aAR9B,GAAIlU,MAEJA,OAAQzM,KACRyM,MAAMkU,cAAe,EAErBlU,MAAMiU,eAAiBA,iBArB1BzsB,GAAGN,OAAO,iBACTS,UAAU,WAAYksB,WA6BtB5sB","file":"../js.min.js","sourcesContent":["(function(angular){\r\n 'use strict';\r\n\r\n angular.module('sonovate.messages')\r\n .config([\r\n '$stateProvider',\r\n function ($stateProvider) {\r\n $stateProvider\r\n .state('sonovate.messages', {\r\n url: '/messages', \r\n templateUrl: 'messages/Message.html'\r\n })\r\n .state('sonovate.messages.500', {\r\n url: '/500',\r\n templateUrl: 'messages/500.html'\r\n });\r\n }\r\n ]);\r\n\r\n}(angular));","(function(ng){\r\n 'use strict';\r\n\r\n ng.module('sonovate.signup')\r\n .config(['$stateProvider', '$locationProvider',\r\n function ($stateProvider, $locationProvider) {\r\n\r\n $stateProvider\r\n .state('sonovate.signup', {\r\n url: '/signup',\r\n templateUrl: 'signup/signup.html',\r\n controller: 'signupController'\r\n });\r\n }]);\r\n\r\n}(angular));\r\n","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\"snMenuButton\", function () {\r\n return {\r\n restrict:\"E\",\r\n require:\"^snProfileMenu\",\r\n scope: {\r\n buttontext:'@',\r\n route:'@'\r\n },\r\n link: function ($scope, elm, attrs, snProfileMenuController) {\r\n snProfileMenuController.register($scope.buttontext,$scope.route);\r\n }\r\n };\r\n });\r\n \r\n}(angular));","(function(angular) {\r\n 'use strict';\r\n\r\n\tangular.module(\"sonovate.core\").factory(\"localisationActions\", localisationActionsController); \r\n\r\n\tfunction localisationActionsController ($http, localisationUtils, httpService, $state, signedInUserStore) {\r\n\t\tvar requestSubjects = {\r\n\t\t\tgetLabels: new Rx.Subject()\r\n\t\t};\r\n\r\n\t\tvar resultSubjects = {\r\n\t\t\tgetLabels: new Rx.Subject(), \r\n\t\t\tgetLabelSuccess: new Rx.Subject(),\r\n\t\t\tgetCachedLabel: new Rx.Subject(),\r\n\t\t\tgetDateFormatSuccess: new Rx.Subject()\r\n\t\t};\r\n\r\n\t\t// To be depreciated\r\n\t\tvar labelCache = [];\r\n\r\n\t\tvar currentLanguageCode = 'en-GB';\r\n\t\tvar hasDateFormat = false;\r\n\r\n\t\trequestSubjects.getLabels\r\n\t\t// Commented this out because we are serving the labels form the FE for now\r\n\t\t// when we revert back to getting them from the BE then uncomment the code bellow\r\n\t\t\r\n\t\t// .map(function (request) {\r\n\t\t// \trequest.labelsAsString = request.labels.join();\r\n\t\t// \treturn request;\r\n\t\t// })\r\n\t\t// .flatMap(function (request) {\r\n\t\t// \treturn Rx.Observable.fromPromise(\r\n // httpService.getLocalisation(\"/v1/localisation/views/\" + request.language + \"/\" + request.labelsAsString)\r\n // )\r\n // .retry(3)\r\n // .catch(function () {\r\n // return Rx.Observable.empty();\r\n // });\r\n\t\t// })\r\n\t\t// .map(function (response) {\r\n\t\t// \treturn response.data.result.labels;\r\n\t\t// })\r\n\t\t.subscribe(function () {\r\n\t\t\tresultSubjects.getLabels.onNext(\r\n\t\t\t\tSonovate.Config.Localisation.Labels // jshint ignore:line\r\n\t\t\t);\r\n\t\t}, function () {\r\n\t\t\t$state.go('sonovate.500');\r\n\t\t});\r\n\r\n\t\tfunction getDateFormat (locale) {\r\n\t\t\tif (hasDateFormat) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\thasDateFormat = true;\r\n\r\n\t\t\tRx.Observable.fromPromise(\r\n\t\t\t\t$http.get(\"https://private-0f890-sonovatecore1.apiary-mock.com/countries\", {\r\n\t\t\t\t\theaders: {\r\n\t\t\t\t\t\t\"languageCultureName\":locale\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t).map(function (data) {\r\n\t\t\t\treturn data.data.result.countries[0].dateLongFormat;\r\n\t\t\t}).subscribe(function (dateFormat) {\r\n\t\t\t\tresultSubjects.getDateFormatSuccess.onNext(dateFormat);\r\n\t\t\t},\r\n\t\t\t\tangular.noop\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\t// To be depreciated\r\n\t\tfunction getLabel (label, languageCode) {\r\n\t\t\tvar baseNamespace = localisationUtils.getNamespaceBase(label);\r\n\r\n\t\t\tif (currentLanguageCode !== languageCode) {\r\n\t\t\t\tlabelCache = [];\r\n\t\t\t\tcurrentLanguageCode = languageCode;\r\n\t\t\t}\r\n\r\n\t\t\tif (R.contains(baseNamespace, labelCache)) {\r\n\t\t\t\tresultSubjects.getCachedLabel.onNext(label);\r\n\t\t\t} else if (label !== \"\") {\r\n\t\t\t\tlabelCache.push(baseNamespace);\r\n\t\t\t\tRx.Observable.fromPromise(\r\n\t\t\t\t\thttpService.getLocalisation(\"/v1/localisation/views/\" + languageCode + \"/\" + baseNamespace)\r\n\t\t\t\t).map(function onSuccess (data) {\r\n\t\t\t\t\treturn data.data.result.labels;\r\n\t\t\t\t}).subscribe(function (data) { \r\n\t\t\t\t\tresultSubjects.getLabelSuccess.onNext(data);\r\n\t\t\t\t}, function onError (err) {\r\n\t\t\t\t\t$state.go('sonovate.500');\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\trequestSubjects: requestSubjects,\r\n\t\t\tresultSubjects: resultSubjects,\r\n\t\t\tsubjects: resultSubjects,\r\n\t\t\tgetDateFormat: getDateFormat,\r\n\t\t\tgetLabel: getLabel\r\n\t\t};\r\n\r\n\t}\r\n}(angular));","(function(ng) {\r\n 'use strict';\r\n\r\n ng.module('sonovate.core')\r\n .factory(\r\n 'localisationCollectionParserService',\r\n localisationCollectionParserService \r\n );\r\n\r\n function localisationCollectionParserService ($q, localisationActions, localisationStore, localisationUtils) {\r\n\r\n return {\r\n getForSingleNamespace: getForSingleNamespace \r\n };\r\n\r\n function getForSingleNamespace (array, callback) {\r\n \r\n var baseNamespace, subscription, defer;\r\n defer = $q.defer();\r\n baseNamespace = localisationUtils.getNamespaceBase(_.first(array));\r\n subscription = localisationStore.subscribe(resolveTranslatedArray);\r\n localisationActions.getLabel(baseNamespace);\r\n\r\n return defer.promise;\r\n\r\n function resolveTranslatedArray (data) {\r\n \r\n var localisedArray = getLocalisedArray(data);\r\n\r\n if ( _.first(localisedArray) && localisedArray.length === array.length ) {\r\n defer.resolve(localisedArray);\r\n subscription.dispose();\r\n }\r\n }\r\n\r\n function getLocalisedArray (data) {\r\n return _.map(array, function (labelName) {\r\n return data.getForLabel(labelName);\r\n });\r\n }\r\n }\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .factory(\r\n 'localisationDateParser', \r\n [\r\n localeDateService\r\n ]\r\n );\r\n\r\n function localeDateService () {\r\n\r\n var dateFormatNameToFormat;\r\n dateFormatNameToFormat = {\r\n \"big-endian\": \"YYYY-MM-DD\",\r\n \"little-endian\": \"DD-MM-YYYY\",\r\n \"middle-endian\": \"MM-DD-YYYY\",\r\n };\r\n\r\n return {\r\n formatDate: formatDate\r\n };\r\n\r\n function formatDate (date, dateFormat) {\r\n return moment(date).format(dateFormat);\r\n }\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .factory(\r\n 'localisationNumberParser', \r\n [\r\n localeNumberService\r\n ]\r\n );\r\n\r\n function localeNumberService () {\r\n\r\n var numberFormatToLocale;\r\n numberFormatToLocale = {\r\n \"n,n.n\": [\"ar-SA\",\"zh-TW\",\"en-US\",\"he-IL\",\"ja-JP\",\"ko-KR\",\"th-TH\",\"ur-PK\",\"hy-AM\",\"af-ZA\",\"hi-IN\",\"sw-KE\",\"pa-IN\",\"gu-IN\",\"ta-IN\",\"te-IN\",\"kn-IN\",\"mr-IN\",\"sa-IN\",\"kok-IN\",\"syr-SY\",\"dv-MV\",\"ar-IQ\",\"zh-CN\",\"en-GB\",\"es-MX\",\"ar-EG\",\"zh-HK\",\"en-AU\",\"ar-LY\",\"zh-SG\",\"en-CA\",\"es-GT\",\"ar-DZ\",\"zh-MO\",\"en-NZ\",\"ar-MA\",\"en-IE\",\"es-PA\",\"ar-TN\",\"en-ZA\",\"es-DO\",\"ar-OM\",\"en-JM\",\"ar-YE\",\"en-029\",\"ar-SY\",\"en-BZ\",\"es-PE\",\"ar-JO\",\"en-TT\",\"ar-LB\",\"en-ZW\",\"ar-KW\",\"en-PH\",\"ar-AE\",\"ar-BH\",\"ar-QA\",\"es-SV\",\"es-HN\",\"es-NI\",\"es-PR\",\"zu-ZA\",\"xh-ZA\",\"tn-ZA\",\"quz-PE\",\"cy-GB\",\"fil-PH\",\"iu-Latn-CA\",\"mi-NZ\",\"ga-IE\",\"moh-CA\",\"ns-ZA\",\"mt-MT\"],\r\n \"n.n,n\": [\"ca-ES\",\"da-DK\",\"de-DE\",\"el-GR\",\"is-IS\",\"it-IT\",\"nl-NL\",\"pt-BR\",\"ro-RO\",\"hr-HR\",\"sq-AL\",\"sv-SE\",\"tr-TR\",\"id-ID\",\"sl-SI\",\"lt-LT\",\"vi-VN\",\"eu-ES\",\"mk-MK\",\"fo-FO\",\"ms-MY\",\"gl-ES\",\"fr-BE\",\"nl-BE\",\"pt-PT\",\"sr-SRB\",\"ms-BN\",\"de-AT\",\"es-ES\",\"sr-Cyrl-CS\",\"de-LU\",\"es-CR\",\"es-VE\",\"es-CO\",\"es-AR\",\"es-EC\",\"es-CL\",\"es-UY\",\"es-PY\",\"es-BO\",\"sr-Cyrl-BA\",\"fy-NL\",\"se-SE\",\"sma-SE\",\"hr-BA\",\"bs-Latn-BA\",\"bs-Cyrl-BA\",\"arn-CL\",\"quz-EC\",\"sr-Latn-BA\",\"smj-SE\",\"quz-BO\"],\r\n \"n'n.n\": [\"de-CH\",\"it-CH\",\"fr-CH\",\"de-LI\",\"rm-CH\"],\r\n \"n n,n\": [\"bg-BG\",\"cs-CZ\",\"fi-FI\",\"fr-FR\",\"hu-HU\",\"nb-NO\",\"pl-PL\",\"ru-RU\",\"sk-SK\",\"uk-UA\",\"be-BY\",\"lv-LV\",\"az-Latn-AZ\",\"ka-GE\",\"uz-Latn-UZ\",\"tt-RU\",\"mn-MN\",\"nn-NO\",\"sv-FI\",\"az-Cyrl-AZ\",\"uz-Cyrl-UZ\",\"fr-CA\",\"fr-LU\",\"fr-MC\",\"sma-NO\",\"smn-FI\",\"se-FI\",\"sms-FI\",\"smj-NO\",\"lb-LU\",\"se-NO\"],\r\n \"n,n/n\": [\"fa-IR\"],\r\n \"n n-n\": [\"kk-KZ\", \"ky-KG\"],\r\n \"n n.n\": [\"et-EE\"],\r\n };\r\n\r\n return {\r\n formatNumber: formatNumber\r\n };\r\n\r\n function formatNumber (number, localeName) {\r\n var finalNumber, formatSymbols, realAndDecimalNumber;\r\n realAndDecimalNumber = getRealAndDecimalNumber(number);\r\n formatSymbols = getFormatSybmolsForLocale(localeName);\r\n finalNumber = formatRealNumber(\r\n realAndDecimalNumber.realNumber, \r\n formatSymbols.realNumber\r\n );\r\n\r\n if ( formatSymbols.decimalNumber ) {\r\n return finalNumber + formatSymbols.decimalNumber + realAndDecimalNumber.decimalNumber;\r\n } else {\r\n return finalNumber;\r\n }\r\n }\r\n\r\n function formatRealNumber (realNumber, formatSymbol) {\r\n var splitRealNumber;\r\n splitRealNumber = splitRealNumberIntoDenotableParts(realNumber);\r\n return _.reduce(\r\n splitRealNumber.slice(1),\r\n function (realNumber, numberPart) {\r\n return realNumber+formatSymbol+numberPart;\r\n },\r\n splitRealNumber[0]\r\n );\r\n }\r\n\r\n function getFormatSybmolsForLocale (localeName) {\r\n return getFormatSymbolsFromNumberFormat(\r\n getNumberFormatForLocale(localeName)\r\n );\r\n }\r\n\r\n function getFormatSymbolsFromNumberFormat (numberFormat) {\r\n var symbols = numberFormat.match(/[^a-z]/g);\r\n return {\r\n realNumber: symbols[0],\r\n decimalNumber: symbols[1]\r\n };\r\n }\r\n\r\n function splitRealNumberIntoDenotableParts (number) {\r\n if ( number.length % 3 === 0 ) {\r\n return splitEvenRealNumberIntoDenotableParts(number);\r\n } else {\r\n return splitUnevenRealNumberIntoDenotableParts(number);\r\n }\r\n }\r\n\r\n function splitEvenRealNumberIntoDenotableParts (number) {\r\n return _.times(\r\n number.length/3, \r\n function (index) {\r\n var cutFrom, cutTo;\r\n cutTo = 3*(index+1);\r\n cutFrom = cutTo-3;\r\n return number.slice(cutFrom,cutTo);\r\n }\r\n );\r\n }\r\n\r\n function splitUnevenRealNumberIntoDenotableParts (number) {\r\n \r\n var skipNumbers, denotableParts;\r\n denotableParts = Math.floor(number.length/3);\r\n skipNumbers = number.length-(denotableParts*3);\r\n\r\n return [number.slice(0,skipNumbers)].concat(\r\n _.times(\r\n denotableParts, \r\n function (index) {\r\n var cutFrom, cutTo;\r\n cutTo = (3*(index+1)+skipNumbers);\r\n cutFrom = cutTo-3;\r\n return number.slice(cutFrom,cutTo);\r\n }\r\n )\r\n );\r\n }\r\n\r\n function getRealAndDecimalNumber (number) {\r\n // we expect that the number given is always like 1000.56\r\n var numberParts = number.match(/[0-9]+/g);\r\n if ( numberParts.length > 1 ) {\r\n return {\r\n realNumber: numberParts[0],\r\n decimalNumber: numberParts[1],\r\n };\r\n } else {\r\n return {\r\n realNumber: numberParts[0]\r\n };\r\n }\r\n }\r\n\r\n function getNumberFormatForLocale (localeName) {\r\n var localeToNumberFormat = getAllLocalesToNumberFormat();\r\n if ( localeToNumberFormat.hasOwnProperty(localeName) ) {\r\n return localeToNumberFormat[localeName];\r\n } else {\r\n console.warn(\"[localeNumberService]: locale by name\"+ localeName +\" does not exist.\");\r\n }\r\n }\r\n\r\n function getAllLocalesToNumberFormat () {\r\n\r\n var localesByNumberFormat = {};\r\n\r\n _.each(numberFormatToLocale, function (locales, numberFormat) {\r\n _.extend(\r\n localesByNumberFormat,\r\n makeLocaleToNumberFormatObject(locales, numberFormat)\r\n );\r\n });\r\n\r\n return localesByNumberFormat;\r\n }\r\n\r\n function makeLocaleToNumberFormatObject (locales, numberFormat) {\r\n return _.object(\r\n locales,\r\n _.times(locales.length, function () {\r\n return numberFormat;\r\n })\r\n );\r\n }\r\n }\r\n\r\n}(angular));","(function(angular) {\r\n 'use strict';\r\n\r\n\r\n angular.module('sonovate.core').factory('localisationParamParser', localisationParamParserController);\r\n\r\n function localisationParamParserController (localisationDateParser, localisationNumberParser) {\r\n\r\n\t\tvar locale, dateFormat;\r\n\r\n\t\tvar expressionVariableFormats = {\r\n date: function (date) {\r\n return localisationDateParser.formatDate(\r\n date, \r\n dateFormat\r\n );\r\n },\r\n number: function (number) {\r\n return localisationNumberParser.formatNumber(\r\n number,\r\n locale\r\n );\r\n }\r\n };\r\n\r\n return {\r\n getLocaleLabel: getLocaleLabel\r\n };\r\n\r\n function getLocaleLabel (text, labelParamaters, localeString, dateFormatString) {\r\n \tlocale = localeString;\r\n \tdateFormat = dateFormatString;\r\n if ( typeof labelParamaters === \"object\" ) {\r\n return parseLabelExpression(\r\n text,\r\n labelParamaters\r\n );\r\n } else {\r\n return text;\r\n }\r\n }\r\n\r\n function parseLabelExpression (expression, variables) {\r\n var expressionVariables = prepareVariablesForParsing(variables);\r\n return expression.replace(\r\n /{{[A-Za-z]*}}/g, \r\n function (variableName) {\r\n if ( expressionVariables.hasOwnProperty(variableName) ) {\r\n return expressionVariables[variableName];\r\n } else {\r\n console.warn(\"[localeTextService]:\\nExpression:\"+ expression +\"\\nVariable name: \"+ variableName +\"\\nHas not been provided.\");\r\n return \"\";\r\n }\r\n }\r\n );\r\n }\r\n\r\n function prepareVariablesForParsing (variables) {\r\n var formatedVariables = formatVariablesToLocale(variables);\r\n return _.object(\r\n _.map(_.keys(formatedVariables), function (key) {\r\n return \"{{\"+ key + \"}}\";\r\n }),\r\n _.values(formatedVariables)\r\n );\r\n }\r\n\r\n function formatVariablesToLocale (variables) {\r\n var variable = splitVariablesIntoKeysAndValues(variables);\r\n return _.object(\r\n _.map(variable.keys, function (key) {\r\n if ( variableHasFormat(key) ) {\r\n return key.replace(/\\[[A-Za-z0-9]+\\]/, \"\");\r\n } else {\r\n return key;\r\n }\r\n }),\r\n _.map(variable.values, function (value, index) {\r\n if ( variableHasFormat(variable.keys[index]) ) {\r\n return parseFormatedVariable(value, variable.keys[index]);\r\n } else {\r\n return value;\r\n }\r\n })\r\n );\r\n }\r\n\r\n function parseFormatedVariable (value, key) {\r\n var variableFormatName = getVariableFormatName(key);\r\n if ( variableFormatExists(variableFormatName) ) {\r\n return expressionVariableFormats[variableFormatName](value);\r\n } else {\r\n console.warn(\"[localeTextService]: variable format: \"+ variableFormatName +\"is not a valid one.\");\r\n return value;\r\n }\r\n }\r\n\r\n function variableHasFormat (variable) {\r\n return getVariableFormatName(variable) !== null;\r\n }\r\n\r\n function getVariableFormatName (variable) {\r\n var variableFormat = variable.match(/(\\[[A-Za-z0-9]+\\])/g);\r\n if ( variableFormat ) {\r\n return variableFormat[0].slice(1, variableFormat.length-2);\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n function variableFormatExists (variableFormat) {\r\n return _.contains(_.keys(expressionVariableFormats), variableFormat);\r\n }\r\n\r\n function splitVariablesIntoKeysAndValues (variables) {\r\n return {\r\n keys: _.keys(variables),\r\n values: _.values(variables)\r\n };\r\n }\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n\tangular.module(\"sonovate.core\").factory('localisationStore', localisationStoreController);\r\n\t\t\r\n\t\tfunction localisationStoreController (localisationActions, localisationParamParser) {\r\n\r\n\t\t\tvar data, subject;\r\n\r\n\t\t\tsubject = new Rx.ReplaySubject(1); \r\n\t\t\tdata = {\r\n\t\t\t\tlocale:'en-GB',\r\n\t\t\t\tdateFormat:'MM/DD/YYYY',\r\n\t\t\t\tloading:true,\r\n\t\t\t\tlabels: {},\r\n\t\t\t\tgetForLabel: getForLabel\r\n\t\t\t};\r\n\r\n\t\t\tlocalisationActions.subjects.getLabelSuccess.subscribe(addNewLabels);\r\n\t\t\tlocalisationActions.subjects.getCachedLabel.subscribe(getCachedLabel);\r\n\t\t\tlocalisationActions.subjects.getDateFormatSuccess.subscribe(setDateFormat);\r\n\r\n\t\t\tfunction addNewLabels (labels) {\r\n\t\t\t\tObject.keys(labels).forEach(function(key) {\r\n\t\t\t\t data.labels[key] = labels[key];\r\n\t\t\t\t});\r\n\t\t\t\tsubject.onNext(data);\r\n\t\t\t}\r\n\r\n\t\t\tfunction getCachedLabel () {\r\n\t\t\t\tsubject.onNext(data);\t\r\n\t\t\t}\r\n\r\n\t\t\tfunction setDateFormat (dateFormat) {\r\n\t\t\t\tdata.dateFormat = dateFormat;\r\n\t\t\t\tdata.loading = false;\r\n\t\t\t\tsubject.onNext(data);\r\n\t\t\t}\r\n\r\n\t\t\tfunction getForLabel (namespacedLabel, params) {\r\n\t\t\t\treturn localisationParamParser.getLocaleLabel(\r\n\t\t\t\t\tdata.labels[namespacedLabel], \r\n\t\t\t\t\tparams, \r\n\t\t\t\t\tdata.locale, \r\n\t\t\t\t\tdata.dateFormat\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\treturn subject;\r\n\t\t}\r\n}(angular));","(function(angular) {\r\n 'use strict';\r\n\r\n\tangular.module('sonovate.core').factory('localisationUtils', localisationUtilsController);\r\n\r\n\tfunction localisationUtilsController () { \r\n\t\treturn {\r\n\t\t\tgetNamespaceBase: function (namespacedLabel) { \r\n\t\t\t\treturn this.getNamespaceArray(namespacedLabel)[0];\r\n\t\t\t},\r\n\t\t\tgetNamespaceArray: R.split('.'),\r\n\t\t\tgenerateFiller: function (charLength) {\r\n\t\t\t\tvar generateString = R.pipe(\r\n\t\t\t\t\tR.range(0),\r\n\t\t\t\t\tR.mapAccum(function (string, num) {\r\n\t\t\t\t\t\treturn [string + 'x', num];\r\n\t\t\t\t\t}, '')\r\n\t\t\t\t);\r\n\r\n\t\t\t\tvar string = generateString(charLength)[0]; \r\n\t\t\t\tvar numberOfBlankSpaces = Math.round(charLength/5);\r\n\t\t\t\tvar randomNumbers = R.range(0,numberOfBlankSpaces) \r\n\t\t\t\t\t.map(function () {\r\n\t\t\t\t\t\treturn Math.floor((Math.random() * charLength) + 1);\r\n\t\t\t\t\t}).forEach(function(number) {\r\n\t\t\t\t\t\tstring = string.substr(0, number) + ' ' + string.substr(number + 1);\r\n\t\t\t\t\t});\r\n\t\t\t\treturn string;\r\n\t\t\t}\r\n\t\t};\r\n\t}\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n\tangular.module(\"sonovate.core\")\r\n\t.factory('localiser', localiser);\r\n\tfunction localiser (localisationActions, $rootScope, signedInUserStore) {\r\n\t\tvar requestedNamespaces = [];\r\n\t\tvar labelCache = Immutable.fromJS({});\r\n\t\tvar cleanUpObjects = [];\r\n\t\tvar language = \"\";\r\n\t\tlocalisationActions.resultSubjects.getLabels.subscribe(function (responseLabels) {\r\n\t\t\tcleanUp();\r\n\t\t\taddNewLabelsToCache(responseLabels);\r\n\t\t}); \r\n\r\n\t\tsignedInUserStore.subject.subscribe(function (data) {\r\n\t\t\tif (language !== data.languageCode) {\r\n\t\t\t\tlanguage = data.languageCode;\r\n\t\t\t\treloadAll();\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\tfunction get (labels) { \r\n\t\t\trequestLabels(labels);\r\n\r\n\t\t\tvar observable = new Rx.BehaviorSubject(getLabelCacheSubset(labels).toJS());\r\n\r\n\t\t\tvar subscription = localisationActions.resultSubjects.getLabels.subscribe(function () {\r\n\t\t\t\tobservable.onNext(getLabelCacheSubset(labels).toJS());\r\n\t\t\t});\r\n\r\n\t\t\tcleanUpObjects.push({\r\n\t\t\t\tobservable: observable,\r\n\t\t\t\tsubscription: subscription\r\n\t\t\t});\r\n\r\n\t\t\treturn observable;\r\n\t\t}\r\n\t\t\r\n\t\tfunction getCachedLabel(labelName) {\r\n\t\t\tvar cached = String_NamespaceAndLabel(labelName || \"\");\r\n\t\t\tif (cached.namespace && cached.label) {\r\n\t\t\t\treturn getSingleLabelSubsetFromCache(cached.namespace)[cached.label];\r\n\t\t\t}\r\n\t\t\treturn \"\";\r\n\t\t}\r\n\r\n\t\tfunction String_NamespaceAndLabel(string) {\r\n\t\t\treturn {\r\n\t\t\t\tnamespace: string.split(\".\")[0],\r\n\t\t\t\tlabel: string.split(\".\")[1]\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tfunction getSingleLabelSubsetFromCache(subsetName) {\r\n\t\t\tvar cachedSubset = getLabelCacheSubset([subsetName]).toJS();\r\n\t\t\tif (cachedSubset.hasOwnProperty(subsetName)) {\r\n\t\t\t\treturn cachedSubset[subsetName];\r\n\t\t\t}\r\n\t\t\treturn {};\r\n\t\t}\r\n\r\n\t\tfunction interpolate (labels, callback) {\r\n\t\t\trequestLabels(labels);\r\n\r\n\t\t\tvar params = callback();\r\n\r\n\t\t\tvar observable = new Rx.BehaviorSubject(interpolateParams(getLabelCacheSubset(labels), params).toJS());\r\n\r\n\t\t\tvar subscription = localisationActions.resultSubjects.getLabels.subscribe(function () {\r\n\t\t\t\tobservable.onNext(interpolateParams(getLabelCacheSubset(labels), params).toJS());\r\n\t\t\t});\r\n\r\n\t\t\tvar watcher = $rootScope.$watch(callback, function (watchParams) {\r\n\t\t\t\tcleanUp();\r\n\t\t\t\tparams = watchParams;\r\n\t\t\t\tobservable.onNext(interpolateParams(getLabelCacheSubset(labels), params).toJS());\r\n\t\t\t}, true);\r\n\r\n\t\t\tcleanUpObjects.push({\r\n\t\t\t\tobservable: observable,\r\n\t\t\t\tsubscription: subscription,\r\n\t\t\t\twatcher: watcher\r\n\t\t\t});\r\n\r\n\t\t\treturn observable;\r\n\t\t}\r\n\r\n\t\tfunction reloadAll() {\r\n\t\t\tvar labels = [];\r\n\r\n\t\t\t_.mapObject(labelCache, function (label, key) {\r\n\t\t\t\tlabels.push(key);\r\n\t\t\t});\r\n\r\n\t\t\tlabelCache = Immutable.fromJS({});\r\n\r\n\t\t\ttriggerGetLabelAction(labels);\r\n\t\t}\r\n\r\n\t\tfunction makeObjectFromLabelsArray(labels) {\r\n\t\t\treturn labels.reduce(function(obj, label) {\r\n\t\t\t\tobj[label] = {};\r\n\t\t\t\treturn obj;\r\n\t\t\t}, {});\r\n\r\n\t\t}\r\n\r\n\t\tfunction getLabelCacheSubset(labels) {\r\n\t\t\tvar subset = Immutable.fromJS(makeObjectFromLabelsArray(labels));\r\n\r\n\t\t\tlabels.forEach(function (label) {\r\n\t\t\t\tif (labelCache.toObject().hasOwnProperty(label)) {\r\n\t\t\t\t\tsubset = subset.set(label, labelCache.get(label));\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\treturn subset;\r\n\t\t}\r\n\r\n\t\tfunction requestLabels(labels) {\r\n\t\t\tvar filteredLabels = labels.filter(function (label) {\r\n\t\t\t\treturn requestedNamespaces.indexOf(label) === -1;\r\n\t\t\t}).map(function (label) {\r\n\t\t\t\trequestedNamespaces.push(label);\r\n\t\t\t\treturn label;\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\ttriggerGetLabelAction(filteredLabels);\r\n\t\t}\r\n\r\n\t\tfunction triggerGetLabelAction(labels) {\r\n\t\t\tif (labels.length) {\r\n\t\t\t\tlocalisationActions.requestSubjects.getLabels.onNext({language: language, labels: labels});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction cleanUp () {\r\n\t\t\tcleanUpObjects = cleanUpObjects.filter(function (object) {\r\n\t\t\t\tif (object.observable.observers.length === 0) {\r\n\t\t\t\t\tobject.subscription.dispose();\r\n\t\t\t\t\tdelete object.observable;\r\n\r\n\t\t\t\t\tif (object.hasOwnProperty('watcher')) {\r\n\t\t\t\t\t\tobject.watcher();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tfunction addNewLabelsToCache(responseLabels) {\r\n\t\t\tvar namespace; \r\n\t\t\tvar key;\r\n\t\t\tfor (var label in responseLabels) {\r\n\t\t\t\tnamespace = label.split('.')[0];\r\n\t\t\t\tkey = label.split('.')[1];\r\n\t\t\t\tlabelCache = labelCache.setIn([namespace, key], responseLabels[label]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction interpolateParams (labels, params) {\r\n\t\t\tvar interpolatedSets = labels;\r\n\r\n\t\t\t_.mapObject(interpolatedSets.toJS(), function (set, setKey) { \r\n\t\t\t\t_.mapObject(set, function (label, labelKey) {\r\n\t\t\t\t\tinterpolatedSets = interpolatedSets.setIn([setKey, labelKey], parseParams(label, params));\r\n\t\t\t\t});\r\n\t\t\t});\r\n\r\n\t\t\treturn interpolatedSets;\r\n\t\t}\r\n\r\n\t\tfunction parseParams (labelString, vars) {\r\n\t\t return labelString.replace(\r\n\t\t /{{[A-Za-z]*}}/g, \r\n\t\t function (variableName) {\r\n\t\t return vars[variableName.match(/{{(.+)}}/)[1]];\r\n\t\t });\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tget: get,\r\n\t\t\tinterpolate: interpolate,\r\n\t\t\tgetCachedLabel: getCachedLabel\r\n\t\t};\r\n\t}\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n \"snDate\",\r\n [\r\n 'localisationStore',\r\n 'localisationActions',\r\n 'localisationDateParser',\r\n snTranslate\r\n ]\r\n );\r\n\r\n function snTranslate (localisationStore, localisationActions, localisationDateParser) {\r\n return {\r\n restrict:\"E\",\r\n scope: { \r\n snDate:\"@\"\r\n },\r\n template: \"{{ date }}\",\r\n controller: function ($scope, $timeout) {\r\n \r\n var sub = localisationStore\r\n .safeApply($scope, function (data) {\r\n $scope.loading = data.loading;\r\n if (! $scope.loading) {\r\n var dateFormat = data.dateFormat;\r\n $scope.date = localisationDateParser.formatDate($scope.snDate, dateFormat);\r\n }\r\n })\r\n .subscribe();\r\n \r\n localisationActions.getDateFormat('en-GB');\r\n\r\n $scope.$on('$destroy', function () {\r\n sub.dispose();\r\n });\r\n }\r\n };\r\n }\r\n}(angular)); ","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n \"snNumber\",\r\n [\r\n 'localisationNumberParser',\r\n snTranslate\r\n ]\r\n );\r\n\r\n function snTranslate (localisationNumberParser) {\r\n return {\r\n restrict:\"E\",\r\n scope: { \r\n snNumber:\"@\"\r\n },\r\n template: \"{{ number }}\",\r\n controller: function ($scope) { \r\n $scope.number = localisationNumberParser.formatNumber($scope.snNumber,'en-GB');\r\n }\r\n };\r\n }\r\n\r\n}(angular)); ","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n \"snTranslate\",\r\n [\r\n 'localisationStore',\r\n 'localisationActions',\r\n 'localisationUtils',\r\n 'signedInUserStore',\r\n snTranslate\r\n ]\r\n );\r\n\r\n function snTranslate (localisationStore, localisationActions, localisationUtils, signedInUserStore) {\r\n return {\r\n restrict:\"E\",\r\n scope: { \r\n snLabel:\"@\",\r\n snLength:\"=\",\r\n snParams:\"@\"\r\n },\r\n templateUrl: \"core/localisation/snTranslateDirective.html\",\r\n controller: function ($scope) {\r\n\r\n var params, storeSubscription, labelName;\r\n var languageCode;\r\n\r\n signedInUserStore.subject.subscribe(function (data) {\r\n languageCode = data.languageCode;\r\n });\r\n\r\n params = getParams();\r\n labelName = $scope.snLabel;\r\n storeSubscription = localisationStore.safeApply($scope, setTranslatedText).subscribe();\r\n\r\n $scope.$watch(\"snLabel\", getNewLabelText);\r\n // Once signin complete, this needs updateing to get the locale from the jwt\r\n localisationActions.getDateFormat('en-GB');\r\n getLabelText();\r\n\r\n $scope.$on('$destroy', function () {\r\n storeSubscription.dispose();\r\n });\r\n\r\n function getNewLabelText(newLabel) {\r\n labelName = newLabel;\r\n getLabelText();\r\n }\r\n\r\n function setTranslatedText (data) {\r\n $scope.loading = data.loading;\r\n if (! $scope.loading) {\r\n $scope.text = data.getForLabel(labelName, params);\r\n }\r\n }\r\n \r\n function getLabelText () {\r\n if ( labelName ) {\r\n localisationActions.getLabel(labelName, languageCode);\r\n }\r\n }\r\n\r\n function getParams () {\r\n if ($scope.snParams) {\r\n return JSON.parse($scope.snParams);\r\n }\r\n return undefined;\r\n }\r\n }\r\n };\r\n }\r\n\r\n}(angular)); ","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n \"snTranslatePlaceholder\",\r\n [\r\n 'localisationStore',\r\n 'localisationActions',\r\n 'signedInUserStore',\r\n snTranslate\r\n ]\r\n );\r\n\r\n function snTranslate (localisationStore, localisationActions, signedInUserStore) {\r\n return {\r\n restrict:\"A\",\r\n scope: true,\r\n link: function ($scope, $elm, $attrs) {\r\n var params;\r\n var languageCode;\r\n\r\n signedInUserStore.subject.subscribe(function (data) {\r\n languageCode = data.languageCode;\r\n });\r\n\r\n if ($attrs.snParams) {\r\n params = JSON.parse($attrs.snParams);\r\n }\r\n\r\n var sub = localisationStore\r\n .safeApply($scope, function (data) {\r\n $scope.loading = data.loading;\r\n if (! $scope.loading) {\r\n $elm.attr('placeholder', data.getForLabel($attrs.snTranslatePlaceholder, params));\r\n }\r\n }).subscribe();\r\n\r\n // Once signin complete, this needs updateing to get the locale from the jwt\r\n localisationActions.getDateFormat('en-GB');\r\n\r\n \r\n localisationActions.getLabel($attrs.snTranslatePlaceholder, languageCode);\r\n\r\n $scope.$on('$destroy', function () {\r\n sub.dispose();\r\n });\r\n }\r\n };\r\n }\r\n\r\n}(angular));","(function(ng) {\r\n 'use strict';\r\n\r\n angular.module('sonovate.core')\r\n .factory(\r\n 'segmentEvents',\r\n function ($window, AuthenticationActions) {\r\n function run() {\r\n\r\n AuthenticationActions.subjects.signIn.subscribe(function (user) {\r\n $window.analytics.track('Signed In', {\r\n firstName: user.firstName,\r\n lastName: user.lastName,\r\n id: user.id,\r\n email: user.emailAddress\r\n });\r\n });\r\n\r\n AuthenticationActions.subjects.signUp.subscribe(function (user) {\r\n $window.analytics.track('Signed Up', {\r\n firstName: user.firstName,\r\n lastName: user.lastName,\r\n id: user.id,\r\n email: user.emailAddress\r\n });\r\n });\r\n }\r\n \r\n\r\n return {\r\n run: run\r\n };\r\n }\r\n );\r\n\r\n}(angular));","(function(ng) {\r\n 'use strict';\r\n\r\n angular.module('sonovate.core')\r\n .factory(\r\n 'segmentIdentify',\r\n function ($window, signedInUserStore) {\r\n function run () {\r\n signedInUserStore.subject.subscribe(function (data) {\r\n if (! data.id) {\r\n return;\r\n }\r\n \r\n $window.analytics.identify(data.id, {\r\n firstName: data.firstName,\r\n lastName: data.lastName,\r\n email: data.email\r\n });\r\n });\r\n }\r\n\r\n return {\r\n run: run\r\n };\r\n }\r\n );\r\n\r\n}(angular));","(function(ng) {\r\n 'use strict';\r\n\r\n angular.module('sonovate.core')\r\n .factory(\r\n 'segmentPageview',\r\n function ($rootScope, $window, $location) {\r\n function run () {\r\n $rootScope.$on('$stateChangeSuccess', function () {\r\n $window.analytics.page($location.url());\r\n });\r\n }\r\n\r\n return {\r\n run: run\r\n };\r\n }\r\n );\r\n\r\n}(angular));","(function(ng) {\r\n \"use strict\";\r\n\r\n angular.module('sonovate.core')\r\n .factory(\r\n 'currencyListActions',\r\n [\r\n \"httpService\", \r\n \"$http\", \r\n currencyListActions\r\n ]\r\n );\r\n\r\n function currencyListActions (httpService, $http, $cookies, $stateParams) {\r\n \r\n var subjects = {\r\n getCurrencyListOnSuccess: new Rx.Subject()\r\n };\r\n\r\n return {\r\n subjects: subjects,\r\n getCurrencyList: getCurrencyList,\r\n getCurrency: getCurrency\r\n };\r\n\r\n // TODO: Right now this only gets uk currencys, this will need to change in the future \r\n function getCurrencyList(){\r\n return Rx.Observable.fromPromise(\r\n httpService.getLocalisation(\"/v1/references/en-GB/currencies\", {})\r\n ).subscribe(\r\n function onSuccess(response) {\r\n subjects.getCurrencyListOnSuccess.onNext(response.data.result);\r\n }\r\n );\r\n }\r\n\r\n function getCurrency () {\r\n // TODO: IMPLIMENT GETTING A SPECIFIC CURRECNY\r\n }\r\n }\r\n\r\n}(angular));","(function(ng) {\r\n 'use strict';\r\n\r\n angular.module('sonovate.core')\r\n\r\n .factory('currencyStore', function(currencyListActions) {\r\n var currency = new Rx.ReplaySubject(1);\r\n\r\n var state = {\r\n currencies: []\r\n };\r\n\r\n currencyListActions.getCurrencyList();\r\n\r\n currencyListActions.subjects.getCurrencyListOnSuccess.subscribe(function(currencies){\r\n state.currencies = mapToItems(currencies);\r\n currency.onNext(state);\r\n });\r\n\r\n return currency;\r\n\r\n function mapToItems (currencies) {\r\n return R.map(function (currency) {\r\n return {\r\n text: currency.text + \" \" + \"(\" + currency.id + \")\",\r\n value: currency.id\r\n };\r\n }, currencies);\r\n }\r\n });\r\n\r\n}(angular));","\r\n(function(ng) {\r\n \"use strict\";\r\n\r\n angular.module('sonovate.core')\r\n .factory(\r\n 'organisationActions', [\r\n \"httpService\",\r\n \"$http\",\r\n \"$cookies\",\r\n \"$stateParams\",\r\n \"Upload\",\r\n \"ErrorUtilitiesService\",\r\n organisationActions\r\n ]\r\n );\r\n\r\n function organisationActions\r\n (\r\n httpService,\r\n $http,\r\n $cookies,\r\n $stateParams,\r\n Upload,\r\n ErrorUtilitiesService,\r\n APP_URL\r\n ) {\r\n\r\n var subjects = {\r\n getOrganisationOnSuccess: new Rx.Subject(),\r\n getOrganisationOnFail: new Rx.Subject(),\r\n\r\n getOrganisationNumbersOnSuccess: new Rx.Subject(),\r\n getOrganisationNumbersOnFail: new Rx.Subject(),\r\n\r\n getOrganisationCurrencyOnSuccess: new Rx.Subject(),\r\n getOrganisationCurrencyOnFail: new Rx.Subject(),\r\n\r\n putOrganisationProfilePictureOnSuccess: new Rx.Subject(),\r\n putOrganisationProfilePictureOnFail: new Rx.Subject(),\r\n\r\n onAddNumberSuccess: new Rx.Subject(),\r\n onAddNumberFail: new Rx.Subject(),\r\n\r\n onDeleteNumberSuccess: new Rx.Subject(),\r\n onDeleteNumberFail: new Rx.Subject(),\r\n\r\n changePhoneNumberOnSuccess: new Rx.Subject(),\r\n changePhoneNumberOnFail: new Rx.Subject(),\r\n\r\n putOrganisationDetailsOnSuccess: new Rx.Subject(),\r\n\r\n putOrganisationDetailsOnFail: new Rx.Subject(),\r\n\r\n onGetBankAccountOnSuccess: new Rx.Subject(),\r\n onGetBankAccountOnFail: new Rx.Subject(),\r\n\r\n onPostBankAccountOnSuccess: new Rx.Subject(),\r\n onPostBankAccountOnFail: new Rx.Subject(),\r\n onPostBankAccountOnFailValidation: new Rx.Subject(),\r\n\r\n onPutBankAccountOnSuccess: new Rx.Subject(),\r\n onPutBankAccountOnFail: new Rx.Subject(),\r\n\r\n clearErrors: new Rx.Subject(),\r\n\r\n onPublishBankAccountOnSuccess: new Rx.Subject(),\r\n onPublishBankAccountOnFail: new Rx.Subject(),\r\n\r\n onDiscardBankAccountOnSuccess: new Rx.Subject(),\r\n onDiscardBankAccountOnFail: new Rx.Subject(),\r\n\r\n onupdateOrganisationStore: new Rx.ReplaySubject(1)\r\n };\r\n\r\n return {\r\n subjects: subjects,\r\n updateStore : updateStore,\r\n getOrganisation: getOrganisation,\r\n getOrganisationNumbers: getOrganisationNumbers,\r\n addPhoneNumber: addPhoneNumber,\r\n deletePhoneNumber: deletePhoneNumber,\r\n changePhoneNumber: changePhoneNumber,\r\n putProfilePicture: putProfilePicture,\r\n deleteProfilePicture: deleteProfilePicture,\r\n putOrganisationDetails: putOrganisationDetails,\r\n getBankAccounts: getBankAccounts,\r\n publishBankAccount: publishBankAccount,\r\n discardBankAccount: discardBankAccount,\r\n updateOrganisationStore: updateOrganisationStore\r\n };\r\n\r\n function getOrganisation() {\r\n return Rx.Observable.fromPromise(\r\n httpService.get(\"/v1/organisations/\" + $stateParams.id, {})\r\n ).subscribe(\r\n function onSuccess(response) {\r\n subjects.getOrganisationOnSuccess.onNext({\r\n model: response.data.result,\r\n permissions: response.data.metadata.permissions\r\n });\r\n },\r\n function onFail(err) {\r\n subjects.getOrganisationOnFail.onNext(err);\r\n }\r\n );\r\n }\r\n\r\n function updateOrganisationStore (organisation) {\r\n return Rx.Observable.create(\r\n function (observer) {\r\n observer.onNext(organisation);\r\n }\r\n )\r\n .subscribe(\r\n function onSuccess(organisation) {\r\n subjects.onupdateOrganisationStore.onNext(organisation);\r\n }\r\n );\r\n }\r\n\r\n function getOrganisationNumbers() {\r\n return Rx.Observable.fromPromise(\r\n httpService.get(\"/v1/organisations/\" + $stateParams.id + \"/phone-numbers\", {})\r\n ).subscribe(\r\n function onSuccess(response) {\r\n subjects.getOrganisationNumbersOnSuccess.onNext(response.data.result);\r\n },\r\n function onFail(err) {\r\n subjects.getOrganisationNumbersOnFail.onNext(err.data.result);\r\n }\r\n );\r\n }\r\n\r\n function putProfilePicture (url,file) {\r\n return Rx.Observable.fromPromise(\r\n Upload.upload({\r\n url: url + \"/v1/organisations/\" + $stateParams.id + \"/profile/logo\",\r\n data: \r\n {\r\n file: file\r\n }\r\n }\r\n )).subscribe(\r\n function onSuccess(response) {\r\n subjects.putOrganisationProfilePictureOnSuccess.onNext(response.data.result.pictureUrl);\r\n },\r\n function onFail(err) {\r\n subjects.putOrganisationProfilePictureOnFail.onNext(err.data.result.messages[0]);\r\n }\r\n ); \r\n }\r\n\r\n function deleteProfilePicture (url,file) {\r\n return Rx.Observable.fromPromise(\r\n httpService.delete(\"/v1/organisations/\" + $stateParams.id + \"/profile/logo\")\r\n )\r\n .subscribe(\r\n function onSuccess(response) {\r\n subjects.onDeleteNumberSuccess.onNext(response.data.result);\r\n },\r\n function onFail(err) {\r\n subjects.onFonDeleteNumberFail.onNext(err);\r\n }\r\n ); \r\n }\r\n\r\n function addPhoneNumber (number) { \r\n // return Rx.Observable.fromPromise(\r\n // httpService.post(\"/v1/organisations/\" + $stateParams.id + \"/phone-numbers\", {\r\n // countryCode: number.countryId,\r\n // phoneNumber : number.phoneNumber\r\n // })\r\n // )\r\n // .subscribe(\r\n // function onSuccess(response) {\r\n\r\n // subjects.onAddNumberSuccess.onNext(response.data.result);\r\n // },\r\n // function onFail(err) {\r\n\r\n // subjects.onAddNumberFail.onNext(err.data.message);\r\n // }\r\n // ); \r\n }\r\n\r\n function deletePhoneNumber (phoneNumber) {\r\n return Rx.Observable.fromPromise(\r\n httpService.deleteItem(\"/v1/organisations/\" + $stateParams.id + \"/phone-numbers/\" + phoneNumber.phoneId)\r\n )\r\n .subscribe(\r\n function onSuccess(response) {\r\n subjects.onDeleteNumberSuccess.onNext(response.data.result);\r\n },\r\n function onFail(err) {\r\n subjects.onFonDeleteNumberFail.onNext(err);\r\n }\r\n ); \r\n }\r\n\r\n function changePhoneNumber (phoneNumber) {\r\n return Rx.Observable.fromPromise(\r\n httpService.put(\"/v1/organisations/\" + $stateParams.id + \"/phone-numbers/\" + phoneNumber.phoneId, {\r\n phoneId: phoneNumber.phoneId,\r\n dialPrefix: phoneNumber.dialPrefix,\r\n countryCode: phoneNumber.countryCode,\r\n phoneNumber: phoneNumber.phoneNumber\r\n })\r\n )\r\n .subscribe(\r\n function onSuccess(response) {\r\n subjects.changePhoneNumberOnSuccess.onNext(response.data.result);\r\n },\r\n function onFail(err) {\r\n subjects.changePhoneNumberOnFail.onNext(err);\r\n }\r\n ); \r\n }\r\n \r\n function putOrganisationDetails (organisation) {\r\n return Rx.Observable.fromPromise(\r\n httpService.put(\"/v1/organisations/\" + $stateParams.id + \"/profile\", {\r\n webSite : organisation.website,\r\n vatRegistrationDate : organisation.vatRegistrationDate,\r\n vatNumber : organisation.vatNumber,\r\n pictureUrl : organisation.pictureUrl,\r\n currencyCode : organisation.currencyCode,\r\n organisationClassification: organisation.organisationClassification\r\n })\r\n )\r\n .subscribe(\r\n function onSuccess(response) {\r\n subjects.putOrganisationDetailsOnSuccess.onNext(response.data.result);\r\n },\r\n function onFail(err) {\r\n subjects.putOrganisationDetailsOnFail.onNext(err);\r\n }\r\n ); \r\n }\r\n\r\n // BANK ACCOUNT FACETS\r\n\r\n function getBankAccounts() {\r\n return Rx.Observable.fromPromise(\r\n httpService.get(\"/v1/organisations/\" + $stateParams.id + \"/bank-accounts\")\r\n )\r\n .subscribe(\r\n function onSuccess(response) {\r\n subjects.onGetBankAccountOnSuccess.onNext(response.data.result);\r\n },\r\n function onFail(err) {\r\n subjects.onGetBankAccountOnFail.onNext(err);\r\n }\r\n );\r\n }\r\n\r\n function publishBankAccount(organisationId, bankAccountId) {\r\n return Rx.Observable.fromPromise(\r\n httpService.post(\"/v1/organisations/\" + organisationId + \"/bank-accounts/\" + bankAccountId + \"/publish\")\r\n )\r\n .subscribe(\r\n function onSuccess(response) {\r\n subjects.onPublishBankAccountOnSuccess.onNext(organisationId);\r\n },\r\n function onFail(err) {\r\n subjects.onPublishBankAccountOnFail.onNext(err.data.result.messages[0]);\r\n }\r\n );\r\n }\r\n\r\n function discardBankAccount(organisationId, bankAccountId) {\r\n return Rx.Observable.fromPromise(\r\n httpService.post(\"/v1/organisations/\" + organisationId + \"/bank-accounts/\" + bankAccountId + \"/discard\")\r\n )\r\n .subscribe(\r\n function onSuccess(response) {\r\n subjects.onDiscardBankAccountOnSuccess.onNext(organisationId);\r\n },\r\n function onFail(err) {\r\n subjects.onPublishBankAccountOnFail.onNext(err.data.result.messages[0]);\r\n }\r\n );\r\n }\r\n\r\n\r\n function updateStore (organisation) {\r\n subjects.getOrganisationOnSuccess.onNext(organisation);\r\n }\r\n\r\n function clearErrors () {\r\n subjects.clearErrors.onNext(\" \");\r\n }\r\n\r\n }\r\n\r\n}(angular));","(function(ng) {\r\n 'use strict';\r\n\r\n angular.module('sonovate.core')\r\n\r\n .factory('organisationStore', function(\r\n // legacly js org actions\r\n organisationActions, \r\n // no so legacy ts org actions\r\n OrganisationsActions,\r\n RiskEvents\r\n ) {\r\n\r\n var _this = this;\r\n\r\n _this.removeErrors = removeErrors;\r\n\r\n var organisationSubject = new Rx.ReplaySubject(1);\r\n var state, resetState;\r\n \r\n state = {\r\n organisation: {\r\n currencyCode: \"\",\r\n organisationId: \"\",\r\n organisationName: \"\",\r\n pictureUrl: \"\",\r\n registeredNumber: \"\",\r\n organisationClassification: \"\",\r\n vatNumber: \"\",\r\n vatRegistrationDate: \"\",\r\n website: \"\",\r\n links: [],\r\n assessmentType: \"\",\r\n assessments: [],\r\n assessmentSummary: null\r\n },\r\n billingProfiles: {},\r\n organisationPhoneNumbers: [],\r\n errors:{\r\n getOrganisationError:{\r\n vatRegistrationDate : \"\",\r\n vatNumber : \"\",\r\n baseCurrency: \"\",\r\n companyName : \"\",\r\n registrationNumber: \"\",\r\n website: \"\"\r\n },\r\n getNumbersError: false,\r\n addNumbersError: false,\r\n changeNumbersError: false,\r\n getCurrencyError: false,\r\n profilePictureError: false,\r\n putOrganisationDetailsError: false,\r\n publishFacetError: false,\r\n discardFacetError: false,\r\n billingProfileError: false,\r\n billingProfileFormErrors: false\r\n },\r\n messages: {\r\n showBillingProfileSaveSuccess: false\r\n },\r\n successfulResponse: false,\r\n bankAccounts:[\r\n {\r\n id: \"\",\r\n currencyCode: \"\",\r\n accountName: \"\",\r\n sortCode: \"\",\r\n accountNumber: \"\",\r\n bankBranchName: \"\",\r\n iban: \"\",\r\n bic: \"\",\r\n status: \"\"\r\n }\r\n ],\r\n bankAccountPostError: false,\r\n bankAccountFormErrors:{\r\n id: \"\",\r\n currencyCode: \"\",\r\n accountName: \"\",\r\n sortCode: \"\",\r\n accountNumber: \"\",\r\n bankBranchName: \"\",\r\n iban: \"\",\r\n bic: \"\",\r\n status: \"\",\r\n isoCountryCode: \"\"\r\n },\r\n tradingStyles: {\r\n data: []\r\n },\r\n permissions: []\r\n };\r\n\r\n resetState = angular.copy(state);\r\n\r\n RiskEvents.httpResults.submittedRiskStatusSuccessful.subscribe(function (result) {\r\n if (state.organisation.assessmentSummary) {\r\n state.organisation.assessmentSummary.assessmentStatus = angular.copy(result.assessmentStatus);\r\n }\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.getOrganisationOnSuccess.subscribe(function(response) {\r\n removeErrors();\r\n state.successfulResponse = false;\r\n state.organisation = response.model;\r\n state.permissions = response.permissions;\r\n setAssessmentType();\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n function setAssessmentType() {\r\n if (!R.isEmpty(state.organisation.assessments)) {\r\n state.organisation.assessmentSummary = state.organisation.assessments[0];\r\n state.organisation.assessmentType = state.organisation.assessmentSummary.assessmentType;\r\n }\r\n }\r\n\r\n organisationActions.subjects.getOrganisationOnFail.subscribe(function(error) {\r\n removeErrors();\r\n state.errors.getOrganisationError = error;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.resultSubjects.getOrganisationPhoneNumbersCompleted.subscribe(function(numbers) {\r\n removeErrors();\r\n state.organisationPhoneNumbers = numbers;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.requestSubjects.publishOrganisationPhoneNumber.subscribe(function (request) {\r\n state.organisationPhoneNumbers = state.organisationPhoneNumbers.map(function (number) {\r\n if (number.id === request.phoneNumberId) {\r\n number.status = 1;\r\n }\r\n return number;\r\n });\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.requestSubjects.discardOrganisationPhoneNumber.subscribe(function (request) {\r\n state.organisationPhoneNumbers = state.organisationPhoneNumbers.filter(function (number) {\r\n return number.id !== request.phoneNumberId;\r\n });\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.getOrganisationNumbersOnFail.subscribe(function(error) {\r\n state.getNumbersError = error;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.resultSubjects.addPhoneNumberToOrganisationCompleted.subscribe(function(number) {\r\n removeErrors();\r\n state.addNumbersError = false;\r\n state.organisationPhoneNumbers.push(number);\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.resultSubjects.addPhoneNumberToOrganisationFailed.subscribe(function(error) {\r\n removeErrors();\r\n var formError = error.form;\r\n state.addNumbersError = formError[Object.keys(formError)[0]];\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.onDeleteNumberFail.subscribe(function(error) {\r\n state.getNumbersError = error;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.changePhoneNumberOnSuccess.subscribe(function (updatedNumber) {\r\n removeErrors();\r\n state.changeNumbersError = false;\r\n var phoneNumberTarget = updatedNumber.phoneId;\r\n state.organisationPhoneNumbers.forEach(function(phoneNumber, i){\r\n if(phoneNumberTarget === phoneNumber.phoneId){\r\n phoneNumber.dialingCode = updatedNumber.dialingCode;\r\n phoneNumber.dialPrefix = updatedNumber.dialPrefix;\r\n phoneNumber.phoneId = updatedNumber.phoneId;\r\n phoneNumber.phoneNumber = updatedNumber.phoneNumber;\r\n }\r\n });\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.changePhoneNumberOnFail.subscribe(function(error) {\r\n state.changeNumbersError = error;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.putOrganisationProfilePictureOnSuccess.subscribe(function(url) {\r\n removeErrors();\r\n state.successfulResponse = true;\r\n state.organisation.pictureUrl = url;\r\n state.profilePictureError = false;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.putOrganisationProfilePictureOnFail.subscribe(function(error) {\r\n state.successfulResponse = false;\r\n state.profilePictureError = error;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.putOrganisationDetailsOnSuccess.subscribe(function(organisation) {\r\n removeErrors();\r\n state.successfulResponse = true;\r\n state.organisation = {\r\n currencyCode: organisation.currencyCode,\r\n organisationId: organisation.organisationId,\r\n organisationName: organisation.organisationName,\r\n pictureUrl: organisation.pictureUrl,\r\n registeredNumber: organisation.registeredNumber,\r\n vatNumber: organisation.vatNumber,\r\n vatRegistrationDate: organisation.vatRegistrationDate,\r\n organisationClassification: organisation.organisationClassification,\r\n website: organisation.website\r\n };\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.putOrganisationDetailsOnFail.subscribe(function(error) {\r\n state.successfulResponse = false;\r\n state.errors.putOrganisationDetailsError = error;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.onGetBankAccountOnSuccess.subscribe(function (bankAccounts) {\r\n removeErrors();\r\n state.bankAccounts = bankAccounts;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.onGetBankAccountOnFail.subscribe(function (error) {\r\n state.person.bankAccountError = error;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.onPostBankAccountOnSuccess.subscribe(function (bankAccount) {\r\n removeErrors();\r\n state.bankAccounts.push(bankAccount);\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.onPostBankAccountOnFail.subscribe(function (error) {\r\n removeErrors();\r\n state.bankAccountFormErrors = error.form;\r\n state.successfulResponse = false;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.onPostBankAccountOnFailValidation.subscribe(function (error) {\r\n removeErrors();\r\n state.successfulResponse = false;\r\n state.bankAccountPostError = error[\"0\"];\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.onPutBankAccountOnFail.subscribe(function (error) {\r\n removeErrors();\r\n state.successfulResponse = false;\r\n state.bankAccountFormErrors = error.form;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.onPutBankAccountOnSuccess.subscribe(function (updatedBankAccount) {\r\n removeErrors();\r\n var bankAccountTarget = updatedBankAccount.bankAccountId;\r\n state.bankAccounts.forEach(function(bankAccount, i){\r\n if(bankAccountTarget === updatedBankAccount.phoneId){\r\n bankAccount.accountName = updatedBankAccount.dialingCode;\r\n bankAccount.accountNumber = updatedBankAccount.dialPrefix;\r\n bankAccount.bankBranchName = updatedBankAccount.phoneId;\r\n bankAccount.bic = updatedBankAccount.updatedBankAccount;\r\n bankAccount.currencyCode = updatedBankAccount.phoneNumber;\r\n bankAccount.iban = updatedBankAccount.phoneNumber;\r\n bankAccount.sortCode = updatedBankAccount.phoneNumber;\r\n }\r\n });\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n organisationActions.subjects.onPublishBankAccountOnFail.subscribe(function (error) {\r\n state.publishFacetError = error;\r\n organisationSubject.onNext(state);\r\n removeErrors();\r\n });\r\n\r\n organisationActions.subjects.onDiscardBankAccountOnFail.subscribe(function (error) {\r\n state.discardFacetError = error;\r\n organisationSubject.onNext(state);\r\n removeErrors();\r\n });\r\n\r\n\r\n organisationActions.subjects.onPublishBankAccountOnSuccess.subscribe(function (id) {\r\n state.bankAccounts.forEach(function(bankAccount, i, array){\r\n if(id === bankAccount.id){\r\n state.bankAccounts[i].status = \"Published\";\r\n organisationSubject.onNext(state);\r\n removeErrors();\r\n }\r\n });\r\n });\r\n\r\n organisationActions.subjects.onDiscardBankAccountOnSuccess.subscribe(function (id) {\r\n state.bankAccounts.forEach(function(bankAccount, i, array){\r\n if(id === bankAccount.id){\r\n state.bankAccounts[i].status = \"Discarded\";\r\n organisationSubject.onNext(state);\r\n removeErrors();\r\n }\r\n });\r\n organisationSubject.onNext(state);\r\n removeErrors();\r\n });\r\n\r\n OrganisationsActions.subjects.getBillingProfileCompleted.subscribe(function (billingProfiles) {\r\n state.billingProfiles = billingProfiles;\r\n removeErrors();\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.subjects.saveBillingProfileCompleted.subscribe(function (billingProfile) {\r\n state.billingProfiles = state.billingProfiles.map(function (profile) {\r\n if (profile.id === billingProfile.id) {\r\n return billingProfile;\r\n }\r\n return profile;\r\n });\r\n state.messages.showBillingProfileSaveSuccess = true;\r\n removeErrors();\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.subjects.saveBillingProfileValidationFormError.subscribe(function (error) {\r\n removeErrors();\r\n state.messages.showBillingProfileSaveSuccess = false;\r\n state.errors.billingProfileFormErrors = error.form;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.subjects.saveBillingProfileFail.subscribe(function (error) {\r\n removeErrors();\r\n state.messages.showBillingProfileSaveSuccess = false;\r\n state.errors.billingProfileError = error;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.subjects.createBillingProfileFail.subscribe(function (error) {\r\n removeErrors();\r\n state.messages.showBillingProfileSaveSuccess = false;\r\n state.errors.billingProfileError = error;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.subjects.createBillingProfileCompleted.subscribe(function (billingProfile) {\r\n state.billingProfiles.push(billingProfile);\r\n state.messages.showBillingProfileSaveSuccess = true;\r\n removeErrors();\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.subjects.discardBillingProfileCompleted.subscribe(function (billingProfile) {\r\n state.billingProfiles = state.billingProfiles.filter(function (profile) {\r\n return profile.id !== billingProfile.id;\r\n });\r\n removeErrors();\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.subjects.deleteBillingProfileCompleted.subscribe(function (billingProfile) {\r\n state.billingProfiles = state.billingProfiles.filter(function (profile) {\r\n return profile.id !== billingProfile.id;\r\n });\r\n removeErrors();\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.subjects.publishBillingProfileCompleted.subscribe(function (billingProfile) {\r\n state.billingProfiles = state.billingProfiles.map(function (profile) {\r\n if(profile.id === billingProfile.id) {\r\n profile.status = 1;\r\n }\r\n });\r\n removeErrors();\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.subjects.dissmissBillingProfileSaveSuccessComplete.subscribe(function () {\r\n state.messages.showBillingProfileSaveSuccess = false;\r\n });\r\n\r\n OrganisationsActions.resultSubjects.getTradingStylesForOrganisationSuccess.subscribe(function (tradingStyles) {\r\n state.tradingStyles.data = tradingStyles;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.resultSubjects.addTradingStyleToOrganisationSuccess.subscribe(function (tradingStyle) {\r\n state.tradingStyles.data.push(tradingStyle);\r\n state.tradingStyles.formErrors.add = {};\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.resultSubjects.saveTradingStyleOnOrganisationSuccess.subscribe(function (tradingStyle) {\r\n state.tradingStyles.data = state.tradingStyles.data.map(function (tradingStyleItem) {\r\n if (tradingStyleItem.id === tradingStyle.id) {\r\n return tradingStyle;\r\n }\r\n return tradingStyleItem;\r\n });\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.requestSubjects.deleteTradingStyleFromOrganisation.subscribe(function (intent) {\r\n state.tradingStyles.data = state.tradingStyles.data.filter(function (tradingStyleItem) {\r\n return tradingStyleItem.id !== intent.tradingStyle.id;\r\n });\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.requestSubjects.discardTradingStyleOnOrganisation.subscribe(function (intent) {\r\n state.tradingStyles.data = state.tradingStyles.data.filter(function (tradingStyleItem) {\r\n return tradingStyleItem.id !== intent.tradingStyle.id;\r\n });\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.requestSubjects.publishTradingStyleOnOrganisation.subscribe(function (intent) {\r\n state.tradingStyles.data = state.tradingStyles.data.map(function (tradingStyleItem) {\r\n if (tradingStyleItem.id === intent.tradingStyle.id) {\r\n tradingStyleItem.status = 1;\r\n }\r\n return tradingStyleItem;\r\n });\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n OrganisationsActions.requestSubjects.clearOrganisationStore.subscribe(function (intent) {\r\n state = angular.copy(resetState);\r\n removeErrors();\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n function removeErrors(){\r\n state.errors = {\r\n getOrganisationError: false,\r\n getNumbersError: false,\r\n addNumbersError: false,\r\n changeNumbersError: false,\r\n getCurrencyError: false,\r\n profilePictureError: false,\r\n putOrganisationDetailsError: false,\r\n billingProfileFormErrors: false,\r\n billingProfileError: false\r\n };\r\n state.publishFacetError = false;\r\n state.discardFacetError = false;\r\n }\r\n return organisationSubject;\r\n });\r\n\r\n}(angular));","(function(ng) {\r\n 'use strict';\r\n\r\n angular.module('sonovate.core')\r\n\r\n .factory('organisationUpdateStore', function(organisationActions, OrganisationsActions) {\r\n\r\n var _this = this;\r\n\r\n var organisationSubject = new Rx.ReplaySubject(1);\r\n\r\n var state = {\r\n organisation: {\r\n currencyCode: \"\",\r\n organisationId: \"\",\r\n organisationName: \"\",\r\n pictureUrl: \"\",\r\n registeredNumber: \"\",\r\n organisationClassification: \"\",\r\n vatNumber: \"\",\r\n vatRegistrationDate: \"\",\r\n website: \"\",\r\n },\r\n organisationPhoneNumbers: [],\r\n errors:{\r\n getOrganisationError:{\r\n vatRegistrationDate : \"\",\r\n vatNumber : \"\",\r\n baseCurrency: \"\",\r\n companyName : \"\",\r\n registrationNumber: \"\",\r\n website: \"\"\r\n },\r\n getNumbersError: false,\r\n addNumbersError: false,\r\n changeNumbersError: false,\r\n getCurrencyError: false,\r\n profilePictureError: false,\r\n putOrganisationDetailsError: false,\r\n publishFacetError: false,\r\n discardFacetError: false\r\n },\r\n successfulResponse: false,\r\n bankAccounts:[\r\n {\r\n bankAccountId: false,\r\n currencyCode: false,\r\n accountName: false,\r\n sortCode: false,\r\n accountNumber: false,\r\n bankBranchName: false,\r\n iban: false,\r\n bic: false\r\n }\r\n ]\r\n };\r\n\r\n organisationActions.subjects.onupdateOrganisationStore.subscribe(function(organisation) {\r\n state.organisation = organisation;\r\n organisationSubject.onNext(state);\r\n });\r\n\r\n return organisationSubject;\r\n });\r\n\r\n}(angular));","(function(ng) {\r\n \"use strict\";\r\n\r\n angular.module('sonovate.core')\r\n .factory(\r\n 'roleListActions',\r\n [\r\n \"httpService\", \r\n \"$http\", \r\n \"$cookies\", \r\n \"$stateParams\",\r\n roleListActions\r\n ]\r\n );\r\n // this all belogins in data reference or org \r\n // if we have roles per org by the time you read this\r\n function roleListActions (httpService, $http, $cookies, $stateParams) {\r\n \r\n var subjects = {\r\n getRoleList: new Rx.Subject()\r\n };\r\n\r\n return {\r\n subjects: subjects,\r\n getRoleList: getRoleList\r\n };\r\n\r\n function getRoleList () {\r\n return Rx.Observable.fromPromise(\r\n httpService.get(\"/v1/roles\", {})\r\n )\r\n .subscribe(function onSuccess(response) {\r\n subjects.getRoleList.onNext(response.data.result);\r\n },\r\n angular.noop()\r\n );\r\n }\r\n }\r\n\r\n}(angular));","(function(ng) {\r\n 'use strict';\r\n\r\n angular.module('sonovate.core')\r\n .factory(\r\n 'roleListStore',\r\n function(roleListActions) {\r\n \r\n var store = new Rx.ReplaySubject(1);\r\n\r\n roleListActions.subjects.getRoleList.subscribe(getRoleList);\r\n \r\n return store;\r\n\r\n function getRoleList (roleList) {\r\n store.onNext(roleList);\r\n }\r\n }\r\n );\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .factory(\r\n \"screenSizeServiceService\",\r\n screenSizeServiceService\r\n );\r\n\r\n function screenSizeServiceService ($window) {\r\n return {\r\n isMobile: isMobile\r\n };\r\n\r\n function isMobile () {\r\n return $window.innerWidth <= 768;\r\n }\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .factory(\r\n \"statusIconTextStore\",\r\n statusIconTextStore\r\n );\r\n\r\n function statusIconTextStore (referenceDataActions) {\r\n\r\n var subject, state;\r\n\r\n subject = new Rx.ReplaySubject(1);\r\n state = [];\r\n\r\n referenceDataActions.resultSubjects.getStatusesComplete.subscribe(setState);\r\n\r\n return subject;\r\n\r\n\r\n function setState (statuses) {\r\n state = getStatusIconDetails(statuses);\r\n subject.onNext({\r\n state: state,\r\n getStatusDetails: getStatusDetails\r\n });\r\n }\r\n\r\n function getStatusIconDetails (statuses) {\r\n return R.mergeWith(\r\n R.merge,\r\n getStatusToIcon(),\r\n convertStatusesToIconDetailsObject(statuses)\r\n );\r\n }\r\n\r\n function convertStatusesToIconDetailsObject (statuses) {\r\n return R.pipe(\r\n R.map(function (status) { \r\n return [\r\n status.id, \r\n { \r\n text: status.text \r\n }\r\n ]; \r\n }),\r\n R.fromPairs\r\n )(statuses);\r\n }\r\n\r\n function getStatusDetails (prefix, statusId) {\r\n if ( isValidStatusId(statusId) ) {\r\n return findStatusDetails(prefix, statusId);\r\n }\r\n return {};\r\n }\r\n\r\n function findStatusDetails(prefix, statusId) {\r\n\r\n var id = prefix ? prefix + \".\" + statusId : statusId;\r\n\r\n return state[id];\r\n }\r\n\r\n function isValidStatusId(statusId) {\r\n return !R.isNil(statusId) && !R.isEmpty(statusId) && statusId !== \"None\";\r\n }\r\n\r\n function getStatusToIcon () { \r\n return {\r\n \"AccountStatus.Suspended\": {\r\n icon: \"no-entry\",\r\n color: \"parrot\",\r\n },\r\n \"AccountStatus.Active\": {\r\n icon: \"tick-circle-filled\",\r\n color: \"apple\",\r\n },\r\n \"AccountStatus.Pending\": {\r\n icon: \"clock-filled\",\r\n color: \"daffodil\",\r\n },\r\n \"AccountStatus.Locked\": {\r\n icon: \"lock\",\r\n color: \"parrot\",\r\n },\r\n \"AccountStatus.Verified\": {\r\n icon: \"tick-circle-filled\",\r\n color: \"apple\",\r\n },\r\n \"OrganisationAccountStatus.Proposed\": {\r\n icon: \"clock-filled\",\r\n color: \"daffodil\",\r\n },\r\n \"OrganisationAccountStatus.Verified\": {\r\n icon: \"tick-circle-filled\",\r\n color: \"apple\",\r\n },\r\n \"OrganisationAccountStatus.Rejected\": {\r\n icon: \"no-entry-filled\",\r\n color: \"parrot\"\r\n },\r\n // account status none removed all statuses set to none should be invisible\r\n // remove this when we convert to ts, left just in case there \r\n // was a oversight in ux thinking none should be invis for org\r\n // \"OrganisationAccountStatus.None\": {\r\n // icon: \"no-entry-filled\",\r\n // color: \"parrot\"\r\n // }\r\n };\r\n }\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive('snAccountStatus', snAccountStatus);\r\n\r\n function snAccountStatus () {\r\n return {\r\n restrict: 'E',\r\n templateUrl: 'core/components/snAccountStatus/snAccountStatus.html',\r\n scope: {\r\n snStatus: '@'\r\n },\r\n controllerAs: 'vm',\r\n bindToController:true,\r\n controller: function ($scope) {\r\n if (this.snStatus === \"Active\")\r\n {\r\n this.snStatusText = \"Account Active\";\r\n this.snIcon=\"sn-ico-tick-circle-filled\";\r\n }\r\n else if (this.snStatus === \"Pending\")\r\n {\r\n this.snStatusText = \"Account pending\";\r\n this.snIcon=\"sn-ico-clock-filled\";\r\n }\r\n else if (this.snStatus === \"Notactivated\")\r\n {\r\n this.snStatusText = \"Account not active\";\r\n this.snIcon=\"sn-ico-no-entry-filled\";\r\n }\r\n }\r\n };\r\n }\r\n \r\n}(angular));","(function(angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive('snButton', [snButton]);\r\n\r\n function snButton() {\r\n return {\r\n restrict: 'E',\r\n templateUrl: 'core/components/snButton/snButtonDirective.html',\r\n scope: {\r\n snButtonLabel: \"@\",\r\n snSref: \"@\",\r\n snIconClass: \"@\",\r\n snIconColor: \"@\",\r\n snButtonClass:\"@\",\r\n snModifiers: \"@\",\r\n snOnClick:\"&\",\r\n snTabindex:\"@\",\r\n snType: \"=\",\r\n snModifier: '@',\r\n snTextModifier: '@'\r\n },\r\n controllerAs: 'vm',\r\n bindToController: true,\r\n controller: function ($state) {\r\n this.sref = this.snSref;\r\n this.onClick = function () {\r\n if (this.snSref) {\r\n $state.go(this.snSref);\r\n }\r\n this.snOnClick();\r\n };\r\n }\r\n };\r\n }\r\n \r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n 'snFocusOn',\r\n snFocusOn\r\n );\r\n\r\n function snFocusOn ($timeout) {\r\n return {\r\n restrict: \"A\",\r\n link: function ($scope, element, attributes) {\r\n snFocusOnLink($scope, element, attributes, $timeout);\r\n }\r\n };\r\n }\r\n\r\n function snFocusOnLink ($scope, element, attributes, $timeout) {\r\n $scope.$watch(attributes.snFocusOn, function (focusElement) {\r\n if (focusElement) {\r\n // slight timeout is necessary because of a \r\n // bug in chrome which wont focus if we dont time it out\r\n $timeout(function () {\r\n element[0].focus();\r\n }, 1);\r\n }\r\n });\r\n }\r\n \r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n \"snHideOnMobile\",\r\n snHideOnMobile\r\n );\r\n\r\n function snHideOnMobile (screenSizeServiceService) {\r\n return {\r\n restrict: \"A\",\r\n link: function ($scope, element, attributes) {\r\n snShowOnMobileLink($scope, element, attributes, screenSizeServiceService);\r\n }\r\n };\r\n }\r\n\r\n function snShowOnMobileLink ($scope, element, attributes, screenSizeServiceService) {\r\n if (screenSizeServiceService.isMobile()) {\r\n element.css({ display: \"none\" });\r\n }\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n \"snImageCircle\",\r\n snImageCircle\r\n );\r\n\r\n function snImageCircle () {\r\n return {\r\n restrict: \"E\",\r\n bindToController: true,\r\n controller: snImageCircleController,\r\n controllerAs: \"vm\",\r\n scope: {\r\n snImageUrl: \"@\",\r\n snWidth: \"@\"\r\n },\r\n templateUrl: 'core/components/snImageCircle/snImageCircleDirective.html'\r\n };\r\n }\r\n\r\n function snImageCircleController ($scope) {\r\n\r\n var _this;\r\n _this = this; // jshint ignore:line\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n 'snKeydownArrowDown', \r\n snKeydownArrowDown\r\n );\r\n\r\n function snKeydownArrowDown (keyboardEventGeneratorService) {\r\n return {\r\n restrict: \"A\",\r\n link: function ($scope, element, attributes) {\r\n snKeydownArrowDownLink($scope, element, attributes, keyboardEventGeneratorService);\r\n }\r\n };\r\n }\r\n\r\n function snKeydownArrowDownLink ($scope, element, attributes, keyboardEventGeneratorService) {\r\n keyboardEventGeneratorService.bindEvent({\r\n $scope: $scope,\r\n element: element,\r\n eventName: \"keydown\",\r\n keyCode: 40,\r\n callbackAttribute: attributes.snKeydownArrowDown,\r\n stopPropagation: attributes.snKeydownArrowDownStopPropagation\r\n });\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n 'snKeydownArrowLeft',\r\n snKeydownArrowLeft\r\n );\r\n\r\n function snKeydownArrowLeft (keyboardEventGeneratorService) {\r\n return {\r\n restrict: \"A\",\r\n link: function ($scope, element, attributes) {\r\n snKeydownArrowUpLink($scope, element, attributes, keyboardEventGeneratorService);\r\n }\r\n };\r\n }\r\n\r\n function snKeydownArrowUpLink ($scope, element, attributes, keyboardEventGeneratorService) {\r\n keyboardEventGeneratorService.bindEvent({\r\n $scope: $scope,\r\n element: element,\r\n eventName: \"keydown\",\r\n keyCode: 37,\r\n callbackAttribute: attributes.snKeydownArrowLeft,\r\n stopPropagation: attributes.snKeydownArrowUpDownStopPropagation\r\n });\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n 'snKeydownArrowRight',\r\n snKeydownArrowRight\r\n );\r\n\r\n function snKeydownArrowRight (keyboardEventGeneratorService) {\r\n return {\r\n restrict: \"A\",\r\n link: function ($scope, element, attributes) {\r\n snKeydownArrowUpLink($scope, element, attributes, keyboardEventGeneratorService);\r\n }\r\n };\r\n }\r\n\r\n function snKeydownArrowUpLink ($scope, element, attributes, keyboardEventGeneratorService) {\r\n keyboardEventGeneratorService.bindEvent({\r\n $scope: $scope,\r\n element: element,\r\n eventName: \"keydown\",\r\n keyCode: 39,\r\n callbackAttribute: attributes.snKeydownArrowRight,\r\n stopPropagation: attributes.snKeydownArrowUpDownStopPropagation\r\n });\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n 'snKeydownArrowUp',\r\n snKeydownArrowUp\r\n );\r\n\r\n function snKeydownArrowUp (keyboardEventGeneratorService) {\r\n return {\r\n restrict: \"A\",\r\n link: function ($scope, element, attributes) {\r\n snKeydownArrowUpLink($scope, element, attributes, keyboardEventGeneratorService);\r\n }\r\n };\r\n }\r\n\r\n function snKeydownArrowUpLink ($scope, element, attributes, keyboardEventGeneratorService) {\r\n keyboardEventGeneratorService.bindEvent({\r\n $scope: $scope,\r\n element: element,\r\n eventName: \"keydown\",\r\n keyCode: 38,\r\n callbackAttribute: attributes.snKeydownArrowUp,\r\n stopPropagation: attributes.snKeydownArrowUpDownStopPropagation\r\n });\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n 'snKeydownBackspace',\r\n snKeydownBackspace\r\n );\r\n\r\n function snKeydownBackspace (keyboardEventGeneratorService) {\r\n return {\r\n restrict: \"A\",\r\n link: function ($scope, element, attributes) {\r\n snKeydownArrowUpLink($scope, element, attributes, keyboardEventGeneratorService);\r\n }\r\n };\r\n }\r\n\r\n function snKeydownArrowUpLink ($scope, element, attributes, keyboardEventGeneratorService) {\r\n keyboardEventGeneratorService.bindEvent({\r\n $scope: $scope,\r\n element: element,\r\n eventName: \"keydown\",\r\n keyCode: 8,\r\n callbackAttribute: attributes.snKeydownBackspace,\r\n stopPropagation: attributes.snKeydownArrowUpDownStopPropagation\r\n });\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n 'snKeydownEnter', \r\n snKeydownEnter\r\n );\r\n\r\n function snKeydownEnter (keyboardEventGeneratorService) {\r\n return {\r\n restrict: \"A\",\r\n link: function ($scope, element, attributes) {\r\n snKeydownEnterLink($scope, element, attributes, keyboardEventGeneratorService);\r\n }\r\n };\r\n }\r\n\r\n function snKeydownEnterLink ($scope, element, attributes, keyboardEventGeneratorService) {\r\n keyboardEventGeneratorService.bindEvent({\r\n $scope: $scope,\r\n element: element,\r\n eventName: \"keydown\",\r\n keyCode: 13,\r\n callbackAttribute: attributes.snKeydownEnter,\r\n stopPropagation: attributes.snKeydownEnterStopPropagation\r\n });\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n 'snKeydownEscape', \r\n snKeydownEscape\r\n );\r\n\r\n function snKeydownEscape (keyboardEventGeneratorService) {\r\n return {\r\n restrict: \"A\",\r\n link: function ($scope, element, attributes) {\r\n snKeydownEscapeLink($scope, element, attributes, keyboardEventGeneratorService);\r\n }\r\n };\r\n }\r\n\r\n function snKeydownEscapeLink ($scope, element, attributes, keyboardEventGeneratorService) {\r\n keyboardEventGeneratorService.bindEvent({\r\n $scope: $scope,\r\n element: element,\r\n eventName: \"keydown\",\r\n keyCode: 27,\r\n callbackAttribute: attributes.snKeydownEscape,\r\n stopPropagation: attributes.snKeydownEscapeStopPropagation\r\n });\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n 'snKeydownTab', \r\n snKeydownTab\r\n );\r\n\r\n function snKeydownTab (keyboardEventGeneratorService) {\r\n return {\r\n restrict: \"A\",\r\n link: function ($scope, element, attributes) {\r\n snKeydownTabLink($scope, element, attributes, keyboardEventGeneratorService);\r\n }\r\n };\r\n }\r\n\r\n function snKeydownTabLink ($scope, element, attributes, keyboardEventGeneratorService) {\r\n keyboardEventGeneratorService.bindEvent({\r\n $scope: $scope,\r\n element: element,\r\n eventName: \"keydown\",\r\n keyCode: 9,\r\n callbackAttribute: attributes.snKeydownTab,\r\n stopPropagation: attributes.snKeydownTabStopPropagation\r\n });\r\n }\r\n\r\n}(angular));","(function (ng) {\r\n\t\"use strict\";\r\n\r\n\tng.module(\"sonovate.core\")\r\n\t.directive(\"snMessageBar\", snMessageBar);\r\n\r\n\tfunction snMessageBar() {\r\n\t\treturn {\r\n\t\t\trestrict: \"E\",\r\n\t\t\tscope: {\r\n\t\t\t\tsnShow:\"=\",\r\n\t\t\t\tsnColor: \"@\",\r\n\t\t\t\tsnIcon: \"@\",\r\n\t\t\t\tsnLabel: \"@\",\r\n\t\t\t\tsnShowCancel:\"=\",\r\n\t\t\t\tsnShowConfirm:\"=\",\r\n\t\t\t\tsnCancelLabel: \"@\",\r\n\t\t\t\tsnConfirmLabel: \"@\",\r\n\t\t\t\tsnOnDismiss: \"&\",\r\n\t\t\t\tsnOnConfirm: \"&\",\r\n\t\t\t\tsnNonLocalisedLabel: \"=\",\r\n\t\t\t\tsnShowReload:\"=\",\r\n\t\t\t\tsnReloadText:\"@\"\r\n\t\t\t},\r\n\t\t\ttemplateUrl: \"core/components/snMessageBarDirective/snMessageBarDirective.html\",\r\n\t\t\tcontrollerAs: \"vm\",\r\n\t\t\tbindToController: true,\r\n\t\t\tcontroller: function () {\r\n\t\t\t\tthis.dismiss = function () {\r\n\t\t\t\t\tthis.snShow = false;\r\n\t\t\t\t\tthis.snOnDismiss();\r\n\t\t\t\t};\r\n\r\n\t\t\t\tthis.confirm = function () {\r\n\t\t\t\t\tthis.snShow = false;\r\n\t\t\t\t\tthis.snOnConfirm();\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t};\r\n\t}\r\n\r\n}(angular));","(function (ng) {\r\n 'use strict';\r\n\r\n ng.module('sonovate')\r\n .directive('snOnEnter',[onEnter]);\r\n\r\n function onEnter () {\r\n return function (scope, element, attrs) {\r\n element.bind(\"keydown keypress\", function (event) {\r\n if(event.which === 13) {\r\n scope.$apply(function (){\r\n scope.$eval(attrs.snOnEnter);\r\n });\r\n\r\n event.preventDefault();\r\n }\r\n });\r\n };\r\n }\r\n\r\n}(angular));\r\n","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n \"snOrganisationProfilePicture\",\r\n snOrganisationProfilePicture\r\n );\r\n\r\n function snOrganisationProfilePicture () {\r\n return {\r\n restrict: \"E\",\r\n controller: snOrganisationProfilePictureController,\r\n controllerAs: \"vm\",\r\n bindToController: true,\r\n scope: {\r\n snSrc: \"@\",\r\n snWidth: \"@\",\r\n snBackgroundColor: \"@\"\r\n },\r\n templateUrl: 'core/components/snOrganisationProfilePicture/snOrganisationProfilePictureDirective.html',\r\n link: function (scope, element, attributes) {\r\n snOrganisationProfilePictureLink(scope, element, attributes);\r\n }\r\n };\r\n }\r\n\r\n function snOrganisationProfilePictureController ($scope) {\r\n\r\n var _this;\r\n _this = this; // jshint ignore:line\r\n _this.snBackgroundColor = _this.snBackgroundColor || \"slate\";\r\n }\r\n\r\n function snOrganisationProfilePictureLink (scope, element, attributes) {\r\n\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive('snPersonProfilePicture', snPersonProfilePicture);\r\n\r\n function snPersonProfilePicture () {\r\n return {\r\n restrict: 'E',\r\n templateUrl: 'core/components/snPersonProfilePicture/snPersonProfilePictureDirective.html',\r\n scope: {\r\n snWidth: \"@\",\r\n snClassString: \"@\",\r\n snSrc: \"@\",\r\n snFontColor: \"@\",\r\n snIcon: \"@\",\r\n snFirstName: \"=\",\r\n snLastName: \"=\",\r\n snFontSize: '@',\r\n snAccountStatus: \"@\",\r\n snBackgroundColor: \"@\",\r\n snShowUploadIcon: \"=\"\r\n },\r\n controllerAs: 'vm',\r\n bindToController:true,\r\n controller: function ($scope) {\r\n this.getFirstCharacterOfString = getFirstCharacterOfString;\r\n this.snFontColor = this.snFontColor || \"coal\";\r\n\r\n function getFirstCharacterOfString (string) {\r\n if (string) { \r\n return string.charAt(0);\r\n }\r\n return \"\";\r\n }\r\n\r\n this.setWidth = function(){\r\n return {\r\n width: $scope.vm.snWidth,\r\n height: $scope.vm.snWidth\r\n };\r\n };\r\n\r\n this.setFontSize = function(){\r\n return{\"font-size\":$scope.vm.snFontSize};\r\n };\r\n }\r\n };\r\n }\r\n\r\n}(angular));","(function (ng) {\r\n\t\r\n\t\"use strict\";\r\n\r\n\tng.module(\"sonovate.core\")\r\n\t.directive(\"snPopout\", snPopout);\r\n\r\n\tfunction snPopout () {\r\n\t\treturn {\r\n\t\t\trestrict: \"E\",\r\n\t\t\tscope: {\r\n\t\t\t\tsnListItems:\"=\",\r\n\t\t\t\tsnPopoutColor: \"@\",\r\n\t\t\t\tsnOnClickLink: \"&\",\r\n\t\t\t\tsnVerticalArrowPosition: \"@\",\r\n\t\t\t\tsnHorizontalArrowPosition: \"@\",\r\n\t\t\t\tsnShowMenu: \"=\",\r\n\t\t\t\tsnPositions: \"=\",\r\n\t\t\t\tsnTabIndexStartAt:\"=\",\r\n\t\t\t\tsnBlur:\"&\",\r\n\t\t\t\tsnFocus:\"&\"\r\n\r\n\t\t\t}, \r\n\t\t\ttemplateUrl: \"core/components/snPopout/snPopoutDirective.html\",\r\n\t\t\tcontrollerAs: \"vm\",\r\n\t\t\tbindToController: true,\r\n\t\t\tcontroller: snPopoutController,\r\n\t\t\tlink: function (scope, element, attributes) {\r\n snPopoutLink(scope, element, attributes);\r\n }\r\n\t\t};\r\n\t}\r\n\r\n\tfunction snPopoutController($scope, $timeout) {\r\n\t\tvar _this;\r\n\t\t_this = this; // jshint ignore:line\r\n\t\t_this.menuItemFocused = false;\r\n\t\r\n\t\t_this.blurTriggered = blurTriggered;\r\n\t\t_this.focusTriggered = focusTriggered;\r\n\t\t_this.toggleItemFocused = toggleItemFocused;\r\n\t\t_this.closeMenu = closeMenu;\r\n\t\t_this.clickLink = clickLink;\r\n\r\n\t\tfunction clickLink(listItem) {\r\n\t\t\t// listItem.action() to be depreciated - uses of this need to be replaced by snOnClickLink implementations\r\n\t\t\tif (_.isFunction(listItem.action)) {\r\n\t\t\t\tlistItem.action();\t\t \t\t\r\n\t\t\t}\r\n\r\n\t\t\t_this.snOnClickLink({item: listItem});\r\n\t\t}\r\n\r\n\t\tfunction blurTriggered (lastIndex) {\r\n\t\t\t_this.toggleItemFocused();\r\n\t\t\t_this.snBlur();\r\n\t\t\t\r\n\t\t\t$timeout(function () {\r\n\t\t\t\tif (!_this.menuItemFocused) {\r\n\t\t\t\t\t_this.closeMenu();\r\n\t\t\t\t}\r\n\t\t\t}, 100);\r\n\t\t}\r\n\r\n\t\tfunction focusTriggered (lastIndex) {\r\n\t\t\t_this.toggleItemFocused();\r\n\t\t\t_this.snFocus();\r\n\t\t}\r\n\r\n\t\tfunction toggleItemFocused (lastIndex) {\r\n\t\t\t_this.menuItemFocused = !_this.menuItemFocused;\r\n\t\t}\r\n\r\n\t\tfunction closeMenu () {\r\n\t\t\t_this.snShowMenu = false;\r\n\t\t}\r\n\t}\r\n\r\n\tfunction snPopoutLink (scope, element, attributes) {\r\n\t\tif (scope.vm.snPositions) {\r\n\t\t\tvar positions =\r\n\t\t\t\tJSON.stringify(scope.vm.snPositions)\r\n\t\t\t\t.replace(/[\\s\"'{}]/g, \"\").replace(/,/g, \";\");\r\n\t\t\t\r\n\t\t\telement.children().attr(\"style\", positions);\r\n\t\t}\r\n\r\n\t\telement.addClass(\"popout__wrapper\");\r\n }\r\n\r\n}(angular));","(function (ng) {\r\n\t\r\n\t\"use strict\";\r\n\r\n\tng.module(\"sonovate.core\")\r\n\t.directive(\"snPopoutListItem\", snPopoutListItem);\r\n\r\n\tfunction snPopoutListItem () {\r\n\t\treturn {\r\n\t\t\trestrict: \"E\",\r\n\t\t\tscope: {\r\n\t\t\t\tsnIcon:\"@\",\r\n\t\t\t\tsnText: \"@\",\r\n\t\t\t\tsnAction: \"&\",\r\n\t\t\t\tsnShow: \"=\",\r\n\t\t\t\tsnIndex: \"=\",\r\n\t\t\t\tsnTabindex: \"=\",\r\n\t\t\t\tsnBlur: \"&\",\r\n\t\t\t\tsnFocus: \"&\",\r\n\t\t\t\tsnCloseMenu: \"&\"\r\n\t\t\t},\r\n\t\t\ttemplateUrl: \"core/components/snPopoutListItem/snPopoutListItem.html\",\r\n\t\t\tcontroller: snPopoutListItemController,\r\n\t\t\tcontrollerAs: \"vm\",\r\n\t\t\tbindToController: true,\r\n\t\t\tlink: function (scope, element, attributes) {\r\n snPopoutListItemLink(scope, element, attributes);\r\n }\r\n\t\t};\r\n\t}\r\n\r\n\tfunction snPopoutListItemController($scope) {\r\n\t\tvar _this;\r\n\r\n\t\t_this = this; // jshint ignore:line\r\n\t\t_this.firstIndex = _this.snIndex === 1;\r\n\r\n\t\t_this.onEnter = onEnter;\r\n\r\n\t\tfunction onEnter () {\r\n\t\t\t_this.snAction();\r\n\t\t\t_this.snCloseMenu();\r\n\t\t}\r\n\t}\r\n\r\n\tfunction snPopoutListItemLink (scope, element, attributes ) {}\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive('snRadioButton', [snRadioButton]);\r\n\r\n function snRadioButton () {\r\n return {\r\n restrict: 'E',\r\n templateUrl: 'core/components/snRadioButton/snRadioButtonDirective.html',\r\n scope: {\r\n snId: \"@\",\r\n snName: \"@\",\r\n snLabel: \"@\",\r\n snDescription: \"@\",\r\n snModel: \"=\",\r\n snValue: \"@\",\r\n snChange: \"&\",\r\n snIcon: \"@\",\r\n snIconColor: \"@\",\r\n snOnClick: \"&\",\r\n snItem: \"=\",\r\n snReturnCurrentSelectedValue: \"&\"\r\n },\r\n controller: 'snRadioButtonController',\r\n controllerAs: 'vm',\r\n bindToController: true\r\n };\r\n }\r\n\r\n angular.module(\"sonovate.core\")\r\n .controller('snRadioButtonController', ['$scope', snRadioButtonController]);\r\n\r\n function snRadioButtonController ($scope) { \r\n var _this = this; // jshint ignore:line\r\n\r\n\r\n function setChecked() {\r\n _this.isChecked = false;\r\n if (_.isObject(_this.snModel)) {\r\n _this.value = angular.copy(_this.snModel);\r\n _this.value.value = _this.snValue;\r\n\r\n if (_this.value.value === _this.snModel.value) {\r\n _this.isChecked = true;\r\n }\r\n\r\n } else {\r\n _this.value = _this.snValue;\r\n \r\n if (_this.value === _this.snModel) {\r\n _this.isChecked = true;\r\n }\r\n }\r\n _this.snReturnCurrentSelectedValue({value: _this.snValue });\r\n _this.snChange();\r\n }\r\n\r\n $scope.$watch('vm.snModel', setChecked);\r\n }\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n 'snScrollBar',\r\n snScrollBar\r\n );\r\n\r\n function snScrollBar ($parse) {\r\n return {\r\n restrict: \"A\",\r\n link: function ($scope, element, attributes) {\r\n snScrollBarLink($scope, element, attributes, $parse);\r\n }\r\n };\r\n }\r\n\r\n function snScrollBarLink ($scope, element, attributes, $parse) {\r\n Ps.initialize(\r\n element[0],\r\n {\r\n // there is no case for needing scroll x as of yet; also\r\n // in the latest ie it creates a horizontal scroll even though there should be none\r\n suppressScrollX: true\r\n }\r\n );\r\n\r\n if (attributes.snMarginRight) {\r\n element.find(\".ps-scrollbar-y-rail\").css(\"margin-right\", attributes.snMarginRight);\r\n }\r\n \r\n if ( attributes.snScrollBarScroll ) {\r\n $scope.$watch(attributes.snScrollBarScroll, function () {\r\n element[0].scrollTop = $parse(attributes.snScrollBarScroll)($scope);\r\n Ps.update(element[0]);\r\n });\r\n }\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n \"snShowOnMobile\",\r\n snShowOnMobile\r\n );\r\n\r\n function snShowOnMobile (screenSizeServiceService) {\r\n return {\r\n restrict: \"A\",\r\n link: function ($scope, element, attributes) {\r\n snShowOnMobileLink($scope, element, attributes, screenSizeServiceService);\r\n }\r\n };\r\n }\r\n\r\n function snShowOnMobileLink ($scope, element, attributes, screenSizeServiceService) {\r\n if (!screenSizeServiceService.isMobile()) {\r\n element.css({ display: \"none\" });\r\n }\r\n }\r\n\r\n}(angular));","(function (ng) {\r\n\t\"use strict\";\r\n\tng.module(\"sonovate.core\")\r\n\t.directive('snSkipToContent', function () {\r\n\t\treturn {\r\n\t\t\trestrict: \"E\",\r\n\t\t\ttransclude: true,\r\n\t\t\ttemplateUrl: 'core/components/snSkipToContent/snSkipToContentDirective.html',\r\n\t\t\tcontroller: function ($scope) {\r\n\t\t\t\t$scope.isVisible = false;\r\n\t\t\t\t$scope.show = function () {\r\n\t\t\t\t\t$scope.isVisible = true;\r\n\t\t\t\t};\r\n\r\n\t\t\t\t$scope.hide = function () {\r\n\t\t\t\t\t$scope.isVisible = false;\r\n\t\t\t\t};\r\n\t\t\t},\r\n\t\t\tlink: function (scope, elm, attrs) {\r\n\t\t\t\t// This has to be done this way, to stop angular calling $apply twice\r\n\t\t\t\t\t// elm.find(\".skip-to-content-box__link\").click(function () {\r\n\t\t\t\t\t// var minValue;\r\n \t\t\t\t// var minItem;\r\n \t\t\t\t// var items = [];\r\n\t\t\t\t\t// \t$(\"html\").find(\"#main-content [tabindex]\").each(function () {\r\n\t\t\t\t\t// \t\tif(this.hasAttribute(\"tabindex\")){\r\n\t\t\t\t\t// \t\t\titems.push(this);\r\n\t\t\t\t\t// \t\t}\r\n\t\t\t\t\t// \t});\r\n\t\t\t\t\t// minItem = items[0];\r\n\t\t\t\t\t// minItem.focus();\r\n\t\t\t\t// });\r\n\t\t\t}\r\n\t\t};\r\n\t});\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\"snTag\", function () {\r\n return {\r\n restrict:\"E\",\r\n templateUrl:'core/components/snTag/snTag.html',\r\n scope: {\r\n snFirstLine:'@',\r\n snSecondLine:'@',\r\n snTitle:'@',\r\n snIcon:'@',\r\n snLink: \"@\"\r\n },\r\n controllerAs: 'vm',\r\n bindToController:true,\r\n controller: function ($scope) {\r\n \r\n }\r\n };\r\n });\r\n \r\n}(angular));","(function (ng) {\r\n 'use strict';\r\n\r\n ng.module('sonovate.core')\r\n .directive(\r\n 'snTooltip',\r\n [\r\n snTooltip\r\n ]\r\n );\r\n\r\n function snTooltip () {\r\n return {\r\n restrict: 'E',\r\n templateUrl: 'core/components/snTooltip/snTooltip.html',\r\n transclude: true,\r\n scope: {\r\n message: '@snTooltipMessage',\r\n subMessage: '@snTooltipSubMessage',\r\n disabledSubMessage: '@snTooltipDisabledSubMessage',\r\n icon: '@snTooltipIcon',\r\n disabledIcon: '@snTooltipDisabledIcon',\r\n isDisabled: '=snTooltipDisabled',\r\n arrowPosition: '@snTooltipArrowPosition'\r\n },\r\n compile: function ( element, attributes ) {\r\n element.addClass( \"tooltip_parent\" );\r\n }\r\n };\r\n }\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive(\r\n 'snTransition', \r\n [ \r\n \"$timeout\",\r\n snTransition\r\n ]\r\n );\r\n\r\n function snTransition ($timeout) {\r\n return {\r\n restrict: \"A\",\r\n link: function ($scope, element, attributes) {\r\n snShowLink($scope, element, attributes, $timeout);\r\n }\r\n };\r\n }\r\n\r\n function snShowLink ($scope, element, attributes, $timeout) {\r\n\r\n var timeouts, delayTime, classMap, classDelay;\r\n timeouts = [];\r\n delayTime = 1000;\r\n classMap = getClassMap();\r\n classDelay = getStepDelay();\r\n\r\n $scope.$watch(attributes.snTransition, beginTransition);\r\n\r\n function beginTransition (revertBackToBaseClass) {\r\n if ( revertBackToBaseClass === true ) {\r\n assignClasses(\r\n classMap.slice().reverse(), \r\n classDelay\r\n );\r\n removeClassesAfterTimeout(_.last(classDelay));\r\n } else {\r\n assignClasses(classMap, classDelay);\r\n }\r\n }\r\n\r\n function removeClassesAfterTimeout (timeoutDelay) {\r\n $timeout(function () {\r\n removeAllMapClassesFromElement();\r\n }, timeoutDelay );\r\n }\r\n\r\n function assignClasses (classList, classDelay) {\r\n clearTimeouts();\r\n removeAllMapClassesFromElement();\r\n element.addClass(_.first(classList));\r\n setClassTimeouts(classList.slice(1), classDelay);\r\n }\r\n\r\n function setClassTimeouts (classList, classDelay) {\r\n\r\n timeouts = _.times(\r\n classList.length, \r\n function (index) {\r\n return changeToNextClassAfterTimeout(\r\n classList[index], \r\n classDelay[index]\r\n );\r\n }\r\n );\r\n }\r\n\r\n function changeToNextClassAfterTimeout (className, timeoutDelay) {\r\n return $timeout(function () {\r\n removeAllMapClassesFromElement();\r\n element.addClass(className);\r\n }, timeoutDelay );\r\n }\r\n\r\n function clearTimeouts () {\r\n _.each(timeouts, function (timeout) {\r\n $timeout.cancel(timeout);\r\n });\r\n }\r\n\r\n function removeAllMapClassesFromElement () {\r\n _.each(classMap, function (className) {\r\n if ( element.hasClass(className) ) {\r\n element.removeClass(className);\r\n }\r\n });\r\n }\r\n\r\n function getStepDelay () {\r\n if ( attributes.snTransitionDelay ) {\r\n return parseDelayFromAttribute();\r\n } else {\r\n throw new Error(\r\n \"snTransition:~ You did not supply a class delay array.\"+\r\n \"We need something like sn-transition-delay=\\\"[ 100, 400 ]\\\"\"\r\n );\r\n }\r\n }\r\n\r\n function parseDelayFromAttribute () {\r\n try {\r\n return JSON.parse(attributes.snTransitionDelay.replace(/\\'/g, \"\\\"\"));\r\n } catch (exception) {\r\n throw new Error(\r\n \"snTransition:~ The json for the sn-transition-delay was bad json.\"+\r\n \"\\nThis was probably due to a stray comma or something.\"\r\n );\r\n }\r\n }\r\n\r\n function getClassMap () {\r\n if ( attributes.snTransitionClass ) {\r\n return parseClassMapFromAttribute();\r\n } else {\r\n throw new Error(\r\n \"snTransition:~ You did not supply a class array.\"+\r\n \"We need something like sn-transition-class=['class-name', 'class-name' ... ]\"\r\n );\r\n }\r\n }\r\n\r\n function parseClassMapFromAttribute () {\r\n try {\r\n return JSON.parse(attributes.snTransitionClass.replace(/\\'/g, \"\\\"\"));\r\n } catch (exception) {\r\n throw new Error(\r\n \"snTransition:~ The json for the sn-transition-class was bad json.\"+\r\n \"\\nThis was probably due to a stray comma or something.\"\r\n );\r\n }\r\n }\r\n }\r\n\r\n}(angular));","(function (angular) {\r\n 'use strict';\r\n\r\n angular.module(\"sonovate.core\")\r\n .directive('snAddAddressViewDirective', [snAddAddressViewDirectiveController]);\r\n\r\n function snAddAddressViewDirectiveController () {\r\n return {\r\n restrict: 'E',\r\n templateUrl: 'core/viewDirectives/snAddAddress/snAddAddressViewDirective.html',\r\n scope: {\r\n snShowForm: \"=\"\r\n },\r\n replace: false,\r\n bindToController: true,\r\n controller: 'snAddOrganisationViewController',\r\n controllerAs: 'vm',\r\n link: function ($scope, element, attributes) {\r\n\r\n }\r\n };\r\n }\r\n\r\n angular.module(\"sonovate.core\")\r\n .controller('snAddOrganisationViewController', ['$state', function($state){\r\n\r\n\r\n }]);\r\n\r\n}(angular));","(function (ng) {\r\n\t\r\n\t\"use strict\";\r\n\r\n\tng.module(\"sonovate.core\")\r\n\t.directive(\"snHeader\", snHeader);\r\n\r\n\tfunction snHeader () {\r\n\t\treturn {\r\n\t\t\trestrict: \"E\",\r\n\t\t\tscope: {\r\n\t\t\t\tuserId:\"@\",\r\n\t\t\t\tpopoutListItems: \"=\",\r\n\t\t\t\tpopoutPositions: \"=\",\r\n\t\t\t\tsnIndex: \"=\"\r\n\t\t\t}, \r\n\t\t\ttemplateUrl: \"core/viewDirectives/snHeaderDirective/snHeaderDirective.html\",\r\n\t\t\tcontrollerAs: \"vm\",\r\n\t\t\tbindToController: true,\r\n\t\t\tcontroller: function ($scope) {\r\n\t\t\t\tvar _this;\r\n\r\n\t\t\t\t_this = this; // jshint ignore:line\r\n\t\t\t\t_this.showSettings = false;\r\n\r\n\t\t\t\t_this.toggleSettings = toggleSettings;\r\n\r\n\t\t\t\tfunction toggleSettings () {\r\n\t\t\t\t\t_this.showSettings = ! _this.showSettings;\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t};\r\n\t}\r\n}(angular));"]}