@aglyn/plugins-marketing 1.0.0-beta.143
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/LICENSE +201 -0
- package/README.md +7 -0
- package/package.json +56 -0
- package/src/index.d.ts +19 -0
- package/src/index.js +20 -0
- package/src/index.js.map +1 -0
- package/src/lib/components/announcement-bar-card.component.d.ts +20 -0
- package/src/lib/components/announcement-bar-card.component.js +292 -0
- package/src/lib/components/announcement-bar-card.component.js.map +1 -0
- package/src/lib/components/campaign-composer.d.ts +84 -0
- package/src/lib/components/campaign-composer.js +1643 -0
- package/src/lib/components/campaign-composer.js.map +1 -0
- package/src/lib/components/campaign-conversions-card.d.ts +22 -0
- package/src/lib/components/campaign-conversions-card.js +642 -0
- package/src/lib/components/campaign-conversions-card.js.map +1 -0
- package/src/lib/components/campaign-detail-card.d.ts +55 -0
- package/src/lib/components/campaign-detail-card.js +771 -0
- package/src/lib/components/campaign-detail-card.js.map +1 -0
- package/src/lib/components/campaign-edit-drawer.d.ts +60 -0
- package/src/lib/components/campaign-edit-drawer.js +252 -0
- package/src/lib/components/campaign-edit-drawer.js.map +1 -0
- package/src/lib/components/campaign-email-zones.d.ts +111 -0
- package/src/lib/components/campaign-email-zones.js +54 -0
- package/src/lib/components/campaign-email-zones.js.map +1 -0
- package/src/lib/components/campaign-glance-card.component.d.ts +18 -0
- package/src/lib/components/campaign-glance-card.component.js +151 -0
- package/src/lib/components/campaign-glance-card.component.js.map +1 -0
- package/src/lib/components/campaign-members-section.d.ts +87 -0
- package/src/lib/components/campaign-members-section.js +499 -0
- package/src/lib/components/campaign-members-section.js.map +1 -0
- package/src/lib/components/campaign-reach-sections.d.ts +137 -0
- package/src/lib/components/campaign-reach-sections.js +694 -0
- package/src/lib/components/campaign-reach-sections.js.map +1 -0
- package/src/lib/components/campaign-report-card.d.ts +91 -0
- package/src/lib/components/campaign-report-card.js +667 -0
- package/src/lib/components/campaign-report-card.js.map +1 -0
- package/src/lib/components/campaign-test-send-drawer.d.ts +45 -0
- package/src/lib/components/campaign-test-send-drawer.js +238 -0
- package/src/lib/components/campaign-test-send-drawer.js.map +1 -0
- package/src/lib/components/campaigns-card.d.ts +31 -0
- package/src/lib/components/campaigns-card.js +667 -0
- package/src/lib/components/campaigns-card.js.map +1 -0
- package/src/lib/components/conversion-attribution.component.d.ts +62 -0
- package/src/lib/components/conversion-attribution.component.js +127 -0
- package/src/lib/components/conversion-attribution.component.js.map +1 -0
- package/src/lib/components/email-compose-card.d.ts +12 -0
- package/src/lib/components/email-compose-card.js +157 -0
- package/src/lib/components/email-compose-card.js.map +1 -0
- package/src/lib/components/email-detail.d.ts +40 -0
- package/src/lib/components/email-detail.js +1180 -0
- package/src/lib/components/email-detail.js.map +1 -0
- package/src/lib/components/email-edit-drawer.d.ts +54 -0
- package/src/lib/components/email-edit-drawer.js +172 -0
- package/src/lib/components/email-edit-drawer.js.map +1 -0
- package/src/lib/components/email-messages-widget.d.ts +22 -0
- package/src/lib/components/email-messages-widget.js +49 -0
- package/src/lib/components/email-messages-widget.js.map +1 -0
- package/src/lib/components/email-recipients-card.d.ts +50 -0
- package/src/lib/components/email-recipients-card.js +338 -0
- package/src/lib/components/email-recipients-card.js.map +1 -0
- package/src/lib/components/emails-list-card.d.ts +36 -0
- package/src/lib/components/emails-list-card.js +544 -0
- package/src/lib/components/emails-list-card.js.map +1 -0
- package/src/lib/components/experiment-zones.d.ts +78 -0
- package/src/lib/components/experiment-zones.js +65 -0
- package/src/lib/components/experiment-zones.js.map +1 -0
- package/src/lib/components/host-experiments-card.component.d.ts +17 -0
- package/src/lib/components/host-experiments-card.component.js +887 -0
- package/src/lib/components/host-experiments-card.component.js.map +1 -0
- package/src/lib/components/host-marketing-summary-card.component.d.ts +15 -0
- package/src/lib/components/host-marketing-summary-card.component.js +161 -0
- package/src/lib/components/host-marketing-summary-card.component.js.map +1 -0
- package/src/lib/components/host-overlays-card.component.d.ts +19 -0
- package/src/lib/components/host-overlays-card.component.js +783 -0
- package/src/lib/components/host-overlays-card.component.js.map +1 -0
- package/src/lib/components/marketing-console-page.d.ts +28 -0
- package/src/lib/components/marketing-console-page.js +166 -0
- package/src/lib/components/marketing-console-page.js.map +1 -0
- package/src/lib/components/marketing-console-sections.d.ts +34 -0
- package/src/lib/components/marketing-console-sections.js +77 -0
- package/src/lib/components/marketing-console-sections.js.map +1 -0
- package/src/lib/components/overlay-stats-row.component.d.ts +15 -0
- package/src/lib/components/overlay-stats-row.component.js +78 -0
- package/src/lib/components/overlay-stats-row.component.js.map +1 -0
- package/src/lib/components/popup-card.component.d.ts +18 -0
- package/src/lib/components/popup-card.component.js +462 -0
- package/src/lib/components/popup-card.component.js.map +1 -0
- package/src/lib/components/record-attribution-widget.d.ts +35 -0
- package/src/lib/components/record-attribution-widget.js +33 -0
- package/src/lib/components/record-attribution-widget.js.map +1 -0
- package/src/lib/components/site-runtime.d.ts +9 -0
- package/src/lib/components/site-runtime.js +1081 -0
- package/src/lib/components/site-runtime.js.map +1 -0
- package/src/lib/components/use-campaign-send-api.d.ts +35 -0
- package/src/lib/components/use-campaign-send-api.js +99 -0
- package/src/lib/components/use-campaign-send-api.js.map +1 -0
- package/src/lib/components/use-campaign-topic-options.d.ts +20 -0
- package/src/lib/components/use-campaign-topic-options.js +44 -0
- package/src/lib/components/use-campaign-topic-options.js.map +1 -0
- package/src/lib/components/use-emails-hub-path.d.ts +39 -0
- package/src/lib/components/use-emails-hub-path.js +70 -0
- package/src/lib/components/use-emails-hub-path.js.map +1 -0
- package/src/lib/components/use-marketing-hub-path.d.ts +21 -0
- package/src/lib/components/use-marketing-hub-path.js +50 -0
- package/src/lib/components/use-marketing-hub-path.js.map +1 -0
- package/src/lib/components/use-overlay-copy-editor.d.ts +79 -0
- package/src/lib/components/use-overlay-copy-editor.js +110 -0
- package/src/lib/components/use-overlay-copy-editor.js.map +1 -0
- package/src/lib/constants/bundle-common.d.ts +8 -0
- package/src/lib/constants/bundle-common.js +9 -0
- package/src/lib/constants/bundle-common.js.map +1 -0
- package/src/lib/model/campaign-membership-figures.d.ts +109 -0
- package/src/lib/model/campaign-membership-figures.js +113 -0
- package/src/lib/model/campaign-membership-figures.js.map +1 -0
- package/src/lib/model/compile-client-automations.d.ts +65 -0
- package/src/lib/model/compile-client-automations.js +95 -0
- package/src/lib/model/compile-client-automations.js.map +1 -0
- package/src/lib/model/experiments.d.ts +130 -0
- package/src/lib/model/experiments.js +186 -0
- package/src/lib/model/experiments.js.map +1 -0
- package/src/lib/model/index.d.ts +26 -0
- package/src/lib/model/index.js +26 -0
- package/src/lib/model/index.js.map +1 -0
- package/src/lib/model/marketing-record-routes.d.ts +6 -0
- package/src/lib/model/marketing-record-routes.js +46 -0
- package/src/lib/model/marketing-record-routes.js.map +1 -0
- package/src/lib/model/overlay-copy.d.ts +62 -0
- package/src/lib/model/overlay-copy.js +78 -0
- package/src/lib/model/overlay-copy.js.map +1 -0
- package/src/lib/model/overlays.d.ts +113 -0
- package/src/lib/model/overlays.js +93 -0
- package/src/lib/model/overlays.js.map +1 -0
- package/src/lib/model/site-contract.d.ts +100 -0
- package/src/lib/model/site-contract.js +23 -0
- package/src/lib/model/site-contract.js.map +1 -0
- package/src/lib/plugin.d.ts +27 -0
- package/src/lib/plugin.js +168 -0
- package/src/lib/plugin.js.map +1 -0
- package/src/lib/preview-props.d.ts +31 -0
- package/src/lib/preview-props.js +54 -0
- package/src/lib/preview-props.js.map +1 -0
- package/src/lib/server/campaign-manage.d.ts +62 -0
- package/src/lib/server/campaign-manage.js +829 -0
- package/src/lib/server/campaign-manage.js.map +1 -0
- package/src/lib/server/campaign-process-scheduled.d.ts +26 -0
- package/src/lib/server/campaign-process-scheduled.js +198 -0
- package/src/lib/server/campaign-process-scheduled.js.map +1 -0
- package/src/lib/server/campaign-recipients.d.ts +55 -0
- package/src/lib/server/campaign-recipients.js +219 -0
- package/src/lib/server/campaign-recipients.js.map +1 -0
- package/src/lib/server/campaign-send.d.ts +487 -0
- package/src/lib/server/campaign-send.js +3157 -0
- package/src/lib/server/campaign-send.js.map +1 -0
- package/src/lib/server/email-campaign-reach.d.ts +174 -0
- package/src/lib/server/email-campaign-reach.js +254 -0
- package/src/lib/server/email-campaign-reach.js.map +1 -0
- package/src/lib/server/email-events.d.ts +27 -0
- package/src/lib/server/email-events.js +714 -0
- package/src/lib/server/email-events.js.map +1 -0
- package/src/lib/server/get-client-automations.d.ts +60 -0
- package/src/lib/server/get-client-automations.js +87 -0
- package/src/lib/server/get-client-automations.js.map +1 -0
- package/src/lib/server/get-overlays.d.ts +28 -0
- package/src/lib/server/get-overlays.js +65 -0
- package/src/lib/server/get-overlays.js.map +1 -0
- package/src/lib/server/get-screen-experiments.d.ts +42 -0
- package/src/lib/server/get-screen-experiments.js +82 -0
- package/src/lib/server/get-screen-experiments.js.map +1 -0
- package/src/lib/server/lists-materialize.d.ts +18 -0
- package/src/lib/server/lists-materialize.js +130 -0
- package/src/lib/server/lists-materialize.js.map +1 -0
- package/src/lib/server/marketing-figures.d.ts +37 -0
- package/src/lib/server/marketing-figures.js +248 -0
- package/src/lib/server/marketing-figures.js.map +1 -0
- package/src/lib/server/site-page-enricher.d.ts +26 -0
- package/src/lib/server/site-page-enricher.js +210 -0
- package/src/lib/server/site-page-enricher.js.map +1 -0
- package/src/lib/server.d.ts +20 -0
- package/src/lib/server.js +152 -0
- package/src/lib/server.js.map +1 -0
- package/src/lib/site.d.ts +22 -0
- package/src/lib/site.js +48 -0
- package/src/lib/site.js.map +1 -0
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ 'use client';
|
|
17
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
import { checkEntitlement, inheritedMediaAlt, MEDIA_ALT_MAX_LENGTH, pluginDocsHelp, useMediaPicker } from "@aglyn/aglyn";
|
|
20
|
+
import { CardDisplay, useLoading } from "@aglyn/shared-ui-jsx";
|
|
21
|
+
import { useSnackbar } from "@aglyn/shared-ui-snackstack";
|
|
22
|
+
import { Alert, Button, MenuItem, Stack, Switch, TextField, Typography } from "@mui/material";
|
|
23
|
+
import { doc, updateDoc } from "firebase/firestore";
|
|
24
|
+
import { useEffect, useState } from "react";
|
|
25
|
+
import { useFirestore, useFirestoreDoc, useHostActivityLogger, writeGuardedBySeed } from "@aglyn/tenant-feature-instance";
|
|
26
|
+
import OverlayStatsRow from "./overlay-stats-row.component.js";
|
|
27
|
+
import { OVERLAY_COPY_HELPER_TEXT, shownAsTypedHelperText, useOverlayCopyEditor } from "./use-overlay-copy-editor.js";
|
|
28
|
+
const TRIGGERS = [
|
|
29
|
+
{
|
|
30
|
+
value: 'delay',
|
|
31
|
+
label: 'After a delay (seconds)'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
value: 'scroll',
|
|
35
|
+
label: 'At scroll depth (%)'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
value: 'exit',
|
|
39
|
+
label: 'On exit intent (desktop)'
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
const toLocalInput = (ms)=>{
|
|
43
|
+
if (!ms) return '';
|
|
44
|
+
const date = new Date(ms - new Date().getTimezoneOffset() * 60000);
|
|
45
|
+
return date.toISOString().slice(0, 16);
|
|
46
|
+
};
|
|
47
|
+
const fromLocalInput = (value)=>value ? new Date(value).getTime() : undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Promotional popup editor (AGL-196): one popup per host, persisted on the
|
|
50
|
+
* host doc; the tenant render handles triggers, scheduling, and
|
|
51
|
+
* frequency capping. marketingOverlays-gated (Starter+). The headline and
|
|
52
|
+
* body are edited through `useOverlayCopyEditor`, like the bar's text
|
|
53
|
+
* (AGL-2885).
|
|
54
|
+
*/ export function PopupCard(props) {
|
|
55
|
+
var _ref, _shownAsTypedHelperText, _draft_imageUrl, _draft_imageUrl1, _draft_imageAlt, _draft_ctaLabel, _draft_ctaHref, _draft_trigger, _draft_triggerValue, _draft_frequencyDays;
|
|
56
|
+
var _draft_body;
|
|
57
|
+
const { hostId } = props;
|
|
58
|
+
const firestore = useFirestore();
|
|
59
|
+
const { org } = props;
|
|
60
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
61
|
+
const { queueLoading } = useLoading();
|
|
62
|
+
const logActivity = useHostActivityLogger(hostId);
|
|
63
|
+
const { data: host, status: hostStatus, /**
|
|
64
|
+
* The host doc this form is seeded from is unconfirmed by the server
|
|
65
|
+
* (AGL-1358). The save writes the whole `popup` map — a nested map value
|
|
66
|
+
* REPLACES atomically, so `updateDoc` protects only the host doc's other
|
|
67
|
+
* fields, never the popup's own — and every field of it comes off this
|
|
68
|
+
* seed. Against a cached read, retyping the headline restores yesterday's
|
|
69
|
+
* body, link, schedule and enabled flag on a live site.
|
|
70
|
+
*/ fromCache: hostFromCache } = useFirestoreDoc(()=>doc(firestore, 'hosts', hostId), [
|
|
71
|
+
firestore,
|
|
72
|
+
hostId
|
|
73
|
+
], {
|
|
74
|
+
idField: '$id'
|
|
75
|
+
});
|
|
76
|
+
const entitled = checkEntitlement(org, 'marketingOverlays');
|
|
77
|
+
const saved = (_ref = host == null ? void 0 : host.popup) != null ? _ref : {};
|
|
78
|
+
const [draft, setDraft] = useState(saved);
|
|
79
|
+
const savedKey = JSON.stringify(saved);
|
|
80
|
+
useEffect(()=>{
|
|
81
|
+
setDraft(JSON.parse(savedKey));
|
|
82
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
83
|
+
}, [
|
|
84
|
+
savedKey
|
|
85
|
+
]);
|
|
86
|
+
// The console media browser is provided by the shell (AGL-395).
|
|
87
|
+
const { pickMedia } = useMediaPicker();
|
|
88
|
+
// The headline and body are held in their stored form; the fields show them
|
|
89
|
+
// as typed.
|
|
90
|
+
const copy = useOverlayCopyEditor({
|
|
91
|
+
hostId,
|
|
92
|
+
host,
|
|
93
|
+
usesTokens: entitled && [
|
|
94
|
+
saved.headline,
|
|
95
|
+
saved.body,
|
|
96
|
+
draft.headline,
|
|
97
|
+
draft.body
|
|
98
|
+
].some((text)=>text == null ? void 0 : text.includes('{{'))
|
|
99
|
+
});
|
|
100
|
+
// Compared as it would be stored, so a name typed before the variables
|
|
101
|
+
// arrived still counts as the change it becomes on save.
|
|
102
|
+
const dirty = JSON.stringify(_extends({}, draft, {
|
|
103
|
+
headline: copy.stored(draft.headline),
|
|
104
|
+
body: copy.stored(draft.body)
|
|
105
|
+
})) !== savedKey;
|
|
106
|
+
const patch = (partial)=>setDraft((previous)=>_extends({}, previous, partial));
|
|
107
|
+
const headlineShownAsTyped = copy.shownAsTyped(draft.headline);
|
|
108
|
+
const bodyShownAsTyped = copy.shownAsTyped(draft.body);
|
|
109
|
+
const handleSave = async ()=>{
|
|
110
|
+
const dequeue = queueLoading();
|
|
111
|
+
try {
|
|
112
|
+
/**
|
|
113
|
+
* Refuse a save whose seed the server never confirmed (AGL-1358).
|
|
114
|
+
*
|
|
115
|
+
* There is no create path to exempt here, and that is the point: unlike
|
|
116
|
+
* a new row at a fresh uid, this writes a FIXED document path, so a
|
|
117
|
+
* blank `draft` — what `host?.popup ?? {}` yields when the cache has
|
|
118
|
+
* never seen a popup — is not harmless. It replaces whatever popup the
|
|
119
|
+
* server really holds with an empty one. Both the populated and the
|
|
120
|
+
* empty seed are guarded for the same reason.
|
|
121
|
+
*
|
|
122
|
+
* The activity log rides inside the guard: a logged "Updated popup"
|
|
123
|
+
* whose write never happened leaves the history disagreeing with the
|
|
124
|
+
* popup it claims to explain.
|
|
125
|
+
*
|
|
126
|
+
* The guard WRAPS the write — an early return is a shape you can keep
|
|
127
|
+
* while losing the protection.
|
|
128
|
+
*/ const verdict = await writeGuardedBySeed({
|
|
129
|
+
subject: 'popup',
|
|
130
|
+
unreadable: hostStatus === 'error',
|
|
131
|
+
fromCache: hostFromCache
|
|
132
|
+
}, async ()=>{
|
|
133
|
+
var _draft_imageUrl, _draft_imageAlt, _draft_ctaLabel, _draft_ctaHref, _draft_trigger, _draft_triggerValue, _draft_frequencyDays, _draft_startAtMs, _draft_endAtMs;
|
|
134
|
+
await updateDoc(doc(firestore, 'hosts', hostId), {
|
|
135
|
+
popup: {
|
|
136
|
+
enabled: Boolean(draft.enabled),
|
|
137
|
+
headline: copy.storedWithin(draft.headline, 120),
|
|
138
|
+
body: copy.storedWithin(draft.body, 1000),
|
|
139
|
+
imageUrl: ((_draft_imageUrl = draft.imageUrl) != null ? _draft_imageUrl : '').trim(),
|
|
140
|
+
// AGL-1896. Capped at the same length the media library saves
|
|
141
|
+
// alt through, so a value defaulted from an asset and a value
|
|
142
|
+
// typed here cannot diverge.
|
|
143
|
+
imageAlt: ((_draft_imageAlt = draft.imageAlt) != null ? _draft_imageAlt : '').trim().slice(0, MEDIA_ALT_MAX_LENGTH),
|
|
144
|
+
ctaLabel: ((_draft_ctaLabel = draft.ctaLabel) != null ? _draft_ctaLabel : '').slice(0, 60),
|
|
145
|
+
ctaHref: ((_draft_ctaHref = draft.ctaHref) != null ? _draft_ctaHref : '').trim(),
|
|
146
|
+
collectEmail: Boolean(draft.collectEmail),
|
|
147
|
+
trigger: (_draft_trigger = draft.trigger) != null ? _draft_trigger : 'delay',
|
|
148
|
+
triggerValue: Math.max(0, Number((_draft_triggerValue = draft.triggerValue) != null ? _draft_triggerValue : 3)),
|
|
149
|
+
frequencyDays: Math.max(1, Number((_draft_frequencyDays = draft.frequencyDays) != null ? _draft_frequencyDays : 7)),
|
|
150
|
+
startAtMs: (_draft_startAtMs = draft.startAtMs) != null ? _draft_startAtMs : null,
|
|
151
|
+
endAtMs: (_draft_endAtMs = draft.endAtMs) != null ? _draft_endAtMs : null
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
logActivity('Updated popup', {
|
|
155
|
+
type: 'host',
|
|
156
|
+
id: hostId
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
// A refusal leaves every typed value on screen. A save that silently
|
|
160
|
+
// does nothing sends the user back to retype a form that will be
|
|
161
|
+
// refused again just as quietly.
|
|
162
|
+
if (!verdict.ok) {
|
|
163
|
+
return void enqueueSnackbar(verdict.message, {
|
|
164
|
+
variant: 'warning',
|
|
165
|
+
persist: false
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
enqueueSnackbar('Popup saved', {
|
|
169
|
+
variant: 'success',
|
|
170
|
+
persist: false
|
|
171
|
+
});
|
|
172
|
+
} catch (error) {
|
|
173
|
+
console.error(error);
|
|
174
|
+
enqueueSnackbar('An error has occurred', {
|
|
175
|
+
variant: 'error',
|
|
176
|
+
allowDuplicate: true
|
|
177
|
+
});
|
|
178
|
+
} finally{
|
|
179
|
+
dequeue();
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
return /*#__PURE__*/ _jsx(CardDisplay, {
|
|
183
|
+
header: "Promotional popup",
|
|
184
|
+
help: pluginDocsHelp('marketingOverlays', {
|
|
185
|
+
anchor: '#promotional-popups',
|
|
186
|
+
excerpt: 'The site-wide default popup. Its only frequency cap is a number ' + 'of days — the once-per-session choice is on the overlays card.'
|
|
187
|
+
}),
|
|
188
|
+
contentGutterX: true,
|
|
189
|
+
contentGutterY: true,
|
|
190
|
+
children: !entitled ? /*#__PURE__*/ _jsx(Alert, {
|
|
191
|
+
severity: "info",
|
|
192
|
+
children: 'Popups are included from the Starter plan — see Billing to ' + 'upgrade.'
|
|
193
|
+
}) : /*#__PURE__*/ _jsxs(Stack, {
|
|
194
|
+
spacing: 2,
|
|
195
|
+
children: [
|
|
196
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
197
|
+
direction: "row",
|
|
198
|
+
spacing: 1,
|
|
199
|
+
sx: {
|
|
200
|
+
alignItems: 'center'
|
|
201
|
+
},
|
|
202
|
+
children: [
|
|
203
|
+
/*#__PURE__*/ _jsx(Switch, {
|
|
204
|
+
checked: Boolean(draft.enabled),
|
|
205
|
+
onChange: (event)=>patch({
|
|
206
|
+
enabled: event.target.checked
|
|
207
|
+
})
|
|
208
|
+
}),
|
|
209
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
210
|
+
variant: "body2",
|
|
211
|
+
children: draft.enabled ? 'Active on your published site' : 'Off'
|
|
212
|
+
})
|
|
213
|
+
]
|
|
214
|
+
}),
|
|
215
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
216
|
+
label: "Headline",
|
|
217
|
+
size: "small",
|
|
218
|
+
value: copy.editable(draft.headline),
|
|
219
|
+
onChange: (event)=>patch({
|
|
220
|
+
headline: copy.stored(event.target.value)
|
|
221
|
+
}),
|
|
222
|
+
error: headlineShownAsTyped.length > 0,
|
|
223
|
+
helperText: shownAsTypedHelperText(headlineShownAsTyped),
|
|
224
|
+
fullWidth: true
|
|
225
|
+
}),
|
|
226
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
227
|
+
label: "Body",
|
|
228
|
+
size: "small",
|
|
229
|
+
value: copy.editable(draft.body),
|
|
230
|
+
onChange: (event)=>patch({
|
|
231
|
+
body: copy.stored(event.target.value)
|
|
232
|
+
}),
|
|
233
|
+
error: bodyShownAsTyped.length > 0,
|
|
234
|
+
helperText: (_shownAsTypedHelperText = shownAsTypedHelperText(bodyShownAsTyped)) != null ? _shownAsTypedHelperText : OVERLAY_COPY_HELPER_TEXT,
|
|
235
|
+
multiline: true,
|
|
236
|
+
minRows: 2,
|
|
237
|
+
fullWidth: true
|
|
238
|
+
}),
|
|
239
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
240
|
+
direction: "row",
|
|
241
|
+
spacing: 1,
|
|
242
|
+
sx: {
|
|
243
|
+
flexWrap: 'wrap',
|
|
244
|
+
rowGap: 1
|
|
245
|
+
},
|
|
246
|
+
children: [
|
|
247
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
248
|
+
label: "Image URL (optional)",
|
|
249
|
+
size: "small",
|
|
250
|
+
placeholder: "Pick from the media library",
|
|
251
|
+
value: (_draft_imageUrl = draft.imageUrl) != null ? _draft_imageUrl : '',
|
|
252
|
+
onChange: (event)=>patch({
|
|
253
|
+
imageUrl: event.target.value
|
|
254
|
+
}),
|
|
255
|
+
sx: {
|
|
256
|
+
flex: 1,
|
|
257
|
+
minWidth: 220
|
|
258
|
+
}
|
|
259
|
+
}),
|
|
260
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
261
|
+
size: "small",
|
|
262
|
+
onClick: ()=>void (async ()=>{
|
|
263
|
+
const media = await (pickMedia == null ? void 0 : pickMedia());
|
|
264
|
+
if (!media) return;
|
|
265
|
+
// Alt defaults from the asset (AGL-1896), never clobbering
|
|
266
|
+
// one the author already typed for THIS popup. Undefined
|
|
267
|
+
// when the asset has no alt or the field is already
|
|
268
|
+
// filled, and the spread then leaves `imageAlt` alone.
|
|
269
|
+
const inheritedAlt = inheritedMediaAlt({
|
|
270
|
+
placementAlt: draft.imageAlt,
|
|
271
|
+
assetAlt: media.alt
|
|
272
|
+
});
|
|
273
|
+
patch(_extends({
|
|
274
|
+
imageUrl: media.url
|
|
275
|
+
}, inheritedAlt ? {
|
|
276
|
+
imageAlt: inheritedAlt
|
|
277
|
+
} : {}));
|
|
278
|
+
})(),
|
|
279
|
+
children: 'Browse media'
|
|
280
|
+
})
|
|
281
|
+
]
|
|
282
|
+
}),
|
|
283
|
+
((_draft_imageUrl1 = draft.imageUrl) != null ? _draft_imageUrl1 : '').trim() ? /*#__PURE__*/ _jsx(TextField, {
|
|
284
|
+
label: "Image alt text",
|
|
285
|
+
size: "small",
|
|
286
|
+
value: (_draft_imageAlt = draft.imageAlt) != null ? _draft_imageAlt : '',
|
|
287
|
+
onChange: (event)=>patch({
|
|
288
|
+
imageAlt: event.target.value
|
|
289
|
+
}),
|
|
290
|
+
helperText: 'Describes the image for screen readers. Filled in from the ' + 'media library when you pick an image that has alt text. ' + 'Leave empty only if the image is purely decorative.'
|
|
291
|
+
}) : null,
|
|
292
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
293
|
+
direction: "row",
|
|
294
|
+
spacing: 1,
|
|
295
|
+
sx: {
|
|
296
|
+
alignItems: 'center'
|
|
297
|
+
},
|
|
298
|
+
children: [
|
|
299
|
+
/*#__PURE__*/ _jsx(Switch, {
|
|
300
|
+
checked: Boolean(draft.collectEmail),
|
|
301
|
+
onChange: (event)=>patch({
|
|
302
|
+
collectEmail: event.target.checked
|
|
303
|
+
})
|
|
304
|
+
}),
|
|
305
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
306
|
+
variant: "body2",
|
|
307
|
+
children: 'Collect emails (submissions land in your Inbox and Contacts)'
|
|
308
|
+
})
|
|
309
|
+
]
|
|
310
|
+
}),
|
|
311
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
312
|
+
direction: "row",
|
|
313
|
+
spacing: 1,
|
|
314
|
+
sx: {
|
|
315
|
+
flexWrap: 'wrap',
|
|
316
|
+
rowGap: 1
|
|
317
|
+
},
|
|
318
|
+
children: [
|
|
319
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
320
|
+
label: "Button label",
|
|
321
|
+
size: "small",
|
|
322
|
+
value: (_draft_ctaLabel = draft.ctaLabel) != null ? _draft_ctaLabel : '',
|
|
323
|
+
onChange: (event)=>patch({
|
|
324
|
+
ctaLabel: event.target.value
|
|
325
|
+
}),
|
|
326
|
+
sx: {
|
|
327
|
+
width: 160
|
|
328
|
+
}
|
|
329
|
+
}),
|
|
330
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
331
|
+
label: "Button link",
|
|
332
|
+
size: "small",
|
|
333
|
+
placeholder: "/sale or https://…",
|
|
334
|
+
value: (_draft_ctaHref = draft.ctaHref) != null ? _draft_ctaHref : '',
|
|
335
|
+
onChange: (event)=>patch({
|
|
336
|
+
ctaHref: event.target.value
|
|
337
|
+
}),
|
|
338
|
+
sx: {
|
|
339
|
+
flex: 1,
|
|
340
|
+
minWidth: 180
|
|
341
|
+
}
|
|
342
|
+
})
|
|
343
|
+
]
|
|
344
|
+
}),
|
|
345
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
346
|
+
direction: "row",
|
|
347
|
+
spacing: 1,
|
|
348
|
+
sx: {
|
|
349
|
+
flexWrap: 'wrap',
|
|
350
|
+
rowGap: 1
|
|
351
|
+
},
|
|
352
|
+
children: [
|
|
353
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
354
|
+
select: true,
|
|
355
|
+
label: "Show",
|
|
356
|
+
size: "small",
|
|
357
|
+
value: (_draft_trigger = draft.trigger) != null ? _draft_trigger : 'delay',
|
|
358
|
+
onChange: (event)=>patch({
|
|
359
|
+
trigger: event.target.value
|
|
360
|
+
}),
|
|
361
|
+
sx: {
|
|
362
|
+
minWidth: 200
|
|
363
|
+
},
|
|
364
|
+
children: TRIGGERS.map((option)=>/*#__PURE__*/ _jsx(MenuItem, {
|
|
365
|
+
value: option.value,
|
|
366
|
+
children: option.label
|
|
367
|
+
}, option.value))
|
|
368
|
+
}),
|
|
369
|
+
draft.trigger !== 'exit' ? /*#__PURE__*/ _jsx(TextField, {
|
|
370
|
+
label: draft.trigger === 'scroll' ? 'Depth %' : 'Seconds',
|
|
371
|
+
size: "small",
|
|
372
|
+
type: "number",
|
|
373
|
+
value: (_draft_triggerValue = draft.triggerValue) != null ? _draft_triggerValue : 3,
|
|
374
|
+
onChange: (event)=>patch({
|
|
375
|
+
triggerValue: Number(event.target.value)
|
|
376
|
+
}),
|
|
377
|
+
sx: {
|
|
378
|
+
width: 110
|
|
379
|
+
}
|
|
380
|
+
}) : null,
|
|
381
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
382
|
+
label: "Re-show after (days)",
|
|
383
|
+
size: "small",
|
|
384
|
+
type: "number",
|
|
385
|
+
value: (_draft_frequencyDays = draft.frequencyDays) != null ? _draft_frequencyDays : 7,
|
|
386
|
+
onChange: (event)=>patch({
|
|
387
|
+
frequencyDays: Number(event.target.value)
|
|
388
|
+
}),
|
|
389
|
+
sx: {
|
|
390
|
+
width: 160
|
|
391
|
+
}
|
|
392
|
+
})
|
|
393
|
+
]
|
|
394
|
+
}),
|
|
395
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
396
|
+
direction: "row",
|
|
397
|
+
spacing: 1,
|
|
398
|
+
sx: {
|
|
399
|
+
flexWrap: 'wrap',
|
|
400
|
+
rowGap: 1
|
|
401
|
+
},
|
|
402
|
+
children: [
|
|
403
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
404
|
+
label: "Start (optional)",
|
|
405
|
+
size: "small",
|
|
406
|
+
type: "datetime-local",
|
|
407
|
+
value: toLocalInput(draft.startAtMs),
|
|
408
|
+
onChange: (event)=>patch({
|
|
409
|
+
startAtMs: fromLocalInput(event.target.value)
|
|
410
|
+
}),
|
|
411
|
+
slotProps: {
|
|
412
|
+
inputLabel: {
|
|
413
|
+
shrink: true
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
sx: {
|
|
417
|
+
minWidth: 200
|
|
418
|
+
}
|
|
419
|
+
}),
|
|
420
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
421
|
+
label: "End (optional)",
|
|
422
|
+
size: "small",
|
|
423
|
+
type: "datetime-local",
|
|
424
|
+
value: toLocalInput(draft.endAtMs),
|
|
425
|
+
onChange: (event)=>patch({
|
|
426
|
+
endAtMs: fromLocalInput(event.target.value)
|
|
427
|
+
}),
|
|
428
|
+
slotProps: {
|
|
429
|
+
inputLabel: {
|
|
430
|
+
shrink: true
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
sx: {
|
|
434
|
+
minWidth: 200
|
|
435
|
+
}
|
|
436
|
+
})
|
|
437
|
+
]
|
|
438
|
+
}),
|
|
439
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
440
|
+
variant: "contained",
|
|
441
|
+
color: "primary",
|
|
442
|
+
disabled: !dirty || Boolean(draft.enabled) && !((_draft_body = draft.body) == null ? void 0 : _draft_body.trim()) || copy.pending(draft.headline, draft.body),
|
|
443
|
+
onClick: handleSave,
|
|
444
|
+
sx: {
|
|
445
|
+
alignSelf: 'flex-start'
|
|
446
|
+
},
|
|
447
|
+
children: 'Save'
|
|
448
|
+
}),
|
|
449
|
+
/*#__PURE__*/ _jsx(OverlayStatsRow, {
|
|
450
|
+
hostId: hostId,
|
|
451
|
+
impressionKey: "popupImpression",
|
|
452
|
+
actionKey: "popupClick",
|
|
453
|
+
actionLabel: "clicks"
|
|
454
|
+
})
|
|
455
|
+
]
|
|
456
|
+
})
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
PopupCard.displayName = 'PopupCard';
|
|
460
|
+
export default PopupCard;
|
|
461
|
+
|
|
462
|
+
//# sourceMappingURL=popup-card.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/marketing/src/lib/components/popup-card.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport {\n type AglynOrgBilling,\n checkEntitlement,\n type HostPopup,\n inheritedMediaAlt,\n MEDIA_ALT_MAX_LENGTH,\n pluginDocsHelp,\n useMediaPicker,\n} from '@aglyn/aglyn'\nimport { CardDisplay, useLoading } from '@aglyn/shared-ui-jsx'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport {\n Alert,\n Button,\n MenuItem,\n Stack,\n Switch,\n TextField,\n Typography,\n} from '@mui/material'\nimport { doc, updateDoc } from 'firebase/firestore'\nimport { useEffect, useState } from 'react'\nimport {\n useFirestore,\n useFirestoreDoc,\n useHostActivityLogger,\n writeGuardedBySeed,\n} from '@aglyn/tenant-feature-instance'\nimport OverlayStatsRow from './overlay-stats-row.component'\nimport {\n OVERLAY_COPY_HELPER_TEXT,\n shownAsTypedHelperText,\n useOverlayCopyEditor,\n} from './use-overlay-copy-editor'\n\nexport interface PopupCardProps {\n hostId: string\n /** Resolved entitlement source (AGL-395). */\n org?: Partial<AglynOrgBilling>\n}\n\nconst TRIGGERS: Array<{ value: NonNullable<HostPopup['trigger']>; label: string }> = [\n { value: 'delay', label: 'After a delay (seconds)' },\n { value: 'scroll', label: 'At scroll depth (%)' },\n { value: 'exit', label: 'On exit intent (desktop)' },\n]\n\nconst toLocalInput = (ms?: number) => {\n if (!ms) return ''\n const date = new Date(ms - new Date().getTimezoneOffset() * 60000)\n return date.toISOString().slice(0, 16)\n}\nconst fromLocalInput = (value: string) =>\n value ? new Date(value).getTime() : undefined\n\n/**\n * Promotional popup editor (AGL-196): one popup per host, persisted on the\n * host doc; the tenant render handles triggers, scheduling, and\n * frequency capping. marketingOverlays-gated (Starter+). The headline and\n * body are edited through `useOverlayCopyEditor`, like the bar's text\n * (AGL-2885).\n */\nexport function PopupCard(props: PopupCardProps) {\n const { hostId } = props\n const firestore = useFirestore()\n const { org } = props\n const { enqueueSnackbar } = useSnackbar()\n const { queueLoading } = useLoading()\n const logActivity = useHostActivityLogger(hostId)\n const {\n data: host,\n status: hostStatus,\n /**\n * The host doc this form is seeded from is unconfirmed by the server\n * (AGL-1358). The save writes the whole `popup` map — a nested map value\n * REPLACES atomically, so `updateDoc` protects only the host doc's other\n * fields, never the popup's own — and every field of it comes off this\n * seed. Against a cached read, retyping the headline restores yesterday's\n * body, link, schedule and enabled flag on a live site.\n */\n fromCache: hostFromCache,\n } = useFirestoreDoc<any>(\n () => doc(firestore, 'hosts', hostId),\n [firestore, hostId],\n { idField: '$id' },\n )\n const entitled = checkEntitlement(org, 'marketingOverlays')\n\n const saved = (host?.popup ?? {}) as HostPopup\n const [draft, setDraft] = useState<HostPopup>(saved)\n const savedKey = JSON.stringify(saved)\n useEffect(() => {\n setDraft(JSON.parse(savedKey))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [savedKey])\n\n // The console media browser is provided by the shell (AGL-395).\n const { pickMedia } = useMediaPicker()\n // The headline and body are held in their stored form; the fields show them\n // as typed.\n const copy = useOverlayCopyEditor({\n hostId,\n host,\n usesTokens:\n entitled &&\n [saved.headline, saved.body, draft.headline, draft.body].some((text) =>\n text?.includes('{{'),\n ),\n })\n // Compared as it would be stored, so a name typed before the variables\n // arrived still counts as the change it becomes on save.\n const dirty =\n JSON.stringify({\n ...draft,\n headline: copy.stored(draft.headline),\n body: copy.stored(draft.body),\n }) !== savedKey\n const patch = (partial: Partial<HostPopup>) =>\n setDraft((previous) => ({ ...previous, ...partial }))\n const headlineShownAsTyped = copy.shownAsTyped(draft.headline)\n const bodyShownAsTyped = copy.shownAsTyped(draft.body)\n\n const handleSave = async () => {\n const dequeue = queueLoading()\n try {\n /**\n * Refuse a save whose seed the server never confirmed (AGL-1358).\n *\n * There is no create path to exempt here, and that is the point: unlike\n * a new row at a fresh uid, this writes a FIXED document path, so a\n * blank `draft` — what `host?.popup ?? {}` yields when the cache has\n * never seen a popup — is not harmless. It replaces whatever popup the\n * server really holds with an empty one. Both the populated and the\n * empty seed are guarded for the same reason.\n *\n * The activity log rides inside the guard: a logged \"Updated popup\"\n * whose write never happened leaves the history disagreeing with the\n * popup it claims to explain.\n *\n * The guard WRAPS the write — an early return is a shape you can keep\n * while losing the protection.\n */\n const verdict = await writeGuardedBySeed(\n {\n subject: 'popup',\n unreadable: hostStatus === 'error',\n fromCache: hostFromCache,\n },\n async () => {\n await updateDoc(doc(firestore, 'hosts', hostId), {\n popup: {\n enabled: Boolean(draft.enabled),\n headline: copy.storedWithin(draft.headline, 120),\n body: copy.storedWithin(draft.body, 1000),\n imageUrl: (draft.imageUrl ?? '').trim(),\n // AGL-1896. Capped at the same length the media library saves\n // alt through, so a value defaulted from an asset and a value\n // typed here cannot diverge.\n imageAlt: (draft.imageAlt ?? '')\n .trim()\n .slice(0, MEDIA_ALT_MAX_LENGTH),\n ctaLabel: (draft.ctaLabel ?? '').slice(0, 60),\n ctaHref: (draft.ctaHref ?? '').trim(),\n collectEmail: Boolean(draft.collectEmail),\n trigger: draft.trigger ?? 'delay',\n triggerValue: Math.max(0, Number(draft.triggerValue ?? 3)),\n frequencyDays: Math.max(1, Number(draft.frequencyDays ?? 7)),\n startAtMs: draft.startAtMs ?? null,\n endAtMs: draft.endAtMs ?? null,\n },\n })\n logActivity('Updated popup', { type: 'host', id: hostId })\n },\n )\n // A refusal leaves every typed value on screen. A save that silently\n // does nothing sends the user back to retype a form that will be\n // refused again just as quietly.\n if (!verdict.ok) {\n return void enqueueSnackbar(verdict.message, {\n variant: 'warning',\n persist: false,\n })\n }\n enqueueSnackbar('Popup saved', { variant: 'success', persist: false })\n } catch (error) {\n console.error(error)\n enqueueSnackbar('An error has occurred', {\n variant: 'error',\n allowDuplicate: true,\n })\n } finally {\n dequeue()\n }\n }\n\n return (\n <CardDisplay\n header=\"Promotional popup\"\n help={pluginDocsHelp('marketingOverlays', {\n anchor: '#promotional-popups',\n excerpt:\n 'The site-wide default popup. Its only frequency cap is a number ' +\n 'of days — the once-per-session choice is on the overlays card.',\n })}\n contentGutterX\n contentGutterY\n >\n {!entitled ? (\n <Alert severity=\"info\">\n {'Popups are included from the Starter plan — see Billing to ' +\n 'upgrade.'}\n </Alert>\n ) : (\n <Stack spacing={2}>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <Switch\n checked={Boolean(draft.enabled)}\n onChange={(event) => patch({ enabled: event.target.checked })}\n />\n <Typography variant=\"body2\">\n {draft.enabled ? 'Active on your published site' : 'Off'}\n </Typography>\n </Stack>\n <TextField\n label=\"Headline\"\n size=\"small\"\n value={copy.editable(draft.headline)}\n onChange={(event) =>\n patch({ headline: copy.stored(event.target.value) })\n }\n error={headlineShownAsTyped.length > 0}\n helperText={shownAsTypedHelperText(headlineShownAsTyped)}\n fullWidth\n />\n <TextField\n label=\"Body\"\n size=\"small\"\n value={copy.editable(draft.body)}\n onChange={(event) =>\n patch({ body: copy.stored(event.target.value) })\n }\n error={bodyShownAsTyped.length > 0}\n helperText={\n shownAsTypedHelperText(bodyShownAsTyped) ?? OVERLAY_COPY_HELPER_TEXT\n }\n multiline\n minRows={2}\n fullWidth\n />\n <Stack direction=\"row\" spacing={1} sx={{ flexWrap: 'wrap', rowGap: 1 }}>\n <TextField\n label=\"Image URL (optional)\"\n size=\"small\"\n placeholder=\"Pick from the media library\"\n value={draft.imageUrl ?? ''}\n onChange={(event) => patch({ imageUrl: event.target.value })}\n sx={{ flex: 1, minWidth: 220 }}\n />\n <Button\n size=\"small\"\n onClick={() =>\n void (async () => {\n const media = await pickMedia?.()\n if (!media) return\n // Alt defaults from the asset (AGL-1896), never clobbering\n // one the author already typed for THIS popup. Undefined\n // when the asset has no alt or the field is already\n // filled, and the spread then leaves `imageAlt` alone.\n const inheritedAlt = inheritedMediaAlt({\n placementAlt: draft.imageAlt,\n assetAlt: media.alt,\n })\n patch({\n imageUrl: media.url,\n ...(inheritedAlt ? { imageAlt: inheritedAlt } : {}),\n })\n })()\n }\n >\n {'Browse media'}\n </Button>\n </Stack>\n {/* AGL-1896: the popup image rendered `alt=\"\"` with no field\n behind it. Offered whenever there is an image to describe. */}\n {(draft.imageUrl ?? '').trim() ? (\n <TextField\n label=\"Image alt text\"\n size=\"small\"\n value={draft.imageAlt ?? ''}\n onChange={(event) => patch({ imageAlt: event.target.value })}\n helperText={\n 'Describes the image for screen readers. Filled in from the ' +\n 'media library when you pick an image that has alt text. ' +\n 'Leave empty only if the image is purely decorative.'\n }\n />\n ) : null}\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <Switch\n checked={Boolean(draft.collectEmail)}\n onChange={(event) =>\n patch({ collectEmail: event.target.checked })\n }\n />\n <Typography variant=\"body2\">\n {'Collect emails (submissions land in your Inbox and Contacts)'}\n </Typography>\n </Stack>\n <Stack direction=\"row\" spacing={1} sx={{ flexWrap: 'wrap', rowGap: 1 }}>\n <TextField\n label=\"Button label\"\n size=\"small\"\n value={draft.ctaLabel ?? ''}\n onChange={(event) => patch({ ctaLabel: event.target.value })}\n sx={{ width: 160 }}\n />\n <TextField\n label=\"Button link\"\n size=\"small\"\n placeholder=\"/sale or https://…\"\n value={draft.ctaHref ?? ''}\n onChange={(event) => patch({ ctaHref: event.target.value })}\n sx={{ flex: 1, minWidth: 180 }}\n />\n </Stack>\n <Stack direction=\"row\" spacing={1} sx={{ flexWrap: 'wrap', rowGap: 1 }}>\n <TextField\n select\n label=\"Show\"\n size=\"small\"\n value={draft.trigger ?? 'delay'}\n onChange={(event) =>\n patch({ trigger: event.target.value as HostPopup['trigger'] })\n }\n sx={{ minWidth: 200 }}\n >\n {TRIGGERS.map((option) => (\n <MenuItem key={option.value} value={option.value}>\n {option.label}\n </MenuItem>\n ))}\n </TextField>\n {draft.trigger !== 'exit' ? (\n <TextField\n label={draft.trigger === 'scroll' ? 'Depth %' : 'Seconds'}\n size=\"small\"\n type=\"number\"\n value={draft.triggerValue ?? 3}\n onChange={(event) =>\n patch({ triggerValue: Number(event.target.value) })\n }\n sx={{ width: 110 }}\n />\n ) : null}\n <TextField\n label=\"Re-show after (days)\"\n size=\"small\"\n type=\"number\"\n value={draft.frequencyDays ?? 7}\n onChange={(event) =>\n patch({ frequencyDays: Number(event.target.value) })\n }\n sx={{ width: 160 }}\n />\n </Stack>\n <Stack direction=\"row\" spacing={1} sx={{ flexWrap: 'wrap', rowGap: 1 }}>\n <TextField\n label=\"Start (optional)\"\n size=\"small\"\n type=\"datetime-local\"\n value={toLocalInput(draft.startAtMs)}\n onChange={(event) =>\n patch({ startAtMs: fromLocalInput(event.target.value) })\n }\n slotProps={{ inputLabel: { shrink: true } }}\n sx={{ minWidth: 200 }}\n />\n <TextField\n label=\"End (optional)\"\n size=\"small\"\n type=\"datetime-local\"\n value={toLocalInput(draft.endAtMs)}\n onChange={(event) =>\n patch({ endAtMs: fromLocalInput(event.target.value) })\n }\n slotProps={{ inputLabel: { shrink: true } }}\n sx={{ minWidth: 200 }}\n />\n </Stack>\n <Button\n variant=\"contained\"\n color=\"primary\"\n disabled={\n !dirty ||\n (Boolean(draft.enabled) && !draft.body?.trim()) ||\n copy.pending(draft.headline, draft.body)\n }\n onClick={handleSave}\n sx={{ alignSelf: 'flex-start' }}\n >\n {'Save'}\n </Button>\n <OverlayStatsRow\n hostId={hostId}\n impressionKey=\"popupImpression\"\n actionKey=\"popupClick\"\n actionLabel=\"clicks\"\n />\n </Stack>\n )}\n </CardDisplay>\n )\n}\nPopupCard.displayName = 'PopupCard'\n\nexport default PopupCard\n"],"names":["checkEntitlement","inheritedMediaAlt","MEDIA_ALT_MAX_LENGTH","pluginDocsHelp","useMediaPicker","CardDisplay","useLoading","useSnackbar","Alert","Button","MenuItem","Stack","Switch","TextField","Typography","doc","updateDoc","useEffect","useState","useFirestore","useFirestoreDoc","useHostActivityLogger","writeGuardedBySeed","OverlayStatsRow","OVERLAY_COPY_HELPER_TEXT","shownAsTypedHelperText","useOverlayCopyEditor","TRIGGERS","value","label","toLocalInput","ms","date","Date","getTimezoneOffset","toISOString","slice","fromLocalInput","getTime","undefined","PopupCard","props","draft","hostId","firestore","org","enqueueSnackbar","queueLoading","logActivity","data","host","status","hostStatus","fromCache","hostFromCache","idField","entitled","saved","popup","setDraft","savedKey","JSON","stringify","parse","pickMedia","copy","usesTokens","headline","body","some","text","includes","dirty","stored","patch","partial","previous","headlineShownAsTyped","shownAsTyped","bodyShownAsTyped","handleSave","dequeue","verdict","subject","unreadable","enabled","Boolean","storedWithin","imageUrl","trim","imageAlt","ctaLabel","ctaHref","collectEmail","trigger","triggerValue","Math","max","Number","frequencyDays","startAtMs","endAtMs","type","id","ok","message","variant","persist","error","console","allowDuplicate","header","help","anchor","excerpt","contentGutterX","contentGutterY","severity","spacing","direction","sx","alignItems","checked","onChange","event","target","size","editable","length","helperText","fullWidth","multiline","minRows","flexWrap","rowGap","placeholder","flex","minWidth","onClick","media","inheritedAlt","placementAlt","assetAlt","alt","url","width","select","map","option","slotProps","inputLabel","shrink","color","disabled","pending","alignSelf","impressionKey","actionKey","actionLabel","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAEEA,gBAAgB,EAEhBC,iBAAiB,EACjBC,oBAAoB,EACpBC,cAAc,EACdC,cAAc,QACT,eAAc;AACrB,SAASC,WAAW,EAAEC,UAAU,QAAQ,uBAAsB;AAC9D,SAASC,WAAW,QAAQ,8BAA6B;AACzD,SACEC,KAAK,EACLC,MAAM,EACNC,QAAQ,EACRC,KAAK,EACLC,MAAM,EACNC,SAAS,EACTC,UAAU,QACL,gBAAe;AACtB,SAASC,GAAG,EAAEC,SAAS,QAAQ,qBAAoB;AACnD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAC3C,SACEC,YAAY,EACZC,eAAe,EACfC,qBAAqB,EACrBC,kBAAkB,QACb,iCAAgC;AACvC,OAAOC,qBAAqB,mCAA+B;AAC3D,SACEC,wBAAwB,EACxBC,sBAAsB,EACtBC,oBAAoB,QACf,+BAA2B;AAQlC,MAAMC,WAA+E;IACnF;QAAEC,OAAO;QAASC,OAAO;IAA0B;IACnD;QAAED,OAAO;QAAUC,OAAO;IAAsB;IAChD;QAAED,OAAO;QAAQC,OAAO;IAA2B;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BACTwC,IAAI;wBAAEmC,WAAW;oBAAa;8BAE7B;;8BAEH,KAACpI;oBACCoB,QAAQA;oBACRiH,eAAc;oBACdC,WAAU;oBACVC,aAAY;;;;;AAMxB;AACAtH,UAAUuH,WAAW,GAAG;AAExB,eAAevH,UAAS"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The widget this plugin draws in another plugin's record-attribution zone.
|
|
19
|
+
*
|
|
20
|
+
* The CRM and the Inbox each host a zone on a record and hand it
|
|
21
|
+
* `{ hostId, recordKind, recordId }` in their own words. Those words are the
|
|
22
|
+
* identify moments this plugin credits a conversion at, so the widget reads
|
|
23
|
+
* the kind as one — and draws nothing for a kind it never credits, rather
|
|
24
|
+
* than reading a document that cannot exist.
|
|
25
|
+
*/
|
|
26
|
+
export interface RecordAttributionWidgetProps {
|
|
27
|
+
hostId?: string | null;
|
|
28
|
+
recordKind?: string;
|
|
29
|
+
recordId?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function RecordAttributionWidget(props: RecordAttributionWidgetProps): import("react").JSX.Element;
|
|
32
|
+
export declare namespace RecordAttributionWidget {
|
|
33
|
+
var displayName: string;
|
|
34
|
+
}
|
|
35
|
+
export default RecordAttributionWidget;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ 'use client';
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
import { CAMPAIGN_CONVERSION_KINDS } from "@aglyn/shared-ui-email-campaigns/model/campaign-conversions";
|
|
19
|
+
import ConversionAttribution from "./conversion-attribution.component.js";
|
|
20
|
+
const isConversionKind = (kind)=>CAMPAIGN_CONVERSION_KINDS.includes(kind);
|
|
21
|
+
export function RecordAttributionWidget(props) {
|
|
22
|
+
const { hostId, recordKind, recordId } = props;
|
|
23
|
+
if (!hostId || !recordId || !isConversionKind(recordKind)) return null;
|
|
24
|
+
return /*#__PURE__*/ _jsx(ConversionAttribution, {
|
|
25
|
+
hostId: hostId,
|
|
26
|
+
kind: recordKind,
|
|
27
|
+
refId: recordId
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
RecordAttributionWidget.displayName = 'RecordAttributionWidget';
|
|
31
|
+
export default RecordAttributionWidget;
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=record-attribution-widget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/marketing/src/lib/components/record-attribution-widget.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n'use client'\n\nimport {\n CAMPAIGN_CONVERSION_KINDS,\n type CampaignConversionKind,\n} from '@aglyn/shared-ui-email-campaigns/model/campaign-conversions'\nimport ConversionAttribution from './conversion-attribution.component'\n\n/**\n * The widget this plugin draws in another plugin's record-attribution zone.\n *\n * The CRM and the Inbox each host a zone on a record and hand it\n * `{ hostId, recordKind, recordId }` in their own words. Those words are the\n * identify moments this plugin credits a conversion at, so the widget reads\n * the kind as one — and draws nothing for a kind it never credits, rather\n * than reading a document that cannot exist.\n */\nexport interface RecordAttributionWidgetProps {\n hostId?: string | null\n recordKind?: string\n recordId?: string\n}\n\nconst isConversionKind = (kind: unknown): kind is CampaignConversionKind =>\n (CAMPAIGN_CONVERSION_KINDS as readonly unknown[]).includes(kind)\n\nexport function RecordAttributionWidget(props: RecordAttributionWidgetProps) {\n const { hostId, recordKind, recordId } = props\n if (!hostId || !recordId || !isConversionKind(recordKind)) return null\n return <ConversionAttribution hostId={hostId} kind={recordKind} refId={recordId} />\n}\nRecordAttributionWidget.displayName = 'RecordAttributionWidget'\n\nexport default RecordAttributionWidget\n"],"names":["CAMPAIGN_CONVERSION_KINDS","ConversionAttribution","isConversionKind","kind","includes","RecordAttributionWidget","props","hostId","recordKind","recordId","refId","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;AAEA,SACEA,yBAAyB,QAEpB,8DAA6D;AACpE,OAAOC,2BAA2B,wCAAoC;AAiBtE,MAAMC,mBAAmB,CAACC,OACxB,AAACH,0BAAiDI,QAAQ,CAACD;AAE7D,OAAO,SAASE,wBAAwBC,KAAmC;IACzE,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGH;IACzC,IAAI,CAACC,UAAU,CAACE,YAAY,CAACP,iBAAiBM,aAAa,OAAO;IAClE,qBAAO,KAACP;QAAsBM,QAAQA;QAAQJ,MAAMK;QAAYE,OAAOD;;AACzE;AACAJ,wBAAwBM,WAAW,GAAG;AAEtC,eAAeN,wBAAuB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SiteRuntimeProps } from '@aglyn/aglyn';
|
|
2
|
+
/**
|
|
3
|
+
* The marketing plugin's site runtime (AGL-419), relocated verbatim from
|
|
4
|
+
* the tenant catch-all: announcement bar + popup rendering (AGL-195/200),
|
|
5
|
+
* the experiments runner (AGL-253), the site-event automations engine
|
|
6
|
+
* (AGL-256/257), and automation-triggered overlays. Reads back exactly the
|
|
7
|
+
* page-props slices its server enricher wrote (site-contract shapes).
|
|
8
|
+
*/
|
|
9
|
+
export declare function MarketingSiteRuntime({ hostId, screens, page }: SiteRuntimeProps): import("react").JSX.Element;
|