@plusscommunities/pluss-newsletter-web-sharing 1.4.27 → 1.4.28

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/index.cjs.js CHANGED
@@ -351,12 +351,12 @@ var Popup = Components$2.Popup;
351
351
  var HubSidebar = Components$2.HubSidebar;
352
352
  var SVGIcon = Components$2.SVGIcon;
353
353
 
354
- var Session$1 = PlussCore__namespace.Session;
355
- Session$1.isTheBest;
356
- var validateAccess = Session$1.validateAccess;
357
- var authedFunction = Session$1.authedFunction;
358
- var checkLoggedIn = Session$1.checkLoggedIn;
359
- Session$1.isTVEnabled;
354
+ var Session$2 = PlussCore__namespace.Session;
355
+ Session$2.isTheBest;
356
+ var validateAccess = Session$2.validateAccess;
357
+ var authedFunction = Session$2.authedFunction;
358
+ var checkLoggedIn = Session$2.checkLoggedIn;
359
+ Session$2.isTVEnabled;
360
360
 
361
361
  var NEWS_LOADED = values.actionNewsLoaded;
362
362
  var NEWS_UPDATED = values.actionNewsUpdated;
@@ -624,6 +624,31 @@ var removeNews = function removeNews(id) {
624
624
  payload: id
625
625
  };
626
626
  };
