@slicemachine/manager 0.20.7 → 0.20.8-alpha.BI-dt-2380-add-shared-onboarding.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.
Files changed (53) hide show
  1. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/client.cjs +1 -1
  2. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/client.js +1 -1
  3. package/dist/_node_modules/cross-spawn/index.cjs +1 -1
  4. package/dist/_node_modules/cross-spawn/index.js +1 -1
  5. package/dist/_node_modules/zod/lib/index.cjs +4030 -0
  6. package/dist/_node_modules/zod/lib/index.cjs.map +1 -0
  7. package/dist/_node_modules/zod/lib/index.js +4033 -0
  8. package/dist/_node_modules/zod/lib/index.js.map +1 -0
  9. package/dist/_virtual/index2.cjs +4 -3
  10. package/dist/_virtual/index2.cjs.map +1 -1
  11. package/dist/_virtual/index2.js +4 -2
  12. package/dist/_virtual/index2.js.map +1 -1
  13. package/dist/_virtual/index3.cjs +3 -4
  14. package/dist/_virtual/index3.cjs.map +1 -1
  15. package/dist/_virtual/index3.js +2 -4
  16. package/dist/_virtual/index3.js.map +1 -1
  17. package/dist/constants/API_ENDPOINTS.cjs +6 -3
  18. package/dist/constants/API_ENDPOINTS.cjs.map +1 -1
  19. package/dist/constants/API_ENDPOINTS.d.ts +1 -0
  20. package/dist/constants/API_ENDPOINTS.js +6 -3
  21. package/dist/constants/API_ENDPOINTS.js.map +1 -1
  22. package/dist/lib/DecodeError.cjs +15 -1
  23. package/dist/lib/DecodeError.cjs.map +1 -1
  24. package/dist/lib/DecodeError.d.ts +2 -1
  25. package/dist/lib/DecodeError.js +15 -1
  26. package/dist/lib/DecodeError.js.map +1 -1
  27. package/dist/lib/decode.cjs +13 -2
  28. package/dist/lib/decode.cjs.map +1 -1
  29. package/dist/lib/decode.d.ts +3 -1
  30. package/dist/lib/decode.js +13 -2
  31. package/dist/lib/decode.js.map +1 -1
  32. package/dist/managers/prismicRepository/PrismicRepositoryManager.cjs +76 -0
  33. package/dist/managers/prismicRepository/PrismicRepositoryManager.cjs.map +1 -1
  34. package/dist/managers/prismicRepository/PrismicRepositoryManager.d.ts +8 -1
  35. package/dist/managers/prismicRepository/PrismicRepositoryManager.js +77 -1
  36. package/dist/managers/prismicRepository/PrismicRepositoryManager.js.map +1 -1
  37. package/dist/managers/prismicRepository/types.cjs +15 -0
  38. package/dist/managers/prismicRepository/types.cjs.map +1 -1
  39. package/dist/managers/prismicRepository/types.d.ts +30 -0
  40. package/dist/managers/prismicRepository/types.js +15 -0
  41. package/dist/managers/prismicRepository/types.js.map +1 -1
  42. package/dist/managers/telemetry/types.cjs +14 -8
  43. package/dist/managers/telemetry/types.cjs.map +1 -1
  44. package/dist/managers/telemetry/types.d.ts +23 -13
  45. package/dist/managers/telemetry/types.js +14 -8
  46. package/dist/managers/telemetry/types.js.map +1 -1
  47. package/package.json +4 -3
  48. package/src/constants/API_ENDPOINTS.ts +7 -0
  49. package/src/lib/DecodeError.ts +21 -2
  50. package/src/lib/decode.ts +30 -4
  51. package/src/managers/prismicRepository/PrismicRepositoryManager.ts +109 -1
  52. package/src/managers/prismicRepository/types.ts +16 -0
  53. package/src/managers/telemetry/types.ts +39 -18
@@ -28,13 +28,16 @@ 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
- onboarding_step_opened: "onboarding:step-opened",
32
- onboarding_step_completed: "onboarding:step-completed",
33
- onboarding_completed: "onboarding:completed",
34
31
  postPush_emptyStateCtaClicked: "post-push:empty-state-cta-clicked",
35
32
  postPush_toastCtaClicked: "post-push:toast-cta-clicked",
36
33
  experiment_exposure: "experiment:exposure",
37
- sliceName_pascalCaseError: "slice-name-error:pascal-case"
34
+ sliceName_pascalCaseError: "slice-name-error:pascal-case",
35
+ onboarding_step_opened: "onboarding:step-opened",
36
+ onboarding_step_completed: "onboarding:step-completed",
37
+ onboarding_completed: "onboarding:completed",
38
+ sharedOnboarding_step_opened: "shared-onboarding:step-opened",
39
+ sharedOnboarding_step_completed: "shared-onboarding:step-completed",
40
+ sharedOnboarding_completed: "shared-onboarding:completed"
38
41
  };
