diff --git a/wallet-reward-services/src/main/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateBuilder.java b/wallet-reward-services/src/main/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateBuilder.java index bf542410b..4c8b03a7b 100644 --- a/wallet-reward-services/src/main/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateBuilder.java +++ b/wallet-reward-services/src/main/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateBuilder.java @@ -28,7 +28,6 @@ import org.apache.commons.codec.binary.StringUtils; import org.exoplatform.commons.api.notification.NotificationContext; -import org.exoplatform.commons.api.notification.NotificationMessageUtils; import org.exoplatform.commons.api.notification.channel.template.AbstractTemplateBuilder; import org.exoplatform.commons.api.notification.model.*; import org.exoplatform.commons.api.notification.service.template.TemplateContext; @@ -86,9 +85,6 @@ protected MessageInfo makeMessage(NotificationContext ctx) { String rewardEndPeriodDate = (String) templateContext.get(REWARD_END_PERIOD_DATE); templateContext.put(REWARD_END_PERIOD_DATE_FORMATTED, formatTime(Long.parseLong(rewardEndPeriodDate) - 1, zoneId, language)); - String notificationRead = notification.getValueOwnerParameter(NotificationMessageUtils.READ_PORPERTY.getKey()); - templateContext.put("READ", Boolean.parseBoolean(notificationRead) ? "read" : "unread"); - setLastModifiedDate(notification, language, templateContext); SocialNotificationUtils.addFooterAndFirstName(notification.getTo(), templateContext); diff --git a/wallet-reward-services/src/main/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateProvider.java b/wallet-reward-services/src/main/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateProvider.java index 022e7081c..d9077d229 100644 --- a/wallet-reward-services/src/main/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateProvider.java +++ b/wallet-reward-services/src/main/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateProvider.java @@ -36,8 +36,6 @@ public class RewardSuccessTemplateProvider extends TemplateProvider { private RewardSuccessTemplateBuilder builder = null; - private String webTemplatePath = null; - private String pushTemplatePath = null; private String mailTemplatePath = null; @@ -48,7 +46,6 @@ public RewardSuccessTemplateProvider(PortalContainer container, RewardSettingsSe this.templateBuilders.put(PLUGIN_KEY, builder); - setWebTemplatePath("war:/conf/wallet/templates/notification/web/RewardSuccessWebPlugin.gtmpl"); setMailTemplatePath("war:/conf/wallet/templates/notification/mail/RewardSuccessMailPlugin.gtmpl"); setPushTemplatePath("war:/conf/wallet/templates/notification/push/RewardSuccessPushPlugin.gtmpl"); } @@ -60,20 +57,10 @@ public Map getTemplateFilePathConfigs() { return Collections.singletonMap(PLUGIN_KEY, mailTemplatePath); } else if (StringUtils.equals(channelKey.getId(), "PUSH_CHANNEL")) { return Collections.singletonMap(PLUGIN_KEY, pushTemplatePath); - } else if (StringUtils.equals(channelKey.getId(), "WEB_CHANNEL")) { - return Collections.singletonMap(PLUGIN_KEY, webTemplatePath); } return Collections.emptyMap(); } - public String getWebTemplatePath() { - return webTemplatePath; - } - - public void setWebTemplatePath(String webTemplatePath) { - this.webTemplatePath = webTemplatePath; - } - public String getPushTemplatePath() { return pushTemplatePath; } diff --git a/wallet-reward-services/src/test/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateBuilderTest.java b/wallet-reward-services/src/test/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateBuilderTest.java index 06bf45c54..df7254b5b 100644 --- a/wallet-reward-services/src/test/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateBuilderTest.java +++ b/wallet-reward-services/src/test/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateBuilderTest.java @@ -57,7 +57,7 @@ public void testBuildMessage() { new RewardSuccessTemplateProvider(container, getService(WalletRewardSettingsService.class), params); - templateProvider.setWebTemplatePath("jar:/template/RewardSuccessReward.gtmpl"); + templateProvider.setMailTemplatePath("jar:/template/RewardSuccessReward.gtmpl"); NotificationContext ctx = NotificationContextImpl.cloneInstance(); @@ -99,7 +99,7 @@ private InitParams getParams() { ValueParam valueParam = new ValueParam(); valueParam.setName("channel-id"); - valueParam.setValue("WEB_CHANNEL"); + valueParam.setValue("MAIL_CHANNEL"); initParams.addParam(valueParam); return initParams; } diff --git a/wallet-reward-services/src/test/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateProviderTest.java b/wallet-reward-services/src/test/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateProviderTest.java index 2283c905d..c11a4f3cd 100644 --- a/wallet-reward-services/src/test/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateProviderTest.java +++ b/wallet-reward-services/src/test/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateProviderTest.java @@ -44,12 +44,12 @@ public void testGetTemplate() { provider = new RewardSuccessTemplateProvider(container, getService(WalletRewardSettingsService.class), - getParams("WEB_CHANNEL")); + getParams("MAIL_CHANNEL")); templateFilePathConfigs = provider.getTemplateFilePathConfigs(); assertNotNull(templateFilePathConfigs); assertEquals(1, templateFilePathConfigs.size()); template = templateFilePathConfigs.values().iterator().next(); - assertEquals(provider.getWebTemplatePath(), template); + assertEquals(provider.getMailTemplatePath(), template); provider = new RewardSuccessTemplateProvider(container, getService(WalletRewardSettingsService.class), diff --git a/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/RequestFundsTemplateBuilder.java b/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/RequestFundsTemplateBuilder.java index cfa8dc1a2..f4cef388f 100644 --- a/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/RequestFundsTemplateBuilder.java +++ b/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/RequestFundsTemplateBuilder.java @@ -23,7 +23,6 @@ import java.util.Locale; import org.exoplatform.commons.api.notification.NotificationContext; -import org.exoplatform.commons.api.notification.NotificationMessageUtils; import org.exoplatform.commons.api.notification.channel.template.AbstractTemplateBuilder; import org.exoplatform.commons.api.notification.channel.template.TemplateProvider; import org.exoplatform.commons.api.notification.model.MessageInfo; @@ -82,7 +81,6 @@ protected MessageInfo makeMessage(NotificationContext ctx) { String userUrl = notification.getValueOwnerParameter(USER_URL); String symbol = notification.getValueOwnerParameter(SYMBOL); String message = notification.getValueOwnerParameter(MESSAGE); - String notificationRead = notification.getValueOwnerParameter(NotificationMessageUtils.READ_PORPERTY.getKey()); String fundRequestSent = notification.getValueOwnerParameter(FUNDS_REQUEST_SENT); RequestLifeCycle.begin(container); @@ -100,7 +98,6 @@ protected MessageInfo makeMessage(NotificationContext ctx) { templateContext.put("MESSAGE", message); templateContext.put("AVATAR", avatar != null ? avatar : LinkProvider.PROFILE_DEFAULT_AVATAR_URL); templateContext.put("NOTIFICATION_ID", notification.getId()); - templateContext.put("READ", Boolean.parseBoolean(notificationRead) ? "read" : "unread"); templateContext.put("FUNDS_REQUEST_SENT", Boolean.valueOf(fundRequestSent)); setLastModifiedDate(notification, language, templateContext); SocialNotificationUtils.addFooterAndFirstName(notification.getTo(), templateContext); diff --git a/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/TemplateBuilder.java b/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/TemplateBuilder.java index 28397adb7..2e3329412 100644 --- a/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/TemplateBuilder.java +++ b/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/TemplateBuilder.java @@ -25,7 +25,6 @@ import org.apache.commons.lang3.StringUtils; import org.exoplatform.commons.api.notification.NotificationContext; -import org.exoplatform.commons.api.notification.NotificationMessageUtils; import org.exoplatform.commons.api.notification.channel.template.AbstractTemplateBuilder; import org.exoplatform.commons.api.notification.channel.template.TemplateProvider; import org.exoplatform.commons.api.notification.model.MessageInfo; @@ -83,7 +82,6 @@ protected MessageInfo makeMessage(NotificationContext ctx) { String symbol = notification.getValueOwnerParameter(SYMBOL); String message = notification.getValueOwnerParameter(MESSAGE); String hash = notification.getValueOwnerParameter(HASH); - String notificationRead = notification.getValueOwnerParameter(NotificationMessageUtils.READ_PORPERTY.getKey()); RequestLifeCycle.begin(container); try { @@ -97,7 +95,6 @@ protected MessageInfo makeMessage(NotificationContext ctx) { templateContext.put("SYMBOL", symbol); templateContext.put("CONTRACT_ADDRESS", contractAddress == null ? "" : contractAddress); templateContext.put("NOTIFICATION_ID", notification.getId()); - templateContext.put("READ", Boolean.parseBoolean(notificationRead) ? "read" : "unread"); templateContext.put("MESSAGE", message); templateContext.put("HASH", hash); diff --git a/wallet-services/src/main/java/org/exoplatform/wallet/notification/provider/WebTemplateProvider.java b/wallet-services/src/main/java/org/exoplatform/wallet/notification/provider/WebTemplateProvider.java deleted file mode 100644 index 40aa74da7..000000000 --- a/wallet-services/src/main/java/org/exoplatform/wallet/notification/provider/WebTemplateProvider.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This file is part of the Meeds project (https://meeds.io/). - * Copyright (C) 2020 Meeds Association - * contact@meeds.io - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.exoplatform.wallet.notification.provider; - -import static org.exoplatform.wallet.utils.WalletUtils.*; - -import org.exoplatform.commons.api.notification.annotation.TemplateConfig; -import org.exoplatform.commons.api.notification.annotation.TemplateConfigs; -import org.exoplatform.commons.api.notification.channel.template.TemplateProvider; -import org.exoplatform.commons.api.notification.model.PluginKey; -import org.exoplatform.container.PortalContainer; -import org.exoplatform.container.xml.InitParams; -import org.exoplatform.wallet.notification.builder.RequestFundsTemplateBuilder; -import org.exoplatform.wallet.notification.builder.TemplateBuilder; - -@TemplateConfigs(templates = { - @TemplateConfig(pluginId = WALLET_SENDER_NOTIFICATION_ID, template = "war:/conf/wallet/templates/notification/web/WalletSenderWebPlugin.gtmpl"), - @TemplateConfig(pluginId = WALLET_RECEIVER_NOTIFICATION_ID, template = "war:/conf/wallet/templates/notification/web/WalletReceiverWebPlugin.gtmpl"), - @TemplateConfig(pluginId = FUNDS_REQUEST_NOTIFICATION_ID, template = "war:/conf/wallet/templates/notification/web/WalletRequestFundsWebPlugin.gtmpl") }) -public class WebTemplateProvider extends TemplateProvider { - - public WebTemplateProvider(PortalContainer container, InitParams initParams) { - super(initParams); - this.templateBuilders.put(PluginKey.key(WALLET_SENDER_NOTIFICATION_ID), new TemplateBuilder(this, container, false)); - this.templateBuilders.put(PluginKey.key(WALLET_RECEIVER_NOTIFICATION_ID), new TemplateBuilder(this, container, false)); - this.templateBuilders.put(PluginKey.key(FUNDS_REQUEST_NOTIFICATION_ID), - new RequestFundsTemplateBuilder(this, container, false)); - } - -} diff --git a/wallet-services/src/main/resources/locale/notification/WalletNotification_en.properties b/wallet-services/src/main/resources/locale/notification/WalletNotification_en.properties index 86516f04d..2427f5f9f 100644 --- a/wallet-services/src/main/resources/locale/notification/WalletNotification_en.properties +++ b/wallet-services/src/main/resources/locale/notification/WalletNotification_en.properties @@ -16,6 +16,8 @@ # UINotification.label.group.Wallet=Wallet +Notification.label.types.wallet=Wallet + UINotification.title.EtherSenderNotificationPlugin=Funds sent UINotification.label.EtherSenderNotificationPlugin=Sending funds notification Notification.subject.EtherSenderNotificationPlugin=You have sent funds @@ -32,6 +34,18 @@ Notification.message.AdminFundReceiverNotificationPlugin=Congratulations! The co Notification.subject.SpaceEtherReceiverNotificationPlugin=Space Wallet has received funds Notification.message.SpaceEtherReceiverNotificationPlugin={0} has received {1} {3} from {2} +Notification.message.FundsSpaceReceiverNotificationPlugin=Space {0} has received {1} {2} +Notification.message.FundsReceiverNotificationPlugin=You have received {0} {1} + +Notification.message.FundsSpaceSentToSpaceNotificationPlugin=Space {0} has sent {1} {2} to Space {3} +Notification.message.FundsSpaceSentNotificationPlugin=Space {0} has sent {1} {2} to {3} +Notification.message.FundsSentToSpaceNotificationPlugin=You have sent {0} {1} to Space {2} +Notification.message.FundsSentNotificationPlugin=You have sent {0} {1} to {2} + +Notification.message.FundsRequestNotificationPlugin={0} has requested {1} {2} +Notification.message.RewardsSentNotificationPlugin=Rewards for period {0} to {1} successfully sent +Notification.subtitle.RewardsSentNotificationPlugin=Total amount of {0} {1} for {2} members + UINotification.title.FundsRequestNotificationPlugin=Funds request received UINotification.label.FundsRequestNotificationPlugin=Receiving funds request Notification.subject.FundsRequestNotificationPlugin=Funds request received diff --git a/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/notification-configuration.xml b/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/notification-configuration.xml index 1a76b1f01..fd46734b8 100644 --- a/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/notification-configuration.xml +++ b/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/notification-configuration.xml @@ -199,17 +199,6 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. org.exoplatform.commons.api.notification.channel.ChannelManager - - web.channel.wallet.template - registerTemplateProvider - org.exoplatform.wallet.notification.provider.WebTemplateProvider - - - channel-id - WEB_CHANNEL - - - mail.channel.wallet.template registerTemplateProvider @@ -232,17 +221,6 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - web.channel.wallet.reward.template - registerTemplateProvider - org.exoplatform.wallet.reward.notification.RewardSuccessTemplateProvider - - - channel-id - WEB_CHANNEL - - - mail.channel.wallet.reward.template registerTemplateProvider diff --git a/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/templates/notification/web/RewardSuccessWebPlugin.gtmpl b/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/templates/notification/web/RewardSuccessWebPlugin.gtmpl deleted file mode 100644 index b0e76727b..000000000 --- a/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/templates/notification/web/RewardSuccessWebPlugin.gtmpl +++ /dev/null @@ -1,38 +0,0 @@ - -
  • -
    -
    -
    -
    -
    -
    - <%=_ctx.appRes("Notification.content.rewardProceededSuccessfullyForPeriod", rewardStartPeriodDateFormatted, rewardEndPeriodDateFormatted)%> -
    -
    - <%=_ctx.appRes("Notification.content.rewardReportDetails", amount, symbol, rewardValidMembersCount)%> -
    -
    - $LAST_UPDATED_TIME -
    -
    -
    -
    - - - -
  • \ No newline at end of file diff --git a/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/templates/notification/web/WalletReceiverWebPlugin.gtmpl b/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/templates/notification/web/WalletReceiverWebPlugin.gtmpl deleted file mode 100644 index e290071e8..000000000 --- a/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/templates/notification/web/WalletReceiverWebPlugin.gtmpl +++ /dev/null @@ -1,48 +0,0 @@ - -<% String openURL = HASH == null ? BASE_URL : BASE_URL + "?hash=" + HASH; %> -
  • -
    -
    - -
    -
    -
    -
    -
    -
    - <%= - ACCOUNT_TYPE.equals("admin") ? - _ctx.appRes("Notification.message.AdminFundReceiverNotificationPlugin", AMOUNT, SENDER_URL, SYMBOL) : - ACCOUNT_TYPE.equals("space") ? - _ctx.appRes("Notification.message.SpaceEtherReceiverNotificationPlugin", RECEIVER_URL, AMOUNT, SENDER_URL, SYMBOL) : - _ctx.appRes("Notification.message.EtherReceiverNotificationPlugin", AMOUNT, SENDER_URL, SYMBOL) - %> -
    - <% if(org.apache.commons.lang.StringUtils.isNotBlank(MESSAGE)) { %> -
    - <%= MESSAGE %> -
    - <% } %> -
    - $LAST_UPDATED_TIME -
    -
    -
    -
    - -
  • diff --git a/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/templates/notification/web/WalletRequestFundsWebPlugin.gtmpl b/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/templates/notification/web/WalletRequestFundsWebPlugin.gtmpl deleted file mode 100644 index 4c8d03c67..000000000 --- a/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/templates/notification/web/WalletRequestFundsWebPlugin.gtmpl +++ /dev/null @@ -1,53 +0,0 @@ - -<% String acceptURL = FUNDS_REQUEST_SENT ? "" : FUNDS_ACCEPT_URL + "&id=" + NOTIFICATION_ID; %> -
  • -
    -
    - -
    -
    -
    -
    -
    -
    - <%= ACCOUNT_TYPE.equals("space") ? - _ctx.appRes("Notification.message.SpaceFundsRequestNotificationPlugin", USER_URL, AMOUNT, SYMBOL, SENDER_URL) - : _ctx.appRes("Notification.message.FundsRequestNotificationPlugin", USER_URL, AMOUNT, SYMBOL)%> -
    - <% if (org.apache.commons.lang.StringUtils.isNotBlank(MESSAGE)) { %> -
    - <%= MESSAGE %> -
    - <% } %> -
    -
    - <% if(FUNDS_REQUEST_SENT) { %> - - <% } else { %> - <%= _ctx.appRes("Notification.message.FundsRequestAccpt") %> - <% } %> -
    -
    -
    - $LAST_UPDATED_TIME -
    -
    -
    -
    - -
  • diff --git a/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/templates/notification/web/WalletSenderWebPlugin.gtmpl b/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/templates/notification/web/WalletSenderWebPlugin.gtmpl deleted file mode 100644 index 8b15a71f3..000000000 --- a/wallet-webapps/src/main/webapp/WEB-INF/conf/wallet/templates/notification/web/WalletSenderWebPlugin.gtmpl +++ /dev/null @@ -1,42 +0,0 @@ - -<% String openURL = HASH == null ? BASE_URL : BASE_URL + "?hash=" + HASH; %> -
  • -
    -
    - -
    -
    -
    -
    -
    -
    - <%= ACCOUNT_TYPE.equals("space") ? _ctx.appRes("Notification.message.SpaceEtherSenderNotificationPlugin", SENDER_URL, AMOUNT, RECEIVER_URL, SYMBOL) : _ctx.appRes("Notification.message.EtherSenderNotificationPlugin", AMOUNT, RECEIVER_URL, SYMBOL)%> -
    - <% if(org.apache.commons.lang.StringUtils.isNotBlank(MESSAGE)) { %> -
    - <%= MESSAGE %> -
    - <% } %> -
    - $LAST_UPDATED_TIME -
    -
    -
    -
    - -
  • diff --git a/wallet-webapps/src/main/webapp/WEB-INF/gatein-resources.xml b/wallet-webapps/src/main/webapp/WEB-INF/gatein-resources.xml index aea52cc64..17303b0ab 100644 --- a/wallet-webapps/src/main/webapp/WEB-INF/gatein-resources.xml +++ b/wallet-webapps/src/main/webapp/WEB-INF/gatein-resources.xml @@ -430,6 +430,26 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + walletNotificationExtension + notificationGRP + + + vue + + + vuetify + + + eXoVueI18n + + + extensionRegistry + + + vueChart diff --git a/wallet-webapps/src/main/webapp/vue-app/notification-extension/components/FundsReceiverNotification.vue b/wallet-webapps/src/main/webapp/vue-app/notification-extension/components/FundsReceiverNotification.vue new file mode 100644 index 000000000..2a3f0fc55 --- /dev/null +++ b/wallet-webapps/src/main/webapp/vue-app/notification-extension/components/FundsReceiverNotification.vue @@ -0,0 +1,71 @@ + + \ No newline at end of file diff --git a/wallet-webapps/src/main/webapp/vue-app/notification-extension/components/FundsRequestNotification.vue b/wallet-webapps/src/main/webapp/vue-app/notification-extension/components/FundsRequestNotification.vue new file mode 100644 index 000000000..bb9761dfb --- /dev/null +++ b/wallet-webapps/src/main/webapp/vue-app/notification-extension/components/FundsRequestNotification.vue @@ -0,0 +1,100 @@ + + \ No newline at end of file diff --git a/wallet-webapps/src/main/webapp/vue-app/notification-extension/components/FundsSenderNotification.vue b/wallet-webapps/src/main/webapp/vue-app/notification-extension/components/FundsSenderNotification.vue new file mode 100644 index 000000000..618c46b66 --- /dev/null +++ b/wallet-webapps/src/main/webapp/vue-app/notification-extension/components/FundsSenderNotification.vue @@ -0,0 +1,99 @@ + + \ No newline at end of file diff --git a/wallet-webapps/src/main/webapp/vue-app/notification-extension/components/RewardSuccessNotification.vue b/wallet-webapps/src/main/webapp/vue-app/notification-extension/components/RewardSuccessNotification.vue new file mode 100644 index 000000000..3b8ec6f78 --- /dev/null +++ b/wallet-webapps/src/main/webapp/vue-app/notification-extension/components/RewardSuccessNotification.vue @@ -0,0 +1,76 @@ + + \ No newline at end of file diff --git a/wallet-webapps/src/main/webapp/vue-app/notification-extension/extensions.js b/wallet-webapps/src/main/webapp/vue-app/notification-extension/extensions.js new file mode 100644 index 000000000..87286e2a8 --- /dev/null +++ b/wallet-webapps/src/main/webapp/vue-app/notification-extension/extensions.js @@ -0,0 +1,53 @@ +/* + * This file is part of the Meeds project (https://meeds.io/). + * + * Copyright (C) 2020 - 2023 Meeds Association contact@meeds.io + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +extensionRegistry.registerExtension('WebNotification', 'notification-group-extension', { + rank: 60, + name: 'wallet', + plugins: [ + 'FundsRequestNotificationPlugin', + 'EtherReceiverNotificationPlugin', + 'EtherSenderNotificationPlugin', + 'RewardSuccessNotificationPlugin' + ], + icon: 'fa-money-bill-alt', +}); +extensionRegistry.registerExtension('WebNotification', 'notification-content-extension', { + type: 'FundsRequestNotificationPlugin', + rank: 10, + vueComponent: Vue.options.components['user-notification-funds-request'], +}); + +extensionRegistry.registerExtension('WebNotification', 'notification-content-extension', { + type: 'EtherReceiverNotificationPlugin', + rank: 10, + vueComponent: Vue.options.components['user-notification-funds-receiver'], +}); + +extensionRegistry.registerExtension('WebNotification', 'notification-content-extension', { + type: 'EtherSenderNotificationPlugin', + rank: 10, + vueComponent: Vue.options.components['user-notification-funds-sender'], +}); + +extensionRegistry.registerExtension('WebNotification', 'notification-content-extension', { + type: 'RewardSuccessNotificationPlugin', + rank: 10, + vueComponent: Vue.options.components['user-notification-reward-success'], +}); diff --git a/wallet-webapps/src/main/webapp/vue-app/notification-extension/initComponents.js b/wallet-webapps/src/main/webapp/vue-app/notification-extension/initComponents.js new file mode 100644 index 000000000..618580b46 --- /dev/null +++ b/wallet-webapps/src/main/webapp/vue-app/notification-extension/initComponents.js @@ -0,0 +1,34 @@ +/* + * This file is part of the Meeds project (https://meeds.io/). + * + * Copyright (C) 2020 - 2023 Meeds Association contact@meeds.io + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import RewardSuccessNotification from './components/RewardSuccessNotification.vue'; +import FundsSenderNotification from './components/FundsSenderNotification.vue'; +import FundsReceiverNotification from './components/FundsReceiverNotification.vue'; +import FundsRequestNotification from './components/FundsRequestNotification.vue'; + +const components = { + 'user-notification-reward-success': RewardSuccessNotification, + 'user-notification-funds-sender': FundsSenderNotification, + 'user-notification-funds-receiver': FundsReceiverNotification, + 'user-notification-funds-request': FundsRequestNotification, +}; + +for (const key in components) { + Vue.component(key, components[key]); +} diff --git a/wallet-webapps/src/main/webapp/vue-app/notification-extension/main.js b/wallet-webapps/src/main/webapp/vue-app/notification-extension/main.js new file mode 100644 index 000000000..ba8ac552a --- /dev/null +++ b/wallet-webapps/src/main/webapp/vue-app/notification-extension/main.js @@ -0,0 +1,33 @@ +/* + * This file is part of the Meeds project (https://meeds.io/). + * + * Copyright (C) 2020 - 2023 Meeds Association contact@meeds.io + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import './initComponents.js'; +import './extensions.js'; + +const lang = eXo.env.portal.language; +const url = `${eXo.env.portal.context}/${eXo.env.portal.rest}/i18n/bundle/locale.notification.WalletNotification-${lang}.json`; + +export function init() { + return exoi18n.loadLanguageAsync(lang, url) + .then(() => { + new Vue({ + i18n: exoi18n.i18n, + }); + }); +} diff --git a/wallet-webapps/webpack.prod.js b/wallet-webapps/webpack.prod.js index 8847ff687..122811261 100644 --- a/wallet-webapps/webpack.prod.js +++ b/wallet-webapps/webpack.prod.js @@ -29,7 +29,8 @@ const config = merge(webpackCommonConfig, { walletSettings: './src/main/webapp/vue-app/wallet-common/wallet-settings/main.js', walletOverview: './src/main/webapp/vue-app/wallet-common/wallet-overview/main.js', rewardApp: './src/main/webapp/vue-app/wallet-reward/main.js', - engagementCenterExtensions: './src/main/webapp/vue-app/engagementCenterExtensions/extensions.js' + engagementCenterExtensions: './src/main/webapp/vue-app/engagementCenterExtensions/extensions.js', + notificationExtension: './src/main/webapp/vue-app/notification-extension/main.js', }, output: { path: path.join(__dirname, 'target/wallet/'),