refactor(events): Events are now tied to a common enum typings (#167)

* chore(scripts/twitter): Refactored twitter to use event enums

* chore(scripts/marketplace): Refactored marketplace to use event enums

* chore(scripts/messages): Refactored messages to use event enums

* chore(scripts/contacts): Refactored contacts to use event enums

* chore(scripts/calls): Refactored calls to use event enums

* chore(scripts/notes): Refactored notes to use event enums

* chore(scripts/photos): Refactored photos to use event enums

* chore(scripts/bank): Refactored bank to use event enums

* chore(scripts/phone): Refactored phone to use event enums

* chore(events): Removed old events object

* refactor(phone/nui-events): Attached NUI events to respective enum

* tweak(event-enums): Added npwd prefix to all events

* tweak(phone/serve): Added craco to override CRA without eject

Also bumped react-scripts to 4.0.1, with seemingly no issues

* fix(typings/twitter): Fixed method enums for twitter
This commit is contained in:
Taso authored and GitHub committed 2021-03-22 13:37:07 -04:00
1 parent 53d5bb459d
commit 0f61088999
62 files changed
+4734 -3470

No files matched your search

+11
View File
@@ -17,3 +17,14 @@ export interface ITransactions {
type: string;
amount: number;
}
export enum BankEvents {
ADD_TRANSFER = 'npwd:addTransfer',
ADD_TRANSFER_SUCCESS = 'npwd:addTransferSuccess',
FETCH_TRANSACTIONS = 'npwd:fetchAllTransactions',
SEND_TRANSFERS = 'npwd:sendTransfers',
TRANSACTION_ALERT = 'npwd:bankTransactionAlert',
TRANSACTION_NOTIFICATION = 'npwd:bankTransactionNotification',
SEND_CREDENTIALS = 'npwd:sendBankCredentials',
GET_CREDENTIALS = 'npwd:getBankCredentials',
}
+14
View File
@@ -24,3 +24,17 @@ export interface ICallDuration {
m: number;
h: number;
}
export enum CallEvents {
INITIALIZE_CALL = 'npwd:beginCall',
START_CALL = 'npwd:startCall',
ACCEPT_CALL = 'npwd:acceptCall',
END_CALL = 'npwd:endCall',
WAS_ENDED = 'npwd:callEnded',
WAS_ACCEPTED = 'npwd:callAccepted',
REJECTED = 'npwd:rejectCall',
WAS_REJECTED = 'npwd:callRejected',
FETCH_CALLS = 'npwd:fetchCalls',
SEND_HISTORY = 'npwd:sendCallHistory',
SEND_HANGUP_ANIM = 'npwd:sendHangupAnim',
}
+12
View File
@@ -17,3 +17,15 @@ export interface Contact {
number: string;
avatar?: string;
}
export enum ContactEvents {
SEND_CONTACTS = 'npwd:sendContacts',
GET_CONTACTS = 'npwd:getContacts',
ADD_CONTACT = 'npwd:addContacts',
ADD_CONTACT_SUCCESS = 'contacts:addSuccess',
UPDATE_CONTACT = 'npwd:updateContact',
DELETE_CONTACT = 'npwd:deleteContact',
DELETE_CONTACT_SUCCESS = 'npwd:deleteSuccess',
UPDATE_CONTACT_SUCCESS = 'npwd:updateContactSuccess',
ACTION_RESULT = 'npwd:contactActionResult',
}
+13
View File
@@ -8,3 +8,16 @@ export interface MarketplaceListing {
url: string;
description: string;
}
export enum MarketplaceEvents {
ADD_LISTING = 'npwd:addListing',
ADD_LISTING_SUCCESS = 'npwd:addListingSuccess',
FETCH_LISTING = 'npwd:fetchAllListings',
SEND_LISTING = 'npwd:sendAllListings',
ACTION_RESULT = 'npwd:selloutActionResult',
DELETE_LISTING = 'npwd:marketplaceDeleteListing',
DELETE_LISTING_SUCCESS = 'npwd:marketplaceDeleteListingSuccess',
REPORT_LISTING = 'npwd:reportListing',
REPORT_LISTING_SUCCESS = 'npwd:reportListingSuccess',
REPORT_LISTING_SUCESS = 'npwd:reportListingFailed',
}
+18
View File
@@ -41,3 +41,21 @@ export interface CreateMessageBroadcast {
export interface SetMessageRead {
groupId: string;
}
export enum MessageEvents {
FETCH_MESSAGE_GROUPS = 'npwd:fetchMessageGroups',
FETCH_MESSAGE_GROUPS_SUCCESS = 'npwd:fetchMessageGroupsSuccess',
FETCH_MESSAGE_GROUPS_FAILED = 'npwd:fetchMessageGroupsFailed',
CREATE_MESSAGE_GROUP = 'npwd:createMessageGroup',
CREATE_MESSAGE_GROUP_SUCCESS = 'npwd:createMessageGroupSuccess',
CREATE_MESSAGE_GROUP_FAILED = 'npwd:createMessageGroupFailed',
SEND_MESSAGE = 'npwd:sendMessage',
SEND_MESSAGE_SUCCESS = 'npwd:sendMessageSuccess',
SEND_MESSAGE_FAILED = 'npwd:sendMessageFailed',
FETCH_MESSAGES = 'npwd:fetchMessages',
FETCH_MESSAGES_SUCCESS = 'npwd:fetchMessagesSuccess',
FETCH_MESSAGES_FAILED = 'npwd:fetchMessagesFailed',
ACTION_RESULT = 'npwd:setMessagesAlert',
CREATE_MESSAGE_BROADCAST = 'createMessagesBroadcast',
SET_MESSAGE_READ = 'npwd:setReadMessages',
}
+13
View File
@@ -20,3 +20,16 @@ export interface Note {
export interface NoteId {
id: number;
}
export enum NotesEvents {
ADD_NOTE = 'npwd:addNote',
FETCH_ALL_NOTES = 'npwd:fetchAllNotes',
SEND_NOTE = 'npwd:sendNote',
SEND_NOTE_SUCCESS = 'npwd:sendNoteSuccess',
DELETE_NOTE = 'npwd:deleteNote',
DELETE_NOTE_SUCCESS = 'npwd:deleteNoteSuccess',
UPDATE_NOTE = 'npwd:updateNote',
UPDATE_NOTE_SUCCESS = 'npwd:updateNoteSuccess',
UPDATE_NOTE_FAILURE = 'npwd:updateNoteFailure',
ACTION_RESULT = 'npwd:notesActionResult',
}
+11
View File
@@ -0,0 +1,11 @@
export enum PhoneEvents {
PLAYER_IS_READY = 'npwd:playerIsReady',
OPEN_APP_CONTACTS = 'npwd:app:CONTACTS',
OPEN_APP_BANK = 'npwd:app:BANK',
OPEN_APP_NOTES = 'npwd:app:NOTES',
OPEN_APP_LISTINGS = 'npwd:app:SELLOUT',
OPEN_APP_CAMERA = 'npwd:app:CAMERA',
OPEN_APP_DAILER = 'npwd:app:DIALER',
OPEN_PHONE = 'npwd:open',
CLOSE_PHONE = 'npwd:close',
}
+10
View File
@@ -2,3 +2,13 @@ export interface IPhoto {
image: string;
id: number;
}
export enum PhotoEvents {
TAKE_PHOTO = 'npwd:TakePhoto',
UPLOAD_PHOTO = 'npwd:UploadPhoto',
UPLOAD_PHOTO_SUCCESS = 'npwd:UploadPhotoSuccess',
FETCH_PHOTOS = 'npwd:FetchPhotos',
SEND_PHOTOS = 'npwd:SendPhotos',
DELETE_PHOTO = 'npwd:deletePhoto',
DELETE_PHOTO_SUCCESS = 'npwd:deletePhotoSuccess',
}
+36
View File
@@ -46,3 +46,39 @@ export interface Profile {
createdAt: string;
updatedAt: string;
}
export enum TwitterEvents {
FETCH_TWEETS = 'npwd:fetchTweets',
FETCH_TWEETS_SUCCESS = 'fetchTweets',
FETCH_TWEETS_FAILURE = 'fetchTweetsFailed',
FETCH_TWEETS_FILTERED = 'npwd:fetchTweetsFiltered',
FETCH_TWEETS_FILTERED_SUCCESS = 'fetchTweetsFiltered',
FETCH_TWEETS_FILTERED_FAILURE = 'fetchTweetsFilteredFailed',
CREATE_PROFILE = 'npwd:createTwitterProfile',
CREATE_PROFILE_RESULT = 'npwd:createProfileResult',
GET_OR_CREATE_PROFILE = 'npwd:getOrCreateTwitterProfile',
GET_OR_CREATE_PROFILE_NULL = 'getOrCreateTwitterProfileNull',
GET_OR_CREATE_PROFILE_SUCCESS = 'getOrCreateTwitterProfile',
GET_OR_CREATE_PROFILE_FAILURE = 'getOrCreateTwitterProfileFailed',
UPDATE_PROFILE = 'npwd:updateTwitterProfile',
UPDATE_PROFILE_LOADING = 'updateProfileLoading',
UPDATE_PROFILE_RESULT = 'updateProfileResult',
CREATE_TWEET = 'npwd:createTweet',
CREATE_TWEET_LOADING = 'createTweetLoading',
CREATE_TWEET_RESULT = 'createTweetResult',
CREATE_TWEET_BROADCAST = 'createTweetBroadcast',
CREATE_TWEET_FAILURE = 'createTweetResultFailed',
DELETE_TWEET = 'npwd:deleteTweet',
DELETE_TWEET_SUCCESS = 'deleteTweetSuccess',
DELETE_TWEET_FAILURE = 'deleteTweetFailed',
TOGGLE_LIKE = 'npwd:toggleLike',
TOGGLE_LIKE_SUCCESS = 'toggleLikeSuccess',
TOGGLE_LIKE_FAILURE = 'toggleLikeFailed',
RETWEET = 'npwd:retweet',
RETWEET_SUCCESS = 'npwd:retweetSuccess',
RETWEET_EXISTS = 'npwd:retweetExists',
RETWEET_FAILURE = 'npwd:retweetFailed',
REPORT = 'npwd:reportTweet',
REPORT_SUCCESS = 'reportTweetSuccess',
REPORT_FAILURE = 'reportTweetFailed',
}