@selfcommunity/react-core 0.6.7-payments.186 → 0.6.7-payments.188

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.
@@ -36,21 +36,27 @@ function useSCJoinedCoursesManager(user) {
36
36
  Preferences_1.CONFIGURATIONS_COURSES_ENABLED in preferences &&
37
37
  preferences[Preferences_1.CONFIGURATIONS_COURSES_ENABLED].value, [preferences, features]);
38
38
  const notificationInvitedToJoinCourse = (0, react_1.useRef)(null);
39
- const notificationRequestedToJoinCourse = (0, react_1.useRef)(null);
40
- const notificationAcceptedToJoinCourse = (0, react_1.useRef)(null);
39
+ // const notificationRequestedToJoinCourse = useRef(null);
40
+ // const notificationAcceptedToJoinCourse = useRef(null);
41
41
  const notificationAddedToCourse = (0, react_1.useRef)(null);
42
42
  /**
43
43
  * Subscribe to notification types user_follow, user_unfollow
44
44
  */
45
45
  (0, use_deep_compare_effect_1.useDeepCompareEffectNoCheck)(() => {
46
46
  notificationInvitedToJoinCourse.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_COURSE}`, notificationSubscriber);
47
- notificationRequestedToJoinCourse.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_COURSE}`, notificationSubscriber);
48
- notificationAcceptedToJoinCourse.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_COURSE}`, notificationSubscriber);
47
+ /* notificationRequestedToJoinCourse.current = PubSub.subscribe(
48
+ `${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_COURSE}`,
49
+ notificationSubscriber
50
+ );
51
+ notificationAcceptedToJoinCourse.current = PubSub.subscribe(
52
+ `${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_COURSE}`,
53
+ notificationSubscriber
54
+ ); */
49
55
  notificationAddedToCourse.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_ADDED_TO_COURSE}`, notificationSubscriber);
50
56
  return () => {
51
57
  pubsub_js_1.default.unsubscribe(notificationInvitedToJoinCourse.current);
52
- pubsub_js_1.default.unsubscribe(notificationRequestedToJoinCourse.current);
53
- pubsub_js_1.default.unsubscribe(notificationAcceptedToJoinCourse.current);
58
+ // PubSub.unsubscribe(notificationRequestedToJoinCourse.current);
59
+ // PubSub.unsubscribe(notificationAcceptedToJoinCourse.current);
54
60
  pubsub_js_1.default.unsubscribe(notificationAddedToCourse.current);
55
61
  };
56
62
  }, [data]);