39
42
  const HumanSegmentEventType = {
40
43
  [SegmentEventType.command_init_start]: "SliceMachine Init Start",
@@ -66,13 +69,16 @@ const HumanSegmentEventType = {
66
69
  [SegmentEventType.sliceMachine_start]: "SliceMachine Start",
67
70
  [SegmentEventType.sliceLibrary_beta_modalOpened]: "SliceMachine Slice Library [BETA] CTA modal displayed",
68
71
  [SegmentEventType.sliceLibrary_beta_codeOpened]: "SliceMachine Slice Library [BETA] CTA example code opened",
69
- [SegmentEventType.onboarding_step_opened]: "SliceMachine Onboarding Step Opened",
70
- [SegmentEventType.onboarding_step_completed]: "SliceMachine Onboarding Step Completed",
71
- [SegmentEventType.onboarding_completed]: "SliceMachine Onboarding Completed",
72
72
  [SegmentEventType.postPush_emptyStateCtaClicked]: "SliceMachine Post Push Empty State CTA Clicked",
73
73
  [SegmentEventType.postPush_toastCtaClicked]: "SliceMachine Post Push Toast CTA Clicked",
74
74
  [SegmentEventType.experiment_exposure]: "$exposure",
75
- [SegmentEventType.sliceName_pascalCaseError]: "SliceMachine Slice Name Pascal Case Error"
75
+ [SegmentEventType.sliceName_pascalCaseError]: "SliceMachine Slice Name Pascal Case Error",
76
+ [SegmentEventType.onboarding_step_opened]: "SliceMachine Onboarding Step Opened",
77
+ [SegmentEventType.onboarding_step_completed]: "SliceMachine Onboarding Step Completed",
78
+ [SegmentEventType.onboarding_completed]: "SliceMachine Onboarding Completed",
79
+ [SegmentEventType.sharedOnboarding_step_completed]: "Prismic Onboarding Guide Step Completed",
80
+ [SegmentEventType.sharedOnboarding_step_opened]: "Prismic Onboarding Guide Step Open",
81
+ [SegmentEventType.sharedOnboarding_completed]: "Prismic Onboarding Guide Completed"
76
82
  };
77
83
  export {
78
84
  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\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;;"}
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 = {}> = T & { source: \"SliceMachine\" }; // eslint-disable-line @typescript-eslint/ban-types\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;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slicemachine/manager",
3
- "version": "0.20.7",
3
+ "version": "0.20.8-alpha.BI-dt-2380-add-shared-onboarding.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.51",
73
+ "@slicemachine/plugin-kit": "0.4.52-alpha.BI-dt-2380-add-shared-onboarding.1",
74
74
  "cookie": "^0.5.0",
75
75
  "cors": "^2.8.5",
76
76
  "execa": "^7.1.1",
@@ -131,5 +131,6 @@
131
131
  },
132
132
  "publishConfig": {
133
133
  "access": "public"
134
- }
134
+ },
135
+ "stableVersion": "0.20.7"
135
136
  }
@@ -10,6 +10,7 @@ export type APIEndpoints = {
10
10
  PrismicEmbed: string;
11
11
  PrismicUnsplash: string;
12
12
  SliceMachineV1: string;
13
+ RepositoryService: string;
13
14
  };
14
15
 
15
16
  export const API_ENDPOINTS: APIEndpoints = (() => {
@@ -33,6 +34,10 @@ export const API_ENDPOINTS: APIEndpoints = (() => {
33
34
  process.env.slice_machine_v1_endpoint ??
34
35
  "https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/",
35
36
  ),
37
+ RepositoryService: addTrailingSlash(
38
+ process.env.repository_endpoint ??
39
+ "https://repository.internal.wroom.io/",
40
+ ),
36
41
  };
37
42
 
38
43
  const missingAPIEndpoints = Object.keys(apiEndpoints).filter((key) => {
@@ -81,6 +86,7 @@ If you didn't intend to run Slice Machine this way, stop it immediately and unse
81
86
  PrismicUnsplash: "https://unsplash.wroom.io/",
82
87
  SliceMachineV1:
83
88
  "https://mc5qopc07a.execute-api.us-east-1.amazonaws.com/v1/",
89
+ RepositoryService: "https://repository.internal.wroom.io/",
84
90
  };
85
91
  }
86
92
 
@@ -96,6 +102,7 @@ If you didn't intend to run Slice Machine this way, stop it immediately and unse
96
102
  PrismicEmbed: "https://oembed.prismic.io",
97
103
  PrismicUnsplash: "https://unsplash.prismic.io/",
98
104
  SliceMachineV1: "https://sm-api.prismic.io/v1/",
105
+ RepositoryService: "https://repository.internal.prismic.io/",
99
106
  };
100
107
  }
