@scalar/api-reference 1.52.2 → 1.52.4
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.
- package/CHANGELOG.md +17 -0
- package/dist/browser/standalone.js +210 -202
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReference.vue.d.ts.map +1 -1
- package/dist/components/ApiReference.vue.js +1 -1
- package/dist/components/ApiReference.vue.js.map +1 -1
- package/dist/components/ApiReference.vue.script.js +6 -2
- package/dist/components/ApiReference.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.script.js +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.script.js.map +1 -1
- package/dist/components/SectionFlare/SectionFlare.vue.d.ts.map +1 -1
- package/dist/components/SectionFlare/SectionFlare.vue.js +2 -2
- package/dist/components/SectionFlare/SectionFlare.vue.js.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.d.ts +10 -1
- package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.js.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.script.js +17 -8
- package/dist/features/Operation/components/OperationParameters.vue.script.js.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.d.ts +9 -1
- package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.js +1 -1
- package/dist/features/Operation/components/RequestBody.vue.js.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.script.js +8 -4
- package/dist/features/Operation/components/RequestBody.vue.script.js.map +1 -1
- package/dist/features/Operation/helpers/filter-selected-security.js +3 -3
- package/dist/features/Operation/helpers/filter-selected-security.js.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.js.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.script.js +10 -3
- package/dist/features/Operation/layouts/ClassicLayout.vue.script.js.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.script.js +9 -2
- package/dist/features/Operation/layouts/ModernLayout.vue.script.js.map +1 -1
- package/dist/helpers/map-config-plugins.d.ts.map +1 -1
- package/dist/helpers/map-config-plugins.js +2 -1
- package/dist/helpers/map-config-plugins.js.map +1 -1
- package/dist/plugins/plugin-manager.d.ts +17 -0
- package/dist/plugins/plugin-manager.d.ts.map +1 -1
- package/dist/plugins/plugin-manager.js +14 -0
- package/dist/plugins/plugin-manager.js.map +1 -1
- package/dist/plugins/posthog/index.d.ts +16 -0
- package/dist/plugins/posthog/index.d.ts.map +1 -0
- package/dist/plugins/posthog/index.js +54 -0
- package/dist/plugins/posthog/index.js.map +1 -0
- package/dist/style.css +245 -167
- package/package.json +22 -17
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type PostHogConfig } from '@scalar/api-client/plugins/posthog';
|
|
2
|
+
import type { ApiReferencePlugin } from '../plugin-manager.js';
|
|
3
|
+
export type { PostHogConfig };
|
|
4
|
+
/**
|
|
5
|
+
* PostHog analytics plugin for the API Reference.
|
|
6
|
+
*
|
|
7
|
+
* Loading this plugin opts in to analytics for both the API Reference
|
|
8
|
+
* and the embedded API Client (tracked as separate products).
|
|
9
|
+
*
|
|
10
|
+
* Respects the `telemetry` configuration option — when set to `false`,
|
|
11
|
+
* capturing is disabled. Reacts dynamically to config changes at runtime.
|
|
12
|
+
*
|
|
13
|
+
* If the plugin is not loaded, no tracking occurs.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PostHogPlugin: (config: PostHogConfig) => ApiReferencePlugin;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/posthog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAI5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,YAAY,EAAE,aAAa,EAAE,CAAA;AAE7B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,aAAa,KAAG,kBAuDrD,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { PostHogClientPlugin } from "@scalar/api-client/plugins/posthog";
|
|
2
|
+
import ph from "posthog-js";
|
|
3
|
+
//#region src/plugins/posthog/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* PostHog analytics plugin for the API Reference.
|
|
6
|
+
*
|
|
7
|
+
* Loading this plugin opts in to analytics for both the API Reference
|
|
8
|
+
* and the embedded API Client (tracked as separate products).
|
|
9
|
+
*
|
|
10
|
+
* Respects the `telemetry` configuration option — when set to `false`,
|
|
11
|
+
* capturing is disabled. Reacts dynamically to config changes at runtime.
|
|
12
|
+
*
|
|
13
|
+
* If the plugin is not loaded, no tracking occurs.
|
|
14
|
+
*/
|
|
15
|
+
var PostHogPlugin = (config) => {
|
|
16
|
+
let posthog = null;
|
|
17
|
+
const clientPlugin = PostHogClientPlugin(config);
|
|
18
|
+
return () => ({
|
|
19
|
+
name: "posthog",
|
|
20
|
+
extensions: [],
|
|
21
|
+
apiClientPlugins: [clientPlugin],
|
|
22
|
+
hooks: {
|
|
23
|
+
onInit({ config: referenceConfig }) {
|
|
24
|
+
if (typeof window === "undefined") return;
|
|
25
|
+
const instance = ph.init(config.apiKey, {
|
|
26
|
+
api_host: config.apiHost,
|
|
27
|
+
...config.uiHost ? { ui_host: config.uiHost } : {},
|
|
28
|
+
...config.defaults ? { defaults: config.defaults } : {},
|
|
29
|
+
opt_out_capturing_by_default: true
|
|
30
|
+
}, "scalar-api-reference");
|
|
31
|
+
if (instance) {
|
|
32
|
+
posthog = instance;
|
|
33
|
+
posthog.register({ product: "api-reference" });
|
|
34
|
+
if (referenceConfig.telemetry !== false) posthog.opt_in_capturing();
|
|
35
|
+
}
|
|
36
|
+
clientPlugin.lifecycle?.onInit?.({ config: referenceConfig });
|
|
37
|
+
},
|
|
38
|
+
onConfigChange({ config: referenceConfig }) {
|
|
39
|
+
if (posthog) if (referenceConfig.telemetry === false) posthog.opt_out_capturing();
|
|
40
|
+
else posthog.opt_in_capturing();
|
|
41
|
+
clientPlugin.lifecycle?.onConfigChange?.({ config: referenceConfig });
|
|
42
|
+
},
|
|
43
|
+
onDestroy() {
|
|
44
|
+
posthog?.reset();
|
|
45
|
+
posthog = null;
|
|
46
|
+
clientPlugin.lifecycle?.onDestroy?.();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { PostHogPlugin };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/plugins/posthog/index.ts"],"sourcesContent":["import { PostHogClientPlugin, type PostHogConfig } from '@scalar/api-client/plugins/posthog'\nimport type { PostHog } from 'posthog-js'\nimport ph from 'posthog-js'\n\nimport type { ApiReferencePlugin } from '../plugin-manager'\n\nexport type { PostHogConfig }\n\n/**\n * PostHog analytics plugin for the API Reference.\n *\n * Loading this plugin opts in to analytics for both the API Reference\n * and the embedded API Client (tracked as separate products).\n *\n * Respects the `telemetry` configuration option — when set to `false`,\n * capturing is disabled. Reacts dynamically to config changes at runtime.\n *\n * If the plugin is not loaded, no tracking occurs.\n */\nexport const PostHogPlugin = (config: PostHogConfig): ApiReferencePlugin => {\n let posthog: PostHog | null = null\n const clientPlugin = PostHogClientPlugin(config)\n\n return () => ({\n name: 'posthog',\n extensions: [],\n apiClientPlugins: [clientPlugin],\n hooks: {\n onInit({ config: referenceConfig }) {\n if (typeof window === 'undefined') {\n return\n }\n\n const instance = ph.init(\n config.apiKey,\n {\n api_host: config.apiHost,\n ...(config.uiHost ? { ui_host: config.uiHost } : {}),\n ...(config.defaults ? { defaults: config.defaults } : {}),\n opt_out_capturing_by_default: true,\n },\n 'scalar-api-reference',\n )\n\n if (instance) {\n posthog = instance\n posthog.register({ product: 'api-reference' })\n\n if (referenceConfig.telemetry !== false) {\n posthog.opt_in_capturing()\n }\n }\n\n clientPlugin.lifecycle?.onInit?.({ config: referenceConfig })\n },\n onConfigChange({ config: referenceConfig }) {\n if (posthog) {\n if (referenceConfig.telemetry === false) {\n posthog.opt_out_capturing()\n } else {\n posthog.opt_in_capturing()\n }\n }\n\n clientPlugin.lifecycle?.onConfigChange?.({ config: referenceConfig })\n },\n onDestroy() {\n posthog?.reset()\n posthog = null\n\n clientPlugin.lifecycle?.onDestroy?.()\n },\n },\n })\n}\n"],"mappings":";;;;;;;;;;;;;;AAmBA,IAAa,iBAAiB,WAA8C;CAC1E,IAAI,UAA0B;CAC9B,MAAM,eAAe,oBAAoB,OAAO;AAEhD,eAAc;EACZ,MAAM;EACN,YAAY,EAAE;EACd,kBAAkB,CAAC,aAAa;EAChC,OAAO;GACL,OAAO,EAAE,QAAQ,mBAAmB;AAClC,QAAI,OAAO,WAAW,YACpB;IAGF,MAAM,WAAW,GAAG,KAClB,OAAO,QACP;KACE,UAAU,OAAO;KACjB,GAAI,OAAO,SAAS,EAAE,SAAS,OAAO,QAAQ,GAAG,EAAE;KACnD,GAAI,OAAO,WAAW,EAAE,UAAU,OAAO,UAAU,GAAG,EAAE;KACxD,8BAA8B;KAC/B,EACD,uBACD;AAED,QAAI,UAAU;AACZ,eAAU;AACV,aAAQ,SAAS,EAAE,SAAS,iBAAiB,CAAC;AAE9C,SAAI,gBAAgB,cAAc,MAChC,SAAQ,kBAAkB;;AAI9B,iBAAa,WAAW,SAAS,EAAE,QAAQ,iBAAiB,CAAC;;GAE/D,eAAe,EAAE,QAAQ,mBAAmB;AAC1C,QAAI,QACF,KAAI,gBAAgB,cAAc,MAChC,SAAQ,mBAAmB;QAE3B,SAAQ,kBAAkB;AAI9B,iBAAa,WAAW,iBAAiB,EAAE,QAAQ,iBAAiB,CAAC;;GAEvE,YAAY;AACV,aAAS,OAAO;AAChB,cAAU;AAEV,iBAAa,WAAW,aAAa;;GAExC;EACF"}
|