@slicemachine/manager 0.20.8-alpha.BI-dt-2380-add-shared-onboarding.22 → 0.20.8-beta.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/dist/constants/API_ENDPOINTS.cjs +3 -6
- package/dist/constants/API_ENDPOINTS.cjs.map +1 -1
- package/dist/constants/API_ENDPOINTS.d.ts +0 -1
- package/dist/constants/API_ENDPOINTS.js +3 -6
- package/dist/constants/API_ENDPOINTS.js.map +1 -1
- package/dist/lib/DecodeError.cjs +1 -15
- package/dist/lib/DecodeError.cjs.map +1 -1
- package/dist/lib/DecodeError.d.ts +1 -2
- package/dist/lib/DecodeError.js +1 -15
- package/dist/lib/DecodeError.js.map +1 -1
- package/dist/lib/decode.cjs +2 -13
- package/dist/lib/decode.cjs.map +1 -1
- package/dist/lib/decode.d.ts +1 -3
- package/dist/lib/decode.js +2 -13
- package/dist/lib/decode.js.map +1 -1
- package/dist/managers/prismicRepository/PrismicRepositoryManager.cjs +0 -76
- package/dist/managers/prismicRepository/PrismicRepositoryManager.cjs.map +1 -1
- package/dist/managers/prismicRepository/PrismicRepositoryManager.d.ts +1 -8
- package/dist/managers/prismicRepository/PrismicRepositoryManager.js +1 -77
- package/dist/managers/prismicRepository/PrismicRepositoryManager.js.map +1 -1
- package/dist/managers/prismicRepository/types.cjs +0 -26
- package/dist/managers/prismicRepository/types.cjs.map +1 -1
- package/dist/managers/prismicRepository/types.d.ts +0 -33
- package/dist/managers/prismicRepository/types.js +1 -27
- package/dist/managers/prismicRepository/types.js.map +1 -1
- package/dist/managers/telemetry/types.cjs +8 -14
- package/dist/managers/telemetry/types.cjs.map +1 -1
- package/dist/managers/telemetry/types.d.ts +13 -23
- package/dist/managers/telemetry/types.js +8 -14
- package/dist/managers/telemetry/types.js.map +1 -1
- package/package.json +2 -2
- package/src/constants/API_ENDPOINTS.ts +0 -6
- package/src/lib/DecodeError.ts +2 -21
- package/src/lib/decode.ts +4 -30
- package/src/managers/prismicRepository/PrismicRepositoryManager.ts +1 -112
- package/src/managers/prismicRepository/types.ts +0 -38
- package/src/managers/telemetry/types.ts +18 -41
- package/dist/_node_modules/zod/lib/index.cjs +0 -4030
- package/dist/_node_modules/zod/lib/index.cjs.map +0 -1
- package/dist/_node_modules/zod/lib/index.js +0 -4033
- package/dist/_node_modules/zod/lib/index.js.map +0 -1
@@ -32,16 +32,13 @@ export declare const SegmentEventType: {
|
|
32
32
|
readonly sliceMachine_start: "slice-machine:start";
|
33
33
|
readonly sliceLibrary_beta_modalOpened: "slice-library:beta:modal-opened";
|
34
34
|
readonly sliceLibrary_beta_codeOpened: "slice-library:beta:code-opened";
|
35
|
+
readonly onboarding_step_opened: "onboarding:step-opened";
|
36
|
+
readonly onboarding_step_completed: "onboarding:step-completed";
|
37
|
+
readonly onboarding_completed: "onboarding:completed";
|
35
38
|
readonly postPush_emptyStateCtaClicked: "post-push:empty-state-cta-clicked";
|
36
39
|
readonly postPush_toastCtaClicked: "post-push:toast-cta-clicked";
|
37
40
|
readonly experiment_exposure: "experiment:exposure";
|
38
41
|
readonly sliceName_pascalCaseError: "slice-name-error:pascal-case";
|
39
|
-
readonly onboarding_step_opened: "onboarding:step-opened";
|
40
|
-
readonly onboarding_step_completed: "onboarding:step-completed";
|
41
|
-
readonly onboarding_completed: "onboarding:completed";
|
42
|
-
readonly sharedOnboarding_step_opened: "shared-onboarding:step-opened";
|
43
|
-
readonly sharedOnboarding_step_completed: "shared-onboarding:step-completed";
|
44
|
-
readonly sharedOnboarding_completed: "shared-onboarding:completed";
|
45
42
|
};
|
46
43
|
type SegmentEventTypes = (typeof SegmentEventType)[keyof typeof SegmentEventType];
|
47
44
|
export declare const HumanSegmentEventType: {
|
@@ -74,16 +71,13 @@ export declare const HumanSegmentEventType: {
|
|
74
71
|
readonly "slice-machine:start": "SliceMachine Start";
|
75
72
|
readonly "slice-library:beta:modal-opened": "SliceMachine Slice Library [BETA] CTA modal displayed";
|
76
73
|
readonly "slice-library:beta:code-opened": "SliceMachine Slice Library [BETA] CTA example code opened";
|
74
|
+
readonly "onboarding:step-opened": "SliceMachine Onboarding Step Opened";
|
75
|
+
readonly "onboarding:step-completed": "SliceMachine Onboarding Step Completed";
|
76
|
+
readonly "onboarding:completed": "SliceMachine Onboarding Completed";
|
77
77
|
readonly "post-push:empty-state-cta-clicked": "SliceMachine Post Push Empty State CTA Clicked";
|
78
78
|
readonly "post-push:toast-cta-clicked": "SliceMachine Post Push Toast CTA Clicked";
|
79
79
|
readonly "experiment:exposure": "$exposure";
|
80
80
|
readonly "slice-name-error:pascal-case": "SliceMachine Slice Name Pascal Case Error";
|
81
|
-
readonly "onboarding:step-opened": "SliceMachine Onboarding Step Opened";
|
82
|
-
readonly "onboarding:step-completed": "SliceMachine Onboarding Step Completed";
|
83
|
-
readonly "onboarding:completed": "SliceMachine Onboarding Completed";
|
84
|
-
readonly "shared-onboarding:step-completed": "Prismic Onboarding Guide Step Completed";
|
85
|
-
readonly "shared-onboarding:step-opened": "Prismic Onboarding Guide Step Open";
|
86
|
-
readonly "shared-onboarding:completed": "Prismic Onboarding Guide Completed";
|
87
81
|
};
|
88
82
|
export type HumanSegmentEventTypes = (typeof HumanSegmentEventType)[keyof typeof HumanSegmentEventType];
|
89
83
|
type SegmentEvent<TType extends SegmentEventTypes, TProperties extends Record<string, unknown> | void = void> = TProperties extends void ? {
|
@@ -222,19 +216,15 @@ type SliceMachineStart = SegmentEvent<typeof SegmentEventType.sliceMachine_start
|
|
222
216
|
}>;
|
223
217
|
type SliceLibraryBetaModalOpened = SegmentEvent<typeof SegmentEventType.sliceLibrary_beta_modalOpened>;
|
224
218
|
type SliceLibraryBetaCodeOpened = SegmentEvent<typeof SegmentEventType.sliceLibrary_beta_codeOpened>;
|
225
|
-
type
|
219
|
+
type SliceMachineOnboardingStepOpened = SegmentEvent<typeof SegmentEventType.onboarding_step_opened, {
|
226
220
|
stepId: string;
|
227
221
|
stepTitle: string;
|
228
|
-
}
|
229
|
-
type
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
type SliceMachineOnboardingStepCompleted = SegmentEvent<typeof SegmentEventType.onboarding_step_completed, OnboardingCommonPayload>;
|
222
|
+
}>;
|
223
|
+
type SliceMachineOnboardingStepCompleted = SegmentEvent<typeof SegmentEventType.onboarding_step_completed, {
|
224
|
+
stepId: string;
|
225
|
+
stepTitle: string;
|
226
|
+
}>;
|
234
227
|
type SliceMachineOnboardingCompleted = SegmentEvent<typeof SegmentEventType.onboarding_completed>;
|
235
|
-
type SliceMachineSharedOnboardingStepOpened = SegmentEvent<typeof SegmentEventType.sharedOnboarding_step_opened, SharedOnboardingProperties<OnboardingCommonPayload>>;
|
236
|
-
type SliceMachineSharedOnboardingStepCompleted = SegmentEvent<typeof SegmentEventType.sharedOnboarding_step_completed, SharedOnboardingProperties<OnboardingCommonPayload>>;
|
237
|
-
type SliceMachineSharedOnboardingCompleted = SegmentEvent<typeof SegmentEventType.sharedOnboarding_completed, SharedOnboardingProperties>;
|
238
228
|
type SliceMachinePostPushEmptyStateCtaClicked = SegmentEvent<typeof SegmentEventType.postPush_emptyStateCtaClicked>;
|
239
229
|
type SliceMachinePostPushToastCtaClicked = SegmentEvent<typeof SegmentEventType.postPush_toastCtaClicked>;
|
240
230
|
type SliceMachineExperimentExposure = SegmentEvent<typeof SegmentEventType.experiment_exposure, {
|
@@ -244,4 +234,4 @@ type SliceMachineExperimentExposure = SegmentEvent<typeof SegmentEventType.exper
|
|
244
234
|
type SliceMachineSliceNamePascalCase = SegmentEvent<typeof SegmentEventType.sliceName_pascalCaseError, {
|
245
235
|
errorType: "create" | "update";
|
246
236
|
}>;
|
247
|
-
export type SegmentEvents = CommandInitStartSegmentEvent | CommandInitIdentifySegmentEvent | CommandInitEndSegmentEvent | ReviewSegmentEvent | SliceSimulatorOpenSegmentEvent | SliceSimulatorIsNotRunningSegmentEvent | PageViewSegmentEvent | OpenVideoTutorialsSegmentEvent | FieldAddedSegmentEvent | FieldSettingsOpenedSegmentEvent | CustomTypeCreatedSegmentEvent | CustomTypeSliceZoneUpdatedSegmentEvent | CustomTypeOpenAddFromTemplatesEvent | CustomTypeSavedSegmentEvent | SliceCreatedSegmentEvent | LegacySliceConvertedSegmentEvent | ScreenshotTakenSegmentEvent | ChangesPushedSegmentEvent | ChangesLimitReachSegmentEvent | EditorWidgetUsedSegmentEvent | OpenPageSnippetSegmentEvent | CopyPageSnippetSegmentEvent | SwitchEnvironmentSegmentEvent | DevCollabJoinBetaClicked | DevCollabSetUpWorkflowOpened | DevCollabWorkflowStubDisplayed | SliceMachineStart | SliceLibraryBetaModalOpened | SliceLibraryBetaCodeOpened | SliceMachineOnboardingStepOpened | SliceMachineOnboardingStepCompleted | SliceMachineOnboardingCompleted |
|
237
|
+
export type SegmentEvents = CommandInitStartSegmentEvent | CommandInitIdentifySegmentEvent | CommandInitEndSegmentEvent | ReviewSegmentEvent | SliceSimulatorOpenSegmentEvent | SliceSimulatorIsNotRunningSegmentEvent | PageViewSegmentEvent | OpenVideoTutorialsSegmentEvent | FieldAddedSegmentEvent | FieldSettingsOpenedSegmentEvent | CustomTypeCreatedSegmentEvent | CustomTypeSliceZoneUpdatedSegmentEvent | CustomTypeOpenAddFromTemplatesEvent | CustomTypeSavedSegmentEvent | SliceCreatedSegmentEvent | LegacySliceConvertedSegmentEvent | ScreenshotTakenSegmentEvent | ChangesPushedSegmentEvent | ChangesLimitReachSegmentEvent | EditorWidgetUsedSegmentEvent | OpenPageSnippetSegmentEvent | CopyPageSnippetSegmentEvent | SwitchEnvironmentSegmentEvent | DevCollabJoinBetaClicked | DevCollabSetUpWorkflowOpened | DevCollabWorkflowStubDisplayed | SliceMachineStart | SliceLibraryBetaModalOpened | SliceLibraryBetaCodeOpened | SliceMachineOnboardingStepOpened | SliceMachineOnboardingStepCompleted | SliceMachineOnboardingCompleted | SliceMachinePostPushEmptyStateCtaClicked | SliceMachinePostPushToastCtaClicked | SliceMachineExperimentExposure | SliceMachineSliceNamePascalCase;
|
@@ -28,16 +28,13 @@ const SegmentEventType = {
|
|
28
28
|
sliceMachine_start: "slice-machine:start",
|
29
29
|
sliceLibrary_beta_modalOpened: "slice-library:beta:modal-opened",
|
30
30
|
sliceLibrary_beta_codeOpened: "slice-library:beta:code-opened",
|
31
|
-
postPush_emptyStateCtaClicked: "post-push:empty-state-cta-clicked",
|
32
|
-
postPush_toastCtaClicked: "post-push:toast-cta-clicked",
|
33
|
-
experiment_exposure: "experiment:exposure",
|
34
|
-
sliceName_pascalCaseError: "slice-name-error:pascal-case",
|
35
31
|
onboarding_step_opened: "onboarding:step-opened",
|
36
32
|
onboarding_step_completed: "onboarding:step-completed",
|
37
33
|
onboarding_completed: "onboarding:completed",
|
38
|
-
|
39
|
-
|
40
|
-
|
34
|
+
postPush_emptyStateCtaClicked: "post-push:empty-state-cta-clicked",
|
35
|
+
postPush_toastCtaClicked: "post-push:toast-cta-clicked",
|
36
|
+
experiment_exposure: "experiment:exposure",
|
37
|
+
sliceName_pascalCaseError: "slice-name-error:pascal-case"
|
41
38
|
};
|
42
39
|
const HumanSegmentEventType = {
|
43
40
|
[SegmentEventType.command_init_start]: "SliceMachine Init Start",
|
@@ -69,16 +66,13 @@ const HumanSegmentEventType = {
|
|
69
66
|
[SegmentEventType.sliceMachine_start]: "SliceMachine Start",
|
70
67
|
[SegmentEventType.sliceLibrary_beta_modalOpened]: "SliceMachine Slice Library [BETA] CTA modal displayed",
|
71
68
|
[SegmentEventType.sliceLibrary_beta_codeOpened]: "SliceMachine Slice Library [BETA] CTA example code opened",
|
72
|
-
[SegmentEventType.postPush_emptyStateCtaClicked]: "SliceMachine Post Push Empty State CTA Clicked",
|
73
|
-
[SegmentEventType.postPush_toastCtaClicked]: "SliceMachine Post Push Toast CTA Clicked",
|
74
|
-
[SegmentEventType.experiment_exposure]: "$exposure",
|
75
|
-
[SegmentEventType.sliceName_pascalCaseError]: "SliceMachine Slice Name Pascal Case Error",
|
76
69
|
[SegmentEventType.onboarding_step_opened]: "SliceMachine Onboarding Step Opened",
|
77
70
|
[SegmentEventType.onboarding_step_completed]: "SliceMachine Onboarding Step Completed",
|
78
71
|
[SegmentEventType.onboarding_completed]: "SliceMachine Onboarding Completed",
|
79
|
-
[SegmentEventType.
|
80
|
-
[SegmentEventType.
|
81
|
-
[SegmentEventType.
|
72
|
+
[SegmentEventType.postPush_emptyStateCtaClicked]: "SliceMachine Post Push Empty State CTA Clicked",
|
73
|
+
[SegmentEventType.postPush_toastCtaClicked]: "SliceMachine Post Push Toast CTA Clicked",
|
74
|
+
[SegmentEventType.experiment_exposure]: "$exposure",
|
75
|
+
[SegmentEventType.sliceName_pascalCaseError]: "SliceMachine Slice Name Pascal Case Error"
|
82
76
|
};
|
83
77
|
export {
|
84
78
|
HumanSegmentEventType,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../../src/managers/telemetry/types.ts"],"sourcesContent":["import { FieldType } from \"@prismicio/types-internal/lib/customtypes/widgets\";\n\nimport { CustomTypeFormat } from \"../customTypes/types\";\nimport type { PushChangesLimitType } from \"../prismicRepository/types\";\n\nexport type { Variant } from \"@amplitude/experiment-node-server\";\n\nexport const SegmentEventType = {\n\tcommand_init_start: \"command:init:start\",\n\tcommand_init_identify: \"command:init:identify\",\n\tcommand_init_end: \"command:init:end\",\n\treview: \"review\",\n\tsliceSimulator_open: \"slice-simulator:open\",\n\tsliceSimulator_isNotRunning: \"slice-simulator:is-not-running\",\n\tpageView: \"page-view\",\n\topenVideoTutorials: \"open-video-tutorials\",\n\tfield_added: \"field:added\",\n\tfield_settingsOpened: \"field:settings-opened\",\n\tcustomType_created: \"custom-type:created\",\n\tcustomType_sliceZoneUpdated: \"custom-type:slice-zone-updated\",\n\tcustomType_openAddFromTemplates: \"custom-type:open-add-from-templates\",\n\tcustomType_saved: \"custom-type:saved\",\n\tslice_created: \"slice:created\",\n\tlegacySlice_converted: \"legacy-slice:converted\",\n\tscreenshotTaken: \"screenshot-taken\",\n\tchanges_pushed: \"changes:pushed\",\n\tchanges_limitReach: \"changes:limit-reach\",\n\teditor_widgetUsed: \"editor:widget-used\",\n\topen_page_snippet: \"page-type:open-snippet\",\n\tcopy_page_snippet: \"page-type:copy-snippet\",\n\tswitch_environment: \"environment:switch\",\n\tdevCollab_joinBetaClicked: \"dev-collab:join-beta-clicked\",\n\tdevCollab_setUpWorkflowOpened: \"dev-collab:set-up-workflow-opened\",\n\tdevCollab_workflowStubDisplayed: \"dev-collab:workflow-stub-displayed\",\n\tsliceMachine_start: \"slice-machine:start\",\n\tsliceLibrary_beta_modalOpened: \"slice-library:beta:modal-opened\",\n\tsliceLibrary_beta_codeOpened: \"slice-library:beta:code-opened\",\n\tpostPush_emptyStateCtaClicked: \"post-push:empty-state-cta-clicked\",\n\tpostPush_toastCtaClicked: \"post-push:toast-cta-clicked\",\n\texperiment_exposure: \"experiment:exposure\",\n\tsliceName_pascalCaseError: \"slice-name-error:pascal-case\",\n\tonboarding_step_opened: \"onboarding:step-opened\",\n\tonboarding_step_completed: \"onboarding:step-completed\",\n\tonboarding_completed: \"onboarding:completed\",\n\tsharedOnboarding_step_opened: \"shared-onboarding:step-opened\",\n\tsharedOnboarding_step_completed: \"shared-onboarding:step-completed\",\n\tsharedOnboarding_completed: \"shared-onboarding:completed\",\n} as const;\ntype SegmentEventTypes =\n\t(typeof SegmentEventType)[keyof typeof SegmentEventType];\n\nexport const HumanSegmentEventType = {\n\t[SegmentEventType.command_init_start]: \"SliceMachine Init Start\",\n\t[SegmentEventType.command_init_identify]: \"SliceMachine Init Identify\",\n\t[SegmentEventType.command_init_end]: \"SliceMachine Init End\",\n\t[SegmentEventType.review]: \"SliceMachine Review\",\n\t[SegmentEventType.sliceSimulator_open]: \"SliceMachine Slice Simulator Open\",\n\t[SegmentEventType.sliceSimulator_isNotRunning]:\n\t\t\"SliceMachine Slice Simulator is not running\",\n\t[SegmentEventType.pageView]: \"SliceMachine Page View\",\n\t[SegmentEventType.openVideoTutorials]: \"SliceMachine Open Video Tutorials\",\n\t[SegmentEventType.field_added]: \"SliceMachine Field Added\",\n\t[SegmentEventType.field_settingsOpened]: \"SliceMachine Field Settings Opened\",\n\t[SegmentEventType.customType_created]: \"SliceMachine Custom Type Created\",\n\t[SegmentEventType.customType_sliceZoneUpdated]:\n\t\t\"SliceMachine Slicezone Updated\",\n\t[SegmentEventType.customType_openAddFromTemplates]:\n\t\t\"SliceMachine Open Add from templates\",\n\t[SegmentEventType.customType_saved]: \"SliceMachine Custom Type Saved\",\n\t[SegmentEventType.slice_created]: \"SliceMachine Slice Created\",\n\t[SegmentEventType.legacySlice_converted]:\n\t\t\"SliceMachine Legacy Slice Converted\",\n\t[SegmentEventType.screenshotTaken]: \"SliceMachine Screenshot Taken\",\n\t[SegmentEventType.changes_pushed]: \"SliceMachine Changes Pushed\",\n\t[SegmentEventType.changes_limitReach]: \"SliceMachine Changes Limit Reach\",\n\t[SegmentEventType.editor_widgetUsed]: \"SliceMachine Editor Widget Used\",\n\t[SegmentEventType.open_page_snippet]:\n\t\t\"SliceMachine Opens Page Type Snippet Dialog\",\n\t[SegmentEventType.copy_page_snippet]:\n\t\t\"Slice Machine page code snippet copied\",\n\t[SegmentEventType.switch_environment]: \"SliceMachine environment switch\",\n\t[SegmentEventType.devCollab_joinBetaClicked]:\n\t\t\"SliceMachine Dev Collab Join Beta Clicked\",\n\t[SegmentEventType.devCollab_setUpWorkflowOpened]:\n\t\t\"SliceMachine Dev Collab Set Up Workflow Opened\",\n\t[SegmentEventType.devCollab_workflowStubDisplayed]:\n\t\t\"SliceMachine Dev Collab Workflow Stub Displayed\",\n\t[SegmentEventType.sliceMachine_start]: \"SliceMachine Start\",\n\t[SegmentEventType.sliceLibrary_beta_modalOpened]:\n\t\t\"SliceMachine Slice Library [BETA] CTA modal displayed\",\n\t[SegmentEventType.sliceLibrary_beta_codeOpened]:\n\t\t\"SliceMachine Slice Library [BETA] CTA example code opened\",\n\t[SegmentEventType.postPush_emptyStateCtaClicked]:\n\t\t\"SliceMachine Post Push Empty State CTA Clicked\",\n\t[SegmentEventType.postPush_toastCtaClicked]:\n\t\t\"SliceMachine Post Push Toast CTA Clicked\",\n\t[SegmentEventType.experiment_exposure]: \"$exposure\",\n\t[SegmentEventType.sliceName_pascalCaseError]:\n\t\t\"SliceMachine Slice Name Pascal Case Error\",\n\t[SegmentEventType.onboarding_step_opened]:\n\t\t\"SliceMachine Onboarding Step Opened\",\n\t[SegmentEventType.onboarding_step_completed]:\n\t\t\"SliceMachine Onboarding Step Completed\",\n\t[SegmentEventType.onboarding_completed]: \"SliceMachine Onboarding Completed\",\n\t[SegmentEventType.sharedOnboarding_step_completed]:\n\t\t\"Prismic Onboarding Guide Step Completed\",\n\t[SegmentEventType.sharedOnboarding_step_opened]:\n\t\t\"Prismic Onboarding Guide Step Open\",\n\t[SegmentEventType.sharedOnboarding_completed]:\n\t\t\"Prismic Onboarding Guide Completed\",\n} as const;\n\nexport type HumanSegmentEventTypes =\n\t(typeof HumanSegmentEventType)[keyof typeof HumanSegmentEventType];\n\ntype SegmentEvent<\n\tTType extends SegmentEventTypes,\n\tTProperties extends Record<string, unknown> | void = void,\n> = TProperties extends void\n\t? {\n\t\t\tevent: TType;\n\t\t\trepository?: string;\n\t }\n\t: {\n\t\t\tevent: TType;\n\t\t\trepository?: string;\n\t } & TProperties;\n\ntype CommandInitStartSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.command_init_start\n>;\n\n// This event feels off, we have a dedicated `identify` method...\ntype CommandInitIdentifySegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.command_init_identify\n>;\n\ntype CommandInitEndSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.command_init_end,\n\t{ framework: string; success: boolean; error?: string }\n>;\n\ntype ReviewSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.review,\n\t{\n\t\trating: number;\n\t\tcomment: string;\n\t\ttype: \"onboarding\" | \"advanced repository\";\n\t}\n>;\n\ntype SliceSimulatorOpenSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.sliceSimulator_open\n>;\n\ntype SliceSimulatorIsNotRunningSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.sliceSimulator_isNotRunning\n>;\n\ntype PageViewSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.pageView,\n\t{\n\t\turl: string;\n\t\tpath: string;\n\t\tsearch: string;\n\t\ttitle: string;\n\t\treferrer: string;\n\t\tadapter: string;\n\t\t/*\n\t\t * We are tracking outer sizes instead of inner sizes as with the latter, we\n\t\t * can't differentiate between users with a high-density screen and those\n\t\t * zooming in/out with ⌘ + / ⌘ -. Indeed, when users zoom in/out, some\n\t\t * browsers (like Google Chrome) will update `window.devicePixelRatio` while\n\t\t * others (like Safari) will keep it unchanged so that it always reflects\n\t\t * the ratio of physical pixels to CSS pixels.\n\t\t */\n\t\touterWidth: number;\n\t\touterHeight: number;\n\t\tscreenWidth: number;\n\t\tscreenHeight: number;\n\t}\n>;\n\ntype OpenPageSnippetSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.open_page_snippet,\n\t{ framework: string }\n>;\n\ntype CopyPageSnippetSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.copy_page_snippet,\n\t{ framework: string }\n>;\n\ntype SwitchEnvironmentSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.switch_environment,\n\t{ domain: string }\n>;\n\ntype OpenVideoTutorialsSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.openVideoTutorials,\n\t{ video: string }\n>;\n\ntype FieldAddedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.field_added,\n\t{\n\t\tid: string;\n\t\tname: string;\n\t\ttype: FieldType;\n\t\tisInAGroup: boolean;\n\t\tcontentType: \"page type\" | \"custom type\" | \"slice\";\n\t\tallowText?: boolean;\n\t}\n>;\n\ntype FieldSettingsOpenedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.field_settingsOpened,\n\t{\n\t\tid: string;\n\t\tname: string;\n\t\ttype: FieldType;\n\t\tisInAGroup: boolean;\n\t\tcontentType: \"page type\" | \"custom type\" | \"slice\";\n\t}\n>;\n\ntype CustomTypeCreatedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.customType_created,\n\t{\n\t\tid: string;\n\t\tname: string;\n\t\tformat: CustomTypeFormat;\n\t\ttype: \"repeatable\" | \"single\";\n\t\torigin: \"onboarding\" | \"table\";\n\t}\n>;\n\ntype CustomTypeSliceZoneUpdatedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.customType_sliceZoneUpdated,\n\t{ customTypeId: string }\n>;\n\ntype CustomTypeOpenAddFromTemplatesEvent = SegmentEvent<\n\ttypeof SegmentEventType.customType_openAddFromTemplates,\n\t{ customTypeId: string; customTypeFormat: CustomTypeFormat }\n>;\n\ntype CustomTypeSavedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.customType_saved,\n\t{\n\t\tid: string;\n\t\tname: string;\n\t\tformat: CustomTypeFormat;\n\t\ttype: \"repeatable\" | \"single\";\n\t}\n>;\n\ntype SliceCreatedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.slice_created,\n\t{ id: string; name: string; library: string; sliceTemplate?: string }\n>;\n\ntype LegacySliceConvertedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.legacySlice_converted,\n\t{\n\t\tid: string;\n\t\tvariation: string;\n\t\tlibrary: string;\n\t\tconversionType:\n\t\t\t| \"as_new_slice\"\n\t\t\t| \"as_new_variation\"\n\t\t\t| \"merge_with_identical\";\n\t}\n>;\n\ntype ScreenshotTakenSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.screenshotTaken,\n\t{\n\t\ttype: \"custom\";\n\t\tmethod: \"upload\" | \"dragAndDrop\";\n\t}\n>;\n\ntype ChangesPushedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.changes_pushed,\n\t{\n\t\tcustomTypesCreated: number;\n\t\tcustomTypesModified: number;\n\t\tcustomTypesDeleted: number;\n\t\tslicesCreated: number;\n\t\tslicesModified: number;\n\t\tslicesDeleted: number;\n\t\tmissingScreenshots: number;\n\t\ttotal: number;\n\t\tduration: number;\n\t\thasDeletedDocuments: boolean;\n\t}\n>;\n\ntype ChangesLimitReachSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.changes_limitReach,\n\t{ limitType: PushChangesLimitType }\n>;\n\ntype EditorWidgetUsedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.editor_widgetUsed,\n\t{ sliceId: string }\n>;\n\ntype DevCollabJoinBetaClicked = SegmentEvent<\n\ttypeof SegmentEventType.devCollab_joinBetaClicked\n>;\n\ntype DevCollabSetUpWorkflowOpened = SegmentEvent<\n\ttypeof SegmentEventType.devCollab_setUpWorkflowOpened\n>;\n\ntype DevCollabWorkflowStubDisplayed = SegmentEvent<\n\ttypeof SegmentEventType.devCollab_workflowStubDisplayed\n>;\n\ntype SliceMachineStart = SegmentEvent<\n\ttypeof SegmentEventType.sliceMachine_start,\n\t{\n\t\tadapter?: string;\n\t\tadapterVersion?: string;\n\t\tgitProvider?: string;\n\t\tisAdapterUpdateAvailable?: boolean;\n\t\tisLoggedIn?: boolean;\n\t\tisSliceMachineUpdateAvailable?: boolean;\n\t\tisTypeScriptProject?: boolean;\n\t\tnodeVersion?: string;\n\t\tnumberOfCustomTypes?: number;\n\t\tnumberOfSlices?: number;\n\t\tosPlatform?: string;\n\t\tpackageManager?: string;\n\t\tprojectPort?: string;\n\t\tsliceMachineVersion?: string;\n\t\tversionControlSystem?: string;\n\t}\n>;\n\ntype SliceLibraryBetaModalOpened = SegmentEvent<\n\ttypeof SegmentEventType.sliceLibrary_beta_modalOpened\n>;\n\ntype SliceLibraryBetaCodeOpened = SegmentEvent<\n\ttypeof SegmentEventType.sliceLibrary_beta_codeOpened\n>;\n\ntype OnboardingCommonPayload = { stepId: string; stepTitle: string };\ntype SharedOnboardingProperties<T = Record<string, string>> = T & {\n\tsource: \"SliceMachine\";\n};\n\ntype SliceMachineOnboardingStepOpened = SegmentEvent<\n\ttypeof SegmentEventType.onboarding_step_opened,\n\tOnboardingCommonPayload\n>;\ntype SliceMachineOnboardingStepCompleted = SegmentEvent<\n\ttypeof SegmentEventType.onboarding_step_completed,\n\tOnboardingCommonPayload\n>;\ntype SliceMachineOnboardingCompleted = SegmentEvent<\n\ttypeof SegmentEventType.onboarding_completed\n>;\n\ntype SliceMachineSharedOnboardingStepOpened = SegmentEvent<\n\ttypeof SegmentEventType.sharedOnboarding_step_opened,\n\tSharedOnboardingProperties<OnboardingCommonPayload>\n>;\ntype SliceMachineSharedOnboardingStepCompleted = SegmentEvent<\n\ttypeof SegmentEventType.sharedOnboarding_step_completed,\n\tSharedOnboardingProperties<OnboardingCommonPayload>\n>;\ntype SliceMachineSharedOnboardingCompleted = SegmentEvent<\n\ttypeof SegmentEventType.sharedOnboarding_completed,\n\tSharedOnboardingProperties\n>;\n\ntype SliceMachinePostPushEmptyStateCtaClicked = SegmentEvent<\n\ttypeof SegmentEventType.postPush_emptyStateCtaClicked\n>;\n\ntype SliceMachinePostPushToastCtaClicked = SegmentEvent<\n\ttypeof SegmentEventType.postPush_toastCtaClicked\n>;\n\ntype SliceMachineExperimentExposure = SegmentEvent<\n\ttypeof SegmentEventType.experiment_exposure,\n\t{\n\t\tflag_key: string;\n\t\tvariant: string;\n\t}\n>;\n\ntype SliceMachineSliceNamePascalCase = SegmentEvent<\n\ttypeof SegmentEventType.sliceName_pascalCaseError,\n\t{ errorType: \"create\" | \"update\" }\n>;\n\nexport type SegmentEvents =\n\t| CommandInitStartSegmentEvent\n\t| CommandInitIdentifySegmentEvent\n\t| CommandInitEndSegmentEvent\n\t| ReviewSegmentEvent\n\t| SliceSimulatorOpenSegmentEvent\n\t| SliceSimulatorIsNotRunningSegmentEvent\n\t| PageViewSegmentEvent\n\t| OpenVideoTutorialsSegmentEvent\n\t| FieldAddedSegmentEvent\n\t| FieldSettingsOpenedSegmentEvent\n\t| CustomTypeCreatedSegmentEvent\n\t| CustomTypeSliceZoneUpdatedSegmentEvent\n\t| CustomTypeOpenAddFromTemplatesEvent\n\t| CustomTypeSavedSegmentEvent\n\t| SliceCreatedSegmentEvent\n\t| LegacySliceConvertedSegmentEvent\n\t| ScreenshotTakenSegmentEvent\n\t| ChangesPushedSegmentEvent\n\t| ChangesLimitReachSegmentEvent\n\t| EditorWidgetUsedSegmentEvent\n\t| OpenPageSnippetSegmentEvent\n\t| CopyPageSnippetSegmentEvent\n\t| SwitchEnvironmentSegmentEvent\n\t| DevCollabJoinBetaClicked\n\t| DevCollabSetUpWorkflowOpened\n\t| DevCollabWorkflowStubDisplayed\n\t| SliceMachineStart\n\t| SliceLibraryBetaModalOpened\n\t| SliceLibraryBetaCodeOpened\n\t| SliceMachineOnboardingStepOpened\n\t| SliceMachineOnboardingStepCompleted\n\t| SliceMachineOnboardingCompleted\n\t| SliceMachineSharedOnboardingStepOpened\n\t| SliceMachineSharedOnboardingStepCompleted\n\t| SliceMachineSharedOnboardingCompleted\n\t| SliceMachinePostPushEmptyStateCtaClicked\n\t| SliceMachinePostPushToastCtaClicked\n\t| SliceMachineExperimentExposure\n\t| SliceMachineSliceNamePascalCase;\n"],"names":[],"mappings":"AAOO,MAAM,mBAAmB;AAAA,EAC/B,oBAAoB;AAAA,EACpB,uBAAuB;AAAA,EACvB,kBAAkB;AAAA,EAClB,QAAQ;AAAA,EACR,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,UAAU;AAAA,EACV,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,sBAAsB;AAAA,EACtB,oBAAoB;AAAA,EACpB,6BAA6B;AAAA,EAC7B,iCAAiC;AAAA,EACjC,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,uBAAuB;AAAA,EACvB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,2BAA2B;AAAA,EAC3B,+BAA+B;AAAA,EAC/B,iCAAiC;AAAA,EACjC,oBAAoB;AAAA,EACpB,+BAA+B;AAAA,EAC/B,8BAA8B;AAAA,EAC9B,+BAA+B;AAAA,EAC/B,0BAA0B;AAAA,EAC1B,qBAAqB;AAAA,EACrB,2BAA2B;AAAA,EAC3B,wBAAwB;AAAA,EACxB,2BAA2B;AAAA,EAC3B,sBAAsB;AAAA,EACtB,8BAA8B;AAAA,EAC9B,iCAAiC;AAAA,EACjC,4BAA4B;;AAKtB,MAAM,wBAAwB;AAAA,EACpC,CAAC,iBAAiB,kBAAkB,GAAG;AAAA,EACvC,CAAC,iBAAiB,qBAAqB,GAAG;AAAA,EAC1C,CAAC,iBAAiB,gBAAgB,GAAG;AAAA,EACrC,CAAC,iBAAiB,MAAM,GAAG;AAAA,EAC3B,CAAC,iBAAiB,mBAAmB,GAAG;AAAA,EACxC,CAAC,iBAAiB,2BAA2B,GAC5C;AAAA,EACD,CAAC,iBAAiB,QAAQ,GAAG;AAAA,EAC7B,CAAC,iBAAiB,kBAAkB,GAAG;AAAA,EACvC,CAAC,iBAAiB,WAAW,GAAG;AAAA,EAChC,CAAC,iBAAiB,oBAAoB,GAAG;AAAA,EACzC,CAAC,iBAAiB,kBAAkB,GAAG;AAAA,EACvC,CAAC,iBAAiB,2BAA2B,GAC5C;AAAA,EACD,CAAC,iBAAiB,+BAA+B,GAChD;AAAA,EACD,CAAC,iBAAiB,gBAAgB,GAAG;AAAA,EACrC,CAAC,iBAAiB,aAAa,GAAG;AAAA,EAClC,CAAC,iBAAiB,qBAAqB,GACtC;AAAA,EACD,CAAC,iBAAiB,eAAe,GAAG;AAAA,EACpC,CAAC,iBAAiB,cAAc,GAAG;AAAA,EACnC,CAAC,iBAAiB,kBAAkB,GAAG;AAAA,EACvC,CAAC,iBAAiB,iBAAiB,GAAG;AAAA,EACtC,CAAC,iBAAiB,iBAAiB,GAClC;AAAA,EACD,CAAC,iBAAiB,iBAAiB,GAClC;AAAA,EACD,CAAC,iBAAiB,kBAAkB,GAAG;AAAA,EACvC,CAAC,iBAAiB,yBAAyB,GAC1C;AAAA,EACD,CAAC,iBAAiB,6BAA6B,GAC9C;AAAA,EACD,CAAC,iBAAiB,+BAA+B,GAChD;AAAA,EACD,CAAC,iBAAiB,kBAAkB,GAAG;AAAA,EACvC,CAAC,iBAAiB,6BAA6B,GAC9C;AAAA,EACD,CAAC,iBAAiB,4BAA4B,GAC7C;AAAA,EACD,CAAC,iBAAiB,6BAA6B,GAC9C;AAAA,EACD,CAAC,iBAAiB,wBAAwB,GACzC;AAAA,EACD,CAAC,iBAAiB,mBAAmB,GAAG;AAAA,EACxC,CAAC,iBAAiB,yBAAyB,GAC1C;AAAA,EACD,CAAC,iBAAiB,sBAAsB,GACvC;AAAA,EACD,CAAC,iBAAiB,yBAAyB,GAC1C;AAAA,EACD,CAAC,iBAAiB,oBAAoB,GAAG;AAAA,EACzC,CAAC,iBAAiB,+BAA+B,GAChD;AAAA,EACD,CAAC,iBAAiB,4BAA4B,GAC7C;AAAA,EACD,CAAC,iBAAiB,0BAA0B,GAC3C;;"}
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/managers/telemetry/types.ts"],"sourcesContent":["import { FieldType } from \"@prismicio/types-internal/lib/customtypes/widgets\";\n\nimport { CustomTypeFormat } from \"../customTypes/types\";\nimport type { PushChangesLimitType } from \"../prismicRepository/types\";\n\nexport type { Variant } from \"@amplitude/experiment-node-server\";\n\nexport const SegmentEventType = {\n\tcommand_init_start: \"command:init:start\",\n\tcommand_init_identify: \"command:init:identify\",\n\tcommand_init_end: \"command:init:end\",\n\treview: \"review\",\n\tsliceSimulator_open: \"slice-simulator:open\",\n\tsliceSimulator_isNotRunning: \"slice-simulator:is-not-running\",\n\tpageView: \"page-view\",\n\topenVideoTutorials: \"open-video-tutorials\",\n\tfield_added: \"field:added\",\n\tfield_settingsOpened: \"field:settings-opened\",\n\tcustomType_created: \"custom-type:created\",\n\tcustomType_sliceZoneUpdated: \"custom-type:slice-zone-updated\",\n\tcustomType_openAddFromTemplates: \"custom-type:open-add-from-templates\",\n\tcustomType_saved: \"custom-type:saved\",\n\tslice_created: \"slice:created\",\n\tlegacySlice_converted: \"legacy-slice:converted\",\n\tscreenshotTaken: \"screenshot-taken\",\n\tchanges_pushed: \"changes:pushed\",\n\tchanges_limitReach: \"changes:limit-reach\",\n\teditor_widgetUsed: \"editor:widget-used\",\n\topen_page_snippet: \"page-type:open-snippet\",\n\tcopy_page_snippet: \"page-type:copy-snippet\",\n\tswitch_environment: \"environment:switch\",\n\tdevCollab_joinBetaClicked: \"dev-collab:join-beta-clicked\",\n\tdevCollab_setUpWorkflowOpened: \"dev-collab:set-up-workflow-opened\",\n\tdevCollab_workflowStubDisplayed: \"dev-collab:workflow-stub-displayed\",\n\tsliceMachine_start: \"slice-machine:start\",\n\tsliceLibrary_beta_modalOpened: \"slice-library:beta:modal-opened\",\n\tsliceLibrary_beta_codeOpened: \"slice-library:beta:code-opened\",\n\tonboarding_step_opened: \"onboarding:step-opened\",\n\tonboarding_step_completed: \"onboarding:step-completed\",\n\tonboarding_completed: \"onboarding:completed\",\n\tpostPush_emptyStateCtaClicked: \"post-push:empty-state-cta-clicked\",\n\tpostPush_toastCtaClicked: \"post-push:toast-cta-clicked\",\n\texperiment_exposure: \"experiment:exposure\",\n\tsliceName_pascalCaseError: \"slice-name-error:pascal-case\",\n} as const;\ntype SegmentEventTypes =\n\t(typeof SegmentEventType)[keyof typeof SegmentEventType];\n\nexport const HumanSegmentEventType = {\n\t[SegmentEventType.command_init_start]: \"SliceMachine Init Start\",\n\t[SegmentEventType.command_init_identify]: \"SliceMachine Init Identify\",\n\t[SegmentEventType.command_init_end]: \"SliceMachine Init End\",\n\t[SegmentEventType.review]: \"SliceMachine Review\",\n\t[SegmentEventType.sliceSimulator_open]: \"SliceMachine Slice Simulator Open\",\n\t[SegmentEventType.sliceSimulator_isNotRunning]:\n\t\t\"SliceMachine Slice Simulator is not running\",\n\t[SegmentEventType.pageView]: \"SliceMachine Page View\",\n\t[SegmentEventType.openVideoTutorials]: \"SliceMachine Open Video Tutorials\",\n\t[SegmentEventType.field_added]: \"SliceMachine Field Added\",\n\t[SegmentEventType.field_settingsOpened]: \"SliceMachine Field Settings Opened\",\n\t[SegmentEventType.customType_created]: \"SliceMachine Custom Type Created\",\n\t[SegmentEventType.customType_sliceZoneUpdated]:\n\t\t\"SliceMachine Slicezone Updated\",\n\t[SegmentEventType.customType_openAddFromTemplates]:\n\t\t\"SliceMachine Open Add from templates\",\n\t[SegmentEventType.customType_saved]: \"SliceMachine Custom Type Saved\",\n\t[SegmentEventType.slice_created]: \"SliceMachine Slice Created\",\n\t[SegmentEventType.legacySlice_converted]:\n\t\t\"SliceMachine Legacy Slice Converted\",\n\t[SegmentEventType.screenshotTaken]: \"SliceMachine Screenshot Taken\",\n\t[SegmentEventType.changes_pushed]: \"SliceMachine Changes Pushed\",\n\t[SegmentEventType.changes_limitReach]: \"SliceMachine Changes Limit Reach\",\n\t[SegmentEventType.editor_widgetUsed]: \"SliceMachine Editor Widget Used\",\n\t[SegmentEventType.open_page_snippet]:\n\t\t\"SliceMachine Opens Page Type Snippet Dialog\",\n\t[SegmentEventType.copy_page_snippet]:\n\t\t\"Slice Machine page code snippet copied\",\n\t[SegmentEventType.switch_environment]: \"SliceMachine environment switch\",\n\t[SegmentEventType.devCollab_joinBetaClicked]:\n\t\t\"SliceMachine Dev Collab Join Beta Clicked\",\n\t[SegmentEventType.devCollab_setUpWorkflowOpened]:\n\t\t\"SliceMachine Dev Collab Set Up Workflow Opened\",\n\t[SegmentEventType.devCollab_workflowStubDisplayed]:\n\t\t\"SliceMachine Dev Collab Workflow Stub Displayed\",\n\t[SegmentEventType.sliceMachine_start]: \"SliceMachine Start\",\n\t[SegmentEventType.sliceLibrary_beta_modalOpened]:\n\t\t\"SliceMachine Slice Library [BETA] CTA modal displayed\",\n\t[SegmentEventType.sliceLibrary_beta_codeOpened]:\n\t\t\"SliceMachine Slice Library [BETA] CTA example code opened\",\n\t[SegmentEventType.onboarding_step_opened]:\n\t\t\"SliceMachine Onboarding Step Opened\",\n\t[SegmentEventType.onboarding_step_completed]:\n\t\t\"SliceMachine Onboarding Step Completed\",\n\t[SegmentEventType.onboarding_completed]: \"SliceMachine Onboarding Completed\",\n\t[SegmentEventType.postPush_emptyStateCtaClicked]:\n\t\t\"SliceMachine Post Push Empty State CTA Clicked\",\n\t[SegmentEventType.postPush_toastCtaClicked]:\n\t\t\"SliceMachine Post Push Toast CTA Clicked\",\n\t[SegmentEventType.experiment_exposure]: \"$exposure\",\n\t[SegmentEventType.sliceName_pascalCaseError]:\n\t\t\"SliceMachine Slice Name Pascal Case Error\",\n} as const;\nexport type HumanSegmentEventTypes =\n\t(typeof HumanSegmentEventType)[keyof typeof HumanSegmentEventType];\n\ntype SegmentEvent<\n\tTType extends SegmentEventTypes,\n\tTProperties extends Record<string, unknown> | void = void,\n> = TProperties extends void\n\t? {\n\t\t\tevent: TType;\n\t\t\trepository?: string;\n\t }\n\t: {\n\t\t\tevent: TType;\n\t\t\trepository?: string;\n\t } & TProperties;\n\ntype CommandInitStartSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.command_init_start\n>;\n\n// This event feels off, we have a dedicated `identify` method...\ntype CommandInitIdentifySegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.command_init_identify\n>;\n\ntype CommandInitEndSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.command_init_end,\n\t{ framework: string; success: boolean; error?: string }\n>;\n\ntype ReviewSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.review,\n\t{\n\t\trating: number;\n\t\tcomment: string;\n\t\ttype: \"onboarding\" | \"advanced repository\";\n\t}\n>;\n\ntype SliceSimulatorOpenSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.sliceSimulator_open\n>;\n\ntype SliceSimulatorIsNotRunningSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.sliceSimulator_isNotRunning\n>;\n\ntype PageViewSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.pageView,\n\t{\n\t\turl: string;\n\t\tpath: string;\n\t\tsearch: string;\n\t\ttitle: string;\n\t\treferrer: string;\n\t\tadapter: string;\n\t\t/*\n\t\t * We are tracking outer sizes instead of inner sizes as with the latter, we\n\t\t * can't differentiate between users with a high-density screen and those\n\t\t * zooming in/out with ⌘ + / ⌘ -. Indeed, when users zoom in/out, some\n\t\t * browsers (like Google Chrome) will update `window.devicePixelRatio` while\n\t\t * others (like Safari) will keep it unchanged so that it always reflects\n\t\t * the ratio of physical pixels to CSS pixels.\n\t\t */\n\t\touterWidth: number;\n\t\touterHeight: number;\n\t\tscreenWidth: number;\n\t\tscreenHeight: number;\n\t}\n>;\n\ntype OpenPageSnippetSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.open_page_snippet,\n\t{ framework: string }\n>;\n\ntype CopyPageSnippetSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.copy_page_snippet,\n\t{ framework: string }\n>;\n\ntype SwitchEnvironmentSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.switch_environment,\n\t{ domain: string }\n>;\n\ntype OpenVideoTutorialsSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.openVideoTutorials,\n\t{ video: string }\n>;\n\ntype FieldAddedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.field_added,\n\t{\n\t\tid: string;\n\t\tname: string;\n\t\ttype: FieldType;\n\t\tisInAGroup: boolean;\n\t\tcontentType: \"page type\" | \"custom type\" | \"slice\";\n\t\tallowText?: boolean;\n\t}\n>;\n\ntype FieldSettingsOpenedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.field_settingsOpened,\n\t{\n\t\tid: string;\n\t\tname: string;\n\t\ttype: FieldType;\n\t\tisInAGroup: boolean;\n\t\tcontentType: \"page type\" | \"custom type\" | \"slice\";\n\t}\n>;\n\ntype CustomTypeCreatedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.customType_created,\n\t{\n\t\tid: string;\n\t\tname: string;\n\t\tformat: CustomTypeFormat;\n\t\ttype: \"repeatable\" | \"single\";\n\t\torigin: \"onboarding\" | \"table\";\n\t}\n>;\n\ntype CustomTypeSliceZoneUpdatedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.customType_sliceZoneUpdated,\n\t{ customTypeId: string }\n>;\n\ntype CustomTypeOpenAddFromTemplatesEvent = SegmentEvent<\n\ttypeof SegmentEventType.customType_openAddFromTemplates,\n\t{ customTypeId: string; customTypeFormat: CustomTypeFormat }\n>;\n\ntype CustomTypeSavedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.customType_saved,\n\t{\n\t\tid: string;\n\t\tname: string;\n\t\tformat: CustomTypeFormat;\n\t\ttype: \"repeatable\" | \"single\";\n\t}\n>;\n\ntype SliceCreatedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.slice_created,\n\t{ id: string; name: string; library: string; sliceTemplate?: string }\n>;\n\ntype LegacySliceConvertedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.legacySlice_converted,\n\t{\n\t\tid: string;\n\t\tvariation: string;\n\t\tlibrary: string;\n\t\tconversionType:\n\t\t\t| \"as_new_slice\"\n\t\t\t| \"as_new_variation\"\n\t\t\t| \"merge_with_identical\";\n\t}\n>;\n\ntype ScreenshotTakenSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.screenshotTaken,\n\t{\n\t\ttype: \"custom\";\n\t\tmethod: \"upload\" | \"dragAndDrop\";\n\t}\n>;\n\ntype ChangesPushedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.changes_pushed,\n\t{\n\t\tcustomTypesCreated: number;\n\t\tcustomTypesModified: number;\n\t\tcustomTypesDeleted: number;\n\t\tslicesCreated: number;\n\t\tslicesModified: number;\n\t\tslicesDeleted: number;\n\t\tmissingScreenshots: number;\n\t\ttotal: number;\n\t\tduration: number;\n\t\thasDeletedDocuments: boolean;\n\t}\n>;\n\ntype ChangesLimitReachSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.changes_limitReach,\n\t{ limitType: PushChangesLimitType }\n>;\n\ntype EditorWidgetUsedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.editor_widgetUsed,\n\t{ sliceId: string }\n>;\n\ntype DevCollabJoinBetaClicked = SegmentEvent<\n\ttypeof SegmentEventType.devCollab_joinBetaClicked\n>;\n\ntype DevCollabSetUpWorkflowOpened = SegmentEvent<\n\ttypeof SegmentEventType.devCollab_setUpWorkflowOpened\n>;\n\ntype DevCollabWorkflowStubDisplayed = SegmentEvent<\n\ttypeof SegmentEventType.devCollab_workflowStubDisplayed\n>;\n\ntype SliceMachineStart = SegmentEvent<\n\ttypeof SegmentEventType.sliceMachine_start,\n\t{\n\t\tadapter?: string;\n\t\tadapterVersion?: string;\n\t\tgitProvider?: string;\n\t\tisAdapterUpdateAvailable?: boolean;\n\t\tisLoggedIn?: boolean;\n\t\tisSliceMachineUpdateAvailable?: boolean;\n\t\tisTypeScriptProject?: boolean;\n\t\tnodeVersion?: string;\n\t\tnumberOfCustomTypes?: number;\n\t\tnumberOfSlices?: number;\n\t\tosPlatform?: string;\n\t\tpackageManager?: string;\n\t\tprojectPort?: string;\n\t\tsliceMachineVersion?: string;\n\t\tversionControlSystem?: string;\n\t}\n>;\n\ntype SliceLibraryBetaModalOpened = SegmentEvent<\n\ttypeof SegmentEventType.sliceLibrary_beta_modalOpened\n>;\n\ntype SliceLibraryBetaCodeOpened = SegmentEvent<\n\ttypeof SegmentEventType.sliceLibrary_beta_codeOpened\n>;\n\ntype SliceMachineOnboardingStepOpened = SegmentEvent<\n\ttypeof SegmentEventType.onboarding_step_opened,\n\t{\n\t\tstepId: string;\n\t\tstepTitle: string;\n\t}\n>;\n\ntype SliceMachineOnboardingStepCompleted = SegmentEvent<\n\ttypeof SegmentEventType.onboarding_step_completed,\n\t{\n\t\tstepId: string;\n\t\tstepTitle: string;\n\t}\n>;\n\ntype SliceMachineOnboardingCompleted = SegmentEvent<\n\ttypeof SegmentEventType.onboarding_completed\n>;\n\ntype SliceMachinePostPushEmptyStateCtaClicked = SegmentEvent<\n\ttypeof SegmentEventType.postPush_emptyStateCtaClicked\n>;\n\ntype SliceMachinePostPushToastCtaClicked = SegmentEvent<\n\ttypeof SegmentEventType.postPush_toastCtaClicked\n>;\n\ntype SliceMachineExperimentExposure = SegmentEvent<\n\ttypeof SegmentEventType.experiment_exposure,\n\t{\n\t\tflag_key: string;\n\t\tvariant: string;\n\t}\n>;\n\ntype SliceMachineSliceNamePascalCase = SegmentEvent<\n\ttypeof SegmentEventType.sliceName_pascalCaseError,\n\t{ errorType: \"create\" | \"update\" }\n>;\n\nexport type SegmentEvents =\n\t| CommandInitStartSegmentEvent\n\t| CommandInitIdentifySegmentEvent\n\t| CommandInitEndSegmentEvent\n\t| ReviewSegmentEvent\n\t| SliceSimulatorOpenSegmentEvent\n\t| SliceSimulatorIsNotRunningSegmentEvent\n\t| PageViewSegmentEvent\n\t| OpenVideoTutorialsSegmentEvent\n\t| FieldAddedSegmentEvent\n\t| FieldSettingsOpenedSegmentEvent\n\t| CustomTypeCreatedSegmentEvent\n\t| CustomTypeSliceZoneUpdatedSegmentEvent\n\t| CustomTypeOpenAddFromTemplatesEvent\n\t| CustomTypeSavedSegmentEvent\n\t| SliceCreatedSegmentEvent\n\t| LegacySliceConvertedSegmentEvent\n\t| ScreenshotTakenSegmentEvent\n\t| ChangesPushedSegmentEvent\n\t| ChangesLimitReachSegmentEvent\n\t| EditorWidgetUsedSegmentEvent\n\t| OpenPageSnippetSegmentEvent\n\t| CopyPageSnippetSegmentEvent\n\t| SwitchEnvironmentSegmentEvent\n\t| DevCollabJoinBetaClicked\n\t| DevCollabSetUpWorkflowOpened\n\t| DevCollabWorkflowStubDisplayed\n\t| SliceMachineStart\n\t| SliceLibraryBetaModalOpened\n\t| SliceLibraryBetaCodeOpened\n\t| SliceMachineOnboardingStepOpened\n\t| SliceMachineOnboardingStepCompleted\n\t| SliceMachineOnboardingCompleted\n\t| SliceMachinePostPushEmptyStateCtaClicked\n\t| SliceMachinePostPushToastCtaClicked\n\t| SliceMachineExperimentExposure\n\t| SliceMachineSliceNamePascalCase;\n"],"names":[],"mappings":"AAOO,MAAM,mBAAmB;AAAA,EAC/B,oBAAoB;AAAA,EACpB,uBAAuB;AAAA,EACvB,kBAAkB;AAAA,EAClB,QAAQ;AAAA,EACR,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,UAAU;AAAA,EACV,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,sBAAsB;AAAA,EACtB,oBAAoB;AAAA,EACpB,6BAA6B;AAAA,EAC7B,iCAAiC;AAAA,EACjC,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,uBAAuB;AAAA,EACvB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,2BAA2B;AAAA,EAC3B,+BAA+B;AAAA,EAC/B,iCAAiC;AAAA,EACjC,oBAAoB;AAAA,EACpB,+BAA+B;AAAA,EAC/B,8BAA8B;AAAA,EAC9B,wBAAwB;AAAA,EACxB,2BAA2B;AAAA,EAC3B,sBAAsB;AAAA,EACtB,+BAA+B;AAAA,EAC/B,0BAA0B;AAAA,EAC1B,qBAAqB;AAAA,EACrB,2BAA2B;;AAKrB,MAAM,wBAAwB;AAAA,EACpC,CAAC,iBAAiB,kBAAkB,GAAG;AAAA,EACvC,CAAC,iBAAiB,qBAAqB,GAAG;AAAA,EAC1C,CAAC,iBAAiB,gBAAgB,GAAG;AAAA,EACrC,CAAC,iBAAiB,MAAM,GAAG;AAAA,EAC3B,CAAC,iBAAiB,mBAAmB,GAAG;AAAA,EACxC,CAAC,iBAAiB,2BAA2B,GAC5C;AAAA,EACD,CAAC,iBAAiB,QAAQ,GAAG;AAAA,EAC7B,CAAC,iBAAiB,kBAAkB,GAAG;AAAA,EACvC,CAAC,iBAAiB,WAAW,GAAG;AAAA,EAChC,CAAC,iBAAiB,oBAAoB,GAAG;AAAA,EACzC,CAAC,iBAAiB,kBAAkB,GAAG;AAAA,EACvC,CAAC,iBAAiB,2BAA2B,GAC5C;AAAA,EACD,CAAC,iBAAiB,+BAA+B,GAChD;AAAA,EACD,CAAC,iBAAiB,gBAAgB,GAAG;AAAA,EACrC,CAAC,iBAAiB,aAAa,GAAG;AAAA,EAClC,CAAC,iBAAiB,qBAAqB,GACtC;AAAA,EACD,CAAC,iBAAiB,eAAe,GAAG;AAAA,EACpC,CAAC,iBAAiB,cAAc,GAAG;AAAA,EACnC,CAAC,iBAAiB,kBAAkB,GAAG;AAAA,EACvC,CAAC,iBAAiB,iBAAiB,GAAG;AAAA,EACtC,CAAC,iBAAiB,iBAAiB,GAClC;AAAA,EACD,CAAC,iBAAiB,iBAAiB,GAClC;AAAA,EACD,CAAC,iBAAiB,kBAAkB,GAAG;AAAA,EACvC,CAAC,iBAAiB,yBAAyB,GAC1C;AAAA,EACD,CAAC,iBAAiB,6BAA6B,GAC9C;AAAA,EACD,CAAC,iBAAiB,+BAA+B,GAChD;AAAA,EACD,CAAC,iBAAiB,kBAAkB,GAAG;AAAA,EACvC,CAAC,iBAAiB,6BAA6B,GAC9C;AAAA,EACD,CAAC,iBAAiB,4BAA4B,GAC7C;AAAA,EACD,CAAC,iBAAiB,sBAAsB,GACvC;AAAA,EACD,CAAC,iBAAiB,yBAAyB,GAC1C;AAAA,EACD,CAAC,iBAAiB,oBAAoB,GAAG;AAAA,EACzC,CAAC,iBAAiB,6BAA6B,GAC9C;AAAA,EACD,CAAC,iBAAiB,wBAAwB,GACzC;AAAA,EACD,CAAC,iBAAiB,mBAAmB,GAAG;AAAA,EACxC,CAAC,iBAAiB,yBAAyB,GAC1C;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@slicemachine/manager",
|
3
|
-
"version": "0.20.8-
|
3
|
+
"version": "0.20.8-beta.1",
|
4
4
|
"description": "Manage all aspects of a Slice Machine project.",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -70,7 +70,7 @@
|
|
70
70
|
"@prismicio/mocks": "^2.4.0",
|
71
71
|
"@prismicio/types-internal": "^2.8.0",
|
72
72
|
"@segment/analytics-node": "^2.1.2",
|
73
|
-
"@slicemachine/plugin-kit": "0.4.52-
|
73
|
+
"@slicemachine/plugin-kit": "0.4.52-beta.1",
|
74
74
|
"cookie": "^0.5.0",
|
75
75
|
"cors": "^2.8.5",
|
76
76
|
"execa": "^7.1.1",
|
@@ -10,7 +10,6 @@ export type APIEndpoints = {
|
|
10
10
|
PrismicEmbed: string;
|
11
11
|
PrismicUnsplash: string;
|
12
12
|
SliceMachineV1: string;
|
13
|
-
RepositoryService: string;
|
14
13
|
};
|
15
14
|
|
16
15
|
export const API_ENDPOINTS: APIEndpoints = (() => {
|
@@ -34,9 +33,6 @@ export const API_ENDPOINTS: APIEndpoints = (() => {
|
|
34
33
|
process.env.slice_machine_v1_endpoint ??
|
35
34
|
"https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/",
|
36
35
|
),
|
37
|
-
RepositoryService: addTrailingSlash(
|
38
|
-
process.env.repository_api ?? "https://repository.wroom.io/",
|
39
|
-
),
|
40
36
|
};
|
41
37
|
|
42
38
|
const missingAPIEndpoints = Object.keys(apiEndpoints).filter((key) => {
|
@@ -85,7 +81,6 @@ If you didn't intend to run Slice Machine this way, stop it immediately and unse
|
|
85
81
|
PrismicUnsplash: "https://unsplash.wroom.io/",
|
86
82
|
SliceMachineV1:
|
87
83
|
"https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/",
|
88
|
-
RepositoryService: "https://repository.wroom.io/",
|
89
84
|
};
|
90
85
|
}
|
91
86
|
|
@@ -101,7 +96,6 @@ If you didn't intend to run Slice Machine this way, stop it immediately and unse
|
|
101
96
|
PrismicEmbed: "https://oembed.prismic.io",
|
102
97
|
PrismicUnsplash: "https://unsplash.prismic.io/",
|
103
98
|
SliceMachineV1: "https://sm-api.prismic.io/v1/",
|
104
|
-
RepositoryService: "https://repository.prismic.io/",
|
105
99
|
};
|
106
100
|
}
|
107
101
|
}
|
package/src/lib/DecodeError.ts
CHANGED
@@ -1,37 +1,18 @@
|
|
1
1
|
import * as t from "io-ts";
|
2
2
|
import { formatValidationErrors } from "io-ts-reporters";
|
3
|
-
import { ZodIssue } from "zod";
|
4
3
|
|
5
4
|
type DecodeErrorConstructorArgs<TInput = unknown> = {
|
6
5
|
input: TInput;
|
7
|
-
errors: t.Errors
|
6
|
+
errors: t.Errors;
|
8
7
|
};
|
9
8
|
|
10
|
-
function isZodIssueArray(errors: object[]): errors is ZodIssue[] {
|
11
|
-
return "path" in errors[0];
|
12
|
-
}
|
13
|
-
|
14
|
-
function formatZodErrors(errors: ZodIssue[]): string[] {
|
15
|
-
return errors.map((err) => {
|
16
|
-
const path = err.path.length > 0 ? ` at ${err.path.join(".")}` : "";
|
17
|
-
|
18
|
-
return `${err.message}${path}`;
|
19
|
-
});
|
20
|
-
}
|
21
|
-
|
22
9
|
export class DecodeError<TInput = unknown> extends Error {
|
23
10
|
name = "DecodeError";
|
24
11
|
input: TInput;
|
25
12
|
errors: string[];
|
26
13
|
|
27
14
|
constructor(args: DecodeErrorConstructorArgs<TInput>) {
|
28
|
-
|
29
|
-
|
30
|
-
if (isZodIssueArray(args.errors)) {
|
31
|
-
formattedErrors = formatZodErrors(args.errors);
|
32
|
-
} else {
|
33
|
-
formattedErrors = formatValidationErrors(args.errors);
|
34
|
-
}
|
15
|
+
const formattedErrors = formatValidationErrors(args.errors);
|
35
16
|
|
36
17
|
super(formattedErrors.join(", "));
|
37
18
|
|
package/src/lib/decode.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import * as t from "io-ts";
|
2
|
-
import { ZodType, ZodTypeDef } from "zod";
|
3
2
|
import * as E from "fp-ts/Either";
|
4
3
|
import { pipe } from "fp-ts/function";
|
5
4
|
|
@@ -15,35 +14,10 @@ export type DecodeReturnType<A, _O, I> =
|
|
15
14
|
error: DecodeError<I>;
|
16
15
|
};
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
typeof (value as ZodType<unknown>).safeParse === "function" &&
|
21
|
-
value instanceof ZodType
|
22
|
-
);
|
23
|
-
}
|
24
|
-
|
25
|
-
export function decode<A, O, I>(
|
26
|
-
codec: ZodType<A, ZodTypeDef, unknown>,
|
27
|
-
input: I,
|
28
|
-
): DecodeReturnType<A, O, I>;
|
29
|
-
export function decode<A, O, I>(
|
30
|
-
codec: t.Type<A, O, I> | ZodType<A, ZodTypeDef, unknown>,
|
31
|
-
input: I,
|
32
|
-
): DecodeReturnType<A, O, I>;
|
33
|
-
export function decode<A, O, I>(
|
34
|
-
codec: t.Type<A, O, I> | ZodType<A, ZodTypeDef, unknown>,
|
17
|
+
export const decode = <A, O, I>(
|
18
|
+
codec: t.Type<A, O, I>,
|
35
19
|
input: I,
|
36
|
-
): DecodeReturnType<A, O, I> {
|
37
|
-
if (isZodSchema(codec)) {
|
38
|
-
const parsed = codec.safeParse(input);
|
39
|
-
|
40
|
-
if (parsed.success) {
|
41
|
-
return { value: parsed.data };
|
42
|
-
}
|
43
|
-
|
44
|
-
return { error: new DecodeError({ input, errors: parsed.error.errors }) };
|
45
|
-
}
|
46
|
-
|
20
|
+
): DecodeReturnType<A, O, I> => {
|
47
21
|
return pipe(
|
48
22
|
codec.decode(input),
|
49
23
|
E.foldW(
|
@@ -59,4 +33,4 @@ export function decode<A, O, I>(
|
|
59
33
|
},
|
60
34
|
),
|
61
35
|
);
|
62
|
-
}
|
36
|
+
};
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import * as t from "io-ts";
|
2
|
-
import { z } from "zod";
|
3
2
|
import fetch, { Response } from "../../lib/fetch";
|
4
3
|
import { fold } from "fp-ts/Either";
|
5
4
|
|
@@ -36,7 +35,6 @@ import {
|
|
36
35
|
FrameworkWroomTelemetryID,
|
37
36
|
StarterId,
|
38
37
|
Environment,
|
39
|
-
OnboardingState,
|
40
38
|
} from "./types";
|
41
39
|
import { sortEnvironments } from "./sortEnvironments";
|
42
40
|
|
@@ -508,115 +506,6 @@ export class PrismicRepositoryManager extends BaseManager {
|
|
508
506
|
}
|
509
507
|
}
|
510
508
|
|
511
|
-
async fetchOnboarding(): Promise<OnboardingState> {
|
512
|
-
const repositoryName = await this.project.getRepositoryName();
|
513
|
-
|
514
|
-
const url = new URL("/onboarding", API_ENDPOINTS.RepositoryService);
|
515
|
-
url.searchParams.set("repository", repositoryName);
|
516
|
-
const res = await this._fetch({ url });
|
517
|
-
|
518
|
-
if (res.ok) {
|
519
|
-
const json = await res.json();
|
520
|
-
const { value, error } = decode(OnboardingState, json);
|
521
|
-
|
522
|
-
if (error) {
|
523
|
-
throw new UnexpectedDataError(
|
524
|
-
`Failed to decode onboarding: ${error.errors.join(", ")}`,
|
525
|
-
);
|
526
|
-
}
|
527
|
-
if (value) {
|
528
|
-
return value;
|
529
|
-
}
|
530
|
-
}
|
531
|
-
|
532
|
-
switch (res.status) {
|
533
|
-
case 400:
|
534
|
-
case 401:
|
535
|
-
throw new UnauthenticatedError();
|
536
|
-
case 403:
|
537
|
-
throw new UnauthorizedError();
|
538
|
-
default:
|
539
|
-
throw new Error("Failed to fetch onboarding.");
|
540
|
-
}
|
541
|
-
}
|
542
|
-
|
543
|
-
async toggleOnboardingStep(
|
544
|
-
stepId: string,
|
545
|
-
): Promise<{ completedSteps: string[] }> {
|
546
|
-
const repositoryName = await this.project.getRepositoryName();
|
547
|
-
|
548
|
-
const url = new URL(
|
549
|
-
`/onboarding/${stepId}/toggle`,
|
550
|
-
API_ENDPOINTS.RepositoryService,
|
551
|
-
);
|
552
|
-
url.searchParams.set("repository", repositoryName);
|
553
|
-
const res = await this._fetch({ url, method: "PATCH" });
|
554
|
-
|
555
|
-
if (res.ok) {
|
556
|
-
const json = await res.json();
|
557
|
-
const { value, error } = decode(
|
558
|
-
z.object({ completedSteps: z.array(z.string()) }),
|
559
|
-
json,
|
560
|
-
);
|
561
|
-
|
562
|
-
if (error) {
|
563
|
-
throw new UnexpectedDataError(
|
564
|
-
`Failed to decode onboarding step toggle: ${error.errors.join(", ")}`,
|
565
|
-
);
|
566
|
-
}
|
567
|
-
|
568
|
-
if (value) {
|
569
|
-
return value;
|
570
|
-
}
|
571
|
-
}
|
572
|
-
|
573
|
-
switch (res.status) {
|
574
|
-
case 400:
|
575
|
-
case 401:
|
576
|
-
throw new UnauthenticatedError();
|
577
|
-
case 403:
|
578
|
-
throw new UnauthorizedError();
|
579
|
-
default:
|
580
|
-
throw new Error("Failed to toggle onboarding step.");
|
581
|
-
}
|
582
|
-
}
|
583
|
-
|
584
|
-
async toggleOnboarding(): Promise<{ isDismissed: boolean }> {
|
585
|
-
const repositoryName = await this.project.getRepositoryName();
|
586
|
-
|
587
|
-
const url = new URL("/onboarding/toggle", API_ENDPOINTS.RepositoryService);
|
588
|
-
url.searchParams.set("repository", repositoryName);
|
589
|
-
const res = await this._fetch({ url, method: "PATCH" });
|
590
|
-
|
591
|
-
if (res.ok) {
|
592
|
-
const json = await res.json();
|
593
|
-
const { value, error } = decode(
|
594
|
-
z.object({ isDismissed: z.boolean() }),
|
595
|
-
json,
|
596
|
-
);
|
597
|
-
|
598
|
-
if (error) {
|
599
|
-
throw new UnexpectedDataError(
|
600
|
-
`Failed to decode onboarding toggle: ${error.errors.join(", ")}`,
|
601
|
-
);
|
602
|
-
}
|
603
|
-
|
604
|
-
if (value) {
|
605
|
-
return value;
|
606
|
-
}
|
607
|
-
}
|
608
|
-
|
609
|
-
switch (res.status) {
|
610
|
-
case 400:
|
611
|
-
case 401:
|
612
|
-
throw new UnauthenticatedError();
|
613
|
-
case 403:
|
614
|
-
throw new UnauthorizedError();
|
615
|
-
default:
|
616
|
-
throw new Error("Failed to toggle onboarding guide.");
|
617
|
-
}
|
618
|
-
}
|
619
|
-
|
620
509
|
private _decodeLimitOrThrow(
|
621
510
|
potentialLimit: unknown,
|
622
511
|
statusCode: number,
|
@@ -642,7 +531,7 @@ export class PrismicRepositoryManager extends BaseManager {
|
|
642
531
|
|
643
532
|
private async _fetch(args: {
|
644
533
|
url: URL;
|
645
|
-
method?: "GET" | "POST"
|
534
|
+
method?: "GET" | "POST";
|
646
535
|
body?: unknown;
|
647
536
|
userAgent?: PrismicRepositoryUserAgents;
|
648
537
|
repository?: string;
|
@@ -3,7 +3,6 @@ import {
|
|
3
3
|
SharedSlice,
|
4
4
|
} from "@prismicio/types-internal/lib/customtypes";
|
5
5
|
import * as t from "io-ts";
|
6
|
-
import { z } from "zod";
|
7
6
|
|
8
7
|
export const PrismicRepositoryUserAgent = {
|
9
8
|
SliceMachine: "prismic-cli/sm",
|
@@ -168,40 +167,3 @@ export const Environment = t.type({
|
|
168
167
|
),
|
169
168
|
});
|
170
169
|
export type Environment = t.TypeOf<typeof Environment>;
|
171
|
-
|
172
|
-
export const supportedSliceMachineFrameworks = [
|
173
|
-
"next",
|
174
|
-
"nuxt",
|
175
|
-
"sveltekit",
|
176
|
-
] as const;
|
177
|
-
|
178
|
-
type SupportedFramework = (typeof supportedSliceMachineFrameworks)[number];
|
179
|
-
|
180
|
-
function isSupportedFramework(value: string): value is SupportedFramework {
|
181
|
-
return supportedSliceMachineFrameworks.includes(value as SupportedFramework);
|
182
|
-
}
|
183
|
-
|
184
|
-
export const repositoryFramework = z.preprocess(
|
185
|
-
(value) => {
|
186
|
-
// NOTE: we persist a lot of different frameworks in the DB, but only the SM supported are relevant to us
|
187
|
-
// Any other framework is treated like "other"
|
188
|
-
if (typeof value === "string" && isSupportedFramework(value)) {
|
189
|
-
return value;
|
190
|
-
}
|
191
|
-
|
192
|
-
return "other";
|
193
|
-
},
|
194
|
-
z.enum([...supportedSliceMachineFrameworks, "other"]),
|
195
|
-
);
|
196
|
-
|
197
|
-
export type RepositoryFramework = z.TypeOf<typeof repositoryFramework>;
|
198
|
-
|
199
|
-
export const OnboardingState = z.object({
|
200
|
-
completedSteps: z.array(z.string()),
|
201
|
-
isDismissed: z.boolean(),
|
202
|
-
context: z.object({
|
203
|
-
framework: repositoryFramework,
|
204
|
-
starterId: z.string().nullable(),
|
205
|
-
}),
|
206
|
-
});
|
207
|
-
export type OnboardingState = z.infer<typeof OnboardingState>;
|
@@ -35,16 +35,13 @@ export const SegmentEventType = {
|
|
35
35
|
sliceMachine_start: "slice-machine:start",
|
36
36
|
sliceLibrary_beta_modalOpened: "slice-library:beta:modal-opened",
|
37
37
|
sliceLibrary_beta_codeOpened: "slice-library:beta:code-opened",
|
38
|
+
onboarding_step_opened: "onboarding:step-opened",
|
39
|
+
onboarding_step_completed: "onboarding:step-completed",
|
40
|
+
onboarding_completed: "onboarding:completed",
|
38
41
|
postPush_emptyStateCtaClicked: "post-push:empty-state-cta-clicked",
|
39
42
|
postPush_toastCtaClicked: "post-push:toast-cta-clicked",
|
40
43
|
experiment_exposure: "experiment:exposure",
|
41
44
|
sliceName_pascalCaseError: "slice-name-error:pascal-case",
|
42
|
-
onboarding_step_opened: "onboarding:step-opened",
|
43
|
-
onboarding_step_completed: "onboarding:step-completed",
|
44
|
-
onboarding_completed: "onboarding:completed",
|
45
|
-
sharedOnboarding_step_opened: "shared-onboarding:step-opened",
|
46
|
-
sharedOnboarding_step_completed: "shared-onboarding:step-completed",
|
47
|
-
sharedOnboarding_completed: "shared-onboarding:completed",
|
48
45
|
} as const;
|
49
46
|
type SegmentEventTypes =
|
50
47
|
(typeof SegmentEventType)[keyof typeof SegmentEventType];
|
@@ -90,6 +87,11 @@ export const HumanSegmentEventType = {
|
|
90
87
|
"SliceMachine Slice Library [BETA] CTA modal displayed",
|
91
88
|
[SegmentEventType.sliceLibrary_beta_codeOpened]:
|
92
89
|
"SliceMachine Slice Library [BETA] CTA example code opened",
|
90
|
+
[SegmentEventType.onboarding_step_opened]:
|
91
|
+
"SliceMachine Onboarding Step Opened",
|
92
|
+
[SegmentEventType.onboarding_step_completed]:
|
93
|
+
"SliceMachine Onboarding Step Completed",
|
94
|
+
[SegmentEventType.onboarding_completed]: "SliceMachine Onboarding Completed",
|
93
95
|
[SegmentEventType.postPush_emptyStateCtaClicked]:
|
94
96
|
"SliceMachine Post Push Empty State CTA Clicked",
|
95
97
|
[SegmentEventType.postPush_toastCtaClicked]:
|
@@ -97,19 +99,7 @@ export const HumanSegmentEventType = {
|
|
97
99
|
[SegmentEventType.experiment_exposure]: "$exposure",
|
98
100
|
[SegmentEventType.sliceName_pascalCaseError]:
|
99
101
|
"SliceMachine Slice Name Pascal Case Error",
|
100
|
-
[SegmentEventType.onboarding_step_opened]:
|
101
|
-
"SliceMachine Onboarding Step Opened",
|
102
|
-
[SegmentEventType.onboarding_step_completed]:
|
103
|
-
"SliceMachine Onboarding Step Completed",
|
104
|
-
[SegmentEventType.onboarding_completed]: "SliceMachine Onboarding Completed",
|
105
|
-
[SegmentEventType.sharedOnboarding_step_completed]:
|
106
|
-
"Prismic Onboarding Guide Step Completed",
|
107
|
-
[SegmentEventType.sharedOnboarding_step_opened]:
|
108
|
-
"Prismic Onboarding Guide Step Open",
|
109
|
-
[SegmentEventType.sharedOnboarding_completed]:
|
110
|
-
"Prismic Onboarding Guide Completed",
|
111
102
|
} as const;
|
112
|
-
|
113
103
|
export type HumanSegmentEventTypes =
|
114
104
|
(typeof HumanSegmentEventType)[keyof typeof HumanSegmentEventType];
|
115
105
|
|
@@ -348,36 +338,26 @@ type SliceLibraryBetaCodeOpened = SegmentEvent<
|
|
348
338
|
typeof SegmentEventType.sliceLibrary_beta_codeOpened
|
349
339
|
>;
|
350
340
|
|
351
|
-
type OnboardingCommonPayload = { stepId: string; stepTitle: string };
|
352
|
-
type SharedOnboardingProperties<T = Record<string, string>> = T & {
|
353
|
-
source: "SliceMachine";
|
354
|
-
};
|
355
|
-
|
356
341
|
type SliceMachineOnboardingStepOpened = SegmentEvent<
|
357
342
|
typeof SegmentEventType.onboarding_step_opened,
|
358
|
-
|
343
|
+
{
|
344
|
+
stepId: string;
|
345
|
+
stepTitle: string;
|
346
|
+
}
|
359
347
|
>;
|
348
|
+
|
360
349
|
type SliceMachineOnboardingStepCompleted = SegmentEvent<
|
361
350
|
typeof SegmentEventType.onboarding_step_completed,
|
362
|
-
|
351
|
+
{
|
352
|
+
stepId: string;
|
353
|
+
stepTitle: string;
|
354
|
+
}
|
363
355
|
>;
|
356
|
+
|
364
357
|
type SliceMachineOnboardingCompleted = SegmentEvent<
|
365
358
|
typeof SegmentEventType.onboarding_completed
|
366
359
|
>;
|
367
360
|
|
368
|
-
type SliceMachineSharedOnboardingStepOpened = SegmentEvent<
|
369
|
-
typeof SegmentEventType.sharedOnboarding_step_opened,
|
370
|
-
SharedOnboardingProperties<OnboardingCommonPayload>
|
371
|
-
>;
|
372
|
-
type SliceMachineSharedOnboardingStepCompleted = SegmentEvent<
|
373
|
-
typeof SegmentEventType.sharedOnboarding_step_completed,
|
374
|
-
SharedOnboardingProperties<OnboardingCommonPayload>
|
375
|
-
>;
|
376
|
-
type SliceMachineSharedOnboardingCompleted = SegmentEvent<
|
377
|
-
typeof SegmentEventType.sharedOnboarding_completed,
|
378
|
-
SharedOnboardingProperties
|
379
|
-
>;
|
380
|
-
|
381
361
|
type SliceMachinePostPushEmptyStateCtaClicked = SegmentEvent<
|
382
362
|
typeof SegmentEventType.postPush_emptyStateCtaClicked
|
383
363
|
>;
|
@@ -432,9 +412,6 @@ export type SegmentEvents =
|
|
432
412
|
| SliceMachineOnboardingStepOpened
|
433
413
|
| SliceMachineOnboardingStepCompleted
|
434
414
|
| SliceMachineOnboardingCompleted
|
435
|
-
| SliceMachineSharedOnboardingStepOpened
|
436
|
-
| SliceMachineSharedOnboardingStepCompleted
|
437
|
-
| SliceMachineSharedOnboardingCompleted
|
438
415
|
| SliceMachinePostPushEmptyStateCtaClicked
|
439
416
|
| SliceMachinePostPushToastCtaClicked
|
440
417
|
| SliceMachineExperimentExposure
|