@candlerip/shared3 0.0.153 → 0.0.156
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/backend/api/api-response/index.d.ts +1 -0
- package/src/backend/api/api-response/index.js +1 -0
- package/src/backend/api/api-response/terms-and-conditions/compose-terms-and-conditions-page-api-response/index.d.ts +2 -0
- package/src/backend/api/api-response/terms-and-conditions/compose-terms-and-conditions-page-api-response/index.js +13 -0
- package/src/backend/api/api-response/terms-and-conditions/compose-terms-and-conditions-page-api-response/type.d.ts +11 -0
- package/src/backend/api/api-response/terms-and-conditions/compose-terms-and-conditions-page-api-response/type.js +1 -0
- package/src/backend/api/api-response/terms-and-conditions/index.d.ts +2 -0
- package/src/backend/api/api-response/terms-and-conditions/index.js +2 -0
- package/src/backend/api/api-response/terms-and-conditions/type.d.ts +4 -0
- package/src/backend/api/api-response/terms-and-conditions/type.js +1 -0
- package/src/backend/cache/cache/config.d.ts +2 -0
- package/src/backend/cache/cache/config.js +2 -0
- package/src/backend/cache/cache/type.d.ts +2 -1
- package/src/backend/dictionary/compose-dictionary/index.js +8 -1
- package/src/backend/dictionary/compose-dictionary/type.d.ts +2 -1
- package/src/backend/dictionary/index.d.ts +1 -0
- package/src/backend/dictionary/index.js +1 -0
- package/src/backend/dictionary/translation-id/excluded/compose-excluded-translation-ids/index.d.ts +2 -0
- package/src/backend/dictionary/translation-id/excluded/compose-excluded-translation-ids/index.js +16 -0
- package/src/backend/dictionary/translation-id/excluded/compose-excluded-translation-ids/type.d.ts +7 -0
- package/src/backend/dictionary/translation-id/excluded/compose-excluded-translation-ids/type.js +1 -0
- package/src/backend/dictionary/translation-id/excluded/config.d.ts +2 -0
- package/src/backend/dictionary/translation-id/excluded/config.js +3 -0
- package/src/backend/dictionary/translation-id/excluded/index.d.ts +2 -0
- package/src/backend/dictionary/translation-id/excluded/index.js +2 -0
- package/src/backend/dictionary/translation-id/excluded/type.d.ts +4 -0
- package/src/backend/dictionary/translation-id/excluded/type.js +1 -0
- package/src/backend/dictionary/translation-id/index.d.ts +1 -0
- package/src/backend/dictionary/translation-id/index.js +1 -0
- package/src/candle/burning-candle-state/type-guard.js +1 -3
- package/src/page/index.d.ts +1 -0
- package/src/page/index.js +1 -0
- package/src/page/page-menu/config.d.ts +1 -0
- package/src/page/page-menu/config.js +12 -0
- package/src/page/page-menu/index.d.ts +3 -0
- package/src/page/page-menu/index.js +3 -0
- package/src/page/page-menu/type-guard.d.ts +2 -0
- package/src/page/page-menu/type-guard.js +2 -0
- package/src/page/page-menu/type.d.ts +2 -0
- package/src/page/page-menu/type.js +1 -0
- package/src/type/boolean/index.d.ts +1 -0
- package/src/type/boolean/index.js +1 -0
- package/src/type/boolean/type-guard.d.ts +1 -0
- package/src/type/boolean/type-guard.js +1 -0
- package/src/type/index.d.ts +1 -0
- package/src/type/index.js +1 -0
package/package.json
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
import { composeDictionary } from '../../../../dictionary/index.js';
|
2
|
+
export const composeTermsAndConditionsPageApiResponse = async (language, { excludedIdOptions }) => {
|
3
|
+
const resp = await composeDictionary('terms-and-conditions-page', language, excludedIdOptions);
|
4
|
+
if ('customError' in resp) {
|
5
|
+
return resp;
|
6
|
+
}
|
7
|
+
const dictionary = resp.data;
|
8
|
+
return {
|
9
|
+
data: {
|
10
|
+
dictionary,
|
11
|
+
},
|
12
|
+
};
|
13
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { Language } from '../../../../../dictionary/index.js';
|
2
|
+
import { CustomError } from '../../../../../error/index.js';
|
3
|
+
import { ExcludedIdOptions } from '../../../../dictionary/index.js';
|
4
|
+
import { TermsAndConditionsPageApiResponse } from '../type.js';
|
5
|
+
export type ComposeTermsAndConditionsPageApiResponse = (language: Language, options: {
|
6
|
+
excludedIdOptions?: ExcludedIdOptions;
|
7
|
+
}) => Promise<{
|
8
|
+
data: TermsAndConditionsPageApiResponse;
|
9
|
+
} | {
|
10
|
+
customError: CustomError;
|
11
|
+
}>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -33,4 +33,6 @@ export declare const CACHE: {
|
|
33
33
|
readonly 'persons-map-page-dictionary-hu': "Dictionary";
|
34
34
|
readonly 'terms-and-conditions-page-dictionary-en': "Dictionary";
|
35
35
|
readonly 'terms-and-conditions-page-dictionary-hu': "Dictionary";
|
36
|
+
readonly 'terms-and-conditions-page-api-response-en': "TermsAndConditionsPageApiResponse";
|
37
|
+
readonly 'terms-and-conditions-page-api-response-hu': "TermsAndConditionsPageApiResponse";
|
36
38
|
};
|
@@ -33,4 +33,6 @@ export const CACHE = {
|
|
33
33
|
'persons-map-page-dictionary-hu': 'Dictionary',
|
34
34
|
'terms-and-conditions-page-dictionary-en': 'Dictionary',
|
35
35
|
'terms-and-conditions-page-dictionary-hu': 'Dictionary',
|
36
|
+
'terms-and-conditions-page-api-response-en': 'TermsAndConditionsPageApiResponse',
|
37
|
+
'terms-and-conditions-page-api-response-hu': 'TermsAndConditionsPageApiResponse',
|
36
38
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Dictionary } from '../../../dictionary/index.js';
|
2
|
-
import { CandlesPageApiResponse, PersonsMapPageApiResponse } from '../../api/index.js';
|
2
|
+
import { CandlesPageApiResponse, PersonsMapPageApiResponse, TermsAndConditionsPageApiResponse } from '../../api/index.js';
|
3
3
|
import { CACHE } from './config.js';
|
4
4
|
export type Cache = {
|
5
5
|
[key in keyof typeof CACHE]: TypeMap[(typeof CACHE)[key]];
|
@@ -8,5 +8,6 @@ interface TypeMap {
|
|
8
8
|
CandlesPageApiResponse: CandlesPageApiResponse;
|
9
9
|
Dictionary: Dictionary;
|
10
10
|
PersonsMapPageApiResponse: PersonsMapPageApiResponse;
|
11
|
+
TermsAndConditionsPageApiResponse: TermsAndConditionsPageApiResponse;
|
11
12
|
}
|
12
13
|
export {};
|
@@ -1,3 +1,10 @@
|
|
1
1
|
import { DICTIONARY_CONFIG } from '../../../dictionary/index.js';
|
2
2
|
import { getTranslationsAsDictionary } from '../../database/mutation/translation/index.js';
|
3
|
-
|
3
|
+
import { composeExcludedTranslationIds } from '../translation-id/index.js';
|
4
|
+
export const composeDictionary = async (page, language, options) => {
|
5
|
+
let translationIds = [...DICTIONARY_CONFIG[page].translationIds];
|
6
|
+
const excludedIds = composeExcludedTranslationIds(page, options);
|
7
|
+
translationIds = translationIds.filter((it) => !excludedIds.includes(it));
|
8
|
+
const resp = await getTranslationsAsDictionary(language, translationIds);
|
9
|
+
return resp;
|
10
|
+
};
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { Dictionary, Language } from '../../../dictionary/index.js';
|
2
2
|
import { CustomError } from '../../../error/index.js';
|
3
3
|
import { Page } from '../../../page/index.js';
|
4
|
-
|
4
|
+
import { ExcludedIdOptions } from '../translation-id/index.js';
|
5
|
+
export type ComposeDictionary = (page: Page, language: Language, options?: ExcludedIdOptions) => Promise<{
|
5
6
|
data: Dictionary;
|
6
7
|
} | {
|
7
8
|
customError: CustomError;
|
package/src/backend/dictionary/translation-id/excluded/compose-excluded-translation-ids/index.js
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
import { isPageMenu } from '../../../../../page/index.js';
|
2
|
+
import { EXCLUDED_TRANSLATION_IDS } from '../config.js';
|
3
|
+
export const composeExcludedTranslationIds = (page, options) => {
|
4
|
+
let excludedIds = [];
|
5
|
+
if (options) {
|
6
|
+
const { isAuthenticated, isCookieConsent } = options;
|
7
|
+
excludedIds.push(isAuthenticated ? 'login' : 'logout');
|
8
|
+
if (isCookieConsent) {
|
9
|
+
excludedIds = excludedIds.concat(EXCLUDED_TRANSLATION_IDS.cookieConsent);
|
10
|
+
}
|
11
|
+
}
|
12
|
+
if (isPageMenu(page)) {
|
13
|
+
excludedIds.push(`pageMenu.${page}`);
|
14
|
+
}
|
15
|
+
return excludedIds;
|
16
|
+
};
|
package/src/backend/dictionary/translation-id/excluded/compose-excluded-translation-ids/type.d.ts
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
import { TranslationId } from '../../../../../dictionary/index.js';
|
2
|
+
import { Page } from '../../../../../page/index.js';
|
3
|
+
export type ComposeExcludedTranslationIds = (page: Page, options?: ExcludedIdOptions) => TranslationId[];
|
4
|
+
export type ExcludedIdOptions = {
|
5
|
+
isAuthenticated: boolean;
|
6
|
+
isCookieConsent: boolean;
|
7
|
+
};
|
package/src/backend/dictionary/translation-id/excluded/compose-excluded-translation-ids/type.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './excluded/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './excluded/index.js';
|
package/src/page/index.d.ts
CHANGED
package/src/page/index.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
export declare const PAGE_MENUS: readonly ["persons-page", "add-person-page", "persons-map-page", "candles-page", "contact-page", "cookie-policy-page", "help-page", "terms-and-conditions-page"];
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export const PAGE_MENUS = [
|
2
|
+
'persons-page',
|
3
|
+
'add-person-page',
|
4
|
+
'persons-map-page',
|
5
|
+
'candles-page',
|
6
|
+
'contact-page',
|
7
|
+
'cookie-policy-page',
|
8
|
+
'help-page',
|
9
|
+
'terms-and-conditions-page',
|
10
|
+
];
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
12
|
+
const CHECK = PAGE_MENUS;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './type-guard.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './type-guard.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const isBoolean: (data?: unknown) => data is boolean;
|
@@ -0,0 +1 @@
|
|
1
|
+
export const isBoolean = (data) => typeof data === 'boolean';
|
package/src/type/index.d.ts
CHANGED