@automattic/jetpack-ai-client 0.25.7 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/build/components/ai-icon/index.d.ts +10 -0
- package/build/components/ai-icon/index.js +16 -0
- package/build/components/ai-image/components/ai-image-modal.d.ts +57 -0
- package/build/components/ai-image/components/ai-image-modal.js +92 -0
- package/build/components/ai-image/components/carrousel.d.ts +28 -0
- package/build/components/ai-image/components/carrousel.js +69 -0
- package/build/components/ai-image/components/usage-counter.d.ts +16 -0
- package/build/components/ai-image/components/usage-counter.js +29 -0
- package/build/components/ai-image/featured-image.d.ts +17 -0
- package/build/components/ai-image/featured-image.js +278 -0
- package/build/components/ai-image/general-purpose-image.d.ts +23 -0
- package/build/components/ai-image/general-purpose-image.js +184 -0
- package/build/components/ai-image/hooks/use-ai-image.d.ts +48 -0
- package/build/components/ai-image/hooks/use-ai-image.js +219 -0
- package/build/components/ai-image/hooks/use-site-type.d.ts +6 -0
- package/build/components/ai-image/hooks/use-site-type.js +23 -0
- package/build/components/ai-image/index.d.ts +4 -0
- package/build/components/ai-image/index.js +4 -0
- package/build/components/ai-image/types.d.ts +16 -0
- package/build/components/ai-image/types.js +6 -0
- package/build/{ai-client/src/components → components}/index.d.ts +4 -0
- package/build/{ai-client/src/components → components}/index.js +4 -0
- package/build/components/modal/index.d.ts +18 -0
- package/build/components/modal/index.js +23 -0
- package/build/components/quota-exceeded-message/index.d.ts +13 -0
- package/build/components/quota-exceeded-message/index.js +152 -0
- package/build/components/quota-exceeded-message/light-nudge.d.ts +11 -0
- package/build/components/quota-exceeded-message/light-nudge.js +8 -0
- package/build/{ai-client/src/constants.d.ts → constants.d.ts} +3 -0
- package/build/{ai-client/src/constants.js → constants.js} +4 -0
- package/build/hooks/use-ai-checkout/index.d.ts +13 -0
- package/build/hooks/use-ai-checkout/index.js +41 -0
- package/build/hooks/use-ai-feature/index.d.ts +33 -0
- package/build/hooks/use-ai-feature/index.js +37 -0
- package/build/hooks/use-post-content.d.ts +5 -0
- package/build/hooks/use-post-content.js +20 -0
- package/build/hooks/use-save-to-media-library.d.ts +12 -0
- package/build/hooks/use-save-to-media-library.js +74 -0
- package/build/{ai-client/src/index.d.ts → index.d.ts} +3 -0
- package/build/{ai-client/src/index.js → index.js} +3 -0
- package/build/{ai-client/src/logo-generator → logo-generator}/components/upgrade-screen.js +1 -1
- package/build/{ai-client/src/logo-generator → logo-generator}/hooks/use-fair-usage-notice-message.js +1 -1
- package/package.json +20 -14
- package/src/components/ai-icon/index.tsx +39 -0
- package/src/components/ai-image/components/ai-image-modal.scss +88 -0
- package/src/components/ai-image/components/ai-image-modal.tsx +240 -0
- package/src/components/ai-image/components/carrousel.scss +163 -0
- package/src/components/ai-image/components/carrousel.tsx +217 -0
- package/src/components/ai-image/components/usage-counter.scss +19 -0
- package/src/components/ai-image/components/usage-counter.tsx +54 -0
- package/src/components/ai-image/featured-image.tsx +439 -0
- package/src/components/ai-image/general-purpose-image.tsx +303 -0
- package/src/components/ai-image/hooks/use-ai-image.ts +339 -0
- package/src/components/ai-image/hooks/use-site-type.ts +26 -0
- package/src/components/ai-image/index.ts +10 -0
- package/src/components/ai-image/style.scss +95 -0
- package/src/components/ai-image/types.ts +19 -0
- package/src/components/index.ts +12 -0
- package/src/components/modal/index.tsx +70 -0
- package/src/components/modal/style.scss +45 -0
- package/src/components/quota-exceeded-message/index.tsx +319 -0
- package/src/components/quota-exceeded-message/light-nudge.tsx +38 -0
- package/src/components/quota-exceeded-message/style.scss +35 -0
- package/src/constants.ts +5 -0
- package/src/hooks/use-ai-checkout/index.ts +65 -0
- package/src/hooks/use-ai-feature/Readme.md +20 -0
- package/src/hooks/use-ai-feature/index.ts +62 -0
- package/src/hooks/use-post-content.ts +27 -0
- package/src/hooks/use-save-to-media-library.ts +100 -0
- package/src/index.ts +3 -0
- package/src/logo-generator/components/upgrade-screen.tsx +1 -1
- package/src/logo-generator/hooks/use-fair-usage-notice-message.tsx +1 -1
- package/build/components/tools/jp-redirect/index.d.ts +0 -20
- package/build/components/tools/jp-redirect/index.js +0 -50
- package/build/components/tools/jp-redirect/types.d.ts +0 -39
- package/build/components/tools/jp-redirect/types.js +0 -1
- /package/build/{ai-client/src/api-fetch → api-fetch}/index.d.ts +0 -0
- /package/build/{ai-client/src/api-fetch → api-fetch}/index.js +0 -0
- /package/build/{ai-client/src/ask-question → ask-question}/index.d.ts +0 -0
- /package/build/{ai-client/src/ask-question → ask-question}/index.js +0 -0
- /package/build/{ai-client/src/ask-question → ask-question}/sync.d.ts +0 -0
- /package/build/{ai-client/src/ask-question → ask-question}/sync.js +0 -0
- /package/build/{ai-client/src/audio-transcription → audio-transcription}/index.d.ts +0 -0
- /package/build/{ai-client/src/audio-transcription → audio-transcription}/index.js +0 -0
- /package/build/{ai-client/src/components → components}/ai-control/ai-control.d.ts +0 -0
- /package/build/{ai-client/src/components → components}/ai-control/ai-control.js +0 -0
- /package/build/{ai-client/src/components → components}/ai-control/block-ai-control.d.ts +0 -0
- /package/build/{ai-client/src/components → components}/ai-control/block-ai-control.js +0 -0
- /package/build/{ai-client/src/components → components}/ai-control/extension-ai-control.d.ts +0 -0
- /package/build/{ai-client/src/components → components}/ai-control/extension-ai-control.js +0 -0
- /package/build/{ai-client/src/components → components}/ai-control/index.d.ts +0 -0
- /package/build/{ai-client/src/components → components}/ai-control/index.js +0 -0
- /package/build/{ai-client/src/components → components}/ai-feedback/index.d.ts +0 -0
- /package/build/{ai-client/src/components → components}/ai-feedback/index.js +0 -0
- /package/build/{ai-client/src/components → components}/ai-modal-footer/index.d.ts +0 -0
- /package/build/{ai-client/src/components → components}/ai-modal-footer/index.js +0 -0
- /package/build/{ai-client/src/components → components}/ai-status-indicator/index.d.ts +0 -0
- /package/build/{ai-client/src/components → components}/ai-status-indicator/index.js +0 -0
- /package/build/{ai-client/src/components → components}/audio-duration-display/index.d.ts +0 -0
- /package/build/{ai-client/src/components → components}/audio-duration-display/index.js +0 -0
- /package/build/{ai-client/src/components → components}/audio-duration-display/lib/media.d.ts +0 -0
- /package/build/{ai-client/src/components → components}/audio-duration-display/lib/media.js +0 -0
- /package/build/{ai-client/src/components → components}/message/index.d.ts +0 -0
- /package/build/{ai-client/src/components → components}/message/index.js +0 -0
- /package/build/{ai-client/src/data-flow → data-flow}/context.d.ts +0 -0
- /package/build/{ai-client/src/data-flow → data-flow}/context.js +0 -0
- /package/build/{ai-client/src/data-flow → data-flow}/index.d.ts +0 -0
- /package/build/{ai-client/src/data-flow → data-flow}/index.js +0 -0
- /package/build/{ai-client/src/data-flow → data-flow}/use-ai-context.d.ts +0 -0
- /package/build/{ai-client/src/data-flow → data-flow}/use-ai-context.js +0 -0
- /package/build/{ai-client/src/data-flow → data-flow}/with-ai-assistant-data.d.ts +0 -0
- /package/build/{ai-client/src/data-flow → data-flow}/with-ai-assistant-data.js +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-ai-suggestions/index.d.ts +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-ai-suggestions/index.js +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-audio-transcription/index.d.ts +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-audio-transcription/index.js +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-audio-validation/index.d.ts +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-audio-validation/index.js +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-image-generator/constants.d.ts +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-image-generator/constants.js +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-image-generator/index.d.ts +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-image-generator/index.js +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-media-recording/index.d.ts +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-media-recording/index.js +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-save-to-media-library/index.d.ts +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-save-to-media-library/index.js +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-transcription-post-processing/index.d.ts +0 -0
- /package/build/{ai-client/src/hooks → hooks}/use-transcription-post-processing/index.js +0 -0
- /package/build/{ai-client/src/icons → icons}/ai-assistant.d.ts +0 -0
- /package/build/{ai-client/src/icons → icons}/ai-assistant.js +0 -0
- /package/build/{ai-client/src/icons → icons}/error-exclamation.d.ts +0 -0
- /package/build/{ai-client/src/icons → icons}/error-exclamation.js +0 -0
- /package/build/{ai-client/src/icons → icons}/index.d.ts +0 -0
- /package/build/{ai-client/src/icons → icons}/index.js +0 -0
- /package/build/{ai-client/src/icons → icons}/mic.d.ts +0 -0
- /package/build/{ai-client/src/icons → icons}/mic.js +0 -0
- /package/build/{ai-client/src/icons → icons}/origami-plane.d.ts +0 -0
- /package/build/{ai-client/src/icons → icons}/origami-plane.js +0 -0
- /package/build/{ai-client/src/icons → icons}/player-pause.d.ts +0 -0
- /package/build/{ai-client/src/icons → icons}/player-pause.js +0 -0
- /package/build/{ai-client/src/icons → icons}/player-play.d.ts +0 -0
- /package/build/{ai-client/src/icons → icons}/player-play.js +0 -0
- /package/build/{ai-client/src/icons → icons}/player-stop.d.ts +0 -0
- /package/build/{ai-client/src/icons → icons}/player-stop.js +0 -0
- /package/build/{ai-client/src/icons → icons}/speak-tone.d.ts +0 -0
- /package/build/{ai-client/src/icons → icons}/speak-tone.js +0 -0
- /package/build/{ai-client/src/jwt → jwt}/index.d.ts +0 -0
- /package/build/{ai-client/src/jwt → jwt}/index.js +0 -0
- /package/build/{ai-client/src/libs → libs}/index.d.ts +0 -0
- /package/build/{ai-client/src/libs → libs}/index.js +0 -0
- /package/build/{ai-client/src/libs → libs}/map-action-to-human-text.d.ts +0 -0
- /package/build/{ai-client/src/libs → libs}/map-action-to-human-text.js +0 -0
- /package/build/{ai-client/src/libs → libs}/markdown/html-to-markdown.d.ts +0 -0
- /package/build/{ai-client/src/libs → libs}/markdown/html-to-markdown.js +0 -0
- /package/build/{ai-client/src/libs → libs}/markdown/index.d.ts +0 -0
- /package/build/{ai-client/src/libs → libs}/markdown/index.js +0 -0
- /package/build/{ai-client/src/libs → libs}/markdown/markdown-to-html.d.ts +0 -0
- /package/build/{ai-client/src/libs → libs}/markdown/markdown-to-html.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/assets/icons/ai.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/assets/icons/ai.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/assets/icons/check.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/assets/icons/check.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/assets/icons/logo.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/assets/icons/logo.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/assets/icons/media.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/assets/icons/media.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/fair-usage-notice.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/fair-usage-notice.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/feature-fetch-failure-screen.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/feature-fetch-failure-screen.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/first-load-screen.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/first-load-screen.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/generator-modal.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/generator-modal.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/history-carousel.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/history-carousel.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/image-loader.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/image-loader.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/logo-presenter.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/logo-presenter.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/prompt.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/prompt.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/upgrade-nudge.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/upgrade-nudge.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/upgrade-screen.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/visit-site-banner.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/components/visit-site-banner.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/constants.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/constants.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/hooks/use-checkout.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/hooks/use-checkout.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/hooks/use-fair-usage-notice-message.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/hooks/use-logo-generator.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/hooks/use-logo-generator.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/hooks/use-request-errors.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/hooks/use-request-errors.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/index.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/index.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/lib/logo-storage.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/lib/logo-storage.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/lib/media-exists.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/lib/media-exists.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/lib/set-site-logo.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/lib/set-site-logo.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/lib/wpcom-limited-request.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/lib/wpcom-limited-request.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/store/actions.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/store/actions.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/store/constants.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/store/constants.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/store/index.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/store/index.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/store/initial-state.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/store/initial-state.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/store/reducer.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/store/reducer.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/store/selectors.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/store/selectors.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/store/types.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/store/types.js +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/types.d.ts +0 -0
- /package/build/{ai-client/src/logo-generator → logo-generator}/types.js +0 -0
- /package/build/{ai-client/src/suggestions-event-source → suggestions-event-source}/index.d.ts +0 -0
- /package/build/{ai-client/src/suggestions-event-source → suggestions-event-source}/index.js +0 -0
- /package/build/{ai-client/src/types.d.ts → types.d.ts} +0 -0
- /package/build/{ai-client/src/types.js → types.js} +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
.ai-assistant-featured-image {
|
|
2
|
+
&__content {
|
|
3
|
+
display: flex;
|
|
4
|
+
margin-top: 32px;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: 8px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&__actions {
|
|
12
|
+
width: 100%;
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&__user-prompt {
|
|
18
|
+
width: 100%;
|
|
19
|
+
display: flex;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
flex-direction: row;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&__user-prompt-textarea {
|
|
25
|
+
width: 100%;
|
|
26
|
+
display: flex;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
|
|
29
|
+
textarea {
|
|
30
|
+
width: 100%;
|
|
31
|
+
outline: none;
|
|
32
|
+
border: 1px solid #CCC;
|
|
33
|
+
border-radius: 6px;
|
|
34
|
+
padding: 12px;
|
|
35
|
+
color: var(--studio-black);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
textarea:disabled {
|
|
39
|
+
opacity: 0.5;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&__actions-left {
|
|
44
|
+
width: 50%;
|
|
45
|
+
display: flex;
|
|
46
|
+
justify-content: flex-start;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&__actions-right {
|
|
50
|
+
width: 50%;
|
|
51
|
+
display: flex;
|
|
52
|
+
justify-content: flex-end;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&__action-buttons {
|
|
56
|
+
display: flex;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
gap: 12px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&__image-canvas {
|
|
62
|
+
width: 100%;
|
|
63
|
+
margin-top: 24px;
|
|
64
|
+
& > .jetpack-ai-upgrade-banner {
|
|
65
|
+
margin-bottom: 8px;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&__footer {
|
|
70
|
+
display: flex;
|
|
71
|
+
justify-content: flex-start;
|
|
72
|
+
margin-right: -32px;
|
|
73
|
+
margin-left: -32px;
|
|
74
|
+
margin-top: 32px;
|
|
75
|
+
margin-bottom: -32px;
|
|
76
|
+
padding: 8px 32px;
|
|
77
|
+
border-top: solid 1px #DCDCDE;
|
|
78
|
+
height: 60px;
|
|
79
|
+
|
|
80
|
+
&__feedback-button {
|
|
81
|
+
display: inline-block;
|
|
82
|
+
|
|
83
|
+
a {
|
|
84
|
+
text-decoration: none;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.icon {
|
|
89
|
+
width: 20px;
|
|
90
|
+
height: 20px;
|
|
91
|
+
color: var(--studio-gray-20);
|
|
92
|
+
margin-left: 4px;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const FEATURED_IMAGE_FEATURE_NAME = 'featured-post-image' as const;
|
|
2
|
+
export const GENERAL_IMAGE_FEATURE_NAME = 'general-image' as const;
|
|
3
|
+
export const IMAGE_GENERATION_MODEL_STABLE_DIFFUSION = 'stable-diffusion' as const;
|
|
4
|
+
export const IMAGE_GENERATION_MODEL_DALL_E_3 = 'dall-e-3' as const;
|
|
5
|
+
export const PLACEMENT_MEDIA_SOURCE_DROPDOWN = 'media-source-dropdown' as const;
|
|
6
|
+
export const PLACEMENT_BLOCK_PLACEHOLDER_BUTTON = 'block-placeholder-button' as const;
|
|
7
|
+
|
|
8
|
+
export interface EditorSelectors {
|
|
9
|
+
// actually getEditedPostAttribute can bring different values, but for our current use, number is fine (media ID)
|
|
10
|
+
getEditedPostAttribute: ( attribute: string ) => number;
|
|
11
|
+
isEditorPanelOpened: ( panel: string ) => boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface CoreSelectors {
|
|
15
|
+
getMedia: ( mediaId: number ) => {
|
|
16
|
+
id: number;
|
|
17
|
+
source_url: string;
|
|
18
|
+
} | null;
|
|
19
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
export { AIControl, BlockAIControl, ExtensionAIControl } from './ai-control/index.js';
|
|
2
2
|
export { default as AiFeedbackThumbs } from './ai-feedback/index.js';
|
|
3
|
+
export { default as AiIcon, AiSVG } from './ai-icon/index.js';
|
|
4
|
+
export {
|
|
5
|
+
FeaturedImage,
|
|
6
|
+
GeneralPurposeImage,
|
|
7
|
+
PLACEMENT_MEDIA_SOURCE_DROPDOWN,
|
|
8
|
+
PLACEMENT_BLOCK_PLACEHOLDER_BUTTON,
|
|
9
|
+
} from './ai-image/index.js';
|
|
3
10
|
export { default as AiStatusIndicator } from './ai-status-indicator/index.js';
|
|
4
11
|
export { default as AudioDurationDisplay } from './audio-duration-display/index.js';
|
|
5
12
|
export { default as AiModalFooter } from './ai-modal-footer/index.js';
|
|
@@ -9,3 +16,8 @@ export {
|
|
|
9
16
|
ErrorMessage,
|
|
10
17
|
default as FooterMessage,
|
|
11
18
|
} from './message/index.js';
|
|
19
|
+
export { default as AiAssistantModal } from './modal/index.js';
|
|
20
|
+
export {
|
|
21
|
+
default as QuotaExceededMessage,
|
|
22
|
+
FairUsageNotice,
|
|
23
|
+
} from './quota-exceeded-message/index.js';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Modal, Button } from '@wordpress/components';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { close } from '@wordpress/icons';
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import AiStatusIndicator from '../ai-status-indicator/index.js';
|
|
11
|
+
import type { RequestingStateProp } from '../../types.js';
|
|
12
|
+
import './style.scss';
|
|
13
|
+
|
|
14
|
+
const ModalHeader = ( {
|
|
15
|
+
requestingState,
|
|
16
|
+
onClose,
|
|
17
|
+
title,
|
|
18
|
+
}: {
|
|
19
|
+
requestingState: RequestingStateProp;
|
|
20
|
+
onClose: () => void;
|
|
21
|
+
title: string;
|
|
22
|
+
} ) => {
|
|
23
|
+
return (
|
|
24
|
+
<div className="ai-assistant-modal__header">
|
|
25
|
+
<div className="ai-assistant-modal__title-wrapper">
|
|
26
|
+
<AiStatusIndicator state={ requestingState } />
|
|
27
|
+
<h1 className="ai-assistant-modal__title">{ title }</h1>
|
|
28
|
+
</div>
|
|
29
|
+
<Button icon={ close } label={ __( 'Close', 'jetpack-ai-client' ) } onClick={ onClose } />
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type AiAssistantModalProps = {
|
|
35
|
+
children: React.ReactNode;
|
|
36
|
+
handleClose: () => void;
|
|
37
|
+
hideHeader?: boolean;
|
|
38
|
+
requestingState?: RequestingStateProp;
|
|
39
|
+
title?: string;
|
|
40
|
+
maxWidth?: number;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* AiAssistantModal component
|
|
45
|
+
* @param {AiAssistantModalProps} props - The component properties.
|
|
46
|
+
* @return {React.ReactElement} - rendered component.
|
|
47
|
+
*/
|
|
48
|
+
export default function AiAssistantModal( {
|
|
49
|
+
children,
|
|
50
|
+
handleClose,
|
|
51
|
+
hideHeader = true,
|
|
52
|
+
requestingState = 'init',
|
|
53
|
+
title = __( 'AI Assistant', 'jetpack-ai-client' ),
|
|
54
|
+
maxWidth = 720,
|
|
55
|
+
}: AiAssistantModalProps ) {
|
|
56
|
+
return (
|
|
57
|
+
<Modal
|
|
58
|
+
__experimentalHideHeader={ hideHeader }
|
|
59
|
+
className="ai-assistant-modal"
|
|
60
|
+
shouldCloseOnClickOutside={ false }
|
|
61
|
+
onRequestClose={ handleClose }
|
|
62
|
+
>
|
|
63
|
+
<div className="ai-assistant-modal__content" style={ { maxWidth } }>
|
|
64
|
+
<ModalHeader requestingState={ requestingState } onClose={ handleClose } title={ title } />
|
|
65
|
+
<hr className="ai-assistant-modal__divider" />
|
|
66
|
+
{ children }
|
|
67
|
+
</div>
|
|
68
|
+
</Modal>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.ai-assistant-modal {
|
|
2
|
+
@media (min-width: 960px) {
|
|
3
|
+
max-height: 95%;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
&__content {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
@media screen and (min-width: 960px) {
|
|
10
|
+
width: 100vw;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&__header {
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
margin-right: -32px;
|
|
18
|
+
margin-left: -32px;
|
|
19
|
+
margin-top: -32px;
|
|
20
|
+
padding: 8px 12px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&__divider {
|
|
24
|
+
background: #DCDCDE;
|
|
25
|
+
margin: 0 -32px;
|
|
26
|
+
height: 1px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&__title-wrapper {
|
|
30
|
+
display: flex;
|
|
31
|
+
gap: 16px;
|
|
32
|
+
align-items: center;
|
|
33
|
+
|
|
34
|
+
& > svg {
|
|
35
|
+
margin: 0;
|
|
36
|
+
color: #008710;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&__title {
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
line-height: 24px;
|
|
43
|
+
margin: 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import getRedirectUrl from '@automattic/jetpack-components/tools/jp-redirect';
|
|
5
|
+
import { useAnalytics, canUserPurchasePlan } from '@automattic/jetpack-shared-extension-utils';
|
|
6
|
+
import { Nudge as StandardNudge } from '@automattic/jetpack-shared-extension-utils/components';
|
|
7
|
+
import { Notice } from '@wordpress/components';
|
|
8
|
+
import { createInterpolateElement, useCallback } from '@wordpress/element';
|
|
9
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
10
|
+
import debugFactory from 'debug';
|
|
11
|
+
/*
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import useAICheckout from '../../hooks/use-ai-checkout/index.js';
|
|
15
|
+
import useAiFeature from '../../hooks/use-ai-feature/index.js';
|
|
16
|
+
import { LightNudge } from './light-nudge.js';
|
|
17
|
+
import type { ReactElement } from 'react';
|
|
18
|
+
import './style.scss';
|
|
19
|
+
|
|
20
|
+
type QuotaExceededMessageProps = {
|
|
21
|
+
placement?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
useLightNudge?: boolean;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const debug = debugFactory( 'jetpack-ai-client:upgrade-prompt' );
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The fair usage notice message for the AI Assistant block.
|
|
30
|
+
* @return {ReactElement} the fair usage notice message, with the proper link and date.
|
|
31
|
+
*/
|
|
32
|
+
const useFairUsageNoticeMessage = () => {
|
|
33
|
+
const { usagePeriod } = useAiFeature();
|
|
34
|
+
|
|
35
|
+
const getFormattedUsagePeriodStartDate = planUsagePeriod => {
|
|
36
|
+
if ( ! planUsagePeriod?.nextStart ) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const nextUsagePeriodStartDate = new Date( planUsagePeriod.nextStart );
|
|
41
|
+
return (
|
|
42
|
+
nextUsagePeriodStartDate.toLocaleString( 'default', { month: 'long' } ) +
|
|
43
|
+
' ' +
|
|
44
|
+
nextUsagePeriodStartDate.getDate()
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const getFairUsageNoticeMessage = resetDateString => {
|
|
49
|
+
const fairUsageMessage = __(
|
|
50
|
+
"You've reached this month's request limit, per our <link>fair usage policy</link>.",
|
|
51
|
+
'jetpack-ai-client'
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
if ( ! resetDateString ) {
|
|
55
|
+
return fairUsageMessage;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Translators: %s is the date when the requests will reset.
|
|
59
|
+
const dateMessage = __( 'Requests will reset on %s.', 'jetpack-ai-client' );
|
|
60
|
+
const formattedDateMessage = sprintf( dateMessage, resetDateString );
|
|
61
|
+
|
|
62
|
+
return `${ fairUsageMessage } ${ formattedDateMessage }`;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const nextUsagePeriodStartDateString = getFormattedUsagePeriodStartDate( usagePeriod );
|
|
66
|
+
|
|
67
|
+
// Get the proper template based on the presence of the next usage period start date.
|
|
68
|
+
const fairUsageNoticeMessage = getFairUsageNoticeMessage( nextUsagePeriodStartDateString );
|
|
69
|
+
|
|
70
|
+
const fairUsageNoticeMessageElement = createInterpolateElement( fairUsageNoticeMessage, {
|
|
71
|
+
link: (
|
|
72
|
+
<a
|
|
73
|
+
href="https://jetpack.com/redirect/?source=ai-assistant-fair-usage-policy"
|
|
74
|
+
target="_blank"
|
|
75
|
+
rel="noreferrer"
|
|
76
|
+
/>
|
|
77
|
+
),
|
|
78
|
+
} );
|
|
79
|
+
|
|
80
|
+
return fairUsageNoticeMessageElement;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The default upgrade prompt for the AI Assistant block, containing the Upgrade button and linking
|
|
85
|
+
* to the checkout page or the Jetpack AI interstitial page.
|
|
86
|
+
*
|
|
87
|
+
* @param {QuotaExceededMessageProps} props - Component props.
|
|
88
|
+
* @return {ReactElement} the Nudge component with the prompt.
|
|
89
|
+
*/
|
|
90
|
+
const DefaultUpgradePrompt = ( {
|
|
91
|
+
placement = null,
|
|
92
|
+
description = null,
|
|
93
|
+
useLightNudge = false,
|
|
94
|
+
}: QuotaExceededMessageProps ): ReactElement => {
|
|
95
|
+
const Nudge = useLightNudge ? LightNudge : StandardNudge;
|
|
96
|
+
|
|
97
|
+
const { checkoutUrl } = useAICheckout();
|
|
98
|
+
const canUpgrade = canUserPurchasePlan();
|
|
99
|
+
const { nextTier, tierPlansEnabled, currentTier, requestsCount } = useAiFeature();
|
|
100
|
+
|
|
101
|
+
const { tracks } = useAnalytics();
|
|
102
|
+
|
|
103
|
+
const handleUpgradeClick = useCallback( () => {
|
|
104
|
+
debug( 'upgrade', placement );
|
|
105
|
+
tracks.recordEvent( 'jetpack_ai_upgrade_button', {
|
|
106
|
+
current_tier_slug: currentTier?.slug,
|
|
107
|
+
requests_count: requestsCount,
|
|
108
|
+
placement: placement,
|
|
109
|
+
} );
|
|
110
|
+
}, [ currentTier, requestsCount, tracks, placement ] );
|
|
111
|
+
|
|
112
|
+
const handleContactUsClick = useCallback( () => {
|
|
113
|
+
debug( 'contact us', placement );
|
|
114
|
+
tracks.recordEvent( 'jetpack_ai_upgrade_contact_us', {
|
|
115
|
+
placement: placement,
|
|
116
|
+
} );
|
|
117
|
+
}, [ tracks, placement ] );
|
|
118
|
+
|
|
119
|
+
if ( ! canUpgrade ) {
|
|
120
|
+
const cantUpgradeDescription = createInterpolateElement(
|
|
121
|
+
__(
|
|
122
|
+
'Congratulations on exploring Jetpack AI and reaching the free requests limit! <strong>Reach out to the site administrator to upgrade and keep using Jetpack AI.</strong>',
|
|
123
|
+
'jetpack-ai-client'
|
|
124
|
+
),
|
|
125
|
+
{
|
|
126
|
+
strong: <strong />,
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<Nudge
|
|
132
|
+
showButton={ false }
|
|
133
|
+
className={ 'jetpack-ai-upgrade-banner' }
|
|
134
|
+
description={ description || cantUpgradeDescription }
|
|
135
|
+
visible={ true }
|
|
136
|
+
align={ null }
|
|
137
|
+
title={ null }
|
|
138
|
+
context={ null }
|
|
139
|
+
/>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if ( tierPlansEnabled ) {
|
|
144
|
+
if ( ! nextTier ) {
|
|
145
|
+
const contactHref = getRedirectUrl( 'jetpack-ai-tiers-more-requests-contact' );
|
|
146
|
+
const contactUsDescription = __(
|
|
147
|
+
'You have reached the request limit for your current plan.',
|
|
148
|
+
'jetpack-ai-client'
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<Nudge
|
|
153
|
+
buttonText={ __( 'Contact Us', 'jetpack-ai-client' ) }
|
|
154
|
+
description={ description || contactUsDescription }
|
|
155
|
+
className={ 'jetpack-ai-upgrade-banner' }
|
|
156
|
+
checkoutUrl={ contactHref }
|
|
157
|
+
visible={ true }
|
|
158
|
+
align={ null }
|
|
159
|
+
title={ null }
|
|
160
|
+
context={ null }
|
|
161
|
+
goToCheckoutPage={ handleContactUsClick }
|
|
162
|
+
target="_blank"
|
|
163
|
+
/>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const upgradeDescription = createInterpolateElement(
|
|
168
|
+
sprintf(
|
|
169
|
+
/* Translators: number of requests */
|
|
170
|
+
__(
|
|
171
|
+
'You have reached the requests limit for your current plan. <strong>Upgrade now to increase your requests limit to %d.</strong>',
|
|
172
|
+
'jetpack-ai-client'
|
|
173
|
+
),
|
|
174
|
+
nextTier.limit
|
|
175
|
+
),
|
|
176
|
+
{
|
|
177
|
+
strong: <strong />,
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<Nudge
|
|
183
|
+
buttonText={ sprintf(
|
|
184
|
+
/* Translators: number of requests */
|
|
185
|
+
__( 'Upgrade to %d requests', 'jetpack-ai-client' ),
|
|
186
|
+
nextTier.limit
|
|
187
|
+
) }
|
|
188
|
+
checkoutUrl={ checkoutUrl }
|
|
189
|
+
className={ 'jetpack-ai-upgrade-banner' }
|
|
190
|
+
description={ description || upgradeDescription }
|
|
191
|
+
goToCheckoutPage={ handleUpgradeClick }
|
|
192
|
+
visible={ true }
|
|
193
|
+
align={ 'center' }
|
|
194
|
+
title={ null }
|
|
195
|
+
context={ null }
|
|
196
|
+
target="_blank"
|
|
197
|
+
/>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return (
|
|
202
|
+
<Nudge
|
|
203
|
+
buttonText={ __( 'Upgrade', 'jetpack-ai-client' ) }
|
|
204
|
+
checkoutUrl={ checkoutUrl }
|
|
205
|
+
className={ 'jetpack-ai-upgrade-banner' }
|
|
206
|
+
description={ createInterpolateElement(
|
|
207
|
+
__(
|
|
208
|
+
'Congratulations on exploring Jetpack AI and reaching the free requests limit! <strong>Upgrade now to keep using it.</strong>',
|
|
209
|
+
'jetpack-ai-client'
|
|
210
|
+
),
|
|
211
|
+
{
|
|
212
|
+
strong: <strong />,
|
|
213
|
+
}
|
|
214
|
+
) }
|
|
215
|
+
goToCheckoutPage={ handleUpgradeClick }
|
|
216
|
+
visible={ true }
|
|
217
|
+
align={ null }
|
|
218
|
+
title={ null }
|
|
219
|
+
context={ null }
|
|
220
|
+
target="_blank"
|
|
221
|
+
/>
|
|
222
|
+
);
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* The VIP upgrade prompt, with a single text message recommending that the user reach
|
|
227
|
+
* out to their VIP account team.
|
|
228
|
+
*
|
|
229
|
+
* @param {object} props - Component props.
|
|
230
|
+
* @param {string} props.description - The description to display in the prompt.
|
|
231
|
+
* @param {boolean} props.useLightNudge - Wheter to use the light variant of the nudge, or the standard one.
|
|
232
|
+
* @return {ReactElement} the Nudge component with the prompt.
|
|
233
|
+
*/
|
|
234
|
+
const VIPUpgradePrompt = ( {
|
|
235
|
+
description = null,
|
|
236
|
+
useLightNudge = false,
|
|
237
|
+
}: {
|
|
238
|
+
description?: string;
|
|
239
|
+
useLightNudge?: boolean;
|
|
240
|
+
} ): ReactElement => {
|
|
241
|
+
const Nudge = useLightNudge ? LightNudge : StandardNudge;
|
|
242
|
+
const vipDescription = createInterpolateElement(
|
|
243
|
+
__(
|
|
244
|
+
"You've reached the Jetpack AI rate limit. <strong>Please reach out to your VIP account team.</strong>",
|
|
245
|
+
'jetpack-ai-client'
|
|
246
|
+
),
|
|
247
|
+
{
|
|
248
|
+
strong: <strong />,
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
return (
|
|
253
|
+
<Nudge
|
|
254
|
+
buttonText={ null }
|
|
255
|
+
checkoutUrl={ null }
|
|
256
|
+
className={ 'jetpack-ai-upgrade-banner' }
|
|
257
|
+
description={ description || vipDescription }
|
|
258
|
+
goToCheckoutPage={ null }
|
|
259
|
+
isRedirecting={ null }
|
|
260
|
+
visible={ true }
|
|
261
|
+
align={ null }
|
|
262
|
+
title={ null }
|
|
263
|
+
context={ null }
|
|
264
|
+
/>
|
|
265
|
+
);
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
type FairUsageNoticeProps = {
|
|
269
|
+
variant?: 'error' | 'muted';
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* The fair usage notice component.
|
|
274
|
+
* @param {FairUsageNoticeProps} props - Fair usage notice component props.
|
|
275
|
+
* @param {FairUsageNoticeProps.variant} props.variant - The variant of the notice to render.
|
|
276
|
+
* @return {ReactElement} the Notice component with the fair usage message.
|
|
277
|
+
*/
|
|
278
|
+
export const FairUsageNotice = ( { variant = 'error' }: FairUsageNoticeProps ) => {
|
|
279
|
+
const useFairUsageNoticeMessageElement = useFairUsageNoticeMessage();
|
|
280
|
+
|
|
281
|
+
if ( variant === 'muted' ) {
|
|
282
|
+
return (
|
|
283
|
+
<span className="jetpack-ai-fair-usage-notice-muted-variant">
|
|
284
|
+
{ useFairUsageNoticeMessageElement }
|
|
285
|
+
</span>
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if ( variant === 'error' ) {
|
|
290
|
+
return (
|
|
291
|
+
<Notice status="error" isDismissible={ false } className="jetpack-ai-fair-usage-notice">
|
|
292
|
+
{ useFairUsageNoticeMessageElement }
|
|
293
|
+
</Notice>
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return null;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
const QuotaExceededMessage = props => {
|
|
301
|
+
const { upgradeType, currentTier } = useAiFeature();
|
|
302
|
+
|
|
303
|
+
// Return notice component for the fair usage limit message, on unlimited plans.
|
|
304
|
+
if ( currentTier?.value === 1 ) {
|
|
305
|
+
return <FairUsageNotice />;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// If the user is on a VIP site, show the VIP upgrade prompt.
|
|
309
|
+
if ( upgradeType === 'vip' ) {
|
|
310
|
+
return VIPUpgradePrompt( {
|
|
311
|
+
description: props.description,
|
|
312
|
+
useLightNudge: props?.useLightNudge,
|
|
313
|
+
} );
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return DefaultUpgradePrompt( props );
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
export default QuotaExceededMessage;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Button, Notice } from '@wordpress/components';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
|
|
4
|
+
import './style.scss';
|
|
5
|
+
|
|
6
|
+
export const LightNudge = ( {
|
|
7
|
+
title,
|
|
8
|
+
description,
|
|
9
|
+
buttonText = null,
|
|
10
|
+
checkoutUrl = null,
|
|
11
|
+
goToCheckoutPage = null,
|
|
12
|
+
isRedirecting = false,
|
|
13
|
+
showButton = true,
|
|
14
|
+
target = '_top',
|
|
15
|
+
} ) => {
|
|
16
|
+
const redirectingText = __( 'Redirecting…', 'jetpack-ai-client' );
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div className="jetpack-upgrade-plan-banner-light">
|
|
20
|
+
<Notice status="error" isDismissible={ false }>
|
|
21
|
+
<p>
|
|
22
|
+
{ title && <strong>{ title }</strong> }
|
|
23
|
+
{ description }{ ' ' }
|
|
24
|
+
{ showButton && (
|
|
25
|
+
<Button
|
|
26
|
+
href={ isRedirecting ? null : checkoutUrl } // Only for server-side rendering, since onClick doesn't work there.
|
|
27
|
+
onClick={ goToCheckoutPage }
|
|
28
|
+
variant="link"
|
|
29
|
+
target={ target }
|
|
30
|
+
>
|
|
31
|
+
{ isRedirecting ? redirectingText : buttonText }
|
|
32
|
+
</Button>
|
|
33
|
+
) }
|
|
34
|
+
</p>
|
|
35
|
+
</Notice>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@import '@automattic/jetpack-base-styles/style';
|
|
2
|
+
|
|
3
|
+
.jetpack-upgrade-plan-banner__wrapper {
|
|
4
|
+
column-gap: 32px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.jetpack-upgrade-plan-banner.jetpack-ai-upgrade-banner {
|
|
8
|
+
.jetpack-upgrade-plan-banner__wrapper {
|
|
9
|
+
.components-button.is-primary.is-busy {
|
|
10
|
+
background: var( --jp-white );
|
|
11
|
+
color: var( --jp-black );
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.jetpack-ai-fair-usage-notice-muted-variant {
|
|
17
|
+
line-height: 1.4;
|
|
18
|
+
margin: 0px;
|
|
19
|
+
text-wrap: pretty;
|
|
20
|
+
font-size: calc(13px);
|
|
21
|
+
font-weight: normal;
|
|
22
|
+
color: #757575;
|
|
23
|
+
|
|
24
|
+
a {
|
|
25
|
+
color: #757575;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.jetpack-ai-fair-usage-notice {
|
|
30
|
+
color: #1E1E1E;
|
|
31
|
+
|
|
32
|
+
a {
|
|
33
|
+
color: #1E1E1E;
|
|
34
|
+
}
|
|
35
|
+
}
|
package/src/constants.ts
CHANGED
|
@@ -114,3 +114,8 @@ export const WRITE_POST_FROM_LIST_LABEL = __( 'Write a post from this list', 'je
|
|
|
114
114
|
export const GENERATE_TITLE_LABEL = __( 'Generate a post title', 'jetpack-ai-client' );
|
|
115
115
|
export const SUMMARY_BASED_ON_TITLE_LABEL = __( 'Summary based on title', 'jetpack-ai-client' );
|
|
116
116
|
export const CONTINUE_LABEL = __( 'Continue writing', 'jetpack-ai-client' );
|
|
117
|
+
|
|
118
|
+
// Jetpack Sidebar
|
|
119
|
+
export const PLACEMENT_JETPACK_SIDEBAR = 'jetpack-sidebar' as const;
|
|
120
|
+
export const PLACEMENT_DOCUMENT_SETTINGS = 'document-settings' as const;
|
|
121
|
+
export const PLACEMENT_PRE_PUBLISH = 'pre-publish' as const;
|