Skip to content
Snippets Groups Projects
Unverified Commit e23bd004 authored by Jeff Bruemmer's avatar Jeff Bruemmer Committed by GitHub
Browse files

sdk readme (#50372)

parent 7393892b
No related branches found
No related tags found
No related merge requests found
---
title: Developing the Embedded analytics SDK
---
# Developing the Embedded analytics SDK
These docs are for developing the SDK. For using the SDK in your app, see our [SDK docs](../embedding/sdk/introduction.md).
## Building locally
First you need to build the Metabase Embedding SDK for React locally:
```bash
yarn build-release:cljs
```
## Build and watch
And then run:
```bash
yarn build-embedding-sdk:watch
```
`build-embedding-sdk:watch` is the original command, the js output is fast, but the dts output is extremely slow and is not fixed by the fixup script on watch.
## Build incrementally
```bash
yarn build-embedding-sdk:dev
```
This is an _experimental_ command that should be much faster, it uses `tsc --incremental` to to generate the dts files and fixes them automatically by running the fixup script on watch.
The `tsc` command will output a lot of errors, to keep the terminal output under control you may want to run the three different `embedding-sdk:dev:*` commands on different terminals.
There is a VS code task named `Run embedding sdk dev commands` that does that
## Storybook
You can use storybook to run SDK components during local development.
When you have Metabase instance running:
```bash
yarn storybook-embedding-sdk
```
## Initial configuration
1. Set JWT secret to be "`0000000000000000000000000000000000000000000000000000000000000000`" in Admin > Authentication >
JWT > String used by the JWT signing key
1. Make sure "User Provisioning" setting is set to "`on`".
1. Set Authorized Origins to "`*`" in Admin > Embedding > Interactive embedding
## Using the local build
After that you need to add this built SDK package location to your package.json. In this example we assume that your
application is located in the same directory as Metabase directory:
```json
"dependencies": {
"@metabase/embedding-sdk-react": "file:../metabase/resources/embedding-sdk"
}
```
And then you can install the package using npm or yarn:
```bash
npm install
# or
yarn
```
## Releases
Embedding SDK package build happens with Github actions if `embedding-sdk-build` label has been set on the PR.
Published package will use a version from `package.template.json` + current date and commit short hash.
<svg width="1035" height="256" viewBox="0 0 1035 256" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M430.799 63.8732V193.797H407.079V114.016C407.079 112.345 407.109 110.554 407.168 108.644C407.288 106.734 407.467 104.793 407.705 102.824L370.558 173.292C368.529 177.172 365.396 179.113 361.16 179.113H357.4C355.311 179.113 353.462 178.635 351.85 177.68C350.239 176.665 348.956 175.203 348.001 173.292L310.675 102.555C310.854 104.644 311.003 106.674 311.123 108.644C311.242 110.554 311.302 112.345 311.302 114.016V193.797H287.581V63.8732H307.99C309.124 63.8732 310.138 63.9031 311.033 63.9628C311.928 64.0225 312.704 64.2015 313.361 64.5C314.077 64.7388 314.703 65.1567 315.24 65.7536C315.837 66.2908 316.404 67.0669 316.941 68.0817L353.283 137.386C354.416 139.476 355.461 141.625 356.415 143.833C357.43 146.042 358.385 148.31 359.28 150.638C360.175 148.251 361.1 145.923 362.055 143.654C363.069 141.386 364.143 139.207 365.277 137.118L401.35 68.0817C401.887 67.0669 402.454 66.2908 403.051 65.7536C403.647 65.1567 404.274 64.7388 404.93 64.5C405.647 64.2015 406.422 64.0225 407.258 63.9628C408.153 63.9031 409.197 63.8732 410.391 63.8732H430.799Z" fill="#5A6072"/>
<path d="M506.624 136.76C506.624 134.193 506.266 131.745 505.549 129.417C504.893 127.089 503.819 125.03 502.327 123.239C500.835 121.448 498.955 120.045 496.688 119.031C494.42 117.956 491.705 117.419 488.542 117.419C482.635 117.419 478.01 119.09 474.668 122.433C471.326 125.776 469.148 130.551 468.134 136.76H506.624ZM467.776 151.444C468.551 160.1 470.998 166.428 475.116 170.427C479.293 174.427 484.723 176.426 491.407 176.426C494.808 176.426 497.732 176.038 500.179 175.262C502.685 174.427 504.863 173.531 506.713 172.576C508.623 171.561 510.323 170.666 511.815 169.89C513.367 169.054 514.888 168.636 516.38 168.636C518.29 168.636 519.782 169.353 520.856 170.785L528.017 179.739C525.391 182.784 522.497 185.321 519.334 187.35C516.171 189.32 512.889 190.902 509.488 192.096C506.087 193.23 502.655 194.006 499.194 194.424C495.733 194.902 492.391 195.14 489.169 195.14C482.724 195.14 476.697 194.096 471.088 192.006C465.538 189.857 460.675 186.724 456.497 182.605C452.38 178.426 449.128 173.263 446.741 167.114C444.354 160.966 443.16 153.832 443.16 145.714C443.16 139.446 444.175 133.536 446.204 127.985C448.292 122.433 451.276 117.598 455.155 113.479C459.033 109.36 463.748 106.107 469.297 103.719C474.847 101.272 481.113 100.048 488.095 100.048C494.003 100.048 499.433 101.003 504.386 102.913C509.398 104.764 513.695 107.48 517.275 111.061C520.916 114.643 523.72 119.06 525.689 124.313C527.718 129.507 528.733 135.446 528.733 142.132C528.733 143.983 528.643 145.505 528.464 146.699C528.285 147.893 527.987 148.848 527.569 149.564C527.151 150.28 526.585 150.788 525.868 151.086C525.152 151.325 524.227 151.444 523.094 151.444H467.776Z" fill="#5A6072"/>
<path d="M571.3 195.23C567.122 195.23 563.423 194.633 560.2 193.439C556.978 192.186 554.263 190.425 552.055 188.156C549.847 185.888 548.176 183.142 547.042 179.918C545.908 176.695 545.341 173.054 545.341 168.994V119.21H536.659C535.346 119.21 534.212 118.792 533.257 117.956C532.362 117.12 531.915 115.867 531.915 114.195V104.525L546.684 101.839L551.697 77.9312C552.353 75.2449 554.173 73.9018 557.157 73.9018H570.046V102.018H593.856V119.21H570.046V167.383C570.046 169.949 570.643 171.979 571.837 173.471C573.09 174.964 574.85 175.71 577.118 175.71C578.311 175.71 579.326 175.591 580.161 175.352C580.997 175.053 581.713 174.755 582.31 174.456C582.906 174.098 583.443 173.8 583.921 173.561C584.458 173.263 584.995 173.113 585.532 173.113C586.248 173.113 586.845 173.292 587.322 173.651C587.8 173.949 588.277 174.486 588.754 175.262L596.184 187.082C592.782 189.768 588.933 191.798 584.637 193.17C580.34 194.543 575.895 195.23 571.3 195.23Z" fill="#5A6072"/>
<path d="M651.758 155.205C645.731 155.504 640.718 156.041 636.72 156.817C632.722 157.533 629.529 158.488 627.142 159.682C624.815 160.876 623.144 162.249 622.129 163.801C621.175 165.293 620.697 166.935 620.697 168.726C620.697 172.307 621.682 174.844 623.651 176.337C625.68 177.829 628.485 178.575 632.065 178.575C636.183 178.575 639.733 177.859 642.717 176.426C645.76 174.934 648.774 172.636 651.758 169.532V155.205ZM601.452 114.285C606.883 109.39 612.88 105.749 619.444 103.361C626.008 100.913 633.109 99.6897 640.748 99.6897C646.238 99.6897 651.131 100.585 655.428 102.376C659.784 104.167 663.454 106.674 666.437 109.897C669.481 113.061 671.808 116.852 673.419 121.269C675.031 125.686 675.836 130.522 675.836 135.775V193.797H664.558C662.23 193.797 660.44 193.469 659.187 192.812C657.994 192.156 657.009 190.783 656.233 188.693L654.264 182.784C651.937 184.813 649.669 186.604 647.461 188.156C645.313 189.708 643.075 191.021 640.748 192.096C638.42 193.111 635.914 193.887 633.229 194.424C630.603 194.961 627.649 195.23 624.367 195.23C620.309 195.23 616.61 194.693 613.268 193.618C609.926 192.544 607.032 190.962 604.585 188.873C602.198 186.724 600.348 184.067 599.036 180.903C597.723 177.74 597.066 174.098 597.066 169.979C597.066 166.577 597.932 163.174 599.662 159.772C601.393 156.369 604.347 153.295 608.524 150.549C612.761 147.743 618.37 145.445 625.352 143.654C632.393 141.804 641.195 140.759 651.758 140.52V135.775C651.758 129.984 650.534 125.746 648.088 123.06C645.641 120.314 642.12 118.941 637.525 118.941C634.124 118.941 631.289 119.359 629.022 120.195C626.754 120.971 624.755 121.836 623.025 122.791C621.354 123.687 619.772 124.552 618.28 125.388C616.789 126.164 615.058 126.552 613.089 126.552C611.358 126.552 609.896 126.134 608.703 125.298C607.569 124.403 606.614 123.358 605.838 122.164L601.452 114.285Z" fill="#5A6072"/>
<path d="M716.245 169.442C718.572 172.128 721.078 174.009 723.764 175.083C726.509 176.158 729.343 176.695 732.267 176.695C735.311 176.695 738.056 176.158 740.502 175.083C743.009 173.949 745.157 172.188 746.947 169.8C748.737 167.353 750.11 164.189 751.065 160.309C752.02 156.429 752.497 151.743 752.497 146.251C752.497 141.356 752.109 137.207 751.333 133.805C750.557 130.343 749.394 127.507 747.842 125.298C746.35 123.09 744.501 121.478 742.293 120.463C740.085 119.448 737.519 118.941 734.595 118.941C730.716 118.941 727.344 119.807 724.48 121.538C721.675 123.209 718.93 125.686 716.245 128.97V169.442ZM716.245 112.136C719.885 108.495 723.913 105.57 728.329 103.361C732.745 101.152 737.698 100.048 743.188 100.048C748.499 100.048 753.273 101.122 757.51 103.271C761.806 105.361 765.446 108.375 768.43 112.315C771.473 116.255 773.801 121.03 775.412 126.641C777.083 132.193 777.918 138.431 777.918 145.356C777.918 152.817 776.963 159.622 775.054 165.771C773.204 171.86 770.548 177.083 767.087 181.441C763.626 185.798 759.479 189.171 754.645 191.559C749.871 193.946 744.53 195.14 738.623 195.14C735.758 195.14 733.192 194.842 730.925 194.245C728.657 193.708 726.568 192.932 724.659 191.917C722.749 190.902 720.989 189.708 719.378 188.335C717.767 186.903 716.245 185.321 714.813 183.59L713.828 189.141C713.41 190.872 712.724 192.096 711.769 192.812C710.815 193.469 709.532 193.797 707.92 193.797H691.54V60.2916H716.245V112.136Z" fill="#5A6072"/>
<path d="M838.479 155.205C832.452 155.504 827.44 156.041 823.442 156.817C819.443 157.533 816.251 158.488 813.864 159.682C811.537 160.876 809.866 162.249 808.851 163.801C807.896 165.293 807.419 166.935 807.419 168.726C807.419 172.307 808.404 174.844 810.373 176.337C812.402 177.829 815.207 178.575 818.787 178.575C822.904 178.575 826.455 177.859 829.439 176.426C832.482 174.934 835.496 172.636 838.479 169.532V155.205ZM788.174 114.285C793.604 109.39 799.602 105.749 806.166 103.361C812.73 100.913 819.831 99.6897 827.47 99.6897C832.96 99.6897 837.853 100.585 842.149 102.376C846.506 104.167 850.176 106.674 853.159 109.897C856.203 113.061 858.53 116.852 860.141 121.269C861.752 125.686 862.558 130.522 862.558 135.775V193.797H851.279C848.952 193.797 847.162 193.469 845.909 192.812C844.715 192.156 843.731 190.783 842.955 188.693L840.986 182.784C838.658 184.813 836.391 186.604 834.183 188.156C832.035 189.708 829.797 191.021 827.47 192.096C825.142 193.111 822.636 193.887 819.951 194.424C817.325 194.961 814.371 195.23 811.089 195.23C807.031 195.23 803.331 194.693 799.99 193.618C796.648 192.544 793.754 190.962 791.307 188.873C788.92 186.724 787.07 184.067 785.757 180.903C784.444 177.74 783.788 174.098 783.788 169.979C783.788 166.577 784.653 163.174 786.384 159.772C788.114 156.369 791.068 153.295 795.245 150.549C799.482 147.743 805.092 145.445 812.074 143.654C819.115 141.804 827.917 140.759 838.479 140.52V135.775C838.479 129.984 837.256 125.746 834.809 123.06C832.363 120.314 828.842 118.941 824.247 118.941C820.846 118.941 818.011 119.359 815.744 120.195C813.476 120.971 811.477 121.836 809.746 122.791C808.075 123.687 806.494 124.552 805.002 125.388C803.51 126.164 801.78 126.552 799.811 126.552C798.08 126.552 796.618 126.134 795.424 125.298C794.291 124.403 793.336 123.358 792.56 122.164L788.174 114.285Z" fill="#5A6072"/>
<path d="M935.638 120.463C934.982 121.478 934.296 122.224 933.579 122.702C932.923 123.12 931.998 123.328 930.805 123.328C929.611 123.328 928.388 123.03 927.135 122.433C925.882 121.836 924.479 121.209 922.928 120.553C921.376 119.836 919.586 119.18 917.557 118.583C915.588 117.986 913.29 117.687 910.665 117.687C906.666 117.687 903.563 118.523 901.355 120.195C899.147 121.806 898.044 123.955 898.044 126.641C898.044 128.492 898.67 130.044 899.923 131.298C901.176 132.551 902.817 133.656 904.846 134.611C906.935 135.506 909.292 136.372 911.918 137.207C914.543 137.983 917.229 138.849 919.974 139.804C922.778 140.759 925.494 141.863 928.119 143.117C930.745 144.371 933.072 145.953 935.101 147.863C937.19 149.713 938.861 151.982 940.114 154.668C941.367 157.294 941.994 160.488 941.994 164.249C941.994 168.726 941.158 172.875 939.487 176.695C937.876 180.456 935.489 183.709 932.326 186.455C929.164 189.201 925.225 191.35 920.511 192.902C915.797 194.454 910.366 195.23 904.22 195.23C901.057 195.23 897.924 194.931 894.821 194.334C891.718 193.797 888.764 193.021 885.96 192.006C883.155 190.932 880.529 189.708 878.083 188.335C875.636 186.962 873.517 185.47 871.727 183.858L877.456 174.635C878.112 173.561 878.918 172.725 879.873 172.128C880.887 171.531 882.17 171.233 883.722 171.233C885.214 171.233 886.586 171.621 887.839 172.397C889.092 173.113 890.495 173.919 892.046 174.815C893.598 175.65 895.418 176.456 897.506 177.232C899.655 177.949 902.31 178.307 905.473 178.307C907.86 178.307 909.919 178.038 911.649 177.501C913.38 176.964 914.782 176.247 915.856 175.352C916.93 174.397 917.706 173.352 918.184 172.218C918.721 171.024 918.989 169.8 918.989 168.547C918.989 166.517 918.333 164.876 917.02 163.622C915.767 162.309 914.096 161.174 912.007 160.219C909.978 159.264 907.621 158.399 904.936 157.623C902.251 156.847 899.506 155.981 896.701 155.026C893.956 154.071 891.241 152.937 888.555 151.623C885.93 150.31 883.573 148.669 881.484 146.699C879.455 144.669 877.784 142.192 876.471 139.267C875.218 136.342 874.592 132.79 874.592 128.611C874.592 124.791 875.338 121.179 876.829 117.777C878.321 114.315 880.559 111.27 883.543 108.644C886.526 106.017 890.226 103.928 894.642 102.376C899.118 100.824 904.279 100.048 910.128 100.048C916.692 100.048 922.659 101.122 928.03 103.271C933.4 105.42 937.816 108.226 941.277 111.688L935.638 120.463Z" fill="#5A6072"/>
<path d="M1012.42 136.76C1012.42 134.193 1012.06 131.745 1011.34 129.417C1010.69 127.089 1009.61 125.03 1008.12 123.239C1006.63 121.448 1004.75 120.045 1002.48 119.031C1000.21 117.956 997.499 117.419 994.337 117.419C988.429 117.419 983.804 119.09 980.462 122.433C977.121 125.776 974.942 130.551 973.928 136.76H1012.42ZM973.57 151.444C974.346 160.1 976.792 166.428 980.91 170.427C985.087 174.427 990.517 176.426 997.201 176.426C1000.6 176.426 1003.53 176.038 1005.97 175.262C1008.48 174.427 1010.66 173.531 1012.51 172.576C1014.42 171.561 1016.12 170.666 1017.61 169.89C1019.16 169.054 1020.68 168.636 1022.17 168.636C1024.08 168.636 1025.58 169.353 1026.65 170.785L1033.81 179.739C1031.19 182.784 1028.29 185.321 1025.13 187.35C1021.97 189.32 1018.68 190.902 1015.28 192.096C1011.88 193.23 1008.45 194.006 1004.99 194.424C1001.53 194.902 998.186 195.14 994.963 195.14C988.518 195.14 982.491 194.096 976.882 192.006C971.332 189.857 966.469 186.724 962.292 182.605C958.174 178.426 954.922 173.263 952.535 167.114C950.148 160.966 948.954 153.832 948.954 145.714C948.954 139.446 949.969 133.536 951.998 127.985C954.086 122.433 957.07 117.598 960.949 113.479C964.828 109.36 969.542 106.107 975.092 103.719C980.641 101.272 986.907 100.048 993.889 100.048C999.797 100.048 1005.23 101.003 1010.18 102.913C1015.19 104.764 1019.49 107.48 1023.07 111.061C1026.71 114.643 1029.51 119.06 1031.48 124.313C1033.51 129.507 1034.53 135.446 1034.53 142.132C1034.53 143.983 1034.44 145.505 1034.26 146.699C1034.08 147.893 1033.78 148.848 1033.36 149.564C1032.95 150.28 1032.38 150.788 1031.66 151.086C1030.95 151.325 1030.02 151.444 1028.89 151.444H973.57Z" fill="#5A6072"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.5514 76.0822C24.1402 76.0822 31.1028 69.1196 31.1028 60.5308C31.1028 51.942 24.1402 44.9794 15.5514 44.9794C6.9626 44.9794 0 51.942 0 60.5308C0 69.1196 6.9626 76.0822 15.5514 76.0822Z" fill="#509EE3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.5514 121.062C24.1402 121.062 31.1028 114.099 31.1028 105.51C31.1028 96.9215 24.1402 89.9589 15.5514 89.9589C6.9626 89.9589 0 96.9215 0 105.51C0 114.099 6.9626 121.062 15.5514 121.062Z" fill="#509EE3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M60.5309 121.062C69.1197 121.062 76.0823 114.099 76.0823 105.51C76.0823 96.9215 69.1197 89.9589 60.5309 89.9589C51.9421 89.9589 44.9795 96.9215 44.9795 105.51C44.9795 114.099 51.9421 121.062 60.5309 121.062Z" fill="#509EE3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M195.469 76.0822C204.058 76.0822 211.021 69.1196 211.021 60.5308C211.021 51.942 204.058 44.9794 195.469 44.9794C186.88 44.9794 179.918 51.942 179.918 60.5308C179.918 69.1196 186.88 76.0822 195.469 76.0822Z" fill="#509EE3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M150.49 121.062C159.079 121.062 166.041 114.099 166.041 105.51C166.041 96.9215 159.079 89.9589 150.49 89.9589C141.901 89.9589 134.938 96.9215 134.938 105.51C134.938 114.099 141.901 121.062 150.49 121.062Z" fill="#509EE3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M105.51 166.041C114.099 166.041 121.062 159.079 121.062 150.49C121.062 141.901 114.099 134.938 105.51 134.938C96.9215 134.938 89.9589 141.901 89.9589 150.49C89.9589 159.079 96.9215 166.041 105.51 166.041Z" fill="#509EE3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M195.469 121.062C204.058 121.062 211.021 114.099 211.021 105.51C211.021 96.9215 204.058 89.9589 195.469 89.9589C186.88 89.9589 179.918 96.9215 179.918 105.51C179.918 114.099 186.88 121.062 195.469 121.062Z" fill="#509EE3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.5514 166.041C24.1402 166.041 31.1028 159.079 31.1028 150.49C31.1028 141.901 24.1402 134.938 15.5514 134.938C6.9626 134.938 0 141.901 0 150.49C0 159.079 6.9626 166.041 15.5514 166.041Z" fill="#509EE3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M195.469 166.041C204.058 166.041 211.021 159.079 211.021 150.49C211.021 141.901 204.058 134.938 195.469 134.938C186.88 134.938 179.918 141.901 179.918 150.49C179.918 159.079 186.88 166.041 195.469 166.041Z" fill="#509EE3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.5514 211.021C24.1402 211.021 31.1028 204.058 31.1028 195.469C31.1028 186.88 24.1402 179.918 15.5514 179.918C6.9626 179.918 0 186.88 0 195.469C0 204.058 6.9626 211.021 15.5514 211.021Z" fill="#509EE3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M195.469 211.021C204.058 211.021 211.021 204.058 211.021 195.469C211.021 186.88 204.058 179.918 195.469 179.918C186.88 179.918 179.918 186.88 179.918 195.469C179.918 204.058 186.88 211.021 195.469 211.021Z" fill="#509EE3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M60.5309 76.0822C69.1197 76.0822 76.0823 69.1196 76.0823 60.5308C76.0823 51.942 69.1197 44.9794 60.5309 44.9794C51.9421 44.9794 44.9795 51.942 44.9795 60.5308C44.9795 69.1196 51.9421 76.0822 60.5309 76.0822Z" fill="#C2DAF0"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M105.51 76.0822C114.099 76.0822 121.062 69.1196 121.062 60.5308C121.062 51.942 114.099 44.9794 105.51 44.9794C96.9215 44.9794 89.9589 51.942 89.9589 60.5308C89.9589 69.1196 96.9215 76.0822 105.51 76.0822Z" fill="#C2DAF0"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M105.51 31.1028C114.099 31.1028 121.062 24.1402 121.062 15.5514C121.062 6.9626 114.099 0 105.51 0C96.9215 0 89.9589 6.9626 89.9589 15.5514C89.9589 24.1402 96.9215 31.1028 105.51 31.1028Z" fill="#C2DAF0"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M105.51 121.062C114.099 121.062 121.062 114.099 121.062 105.51C121.062 96.9215 114.099 89.9589 105.51 89.9589C96.9215 89.9589 89.9589 96.9215 89.9589 105.51C89.9589 114.099 96.9215 121.062 105.51 121.062Z" fill="#C2DAF0"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M150.49 76.0822C159.079 76.0822 166.041 69.1196 166.041 60.5308C166.041 51.942 159.079 44.9794 150.49 44.9794C141.901 44.9794 134.938 51.942 134.938 60.5308C134.938 69.1196 141.901 76.0822 150.49 76.0822Z" fill="#C2DAF0"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M60.5309 166.041C69.1197 166.041 76.0823 159.079 76.0823 150.49C76.0823 141.901 69.1197 134.938 60.5309 134.938C51.9421 134.938 44.9795 141.901 44.9795 150.49C44.9795 159.079 51.9421 166.041 60.5309 166.041Z" fill="#C2DAF0"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M150.49 166.041C159.079 166.041 166.041 159.079 166.041 150.49C166.041 141.901 159.079 134.938 150.49 134.938C141.901 134.938 134.938 141.901 134.938 150.49C134.938 159.079 141.901 166.041 150.49 166.041Z" fill="#C2DAF0"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M60.5309 211.021C69.1197 211.021 76.0823 204.058 76.0823 195.469C76.0823 186.88 69.1197 179.918 60.5309 179.918C51.9421 179.918 44.9795 186.88 44.9795 195.469C44.9795 204.058 51.9421 211.021 60.5309 211.021Z" fill="#C2DAF0"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M105.51 211.021C114.099 211.021 121.062 204.058 121.062 195.469C121.062 186.88 114.099 179.918 105.51 179.918C96.9215 179.918 89.9589 186.88 89.9589 195.469C89.9589 204.058 96.9215 211.021 105.51 211.021Z" fill="#C2DAF0"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M105.51 256C114.099 256 121.062 249.037 121.062 240.449C121.062 231.86 114.099 224.897 105.51 224.897C96.9215 224.897 89.9589 231.86 89.9589 240.449C89.9589 249.037 96.9215 256 105.51 256Z" fill="#C2DAF0"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M150.49 211.021C159.079 211.021 166.041 204.058 166.041 195.469C166.041 186.88 159.079 179.918 150.49 179.918C141.901 179.918 134.938 186.88 134.938 195.469C134.938 204.058 141.901 211.021 150.49 211.021Z" fill="#C2DAF0"/>
</svg>
# Metabase embedded analytics SDK
![Metabase logo](../../../../docs/images/metabase-logo.svg)
> This SDK is in public beta and actively being developed. You can expect some changes to the API, especially during the beta. The SDK currently only works with a Metabase 1.51 or higher.
With Metabase's Embedded analytics SDK, you can embed individual [Metabase](https://www.metabase.com/) components with React (like standalone charts, dashboards, the query builder, and more). You can manage access and interactivity per component, and you have advanced customization for seamless styling.
[Learn more](https://www.metabase.com/docs/latest/embedding/sdk/introduction).
## Installing Metabase Enterprise Edition
## Docs for the Embedded analytics SDK
For how to use the SDK with your app, check out our [docs for the Embedded analytics SDK](https://www.metabase.com/docs/latest/embedding/sdk/introduction).
## Quickstart
Just some commands to get you started. For more on how to set up the SDK with your app, see the [SDK docs](https://www.metabase.com/docs/latest/embedding/sdk/introduction).
### Installing Metabase
You can run Metabase Pro on a Cloud plan (with a free trial)](https://www.metabase.com/pricing).
Start a free trial of [Metabase Pro](https://www.metabase.com/pricing).
Or run it locally. Here's a docker one-liner:
......@@ -19,14 +29,14 @@ docker run -d -p 3000:3000 --name metabase metabase/metabase-enterprise:latest
You can also [download the JAR](https://downloads.metabase.com/enterprise/latest/metabase.jar), and run it like so:
```sh
java --add-opens java.base/java.nio=ALL-UNNAMED -jar metabase.jar
java -jar metabase.jar
```
By default, Metabase will run at `http://localhost:3000`.
If you get stuck, check out our [installation docs](https://www.metabase.com/docs/latest/installation-and-operation/installing-metabase).
## Installing the SDK
### Installing the SDK
You can install Metabase Embedded analytics SDK for React via npm:
......@@ -40,72 +50,8 @@ or using yarn:
yarn add @metabase/embedding-sdk-react
```
## Which SDK version to use
The SDK version tracks with the Metabase version.
So, for example, if you're on Metabase version `1.51.x`, you should use the SDK with the tag `51-stable`.
See [Versioning](https://www.metabase.com/docs/latest/embedding/sdk/version).
## Docs
For how to use the SDK, check out our [docs for the Embedded analytics SDK](https://www.metabase.com/docs/latest/embedding/sdk/introduction).
## Development
### Storybook
You can use storybook to run SDK components during local development.
When you have Metabase instance running:
```bash
yarn storybook-embedding-sdk
```
### Initial configuration
1. Set JWT secret to be "`0000000000000000000000000000000000000000000000000000000000000000`" in Admin > Authentication >
JWT > String used by the JWT signing key
1. Make sure "User Provisioning" setting is set to "`on`".
1. Set Authorized Origins to "`*`" in Admin > Embedding > Interactive embedding
### Building locally
First you need to build the Metabase Embedding SDK for React locally:
```bash
yarn build-release:cljs
```
And then run:
```bash
yarn build-embedding-sdk:watch
```
### Using the local build
After that you need to add this built SDK package location to your package.json. In this example we assume that your
application is located in the same directory as Metabase directory:
```json
"dependencies": {
"@metabase/embedding-sdk-react": "file:../metabase/resources/embedding-sdk"
}
```
And then you can install the package using npm or yarn:
```bash
npm install
# or
yarn
```
## Releases
For more on the SDK, check out the [SDK docs](https://www.metabase.com/docs/latest/embedding/sdk/introduction).
Embedding SDK package build happens with Github actions if `embedding-sdk-build` label has been set on the PR.
## Development docs
Published package will use a version from `package.template.json` + current date and commit short hash.
For developing the SDK, see the [dev docs](https://www.metabase.com/docs/latest/developers-guide/sdk).
# Docs for development on the sdk
## Commands
### Build
You can build the sdk with `build-embedding-sdk`.
### Watch
If you want to have it build when you change a file there are two options:
#### build-embedding-sdk:watch
`build-embedding-sdk:watch` is the original command, the js output is fast, but the dts output is extremely slow and is not fixed by the fixup script on watch.
#### embedding-sdk:dev
This is an _experimental_ command that should be much faster, it uses `tsc --incremental` to to generate the dts files and fixes them automatically by running the fixup script on watch.
The `tsc` command will output a lot of errors, to keep the terminal output under control you may want to run the three different `embedding-sdk:dev:*` commands on different terminals.
There is a VS code task named `Run embedding sdk dev commands` that does that
## Storybook
TODO
## E2E tests
TODO
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment