Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions packages/app/src/cli/api/graphql/development_preview.ts

This file was deleted.

19 changes: 0 additions & 19 deletions packages/app/src/cli/api/graphql/find_app_preview_mode.ts

This file was deleted.

24 changes: 0 additions & 24 deletions packages/app/src/cli/models/app/app.test-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ import {AllAppExtensionRegistrationsQuerySchema} from '../../api/graphql/all_app
import {AppDeploySchema, AppDeployVariables} from '../../api/graphql/app_deploy.js'
import {ExtensionCreateSchema, ExtensionCreateVariables} from '../../api/graphql/extension_create.js'
import {ConvertDevToTransferDisabledStoreVariables} from '../../api/graphql/convert_dev_to_transfer_disabled_store.js'
import {
DevelopmentStorePreviewUpdateInput,
DevelopmentStorePreviewUpdateSchema,
} from '../../api/graphql/development_preview.js'
import {FindAppPreviewModeSchema, FindAppPreviewModeVariables} from '../../api/graphql/find_app_preview_mode.js'
import {SendSampleWebhookSchema, SendSampleWebhookVariables} from '../../services/webhook/request-sample.js'
import {PublicApiVersionsSchema} from '../../services/webhook/request-api-versions.js'
import {WebhookTopicsSchema, WebhookTopicsVariables} from '../../services/webhook/request-topics.js'
Expand Down Expand Up @@ -1272,22 +1267,6 @@ const convertedToTransferDisabledStoreResponse = {
},
}

const updateDeveloperPreviewResponse: DevelopmentStorePreviewUpdateSchema = {
developmentStorePreviewUpdate: {
app: {
id: 'app-id',
developmentStorePreviewEnabled: true,
},
userErrors: [],
},
}

const appPreviewModeResponse: FindAppPreviewModeSchema = {
app: {
developmentStorePreviewEnabled: true,
},
}

const organizationsResponse: Organization[] = [testOrganization()]

