@plusscommunities/pluss-feeds-web 1.0.7 → 1.0.8-beta.0

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/rollup.config.js DELETED
@@ -1,59 +0,0 @@
1
- import styles from 'rollup-plugin-styles';
2
- const autoprefixer = require('autoprefixer');
3
- import babel from '@rollup/plugin-babel';
4
- import json from '@rollup/plugin-json';
5
- import image from '@rollup/plugin-image';
6
- import localResolve from 'rollup-plugin-local-resolve';
7
-
8
- // the entry point for the library
9
- const input = 'src/index.js';
10
-
11
- var MODE = [
12
- {
13
- fomart: 'cjs',
14
- },
15
- {
16
- fomart: 'esm',
17
- },
18
- {
19
- fomart: 'umd',
20
- },
21
- ];
22
-
23
- var config = [];
24
-
25
- MODE.map((m) => {
26
- var conf = {
27
- input: input,
28
- output: {
29
- // then name of your package
30
- name: '@plusscommunities/pluss-feeds-web',
31
- file: `dist/index.${m.fomart}.js`,
32
- format: m.fomart,
33
- exports: 'auto',
34
- },
35
- // this externelizes react to prevent rollup from compiling it
36
- external: ['react', /@babel\/runtime/],
37
- plugins: [
38
- // these are babel comfigurations
39
- babel({
40
- exclude: 'node_modules/**',
41
- presets: ['@babel/preset-react', '@babel/preset-env'],
42
- plugins: ['@babel/transform-runtime'],
43
- babelHelpers: 'runtime',
44
- }),
45
- // this adds support for styles
46
- styles({
47
- postcss: {
48
- plugins: [autoprefixer()],
49
- },
50
- }),
51
- json(),
52
- image(),
53
- localResolve(),
54
- ],
55
- };
56
- config.push(conf);
57
- });
58
-
59
- export default [...config];
@@ -1,73 +0,0 @@
1
- import _ from 'lodash';
2
- import {
3
- FEEDS_LOADING,
4
- FEEDS_LOADED,
5
- FEEDS_REMOVED,
6
- FEEDS_SUBMISSIONS_LOADED,
7
- FEEDS_SUBMISSIONS_REMOVED,
8
- FEED_TYPES_LOADED,
9
- } from './types';
10
- import { feedActions } from '../apis';
11
-
12
- import { PlussCore } from '../feature.config';
13
- const { Helper } = PlussCore;
14
-
15
- export const feedsUpdate = (site, isdashboard) => {
16
- return (dispatch) => {
17
- if (isdashboard) dispatch({ type: FEEDS_LOADING });
18
- feedActions.getFeedsRecursive(site).then((res) => {
19
- const currentSite = Helper.readStorageWithCookie('site');
20
- if (!_.isEmpty(res) && res[0].site === currentSite) {
21
- dispatch({ type: FEEDS_LOADED, payload: res });
22
- } else {
23
- dispatch({ type: FEEDS_LOADED, payload: [] });
24
- }
25
- });
26
- };
27
- };
28
-
29
- export const feedsLoaded = (feeds) => {
30
- return {
31
- type: FEEDS_LOADED,
32
- payload: feeds,
33
- };
34
- };
35
-
36
- export const removeFeed = (id) => {
37
- return {
38
- type: FEEDS_REMOVED,
39
- payload: id,
40
- };
41
- };
42
-
43
- export const feedsSubmissionsLoaded = (submissions) => {
44
- return {
45
- type: FEEDS_SUBMISSIONS_LOADED,
46
- payload: submissions,
47
- };
48
- };
49
-
50
- export const removeFeedSubmission = (id) => {
51
- return {
52
- type: FEEDS_SUBMISSIONS_REMOVED,
53
- payload: id,
54
- };
55
- };
56
-
57
- export const feedTypesUpdate = (site) => {
58
- return (dispatch) => {
59
- feedActions.getFeedTypes(site).then((res) => {
60
- dispatch({
61
- type: FEED_TYPES_LOADED,
62
- payload: res.data,
63
- });
64
- });
65
- };
66
- };
67
-
68
- export const feedTypesLoaded = (feedTypes) => {
69
- return {
70
- type: FEED_TYPES_LOADED,
71
- payload: feedTypes,
72
- };
73
- };
@@ -1,6 +0,0 @@
1
- import { PlussCore } from '../feature.config';
2
-
3
- const { Actions } = PlussCore;
4
- export const usersLoaded = Actions.usersLoaded;
5
-
6
- export * from './FeedActions';
@@ -1,8 +0,0 @@
1
- import { values } from '../values.config';
2
-
3
- export const FEEDS_LOADED = values.actionFeedsLoaded;
4
- export const FEED_TYPES_LOADED = values.actionFeedTypeLoaded;
5
- export const FEEDS_REMOVED = values.actionFeedRemoved;
6
- export const FEEDS_LOADING = values.actionFeedsLoading;
7
- export const FEEDS_SUBMISSIONS_LOADED = values.actionFeedsSubmissionsLoaded;
8
- export const FEEDS_SUBMISSIONS_REMOVED = values.actionFeedsSubmissionsRemoved;
@@ -1,94 +0,0 @@
1
- import { PlussCore } from '../feature.config';
2
- import { values } from '../values.config';
3
- const { Helper, Session } = PlussCore;
4
-
5
- export const feedActions = {
6
- getFeedTypes: (site) => {
7
- let url = Helper.getUrl(values.serviceKey, 'getTypes', { site });
8
- return Session.authedFunction({ method: 'GET', url });
9
- },
10
- addFeedType: (site, label, colour) => {
11
- return Session.authedFunction({
12
- method: 'POST',
13
- url: Helper.getUrl(values.serviceKey, 'createType'),
14
- data: { site, label, colour },
15
- });
16
- },
17
- editFeedType: (site, id, label, colour) => {
18
- return Session.authedFunction({
19
- method: 'POST',
20
- url: Helper.getUrl(values.serviceKey, 'editType'),
21
- data: { site, id, label, colour },
22
- });
23
- },
24
- deleteFeedType: (site, id) => {
25
- return Session.authedFunction({
26
- method: 'POST',
27
- url: Helper.getUrl(values.serviceKey, 'deleteType'),
28
- data: { site, id },
29
- });
30
- },
31
- getFeed: (id) => {
32
- const query = { id };
33
- return Session.authedFunction({
34
- method: 'GET',
35
- url: Helper.getUrl(values.serviceKey, 'getPost', query),
36
- });
37
- },
38
- getFeedSubmissions: (site) => {
39
- const query = { site };
40
- return Session.authedFunction({
41
- method: 'GET',
42
- url: Helper.getUrl(values.serviceKey, 'getPendingPosts', query),
43
- });
44
- },
45
- getFeeds: (site, userId, authorId, lastKey) => {
46
- const query = { site };
47
- if (userId) query.userId = userId;
48
- if (authorId) query.authorId = authorId;
49
- if (lastKey) query.lastKey = JSON.stringify(lastKey);
50
- return Session.authedFunction({
51
- method: 'GET',
52
- url: Helper.getUrl(values.serviceKey, 'getPosts', query),
53
- });
54
- },
55
- getFeedsRecursive: (site, userId, authorId, lastKey, feeds = []) => {
56
- return new Promise((resolve) => {
57
- feedActions.getFeeds(site, userId, authorId, lastKey).then((res) => {
58
- const newFeeds = [...feeds, ...res.data.Items];
59
- if (!res.data.LastKey) {
60
- return resolve(newFeeds);
61
- }
62
- return resolve(feedActions.getFeedsRecursive(site, userId, authorId, res.data.LastKey, newFeeds));
63
- });
64
- });
65
- },
66
- createFeed: (feed) => {
67
- return Session.authedFunction({
68
- method: 'POST',
69
- url: Helper.getUrl(values.serviceKey, 'createPost'),
70
- data: { ...feed },
71
- });
72
- },
73
- editFeed: (feed) => {
74
- return Session.authedFunction({
75
- method: 'POST',
76
- url: Helper.getUrl(values.serviceKey, 'editPost'),
77
- data: { ...feed },
78
- });
79
- },
80
- deleteFeed: (id) => {
81
- return Session.authedFunction({
82
- method: 'POST',
83
- url: Helper.getUrl(values.serviceKey, 'deletePost'),
84
- data: { id },
85
- });
86
- },
87
- reviewFeed: (id, approved) => {
88
- return Session.authedFunction({
89
- method: 'POST',
90
- url: Helper.getUrl(values.serviceKey, 'reviewPost'),
91
- data: { id, approved },
92
- });
93
- },
94
- };
package/src/apis/index.js DELETED
@@ -1,9 +0,0 @@
1
- import { PlussCore } from '../feature.config';
2
-
3
- const { Apis } = PlussCore;
4
-
5
- export const analyticsActions = Apis.analyticsActions;
6
- export const userActions = Apis.userActions;
7
-
8
- export * from './feedActions';
9
- export * from './reactionActions';
@@ -1,46 +0,0 @@
1
- import _ from 'lodash';
2
- import { PlussCore } from '../feature.config';
3
- const { Helper, Session } = PlussCore;
4
-
5
- export const reactionActions = {
6
- addComment: (entityId, entityType, entityName, site, comment, image, parentId) => {
7
- const data = {
8
- entityId,
9
- entityType,
10
- entityName,
11
- site,
12
- comment,
13
- parentId,
14
- };
15
- if (!_.isEmpty(image)) {
16
- data.image = image;
17
- }
18
- return Session.authedFunction({
19
- method: 'POST',
20
- url: Helper.getUrl('reactions', 'comments/add'),
21
- data,
22
- });
23
- },
24
- // removeComment: (id) => {
25
- // return Session.authedFunction({
26
- // method: 'POST',
27
- // url: Helper.getUrl('reactions', 'comments/remove'),
28
- // data: {
29
- // id,
30
- // },
31
- // });
32
- // },
33
- getComments: (entityId, entityType, minTime) => {
34
- const query = {
35
- entityId,
36
- entityType,
37
- };
38
- if (minTime) {
39
- query.minTime = minTime;
40
- }
41
- return Session.authedFunction({
42
- method: 'GET',
43
- url: Helper.getUrl('reactions', 'comments/get', query),
44
- });
45
- },
46
- };