@things-factory/kpi 10.1.147 → 10.1.149

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.
@@ -1,19 +1,17 @@
1
+ import { loadGoogleMaps } from '@operato/utils/google-maps-loader.js'
1
2
  import ScriptLoader from '@operato/utils/script-loader.js'
3
+ import { fetchSettingRule } from '@things-factory/setting-ui/dist-client/fetch-setting-value.js'
4
+
5
+ /** The domain setting that holds this site's Google Maps API key. The key is never written in source. */
6
+ export const GOOGLE_MAP_API_KEY_SETTING = 'google-map-api-key'
2
7
 
3
8
  export default class GoogleMapLoader {
4
- static loaded = false
5
9
  static markerClustererLoaded = false
6
10
 
11
+ /** Loads Google Maps once per page with the key from the domain setting; without one, it refuses. */
7
12
  static async load() {
8
- if (GoogleMapLoader.loaded) {
9
- return
10
- }
11
- var key = 'AIzaSyBgQZb-SFqjQBC_XTxNiz0XapejNwV9PgA'
12
-
13
- await ScriptLoader.load(
14
- 'https://maps.googleapis.com/maps/api/js' + (key ? '?key=' + key : '') + '&libraries=places'
15
- )
16
- GoogleMapLoader.loaded = true
13
+ const key = await fetchSettingRule(GOOGLE_MAP_API_KEY_SETTING)
14
+ await loadGoogleMaps(typeof key === 'string' ? key : '')
17
15
  }
18
16
 
19
17
  static async loadMarkerClusterer() {
@@ -1,6 +1,8 @@
1
+ /** The domain setting that holds this site's Google Maps API key. The key is never written in source. */
2
+ export declare const GOOGLE_MAP_API_KEY_SETTING = "google-map-api-key";
1
3
  export default class GoogleMapLoader {
2
- static loaded: boolean;
3
4
  static markerClustererLoaded: boolean;
5
+ /** Loads Google Maps once per page with the key from the domain setting; without one, it refuses. */
4
6
  static load(): Promise<void>;
5
7
  static loadMarkerClusterer(): Promise<void>;
6
8
  }
@@ -1,14 +1,14 @@
1
+ import { loadGoogleMaps } from '@operato/utils/google-maps-loader.js';
1
2
  import ScriptLoader from '@operato/utils/script-loader.js';
3
+ import { fetchSettingRule } from '@things-factory/setting-ui/dist-client/fetch-setting-value.js';
4
+ /** The domain setting that holds this site's Google Maps API key. The key is never written in source. */
5
+ export const GOOGLE_MAP_API_KEY_SETTING = 'google-map-api-key';
2
6
  export default class GoogleMapLoader {
3
- static { this.loaded = false; }
4
7
  static { this.markerClustererLoaded = false; }
8
+ /** Loads Google Maps once per page with the key from the domain setting; without one, it refuses. */
5
9
  static async load() {
6
- if (GoogleMapLoader.loaded) {
7
- return;
8
- }
9
- var key = 'AIzaSyBgQZb-SFqjQBC_XTxNiz0XapejNwV9PgA';
10
- await ScriptLoader.load('https://maps.googleapis.com/maps/api/js' + (key ? '?key=' + key : '') + '&libraries=places');
11
- GoogleMapLoader.loaded = true;
10
+ const key = await fetchSettingRule(GOOGLE_MAP_API_KEY_SETTING);
11
+ await loadGoogleMaps(typeof key === 'string' ? key : '');
12
12
  }
13
13
  static async loadMarkerClusterer() {
14
14
  if (GoogleMapLoader.markerClustererLoaded) {
@@ -1 +1 @@
1
- {"version":3,"file":"google-map-loader.js","sourceRoot":"","sources":["../../client/google-map/google-map-loader.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,iCAAiC,CAAA;AAE1D,MAAM,CAAC,OAAO,OAAO,eAAe;aAC3B,WAAM,GAAG,KAAK,CAAA;aACd,0BAAqB,GAAG,KAAK,CAAA;IAEpC,MAAM,CAAC,KAAK,CAAC,IAAI;QACf,IAAI,eAAe,CAAC,MAAM,EAAE,CAAC;YAC3B,OAAM;QACR,CAAC;QACD,IAAI,GAAG,GAAG,yCAAyC,CAAA;QAEnD,MAAM,YAAY,CAAC,IAAI,CACrB,yCAAyC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,mBAAmB,CAC7F,CAAA;QACD,eAAe,CAAC,MAAM,GAAG,IAAI,CAAA;IAC/B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,mBAAmB;QAC9B,IAAI,eAAe,CAAC,qBAAqB,EAAE,CAAC;YAC1C,OAAM;QACR,CAAC;QAED,0CAA0C;QAC1C,MAAM,YAAY,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAA;QAE1F,eAAe,CAAC,qBAAqB,GAAG,IAAI,CAAA;IAC9C,CAAC","sourcesContent":["import ScriptLoader from '@operato/utils/script-loader.js'\n\nexport default class GoogleMapLoader {\n static loaded = false\n static markerClustererLoaded = false\n\n static async load() {\n if (GoogleMapLoader.loaded) {\n return\n }\n var key = 'AIzaSyBgQZb-SFqjQBC_XTxNiz0XapejNwV9PgA'\n\n await ScriptLoader.load(\n 'https://maps.googleapis.com/maps/api/js' + (key ? '?key=' + key : '') + '&libraries=places'\n )\n GoogleMapLoader.loaded = true\n }\n\n static async loadMarkerClusterer() {\n if (GoogleMapLoader.markerClustererLoaded) {\n return\n }\n\n // Google Maps 공식 MarkerClusterer 라이브러리 로드\n await ScriptLoader.load('https://unpkg.com/@googlemaps/markerclusterer/dist/index.min.js')\n\n GoogleMapLoader.markerClustererLoaded = true\n }\n}\n"]}
1
+ {"version":3,"file":"google-map-loader.js","sourceRoot":"","sources":["../../client/google-map/google-map-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AACrE,OAAO,YAAY,MAAM,iCAAiC,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+DAA+D,CAAA;AAEhG,yGAAyG;AACzG,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAA;AAE9D,MAAM,CAAC,OAAO,OAAO,eAAe;aAC3B,0BAAqB,GAAG,KAAK,CAAA;IAEpC,qGAAqG;IACrG,MAAM,CAAC,KAAK,CAAC,IAAI;QACf,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC,0BAA0B,CAAC,CAAA;QAC9D,MAAM,cAAc,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IAC1D,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,mBAAmB;QAC9B,IAAI,eAAe,CAAC,qBAAqB,EAAE,CAAC;YAC1C,OAAM;QACR,CAAC;QAED,0CAA0C;QAC1C,MAAM,YAAY,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAA;QAE1F,eAAe,CAAC,qBAAqB,GAAG,IAAI,CAAA;IAC9C,CAAC","sourcesContent":["import { loadGoogleMaps } from '@operato/utils/google-maps-loader.js'\nimport ScriptLoader from '@operato/utils/script-loader.js'\nimport { fetchSettingRule } from '@things-factory/setting-ui/dist-client/fetch-setting-value.js'\n\n/** The domain setting that holds this site's Google Maps API key. The key is never written in source. */\nexport const GOOGLE_MAP_API_KEY_SETTING = 'google-map-api-key'\n\nexport default class GoogleMapLoader {\n static markerClustererLoaded = false\n\n /** Loads Google Maps once per page with the key from the domain setting; without one, it refuses. */\n static async load() {\n const key = await fetchSettingRule(GOOGLE_MAP_API_KEY_SETTING)\n await loadGoogleMaps(typeof key === 'string' ? key : '')\n }\n\n static async loadMarkerClusterer() {\n if (GoogleMapLoader.markerClustererLoaded) {\n return\n }\n\n // Google Maps 공식 MarkerClusterer 라이브러리 로드\n await ScriptLoader.load('https://unpkg.com/@googlemaps/markerclusterer/dist/index.min.js')\n\n GoogleMapLoader.markerClustererLoaded = true\n }\n}\n"]}