Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.model("StateStore", {
sales_state: types.optional(types.array(Sales), []),
listing_state: types.optional(types.array(Listing), []),
login_state: types.optional(types.array(Login), []),
payment_state: types.optional(types.array(Payment), []),
settings_state: types.optional(types.array(Settings), []),
// Value from payment state
payment_value: types.optional(types.string, "0"),
amount_due: types.optional(types.string, "0.00"),
// SalesListing
orders: types.optional(types.frozen, []),
orderId: types.optional(types.number, -1),
currentTable: types.optional(types.number, -1),
isViewingOrder: types.optional(types.boolean, false),
isLoadingOrder: types.optional(types.boolean, false),
currentConfirmation: types.optional(types.string, ""),
index_value: types.optional(types.number, 0),
discount_string: types.optional(types.string, "{}"),
receipt_summary: types.optional(types.string, "{}"),
scanned_nfc: types.optional(types.string, "{}"),
payment_types: types.optional(types.string, "[]"),
payment_amount: types.optional(types.string, "0"),
balance: types.optional(types.string, "0"),
// Settings
queueHost: types.optional(types.string, ""),
hasTailOrder: types.optional(types.boolean, false),
isEditingQueue: types.optional(types.boolean, false),
useDescription: types.optional(types.boolean, false),
isHttps: types.optional(types.boolean, false),
isCurrencyDisabled: types.optional(types.boolean, false),
const Suggestion = t.model('Suggestion', {
title: t.string,
desc: t.maybeNull(t.string),
raw: t.string,
id: t.maybeNull(t.string),
logo: t.maybeNull(t.string),
cmd: t.maybeNull(t.enumeration('cmd', ['theme', 'debug'])),
descType: t.optional(
t.enumeration('descType', ['text', 'component']),
'text'
),
})
const DoraemonStore = t
.model('DoraemonStore', {
visible: t.optional(t.boolean, false),
searching: t.optional(t.boolean, false),
showAlert: t.optional(t.boolean, false),
showUtils: t.optional(t.boolean, false),
showThreadSelector: t.optional(t.boolean, false),
searchedTotalCount: t.optional(t.number, 0),
searchThread: t.optional(
t.enumeration('searchThread', [...R.values(THREAD), 'community']),
'community'
),
inputValue: t.optional(t.string, ''),
suggestions: t.optional(t.array(Suggestion), []),
activeRaw: t.maybeNull(t.string),
// TODO: prefix -> cmdPrefix, and prefix be a getter
prefix: t.optional(t.string, ''),
by: types.maybe(types.string),
descendants: types.optional(types.number, 0),
kids: types.optional(types.array(types.number), []),
score: types.maybe(types.number),
time: types.number,
title: types.maybe(types.string),
text: types.maybe(types.string),
url: types.maybe(types.string),
parent: types.maybe(types.string),
// App specific fields
metadata: types.maybe(Metadata),
belongsTo: types.optional(types.array(types.string), []),
comments: types.optional(types.array(types.late(() => ItemReference)), []),
offset: types.optional(types.number, 0),
isPending: types.optional(types.boolean, false),
isError: types.optional(types.boolean, false),
})
.views(self => ({
get date() {
return new Date(self.time * 1000);
},
get level() {
return self.belongsTo.length;
},
get hackernewsUrl() {
return `https://news.ycombinator.com/item?id=${self.id}`;
},
get isOwn() {
/* #endregion */
/* #region type-def */
/**
* LaunchConnection
*
* Simple wrapper around our list of launches that contains a cursor to the last item in the list. Pass this cursor to the launches query to fetch results after these.
*/
export const LaunchConnection = MSTGQLObject
.named('LaunchConnection')
.props({
__typename: types.optional(types.literal("LaunchConnection"), "LaunchConnection"),
cursor: types.string,
hasMore: types.boolean,
launches: types.array(MSTGQLRef(types.late(() => Launch))),
})
.views(self => ({
get store() {
return self.__getStore()
}
})) /* #endregion */
.volatile(self => ({
isFetchingMore: false
}))
.actions(self => ({
fetchMore() {
self.isFetchingMore = true
const query = self.store.fetchLaunches(self.cursor)
query.then(lc => self.doneFetchingMore(lc))
return query
/*
* Labeler store
*
*/
import { types as t, getParent } from 'mobx-state-tree'
import R from 'ramda'
import { markStates, buildLog, stripMobx } from '@utils'
import { Tag } from '@model'
/* eslint-disable-next-line */
const log = buildLog('S:Labeler')
const RealLabel = t.model('RealLabel', {
uniqId: t.string,
popVisible: t.optional(t.boolean, false),
tags: t.optional(t.array(Tag), []),
label: t.optional(
t.enumeration([
'default',
'salary',
'city',
'exp',
'education',
'finance',
'scale',
'field',
]),
'default'
),
multi: t.optional(t.boolean, false),
selected: t.optional(t.array(t.string), []),
poster: t.maybeNull(t.string),
author: t.maybeNull(User),
source: t.maybeNull(t.string),
link: t.maybeNull(t.string),
originalAuthor: t.maybeNull(t.string),
originalAuthorLink: t.maybeNull(t.string),
views: t.optional(t.number, 0),
communities: t.optional(t.array(Community), []),
tags: t.optional(t.array(Tag), []),
/* comments: t.optional(t.array(Comment), []), */
favoritedCount: t.optional(t.number, 0),
starredCount: t.optional(t.number, 0),
viewerHasFavorited: t.optional(t.boolean, false),
viewerHasStarred: t.optional(t.boolean, false),
favoritedCategoryId: t.maybeNull(t.string),
commentsCount: t.optional(t.number, 0),
pagedCommentsParticipators: t.optional(PagedUsers, {}),
publishAt: t.maybeNull(t.string),
viewerHasViewed: t.optional(t.boolean, false),
insertedAt: t.optional(t.string, ''),
updatedAt: t.optional(t.string, ''),
})
export const PagedVideos = t.model('PagedVideos', {
entries: t.optional(t.array(Video), []),
import { types } from 'mobx-state-tree';
const Git = types.model({
branch: types.string,
commitSha: types.string,
path: types.maybeNull(types.string),
repo: types.string,
username: types.string,
});
export default {
repoTitle: types.string,
error: types.maybeNull(types.string),
isExported: types.boolean,
showExportedModal: types.boolean,
isFetching: types.boolean,
subject: types.string,
description: types.string,
originalGitChanges: types.maybeNull(
types.model({
added: types.array(types.string),
deleted: types.array(types.string),
modified: types.array(types.string),
rights: types.string,
})
),
commit: types.maybeNull(
types.model({
git: Git,
merge: types.maybeNull(types.boolean),
newBranch: types.maybeNull(types.string),
readme: t.maybeNull(t.string),
issuesCount: t.optional(t.number, 0),
prsCount: t.optional(t.number, 0),
starCount: t.optional(t.number, 0),
forkCount: t.optional(t.number, 0),
watchCount: t.optional(t.number, 0),
primaryLanguage: t.optional(Language, { name: '', color: 'grey' }),
license: t.maybeNull(t.string),
releaseTag: t.maybeNull(t.string),
contributors: t.array(Contributor),
author: t.maybeNull(User),
views: t.optional(t.number, 0),
pin: t.maybeNull(t.boolean),
favoritedCount: t.optional(t.number, 0),
viewerHasFavorited: t.optional(t.boolean, false),
favoritedCategoryId: t.maybeNull(t.string),
communities: t.optional(t.array(Community), []),
origialCommunity: t.optional(Community, {}),
tags: t.optional(t.array(Tag), []),
lastSync: t.maybeNull(t.string),
pagedCommentsParticipators: t.optional(PagedUsers, {}),
viewerHasViewed: t.optional(t.boolean, false),
insertedAt: t.optional(t.string, ''),
updatedAt: t.optional(t.string, ''),
floor: t.maybeNull(t.number),
author: t.optional(User, {}),
})
const CommentBase = {
id: t.maybeNull(t.string),
body: t.maybeNull(t.string),
author: t.optional(User, {}),
floor: t.number,
replyTo: t.maybeNull(CommentBrief),
replies: t.optional(t.array(CommentBrief), []),
repliesCount: t.optional(t.number, 0),
likesCount: t.optional(t.number, 0),
dislikesCount: t.optional(t.number, 0),
viewerHasLiked: t.maybeNull(t.boolean),
viewerHasDisliked: t.maybeNull(t.boolean),
insertedAt: t.optional(t.string, ''),
updatedAt: t.optional(t.string, ''),
}
export const Comment = t.model('Comment', {
...CommentBase,
})
export const PagedComments = t.model('PagedComments', {
entries: t.optional(t.array(Comment), []),
pageNumber: t.optional(t.number, 1),
pageSize: t.optional(t.number, PAGE_SIZE.D),
totalCount: t.optional(t.number, 0),
totalPages: t.optional(t.number, 0),
})
export const ModelListing = {
itemStatus: types.optional(types.string, "idle"),
categoryStatus: types.optional(types.string, "idle"),
discountStatus: types.optional(types.string, "idle"),
tabStatus: types.optional(types.number, 0),
itemMaintenanceStatus: types.optional(types.boolean, false),
taxObjects: types.optional(types.string, "[]"),
printerStatus: types.optional(types.string, "Offline"),
};
export const ModelLogin = {
loginStatus: types.optional(types.string, "idle"),
verificationVisible: types.optional(types.boolean, false),
pin: types.optional(types.string, ""),
confirmPin: types.optional(types.string, ""),
securityPinStatus: types.optional(types.boolean, true),
securityConfirmPinStatus: types.optional(types.boolean, true),
userName: types.optional(types.string, ""),
};
export const ModelPayment = {
selected: types.optional(types.string, "Cash"),
value: types.optional(types.string, "0"),
amountDue: types.optional(types.string, "0.00"),
amountChange: types.optional(types.string, "0.00"),
itemSelected: types.optional(types.string, "key0"),
connection: types.optional(types.boolean, false),
connectionStatus: types.optional(types.string, "Offline"),
modalVisible: types.optional(types.boolean, false),
customerName: types.optional(types.string, ""),
customerEmail: types.optional(types.string, ""),
customerPhoneNumber: types.optional(types.string, ""),