From 3ed3400aa95fe89e07597952302fa1d510d5deb9 Mon Sep 17 00:00:00 2001 From: Jean-Sebastien Goupil Date: Thu, 4 Jul 2024 16:12:58 +0000 Subject: [PATCH 1/4] Added pos_ui_extension to migration for ui_extension --- packages/app/src/cli/services/dev/migrate-to-ui-extension.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/app/src/cli/services/dev/migrate-to-ui-extension.ts b/packages/app/src/cli/services/dev/migrate-to-ui-extension.ts index 24988fabe7..7f33a41ab4 100644 --- a/packages/app/src/cli/services/dev/migrate-to-ui-extension.ts +++ b/packages/app/src/cli/services/dev/migrate-to-ui-extension.ts @@ -15,7 +15,7 @@ export function getUIExtensionsToMigrate( identifiers: IdentifiersExtensions, ) { const ids = getExtensionIds(localSources, identifiers) - const remoteExtensionTypesToMigrate = ['CHECKOUT_UI_EXTENSION'] + const remoteExtensionTypesToMigrate = ['CHECKOUT_UI_EXTENSION', 'POS_UI_EXTENSION'] return localSources.reduce((accumulator, localSource) => { if (localSource.type === 'ui_extension') { @@ -67,6 +67,7 @@ async function migrateExtensionToUIExtension( registrationId: MigrateToUiExtensionVariables['registrationId'], developerPlatformClient: DeveloperPlatformClient, ) { + console.log('>>>>>>>>>>>>>>>>>>>>>>>>> registration id', registrationId) const variables: MigrateToUiExtensionVariables = { apiKey, registrationId, From c09a2fc9f887deab1bf91eba623070eef39af72f Mon Sep 17 00:00:00 2001 From: Jean-Sebastien Goupil Date: Thu, 4 Jul 2024 16:13:40 +0000 Subject: [PATCH 2/4] Removed console log --- packages/app/src/cli/services/dev/migrate-to-ui-extension.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/app/src/cli/services/dev/migrate-to-ui-extension.ts b/packages/app/src/cli/services/dev/migrate-to-ui-extension.ts index 7f33a41ab4..fb6ff384e8 100644 --- a/packages/app/src/cli/services/dev/migrate-to-ui-extension.ts +++ b/packages/app/src/cli/services/dev/migrate-to-ui-extension.ts @@ -67,7 +67,6 @@ async function migrateExtensionToUIExtension( registrationId: MigrateToUiExtensionVariables['registrationId'], developerPlatformClient: DeveloperPlatformClient, ) { - console.log('>>>>>>>>>>>>>>>>>>>>>>>>> registration id', registrationId) const variables: MigrateToUiExtensionVariables = { apiKey, registrationId, From f973cb6255985aa70c689dcc2608dffca14d9eb9 Mon Sep 17 00:00:00 2001 From: Jean-Sebastien Goupil Date: Thu, 4 Jul 2024 18:01:46 +0000 Subject: [PATCH 3/4] Added test case for POS --- .../services/dev/migrate-to-ui-extension.test.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/app/src/cli/services/dev/migrate-to-ui-extension.test.ts b/packages/app/src/cli/services/dev/migrate-to-ui-extension.test.ts index 9c5abbb715..758ae909db 100644 --- a/packages/app/src/cli/services/dev/migrate-to-ui-extension.test.ts +++ b/packages/app/src/cli/services/dev/migrate-to-ui-extension.test.ts @@ -30,6 +30,18 @@ describe('getExtensionsToMigrate()', () => { } describe('if local.id matches remote.id', () => { + test('returns extensions where local.type is ui_extension but remote.type is POS_UI_EXTENSION', () => { + // Given + const localExtension = getLocalExtension({type: 'ui_extension'}) + const remoteExtension = getRemoteExtension({type: 'POS_UI_EXTENSION'}) + + // When + const toMigrate = getUIExtensionsToMigrate([localExtension], [remoteExtension], defaultIds) + + // Then + expect(toMigrate).toStrictEqual([{local: localExtension, remote: remoteExtension}]) + }) + test('returns extensions where local.type is ui_extension but remote.type is CHECKOUT_UI_EXTENSION', () => { // Given const localExtension = getLocalExtension({type: 'ui_extension'}) @@ -54,7 +66,7 @@ describe('getExtensionsToMigrate()', () => { expect(toMigrate).toStrictEqual([]) }) - test('does not return extensions where remote.type is not CHECKOUT_UI_EXTENSION', () => { + test('does not return extensions where remote.type is not CHECKOUT_UI_EXTENSION or POS_UI_EXTENSION', () => { // Given const localExtension = {...getLocalExtension(), type: 'ui_extension'} const remoteExtension = {...getRemoteExtension(), type: 'PRODUCT_SUBSCRIPTION_UI_EXTENSION'} From cb06f10e17b3bdc1112eeba83f69080201ce9d90 Mon Sep 17 00:00:00 2001 From: Jean-Sebastien Goupil Date: Fri, 5 Jul 2024 17:18:49 +0000 Subject: [PATCH 4/4] Updated prompt for migration and added changeset --- .changeset/rare-lizards-heal.md | 5 +++++ packages/app/src/cli/services/context/prompts.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/rare-lizards-heal.md diff --git a/.changeset/rare-lizards-heal.md b/.changeset/rare-lizards-heal.md new file mode 100644 index 0000000000..98a1ad76cd --- /dev/null +++ b/.changeset/rare-lizards-heal.md @@ -0,0 +1,5 @@ +--- +'@shopify/cli': minor +--- + +Added extension type pos_ui_extension to the ui_extension migration process diff --git a/packages/app/src/cli/services/context/prompts.ts b/packages/app/src/cli/services/context/prompts.ts index 9ff46f7f83..dcf86a5048 100644 --- a/packages/app/src/cli/services/context/prompts.ts +++ b/packages/app/src/cli/services/context/prompts.ts @@ -41,13 +41,15 @@ export async function extensionMigrationPrompt( .map((name) => `"${name}"`) .join(', ') + const migrationEndType = toMigrate.map(({local}) => `"${local.type}"`).join(', ') + renderInfo({ headline: "Extension migrations can't be undone.", body: `Your ${migrationNames} configuration has been updated. Migrating gives you access to new features and won't impact the end user experience. All previous extension versions will reflect this change.`, }) const confirmMessage = includeRemoteType - ? `Yes, confirm migration from ${uniqueMigrationTypes}` + ? `Yes, confirm migration from ${uniqueMigrationTypes} to ${migrationEndType}` : 'Yes, confirm migration' return renderConfirmationPrompt({