@coras-io/embed 0.4.0 → 0.5.1
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @coras-io/embed
|
|
2
2
|
|
|
3
|
+
## 0.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8a51a71: Accept a brand's `colorScheme` in `config.theme` under `strict: true`, so a `brand.json` exported from Coras Studio mounts as shipped.
|
|
8
|
+
- Updated dependencies [8a51a71]
|
|
9
|
+
- @coras-io/brand-tokens@0.5.0
|
|
10
|
+
|
|
11
|
+
## 0.5.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 6220f11: Add `logoHref` to the managed navbar so the brand logo can link to the distributor's own website instead of the embed's landing page
|
|
16
|
+
|
|
3
17
|
## 0.4.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -32,6 +32,7 @@ export declare class CorasNavBar extends CorasNavBar_base implements SearchMixin
|
|
|
32
32
|
logo?: string;
|
|
33
33
|
logoDark?: string;
|
|
34
34
|
navbarLogo?: string;
|
|
35
|
+
logoHref?: string;
|
|
35
36
|
private readonly colorScheme;
|
|
36
37
|
locale: SupportedLocales;
|
|
37
38
|
locales: SupportedLocales[];
|
|
@@ -99,6 +100,7 @@ export declare class CorasNavBar extends CorasNavBar_base implements SearchMixin
|
|
|
99
100
|
private renderMobileMenuDrawer;
|
|
100
101
|
private handleLogoClick;
|
|
101
102
|
private renderBrand;
|
|
103
|
+
private renderBrandHome;
|
|
102
104
|
private renderSearchOnlyHeader;
|
|
103
105
|
private renderFullHeader;
|
|
104
106
|
willUpdate(): void;
|
|
@@ -10,6 +10,7 @@ import { ColorSchemeController } from "../../core/color-scheme.js";
|
|
|
10
10
|
import { when } from "lit/directives/when.js";
|
|
11
11
|
import { localized, msg } from "@lit/localize";
|
|
12
12
|
import { consume, ContextConsumer } from "@lit/context";
|
|
13
|
+
import { safeUrl } from "@coras-io/brand-tokens";
|
|
13
14
|
import "../../components/button/button.js";
|
|
14
15
|
import "../../components/icon/icon.js";
|
|
15
16
|
import "../../components/input-field/input-field.js";
|
|
@@ -620,21 +621,40 @@ let CorasNavBar = class CorasNavBar extends SearchMixin(SignalWatcher(LitElement
|
|
|
620
621
|
? this.logoDark
|
|
621
622
|
: this.logo);
|
|
622
623
|
return html `
|
|
623
|
-
<slot name="brand">
|
|
624
|
-
${logo
|
|
625
|
-
? html `<button
|
|
626
|
-
class="brand-button"
|
|
627
|
-
part="brand-button"
|
|
628
|
-
type="button"
|
|
629
|
-
aria-label=${msg("Go to the home page")}
|
|
630
|
-
@click=${this.handleLogoClick}
|
|
631
|
-
>
|
|
632
|
-
<img class="brand-logo" part="brand-logo" src=${logo} alt="" />
|
|
633
|
-
</button>`
|
|
634
|
-
: nothing}
|
|
635
|
-
</slot>
|
|
624
|
+
<slot name="brand"> ${logo ? this.renderBrandHome(logo) : nothing} </slot>
|
|
636
625
|
`;
|
|
637
626
|
}
|
|
627
|
+
// A distributor with its own website links the logo straight there, the way its
|
|
628
|
+
// main site does, and a real anchor keeps that a link (middle-click, new tab,
|
|
629
|
+
// status bar). Without one there is no URL to link to, so the logo stays a
|
|
630
|
+
// button dispatching the `landing` navigation for the host to route.
|
|
631
|
+
renderBrandHome(logo) {
|
|
632
|
+
const image = html `<img
|
|
633
|
+
class="brand-logo"
|
|
634
|
+
part="brand-logo"
|
|
635
|
+
src=${logo}
|
|
636
|
+
alt=""
|
|
637
|
+
/>`;
|
|
638
|
+
// The URL comes from host config, so it is gated here rather than trusted.
|
|
639
|
+
const href = safeUrl(this.logoHref);
|
|
640
|
+
return href
|
|
641
|
+
? html `<a
|
|
642
|
+
class="brand-button"
|
|
643
|
+
part="brand-button"
|
|
644
|
+
href=${href}
|
|
645
|
+
aria-label=${msg("Go to the home page")}
|
|
646
|
+
>${image}</a
|
|
647
|
+
>`
|
|
648
|
+
: html `<button
|
|
649
|
+
class="brand-button"
|
|
650
|
+
part="brand-button"
|
|
651
|
+
type="button"
|
|
652
|
+
aria-label=${msg("Go to the home page")}
|
|
653
|
+
@click=${this.handleLogoClick}
|
|
654
|
+
>
|
|
655
|
+
${image}
|
|
656
|
+
</button>`;
|
|
657
|
+
}
|
|
638
658
|
renderSearchOnlyHeader() {
|
|
639
659
|
return html `
|
|
640
660
|
<header class="search-only">
|
|
@@ -711,6 +731,9 @@ __decorate([
|
|
|
711
731
|
__decorate([
|
|
712
732
|
property({ type: String, attribute: "navbar-logo" })
|
|
713
733
|
], CorasNavBar.prototype, "navbarLogo", void 0);
|
|
734
|
+
__decorate([
|
|
735
|
+
property({ type: String, attribute: "logo-href" })
|
|
736
|
+
], CorasNavBar.prototype, "logoHref", void 0);
|
|
714
737
|
__decorate([
|
|
715
738
|
consume({ context: localeContext, subscribe: true })
|
|
716
739
|
], CorasNavBar.prototype, "locale", void 0);
|
package/dist/sdk/types.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export type CorasConfig = {
|
|
|
87
87
|
colorScheme?: CorasColorScheme;
|
|
88
88
|
};
|
|
89
89
|
/**
|
|
90
|
-
*
|
|
90
|
+
* Host-set options for the SDK-created Coras navbar. Each `show*` key maps 1:1 to
|
|
91
91
|
* a navbar control; an omitted key keeps the navbar's default (everything
|
|
92
92
|
* shown). Used with `{ use: "managed", props: { … } }`.
|
|
93
93
|
*/
|
|
@@ -102,6 +102,13 @@ export type CorasNavbarProps = {
|
|
|
102
102
|
showCurrencySelector?: boolean;
|
|
103
103
|
showBasket?: boolean;
|
|
104
104
|
showSearch?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Where the brand logo links, for a distributor whose booking site sits beside
|
|
107
|
+
* a main website. Set it and the logo becomes a plain link there; leave it
|
|
108
|
+
* unset and the logo stays a button that emits a `landing` navigation for the
|
|
109
|
+
* host to route. Only `https:` and same-origin URLs are honoured.
|
|
110
|
+
*/
|
|
111
|
+
logoHref?: string;
|
|
105
112
|
};
|
|
106
113
|
/**
|
|
107
114
|
* Host content-injection points on the Coras navbar. Names describe the region
|
package/dist/sdk/validation.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FIELDS } from "@coras-io/brand-tokens";
|
|
1
|
+
import { BRAND_META_KEYS, FIELDS } from "@coras-io/brand-tokens";
|
|
2
2
|
import { validateBrandConfig } from "@coras-io/brand-tokens/validate";
|
|
3
3
|
import { supportedCurrencies } from "../core/currency/constants.js";
|
|
4
4
|
import { allLocales } from "../core/i18n/locale-codes.js";
|
|
@@ -178,16 +178,15 @@ function validateAssetsUrl(value) {
|
|
|
178
178
|
}
|
|
179
179
|
throw new CorasValidationError("invalid_url", "config.assetsUrl must be an absolute https URL or a root-relative path.", "config.assetsUrl");
|
|
180
180
|
}
|
|
181
|
-
// Field keys plus the BrandConfig meta keys
|
|
182
|
-
//
|
|
183
|
-
//
|
|
181
|
+
// Field keys (flat and grouped) plus the BrandConfig meta keys, taken from the
|
|
182
|
+
// contract rather than restated here so a key added there cannot be rejected
|
|
183
|
+
// here. Used only to surface unknown keys in strict mode (the schema itself
|
|
184
|
+
// strips them silently, which a strict host wants flagged, not swallowed).
|
|
184
185
|
const THEME_KEYS = [
|
|
185
186
|
...FIELDS.map((field) => field.key),
|
|
186
187
|
...FIELDS.map((field) => field.path.split(".")[0]),
|
|
187
|
-
|
|
188
|
-
"fontFaces",
|
|
188
|
+
...BRAND_META_KEYS,
|
|
189
189
|
"dark",
|
|
190
|
-
"schemaVersion",
|
|
191
190
|
];
|
|
192
191
|
/**
|
|
193
192
|
* Validate `config.theme` (and its `dark` overrides) against the shared
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=22"
|
|
22
22
|
},
|
|
23
|
-
"version": "0.
|
|
23
|
+
"version": "0.5.1",
|
|
24
24
|
"private": false,
|
|
25
25
|
"homepage": "https://embed.coras.io",
|
|
26
26
|
"bugs": {
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"typescript-eslint": "8.67.0",
|
|
105
105
|
"vite": "8.2.2",
|
|
106
106
|
"vitest": "4.1.11",
|
|
107
|
-
"@coras-io/static": "0.0.
|
|
107
|
+
"@coras-io/static": "0.0.5"
|
|
108
108
|
},
|
|
109
109
|
"dependencies": {
|
|
110
110
|
"@coinbase/cdp-core": "0.0.122",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"lit": "^3.3.3",
|
|
123
123
|
"openapi-fetch": "0.17.0",
|
|
124
124
|
"viem": "2.55.19",
|
|
125
|
-
"@coras-io/brand-tokens": "^0.
|
|
125
|
+
"@coras-io/brand-tokens": "^0.5.0"
|
|
126
126
|
},
|
|
127
127
|
"scripts": {
|
|
128
128
|
"lint": "eslint \"src/**/*.ts*\"",
|