@@ -60,6 +66,7 @@ function useSCJoinedCoursesManager(user) {
60
66
  * @param dataMsg
61
67
  */
62
68
  const notificationSubscriber = (msg, dataMsg) => {
69
+ var _a;
63
70
  if (dataMsg.data.course !== undefined) {
64
71
  let _status;
65
72
  switch (Notification_1.SCNotificationMapping[dataMsg.data.activity_type]) {
@@ -73,7 +80,12 @@ function useSCJoinedCoursesManager(user) {
73
80
  _status = SCCourseJoinStatusType.JOINED;
74
81
  break; */
75
82
  case types_1.SCNotificationTypologyType.USER_ADDED_TO_COURSE:
76
- _status = types_1.SCCourseJoinStatusType.JOINED;
83
+ if (dataMsg.data.notification_obj.course && ((_a = dataMsg.data.notification_obj.course.paywalls) === null || _a === void 0 ? void 0 : _a.length)) {
84
+ _status = types_1.SCCourseJoinStatusType.PAYMENT_WAITING;
85
+ }
86
+ else {
87
+ _status = types_1.SCCourseJoinStatusType.JOINED;
88
+ }
77
89
  break;
78
90
  }
79
91
  updateCache([dataMsg.data.course]);
@@ -37,21 +37,28 @@ function useSCSubscribedEventsManager(user) {
37
37
  Preferences_1.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
38
38
  preferences[Preferences_1.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
39
39
  const notificationInvitedToJoinEvent = (0, react_1.useRef)(null);
40
- const notificationRequestedToJoinEvent = (0, react_1.useRef)(null);
41
- const notificationAcceptedToJoinEvent = (0, react_1.useRef)(null);
40
+ // const notificationRequestedToJoinEvent = useRef(null);
41
+ // const notificationAcceptedToJoinEvent = useRef(null);
42
42
  const notificationAddedToEvent = (0, react_1.useRef)(null);
43
43
  /**
44
44
  * Subscribe to notification types user_follow, user_unfollow
45
45
  */
46
46
  (0, use_deep_compare_effect_1.useDeepCompareEffectNoCheck)(() => {
47
47
  notificationInvitedToJoinEvent.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_EVENT}`, notificationSubscriber);
48
- notificationRequestedToJoinEvent.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT}`, notificationSubscriber);
49
- notificationAcceptedToJoinEvent.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_EVENT}`, notificationSubscriber);
48
+ /* notificationRequestedToJoinEvent.current = PubSub.subscribe(
49
+ `${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT}`,
50
+ notificationSubscriber
51
+ );
52
+ notificationAcceptedToJoinEvent.current = PubSub.subscribe(
53
+ `${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_EVENT}`,
54
+ notificationSubscriber
55
+ );
56
+ */
50
57
  notificationAddedToEvent.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_ADDED_TO_EVENT}`, notificationSubscriber);
51
58
  return () => {
52
59
  pubsub_js_1.default.unsubscribe(notificationInvitedToJoinEvent.current);
53
- pubsub_js_1.default.unsubscribe(notificationRequestedToJoinEvent.current);
54
- pubsub_js_1.default.unsubscribe(notificationAcceptedToJoinEvent.current);
60
+ // PubSub.unsubscribe(notificationRequestedToJoinEvent.current);
61
+ // PubSub.unsubscribe(notificationAcceptedToJoinEvent.current);
55
62
  pubsub_js_1.default.unsubscribe(notificationAddedToEvent.current);
56
63
  };
57
64
  }, [data]);
@@ -37,21 +37,29 @@ function useSCSubscribedGroupsManager(user) {
37
37
  Preferences_1.CONFIGURATIONS_GROUPS_ENABLED in preferences &&
38
38
  preferences[Preferences_1.CONFIGURATIONS_GROUPS_ENABLED].value, [preferences, features]);
39
39
  const notificationInvitedToJoinGroup = (0, react_1.useRef)(null);
40
- const notificationRequestedToJoinGroup = (0, react_1.useRef)(null);
41
- const notificationAcceptedToJoinGroup = (0, react_1.useRef)(null);
40
+ // const notificationRequestedToJoinGroup = useRef(null);
41
+ // const notificationAcceptedToJoinGroup = useRef(null);
42
42
  const notificationAddedToGroup = (0, react_1.useRef)(null);
43
43
  /**
44
44
  * Subscribe to notification types user_follow, user_unfollow
45
45
  */
46
46
  (0, use_deep_compare_effect_1.useDeepCompareEffectNoCheck)(() => {
47
47
  notificationInvitedToJoinGroup.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_GROUP}`, notificationSubscriber);
48
- notificationRequestedToJoinGroup.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_GROUP}`, notificationSubscriber);
49
- notificationAcceptedToJoinGroup.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_GROUP}`, notificationSubscriber);
48
+ /*
49
+ notificationRequestedToJoinGroup.current = PubSub.subscribe(
50
+ `${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_GROUP}`,
51
+ notificationSubscriber
52
+ );
53
+ notificationAcceptedToJoinGroup.current = PubSub.subscribe(
54
+ `${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_GROUP}`,
55
+ notificationSubscriber
56
+ );
57
+ */
50
58
  notificationAddedToGroup.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_ADDED_TO_GROUP}`, notificationSubscriber);
