@atlasauth/embed 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,10 +25,10 @@ export interface AtlasGlobal {
25
25
  mountPricingTable: typeof mountPricingTable;
26
26
  /** Mount a lead / newsletter signup form. */
27
27
  mountLeadForm: typeof mountLeadForm;
28
+ /** `session.getToken()` / `getIdToken()` / `user` / `isSignedIn`: see `@atlasauth/js`. Present when the script tag carries a key and FAPI origin. */
29
+ session?: import('@atlasauth/js').AtlasSessionGlobal;
30
+ billing?: import('@atlasauth/js').AtlasBillingGlobal;
28
31
  defineElements: typeof defineElements;
29
- }
30
- declare global {
31
- interface Window {
32
- Atlas?: AtlasGlobal;
33
- }
32
+ /** Other scripts may add their own keys to the shared global. */
33
+ [key: string]: unknown;
34
34
  }
@@ -19,6 +19,7 @@ const org_admin_1 = require("./org-admin");
19
19
  const pricing_1 = require("./pricing");
20
20
  const lead_form_1 = require("./lead-form");
21
21
  const config_1 = require("./config");
22
+ const client_1 = require("./client");
22
23
  function currentScript() {
23
24
  const active = document.currentScript;
24
25
  if (active instanceof HTMLScriptElement)
@@ -31,7 +32,12 @@ function currentScript() {
31
32
  function boot() {
32
33
  (0, config_1.setScriptDefaults)((0, config_1.readScriptTag)(currentScript()));
33
34
  (0, element_1.defineElements)();
34
- window.Atlas = { mountSignIn: mount_1.mountSignIn, mountSignUp: mount_1.mountSignUp, mountOrganizationAdmin: org_admin_1.mountOrganizationAdmin, mountPricingTable: pricing_1.mountPricingTable, mountLeadForm: lead_form_1.mountLeadForm, defineElements: element_1.defineElements };
35
+ const defaults = (0, config_1.readScriptTag)(currentScript());
36
+ // The client registers `window.Atlas.session` (extended below, never clobbered).
37
+ if (defaults.publishableKey && defaults.frontendApi) {
38
+ (0, client_1.createClient)({ publishableKey: defaults.publishableKey, frontendApi: defaults.frontendApi, locale: defaults.locale });
39
+ }
40
+ window.Atlas = Object.assign(window.Atlas ?? {}, { mountSignIn: mount_1.mountSignIn, mountSignUp: mount_1.mountSignUp, mountOrganizationAdmin: org_admin_1.mountOrganizationAdmin, mountPricingTable: pricing_1.mountPricingTable, mountLeadForm: lead_form_1.mountLeadForm, defineElements: element_1.defineElements });
35
41
  }
36
42
  boot();
37
43
  //# sourceMappingURL=standalone.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standalone.js","sourceRoot":"","sources":["../src/standalone.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;GAYG;AACH,uCAA2C;AAC3C,mCAAmD;AACnD,2CAAqD;AACrD,uCAA8C;AAC9C,2CAA4C;AAC5C,qCAA4D;AAoB5D,SAAS,aAAa;IACpB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC;IACtC,IAAI,MAAM,YAAY,iBAAiB;QAAE,OAAO,MAAM,CAAC;IACvD,wEAAwE;IACxE,uEAAuE;IACvE,OAAO,CACL,QAAQ,CAAC,aAAa,CAAoB,wBAAwB,CAAC;QACnE,QAAQ,CAAC,aAAa,CAAoB,yBAAyB,CAAC,CACrE,CAAC;AACJ,CAAC;AAED,SAAS,IAAI;IACX,IAAA,0BAAiB,EAAC,IAAA,sBAAa,EAAC,aAAa,EAAE,CAAC,CAAC,CAAC;IAClD,IAAA,wBAAc,GAAE,CAAC;IACjB,MAAM,CAAC,KAAK,GAAG,EAAE,WAAW,EAAX,mBAAW,EAAE,WAAW,EAAX,mBAAW,EAAE,sBAAsB,EAAtB,kCAAsB,EAAE,iBAAiB,EAAjB,2BAAiB,EAAE,aAAa,EAAb,yBAAa,EAAE,cAAc,EAAd,wBAAc,EAAE,CAAC;AACxH,CAAC;AAED,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"standalone.js","sourceRoot":"","sources":["../src/standalone.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;GAYG;AACH,uCAA2C;AAC3C,mCAAmD;AACnD,2CAAqD;AACrD,uCAA8C;AAC9C,2CAA4C;AAC5C,qCAA4D;AAC5D,qCAAwC;AAmBxC,SAAS,aAAa;IACpB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC;IACtC,IAAI,MAAM,YAAY,iBAAiB;QAAE,OAAO,MAAM,CAAC;IACvD,wEAAwE;IACxE,uEAAuE;IACvE,OAAO,CACL,QAAQ,CAAC,aAAa,CAAoB,wBAAwB,CAAC;QACnE,QAAQ,CAAC,aAAa,CAAoB,yBAAyB,CAAC,CACrE,CAAC;AACJ,CAAC;AAED,SAAS,IAAI;IACX,IAAA,0BAAiB,EAAC,IAAA,sBAAa,EAAC,aAAa,EAAE,CAAC,CAAC,CAAC;IAClD,IAAA,wBAAc,GAAE,CAAC;IACjB,MAAM,QAAQ,GAAG,IAAA,sBAAa,EAAC,aAAa,EAAE,CAAC,CAAC;IAChD,iFAAiF;IACjF,IAAI,QAAQ,CAAC,cAAc,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC;QACpD,IAAA,qBAAY,EAAC,EAAE,cAAc,EAAE,QAAQ,CAAC,cAAc,EAAE,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACxH,CAAC;IACD,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,EAAE,WAAW,EAAX,mBAAW,EAAE,WAAW,EAAX,mBAAW,EAAE,sBAAsB,EAAtB,kCAAsB,EAAE,iBAAiB,EAAjB,2BAAiB,EAAE,aAAa,EAAb,yBAAa,EAAE,cAAc,EAAd,wBAAc,EAAE,CAAgB,CAAC;AAC1K,CAAC;AAED,IAAI,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@atlasauth/embed",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {
7
7
  "@atlasauth/design": "0.3.0",
8
- "@atlasauth/js": "0.27.0"
8
+ "@atlasauth/js": "0.29.0"
9
9
  },
10
10
  "devDependencies": {
11
11
  "esbuild": "^0.21.5",