From 58165cf7452dbad480c7cb85e7acba085b3bac1d Mon Sep 17 00:00:00 2001 From: mayakoneval Date: Thu, 9 Mar 2023 11:07:24 -0800 Subject: [PATCH] send referrer to studio via query param (#221) * send referrer to studio via query param * Create breezy-apples-add.md * rename to runtime --- .changeset/breezy-apples-add.md | 6 ++++++ packages/explorer/src/EmbeddedExplorer.ts | 2 ++ packages/sandbox/src/EmbeddedSandbox.ts | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/breezy-apples-add.md diff --git a/.changeset/breezy-apples-add.md b/.changeset/breezy-apples-add.md new file mode 100644 index 00000000..58117d05 --- /dev/null +++ b/.changeset/breezy-apples-add.md @@ -0,0 +1,6 @@ +--- +"@apollo/explorer": patch +"@apollo/sandbox": patch +--- + +send referrer to studio via query param diff --git a/packages/explorer/src/EmbeddedExplorer.ts b/packages/explorer/src/EmbeddedExplorer.ts index 2278cfa9..efcd3f16 100644 --- a/packages/explorer/src/EmbeddedExplorer.ts +++ b/packages/explorer/src/EmbeddedExplorer.ts @@ -81,6 +81,7 @@ export type EmbeddableExplorerOptions = type InternalEmbeddableExplorerOptions = EmbeddableExplorerOptions & { __testLocal__?: boolean; + runtime?: string; }; let idCounter = 0; @@ -216,6 +217,7 @@ export class EmbeddedExplorer { const graphRef = 'graphRef' in this.options ? this.options.graphRef : undefined; const queryParams = { + runtime: this.options.runtime, graphRef, defaultCollectionEntryId: operationId, defaultCollectionId: collectionId, diff --git a/packages/sandbox/src/EmbeddedSandbox.ts b/packages/sandbox/src/EmbeddedSandbox.ts index 398fc602..3490fa08 100644 --- a/packages/sandbox/src/EmbeddedSandbox.ts +++ b/packages/sandbox/src/EmbeddedSandbox.ts @@ -8,7 +8,6 @@ import type { JSONObject } from './helpers/types'; export interface EmbeddableSandboxOptions { target: string | HTMLElement; // HTMLElement is to accommodate people who might prefer to pass in a ref initialEndpoint?: string; - initialState?: { document?: string; variables?: JSONObject; @@ -64,6 +63,7 @@ export interface EmbeddableSandboxOptions { type InternalEmbeddableSandboxOptions = EmbeddableSandboxOptions & { __testLocal__?: boolean; initialRequestQueryPlan?: boolean; + runtime?: string; }; let idCounter = 0; @@ -117,6 +117,7 @@ export class EmbeddedSandbox { } = this.options.initialState || {}; const queryParams = { + runtime: this.options.runtime, endpoint: this.options.initialEndpoint, defaultCollectionId: collectionId, defaultCollectionEntryId: operationId,