51
59
  return () => {
52
60
  pubsub_js_1.default.unsubscribe(notificationInvitedToJoinGroup.current);
53
- pubsub_js_1.default.unsubscribe(notificationRequestedToJoinGroup.current);
54
- pubsub_js_1.default.unsubscribe(notificationAcceptedToJoinGroup.current);
61
+ // PubSub.unsubscribe(notificationRequestedToJoinGroup.current);
62
+ // PubSub.unsubscribe(notificationAcceptedToJoinGroup.current);
55
63
  pubsub_js_1.default.unsubscribe(notificationAddedToGroup.current);
56
64
  };
57
65
  }, [data]);
@@ -61,6 +69,7 @@ function useSCSubscribedGroupsManager(user) {
61
69
  * @param dataMsg
62
70
  */
63
71
  const notificationSubscriber = (msg, dataMsg) => {
72
+ var _a;
64
73
  if (dataMsg.data.group !== undefined) {
65
74
  let _status;
66
75
  switch (Notification_1.SCNotificationMapping[dataMsg.data.activity_type]) {
@@ -74,7 +83,12 @@ function useSCSubscribedGroupsManager(user) {
74
83
  _status = SCGroupSubscriptionStatusType.SUBSCRIBED;
75
84
  break; */
76
85
  case types_1.SCNotificationTypologyType.USER_ADDED_TO_GROUP:
77
- _status = types_1.SCGroupSubscriptionStatusType.SUBSCRIBED;
86
+ if (dataMsg.data.notification_obj.group && ((_a = dataMsg.data.notification_obj.group.paywalls) === null || _a === void 0 ? void 0 : _a.length)) {
87
+ _status = types_1.SCGroupSubscriptionStatusType.PAYMENT_WAITING;
88
+ }
89
+ else {
90
+ _status = types_1.SCGroupSubscriptionStatusType.SUBSCRIBED;
91
+ }
78
92
  break;
79
93
  }
80
94
  updateCache([dataMsg.data.group]);
@@ -33,21 +33,27 @@ export default function useSCJoinedCoursesManager(user) {
33
33
  CONFIGURATIONS_COURSES_ENABLED in preferences &&
34
34
  preferences[CONFIGURATIONS_COURSES_ENABLED].value, [preferences, features]);
35
35
  const notificationInvitedToJoinCourse = useRef(null);
36
- const notificationRequestedToJoinCourse = useRef(null);
37
- const notificationAcceptedToJoinCourse = useRef(null);
36
+ // const notificationRequestedToJoinCourse = useRef(null);
37
+ // const notificationAcceptedToJoinCourse = useRef(null);
38
38
  const notificationAddedToCourse = useRef(null);
39
39
  /**
40
40
  * Subscribe to notification types user_follow, user_unfollow
41
41
  */
42
42
  useDeepCompareEffectNoCheck(() => {
43
43
  notificationInvitedToJoinCourse.current = PubSub.subscribe(`${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_INVITED_TO_JOIN_COURSE}`, notificationSubscriber);
44
- notificationRequestedToJoinCourse.current = PubSub.subscribe(`${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_COURSE}`, notificationSubscriber);
45
- notificationAcceptedToJoinCourse.current = PubSub.subscribe(`${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_COURSE}`, notificationSubscriber);
44
+ /* notificationRequestedToJoinCourse.current = PubSub.subscribe(
45
+ `${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_COURSE}`,
46
+ notificationSubscriber
47
+ );
48
+ notificationAcceptedToJoinCourse.current = PubSub.subscribe(
49
+ `${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_COURSE}`,
50
+ notificationSubscriber
51
+ ); */
46
52
  notificationAddedToCourse.current = PubSub.subscribe(`${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_ADDED_TO_COURSE}`, notificationSubscriber);
47
53
  return () => {
48
54
  PubSub.unsubscribe(notificationInvitedToJoinCourse.current);
49
- PubSub.unsubscribe(notificationRequestedToJoinCourse.current);
50
- PubSub.unsubscribe(notificationAcceptedToJoinCourse.current);
55
+ // PubSub.unsubscribe(notificationRequestedToJoinCourse.current);
56
+ // PubSub.unsubscribe(notificationAcceptedToJoinCourse.current);
51
57
  PubSub.unsubscribe(notificationAddedToCourse.current);
52
58
  };
53
59
  }, [data]);
@@ -57,6 +63,7 @@ export default function useSCJoinedCoursesManager(user) {
57
63
  * @param dataMsg
58
64
  */
59
65
  const notificationSubscriber = (msg, dataMsg) => {
66
+ var _a;
60
67
  if (dataMsg.data.course !== undefined) {
61
68
  let _status;
62
69
  switch (SCNotificationMapping[dataMsg.data.activity_type]) {
@@ -70,7 +77,12 @@ export default function useSCJoinedCoursesManager(user) {
70
77
  _status = SCCourseJoinStatusType.JOINED;
71
78
  break; */
72
79
  case SCNotificationTypologyType.USER_ADDED_TO_COURSE:
73
- _status = SCCourseJoinStatusType.JOINED;
80
+ if (dataMsg.data.notification_obj.course && ((_a = dataMsg.data.notification_obj.course.paywalls) === null || _a === void 0 ? void 0 : _a.length)) {
81
+ _status = SCCourseJoinStatusType.PAYMENT_WAITING;
82
+ }
83
+ else {
84
+ _status = SCCourseJoinStatusType.JOINED;
85
+ }
74
86
  break;
75
87
  }
76
88
  updateCache([dataMsg.data.course]);
@@ -34,21 +34,28 @@ export default function useSCSubscribedEventsManager(user) {
34
34
  CONFIGURATIONS_EVENTS_ENABLED in preferences &&
35
35
  preferences[CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
36
36
  const notificationInvitedToJoinEvent = useRef(null);
37
- const notificationRequestedToJoinEvent = useRef(null);
38
- const notificationAcceptedToJoinEvent = useRef(null);
37
+ // const notificationRequestedToJoinEvent = useRef(null);
38
+ // const notificationAcceptedToJoinEvent = useRef(null);
39
39
  const notificationAddedToEvent = useRef(null);
40
40
  /**
41
41
  * Subscribe to notification types user_follow, user_unfollow
42
42
  */
43
43
  useDeepCompareEffectNoCheck(() => {
44
44
  notificationInvitedToJoinEvent.current = PubSub.subscribe(`${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_INVITED_TO_JOIN_EVENT}`, notificationSubscriber);
45
- notificationRequestedToJoinEvent.current = PubSub.subscribe(`${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT}`, notificationSubscriber);
46
- notificationAcceptedToJoinEvent.current = PubSub.subscribe(`${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_EVENT}`, notificationSubscriber);
45
+ /* notificationRequestedToJoinEvent.current = PubSub.subscribe(
46
+ `${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT}`,
47
+ notificationSubscriber
48
+ );
49
+ notificationAcceptedToJoinEvent.current = PubSub.subscribe(
50
+ `${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_EVENT}`,
51
+ notificationSubscriber
52
+ );
53
+ */
47
54
  notificationAddedToEvent.current = PubSub.subscribe(`${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_ADDED_TO_EVENT}`, notificationSubscriber);
48
55
  return () => {
49
56
  PubSub.unsubscribe(notificationInvitedToJoinEvent.current);
50
- PubSub.unsubscribe(notificationRequestedToJoinEvent.current);
51
- PubSub.unsubscribe(notificationAcceptedToJoinEvent.current);
57
+ // PubSub.unsubscribe(notificationRequestedToJoinEvent.current);
58
+ // PubSub.unsubscribe(notificationAcceptedToJoinEvent.current);
52
59
  PubSub.unsubscribe(notificationAddedToEvent.current);
53
60
  };
54
61
  }, [data]);
@@ -34,21 +34,29 @@ export default function useSCSubscribedGroupsManager(user) {
34
34
  CONFIGURATIONS_GROUPS_ENABLED in preferences &&
35
35
  preferences[CONFIGURATIONS_GROUPS_ENABLED].value, [preferences, features]);
36
36
  const notificationInvitedToJoinGroup = useRef(null);
37
- const notificationRequestedToJoinGroup = useRef(null);
38
- const notificationAcceptedToJoinGroup = useRef(null);
37
+ // const notificationRequestedToJoinGroup = useRef(null);
38
+ // const notificationAcceptedToJoinGroup = useRef(null);
39
39
  const notificationAddedToGroup = useRef(null);
40
40
  /**
41
41
  * Subscribe to notification types user_follow, user_unfollow
42
42
  */
43
43
  useDeepCompareEffectNoCheck(() => {
44
44
  notificationInvitedToJoinGroup.current = PubSub.subscribe(`${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_INVITED_TO_JOIN_GROUP}`, notificationSubscriber);
45
- notificationRequestedToJoinGroup.current = PubSub.subscribe(`${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_GROUP}`, notificationSubscriber);
46
- notificationAcceptedToJoinGroup.current = PubSub.subscribe(`${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_GROUP}`, notificationSubscriber);
45
+ /*
46
+ notificationRequestedToJoinGroup.current = PubSub.subscribe(
47
+ `${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_GROUP}`,
48
+ notificationSubscriber
49
+ );
50
+ notificationAcceptedToJoinGroup.current = PubSub.subscribe(
51
+ `${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_GROUP}`,
52
+ notificationSubscriber
53
+ );
54
+ */
47
55
  notificationAddedToGroup.current = PubSub.subscribe(`${SCNotificationTopicType.INTERACTION}.${SCNotificationTypologyType.USER_ADDED_TO_GROUP}`, notificationSubscriber);
48
56
  return () => {
49
57
  PubSub.unsubscribe(notificationInvitedToJoinGroup.current);
50
- PubSub.unsubscribe(notificationRequestedToJoinGroup.current);
51
- PubSub.unsubscribe(notificationAcceptedToJoinGroup.current);
58
+ // PubSub.unsubscribe(notificationRequestedToJoinGroup.current);
59
+ // PubSub.unsubscribe(notificationAcceptedToJoinGroup.current);
52
60
  PubSub.unsubscribe(notificationAddedToGroup.current);
53
61
  };
54
62
  }, [data]);
@@ -58,6 +66,7 @@ export default function useSCSubscribedGroupsManager(user) {
58
66
  * @param dataMsg
59
67
  */
60
68
  const notificationSubscriber = (msg, dataMsg) => {
69
+ var _a;
61
70
  if (dataMsg.data.group !== undefined) {
62
71
  let _status;
63
72
  switch (SCNotificationMapping[dataMsg.data.activity_type]) {
@@ -71,7 +80,12 @@ export default function useSCSubscribedGroupsManager(user) {
71
80
  _status = SCGroupSubscriptionStatusType.SUBSCRIBED;
72
81
  break; */
73
82
  case SCNotificationTypologyType.USER_ADDED_TO_GROUP:
74
- _status = SCGroupSubscriptionStatusType.SUBSCRIBED;
83
+ if (dataMsg.data.notification_obj.group && ((_a = dataMsg.data.notification_obj.group.paywalls) === null || _a === void 0 ? void 0 : _a.length)) {
84
+ _status = SCGroupSubscriptionStatusType.PAYMENT_WAITING;
85
+ }
86
+ else {
87
+ _status = SCGroupSubscriptionStatusType.SUBSCRIBED;
88
+ }
75
89
  break;
76
90
  }
77
91
  updateCache([dataMsg.data.group]);