@croct/plug 0.16.5 → 0.17.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.
Files changed (116) hide show
  1. package/api/evaluate.cjs +45 -0
  2. package/api/evaluate.d.cts +23 -0
  3. package/api/evaluate.d.ts +9 -7
  4. package/api/evaluate.js +20 -22
  5. package/api/fetchContent.cjs +53 -0
  6. package/api/fetchContent.d.cts +45 -0
  7. package/api/fetchContent.d.ts +31 -11
  8. package/api/fetchContent.js +29 -21
  9. package/api/index.cjs +23 -0
  10. package/api/index.d.cts +27 -0
  11. package/api/index.d.ts +27 -2
  12. package/api/index.js +2 -6
  13. package/component.cjs +15 -0
  14. package/component.d.cts +19 -0
  15. package/component.d.ts +12 -9
  16. package/component.js +0 -3
  17. package/constants.cjs +39 -0
  18. package/constants.d.cts +7 -0
  19. package/constants.d.ts +7 -5
  20. package/constants.js +12 -9
  21. package/index.cjs +24 -0
  22. package/index.d.cts +27 -0
  23. package/index.d.ts +26 -3
  24. package/index.js +5 -6
  25. package/package.json +33 -6
  26. package/playground.cjs +166 -0
  27. package/playground.d.cts +64 -0
  28. package/playground.d.ts +18 -8
  29. package/playground.js +130 -138
  30. package/plug.cjs +271 -0
  31. package/plug.d.cts +86 -0
  32. package/plug.d.ts +34 -17
  33. package/plug.js +243 -256
  34. package/plugin.cjs +15 -0
  35. package/plugin.d.cts +41 -0
  36. package/plugin.d.ts +18 -8
  37. package/plugin.js +0 -3
  38. package/preview.cjs +180 -0
  39. package/preview.d.cts +35 -0
  40. package/preview.d.ts +18 -6
  41. package/preview.js +143 -152
  42. package/sdk/apiKey.cjs +21 -0
  43. package/sdk/apiKey.js +1 -5
  44. package/sdk/evaluation.cjs +34 -0
  45. package/sdk/evaluation.d.cts +2 -0
  46. package/sdk/evaluation.d.ts +1 -1
  47. package/sdk/evaluation.js +8 -10
  48. package/sdk/index.cjs +33 -0
  49. package/sdk/index.d.cts +15 -0
  50. package/sdk/index.d.ts +9 -6
  51. package/sdk/index.js +8 -10
  52. package/sdk/json.cjs +15 -0
  53. package/sdk/json.d.cts +6 -0
  54. package/sdk/json.d.ts +4 -1
  55. package/sdk/json.js +0 -5
  56. package/sdk/sdkEvents.cjs +15 -0
  57. package/sdk/sdkEvents.d.cts +1 -0
  58. package/sdk/sdkEvents.js +0 -3
  59. package/sdk/token.cjs +27 -0
  60. package/sdk/token.d.cts +7 -0
  61. package/sdk/token.d.ts +7 -1
  62. package/sdk/token.js +4 -6
  63. package/sdk/tracking.cjs +27 -0
  64. package/sdk/tracking.d.cts +9 -0
  65. package/sdk/tracking.d.ts +8 -5
  66. package/sdk/tracking.js +4 -6
  67. package/sdk/validation.cjs +23 -0
  68. package/sdk/validation.js +2 -6
  69. package/slot.cjs +15 -0
  70. package/slot.d.cts +42 -0
  71. package/slot.d.ts +14 -12
  72. package/slot.js +0 -3
  73. package/versioning.cjs +15 -0
  74. package/versioning.d.cts +26 -0
  75. package/versioning.d.ts +8 -6
  76. package/versioning.js +0 -3
  77. package/api/evaluate.js.map +0 -1
  78. package/api/fetchContent.js.map +0 -1
  79. package/api/index.js.map +0 -1
  80. package/component.js.map +0 -1
  81. package/constants.js.map +0 -1
  82. package/index.js.map +0 -1
  83. package/playground.js.map +0 -1
  84. package/plug.js.map +0 -1
  85. package/plugin.js.map +0 -1
  86. package/preview.js.map +0 -1
  87. package/sdk/apiKey.js.map +0 -1
  88. package/sdk/evaluation.js.map +0 -1
  89. package/sdk/index.js.map +0 -1
  90. package/sdk/json.js.map +0 -1
  91. package/sdk/sdkEvents.js.map +0 -1
  92. package/sdk/token.js.map +0 -1
  93. package/sdk/tracking.js.map +0 -1
  94. package/sdk/validation.js.map +0 -1
  95. package/slot.js.map +0 -1
  96. package/src/api/evaluate.ts +0 -50
  97. package/src/api/fetchContent.ts +0 -70
  98. package/src/api/index.ts +0 -2
  99. package/src/component.ts +0 -19
  100. package/src/constants.ts +0 -5
  101. package/src/index.ts +0 -6
  102. package/src/playground.ts +0 -247
  103. package/src/plug.ts +0 -429
  104. package/src/plugin.ts +0 -39
  105. package/src/preview.ts +0 -226
  106. package/src/sdk/evaluation.ts +0 -2
  107. package/src/sdk/index.ts +0 -14
  108. package/src/sdk/json.ts +0 -4
  109. package/src/sdk/sdkEvents.ts +0 -1
  110. package/src/sdk/token.ts +0 -1
  111. package/src/sdk/tracking.ts +0 -14
  112. package/src/slot.ts +0 -48
  113. package/src/versioning.ts +0 -38
  114. package/versioning.js.map +0 -1
  115. /package/{src/sdk/apiKey.ts → sdk/apiKey.d.cts} +0 -0
  116. /package/{src/sdk/validation.ts → sdk/validation.d.cts} +0 -0
