@automattic/launchpad 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +35 -0
- package/dist/cjs/badge/index.js +13 -0
- package/dist/cjs/badge/index.js.map +1 -0
- package/dist/cjs/badge/style.scss +50 -0
- package/dist/cjs/checklist/index.js +18 -0
- package/dist/cjs/checklist/index.js.map +1 -0
- package/dist/cjs/checklist/style.scss +9 -0
- package/dist/cjs/checklist-item/index.js +35 -0
- package/dist/cjs/checklist-item/index.js.map +1 -0
- package/dist/cjs/checklist-item/style.scss +214 -0
- package/dist/cjs/index.js +14 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/launchpad.js +19 -0
- package/dist/cjs/launchpad.js.map +1 -0
- package/dist/cjs/setup-actions.js +156 -0
- package/dist/cjs/setup-actions.js.map +1 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/badge/index.js +10 -0
- package/dist/esm/badge/index.js.map +1 -0
- package/dist/esm/badge/style.scss +50 -0
- package/dist/esm/checklist/index.js +15 -0
- package/dist/esm/checklist/index.js.map +1 -0
- package/dist/esm/checklist/style.scss +9 -0
- package/dist/esm/checklist-item/index.js +32 -0
- package/dist/esm/checklist-item/index.js.map +1 -0
- package/dist/esm/checklist-item/style.scss +214 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/launchpad.js +16 -0
- package/dist/esm/launchpad.js.map +1 -0
- package/dist/esm/setup-actions.js +151 -0
- package/dist/esm/setup-actions.js.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/tsconfig-cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/badge/index.d.ts +10 -0
- package/dist/types/badge/index.d.ts.map +1 -0
- package/dist/types/checklist/index.d.ts +12 -0
- package/dist/types/checklist/index.d.ts.map +1 -0
- package/dist/types/checklist-item/index.d.ts +11 -0
- package/dist/types/checklist-item/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/launchpad.d.ts +12 -0
- package/dist/types/launchpad.d.ts.map +1 -0
- package/dist/types/setup-actions.d.ts +3 -0
- package/dist/types/setup-actions.d.ts.map +1 -0
- package/dist/types/types.d.ts +64 -0
- package/dist/types/types.d.ts.map +1 -0
- package/jest.config.js +5 -0
- package/package.json +59 -0
- package/src/badge/index.tsx +27 -0
- package/src/badge/style.scss +50 -0
- package/src/checklist/index.tsx +43 -0
- package/src/checklist/style.scss +9 -0
- package/src/checklist-item/index.tsx +94 -0
- package/src/checklist-item/style.scss +214 -0
- package/src/index.ts +5 -0
- package/src/launchpad.tsx +45 -0
- package/src/setup-actions.ts +168 -0
- package/src/test/badge.tsx +50 -0
- package/src/test/checklist-item.tsx +96 -0
- package/src/test/checklist.tsx +25 -0
- package/src/test/launchpad.tsx +49 -0
- package/src/test/lib/fixtures.ts +322 -0
- package/src/types.ts +70 -0
- package/tsconfig-cjs.json +7 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { SiteDetails } from '@automattic/data-stores/src/site';
|
|
2
|
+
import { Task } from '../../types';
|
|
3
|
+
|
|
4
|
+
export const defaultSiteDetails: SiteDetails = {
|
|
5
|
+
ID: 211078228,
|
|
6
|
+
title: 'Test Link In Bio',
|
|
7
|
+
name: 'testLinkInBio',
|
|
8
|
+
description: 'test link in bio',
|
|
9
|
+
URL: 'https://testlinkinbio.wordpress.com',
|
|
10
|
+
domain: '',
|
|
11
|
+
locale: '',
|
|
12
|
+
slug: '',
|
|
13
|
+
capabilities: {
|
|
14
|
+
edit_pages: true,
|
|
15
|
+
edit_posts: true,
|
|
16
|
+
edit_others_posts: true,
|
|
17
|
+
edit_others_pages: true,
|
|
18
|
+
delete_posts: true,
|
|
19
|
+
delete_others_posts: true,
|
|
20
|
+
edit_theme_options: true,
|
|
21
|
+
edit_users: true,
|
|
22
|
+
list_users: true,
|
|
23
|
+
manage_categories: true,
|
|
24
|
+
manage_options: true,
|
|
25
|
+
moderate_comments: true,
|
|
26
|
+
activate_wordads: true,
|
|
27
|
+
promote_users: true,
|
|
28
|
+
publish_posts: true,
|
|
29
|
+
upload_files: true,
|
|
30
|
+
delete_users: false,
|
|
31
|
+
remove_users: true,
|
|
32
|
+
own_site: true,
|
|
33
|
+
view_hosting: true,
|
|
34
|
+
view_stats: true,
|
|
35
|
+
activate_plugins: true,
|
|
36
|
+
},
|
|
37
|
+
jetpack: false,
|
|
38
|
+
is_multisite: true,
|
|
39
|
+
site_owner: 69220074,
|
|
40
|
+
lang: 'en',
|
|
41
|
+
icon: {
|
|
42
|
+
img: 'https://testlib0777.files.wordpress.com/2022/10/site-logo.png?w=96',
|
|
43
|
+
ico: 'https://testlib0777.files.wordpress.com/2022/10/site-logo.png?w=96',
|
|
44
|
+
media_id: 5,
|
|
45
|
+
},
|
|
46
|
+
logo: {
|
|
47
|
+
id: '5',
|
|
48
|
+
sizes: [],
|
|
49
|
+
url: 'https://testlib0777.files.wordpress.com/2022/10/site-logo.png',
|
|
50
|
+
},
|
|
51
|
+
visible: true,
|
|
52
|
+
is_private: false,
|
|
53
|
+
is_coming_soon: true,
|
|
54
|
+
single_user_site: true,
|
|
55
|
+
is_vip: false,
|
|
56
|
+
options: {
|
|
57
|
+
timezone: 'America/Los_Angeles',
|
|
58
|
+
gmt_offset: -7,
|
|
59
|
+
blog_public: 0,
|
|
60
|
+
videopress_enabled: false,
|
|
61
|
+
upgraded_filetypes_enabled: false,
|
|
62
|
+
login_url: 'https://testlib0777.wordpress.com/wp-login.php',
|
|
63
|
+
admin_url: 'https://testlib0777.wordpress.com/wp-admin/',
|
|
64
|
+
is_mapped_domain: false,
|
|
65
|
+
is_redirect: false,
|
|
66
|
+
unmapped_url: 'https://testlib0777.wordpress.com',
|
|
67
|
+
featured_images_enabled: true,
|
|
68
|
+
theme_slug: 'pub/lynx',
|
|
69
|
+
header_image: false,
|
|
70
|
+
background_color: false,
|
|
71
|
+
image_default_link_type: 'none',
|
|
72
|
+
image_thumbnail_width: 150,
|
|
73
|
+
image_thumbnail_height: 150,
|
|
74
|
+
image_thumbnail_crop: 0,
|
|
75
|
+
image_medium_width: 300,
|
|
76
|
+
image_medium_height: 300,
|
|
77
|
+
image_large_width: 1024,
|
|
78
|
+
image_large_height: 1024,
|
|
79
|
+
permalink_structure: '/%year%/%monthnum%/%day%/%postname%/',
|
|
80
|
+
post_formats: [],
|
|
81
|
+
default_post_format: '0',
|
|
82
|
+
default_category: 1,
|
|
83
|
+
allowed_file_types: [
|
|
84
|
+
'jpg',
|
|
85
|
+
'jpeg',
|
|
86
|
+
'png',
|
|
87
|
+
'gif',
|
|
88
|
+
'pdf',
|
|
89
|
+
'doc',
|
|
90
|
+
'ppt',
|
|
91
|
+
'odt',
|
|
92
|
+
'pptx',
|
|
93
|
+
'docx',
|
|
94
|
+
'pps',
|
|
95
|
+
'ppsx',
|
|
96
|
+
'xls',
|
|
97
|
+
'xlsx',
|
|
98
|
+
'key',
|
|
99
|
+
'webp',
|
|
100
|
+
'heic',
|
|
101
|
+
'heif',
|
|
102
|
+
'asc',
|
|
103
|
+
],
|
|
104
|
+
show_on_front: 'page',
|
|
105
|
+
default_likes_enabled: true,
|
|
106
|
+
default_sharing_status: true,
|
|
107
|
+
default_comment_status: true,
|
|
108
|
+
default_ping_status: true,
|
|
109
|
+
software_version: '6.0.2',
|
|
110
|
+
created_at: '2022-10-01T17:24:08+00:00',
|
|
111
|
+
updated_at: '2022-10-01T17:24:10+00:00',
|
|
112
|
+
wordads: false,
|
|
113
|
+
publicize_permanently_disabled: false,
|
|
114
|
+
frame_nonce: 'f8e0ef6e72',
|
|
115
|
+
jetpack_frame_nonce: 'f8e0ef6e72',
|
|
116
|
+
page_on_front: 2,
|
|
117
|
+
page_for_posts: 0,
|
|
118
|
+
headstart: false,
|
|
119
|
+
headstart_is_fresh: false,
|
|
120
|
+
ak_vp_bundle_enabled: null,
|
|
121
|
+
advanced_seo_front_page_description: '',
|
|
122
|
+
advanced_seo_title_formats: [],
|
|
123
|
+
verification_services_codes: null,
|
|
124
|
+
podcasting_archive: null,
|
|
125
|
+
is_domain_only: false,
|
|
126
|
+
is_automated_transfer: false,
|
|
127
|
+
is_wpcom_atomic: false,
|
|
128
|
+
is_wpcom_store: false,
|
|
129
|
+
woocommerce_is_active: false,
|
|
130
|
+
editing_toolkit_is_active: true,
|
|
131
|
+
design_type: null,
|
|
132
|
+
site_segment: null,
|
|
133
|
+
import_engine: null,
|
|
134
|
+
is_pending_plan: false,
|
|
135
|
+
is_wpforteams_site: false,
|
|
136
|
+
p2_hub_blog_id: null,
|
|
137
|
+
is_cloud_eligible: false,
|
|
138
|
+
anchor_podcast: false,
|
|
139
|
+
was_created_with_blank_canvas_design: false,
|
|
140
|
+
videopress_storage_used: 0,
|
|
141
|
+
is_difm_lite_in_progress: false,
|
|
142
|
+
difm_lite_site_options: {},
|
|
143
|
+
site_intent: 'link-in-bio',
|
|
144
|
+
site_vertical_id: null,
|
|
145
|
+
launchpad_screen: 'full',
|
|
146
|
+
launchpad_checklist_tasks_statuses: {
|
|
147
|
+
links_edited: false,
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
plan: {
|
|
151
|
+
product_id: 1,
|
|
152
|
+
product_slug: 'free_plan',
|
|
153
|
+
product_name: 'WordPress.com Free',
|
|
154
|
+
product_name_short: 'Free',
|
|
155
|
+
expired: false,
|
|
156
|
+
billing_period: '',
|
|
157
|
+
user_is_owner: false,
|
|
158
|
+
is_free: true,
|
|
159
|
+
features: {
|
|
160
|
+
active: [ 'akismet', 'free-blog', 'space', 'support' ],
|
|
161
|
+
available: {
|
|
162
|
+
'core/audio': [
|
|
163
|
+
'personal-bundle',
|
|
164
|
+
'value_bundle',
|
|
165
|
+
'business-bundle',
|
|
166
|
+
'ecommerce-bundle',
|
|
167
|
+
'personal-bundle-2y',
|
|
168
|
+
'value_bundle-2y',
|
|
169
|
+
'business-bundle-2y',
|
|
170
|
+
'ecommerce-bundle-2y',
|
|
171
|
+
'personal-bundle-monthly',
|
|
172
|
+
'value_bundle_monthly',
|
|
173
|
+
'business-bundle-monthly',
|
|
174
|
+
'ecommerce-bundle-monthly',
|
|
175
|
+
'pro-plan-monthly',
|
|
176
|
+
'pro-plan-2y',
|
|
177
|
+
'starter-plan',
|
|
178
|
+
'pro-plan',
|
|
179
|
+
],
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
products: [],
|
|
184
|
+
launch_status: 'unlaunched',
|
|
185
|
+
is_wpcom_atomic: false,
|
|
186
|
+
user_interactions: [ '2022-10-01' ],
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const defaultTask: Task = {
|
|
190
|
+
id: 'foo_task',
|
|
191
|
+
completed: false,
|
|
192
|
+
disabled: true,
|
|
193
|
+
title: 'Foo Task',
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export function buildSiteDetails( details ) {
|
|
197
|
+
return {
|
|
198
|
+
...defaultSiteDetails,
|
|
199
|
+
...details,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export function buildTask( overrides ) {
|
|
204
|
+
return {
|
|
205
|
+
...defaultTask,
|
|
206
|
+
...overrides,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export const defaultDomainResponse: any = {
|
|
211
|
+
adminEmail: undefined,
|
|
212
|
+
aftermarketAuction: false,
|
|
213
|
+
aftermarketAuctionEnd: null,
|
|
214
|
+
aftermarketAuctionStart: null,
|
|
215
|
+
autoRenewalDate: '',
|
|
216
|
+
autoRenewing: false,
|
|
217
|
+
beginTransferUntilDate: '',
|
|
218
|
+
blogId: 0,
|
|
219
|
+
bundledPlanSubscriptionId: undefined,
|
|
220
|
+
canManageDnsRecords: false,
|
|
221
|
+
canManageNameServers: false,
|
|
222
|
+
cannotManageDnsRecordsReason: null,
|
|
223
|
+
cannotManageNameServersReason: null,
|
|
224
|
+
cannotUpdateContactInfoReason: null,
|
|
225
|
+
canSetAsPrimary: false,
|
|
226
|
+
canUpdateContactInfo: false,
|
|
227
|
+
connectionMode: '',
|
|
228
|
+
contactInfoDisclosed: false,
|
|
229
|
+
contactInfoDisclosureAvailable: false,
|
|
230
|
+
currentUserCanAddEmail: false,
|
|
231
|
+
currentUserCanCreateSiteFromDomainOnly: false,
|
|
232
|
+
currentUserCanManage: false,
|
|
233
|
+
currentUserCannotAddEmailReason: null,
|
|
234
|
+
currentUserIsOwner: false,
|
|
235
|
+
domain: '',
|
|
236
|
+
domainLockingAvailable: false,
|
|
237
|
+
domainRegistrationAgreementUrl: null,
|
|
238
|
+
emailForwardsCount: 0,
|
|
239
|
+
expired: false,
|
|
240
|
+
expiry: null,
|
|
241
|
+
expirySoon: false,
|
|
242
|
+
gdprConsentStatus: null,
|
|
243
|
+
googleAppsSubscription: null,
|
|
244
|
+
hasRegistration: false,
|
|
245
|
+
hasWpcomNameservers: false,
|
|
246
|
+
hasZone: false,
|
|
247
|
+
isAutoRenewing: false,
|
|
248
|
+
isEligibleForInboundTransfer: false,
|
|
249
|
+
isIcannVerificationSuspended: false,
|
|
250
|
+
isLocked: false,
|
|
251
|
+
isPendingIcannVerification: false,
|
|
252
|
+
isPendingRenewal: false,
|
|
253
|
+
isPendingWhoisUpdate: false,
|
|
254
|
+
isPremium: false,
|
|
255
|
+
isPrimary: false,
|
|
256
|
+
isRedeemable: false,
|
|
257
|
+
isRenewable: false,
|
|
258
|
+
isSubdomain: false,
|
|
259
|
+
isWPCOMDomain: false,
|
|
260
|
+
isWpcomStagingDomain: false,
|
|
261
|
+
lastTransferError: '',
|
|
262
|
+
manualTransferRequired: false,
|
|
263
|
+
mustRemovePrivacyBeforeContactUpdate: false,
|
|
264
|
+
name: '',
|
|
265
|
+
nominetDomainSuspended: false,
|
|
266
|
+
nominetPendingContactVerificationRequest: false,
|
|
267
|
+
owner: '',
|
|
268
|
+
partnerDomain: false,
|
|
269
|
+
pendingRegistration: false,
|
|
270
|
+
pendingRegistrationTime: '',
|
|
271
|
+
pointsToWpcom: false,
|
|
272
|
+
privacyAvailable: false,
|
|
273
|
+
privateDomain: false,
|
|
274
|
+
redeemableUntil: '',
|
|
275
|
+
registrar: '',
|
|
276
|
+
registrationDate: '',
|
|
277
|
+
registryExpiryDate: '',
|
|
278
|
+
renewableUntil: '',
|
|
279
|
+
sslStatus: null,
|
|
280
|
+
subscriptionId: null,
|
|
281
|
+
supportsDomainConnect: false,
|
|
282
|
+
supportsGdprConsentManagement: false,
|
|
283
|
+
supportsTransferApproval: false,
|
|
284
|
+
titanMailSubscription: null,
|
|
285
|
+
transferAwayEligibleAt: null,
|
|
286
|
+
transferEndDate: null,
|
|
287
|
+
transferLockOnWhoisUpdateOptional: false,
|
|
288
|
+
transferStartDate: null,
|
|
289
|
+
transferStatus: null,
|
|
290
|
+
type: 'MAPPED',
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
export function buildDomainResponse( overrides ) {
|
|
294
|
+
return {
|
|
295
|
+
...defaultDomainResponse,
|
|
296
|
+
...overrides,
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export const MOCK_USE_QUERY_RESULT = {
|
|
301
|
+
data: undefined,
|
|
302
|
+
dataUpdatedAt: 0,
|
|
303
|
+
error: null,
|
|
304
|
+
errorUpdatedAt: 0,
|
|
305
|
+
failureCount: 0,
|
|
306
|
+
isError: false,
|
|
307
|
+
isFetched: false,
|
|
308
|
+
isFetchedAfterMount: false,
|
|
309
|
+
isFetching: false,
|
|
310
|
+
isIdle: false,
|
|
311
|
+
isLoading: false,
|
|
312
|
+
isLoadingError: false,
|
|
313
|
+
isPlaceholderData: false,
|
|
314
|
+
isPreviousData: false,
|
|
315
|
+
isRefetchError: false,
|
|
316
|
+
isRefetching: false,
|
|
317
|
+
isStale: false,
|
|
318
|
+
isSuccess: true,
|
|
319
|
+
status: 'success',
|
|
320
|
+
refetch: jest.fn(),
|
|
321
|
+
remove: jest.fn(),
|
|
322
|
+
};
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface TaskExtraData {
|
|
2
|
+
about_page_id?: number;
|
|
3
|
+
}
|
|
4
|
+
export interface Task {
|
|
5
|
+
id: string;
|
|
6
|
+
completed: boolean;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
title?: string;
|
|
9
|
+
subtitle?: string | React.ReactNode | null;
|
|
10
|
+
badge_text?: string;
|
|
11
|
+
actionDispatch?: () => void;
|
|
12
|
+
isLaunchTask?: boolean;
|
|
13
|
+
extra_data?: TaskExtraData;
|
|
14
|
+
calypso_path?: string;
|
|
15
|
+
target_repetitions?: number;
|
|
16
|
+
repetition_count?: number;
|
|
17
|
+
order?: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type LaunchpadChecklist = Task[];
|
|
21
|
+
|
|
22
|
+
export type LaunchpadTracksData = {
|
|
23
|
+
checklistSlug: string;
|
|
24
|
+
launchpadContext: string;
|
|
25
|
+
recordTracksEvent: ( event: string, properties: Record< string, unknown > ) => void;
|
|
26
|
+
tasklistCompleted: boolean;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export interface LaunchpadFlowTaskList {
|
|
30
|
+
[ string: string ]: string[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface TranslatedLaunchpadStrings {
|
|
34
|
+
flowName: string;
|
|
35
|
+
title: string;
|
|
36
|
+
launchTitle?: string;
|
|
37
|
+
subtitle: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface LaunchpadStatuses {
|
|
41
|
+
links_edited?: boolean;
|
|
42
|
+
site_edited?: boolean;
|
|
43
|
+
site_launched?: boolean;
|
|
44
|
+
first_post_published?: boolean;
|
|
45
|
+
video_uploaded?: boolean;
|
|
46
|
+
publish_first_course?: boolean;
|
|
47
|
+
plan_selected?: boolean;
|
|
48
|
+
plan_completed?: boolean;
|
|
49
|
+
domain_upsell_deferred?: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface LaunchpadResponse {
|
|
53
|
+
site_intent: string;
|
|
54
|
+
launchpad_screen: boolean | string;
|
|
55
|
+
checklist_statuses: LaunchpadStatuses[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface PermittedActions {
|
|
59
|
+
setShareSiteModalIsOpen?: ( isOpen: boolean ) => void;
|
|
60
|
+
siteLaunched?: () => void;
|
|
61
|
+
setActiveChecklist: ( siteSlug: string, activeChecklistSlug: string ) => void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface LaunchpadTaskActionsProps {
|
|
65
|
+
siteSlug: string | null;
|
|
66
|
+
tasks: Task[];
|
|
67
|
+
tracksData: LaunchpadTracksData;
|
|
68
|
+
extraActions: PermittedActions;
|
|
69
|
+
uiContext?: 'calypso';
|
|
70
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@automattic/calypso-typescript-config/ts-package.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declarationDir": "dist/types",
|
|
5
|
+
"outDir": "dist/esm",
|
|
6
|
+
"rootDir": "src"
|
|
7
|
+
},
|
|
8
|
+
"include": [ "src" ],
|
|
9
|
+
"exclude": [ "**/test/*" ],
|
|
10
|
+
"references": [ { "path": "../components" }, { "path": "../data-stores" } ]
|
|
11
|
+
}
|