@slicemachine/manager 0.25.3-alpha.jp-unauthorized-error.5 → 0.25.3-alpha.jp-unauthorized-error-improvement.2
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/managers/SliceMachineManager.cjs +11 -4
- package/dist/managers/SliceMachineManager.cjs.map +1 -1
- package/dist/managers/SliceMachineManager.js +11 -4
- package/dist/managers/SliceMachineManager.js.map +1 -1
- package/dist/managers/prismicRepository/PrismicRepositoryManager.cjs +2 -0
- package/dist/managers/prismicRepository/PrismicRepositoryManager.cjs.map +1 -1
- package/dist/managers/prismicRepository/PrismicRepositoryManager.js +2 -0
- package/dist/managers/prismicRepository/PrismicRepositoryManager.js.map +1 -1
- package/dist/managers/prismicRepository/types.cjs.map +1 -1
- package/dist/managers/prismicRepository/types.d.ts +7 -0
- package/dist/managers/prismicRepository/types.js.map +1 -1
- package/dist/managers/slices/SlicesManager.cjs +11 -3
- package/dist/managers/slices/SlicesManager.cjs.map +1 -1
- package/dist/managers/slices/SlicesManager.d.ts +9 -2
- package/dist/managers/slices/SlicesManager.js +11 -3
- package/dist/managers/slices/SlicesManager.js.map +1 -1
- package/dist/managers/telemetry/types.cjs +6 -2
- package/dist/managers/telemetry/types.cjs.map +1 -1
- package/dist/managers/telemetry/types.d.ts +13 -1
- package/dist/managers/telemetry/types.js +6 -2
- package/dist/managers/telemetry/types.js.map +1 -1
- package/package.json +2 -2
- package/src/managers/SliceMachineManager.ts +10 -4
- package/src/managers/prismicRepository/PrismicRepositoryManager.ts +2 -0
- package/src/managers/prismicRepository/types.ts +7 -0
- package/src/managers/slices/SlicesManager.ts +22 -6
- package/src/managers/telemetry/types.ts +23 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlicesManager.js","sources":["../../../../src/managers/slices/SlicesManager.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport * as prismicCustomTypesClient from \"@prismicio/custom-types-client\";\nimport { SharedSliceContent } from \"@prismicio/types-internal/lib/content\";\nimport { SliceComparator } from \"@prismicio/types-internal/lib/customtypes/diff\";\nimport {\n\tCompositeSlice,\n\tLegacySlice,\n\tSharedSlice,\n\tVariation,\n} from \"@prismicio/types-internal/lib/customtypes\";\nimport {\n\tCallHookReturnType,\n\tHookError,\n\tSliceAssetUpdateHook,\n\tSliceCreateHook,\n\tSliceCreateHookData,\n\tSliceLibraryReadHookData,\n\tSliceReadHookData,\n\tSliceRenameHook,\n\tSliceRenameHookData,\n\tSliceUpdateHook,\n} from \"@slicemachine/plugin-kit\";\n\nimport { DecodeError } from \"../../lib/DecodeError\";\nimport { assertPluginsInitialized } from \"../../lib/assertPluginsInitialized\";\nimport { bufferCodec } from \"../../lib/bufferCodec\";\nimport { decodeHookResult } from \"../../lib/decodeHookResult\";\nimport { createContentDigest } from \"../../lib/createContentDigest\";\nimport { mockSlice } from \"../../lib/mockSlice\";\nimport fetch from \"../../lib/fetch\";\n\nimport { OnlyHookErrors } from \"../../types\";\nimport { DEFAULT_SLICE_SCREENSHOT_URL } from \"../../constants/DEFAULT_SLICE_SCREENSHOT_URL\";\nimport { SLICE_MACHINE_USER_AGENT } from \"../../constants/SLICE_MACHINE_USER_AGENT\";\nimport { API_ENDPOINTS } from \"../../constants/API_ENDPOINTS\";\nimport { UnauthenticatedError, UnauthorizedError } from \"../../errors\";\n\nimport { BaseManager } from \"../BaseManager\";\n\ntype SlicesManagerReadSliceLibraryReturnType = {\n\tsliceIDs: string[];\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SlicesManagerReadAllSliceLibrariesReturnType = {\n\tlibraries: {\n\t\tlibraryID: string;\n\t\tsliceIDs: string[] | undefined;\n\t}[];\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerReadAllSlicesForLibraryArgs = {\n\tlibraryID: string;\n};\n\ntype SliceMachineManagerUpdateSliceArgs = {\n\tlibraryID: string;\n\tmodel: SharedSlice;\n\tmocks?: SharedSliceContent[];\n};\n\ntype SliceMachineManagerReadAllSlicesForLibraryReturnType = {\n\tmodels: { model: SharedSlice }[];\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerReadAllSlicesReturnType = {\n\tmodels: {\n\t\tlibraryID: string;\n\t\tmodel: SharedSlice;\n\t}[];\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerReadSliceReturnType = {\n\tmodel: SharedSlice | undefined;\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerPushSliceArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\tuserAgent?: string;\n};\n\nexport type SliceMachineManagerPushSliceReturnType = {\n\t/**\n\t * A record of Slice variation IDs mapped to uploaded screenshot URLs.\n\t */\n\tscreenshotURLs: Record<string, string> | undefined;\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerReadSliceScreenshotArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\tvariationID: string;\n};\n\ntype SliceMachineManagerReadSliceScreenshotReturnType = {\n\tdata: Buffer | undefined;\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerUpdateSliceScreenshotArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\tvariationID: string;\n\tdata: Buffer;\n};\n\ntype SliceMachineManagerDeleteSliceScreenshotArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\tvariationID: string;\n};\n\ntype SliceMachineManagerReadSliceMocksArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n};\n\ntype SliceMachineManagerReadSliceMocksReturnType = {\n\tmocks?: SharedSliceContent[];\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerReadSliceMocksConfigArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n};\n\ntype SliceMachineManagerReadSliceMocksConfigArgsReturnType = {\n\t// TODO\n\tmocksConfig?: Record<string, unknown>;\n\terrors: HookError[];\n};\n\ntype SliceMachineManagerUpdateSliceMocksArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\tmocks: SharedSliceContent[];\n};\n\ntype SliceMachineManagerUpdateSliceMocksArgsReturnType = {\n\terrors: HookError[];\n};\n\ntype SlicesManagerUpsertHostedSliceScrenshotsArgs = {\n\tlibraryID: string;\n\tmodel: SharedSlice;\n};\n\ntype SliceMachineManagerDeleteSliceArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n};\n\ntype SliceMachineManagerDeleteSliceReturnType = {\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerRenameSliceVariationArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\t/**\n\t * Current ID of the variation to rename.\n\t */\n\tvariationID: string;\n\tmodel: Variation;\n};\n\ntype SliceMachineManagerRenameSliceVariationReturnType = {\n\terrors: (DecodeError | HookError)[];\n\tassetsErrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerDeleteSliceVariationArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\tvariationID: string;\n};\n\ntype SliceMachineManagerDeleteSliceVariationReturnType = {\n\terrors: (DecodeError | HookError)[];\n\tassetsErrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerConvertLegacySliceToSharedSliceArgs = {\n\tmodel: CompositeSlice | LegacySlice;\n\tsrc: {\n\t\tcustomTypeID: string;\n\t\ttabID: string;\n\t\tsliceZoneID: string;\n\t\tsliceID: string;\n\t};\n\tdest: {\n\t\tlibraryID: string;\n\t\tsliceID: string;\n\t\tvariationName: string;\n\t\tvariationID: string;\n\t};\n};\n\ntype SliceMachineManagerConvertLegacySliceToSharedSliceReturnType = {\n\terrors: (DecodeError | HookError)[];\n};\n\nexport class SlicesManager extends BaseManager {\n\tasync readSliceLibrary(\n\t\targs: SliceLibraryReadHookData,\n\t): Promise<SlicesManagerReadSliceLibraryReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\t// TODO: Should validation happen at the `callHook` level?\n\t\t// Including validation at the hook level would ensure\n\t\t// hook-based actions are validated.\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice-library:read\",\n\t\t\targs,\n\t\t);\n\t\tconst { data, errors } = decodeHookResult(\n\t\t\tt.type({\n\t\t\t\tid: t.string,\n\t\t\t\tsliceIDs: t.array(t.string),\n\t\t\t}),\n\t\t\thookResult,\n\t\t);\n\n\t\treturn {\n\t\t\tsliceIDs: data[0]?.sliceIDs ?? [],\n\t\t\terrors: errors,\n\t\t};\n\t}\n\n\tasync readAllSliceLibraries(): Promise<SlicesManagerReadAllSliceLibrariesReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst sliceMachineConfig = await this.project.getSliceMachineConfig();\n\t\tconst libraryIDs = sliceMachineConfig.libraries || [];\n\n\t\tconst res: SlicesManagerReadAllSliceLibrariesReturnType = {\n\t\t\tlibraries: [],\n\t\t\terrors: [],\n\t\t};\n\n\t\tfor (const libraryID of libraryIDs) {\n\t\t\tconst { sliceIDs, errors } = await this.readSliceLibrary({\n\t\t\t\tlibraryID,\n\t\t\t});\n\t\t\tres.errors = [...res.errors, ...errors];\n\n\t\t\tres.libraries.push({\n\t\t\t\tlibraryID,\n\t\t\t\tsliceIDs,\n\t\t\t});\n\t\t}\n\n\t\treturn res;\n\t}\n\n\tasync readAllSlicesForLibrary(\n\t\targs: SliceMachineManagerReadAllSlicesForLibraryArgs,\n\t): Promise<SliceMachineManagerReadAllSlicesForLibraryReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst res: SliceMachineManagerReadAllSlicesForLibraryReturnType = {\n\t\t\tmodels: [],\n\t\t\terrors: [],\n\t\t};\n\n\t\tconst { sliceIDs, errors } = await this.readSliceLibrary({\n\t\t\tlibraryID: args.libraryID,\n\t\t});\n\t\tres.errors.push(...errors);\n\n\t\tif (sliceIDs) {\n\t\t\tfor (const sliceID of sliceIDs) {\n\t\t\t\tconst { model, errors } = await this.readSlice({\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\tsliceID,\n\t\t\t\t});\n\t\t\t\tres.errors.push(...errors);\n\n\t\t\t\tif (model) {\n\t\t\t\t\tres.models.push({ model });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn res;\n\t}\n\n\tasync readAllSlices(): Promise<SliceMachineManagerReadAllSlicesReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst sliceMachineConfig = await this.project.getSliceMachineConfig();\n\t\tconst libraryIDs = sliceMachineConfig.libraries || [];\n\n\t\tconst res: SliceMachineManagerReadAllSlicesReturnType = {\n\t\t\tmodels: [],\n\t\t\terrors: [],\n\t\t};\n\n\t\tfor (const libraryID of libraryIDs) {\n\t\t\tconst { models, errors } = await this.readAllSlicesForLibrary({\n\t\t\t\tlibraryID,\n\t\t\t});\n\t\t\tres.errors.push(...errors);\n\n\t\t\tfor (const model of models) {\n\t\t\t\tres.models.push({\n\t\t\t\t\tlibraryID,\n\t\t\t\t\tmodel: model.model,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn res;\n\t}\n\n\tasync createSlice(\n\t\targs: SliceCreateHookData,\n\t): Promise<OnlyHookErrors<CallHookReturnType<SliceCreateHook>>> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:create\",\n\t\t\targs,\n\t\t);\n\n\t\tconst updateSliceMocksArgs: SliceMachineManagerUpdateSliceMocksArgs = {\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.model.id,\n\t\t\tmocks: mockSlice({ model: args.model }),\n\t\t};\n\n\t\tconst { errors: updateSliceHookErrors } =\n\t\t\tawait this.updateSliceMocks(updateSliceMocksArgs);\n\n\t\treturn {\n\t\t\terrors: [...hookResult.errors, ...updateSliceHookErrors],\n\t\t};\n\t}\n\n\tasync readSlice(\n\t\targs: SliceReadHookData,\n\t): Promise<SliceMachineManagerReadSliceReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:read\",\n\t\t\targs,\n\t\t);\n\t\tconst { data, errors } = decodeHookResult(\n\t\t\tt.type({\n\t\t\t\tmodel: SharedSlice,\n\t\t\t}),\n\t\t\thookResult,\n\t\t);\n\n\t\treturn {\n\t\t\tmodel: data[0]?.model,\n\t\t\terrors: errors.map((error) => {\n\t\t\t\terror.message = `Failed to decode slice model with id '${args.sliceID}': ${error.message}`;\n\n\t\t\t\treturn error;\n\t\t\t}),\n\t\t};\n\t}\n\n\tasync updateSlice(\n\t\targs: SliceMachineManagerUpdateSliceArgs,\n\t): Promise<OnlyHookErrors<CallHookReturnType<SliceUpdateHook>>> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst { mocks: previousMocks } = await this.readSliceMocks({\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.model.id,\n\t\t});\n\t\tconst { model: previousModel } = await this.readSlice({\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.model.id,\n\t\t});\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:update\",\n\t\t\targs,\n\t\t);\n\n\t\tconst updatedMocks = mockSlice({\n\t\t\tmodel: args.model,\n\t\t\tmocks: previousMocks,\n\t\t\tdiff: SliceComparator.compare(previousModel, args.model),\n\t\t});\n\t\tconst updateSliceMocksArgs: SliceMachineManagerUpdateSliceMocksArgs = {\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.model.id,\n\t\t\tmocks: updatedMocks,\n\t\t};\n\n\t\tconst { errors: updateSliceMocksHookResult } =\n\t\t\tawait this.updateSliceMocks(updateSliceMocksArgs);\n\n\t\treturn {\n\t\t\terrors: [...hookResult.errors, ...updateSliceMocksHookResult],\n\t\t};\n\t}\n\n\tasync renameSlice(\n\t\targs: SliceRenameHookData,\n\t): Promise<OnlyHookErrors<CallHookReturnType<SliceRenameHook>>> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:rename\",\n\t\t\targs,\n\t\t);\n\n\t\treturn {\n\t\t\terrors: hookResult.errors,\n\t\t};\n\t}\n\n\tasync deleteSlice(\n\t\targs: SliceMachineManagerDeleteSliceArgs,\n\t): Promise<SliceMachineManagerDeleteSliceReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst { model, errors: readSliceErrors } = await this.readSlice({\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.sliceID,\n\t\t});\n\n\t\tif (model) {\n\t\t\tconst { errors: deleteSliceErrors } =\n\t\t\t\tawait this.sliceMachinePluginRunner.callHook(\"slice:delete\", {\n\t\t\t\t\tmodel,\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t});\n\n\t\t\t// Do not update custom types if slice deletion failed\n\t\t\tif (deleteSliceErrors.length > 0) {\n\t\t\t\treturn {\n\t\t\t\t\terrors: deleteSliceErrors,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { errors: updateCustomTypeErrors } =\n\t\t\t\tawait this._removeSliceFromCustomTypes(args.sliceID);\n\n\t\t\treturn {\n\t\t\t\terrors: updateCustomTypeErrors,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\terrors: readSliceErrors,\n\t\t\t};\n\t\t}\n\t}\n\n\tasync renameSliceVariation(\n\t\targs: SliceMachineManagerRenameSliceVariationArgs,\n\t): Promise<SliceMachineManagerRenameSliceVariationReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\t// TODO: Remove when we support renaming variation ID, see: DT-1708\n\t\tif (args.variationID !== args.model.id) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Renaming variation ID is not supported yet by the backend, only rename its name! For more information, see: https://linear.app/prismic/issue/DT-1708\",\n\t\t\t);\n\t\t}\n\n\t\tconst { model, errors: readSliceErrors } = await this.readSlice({\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.sliceID,\n\t\t});\n\n\t\tif (model) {\n\t\t\t// Find and rename the variation\n\t\t\tconst updatedModel = {\n\t\t\t\t...model,\n\t\t\t\tvariations: model.variations.map((variation) => {\n\t\t\t\t\tif (variation.id === args.variationID) {\n\t\t\t\t\t\t// Matches the slice we want to rename\n\t\t\t\t\t\treturn args.model;\n\t\t\t\t\t} else if (variation.id === args.model.id) {\n\t\t\t\t\t\t// Matches any other slice that has the ID of the renamed variation and throw.\n\t\t\t\t\t\t// This should be validated on the frontend first for better UX, this is only backend validation.\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Cannot rename variation \\`${args.variationID}\\` to \\`${args.model.id}\\`. A variation already exists with that ID in slice \\`${args.sliceID}\\` from library \\`${args.libraryID}\\`, try deleting it first or choose another variation ID to rename that slice.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn variation;\n\t\t\t\t}),\n\t\t\t};\n\t\t\tconst updateSliceHookResult =\n\t\t\t\tawait this.sliceMachinePluginRunner.callHook(\"slice:update\", {\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\tmodel: updatedModel,\n\t\t\t\t});\n\n\t\t\t// If variation ID has changed, we need to rename assets accordingly\n\t\t\tconst assetsErrors: (DecodeError<unknown> | HookError<unknown>)[] = [];\n\t\t\tif (args.variationID !== args.model.id) {\n\t\t\t\t// Renaming screenshot\n\t\t\t\tconst { data: screenshot, errors: readSliceScreenshotErrors } =\n\t\t\t\t\tawait this.readSliceScreenshot({\n\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\tsliceID: args.sliceID,\n\t\t\t\t\t\tvariationID: args.variationID,\n\t\t\t\t\t});\n\t\t\t\tassetsErrors.push(...readSliceScreenshotErrors);\n\n\t\t\t\tif (screenshot) {\n\t\t\t\t\t// Delete old ID screenshot\n\t\t\t\t\tconst { errors: deleteSliceScreenshotErrors } =\n\t\t\t\t\t\tawait this.deleteSliceScreenshot({\n\t\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\t\tsliceID: args.sliceID,\n\t\t\t\t\t\t\tvariationID: args.variationID,\n\t\t\t\t\t\t});\n\t\t\t\t\tassetsErrors.push(...deleteSliceScreenshotErrors);\n\n\t\t\t\t\t// Create new ID screenshot\n\t\t\t\t\tconst { errors: updateSliceScreenshotErrors } =\n\t\t\t\t\t\tawait this.updateSliceScreenshot({\n\t\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\t\tsliceID: args.sliceID,\n\t\t\t\t\t\t\tvariationID: args.model.id,\n\t\t\t\t\t\t\tdata: screenshot,\n\t\t\t\t\t\t});\n\t\t\t\t\tassetsErrors.push(...updateSliceScreenshotErrors);\n\t\t\t\t}\n\n\t\t\t\t// Renaming mocks\n\t\t\t\tconst { mocks, errors: readSliceMocksErrors } =\n\t\t\t\t\tawait this.readSliceMocks({\n\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\tsliceID: args.sliceID,\n\t\t\t\t\t});\n\t\t\t\tassetsErrors.push(...readSliceMocksErrors);\n\n\t\t\t\tif (mocks?.length) {\n\t\t\t\t\tconst { errors: updateSliceMocksErrors } =\n\t\t\t\t\t\tawait this.updateSliceMocks({\n\t\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\t\tsliceID: args.sliceID,\n\t\t\t\t\t\t\tmocks: mocks.map((mock) => {\n\t\t\t\t\t\t\t\tif (mock.variation === args.variationID) {\n\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t...mock,\n\t\t\t\t\t\t\t\t\t\tvariation: args.model.id,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn mock;\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\t\t\t\t\tassetsErrors.push(...updateSliceMocksErrors);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\terrors: updateSliceHookResult.errors,\n\t\t\t\tassetsErrors,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\terrors: readSliceErrors,\n\t\t\t\tassetsErrors: [],\n\t\t\t};\n\t\t}\n\t}\n\n\tasync deleteSliceVariation(\n\t\targs: SliceMachineManagerDeleteSliceVariationArgs,\n\t): Promise<SliceMachineManagerDeleteSliceVariationReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst { model, errors: readSliceErrors } = await this.readSlice({\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.sliceID,\n\t\t});\n\n\t\tif (model) {\n\t\t\t// Remove variation from model and update it\n\t\t\tconst updatedModel = {\n\t\t\t\t...model,\n\t\t\t\tvariations: model.variations.filter(\n\t\t\t\t\t(variation) => variation.id !== args.variationID,\n\t\t\t\t),\n\t\t\t};\n\t\t\tconst updateSliceHookResult =\n\t\t\t\tawait this.sliceMachinePluginRunner.callHook(\"slice:update\", {\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\tmodel: updatedModel,\n\t\t\t\t});\n\n\t\t\t// Cleanup deleted variation screenshot\n\t\t\tconst { errors: deleteSliceScreenshotErrors } =\n\t\t\t\tawait this.deleteSliceScreenshot(args);\n\n\t\t\t// Cleanup deleted variation mocks\n\t\t\tconst { mocks, errors: readSliceMocksErrors } = await this.readSliceMocks(\n\t\t\t\t{\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\tsliceID: args.sliceID,\n\t\t\t\t},\n\t\t\t);\n\t\t\tlet updateSliceMocksErrors: SliceMachineManagerUpdateSliceMocksArgsReturnType[\"errors\"] =\n\t\t\t\t[];\n\t\t\tif (mocks?.length) {\n\t\t\t\tupdateSliceMocksErrors = (\n\t\t\t\t\tawait this.updateSliceMocks({\n\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\tsliceID: args.sliceID,\n\t\t\t\t\t\tmocks: mocks.filter((mock) => mock.variation !== args.variationID),\n\t\t\t\t\t})\n\t\t\t\t).errors;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\terrors: updateSliceHookResult.errors,\n\t\t\t\tassetsErrors: [\n\t\t\t\t\t...deleteSliceScreenshotErrors,\n\t\t\t\t\t...readSliceMocksErrors,\n\t\t\t\t\t...updateSliceMocksErrors,\n\t\t\t\t],\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\terrors: readSliceErrors,\n\t\t\t\tassetsErrors: [],\n\t\t\t};\n\t\t}\n\t}\n\n\tasync convertLegacySliceToSharedSlice(\n\t\targs: SliceMachineManagerConvertLegacySliceToSharedSliceArgs,\n\t): Promise<SliceMachineManagerConvertLegacySliceToSharedSliceReturnType> {\n\t\tconst errors: (DecodeError | HookError)[] = [];\n\n\t\tconst { model: maybeExistingSlice } = await this.readSlice({\n\t\t\tlibraryID: args.dest.libraryID,\n\t\t\tsliceID: args.dest.sliceID,\n\t\t});\n\n\t\tconst legacySliceAsVariation: Variation = {\n\t\t\tid: args.dest.variationID,\n\t\t\tname: args.dest.variationName,\n\t\t\tdescription: args.dest.variationName,\n\t\t\timageUrl: \"\",\n\t\t\tdocURL: \"\",\n\t\t\tversion: \"initial\",\n\t\t\tprimary: {},\n\t\t\titems: {},\n\t\t};\n\n\t\tswitch (args.model.type) {\n\t\t\tcase \"Slice\":\n\t\t\t\tlegacySliceAsVariation.primary = args.model[\"non-repeat\"];\n\t\t\t\tlegacySliceAsVariation.items = args.model.repeat;\n\t\t\t\tbreak;\n\n\t\t\tcase \"Group\":\n\t\t\t\tlegacySliceAsVariation.items = args.model.config?.fields ?? {};\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tlegacySliceAsVariation.primary = { [args.src.sliceID]: args.model };\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// Convert as a slice variation, or merge against an existing slice variation\n\t\tif (maybeExistingSlice) {\n\t\t\tconst maybeVariation = maybeExistingSlice.variations.find(\n\t\t\t\t(variation) => variation.id === args.dest.variationID,\n\t\t\t);\n\n\t\t\t// If we're not merging against an existing slice variation, then we need to insert the new variation\n\t\t\tif (!maybeVariation) {\n\t\t\t\tmaybeExistingSlice.variations = [\n\t\t\t\t\t...maybeExistingSlice.variations,\n\t\t\t\t\tlegacySliceAsVariation,\n\t\t\t\t];\n\t\t\t}\n\n\t\t\tmaybeExistingSlice.legacyPaths ||= {};\n\t\t\tmaybeExistingSlice.legacyPaths[\n\t\t\t\t`${args.src.customTypeID}::${args.src.sliceZoneID}::${args.src.sliceID}`\n\t\t\t] = args.dest.variationID;\n\n\t\t\tawait this.updateSlice({\n\t\t\t\tlibraryID: args.dest.libraryID,\n\t\t\t\tmodel: maybeExistingSlice,\n\t\t\t});\n\t\t} else {\n\t\t\t// Convert to new shared slice\n\t\t\tawait this.createSlice({\n\t\t\t\tlibraryID: args.dest.libraryID,\n\t\t\t\tmodel: {\n\t\t\t\t\tid: args.dest.sliceID,\n\t\t\t\t\ttype: \"SharedSlice\",\n\t\t\t\t\tname: args.dest.sliceID,\n\t\t\t\t\tlegacyPaths: {\n\t\t\t\t\t\t[`${args.src.customTypeID}::${args.src.sliceZoneID}::${args.src.sliceID}`]:\n\t\t\t\t\t\t\targs.dest.variationID,\n\t\t\t\t\t},\n\t\t\t\t\tvariations: [legacySliceAsVariation],\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// Update source custom type\n\t\tconst { model: customType, errors: customTypeReadErrors } =\n\t\t\tawait this.customTypes.readCustomType({\n\t\t\t\tid: args.src.customTypeID,\n\t\t\t});\n\t\terrors.push(...customTypeReadErrors);\n\n\t\tif (customType) {\n\t\t\tconst field = customType.json[args.src.tabID][args.src.sliceZoneID];\n\n\t\t\t// Convert legacy slice definition in slice zone to shared slice reference\n\t\t\tif (field.type === \"Slices\" && field.config?.choices) {\n\t\t\t\tdelete field.config.choices[args.src.sliceID];\n\t\t\t\tfield.config.choices[args.dest.sliceID] = {\n\t\t\t\t\ttype: \"SharedSlice\",\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { errors: customTypeUpdateErrors } =\n\t\t\t\tawait this.customTypes.updateCustomType({ model: customType });\n\t\t\terrors.push(...customTypeUpdateErrors);\n\t\t}\n\n\t\treturn { errors };\n\t}\n\n\t/**\n\t * @returns Record of variation IDs mapped to uploaded screenshot URLs.\n\t */\n\tasync pushSlice(\n\t\targs: SliceMachineManagerPushSliceArgs,\n\t): Promise<SliceMachineManagerPushSliceReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tif (!(await this.user.checkIsLoggedIn())) {\n\t\t\tthrow new UnauthenticatedError();\n\t\t}\n\n\t\tconst { model, errors: readSliceErrors } = await this.readSlice({\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.sliceID,\n\t\t});\n\n\t\tif (model) {\n\t\t\tconst modelWithScreenshots =\n\t\t\t\tawait this.updateSliceModelScreenshotsInPlace({\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\tmodel,\n\t\t\t\t});\n\n\t\t\tconst authenticationToken = await this.user.getAuthenticationToken();\n\t\t\tconst repositoryName = await this.project.getResolvedRepositoryName();\n\n\t\t\t// TODO: Create a single shared client.\n\t\t\tconst client = prismicCustomTypesClient.createClient({\n\t\t\t\tendpoint: API_ENDPOINTS.PrismicModels,\n\t\t\t\trepositoryName,\n\t\t\t\ttoken: authenticationToken,\n\t\t\t\tfetch,\n\t\t\t\tfetchOptions: {\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t\"User-Agent\": args.userAgent || SLICE_MACHINE_USER_AGENT,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\n\t\t\ttry {\n\t\t\t\t// Check if Slice already exists on the repository.\n\t\t\t\tawait client.getSharedSliceByID(args.sliceID);\n\n\t\t\t\t// If it exists on the repository, update it.\n\t\t\t\tawait client.updateSharedSlice(modelWithScreenshots);\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof prismicCustomTypesClient.NotFoundError) {\n\t\t\t\t\t// If the Slice doesn't exist on the repository, insert it.\n\t\t\t\t\tawait client.insertSharedSlice(modelWithScreenshots);\n\t\t\t\t} else if (error instanceof prismicCustomTypesClient.ForbiddenError) {\n\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\"You do not have access to push Slices to this Prismic repository.\",\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\t// Pass the error through if it isn't the one we were expecting.\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst screenshotURLs: Record<string, string> = {};\n\t\t\tfor (const variation of modelWithScreenshots.variations) {\n\t\t\t\tscreenshotURLs[variation.id] = variation.imageUrl;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tscreenshotURLs,\n\t\t\t\terrors: readSliceErrors,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tscreenshotURLs: undefined,\n\t\t\t\terrors: readSliceErrors,\n\t\t\t};\n\t\t}\n\t}\n\n\tasync readSliceScreenshot(\n\t\targs: SliceMachineManagerReadSliceScreenshotArgs,\n\t): Promise<SliceMachineManagerReadSliceScreenshotReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:asset:read\",\n\t\t\t{\n\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\tsliceID: args.sliceID,\n\t\t\t\tassetID: `screenshot-${args.variationID}.png`,\n\t\t\t},\n\t\t);\n\t\tconst { data, errors } = decodeHookResult(\n\t\t\tt.type({\n\t\t\t\tdata: bufferCodec,\n\t\t\t}),\n\t\t\thookResult,\n\t\t);\n\n\t\treturn {\n\t\t\tdata: data[0]?.data,\n\t\t\terrors: errors,\n\t\t};\n\t}\n\n\tasync updateSliceScreenshot(\n\t\targs: SliceMachineManagerUpdateSliceScreenshotArgs,\n\t): Promise<OnlyHookErrors<CallHookReturnType<SliceAssetUpdateHook>>> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:asset:update\",\n\t\t\t{\n\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\tsliceID: args.sliceID,\n\t\t\t\tasset: {\n\t\t\t\t\tid: `screenshot-${args.variationID}.png`,\n\t\t\t\t\tdata: args.data,\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\treturn {\n\t\t\terrors: hookResult.errors,\n\t\t};\n\t}\n\n\tasync deleteSliceScreenshot(\n\t\targs: SliceMachineManagerDeleteSliceScreenshotArgs,\n\t): Promise<OnlyHookErrors<CallHookReturnType<SliceAssetUpdateHook>>> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:asset:delete\",\n\t\t\t{\n\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\tsliceID: args.sliceID,\n\t\t\t\tassetID: `screenshot-${args.variationID}.png`,\n\t\t\t},\n\t\t);\n\n\t\treturn {\n\t\t\terrors: hookResult.errors,\n\t\t};\n\t}\n\n\tasync readSliceMocks(\n\t\targs: SliceMachineManagerReadSliceMocksArgs,\n\t): Promise<SliceMachineManagerReadSliceMocksReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:asset:read\",\n\t\t\t{\n\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\tsliceID: args.sliceID,\n\t\t\t\tassetID: `mocks.json`,\n\t\t\t},\n\t\t);\n\t\tconst { data, errors } = decodeHookResult(\n\t\t\tt.type({\n\t\t\t\tdata: t.array(SharedSliceContent),\n\t\t\t}),\n\t\t\t{\n\t\t\t\t...hookResult,\n\t\t\t\t// Convert the asset data from a Buffer to JSON\n\t\t\t\t// to prepare it for validation.\n\t\t\t\tdata: hookResult.data.map((result) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...result,\n\t\t\t\t\t\t\tdata: JSON.parse(result.data.toString()),\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch {\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t},\n\t\t);\n\n\t\tif (data) {\n\t\t\treturn {\n\t\t\t\tmocks: data[0]?.data,\n\t\t\t\terrors,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tmocks: [],\n\t\t\t\terrors,\n\t\t\t};\n\t\t}\n\t}\n\n\tasync updateSliceMocks(\n\t\targs: SliceMachineManagerUpdateSliceMocksArgs,\n\t): Promise<SliceMachineManagerUpdateSliceMocksArgsReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:asset:update\",\n\t\t\t{\n\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\tsliceID: args.sliceID,\n\t\t\t\tasset: {\n\t\t\t\t\tid: \"mocks.json\",\n\t\t\t\t\tdata: Buffer.from(JSON.stringify(args.mocks, null, \"\\t\")),\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\treturn {\n\t\t\terrors: hookResult.errors,\n\t\t};\n\t}\n\n\t// TODO: Remove\n\tasync readSliceMocksConfig(\n\t\targs: SliceMachineManagerReadSliceMocksConfigArgs,\n\t): Promise<SliceMachineManagerReadSliceMocksConfigArgsReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:asset:read\",\n\t\t\t{\n\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\tsliceID: args.sliceID,\n\t\t\t\tassetID: \"mocks.config.json\",\n\t\t\t},\n\t\t);\n\t\tconst data = hookResult.data[0]?.data;\n\n\t\t// TODO: Validate the returned data.\n\n\t\tif (data) {\n\t\t\treturn {\n\t\t\t\tmocksConfig: JSON.parse(data.toString()),\n\t\t\t\terrors: hookResult.errors,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tmocksConfig: undefined,\n\t\t\t\terrors: hookResult.errors,\n\t\t\t};\n\t\t}\n\t}\n\n\tasync fetchRemoteSlices(): Promise<SharedSlice[]> {\n\t\tconst authenticationToken = await this.user.getAuthenticationToken();\n\t\tconst repositoryName = await this.project.getResolvedRepositoryName();\n\n\t\tconst client = prismicCustomTypesClient.createClient({\n\t\t\tendpoint: API_ENDPOINTS.PrismicModels,\n\t\t\trepositoryName,\n\t\t\ttoken: authenticationToken,\n\t\t\tfetch,\n\t\t\tfetchOptions: {\n\t\t\t\theaders: {\n\t\t\t\t\t\"User-Agent\": SLICE_MACHINE_USER_AGENT,\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\treturn await client.getAllSharedSlices();\n\t}\n\n\tasync updateSliceModelScreenshotsInPlace(\n\t\targs: SlicesManagerUpsertHostedSliceScrenshotsArgs,\n\t): Promise<SharedSlice> {\n\t\tconst repositoryName = await this.project.getResolvedRepositoryName();\n\n\t\tconst variations = await Promise.all(\n\t\t\targs.model.variations.map(async (variation) => {\n\t\t\t\tconst screenshot = await this.readSliceScreenshot({\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\tsliceID: args.model.id,\n\t\t\t\t\tvariationID: variation.id,\n\t\t\t\t});\n\n\t\t\t\t// If there's no screenshot, delete it by replacing it with the default screenshot\n\t\t\t\tif (!screenshot.data) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...variation,\n\t\t\t\t\t\timageUrl: DEFAULT_SLICE_SCREENSHOT_URL,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst hasScreenshotChanged = !variation.imageUrl?.includes(\n\t\t\t\t\tcreateContentDigest(screenshot.data),\n\t\t\t\t);\n\n\t\t\t\t// If screenshot hasn't changed, do nothing\n\t\t\t\tif (!hasScreenshotChanged) {\n\t\t\t\t\treturn variation;\n\t\t\t\t}\n\n\t\t\t\tconst keyPrefix = [\n\t\t\t\t\trepositoryName,\n\t\t\t\t\t\"shared-slices\",\n\t\t\t\t\targs.model.id,\n\t\t\t\t\tvariation.id,\n\t\t\t\t].join(\"/\");\n\n\t\t\t\tconst uploadedScreenshot = await this.screenshots.uploadScreenshot({\n\t\t\t\t\tdata: screenshot.data,\n\t\t\t\t\tkeyPrefix,\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\t...variation,\n\t\t\t\t\timageUrl: uploadedScreenshot.url,\n\t\t\t\t};\n\t\t\t}),\n\t\t);\n\n\t\treturn {\n\t\t\t...args.model,\n\t\t\tvariations,\n\t\t};\n\t}\n\n\tprivate async _removeSliceFromCustomTypes(sliceID: string) {\n\t\tconst { models, errors: customTypeReadErrors } =\n\t\t\tawait this.customTypes.readAllCustomTypes();\n\n\t\t// Successfully update all custom types or throw\n\t\tawait Promise.all(\n\t\t\tmodels.map(async (customType) => {\n\t\t\t\tconst updatedJsonModel = Object.entries(customType.model.json).reduce(\n\t\t\t\t\t(tabAccumulator, [tabKey, tab]) => {\n\t\t\t\t\t\tconst updatedTabFields = Object.entries(tab).reduce(\n\t\t\t\t\t\t\t(fieldAccumulator, [fieldKey, field]) => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tfield.config === undefined ||\n\t\t\t\t\t\t\t\t\tfield.type !== \"Slices\" ||\n\t\t\t\t\t\t\t\t\tfield.config.choices === undefined\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn { ...fieldAccumulator, [fieldKey]: field };\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst filteredChoices = Object.entries(\n\t\t\t\t\t\t\t\t\tfield.config.choices,\n\t\t\t\t\t\t\t\t).reduce((choiceAccumulator, [choiceKey, choice]) => {\n\t\t\t\t\t\t\t\t\tif (choiceKey === sliceID) {\n\t\t\t\t\t\t\t\t\t\treturn choiceAccumulator;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\treturn { ...choiceAccumulator, [choiceKey]: choice };\n\t\t\t\t\t\t\t\t}, {});\n\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t...fieldAccumulator,\n\t\t\t\t\t\t\t\t\t[fieldKey]: {\n\t\t\t\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\t\t\t\tconfig: { ...field.config, choices: filteredChoices },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{},\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn { ...tabAccumulator, [tabKey]: updatedTabFields };\n\t\t\t\t\t},\n\t\t\t\t\t{},\n\t\t\t\t);\n\n\t\t\t\tawait this.customTypes.updateCustomType({\n\t\t\t\t\tmodel: { ...customType.model, json: updatedJsonModel },\n\t\t\t\t});\n\t\t\t}),\n\t\t);\n\n\t\treturn { errors: customTypeReadErrors };\n\t}\n}\n"],"names":["errors"],"mappings":";;;;;;;;;;;;;;;;AAiNM,MAAO,sBAAsB,YAAW;AAAA,EAC7C,MAAM,iBACL,MAA8B;;AAE9B,6BAAyB,KAAK,wBAAwB;AAKtD,UAAM,aAAa,MAAM,KAAK,yBAAyB,SACtD,sBACA,IAAI;AAEL,UAAM,EAAE,MAAM,OAAA,IAAW,iBACxB,EAAE,KAAK;AAAA,MACN,IAAI,EAAE;AAAA,MACN,UAAU,EAAE,MAAM,EAAE,MAAM;AAAA,IAAA,CAC1B,GACD,UAAU;AAGJ,WAAA;AAAA,MACN,YAAU,UAAK,CAAC,MAAN,mBAAS,aAAY,CAAE;AAAA,MACjC;AAAA,IAAA;AAAA,EAEF;AAAA,EAEA,MAAM,wBAAqB;AAC1B,6BAAyB,KAAK,wBAAwB;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kB,CAAC,QAAQ,GAAG,MAAK;AAAA,UAChD;AAEA,gBAAM,kBAAkB,OAAO,QAC9B,MAAM,OAAO,OAAO,EACnB,OAAO,CAAC,mBAAmB,CAAC,WAAW,MAAM,MAAK;AACnD,gBAAI,cAAc,SAAS;AACnB,qBAAA;AAAA,YACR;AAEA,mBAAO,EAAE,GAAG,mBAAmB,CAAC,SAAS,GAAG,OAAM;AAAA,UACnD,GAAG,CAAE,CAAA;AAEE,iBAAA;AAAA,YACN,GAAG;AAAA,YACH,CAAC,QAAQ,GAAG;AAAA,cACX,GAAG;AAAA,cACH,QAAQ,EAAE,GAAG,MAAM,QAAQ,SAAS,gBAAiB;AAAA,YACrD;AAAA,UAAA;AAAA,QAEH,GACA,CAAE,CAAA;AAGH,eAAO,EAAE,GAAG,gBAAgB,CAAC,MAAM,GAAG,iBAAgB;AAAA,MACvD,GACA,CAAE,CAAA;AAGG,YAAA,KAAK,YAAY,iBAAiB;AAAA,QACvC,OAAO,EAAE,GAAG,WAAW,OAAO,MAAM,iBAAkB;AAAA,MAAA,CACtD;AAAA,IACD,CAAA,CAAC;AAGI,WAAA,EAAE,QAAQ;EAClB;AACA;"}
|
|
1
|
+
{"version":3,"file":"SlicesManager.js","sources":["../../../../src/managers/slices/SlicesManager.ts"],"sourcesContent":["import * as t from \"io-ts\";\nimport * as prismicCustomTypesClient from \"@prismicio/custom-types-client\";\nimport { SharedSliceContent } from \"@prismicio/types-internal/lib/content\";\nimport { SliceComparator } from \"@prismicio/types-internal/lib/customtypes/diff\";\nimport {\n\tCompositeSlice,\n\tLegacySlice,\n\tSharedSlice,\n\tVariation,\n} from \"@prismicio/types-internal/lib/customtypes\";\nimport {\n\tCallHookReturnType,\n\tHookError,\n\tSliceAssetUpdateHook,\n\tSliceCreateHook,\n\tSliceCreateHookData,\n\tSliceLibraryReadHookData,\n\tSliceReadHookData,\n\tSliceRenameHook,\n\tSliceRenameHookData,\n\tSliceUpdateHook,\n} from \"@slicemachine/plugin-kit\";\n\nimport { DecodeError } from \"../../lib/DecodeError\";\nimport { assertPluginsInitialized } from \"../../lib/assertPluginsInitialized\";\nimport { bufferCodec } from \"../../lib/bufferCodec\";\nimport { decodeHookResult } from \"../../lib/decodeHookResult\";\nimport { createContentDigest } from \"../../lib/createContentDigest\";\nimport { mockSlice } from \"../../lib/mockSlice\";\nimport fetch from \"../../lib/fetch\";\n\nimport { OnlyHookErrors } from \"../../types\";\nimport { DEFAULT_SLICE_SCREENSHOT_URL } from \"../../constants/DEFAULT_SLICE_SCREENSHOT_URL\";\nimport { SLICE_MACHINE_USER_AGENT } from \"../../constants/SLICE_MACHINE_USER_AGENT\";\nimport { API_ENDPOINTS } from \"../../constants/API_ENDPOINTS\";\nimport { UnauthenticatedError, UnauthorizedError } from \"../../errors\";\n\nimport { BaseManager } from \"../BaseManager\";\n\ntype SlicesManagerReadSliceLibraryReturnType = {\n\tsliceIDs: string[];\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SlicesManagerReadAllSliceLibrariesReturnType = {\n\tlibraries: {\n\t\tlibraryID: string;\n\t\tsliceIDs: string[] | undefined;\n\t}[];\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerReadAllSlicesForLibraryArgs = {\n\tlibraryID: string;\n};\n\ntype SliceMachineManagerUpdateSliceArgs = {\n\tlibraryID: string;\n\tmodel: SharedSlice;\n\tmocks?: SharedSliceContent[];\n};\n\ntype SliceMachineManagerReadAllSlicesForLibraryReturnType = {\n\tmodels: { model: SharedSlice }[];\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerReadAllSlicesReturnType = {\n\tmodels: {\n\t\tlibraryID: string;\n\t\tmodel: SharedSlice;\n\t}[];\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerReadSliceReturnType = {\n\tmodel: SharedSlice | undefined;\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerPushSliceArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\tuserAgent?: string;\n};\n\nexport type SliceMachineManagerPushSliceReturnType = {\n\t/**\n\t * A record of Slice variation IDs mapped to uploaded screenshot URLs.\n\t */\n\tscreenshotURLs: Record<string, string> | undefined;\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerReadSliceScreenshotArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\tvariationID: string;\n};\n\ntype SliceMachineManagerReadSliceScreenshotReturnType = {\n\tdata: Buffer | undefined;\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerUpdateSliceScreenshotArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\tvariationID: string;\n\tdata: Buffer;\n};\n\ntype SliceMachineManagerDeleteSliceScreenshotArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\tvariationID: string;\n};\n\ntype SliceMachineManagerReadSliceMocksArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n};\n\ntype SliceMachineManagerReadSliceMocksReturnType = {\n\tmocks?: SharedSliceContent[];\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerReadSliceMocksConfigArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n};\n\ntype SliceMachineManagerReadSliceMocksConfigArgsReturnType = {\n\t// TODO\n\tmocksConfig?: Record<string, unknown>;\n\terrors: HookError[];\n};\n\ntype SliceMachineManagerUpdateSliceMocksArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\tmocks: SharedSliceContent[];\n};\n\ntype SliceMachineManagerUpdateSliceMocksArgsReturnType = {\n\terrors: HookError[];\n};\n\ntype SlicesManagerUpsertHostedSliceScreenshotsArgs = {\n\tlibraryID: string;\n\tmodel: SharedSlice;\n\t/**\n\t * A map of variation IDs to remote screenshot URLs. These URLs are used to\n\t * detect if a screenshot has changed when comparing with local ones and to\n\t * push slices with the current screenshot. If a matching screenshot is not\n\t * found in this map, the current local screenshot is uploaded again.\n\t */\n\tvariationImageUrlMap: Record<string, string>;\n};\n\ntype SliceMachineManagerDeleteSliceArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n};\n\ntype SliceMachineManagerDeleteSliceReturnType = {\n\terrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerRenameSliceVariationArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\t/**\n\t * Current ID of the variation to rename.\n\t */\n\tvariationID: string;\n\tmodel: Variation;\n};\n\ntype SliceMachineManagerRenameSliceVariationReturnType = {\n\terrors: (DecodeError | HookError)[];\n\tassetsErrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerDeleteSliceVariationArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\tvariationID: string;\n};\n\ntype SliceMachineManagerDeleteSliceVariationReturnType = {\n\terrors: (DecodeError | HookError)[];\n\tassetsErrors: (DecodeError | HookError)[];\n};\n\ntype SliceMachineManagerConvertLegacySliceToSharedSliceArgs = {\n\tmodel: CompositeSlice | LegacySlice;\n\tsrc: {\n\t\tcustomTypeID: string;\n\t\ttabID: string;\n\t\tsliceZoneID: string;\n\t\tsliceID: string;\n\t};\n\tdest: {\n\t\tlibraryID: string;\n\t\tsliceID: string;\n\t\tvariationName: string;\n\t\tvariationID: string;\n\t};\n};\n\ntype SliceMachineManagerConvertLegacySliceToSharedSliceReturnType = {\n\terrors: (DecodeError | HookError)[];\n};\n\nexport class SlicesManager extends BaseManager {\n\tasync readSliceLibrary(\n\t\targs: SliceLibraryReadHookData,\n\t): Promise<SlicesManagerReadSliceLibraryReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\t// TODO: Should validation happen at the `callHook` level?\n\t\t// Including validation at the hook level would ensure\n\t\t// hook-based actions are validated.\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice-library:read\",\n\t\t\targs,\n\t\t);\n\t\tconst { data, errors } = decodeHookResult(\n\t\t\tt.type({\n\t\t\t\tid: t.string,\n\t\t\t\tsliceIDs: t.array(t.string),\n\t\t\t}),\n\t\t\thookResult,\n\t\t);\n\n\t\treturn {\n\t\t\tsliceIDs: data[0]?.sliceIDs ?? [],\n\t\t\terrors: errors,\n\t\t};\n\t}\n\n\tasync readAllSliceLibraries(): Promise<SlicesManagerReadAllSliceLibrariesReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst sliceMachineConfig = await this.project.getSliceMachineConfig();\n\t\tconst libraryIDs = sliceMachineConfig.libraries || [];\n\n\t\tconst res: SlicesManagerReadAllSliceLibrariesReturnType = {\n\t\t\tlibraries: [],\n\t\t\terrors: [],\n\t\t};\n\n\t\tfor (const libraryID of libraryIDs) {\n\t\t\tconst { sliceIDs, errors } = await this.readSliceLibrary({\n\t\t\t\tlibraryID,\n\t\t\t});\n\t\t\tres.errors = [...res.errors, ...errors];\n\n\t\t\tres.libraries.push({\n\t\t\t\tlibraryID,\n\t\t\t\tsliceIDs,\n\t\t\t});\n\t\t}\n\n\t\treturn res;\n\t}\n\n\tasync readAllSlicesForLibrary(\n\t\targs: SliceMachineManagerReadAllSlicesForLibraryArgs,\n\t): Promise<SliceMachineManagerReadAllSlicesForLibraryReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst res: SliceMachineManagerReadAllSlicesForLibraryReturnType = {\n\t\t\tmodels: [],\n\t\t\terrors: [],\n\t\t};\n\n\t\tconst { sliceIDs, errors } = await this.readSliceLibrary({\n\t\t\tlibraryID: args.libraryID,\n\t\t});\n\t\tres.errors.push(...errors);\n\n\t\tif (sliceIDs) {\n\t\t\tfor (const sliceID of sliceIDs) {\n\t\t\t\tconst { model, errors } = await this.readSlice({\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\tsliceID,\n\t\t\t\t});\n\t\t\t\tres.errors.push(...errors);\n\n\t\t\t\tif (model) {\n\t\t\t\t\tres.models.push({ model });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn res;\n\t}\n\n\tasync readAllSlices(): Promise<SliceMachineManagerReadAllSlicesReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst sliceMachineConfig = await this.project.getSliceMachineConfig();\n\t\tconst libraryIDs = sliceMachineConfig.libraries || [];\n\n\t\tconst res: SliceMachineManagerReadAllSlicesReturnType = {\n\t\t\tmodels: [],\n\t\t\terrors: [],\n\t\t};\n\n\t\tfor (const libraryID of libraryIDs) {\n\t\t\tconst { models, errors } = await this.readAllSlicesForLibrary({\n\t\t\t\tlibraryID,\n\t\t\t});\n\t\t\tres.errors.push(...errors);\n\n\t\t\tfor (const model of models) {\n\t\t\t\tres.models.push({\n\t\t\t\t\tlibraryID,\n\t\t\t\t\tmodel: model.model,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn res;\n\t}\n\n\tasync createSlice(\n\t\targs: SliceCreateHookData,\n\t): Promise<OnlyHookErrors<CallHookReturnType<SliceCreateHook>>> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:create\",\n\t\t\targs,\n\t\t);\n\n\t\tconst updateSliceMocksArgs: SliceMachineManagerUpdateSliceMocksArgs = {\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.model.id,\n\t\t\tmocks: mockSlice({ model: args.model }),\n\t\t};\n\n\t\tconst { errors: updateSliceHookErrors } =\n\t\t\tawait this.updateSliceMocks(updateSliceMocksArgs);\n\n\t\treturn {\n\t\t\terrors: [...hookResult.errors, ...updateSliceHookErrors],\n\t\t};\n\t}\n\n\tasync readSlice(\n\t\targs: SliceReadHookData,\n\t): Promise<SliceMachineManagerReadSliceReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:read\",\n\t\t\targs,\n\t\t);\n\t\tconst { data, errors } = decodeHookResult(\n\t\t\tt.type({\n\t\t\t\tmodel: SharedSlice,\n\t\t\t}),\n\t\t\thookResult,\n\t\t);\n\n\t\treturn {\n\t\t\tmodel: data[0]?.model,\n\t\t\terrors: errors.map((error) => {\n\t\t\t\terror.message = `Failed to decode slice model with id '${args.sliceID}': ${error.message}`;\n\n\t\t\t\treturn error;\n\t\t\t}),\n\t\t};\n\t}\n\n\tasync updateSlice(\n\t\targs: SliceMachineManagerUpdateSliceArgs,\n\t): Promise<OnlyHookErrors<CallHookReturnType<SliceUpdateHook>>> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst { mocks: previousMocks } = await this.readSliceMocks({\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.model.id,\n\t\t});\n\t\tconst { model: previousModel } = await this.readSlice({\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.model.id,\n\t\t});\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:update\",\n\t\t\targs,\n\t\t);\n\n\t\tconst updatedMocks = mockSlice({\n\t\t\tmodel: args.model,\n\t\t\tmocks: previousMocks,\n\t\t\tdiff: SliceComparator.compare(previousModel, args.model),\n\t\t});\n\t\tconst updateSliceMocksArgs: SliceMachineManagerUpdateSliceMocksArgs = {\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.model.id,\n\t\t\tmocks: updatedMocks,\n\t\t};\n\n\t\tconst { errors: updateSliceMocksHookResult } =\n\t\t\tawait this.updateSliceMocks(updateSliceMocksArgs);\n\n\t\treturn {\n\t\t\terrors: [...hookResult.errors, ...updateSliceMocksHookResult],\n\t\t};\n\t}\n\n\tasync renameSlice(\n\t\targs: SliceRenameHookData,\n\t): Promise<OnlyHookErrors<CallHookReturnType<SliceRenameHook>>> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:rename\",\n\t\t\targs,\n\t\t);\n\n\t\treturn {\n\t\t\terrors: hookResult.errors,\n\t\t};\n\t}\n\n\tasync deleteSlice(\n\t\targs: SliceMachineManagerDeleteSliceArgs,\n\t): Promise<SliceMachineManagerDeleteSliceReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst { model, errors: readSliceErrors } = await this.readSlice({\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.sliceID,\n\t\t});\n\n\t\tif (model) {\n\t\t\tconst { errors: deleteSliceErrors } =\n\t\t\t\tawait this.sliceMachinePluginRunner.callHook(\"slice:delete\", {\n\t\t\t\t\tmodel,\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t});\n\n\t\t\t// Do not update custom types if slice deletion failed\n\t\t\tif (deleteSliceErrors.length > 0) {\n\t\t\t\treturn {\n\t\t\t\t\terrors: deleteSliceErrors,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { errors: updateCustomTypeErrors } =\n\t\t\t\tawait this._removeSliceFromCustomTypes(args.sliceID);\n\n\t\t\treturn {\n\t\t\t\terrors: updateCustomTypeErrors,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\terrors: readSliceErrors,\n\t\t\t};\n\t\t}\n\t}\n\n\tasync renameSliceVariation(\n\t\targs: SliceMachineManagerRenameSliceVariationArgs,\n\t): Promise<SliceMachineManagerRenameSliceVariationReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\t// TODO: Remove when we support renaming variation ID, see: DT-1708\n\t\tif (args.variationID !== args.model.id) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Renaming variation ID is not supported yet by the backend, only rename its name! For more information, see: https://linear.app/prismic/issue/DT-1708\",\n\t\t\t);\n\t\t}\n\n\t\tconst { model, errors: readSliceErrors } = await this.readSlice({\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.sliceID,\n\t\t});\n\n\t\tif (model) {\n\t\t\t// Find and rename the variation\n\t\t\tconst updatedModel = {\n\t\t\t\t...model,\n\t\t\t\tvariations: model.variations.map((variation) => {\n\t\t\t\t\tif (variation.id === args.variationID) {\n\t\t\t\t\t\t// Matches the slice we want to rename\n\t\t\t\t\t\treturn args.model;\n\t\t\t\t\t} else if (variation.id === args.model.id) {\n\t\t\t\t\t\t// Matches any other slice that has the ID of the renamed variation and throw.\n\t\t\t\t\t\t// This should be validated on the frontend first for better UX, this is only backend validation.\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Cannot rename variation \\`${args.variationID}\\` to \\`${args.model.id}\\`. A variation already exists with that ID in slice \\`${args.sliceID}\\` from library \\`${args.libraryID}\\`, try deleting it first or choose another variation ID to rename that slice.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn variation;\n\t\t\t\t}),\n\t\t\t};\n\t\t\tconst updateSliceHookResult =\n\t\t\t\tawait this.sliceMachinePluginRunner.callHook(\"slice:update\", {\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\tmodel: updatedModel,\n\t\t\t\t});\n\n\t\t\t// If variation ID has changed, we need to rename assets accordingly\n\t\t\tconst assetsErrors: (DecodeError<unknown> | HookError<unknown>)[] = [];\n\t\t\tif (args.variationID !== args.model.id) {\n\t\t\t\t// Renaming screenshot\n\t\t\t\tconst { data: screenshot, errors: readSliceScreenshotErrors } =\n\t\t\t\t\tawait this.readSliceScreenshot({\n\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\tsliceID: args.sliceID,\n\t\t\t\t\t\tvariationID: args.variationID,\n\t\t\t\t\t});\n\t\t\t\tassetsErrors.push(...readSliceScreenshotErrors);\n\n\t\t\t\tif (screenshot) {\n\t\t\t\t\t// Delete old ID screenshot\n\t\t\t\t\tconst { errors: deleteSliceScreenshotErrors } =\n\t\t\t\t\t\tawait this.deleteSliceScreenshot({\n\t\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\t\tsliceID: args.sliceID,\n\t\t\t\t\t\t\tvariationID: args.variationID,\n\t\t\t\t\t\t});\n\t\t\t\t\tassetsErrors.push(...deleteSliceScreenshotErrors);\n\n\t\t\t\t\t// Create new ID screenshot\n\t\t\t\t\tconst { errors: updateSliceScreenshotErrors } =\n\t\t\t\t\t\tawait this.updateSliceScreenshot({\n\t\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\t\tsliceID: args.sliceID,\n\t\t\t\t\t\t\tvariationID: args.model.id,\n\t\t\t\t\t\t\tdata: screenshot,\n\t\t\t\t\t\t});\n\t\t\t\t\tassetsErrors.push(...updateSliceScreenshotErrors);\n\t\t\t\t}\n\n\t\t\t\t// Renaming mocks\n\t\t\t\tconst { mocks, errors: readSliceMocksErrors } =\n\t\t\t\t\tawait this.readSliceMocks({\n\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\tsliceID: args.sliceID,\n\t\t\t\t\t});\n\t\t\t\tassetsErrors.push(...readSliceMocksErrors);\n\n\t\t\t\tif (mocks?.length) {\n\t\t\t\t\tconst { errors: updateSliceMocksErrors } =\n\t\t\t\t\t\tawait this.updateSliceMocks({\n\t\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\t\tsliceID: args.sliceID,\n\t\t\t\t\t\t\tmocks: mocks.map((mock) => {\n\t\t\t\t\t\t\t\tif (mock.variation === args.variationID) {\n\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t...mock,\n\t\t\t\t\t\t\t\t\t\tvariation: args.model.id,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn mock;\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\t\t\t\t\tassetsErrors.push(...updateSliceMocksErrors);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\terrors: updateSliceHookResult.errors,\n\t\t\t\tassetsErrors,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\terrors: readSliceErrors,\n\t\t\t\tassetsErrors: [],\n\t\t\t};\n\t\t}\n\t}\n\n\tasync deleteSliceVariation(\n\t\targs: SliceMachineManagerDeleteSliceVariationArgs,\n\t): Promise<SliceMachineManagerDeleteSliceVariationReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst { model, errors: readSliceErrors } = await this.readSlice({\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.sliceID,\n\t\t});\n\n\t\tif (model) {\n\t\t\t// Remove variation from model and update it\n\t\t\tconst updatedModel = {\n\t\t\t\t...model,\n\t\t\t\tvariations: model.variations.filter(\n\t\t\t\t\t(variation) => variation.id !== args.variationID,\n\t\t\t\t),\n\t\t\t};\n\t\t\tconst updateSliceHookResult =\n\t\t\t\tawait this.sliceMachinePluginRunner.callHook(\"slice:update\", {\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\tmodel: updatedModel,\n\t\t\t\t});\n\n\t\t\t// Cleanup deleted variation screenshot\n\t\t\tconst { errors: deleteSliceScreenshotErrors } =\n\t\t\t\tawait this.deleteSliceScreenshot(args);\n\n\t\t\t// Cleanup deleted variation mocks\n\t\t\tconst { mocks, errors: readSliceMocksErrors } = await this.readSliceMocks(\n\t\t\t\t{\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\tsliceID: args.sliceID,\n\t\t\t\t},\n\t\t\t);\n\t\t\tlet updateSliceMocksErrors: SliceMachineManagerUpdateSliceMocksArgsReturnType[\"errors\"] =\n\t\t\t\t[];\n\t\t\tif (mocks?.length) {\n\t\t\t\tupdateSliceMocksErrors = (\n\t\t\t\t\tawait this.updateSliceMocks({\n\t\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t\tsliceID: args.sliceID,\n\t\t\t\t\t\tmocks: mocks.filter((mock) => mock.variation !== args.variationID),\n\t\t\t\t\t})\n\t\t\t\t).errors;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\terrors: updateSliceHookResult.errors,\n\t\t\t\tassetsErrors: [\n\t\t\t\t\t...deleteSliceScreenshotErrors,\n\t\t\t\t\t...readSliceMocksErrors,\n\t\t\t\t\t...updateSliceMocksErrors,\n\t\t\t\t],\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\terrors: readSliceErrors,\n\t\t\t\tassetsErrors: [],\n\t\t\t};\n\t\t}\n\t}\n\n\tasync convertLegacySliceToSharedSlice(\n\t\targs: SliceMachineManagerConvertLegacySliceToSharedSliceArgs,\n\t): Promise<SliceMachineManagerConvertLegacySliceToSharedSliceReturnType> {\n\t\tconst errors: (DecodeError | HookError)[] = [];\n\n\t\tconst { model: maybeExistingSlice } = await this.readSlice({\n\t\t\tlibraryID: args.dest.libraryID,\n\t\t\tsliceID: args.dest.sliceID,\n\t\t});\n\n\t\tconst legacySliceAsVariation: Variation = {\n\t\t\tid: args.dest.variationID,\n\t\t\tname: args.dest.variationName,\n\t\t\tdescription: args.dest.variationName,\n\t\t\timageUrl: \"\",\n\t\t\tdocURL: \"\",\n\t\t\tversion: \"initial\",\n\t\t\tprimary: {},\n\t\t\titems: {},\n\t\t};\n\n\t\tswitch (args.model.type) {\n\t\t\tcase \"Slice\":\n\t\t\t\tlegacySliceAsVariation.primary = args.model[\"non-repeat\"];\n\t\t\t\tlegacySliceAsVariation.items = args.model.repeat;\n\t\t\t\tbreak;\n\n\t\t\tcase \"Group\":\n\t\t\t\tlegacySliceAsVariation.items = args.model.config?.fields ?? {};\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tlegacySliceAsVariation.primary = { [args.src.sliceID]: args.model };\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// Convert as a slice variation, or merge against an existing slice variation\n\t\tif (maybeExistingSlice) {\n\t\t\tconst maybeVariation = maybeExistingSlice.variations.find(\n\t\t\t\t(variation) => variation.id === args.dest.variationID,\n\t\t\t);\n\n\t\t\t// If we're not merging against an existing slice variation, then we need to insert the new variation\n\t\t\tif (!maybeVariation) {\n\t\t\t\tmaybeExistingSlice.variations = [\n\t\t\t\t\t...maybeExistingSlice.variations,\n\t\t\t\t\tlegacySliceAsVariation,\n\t\t\t\t];\n\t\t\t}\n\n\t\t\tmaybeExistingSlice.legacyPaths ||= {};\n\t\t\tmaybeExistingSlice.legacyPaths[\n\t\t\t\t`${args.src.customTypeID}::${args.src.sliceZoneID}::${args.src.sliceID}`\n\t\t\t] = args.dest.variationID;\n\n\t\t\tawait this.updateSlice({\n\t\t\t\tlibraryID: args.dest.libraryID,\n\t\t\t\tmodel: maybeExistingSlice,\n\t\t\t});\n\t\t} else {\n\t\t\t// Convert to new shared slice\n\t\t\tawait this.createSlice({\n\t\t\t\tlibraryID: args.dest.libraryID,\n\t\t\t\tmodel: {\n\t\t\t\t\tid: args.dest.sliceID,\n\t\t\t\t\ttype: \"SharedSlice\",\n\t\t\t\t\tname: args.dest.sliceID,\n\t\t\t\t\tlegacyPaths: {\n\t\t\t\t\t\t[`${args.src.customTypeID}::${args.src.sliceZoneID}::${args.src.sliceID}`]:\n\t\t\t\t\t\t\targs.dest.variationID,\n\t\t\t\t\t},\n\t\t\t\t\tvariations: [legacySliceAsVariation],\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// Update source custom type\n\t\tconst { model: customType, errors: customTypeReadErrors } =\n\t\t\tawait this.customTypes.readCustomType({\n\t\t\t\tid: args.src.customTypeID,\n\t\t\t});\n\t\terrors.push(...customTypeReadErrors);\n\n\t\tif (customType) {\n\t\t\tconst field = customType.json[args.src.tabID][args.src.sliceZoneID];\n\n\t\t\t// Convert legacy slice definition in slice zone to shared slice reference\n\t\t\tif (field.type === \"Slices\" && field.config?.choices) {\n\t\t\t\tdelete field.config.choices[args.src.sliceID];\n\t\t\t\tfield.config.choices[args.dest.sliceID] = {\n\t\t\t\t\ttype: \"SharedSlice\",\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { errors: customTypeUpdateErrors } =\n\t\t\t\tawait this.customTypes.updateCustomType({ model: customType });\n\t\t\terrors.push(...customTypeUpdateErrors);\n\t\t}\n\n\t\treturn { errors };\n\t}\n\n\t/**\n\t * @returns Record of variation IDs mapped to uploaded screenshot URLs.\n\t */\n\tasync pushSlice(\n\t\targs: SliceMachineManagerPushSliceArgs,\n\t): Promise<SliceMachineManagerPushSliceReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tif (!(await this.user.checkIsLoggedIn())) {\n\t\t\tthrow new UnauthenticatedError();\n\t\t}\n\n\t\tconst { model, errors: readSliceErrors } = await this.readSlice({\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.sliceID,\n\t\t});\n\n\t\tif (model) {\n\t\t\tconst modelWithScreenshots =\n\t\t\t\tawait this.updateSliceModelScreenshotsInPlace({\n\t\t\t\t\tmodel,\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\t// We are pushing it for the first time here, no remote image URLs to\n\t\t\t\t\t// use during the update.\n\t\t\t\t\tvariationImageUrlMap: {},\n\t\t\t\t});\n\n\t\t\tconst authenticationToken = await this.user.getAuthenticationToken();\n\t\t\tconst repositoryName = await this.project.getResolvedRepositoryName();\n\n\t\t\t// TODO: Create a single shared client.\n\t\t\tconst client = prismicCustomTypesClient.createClient({\n\t\t\t\tendpoint: API_ENDPOINTS.PrismicModels,\n\t\t\t\trepositoryName,\n\t\t\t\ttoken: authenticationToken,\n\t\t\t\tfetch,\n\t\t\t\tfetchOptions: {\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t\"User-Agent\": args.userAgent || SLICE_MACHINE_USER_AGENT,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\n\t\t\ttry {\n\t\t\t\t// Check if Slice already exists on the repository.\n\t\t\t\tawait client.getSharedSliceByID(args.sliceID);\n\n\t\t\t\t// If it exists on the repository, update it.\n\t\t\t\tawait client.updateSharedSlice(modelWithScreenshots);\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof prismicCustomTypesClient.NotFoundError) {\n\t\t\t\t\t// If the Slice doesn't exist on the repository, insert it.\n\t\t\t\t\tawait client.insertSharedSlice(modelWithScreenshots);\n\t\t\t\t} else if (error instanceof prismicCustomTypesClient.ForbiddenError) {\n\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\"You do not have access to push Slices to this Prismic repository.\",\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\t// Pass the error through if it isn't the one we were expecting.\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst screenshotURLs: Record<string, string> = {};\n\t\t\tfor (const variation of modelWithScreenshots.variations) {\n\t\t\t\tscreenshotURLs[variation.id] = variation.imageUrl;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tscreenshotURLs,\n\t\t\t\terrors: readSliceErrors,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tscreenshotURLs: undefined,\n\t\t\t\terrors: readSliceErrors,\n\t\t\t};\n\t\t}\n\t}\n\n\tasync readSliceScreenshot(\n\t\targs: SliceMachineManagerReadSliceScreenshotArgs,\n\t): Promise<SliceMachineManagerReadSliceScreenshotReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:asset:read\",\n\t\t\t{\n\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\tsliceID: args.sliceID,\n\t\t\t\tassetID: `screenshot-${args.variationID}.png`,\n\t\t\t},\n\t\t);\n\t\tconst { data, errors } = decodeHookResult(\n\t\t\tt.type({\n\t\t\t\tdata: bufferCodec,\n\t\t\t}),\n\t\t\thookResult,\n\t\t);\n\n\t\treturn {\n\t\t\tdata: data[0]?.data,\n\t\t\terrors: errors,\n\t\t};\n\t}\n\n\tasync updateSliceScreenshot(\n\t\targs: SliceMachineManagerUpdateSliceScreenshotArgs,\n\t): Promise<OnlyHookErrors<CallHookReturnType<SliceAssetUpdateHook>>> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:asset:update\",\n\t\t\t{\n\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\tsliceID: args.sliceID,\n\t\t\t\tasset: {\n\t\t\t\t\tid: `screenshot-${args.variationID}.png`,\n\t\t\t\t\tdata: args.data,\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\treturn {\n\t\t\terrors: hookResult.errors,\n\t\t};\n\t}\n\n\tasync deleteSliceScreenshot(\n\t\targs: SliceMachineManagerDeleteSliceScreenshotArgs,\n\t): Promise<OnlyHookErrors<CallHookReturnType<SliceAssetUpdateHook>>> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:asset:delete\",\n\t\t\t{\n\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\tsliceID: args.sliceID,\n\t\t\t\tassetID: `screenshot-${args.variationID}.png`,\n\t\t\t},\n\t\t);\n\n\t\treturn {\n\t\t\terrors: hookResult.errors,\n\t\t};\n\t}\n\n\tasync readSliceMocks(\n\t\targs: SliceMachineManagerReadSliceMocksArgs,\n\t): Promise<SliceMachineManagerReadSliceMocksReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:asset:read\",\n\t\t\t{\n\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\tsliceID: args.sliceID,\n\t\t\t\tassetID: `mocks.json`,\n\t\t\t},\n\t\t);\n\t\tconst { data, errors } = decodeHookResult(\n\t\t\tt.type({\n\t\t\t\tdata: t.array(SharedSliceContent),\n\t\t\t}),\n\t\t\t{\n\t\t\t\t...hookResult,\n\t\t\t\t// Convert the asset data from a Buffer to JSON\n\t\t\t\t// to prepare it for validation.\n\t\t\t\tdata: hookResult.data.map((result) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...result,\n\t\t\t\t\t\t\tdata: JSON.parse(result.data.toString()),\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch {\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t},\n\t\t);\n\n\t\tif (data) {\n\t\t\treturn {\n\t\t\t\tmocks: data[0]?.data,\n\t\t\t\terrors,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tmocks: [],\n\t\t\t\terrors,\n\t\t\t};\n\t\t}\n\t}\n\n\tasync updateSliceMocks(\n\t\targs: SliceMachineManagerUpdateSliceMocksArgs,\n\t): Promise<SliceMachineManagerUpdateSliceMocksArgsReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:asset:update\",\n\t\t\t{\n\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\tsliceID: args.sliceID,\n\t\t\t\tasset: {\n\t\t\t\t\tid: \"mocks.json\",\n\t\t\t\t\tdata: Buffer.from(JSON.stringify(args.mocks, null, \"\\t\")),\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\treturn {\n\t\t\terrors: hookResult.errors,\n\t\t};\n\t}\n\n\t// TODO: Remove\n\tasync readSliceMocksConfig(\n\t\targs: SliceMachineManagerReadSliceMocksConfigArgs,\n\t): Promise<SliceMachineManagerReadSliceMocksConfigArgsReturnType> {\n\t\tassertPluginsInitialized(this.sliceMachinePluginRunner);\n\n\t\tconst hookResult = await this.sliceMachinePluginRunner.callHook(\n\t\t\t\"slice:asset:read\",\n\t\t\t{\n\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\tsliceID: args.sliceID,\n\t\t\t\tassetID: \"mocks.config.json\",\n\t\t\t},\n\t\t);\n\t\tconst data = hookResult.data[0]?.data;\n\n\t\t// TODO: Validate the returned data.\n\n\t\tif (data) {\n\t\t\treturn {\n\t\t\t\tmocksConfig: JSON.parse(data.toString()),\n\t\t\t\terrors: hookResult.errors,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tmocksConfig: undefined,\n\t\t\t\terrors: hookResult.errors,\n\t\t\t};\n\t\t}\n\t}\n\n\tasync fetchRemoteSlices(): Promise<SharedSlice[]> {\n\t\tconst authenticationToken = await this.user.getAuthenticationToken();\n\t\tconst repositoryName = await this.project.getResolvedRepositoryName();\n\n\t\tconst client = prismicCustomTypesClient.createClient({\n\t\t\tendpoint: API_ENDPOINTS.PrismicModels,\n\t\t\trepositoryName,\n\t\t\ttoken: authenticationToken,\n\t\t\tfetch,\n\t\t\tfetchOptions: {\n\t\t\t\theaders: {\n\t\t\t\t\t\"User-Agent\": SLICE_MACHINE_USER_AGENT,\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\treturn await client.getAllSharedSlices();\n\t}\n\n\tasync updateSliceModelScreenshotsInPlace(\n\t\targs: SlicesManagerUpsertHostedSliceScreenshotsArgs,\n\t): Promise<SharedSlice> {\n\t\tconst repositoryName = await this.project.getResolvedRepositoryName();\n\n\t\tconst variations = await Promise.all(\n\t\t\targs.model.variations.map(async (variation) => {\n\t\t\t\tconst screenshot = await this.readSliceScreenshot({\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\tsliceID: args.model.id,\n\t\t\t\t\tvariationID: variation.id,\n\t\t\t\t});\n\n\t\t\t\t// If there's no screenshot, delete it by replacing it with the default screenshot\n\t\t\t\tif (!screenshot.data) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...variation,\n\t\t\t\t\t\timageUrl: DEFAULT_SLICE_SCREENSHOT_URL,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst remoteImageUrl = args.variationImageUrlMap?.[variation.id];\n\t\t\t\tconst hasScreenshotChanged = !remoteImageUrl?.includes(\n\t\t\t\t\tcreateContentDigest(screenshot.data),\n\t\t\t\t);\n\n\t\t\t\t// If screenshot hasn't changed, no need to upload it again, just use\n\t\t\t\t// the existing variation with the remote image URL if it exists.\n\t\t\t\tif (!hasScreenshotChanged) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...variation,\n\t\t\t\t\t\t// Keep the existing remote screenshot URL if it exists.\n\t\t\t\t\t\timageUrl: remoteImageUrl ?? variation.imageUrl,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst keyPrefix = [\n\t\t\t\t\trepositoryName,\n\t\t\t\t\t\"shared-slices\",\n\t\t\t\t\targs.model.id,\n\t\t\t\t\tvariation.id,\n\t\t\t\t].join(\"/\");\n\n\t\t\t\tconst uploadedScreenshot = await this.screenshots.uploadScreenshot({\n\t\t\t\t\tdata: screenshot.data,\n\t\t\t\t\tkeyPrefix,\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\t...variation,\n\t\t\t\t\timageUrl: uploadedScreenshot.url,\n\t\t\t\t};\n\t\t\t}),\n\t\t);\n\n\t\treturn {\n\t\t\t...args.model,\n\t\t\tvariations,\n\t\t};\n\t}\n\n\tprivate async _removeSliceFromCustomTypes(sliceID: string) {\n\t\tconst { models, errors: customTypeReadErrors } =\n\t\t\tawait this.customTypes.readAllCustomTypes();\n\n\t\t// Successfully update all custom types or throw\n\t\tawait Promise.all(\n\t\t\tmodels.map(async (customType) => {\n\t\t\t\tconst updatedJsonModel = Object.entries(customType.model.json).reduce(\n\t\t\t\t\t(tabAccumulator, [tabKey, tab]) => {\n\t\t\t\t\t\tconst updatedTabFields = Object.entries(tab).reduce(\n\t\t\t\t\t\t\t(fieldAccumulator, [fieldKey, field]) => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tfield.config === undefined ||\n\t\t\t\t\t\t\t\t\tfield.type !== \"Slices\" ||\n\t\t\t\t\t\t\t\t\tfield.config.choices === undefined\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn { ...fieldAccumulator, [fieldKey]: field };\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst filteredChoices = Object.entries(\n\t\t\t\t\t\t\t\t\tfield.config.choices,\n\t\t\t\t\t\t\t\t).reduce((choiceAccumulator, [choiceKey, choice]) => {\n\t\t\t\t\t\t\t\t\tif (choiceKey === sliceID) {\n\t\t\t\t\t\t\t\t\t\treturn choiceAccumulator;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\treturn { ...choiceAccumulator, [choiceKey]: choice };\n\t\t\t\t\t\t\t\t}, {});\n\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t...fieldAccumulator,\n\t\t\t\t\t\t\t\t\t[fieldKey]: {\n\t\t\t\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\t\t\t\tconfig: { ...field.config, choices: filteredChoices },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{},\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn { ...tabAccumulator, [tabKey]: updatedTabFields };\n\t\t\t\t\t},\n\t\t\t\t\t{},\n\t\t\t\t);\n\n\t\t\t\tawait this.customTypes.updateCustomType({\n\t\t\t\t\tmodel: { ...customType.model, json: updatedJsonModel },\n\t\t\t\t});\n\t\t\t}),\n\t\t);\n\n\t\treturn { errors: customTypeReadErrors };\n\t}\n}\n"],"names":["errors"],"mappings":";;;;;;;;;;;;;;;;AAwNM,MAAO,sBAAsB,YAAW;AAAA,EAC7C,MAAM,iBACL,MAA8B;;AAE9B,6BAAyB,KAAK,wBAAwB;AAKtD,UAAM,aAAa,MAAM,KAAK,yBAAyB,SACtD,sBACA,IAAI;AAEL,UAAM,EAAE,MAAM,OAAA,IAAW,iBACxB,EAAE,KAAK;AAAA,MACN,IAAI,EAAE;AAAA,MACN,UAAU,EAAE,MAAM,EAAE,MAAM;AAAA,IAAA,CAC1B,GACD,UAAU;AAGJ,WAAA;AAAA,MACN,YAAU,UAAK,CAAC,M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WAAW,MAAM,IAAI,EAAE,OAC9D,CAAC,gBAAgB,CAAC,QAAQ,GAAG,MAAK;AAC3B,cAAA,mBAAmB,OAAO,QAAQ,GAAG,EAAE,OAC5C,CAAC,kBAAkB,CAAC,UAAU,KAAK,MAAK;AAEtC,cAAA,MAAM,WAAW,UACjB,MAAM,SAAS,YACf,MAAM,OAAO,YAAY,QACxB;AACD,mBAAO,EAAE,GAAG,kBAAkB,CAAC,QAAQ,GAAG,MAAK;AAAA,UAChD;AAEA,gBAAM,kBAAkB,OAAO,QAC9B,MAAM,OAAO,OAAO,EACnB,OAAO,CAAC,mBAAmB,CAAC,WAAW,MAAM,MAAK;AACnD,gBAAI,cAAc,SAAS;AACnB,qBAAA;AAAA,YACR;AAEA,mBAAO,EAAE,GAAG,mBAAmB,CAAC,SAAS,GAAG,OAAM;AAAA,UACnD,GAAG,CAAE,CAAA;AAEE,iBAAA;AAAA,YACN,GAAG;AAAA,YACH,CAAC,QAAQ,GAAG;AAAA,cACX,GAAG;AAAA,cACH,QAAQ,EAAE,GAAG,MAAM,QAAQ,SAAS,gBAAiB;AAAA,YACrD;AAAA,UAAA;AAAA,QAEH,GACA,CAAE,CAAA;AAGH,eAAO,EAAE,GAAG,gBAAgB,CAAC,MAAM,GAAG,iBAAgB;AAAA,MACvD,GACA,CAAE,CAAA;AAGG,YAAA,KAAK,YAAY,iBAAiB;AAAA,QACvC,OAAO,EAAE,GAAG,WAAW,OAAO,MAAM,iBAAkB;AAAA,MAAA,CACtD;AAAA,IACD,CAAA,CAAC;AAGI,WAAA,EAAE,QAAQ;EAClB;AACA;"}
|
|
@@ -37,7 +37,9 @@ const SegmentEventType = {
|
|
|
37
37
|
sharedOnboarding_completed: "shared-onboarding:completed",
|
|
38
38
|
sharedOnboarding_tutorial: "shared-onboarding:follow-tutorial",
|
|
39
39
|
sliceGenerationFeedback: "slice-generation-feedback",
|
|
40
|
-
navigation_documentationLinkClicked: "navigation:documentation-link-clicked"
|
|
40
|
+
navigation_documentationLinkClicked: "navigation:documentation-link-clicked",
|
|
41
|
+
sidebar_link_clicked: "sidebar:link-clicked",
|
|
42
|
+
mcp_promo_link_clicked: "mcp:promo-link-clicked"
|
|
41
43
|
};
|
|
42
44
|
const HumanSegmentEventType = {
|
|
43
45
|
[SegmentEventType.command_init_start]: "SliceMachine Init Start",
|
|
@@ -76,7 +78,9 @@ const HumanSegmentEventType = {
|
|
|
76
78
|
[SegmentEventType.sharedOnboarding_completed]: "Prismic Onboarding Guide Completed",
|
|
77
79
|
[SegmentEventType.sharedOnboarding_tutorial]: "Prismic Onboarding Guide Follow Tutorial",
|
|
78
80
|
[SegmentEventType.sliceGenerationFeedback]: "Slice Generation Feedback",
|
|
79
|
-
[SegmentEventType.navigation_documentationLinkClicked]: "SliceMachine Documentation Link Clicked"
|
|
81
|
+
[SegmentEventType.navigation_documentationLinkClicked]: "SliceMachine Documentation Link Clicked",
|
|
82
|
+
[SegmentEventType.sidebar_link_clicked]: "Sidebar Link Clicked",
|
|
83
|
+
[SegmentEventType.mcp_promo_link_clicked]: "MCP Promo Link Clicked"
|
|
80
84
|
};
|
|
81
85
|
exports.HumanSegmentEventType = HumanSegmentEventType;
|
|
82
86
|
exports.SegmentEventType = SegmentEventType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sources":["../../../../src/managers/telemetry/types.ts"],"sourcesContent":["import {\n\tFieldType,\n\tLinkConfig,\n} 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\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_updated: \"field:updated\",\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_groupPushed: \"changes:group-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\tpostPush_emptyStateCtaClicked: \"post-push:empty-state-cta-clicked\",\n\tpostPush_toastCtaClicked: \"post-push:toast-cta-clicked\",\n\texperiment_exposure: \"experiment:exposure\",\n\tsharedOnboarding_step_opened: \"shared-onboarding:step-opened\",\n\tsharedOnboarding_step_completed: \"shared-onboarding:step-completed\",\n\tsharedOnboarding_completed: \"shared-onboarding:completed\",\n\tsharedOnboarding_tutorial: \"shared-onboarding:follow-tutorial\",\n\tsliceGenerationFeedback: \"slice-generation-feedback\",\n\tnavigation_documentationLinkClicked: \"navigation:documentation-link-clicked\",\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.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_updated]: \"SliceMachine Field Updated\",\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_groupPushed]: \"SliceMachine Group Field 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.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.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\t[SegmentEventType.sharedOnboarding_tutorial]:\n\t\t\"Prismic Onboarding Guide Follow Tutorial\",\n\t[SegmentEventType.sliceGenerationFeedback]: \"Slice Generation Feedback\",\n\t[SegmentEventType.navigation_documentationLinkClicked]:\n\t\t\"SliceMachine Documentation Link Clicked\",\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 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\trepeat?: boolean;\n\t\tvariants?: string[];\n\t\tlinkSelect?: LinkConfig[\"select\"];\n\t\tlinkPickedFields?: number;\n\t\tlinkNestedPickedFields?: number;\n\t}\n>;\n\ntype FieldUpdatedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.field_updated,\n\t{\n\t\tpreviousId: string;\n\t\tid: string;\n\t\tidUpdated: boolean;\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\trepeat?: boolean;\n\t\tvariants?: string[];\n\t\tlinkSelect?: LinkConfig[\"select\"];\n\t\tlinkPickedFields?: number;\n\t\tlinkNestedPickedFields?: number;\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{\n\t\tid: string;\n\t\tname: string;\n\t\tlibrary: string;\n\t\tlocation: \"custom_type\" | \"page_type\" | \"slices\";\n\t} & (\n\t\t| { mode: \"ai\"; langSmithUrl?: string }\n\t\t| { mode: \"manual\" }\n\t\t| { mode: \"template\"; sliceTemplate: string }\n\t)\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 ChangesGroupPushedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.changes_groupPushed,\n\t{\n\t\tisInStaticZone: boolean;\n\t\tisInSlice: boolean;\n\t} & {\n\t\t[key in FieldType]?: number;\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\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 OnboardingCommonPayload = { stepId: string; stepTitle: string };\ntype SharedOnboardingProperties<T = Record<string, string>> = T & {\n\tsource: \"SliceMachine\";\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>;\ntype SliceMachineSharedOnboardingTutorial = SegmentEvent<\n\ttypeof SegmentEventType.sharedOnboarding_tutorial,\n\tSharedOnboardingProperties\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 SliceGenerationFeedback = SegmentEvent<\n\ttypeof SegmentEventType.sliceGenerationFeedback,\n\t{\n\t\ttype: \"model\";\n\t\tsliceId: string;\n\t\tvariationId: string;\n\t\tfeedback: \"up\" | \"down\";\n\t\tlangSmithUrl?: string;\n\t}\n>;\n\ntype NavigationDocumentationLinkClicked = SegmentEvent<\n\ttypeof SegmentEventType.navigation_documentationLinkClicked,\n\t{\n\t\tframework: string;\n\t}\n>;\n\nexport type SegmentEvents =\n\t| CommandInitStartSegmentEvent\n\t| CommandInitIdentifySegmentEvent\n\t| CommandInitEndSegmentEvent\n\t| SliceSimulatorOpenSegmentEvent\n\t| SliceSimulatorIsNotRunningSegmentEvent\n\t| PageViewSegmentEvent\n\t| OpenVideoTutorialsSegmentEvent\n\t| FieldAddedSegmentEvent\n\t| FieldUpdatedSegmentEvent\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| ChangesGroupPushedSegmentEvent\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| SliceMachineSharedOnboardingStepOpened\n\t| SliceMachineSharedOnboardingStepCompleted\n\t| SliceMachineSharedOnboardingCompleted\n\t| SliceMachineSharedOnboardingTutorial\n\t| SliceMachinePostPushEmptyStateCtaClicked\n\t| SliceMachinePostPushToastCtaClicked\n\t| SliceMachineExperimentExposure\n\t| SliceGenerationFeedback\n\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AAoB,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,mBAAmB,GAAG;AAAA,EACxC,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,wBAAwB,GACzC;AAAA,EACD,CAAC,iBAAiB,mBAAmB,GAAG;AAAA,EACxC,CAAC,iBAAiB,+BAA+B,GAChD;AAAA,EACD,CAAC,iBAAiB,4BAA4B,GAC7C;AAAA,EACD,CAAC,iBAAiB,0BAA0B,GAC3C;AAAA,EACD,CAAC,iBAAiB,yBAAyB,GAC1C;AAAA,EACD,CAAC,iBAAiB,uBAAuB,GAAG;AAAA,EAC5C,CAAC,iBAAiB,mCAAmC,GACpD;;;;"}
|
|
1
|
+
{"version":3,"file":"types.cjs","sources":["../../../../src/managers/telemetry/types.ts"],"sourcesContent":["import {\n\tFieldType,\n\tLinkConfig,\n} 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\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_updated: \"field:updated\",\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_groupPushed: \"changes:group-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\tpostPush_emptyStateCtaClicked: \"post-push:empty-state-cta-clicked\",\n\tpostPush_toastCtaClicked: \"post-push:toast-cta-clicked\",\n\texperiment_exposure: \"experiment:exposure\",\n\tsharedOnboarding_step_opened: \"shared-onboarding:step-opened\",\n\tsharedOnboarding_step_completed: \"shared-onboarding:step-completed\",\n\tsharedOnboarding_completed: \"shared-onboarding:completed\",\n\tsharedOnboarding_tutorial: \"shared-onboarding:follow-tutorial\",\n\tsliceGenerationFeedback: \"slice-generation-feedback\",\n\tnavigation_documentationLinkClicked: \"navigation:documentation-link-clicked\",\n\tsidebar_link_clicked: \"sidebar:link-clicked\",\n\tmcp_promo_link_clicked: \"mcp:promo-link-clicked\",\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.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_updated]: \"SliceMachine Field Updated\",\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_groupPushed]: \"SliceMachine Group Field 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.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.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\t[SegmentEventType.sharedOnboarding_tutorial]:\n\t\t\"Prismic Onboarding Guide Follow Tutorial\",\n\t[SegmentEventType.sliceGenerationFeedback]: \"Slice Generation Feedback\",\n\t[SegmentEventType.navigation_documentationLinkClicked]:\n\t\t\"SliceMachine Documentation Link Clicked\",\n\t[SegmentEventType.sidebar_link_clicked]: \"Sidebar Link Clicked\",\n\t[SegmentEventType.mcp_promo_link_clicked]: \"MCP Promo Link Clicked\",\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 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\trepeat?: boolean;\n\t\tvariants?: string[];\n\t\tlinkSelect?: LinkConfig[\"select\"];\n\t\tlinkPickedFields?: number;\n\t\tlinkNestedPickedFields?: number;\n\t}\n>;\n\ntype FieldUpdatedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.field_updated,\n\t{\n\t\tpreviousId: string;\n\t\tid: string;\n\t\tidUpdated: boolean;\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\trepeat?: boolean;\n\t\tvariants?: string[];\n\t\tlinkSelect?: LinkConfig[\"select\"];\n\t\tlinkPickedFields?: number;\n\t\tlinkNestedPickedFields?: number;\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{\n\t\tid: string;\n\t\tname: string;\n\t\tlibrary: string;\n\t\tlocation: \"custom_type\" | \"page_type\" | \"slices\";\n\t} & (\n\t\t| { mode: \"ai\"; langSmithUrl?: string }\n\t\t| { mode: \"manual\" }\n\t\t| { mode: \"template\"; sliceTemplate: string }\n\t)\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 ChangesGroupPushedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.changes_groupPushed,\n\t{\n\t\tisInStaticZone: boolean;\n\t\tisInSlice: boolean;\n\t} & {\n\t\t[key in FieldType]?: number;\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\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 OnboardingCommonPayload = { stepId: string; stepTitle: string };\ntype SharedOnboardingProperties<T = Record<string, string>> = T & {\n\tsource: \"SliceMachine\";\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>;\ntype SliceMachineSharedOnboardingTutorial = SegmentEvent<\n\ttypeof SegmentEventType.sharedOnboarding_tutorial,\n\tSharedOnboardingProperties\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 SliceGenerationFeedback = SegmentEvent<\n\ttypeof SegmentEventType.sliceGenerationFeedback,\n\t{\n\t\ttype: \"model\";\n\t\tsliceId: string;\n\t\tvariationId: string;\n\t\tfeedback: \"up\" | \"down\";\n\t\tlangSmithUrl?: string;\n\t}\n>;\n\ntype NavigationDocumentationLinkClicked = SegmentEvent<\n\ttypeof SegmentEventType.navigation_documentationLinkClicked,\n\t{\n\t\tframework: string;\n\t}\n>;\n\ntype SidebarLinkClicked = SegmentEvent<\n\ttypeof SegmentEventType.sidebar_link_clicked,\n\t{\n\t\tlink_name: string;\n\t\tsource: string;\n\t}\n>;\n\ntype McpPromoLinkClicked = SegmentEvent<\n\ttypeof SegmentEventType.mcp_promo_link_clicked,\n\t{\n\t\tsource: string;\n\t\ttarget: string;\n\t}\n>;\n\nexport type SegmentEvents =\n\t| CommandInitStartSegmentEvent\n\t| CommandInitIdentifySegmentEvent\n\t| CommandInitEndSegmentEvent\n\t| SliceSimulatorOpenSegmentEvent\n\t| SliceSimulatorIsNotRunningSegmentEvent\n\t| PageViewSegmentEvent\n\t| OpenVideoTutorialsSegmentEvent\n\t| FieldAddedSegmentEvent\n\t| FieldUpdatedSegmentEvent\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| ChangesGroupPushedSegmentEvent\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| SliceMachineSharedOnboardingStepOpened\n\t| SliceMachineSharedOnboardingStepCompleted\n\t| SliceMachineSharedOnboardingCompleted\n\t| SliceMachineSharedOnboardingTutorial\n\t| SliceMachinePostPushEmptyStateCtaClicked\n\t| SliceMachinePostPushToastCtaClicked\n\t| SliceMachineExperimentExposure\n\t| SliceGenerationFeedback\n\t| NavigationDocumentationLinkClicked\n\t| SidebarLinkClicked\n\t| McpPromoLinkClicked;\n"],"names":[],"mappings":";;AAUO,MAAM,mBAAmB;AAAA,EAC/B,oBAAoB;AAAA,EACpB,uBAAuB;AAAA,EACvB,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,UAAU;AAAA,EACV,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,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,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,mBAAmB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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,wBAAwB,GACzC;AAAA,EACD,CAAC,iBAAiB,mBAAmB,GAAG;AAAA,EACxC,CAAC,iBAAiB,+BAA+B,GAChD;AAAA,EACD,CAAC,iBAAiB,4BAA4B,GAC7C;AAAA,EACD,CAAC,iBAAiB,0BAA0B,GAC3C;AAAA,EACD,CAAC,iBAAiB,yBAAyB,GAC1C;AAAA,EACD,CAAC,iBAAiB,uBAAuB,GAAG;AAAA,EAC5C,CAAC,iBAAiB,mCAAmC,GACpD;AAAA,EACD,CAAC,iBAAiB,oBAAoB,GAAG;AAAA,EACzC,CAAC,iBAAiB,sBAAsB,GAAG;;;;"}
|
|
@@ -40,6 +40,8 @@ export declare const SegmentEventType: {
|
|
|
40
40
|
readonly sharedOnboarding_tutorial: "shared-onboarding:follow-tutorial";
|
|
41
41
|
readonly sliceGenerationFeedback: "slice-generation-feedback";
|
|
42
42
|
readonly navigation_documentationLinkClicked: "navigation:documentation-link-clicked";
|
|
43
|
+
readonly sidebar_link_clicked: "sidebar:link-clicked";
|
|
44
|
+
readonly mcp_promo_link_clicked: "mcp:promo-link-clicked";
|
|
43
45
|
};
|
|
44
46
|
type SegmentEventTypes = (typeof SegmentEventType)[keyof typeof SegmentEventType];
|
|
45
47
|
export declare const HumanSegmentEventType: {
|
|
@@ -80,6 +82,8 @@ export declare const HumanSegmentEventType: {
|
|
|
80
82
|
readonly "shared-onboarding:follow-tutorial": "Prismic Onboarding Guide Follow Tutorial";
|
|
81
83
|
readonly "slice-generation-feedback": "Slice Generation Feedback";
|
|
82
84
|
readonly "navigation:documentation-link-clicked": "SliceMachine Documentation Link Clicked";
|
|
85
|
+
readonly "sidebar:link-clicked": "Sidebar Link Clicked";
|
|
86
|
+
readonly "mcp:promo-link-clicked": "MCP Promo Link Clicked";
|
|
83
87
|
};
|
|
84
88
|
export type HumanSegmentEventTypes = (typeof HumanSegmentEventType)[keyof typeof HumanSegmentEventType];
|
|
85
89
|
type SegmentEvent<TType extends SegmentEventTypes, TProperties extends Record<string, unknown> | void = void> = TProperties extends void ? {
|
|
@@ -271,4 +275,12 @@ type SliceGenerationFeedback = SegmentEvent<typeof SegmentEventType.sliceGenerat
|
|
|
271
275
|
type NavigationDocumentationLinkClicked = SegmentEvent<typeof SegmentEventType.navigation_documentationLinkClicked, {
|
|
272
276
|
framework: string;
|
|
273
277
|
}>;
|
|
274
|
-
|
|
278
|
+
type SidebarLinkClicked = SegmentEvent<typeof SegmentEventType.sidebar_link_clicked, {
|
|
279
|
+
link_name: string;
|
|
280
|
+
source: string;
|
|
281
|
+
}>;
|
|
282
|
+
type McpPromoLinkClicked = SegmentEvent<typeof SegmentEventType.mcp_promo_link_clicked, {
|
|
283
|
+
source: string;
|
|
284
|
+
target: string;
|
|
285
|
+
}>;
|
|
286
|
+
export type SegmentEvents = CommandInitStartSegmentEvent | CommandInitIdentifySegmentEvent | CommandInitEndSegmentEvent | SliceSimulatorOpenSegmentEvent | SliceSimulatorIsNotRunningSegmentEvent | PageViewSegmentEvent | OpenVideoTutorialsSegmentEvent | FieldAddedSegmentEvent | FieldUpdatedSegmentEvent | FieldSettingsOpenedSegmentEvent | CustomTypeCreatedSegmentEvent | CustomTypeSliceZoneUpdatedSegmentEvent | CustomTypeOpenAddFromTemplatesEvent | CustomTypeSavedSegmentEvent | SliceCreatedSegmentEvent | LegacySliceConvertedSegmentEvent | ScreenshotTakenSegmentEvent | ChangesPushedSegmentEvent | ChangesGroupPushedSegmentEvent | ChangesLimitReachSegmentEvent | EditorWidgetUsedSegmentEvent | OpenPageSnippetSegmentEvent | CopyPageSnippetSegmentEvent | SwitchEnvironmentSegmentEvent | DevCollabJoinBetaClicked | DevCollabSetUpWorkflowOpened | DevCollabWorkflowStubDisplayed | SliceMachineStart | SliceMachineSharedOnboardingStepOpened | SliceMachineSharedOnboardingStepCompleted | SliceMachineSharedOnboardingCompleted | SliceMachineSharedOnboardingTutorial | SliceMachinePostPushEmptyStateCtaClicked | SliceMachinePostPushToastCtaClicked | SliceMachineExperimentExposure | SliceGenerationFeedback | NavigationDocumentationLinkClicked | SidebarLinkClicked | McpPromoLinkClicked;
|
|
@@ -35,7 +35,9 @@ const SegmentEventType = {
|
|
|
35
35
|
sharedOnboarding_completed: "shared-onboarding:completed",
|
|
36
36
|
sharedOnboarding_tutorial: "shared-onboarding:follow-tutorial",
|
|
37
37
|
sliceGenerationFeedback: "slice-generation-feedback",
|
|
38
|
-
navigation_documentationLinkClicked: "navigation:documentation-link-clicked"
|
|
38
|
+
navigation_documentationLinkClicked: "navigation:documentation-link-clicked",
|
|
39
|
+
sidebar_link_clicked: "sidebar:link-clicked",
|
|
40
|
+
mcp_promo_link_clicked: "mcp:promo-link-clicked"
|
|
39
41
|
};
|
|
40
42
|
const HumanSegmentEventType = {
|
|
41
43
|
[SegmentEventType.command_init_start]: "SliceMachine Init Start",
|
|
@@ -74,7 +76,9 @@ const HumanSegmentEventType = {
|
|
|
74
76
|
[SegmentEventType.sharedOnboarding_completed]: "Prismic Onboarding Guide Completed",
|
|
75
77
|
[SegmentEventType.sharedOnboarding_tutorial]: "Prismic Onboarding Guide Follow Tutorial",
|
|
76
78
|
[SegmentEventType.sliceGenerationFeedback]: "Slice Generation Feedback",
|
|
77
|
-
[SegmentEventType.navigation_documentationLinkClicked]: "SliceMachine Documentation Link Clicked"
|
|
79
|
+
[SegmentEventType.navigation_documentationLinkClicked]: "SliceMachine Documentation Link Clicked",
|
|
80
|
+
[SegmentEventType.sidebar_link_clicked]: "Sidebar Link Clicked",
|
|
81
|
+
[SegmentEventType.mcp_promo_link_clicked]: "MCP Promo Link Clicked"
|
|
78
82
|
};
|
|
79
83
|
export {
|
|
80
84
|
HumanSegmentEventType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../../src/managers/telemetry/types.ts"],"sourcesContent":["import {\n\tFieldType,\n\tLinkConfig,\n} 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\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_updated: \"field:updated\",\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_groupPushed: \"changes:group-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\tpostPush_emptyStateCtaClicked: \"post-push:empty-state-cta-clicked\",\n\tpostPush_toastCtaClicked: \"post-push:toast-cta-clicked\",\n\texperiment_exposure: \"experiment:exposure\",\n\tsharedOnboarding_step_opened: \"shared-onboarding:step-opened\",\n\tsharedOnboarding_step_completed: \"shared-onboarding:step-completed\",\n\tsharedOnboarding_completed: \"shared-onboarding:completed\",\n\tsharedOnboarding_tutorial: \"shared-onboarding:follow-tutorial\",\n\tsliceGenerationFeedback: \"slice-generation-feedback\",\n\tnavigation_documentationLinkClicked: \"navigation:documentation-link-clicked\",\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.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_updated]: \"SliceMachine Field Updated\",\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_groupPushed]: \"SliceMachine Group Field 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.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.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\t[SegmentEventType.sharedOnboarding_tutorial]:\n\t\t\"Prismic Onboarding Guide Follow Tutorial\",\n\t[SegmentEventType.sliceGenerationFeedback]: \"Slice Generation Feedback\",\n\t[SegmentEventType.navigation_documentationLinkClicked]:\n\t\t\"SliceMachine Documentation Link Clicked\",\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 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\trepeat?: boolean;\n\t\tvariants?: string[];\n\t\tlinkSelect?: LinkConfig[\"select\"];\n\t\tlinkPickedFields?: number;\n\t\tlinkNestedPickedFields?: number;\n\t}\n>;\n\ntype FieldUpdatedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.field_updated,\n\t{\n\t\tpreviousId: string;\n\t\tid: string;\n\t\tidUpdated: boolean;\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\trepeat?: boolean;\n\t\tvariants?: string[];\n\t\tlinkSelect?: LinkConfig[\"select\"];\n\t\tlinkPickedFields?: number;\n\t\tlinkNestedPickedFields?: number;\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{\n\t\tid: string;\n\t\tname: string;\n\t\tlibrary: string;\n\t\tlocation: \"custom_type\" | \"page_type\" | \"slices\";\n\t} & (\n\t\t| { mode: \"ai\"; langSmithUrl?: string }\n\t\t| { mode: \"manual\" }\n\t\t| { mode: \"template\"; sliceTemplate: string }\n\t)\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 ChangesGroupPushedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.changes_groupPushed,\n\t{\n\t\tisInStaticZone: boolean;\n\t\tisInSlice: boolean;\n\t} & {\n\t\t[key in FieldType]?: number;\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\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 OnboardingCommonPayload = { stepId: string; stepTitle: string };\ntype SharedOnboardingProperties<T = Record<string, string>> = T & {\n\tsource: \"SliceMachine\";\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>;\ntype SliceMachineSharedOnboardingTutorial = SegmentEvent<\n\ttypeof SegmentEventType.sharedOnboarding_tutorial,\n\tSharedOnboardingProperties\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 SliceGenerationFeedback = SegmentEvent<\n\ttypeof SegmentEventType.sliceGenerationFeedback,\n\t{\n\t\ttype: \"model\";\n\t\tsliceId: string;\n\t\tvariationId: string;\n\t\tfeedback: \"up\" | \"down\";\n\t\tlangSmithUrl?: string;\n\t}\n>;\n\ntype NavigationDocumentationLinkClicked = SegmentEvent<\n\ttypeof SegmentEventType.navigation_documentationLinkClicked,\n\t{\n\t\tframework: string;\n\t}\n>;\n\nexport type SegmentEvents =\n\t| CommandInitStartSegmentEvent\n\t| CommandInitIdentifySegmentEvent\n\t| CommandInitEndSegmentEvent\n\t| SliceSimulatorOpenSegmentEvent\n\t| SliceSimulatorIsNotRunningSegmentEvent\n\t| PageViewSegmentEvent\n\t| OpenVideoTutorialsSegmentEvent\n\t| FieldAddedSegmentEvent\n\t| FieldUpdatedSegmentEvent\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| ChangesGroupPushedSegmentEvent\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| SliceMachineSharedOnboardingStepOpened\n\t| SliceMachineSharedOnboardingStepCompleted\n\t| SliceMachineSharedOnboardingCompleted\n\t| SliceMachineSharedOnboardingTutorial\n\t| SliceMachinePostPushEmptyStateCtaClicked\n\t| SliceMachinePostPushToastCtaClicked\n\t| SliceMachineExperimentExposure\n\t| SliceGenerationFeedback\n\t| NavigationDocumentationLinkClicked;\n"],"names":[],"mappings":"AAUO,MAAM,mBAAmB;AAAA,EAC/B,oBAAoB;AAAA,EACpB,uBAAuB;AAAA,EACvB,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,UAAU;AAAA,EACV,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,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,qBAAqB;AAAA,EACrB,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,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1C;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,wBAAwB,GACzC;AAAA,EACD,CAAC,iBAAiB,mBAAmB,GAAG;AAAA,EACxC,CAAC,iBAAiB,+BAA+B,GAChD;AAAA,EACD,CAAC,iBAAiB,4BAA4B,GAC7C;AAAA,EACD,CAAC,iBAAiB,0BAA0B,GAC3C;AAAA,EACD,CAAC,iBAAiB,yBAAyB,GAC1C;AAAA,EACD,CAAC,iBAAiB,uBAAuB,GAAG;AAAA,EAC5C,CAAC,iBAAiB,mCAAmC,GACpD;;"}
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/managers/telemetry/types.ts"],"sourcesContent":["import {\n\tFieldType,\n\tLinkConfig,\n} 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\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_updated: \"field:updated\",\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_groupPushed: \"changes:group-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\tpostPush_emptyStateCtaClicked: \"post-push:empty-state-cta-clicked\",\n\tpostPush_toastCtaClicked: \"post-push:toast-cta-clicked\",\n\texperiment_exposure: \"experiment:exposure\",\n\tsharedOnboarding_step_opened: \"shared-onboarding:step-opened\",\n\tsharedOnboarding_step_completed: \"shared-onboarding:step-completed\",\n\tsharedOnboarding_completed: \"shared-onboarding:completed\",\n\tsharedOnboarding_tutorial: \"shared-onboarding:follow-tutorial\",\n\tsliceGenerationFeedback: \"slice-generation-feedback\",\n\tnavigation_documentationLinkClicked: \"navigation:documentation-link-clicked\",\n\tsidebar_link_clicked: \"sidebar:link-clicked\",\n\tmcp_promo_link_clicked: \"mcp:promo-link-clicked\",\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.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_updated]: \"SliceMachine Field Updated\",\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_groupPushed]: \"SliceMachine Group Field 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.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.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\t[SegmentEventType.sharedOnboarding_tutorial]:\n\t\t\"Prismic Onboarding Guide Follow Tutorial\",\n\t[SegmentEventType.sliceGenerationFeedback]: \"Slice Generation Feedback\",\n\t[SegmentEventType.navigation_documentationLinkClicked]:\n\t\t\"SliceMachine Documentation Link Clicked\",\n\t[SegmentEventType.sidebar_link_clicked]: \"Sidebar Link Clicked\",\n\t[SegmentEventType.mcp_promo_link_clicked]: \"MCP Promo Link Clicked\",\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 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\trepeat?: boolean;\n\t\tvariants?: string[];\n\t\tlinkSelect?: LinkConfig[\"select\"];\n\t\tlinkPickedFields?: number;\n\t\tlinkNestedPickedFields?: number;\n\t}\n>;\n\ntype FieldUpdatedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.field_updated,\n\t{\n\t\tpreviousId: string;\n\t\tid: string;\n\t\tidUpdated: boolean;\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\trepeat?: boolean;\n\t\tvariants?: string[];\n\t\tlinkSelect?: LinkConfig[\"select\"];\n\t\tlinkPickedFields?: number;\n\t\tlinkNestedPickedFields?: number;\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{\n\t\tid: string;\n\t\tname: string;\n\t\tlibrary: string;\n\t\tlocation: \"custom_type\" | \"page_type\" | \"slices\";\n\t} & (\n\t\t| { mode: \"ai\"; langSmithUrl?: string }\n\t\t| { mode: \"manual\" }\n\t\t| { mode: \"template\"; sliceTemplate: string }\n\t)\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 ChangesGroupPushedSegmentEvent = SegmentEvent<\n\ttypeof SegmentEventType.changes_groupPushed,\n\t{\n\t\tisInStaticZone: boolean;\n\t\tisInSlice: boolean;\n\t} & {\n\t\t[key in FieldType]?: number;\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\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 OnboardingCommonPayload = { stepId: string; stepTitle: string };\ntype SharedOnboardingProperties<T = Record<string, string>> = T & {\n\tsource: \"SliceMachine\";\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>;\ntype SliceMachineSharedOnboardingTutorial = SegmentEvent<\n\ttypeof SegmentEventType.sharedOnboarding_tutorial,\n\tSharedOnboardingProperties\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 SliceGenerationFeedback = SegmentEvent<\n\ttypeof SegmentEventType.sliceGenerationFeedback,\n\t{\n\t\ttype: \"model\";\n\t\tsliceId: string;\n\t\tvariationId: string;\n\t\tfeedback: \"up\" | \"down\";\n\t\tlangSmithUrl?: string;\n\t}\n>;\n\ntype NavigationDocumentationLinkClicked = SegmentEvent<\n\ttypeof SegmentEventType.navigation_documentationLinkClicked,\n\t{\n\t\tframework: string;\n\t}\n>;\n\ntype SidebarLinkClicked = SegmentEvent<\n\ttypeof SegmentEventType.sidebar_link_clicked,\n\t{\n\t\tlink_name: string;\n\t\tsource: string;\n\t}\n>;\n\ntype McpPromoLinkClicked = SegmentEvent<\n\ttypeof SegmentEventType.mcp_promo_link_clicked,\n\t{\n\t\tsource: string;\n\t\ttarget: string;\n\t}\n>;\n\nexport type SegmentEvents =\n\t| CommandInitStartSegmentEvent\n\t| CommandInitIdentifySegmentEvent\n\t| CommandInitEndSegmentEvent\n\t| SliceSimulatorOpenSegmentEvent\n\t| SliceSimulatorIsNotRunningSegmentEvent\n\t| PageViewSegmentEvent\n\t| OpenVideoTutorialsSegmentEvent\n\t| FieldAddedSegmentEvent\n\t| FieldUpdatedSegmentEvent\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| ChangesGroupPushedSegmentEvent\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| SliceMachineSharedOnboardingStepOpened\n\t| SliceMachineSharedOnboardingStepCompleted\n\t| SliceMachineSharedOnboardingCompleted\n\t| SliceMachineSharedOnboardingTutorial\n\t| SliceMachinePostPushEmptyStateCtaClicked\n\t| SliceMachinePostPushToastCtaClicked\n\t| SliceMachineExperimentExposure\n\t| SliceGenerationFeedback\n\t| NavigationDocumentationLinkClicked\n\t| SidebarLinkClicked\n\t| McpPromoLinkClicked;\n"],"names":[],"mappings":"AAUO,MAAM,mBAAmB;AAAA,EAC/B,oBAAoB;AAAA,EACpB,uBAAuB;AAAA,EACvB,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,UAAU;AAAA,EACV,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,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,qBAAqB;AAAA,EACrB,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,0BAA0B;AAAA,EAC1B,qBAAqB;AAAA,EACrB,8BAA8B;AAAA,EAC9B,iCAAiC;AAAA,EACjC,4BAA4B;AAAA,EAC5B,2BAA2B;AAAA,EAC3B,yBAAyB;AAAA,EACzB,qCAAqC;AAAA,EACrC,sBAAsB;AAAA,EACtB,wBAAwB;;AAKlB,MAAM,wBAAwB;AAAA,EACpC,CAAC,iBAAiB,kBAAkB,GAAG;AAAA,EACvC,CAAC,iBAAiB,qBAAqB,GAAG;AAAA,EAC1C,CAAC,iBAAiB,gBAAgB,GAAG;AAAA,EACrC,CAAC,iBAAiB,mBAAmB,GAAG;AAAA,EACxC,CAAC,iBAAiB,2BAA2B,GAC5C;AAAA,EACD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AAG;AAAA,EAC5C,CAAC,iBAAiB,mCAAmC,GACpD;AAAA,EACD,CAAC,iBAAiB,oBAAoB,GAAG;AAAA,EACzC,CAAC,iBAAiB,sBAAsB,GAAG;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slicemachine/manager",
|
|
3
|
-
"version": "0.25.3-alpha.jp-unauthorized-error.
|
|
3
|
+
"version": "0.25.3-alpha.jp-unauthorized-error-improvement.2",
|
|
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.14.0",
|
|
71
71
|
"@prismicio/types-internal": "3.11.2",
|
|
72
72
|
"@segment/analytics-node": "^2.1.2",
|
|
73
|
-
"@slicemachine/plugin-kit": "0.4.81-alpha.jp-unauthorized-error.
|
|
73
|
+
"@slicemachine/plugin-kit": "0.4.81-alpha.jp-unauthorized-error-improvement.2",
|
|
74
74
|
"cookie": "^1.0.1",
|
|
75
75
|
"cors": "^2.8.5",
|
|
76
76
|
"execa": "^7.1.1",
|
|
@@ -201,17 +201,23 @@ export class SliceMachineManager {
|
|
|
201
201
|
} catch (error) {
|
|
202
202
|
if (error instanceof prismicCustomTypesClient.ForbiddenError) {
|
|
203
203
|
authError = {
|
|
204
|
-
name: "
|
|
204
|
+
name: "ForbiddenError",
|
|
205
205
|
message: "__stub__",
|
|
206
206
|
reason: "__stub__",
|
|
207
207
|
status: 403,
|
|
208
208
|
};
|
|
209
209
|
} else if (
|
|
210
|
-
error instanceof UnauthenticatedError ||
|
|
211
210
|
error instanceof prismicCustomTypesClient.UnauthorizedError
|
|
212
211
|
) {
|
|
213
212
|
authError = {
|
|
214
|
-
name: "
|
|
213
|
+
name: "UnauthorizedError",
|
|
214
|
+
message: "__stub__",
|
|
215
|
+
reason: "__stub__",
|
|
216
|
+
status: 401,
|
|
217
|
+
};
|
|
218
|
+
} else if (error instanceof UnauthenticatedError) {
|
|
219
|
+
authError = {
|
|
220
|
+
name: new UnauthenticatedError().name,
|
|
215
221
|
message: "__stub__",
|
|
216
222
|
reason: "__stub__",
|
|
217
223
|
status: 401,
|
|
@@ -242,7 +248,7 @@ export class SliceMachineManager {
|
|
|
242
248
|
(profile
|
|
243
249
|
? undefined
|
|
244
250
|
: {
|
|
245
|
-
name:
|
|
251
|
+
name: new UnauthenticatedError().name,
|
|
246
252
|
message: "__stub__",
|
|
247
253
|
reason: "__stub__",
|
|
248
254
|
status: 401, // Needed to trigger the unauthorized flow.
|
|
@@ -319,6 +319,7 @@ export class PrismicRepositoryManager extends BaseManager {
|
|
|
319
319
|
const modelWithScreenshots =
|
|
320
320
|
await this.slices.updateSliceModelScreenshotsInPlace({
|
|
321
321
|
libraryID: change.libraryID,
|
|
322
|
+
variationImageUrlMap: change.variationImageUrlMap,
|
|
322
323
|
model,
|
|
323
324
|
});
|
|
324
325
|
|
|
@@ -341,6 +342,7 @@ export class PrismicRepositoryManager extends BaseManager {
|
|
|
341
342
|
const modelWithScreenshots =
|
|
342
343
|
await this.slices.updateSliceModelScreenshotsInPlace({
|
|
343
344
|
libraryID: change.libraryID,
|
|
345
|
+
variationImageUrlMap: change.variationImageUrlMap,
|
|
344
346
|
model,
|
|
345
347
|
});
|
|
346
348
|
|
|
@@ -124,6 +124,13 @@ type SliceChange = {
|
|
|
124
124
|
type: "Slice";
|
|
125
125
|
status: ChangeStatus;
|
|
126
126
|
libraryID: string;
|
|
127
|
+
/**
|
|
128
|
+
* A map of variation IDs to remote screenshot URLs. These URLs are used to
|
|
129
|
+
* detect if a screenshot has changed when comparing with local ones and to
|
|
130
|
+
* push slices with the current screenshot. If a matching screenshot is not
|
|
131
|
+
* found in this map, the current local screenshot is uploaded again.
|
|
132
|
+
*/
|
|
133
|
+
variationImageUrlMap: Record<string, string>;
|
|
127
134
|
};
|
|
128
135
|
|
|
129
136
|
export type TransactionalMergeArgs = {
|