const sendSampleWebhookResponse: SendSampleWebhookSchema = {
Expand Down Expand Up @@ -1385,9 +1364,6 @@ export function testDeveloperPlatformClient(stubs: Partial<DeveloperPlatformClie
generateSignedUploadUrl: (_app: MinimalAppIdentifiers) => Promise.resolve(generateSignedUploadUrlResponse),
convertToTransferDisabledStore: (_input: ConvertDevToTransferDisabledStoreVariables) =>
Promise.resolve(convertedToTransferDisabledStoreResponse),
updateDeveloperPreview: (_input: DevelopmentStorePreviewUpdateInput) =>
Promise.resolve(updateDeveloperPreviewResponse),
appPreviewMode: (_input: FindAppPreviewModeVariables) => Promise.resolve(appPreviewModeResponse),
sendSampleWebhook: (_input: SendSampleWebhookVariables) => Promise.resolve(sendSampleWebhookResponse),
apiVersions: () => Promise.resolve(apiVersionsResponse),
topics: (_input: WebhookTopicsVariables) => Promise.resolve(topicsResponse),
Expand Down
36 changes: 4 additions & 32 deletions packages/app/src/cli/prompts/dev.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,44 +273,17 @@ describe('createAsNewAppPrompt', () => {
})

describe('updateURLsPrompt', () => {
test('shows legacy prompt when dev sessions is disabled', async () => {
test('shows prompt without app proxy', async () => {
// Given
vi.mocked(renderConfirmationPrompt).mockResolvedValue(true)
const currentAppUrl = 'http://current-url'
const currentRedirectUrls = ['http://current-redirect-url1', 'http://current-redirect-url2']
const newUrls = {
applicationUrl: 'http://new-url',
redirectUrlWhitelist: ['http://new-redirect-url'],
}

// When
const got = await updateURLsPrompt(false, currentAppUrl, currentRedirectUrls, newUrls)

// Then
expect(got).toEqual(true)
expect(renderConfirmationPrompt).toHaveBeenCalledWith({
message: "Have Shopify automatically update your app's URL in order to create a preview experience?",
infoTable: {
'Current app URL': ['http://current-url'],
'Current redirect URLs': ['http://current-redirect-url1', 'http://current-redirect-url2'],
},
confirmationMessage: 'Yes, automatically update',
cancellationMessage: 'No, never',
})
})

test('shows dev sessions prompt when enabled without app proxy', async () => {
// Given
vi.mocked(renderConfirmationPrompt).mockResolvedValue(true)
const currentAppUrl = 'http://current-url'
const currentRedirectUrls: string[] = []
const newUrls = {
applicationUrl: 'http://new-url',
redirectUrlWhitelist: ['http://new-redirect-url'],
}

// When
const got = await updateURLsPrompt(true, currentAppUrl, currentRedirectUrls, newUrls)
const got = await updateURLsPrompt(currentAppUrl, newUrls)

// Then
expect(got).toEqual(true)
Expand All @@ -327,11 +300,10 @@ describe('updateURLsPrompt', () => {
})
})

test('shows dev sessions prompt when enabled with app proxy', async () => {
test('shows prompt with app proxy', async () => {
// Given
vi.mocked(renderConfirmationPrompt).mockResolvedValue(true)
const currentAppUrl = 'http://current-url'
const currentRedirectUrls: string[] = []
const newUrls: ApplicationURLs = {
applicationUrl: 'http://new-url',
redirectUrlWhitelist: ['http://new-redirect-url'],
Expand All @@ -343,7 +315,7 @@ describe('updateURLsPrompt', () => {
}

// When
const got = await updateURLsPrompt(true, currentAppUrl, currentRedirectUrls, newUrls)
const got = await updateURLsPrompt(currentAppUrl, newUrls)

// Then
expect(got).toEqual(true)
Expand Down
30 changes: 3 additions & 27 deletions packages/app/src/cli/prompts/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,39 +154,15 @@ export async function createAsNewAppPrompt(): Promise<boolean> {
})
}

export function updateURLsPrompt(
usingDevSessions: boolean,
currentAppUrl: string,
currentRedirectUrls: string[],
newURLs: ApplicationURLs,
): Promise<boolean> {
if (usingDevSessions) {
return updateURLsPromptWithDevSessions(currentAppUrl, newURLs)
}
return legacyUpdateURLsPrompt(currentAppUrl, currentRedirectUrls)
}

function legacyUpdateURLsPrompt(currentAppUrl: string, currentRedirectUrls: string[]): Promise<boolean> {
return renderConfirmationPrompt({
message: "Have Shopify automatically update your app's URL in order to create a preview experience?",
confirmationMessage: 'Yes, automatically update',
cancellationMessage: 'No, never',
infoTable: {
'Current app URL': [currentAppUrl],
'Current redirect URLs': currentRedirectUrls,
},
})
}

function updateURLsPromptWithDevSessions(currentAppUrl: string, urls: ApplicationURLs): Promise<boolean> {
export function updateURLsPrompt(currentAppUrl: string, newURLs: ApplicationURLs): Promise<boolean> {
const affectedConfigs = ['application_url', 'redirect_urls']
if (urls.appProxy?.proxyUrl) {
if (newURLs.appProxy?.proxyUrl) {
affectedConfigs.push('app_proxy')
}

const infoTable: {[key: string]: string[]} = {
'Currently released app URL': [currentAppUrl],
'=> Dev URL': [urls.applicationUrl],
'=> Dev URL': [newURLs.applicationUrl],
'Affected configurations': affectedConfigs,
}

Expand Down
17 changes: 0 additions & 17 deletions packages/app/src/cli/services/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {installAppDependencies} from './dependencies.js'
import {DevConfig, DevProcesses, setupDevProcesses} from './dev/processes/setup-dev-processes.js'
import {frontAndBackendConfig} from './dev/processes/utils.js'
import {renderDev} from './dev/ui.js'
import {DeveloperPreviewController} from './dev/ui/components/Dev.js'
import {DevProcessFunction} from './dev/processes/types.js'
import {getCachedAppInfo, setCachedAppInfo} from './local-storage.js'
import {fetchAppRemoteConfiguration} from './app/select-app.js'
Expand Down Expand Up @@ -334,25 +333,18 @@ async function launchDevProcesses({
return outputProcess
})

const apiKey = config.remoteApp.apiKey
const developerPlatformClient = config.developerPlatformClient
const app = {
canEnablePreviewMode: false,
developmentStorePreviewEnabled: config.remoteApp.developmentStorePreviewEnabled,
apiKey,
id: config.remoteApp.id,
developerPlatformClient,
extensions: config.localApp.allExtensions,
}

return renderDev({
processes: processesForTaskRunner,
previewUrl,
graphiqlUrl,
graphiqlPort: config.graphiqlPort,
app,
abortController,
developerPreview: developerPreviewController(),
shopFqdn: config.storeFqdn,
devSessionStatusManager,
appURL: config.localApp.devApplicationURLs?.applicationUrl,
Expand All @@ -363,15 +355,6 @@ async function launchDevProcesses({
})
}

function developerPreviewController(): DeveloperPreviewController {
return {
fetchMode: () => Promise.resolve(false),
enable: () => Promise.resolve(false),
disable: () => Promise.resolve(),
update: () => Promise.resolve(false),
}
}

async function logMetadataForDev(options: {
devOptions: DevOptions
tunnelUrl: string
Expand Down
Loading
Loading