101
108
  }
@@ -1,18 +1,37 @@
1
1
  import * as t from "io-ts";
2
2
  import { formatValidationErrors } from "io-ts-reporters";
3
+ import { ZodIssue } from "zod";
3
4
 
4
5
  type DecodeErrorConstructorArgs<TInput = unknown> = {
5
6
  input: TInput;
6
- errors: t.Errors;
7
+ errors: t.Errors | ZodIssue[];
7
8
  };
8
9
 
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
+
9
22
  export class DecodeError<TInput = unknown> extends Error {
10
23
  name = "DecodeError";
11
24
  input: TInput;
12
25
  errors: string[];
13
26
 
14
27
  constructor(args: DecodeErrorConstructorArgs<TInput>) {
15
- const formattedErrors = formatValidationErrors(args.errors);
28
+ let formattedErrors: string[] = [];
29
+
30
+ if (isZodIssueArray(args.errors)) {
31
+ formattedErrors = formatZodErrors(args.errors);
32
+ } else {
33
+ formattedErrors = formatValidationErrors(args.errors);
34
+ }
16
35
 
17
36
  super(formattedErrors.join(", "));
18
37
 
package/src/lib/decode.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as t from "io-ts";
2
+ import { ZodType, ZodTypeDef } from "zod";
2
3
  import * as E from "fp-ts/Either";
3
4
  import { pipe } from "fp-ts/function";
4
5
 
@@ -14,10 +15,35 @@ export type DecodeReturnType<A, _O, I> =
14
15
  error: DecodeError<I>;
15
16
  };
16
17
 
17
- export const decode = <A, O, I>(
18
- codec: t.Type<A, O, I>,
18
+ function isZodSchema(value: unknown): value is ZodType<unknown> {
19
+ return (
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>,
19
35
  input: I,
20
- ): DecodeReturnType<A, O, 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
+
21
47
  return pipe(
22
48
  codec.decode(input),
23
49
  E.foldW(
@@ -33,4 +59,4 @@ export const decode = <A, O, I>(
33
59
  },
34
60
  ),
35
61
  );
36
- };
62
+ }
@@ -1,4 +1,5 @@
1
1
  import * as t from "io-ts";
2
+ import { z } from "zod";
2
3
  import fetch, { Response } from "../../lib/fetch";
3
4
  import { fold } from "fp-ts/Either";
4
5
 
@@ -35,6 +36,7 @@ import {
35
36
  FrameworkWroomTelemetryID,
36
37
  StarterId,
37
38
  Environment,
39
+ OnboardingState,
38
40
  } from "./types";
39
41
  import { sortEnvironments } from "./sortEnvironments";
40
42
 
@@ -506,6 +508,112 @@ export class PrismicRepositoryManager extends BaseManager {
506
508
  }
507
509
  }
