Skip to content
Merged
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
2 changes: 1 addition & 1 deletion docs/pricing/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Overview
sidebar_position: 0
---

[[API Docs](/api/pricing)] [[SDK](https://www.npmjs.com/package/@epilot/pricing-client)]
[[API Docs](/api/pricing)] [[SDK](https://www.npmjs.com/package/@epilot/pricing-client)] [[Pricing Demo Playground](/pricing-playground/index.html)]

# Pricing

Expand Down
2 changes: 2 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ const DOCS_URL = process.env.DOCS_URL || 'https://docs.epilot.io';
],
],

clientModules: [require.resolve('./src/clientModules/playgroundNewTab.js')],

plugins: [
function mermaidAliasPlugin() {
return {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"update-entities": "cp ../entity-api/lambda/ApiHandlerFunction/src/schema/blueprints/snapshots/* static/schemas/",
"update-events": "cp ../event-catalog-api/packages/core/src/builtin-events/__snapshots__/* static/events",
"update-sdk": "./scripts/update-sdk-docs.sh",
"update-cli": "./scripts/update-cli-docs.sh"
"update-cli": "./scripts/update-cli-docs.sh",
"update-playground": "./scripts/update-pricing-playground.sh"
},
"dependencies": {
"@cmfcmf/docusaurus-search-local": "^0.10.0",
Expand Down
29 changes: 29 additions & 0 deletions scripts/update-pricing-playground.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -euo pipefail

# THIS SCRIPT ASSUMES you are within the codebase repo.

# Rebuild the pricing demo and copy the output to the docs static folder.
# Usage: npm run update-playground (from the docs root)

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
DOCS_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
PRICING_DEMO="$DOCS_ROOT/../pricing/demo"
TARGET="$DOCS_ROOT/static/pricing-playground"

if [ ! -d "$PRICING_DEMO" ]; then
echo "ERROR: pricing demo not found at $PRICING_DEMO"
exit 1
fi

echo "→ Installing pricing demo dependencies..."
(cd "$PRICING_DEMO" && npm install --no-audit --no-fund)

echo "→ Building pricing demo..."
(cd "$PRICING_DEMO" && npx tsc -b && npx vite build)

echo "→ Copying build output to $TARGET..."
rm -rf "$TARGET"
cp -r "$PRICING_DEMO/dist" "$TARGET"

echo "✓ Pricing playground updated at static/pricing-playground/"
21 changes: 20 additions & 1 deletion sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
* Create as many sidebars as you want.
*/

const DOCS_URL = process.env.DOCS_URL || 'https://docs.epilot.io';

const PLAYGROUND_URL = `${DOCS_URL}/pricing-playground/index.html`;

module.exports = {
docsSidebar: [
'intro',
Expand Down Expand Up @@ -133,7 +137,22 @@ module.exports = {
collapsible: true,
collapsed: true,
items: [
{ type: 'autogenerated', dirName: 'pricing' },
'pricing/README',
{
type: 'category',
label: 'Pricing Library',
items: [{ type: 'autogenerated', dirName: 'pricing/pricing-library' }],
},
{
type: 'link',
label: 'Pricing Playground',
href: PLAYGROUND_URL,
},
'pricing/entities',
'pricing/catalog',
'pricing/orders',
'pricing/ecommerce',
'pricing/pricing-models',
{ type: 'autogenerated', dirName: 'deadlines' },
],
},
Expand Down
20 changes: 20 additions & 0 deletions src/clientModules/playgroundNewTab.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Opens the Pricing Playground sidebar link in a new tab.
// Docusaurus sidebar `link` items don't support target="_blank" natively.

if (typeof window !== 'undefined') {
const PLAYGROUND_PATH = '/pricing-playground/';

const observer = new MutationObserver(() => {
document.querySelectorAll('.menu__link[href*="' + PLAYGROUND_PATH + '"]').forEach((link) => {
if (!link.getAttribute('target')) {
link.setAttribute('target', '_blank');
link.setAttribute('rel', 'noopener noreferrer');
}
});
});

observer.observe(document.documentElement, {
childList: true,
subtree: true,
});
}
1 change: 1 addition & 0 deletions static/pricing-playground/assets/index-DBk_NkYK.css

Large diffs are not rendered by default.

484 changes: 484 additions & 0 deletions static/pricing-playground/assets/index-DOCEUpWZ.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions static/pricing-playground/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>epilot Pricing Playground</title>
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>💰</text></svg>" />
<script type="module" crossorigin src="/pricing-playground/assets/index-DOCEUpWZ.js"></script>
<link rel="stylesheet" crossorigin href="/pricing-playground/assets/index-DBk_NkYK.css">
</head>
<body class="bg-gray-50 text-gray-900 antialiased">
<div id="root"></div>
</body>
</html>
Loading