@jsb188/app 1.1.1 → 1.1.2

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.
Files changed (110) hide show
  1. package/package.json +57 -42
  2. package/src/constants/agent.ts +74 -0
  3. package/src/constants/app.ts +389 -0
  4. package/src/constants/emoji.ts +9153 -0
  5. package/src/constants/other.ts +13 -0
  6. package/src/constants/user.ts +27 -0
  7. package/src/constants/wsActions.ts +49 -0
  8. package/src/i18n/account.ts +139 -0
  9. package/src/i18n/agent.ts +397 -0
  10. package/src/i18n/agentToolBusiness.ts +196 -0
  11. package/src/i18n/agentToolGrid.ts +137 -0
  12. package/src/i18n/agentToolWorkflow.ts +101 -0
  13. package/src/i18n/agent_note.ts +109 -0
  14. package/src/i18n/app.ts +124 -0
  15. package/src/i18n/auth.ts +128 -0
  16. package/src/i18n/billing.ts +7 -0
  17. package/src/i18n/c.ts +907 -0
  18. package/src/i18n/campaign.ts +919 -0
  19. package/src/i18n/country.ts +249 -0
  20. package/src/i18n/datetime.ts +66 -0
  21. package/src/i18n/editor.ts +58 -0
  22. package/src/i18n/error.ts +579 -0
  23. package/src/i18n/field_doc_editor.ts +21 -0
  24. package/src/i18n/field_doc_programs.ts +52 -0
  25. package/src/i18n/field_docs.ts +190 -0
  26. package/src/i18n/index.ts +64 -0
  27. package/src/i18n/log.ts +566 -0
  28. package/src/i18n/memory.ts +59 -0
  29. package/src/i18n/message.ts +13 -0
  30. package/src/i18n/note.ts +19 -0
  31. package/src/i18n/org.ts +306 -0
  32. package/src/i18n/schedule.ts +209 -0
  33. package/src/i18n/sheet.ts +339 -0
  34. package/src/i18n/sheet_formula.ts +165 -0
  35. package/src/i18n/workflow.ts +111 -0
  36. package/src/main.ts +89 -0
  37. package/src/platform.ts +166 -0
  38. package/src/types/ai.d.ts +63 -0
  39. package/src/types/app.d.ts +127 -0
  40. package/src/types/auth.d.ts +94 -0
  41. package/src/types/console.d.ts +3 -0
  42. package/src/types/node-polyglot.d.ts +23 -0
  43. package/src/types/other.d.ts +66 -0
  44. package/src/types.d.ts +29 -0
  45. package/src/utils/account.ts +97 -0
  46. package/src/utils/api.ts +358 -0
  47. package/src/utils/authSession.ts +24 -0
  48. package/src/utils/clientIP.ts +213 -0
  49. package/src/utils/color.ts +279 -0
  50. package/src/utils/cron.ts +310 -0
  51. package/src/utils/csv.ts +19 -0
  52. package/src/utils/datetime.ts +1394 -0
  53. package/src/utils/deferredSave.ts +89 -0
  54. package/src/utils/email.ts +39 -0
  55. package/src/utils/emoji.ts +174 -0
  56. package/src/utils/expression.helpers.ts +470 -0
  57. package/src/utils/expression.test.ts +793 -0
  58. package/src/utils/expression.ts +2261 -0
  59. package/src/utils/interval.ts +80 -0
  60. package/src/utils/language.ts +9 -0
  61. package/src/utils/logic.ts +299 -0
  62. package/src/utils/managedSession.ts +34 -0
  63. package/src/utils/managedSessionBff.test.ts +60 -0
  64. package/src/utils/managedSessionBff.ts +117 -0
  65. package/src/utils/number.ts +338 -0
  66. package/src/utils/object.ts +916 -0
  67. package/src/utils/promise.ts +98 -0
  68. package/src/utils/queryReset.ts +266 -0
  69. package/src/utils/recurringTask.ts +60 -0
  70. package/src/utils/schema.ts +293 -0
  71. package/src/utils/string.test.ts +278 -0
  72. package/src/utils/string.ts +709 -0
  73. package/{utils → src/utils}/timeZone.ts +531 -852
  74. package/src/utils/url_client.ts +206 -0
  75. package/tsconfig.json +12 -0
  76. package/constants/app.ts +0 -47
  77. package/constants/billing.ts +0 -146
  78. package/constants/emoji.ts +0 -8945
  79. package/constants/journal.ts +0 -74
  80. package/constants/user.ts +0 -36
  81. package/constants/ws.ts +0 -47
  82. package/i18n/app.ts +0 -101
  83. package/i18n/auth.ts +0 -63
  84. package/i18n/billing.ts +0 -94
  85. package/i18n/datetime.ts +0 -21
  86. package/i18n/error.ts +0 -143
  87. package/i18n/form.ts +0 -74
  88. package/i18n/index.ts +0 -5
  89. package/i18n/user.ts +0 -101
  90. package/main.ts +0 -94
  91. package/platform.ts +0 -125
  92. package/types/ai.d.ts +0 -30
  93. package/types/app.d.ts +0 -48
  94. package/types/auth.d.ts +0 -63
  95. package/types/form.d.ts +0 -56
  96. package/types/journal.d.ts +0 -24
  97. package/types/organization.d.ts +0 -38
  98. package/types/user.d.ts +0 -52
  99. package/types.d.ts +0 -31
  100. package/utils/api.ts +0 -99
  101. package/utils/billing.ts +0 -134
  102. package/utils/datetime.ts +0 -542
  103. package/utils/emoji.ts +0 -151
  104. package/utils/journal.ts +0 -17
  105. package/utils/logic.ts +0 -118
  106. package/utils/number.ts +0 -139
  107. package/utils/object.ts +0 -425
  108. package/utils/string.ts +0 -323
  109. package/utils/url_client.ts +0 -138
  110. package/utils/user.ts +0 -273
