@sigmaott/base-next 1.2.2 → 1.2.4

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/nuxt.config.ts CHANGED
@@ -67,10 +67,10 @@ export default defineNuxtConfig({
67
67
 
68
68
  imports: {
69
69
  dirs: [
70
- '~/constants',
70
+ // './constants',
71
71
  // all hooks, helper folders in components folder
72
- '~/components/**/*/hooks/*.ts',
73
- '~/components/**/*/helpers/*.ts',
72
+ 'components/**/*/hooks/*.ts',
73
+ 'components/**/*/helpers/*.ts',
74
74
  ],
75
75
  presets: [
76
76
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sigmaott/base-next",
3
3
  "type": "module",
4
- "version": "1.2.2",
4
+ "version": "1.2.4",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -0,0 +1,11 @@
1
+ export const ENV = {
2
+ VITE_HOST: import.meta.env.VITE_HOST as string,
3
+ VITE_BASE_URL: import.meta.env.VITE_BASE_URL as string,
4
+ VITE_BASE_PATH: import.meta.env.VITE_BASE_PATH as string,
5
+ DEV: import.meta.env.DEV as boolean,
6
+ PROD: import.meta.env.PROD as boolean,
7
+ NUXT_PUBLIC_API_BASE: window.__NUXT__.config.public.apiBase as string,
8
+ }
9
+
10
+ export const ASSET_DEV_URL
11
+ = isSubApp || import.meta.env.DEV ? ENV.NUXT_PUBLIC_API_BASE : undefined
@@ -0,0 +1,32 @@
1
+ export type TimeRange =
2
+ 'Today' | 'Yesterday' | 'This week' | 'This month'
3
+ | 'Last 7 days' | 'last_14_days' | 'Last 30 days' | 'custom'
4
+
5
+ export const TimeRangeOptions = [
6
+ { label: 'Custom', value: 'custom', key: 'custom' },
7
+ // { label: 'All time', value: 'all_time', key: 'all_time' },
8
+ { label: 'Today', value: 'Today', key: 'today' },
9
+ { label: 'Yesterday', value: 'Yesterday', key: 'yesterday' },
10
+ { label: 'This week', value: 'This week', key: 'this_week' },
11
+ { label: 'This month', value: 'This month', key: 'this_month' },
12
+ // { label: 'This year', value: 'This year', key: 'this_year' },
13
+ { label: 'Last 7 days', value: 'Last 7 days', key: 'last_7_days' },
14
+ { label: 'Last 30 days', value: 'Last 30 days', key: 'last_30_days' },
15
+ // { label: 'Last year', value: 'Last year', key: 'last_year' },
16
+ ]
17
+
18
+ export type TimeUnit = 'hour' | 'day' | 'week' | 'month' | 'year'
19
+
20
+ export const TimeUnitOptions = [
21
+ { label: 'Hour', value: 'hour', disabled: true },
22
+ { label: 'Day', value: 'day' },
23
+ { label: 'Week', value: 'week' },
24
+ { label: 'Month', value: 'month', disabled: true },
25
+ // { label: 'Year', value: 'year' },
26
+ ]
27
+
28
+ export interface FilterDimensionForm {
29
+ 'Events.channelId': string
30
+ 'Events.subChannel'?: string
31
+ 'Events.vastId'?: string
32
+ }
@@ -0,0 +1,185 @@
1
+ export const iso639_3 = {
2
+ 'Abkhazian': 'abk',
3
+ 'Afar': 'aar',
4
+ 'Afrikaans': 'afr',
5
+ 'Akan': 'aka',
6
+ 'Albanian': 'sqi',
7
+ 'Amharic': 'amh',
8
+ 'Arabic': 'ara',
9
+ 'Aragonese': 'arg',
10
+ 'Armenian': 'hye',
11
+ 'Assamese': 'asm',
12
+ 'Avaric': 'ava',
13
+ 'Avestan': 'ave',
14
+ 'Aymara': 'aym',
15
+ 'Azerbaijani': 'aze',
16
+ 'Bambara': 'bam',
17
+ 'Bashkir': 'bak',
18
+ 'Basque': 'eus',
19
+ 'Belarusian': 'bel',
20
+ 'Bengali': 'ben',
21
+ 'Bislama': 'bis',
22
+ 'Bosnian': 'bos',
23
+ 'Breton': 'bre',
24
+ 'Bulgarian': 'bul',
25
+ 'Burmese': 'mya',
26
+ 'Catalan': 'cat',
27
+ 'Chamorro': 'cha',
28
+ 'Chechen': 'che',
29
+ 'Chichewa': 'nya',
30
+ 'Chinese': 'zho',
31
+ 'Church': 'chu',
32
+ 'Chuvash': 'chv',
33
+ 'Cornish': 'cor',
34
+ 'Corsican': 'cos',
35
+ 'Cree': 'cre',
36
+ 'Croatian': 'hrv',
37
+ 'Czech': 'ces',
38
+ 'Danish': 'dan',
39
+ 'Divehi': 'div',
40
+ 'Dutch': 'nld',
41
+ 'Dzongkha': 'dzo',
42
+ 'English': 'eng',
43
+ 'Esperanto': 'epo',
44
+ 'Estonian': 'est',
45
+ 'Ewe': 'ewe',
46
+ 'Faroese': 'fao',
47
+ 'Fijian': 'fij',
48
+ 'Finnish': 'fin',
49
+ 'French': 'fra',
50
+ 'Western': 'fry',
51
+ 'Fulah': 'ful',
52
+ 'Gaelic': 'gla',
53
+ 'Galician': 'glg',
54
+ 'Ganda': 'lug',
55
+ 'Georgian': 'kat',
56
+ 'German': 'deu',
57
+ 'Greek': 'ell',
58
+ 'Kalaallisut': 'kal',
59
+ 'Guarani': 'grn',
60
+ 'Gujarati': 'guj',
61
+ 'Haitian': 'hat',
62
+ 'Hausa': 'hau',
63
+ 'Hebrew': 'heb',
64
+ 'Herero': 'her',
65
+ 'Hindi': 'hin',
66
+ 'Hiri': 'hmo',
67
+ 'Hungarian': 'hun',
68
+ 'Icelandic': 'isl',
69
+ 'Ido': 'ido',
70
+ 'Igbo': 'ibo',
71
+ 'Indonesian': 'ind',
72
+ 'Interlingua': 'ina',
73
+ 'Interlingue': 'ile',
74
+ 'Inuktitut': 'iku',
75
+ 'Inupiaq': 'ipk',
76
+ 'Irish': 'gle',
77
+ 'Italian': 'ita',
78
+ 'Japanese': 'jpn',
79
+ 'Javanese': 'jav',
80
+ 'Kannada': 'kan',
81
+ 'Kanuri': 'kau',
82
+ 'Kashmiri': 'kas',
83
+ 'Kazakh': 'kaz',
84
+ 'Central': 'khm',
85
+ 'Kikuyu': 'kik',
86
+ 'Kinyarwanda': 'kin',
87
+ 'Kirghiz': 'kir',
88
+ 'Komi': 'kom',
89
+ 'Kongo': 'kon',
90
+ 'Korean': 'kor',
91
+ 'Kuanyama': 'kua',
92
+ 'Kurdish': 'kur',
93
+ 'Lao': 'lao',
94
+ 'Latin': 'lat',
95
+ 'Latvian': 'lav',
96
+ 'Limburgan': 'lim',
97
+ 'Lingala': 'lin',
98
+ 'Lithuanian': 'lit',
99
+ 'Luba-Katanga': 'lub',
100
+ 'Luxembourgish': 'ltz',
101
+ 'Macedonian': 'mkd',
102
+ 'Malagasy': 'mlg',
103
+ 'Malay': 'msa',
104
+ 'Malayalam': 'mal',
105
+ 'Maltese': 'mlt',
106
+ 'Manx': 'glv',
107
+ 'Maori': 'mri',
108
+ 'Marathi': 'mar',
109
+ 'Marshallese': 'mah',
110
+ 'Mongolian': 'mon',
111
+ 'Nauru': 'nau',
112
+ 'Navajo': 'nav',
113
+ 'North': 'nde',
114
+ 'South': 'nbl',
115
+ 'Ndonga': 'ndo',
116
+ 'Nepali': 'nep',
117
+ 'Norwegian': 'nno',
118
+ 'Sichuan': 'iii',
119
+ 'Occitan': 'oci',
120
+ 'Ojibwa': 'oji',
121
+ 'Oriya': 'ori',
122
+ 'Oromo': 'orm',
123
+ 'Ossetian': 'oss',
124
+ 'Pali': 'pli',
125
+ 'Pashto': 'pus',
126
+ 'Persian': 'fas',
127
+ 'Polish': 'pol',
128
+ 'Portuguese': 'por',
129
+ 'Punjabi': 'pan',
130
+ 'Quechua': 'que',
131
+ 'Romanian': 'ron',
132
+ 'Romansh': 'roh',
133
+ 'Rundi': 'run',
134
+ 'Russian': 'rus',
135
+ 'Northern': 'sme',
136
+ 'Samoan': 'smo',
137
+ 'Sango': 'sag',
138
+ 'Sanskrit': 'san',
139
+ 'Sardinian': 'srd',
140
+ 'Serbian': 'srp',
141
+ 'Shona': 'sna',
142
+ 'Sindhi': 'snd',
143
+ 'Sinhala': 'sin',
144
+ 'Slovak': 'slk',
145
+ 'Slovenian': 'slv',
146
+ 'Somali': 'som',
147
+ 'Southern': 'sot',
148
+ 'Spanish': 'spa',
149
+ 'Sundanese': 'sun',
150
+ 'Swahili': 'swa',
151
+ 'Swati': 'ssw',
152
+ 'Swedish': 'swe',
153
+ 'Tagalog': 'tgl',
154
+ 'Tahitian': 'tah',
155
+ 'Tajik': 'tgk',
156
+ 'Tamil': 'tam',
157
+ 'Tatar': 'tat',
158
+ 'Telugu': 'tel',
159
+ 'Thai': 'tha',
160
+ 'Tibetan': 'bod',
161
+ 'Tigrinya': 'tir',
162
+ 'Tonga': 'ton',
163
+ 'Tsonga': 'tso',
164
+ 'Tswana': 'tsn',
165
+ 'Turkish': 'tur',
166
+ 'Turkmen': 'tuk',
167
+ 'Twi': 'twi',
168
+ 'Uighur': 'uig',
169
+ 'Ukrainian': 'ukr',
170
+ 'Urdu': 'urd',
171
+ 'Uzbek': 'uzb',
172
+ 'Venda': 'ven',
173
+ 'Vietnamese': 'vie',
174
+ 'Volapük': 'vol',
175
+ 'Walloon': 'wln',
176
+ 'Welsh': 'cym',
177
+ 'Wolof': 'wol',
178
+ 'Xhosa': 'xho',
179
+ 'Yiddish': 'yid',
180
+ 'Yoruba': 'yor',
181
+ 'Zhuang': 'zha',
182
+ 'Zulu': 'zul',
183
+ }
184
+
185
+ export const langOptions = computed(() => Object.entries(iso639_3))
@@ -3,6 +3,7 @@ import type { cacheOptions, loadErrorHandler, plugin } from 'wujie'
3
3
  import type { lifecycle } from 'wujie/esm/sandbox'
4
4
  import { defu } from 'defu'
5
5
  import { bus, destroyApp, setupApp } from 'wujie'
6
+ export const isSubApp = window.__MICRO_APP_ENVIRONMENT__ ?? window.__POWERED_BY_WUJIE__ ?? false
6
7
 
7
8
  interface Lifecycles {
8
9
  beforeLoad: lifecycle
@@ -0,0 +1,11 @@
1
+ export const QueryKeys = {
2
+ PaymentPlan: 'PaymentPlan',
3
+ AppBillingInfo: 'AppBillingInfo',
4
+ Noti: '/api/notification/notification',
5
+ LibraryProfile: 'LibraryProfile',
6
+ LibraryPreset: 'LibraryPreset',
7
+ LibraryPresetDetail: 'LibraryPresetDetail',
8
+ App: 'App',
9
+ InputDetail: 'InputDetail',
10
+
11
+ }
@@ -0,0 +1,8 @@
1
+ export const SPECIAL_CHARACTERS = /[`!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?~]/
2
+ export const SPECIAL_CHARACTERS_NAME = /[`!@#$%^&*()+\=[\]{};':"\\|,.<>/?~\s]/
3
+ export const SPECIAL_CHARACTERS_NAME_NO_DASH_UNDERLINE = /[`!@#$%^&*()+\=[\]{};':"\\|,<>\/?~\s.]/
4
+
5
+ export const SPECIAL_CHARACTERS_NO_DASH = /[`!@#$%^&*()+=[\]{};':"\\|,.<>/?~]/
6
+ export const SPECIAL_CHARACTERS_NO_DASH_UNDERLINE = /[`!@#$%^&*()+\=[\]{};':"\\|,<>/?~]/
7
+ export const WORD_NO_CONTAINT_ACCENTED_CHARACTERS = /^[a-z0-9A-Z_-]*$/
8
+ export const WORD_REGEX_FULL = /^[a-zA-Z0-9\-_\s]*$/
@@ -0,0 +1,41 @@
1
+ import { useStorage } from '@vueuse/core'
2
+ import { StorageKeys } from '../enums'
3
+
4
+ export const TOKEN_STORAGE = useStorage(StorageKeys.TOKEN, '', window.parent?.localStorage || localStorage)
5
+ export const TOKEN_TEMP_STORAGE = useStorage(StorageKeys.__TOKEN_TEMP_STORAGE__, '', window.parent?.localStorage || localStorage)
6
+ export const ADMIN_TOKEN_STORAGE = useStorage(StorageKeys.__ADMIN_TOKEN_STORAGE__, '')
7
+ export const APP_ID_STORAGE = useStorage(StorageKeys.APP_ID, '', window.parent?.sessionStorage || sessionStorage)
8
+ // NOTE: APP_DETAIL_STORAGE = [info, permission]
9
+ export const APP_DETAIL_STORAGE = useStorage(StorageKeys.__APP_DETAIL_STORAGE__, {}, window.parent?.sessionStorage || sessionStorage) as Ref<[any, any]>
10
+ export const ALERTS_TRANSCODE_STORAGE = useStorage(StorageKeys.__ALERTS_TRANSCODE_STORAGE__, {}, window.parent?.sessionStorage || sessionStorage)
11
+ export const SERVER_ADD_LICENSE = useStorage(StorageKeys.__SERVER_ADD_LICENSE__, {}, window.parent?.sessionStorage || sessionStorage)
12
+ export const PAYMENT_METHOD_STORAGE = useStorage(StorageKeys.__PAYMENT_METHOD_STORAGE__, {}, window.parent?.sessionStorage || sessionStorage)
13
+ export const TOKEN_PROP_STORAGE = useStorage(StorageKeys.TOKEN_PROP, '', window.parent?.localStorage || localStorage)
14
+ export const __LANGUAGE__ = useStorage(StorageKeys.__LANGUAGE__, 'en', window.parent?.localStorage || localStorage)
15
+ export const __IS_DARK__ = useStorage(StorageKeys.__IS_DARK__, true, window.parent?.localStorage || localStorage)
16
+ export const SOCIAL_LOGIN_REDIRECT = useStorage('__SOCIAL_LOGIN_REDIRECT__', '')
17
+ export const asideCollapsed = useStorage(StorageKeys.__ASIDE_COLLAPSED__, false, window.parent?.localStorage || localStorage)
18
+
19
+ const languagesMap: Record<string, string> = {
20
+ vi: 'vi-VN',
21
+ en: 'en-US',
22
+ }
23
+ export const TIMEZONE_USER = computed(() => {
24
+ return APP_DETAIL_STORAGE.value?.[1]?.user?.timezone
25
+ })
26
+ export const HEADER_TOKEN = computed(() => {
27
+ const commonHeader = {
28
+ 'Accept-Language': languagesMap[__LANGUAGE__.value],
29
+ }
30
+ if (TOKEN_STORAGE.value && TOKEN_PROP_STORAGE.value) {
31
+ return {
32
+ ...commonHeader,
33
+ [TOKEN_PROP_STORAGE.value]: `${TOKEN_STORAGE.value}`,
34
+ ...(APP_ID_STORAGE.value ? { 'X-App-Id': APP_ID_STORAGE.value } : {}),
35
+ }
36
+ }
37
+
38
+ return {
39
+ ...commonHeader,
40
+ }
41
+ })