@openfin/web-notifications 2.12.0-alpha-4102 → 2.12.0-alpha-4111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/index.js +3 -3
- package/package.json +2 -2
package/dist/web/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
`,f=(0,r.default)(a.Box)`
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
margin-top: ${({theme:e})=>e.px.large};
|
|
8
|
-
`;t.CustomLocation=(0,s.connect)(void 0,(e=>({requestNewCustomPosition:()=>e(new c.RequestNewCustomToastPosition),raiseAnalyticsEvent:async(t,n)=>e(new u.RaiseAnalyticsEvent(t,n))})))(t.CustomLocationComponent)},94:e=>{"use strict";e.exports=t},96:e=>{"use strict";e.exports=n},136:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.APIMethodHandler=void 0;const i=n(4673),o=n(6012),r=n(8320),a=n(7451),l=n(2753),s=n(5425),c=n(707),u=n(2984),d=n(7234),f=n(4138),p=n(8917);t.APIMethodHandler=class{constructor(e,t){this._store=e,this._scheduler=t}async createNotification(e,t){const n=(0,o.hydrateNotification)(e,{type:"desktop",identity:this.translateIdentity(t),origin:await this.getOrigin(t)});return e.reminder&&e.reminder>Date.now()?await this._store.dispatch(new r.SetReminder(Object.assign(Object.assign({},n),{modifiers:{reminder:e.reminder}}))):await this._store.dispatch(new a.CreateNotification(n)),(0,i.mutable)(n.notification)}async updateNotification(e,t){const n=await this.getOrigin(t),r=(0,o.getAllStoredNotifications)(this._store.state).find((t=>t.notification.id===e.id&&this.isAllowed(t.source,n)));if(!r)throw new Error(`Cannot find existing notification to update with id: ${e.id}`);const s=(0,o.hydrateUpdateNotification)(e,(0,l.getUpdateValidateOptions)(null==r?void 0:r.notification));await this._store.dispatch(new a.UpdateNotification(s));const c=(0,o.getAllStoredNotifications)(this._store.state).find((t=>t.notification.id===e.id&&this.isAllowed(t.source,n)));if(!c)throw new Error(`Cannot find updated notification with id: ${e.id}`);return(0,i.mutable)(c.notification)}async clearNotification(e,t){if("string"!=typeof e.id)throw new Error("Invalid argument passed to clear: argument must be a string");const n=await this.getOrigin(t),i=this.translateIdentity(t),r=(0,o.encodeId)(e.id,i),l=(0,o.getAllStoredNotifications)(this._store.state).find((e=>e.id===r&&this.isAllowed(e.source,n)));return!!l&&(await this._store.dispatch(new a.RemoveNotifications([l])),!0)}async fetchAppNotifications(e,t){const n=await this.getOrigin(t),o=this.translateIdentity(t);return this.getAppNotifications(o.uuid,n).map((e=>(0,i.mutable)(e.notification)))}async clearAppNotifications(e,t){const n=await this.getOrigin(t),i=this.translateIdentity(t),o=this.getAppNotifications(i.uuid,n);return await this._store.dispatch(new a.InitiateRemoveAllNotifications(o)),o.length}getAppNotifications(e,t){return this._store.state.notifications.filter((n=>"desktop"===n.source.type&&n.source.identity.uuid===e&&this.isAllowed(n.source,t)))}async showNotificationCenter(e){const t=(null==e?void 0:e.navigateToAll)&&(0,s.shouldNavigateToAll)(this._store.getState());await this._store.dispatch(new a.ShowCenter(t))}async hideNotificationCenter(){await this._store.dispatch(new a.HideCenter)}async toggleNotificationCenter(){await this._store.dispatch(new a.ToggleCenterVisibility(a.ToggleCenterVisibilitySource.API))}async getNotificationsCount(){return this._store.state.notifications.length}async getNotificationCenterSettings(e){if(e===c.UserSettings.SOUND_ENABLED)return this._store.state.settings.notificationSoundEnabled;throw new Error("Invalid setting requested")}getStatus(){return{connected:!0,version:(0,u.getVersion)(),templateAPIVersion:(0,u.getTemplateAPIVersion)()}}async setDefaultPlatformShortcut(e){const t=this._store.state.settings.platformDefaultShortcut;""===t?await this._store.dispatch(new d.SetPlatformDefaultShortcut(e)):console.warn(`Notifications: Default Platform Shortcut has previously been set to ${t} and cannot be changed`)}async setFormValidationErrors(e,t){const n=this.translateIdentity(t),i=(0,o.encodeId)(e.notificationId,n),r=await this.getOrigin(t);if(!(0,o.getAllStoredNotifications)(this._store.state).find((t=>t.notification.id===e.notificationId&&this.isAllowed(t.source,r))))throw new Error(`Attempted to set form validation errors for notification ${i} but the sender does not have permission`);await this._store.dispatch(new f.SetNotificationFormCustomValidationErrors(i,e.errors))}async setFormStatus(e,t){var n,i;const r=this.translateIdentity(t),a=(0,o.encodeId)(e._notificationId,r),l=Object.assign(Object.assign({},e),{_notificationId:a}),s=await this.getOrigin(t);if(!(0,o.getAllStoredNotifications)(this._store.state).find((t=>t.notification.id===e._notificationId&&this.isAllowed(t.source,s))))throw new Error(`Attempted to set form status for notification source: ${JSON.stringify(t)} but the sender does not have permission`);(null===(i=null===(n=this._store.state.activeForms)||void 0===n?void 0:n.forms)||void 0===i?void 0:i.find((e=>e.notificationId===a&&"submitted"===e.formStatusOptions.formStatus)))||await this._store.dispatch(new p.SetNotificationFormStatusOptions(l))}}},164:function(e,t,n){"use strict";var i=this&&this.
|
|
8
|
+
`;t.CustomLocation=(0,s.connect)(void 0,(e=>({requestNewCustomPosition:()=>e(new c.RequestNewCustomToastPosition),raiseAnalyticsEvent:async(t,n)=>e(new u.RaiseAnalyticsEvent(t,n))})))(t.CustomLocationComponent)},94:e=>{"use strict";e.exports=t},96:e=>{"use strict";e.exports=n},136:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.APIMethodHandler=void 0;const i=n(4673),o=n(6012),r=n(8320),a=n(7451),l=n(2753),s=n(5425),c=n(707),u=n(2984),d=n(7234),f=n(4138),p=n(8917);t.APIMethodHandler=class{constructor(e,t){this._store=e,this._scheduler=t}async createNotification(e,t){const n=(0,o.hydrateNotification)(e,{type:"desktop",identity:this.translateIdentity(t),origin:await this.getOrigin(t)});return e.reminder&&e.reminder>Date.now()?await this._store.dispatch(new r.SetReminder(Object.assign(Object.assign({},n),{modifiers:{reminder:e.reminder}}))):await this._store.dispatch(new a.CreateNotification(n)),(0,i.mutable)(n.notification)}async updateNotification(e,t){const n=await this.getOrigin(t),r=(0,o.getAllStoredNotifications)(this._store.state).find((t=>t.notification.id===e.id&&this.isAllowed(t.source,n)));if(!r)throw new Error(`Cannot find existing notification to update with id: ${e.id}`);const s=(0,o.hydrateUpdateNotification)(e,(0,l.getUpdateValidateOptions)(null==r?void 0:r.notification));await this._store.dispatch(new a.UpdateNotification(s));const c=(0,o.getAllStoredNotifications)(this._store.state).find((t=>t.notification.id===e.id&&this.isAllowed(t.source,n)));if(!c)throw new Error(`Cannot find updated notification with id: ${e.id}`);return(0,i.mutable)(c.notification)}async clearNotification(e,t){if("string"!=typeof e.id)throw new Error("Invalid argument passed to clear: argument must be a string");const n=await this.getOrigin(t),i=this.translateIdentity(t),r=(0,o.encodeId)(e.id,i),l=(0,o.getAllStoredNotifications)(this._store.state).find((e=>e.id===r&&this.isAllowed(e.source,n)));return!!l&&(await this._store.dispatch(new a.RemoveNotifications([l])),!0)}async fetchAppNotifications(e,t){const n=await this.getOrigin(t),o=this.translateIdentity(t);return this.getAppNotifications(o.uuid,n).map((e=>(0,i.mutable)(e.notification)))}async clearAppNotifications(e,t){const n=await this.getOrigin(t),i=this.translateIdentity(t),o=this.getAppNotifications(i.uuid,n);return await this._store.dispatch(new a.InitiateRemoveAllNotifications(o)),o.length}getAppNotifications(e,t){return this._store.state.notifications.filter((n=>"desktop"===n.source.type&&n.source.identity.uuid===e&&this.isAllowed(n.source,t)))}async showNotificationCenter(e){const t=(null==e?void 0:e.navigateToAll)&&(0,s.shouldNavigateToAll)(this._store.getState());await this._store.dispatch(new a.ShowCenter(t))}async hideNotificationCenter(){await this._store.dispatch(new a.HideCenter)}async toggleNotificationCenter(){await this._store.dispatch(new a.ToggleCenterVisibility(a.ToggleCenterVisibilitySource.API))}async getNotificationsCount(){return this._store.state.notifications.length}async getNotificationCenterSettings(e){if(e===c.UserSettings.SOUND_ENABLED)return this._store.state.settings.notificationSoundEnabled;throw new Error("Invalid setting requested")}getStatus(){return{connected:!0,version:(0,u.getVersion)(),templateAPIVersion:(0,u.getTemplateAPIVersion)()}}async setDefaultPlatformShortcut(e){const t=this._store.state.settings.platformDefaultShortcut;""===t?await this._store.dispatch(new d.SetPlatformDefaultShortcut(e)):console.warn(`Notifications: Default Platform Shortcut has previously been set to ${t} and cannot be changed`)}async setFormValidationErrors(e,t){const n=this.translateIdentity(t),i=(0,o.encodeId)(e.notificationId,n),r=await this.getOrigin(t);if(!(0,o.getAllStoredNotifications)(this._store.state).find((t=>t.notification.id===e.notificationId&&this.isAllowed(t.source,r))))throw new Error(`Attempted to set form validation errors for notification ${i} but the sender does not have permission`);await this._store.dispatch(new f.SetNotificationFormCustomValidationErrors(i,e.errors))}async setFormStatus(e,t){var n,i;const r=this.translateIdentity(t),a=(0,o.encodeId)(e._notificationId,r),l=Object.assign(Object.assign({},e),{_notificationId:a}),s=await this.getOrigin(t);if(!(0,o.getAllStoredNotifications)(this._store.state).find((t=>t.notification.id===e._notificationId&&this.isAllowed(t.source,s))))throw new Error(`Attempted to set form status for notification source: ${JSON.stringify(t)} but the sender does not have permission`);(null===(i=null===(n=this._store.state.activeForms)||void 0===n?void 0:n.forms)||void 0===i?void 0:i.find((e=>e.notificationId===a&&"submitted"===e.formStatusOptions.formStatus)))||await this._store.dispatch(new p.SetNotificationFormStatusOptions(l))}}},164:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.NotificationForm=void 0;const a=r(n(5932)),l=n(258),s=n(7250),c=n(597),u=n(4382),d=n(8768),f=n(9636),p=n(6430),h=n(6075),m=n(8684),b=n(723),g=n(6766),v=({notification:e,values:t,dirty:n})=>{const i=(0,h.useDispatchRequestCustomValidationDebounced)();return(0,a.useEffect)((()=>{n&&i(new m.RequestNotificationFormCustomValidation(e,t))}),[t,n,e,i]),null};t.NotificationForm=e=>{const{notification:t,onSubmit:n}=e,[i,o]=(0,d.useFormData)(t.notification.form),r=(0,c.buildFormSchema)(i),h=(0,g.getInitialFormValues)(i),m=(0,b.useNotificationFormAnalytics)(t.id,e.isToast);return a.default.createElement(l.Formik,{key:t.id,initialValues:h,validationSchema:r,validateOnBlur:!0,validateOnChange:!0,validateOnMount:!0,onSubmit:e=>{const i=t.notification.buttons.find((e=>e.submit));if(!i)throw Error(`Form was submitted without a submit button for notification ${t.notification.id}`);null==n||n(t,e,i)}},(n=>a.default.createElement(f.FormContainer,{templateContent:e.templateContent,fields:i,notificationId:t.id,formErrorsCount:(0,p.getFormikErrorCount)(n)},a.default.createElement(v,{notification:t,values:n.values,dirty:n.dirty}),a.default.createElement(l.Form,{autoComplete:"off"},a.default.createElement(s.Box,{flexDirection:"column",gap:i.length>1?"base":void 0},i.map(((t,n)=>{const i=u.WidgetComponentMap[t.widget.type];return i?a.default.createElement(i,{tabIndexOverride:e.tabIndexOverride,formSettings:o,field:t,key:n,raiseAnalytics:m}):(console.error("Unable to render component",t),null)})))))))}},194:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Section=t.Transitions=void 0;const o=i(n(5932)),r=n(9130),a=n(7451),l=n(9004),s=n(4887),c=i(n(2230)),u=n(524),d=n(6460),f=n(4248);t.Transitions=(0,c.default)(u.TransitionGroup)`
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
gap: ${({theme:e})=>e.px.base};
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
user-select: none;
|
|
92
92
|
`,p=(0,s.default)(c.Icon)`
|
|
93
93
|
cursor: pointer;
|
|
94
|
-
`},597:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.parseFormData=t.buildFormSchema=t.buildFieldSchema=t.FieldValidationFunctions=void 0;const a=r(n(4298)),l=n(3955),s=e=>null==e;t.FieldValidationFunctions={[l.FieldType.radioGroup]:Object.assign({},{required:(e,t)=>t.arg?e.required(t.invalidMessage):e}),[l.FieldType.checkboxGroup]:Object.assign({},{required:(e,t)=>t.arg?e.required(t.invalidMessage):e}),[l.FieldType.date]:Object.assign({},{required:(e,t)=>t.arg?e.required(t.invalidMessage):e}),[l.FieldType.time]:Object.assign({},{required:(e,t)=>t.arg?e.required(t.invalidMessage):e}),[l.FieldType.string]:Object.assign(Object.assign({min:(e,t)=>{var n;return e.min(null!==(n=t.arg)&&void 0!==n?n:0,t.invalidMessage)},max:(e,t)=>{var n;return e.max(null!==(n=t.arg)&&void 0!==n?n:0,t.invalidMessage)},length:(e,t)=>{var n;return e.length(null!==(n=t.arg)&&void 0!==n?n:0,t.invalidMessage)}},{required:(e,t)=>t.arg?e.required(t.invalidMessage):e}),{match:(e,t)=>{if(!t.arg)return e;const n=new RegExp(t.arg);return e.matches(n,{message:t.invalidMessage,excludeEmptyString:!0})}}),[l.FieldType.number]:{max:(e,t)=>s(t.arg)?e:e.max(t.arg,t.invalidMessage),min:(e,t)=>s(t.arg)?e:e.min(t.arg,t.invalidMessage),lessThan:(e,t)=>s(t.arg)?e:e.lessThan(t.arg,t.invalidMessage),moreThan:(e,t)=>s(t.arg)?e:e.moreThan(t.arg,t.invalidMessage),positive:(e,t)=>e.positive(t.invalidMessage),negative:(e,t)=>e.negative(t.invalidMessage),required:(e,t)=>e.required(t.invalidMessage)},[l.FieldType.boolean]:{}};const c={[l.FieldType.string]:a.StringSchema,[l.FieldType.number]:a.NumberSchema,[l.FieldType.boolean]:a.BooleanSchema,[l.FieldType.date]:a.ObjectSchema,[l.FieldType.checkboxGroup]:a.ArraySchema,[l.FieldType.radioGroup]:a.StringSchema,[l.FieldType.time]:a.ObjectSchema};function u(e){const n=t.FieldValidationFunctions[e.type];if(!n)throw new Error("Invalid field");let i=function(e){const{type:t}=e;return new(0,c[t])}(e);if(!e.validation)return i;const o=Object.entries(e.validation);for(const[t,r]of o){const o=n[t];if(o){let n=null;try{n=o(i,r)}catch(n){console.error(`Error parsing field ${t}`,r,e)}i=null!=n?n:i}}return e.label&&(i.spec.label=e.label),i}t.buildFieldSchema=u,t.buildFormSchema=function(e){const t={};for(const n of e)t[n.key]=u(n);return a.object().shape(t)},t.parseFormData=function(e){return e.map((e=>({initialValue:e.value,fieldData:e,widget:e.widget,schema:u(e)}))),[]}},611:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getTemplateSchema=void 0;const a=r(n(4298)),l=n(512),s=n(3694),c=n(6188),u=a.object({id:a.string().required(),buttons:c.ButtonsSchema.clone(),customData:a.object().optional().default({})}),d=u.clone().shape({template:a.mixed().required(),body:a.string().optional().default(null),form:s.templateMarkDownFormSchema}).label("Notification Update (Markdown)"),f=u.clone().shape({template:a.mixed().required(),list:a.mixed().optional().test({name:"List object",message:"Invalid list object",test:e=>{if(!e)return!0;if(e&&"object"!=typeof e)throw new Error("Not an object");return Object.entries(null!=e?e:{}).every((([e,t])=>"string"==typeof e&&"string"==typeof t))}})}).label("Update Notification (List)"),p=u.clone().shape({template:a.mixed().required(),form:s.templateCustomFormSchema,templateData:a.mixed().optional().test({name:"Temp object",message:"Invalid list object",test:function(e){var t,n;return!e||((null===(n=null===(t=this.options)||void 0===t?void 0:t.context)||void 0===n?void 0:n.fragments).presentationFragments.forEach((t=>{const n=e[t.dataKey];if(!t.optional&&!n)throw new Error(`templateData["${t.dataKey}"] is not optional and must exist in template data.`);if(n){if(("text"===t.type||"image"===t.type)&&"string"!=typeof n)throw new Error(`templateData["${t.dataKey}"] is referred by a ${t.type} fragment and must be a string type.`);if("list"===t.type&&(!Array.isArray(n)||n.some((e=>2!==e.length||"string"!=typeof e[0]||"string"!=typeof e[1]))))throw new Error(`templateData["${t.dataKey}"] is referred by a list fragment and must be a ListPairs (Array of [string, string]) type.`)}})),!0)}})}).label("Update Notification (Custom)"),h={[l.TemplateNames.markdown]:d,[l.TemplateNames.list]:f,[l.TemplateNames.custom]:p};t.getTemplateSchema=e=>{if(!e.template)throw new Error("Template type cannot be null");const t=h[null==e?void 0:e.template];if(!t)throw new Error(`Cannot find template type: ${e.template}`);return t}},660:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.HistoryContext=void 0;const a=r(n(5932));t.HistoryContext=a.createContext({})},697:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ToastPositionSelector=void 0;const a=r(n(5932)),l=n(7250),s=n(79),c=n(785);t.ToastPositionSelector=e=>a.createElement(a.Fragment,null,a.createElement(d,Object.assign({},e,{title:"Position",id:"toast-position"})),a.createElement(s.CustomLocation,{state:e.value,onChange:t=>{var n,i;null===(n=e.onChange)||void 0===n||n.call(e,{position:t?"custom":"bottom-right",customPosition:null===(i=e.value)||void 0===i?void 0:i.customPosition})}}));const u=["top-left","top-right","bottom-left","bottom-right"],d=({value:e,title:t,id:n="",onChange:i=()=>{}})=>{const o=t=>{i(Object.assign(Object.assign({},e||{}),{position:t}))};return a.createElement("div",{role:"radiogroup"},a.createElement(c.TitleElement,{htmlFor:n,size:l.Size.large},t),a.createElement(c.StyledSelectors,{tabIndex:0,onKeyUp:t=>{const n=u.findIndex((t=>t===(null==e?void 0:e.position)));switch(t.key){case"ArrowUp":case"ArrowLeft":t.preventDefault(),t.stopPropagation(),i(0===n?Object.assign(Object.assign({},e),{position:"bottom-right"}):Object.assign(Object.assign({},e),{position:u[n-1]}));break;case"ArrowDown":case"ArrowRight":t.preventDefault(),t.stopPropagation(),n===u.length-1?i(Object.assign(Object.assign({},e),{position:"top-left"})):i(Object.assign(Object.assign({},e),{position:u[n+1]}))}},id:n},u.map((t=>a.createElement(c.Selector,{key:t,position:t,onClick:o,active:(null==e?void 0:e.position)===t})))))}},707:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t},a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)},l=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.setAllowedOrigins=t.getUserSettingStatus=t.UserSettings=t.getNotificationsCount=t.hide=t.show=t.setDefaultPlatformShortcut=t.toggleNotificationCenter=t.clearAll=t.getAll=t.clear=t.update=t.create=t.removeEventListener=t.addEventListener=t.VERSION=t.NotificationIndicatorType=t.IndicatorColor=t.NotificationIndicatorWithCustomColor=t.NotificationIndicator=t.NotificationOptions=t.provider=t.actions=void 0;const s=n(6455),c=n(3816),u=n(9603),d=n(3657),f=r(n(6451));t.provider=f;const p=n(8173),h=n(6865);Object.defineProperty(t,"NotificationIndicator",{enumerable:!0,get:function(){return h.NotificationIndicator}}),Object.defineProperty(t,"NotificationIndicatorWithCustomColor",{enumerable:!0,get:function(){return h.NotificationIndicatorWithCustomColor}}),Object.defineProperty(t,"NotificationIndicatorType",{enumerable:!0,get:function(){return h.IndicatorType}}),Object.defineProperty(t,"IndicatorColor",{enumerable:!0,get:function(){return h.IndicatorColor}});const m=n(4415);Object.defineProperty(t,"NotificationOptions",{enumerable:!0,get:function(){return m.NotificationOptions}});const b=r(n(6455));t.actions=b,a(n(6455),t),a(n(7204),t),a(n(295),t),a(n(8912),t),a(n(3154),t),a(n(5050),t),a(n(512),t),t.VERSION="2.12.0-alpha-4102";const g=(0,d.getEventRouter)();function v(e){const{notification:t}=e;return Object.assign(Object.assign({},e),{notification:Object.assign(Object.assign({},t),{date:new Date(t.date),expires:null!==t.expires?new Date(t.expires):null})})}g.registerDeserializer("notification-created",(e=>v(e))),g.registerDeserializer("notification-toast-dismissed",(e=>v(e))),g.registerDeserializer("notification-closed",(e=>v(e))),g.registerDeserializer("notification-action",(e=>{var t;const n=v(e),{controlSource:i,controlIndex:o}=n,r=l(n,["controlSource","controlIndex"]);return e.trigger===s.ActionTrigger.CONTROL?Object.assign(Object.assign({},r),{control:null===(t=e.notification[i])||void 0===t?void 0:t[o]}):r})),g.registerDeserializer("notifications-count-changed",(e=>e)),g.registerDeserializer("notification-reminder-created",(e=>{const t=v(e),{reminderDate:n}=t,i=l(t,["reminderDate"]);return Object.assign(Object.assign({},i),{reminderDate:new Date(n)})})),g.registerDeserializer("notification-reminder-removed",(e=>v(e))),g.registerDeserializer("notification-sound-toggled",(e=>e)),t.addEventListener=async function(e,t){(0,p.validateEnvironment)(),e=(0,p.sanitizeEventType)(e),t=(0,p.sanitizeFunction)(t);const n=d.eventEmitter.listenerCount(e);"notification-form-submitted"===e&&(t=function(e){return t=>{const n=t.notification.id;t.setFormStatus=e=>(0,c.tryServiceDispatch)(u.APITopic.SET_FORM_STATUS_OPTIONS,Object.assign(Object.assign({},e),{_notificationId:n})),e(t)}}(t)),"notification-form-values-changed"===e&&(t=function(e){return t=>{t.setErrors=e=>(0,c.tryServiceDispatch)(u.APITopic.SET_FORM_VALIDATION_ERRORS,{errors:e,notificationId:t.notification.id}),e(t)}}(t)),d.eventEmitter.addListener(e,t),0===n&&1===d.eventEmitter.listenerCount(e)&&await(0,c.tryServiceDispatch)(u.APITopic.ADD_EVENT_LISTENER,e)},t.removeEventListener=async function(e,t){(0,p.validateEnvironment)(),e=(0,p.sanitizeEventType)(e),t=(0,p.sanitizeFunction)(t),1===d.eventEmitter.listenerCount(e)&&d.eventEmitter.listeners(e)[0]===t&&await(0,c.tryServiceDispatch)(u.APITopic.REMOVE_EVENT_LISTENER,e),d.eventEmitter.removeListener(e,t)},t.create=async function(e,t){if("object"!=typeof e||null===e)throw new Error("Invalid argument passed to create: argument must be an object and must not be null");if(void 0!==e.date&&!(e.date instanceof Date))throw new Error('Invalid argument passed to create: "date" must be a valid Date object');if(void 0!==e.expires&&null!==e.expires&&!(e.expires instanceof Date))throw new Error('Invalid argument passed to create: "expires" must be null or a valid Date object');if(t&&t.reminderDate){if(!1===e.allowReminder)throw new Error('You must not specify a reminder date for a notification with "allowReminder" option set to false.');if(!(t.reminderDate instanceof Date))throw new Error('Invalid argument passed to reminder Options: "date" must a valid Date object');if(e.expires&&e.expires.getTime()<t.reminderDate.getTime())throw new Error("Expiration date must not be earlier than reminder date.")}void 0!==e.category&&null!==e.category||(e.category="default");const n=await(0,c.tryServiceDispatch)(u.APITopic.CREATE_NOTIFICATION,Object.assign(Object.assign({},e),{date:e.date&&e.date.valueOf(),expires:e.expires&&e.expires.valueOf(),reminder:(null==t?void 0:t.reminderDate)&&t.reminderDate.valueOf()}));return Object.assign(Object.assign({},n),{date:new Date(n.date),expires:null!==n.expires?new Date(n.expires):null})},t.update=async function(e){if("object"!=typeof e||null===e)throw new Error("Invalid argument passed to create: argument must be an object and must not be null");if(!e.id)throw new Error('Invalid argument passed to create: "id" must be Id of previously created Notification');const t=await(0,c.tryServiceDispatch)(u.APITopic.UPDATE_NOTIFICATION,Object.assign({},e));return Object.assign({},t)},t.clear=async function(e){return(0,c.tryServiceDispatch)(u.APITopic.CLEAR_NOTIFICATION,{id:e})},t.getAll=async function(){return(await(0,c.tryServiceDispatch)(u.APITopic.GET_APP_NOTIFICATIONS,void 0)).map((e=>Object.assign(Object.assign({},e),{indicator:e.indicator||null,date:new Date(e.date),expires:null!==e.expires?new Date(e.expires):null})))},t.clearAll=async function(){return(0,c.tryServiceDispatch)(u.APITopic.CLEAR_APP_NOTIFICATIONS,void 0)},t.toggleNotificationCenter=async function(){return(0,c.tryServiceDispatch)(u.APITopic.TOGGLE_NOTIFICATION_CENTER,void 0)},t.setDefaultPlatformShortcut=function(e){return(0,c.tryServiceDispatch)(u.APITopic.SET_DEFAULT_PLATFORM_SHORTCUT,e)},t.show=async function(e){return(0,c.tryServiceDispatch)(u.APITopic.SHOW_NOTIFICATION_CENTER,e)},t.hide=async function(){return(0,c.tryServiceDispatch)(u.APITopic.HIDE_NOTIFICATION_CENTER,void 0)},t.getNotificationsCount=async function(){return(0,c.tryServiceDispatch)(u.APITopic.GET_NOTIFICATIONS_COUNT,void 0)},(t.UserSettings||(t.UserSettings={})).SOUND_ENABLED="soundEnabled",t.getUserSettingStatus=async function(e){return(0,c.tryServiceDispatch)(u.APITopic.GET_USER_SETTINGS_STATUS,e)},t.setAllowedOrigins=async e=>(0,c.tryServiceDispatch)(u.APITopic.SET_NOTIFICATION_SECURITY_RULE,{allowedOrigins:e})},714:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RadioGroupWidgetComponent=void 0;const o=i(n(5932)),r=n(7250),a=n(258),l=n(7260),s=n(1971),c=n(5232),u=n(5484);t.RadioGroupWidgetComponent=e=>o.default.createElement(a.Field,{name:e.field.key,component:d,radioGroupField:e.field,formSettings:e.formSettings,raiseAnalytics:e.raiseAnalytics});const d=({raiseAnalytics:e,radioGroupField:t,field:n,form:i,formSettings:a})=>((0,u.useRaiseFieldAnalytics)(t,e),o.default.createElement(l.InputContainer,{flexDirection:"column"},o.default.createElement(r.RadioGroup,{onChange:e=>{i.setFieldTouched(t.key,!0),i.setFieldValue(t.key,e.target.value)},label:(0,c.getLabelText)(t,a),helperText:t.helperText,name:t.key,value:n.value,key:`${t.key}_${n.value}`},t.widget.group.map((e=>o.default.createElement(r.RadioInput,{key:`${t.key}_${e.value}`,label:e.label,value:e.value})))),o.default.createElement(s.ErrorLabel,{name:n.name})))},723:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useNotificationFormAnalytics=void 0;const i=n(5932),o=n(9130),r=n(7451);t.useNotificationFormAnalytics=(e,t)=>{const n=(0,o.useDispatch)();return(0,i.useCallback)(((i,o,a)=>{n(new r.RaiseAnalyticsEvent({type:t?"Toast":"Notification",action:o,value:a,data:{fieldLabel:i,notificationId:e}}))}),[e,n,t])}},746:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PlatformIcon=void 0;const a=r(n(5932)),l=r(n(2230)),s=n(7250),c=n(8833);t.PlatformIcon=({id:e,icon:t,title:n,selected:i,count:o,onPlatformSelect:r})=>{var l,s;const h=(0,c.useLoaded)(t),m=!e,b=m?"All":null!==(l=null==n?void 0:n[0])&&void 0!==l?l:null==e?void 0:e[0];return a.createElement(f,{"data-testid":"platform-icon",onClick:()=>{r(e)},allIcon:m,title:`${m?"All":null!==(s=null!=n?n:e)&&void 0!==s?s:"Platform"} Notifications`},o>0&&a.createElement(u,{count:o,max:99}),a.createElement(d,{src:t},(h===c.LoadState.ERROR||h===c.LoadState.LOADING)&&b),i&&a.createElement(p,null))};const u=(0,l.default)(s.Badge)`
|
|
94
|
+
`},597:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.parseFormData=t.buildFormSchema=t.buildFieldSchema=t.FieldValidationFunctions=void 0;const a=r(n(4298)),l=n(3955),s=e=>null==e;t.FieldValidationFunctions={[l.FieldType.radioGroup]:Object.assign({},{required:(e,t)=>t.arg?e.required(t.invalidMessage):e}),[l.FieldType.checkboxGroup]:Object.assign({},{required:(e,t)=>t.arg?e.required(t.invalidMessage):e}),[l.FieldType.date]:Object.assign({},{required:(e,t)=>t.arg?e.required(t.invalidMessage):e}),[l.FieldType.time]:Object.assign({},{required:(e,t)=>t.arg?e.required(t.invalidMessage):e}),[l.FieldType.string]:Object.assign(Object.assign({min:(e,t)=>{var n;return e.min(null!==(n=t.arg)&&void 0!==n?n:0,t.invalidMessage)},max:(e,t)=>{var n;return e.max(null!==(n=t.arg)&&void 0!==n?n:0,t.invalidMessage)},length:(e,t)=>{var n;return e.length(null!==(n=t.arg)&&void 0!==n?n:0,t.invalidMessage)}},{required:(e,t)=>t.arg?e.required(t.invalidMessage):e}),{match:(e,t)=>{if(!t.arg)return e;const n=new RegExp(t.arg);return e.matches(n,{message:t.invalidMessage,excludeEmptyString:!0})}}),[l.FieldType.number]:{max:(e,t)=>s(t.arg)?e:e.max(t.arg,t.invalidMessage),min:(e,t)=>s(t.arg)?e:e.min(t.arg,t.invalidMessage),lessThan:(e,t)=>s(t.arg)?e:e.lessThan(t.arg,t.invalidMessage),moreThan:(e,t)=>s(t.arg)?e:e.moreThan(t.arg,t.invalidMessage),positive:(e,t)=>e.positive(t.invalidMessage),negative:(e,t)=>e.negative(t.invalidMessage),required:(e,t)=>e.required(t.invalidMessage)},[l.FieldType.boolean]:{}};const c={[l.FieldType.string]:a.StringSchema,[l.FieldType.number]:a.NumberSchema,[l.FieldType.boolean]:a.BooleanSchema,[l.FieldType.date]:a.ObjectSchema,[l.FieldType.checkboxGroup]:a.ArraySchema,[l.FieldType.radioGroup]:a.StringSchema,[l.FieldType.time]:a.ObjectSchema};function u(e){const n=t.FieldValidationFunctions[e.type];if(!n)throw new Error("Invalid field");let i=function(e){const{type:t}=e;return new(0,c[t])}(e);if(!e.validation)return i;const o=Object.entries(e.validation);for(const[t,r]of o){const o=n[t];if(o){let n=null;try{n=o(i,r)}catch(n){console.error(`Error parsing field ${t}`,r,e)}i=null!=n?n:i}}return e.label&&(i.spec.label=e.label),i}t.buildFieldSchema=u,t.buildFormSchema=function(e){const t={};for(const n of e)t[n.key]=u(n);return a.object().shape(t)},t.parseFormData=function(e){return e.map((e=>({initialValue:e.value,fieldData:e,widget:e.widget,schema:u(e)}))),[]}},611:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getTemplateSchema=void 0;const a=r(n(4298)),l=n(512),s=n(3694),c=n(6188),u=a.object({id:a.string().required(),buttons:c.ButtonsSchema.clone(),customData:a.object().optional().default({})}),d=u.clone().shape({template:a.mixed().required(),body:a.string().optional().default(null),form:s.templateMarkDownFormSchema}).label("Notification Update (Markdown)"),f=u.clone().shape({template:a.mixed().required(),list:a.mixed().optional().test({name:"List object",message:"Invalid list object",test:e=>{if(!e)return!0;if(e&&"object"!=typeof e)throw new Error("Not an object");return Object.entries(null!=e?e:{}).every((([e,t])=>"string"==typeof e&&"string"==typeof t))}})}).label("Update Notification (List)"),p=u.clone().shape({template:a.mixed().required(),form:s.templateCustomFormSchema,templateData:a.mixed().optional().test({name:"Temp object",message:"Invalid list object",test:function(e){var t,n;return!e||((null===(n=null===(t=this.options)||void 0===t?void 0:t.context)||void 0===n?void 0:n.fragments).presentationFragments.forEach((t=>{const n=e[t.dataKey];if(!t.optional&&!n)throw new Error(`templateData["${t.dataKey}"] is not optional and must exist in template data.`);if(n){if(("text"===t.type||"image"===t.type)&&"string"!=typeof n)throw new Error(`templateData["${t.dataKey}"] is referred by a ${t.type} fragment and must be a string type.`);if("list"===t.type&&(!Array.isArray(n)||n.some((e=>2!==e.length||"string"!=typeof e[0]||"string"!=typeof e[1]))))throw new Error(`templateData["${t.dataKey}"] is referred by a list fragment and must be a ListPairs (Array of [string, string]) type.`)}})),!0)}})}).label("Update Notification (Custom)"),h={[l.TemplateNames.markdown]:d,[l.TemplateNames.list]:f,[l.TemplateNames.custom]:p};t.getTemplateSchema=e=>{if(!e.template)throw new Error("Template type cannot be null");const t=h[null==e?void 0:e.template];if(!t)throw new Error(`Cannot find template type: ${e.template}`);return t}},660:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.HistoryContext=void 0;const a=r(n(5932));t.HistoryContext=a.createContext({})},697:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ToastPositionSelector=void 0;const a=r(n(5932)),l=n(7250),s=n(79),c=n(785);t.ToastPositionSelector=e=>a.createElement(a.Fragment,null,a.createElement(d,Object.assign({},e,{title:"Position",id:"toast-position"})),a.createElement(s.CustomLocation,{state:e.value,onChange:t=>{var n,i;null===(n=e.onChange)||void 0===n||n.call(e,{position:t?"custom":"bottom-right",customPosition:null===(i=e.value)||void 0===i?void 0:i.customPosition})}}));const u=["top-left","top-right","bottom-left","bottom-right"],d=({value:e,title:t,id:n="",onChange:i=()=>{}})=>{const o=t=>{i(Object.assign(Object.assign({},e||{}),{position:t}))};return a.createElement("div",{role:"radiogroup"},a.createElement(c.TitleElement,{htmlFor:n,size:l.Size.large},t),a.createElement(c.StyledSelectors,{tabIndex:0,onKeyUp:t=>{const n=u.findIndex((t=>t===(null==e?void 0:e.position)));switch(t.key){case"ArrowUp":case"ArrowLeft":t.preventDefault(),t.stopPropagation(),i(0===n?Object.assign(Object.assign({},e),{position:"bottom-right"}):Object.assign(Object.assign({},e),{position:u[n-1]}));break;case"ArrowDown":case"ArrowRight":t.preventDefault(),t.stopPropagation(),n===u.length-1?i(Object.assign(Object.assign({},e),{position:"top-left"})):i(Object.assign(Object.assign({},e),{position:u[n+1]}))}},id:n},u.map((t=>a.createElement(c.Selector,{key:t,position:t,onClick:o,active:(null==e?void 0:e.position)===t})))))}},707:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t},a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)},l=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.setAllowedOrigins=t.getUserSettingStatus=t.UserSettings=t.getNotificationsCount=t.hide=t.show=t.setDefaultPlatformShortcut=t.toggleNotificationCenter=t.clearAll=t.getAll=t.clear=t.update=t.create=t.removeEventListener=t.addEventListener=t.VERSION=t.NotificationIndicatorType=t.IndicatorColor=t.NotificationIndicatorWithCustomColor=t.NotificationIndicator=t.NotificationOptions=t.provider=t.actions=void 0;const s=n(6455),c=n(3816),u=n(9603),d=n(3657),f=r(n(6451));t.provider=f;const p=n(8173),h=n(6865);Object.defineProperty(t,"NotificationIndicator",{enumerable:!0,get:function(){return h.NotificationIndicator}}),Object.defineProperty(t,"NotificationIndicatorWithCustomColor",{enumerable:!0,get:function(){return h.NotificationIndicatorWithCustomColor}}),Object.defineProperty(t,"NotificationIndicatorType",{enumerable:!0,get:function(){return h.IndicatorType}}),Object.defineProperty(t,"IndicatorColor",{enumerable:!0,get:function(){return h.IndicatorColor}});const m=n(4415);Object.defineProperty(t,"NotificationOptions",{enumerable:!0,get:function(){return m.NotificationOptions}});const b=r(n(6455));t.actions=b,a(n(6455),t),a(n(7204),t),a(n(295),t),a(n(8912),t),a(n(3154),t),a(n(5050),t),a(n(512),t),t.VERSION="2.12.0-alpha-4111";const g=(0,d.getEventRouter)();function v(e){const{notification:t}=e;return Object.assign(Object.assign({},e),{notification:Object.assign(Object.assign({},t),{date:new Date(t.date),expires:null!==t.expires?new Date(t.expires):null})})}g.registerDeserializer("notification-created",(e=>v(e))),g.registerDeserializer("notification-toast-dismissed",(e=>v(e))),g.registerDeserializer("notification-closed",(e=>v(e))),g.registerDeserializer("notification-action",(e=>{var t;const n=v(e),{controlSource:i,controlIndex:o}=n,r=l(n,["controlSource","controlIndex"]);return e.trigger===s.ActionTrigger.CONTROL?Object.assign(Object.assign({},r),{control:null===(t=e.notification[i])||void 0===t?void 0:t[o]}):r})),g.registerDeserializer("notifications-count-changed",(e=>e)),g.registerDeserializer("notification-reminder-created",(e=>{const t=v(e),{reminderDate:n}=t,i=l(t,["reminderDate"]);return Object.assign(Object.assign({},i),{reminderDate:new Date(n)})})),g.registerDeserializer("notification-reminder-removed",(e=>v(e))),g.registerDeserializer("notification-sound-toggled",(e=>e)),t.addEventListener=async function(e,t){(0,p.validateEnvironment)(),e=(0,p.sanitizeEventType)(e),t=(0,p.sanitizeFunction)(t);const n=d.eventEmitter.listenerCount(e);"notification-form-submitted"===e&&(t=function(e){return t=>{const n=t.notification.id;t.setFormStatus=e=>(0,c.tryServiceDispatch)(u.APITopic.SET_FORM_STATUS_OPTIONS,Object.assign(Object.assign({},e),{_notificationId:n})),e(t)}}(t)),"notification-form-values-changed"===e&&(t=function(e){return t=>{t.setErrors=e=>(0,c.tryServiceDispatch)(u.APITopic.SET_FORM_VALIDATION_ERRORS,{errors:e,notificationId:t.notification.id}),e(t)}}(t)),d.eventEmitter.addListener(e,t),0===n&&1===d.eventEmitter.listenerCount(e)&&await(0,c.tryServiceDispatch)(u.APITopic.ADD_EVENT_LISTENER,e)},t.removeEventListener=async function(e,t){(0,p.validateEnvironment)(),e=(0,p.sanitizeEventType)(e),t=(0,p.sanitizeFunction)(t),1===d.eventEmitter.listenerCount(e)&&d.eventEmitter.listeners(e)[0]===t&&await(0,c.tryServiceDispatch)(u.APITopic.REMOVE_EVENT_LISTENER,e),d.eventEmitter.removeListener(e,t)},t.create=async function(e,t){if("object"!=typeof e||null===e)throw new Error("Invalid argument passed to create: argument must be an object and must not be null");if(void 0!==e.date&&!(e.date instanceof Date))throw new Error('Invalid argument passed to create: "date" must be a valid Date object');if(void 0!==e.expires&&null!==e.expires&&!(e.expires instanceof Date))throw new Error('Invalid argument passed to create: "expires" must be null or a valid Date object');if(t&&t.reminderDate){if(!1===e.allowReminder)throw new Error('You must not specify a reminder date for a notification with "allowReminder" option set to false.');if(!(t.reminderDate instanceof Date))throw new Error('Invalid argument passed to reminder Options: "date" must a valid Date object');if(e.expires&&e.expires.getTime()<t.reminderDate.getTime())throw new Error("Expiration date must not be earlier than reminder date.")}void 0!==e.category&&null!==e.category||(e.category="default");const n=await(0,c.tryServiceDispatch)(u.APITopic.CREATE_NOTIFICATION,Object.assign(Object.assign({},e),{date:e.date&&e.date.valueOf(),expires:e.expires&&e.expires.valueOf(),reminder:(null==t?void 0:t.reminderDate)&&t.reminderDate.valueOf()}));return Object.assign(Object.assign({},n),{date:new Date(n.date),expires:null!==n.expires?new Date(n.expires):null})},t.update=async function(e){if("object"!=typeof e||null===e)throw new Error("Invalid argument passed to create: argument must be an object and must not be null");if(!e.id)throw new Error('Invalid argument passed to create: "id" must be Id of previously created Notification');const t=await(0,c.tryServiceDispatch)(u.APITopic.UPDATE_NOTIFICATION,Object.assign({},e));return Object.assign({},t)},t.clear=async function(e){return(0,c.tryServiceDispatch)(u.APITopic.CLEAR_NOTIFICATION,{id:e})},t.getAll=async function(){return(await(0,c.tryServiceDispatch)(u.APITopic.GET_APP_NOTIFICATIONS,void 0)).map((e=>Object.assign(Object.assign({},e),{indicator:e.indicator||null,date:new Date(e.date),expires:null!==e.expires?new Date(e.expires):null})))},t.clearAll=async function(){return(0,c.tryServiceDispatch)(u.APITopic.CLEAR_APP_NOTIFICATIONS,void 0)},t.toggleNotificationCenter=async function(){return(0,c.tryServiceDispatch)(u.APITopic.TOGGLE_NOTIFICATION_CENTER,void 0)},t.setDefaultPlatformShortcut=function(e){return(0,c.tryServiceDispatch)(u.APITopic.SET_DEFAULT_PLATFORM_SHORTCUT,e)},t.show=async function(e){return(0,c.tryServiceDispatch)(u.APITopic.SHOW_NOTIFICATION_CENTER,e)},t.hide=async function(){return(0,c.tryServiceDispatch)(u.APITopic.HIDE_NOTIFICATION_CENTER,void 0)},t.getNotificationsCount=async function(){return(0,c.tryServiceDispatch)(u.APITopic.GET_NOTIFICATIONS_COUNT,void 0)},(t.UserSettings||(t.UserSettings={})).SOUND_ENABLED="soundEnabled",t.getUserSettingStatus=async function(e){return(0,c.tryServiceDispatch)(u.APITopic.GET_USER_SETTINGS_STATUS,e)},t.setAllowedOrigins=async e=>(0,c.tryServiceDispatch)(u.APITopic.SET_NOTIFICATION_SECURITY_RULE,{allowedOrigins:e})},714:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RadioGroupWidgetComponent=void 0;const o=i(n(5932)),r=n(7250),a=n(258),l=n(7260),s=n(1971),c=n(5232),u=n(5484);t.RadioGroupWidgetComponent=e=>o.default.createElement(a.Field,{name:e.field.key,component:d,radioGroupField:e.field,formSettings:e.formSettings,raiseAnalytics:e.raiseAnalytics});const d=({raiseAnalytics:e,radioGroupField:t,field:n,form:i,formSettings:a})=>((0,u.useRaiseFieldAnalytics)(t,e),o.default.createElement(l.InputContainer,{flexDirection:"column"},o.default.createElement(r.RadioGroup,{onChange:e=>{i.setFieldTouched(t.key,!0),i.setFieldValue(t.key,e.target.value)},label:(0,c.getLabelText)(t,a),helperText:t.helperText,name:t.key,value:n.value,key:`${t.key}_${n.value}`},t.widget.group.map((e=>o.default.createElement(r.RadioInput,{key:`${t.key}_${e.value}`,label:e.label,value:e.value})))),o.default.createElement(s.ErrorLabel,{name:n.name})))},723:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useNotificationFormAnalytics=void 0;const i=n(5932),o=n(9130),r=n(7451);t.useNotificationFormAnalytics=(e,t)=>{const n=(0,o.useDispatch)();return(0,i.useCallback)(((i,o,a)=>{n(new r.RaiseAnalyticsEvent({type:t?"Toast":"Notification",action:o,value:a,data:{fieldLabel:i,notificationId:e}}))}),[e,n,t])}},746:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PlatformIcon=void 0;const a=r(n(5932)),l=r(n(2230)),s=n(7250),c=n(8833);t.PlatformIcon=({id:e,icon:t,title:n,selected:i,count:o,onPlatformSelect:r})=>{var l,s;const h=(0,c.useLoaded)(t),m=!e,b=m?"All":null!==(l=null==n?void 0:n[0])&&void 0!==l?l:null==e?void 0:e[0];return a.createElement(f,{"data-testid":"platform-icon",onClick:()=>{r(e)},allIcon:m,title:`${m?"All":null!==(s=null!=n?n:e)&&void 0!==s?s:"Platform"} Notifications`},o>0&&a.createElement(u,{count:o,max:99}),a.createElement(d,{src:t},(h===c.LoadState.ERROR||h===c.LoadState.LOADING)&&b),i&&a.createElement(p,null))};const u=(0,l.default)(s.Badge)`
|
|
95
95
|
position: absolute;
|
|
96
96
|
right: 0;
|
|
97
97
|
top: -${({theme:e})=>e.px.small};
|
|
@@ -420,7 +420,7 @@
|
|
|
420
420
|
&:hover {
|
|
421
421
|
color: ${({theme:e})=>e.palette.linkHover};
|
|
422
422
|
}
|
|
423
|
-
`},2984:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTemplateAPIVersion=t.getVersion=void 0,t.getVersion=function(){return"2.12.0-alpha-
|
|
423
|
+
`},2984:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTemplateAPIVersion=t.getVersion=void 0,t.getVersion=function(){return"2.12.0-alpha-4111"},t.getTemplateAPIVersion=function(){return"2"}},3051:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useFormCustomValidationErrors=void 0;const i=n(5932),o=n(9130);t.useFormCustomValidationErrors=(e,t)=>{const n=(0,o.useSelector)((e=>{var n,i;return null===(i=null===(n=e.activeForms)||void 0===n?void 0:n.forms.find((e=>e.notificationId===t)))||void 0===i?void 0:i.errors})),{setFieldError:r}=e;(0,i.useEffect)((()=>{for(const e in n)r(e,n[e])}),[n,r])}},3081:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useScrollToFirstElementOnExpand=void 0;const i=n(5932);t.useScrollToFirstElementOnExpand=(e,t)=>{(0,i.useEffect)((()=>{t&&e.current&&setTimeout((()=>{var t,n;const i=null===(n=null===(t=e.current)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.querySelector("input, textarea, button");i&&i.focus()}),500)}),[e,t])}},3082:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.NotificationCenterWebComponent=void 0;const l=a(n(5932)),s=n(5338),c=n(9130),u=n(5056),d=n(3764),f=r(n(2230)),p=n(9136),h=n(660),m=n(3083),b=n(6452),g=n(436),v=n(7586);class y extends HTMLElement{constructor(){super(),this.reactRoot=null,this.root=this.attachShadow({mode:"open"}),this.styleTarget=document.createElement("style"),this.styleTarget.setAttribute("type","text/css"),this.styleTarget.textContent="",this.root.appendChild(this.styleTarget)}setProps(e){this.props=e,this.render()}connectedCallback(){setTimeout((()=>{this.render()}),0)}render(){this.props&&this.props.store&&(this.props.store.subscribe((()=>{!1===this.props.store.getState().centerVisible?this.style.display="none":this.style.display="block"})),this.styleTarget.sheet?(this.reactRoot||(this.reactRoot=(0,s.createRoot)(this.root)),u.centerHistory.push(v.ROUTES.NOTIFICATIONS),this.reactRoot.render(l.default.createElement(c.Provider,{store:this.props.store},l.default.createElement(f.StyleSheetManager,{target:this.styleTarget},l.default.createElement(h.HistoryContext.Provider,{value:u.centerHistory},l.default.createElement(p.WindowProvider,{value:window},l.default.createElement(m.RootThemeProvider,null,l.default.createElement(d.GlobalWebStyles,null),l.default.createElement(_,{id:"here-notifications-panel"},l.default.createElement(b.Router,{routes:g.CenterRoutes,history:u.centerHistory}))))))))):setTimeout((()=>this.render()),0))}}t.NotificationCenterWebComponent=y;const _=f.default.div`
|
|
424
424
|
position: absolute;
|
|
425
425
|
top: 0;
|
|
426
426
|
left: 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfin/web-notifications",
|
|
3
|
-
"version": "2.12.0-alpha-
|
|
3
|
+
"version": "2.12.0-alpha-4111",
|
|
4
4
|
"description": "Here™ Web Notification Center",
|
|
5
5
|
"main": "./dist/web/index.js",
|
|
6
6
|
"types": "./dist/web/index.d.ts",
|
|
@@ -44,6 +44,6 @@
|
|
|
44
44
|
"semver-compare": ">=1.0.0 <2.0.0",
|
|
45
45
|
"styled-components": ">=5.3.11 <6.0.0",
|
|
46
46
|
"yup": ">=0.32.9 <1.0.0",
|
|
47
|
-
"@openfin/core": "42.100.
|
|
47
|
+
"@openfin/core": "42.100.107"
|
|
48
48
|
}
|
|
49
49
|
}
|