@vectoriox/iox-ui 5.133.0 → 5.135.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/commerce-core/index.d.ts +12 -1
- package/composite-core/index.d.ts +27 -22
- package/design-core/index.d.ts +436 -35
- package/domain-core/index.d.ts +353 -0
- package/domain-core/package.json +3 -0
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs +2 -0
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs +6 -48
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +21 -0
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +68 -57
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +895 -416
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-domain-core.mjs +422 -0
- package/fesm2022/vectoriox-iox-ui-domain-core.mjs.map +1 -0
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +14039 -12067
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +9 -3
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-mail-core.mjs +210 -2
- package/fesm2022/vectoriox-iox-ui-mail-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +290 -16
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +1511 -432
- package/harness-core/index.d.ts +6 -1
- package/index.d.ts +139 -10
- package/mail-core/index.d.ts +190 -2
- package/package.json +5 -1
- package/src/actions-core/element-actions.ts +2 -0
- package/src/assist-core/page-sections.ts +7 -37
- package/src/commerce-core/shop-display.ts +21 -0
- package/src/composite-core/shop.ts +71 -57
- package/src/design-core/design-settings.ts +16 -0
- package/src/design-core/design-token.model.ts +7 -1
- package/src/design-core/flavor-spec.generated.ts +374 -35
- package/src/design-core/flavor-tokens.ts +12 -1
- package/src/design-core/header-behaviour.ts +32 -0
- package/src/design-core/motion-language.ts +115 -0
- package/src/design-core/public-api.ts +1 -0
- package/src/design-core/style-presets.ts +3 -0
- package/src/domain-core/domain-vocabulary.ts +125 -0
- package/src/domain-core/domain-wire.ts +95 -0
- package/src/domain-core/org-path-redirect.ts +105 -0
- package/src/domain-core/public-api.ts +12 -0
- package/src/domain-core/web-domain.ts +251 -0
- package/src/generation-core/carry-fill.ts +36 -0
- package/src/generation-core/carry.ts +398 -0
- package/src/generation-core/check-carry.ts +216 -0
- package/src/generation-core/check-layout.ts +71 -5
- package/src/generation-core/compose-layout.ts +187 -28
- package/src/generation-core/compose-site.ts +154 -31
- package/src/generation-core/entrances.ts +66 -10
- package/src/generation-core/header-edit.ts +299 -0
- package/src/generation-core/header-mix.ts +64 -5
- package/src/generation-core/layout-fingerprint.ts +5 -1
- package/src/generation-core/layout-language.ts +20 -1
- package/src/generation-core/layout-space.ts +4 -4
- package/src/generation-core/layout-wire.ts +36 -1
- package/src/generation-core/node-baselines.generated.ts +1 -0
- package/src/generation-core/public-api.ts +7 -0
- package/src/generation-core/redesign-additions.ts +273 -0
- package/src/generation-core/redesign-run.ts +364 -0
- package/src/generation-core/refit-page.ts +151 -0
- package/src/generation-core/section-stamp.ts +4 -4
- package/src/generation-core/shop-plan.ts +15 -0
- package/src/generation-core/site-build-run.ts +67 -3
- package/src/generation-core/site-spec.generated.ts +194 -94
- package/src/generation-core/site-tree.ts +19 -5
- package/src/generation-core/validate-site-plan.ts +37 -3
- package/src/harness-core/motion.ts +13 -3
- package/src/harness-core/starting-design.ts +1 -1
- package/src/mail-core/mail-domain.ts +305 -0
- package/src/mail-core/mail-wire.ts +8 -0
- package/src/mail-core/public-api.ts +3 -1
- package/styles/iox-design.css +30 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DesignMotion, SPEC_AXES, STYLE_PRESETS, StylePreset } from '@vectoriox/iox-ui/design-core';
|
|
1
|
+
import { DesignMotion, MotionWordTier, motionWordTier, SPEC_AXES, STYLE_PRESETS, StylePreset } from '@vectoriox/iox-ui/design-core';
|
|
2
2
|
|
|
3
3
|
import { BUSINESS_TYPES, BusinessType } from './business-types';
|
|
4
4
|
import { READ_ANIMATE, StyleRead } from './rank';
|
|
@@ -8,6 +8,9 @@ import { READ_ANIMATE, StyleRead } from './rank';
|
|
|
8
8
|
* Scrolling and Between pages are the BUSINESS's (a spa scrolls softly whatever its look); How animated is the
|
|
9
9
|
* CALMER of the business's (or what the references show) and the style's — so a quiet serif look never gets
|
|
10
10
|
* bouncing cards. The owner's "little movement" caps all three. No matching type → the style's own.
|
|
11
|
+
* A style whose language names a COVER (AW4: Flood, Wipe, Circle, Veil, Line, Controls) plays it between pages whatever
|
|
12
|
+
* the business — the cover is the style's, like its Feel — except for a calm business (its ceiling below Standard) and
|
|
13
|
+
* under "little movement". A lower plan wears it as Fade (`motionLanguageForPlan`).
|
|
11
14
|
*/
|
|
12
15
|
|
|
13
16
|
export interface MotionInput {
|
|
@@ -27,6 +30,8 @@ export interface MotionBasis {
|
|
|
27
30
|
littleMovement: boolean;
|
|
28
31
|
/** SC6: How animated was held at the type's ceiling (a law firm stays calm whatever the style or references). */
|
|
29
32
|
ceiling: boolean;
|
|
33
|
+
/** AW4: Between pages is the style's own cover. */
|
|
34
|
+
styleCover?: boolean;
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
export interface MotionStart extends DesignMotion {
|
|
@@ -41,6 +46,7 @@ export const LITTLE_MOVEMENT_AVOID = 'lots-of-motion';
|
|
|
41
46
|
export const LITTLE_MOVEMENT_CAP: Readonly<DesignMotion> = { scroll: 'smooth', animate: 'subtle', between: 'fade' };
|
|
42
47
|
|
|
43
48
|
type Axis = keyof DesignMotion;
|
|
49
|
+
const STANDARD = 'standard' as DesignMotion['animate'];
|
|
44
50
|
const TABLES = { scroll: SPEC_AXES.scrolls, animate: SPEC_AXES.animations, between: SPEC_AXES.betweens } as const;
|
|
45
51
|
const ORDER: Readonly<Record<Axis, ReadonlyArray<string>>> = {
|
|
46
52
|
scroll: Object.keys(SPEC_AXES.scrolls), animate: Object.keys(SPEC_AXES.animations), between: Object.keys(SPEC_AXES.betweens),
|
|
@@ -66,9 +72,13 @@ export function motionFor(
|
|
|
66
72
|
const base = type ? type.moves : preset.moves;
|
|
67
73
|
const ref = read?.motion ? READ_ANIMATE[read.motion] : null;
|
|
68
74
|
const wanted = ref ?? base.animate;
|
|
69
|
-
|
|
75
|
+
const calmType = !!type && calmerChoice('animate', type.ceiling, STANDARD) !== STANDARD;
|
|
76
|
+
const styleCover = !!type && !calmType && preset.moves.between !== base.between
|
|
77
|
+
&& motionWordTier('cover', preset.moves.between) === MotionWordTier.Pro;
|
|
78
|
+
let out: DesignMotion = { scroll: base.scroll, animate: calmerChoice('animate', wanted, preset.moves.animate), between: styleCover ? preset.moves.between : base.between };
|
|
70
79
|
const why = [type ? `${type.label}: ${triple(base)}` : `${preset.name}: the style's own`];
|
|
71
|
-
|
|
80
|
+
if (styleCover) why.push(`${preset.name} changes pages by its own cover (${label('between', preset.moves.between)})`);
|
|
81
|
+
const basis: MotionBasis = { type: type?.id ?? null, calmerStyle: out.animate !== wanted, references: !!(ref && type), littleMovement: false, ceiling: false, ...(styleCover ? { styleCover } : {}) };
|
|
72
82
|
if (basis.calmerStyle) why.push(`${preset.name} moves less (${label('animate', preset.moves.animate)})`);
|
|
73
83
|
if (basis.references) why.push(`your references: ${label('animate', ref!)}`);
|
|
74
84
|
if (type && calmerChoice('animate', out.animate, type.ceiling) !== out.animate) {
|
|
@@ -20,7 +20,7 @@ import { referenceSeed } from './reference-colour';
|
|
|
20
20
|
export function presetDesign(
|
|
21
21
|
presetId: string,
|
|
22
22
|
input: MotionInput | string | null,
|
|
23
|
-
kept: Partial<Pick<DesignChoices, 'scroll' | 'animate' | 'between' | 'motion'>> = {},
|
|
23
|
+
kept: Partial<Pick<DesignChoices, 'scroll' | 'animate' | 'between' | 'motion' | 'feel' | 'headings'>> = {},
|
|
24
24
|
read: StyleRead | null = null,
|
|
25
25
|
): DesignChoices | null {
|
|
26
26
|
const base = presetChoices(presetId);
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A studio's OWN sending domain (iox-mail-plan ML4, ML-D2 (b), R-ML3): the owner names an address on its domain, adds the
|
|
3
|
+
* DNS records Mailjet gives, and IOX mail switches the From to that address only once Mailjet says the sender is active
|
|
4
|
+
* AND SPF AND DKIM are ok — never before, and back to `mail.iox.studio` the moment a recheck finds a record gone.
|
|
5
|
+
*
|
|
6
|
+
* ONE judge of Mailjet's `sender` + `dns` answers (`mailSenderProblems`), used by the relay for an IOX-mail domain and by
|
|
7
|
+
* iox-cms for a studio's own Mailjet key (commerce E4's sender check) — the two used to be one private copy each.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** Where a studio's own sending domain stands — what Settings ▸ Email ▸ "Send from my own domain" shows. */
|
|
11
|
+
export enum MailDomainState {
|
|
12
|
+
/** no own domain — mail goes from `<studio>@mail.iox.studio` */
|
|
13
|
+
NotSet = 'not-set',
|
|
14
|
+
/** named; Mailjet has not checked its records yet (never asked, or a check is running) */
|
|
15
|
+
Waiting = 'waiting',
|
|
16
|
+
/** the sender is active and SPF + DKIM are ok — mail goes from the studio's own address */
|
|
17
|
+
Verified = 'verified',
|
|
18
|
+
/** checked, and a record is missing or wrong — mail keeps going from `mail.iox.studio` */
|
|
19
|
+
Failed = 'failed',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Why a sender is not verified — Mailjet's answers read (the values are commerce E4's, unchanged on the wire). */
|
|
23
|
+
export enum MailSenderProblem {
|
|
24
|
+
/** no sender address at all */
|
|
25
|
+
NoAddress = 'no-address',
|
|
26
|
+
/** Mailjet does not know the address as a sender, or has not activated it (the ownership record) */
|
|
27
|
+
SenderInactive = 'sender-inactive',
|
|
28
|
+
/** the address's domain is not added to Mailjet */
|
|
29
|
+
DomainMissing = 'domain-missing',
|
|
30
|
+
SpfMissing = 'spf-missing',
|
|
31
|
+
DkimMissing = 'dkim-missing',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The three records a domain needs — each one TXT. */
|
|
35
|
+
export enum MailDnsRecordRole {
|
|
36
|
+
/** proves the domain is the studio's: Mailjet's ownership token */
|
|
37
|
+
Ownership = 'ownership',
|
|
38
|
+
/** lets Mailjet's servers send for the domain */
|
|
39
|
+
Spf = 'spf',
|
|
40
|
+
/** signs every message with the domain's key */
|
|
41
|
+
Dkim = 'dkim',
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** One record to copy into the domain's DNS. */
|
|
45
|
+
export interface MailDnsRecord {
|
|
46
|
+
role: MailDnsRecordRole;
|
|
47
|
+
type: 'TXT';
|
|
48
|
+
/** the full name — `mailjet._domainkey.alma.co.il` */
|
|
49
|
+
name: string;
|
|
50
|
+
/** the name as most DNS screens want it, relative to the domain (`mailjet._domainkey`; `@` for the domain itself) */
|
|
51
|
+
host: string;
|
|
52
|
+
value: string;
|
|
53
|
+
/** Mailjet's last word on it: true ok · false wrong or missing · null not checked yet */
|
|
54
|
+
ok: boolean | null;
|
|
55
|
+
/** what Mailjet found wrong, in its words (bounded) */
|
|
56
|
+
error?: string | null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Why an address cannot become the studio's sending address. */
|
|
60
|
+
export enum MailDomainRefusal {
|
|
61
|
+
/** not one plain address */
|
|
62
|
+
NotAnAddress = 'not-an-address',
|
|
63
|
+
/** `iox.studio` or any domain under it — IOX's own */
|
|
64
|
+
PlatformDomain = 'platform-domain',
|
|
65
|
+
/** a public mailbox (gmail.com, outlook.com…) — nobody but its provider can add records there */
|
|
66
|
+
PublicMailbox = 'public-mailbox',
|
|
67
|
+
/** another studio sends from this domain */
|
|
68
|
+
Taken = 'taken',
|
|
69
|
+
/** IOX mail is not on (no key, or the plan has none) */
|
|
70
|
+
NotEnabled = 'not-enabled',
|
|
71
|
+
/** Mailjet could not be asked — try again */
|
|
72
|
+
Upstream = 'upstream',
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Mailjet's sender row (v3 REST `sender`) — only what is read. */
|
|
76
|
+
export interface MailjetSenderRow {
|
|
77
|
+
ID?: number;
|
|
78
|
+
Email?: string;
|
|
79
|
+
/** `Inactive` · `Active` · `Deleted` */
|
|
80
|
+
Status?: string;
|
|
81
|
+
/** -1 while inactive */
|
|
82
|
+
DNSID?: number;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Mailjet's DNS row (v3 REST `dns/{id}`). Statuses: SPF `OK` · `Error` · `Not checked` · `Not found`; DKIM `OK` · `Error` · `Not checked`. */
|
|
86
|
+
export interface MailjetDnsRow {
|
|
87
|
+
ID?: number;
|
|
88
|
+
Domain?: string;
|
|
89
|
+
SPFStatus?: string;
|
|
90
|
+
SPFRecordValue?: string;
|
|
91
|
+
DKIMStatus?: string;
|
|
92
|
+
DKIMRecordName?: string;
|
|
93
|
+
DKIMRecordValue?: string;
|
|
94
|
+
OwnerShipToken?: string;
|
|
95
|
+
OwnerShipTokenRecordName?: string;
|
|
96
|
+
IsCheckInProgress?: boolean;
|
|
97
|
+
LastCheckAt?: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Mailjet's `dns/{id}/check` answer — `OK` · `Error`, with its words. */
|
|
101
|
+
export interface MailjetDnsCheckRow {
|
|
102
|
+
SPFStatus?: string;
|
|
103
|
+
SPFErrors?: string;
|
|
104
|
+
DKIMStatus?: string;
|
|
105
|
+
DKIMErrors?: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const ACTIVE = 'active';
|
|
109
|
+
const OK = 'ok';
|
|
110
|
+
const NOT_CHECKED = new Set(['not checked', '']);
|
|
111
|
+
const MAX_ERROR = 300;
|
|
112
|
+
|
|
113
|
+
/** Mailjet's SPF include — merged into a domain's existing SPF record, never a second record beside it. */
|
|
114
|
+
export const MAILJET_SPF_INCLUDE = 'include:spf.mailjet.com';
|
|
115
|
+
|
|
116
|
+
/** How often the owner's "Check DNS" really asks Mailjet; a sooner press answers the last check. */
|
|
117
|
+
export const MAIL_DOMAIN_CHECK_MIN_MS = 30_000;
|
|
118
|
+
/** A verified domain is checked again this often — a removed record moves the From back to `mail.iox.studio`. */
|
|
119
|
+
export const MAIL_DOMAIN_RECHECK_MS = 24 * 60 * 60 * 1000;
|
|
120
|
+
|
|
121
|
+
/** Domains IOX itself sends from — never a studio's own. */
|
|
122
|
+
export const PLATFORM_MAIL_DOMAINS: readonly string[] = ['iox.studio'];
|
|
123
|
+
|
|
124
|
+
/** Public mailbox providers: an address there can never be verified by the studio (no access to the DNS). */
|
|
125
|
+
export const PUBLIC_MAILBOX_DOMAINS: readonly string[] = [
|
|
126
|
+
'gmail.com', 'googlemail.com', 'outlook.com', 'hotmail.com', 'live.com', 'msn.com', 'yahoo.com', 'ymail.com',
|
|
127
|
+
'icloud.com', 'me.com', 'mac.com', 'aol.com', 'proton.me', 'protonmail.com', 'gmx.com', 'gmx.net', 'zoho.com',
|
|
128
|
+
'yandex.com', 'mail.com', 'walla.co.il', 'walla.com',
|
|
129
|
+
];
|
|
130
|
+
|
|
131
|
+
/** The lower-cased domain of an address, or null. */
|
|
132
|
+
export function mailDomainOf(email: string | null | undefined): string | null {
|
|
133
|
+
const at = String(email ?? '').lastIndexOf('@');
|
|
134
|
+
const domain = at > 0 ? String(email).slice(at + 1).trim().toLowerCase().replace(/\.$/, '') : '';
|
|
135
|
+
return domain || null;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const under = (domain: string, parent: string) => domain === parent || domain.endsWith(`.${parent}`);
|
|
139
|
+
|
|
140
|
+
/** Why this address cannot be the studio's own sending address — null when it can (the relay adds `Taken`). */
|
|
141
|
+
export function ownAddressRefusal(address: unknown, platformDomains: readonly string[] = PLATFORM_MAIL_DOMAINS): MailDomainRefusal | null {
|
|
142
|
+
if (typeof address !== 'string' || !isPlainAddress(address)) return MailDomainRefusal.NotAnAddress;
|
|
143
|
+
const domain = mailDomainOf(address)!;
|
|
144
|
+
if (platformDomains.some((p) => under(domain, p.toLowerCase()))) return MailDomainRefusal.PlatformDomain;
|
|
145
|
+
if (PUBLIC_MAILBOX_DOMAINS.some((p) => under(domain, p))) return MailDomainRefusal.PublicMailbox;
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const PLAIN_ADDRESS = /^[A-Za-z0-9.!#$%&'*+/=?^_`{|}~-]{1,64}@[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)+$/;
|
|
150
|
+
|
|
151
|
+
function isPlainAddress(value: string): boolean {
|
|
152
|
+
const v = value.trim();
|
|
153
|
+
return v.length <= 254 && PLAIN_ADDRESS.test(v) && /\.[A-Za-z]{2,}$/.test(v);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* THE judge of Mailjet's answers for one address: verified only with an active sender AND SPF ok AND DKIM ok.
|
|
158
|
+
* An empty list is verified. (commerce E4's sender check and the relay's own-domain check both ask this.)
|
|
159
|
+
*/
|
|
160
|
+
export function mailSenderProblems(email: string | null, sender: MailjetSenderRow | null, dns: MailjetDnsRow | null): MailSenderProblem[] {
|
|
161
|
+
const problems: MailSenderProblem[] = [];
|
|
162
|
+
if (!email || !mailDomainOf(email)) return [MailSenderProblem.NoAddress];
|
|
163
|
+
if (String(sender?.Status ?? '').toLowerCase() !== ACTIVE) problems.push(MailSenderProblem.SenderInactive);
|
|
164
|
+
if (!dns) problems.push(MailSenderProblem.DomainMissing);
|
|
165
|
+
else {
|
|
166
|
+
if (String(dns.SPFStatus ?? '').toLowerCase() !== OK) problems.push(MailSenderProblem.SpfMissing);
|
|
167
|
+
if (String(dns.DKIMStatus ?? '').toLowerCase() !== OK) problems.push(MailSenderProblem.DkimMissing);
|
|
168
|
+
}
|
|
169
|
+
return problems;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** A record's name relative to its domain — `@` for the domain itself. */
|
|
173
|
+
export function relativeDnsHost(name: string | null | undefined, domain: string): string {
|
|
174
|
+
const full = String(name ?? '').trim().toLowerCase().replace(/\.$/, '');
|
|
175
|
+
if (!full || full === domain) return '@';
|
|
176
|
+
return full.endsWith(`.${domain}`) ? full.slice(0, -(domain.length + 1)) : full;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The SPF record to publish: the domain's existing `v=spf1` record with Mailjet's include added before its `all` term
|
|
181
|
+
* (a domain may hold only ONE SPF record — a second one fails both), or Mailjet's own value when there is none.
|
|
182
|
+
*/
|
|
183
|
+
export function mergedSpf(existing: string | null | undefined, mailjetValue = `v=spf1 ${MAILJET_SPF_INCLUDE} ~all`): string {
|
|
184
|
+
const current = String(existing ?? '').trim().replace(/^"|"$/g, '');
|
|
185
|
+
if (!/^v=spf1(\s|$)/i.test(current)) return mailjetValue;
|
|
186
|
+
const terms = current.split(/\s+/);
|
|
187
|
+
if (terms.some((t) => t.toLowerCase() === MAILJET_SPF_INCLUDE)) return terms.join(' ');
|
|
188
|
+
const all = terms.findIndex((t, i) => i > 0 && /^[-~?+]?all$/i.test(t));
|
|
189
|
+
if (all < 0) return [...terms, MAILJET_SPF_INCLUDE].join(' ');
|
|
190
|
+
return [...terms.slice(0, all), MAILJET_SPF_INCLUDE, ...terms.slice(all)].join(' ');
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const bounded = (words: string | null | undefined) => {
|
|
194
|
+
const w = String(words ?? '').replace(/\s+/g, ' ').trim();
|
|
195
|
+
return w ? w.slice(0, MAX_ERROR) : null;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const statusOk = (status: string | undefined): boolean | null => {
|
|
199
|
+
const s = String(status ?? '').trim().toLowerCase();
|
|
200
|
+
if (NOT_CHECKED.has(s)) return null;
|
|
201
|
+
return s === OK;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
/** The three records to copy, each with Mailjet's last word on it. `existingSpf` = the domain's own SPF, when read. */
|
|
205
|
+
export function mailDnsRecords(
|
|
206
|
+
domain: string,
|
|
207
|
+
sender: MailjetSenderRow | null,
|
|
208
|
+
dns: MailjetDnsRow | null,
|
|
209
|
+
check?: MailjetDnsCheckRow | null,
|
|
210
|
+
existingSpf?: string | null,
|
|
211
|
+
): MailDnsRecord[] {
|
|
212
|
+
if (!dns) return [];
|
|
213
|
+
const record = (role: MailDnsRecordRole, name: string, value: string, ok: boolean | null, error?: string | null): MailDnsRecord =>
|
|
214
|
+
({ role, type: 'TXT', name, host: relativeDnsHost(name, domain), value, ok, error: ok === false ? bounded(error) : null });
|
|
215
|
+
const records: MailDnsRecord[] = [];
|
|
216
|
+
if (dns.OwnerShipToken) {
|
|
217
|
+
const name = String(dns.OwnerShipTokenRecordName || domain).replace(/\.$/, '');
|
|
218
|
+
// a fresh sender is Inactive by birth: the ownership row reads "wrong" only after a check found it so
|
|
219
|
+
const active = String(sender?.Status ?? '').toLowerCase() === ACTIVE;
|
|
220
|
+
records.push(record(MailDnsRecordRole.Ownership, name, dns.OwnerShipToken, active ? true : check ? false : null, check ? 'Mailjet has not found this record yet' : null));
|
|
221
|
+
}
|
|
222
|
+
records.push(record(MailDnsRecordRole.Spf, domain, mergedSpf(existingSpf, dns.SPFRecordValue || undefined), statusOk(check?.SPFStatus ?? dns.SPFStatus), check?.SPFErrors));
|
|
223
|
+
if (dns.DKIMRecordName && dns.DKIMRecordValue) {
|
|
224
|
+
records.push(record(MailDnsRecordRole.Dkim, String(dns.DKIMRecordName).replace(/\.$/, ''), dns.DKIMRecordValue, statusOk(check?.DKIMStatus ?? dns.DKIMStatus), check?.DKIMErrors));
|
|
225
|
+
}
|
|
226
|
+
return records;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** `GET /instances/me/mail/domain` (and every domain call's answer). Dates are ISO strings on the wire. */
|
|
230
|
+
export interface MailDomainAnswer {
|
|
231
|
+
/** the owner's chosen sending address on its domain — `shop@alma.co.il`; null when none is set */
|
|
232
|
+
address: string | null;
|
|
233
|
+
domain: string | null;
|
|
234
|
+
state: MailDomainState;
|
|
235
|
+
records: MailDnsRecord[];
|
|
236
|
+
problems: MailSenderProblem[];
|
|
237
|
+
/** when Mailjet last checked the records */
|
|
238
|
+
checkedAt: string | null;
|
|
239
|
+
/** when the domain was first found verified */
|
|
240
|
+
verifiedAt: string | null;
|
|
241
|
+
/** set when a domain that WAS verified failed a later check — the From went back to `mail.iox.studio` */
|
|
242
|
+
lostAt: string | null;
|
|
243
|
+
/**
|
|
244
|
+
* The studio's IOX address (`<studio>@mail.iox.studio`) — where mail goes whenever the own domain does not send, so
|
|
245
|
+
* the screen can say it even while the domain is verified (when both Froms are the own address). Absent from a relay
|
|
246
|
+
* older than this field.
|
|
247
|
+
*/
|
|
248
|
+
ioxAddress?: string | null;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** iox-cms's answer to Settings ▸ Email (`…/connectors/mailer/domain`): the relay's, plus who may change it. */
|
|
252
|
+
export interface MailDomainView extends MailDomainAnswer {
|
|
253
|
+
/** the signed-in person may set or stop using the address — the INSTANCE owner (ML4-D2); admins read and Check DNS */
|
|
254
|
+
mayChange: boolean;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* A verified domain that a later check failed (ML4-D5): mail went back to the IOX address. THE rule for the bell's
|
|
259
|
+
* "Your own email domain stopped working" and the card's "DNS changed" — `lostAt` stays until it is verified again.
|
|
260
|
+
*/
|
|
261
|
+
export function mailDomainLost(answer: Pick<MailDomainAnswer, 'state' | 'lostAt'> | null | undefined): boolean {
|
|
262
|
+
return !!answer?.lostAt && answer.state !== MailDomainState.Verified;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** No own domain. */
|
|
266
|
+
export const NO_MAIL_DOMAIN: MailDomainAnswer = Object.freeze({
|
|
267
|
+
address: null, domain: null, state: MailDomainState.NotSet, records: [], problems: [], checkedAt: null, verifiedAt: null, lostAt: null,
|
|
268
|
+
}) as MailDomainAnswer;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* THE state rule: verified when nothing is wrong; waiting while nothing was checked yet (or Mailjet is checking now);
|
|
272
|
+
* failed once a check found a record missing or wrong.
|
|
273
|
+
*/
|
|
274
|
+
export function mailDomainState(problems: readonly MailSenderProblem[], checked: boolean, inProgress = false): MailDomainState {
|
|
275
|
+
if (!problems.length) return MailDomainState.Verified;
|
|
276
|
+
if (inProgress || !checked) return MailDomainState.Waiting;
|
|
277
|
+
return MailDomainState.Failed;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** May mail go from this domain now? Only a verified answer for exactly this address's domain (R-ML3). */
|
|
281
|
+
export function mailDomainSends(answer: Pick<MailDomainAnswer, 'state' | 'address'> | null | undefined): string | null {
|
|
282
|
+
return answer?.state === MailDomainState.Verified && answer.address ? answer.address.trim().toLowerCase() : null;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** Is a verified domain due its daily recheck? */
|
|
286
|
+
export function mailDomainRecheckDue(answer: Pick<MailDomainAnswer, 'state' | 'checkedAt'> | null | undefined, now: number): boolean {
|
|
287
|
+
if (answer?.state !== MailDomainState.Verified) return false;
|
|
288
|
+
const at = answer.checkedAt ? Date.parse(answer.checkedAt) : NaN;
|
|
289
|
+
return !Number.isFinite(at) || now - at >= MAIL_DOMAIN_RECHECK_MS;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** The relay's own-domain routes. */
|
|
293
|
+
export const RELAY_MAIL_DOMAIN_PATH = '/instances/me/mail/domain';
|
|
294
|
+
export const RELAY_MAIL_DOMAIN_CHECK_PATH = '/instances/me/mail/domain/check';
|
|
295
|
+
|
|
296
|
+
/** `PUT /instances/me/mail/domain` — the address mail should come from. */
|
|
297
|
+
export interface RelayDomainRequest {
|
|
298
|
+
address: string;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** A refused domain call: `{ code, message }` with 400 (`not-an-address` · `platform-domain` · `public-mailbox`), 409 (`taken`), 403/503 (`not-enabled`), 502 (`upstream`). */
|
|
302
|
+
export interface RelayDomainRefusalBody {
|
|
303
|
+
code: MailDomainRefusal;
|
|
304
|
+
message: string;
|
|
305
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MailKind, MailMode, MailRefusal, MailResultStatus, MailSenderState, MarketingPauseReason } from './mail-vocabulary';
|
|
2
2
|
import type { MailRoute } from './mail-route';
|
|
3
3
|
import type { MailStanding } from './mail-standing';
|
|
4
|
+
import type { MailDomainAnswer } from './mail-domain';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* The relay's wire (iox-control-plane `src/mail/`, its `openapi.json` tag `instances`). The studio calls back with its
|
|
@@ -89,6 +90,11 @@ export interface RelayUsage {
|
|
|
89
90
|
marketingPaused: { at: string; reason: MarketingPauseReason | string } | null;
|
|
90
91
|
/** where the studio's owner changes its plan (the portal's studio page); absent/null = nowhere to send them */
|
|
91
92
|
upgradeUrl?: string | null;
|
|
93
|
+
/**
|
|
94
|
+
* The studio's own sending domain (ML4) — absent from a relay older than ML4. While it is verified, both Froms above
|
|
95
|
+
* are its address (`mailDomainSends`).
|
|
96
|
+
*/
|
|
97
|
+
domain?: MailDomainAnswer | null;
|
|
92
98
|
}
|
|
93
99
|
|
|
94
100
|
export interface RelayResponse {
|
|
@@ -126,6 +132,8 @@ export interface MailerDetails {
|
|
|
126
132
|
/** this studio's emails refused for good in the last seven days (the outbox's own count) */
|
|
127
133
|
notSentThisWeek?: number;
|
|
128
134
|
upgradeUrl?: string | null;
|
|
135
|
+
/** IOX mode only: the own sending domain (ML4) — `NO_MAIL_DOMAIN` when none is set */
|
|
136
|
+
domain?: MailDomainAnswer | null;
|
|
129
137
|
}
|
|
130
138
|
|
|
131
139
|
/** At most this many test emails an hour, per studio (ML3-D3) — each counts against the month like any email. */
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* studio's own active mailer wins, else IOX mail when the plan has it. The control plane (the relay), iox-cms (the
|
|
5
5
|
* transport and the MAILER connector) and the admin (Settings ▸ Email, ML3) speak it — and ML3 adds the ONE reading
|
|
6
6
|
* of a studio's month (`mailStandingOf`: low at 80%, full, the 2× ceiling, paused, off), the connector's `MailerDetails`,
|
|
7
|
-
* the Reply-To check and the test email's answer
|
|
7
|
+
* the Reply-To check and the test email's answer; ML4 the studio's own sending domain (`mail-domain`: ONE judge of
|
|
8
|
+
* Mailjet's sender + DNS answers, the records to copy, the state rule). It imports nothing.
|
|
8
9
|
* ⚠️ Not re-exported from the main entry. Consumers wire the usual trio — ng-package raw-ts assets, jest
|
|
9
10
|
* moduleNameMapper, tsconfig paths — or `nest start` dies with ERR_REQUIRE_ESM.
|
|
10
11
|
*/
|
|
@@ -12,3 +13,4 @@ export * from './mail-vocabulary';
|
|
|
12
13
|
export * from './mail-wire';
|
|
13
14
|
export * from './mail-route';
|
|
14
15
|
export * from './mail-standing';
|
|
16
|
+
export * from './mail-domain';
|
package/styles/iox-design.css
CHANGED
|
@@ -393,7 +393,8 @@ dialog[data-iox-dialog].iox-es[data-iox-dialog-placement='start'] {
|
|
|
393
393
|
· entering (`@starting-style`) and leaving (`data-iox-closing`, set by actions-core `closeDialogAnimated`
|
|
394
394
|
for the whole exit, and `:not([open])` for a browser that closes it natively) — the drawer off its edge,
|
|
395
395
|
any other placement faded 12px toward where it sits, the scrim clear.
|
|
396
|
-
Entering
|
|
396
|
+
Entering lands on the look's arrival (ease-enter) and leaving on its leave (ease-exit — a fast ease-out on every
|
|
397
|
+
look since AW3, Motion board MB-D1: a leave never eases in), arriving over dur-base and leaving in half of it (AW4) — the look's motion
|
|
397
398
|
tokens, which the reduced-motion token block collapses to 0ms: under reduced motion it simply appears and
|
|
398
399
|
goes. `overlay`/`display` allow-discrete keep a natively closed dialog in the top layer for its exit. */
|
|
399
400
|
dialog[data-iox-dialog].iox-es {
|
|
@@ -420,6 +421,8 @@ dialog[data-iox-dialog].iox-es:is([data-iox-closing], :not([open])) {
|
|
|
420
421
|
translate: var(--dialog-exit-x) var(--dialog-exit-y);
|
|
421
422
|
opacity: var(--dialog-exit-opacity);
|
|
422
423
|
transition-timing-function: var(--iox-ease-exit);
|
|
424
|
+
/* AW4 (MB-D1, the contract's leaveShare 0.5): a leave takes half its entrance's time — Emil: exits faster. */
|
|
425
|
+
transition-duration: calc(var(--iox-dur-base) * 0.5);
|
|
423
426
|
}
|
|
424
427
|
@starting-style {
|
|
425
428
|
dialog[data-iox-dialog].iox-es[open] {
|
|
@@ -436,6 +439,7 @@ dialog[data-iox-dialog].iox-es::backdrop {
|
|
|
436
439
|
dialog[data-iox-dialog].iox-es:is([data-iox-closing], :not([open]))::backdrop {
|
|
437
440
|
opacity: 0;
|
|
438
441
|
transition-timing-function: var(--iox-ease-exit);
|
|
442
|
+
transition-duration: calc(var(--iox-dur-base) * 0.5);
|
|
439
443
|
}
|
|
440
444
|
@starting-style {
|
|
441
445
|
dialog[data-iox-dialog].iox-es[open]::backdrop { opacity: 0; }
|
|
@@ -480,6 +484,31 @@ dialog[data-iox-dialog]:has(> .iox-dialog-close),
|
|
|
480
484
|
--iox-link-underline-rest: 0;
|
|
481
485
|
}
|
|
482
486
|
|
|
487
|
+
/* vectoriox/iox-ui#98 — a header on a PHONE is one row, and its name is held whole on one or two lines. The controls (the
|
|
488
|
+
menu button, the bag, the account, a pinned page, the cells holding them) keep their size and sit at half the look's gap;
|
|
489
|
+
the name takes the room the hidden pages leave and wraps balanced, a word too long for the room breaking rather than
|
|
490
|
+
running under a control; a long name (design-core `brandNameAttributes` — `data-iox-name`) steps down the look's own
|
|
491
|
+
type scale: `size-lead`, then `size-body`. Nothing is cut off, so nothing is hidden from a visitor. Two classes, so it
|
|
492
|
+
holds over the parts' own rules (one class each); the canvas sizes by its frame (`@container iox-canvas`). */
|
|
493
|
+
@media (max-width: 767px) {
|
|
494
|
+
.iox-es.iox-role-nav { column-gap: calc(var(--iox-space-gap) / 2); }
|
|
495
|
+
.iox-role-nav .iox-role-nav-cell { min-width: auto; column-gap: calc(var(--iox-space-gap) / 2); }
|
|
496
|
+
.iox-role-nav :is(.iox-role-nav-menu-button, .iox-role-shop-cart-button, .iox-role-account, .iox-role-nav-pinned, .iox-role-nav-actions, .iox-role-nav-cell) { flex-shrink: 0; }
|
|
497
|
+
.iox-role-nav .iox-role-nav-brand { min-width: 0; }
|
|
498
|
+
.iox-role-nav .iox-role-nav-brand :is(h1, h2, h3, h4, h5, h6, p) { text-wrap: balance; overflow-wrap: break-word; }
|
|
499
|
+
.iox-role-nav .iox-role-nav-brand[data-iox-name='long'] :is(h1, h2, h3, h4, h5, h6, p) { font-size: var(--iox-size-lead); }
|
|
500
|
+
.iox-role-nav .iox-role-nav-brand[data-iox-name='longer'] :is(h1, h2, h3, h4, h5, h6, p) { font-size: var(--iox-size-body); }
|
|
501
|
+
}
|
|
502
|
+
@container iox-canvas (max-width: 767px) {
|
|
503
|
+
.iox-es.iox-role-nav { column-gap: calc(var(--iox-space-gap) / 2); }
|
|
504
|
+
.iox-role-nav .iox-role-nav-cell { min-width: auto; column-gap: calc(var(--iox-space-gap) / 2); }
|
|
505
|
+
.iox-role-nav :is(.iox-role-nav-menu-button, .iox-role-shop-cart-button, .iox-role-account, .iox-role-nav-pinned, .iox-role-nav-actions, .iox-role-nav-cell) { flex-shrink: 0; }
|
|
506
|
+
.iox-role-nav .iox-role-nav-brand { min-width: 0; }
|
|
507
|
+
.iox-role-nav .iox-role-nav-brand :is(h1, h2, h3, h4, h5, h6, p) { text-wrap: balance; overflow-wrap: break-word; }
|
|
508
|
+
.iox-role-nav .iox-role-nav-brand[data-iox-name='long'] :is(h1, h2, h3, h4, h5, h6, p) { font-size: var(--iox-size-lead); }
|
|
509
|
+
.iox-role-nav .iox-role-nav-brand[data-iox-name='longer'] :is(h1, h2, h3, h4, h5, h6, p) { font-size: var(--iox-size-body); }
|
|
510
|
+
}
|
|
511
|
+
|
|
483
512
|
/* ── Header ingredients HI2a: the MENU's forms, reveals, buttons and hover (header-builder board v2, HB-D1/HB-D2) ─────────
|
|
484
513
|
A menu is the navigation's drawer Dialog wearing design-core `menuDialogAttributes`; its button and its Close wear
|
|
485
514
|
`menuButtonAttributes`. A menu with none of them is the drawer it always was (R-H4). Board 2: only transform, opacity,
|