@@ -0,0 +1,45 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var evaluate_exports = {};
19
+ __export(evaluate_exports, {
20
+ evaluate: () => evaluate
21
+ });
22
+ module.exports = __toCommonJS(evaluate_exports);
23
+ var import_evaluator = require("@croct/sdk/evaluator");
24
+ var import_error = require("@croct/sdk/error");
25
+ function evaluate(query, options) {
26
+ const { baseEndpointUrl, fallback, apiKey, appId, logger, ...evaluation } = options;
27
+ const auth = apiKey !== void 0 ? { apiKey } : { appId };
28
+ const promise = new import_evaluator.Evaluator({ ...auth, baseEndpointUrl }).evaluate(query, evaluation);
29
+ if (fallback !== void 0) {
30
+ return promise.catch(
31
+ (error) => {
32
+ if (logger !== void 0) {
33
+ const reference = query.length > 20 ? `${query.slice(0, 20)}...` : query;
34
+ logger.error(`Failed to evaluate query "${reference}": ${(0, import_error.formatCause)(error)}`);
35
+ }
36
+ return fallback;
37
+ }
38
+ );
39
+ }
40
+ return promise;
41
+ }
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ evaluate
45
+ });
@@ -0,0 +1,23 @@
1
+ import { EvaluationOptions as EvaluationOptions$1 } from '@croct/sdk/evaluator';
2
+ import { ApiKey } from '@croct/sdk/apiKey';
3
+ import { Logger } from '@croct/sdk/logging';
4
+ import { JsonValue } from '@croct/json/mutable';
5
+
6
+ type EvaluationOptions<T extends JsonValue = JsonValue> = EvaluationOptions$1 & AuthOptions & FetchingOptions<T>;
7
+ type FetchingOptions<T extends JsonValue> = {
8
+ baseEndpointUrl?: string;
9
+ fallback?: T;
10
+ logger?: Logger;
11
+ };
12
+ type AuthOptions = ServerSideAuthOptions | ClientSideAuthOptions;
13
+ type ServerSideAuthOptions = {
14
+ apiKey: string | ApiKey;
15
+ appId?: never;
16
+ };
17
+ type ClientSideAuthOptions = {
18
+ appId: string;
19
+ apiKey?: never;
20
+ };
21
+ declare function evaluate<T extends JsonValue>(query: string, options: EvaluationOptions<T>): Promise<T>;
22
+
23
+ export { type EvaluationOptions, evaluate };
package/api/evaluate.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { EvaluationOptions as BaseOptions } from '@croct/sdk/evaluator';
2
- import type { ApiKey } from '@croct/sdk/apiKey';
3
- import type { Logger } from '@croct/sdk/logging';
4
- import { JsonValue } from '../sdk/json';
5
- export type EvaluationOptions<T extends JsonValue = JsonValue> = BaseOptions & AuthOptions & FetchingOptions<T>;
1
+ import { EvaluationOptions as EvaluationOptions$1 } from '@croct/sdk/evaluator';
2
+ import { ApiKey } from '@croct/sdk/apiKey';
3
+ import { Logger } from '@croct/sdk/logging';
4
+ import { JsonValue } from '@croct/json/mutable';
5
+
6
+ type EvaluationOptions<T extends JsonValue = JsonValue> = EvaluationOptions$1 & AuthOptions & FetchingOptions<T>;
6
7
  type FetchingOptions<T extends JsonValue> = {
7
8
  baseEndpointUrl?: string;
8
9
  fallback?: T;
@@ -17,5 +18,6 @@ type ClientSideAuthOptions = {
17
18
  appId: string;
18
19
  apiKey?: never;
19
20
  };
20
- export declare function evaluate<T extends JsonValue>(query: string, options: EvaluationOptions<T>): Promise<T>;
21
- export {};
21
+ declare function evaluate<T extends JsonValue>(query: string, options: EvaluationOptions<T>): Promise<T>;
22
+
23
+ export { type EvaluationOptions, evaluate };
package/api/evaluate.js CHANGED
@@ -1,24 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.evaluate = evaluate;
4
- const evaluator_1 = require("@croct/sdk/evaluator");
5
- const error_1 = require("@croct/sdk/error");
1
+ import { Evaluator } from "@croct/sdk/evaluator";
2
+ import { formatCause } from "@croct/sdk/error";
6
3
  function evaluate(query, options) {
7
- const { baseEndpointUrl, fallback, apiKey, appId, logger, ...evaluation } = options;
8
- const auth = apiKey !== undefined ? { apiKey: apiKey } : { appId: appId };
9
- const promise = (new evaluator_1.Evaluator({ ...auth, baseEndpointUrl: baseEndpointUrl }))
10
- .evaluate(query, evaluation);
11
- if (fallback !== undefined) {
12
- return promise.catch(error => {
13
- if (logger !== undefined) {
14
- const reference = query.length > 20
15
- ? `${query.slice(0, 20)}...`
16
- : query;
17
- logger.error(`Failed to evaluate query "${reference}": ${(0, error_1.formatCause)(error)}`);
18
- }
19
- return fallback;
20
- });
21
- }
22
- return promise;
4
+ const { baseEndpointUrl, fallback, apiKey, appId, logger, ...evaluation } = options;
5
+ const auth = apiKey !== void 0 ? { apiKey } : { appId };
6
+ const promise = new Evaluator({ ...auth, baseEndpointUrl }).evaluate(query, evaluation);
7
+ if (fallback !== void 0) {
8
+ return promise.catch(
9
+ (error) => {
10
+ if (logger !== void 0) {
11
+ const reference = query.length > 20 ? `${query.slice(0, 20)}...` : query;
12
+ logger.error(`Failed to evaluate query "${reference}": ${formatCause(error)}`);
13
+ }
14
+ return fallback;
15
+ }
16
+ );
17
+ }
18
+ return promise;
23
19
  }
24
- //# sourceMappingURL=evaluate.js.map
20
+ export {
21
+ evaluate
22
+ };
@@ -0,0 +1,53 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var fetchContent_exports = {};
19
+ __export(fetchContent_exports, {
20
+ fetchContent: () => fetchContent
21
+ });
22
+ module.exports = __toCommonJS(fetchContent_exports);
23
+ var import_contentFetcher = require("@croct/sdk/contentFetcher");
24
+ var import_error = require("@croct/sdk/error");
25
+ var import_content = require("@croct/content");
26
+ function fetchContent(slotId, options) {
27
+ const { apiKey, appId, fallback, baseEndpointUrl, logger, ...fetchOptions } = options ?? {};
28
+ const auth = { appId, apiKey };
29
+ const [id, version = "latest"] = slotId.split("@");
30
+ const promise = new import_contentFetcher.ContentFetcher({ ...auth, baseEndpointUrl }).fetch(
31
+ id,
32
+ version === "latest" ? fetchOptions : { ...fetchOptions, version }
33
+ );
34
+ return promise.catch(
35
+ async (error) => {
36
+ if (logger !== void 0) {
37
+ logger.error(`Failed to fetch content for slot "${id}@${version}": ${(0, import_error.formatCause)(error)}`);
38
+ }
39
+ if (fallback !== void 0) {
40
+ return { content: fallback };
41
+ }
42
+ const staticContent = await (0, import_content.loadSlotContent)(id, fetchOptions.preferredLocale);
43
+ if (staticContent === null) {
44
+ throw error;
45
+ }
46
+ return { content: staticContent };
47
+ }
48
+ );
49
+ }
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ fetchContent
53
+ });
@@ -0,0 +1,45 @@
1
+ import { DynamicContentOptions as DynamicContentOptions$1, StaticContentOptions as StaticContentOptions$1 } from '@croct/sdk/contentFetcher';
2
+ import { ApiKey } from '@croct/sdk/apiKey';
3
+ import { Logger } from '@croct/sdk/logging';
4
+ import { JsonObject, JsonValue } from '@croct/json/mutable';
5
+ import { FetchResponse } from '../plug.cjs';
6
+ import { SlotContent, VersionedSlotId } from '../slot.cjs';
7
+ import '@croct/sdk/facade/sessionFacade';
8
+ import '@croct/sdk/facade/userFacade';
9
+ import '@croct/sdk/facade/trackerFacade';
10
+ import '@croct/sdk/facade/evaluatorFacade';
11
+ import '@croct/sdk/facade/sdkFacade';
12
+ import '@croct/sdk/utilityTypes';
13
+ import '@croct/sdk/trackingEvents';
14
+ import '@croct/sdk/facade/contentFetcherFacade';
15
+ import '../plugin.cjs';
16
+ import '@croct/sdk/token';
17
+ import '../sdk/index.cjs';
18
+ import '@croct/sdk/eventManager';
19
+ import '@croct/sdk/sdkEvents';
20
+ import '@croct/sdk/tab';
21
+ import '@croct/sdk/cid';
22
+ import '@croct/json';
23
+ import '../versioning.cjs';
24
+ import '../component.cjs';
25
+
26
+ type FetchingOptions<T extends JsonValue> = {
27
+ baseEndpointUrl?: string;
28
+ fallback?: T;
29
+ logger?: Logger;
30
+ };
31
+ type AuthOptions = ServerSideAuthOptions | ClientSideAuthOptions;
32
+ type ServerSideAuthOptions = {
33
+ apiKey: string | ApiKey;
34
+ appId?: never;
35
+ };
36
+ type ClientSideAuthOptions = {
37
+ appId: string;
38
+ apiKey?: never;
39
+ };
40
+ type DynamicContentOptions<T extends JsonObject = JsonObject> = Omit<DynamicContentOptions$1, 'version'> & FetchingOptions<T> & AuthOptions;
41
+ type StaticContentOptions<T extends JsonObject = JsonObject> = Omit<StaticContentOptions$1, 'version'> & FetchingOptions<T> & ServerSideAuthOptions;
42
+ type FetchOptions<T extends JsonObject = SlotContent> = DynamicContentOptions<T> | StaticContentOptions<T>;
43
+ declare function fetchContent<I extends VersionedSlotId, C extends JsonObject>(slotId: I, options?: FetchOptions<SlotContent<I, C>>): Promise<Omit<FetchResponse<I, C>, 'payload'>>;
44
+
45
+ export { type DynamicContentOptions, type FetchOptions, FetchResponse, type StaticContentOptions, fetchContent };
@@ -1,10 +1,28 @@
1
- import { DynamicContentOptions as BaseDynamicOptions, StaticContentOptions as BaseStaticOptions } from '@croct/sdk/contentFetcher';
2
- import type { ApiKey } from '@croct/sdk/apiKey';
3
- import type { Logger } from '@croct/sdk/logging';
4
- import { JsonObject, JsonValue } from '../sdk/json';
5
- import { FetchResponse } from '../plug';
6
- import { SlotContent, VersionedSlotId } from '../slot';
7
- export { FetchResponse } from '../plug';
1
+ import { DynamicContentOptions as DynamicContentOptions$1, StaticContentOptions as StaticContentOptions$1 } from '@croct/sdk/contentFetcher';
2
+ import { ApiKey } from '@croct/sdk/apiKey';
3
+ import { Logger } from '@croct/sdk/logging';
4
+ import { JsonObject, JsonValue } from '@croct/json/mutable';
5
+ import { FetchResponse } from '../plug.js';
6
+ import { SlotContent, VersionedSlotId } from '../slot.js';
7
+ import '@croct/sdk/facade/sessionFacade';
8
+ import '@croct/sdk/facade/userFacade';
9
+ import '@croct/sdk/facade/trackerFacade';
10
+ import '@croct/sdk/facade/evaluatorFacade';
11
+ import '@croct/sdk/facade/sdkFacade';
12
+ import '@croct/sdk/utilityTypes';
13
+ import '@croct/sdk/trackingEvents';
14
+ import '@croct/sdk/facade/contentFetcherFacade';
15
+ import '../plugin.js';
16
+ import '@croct/sdk/token';
17
+ import '../sdk/index.js';
18
+ import '@croct/sdk/eventManager';
19
+ import '@croct/sdk/sdkEvents';
20
+ import '@croct/sdk/tab';
21
+ import '@croct/sdk/cid';
22
+ import '@croct/json';
23
+ import '../versioning.js';
24
+ import '../component.js';
25
+
8
26
  type FetchingOptions<T extends JsonValue> = {
9
27
  baseEndpointUrl?: string;
10
28
  fallback?: T;
@@ -19,7 +37,9 @@ type ClientSideAuthOptions = {
19
37
  appId: string;
20
38
  apiKey?: never;
21
39
  };
22
- export type DynamicContentOptions<T extends JsonObject = JsonObject> = Omit<BaseDynamicOptions, 'version'> & FetchingOptions<T> & AuthOptions;
23
- export type StaticContentOptions<T extends JsonObject = JsonObject> = Omit<BaseStaticOptions, 'version'> & FetchingOptions<T> & ServerSideAuthOptions;
24
- export type FetchOptions<T extends JsonObject = SlotContent> = DynamicContentOptions<T> | StaticContentOptions<T>;
25
- export declare function fetchContent<I extends VersionedSlotId, C extends JsonObject>(slotId: I, options?: FetchOptions<SlotContent<I, C>>): Promise<Omit<FetchResponse<I, C>, 'payload'>>;
40
+ type DynamicContentOptions<T extends JsonObject = JsonObject> = Omit<DynamicContentOptions$1, 'version'> & FetchingOptions<T> & AuthOptions;
41
+ type StaticContentOptions<T extends JsonObject = JsonObject> = Omit<StaticContentOptions$1, 'version'> & FetchingOptions<T> & ServerSideAuthOptions;
42
+ type FetchOptions<T extends JsonObject = SlotContent> = DynamicContentOptions<T> | StaticContentOptions<T>;
43
+ declare function fetchContent<I extends VersionedSlotId, C extends JsonObject>(slotId: I, options?: FetchOptions<SlotContent<I, C>>): Promise<Omit<FetchResponse<I, C>, 'payload'>>;
44
+
45
+ export { type DynamicContentOptions, type FetchOptions, FetchResponse, type StaticContentOptions, fetchContent };
@@ -1,24 +1,32 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchContent = fetchContent;
4
- const contentFetcher_1 = require("@croct/sdk/contentFetcher");
5
- const error_1 = require("@croct/sdk/error");
1
+ import {
2
+ ContentFetcher
3
+ } from "@croct/sdk/contentFetcher";
4
+ import { formatCause } from "@croct/sdk/error";
5
+ import { loadSlotContent } from "@croct/content";
6
6
  function fetchContent(slotId, options) {
7
- const { apiKey, appId, fallback, baseEndpointUrl, logger, ...fetchOptions } = options !== null && options !== void 0 ? options : {};
8
- const auth = { appId: appId, apiKey: apiKey };
9
- const [id, version = 'latest'] = slotId.split('@');
10
- const promise = (new contentFetcher_1.ContentFetcher({ ...auth, baseEndpointUrl: baseEndpointUrl }))
11
- .fetch(id, version === 'latest'
12
- ? fetchOptions
13
- : { ...fetchOptions, version: version });
14
- if (fallback !== undefined) {
15
- return promise.catch(error => {
16
- if (logger !== undefined) {
17
- logger.error(`Failed to fetch content for slot "${id}@${version}": ${(0, error_1.formatCause)(error)}`);
18
- }
19
- return { content: fallback };
20
- });
7
+ const { apiKey, appId, fallback, baseEndpointUrl, logger, ...fetchOptions } = options ?? {};
8
+ const auth = { appId, apiKey };
9
+ const [id, version = "latest"] = slotId.split("@");
10
+ const promise = new ContentFetcher({ ...auth, baseEndpointUrl }).fetch(
11
+ id,
12
+ version === "latest" ? fetchOptions : { ...fetchOptions, version }
13
+ );
14
+ return promise.catch(
15
+ async (error) => {
16
+ if (logger !== void 0) {
17
+ logger.error(`Failed to fetch content for slot "${id}@${version}": ${formatCause(error)}`);
18
+ }
19
+ if (fallback !== void 0) {
20
+ return { content: fallback };
21
+ }
22
+ const staticContent = await loadSlotContent(id, fetchOptions.preferredLocale);
23
+ if (staticContent === null) {
24
+ throw error;
25
+ }
26
+ return { content: staticContent };
21
27
  }
22
- return promise;
28
+ );
23
29
  }
24
- //# sourceMappingURL=fetchContent.js.map
30
+ export {
31
+ fetchContent
32
+ };
package/api/index.cjs ADDED
@@ -0,0 +1,23 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var api_exports = {};
16
+ module.exports = __toCommonJS(api_exports);
17
+ __reExport(api_exports, require('./evaluate.cjs'), module.exports);
18
+ __reExport(api_exports, require('./fetchContent.cjs'), module.exports);
19
+ // Annotate the CommonJS export names for ESM import in node:
20
+ 0 && (module.exports = {
21
+ ...require('./evaluate.cjs'),
22
+ ...require('./fetchContent.cjs')
23
+ });
@@ -0,0 +1,27 @@
1
+ export { EvaluationOptions, evaluate } from './evaluate.cjs';
2
+ export { DynamicContentOptions, FetchOptions, StaticContentOptions, fetchContent } from './fetchContent.cjs';
3
+ export { FetchResponse } from '../plug.cjs';
4
+ import '@croct/sdk/evaluator';
5
+ import '@croct/sdk/apiKey';
6
+ import '@croct/sdk/logging';
7
+ import '@croct/json/mutable';
8
+ import '@croct/sdk/contentFetcher';
9
+ import '../slot.cjs';
10
+ import '@croct/json';
11
+ import '../versioning.cjs';
12
+ import '../component.cjs';
13
+ import '@croct/sdk/facade/sessionFacade';
14
+ import '@croct/sdk/facade/userFacade';
15
+ import '@croct/sdk/facade/trackerFacade';
16
+ import '@croct/sdk/facade/evaluatorFacade';
17
+ import '@croct/sdk/facade/sdkFacade';
18
+ import '@croct/sdk/utilityTypes';
19
+ import '@croct/sdk/trackingEvents';
20
+ import '@croct/sdk/facade/contentFetcherFacade';
21
+ import '../plugin.cjs';
22
+ import '@croct/sdk/token';
23
+ import '../sdk/index.cjs';
24
+ import '@croct/sdk/eventManager';
25
+ import '@croct/sdk/sdkEvents';
26
+ import '@croct/sdk/tab';
27
+ import '@croct/sdk/cid';
package/api/index.d.ts CHANGED
@@ -1,2 +1,27 @@
1
- export * from './evaluate';
2
- export * from './fetchContent';
1
+ export { EvaluationOptions, evaluate } from './evaluate.js';
2
+ export { DynamicContentOptions, FetchOptions, StaticContentOptions, fetchContent } from './fetchContent.js';
3
+ export { FetchResponse } from '../plug.js';
4
+ import '@croct/sdk/evaluator';
5
+ import '@croct/sdk/apiKey';
6
+ import '@croct/sdk/logging';
7
+ import '@croct/json/mutable';
8
+ import '@croct/sdk/contentFetcher';
9
+ import '../slot.js';
10
+ import '@croct/json';
11
+ import '../versioning.js';
12
+ import '../component.js';
13
+ import '@croct/sdk/facade/sessionFacade';
14
+ import '@croct/sdk/facade/userFacade';
15
+ import '@croct/sdk/facade/trackerFacade';
16
+ import '@croct/sdk/facade/evaluatorFacade';
17
+ import '@croct/sdk/facade/sdkFacade';
18
+ import '@croct/sdk/utilityTypes';
19
+ import '@croct/sdk/trackingEvents';
20
+ import '@croct/sdk/facade/contentFetcherFacade';
21
+ import '../plugin.js';
22
+ import '@croct/sdk/token';
23
+ import '../sdk/index.js';
24
+ import '@croct/sdk/eventManager';
25
+ import '@croct/sdk/sdkEvents';
26
+ import '@croct/sdk/tab';
27
+ import '@croct/sdk/cid';
package/api/index.js CHANGED
@@ -1,6 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./evaluate"), exports);
5
- tslib_1.__exportStar(require("./fetchContent"), exports);
6
- //# sourceMappingURL=index.js.map
1
+ export * from "./evaluate.js";
2
+ export * from "./fetchContent.js";
package/component.cjs ADDED
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var component_exports = {};
15
+ module.exports = __toCommonJS(component_exports);
@@ -0,0 +1,19 @@
1
+ import { Version, CanonicalVersionId, VersionedId, Versioned } from './versioning.cjs';
2
+ import '@croct/json';
3
+
4
+ interface ComponentMap {
5
+ }
6
+ type LatestComponentVersionMap = {
7
+ [K in keyof ComponentMap]: {
8
+ latest: ComponentMap[K];
9
+ };
10
+ };
11
+ interface VersionedComponentMap extends LatestComponentVersionMap {
12
+ }
13
+ type ComponentId = keyof VersionedComponentMap extends never ? string : keyof VersionedComponentMap;
14
+ type ComponentVersion<I extends ComponentId> = Version<VersionedComponentMap, I>;
15
+ type ComponentVersionId<I extends ComponentId = ComponentId> = CanonicalVersionId<I, VersionedComponentMap>;
16
+ type VersionedComponentId<I extends ComponentId = ComponentId> = VersionedId<I, VersionedComponentMap>;
17
+ type ComponentContent<I extends VersionedComponentId> = Versioned<I, VersionedComponentMap>;
18
+
19
+ export type { ComponentContent, ComponentId, ComponentMap, ComponentVersion, ComponentVersionId, VersionedComponentId, VersionedComponentMap };
package/component.d.ts CHANGED
@@ -1,16 +1,19 @@
1
- import { CanonicalVersionId, Version, Versioned, VersionedId } from './versioning';
2
- export interface ComponentMap {
1
+ import { Version, CanonicalVersionId, VersionedId, Versioned } from './versioning.js';
2
+ import '@croct/json';
3
+
4
+ interface ComponentMap {
3
5
  }
4
6
  type LatestComponentVersionMap = {
5
7
  [K in keyof ComponentMap]: {
6
8
  latest: ComponentMap[K];
7
9
  };
8
10
  };
9
- export interface VersionedComponentMap extends LatestComponentVersionMap {
11
+ interface VersionedComponentMap extends LatestComponentVersionMap {
10
12
  }
11
- export type ComponentId = keyof VersionedComponentMap extends never ? string : keyof VersionedComponentMap;
12
- export type ComponentVersion<I extends ComponentId> = Version<VersionedComponentMap, I>;
13
- export type ComponentVersionId<I extends ComponentId = ComponentId> = CanonicalVersionId<I, VersionedComponentMap>;
14
- export type VersionedComponentId<I extends ComponentId = ComponentId> = VersionedId<I, VersionedComponentMap>;
15
- export type ComponentContent<I extends VersionedComponentId> = Versioned<I, VersionedComponentMap>;
16
- export {};
13
+ type ComponentId = keyof VersionedComponentMap extends never ? string : keyof VersionedComponentMap;
14
+ type ComponentVersion<I extends ComponentId> = Version<VersionedComponentMap, I>;
15
+ type ComponentVersionId<I extends ComponentId = ComponentId> = CanonicalVersionId<I, VersionedComponentMap>;
16
+ type VersionedComponentId<I extends ComponentId = ComponentId> = VersionedId<I, VersionedComponentMap>;
17
+ type ComponentContent<I extends VersionedComponentId> = Versioned<I, VersionedComponentMap>;
18
+
19
+ export type { ComponentContent, ComponentId, ComponentMap, ComponentVersion, ComponentVersionId, VersionedComponentId, VersionedComponentMap };
package/component.js CHANGED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=component.js.map
package/constants.cjs ADDED
@@ -0,0 +1,39 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var constants_exports = {};
19
+ __export(constants_exports, {
20
+ CDN_URL: () => CDN_URL,
21
+ PLAYGROUND_CONNECT_URL: () => PLAYGROUND_CONNECT_URL,
22
+ PLAYGROUND_ORIGIN: () => PLAYGROUND_ORIGIN,
23
+ PREVIEW_WIDGET_ORIGIN: () => PREVIEW_WIDGET_ORIGIN,
24
+ PREVIEW_WIDGET_URL: () => PREVIEW_WIDGET_URL
25
+ });
26
+ module.exports = __toCommonJS(constants_exports);
27
+ const CDN_URL = "https://cdn.croct.io/js/v1/lib/plug.js";
28
+ const PLAYGROUND_ORIGIN = "https://play.croct.com";
29
+ const PLAYGROUND_CONNECT_URL = "https://play.croct.com/connect.html";
30
+ const PREVIEW_WIDGET_ORIGIN = "https://cdn.croct.io";
31
+ const PREVIEW_WIDGET_URL = "https://cdn.croct.io/js/v1/lib/plug/widget-0.17.0.html";
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ CDN_URL,
35
+ PLAYGROUND_CONNECT_URL,
36
+ PLAYGROUND_ORIGIN,
37
+ PREVIEW_WIDGET_ORIGIN,
38
+ PREVIEW_WIDGET_URL
39
+ });
@@ -0,0 +1,7 @@
1
+ declare const CDN_URL = "https://cdn.croct.io/js/v1/lib/plug.js";
2
+ declare const PLAYGROUND_ORIGIN = "https://play.croct.com";
3
+ declare const PLAYGROUND_CONNECT_URL = "https://play.croct.com/connect.html";
4
+ declare const PREVIEW_WIDGET_ORIGIN = "https://cdn.croct.io";
5
+ declare const PREVIEW_WIDGET_URL = "https://cdn.croct.io/js/v1/lib/plug/widget-0.17.0.html";
6
+
7
+ export { CDN_URL, PLAYGROUND_CONNECT_URL, PLAYGROUND_ORIGIN, PREVIEW_WIDGET_ORIGIN, PREVIEW_WIDGET_URL };
package/constants.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- export declare const CDN_URL = "https://cdn.croct.io/js/v1/lib/plug.js";
2
- export declare const PLAYGROUND_ORIGIN = "https://play.croct.com";
3
- export declare const PLAYGROUND_CONNECT_URL = "https://play.croct.com/connect.html";
4
- export declare const PREVIEW_WIDGET_ORIGIN = "https://cdn.croct.io";
5
- export declare const PREVIEW_WIDGET_URL = "https://cdn.croct.io/js/v1/lib/plug/widget-0.16.5.html";
1
+ declare const CDN_URL = "https://cdn.croct.io/js/v1/lib/plug.js";
2
+ declare const PLAYGROUND_ORIGIN = "https://play.croct.com";
3
+ declare const PLAYGROUND_CONNECT_URL = "https://play.croct.com/connect.html";
4
+ declare const PREVIEW_WIDGET_ORIGIN = "https://cdn.croct.io";
5
+ declare const PREVIEW_WIDGET_URL = "https://cdn.croct.io/js/v1/lib/plug/widget-0.17.0.html";
6
+
7
+ export { CDN_URL, PLAYGROUND_CONNECT_URL, PLAYGROUND_ORIGIN, PREVIEW_WIDGET_ORIGIN, PREVIEW_WIDGET_URL };
package/constants.js CHANGED
@@ -1,9 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PREVIEW_WIDGET_URL = exports.PREVIEW_WIDGET_ORIGIN = exports.PLAYGROUND_CONNECT_URL = exports.PLAYGROUND_ORIGIN = exports.CDN_URL = void 0;
4
- exports.CDN_URL = 'https://cdn.croct.io/js/v1/lib/plug.js';
5
- exports.PLAYGROUND_ORIGIN = 'https://play.croct.com';
6
- exports.PLAYGROUND_CONNECT_URL = 'https://play.croct.com/connect.html';
7
- exports.PREVIEW_WIDGET_ORIGIN = 'https://cdn.croct.io';
8
- exports.PREVIEW_WIDGET_URL = 'https://cdn.croct.io/js/v1/lib/plug/widget-0.16.5.html';
9
- //# sourceMappingURL=constants.js.map
1
+ const CDN_URL = "https://cdn.croct.io/js/v1/lib/plug.js";
2
+ const PLAYGROUND_ORIGIN = "https://play.croct.com";
3
+ const PLAYGROUND_CONNECT_URL = "https://play.croct.com/connect.html";
4
+ const PREVIEW_WIDGET_ORIGIN = "https://cdn.croct.io";
5
+ const PREVIEW_WIDGET_URL = "https://cdn.croct.io/js/v1/lib/plug/widget-0.17.0.html";
6
+ export {
7
+ CDN_URL,
8
+ PLAYGROUND_CONNECT_URL,
9
+ PLAYGROUND_ORIGIN,
10
+ PREVIEW_WIDGET_ORIGIN,
11
+ PREVIEW_WIDGET_URL
12
+ };
package/index.cjs ADDED
@@ -0,0 +1,24 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var index_exports = {};
19
+ __export(index_exports, {
20
+ default: () => index_default
21
+ });
22
+ module.exports = __toCommonJS(index_exports);
23
+ var import_plug = require('./plug.cjs');
24
+ var index_default = new import_plug.GlobalPlug();