@localess/js-client 0.3.2-next.20250108-112722.0 → 0.3.2-next.20250109-090340.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 (93) hide show
  1. package/dist/index.d.mts +272 -0
  2. package/dist/index.d.ts +260 -9
  3. package/dist/index.js +215 -5
  4. package/dist/index.mjs +186 -0
  5. package/package.json +8 -11
  6. package/dist/cjs/client.d.ts +0 -88
  7. package/dist/cjs/client.js +0 -165
  8. package/dist/cjs/client.js.map +0 -1
  9. package/dist/cjs/editable.d.ts +0 -5
  10. package/dist/cjs/editable.js +0 -11
  11. package/dist/cjs/editable.js.map +0 -1
  12. package/dist/cjs/index.d.ts +0 -21
  13. package/dist/cjs/index.js +0 -21
  14. package/dist/cjs/index.js.map +0 -1
  15. package/dist/cjs/models/content-asset.d.ts +0 -13
  16. package/dist/cjs/models/content-asset.js +0 -3
  17. package/dist/cjs/models/content-asset.js.map +0 -1
  18. package/dist/cjs/models/content-data.d.ts +0 -27
  19. package/dist/cjs/models/content-data.js +0 -3
  20. package/dist/cjs/models/content-data.js.map +0 -1
  21. package/dist/cjs/models/content-link.d.ts +0 -21
  22. package/dist/cjs/models/content-link.js +0 -3
  23. package/dist/cjs/models/content-link.js.map +0 -1
  24. package/dist/cjs/models/content-metadata.d.ts +0 -41
  25. package/dist/cjs/models/content-metadata.js +0 -3
  26. package/dist/cjs/models/content-metadata.js.map +0 -1
  27. package/dist/cjs/models/content-reference.d.ts +0 -13
  28. package/dist/cjs/models/content-reference.js +0 -3
  29. package/dist/cjs/models/content-reference.js.map +0 -1
  30. package/dist/cjs/models/content-rich-text.d.ts +0 -13
  31. package/dist/cjs/models/content-rich-text.js +0 -3
  32. package/dist/cjs/models/content-rich-text.js.map +0 -1
  33. package/dist/cjs/models/content.d.ts +0 -11
  34. package/dist/cjs/models/content.js +0 -3
  35. package/dist/cjs/models/content.js.map +0 -1
  36. package/dist/cjs/models/index.d.ts +0 -9
  37. package/dist/cjs/models/index.js +0 -26
  38. package/dist/cjs/models/index.js.map +0 -1
  39. package/dist/cjs/models/links.d.ts +0 -7
  40. package/dist/cjs/models/links.js +0 -3
  41. package/dist/cjs/models/links.js.map +0 -1
  42. package/dist/cjs/models/translations.d.ts +0 -6
  43. package/dist/cjs/models/translations.js +0 -3
  44. package/dist/cjs/models/translations.js.map +0 -1
  45. package/dist/cjs/sync.d.ts +0 -6
  46. package/dist/cjs/sync.js +0 -32
  47. package/dist/cjs/sync.js.map +0 -1
  48. package/dist/cjs/utils.d.ts +0 -40
  49. package/dist/cjs/utils.js +0 -51
  50. package/dist/cjs/utils.js.map +0 -1
  51. package/dist/client.d.ts +0 -88
  52. package/dist/client.js +0 -161
  53. package/dist/client.js.map +0 -1
  54. package/dist/editable.d.ts +0 -5
  55. package/dist/editable.js +0 -7
  56. package/dist/editable.js.map +0 -1
  57. package/dist/index.js.map +0 -1
  58. package/dist/models/content-asset.d.ts +0 -13
  59. package/dist/models/content-asset.js +0 -2
  60. package/dist/models/content-asset.js.map +0 -1
  61. package/dist/models/content-data.d.ts +0 -27
  62. package/dist/models/content-data.js +0 -2
  63. package/dist/models/content-data.js.map +0 -1
  64. package/dist/models/content-link.d.ts +0 -21
  65. package/dist/models/content-link.js +0 -2
  66. package/dist/models/content-link.js.map +0 -1
  67. package/dist/models/content-metadata.d.ts +0 -41
  68. package/dist/models/content-metadata.js +0 -2
  69. package/dist/models/content-metadata.js.map +0 -1
  70. package/dist/models/content-reference.d.ts +0 -13
  71. package/dist/models/content-reference.js +0 -2
  72. package/dist/models/content-reference.js.map +0 -1
  73. package/dist/models/content-rich-text.d.ts +0 -13
  74. package/dist/models/content-rich-text.js +0 -2
  75. package/dist/models/content-rich-text.js.map +0 -1
  76. package/dist/models/content.d.ts +0 -11
  77. package/dist/models/content.js +0 -2
  78. package/dist/models/content.js.map +0 -1
  79. package/dist/models/index.d.ts +0 -9
  80. package/dist/models/index.js +0 -10
  81. package/dist/models/index.js.map +0 -1
  82. package/dist/models/links.d.ts +0 -7
  83. package/dist/models/links.js +0 -2
  84. package/dist/models/links.js.map +0 -1
  85. package/dist/models/translations.d.ts +0 -6
  86. package/dist/models/translations.js +0 -2
  87. package/dist/models/translations.js.map +0 -1
  88. package/dist/sync.d.ts +0 -6
  89. package/dist/sync.js +0 -28
  90. package/dist/sync.js.map +0 -1
  91. package/dist/utils.d.ts +0 -40
  92. package/dist/utils.js +0 -47
  93. package/dist/utils.js.map +0 -1
