@mrktg/int-brands 1.1.0

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/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # @mrktg/int-brands
2
+
3
+ Бренды международного региона поверх контракта [@mrktg/brands-core](https://www.npmjs.com/package/@mrktg/brands-core):
4
+ здесь только данные и расширение региона под инфраструктуру, функции и проверки — из core.
5
+
6
+ | id | title.en | title.ru | Сайт | Язык |
7
+ | -------------- | ------------ | ------------- | --------------------------- | ---- |
8
+ | `rh` | RateHawk | RateHawk | www.ratehawk.com | en |
9
+ | `zen` | ZenHotels | ZenHotels | www.zenhotels.com | en |
10
+ | `rt` | Roundtrip | Roundtrip | roundtrip.travel | en |
11
+ | `extranet-int` | Extranet ETG | Экстранет ETG | extranet.emergingtravel.com | en |
12
+
13
+ Регион `int`: хранилище AWS, хост ассетов `https://im.worldota.net` (CDN, кэширует на часы),
14
+ бакет напрямую `https://int-marketing.s3.amazonaws.com` (демо и превью), компоненты `int-components`.
15
+
16
+ ## Подключение
17
+
18
+ ```sh
19
+ npm i @mrktg/int-brands
20
+ ```
21
+
22
+ ```ts
23
+ import { getBrand, resolveBrand, getBrandRegion, BRANDS, type TBrandId } from '@mrktg/int-brands';
24
+
25
+ getBrand('rh').favicon.href;
26
+ resolveBrand('ratehawk')?.id; // 'rh' — alias
27
+ getBrandRegion('zen').componentsPackage;
28
+ ```
29
+
30
+ Полный API — в README `@mrktg/brands-core`: `getBrand`, `getRegion`, `getBrandRegion`, `brandsByRegion`,
31
+ `resolveBrand`, `isBrandId`, `siteUrl`, `brandIds`.
32
+
33
+ ## Структура
34
+
35
+ ```
36
+ brands.ts данные брендов и TBrandId
37
+ regions.ts регион и IRegionInfra — расширение IRegion полями storage, componentsPackage
38
+ index.ts createRegistry() из core над этими данными
39
+ dist/ собранные js + d.ts, коммитятся (нода не стрипает типы под node_modules)
40
+ ```
41
+
42
+ ## Как добавить бренд
43
+
44
+ 1. Объект в `brands.ts`, id — в `TBrandId`: короткий, kebab-case.
45
+ 2. `npm test` — core проверит уникальность id и alias'ов, хосты, язык, фавиконку, и что `dist` пересобран.
46
+ 3. Таблица выше.
47
+ 4. `npm version <patch|minor|major>`, `git push --follow-tags`, `npm publish`; потребители поднимают версию.
48
+
49
+ Фавиконки — те же файлы, что подключают сайты; урлы версионированные, при смене иконки на сайте
50
+ обновить здесь.
@@ -0,0 +1,9 @@
1
+ import type { IBrand } from '@mrktg/brands-core';
2
+ import type { TRegionId } from './regions.ts';
3
+ export type TBrandId = 'rh' | 'zen' | 'rt' | 'extranet-int';
4
+ /**
5
+ * Фавиконки — те же файлы, что подключают сайты брендов; урлы версионированные,
6
+ * при смене иконки на сайте обновить здесь (сверка — <link rel="icon"> на главной).
7
+ * aliases — старые написания id, которые ещё живут в данных; в коде не использовать.
8
+ */
9
+ export declare const BRANDS: readonly IBrand<TBrandId, TRegionId>[];
package/dist/brands.js ADDED
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Фавиконки — те же файлы, что подключают сайты брендов; урлы версионированные,
3
+ * при смене иконки на сайте обновить здесь (сверка — <link rel="icon"> на главной).
4
+ * aliases — старые написания id, которые ещё живут в данных; в коде не использовать.
5
+ */
6
+ export const BRANDS = [
7
+ {
8
+ id: 'rh',
9
+ region: 'int',
10
+ title: { en: 'RateHawk', ru: 'RateHawk' },
11
+ siteHost: 'www.ratehawk.com',
12
+ siteLang: 'en',
13
+ favicon: { href: 'https://f.worldota.net/ostrota/theme/ratehawk/favicon-20231105171120.png', type: 'image/png' },
14
+ aliases: ['ratehawk'],
15
+ },
16
+ {
17
+ id: 'zen',
18
+ region: 'int',
19
+ title: { en: 'ZenHotels', ru: 'ZenHotels' },
20
+ siteHost: 'www.zenhotels.com',
21
+ siteLang: 'en',
22
+ favicon: { href: 'https://f.worldota.net/ostrota/theme/zenhotels/favicon-20211001113821.ico', type: 'image/x-icon' },
23
+ aliases: ['zenhotels'],
24
+ },
25
+ {
26
+ id: 'rt',
27
+ region: 'int',
28
+ title: { en: 'Roundtrip', ru: 'Roundtrip' },
29
+ siteHost: 'roundtrip.travel',
30
+ siteLang: 'en',
31
+ favicon: { href: 'https://f.worldota.net/ostrota/theme/roundtrip/favicon-20220512101632.ico', type: 'image/x-icon' },
32
+ aliases: ['roundtrip'],
33
+ },
34
+ {
35
+ id: 'extranet-int',
36
+ region: 'int',
37
+ title: { en: 'Extranet ETG', ru: 'Экстранет ETG' },
38
+ siteHost: 'extranet.emergingtravel.com',
39
+ siteLang: 'en',
40
+ favicon: { href: 'https://extranet.emergingtravel.com/static/favicon.svg', type: 'image/svg+xml' },
41
+ aliases: ['extranetInt', 'extranet_etg', 'extranet-etg'],
42
+ },
43
+ ];
@@ -0,0 +1,7 @@
1
+ import { BRANDS, type TBrandId } from './brands.ts';
2
+ import { REGIONS, type IRegionInfra } from './regions.ts';
3
+ export type { TBrandId } from './brands.ts';
4
+ export type { IRegionInfra, TRegionId } from './regions.ts';
5
+ export { BRANDS, REGIONS };
6
+ export declare const registry: import("@mrktg/brands-core").IRegistry<TBrandId, "int", import("@mrktg/brands-core").IBrand<TBrandId, "int">, IRegionInfra>;
7
+ export declare const brandIds: readonly TBrandId[], isBrandId: (value: unknown) => value is TBrandId, getBrand: (id: TBrandId) => import("@mrktg/brands-core").IBrand<TBrandId, "int">, getRegion: (id: "int") => IRegionInfra, getBrandRegion: (id: TBrandId) => IRegionInfra, brandsByRegion: (region: "int") => readonly import("@mrktg/brands-core").IBrand<TBrandId, "int">[], resolveBrand: (value: string) => import("@mrktg/brands-core").IBrand<TBrandId, "int"> | undefined, siteUrl: (id: TBrandId) => string;
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Реестр брендов региона int. Контракт и функции — из @mrktg/brands-core, здесь только данные.
3
+ */
4
+ import { createRegistry } from '@mrktg/brands-core';
5
+ import { BRANDS } from './brands.js';
6
+ import { REGIONS } from './regions.js';
7
+ export { BRANDS, REGIONS };
8
+ export const registry = createRegistry({
9
+ regions: REGIONS,
10
+ brands: BRANDS,
11
+ });
12
+ export const { brandIds, isBrandId, getBrand, getRegion, getBrandRegion, brandsByRegion, resolveBrand, siteUrl } = registry;
@@ -0,0 +1,10 @@
1
+ import type { IRegion } from '@mrktg/brands-core';
2
+ export type TRegionId = 'int';
3
+ /** Расширение контракта под инфраструктуру региона. */
4
+ export interface IRegionInfra extends IRegion<TRegionId> {
5
+ /** Провайдер хранилища ассетов. */
6
+ storage: 'aws';
7
+ /** npm-пакет UI-компонентов региона. */
8
+ componentsPackage: 'int-components';
9
+ }
10
+ export declare const REGIONS: Readonly<Record<TRegionId, IRegionInfra>>;
@@ -0,0 +1,9 @@
1
+ export const REGIONS = {
2
+ int: {
3
+ id: 'int',
4
+ storage: 'aws',
5
+ host: 'https://im.worldota.net',
6
+ bucketHost: 'https://int-marketing.s3.amazonaws.com',
7
+ componentsPackage: 'int-components',
8
+ },
9
+ };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@mrktg/int-brands",
3
+ "version": "1.1.0",
4
+ "description": "Международные бренды: данные брендов региона int поверх контракта @mrktg/brands-core.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "scripts": {
23
+ "build": "tsc -p tsconfig.build.json",
24
+ "test": "npm run build && node --test",
25
+ "typecheck": "tsc"
26
+ },
27
+ "engines": {
28
+ "node": ">=22.18"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+ssh://git@gitlab.srv.team/marketing-frontend/brands.git"
33
+ },
34
+ "dependencies": {
35
+ "@mrktg/brands-core": "^1.0.0"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^24.0.0",
39
+ "typescript": "^7.0.0"
40
+ }
41
+ }