package/src/main.ts ADDED
@@ -0,0 +1,89 @@
1
+ /// <reference path="./types/console.d.ts" />
2
+
3
+ import i18n, { i18nTranslations } from './i18n/index.ts';
4
+
5
+ // Get the correct type for ENV
6
+ const ENV = new Map<string, string | boolean | number>();
7
+
8
+ /**
9
+ * Extend i18n with app specific texts
10
+ */
11
+
12
+ export function configI18n(texts?: Record<string, any>) {
13
+ // Locale support for later
14
+ const locale = 'en';
15
+
16
+ const extendedObj: Record<string, any> = {};
17
+
18
+ for (const key in i18nTranslations) {
19
+ extendedObj[key] = i18nTranslations[key][locale];
20
+ }
21
+
22
+ if (texts) {
23
+ for (const key in texts) {
24
+ const obj = texts[key][locale];
25
+
26
+ if (extendedObj[key]) {
27
+ extendedObj[key] = {
28
+ ...extendedObj[key],
29
+ ...obj,
30
+ };
31
+ } else {
32
+ extendedObj[key] = obj;
33
+ }
34
+ }
35
+ }
36
+
37
+ i18n.extend(extendedObj);
38
+ }
39
+
40
+ /**
41
+ * Register environment variables so the package may use it
42
+ */
43
+
44
+ export function registerENV(env: Record<string, string | boolean | number>) {
45
+ // Do not use process.env; because this package is used in client + server
46
+
47
+ for (const key in env) {
48
+ if (
49
+ typeof key !== 'undefined' &&
50
+ Object.prototype.hasOwnProperty.call(env, key)
51
+ ) {
52
+ ENV.set(key, env[key]);
53
+ }
54
+ }
55
+
56
+ // Shim some development commands
57
+ console.dev = (str: string, ...args: any[]) => {
58
+ if (ENV.get('NODE_ENV') === 'development') {
59
+ const [preset, ...otherArgs] = args;
60
+
61
+ let style;
62
+ switch (preset) {
63
+ case 'em':
64
+ style = 'background: #FFF380;';
65
+ break;
66
+ case 'warning':
67
+ style = 'background: #E64545; color: #FFF;';
68
+ break;
69
+ default:
70
+ }
71
+
72
+ console.log(
73
+ `%c${str}`,
74
+ `${style || 'background: #F2F0DA;'} padding: 3px 5px;`,
75
+ ...(style ? otherArgs : args),
76
+ );
77
+ }
78
+ };
79
+ }
80
+
81
+ /**
82
+ * Get environment variables
83
+ */
84
+
85
+ export function getENVVariable(
86
+ namespace: string,
87
+ ): string | boolean | number | undefined {
88
+ return ENV.get(namespace);
89
+ }
@@ -0,0 +1,166 @@
1
+ import { STORAGE_KEYS } from './constants/app.ts';
2
+
3
+ interface PlatformOptions {
4
+ defaultTheme: string;
5
+ clearAppCache?: () => void;
6
+ }
7
+
8
+ let platformOptions: PlatformOptions = { defaultTheme: '' };
9
+
10
+ /*
11
+ * Configure app-owned theme and cache behavior without replacing browser defaults.
12
+ */
13
+ export function configurePlatform(options: PlatformOptions): void {
14
+ platformOptions = { ...options };
15
+ }
16
+
17
+ /*
18
+ * Read the system dark-mode preference when the runtime supports it.
19
+ */
20
+ export function isSystemDarkMode(): boolean {
21
+ return !!globalThis.matchMedia?.('(prefers-color-scheme: dark)').matches;
22
+ }
23
+
24
+ /**
25
+ * Get current platform
26
+ */
27
+
28
+ export function getPlatform(): 'WEB' | 'MOBILE' | 'UNKNOWN' {
29
+ return 'WEB';
30
+ }
31
+
32
+ /**
33
+ * Fetch last used login token
34
+ */
35
+
36
+ export function fetchAuthToken(cb: (token: string | null) => void): void {
37
+ if (typeof document !== 'undefined') {
38
+ const authToken: string =
39
+ localStorage.getItem(STORAGE_KEYS.AUTH_TOKEN) ?? '';
40
+ cb(authToken);
41
+ } else {
42
+ cb(null);
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Delete auth token
48
+ */
49
+
50
+ export function deleteAuthToken(): void {
51
+ if (typeof document !== 'undefined') {
52
+ localStorage.removeItem(STORAGE_KEYS.AUTH_TOKEN);
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Save token after login
58
+ */
59
+
60
+ export function saveAuthTokenToPlatform(_token: string, cb: () => void) {
61
+ // In Web, there is nothing saved to local storage because we use SSR
62
+ cb();
63
+ }
64
+
65
+ /**
66
+ * Clear app-owned caches using the callback configured at startup.
67
+ */
68
+
69
+ export function clearAppCache() {
70
+ platformOptions.clearAppCache?.();
71
+ }
72
+
73
+ /**
74
+ * Fetch last used light mode setting
75
+ */
76
+
77
+ export function fetchLightModeSetting(
78
+ accountId: number | null,
79
+ cb: (lightMode: string) => void,
80
+ ): void {
81
+ if (typeof document === 'undefined') {
82
+ cb('');
83
+ return;
84
+ }
85
+
86
+ const key = `${STORAGE_KEYS.LIGHT_MODE}${accountId || 'guest'}`;
87
+ const lightModeSetting = localStorage.getItem(key) || '';
88
+ cb(lightModeSetting);
89
+ }
90
+
91
+ /**
92
+ * Get correct platform
93
+ */
94
+
95
+ export function getOS() {
96
+ const isApple = /(Mac|iPhone|iPod|iPad)/i.test(
97
+ globalThis.navigator?.platform || '',
98
+ );
99
+ return isApple ? 'mac_os' : 'windows';
100
+ }
101
+
102
+ /**
103
+ * Update theme
104
+ */
105
+
106
+ export function updateAppTheme(lightMode: string, theme: string) {
107
+ if (typeof document === 'undefined') {
108
+ return;
109
+ }
110
+
111
+ const lightModeVal =
112
+ lightMode === 'SYSTEM'
113
+ ? isSystemDarkMode()
114
+ ? 'dark'
115
+ : 'light'
116
+ : lightMode === 'DARK'
117
+ ? 'dark'
118
+ : 'light';
119
+
120
+ const fullThemeName = `${theme || platformOptions.defaultTheme}_${lightModeVal}`;
121
+
122
+ document.body.setAttribute('data-mode', lightModeVal);
123
+ document.body.setAttribute('data-theme', fullThemeName);
124
+ }
125
+
126
+ /**
127
+ * Get the last version of app
128
+ */
129
+
130
+ export function getLocalLastVersion(accountId: string) {
131
+ if (typeof document === 'undefined') {
132
+ return '';
133
+ }
134
+
135
+ const lastVersion: string =
136
+ localStorage.getItem(STORAGE_KEYS.LAST_VERSION + accountId) ?? '';
137
+ return lastVersion;
138
+ }
139
+
140
+ /**
141
+ * Save the last version of app
142
+ */
143
+
144
+ export function saveLocalLastVersion(accountId: string, version: string) {
145
+ if (typeof document === 'undefined') {
146
+ return;
147
+ }
148
+
149
+ localStorage.setItem(STORAGE_KEYS.LAST_VERSION + accountId, version);
150
+ }
151
+
152
+ /**
153
+ * Get the necessary Object data for file input
154
+ */
155
+
156
+ export function getFileInputObject(fileInput: File) {
157
+ return fileInput;
158
+ }
159
+
160
+ /**
161
+ * Get buffer data from file
162
+ */
163
+
164
+ export function getBufferDataFromFile<T>(file: T) {
165
+ return file;
166
+ }
@@ -0,0 +1,63 @@
1
+ // AI chat types
2
+
3
+ export type AIChatType = 'ORCHESTRATOR';
4
+
5
+ export type AIChatMessageType =
6
+ | 'MESSAGE'
7
+ | 'SMS'
8
+ | 'IMAGE'
9
+ | 'FILE'
10
+ | 'SMS_IMAGE'
11
+ | 'SMS_FILE'
12
+ | 'TRANSCRIBED_MESSAGE'
13
+ | 'FUNCTION_CALL'
14
+ | 'FUNCTION_CALL_OUTPUT';
15
+
16
+ // AI events
17
+
18
+ export type AIEventErrorName =
19
+ | 'AI_EVENT_UNKNOWN_ERR'
20
+ | 'AI_EVENT_DEVELOPER_ERR'
21
+ | 'AI_EVENT_NO_ACCESS'
22
+ | 'AI_COULD_NOT_RESOLVE'
23
+ | 'AI_CONTEXT_ERR'
24
+ | 'AI_CONTEXT_MANAGEMENT_ERR'
25
+ | 'AI_TOOL_EXECUTION_ERR'
26
+ | 'AI_ORG_ACL_FAILED'
27
+ | 'SETUP_INCOMPLETE_ORG'
28
+ | 'MISSING_API_KEY'
29
+ | 'LLM_PROVIDER_NOT_FOUND'
30
+ | 'LLM_SERVICE_ERR'
31
+ | 'MODERATION_MISSING'
32
+ | 'MODERATION_SERVICE_ERR'
33
+ | 'UNKNOWN_LLM_ERR'
34
+ | 'TWILIO_API_ERR'
35
+ | 'UNFINISHED_LOGIC';
36
+
37
+ // AI chat
38
+
39
+ export interface AIChatData {
40
+ activityOrder?: string;
41
+ id: string;
42
+ type: AIChatType | null;
43
+ organizationId: string | null;
44
+ agentNoteId?: string | null;
45
+ calDate: string | null;
46
+ summary: string;
47
+ userManagedSummary: boolean;
48
+ archivedAt: string | null;
49
+ createdAt: string;
50
+ updatedAt: string;
51
+ }
52
+
53
+ // Public execution metadata shared by GraphQL responses and CHAT_RUN_UPDATE SSE events.
54
+ export interface AIChatRunData {
55
+ id: string;
56
+ sourceMessageIds: string[];
57
+ status: 'QUEUED' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'CANCELLED' | 'DELIVERY_UNKNOWN';
58
+ inProgress: boolean;
59
+ createdAt: string | null;
60
+ claimedAt: string | null;
61
+ finishedAt: string | null;
62
+ updatedAt: string | null;
63
+ }
@@ -0,0 +1,127 @@
1
+ import { COLORS } from '../constants/app.ts';
2
+ import type { QueryResetTarget } from '../utils/queryReset.ts';
3
+
4
+ // Modal; App settings
5
+
6
+ export interface EditIfaceModalProps {
7
+ containerClassName: string;
8
+ saveCounter: number;
9
+ saving: boolean;
10
+ hasChanges: boolean;
11
+ openModalPopUp: (opts: any) => void;
12
+ onChangeDiff: (diff: boolean) => void;
13
+ }
14
+
15
+ export interface EditUserModalProps extends EditIfaceModalProps {
16
+ user: any;
17
+ editUser: (obj: object) => void;
18
+ }
19
+
20
+ // App types
21
+
22
+ export type DarkOrLightEnum = 'light' | 'dark';
23
+
24
+ export type ColorEnum = (typeof COLORS)[number];
25
+
26
+ // Server/API related types
27
+
28
+ export interface ServerErrorObj {
29
+ statusCode: number;
30
+ errorCode: string;
31
+ errorValue?: string;
32
+ iconName?: string;
33
+ title: string;
34
+ message: string;
35
+ }
36
+
37
+ export interface SimpleErrorType {
38
+ iconName?: string;
39
+ title?: string;
40
+ message: string;
41
+ }
42
+
43
+ // Web Socket events
44
+
45
+ export type ResetQueryRuleEnum =
46
+ | 'ALWAYS'
47
+ | 'IF_FRAGMENT_NOT_FOUND'
48
+ | 'IF_FRAGMENT_NOT_IN_QUERY'
49
+ | 'IF_FRAGMENT_FOUND'
50
+ | 'NEVER'
51
+ | 'RESET_ONLY';
52
+ export type AppendRuleEnum = 'APPEND_NEW' | 'APPEND_AT_END' | 'APPEND_AT_FRONT';
53
+
54
+ export type ReactiveMessageKindEnum = 'DATA_TABLE' | 'FIELD_DOC' | 'LOG' | 'ORGANIZATION' | 'SHEET';
55
+
56
+ export interface ReactiveMessageObj {
57
+ kind: ReactiveMessageKindEnum;
58
+ identifier?: string;
59
+ label?: string;
60
+ text: string;
61
+ }
62
+
63
+ /* Explicit single-record reads supported by oversized fragment recovery. */
64
+ export interface WSFragmentRecoveryTarget {
65
+ kind: 'AGENT_NOTE' | 'LOG_ENTRY';
66
+ organizationId: string;
67
+ }
68
+
69
+ export interface WSDataUpdateObj {
70
+ id: string;
71
+ aiChatSubmission?: AIChatSubmissionWSObj;
72
+ orchestratorArtifact?: OrchestratorArtifactWSObj; // Sheet, tab, table, form or workflow the orchestrator just changed
73
+ messages?: ReactiveMessageObj[];
74
+ resetQueries?: QueryResetTarget[]; // Structured query reset targets
75
+ resetQueryRule?: ResetQueryRuleEnum; // Defaults to "IF_FRAGMENT_FOUND"
76
+ reactiveFragmentKeys?: string[]; // Fragment keys that are used to trigger reactivity
77
+ authorizationContextChanged?: boolean; // Private memory/disk cache must be discarded and auth reloaded
78
+ fragments?:
79
+ | null
80
+ | ({
81
+ name: string;
82
+ dataId: string;
83
+ sequence?: string;
84
+ sequenceKey?: string;
85
+ recovery?: WSFragmentRecoveryTarget; // Fetch this record before applying; data is only an identity placeholder.
86
+ replaceId?: string; // Use this where client has a temporary ID that will be replaced by the server-side ID later
87
+ appendRule?: AppendRuleEnum | null;
88
+ data: any;
89
+ } | null)[];
90
+ }
91
+
92
+ export interface AIChatSubmissionWSObj {
93
+ aiChatId: string;
94
+ clientRequestId: string;
95
+ phase: 'RECEIVED';
96
+ }
97
+
98
+ export type OrchestratorArtifactKind = 'SHEET' | 'SHEET_TAB' | 'DATA_TABLE' | 'FIELD_DOC' | 'WORKFLOW';
99
+ export type OrchestratorArtifactAction = 'CREATED' | 'UPDATED' | 'DELETED';
100
+
101
+ /* One sheet, tab, table, form or workflow a Orchestrator tool call committed, sent to the account's watching tabs */
102
+ export interface OrchestratorArtifactWSObj {
103
+ aiChatId: string; // Serialized generic id
104
+ runId: string; // Durable ai_chat_runs id
105
+ callId: string; // Tool call id; the client's idempotency key
106
+ organizationId: string | null; // Serialized controller organization at tool time
107
+ toolName: string;
108
+ kind: OrchestratorArtifactKind;
109
+ action: OrchestratorArtifactAction;
110
+ sheetId?: string | null; // Serialized; SHEET and SHEET_TAB
111
+ sheetTabId?: string | null; // Serialized; SHEET_TAB, and SHEET when one tab is known (e.g. the first tab on create)
112
+ dataTableId?: string | null; // Serialized; DATA_TABLE
113
+ fieldDocId?: string | null; // Serialized; FIELD_DOC
114
+ fieldDocProgramId?: string | null; // Serialized; FIELD_DOC, the program whose page lists the form's documents
115
+ hasDraft?: boolean | null; // FIELD_DOC: whether the form currently has unpublished changes
116
+ draftStateAt?: string | null; // FIELD_DOC: when the server observed hasDraft, independent of the historical tool call time
117
+ workflowId?: string | null; // Serialized; WORKFLOW
118
+ active?: boolean | null; // WORKFLOW: whether new matching logs run it, when known
119
+ title?: string | null; // Sheet title, tab name, table, form or workflow title as stored when the event was built, else the call's
120
+ replayed?: boolean; // The tool result came from a durable receipt replay
121
+ at: string; // ISO timestamp of emission
122
+ }
123
+
124
+ export interface WSAppContextUpdateObj {
125
+ accountId: string;
126
+ updates: [any, any][];
127
+ }
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Auth enums
3
+ */
4
+
5
+ export type AuthTypeEnum = 'ID' | 'USERNAME' | 'EMAIL' | 'PHONE';
6
+ export type LightModeEnum = 'LIGHT' | 'DARK' | 'SYSTEM';
7
+
8
+ /**
9
+ * Account
10
+ */
11
+
12
+ export interface AccountData {
13
+ id: string;
14
+ deleted: boolean;
15
+
16
+ plus: any; // placeholder for later
17
+
18
+ settings: AccountSettings;
19
+
20
+ profile: {
21
+ id: string;
22
+ firstName: string;
23
+ lastName: string;
24
+ photoId: string;
25
+ photoUri: string;
26
+ };
27
+
28
+ email: {
29
+ id: string;
30
+ address: string;
31
+ verified: boolean;
32
+ };
33
+
34
+ phone: {
35
+ id: string;
36
+ number: string;
37
+ verified: boolean;
38
+ };
39
+ }
40
+
41
+ export interface AccountSettings {
42
+ theme: string | null;
43
+ language: string;
44
+ lightMode: LightModeEnum;
45
+ timeZone: string | null;
46
+ }
47
+
48
+ export interface AccountSessionOrganizationAuthorizationData {
49
+ id: string;
50
+ organizationId: string;
51
+ ssoConnectionId?: string | null;
52
+ authorizationMethod: string;
53
+ authorizedAt: string;
54
+ lastActivityAt?: string | null;
55
+ revokedAt?: string | null;
56
+ revokeReason?: string | null;
57
+ }
58
+
59
+ export interface AccountSessionData {
60
+ id: string;
61
+ accountId: string;
62
+ authMethod: string;
63
+ deviceName?: string | null;
64
+ userAgent?: string | null;
65
+ createdIpAddress?: string | null;
66
+ lastIpAddress?: string | null;
67
+ createdAt: string;
68
+ lastActivityAt: string;
69
+ idleExpiresAt: string;
70
+ absoluteExpiresAt: string;
71
+ revokedAt?: string | null;
72
+ revokeReason?: string | null;
73
+ current: boolean;
74
+ organizationAuthorizations: AccountSessionOrganizationAuthorizationData[];
75
+ }
76
+
77
+ /**
78
+ * Auth context
79
+ */
80
+
81
+ export interface AuthenticationData {
82
+ token: string | null;
83
+ sessionBootstrapToken?: string | null;
84
+ cacheAuthorizationEpoch?: string | null;
85
+ timeZone: string | null;
86
+ account: AccountData | null;
87
+ settings: AccountSettings | null;
88
+ primaryOrganizationId: string | null;
89
+ activated: boolean;
90
+ hasPassword: boolean;
91
+ webVersion: string;
92
+ mobileVersion: string;
93
+ alertUpdatesOnMount: boolean;
94
+ }
@@ -0,0 +1,3 @@
1
+ interface Console {
2
+ dev: (...args: any[]) => void;
3
+ }
@@ -0,0 +1,23 @@
1
+ declare module 'node-polyglot' {
2
+ class Polyglot {
3
+ constructor(options?: any);
4
+
5
+ clear(): void;
6
+
7
+ extend(morePhrases: any, prefix?: any): void;
8
+
9
+ has(key: any): any;
10
+
11
+ locale(newLocale: any): any;
12
+
13
+ replace(newPhrases: any): void;
14
+
15
+ t(key: any, options?: any): any;
16
+
17
+ unset(morePhrases: any, prefix: any): void;
18
+
19
+ static transformPhrase(phrase: any, substitutions: any, locale: any): any;
20
+ }
21
+
22
+ export default Polyglot;
23
+ }
@@ -0,0 +1,66 @@
1
+ import { DAY_OF_WEEK, SCHEDULE_FREQUENCY } from '../constants/other.ts';
2
+
3
+ /**
4
+ * Enums
5
+ */
6
+
7
+ export type DayOfWeekEnum = (typeof DAY_OF_WEEK)[number];
8
+ export type ScheduleFrequencyEnum = (typeof SCHEDULE_FREQUENCY)[number];
9
+
10
+ /**
11
+ * Shared acknowledgment returned by optimistic editor mutations.
12
+ */
13
+ export interface EditVersionPayloadGQL {
14
+ editVersion: number;
15
+ }
16
+
17
+ /**
18
+ * Address
19
+ */
20
+
21
+ export interface AddressObj {
22
+ line1: string;
23
+ line2?: string | null;
24
+ city: string;
25
+ state: string;
26
+ postalCode: string;
27
+ country: string;
28
+ }
29
+
30
+ /**
31
+ * Schedule
32
+ */
33
+
34
+ export interface ScheduleObj {
35
+ frequency: ScheduleFrequencyEnum;
36
+ weeksOfMonth?: number[];
37
+ daysOfWeek?: (0 | 1 | 2 | 3 | 4 | 5 | 6)[];
38
+ time?: [
39
+ string?, // Star time "hhmm" format
40
+ string?, // End time "hhmm" format (optional)
41
+ ];
42
+ }
43
+
44
+ /**
45
+ * Generic label/value object
46
+ */
47
+
48
+ export interface LabelAndValue {
49
+ iconName?: string;
50
+ label: string;
51
+ value: string;
52
+ quantity?: number;
53
+ unit?: string;
54
+ tax?: number;
55
+ note?: string;
56
+ }
57
+
58
+ /**
59
+ * File object
60
+ */
61
+
62
+ export interface FileObj {
63
+ buffer: Uint8Array;
64
+ contentType: string;
65
+ fileName?: string;
66
+ }
package/src/types.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ declare global {
2
+ interface Console {
3
+ dev: (...args: any[]) => void;
4
+ }
5
+ }
6
+
7
+ /** Declaration file generated by dts-gen */
8
+
9
+ declare class NodePolyglot {
10
+ constructor(options?: any);
11
+
12
+ clear(): void;
13
+
14
+ extend(morePhrases: any, prefix?: any): void;
15
+
16
+ has(key: any): any;
17
+
18
+ locale(newLocale: any): any;
19
+
20
+ replace(newPhrases: any): void;
21
+
22
+ t(key: any, options?: any): any;
23
+
24
+ unset(morePhrases: any, prefix: any): void;
25
+
26
+ static transformPhrase(phrase: any, substitutions: any, locale: any): any;
27
+ }
28
+
29
+ export = NodePolyglot;