@@ -1,165 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.localessClient = void 0;
4
- const utils_1 = require("./utils");
5
- const LOG_GROUP = `${utils_1.FG_BLUE}[Localess:Client]${utils_1.RESET}`;
6
- /**
7
- * Create a Localess API Client
8
- * @param {LocalessClientOptions} options connection details
9
- */
10
- function localessClient(options) {
11
- if (options.debug) {
12
- console.log(LOG_GROUP, 'Client Options : ', options);
13
- }
14
- const fetchOptions = {
15
- redirect: 'follow',
16
- headers: {
17
- 'Content-Type': 'application/json',
18
- 'Accept': 'application/json',
19
- 'X-Localess-Agent': 'Localess-JS-Client',
20
- 'X-Localess-Agent-Version': '0.3.0'
21
- }
22
- };
23
- return {
24
- /**
25
- * Get all links
26
- * @param params{LinksFetchParams} - Fetch parameters
27
- * @returns {Promise<Links>}
28
- */
29
- async getLinks(params) {
30
- if (options.debug) {
31
- console.log(LOG_GROUP, 'getLinks() params : ' + params);
32
- }
33
- let kind = '';
34
- if (params?.kind) {
35
- kind = `&kind=${params.kind}`;
36
- }
37
- let parentSlug = '';
38
- if (params?.parentSlug) {
39
- parentSlug = `&parentSlug=${params.parentSlug}`;
40
- }
41
- let excludeChildren = '';
42
- if (params?.excludeChildren) {
43
- excludeChildren = `&excludeChildren=${params.excludeChildren}`;
44
- }
45
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/links?token=${options.token}${kind}${parentSlug}${excludeChildren}`;
46
- if (options.debug) {
47
- console.log(LOG_GROUP, 'getLinks fetch url : ', url);
48
- }
49
- try {
50
- const response = await fetch(url, fetchOptions);
51
- if (options.debug) {
52
- console.log(LOG_GROUP, 'getLinks status : ', response.status);
53
- }
54
- const data = await response.json();
55
- return data;
56
- }
57
- catch (error) {
58
- console.error(LOG_GROUP, 'getLinks error : ', error);
59
- return {};
60
- }
61
- },
62
- /**
63
- * Get content by SLUG
64
- * @param slug{string} - Content SLUG
65
- * @param params{ContentFetchParams} - Fetch parameters
66
- * @returns {Promise<Content>}
67
- */
68
- async getContentBySlug(slug, params) {
69
- if (options.debug) {
70
- console.log(LOG_GROUP, 'getContentBySlug() slug : ', slug);
71
- console.log(LOG_GROUP, 'getContentBySlug() params : ', params);
72
- }
73
- let version = '';
74
- // Options
75
- if (options?.version && options.version == 'draft') {
76
- version = `&version=${options.version}`;
77
- }
78
- // Params
79
- if (params?.version && params.version == 'draft') {
80
- version = `&version=${params.version}`;
81
- }
82
- const locale = params?.locale ? `&locale=${params.locale}` : '';
83
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/contents/slugs/${slug}?token=${options.token}${version}${locale}`;
84
- if (options.debug) {
85
- console.log(LOG_GROUP, 'getContentBySlug fetch url : ', url);
86
- }
87
- try {
88
- const response = await fetch(url, fetchOptions);
89
- if (options.debug) {
90
- console.log(LOG_GROUP, 'getContentBySlug status : ', response.status);
91
- }
92
- const data = await response.json();
93
- return data;
94
- }
95
- catch (error) {
96
- console.error(LOG_GROUP, 'getContentBySlug error : ', error);
97
- return {};
98
- }
99
- },
100
- /**
101
- * Get content by ID
102
- * @param id{string} - Content ID
103
- * @param params{ContentFetchParams} - Fetch parameters
104
- * @returns {Promise<Content>}
105
- */
106
- async getContentById(id, params) {
107
- if (options.debug) {
108
- console.log(LOG_GROUP, 'getContentById() id : ', id);
109
- console.log(LOG_GROUP, 'getContentById() params : ', params);
110
- }
111
- let version = '';
112
- // Options
113
- if (options?.version && options.version == 'draft') {
114
- version = `&version=${options.version}`;
115
- }
116
- // Params
117
- if (params?.version && params.version == 'draft') {
118
- version = `&version=${params.version}`;
119
- }
120
- const locale = params?.locale ? `&locale=${params.locale}` : '';
121
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/contents/${id}?token=${options.token}${version}${locale}`;
122
- if (options.debug) {
123
- console.log(LOG_GROUP, 'getContentById fetch url : ', url);
124
- }
125
- const response = await fetch(url, fetchOptions);
126
- if (options.debug) {
127
- console.log(LOG_GROUP, 'getContentById status : ', response.status);
128
- }
129
- const data = await response.json();
130
- return data;
131
- },
132
- /**
133
- * Get translations for the given locale
134
- * @param locale{string} - Locale identifier (ISO 639-1)
135
- */
136
- async getTranslations(locale) {
137
- if (options.debug) {
138
- console.log(LOG_GROUP, 'getTranslations() locale : ', locale);
139
- }
140
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/translations/${locale}`;
141
- if (options.debug) {
142
- console.log(LOG_GROUP, 'getTranslations fetch url : ', url);
143
- }
144
- const response = await fetch(url, fetchOptions);
145
- if (options.debug) {
146
- console.log(LOG_GROUP, 'getTranslations status : ', response.status);
147
- }
148
- const data = await response.json();
149
- return data;
150
- },
151
- syncScriptUrl() {
152
- return `${options.origin}/scripts/sync-v1.js`;
153
- },
154
- assetLink(asset) {
155
- if (typeof asset === 'string') {
156
- return `${options.origin}/api/v1/spaces/${options.spaceId}/assets/${asset}`;
157
- }
158
- else {
159
- return `${options.origin}/api/v1/spaces/${options.spaceId}/assets/${asset.uri}`;
160
- }
161
- }
162
- };
163
- }
164
- exports.localessClient = localessClient;
165
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;AAAA,mCAAuC;AA4DvC,MAAM,SAAS,GAAG,GAAG,eAAO,oBAAoB,aAAK,EAAE,CAAA;AAEvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,OAA8B;IAC3D,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,SA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KAAK,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;YAC/C,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;gBAClB,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,2BAA2B,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;YACvE,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,OAAO,IAAoB,CAAC;QAC9B,CAAC;QAED,aAAa;YACX,OAAO,GAAG,OAAO,CAAC,MAAM,qBAAqB,CAAA;QAC/C,CAAC;QAED,SAAS,CAAC,KAA4B;YACpC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,OAAO,GAAG,OAAO,CAAC,MAAM,kBAAkB,OAAO,CAAC,OAAO,WAAW,KAAK,EAAE,CAAC;YAC9E,CAAC;iBAAM,CAAC;gBACN,OAAO,GAAG,OAAO,CAAC,MAAM,kBAAkB,OAAO,CAAC,OAAO,WAAW,KAAK,CAAC,GAAG,EAAE,CAAC;YAClF,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC;AA7JD,wCA6JC"}
@@ -1,5 +0,0 @@
1
- import { ContentDataSchema } from "./models";
2
- export declare function llEditable(content: ContentDataSchema): {
3
- 'data-ll-id': string;
4
- 'data-ll-schema': string;
5
- };
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.llEditable = void 0;
4
- function llEditable(content) {
5
- return {
6
- 'data-ll-id': content._id,
7
- 'data-ll-schema': content.schema,
8
- };
9
- }
10
- exports.llEditable = llEditable;
11
- //# sourceMappingURL=editable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"editable.js","sourceRoot":"","sources":["../../src/editable.ts"],"names":[],"mappings":";;;AAEA,SAAgB,UAAU,CAAC,OAA0B;IACnD,OAAO;QACL,YAAY,EAAE,OAAO,CAAC,GAAG;QACzB,gBAAgB,EAAE,OAAO,CAAC,MAAM;KACjC,CAAA;AACH,CAAC;AALD,gCAKC"}
@@ -1,21 +0,0 @@
1
- import { ContentData } from "./models";
2
- export * from './models';
3
- export * from './client';
4
- export * from './editable';
5
- export * from './sync';
6
- export type EventType = 'input' | 'save' | 'publish' | 'change';
7
- export type EventCallback = (event: EventToApp) => void;
8
- export type EventToApp = {
9
- type: 'save' | 'publish';
10
- } | {
11
- type: 'input' | 'change';
12
- data: ContentData;
13
- };
14
- export interface LocalessSync {
15
- on: (event: EventType | EventType[], callback: EventCallback) => void;
16
- }
17
- declare global {
18
- interface Window {
19
- localess?: LocalessSync;
20
- }
21
- }
package/dist/cjs/index.js DELETED
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./models"), exports);
18
- __exportStar(require("./client"), exports);
19
- __exportStar(require("./editable"), exports);
20
- __exportStar(require("./sync"), exports);
21
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,2CAAyB;AACzB,2CAAyB;AACzB,6CAA2B;AAC3B,yCAAuB"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Content Asset define reference to a Asset.
3
- */
4
- export interface ContentAsset {
5
- /**
6
- * Define the type of Asset
7
- */
8
- kind: 'ASSET';
9
- /**
10
- * Unique identifier for the asset.
11
- */
12
- uri: string;
13
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=content-asset.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-asset.js","sourceRoot":"","sources":["../../../src/models/content-asset.ts"],"names":[],"mappings":""}
@@ -1,27 +0,0 @@
1
- import { ContentAsset } from "./content-asset";
2
- import { ContentLink } from "./content-link";
3
- import { ContentRichText } from "./content-rich-text";
4
- import { ContentReference } from "./content-reference";
5
- export type ContentDataField = any | string | string[] | number | boolean | ContentLink | ContentRichText | ContentData | ContentData[] | ContentAsset | ContentAsset[] | ContentReference | ContentReference[];
6
- /**
7
- * Content Data Schema related information.
8
- */
9
- export interface ContentDataSchema {
10
- /**
11
- * Unique identifier of a component in a content.
12
- */
13
- _id: string;
14
- /**
15
- * Unique identifier for the Schema object.
16
- */
17
- schema: string;
18
- }
19
- /**
20
- * ContentData defined Object to connect all possible root Schemas.
21
- */
22
- export interface ContentData extends ContentDataSchema {
23
- /**
24
- * Other Schema specific fields
25
- */
26
- [field: string]: ContentDataField | undefined;
27
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=content-data.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-data.js","sourceRoot":"","sources":["../../../src/models/content-data.ts"],"names":[],"mappings":""}
@@ -1,21 +0,0 @@
1
- /**
2
- * Content Link define reference to a Link.
3
- */
4
- export interface ContentLink {
5
- /**
6
- * Define the type of Link
7
- */
8
- kind: 'LINK';
9
- /**
10
- * Define the target of the link. _blank for new tab and _self for same tab.
11
- */
12
- target: '_blank' | '_self';
13
- /**
14
- * Define the type of Link. URL for external links and Content for internal links.
15
- */
16
- type: 'url' | 'content';
17
- /**
18
- * If type is content, then it will be Content ID. Otherwise it will be URL.
19
- */
20
- uri: string;
21
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=content-link.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-link.js","sourceRoot":"","sources":["../../../src/models/content-link.ts"],"names":[],"mappings":""}
@@ -1,41 +0,0 @@
1
- /**
2
- * Content Metadata define short information about a Content for navigation reason.
3
- */
4
- export interface ContentMetadata {
5
- /**
6
- * Date and Time at which the Content was created.
7
- */
8
- createdAt: string;
9
- /**
10
- * Combination of SLUG and Parent SLUG of the Content
11
- */
12
- fullSlug: string;
13
- /**
14
- * Unique identifier for the object.
15
- */
16
- id: string;
17
- /**
18
- * Define the type of Content, whether it is a FOLDER or DOCUMENT.
19
- */
20
- kind: 'FOLDER' | 'DOCUMENT';
21
- /**
22
- * Name of the Content
23
- */
24
- name: string;
25
- /**
26
- * Parent SLUG of the Content
27
- */
28
- parentSlug: string;
29
- /**
30
- * Date and Time at which the Content was published.
31
- */
32
- publishedAt?: string;
33
- /**
34
- * SLUG of the Content
35
- */
36
- slug: string;
37
- /**
38
- * Date and Time at which the Content was updated.
39
- */
40
- updatedAt: string;
41
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=content-metadata.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-metadata.js","sourceRoot":"","sources":["../../../src/models/content-metadata.ts"],"names":[],"mappings":""}
@@ -1,13 +0,0 @@
1
- /**
2
- * Content Reference define reference to a Content.
3
- */
4
- export interface ContentReference {
5
- /**
6
- * Define the type of REFERENCE
7
- */
8
- kind: 'REFERENCE';
9
- /**
10
- * Unique identifier for the Content Document.
11
- */
12
- uri: string;
13
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=content-reference.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-reference.js","sourceRoot":"","sources":["../../../src/models/content-reference.ts"],"names":[],"mappings":""}
@@ -1,13 +0,0 @@
1
- /**
2
- * Content RichText define content as JSON Object.
3
- */
4
- export interface ContentRichText {
5
- /**
6
- * Define the type of Content Node
7
- */
8
- type?: string;
9
- /**
10
- * List of Content Nodes
11
- */
12
- content?: ContentRichText[];
13
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=content-rich-text.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-rich-text.js","sourceRoot":"","sources":["../../../src/models/content-rich-text.ts"],"names":[],"mappings":""}
@@ -1,11 +0,0 @@
1
- import { ContentData } from './content-data';
2
- import { ContentMetadata } from "./content-metadata";
3
- /**
4
- * Content define shared object for all possible Content Types.
5
- */
6
- export interface Content extends ContentMetadata {
7
- /**
8
- * Content Data
9
- */
10
- data?: ContentData;
11
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=content.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content.js","sourceRoot":"","sources":["../../../src/models/content.ts"],"names":[],"mappings":""}
@@ -1,9 +0,0 @@
1
- export * from './content';
2
- export * from './content-asset';
3
- export * from './content-data';
4
- export * from './content-link';
5
- export * from './content-metadata';
6
- export * from './content-reference';
7
- export * from './content-rich-text';
8
- export * from './links';
9
- export * from './translations';
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./content"), exports);
18
- __exportStar(require("./content-asset"), exports);
19
- __exportStar(require("./content-data"), exports);
20
- __exportStar(require("./content-link"), exports);
21
- __exportStar(require("./content-metadata"), exports);
22
- __exportStar(require("./content-reference"), exports);
23
- __exportStar(require("./content-rich-text"), exports);
24
- __exportStar(require("./links"), exports);
25
- __exportStar(require("./translations"), exports);
26
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,kDAAgC;AAChC,iDAA+B;AAC/B,iDAA+B;AAC/B,qDAAmC;AACnC,sDAAoC;AACpC,sDAAoC;AACpC,0CAAwB;AACxB,iDAA+B"}
@@ -1,7 +0,0 @@
1
- import { ContentMetadata } from './content-metadata';
2
- /**
3
- * Key-Value Object. Where Key is Unique identifier for the Content object and Value is Content Metadata.
4
- */
5
- export interface Links {
6
- [key: string]: ContentMetadata;
7
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=links.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"links.js","sourceRoot":"","sources":["../../../src/models/links.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- /**
2
- * Key-Value Object. Where Key is Translation ID and Value is Translated Content
3
- */
4
- export interface Translations {
5
- [key: string]: string;
6
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=translations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"translations.js","sourceRoot":"","sources":["../../../src/models/translations.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- /**
2
- * Inject Localess Sync Script in Header
3
- * @param {string} origin A fully qualified domain name with protocol (http/https) and port.
4
- * @param {boolean} force Force Script Injection even if the application is not in Visual Editor.
5
- */
6
- export declare function loadLocalessSync(origin: string, force?: boolean): void;
package/dist/cjs/sync.js DELETED
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadLocalessSync = void 0;
4
- const JS_SYNC_ID = 'localess-js-sync';
5
- /**
6
- * Inject Localess Sync Script in Header
7
- * @param {string} origin A fully qualified domain name with protocol (http/https) and port.
8
- * @param {boolean} force Force Script Injection even if the application is not in Visual Editor.
9
- */
10
- function loadLocalessSync(origin, force = false) {
11
- const isServer = typeof window === 'undefined';
12
- if (isServer)
13
- return; // Skip Server Injection
14
- if (window.top === window.self)
15
- return; // Skip if the page is not loaded in Visual Editor
16
- const isSyncLoaded = typeof window.localess !== 'undefined';
17
- if (isSyncLoaded)
18
- return; // Skip if Sync is already loaded
19
- const scriptEl = document.getElementById(JS_SYNC_ID);
20
- if (scriptEl)
21
- return; // Skip if script is already loaded
22
- const script = document.createElement('script');
23
- script.id = JS_SYNC_ID;
24
- script.type = 'text/javascript';
25
- script.src = `${origin}/scripts/sync-v1.js`;
26
- script.async = true;
27
- script.onerror = (error) => console.error(error);
28
- script.onload = (event) => console.info('Localess Sync Script loaded');
29
- document.head.appendChild(script);
30
- }
31
- exports.loadLocalessSync = loadLocalessSync;
32
- //# sourceMappingURL=sync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/sync.ts"],"names":[],"mappings":";;;AAAA,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAEtC;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,MAAc,EAAE,QAAiB,KAAK;IACrE,MAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;IAC/C,IAAI,QAAQ;QAAE,OAAO,CAAC,wBAAwB;IAC9C,IAAI,MAAM,CAAC,GAAG,KAAK,MAAM,CAAC,IAAI;QAAE,OAAO,CAAC,kDAAkD;IAC1F,MAAM,YAAY,GAAG,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC;IAC5D,IAAI,YAAY;QAAE,OAAO,CAAC,iCAAiC;IAC3D,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IACrD,IAAI,QAAQ;QAAE,OAAO,CAAC,mCAAmC;IACzD,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,CAAC,EAAE,GAAG,UAAU,CAAC;IACvB,MAAM,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,MAAM,CAAC,GAAG,GAAG,GAAG,MAAM,qBAAqB,CAAA;IAC3C,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;IAEpB,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,MAAM,CAAC,MAAM,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;IAEvE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC;AAlBD,4CAkBC"}
@@ -1,40 +0,0 @@
1
- export declare function proxyURIFromEnv(): string | undefined;
2
- export declare const RESET = "\u001B[0m";
3
- export declare const BRIGHT = "\u001B[1m";
4
- export declare const DIM = "\u001B[2m";
5
- export declare const UNDERSCORE = "\u001B[4m";
6
- export declare const BLINK = "\u001B[5m";
7
- export declare const REVERSE = "\u001B[7m";
8
- export declare const HIDDEN = "\u001B[8m";
9
- export declare const FG_BLACK = "\u001B[30m";
10
- export declare const FG_RED = "\u001B[31m";
11
- export declare const FG_GREEN = "\u001B[32m";
12
- export declare const FG_YELLOW = "\u001B[33m";
13
- export declare const FG_BLUE = "\u001B[34m";
14
- export declare const FG_MAGENTA = "\u001B[35m";
15
- export declare const FG_CYAN = "\u001B[36m";
16
- export declare const FG_WHITE = "\u001B[37m";
17
- export declare const FG_GRAY = "\u001B[90m";
18
- export declare const FG_BRIGHT_RED = "\u001B[91m";
19
- export declare const FG_BRIGHT_GREEN = "\u001B[92m";
20
- export declare const FG_BRIGHT_YELLOW = "\u001B[93m";
21
- export declare const FG_BRIGHT_BLUE = "\u001B[94m";
22
- export declare const FG_BRIGHT_MAGENTA = "\u001B[95m";
23
- export declare const FG_BRIGHT_CYAN = "\u001B[96m";
24
- export declare const FG_BRIGHT_WHITE = "\u001B[97m";
25
- export declare const BG_BLACK = "\u001B[40m";
26
- export declare const BG_RED = "\u001B[41m";
27
- export declare const BG_GREEN = "\u001B[42m";
28
- export declare const BG_YELLOW = "\u001B[43m";
29
- export declare const BG_BLUE = "\u001B[44m";
30
- export declare const BG_MAGENTA = "\u001B[45m";
31
- export declare const BG_CYAN = "\u001B[46m";
32
- export declare const BG_WHITE = "\u001B[47m";
33
- export declare const BG_GRAY = "\u001B[100m";
34
- export declare const BG_BRIGHT_RED = "\u001B[101m";
35
- export declare const BG_BRIGHT_GREEN = "\u001B[102m";
36
- export declare const BG_BRIGHT_YELLOW = "\u001B[103m";
37
- export declare const BG_BRIGHT_BLUE = "\u001B[104m";
38
- export declare const BG_BRIGHT_MAGENTA = "\u001B[105m";
39
- export declare const BG_BRIGHT_CYAN = "\u001B[106m";
40
- export declare const BG_BRIGHT_WHITE = "\u001B[107m";