JS-SDK

Steps to publish change to dev CDN

# on the root path of the repo:
npm run compile:core

# go to the packages/javascript directory
cd packages/javascript

# run the following to publish the script to our dev CDN

# this is for the loader
aws s3 sync loader/ s3://cdn.dev.w3w.io/[email protected]/loader --profile 449290502274:engineer-emergency-write-access --acl public-read --delete 

# this is for the dist folder
aws s3 sync dist/ s3://cdn.dev.w3w.io/[email protected]/dist --profile 449290502274:engineer-emergency-write-access --acl public-read --delete 

# invalidate the cache if you need to, but this is not necessary if you're running the previous steps for the first time or if you're not re-using the same version (overwriting).
aws cloudfront create-invalidation --distribution-id E3R04X8L41PFA7 --paths "/[email protected].*" --profile 449290502274:engineer-emergency-write-access &>/dev/null

Example HTML for testing

<!DOCTYPE html>
<html>
  <head>
    <title>what3words JavaScript Component Sandbox</title>
    <meta charset="UTF-8" />
    <link rel="stylesheet" href="styles.css" />
    <script
      type="module"
      async
      src="https://cdn.dev.w3w.io/[email protected]/dist/what3words/what3words.esm.js"
    ></script>
    <script
      nomodule
      async
      src="https://cdn.dev.w3w.io/[email protected]/dist/what3words/what3words.js"
    ></script>
  </head>

  <body>
    <form id="form" method="GET">
      <div class="container">
        <what3words-autosuggest api_key="TSTSTSTS">
          <input type="text" id="what3words1" name="what3words1" optional />
        </what3words-autosuggest>
      </div>
    </form>
  </body>
</html>

Last updated