@hgdc/ui 0.34.0 → 0.35.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/dist/products.d.ts +22 -0
- package/dist/products.js +24 -1
- package/package.json +1 -1
package/dist/products.d.ts
CHANGED
|
@@ -41,6 +41,28 @@ export type HgdcCatalogProduct = {
|
|
|
41
41
|
* quand cette session existe.
|
|
42
42
|
*/
|
|
43
43
|
export declare const PRODUCT_ENTRY_PATH = "/auth/hgdc";
|
|
44
|
+
/** Où un produit est servi : l'origine et, s'il partage son hôte avec d'autres, sa base de chemin. */
|
|
45
|
+
export type ProductOrigin = {
|
|
46
|
+
origin: string;
|
|
47
|
+
basePath: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Adresse de l'app de chaque produit, par mot en minuscules. Défaut : `https://<mot>.hgdc.ch` sans
|
|
51
|
+
* base. Un produit servi sous `https://app.hgdc.ch/<mot>` (`@hgdc/auth`, `appBasePath`) migre en
|
|
52
|
+
* ajoutant sa ligne ici, une à la fois, quand son déploiement est prêt :
|
|
53
|
+
*
|
|
54
|
+
* ```ts
|
|
55
|
+
* analytics: { origin: "https://app.hgdc.ch", basePath: "/analytics" },
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* Ne change que l'entrée dans l'app (`entryHref`, menus et barre) : la page d'accueil publique
|
|
59
|
+
* (`href`) reste `https://<mot>.hgdc.ch`.
|
|
60
|
+
*/
|
|
61
|
+
export declare const PRODUCT_ORIGINS: Readonly<Record<string, ProductOrigin>>;
|
|
62
|
+
/** Adresse de l'app d'un produit : celle de `PRODUCT_ORIGINS`, sinon `https://<mot>.hgdc.ch`. */
|
|
63
|
+
export declare function productOrigin(word: string, origins?: Readonly<Record<string, ProductOrigin>>): ProductOrigin;
|
|
64
|
+
/** Entrée dans l'app d'un produit avec la session HGDC : `https://app.hgdc.ch/analytics/auth/hgdc?refresh=background&next=/`. */
|
|
65
|
+
export declare function productEntryHref(word: string, origins?: Readonly<Record<string, ProductOrigin>>): string;
|
|
44
66
|
/**
|
|
45
67
|
* Requête de l'entrée depuis un autre produit : arriver sur l'accueil, relire les organisations en
|
|
46
68
|
* arrière-plan (`refresh=background`, ADR 0016).
|
package/dist/products.js
CHANGED
|
@@ -18,6 +18,29 @@ export const PRODUCT_STAGE_LABEL = {
|
|
|
18
18
|
* quand cette session existe.
|
|
19
19
|
*/
|
|
20
20
|
export const PRODUCT_ENTRY_PATH = "/auth/hgdc";
|
|
21
|
+
/**
|
|
22
|
+
* Adresse de l'app de chaque produit, par mot en minuscules. Défaut : `https://<mot>.hgdc.ch` sans
|
|
23
|
+
* base. Un produit servi sous `https://app.hgdc.ch/<mot>` (`@hgdc/auth`, `appBasePath`) migre en
|
|
24
|
+
* ajoutant sa ligne ici, une à la fois, quand son déploiement est prêt :
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* analytics: { origin: "https://app.hgdc.ch", basePath: "/analytics" },
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* Ne change que l'entrée dans l'app (`entryHref`, menus et barre) : la page d'accueil publique
|
|
31
|
+
* (`href`) reste `https://<mot>.hgdc.ch`.
|
|
32
|
+
*/
|
|
33
|
+
export const PRODUCT_ORIGINS = {};
|
|
34
|
+
/** Adresse de l'app d'un produit : celle de `PRODUCT_ORIGINS`, sinon `https://<mot>.hgdc.ch`. */
|
|
35
|
+
export function productOrigin(word, origins = PRODUCT_ORIGINS) {
|
|
36
|
+
const key = word.toLowerCase();
|
|
37
|
+
return Object.hasOwn(origins, key) ? origins[key] : { origin: `https://${key}.hgdc.ch`, basePath: "" };
|
|
38
|
+
}
|
|
39
|
+
/** Entrée dans l'app d'un produit avec la session HGDC : `https://app.hgdc.ch/analytics/auth/hgdc?refresh=background&next=/`. */
|
|
40
|
+
export function productEntryHref(word, origins = PRODUCT_ORIGINS) {
|
|
41
|
+
const app = productOrigin(word, origins);
|
|
42
|
+
return `${app.origin}${app.basePath}${PRODUCT_ENTRY_PATH}?${PRODUCT_ENTRY_REFRESH_QUERY}`;
|
|
43
|
+
}
|
|
21
44
|
/**
|
|
22
45
|
* Requête de l'entrée depuis un autre produit : arriver sur l'accueil, relire les organisations en
|
|
23
46
|
* arrière-plan (`refresh=background`, ADR 0016).
|
|
@@ -34,7 +57,7 @@ function product(word, pitch, icon, stage) {
|
|
|
34
57
|
name: word,
|
|
35
58
|
subdomain,
|
|
36
59
|
href,
|
|
37
|
-
entryHref:
|
|
60
|
+
entryHref: productEntryHref(badge),
|
|
38
61
|
pitch,
|
|
39
62
|
badge,
|
|
40
63
|
icon,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hgdc/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "Interface de la H Collection : jetons de la DA, thèmes, polices et composants.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://github.com/hugogebel-boop/hgdc-kit/tree/main/packages/ui#readme",
|