@embeddable.com/sdk-core 4.3.3 → 4.4.0-next.1
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/lib/defineConfig.d.ts +10 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.esm.js +44 -10
- package/lib/index.esm.js.map +1 -1
- package/lib/push.d.ts +1 -0
- package/package.json +1 -1
- package/src/defineConfig.test.ts +1 -0
- package/src/defineConfig.ts +10 -0
- package/src/dev.test.ts +149 -2
- package/src/dev.ts +28 -3
- package/src/generate.test.ts +65 -3
- package/src/generate.ts +5 -2
- package/src/index.ts +1 -1
- package/src/push.test.ts +163 -3
- package/src/push.ts +20 -2
- package/templates/component.tsx.template +13 -4
package/src/push.ts
CHANGED
|
@@ -21,6 +21,7 @@ export const CUBE_FILES = /^(.*)\.cube\.(ya?ml|js)$/;
|
|
|
21
21
|
|
|
22
22
|
export const CLIENT_CONTEXT_FILES = /^(.*)\.cc\.ya?ml$/;
|
|
23
23
|
export const SECURITY_CONTEXT_FILES = /^(.*)\.sc\.ya?ml$/;
|
|
24
|
+
export const EMBEDDABLE_FILES = /^(.*)\.embeddable\.ya?ml$/;
|
|
24
25
|
|
|
25
26
|
export default async () => {
|
|
26
27
|
await initLogger("push");
|
|
@@ -110,6 +111,7 @@ const publishedSectionFeedback = (
|
|
|
110
111
|
) => {
|
|
111
112
|
config.pushModels && spinnerPushing.succeed("Models published");
|
|
112
113
|
config.pushComponents && spinnerPushing.succeed("Components published");
|
|
114
|
+
config.pushEmbeddables && spinnerPushing.succeed("Embeddables published");
|
|
113
115
|
};
|
|
114
116
|
|
|
115
117
|
async function pushByApiKey(
|
|
@@ -170,9 +172,9 @@ async function verify(ctx: ResolvedEmbeddableConfig) {
|
|
|
170
172
|
export async function buildArchive(config: ResolvedEmbeddableConfig) {
|
|
171
173
|
const spinnerArchive = ora("Building...").start();
|
|
172
174
|
|
|
173
|
-
if (!config.pushModels && !config.pushComponents) {
|
|
175
|
+
if (!config.pushModels && !config.pushComponents && !config.pushEmbeddables) {
|
|
174
176
|
spinnerArchive.fail(
|
|
175
|
-
"Cannot push:
|
|
177
|
+
"Cannot push: pushModels, pushComponents, and pushEmbeddables are all disabled",
|
|
176
178
|
);
|
|
177
179
|
process.exit(1);
|
|
178
180
|
}
|
|
@@ -217,6 +219,20 @@ export async function buildArchive(config: ResolvedEmbeddableConfig) {
|
|
|
217
219
|
);
|
|
218
220
|
}
|
|
219
221
|
|
|
222
|
+
if (config.pushEmbeddables) {
|
|
223
|
+
const embeddableFilesList = await findFiles(
|
|
224
|
+
config.client.srcDir,
|
|
225
|
+
EMBEDDABLE_FILES,
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
filesList.push(
|
|
229
|
+
...embeddableFilesList.map((entry): [string, string] => [
|
|
230
|
+
path.basename(entry[1]),
|
|
231
|
+
entry[1],
|
|
232
|
+
]),
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
220
236
|
await archive({
|
|
221
237
|
ctx: config,
|
|
222
238
|
filesList,
|
|
@@ -297,6 +313,7 @@ export async function sendBuildByApiKey(
|
|
|
297
313
|
const form = await createFormData(ctx.client.archiveFile, {
|
|
298
314
|
pushModels: ctx.pushModels,
|
|
299
315
|
pushComponents: ctx.pushComponents,
|
|
316
|
+
pushEmbeddables: ctx.pushEmbeddables,
|
|
300
317
|
starterEmbeddableIds: ctx.starterEmbeddables?.[ctx.region],
|
|
301
318
|
authorEmail: email,
|
|
302
319
|
description: message,
|
|
@@ -331,6 +348,7 @@ export async function sendBuild(
|
|
|
331
348
|
const form = await createFormData(ctx.client.archiveFile, {
|
|
332
349
|
pushModels: ctx.pushModels,
|
|
333
350
|
pushComponents: ctx.pushComponents,
|
|
351
|
+
pushEmbeddables: ctx.pushEmbeddables,
|
|
334
352
|
starterEmbeddableIds: ctx.starterEmbeddables?.[ctx.region],
|
|
335
353
|
authorEmail: "",
|
|
336
354
|
description: message,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Component, Watch, Host, Prop, Event, EventEmitter, h, Listen } from '@stencil/core';
|
|
2
|
+
import type { PluginFlags } from '@embeddable.com/sdk-core';
|
|
2
3
|
{{RENDER_IMPORT}}
|
|
4
|
+
{{PLUGIN_FLAGS}}
|
|
3
5
|
|
|
4
6
|
@Component({
|
|
5
7
|
tag: 'replace-this-with-component-name',
|
|
@@ -40,11 +42,13 @@ export class EmbeddableComponent {
|
|
|
40
42
|
|
|
41
43
|
componentDidLoad() {
|
|
42
44
|
this.handlePops();
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
if (!pluginFlags.supportsOnComponentReadyHook) {
|
|
46
|
+
const props = JSON.parse(this.props);
|
|
47
|
+
this.componentDidLoadEvent.emit({
|
|
45
48
|
componentId: props.componentId,
|
|
46
49
|
componentName: this.componentName
|
|
47
|
-
|
|
50
|
+
})
|
|
51
|
+
}
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
disconnectedCallback() {
|
|
@@ -113,7 +117,12 @@ export class EmbeddableComponent {
|
|
|
113
117
|
this.componentName,
|
|
114
118
|
props,
|
|
115
119
|
JSON.parse(this.clientContext),
|
|
116
|
-
this.theme
|
|
120
|
+
this.theme,
|
|
121
|
+
() =>
|
|
122
|
+
this.componentDidLoadEvent.emit({
|
|
123
|
+
componentId: props.componentId,
|
|
124
|
+
componentName: this.componentName
|
|
125
|
+
})
|
|
117
126
|
);
|
|
118
127
|
}
|
|
119
128
|
}
|