@vectoriox/iox-ui 5.132.0 → 5.134.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 +44 -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 +118 -62
- 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 +13974 -12036
- 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 +288 -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 +1419 -379
- package/harness-core/index.d.ts +6 -1
- package/index.d.ts +139 -10
- package/mail-core/index.d.ts +315 -39
- 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/consent.ts +6 -2
- package/src/composite-core/shop-runtime.ts +47 -3
- package/src/composite-core/shop.ts +76 -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 +20 -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-standing.ts +58 -0
- package/src/mail-core/mail-vocabulary.ts +3 -0
- package/src/mail-core/mail-wire.ts +70 -1
- package/src/mail-core/public-api.ts +6 -1
- package/styles/iox-design.css +44 -2
package/mail-core/index.d.ts
CHANGED
|
@@ -30,7 +30,9 @@ declare enum MailSender {
|
|
|
30
30
|
/** a form's "email me" delivery to the owner */
|
|
31
31
|
FormDelivery = "form-delivery",
|
|
32
32
|
/** the `sendEmail` element action — to the author's fixed address */
|
|
33
|
-
SendEmailAction = "send-email-action"
|
|
33
|
+
SendEmailAction = "send-email-action",
|
|
34
|
+
/** Settings ▸ Email ▸ Send a test email — to the signed-in person's own address only (ML3-D3) */
|
|
35
|
+
TestEmail = "test-email"
|
|
34
36
|
}
|
|
35
37
|
/** ONE table: what kind of mail each sender sends (R-ML1). Only reminders are marketing. */
|
|
36
38
|
declare const MAIL_KIND_OF_SENDER: Readonly<Record<MailSender, MailKind>>;
|
|
@@ -96,6 +98,258 @@ declare enum MailSenderState {
|
|
|
96
98
|
NotEnabled = "not-enabled"
|
|
97
99
|
}
|
|
98
100
|
|
|
101
|
+
/** The studio's own Mailjet keys — the three an own mailer needs (the MAILER connector's `requiredKeys`, ML-D9). */
|
|
102
|
+
declare const OWN_MAILER_KEYS: readonly string[];
|
|
103
|
+
/** Where one org's mail goes now. */
|
|
104
|
+
declare enum MailRoute {
|
|
105
|
+
/** its own active mailer row — ML-D8: own wins */
|
|
106
|
+
Own = "own",
|
|
107
|
+
/** IOX's relay */
|
|
108
|
+
Iox = "iox",
|
|
109
|
+
/** nowhere: no usable own row and no IOX mail in the plan */
|
|
110
|
+
None = "none"
|
|
111
|
+
}
|
|
112
|
+
/** A mailer row's settings, as the route reads them (decrypted; only presence is read). */
|
|
113
|
+
interface MailerRowLike {
|
|
114
|
+
mode?: unknown;
|
|
115
|
+
publicKey?: unknown;
|
|
116
|
+
secretKey?: unknown;
|
|
117
|
+
originatorEmail?: unknown;
|
|
118
|
+
}
|
|
119
|
+
/** True when the row holds every key an own mailer needs. */
|
|
120
|
+
declare function hasOwnMailerKeys(row: MailerRowLike | null | undefined): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* A row's mode (ML-D9): the one it names; a row that names none is `own` when it holds its keys (every row stored
|
|
123
|
+
* before IOX mail — its owner brought Mailjet), else `iox`. No row at all is `iox`.
|
|
124
|
+
*/
|
|
125
|
+
declare function mailModeOf(row: MailerRowLike | null | undefined): MailMode;
|
|
126
|
+
/** The keys a row needs to count as configured: its own keys in own mode, none in IOX mode (E1). */
|
|
127
|
+
declare function requiredMailerKeys(row: MailerRowLike | null | undefined): string[];
|
|
128
|
+
interface MailRouteFacts {
|
|
129
|
+
/** the org's ACTIVE mailer row, decrypted — null when it has none (or none is on) */
|
|
130
|
+
activeRow: MailerRowLike | null;
|
|
131
|
+
/** the plan has IOX mail (`features.ioxMail`) */
|
|
132
|
+
ioxMail: boolean;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* THE route rule (ML-D8, R-ML1): an active row in own mode with its keys sends as today; anything else — no row, a row
|
|
136
|
+
* turned off, a row set to IOX, a row still missing a key — goes through IOX mail when the plan has it, else nowhere.
|
|
137
|
+
*/
|
|
138
|
+
declare function planMailRoute(facts: MailRouteFacts): MailRoute;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Where a studio's IOX mail stands this month (iox-mail-plan ML-D5, the ML3 board's E2). ONE reading of the relay's
|
|
142
|
+
* usage: the admin's pill, meter and note, System Health, Home and the bell (iox-cms's reconciler) all ask this — none
|
|
143
|
+
* of them compares counts with a quota on its own.
|
|
144
|
+
*/
|
|
145
|
+
declare enum MailStanding {
|
|
146
|
+
/** sending, under 80% of the month */
|
|
147
|
+
Healthy = "healthy",
|
|
148
|
+
/** 80% of the month's emails used — reminders still go */
|
|
149
|
+
Low = "low",
|
|
150
|
+
/** the month's emails used: reminders are paused, receipts and codes continue up to twice the month */
|
|
151
|
+
Full = "full",
|
|
152
|
+
/** twice the month's emails sent: nothing more goes until the month resets */
|
|
153
|
+
Ceiling = "ceiling",
|
|
154
|
+
/** reminders paused by complaints, bounces or the operator (ML-D7) — receipts and codes unaffected */
|
|
155
|
+
Paused = "paused",
|
|
156
|
+
/** IOX mail does not send for this studio: the relay never answered, holds no key, or the plan has none */
|
|
157
|
+
Off = "off"
|
|
158
|
+
}
|
|
159
|
+
/** The meter turns low — and the bell says so — once this share of the month is used (ML3-D2). */
|
|
160
|
+
declare const MAIL_LOW_SHARE = 0.8;
|
|
161
|
+
/** The month's emails used so far (both kinds — what the quota counts). */
|
|
162
|
+
declare function mailEmailsUsed(usage: RelayUsage | null | undefined): number;
|
|
163
|
+
/** Emails left this month before reminders pause; null = unlimited (or no usage). */
|
|
164
|
+
declare function mailEmailsLeft(usage: RelayUsage | null | undefined): number | null;
|
|
165
|
+
/** THE standing rule. The worst line crossed wins: off → ceiling → full → paused → low → healthy. */
|
|
166
|
+
declare function mailStandingOf(usage: RelayUsage | null | undefined): MailStanding;
|
|
167
|
+
/** Reminders do not go in this standing (receipts and codes still do, except at the ceiling). */
|
|
168
|
+
declare function remindersStopped(standing: MailStanding): boolean;
|
|
169
|
+
/** A plain address a Reply-To may carry (`name@domain.tld`), trimmed — the admin's field and iox-cms's save both ask it. */
|
|
170
|
+
declare function isMailAddress(value: unknown): boolean;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 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
|
|
174
|
+
* DNS records Mailjet gives, and IOX mail switches the From to that address only once Mailjet says the sender is active
|
|
175
|
+
* AND SPF AND DKIM are ok — never before, and back to `mail.iox.studio` the moment a recheck finds a record gone.
|
|
176
|
+
*
|
|
177
|
+
* ONE judge of Mailjet's `sender` + `dns` answers (`mailSenderProblems`), used by the relay for an IOX-mail domain and by
|
|
178
|
+
* iox-cms for a studio's own Mailjet key (commerce E4's sender check) — the two used to be one private copy each.
|
|
179
|
+
*/
|
|
180
|
+
/** Where a studio's own sending domain stands — what Settings ▸ Email ▸ "Send from my own domain" shows. */
|
|
181
|
+
declare enum MailDomainState {
|
|
182
|
+
/** no own domain — mail goes from `<studio>@mail.iox.studio` */
|
|
183
|
+
NotSet = "not-set",
|
|
184
|
+
/** named; Mailjet has not checked its records yet (never asked, or a check is running) */
|
|
185
|
+
Waiting = "waiting",
|
|
186
|
+
/** the sender is active and SPF + DKIM are ok — mail goes from the studio's own address */
|
|
187
|
+
Verified = "verified",
|
|
188
|
+
/** checked, and a record is missing or wrong — mail keeps going from `mail.iox.studio` */
|
|
189
|
+
Failed = "failed"
|
|
190
|
+
}
|
|
191
|
+
/** Why a sender is not verified — Mailjet's answers read (the values are commerce E4's, unchanged on the wire). */
|
|
192
|
+
declare enum MailSenderProblem {
|
|
193
|
+
/** no sender address at all */
|
|
194
|
+
NoAddress = "no-address",
|
|
195
|
+
/** Mailjet does not know the address as a sender, or has not activated it (the ownership record) */
|
|
196
|
+
SenderInactive = "sender-inactive",
|
|
197
|
+
/** the address's domain is not added to Mailjet */
|
|
198
|
+
DomainMissing = "domain-missing",
|
|
199
|
+
SpfMissing = "spf-missing",
|
|
200
|
+
DkimMissing = "dkim-missing"
|
|
201
|
+
}
|
|
202
|
+
/** The three records a domain needs — each one TXT. */
|
|
203
|
+
declare enum MailDnsRecordRole {
|
|
204
|
+
/** proves the domain is the studio's: Mailjet's ownership token */
|
|
205
|
+
Ownership = "ownership",
|
|
206
|
+
/** lets Mailjet's servers send for the domain */
|
|
207
|
+
Spf = "spf",
|
|
208
|
+
/** signs every message with the domain's key */
|
|
209
|
+
Dkim = "dkim"
|
|
210
|
+
}
|
|
211
|
+
/** One record to copy into the domain's DNS. */
|
|
212
|
+
interface MailDnsRecord {
|
|
213
|
+
role: MailDnsRecordRole;
|
|
214
|
+
type: 'TXT';
|
|
215
|
+
/** the full name — `mailjet._domainkey.alma.co.il` */
|
|
216
|
+
name: string;
|
|
217
|
+
/** the name as most DNS screens want it, relative to the domain (`mailjet._domainkey`; `@` for the domain itself) */
|
|
218
|
+
host: string;
|
|
219
|
+
value: string;
|
|
220
|
+
/** Mailjet's last word on it: true ok · false wrong or missing · null not checked yet */
|
|
221
|
+
ok: boolean | null;
|
|
222
|
+
/** what Mailjet found wrong, in its words (bounded) */
|
|
223
|
+
error?: string | null;
|
|
224
|
+
}
|
|
225
|
+
/** Why an address cannot become the studio's sending address. */
|
|
226
|
+
declare enum MailDomainRefusal {
|
|
227
|
+
/** not one plain address */
|
|
228
|
+
NotAnAddress = "not-an-address",
|
|
229
|
+
/** `iox.studio` or any domain under it — IOX's own */
|
|
230
|
+
PlatformDomain = "platform-domain",
|
|
231
|
+
/** a public mailbox (gmail.com, outlook.com…) — nobody but its provider can add records there */
|
|
232
|
+
PublicMailbox = "public-mailbox",
|
|
233
|
+
/** another studio sends from this domain */
|
|
234
|
+
Taken = "taken",
|
|
235
|
+
/** IOX mail is not on (no key, or the plan has none) */
|
|
236
|
+
NotEnabled = "not-enabled",
|
|
237
|
+
/** Mailjet could not be asked — try again */
|
|
238
|
+
Upstream = "upstream"
|
|
239
|
+
}
|
|
240
|
+
/** Mailjet's sender row (v3 REST `sender`) — only what is read. */
|
|
241
|
+
interface MailjetSenderRow {
|
|
242
|
+
ID?: number;
|
|
243
|
+
Email?: string;
|
|
244
|
+
/** `Inactive` · `Active` · `Deleted` */
|
|
245
|
+
Status?: string;
|
|
246
|
+
/** -1 while inactive */
|
|
247
|
+
DNSID?: number;
|
|
248
|
+
}
|
|
249
|
+
/** Mailjet's DNS row (v3 REST `dns/{id}`). Statuses: SPF `OK` · `Error` · `Not checked` · `Not found`; DKIM `OK` · `Error` · `Not checked`. */
|
|
250
|
+
interface MailjetDnsRow {
|
|
251
|
+
ID?: number;
|
|
252
|
+
Domain?: string;
|
|
253
|
+
SPFStatus?: string;
|
|
254
|
+
SPFRecordValue?: string;
|
|
255
|
+
DKIMStatus?: string;
|
|
256
|
+
DKIMRecordName?: string;
|
|
257
|
+
DKIMRecordValue?: string;
|
|
258
|
+
OwnerShipToken?: string;
|
|
259
|
+
OwnerShipTokenRecordName?: string;
|
|
260
|
+
IsCheckInProgress?: boolean;
|
|
261
|
+
LastCheckAt?: string;
|
|
262
|
+
}
|
|
263
|
+
/** Mailjet's `dns/{id}/check` answer — `OK` · `Error`, with its words. */
|
|
264
|
+
interface MailjetDnsCheckRow {
|
|
265
|
+
SPFStatus?: string;
|
|
266
|
+
SPFErrors?: string;
|
|
267
|
+
DKIMStatus?: string;
|
|
268
|
+
DKIMErrors?: string;
|
|
269
|
+
}
|
|
270
|
+
/** Mailjet's SPF include — merged into a domain's existing SPF record, never a second record beside it. */
|
|
271
|
+
declare const MAILJET_SPF_INCLUDE = "include:spf.mailjet.com";
|
|
272
|
+
/** How often the owner's "Check DNS" really asks Mailjet; a sooner press answers the last check. */
|
|
273
|
+
declare const MAIL_DOMAIN_CHECK_MIN_MS = 30000;
|
|
274
|
+
/** A verified domain is checked again this often — a removed record moves the From back to `mail.iox.studio`. */
|
|
275
|
+
declare const MAIL_DOMAIN_RECHECK_MS: number;
|
|
276
|
+
/** Domains IOX itself sends from — never a studio's own. */
|
|
277
|
+
declare const PLATFORM_MAIL_DOMAINS: readonly string[];
|
|
278
|
+
/** Public mailbox providers: an address there can never be verified by the studio (no access to the DNS). */
|
|
279
|
+
declare const PUBLIC_MAILBOX_DOMAINS: readonly string[];
|
|
280
|
+
/** The lower-cased domain of an address, or null. */
|
|
281
|
+
declare function mailDomainOf(email: string | null | undefined): string | null;
|
|
282
|
+
/** Why this address cannot be the studio's own sending address — null when it can (the relay adds `Taken`). */
|
|
283
|
+
declare function ownAddressRefusal(address: unknown, platformDomains?: readonly string[]): MailDomainRefusal | null;
|
|
284
|
+
/**
|
|
285
|
+
* THE judge of Mailjet's answers for one address: verified only with an active sender AND SPF ok AND DKIM ok.
|
|
286
|
+
* An empty list is verified. (commerce E4's sender check and the relay's own-domain check both ask this.)
|
|
287
|
+
*/
|
|
288
|
+
declare function mailSenderProblems(email: string | null, sender: MailjetSenderRow | null, dns: MailjetDnsRow | null): MailSenderProblem[];
|
|
289
|
+
/** A record's name relative to its domain — `@` for the domain itself. */
|
|
290
|
+
declare function relativeDnsHost(name: string | null | undefined, domain: string): string;
|
|
291
|
+
/**
|
|
292
|
+
* The SPF record to publish: the domain's existing `v=spf1` record with Mailjet's include added before its `all` term
|
|
293
|
+
* (a domain may hold only ONE SPF record — a second one fails both), or Mailjet's own value when there is none.
|
|
294
|
+
*/
|
|
295
|
+
declare function mergedSpf(existing: string | null | undefined, mailjetValue?: string): string;
|
|
296
|
+
/** The three records to copy, each with Mailjet's last word on it. `existingSpf` = the domain's own SPF, when read. */
|
|
297
|
+
declare function mailDnsRecords(domain: string, sender: MailjetSenderRow | null, dns: MailjetDnsRow | null, check?: MailjetDnsCheckRow | null, existingSpf?: string | null): MailDnsRecord[];
|
|
298
|
+
/** `GET /instances/me/mail/domain` (and every domain call's answer). Dates are ISO strings on the wire. */
|
|
299
|
+
interface MailDomainAnswer {
|
|
300
|
+
/** the owner's chosen sending address on its domain — `shop@alma.co.il`; null when none is set */
|
|
301
|
+
address: string | null;
|
|
302
|
+
domain: string | null;
|
|
303
|
+
state: MailDomainState;
|
|
304
|
+
records: MailDnsRecord[];
|
|
305
|
+
problems: MailSenderProblem[];
|
|
306
|
+
/** when Mailjet last checked the records */
|
|
307
|
+
checkedAt: string | null;
|
|
308
|
+
/** when the domain was first found verified */
|
|
309
|
+
verifiedAt: string | null;
|
|
310
|
+
/** set when a domain that WAS verified failed a later check — the From went back to `mail.iox.studio` */
|
|
311
|
+
lostAt: string | null;
|
|
312
|
+
/**
|
|
313
|
+
* The studio's IOX address (`<studio>@mail.iox.studio`) — where mail goes whenever the own domain does not send, so
|
|
314
|
+
* the screen can say it even while the domain is verified (when both Froms are the own address). Absent from a relay
|
|
315
|
+
* older than this field.
|
|
316
|
+
*/
|
|
317
|
+
ioxAddress?: string | null;
|
|
318
|
+
}
|
|
319
|
+
/** iox-cms's answer to Settings ▸ Email (`…/connectors/mailer/domain`): the relay's, plus who may change it. */
|
|
320
|
+
interface MailDomainView extends MailDomainAnswer {
|
|
321
|
+
/** the signed-in person may set or stop using the address — the INSTANCE owner (ML4-D2); admins read and Check DNS */
|
|
322
|
+
mayChange: boolean;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* A verified domain that a later check failed (ML4-D5): mail went back to the IOX address. THE rule for the bell's
|
|
326
|
+
* "Your own email domain stopped working" and the card's "DNS changed" — `lostAt` stays until it is verified again.
|
|
327
|
+
*/
|
|
328
|
+
declare function mailDomainLost(answer: Pick<MailDomainAnswer, 'state' | 'lostAt'> | null | undefined): boolean;
|
|
329
|
+
/** No own domain. */
|
|
330
|
+
declare const NO_MAIL_DOMAIN: MailDomainAnswer;
|
|
331
|
+
/**
|
|
332
|
+
* THE state rule: verified when nothing is wrong; waiting while nothing was checked yet (or Mailjet is checking now);
|
|
333
|
+
* failed once a check found a record missing or wrong.
|
|
334
|
+
*/
|
|
335
|
+
declare function mailDomainState(problems: readonly MailSenderProblem[], checked: boolean, inProgress?: boolean): MailDomainState;
|
|
336
|
+
/** May mail go from this domain now? Only a verified answer for exactly this address's domain (R-ML3). */
|
|
337
|
+
declare function mailDomainSends(answer: Pick<MailDomainAnswer, 'state' | 'address'> | null | undefined): string | null;
|
|
338
|
+
/** Is a verified domain due its daily recheck? */
|
|
339
|
+
declare function mailDomainRecheckDue(answer: Pick<MailDomainAnswer, 'state' | 'checkedAt'> | null | undefined, now: number): boolean;
|
|
340
|
+
/** The relay's own-domain routes. */
|
|
341
|
+
declare const RELAY_MAIL_DOMAIN_PATH = "/instances/me/mail/domain";
|
|
342
|
+
declare const RELAY_MAIL_DOMAIN_CHECK_PATH = "/instances/me/mail/domain/check";
|
|
343
|
+
/** `PUT /instances/me/mail/domain` — the address mail should come from. */
|
|
344
|
+
interface RelayDomainRequest {
|
|
345
|
+
address: string;
|
|
346
|
+
}
|
|
347
|
+
/** A refused domain call: `{ code, message }` with 400 (`not-an-address` · `platform-domain` · `public-mailbox`), 409 (`taken`), 403/503 (`not-enabled`), 502 (`upstream`). */
|
|
348
|
+
interface RelayDomainRefusalBody {
|
|
349
|
+
code: MailDomainRefusal;
|
|
350
|
+
message: string;
|
|
351
|
+
}
|
|
352
|
+
|
|
99
353
|
/**
|
|
100
354
|
* The relay's wire (iox-control-plane `src/mail/`, its `openapi.json` tag `instances`). The studio calls back with its
|
|
101
355
|
* instance token: `Authorization: Bearer <INSTANCE_TOKEN>`.
|
|
@@ -182,50 +436,72 @@ interface RelayUsage {
|
|
|
182
436
|
at: string;
|
|
183
437
|
reason: MarketingPauseReason | string;
|
|
184
438
|
} | null;
|
|
439
|
+
/** where the studio's owner changes its plan (the portal's studio page); absent/null = nowhere to send them */
|
|
440
|
+
upgradeUrl?: string | null;
|
|
441
|
+
/**
|
|
442
|
+
* The studio's own sending domain (ML4) — absent from a relay older than ML4. While it is verified, both Froms above
|
|
443
|
+
* are its address (`mailDomainSends`).
|
|
444
|
+
*/
|
|
445
|
+
domain?: MailDomainAnswer | null;
|
|
185
446
|
}
|
|
186
447
|
interface RelayResponse {
|
|
187
448
|
results: RelayResult[];
|
|
188
449
|
usage: RelayUsage;
|
|
189
450
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
declare const OWN_MAILER_KEYS: readonly string[];
|
|
193
|
-
/** Where one org's mail goes now. */
|
|
194
|
-
declare enum MailRoute {
|
|
195
|
-
/** its own active mailer row — ML-D8: own wins */
|
|
196
|
-
Own = "own",
|
|
197
|
-
/** IOX's relay */
|
|
198
|
-
Iox = "iox",
|
|
199
|
-
/** nowhere: no usable own row and no IOX mail in the plan */
|
|
200
|
-
None = "none"
|
|
201
|
-
}
|
|
202
|
-
/** A mailer row's settings, as the route reads them (decrypted; only presence is read). */
|
|
203
|
-
interface MailerRowLike {
|
|
204
|
-
mode?: unknown;
|
|
205
|
-
publicKey?: unknown;
|
|
206
|
-
secretKey?: unknown;
|
|
207
|
-
originatorEmail?: unknown;
|
|
208
|
-
}
|
|
209
|
-
/** True when the row holds every key an own mailer needs. */
|
|
210
|
-
declare function hasOwnMailerKeys(row: MailerRowLike | null | undefined): boolean;
|
|
451
|
+
/** The mailer row's Reply-To (ML3-D1) — absent/blank = the relay's default, the studio's owner. */
|
|
452
|
+
declare const MAILER_REPLY_TO_KEY = "replyTo";
|
|
211
453
|
/**
|
|
212
|
-
*
|
|
213
|
-
*
|
|
454
|
+
* What the MAILER connector reports about itself (its E3 `details`), read by Settings ▸ Email, System Health and Home
|
|
455
|
+
* (iox-mail-plan ML3). Never a key. Own mode carries `mode` alone (plus what Mailjet's check found).
|
|
214
456
|
*/
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
457
|
+
interface MailerDetails {
|
|
458
|
+
mode: MailMode;
|
|
459
|
+
/** IOX mode only: `mailStandingOf(usage)` */
|
|
460
|
+
standing?: MailStanding;
|
|
461
|
+
senderState?: MailSenderState;
|
|
462
|
+
/** the transactional From — `<studio>@mail.iox.studio` */
|
|
463
|
+
from?: string | null;
|
|
464
|
+
/** the reminders' From — `<studio>@news.mail.iox.studio` */
|
|
465
|
+
marketingFrom?: string | null;
|
|
466
|
+
/** where replies go now: the row's `replyTo`, else the relay's default (the owner) */
|
|
467
|
+
replyTo?: string | null;
|
|
468
|
+
/** the row's own Reply-To, as typed — null when it uses the default */
|
|
469
|
+
replyToSet?: string | null;
|
|
470
|
+
quota?: number | null;
|
|
471
|
+
ceiling?: number | null;
|
|
472
|
+
periodStart?: string | null;
|
|
473
|
+
periodEnd?: string | null;
|
|
474
|
+
month?: RelayMonth | null;
|
|
475
|
+
suppressions?: number;
|
|
476
|
+
marketingPaused?: RelayUsage['marketingPaused'];
|
|
477
|
+
/** this studio's emails refused for good in the last seven days (the outbox's own count) */
|
|
478
|
+
notSentThisWeek?: number;
|
|
479
|
+
upgradeUrl?: string | null;
|
|
480
|
+
/** IOX mode only: the own sending domain (ML4) — `NO_MAIL_DOMAIN` when none is set */
|
|
481
|
+
domain?: MailDomainAnswer | null;
|
|
482
|
+
}
|
|
483
|
+
/** At most this many test emails an hour, per studio (ML3-D3) — each counts against the month like any email. */
|
|
484
|
+
declare const MAIL_TEST_PER_HOUR = 5;
|
|
485
|
+
/** What became of a test email. */
|
|
486
|
+
declare enum MailTestOutcome {
|
|
487
|
+
/** handed to IOX mail's relay or the studio's own Mailjet, which took it */
|
|
488
|
+
Sent = "sent",
|
|
489
|
+
/** stored in IOX mail's outbox — the relay could not take it now; it goes when it can */
|
|
490
|
+
Queued = "queued",
|
|
491
|
+
/** refused: no route, the relay's reason, Mailjet's words */
|
|
492
|
+
Refused = "refused",
|
|
493
|
+
/** this hour's test emails are used */
|
|
494
|
+
Limited = "limited"
|
|
495
|
+
}
|
|
496
|
+
/** `POST admin/api/org/:orgId/connectors/mailer/test-email` — the answer Settings ▸ Email shows in place. */
|
|
497
|
+
interface MailTestAnswer {
|
|
498
|
+
outcome: MailTestOutcome;
|
|
499
|
+
/** the signed-in person's own address — the only one a test goes to */
|
|
500
|
+
to: string;
|
|
501
|
+
route: MailRoute;
|
|
502
|
+
/** the relay's reason, or Mailjet's words — never a stack */
|
|
503
|
+
detail: string | null;
|
|
223
504
|
}
|
|
224
|
-
/**
|
|
225
|
-
* THE route rule (ML-D8, R-ML1): an active row in own mode with its keys sends as today; anything else — no row, a row
|
|
226
|
-
* turned off, a row set to IOX, a row still missing a key — goes through IOX mail when the plan has it, else nowhere.
|
|
227
|
-
*/
|
|
228
|
-
declare function planMailRoute(facts: MailRouteFacts): MailRoute;
|
|
229
505
|
|
|
230
|
-
export { MAIL_KIND_OF_SENDER, MailKind, MailMode, MailRefusal, MailRelayCode, MailResultStatus, MailRoute, MailSender, MailSenderState, MailStream, MarketingPauseReason, OWN_MAILER_KEYS, RELAY_ALLOWED_HEADERS, RELAY_MAIL_PATH, RELAY_MAIL_USAGE_PATH, RELAY_MAX_MESSAGES, RETRYABLE_REFUSALS, SuppressionReason, hasOwnMailerKeys, isRetryableRefusal, mailKindOf, mailModeOf, planMailRoute, requiredMailerKeys };
|
|
231
|
-
export type { MailRouteFacts, MailerRowLike, RelayAddress, RelayMessage, RelayMonth, RelayRequest, RelayResponse, RelayResult, RelayUsage };
|
|
506
|
+
export { MAILER_REPLY_TO_KEY, MAILJET_SPF_INCLUDE, MAIL_DOMAIN_CHECK_MIN_MS, MAIL_DOMAIN_RECHECK_MS, MAIL_KIND_OF_SENDER, MAIL_LOW_SHARE, MAIL_TEST_PER_HOUR, MailDnsRecordRole, MailDomainRefusal, MailDomainState, MailKind, MailMode, MailRefusal, MailRelayCode, MailResultStatus, MailRoute, MailSender, MailSenderProblem, MailSenderState, MailStanding, MailStream, MailTestOutcome, MarketingPauseReason, NO_MAIL_DOMAIN, OWN_MAILER_KEYS, PLATFORM_MAIL_DOMAINS, PUBLIC_MAILBOX_DOMAINS, RELAY_ALLOWED_HEADERS, RELAY_MAIL_DOMAIN_CHECK_PATH, RELAY_MAIL_DOMAIN_PATH, RELAY_MAIL_PATH, RELAY_MAIL_USAGE_PATH, RELAY_MAX_MESSAGES, RETRYABLE_REFUSALS, SuppressionReason, hasOwnMailerKeys, isMailAddress, isRetryableRefusal, mailDnsRecords, mailDomainLost, mailDomainOf, mailDomainRecheckDue, mailDomainSends, mailDomainState, mailEmailsLeft, mailEmailsUsed, mailKindOf, mailModeOf, mailSenderProblems, mailStandingOf, mergedSpf, ownAddressRefusal, planMailRoute, relativeDnsHost, remindersStopped, requiredMailerKeys };
|
|
507
|
+
export type { MailDnsRecord, MailDomainAnswer, MailDomainView, MailRouteFacts, MailTestAnswer, MailerDetails, MailerRowLike, MailjetDnsCheckRow, MailjetDnsRow, MailjetSenderRow, RelayAddress, RelayDomainRefusalBody, RelayDomainRequest, RelayMessage, RelayMonth, RelayRequest, RelayResponse, RelayResult, RelayUsage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vectoriox/iox-ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.134.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": ">=20.0.0",
|
|
6
6
|
"@angular/core": ">=20.0.0",
|
|
@@ -47,6 +47,10 @@
|
|
|
47
47
|
"types": "./design-core/index.d.ts",
|
|
48
48
|
"default": "./fesm2022/vectoriox-iox-ui-design-core.mjs"
|
|
49
49
|
},
|
|
50
|
+
"./domain-core": {
|
|
51
|
+
"types": "./domain-core/index.d.ts",
|
|
52
|
+
"default": "./fesm2022/vectoriox-iox-ui-domain-core.mjs"
|
|
53
|
+
},
|
|
50
54
|
"./forms-core": {
|
|
51
55
|
"types": "./forms-core/index.d.ts",
|
|
52
56
|
"default": "./fesm2022/vectoriox-iox-ui-forms-core.mjs"
|
|
@@ -61,6 +61,8 @@ export const ELEMENT_ACTION_DESCRIPTORS: readonly ActionDescriptor[] = Object.fr
|
|
|
61
61
|
{ value: 'line', labelKey: 'builder.actions.params.byLine' },
|
|
62
62
|
{ value: 'word', labelKey: 'builder.actions.params.byWord' },
|
|
63
63
|
] }] },
|
|
64
|
+
// AW3 (Motion board, E5): a heading comes from a small blur into focus — the look's `blur-in` move; reduced → the fade.
|
|
65
|
+
{ type: 'blurIn', labelKey: 'builder.actions.blurIn', kind: 'animated', group: 'motion', builderBehaviour: 'run' },
|
|
64
66
|
// Premium M6 (N5): a number that counts up ONCE, the first time it comes into view (D4); its final value is always the
|
|
65
67
|
// node's own text, so it is what the page sends. Offered only where it can wait unseen for that moment.
|
|
66
68
|
{ type: 'countUp', labelKey: 'builder.actions.countUp', kind: 'animated', group: 'motion', builderBehaviour: 'run', triggers: COUNT_UP_TRIGGERS,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
composeSection, jsonClosedObject, jsonListOf, jsonOneOf, JsonSchema, jsonText, patternById, SectionInput, SerializedNode,
|
|
2
|
+
BUTTON_LINK_PROPS, CarryKind, composeSection, jsonClosedObject, jsonListOf, jsonOneOf, JsonSchema, jsonText, patternById, SectionInput, SerializedNode,
|
|
3
|
+
SWAP_CARRY_KINDS, swapParts, walkSerialized,
|
|
3
4
|
} from '@vectoriox/iox-ui/generation-core';
|
|
4
5
|
|
|
5
6
|
import { assertAssistBudget } from './budget';
|
|
@@ -173,46 +174,15 @@ function swapBlocker(root: SerializedNode): string | null {
|
|
|
173
174
|
return blocker;
|
|
174
175
|
}
|
|
175
176
|
|
|
176
|
-
/** A section's parts a swap carries over, in reading order, by kind. */
|
|
177
|
-
enum CarryKind { Eyebrow = 'eyebrow', Heading = 'heading', Text = 'text', Button = 'button', Image = 'image' }
|
|
178
|
-
|
|
179
|
-
/** A button the owner's words and link travel in — never a tab, a price switch or a cart button (their recipe's own). */
|
|
180
|
-
const CARRIED_BUTTON_STYLES: ReadonlySet<string> = new Set(['button-primary', 'button-secondary', 'button-ghost']);
|
|
181
|
-
/** Words that belong to their recipe, not the owner's copy: a figure ("40+", a price), a badge — left where they are. */
|
|
182
|
-
const KEPT_TEXT_STYLES: ReadonlySet<string> = new Set(['price', 'badge-label']);
|
|
183
|
-
|
|
184
|
-
function carryKind(n: SerializedNode): CarryKind | null {
|
|
185
|
-
if (n.elementStyle === 'eyebrow' && (n.type === 'Heading' || n.type === 'Text')) return CarryKind.Eyebrow;
|
|
186
|
-
if (n.type === 'Heading') return CarryKind.Heading;
|
|
187
|
-
if (n.type === 'Text') return KEPT_TEXT_STYLES.has(n.elementStyle ?? '') ? null : CarryKind.Text;
|
|
188
|
-
if (n.type === 'Image') return CarryKind.Image;
|
|
189
|
-
return null;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function carryParts(root: SerializedNode): Record<CarryKind, SerializedNode[]> {
|
|
193
|
-
const out: Record<CarryKind, SerializedNode[]> = { eyebrow: [], heading: [], text: [], button: [], image: [] };
|
|
194
|
-
const visit = (n: SerializedNode) => {
|
|
195
|
-
if (n.type === 'ButtonBlock') {
|
|
196
|
-
if (CARRIED_BUTTON_STYLES.has(n.elementStyle ?? '')) out.button.push(n);
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
const kind = carryKind(n);
|
|
200
|
-
if (kind) out[kind].push(n);
|
|
201
|
-
for (const c of n.children ?? []) visit(c);
|
|
202
|
-
};
|
|
203
|
-
for (const c of root.children ?? []) visit(c);
|
|
204
|
-
return out;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const BUTTON_LINK_PROPS = ['tag', 'linkType', 'href', 'pageRoute', 'url', 'target'];
|
|
208
177
|
const labelOf = (button: SerializedNode) => (button.children ?? []).find(c => c.type === 'Text');
|
|
209
178
|
|
|
210
|
-
/** The owner's words and pictures, placed into the new section part for part (kind by kind, in order); how many found no
|
|
179
|
+
/** The owner's words and pictures, placed into the new section part for part (kind by kind, in order); how many found no
|
|
180
|
+
* place. WHAT is carried is generation-core's carry rule (`swapParts` — the harvest's classifier, today's kinds only). */
|
|
211
181
|
function carryOver(from: SerializedNode, to: SerializedNode): number {
|
|
212
|
-
const old =
|
|
213
|
-
const fresh =
|
|
182
|
+
const old = swapParts(from);
|
|
183
|
+
const fresh = swapParts(to);
|
|
214
184
|
let notPlaced = 0;
|
|
215
|
-
for (const kind of
|
|
185
|
+
for (const kind of SWAP_CARRY_KINDS) {
|
|
216
186
|
old[kind].forEach((source, i) => {
|
|
217
187
|
const target = fresh[kind][i];
|
|
218
188
|
if (!target) {
|
|
@@ -54,6 +54,17 @@ export enum ShopWord {
|
|
|
54
54
|
Quantity = 'quantity',
|
|
55
55
|
FreeShippingGap = 'freeShippingGap',
|
|
56
56
|
ChooseOption = 'chooseOption',
|
|
57
|
+
/** The shop parts' own words, stamped in the site's language (`shopRecipeWords` — vectoriox/iox-ui#100). */
|
|
58
|
+
AddToCart = 'addToCart',
|
|
59
|
+
BuyNow = 'buyNow',
|
|
60
|
+
YourBag = 'yourBag',
|
|
61
|
+
Close = 'close',
|
|
62
|
+
RemoveLine = 'removeLine',
|
|
63
|
+
EmptyBag = 'emptyBag',
|
|
64
|
+
Subtotal = 'subtotal',
|
|
65
|
+
VatNote = 'vatNote',
|
|
66
|
+
CheckOut = 'checkOut',
|
|
67
|
+
KeepShopping = 'keepShopping',
|
|
57
68
|
}
|
|
58
69
|
|
|
59
70
|
/** `{name}` / `{n}` / `{amount}` are filled by `shopWord`. */
|
|
@@ -69,6 +80,16 @@ export const SHOP_WORDS: Readonly<Record<ShopWord, CommerceLabel>> = Object.free
|
|
|
69
80
|
[ShopWord.Quantity]: { en: 'Quantity', he: 'כמות' },
|
|
70
81
|
[ShopWord.FreeShippingGap]: { en: 'Add {amount} more for free delivery', he: 'עוד {amount} למשלוח חינם' },
|
|
71
82
|
[ShopWord.ChooseOption]: { en: 'Choose {name}', he: 'בחירת {name}' },
|
|
83
|
+
[ShopWord.AddToCart]: { en: 'Add to cart', he: 'הוספה לסל' },
|
|
84
|
+
[ShopWord.BuyNow]: { en: 'Buy now', he: 'קנייה עכשיו' },
|
|
85
|
+
[ShopWord.YourBag]: { en: 'Your bag', he: 'הסל שלך' },
|
|
86
|
+
[ShopWord.Close]: { en: 'Close', he: 'סגירה' },
|
|
87
|
+
[ShopWord.RemoveLine]: { en: 'Remove', he: 'הסרה' },
|
|
88
|
+
[ShopWord.EmptyBag]: { en: 'Your bag is empty.', he: 'הסל שלך ריק.' },
|
|
89
|
+
[ShopWord.Subtotal]: { en: 'Subtotal', he: 'סכום ביניים' },
|
|
90
|
+
[ShopWord.VatNote]: { en: 'Includes VAT. Delivery is chosen at checkout.', he: 'כולל מע״מ. המשלוח נבחר בקופה.' },
|
|
91
|
+
[ShopWord.CheckOut]: { en: 'Check out', he: 'לקופה' },
|
|
92
|
+
[ShopWord.KeepShopping]: { en: 'Keep shopping', he: 'המשך בקניות' },
|
|
72
93
|
});
|
|
73
94
|
|
|
74
95
|
export function shopWord(word: ShopWord, lang: string | null | undefined, fill: Readonly<Record<string, string | number>> = {}): string {
|
|
@@ -215,10 +215,14 @@ export function buildConsentRecipe(create: CompositeNodeFactory, options: Consen
|
|
|
215
215
|
onClickRun(accept, [{ type: ConsentActionType.Grant }, { type: ConsentActionType.CloseDialog, target: banner.id }]);
|
|
216
216
|
const reject = button(create, 'consent-reject', ConsentRole.Reject, Style.Secondary, t.reject, 'Reject all');
|
|
217
217
|
onClickRun(reject, [{ type: ConsentActionType.Deny }, { type: ConsentActionType.CloseDialog, target: banner.id }]);
|
|
218
|
-
|
|
218
|
+
// iox-ui#95: on a phone the buttons take their own line, and Accept beside Reject was wider than the words' column
|
|
219
|
+
// (Hebrew and a large type pushed Reject past the dialog's edge). The pair wraps inside the column instead, and
|
|
220
|
+
// the column never grows past its row — it shrinks to it.
|
|
221
|
+
const choices = recipePart(create, 'consent-choices', 'Container', ConsentRole.Choices, null, {}, 'Accept and reject',
|
|
222
|
+
{ ...ROW, flexWrap: 'wrap', justifyContent: 'center', gap: '8px' });
|
|
219
223
|
choices.children = [accept, reject];
|
|
220
224
|
const buttons = recipePart(create, 'consent-buttons', 'Container', null, null, {}, 'Buttons',
|
|
221
|
-
{ ...COLUMN, width: 'auto', flexShrink: '0', alignItems: 'center', gap: '6px' });
|
|
225
|
+
{ ...COLUMN, width: 'auto', maxWidth: '100%', flexShrink: '0', alignItems: 'center', gap: '6px' });
|
|
222
226
|
buttons.children = [choices];
|
|
223
227
|
if (withPreferences) {
|
|
224
228
|
const prefs = button(create, 'consent-open-preferences', ConsentRole.Preferences, Style.Ghost, t.preferences, 'Preferences');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CART_TRANSPORT_ERROR_LABELS, CartTransport, CartTransportError, CartTransportErrorCode, cartIssueWords, CartView, CartViewLine, chooseValue,
|
|
2
|
+
CART_TRANSPORT_ERROR_LABELS, CartTransport, CheckoutWord, checkoutWord, CartTransportError, CartTransportErrorCode, cartIssueWords, CartView, CartViewLine, chooseValue,
|
|
3
3
|
defaultChoice, emptyCartView, findVariant, formatMoney, optionValueStates, ProductOption, ProductVariantView, productOptions, productVariants,
|
|
4
4
|
QuantityBounds, quantityBounds, QuantityStep, canStep, clampQuantity, ShopSlot, ShopWord, shopWord, stepQuantity, StorefrontProduct, VariantChoice,
|
|
5
5
|
variantSlotOf,
|
|
@@ -10,7 +10,7 @@ import { ITEM_KEY_ATTRIBUTE } from './accordion';
|
|
|
10
10
|
import { CompositeKind } from './composite-kinds';
|
|
11
11
|
import { attachExclusiveAt, exclusiveRuntimeOf, ExclusiveRuntime } from './exclusive-runtime';
|
|
12
12
|
import {
|
|
13
|
-
ADDED_HOLD_MS, CART_EMPTY_ATTRIBUTE, CART_LINE_ATTRIBUTE, CART_TITLE_COUNT_ATTRIBUTE, ShopPickerKind, shopPickerKind, ShopRole, shopSelector,
|
|
13
|
+
ADDED_HOLD_MS, CART_EMPTY_ATTRIBUTE, CART_LINE_ATTRIBUTE, CART_WAITING_ATTRIBUTE, SHOP_REST_WORDS_ATTRIBUTE, CART_TITLE_COUNT_ATTRIBUTE, ShopPickerKind, shopPickerKind, ShopRole, shopSelector,
|
|
14
14
|
SHOP_ADDED_ATTRIBUTE, SHOP_CLONE_ATTRIBUTE, SHOP_HIDDEN_ATTRIBUTE, SHOP_LIVE_CLASS, SHOP_SELECT_CLASS, SHOP_UNUSED_ATTRIBUTE, swatchFill,
|
|
15
15
|
variantGroupLabel, variantGroupNote,
|
|
16
16
|
} from './shop';
|
|
@@ -26,6 +26,12 @@ import {
|
|
|
26
26
|
* instance; the rest are copies stamped after it (`data-iox-shop-clone`), restamped only when the list changes.
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
+
/** An order this browser placed and has not paid yet (client-engine#22/#23): its number and the order page's address. */
|
|
30
|
+
export interface WaitingOrder {
|
|
31
|
+
number: string;
|
|
32
|
+
href: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
29
35
|
export interface ShopHost {
|
|
30
36
|
/** The cart: the engine's (E1d) on a live site, `simulatedCartTransport` on the builder canvas. */
|
|
31
37
|
transport: CartTransport;
|
|
@@ -39,6 +45,8 @@ export interface ShopHost {
|
|
|
39
45
|
openDrawer?: (drawer: HTMLElement) => void;
|
|
40
46
|
/** Go to the fixed checkout route (`checkoutHref(orgLabel)`); the canvas simulates it. */
|
|
41
47
|
goToCheckout?: () => void;
|
|
48
|
+
/** Go back to an unpaid order's page (the empty bag's "Continue to payment", client-engine#23). */
|
|
49
|
+
continueOrder?: (order: WaitingOrder) => void;
|
|
42
50
|
/** A change the cart refused (words in the page language) — the host may toast it; it is announced either way. */
|
|
43
51
|
onRefused?: (words: string, error: unknown) => void;
|
|
44
52
|
/** The colours a value is drawn with when it is not a colour word itself (the canvas' sample glazes). */
|
|
@@ -72,6 +80,19 @@ function setText(el: Element | null | undefined, words: string): void {
|
|
|
72
80
|
if (el && el.textContent !== words) el.textContent = words;
|
|
73
81
|
}
|
|
74
82
|
|
|
83
|
+
/** Say `words` in a part's place, keeping what it said; null gives the part its own words back. */
|
|
84
|
+
function swapWords(el: Element | null, words: string | null): void {
|
|
85
|
+
if (!el) return;
|
|
86
|
+
const kept = el.getAttribute(SHOP_REST_WORDS_ATTRIBUTE);
|
|
87
|
+
if (words !== null) {
|
|
88
|
+
if (kept === null) el.setAttribute(SHOP_REST_WORDS_ATTRIBUTE, el.textContent ?? '');
|
|
89
|
+
setText(el, words);
|
|
90
|
+
} else if (kept !== null) {
|
|
91
|
+
setText(el, kept);
|
|
92
|
+
el.removeAttribute(SHOP_REST_WORDS_ATTRIBUTE);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
75
96
|
/** The deepest element of a Text / Heading part that holds its words (a host may wrap them). */
|
|
76
97
|
function wordsOf(el: Element | null | undefined): Element | null {
|
|
77
98
|
if (!el) return null;
|
|
@@ -136,6 +157,7 @@ function announce(scope: Element, words: string): void {
|
|
|
136
157
|
export class ShopRuntime {
|
|
137
158
|
private readonly products = new Map<string, ProductState>();
|
|
138
159
|
private cart: CartView = emptyCartView();
|
|
160
|
+
private waiting: WaitingOrder | null = null;
|
|
139
161
|
private observer: MutationObserver | null = null;
|
|
140
162
|
private stampQueued = false;
|
|
141
163
|
private stamping = false;
|
|
@@ -178,6 +200,17 @@ export class ShopRuntime {
|
|
|
178
200
|
return this.stateFor(el)?.quantity ?? 1;
|
|
179
201
|
}
|
|
180
202
|
|
|
203
|
+
/** client-engine#23: the order this browser placed and has not paid (or null) — an empty bag offers it. */
|
|
204
|
+
setWaitingOrder(order: WaitingOrder | null): void {
|
|
205
|
+
this.waiting = order;
|
|
206
|
+
this.stamp();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** The unpaid order an empty bag offers, or null. */
|
|
210
|
+
get waitingOrder(): WaitingOrder | null {
|
|
211
|
+
return this.cart.empty ? this.waiting : null;
|
|
212
|
+
}
|
|
213
|
+
|
|
181
214
|
/** Re-read every product and restamp (the host's data changed). */
|
|
182
215
|
refresh(): void {
|
|
183
216
|
this.products.clear();
|
|
@@ -447,8 +480,15 @@ export class ShopRuntime {
|
|
|
447
480
|
setAttr(button, 'aria-label', view.empty ? shopWord(ShopWord.Cart, lang) : shopWord(ShopWord.CartCount, lang, { n: view.count }));
|
|
448
481
|
setAttr(button, 'aria-haspopup', 'dialog');
|
|
449
482
|
}
|
|
483
|
+
const waiting = this.waitingOrder;
|
|
450
484
|
for (const drawer of own(this.scope, sel(ShopRole.CartDrawer))) {
|
|
451
485
|
setAttr(drawer, CART_EMPTY_ATTRIBUTE, view.empty ? '' : null);
|
|
486
|
+
// client-engine#23: Back from the order page lands on an empty bag — it names the order and goes back to it.
|
|
487
|
+
setAttr(drawer, CART_WAITING_ATTRIBUTE, waiting ? '' : null);
|
|
488
|
+
swapWords(wordsOf(first(drawer, sel(ShopRole.CartEmpty))), waiting
|
|
489
|
+
? `${checkoutWord(CheckoutWord.OrderAwaitsPayment, lang, { number: waiting.number })}. ${checkoutWord(CheckoutWord.OrderAwaitsNote, lang)}`
|
|
490
|
+
: null);
|
|
491
|
+
swapWords(wordsOf(first(drawer, sel(ShopRole.Checkout))), waiting ? checkoutWord(CheckoutWord.ContinueToPayment, lang) : null);
|
|
452
492
|
const title = wordsOf(first(drawer, sel(ShopRole.CartTitle)));
|
|
453
493
|
if (title) {
|
|
454
494
|
let count = title.querySelector(`[${CART_TITLE_COUNT_ATTRIBUTE}]`);
|
|
@@ -556,7 +596,11 @@ export class ShopRuntime {
|
|
|
556
596
|
const removeLine = remove?.closest(`[${CART_LINE_ATTRIBUTE}]`);
|
|
557
597
|
if (removeLine) { void this.changeLine(removeLine, null); return; }
|
|
558
598
|
if (target.closest(sel(ShopRole.CartButton))) { this.openCart(); return; }
|
|
559
|
-
if (target.closest(sel(ShopRole.Checkout))
|
|
599
|
+
if (target.closest(sel(ShopRole.Checkout))) {
|
|
600
|
+
const waiting = this.waitingOrder;
|
|
601
|
+
if (!this.cart.empty) this.host.goToCheckout?.();
|
|
602
|
+
else if (waiting) this.host.continueOrder?.(waiting);
|
|
603
|
+
}
|
|
560
604
|
};
|
|
561
605
|
|
|
562
606
|
private readonly onChange = (event: Event): void => {
|