From 1ad98a4acaa12bbcaad431719ba344e6522d24cd Mon Sep 17 00:00:00 2001
From: Ioana Munteanu <121992343+munteanuic@users.noreply.github.com>
Date: Thu, 5 Sep 2024 13:16:45 -0700
Subject: [PATCH] add env var description and fix URL
---
embedding/sigma_embed_link_sharing/.env | 2 +-
embedding/sigma_embed_link_sharing/index.html | 20 +++++++++----------
2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/embedding/sigma_embed_link_sharing/.env b/embedding/sigma_embed_link_sharing/.env
index 7872186..832e3bf 100644
--- a/embedding/sigma_embed_link_sharing/.env
+++ b/embedding/sigma_embed_link_sharing/.env
@@ -6,7 +6,7 @@ EMBED_SECRET={your embed secret}
# Required Parameters
EMAIL={your embed test user email address}
EXTERNAL_USER_ID=123
-EXTERNAL_USER_TEAM=Sales_People
+EXTERNAL_USER_TEAM={your team that has access to the workbook you embedded}
ACCOUNT_TYPE=Pro
MODE=userbacked
SESSION_LENGTH=600
diff --git a/embedding/sigma_embed_link_sharing/index.html b/embedding/sigma_embed_link_sharing/index.html
index ba83ffe..7e687d5 100644
--- a/embedding/sigma_embed_link_sharing/index.html
+++ b/embedding/sigma_embed_link_sharing/index.html
@@ -82,21 +82,19 @@
Sigma - Embed Link Sharing Sample
if (exploreKey) params.append("exploreKey", exploreKey);
if (bookmarkId) params.append("bookmarkId", bookmarkId);
- const newUrl = `${window.location.origin}${
- window.location.pathname
- }?${params.toString()}`;
+ const paramsToString = params.toString();
+ const newUrl = paramsToString
+ ? `${window.location.origin}${window.location.pathname}?${paramsToString}`
+ : `${window.location.origin}${window.location.pathname}`;
window.history.pushState({}, "", newUrl);
}
// Function to send sharing links back to Sigma
function sendSharingLinks() {
const baseUrl = window.location.origin + window.location.pathname;
- const finalSharingLink =
- currentExploreKey || currentBookmarkId
- ? `${baseUrl}?${
- currentExploreKey ? `exploreKey=${currentExploreKey}` : ""
- }${currentBookmarkId ? `&bookmarkId=${currentBookmarkId}` : ""}`
- : baseUrl;
+ const sharingLink = currentBookmarkId
+ ? `${baseUrl}?&bookmarkId=${currentBookmarkId}`
+ : baseUrl;
const sharingExplorationLink = currentExploreKey
? currentBookmarkId
@@ -105,13 +103,13 @@ Sigma - Embed Link Sharing Sample
: null;
console.log("Sending sharing links to Sigma:");
- console.log("Final Sharing Link:", finalSharingLink);
+ console.log("Sharing Link:", baseUrl);
console.log("Sharing Exploration Link:", sharingExplorationLink);
iframe.contentWindow.postMessage(
{
type: "workbook:sharinglink:update",
- sharingLink: finalSharingLink,
+ sharingLink: sharingLink,
sharingExplorationLink: sharingExplorationLink,
},
"https://app.sigmacomputing.com"