627
+ var newsSubmissionsUpdate = function newsSubmissionsUpdate(site, isdashboard) {
628
+ return function (dispatch) {
629
+ if (isdashboard) {
630
+ dispatch({
631
+ type: NEWS_SUBMISSIONS_DASHBOARD_LOADING
632
+ });
633
+ }
634
+
635
+ newsletterActions.getNewsletterSubmissions(site).then(function (res) {
636
+ var currentSiteSub = Helper$2.readStorageWithCookie('site');
637
+
638
+ if (res.data != null && !___default['default'].isEmpty(res.data) && res.data[0].Site === currentSiteSub) {
639
+ dispatch({
640
+ type: NEWS_SUBMISSIONS_LOADED,
641
+ payload: res.data
642
+ });
643
+ } else {
644
+ dispatch({
645
+ type: NEWS_SUBMISSIONS_LOADED,
646
+ payload: []
647
+ });
648
+ }
649
+ });
650
+ };
651
+ };
627
652
  var newsSubmissionsLoaded = function newsSubmissionsLoaded(events) {
628
653
  return {
629
654
  type: NEWS_SUBMISSIONS_LOADED,
@@ -982,7 +1007,7 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
982
1007
  return ListNewsletter;
983
1008
  }(React.Component);
984
1009
 
985
- var mapStateToProps$a = function mapStateToProps(state) {
1010
+ var mapStateToProps$b = function mapStateToProps(state) {
986
1011
  var auth = state.auth;
987
1012
  return {
988
1013
  news: state[values.reducerKey].news,
@@ -990,7 +1015,7 @@ var mapStateToProps$a = function mapStateToProps(state) {
990
1015
  };
991
1016
  };
992
1017
 
993
- var ListNewsletterEntries = reactRedux.connect(mapStateToProps$a, {
1018
+ var ListNewsletterEntries = reactRedux.connect(mapStateToProps$b, {
994
1019
  newsLoaded: newsLoaded,
995
1020
  removeNews: removeNews
996
1021
  })(ListNewsletter$1);
@@ -1355,7 +1380,7 @@ var NewsletterSubmissions = /*#__PURE__*/function (_Component) {
1355
1380
  return NewsletterSubmissions;
1356
1381
  }(React.Component);
1357
1382
 
1358
- var mapStateToProps$9 = function mapStateToProps(state) {
1383
+ var mapStateToProps$a = function mapStateToProps(state) {
1359
1384
  var auth = state.auth;
1360
1385
  return {
1361
1386
  submissions: state[values.reducerKey].submissions,
@@ -1363,7 +1388,7 @@ var mapStateToProps$9 = function mapStateToProps(state) {
1363
1388
  };
1364
1389
  };
1365
1390
 
1366
- var NewsletterSubmissions$1 = reactRedux.connect(mapStateToProps$9, {
1391
+ var NewsletterSubmissions$1 = reactRedux.connect(mapStateToProps$a, {
1367
1392
  newsSubmissionsLoaded: newsSubmissionsLoaded
1368
1393
  })(NewsletterSubmissions);
1369
1394
 
@@ -1719,14 +1744,14 @@ var NewsHubAnalytics = /*#__PURE__*/function (_Component) {
1719
1744
  return NewsHubAnalytics;
1720
1745
  }(React.Component);
1721
1746
 
1722
- var mapStateToProps$8 = function mapStateToProps(state) {
1747
+ var mapStateToProps$9 = function mapStateToProps(state) {
1723
1748
  var auth = state.auth;
1724
1749
  return {
1725
1750
  auth: auth
1726
1751
  };
1727
1752
  };
1728
1753
 
1729
- var NewsHubAnalytics$1 = reactRedux.connect(mapStateToProps$8, {
1754
+ var NewsHubAnalytics$1 = reactRedux.connect(mapStateToProps$9, {
1730
1755
  usersLoaded: usersLoaded
1731
1756
  })(reactRouter.withRouter(NewsHubAnalytics));
1732
1757
 
@@ -1903,7 +1928,7 @@ var styles$5 = {
1903
1928
  }
1904
1929
  };
1905
1930
 
1906
- var mapStateToProps$7 = function mapStateToProps(state) {
1931
+ var mapStateToProps$8 = function mapStateToProps(state) {
1907
1932
  var auth = state.auth;
1908
1933
  return {
1909
1934
  news: state[values.reducerKey].news,
@@ -1911,7 +1936,7 @@ var mapStateToProps$7 = function mapStateToProps(state) {
1911
1936
  };
1912
1937
  };
1913
1938
 
1914
- var AvailableNews = reactRedux.connect(mapStateToProps$7, {
1939
+ var AvailableNews = reactRedux.connect(mapStateToProps$8, {
1915
1940
  newsLoaded: newsLoaded,
1916
1941
  removeNews: removeNews
1917
1942
  })(reactRouter.withRouter(ListNewsletter));
@@ -2241,7 +2266,7 @@ var styles$4 = {
2241
2266
  }
2242
2267
  };
2243
2268
 
2244
- var mapStateToProps$6 = function mapStateToProps(state) {
2269
+ var mapStateToProps$7 = function mapStateToProps(state) {
2245
2270
  var auth = state.auth;
2246
2271
  return {
2247
2272
  news: state[values.reducerKey].news,
@@ -2251,7 +2276,7 @@ var mapStateToProps$6 = function mapStateToProps(state) {
2251
2276
  };
2252
2277
  };
2253
2278
 
2254
- var NewsHub$1 = reactRedux.connect(mapStateToProps$6, {
2279
+ var NewsHub$1 = reactRedux.connect(mapStateToProps$7, {
2255
2280
  newsLoaded: newsLoaded,
2256
2281
  newsSubmissionsLoaded: newsSubmissionsLoaded,
2257
2282
  setAuth: setAuth
@@ -3839,7 +3864,7 @@ var AddNewsletterEntry = /*#__PURE__*/function (_Component) {
3839
3864
  return AddNewsletterEntry;
3840
3865
  }(React.Component);
3841
3866
 
3842
- var mapStateToProps$5 = function mapStateToProps(state) {
3867
+ var mapStateToProps$6 = function mapStateToProps(state) {
3843
3868
  var auth = state.auth;
3844
3869
  var allUsers = state.users.allUsers;
3845
3870
  return {
@@ -3850,7 +3875,7 @@ var mapStateToProps$5 = function mapStateToProps(state) {
3850
3875
  };
3851
3876
  };
3852
3877
 
3853
- var AddNewsletterEntry$1 = reactRedux.connect(mapStateToProps$5, {
3878
+ var AddNewsletterEntry$1 = reactRedux.connect(mapStateToProps$6, {
3854
3879
  newsUpdate: newsUpdate,
3855
3880
  usersLoaded: usersLoaded,
3856
3881
  addRecentlyCreated: addRecentlyCreated
@@ -4360,14 +4385,14 @@ var PublishAvailableNews = /*#__PURE__*/function (_Component) {
4360
4385
  return PublishAvailableNews;
4361
4386
  }(React.Component);
4362
4387
 
4363
- var mapStateToProps$4 = function mapStateToProps(state) {
4388
+ var mapStateToProps$5 = function mapStateToProps(state) {
4364
4389
  var auth = state.auth;
4365
4390
  return {
4366
4391
  auth: auth
4367
4392
  };
4368
4393
  };
4369
4394
 
4370
- var PublishAvailableNews$1 = reactRedux.connect(mapStateToProps$4, {
4395
+ var PublishAvailableNews$1 = reactRedux.connect(mapStateToProps$5, {
4371
4396
  newsUpdate: newsUpdate
4372
4397
  })(PublishAvailableNews);
4373
4398
 
@@ -4917,14 +4942,14 @@ var NewsletterSubmission = /*#__PURE__*/function (_Component) {
4917
4942
  return NewsletterSubmission;
4918
4943
  }(React.Component);
4919
4944
 
4920
- var mapStateToProps$3 = function mapStateToProps(state) {
4945
+ var mapStateToProps$4 = function mapStateToProps(state) {
4921
4946
  var auth = state.auth;
4922
4947
  return {
4923
4948
  auth: auth
4924
4949
  };
4925
4950
  };
4926
4951
 
4927
- var NewsletterSubmission$1 = reactRedux.connect(mapStateToProps$3, {
4952
+ var NewsletterSubmission$1 = reactRedux.connect(mapStateToProps$4, {
4928
4953
  removeNewsSubmission: removeNewsSubmission,
4929
4954
  newsSubmissionsLoaded: newsSubmissionsLoaded
4930
4955
  })(NewsletterSubmission);
@@ -5102,14 +5127,14 @@ var NewsletterAnalytics = /*#__PURE__*/function (_Component) {
5102
5127
  return NewsletterAnalytics;
5103
5128
  }(React.Component);
5104
5129
 
5105
- var mapStateToProps$2 = function mapStateToProps(state) {
5130
+ var mapStateToProps$3 = function mapStateToProps(state) {
5106
5131
  var auth = state.auth;
5107
5132
  return {
5108
5133
  auth: auth
5109
5134
  };
5110
5135
  };
5111
5136
 
5112
- var NewsletterAnalytics$1 = reactRedux.connect(mapStateToProps$2, {})(NewsletterAnalytics);
5137
+ var NewsletterAnalytics$1 = reactRedux.connect(mapStateToProps$3, {})(NewsletterAnalytics);
5113
5138
 
5114
5139
  var MakerPopup = PlussCore__namespace.Components.MakerPopup;
5115
5140
 
@@ -6128,7 +6153,7 @@ var GenerateNewsletter = /*#__PURE__*/function (_Component) {
6128
6153
  return GenerateNewsletter;
6129
6154
  }(React.Component);
6130
6155
 
6131
- var mapStateToProps$1 = function mapStateToProps(state) {
6156
+ var mapStateToProps$2 = function mapStateToProps(state) {
6132
6157
  var auth = state.auth;
6133
6158
  return {
6134
6159
  news: state[values.reducerKey].news,
@@ -6136,7 +6161,7 @@ var mapStateToProps$1 = function mapStateToProps(state) {
6136
6161
  };
6137
6162
  };
6138
6163
 
6139
- var GenerateNewsletter$1 = reactRedux.connect(mapStateToProps$1, {
6164
+ var GenerateNewsletter$1 = reactRedux.connect(mapStateToProps$2, {
6140
6165
  newsLoaded: newsLoaded,
6141
6166
  setAuth: setAuth
6142
6167
  })(GenerateNewsletter);
@@ -7203,7 +7228,7 @@ var NewsletterTemplate$1 = reactRedux.connect(null, {
7203
7228
  })(NewsletterTemplate);
7204
7229
 
7205
7230
  var Analytics$1 = PlussCore__namespace.Analytics,
7206
- Session = PlussCore__namespace.Session,
7231
+ Session$1 = PlussCore__namespace.Session,
7207
7232
  Components = PlussCore__namespace.Components;
7208
7233
 
7209
7234
  var getInitialState = function getInitialState() {
@@ -7241,7 +7266,7 @@ var AnalyticsHub = function AnalyticsHub(_ref) {
7241
7266
  isExportOpen = _useState4[0],
7242
7267
  setIsExportOpen = _useState4[1];
7243
7268
 
7244
- var hasAccess = Session.validateAccess(auth.site, values.permissionNewsletter, auth);
7269
+ var hasAccess = Session$1.validateAccess(auth.site, values.permissionNewsletter, auth);
7245
7270
 
7246
7271
  if (!hasAccess) {
7247
7272
  return null;
@@ -7422,7 +7447,7 @@ var AnalyticsHub = function AnalyticsHub(_ref) {
7422
7447
  })));
7423
7448
  };
7424
7449
 
7425
- var mapStateToProps = function mapStateToProps(state) {
7450
+ var mapStateToProps$1 = function mapStateToProps(state) {
7426
7451
  var auth = state.auth;
7427
7452
  return {
7428
7453
  auth: auth,
@@ -7430,7 +7455,7 @@ var mapStateToProps = function mapStateToProps(state) {
7430
7455
  };
7431
7456
  };
7432
7457
 
7433
- var toExport = reactRedux.connect(mapStateToProps, {})(AnalyticsHub);
7458
+ var toExport = reactRedux.connect(mapStateToProps$1, {})(AnalyticsHub);
7434
7459
 
7435
7460
  function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
7436
7461
 
@@ -7907,6 +7932,40 @@ var FeaturePickerContent = (function () {
7907
7932
  })))));
7908
7933
  });
7909
7934
 
7935
+ var Session = PlussCore__namespace.Session; // DashboardLoader Component
7936
+
7937
+ var DashboardLoader = function DashboardLoader(_ref) {
7938
+ var auth = _ref.auth,
7939
+ newsSubmissionsUpdate = _ref.newsSubmissionsUpdate;
7940
+ var hasAccess = Session.validateAccess(auth.site, values.permissionNewsletter, auth);
7941
+
7942
+ if (!hasAccess) {
7943
+ return null;
7944
+ }
7945
+
7946
+ React.useEffect(function () {
7947
+ if (auth && auth.site) {
7948
+ newsSubmissionsUpdate(auth.site);
7949
+ }
7950
+ }, [auth, newsSubmissionsUpdate]);
7951
+ return /*#__PURE__*/React__default['default'].createElement("div", {
7952
+ style: {
7953
+ display: 'none'
7954
+ }
7955
+ });
7956
+ };
7957
+
7958
+ var mapStateToProps = function mapStateToProps(state) {
7959
+ var auth = state.auth;
7960
+ return {
7961
+ auth: auth
7962
+ };
7963
+ };
7964
+
7965
+ var DashboardLoader$1 = reactRedux.connect(mapStateToProps, {
7966
+ newsSubmissionsUpdate: newsSubmissionsUpdate
7967
+ })(DashboardLoader);
7968
+
7910
7969
  var Reducers = function () {
7911
7970
  var reducers = {};
7912
7971
  reducers[values.reducerKey] = NewsReducer;
@@ -7925,10 +7984,12 @@ var Screens = function () {
7925
7984
  }();
7926
7985
 
7927
7986
  var Analytics = [toExport];
7987
+ // Hidden component allowing content to load on the dashboard
7928
7988
 
7929
7989
  exports.ActivityText = ActivityText;
7930
7990
  exports.Analytics = Analytics;
7931
7991
  exports.Config = FeatureConfig;
7992
+ exports.DashboardLoader = DashboardLoader$1;
7932
7993
  exports.FeaturePickerContent = FeaturePickerContent;
7933
7994
  exports.PreviewFull = PreviewFull;
7934
7995
  exports.PreviewGrid = PreviewGrid;
package/dist/index.esm.js CHANGED
@@ -307,12 +307,12 @@ var Popup = Components$2.Popup;
307
307
  var HubSidebar = Components$2.HubSidebar;
308
308
  var SVGIcon = Components$2.SVGIcon;
309
309
 
310
- var Session$1 = PlussCore.Session;
311
- Session$1.isTheBest;
312
- var validateAccess = Session$1.validateAccess;
313
- var authedFunction = Session$1.authedFunction;
314
- var checkLoggedIn = Session$1.checkLoggedIn;
315
- Session$1.isTVEnabled;
310
+ var Session$2 = PlussCore.Session;
311
+ Session$2.isTheBest;
312
+ var validateAccess = Session$2.validateAccess;
313
+ var authedFunction = Session$2.authedFunction;
314
+ var checkLoggedIn = Session$2.checkLoggedIn;
315
+ Session$2.isTVEnabled;
316
316
 
317
317
  var NEWS_LOADED = values.actionNewsLoaded;
318
318
  var NEWS_UPDATED = values.actionNewsUpdated;
@@ -580,6 +580,31 @@ var removeNews = function removeNews(id) {
580
580
  payload: id
581
581
  };
582
582
  };
583
+ var newsSubmissionsUpdate = function newsSubmissionsUpdate(site, isdashboard) {
584
+ return function (dispatch) {
585
+ if (isdashboard) {
586
+ dispatch({
587
+ type: NEWS_SUBMISSIONS_DASHBOARD_LOADING
588
+ });
589
+ }
590
+
591
+ newsletterActions.getNewsletterSubmissions(site).then(function (res) {
592
+ var currentSiteSub = Helper$2.readStorageWithCookie('site');
593
+
594
+ if (res.data != null && !_.isEmpty(res.data) && res.data[0].Site === currentSiteSub) {
595
+ dispatch({
596
+ type: NEWS_SUBMISSIONS_LOADED,
597
+ payload: res.data
598
+ });
599
+ } else {
600
+ dispatch({
601
+ type: NEWS_SUBMISSIONS_LOADED,
602
+ payload: []
603
+ });
604
+ }
605
+ });
606
+ };
607
+ };
583
608
  var newsSubmissionsLoaded = function newsSubmissionsLoaded(events) {
584
609
  return {
585
610
  type: NEWS_SUBMISSIONS_LOADED,
@@ -938,7 +963,7 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
938
963
  return ListNewsletter;
939
964
  }(Component);
940
965
 
941
- var mapStateToProps$a = function mapStateToProps(state) {
966
+ var mapStateToProps$b = function mapStateToProps(state) {
942
967
  var auth = state.auth;
943
968
  return {
944
969
  news: state[values.reducerKey].news,
@@ -946,7 +971,7 @@ var mapStateToProps$a = function mapStateToProps(state) {
946
971
  };
947
972
  };
948
973
 
949
- var ListNewsletterEntries = connect(mapStateToProps$a, {
974
+ var ListNewsletterEntries = connect(mapStateToProps$b, {
950
975
  newsLoaded: newsLoaded,
951
976
  removeNews: removeNews
952
977
  })(ListNewsletter$1);
@@ -1311,7 +1336,7 @@ var NewsletterSubmissions = /*#__PURE__*/function (_Component) {
1311
1336
  return NewsletterSubmissions;
1312
1337
  }(Component);
1313
1338
 
1314
- var mapStateToProps$9 = function mapStateToProps(state) {
1339
+ var mapStateToProps$a = function mapStateToProps(state) {
1315
1340
  var auth = state.auth;
1316
1341
  return {
1317
1342
  submissions: state[values.reducerKey].submissions,
@@ -1319,7 +1344,7 @@ var mapStateToProps$9 = function mapStateToProps(state) {
1319
1344
  };
1320
1345
  };
1321
1346
 
1322
- var NewsletterSubmissions$1 = connect(mapStateToProps$9, {
1347
+ var NewsletterSubmissions$1 = connect(mapStateToProps$a, {
1323
1348
  newsSubmissionsLoaded: newsSubmissionsLoaded
1324
1349
  })(NewsletterSubmissions);
1325
1350
 
@@ -1675,14 +1700,14 @@ var NewsHubAnalytics = /*#__PURE__*/function (_Component) {
1675
1700
  return NewsHubAnalytics;
1676
1701
  }(Component);
1677
1702
 
1678
- var mapStateToProps$8 = function mapStateToProps(state) {
1703
+ var mapStateToProps$9 = function mapStateToProps(state) {
1679
1704
  var auth = state.auth;
1680
1705
  return {
1681
1706
  auth: auth
1682
1707
  };
1683
1708
  };
1684
1709
 
1685
- var NewsHubAnalytics$1 = connect(mapStateToProps$8, {
1710
+ var NewsHubAnalytics$1 = connect(mapStateToProps$9, {
1686
1711
  usersLoaded: usersLoaded
1687
1712
  })(withRouter(NewsHubAnalytics));
1688
1713
 
@@ -1859,7 +1884,7 @@ var styles$5 = {
1859
1884
  }
1860
1885
  };
1861
1886
 
1862
- var mapStateToProps$7 = function mapStateToProps(state) {
1887
+ var mapStateToProps$8 = function mapStateToProps(state) {
1863
1888
  var auth = state.auth;
1864
1889
  return {
1865
1890
  news: state[values.reducerKey].news,
@@ -1867,7 +1892,7 @@ var mapStateToProps$7 = function mapStateToProps(state) {
1867
1892
  };
1868
1893
  };
1869
1894
 
1870
- var AvailableNews = connect(mapStateToProps$7, {
1895
+ var AvailableNews = connect(mapStateToProps$8, {
1871
1896
  newsLoaded: newsLoaded,
1872
1897
  removeNews: removeNews
1873
1898
  })(withRouter(ListNewsletter));
@@ -2197,7 +2222,7 @@ var styles$4 = {
2197
2222
  }
2198
2223
  };
2199
2224
 
2200
- var mapStateToProps$6 = function mapStateToProps(state) {
2225
+ var mapStateToProps$7 = function mapStateToProps(state) {
2201
2226
  var auth = state.auth;
2202
2227
  return {
2203
2228
  news: state[values.reducerKey].news,
@@ -2207,7 +2232,7 @@ var mapStateToProps$6 = function mapStateToProps(state) {
2207
2232
  };
2208
2233
  };
2209
2234
 
2210
- var NewsHub$1 = connect(mapStateToProps$6, {
2235
+ var NewsHub$1 = connect(mapStateToProps$7, {
2211
2236
  newsLoaded: newsLoaded,
2212
2237
  newsSubmissionsLoaded: newsSubmissionsLoaded,
2213
2238
  setAuth: setAuth
@@ -3795,7 +3820,7 @@ var AddNewsletterEntry = /*#__PURE__*/function (_Component) {
3795
3820
  return AddNewsletterEntry;
3796
3821
  }(Component);
3797
3822
 
3798
- var mapStateToProps$5 = function mapStateToProps(state) {
3823
+ var mapStateToProps$6 = function mapStateToProps(state) {
3799
3824
  var auth = state.auth;
3800
3825
  var allUsers = state.users.allUsers;
3801
3826
  return {
@@ -3806,7 +3831,7 @@ var mapStateToProps$5 = function mapStateToProps(state) {
3806
3831
  };
3807
3832
  };
3808
3833
 
3809
- var AddNewsletterEntry$1 = connect(mapStateToProps$5, {
3834
+ var AddNewsletterEntry$1 = connect(mapStateToProps$6, {
3810
3835
  newsUpdate: newsUpdate,
3811
3836
  usersLoaded: usersLoaded,
3812
3837
  addRecentlyCreated: addRecentlyCreated
@@ -4316,14 +4341,14 @@ var PublishAvailableNews = /*#__PURE__*/function (_Component) {
4316
4341
  return PublishAvailableNews;
4317
4342
  }(Component);
4318
4343
 
4319
- var mapStateToProps$4 = function mapStateToProps(state) {
4344
+ var mapStateToProps$5 = function mapStateToProps(state) {
4320
4345
  var auth = state.auth;
4321
4346
  return {
4322
4347
  auth: auth
4323
4348
  };
4324
4349
  };
4325
4350
 
4326
- var PublishAvailableNews$1 = connect(mapStateToProps$4, {
4351
+ var PublishAvailableNews$1 = connect(mapStateToProps$5, {
4327
4352
  newsUpdate: newsUpdate
4328
4353
  })(PublishAvailableNews);
4329
4354
 
@@ -4873,14 +4898,14 @@ var NewsletterSubmission = /*#__PURE__*/function (_Component) {
4873
4898
  return NewsletterSubmission;
4874
4899
  }(Component);
4875
4900
 
4876
- var mapStateToProps$3 = function mapStateToProps(state) {
4901
+ var mapStateToProps$4 = function mapStateToProps(state) {
4877
4902
  var auth = state.auth;
4878
4903
  return {
4879
4904
  auth: auth
4880
4905
  };
4881
4906
  };
4882
4907
 
4883
- var NewsletterSubmission$1 = connect(mapStateToProps$3, {
4908
+ var NewsletterSubmission$1 = connect(mapStateToProps$4, {
4884
4909
  removeNewsSubmission: removeNewsSubmission,
4885
4910
  newsSubmissionsLoaded: newsSubmissionsLoaded
4886
4911
  })(NewsletterSubmission);
@@ -5058,14 +5083,14 @@ var NewsletterAnalytics = /*#__PURE__*/function (_Component) {
5058
5083
  return NewsletterAnalytics;
5059
5084
  }(Component);
5060
5085
 
5061
- var mapStateToProps$2 = function mapStateToProps(state) {
5086
+ var mapStateToProps$3 = function mapStateToProps(state) {
5062
5087
  var auth = state.auth;
5063
5088
  return {
5064
5089
  auth: auth
5065
5090
  };
5066
5091
  };
5067
5092
 
5068
- var NewsletterAnalytics$1 = connect(mapStateToProps$2, {})(NewsletterAnalytics);
5093
+ var NewsletterAnalytics$1 = connect(mapStateToProps$3, {})(NewsletterAnalytics);
5069
5094
 
5070
5095
  var MakerPopup = PlussCore.Components.MakerPopup;
5071
5096
 
@@ -6084,7 +6109,7 @@ var GenerateNewsletter = /*#__PURE__*/function (_Component) {
6084
6109
  return GenerateNewsletter;
6085
6110
  }(Component);
6086
6111
 
6087
- var mapStateToProps$1 = function mapStateToProps(state) {
6112
+ var mapStateToProps$2 = function mapStateToProps(state) {
6088
6113
  var auth = state.auth;
6089
6114
  return {
6090
6115
  news: state[values.reducerKey].news,
@@ -6092,7 +6117,7 @@ var mapStateToProps$1 = function mapStateToProps(state) {
6092
6117
  };
6093
6118
  };
6094
6119
 
6095
- var GenerateNewsletter$1 = connect(mapStateToProps$1, {
6120
+ var GenerateNewsletter$1 = connect(mapStateToProps$2, {
6096
6121
  newsLoaded: newsLoaded,
6097
6122
  setAuth: setAuth
6098
6123
  })(GenerateNewsletter);
@@ -7159,7 +7184,7 @@ var NewsletterTemplate$1 = connect(null, {
7159
7184
  })(NewsletterTemplate);
7160
7185
 
7161
7186
  var Analytics$1 = PlussCore.Analytics,
7162
- Session = PlussCore.Session,
7187
+ Session$1 = PlussCore.Session,
7163
7188
  Components = PlussCore.Components;
7164
7189
 
7165
7190
  var getInitialState = function getInitialState() {
@@ -7197,7 +7222,7 @@ var AnalyticsHub = function AnalyticsHub(_ref) {
7197
7222
  isExportOpen = _useState4[0],
7198
7223
  setIsExportOpen = _useState4[1];
7199
7224
 
7200
- var hasAccess = Session.validateAccess(auth.site, values.permissionNewsletter, auth);
7225
+ var hasAccess = Session$1.validateAccess(auth.site, values.permissionNewsletter, auth);
7201
7226
 
7202
7227
  if (!hasAccess) {
7203
7228
  return null;
@@ -7378,7 +7403,7 @@ var AnalyticsHub = function AnalyticsHub(_ref) {
7378
7403
  })));
7379
7404
  };
7380
7405
 
7381
- var mapStateToProps = function mapStateToProps(state) {
7406
+ var mapStateToProps$1 = function mapStateToProps(state) {
7382
7407
  var auth = state.auth;
7383
7408
  return {
7384
7409
  auth: auth,
@@ -7386,7 +7411,7 @@ var mapStateToProps = function mapStateToProps(state) {
7386
7411
  };
7387
7412
  };
7388
7413
 
7389
- var toExport = connect(mapStateToProps, {})(AnalyticsHub);
7414
+ var toExport = connect(mapStateToProps$1, {})(AnalyticsHub);
7390
7415
 
7391
7416
  function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
7392
7417
 
@@ -7863,6 +7888,40 @@ var FeaturePickerContent = (function () {
7863
7888
  })))));
7864
7889
  });
7865
7890
 
7891
+ var Session = PlussCore.Session; // DashboardLoader Component
7892
+
7893
+ var DashboardLoader = function DashboardLoader(_ref) {
7894
+ var auth = _ref.auth,
7895
+ newsSubmissionsUpdate = _ref.newsSubmissionsUpdate;
7896
+ var hasAccess = Session.validateAccess(auth.site, values.permissionNewsletter, auth);
7897
+
7898
+ if (!hasAccess) {
7899
+ return null;
7900
+ }
7901
+
7902
+ useEffect(function () {
7903
+ if (auth && auth.site) {
7904
+ newsSubmissionsUpdate(auth.site);
7905
+ }
7906
+ }, [auth, newsSubmissionsUpdate]);
7907
+ return /*#__PURE__*/React.createElement("div", {
7908
+ style: {
7909
+ display: 'none'
7910
+ }
7911
+ });
7912
+ };
7913
+
7914
+ var mapStateToProps = function mapStateToProps(state) {
7915
+ var auth = state.auth;
7916
+ return {
7917
+ auth: auth
7918
+ };
7919
+ };
7920
+
7921
+ var DashboardLoader$1 = connect(mapStateToProps, {
7922
+ newsSubmissionsUpdate: newsSubmissionsUpdate
7923
+ })(DashboardLoader);
7924
+
7866
7925
  var Reducers = function () {
7867
7926
  var reducers = {};
7868
7927
  reducers[values.reducerKey] = NewsReducer;
@@ -7881,5 +7940,6 @@ var Screens = function () {
7881
7940
  }();
7882
7941
 
7883
7942
  var Analytics = [toExport];
7943
+ // Hidden component allowing content to load on the dashboard
7884
7944
 
7885
- export { ActivityText, Analytics, FeatureConfig as Config, FeaturePickerContent, PreviewFull, PreviewGrid, PreviewWidget, Reducers, Screens, ViewFull, ViewWidget };
7945
+ export { ActivityText, Analytics, FeatureConfig as Config, DashboardLoader$1 as DashboardLoader, FeaturePickerContent, PreviewFull, PreviewGrid, PreviewWidget, Reducers, Screens, ViewFull, ViewWidget };
package/dist/index.umd.js CHANGED
@@ -329,12 +329,12 @@
329
329
  var HubSidebar = Components$2.HubSidebar;
330
330
  var SVGIcon = Components$2.SVGIcon;
331
331
 
332
- var Session$1 = PlussCore__namespace.Session;
333
- Session$1.isTheBest;
334
- var validateAccess = Session$1.validateAccess;
335
- var authedFunction = Session$1.authedFunction;
336
- var checkLoggedIn = Session$1.checkLoggedIn;
337
- Session$1.isTVEnabled;
332
+ var Session$2 = PlussCore__namespace.Session;
333
+ Session$2.isTheBest;
334
+ var validateAccess = Session$2.validateAccess;
335
+ var authedFunction = Session$2.authedFunction;
336
+ var checkLoggedIn = Session$2.checkLoggedIn;
337
+ Session$2.isTVEnabled;
338
338
 
339
339
  var NEWS_LOADED = values.actionNewsLoaded;
340
340
  var NEWS_UPDATED = values.actionNewsUpdated;
@@ -602,6 +602,31 @@
602
602
  payload: id
603
603
  };
604
604
  };
605
+ var newsSubmissionsUpdate = function newsSubmissionsUpdate(site, isdashboard) {
606
+ return function (dispatch) {
607
+ if (isdashboard) {
608
+ dispatch({
609
+ type: NEWS_SUBMISSIONS_DASHBOARD_LOADING
610
+ });
611
+ }
612
+
613
+ newsletterActions.getNewsletterSubmissions(site).then(function (res) {
614
+ var currentSiteSub = Helper$2.readStorageWithCookie('site');
615
+
616
+ if (res.data != null && !___default['default'].isEmpty(res.data) && res.data[0].Site === currentSiteSub) {
617
+ dispatch({
618
+ type: NEWS_SUBMISSIONS_LOADED,
619
+ payload: res.data
620
+ });
621
+ } else {
622
+ dispatch({
623
+ type: NEWS_SUBMISSIONS_LOADED,
624
+ payload: []
625
+ });
626
+ }
627
+ });
628
+ };
629
+ };
605
630
  var newsSubmissionsLoaded = function newsSubmissionsLoaded(events) {
606
631
  return {
607
632
  type: NEWS_SUBMISSIONS_LOADED,
@@ -960,7 +985,7 @@
960
985
  return ListNewsletter;
961
986
  }(React.Component);
962
987
 
963
- var mapStateToProps$a = function mapStateToProps(state) {
988
+ var mapStateToProps$b = function mapStateToProps(state) {
964
989
  var auth = state.auth;
965
990
  return {
966
991
  news: state[values.reducerKey].news,
@@ -968,7 +993,7 @@
968
993
  };
969
994
  };
970
995
 
971
- var ListNewsletterEntries = reactRedux.connect(mapStateToProps$a, {
996
+ var ListNewsletterEntries = reactRedux.connect(mapStateToProps$b, {
972
997
  newsLoaded: newsLoaded,
973
998
  removeNews: removeNews
974
999
  })(ListNewsletter$1);
@@ -1333,7 +1358,7 @@
1333
1358
  return NewsletterSubmissions;
1334
1359
  }(React.Component);
1335
1360
 
1336
- var mapStateToProps$9 = function mapStateToProps(state) {
1361
+ var mapStateToProps$a = function mapStateToProps(state) {
1337
1362
  var auth = state.auth;
1338
1363
  return {
1339
1364
  submissions: state[values.reducerKey].submissions,
@@ -1341,7 +1366,7 @@
1341
1366
  };
1342
1367
  };
1343
1368
 
1344
- var NewsletterSubmissions$1 = reactRedux.connect(mapStateToProps$9, {
1369
+ var NewsletterSubmissions$1 = reactRedux.connect(mapStateToProps$a, {
1345
1370
  newsSubmissionsLoaded: newsSubmissionsLoaded
1346
1371
  })(NewsletterSubmissions);
1347
1372
 
@@ -1697,14 +1722,14 @@
1697
1722
  return NewsHubAnalytics;
1698
1723
  }(React.Component);
1699
1724
 
1700
- var mapStateToProps$8 = function mapStateToProps(state) {
1725
+ var mapStateToProps$9 = function mapStateToProps(state) {
1701
1726
  var auth = state.auth;
1702
1727
  return {
1703
1728
  auth: auth
1704
1729
  };
1705
1730
  };
1706
1731
 
1707
- var NewsHubAnalytics$1 = reactRedux.connect(mapStateToProps$8, {
1732
+ var NewsHubAnalytics$1 = reactRedux.connect(mapStateToProps$9, {
1708
1733
  usersLoaded: usersLoaded
1709
1734
  })(reactRouter.withRouter(NewsHubAnalytics));
1710
1735
 
@@ -1881,7 +1906,7 @@
1881
1906
  }
1882
1907
  };
1883
1908
 
1884
- var mapStateToProps$7 = function mapStateToProps(state) {
1909
+ var mapStateToProps$8 = function mapStateToProps(state) {
1885
1910
  var auth = state.auth;
1886
1911
  return {
1887
1912
  news: state[values.reducerKey].news,
@@ -1889,7 +1914,7 @@
1889
1914
  };
1890
1915
  };
1891
1916
 
1892
- var AvailableNews = reactRedux.connect(mapStateToProps$7, {
1917
+ var AvailableNews = reactRedux.connect(mapStateToProps$8, {
1893
1918
  newsLoaded: newsLoaded,
1894
1919
  removeNews: removeNews
1895
1920
  })(reactRouter.withRouter(ListNewsletter));
@@ -2219,7 +2244,7 @@
2219
2244
  }
2220
2245
  };
2221
2246
 
2222
- var mapStateToProps$6 = function mapStateToProps(state) {
2247
+ var mapStateToProps$7 = function mapStateToProps(state) {
2223
2248
  var auth = state.auth;
2224
2249
  return {
2225
2250
  news: state[values.reducerKey].news,
@@ -2229,7 +2254,7 @@
2229
2254
  };
2230
2255
  };
2231
2256
 
2232
- var NewsHub$1 = reactRedux.connect(mapStateToProps$6, {
2257
+ var NewsHub$1 = reactRedux.connect(mapStateToProps$7, {
2233
2258
  newsLoaded: newsLoaded,
2234
2259
  newsSubmissionsLoaded: newsSubmissionsLoaded,
2235
2260
  setAuth: setAuth
@@ -3817,7 +3842,7 @@
3817
3842
  return AddNewsletterEntry;
3818
3843
  }(React.Component);
3819
3844
 
3820
- var mapStateToProps$5 = function mapStateToProps(state) {
3845
+ var mapStateToProps$6 = function mapStateToProps(state) {
3821
3846
  var auth = state.auth;
3822
3847
  var allUsers = state.users.allUsers;
3823
3848
  return {
@@ -3828,7 +3853,7 @@
3828
3853
  };
3829
3854
  };
3830
3855
 
3831
- var AddNewsletterEntry$1 = reactRedux.connect(mapStateToProps$5, {
3856
+ var AddNewsletterEntry$1 = reactRedux.connect(mapStateToProps$6, {
3832
3857
  newsUpdate: newsUpdate,
3833
3858
  usersLoaded: usersLoaded,
3834
3859
  addRecentlyCreated: addRecentlyCreated
@@ -4338,14 +4363,14 @@
4338
4363
  return PublishAvailableNews;
4339
4364
  }(React.Component);
4340
4365
 
4341
- var mapStateToProps$4 = function mapStateToProps(state) {
4366
+ var mapStateToProps$5 = function mapStateToProps(state) {
4342
4367
  var auth = state.auth;
4343
4368
  return {
4344
4369
  auth: auth
4345
4370
  };
4346
4371
  };
4347
4372
 
4348
- var PublishAvailableNews$1 = reactRedux.connect(mapStateToProps$4, {
4373
+ var PublishAvailableNews$1 = reactRedux.connect(mapStateToProps$5, {
4349
4374
  newsUpdate: newsUpdate
4350
4375
  })(PublishAvailableNews);
4351
4376
 
@@ -4895,14 +4920,14 @@
4895
4920
  return NewsletterSubmission;
4896
4921
  }(React.Component);
4897
4922
 
4898
- var mapStateToProps$3 = function mapStateToProps(state) {
4923
+ var mapStateToProps$4 = function mapStateToProps(state) {
4899
4924
  var auth = state.auth;
4900
4925
  return {
4901
4926
  auth: auth
4902
4927
  };
4903
4928
  };
4904
4929
 
4905
- var NewsletterSubmission$1 = reactRedux.connect(mapStateToProps$3, {
4930
+ var NewsletterSubmission$1 = reactRedux.connect(mapStateToProps$4, {
4906
4931
  removeNewsSubmission: removeNewsSubmission,
4907
4932
  newsSubmissionsLoaded: newsSubmissionsLoaded
4908
4933
  })(NewsletterSubmission);
@@ -5080,14 +5105,14 @@
5080
5105
  return NewsletterAnalytics;
5081
5106
  }(React.Component);
5082
5107
 
5083
- var mapStateToProps$2 = function mapStateToProps(state) {
5108
+ var mapStateToProps$3 = function mapStateToProps(state) {
5084
5109
  var auth = state.auth;
5085
5110
  return {
5086
5111
  auth: auth
5087
5112
  };
5088
5113
  };
5089
5114
 
5090
- var NewsletterAnalytics$1 = reactRedux.connect(mapStateToProps$2, {})(NewsletterAnalytics);
5115
+ var NewsletterAnalytics$1 = reactRedux.connect(mapStateToProps$3, {})(NewsletterAnalytics);
5091
5116
 
5092
5117
  var MakerPopup = PlussCore__namespace.Components.MakerPopup;
5093
5118
 
@@ -6106,7 +6131,7 @@
6106
6131
  return GenerateNewsletter;
6107
6132
  }(React.Component);
6108
6133
 
6109
- var mapStateToProps$1 = function mapStateToProps(state) {
6134
+ var mapStateToProps$2 = function mapStateToProps(state) {
6110
6135
  var auth = state.auth;
6111
6136
  return {
6112
6137
  news: state[values.reducerKey].news,
@@ -6114,7 +6139,7 @@
6114
6139
  };
6115
6140
  };
6116
6141
 
6117
- var GenerateNewsletter$1 = reactRedux.connect(mapStateToProps$1, {
6142
+ var GenerateNewsletter$1 = reactRedux.connect(mapStateToProps$2, {
6118
6143
  newsLoaded: newsLoaded,
6119
6144
  setAuth: setAuth
6120
6145
  })(GenerateNewsletter);
@@ -7181,7 +7206,7 @@
7181
7206
  })(NewsletterTemplate);
7182
7207
 
7183
7208
  var Analytics$1 = PlussCore__namespace.Analytics,
7184
- Session = PlussCore__namespace.Session,
7209
+ Session$1 = PlussCore__namespace.Session,
7185
7210
  Components = PlussCore__namespace.Components;
7186
7211
 
7187
7212
  var getInitialState = function getInitialState() {
@@ -7219,7 +7244,7 @@
7219
7244
  isExportOpen = _useState4[0],
7220
7245
  setIsExportOpen = _useState4[1];
7221
7246
 
7222
- var hasAccess = Session.validateAccess(auth.site, values.permissionNewsletter, auth);
7247
+ var hasAccess = Session$1.validateAccess(auth.site, values.permissionNewsletter, auth);
7223
7248
 
7224
7249
  if (!hasAccess) {
7225
7250
  return null;
@@ -7400,7 +7425,7 @@
7400
7425
  })));
7401
7426
  };
7402
7427
 
7403
- var mapStateToProps = function mapStateToProps(state) {
7428
+ var mapStateToProps$1 = function mapStateToProps(state) {
7404
7429
  var auth = state.auth;
7405
7430
  return {
7406
7431
  auth: auth,
@@ -7408,7 +7433,7 @@
7408
7433
  };
7409
7434
  };
7410
7435
 
7411
- var toExport = reactRedux.connect(mapStateToProps, {})(AnalyticsHub);
7436
+ var toExport = reactRedux.connect(mapStateToProps$1, {})(AnalyticsHub);
7412
7437
 
7413
7438
  function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
7414
7439
 
@@ -7885,6 +7910,40 @@
7885
7910
  })))));
7886
7911
  });
7887
7912
 
7913
+ var Session = PlussCore__namespace.Session; // DashboardLoader Component
7914
+
7915
+ var DashboardLoader = function DashboardLoader(_ref) {
7916
+ var auth = _ref.auth,
7917
+ newsSubmissionsUpdate = _ref.newsSubmissionsUpdate;
7918
+ var hasAccess = Session.validateAccess(auth.site, values.permissionNewsletter, auth);
7919
+
7920
+ if (!hasAccess) {
7921
+ return null;
7922
+ }
7923
+
7924
+ React.useEffect(function () {
7925
+ if (auth && auth.site) {
7926
+ newsSubmissionsUpdate(auth.site);
7927
+ }
7928
+ }, [auth, newsSubmissionsUpdate]);
7929
+ return /*#__PURE__*/React__default['default'].createElement("div", {
7930
+ style: {
7931
+ display: 'none'
7932
+ }
7933
+ });
7934
+ };
7935
+
7936
+ var mapStateToProps = function mapStateToProps(state) {
7937
+ var auth = state.auth;
7938
+ return {
7939
+ auth: auth
7940
+ };
7941
+ };
7942
+
7943
+ var DashboardLoader$1 = reactRedux.connect(mapStateToProps, {
7944
+ newsSubmissionsUpdate: newsSubmissionsUpdate
7945
+ })(DashboardLoader);
7946
+
7888
7947
  var Reducers = function () {
7889
7948
  var reducers = {};
7890
7949
  reducers[values.reducerKey] = NewsReducer;
@@ -7903,10 +7962,12 @@
7903
7962
  }();
7904
7963
 
7905
7964
  var Analytics = [toExport];
7965
+ // Hidden component allowing content to load on the dashboard
7906
7966
 
7907
7967
  exports.ActivityText = ActivityText;
7908
7968
  exports.Analytics = Analytics;
7909
7969
  exports.Config = FeatureConfig;
7970
+ exports.DashboardLoader = DashboardLoader$1;
7910
7971
  exports.FeaturePickerContent = FeaturePickerContent;
7911
7972
  exports.PreviewFull = PreviewFull;
7912
7973
  exports.PreviewGrid = PreviewGrid;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-newsletter-web-sharing",
3
- "version": "1.4.27",
3
+ "version": "1.4.28",
4
4
  "description": "Extension package to enable newsletter on Pluss Communities Platform",
5
5
  "main": "dist/index.cjs.js",
6
6
  "scripts": {
@@ -0,0 +1,32 @@
1
+ import React, { useEffect } from 'react';
2
+ import { connect } from 'react-redux';
3
+ import { values } from '../values.config';
4
+ import { PlussCore } from '../feature.config';
5
+ import { newsSubmissionsUpdate } from '../actions';
6
+
7
+ const { Session } = PlussCore;
8
+
9
+ // DashboardLoader Component
10
+ const DashboardLoader = ({ auth, newsSubmissionsUpdate }) => {
11
+ const hasAccess = Session.validateAccess(auth.site, values.permissionNewsletter, auth);
12
+ if (!hasAccess) {
13
+ return null;
14
+ }
15
+
16
+ useEffect(() => {
17
+ if (auth && auth.site) {
18
+ newsSubmissionsUpdate(auth.site);
19
+ }
20
+ }, [auth, newsSubmissionsUpdate]);
21
+
22
+ return <div style={{ display: 'none' }} />;
23
+ };
24
+
25
+ const mapStateToProps = (state) => {
26
+ const { auth } = state;
27
+ return {
28
+ auth,
29
+ };
30
+ };
31
+
32
+ export default connect(mapStateToProps, { newsSubmissionsUpdate })(DashboardLoader);
package/src/index.js CHANGED
@@ -34,3 +34,4 @@ export { default as PreviewFull } from './components/PreviewFull'; // Preview on
34
34
  export { default as PreviewGrid } from './components/PreviewGrid'; // Preview on the phone - grid mode
35
35
  export { default as FeaturePickerContent } from './components/FeaturePickerContent'; // New Feature Picker preview
36
36
  export const Analytics = [AnalyticsHub];
37
+ export { default as DashboardLoader } from './components/DashboardLoader'; // Hidden component allowing content to load on the dashboard