Skip to content

Commit

Permalink
feat(embed): Allow hiding test message on creating iframe (#337)
Browse files Browse the repository at this point in the history
Add support for new checkout url parameter `"hide_test_message"`, useful for demoing purposes.

Resolves #336
  • Loading branch information
afrojezus authored Feb 29, 2024
1 parent 056976a commit b0ecc1d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,9 @@ export const embed = async (
ui: options.ui || "inline",
shouldCallValidateSession: onValidateSession !== undefined,
popOut,
...(options.hasOwnProperty("hideTestMessage") && {
hideTestMessage: options["hideTestMessage"],
}),
}),
);

Expand Down
7 changes: 7 additions & 0 deletions src/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ const getSessionUrl = (options: SessionUrlOptions): string => {
if (popOut) {
params.append("role", "pop_out_launcher");
}
if (
options.hasOwnProperty("hideTestMessage") &&
options["hideTestMessage"] !== undefined &&
options["hideTestMessage"] === true
) {
params.append("hide_test_message", "true");
}
if (endpoint === "https://checkout.dintero.com") {
// Default endpoint will redirect via the view endpoint
return `${endpoint}/v1/view/${sid}?${params.toString()}`;
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@
resolved "https://registry.yarnpkg.com/@semantic-release/error/-/error-4.0.0.tgz#692810288239637f74396976a9340fbc0aa9f6f9"
integrity sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ==

"@semantic-release/exec@^6.0.3":
"@semantic-release/[email protected]":
version "6.0.3"
resolved "https://registry.yarnpkg.com/@semantic-release/exec/-/exec-6.0.3.tgz#d212fdf19633bdfb553de6cb6c7f8781933224db"
integrity sha512-bxAq8vLOw76aV89vxxICecEa8jfaWwYITw6X74zzlO0mc/Bgieqx9kBRz9z96pHectiTAtsCwsQcUyLYWnp3VQ==
Expand Down

0 comments on commit b0ecc1d

Please sign in to comment.