508
510
 
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 togggle 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(t.type({ isDismissed: t.boolean }), json);
594
+
595
+ if (error) {
596
+ throw new UnexpectedDataError(
597
+ `Failed to decode onboarding toggle: ${error.errors.join(", ")}`,
598
+ );
599
+ }
600
+
601
+ if (value) {
602
+ return value;
603
+ }
604
+ }
605
+
606
+ switch (res.status) {
607
+ case 400:
608
+ case 401:
609
+ throw new UnauthenticatedError();
610
+ case 403:
611
+ throw new UnauthorizedError();
612
+ default:
613
+ throw new Error("Failed to toggle onboarding guide.");
614
+ }
615
+ }
616
+
509
617
  private _decodeLimitOrThrow(
510
618
  potentialLimit: unknown,
511
619
  statusCode: number,
@@ -531,7 +639,7 @@ export class PrismicRepositoryManager extends BaseManager {
531
639
 
532
640
  private async _fetch(args: {
533
641
  url: URL;
534
- method?: "GET" | "POST";
642
+ method?: "GET" | "POST" | "PATCH";
535
643
  body?: unknown;
536
644
  userAgent?: PrismicRepositoryUserAgents;
537
645
  repository?: string;
@@ -3,6 +3,7 @@ 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";
6
7
 
7
8
  export const PrismicRepositoryUserAgent = {
8
9
  SliceMachine: "prismic-cli/sm",
@@ -167,3 +168,18 @@ export const Environment = t.type({
167
168
  ),
168
169
  });
169
170
  export type Environment = t.TypeOf<typeof Environment>;
171
+
172
+ export const OnboardingState = z.object({
173
+ completedSteps: z.array(z.string()),
174
+ isDismissed: z.boolean(),
175
+ context: z.object({
176
+ framework: z.union([
177
+ z.literal("next"),
178
+ z.literal("nuxt"),
179
+ z.literal("sveltekit"),
180
+ z.literal("other"),
181
+ ]),
182
+ starterId: z.string().nullable(),
183
+ }),
184
+ });
185
+ export type OnboardingState = z.infer<typeof OnboardingState>;
@@ -35,13 +35,16 @@ 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",
41
38
  postPush_emptyStateCtaClicked: "post-push:empty-state-cta-clicked",
42
39
  postPush_toastCtaClicked: "post-push:toast-cta-clicked",
43
40
  experiment_exposure: "experiment:exposure",
44
41
  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",
45
48
  } as const;
46
49
  type SegmentEventTypes =
47
50
  (typeof SegmentEventType)[keyof typeof SegmentEventType];
@@ -87,11 +90,6 @@ export const HumanSegmentEventType = {
87
90
  "SliceMachine Slice Library [BETA] CTA modal displayed",
88
91
  [SegmentEventType.sliceLibrary_beta_codeOpened]:
89
92
  "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",
95
93
  [SegmentEventType.postPush_emptyStateCtaClicked]:
96
94
  "SliceMachine Post Push Empty State CTA Clicked",
97
95
  [SegmentEventType.postPush_toastCtaClicked]:
@@ -99,7 +97,19 @@ export const HumanSegmentEventType = {
99
97
  [SegmentEventType.experiment_exposure]: "$exposure",
100
98
  [SegmentEventType.sliceName_pascalCaseError]:
101
99
  "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",
102
111
  } as const;
112
+
103
113
  export type HumanSegmentEventTypes =
104
114
  (typeof HumanSegmentEventType)[keyof typeof HumanSegmentEventType];
105
115
 
@@ -338,26 +348,34 @@ type SliceLibraryBetaCodeOpened = SegmentEvent<
338
348
  typeof SegmentEventType.sliceLibrary_beta_codeOpened
339
349
  >;
340
350
 
351
+ type OnboardingCommonPayload = { stepId: string; stepTitle: string };
352
+ type SharedOnboardingProperties<T = {}> = T & { source: "SliceMachine" }; // eslint-disable-line @typescript-eslint/ban-types
353
+
341
354
  type SliceMachineOnboardingStepOpened = SegmentEvent<
342
355
  typeof SegmentEventType.onboarding_step_opened,
343
- {
344
- stepId: string;
345
- stepTitle: string;
346
- }
356
+ OnboardingCommonPayload
347
357
  >;
348
-
349
358
  type SliceMachineOnboardingStepCompleted = SegmentEvent<
350
359
  typeof SegmentEventType.onboarding_step_completed,
351
- {
352
- stepId: string;
353
- stepTitle: string;
354
- }
360
+ OnboardingCommonPayload
355
361
  >;
356
-
357
362
  type SliceMachineOnboardingCompleted = SegmentEvent<
358
363
  typeof SegmentEventType.onboarding_completed
359
364
  >;
360
365
 
366
+ type SliceMachineSharedOnboardingStepOpened = SegmentEvent<
367
+ typeof SegmentEventType.sharedOnboarding_step_opened,
368
+ SharedOnboardingProperties<OnboardingCommonPayload>
369
+ >;
370
+ type SliceMachineSharedOnboardingStepCompleted = SegmentEvent<
371
+ typeof SegmentEventType.sharedOnboarding_step_completed,
372
+ SharedOnboardingProperties<OnboardingCommonPayload>
373
+ >;
374
+ type SliceMachineSharedOnboardingCompleted = SegmentEvent<
375
+ typeof SegmentEventType.sharedOnboarding_completed,
376
+ SharedOnboardingProperties
377
+ >;
378
+
361
379
  type SliceMachinePostPushEmptyStateCtaClicked = SegmentEvent<
362
380
  typeof SegmentEventType.postPush_emptyStateCtaClicked
363
381
  >;
@@ -412,6 +430,9 @@ export type SegmentEvents =
412
430
  | SliceMachineOnboardingStepOpened
413
431
  | SliceMachineOnboardingStepCompleted
414
432
  | SliceMachineOnboardingCompleted
433
+ | SliceMachineSharedOnboardingStepOpened
434
+ | SliceMachineSharedOnboardingStepCompleted
435
+ | SliceMachineSharedOnboardingCompleted
415
436
  | SliceMachinePostPushEmptyStateCtaClicked
416
437
  | SliceMachinePostPushToastCtaClicked
417
438
  | SliceMachineExperimentExposure