@hubspot/cms-dev-server 0.6.0 → 0.6.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.
Files changed (53) hide show
  1. package/dist/index.js +0 -10
  2. package/dist/internalSsr.js +4 -7
  3. package/dist/run.js +43 -9
  4. package/dist/storybook/index.js +61 -46
  5. package/dist/{storybook → storybook-main}/main.js +24 -9
  6. package/dist/storybook-main/preview.js +20 -0
  7. package/package.json +11 -10
  8. package/types/storybook/getFieldsArgTypes.d.ts +1 -7
  9. package/types/storybook/moduleStory.d.ts +5 -2
  10. package/types/storybook/types.d.ts +11 -0
  11. package/dist/components/ModulesList.js +0 -14
  12. package/dist/components/PartialsList.js +0 -13
  13. package/dist/createDevServer.js +0 -162
  14. package/dist/createViteDevServer.js +0 -51
  15. package/dist/lib/cli.js +0 -27
  16. package/dist/lib/debug.js +0 -2
  17. package/dist/lib/errors.js +0 -22
  18. package/dist/lib/fullOriginalUrlFromRequest.js +0 -3
  19. package/dist/lib/httpsRedirectingServer.js +0 -48
  20. package/dist/lib/moduleGraph.js +0 -11
  21. package/dist/lib/proxyHelpers.js +0 -70
  22. package/dist/lib/proxyHelpers.test.js +0 -136
  23. package/dist/lib/renderComponentWithCSS.js +0 -26
  24. package/dist/lib/renderHelpers.js +0 -45
  25. package/dist/lib/renderModule.js +0 -56
  26. package/dist/lib/renderPartial.js +0 -15
  27. package/dist/lib/templates.js +0 -55
  28. package/dist/proxyPage/constants.js +0 -1
  29. package/dist/proxyPage/fetchContentMetadata.js +0 -59
  30. package/dist/proxyPage/fetchDomains.js +0 -29
  31. package/dist/proxyPage/fetchPreviewInfo.js +0 -37
  32. package/dist/proxyPage/proxyPage.js +0 -174
  33. package/dist/proxyPage/renderLocalError.js +0 -27
  34. package/dist/proxyPage/utils.js +0 -38
  35. package/dist/routes/createDevServerRoutes.js +0 -43
  36. package/dist/routes/homeRouteHandler.js +0 -12
  37. package/dist/routes/linksToAllModulesRouteHandler.js +0 -10
  38. package/dist/routes/linksToAllPartialsRouteHandler.js +0 -10
  39. package/dist/routes/module.js +0 -41
  40. package/dist/routes/partial.js +0 -30
  41. package/dist/routes/proxyPageResourceRedirect.js +0 -22
  42. package/dist/routes/proxyPageRouteHandler.js +0 -40
  43. package/dist/routes/proxyPathPageResourceRedirect.js +0 -36
  44. package/dist/routes/proxyPathPageRouteHandler.js +0 -43
  45. package/dist/shadowDevServer/createShadowDevServerRoutes.js +0 -63
  46. package/dist/shadowDevServer/startShadowDevServer.js +0 -31
  47. package/dist/storybook/getFieldsArgTypes.js +0 -54
  48. package/dist/storybook/getFieldsArgTypes.test.js +0 -91
  49. package/dist/storybook/getNestedFieldObjectForArgs.js +0 -22
  50. package/dist/storybook/getNestedFieldObjectForArgs.test.js +0 -40
  51. package/dist/storybook/moduleStory.js +0 -61
  52. package/dist/storybook/preview.js +0 -9
  53. package/dist/storybook/types.js +0 -1
@@ -1,40 +0,0 @@
1
- /* hs-eslint ignored failing-rules */
2
- /* eslint-disable consistent-return */
3
- import fetchContentMetadata from '../proxyPage/fetchContentMetadata.js';
4
- import proxyPage from '../proxyPage/proxyPage.js';
5
- import { getSubDomainFromValidLocalDomain, consoleWarn, } from '../proxyPage/utils.js';
6
- import { VALID_PROXY_DOMAIN_SUFFIXES } from '../proxyPage/constants.js';
7
- import fullOriginalUrlFromRequest from '../lib/fullOriginalUrlFromRequest.js';
8
- export default async function proxyPageRouteHandler(request, response, next) {
9
- const { viteServer, webRoot, projectName, projectComponentPath } = request.app.locals;
10
- if (!request.accepts().includes('text/html')) {
11
- return response.sendStatus(404);
12
- }
13
- const fullOriginalUrl = fullOriginalUrlFromRequest(request);
14
- const domainToProxy = getSubDomainFromValidLocalDomain(request.hostname);
15
- const urlToProxy = `http://${domainToProxy}${request.originalUrl}`;
16
- if (!domainToProxy) {
17
- if (VALID_PROXY_DOMAIN_SUFFIXES.includes(request.hostname)) {
18
- const message = `Can't make a proxy request, you need to prepend the real page's domain to '${request.hostname}' (i.e. your.page.com.${request.hostname})`;
19
- consoleWarn(message);
20
- return response.status(400).send(message);
21
- }
22
- else {
23
- const message = `Can't make a proxy request, the domain '${request.hostname}' is not a valid proxy-able domain`;
24
- consoleWarn(message);
25
- return response.status(400).send(message);
26
- }
27
- }
28
- if (request.query.hs_preview) {
29
- const message = `Can't make a proxy request, you cannot proxy URLs that include internal query params like hs_preview`;
30
- consoleWarn(message);
31
- return response.status(400).send(message);
32
- }
33
- try {
34
- const { portalId, contentId, hublet } = await fetchContentMetadata(urlToProxy);
35
- await proxyPage(response, portalId, hublet, contentId, webRoot, viteServer, projectName, projectComponentPath, urlToProxy, fullOriginalUrl);
36
- }
37
- catch (e) {
38
- next(e);
39
- }
40
- }
@@ -1,36 +0,0 @@
1
- import fetch from 'node-fetch';
2
- const HCMS_PATH = '/_hcms/';
3
- const HS_FS_PATH = '/hs-fs/';
4
- const HUB_FS_PATH = '/hubfs/';
5
- // From(ish) https://git.hubteam.com/HubSpot/cloudflare-workers/blob/master/worker-lib/src/Constants.ts
6
- const isInternalCMSRoute = (req) => req.path.startsWith(HCMS_PATH) ||
7
- req.path.startsWith(HS_FS_PATH) ||
8
- req.path.startsWith(HUB_FS_PATH);
9
- export default function proxyPathPageResourceRedirect(req, res, next) {
10
- const isAHtmlRequest = req.accepts().includes('text/html');
11
- // only proxy when referer's path is /proxy && has page query param
12
- let proxyPageUrl;
13
- let refererUrl;
14
- try {
15
- refererUrl = new URL(req.headers.referer);
16
- proxyPageUrl = new URL(new URL(req.headers.referer).searchParams.get('page'));
17
- }
18
- catch (e) {
19
- next();
20
- return;
21
- }
22
- if (!refererUrl.pathname.startsWith('/proxy')) {
23
- next();
24
- return;
25
- }
26
- // handle anchor links, unless internal CMS route
27
- if (isAHtmlRequest && !isInternalCMSRoute(req)) {
28
- const encodedPageUrl = encodeURIComponent(`${proxyPageUrl.origin}${req.url}`);
29
- res.redirect(`/proxy?page=${encodedPageUrl}`);
30
- return;
31
- }
32
- const urlToProxy = `https://${proxyPageUrl.host}${req.url}`;
33
- fetch(urlToProxy)
34
- .then(response => response.body.pipe(res))
35
- .catch(err => console.log(err));
36
- }
@@ -1,43 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /* hs-eslint ignored failing-rules */
3
- /* eslint-disable consistent-return */
4
- import { renderOnServer } from '@hubspot/cms-js-internal';
5
- import fetchContentMetadata from '../proxyPage/fetchContentMetadata.js';
6
- import proxyPage from '../proxyPage/proxyPage.js';
7
- import { consoleWarn } from '../proxyPage/utils.js';
8
- export default async function proxyPathPageRouteHandler(request, response, next) {
9
- const { viteServer, webRoot, devServerHost, devServerPort, projectName, projectComponentPath, } = request.app.locals;
10
- if (!request.accepts().includes('text/html')) {
11
- return response.sendStatus(404);
12
- }
13
- // render proxy index page if not supplied with query param
14
- if (!request.query.page) {
15
- const { html: responseHtml } = await renderOnServer(_jsxs("div", { children: [_jsx("h2", { children: "Local Proxy" }), _jsxs("form", { action: "/proxy", children: [_jsx("label", { htmlFor: "page", style: { display: 'block' }, children: "Page URL" }), _jsx("input", { style: { width: '300px' }, name: "page", type: "text", placeholder: "https://somecmspage.com/path" }), _jsx("button", { style: { display: 'block' }, children: "Proxy" })] })] }), null, null);
16
- response.status(200).set({ 'Content-Type': 'text/html' }).end(responseHtml);
17
- return;
18
- }
19
- // parse proxy page URL from query param
20
- let proxyPageUrl;
21
- try {
22
- proxyPageUrl = new URL(request.query.page);
23
- }
24
- catch (e) {
25
- const message = 'Please provide a valid page query parameter, e.g., http://localhost:3000/proxy?page=https://yourdomain.com/path';
26
- consoleWarn(message);
27
- response.status(400).send(message);
28
- return;
29
- }
30
- // validate proxy page URL query params
31
- if (proxyPageUrl.searchParams.has('hs_preview')) {
32
- const message = `Can't make a proxy request, you cannot proxy URLs that include internal query params like hs_preview`;
33
- consoleWarn(message);
34
- return response.status(400).send(message);
35
- }
36
- try {
37
- const { portalId, contentId, hublet } = await fetchContentMetadata(proxyPageUrl.href);
38
- await proxyPage(response, portalId, hublet, contentId, webRoot, viteServer, projectName, projectComponentPath, proxyPageUrl.href, proxyPageUrl.href);
39
- }
40
- catch (e) {
41
- next(e);
42
- }
43
- }
@@ -1,63 +0,0 @@
1
- /* hs-eslint ignored failing-rules */
2
- /* eslint-disable require-await */
3
- import { Router } from 'express';
4
- import { getAccountId } from '@hubspot/cli-lib/lib/config.js';
5
- import cors from 'cors';
6
- import { findLocalRenderPlaceholders } from '../lib/proxyHelpers.js';
7
- import { makeProxyPreviewRequest } from '../proxyPage/proxyPage.js';
8
- import fetchPreviewInfo from '../proxyPage/fetchPreviewInfo.js';
9
- function getShadowDevServerCheckHandler(devServerPort) {
10
- return async function shadowDevServerCheckHandler(request, response) {
11
- const { query } = request;
12
- if (query) {
13
- const { hostName, pathName, protocol, contentId, portalId: portalIdString, } = query;
14
- const pageUrl = `${protocol}//${hostName}${pathName}`;
15
- const portalId = parseInt(portalIdString, 10);
16
- let accountId;
17
- let hasJSBuildingBlocks = false;
18
- let localProxyUrl;
19
- try {
20
- accountId = getAccountId(portalId);
21
- if (accountId === null) {
22
- throw new Error();
23
- }
24
- }
25
- catch (e) {
26
- response
27
- .status(500)
28
- .end(`Unable to find account for hubid = ${portalId}. Please check your hubspot.config.yaml`);
29
- return;
30
- }
31
- try {
32
- const previewInfo = await fetchPreviewInfo(accountId, portalId, contentId);
33
- const { previewKey } = previewInfo;
34
- const pageHtml = await makeProxyPreviewRequest(accountId, pageUrl, previewKey, contentId);
35
- const localRenderPlaceholders = findLocalRenderPlaceholders(pageHtml);
36
- if (localRenderPlaceholders.length) {
37
- hasJSBuildingBlocks = true;
38
- localProxyUrl = `http://${hostName}.hslocal.net:${devServerPort}${pathName}`;
39
- }
40
- response
41
- .status(200)
42
- .set({ 'Content-Type': 'application/json' })
43
- .json({ hasJSBuildingBlocks, localProxyUrl });
44
- }
45
- catch (error) {
46
- response
47
- .status(500)
48
- .end(`Failed proxy render of page id = ${contentId} hub id = ${portalId}\n\n${error.stack}`);
49
- return;
50
- }
51
- }
52
- else {
53
- response
54
- .status(500)
55
- .end(`Missing pageUrl param, cannot check for proxied page without a pageUrl`);
56
- }
57
- };
58
- }
59
- export default async function createShadowDevServerRoutes(devServerPort) {
60
- const shadowDevServerRoutes = Router();
61
- shadowDevServerRoutes.get('/check-if-local-dev-server', cors(), getShadowDevServerCheckHandler(devServerPort));
62
- return shadowDevServerRoutes;
63
- }
@@ -1,31 +0,0 @@
1
- import net from 'net';
2
- import express from 'express';
3
- import createShadowDevServerRoutes from './createShadowDevServerRoutes.js';
4
- const testNetServer = net.createServer();
5
- export default async function startShadowDevServer(devServerPort, shadowPort) {
6
- const portIsTaken = await new Promise((res, rej) => {
7
- console.log(`Starting proxy link server on port ${shadowPort}`);
8
- testNetServer.once('error', err => {
9
- if (err['code'] === 'EADDRINUSE') {
10
- console.error(`Port ${shadowPort} is in use. HubSpot is unable to automatically create proxy links in the Sprocket Menu`);
11
- res(true);
12
- }
13
- else {
14
- rej(err);
15
- }
16
- });
17
- testNetServer.once('listening', () => {
18
- testNetServer.close();
19
- });
20
- testNetServer.once('close', () => {
21
- res(false);
22
- });
23
- testNetServer.listen(shadowPort);
24
- });
25
- if (portIsTaken) {
26
- return;
27
- }
28
- const shadowDevServer = express();
29
- shadowDevServer.listen(shadowPort);
30
- shadowDevServer.use('/', await createShadowDevServerRoutes(devServerPort));
31
- }
@@ -1,54 +0,0 @@
1
- export default function getFieldsArgTypes(fieldsJson, currentPathSegments = []) {
2
- let resultArgTypes = {};
3
- for (const field of fieldsJson) {
4
- // storybook doesn't support nested controls, so emulate our nested
5
- // structure with group1.group2.field structure
6
- const fullFieldName = [...currentPathSegments, field.name].join('.');
7
- // should this definition of fieldType => argType live next to fields in cms-components?
8
- switch (field.type) {
9
- case 'group': {
10
- if (!field.children) {
11
- continue;
12
- }
13
- const groupResult = getFieldsArgTypes(field.children, [
14
- ...currentPathSegments,
15
- field.name,
16
- ]);
17
- resultArgTypes = {
18
- ...resultArgTypes,
19
- ...groupResult,
20
- };
21
- break;
22
- }
23
- case 'boolean': {
24
- resultArgTypes[fullFieldName] = {
25
- control: 'boolean',
26
- defaultValue: field.default,
27
- };
28
- break;
29
- }
30
- case 'text': {
31
- resultArgTypes[fullFieldName] = {
32
- control: 'text',
33
- defaultValue: field.default,
34
- };
35
- break;
36
- }
37
- case 'number': {
38
- resultArgTypes[fullFieldName] = {
39
- control: 'number',
40
- defaultValue: field.default,
41
- };
42
- break;
43
- }
44
- default: {
45
- resultArgTypes[fullFieldName] = {
46
- control: 'object',
47
- defaultValue: field.default,
48
- };
49
- break;
50
- }
51
- }
52
- }
53
- return resultArgTypes;
54
- }
@@ -1,91 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { describe, expect, it } from 'vitest';
3
- import { ModuleFields, BooleanField, TextField, FieldGroup, NumberField, ColorField, } from '@hubspot/cms-components/fields';
4
- import { renderFieldsToJson } from '@hubspot/cms-js-internal';
5
- import getFieldsArgTypes from './getFieldsArgTypes.js';
6
- describe('getFieldsArgTypes', () => {
7
- it('creates argType for boolean field', () => {
8
- const fields = (_jsx(ModuleFields, { children: _jsx(BooleanField, { name: "testBooleanField", label: "field", default: false }) }));
9
- const argTypes = getFieldsArgTypes(renderFieldsToJson(fields));
10
- expect(argTypes).toStrictEqual({
11
- testBooleanField: {
12
- control: 'boolean',
13
- defaultValue: false,
14
- },
15
- });
16
- });
17
- it('creates text argType for text field', () => {
18
- const fields = (_jsx(ModuleFields, { children: _jsx(TextField, { name: "testStringField", label: "field", default: 'test' }) }));
19
- const argTypes = getFieldsArgTypes(renderFieldsToJson(fields));
20
- expect(argTypes).toStrictEqual({
21
- testStringField: {
22
- control: 'text',
23
- defaultValue: 'test',
24
- },
25
- });
26
- });
27
- it('creates number argType for number field', () => {
28
- const fields = (_jsx(ModuleFields, { children: _jsx(NumberField, { name: "testNumberField", label: "field", default: 123 }) }));
29
- const argTypes = getFieldsArgTypes(renderFieldsToJson(fields));
30
- expect(argTypes).toStrictEqual({
31
- testNumberField: {
32
- control: 'number',
33
- defaultValue: 123,
34
- },
35
- });
36
- });
37
- it('creates object argType for unknown field', () => {
38
- const fields = (_jsx(ModuleFields, { children: _jsx(ColorField, { name: "testColorField", label: "field", default: {
39
- color: '#fff',
40
- } }) }));
41
- const argTypes = getFieldsArgTypes(renderFieldsToJson(fields));
42
- expect(argTypes).toStrictEqual({
43
- testColorField: {
44
- control: 'object',
45
- defaultValue: {
46
- color: '#fff',
47
- },
48
- },
49
- });
50
- });
51
- it('prefixes fields in a group with . separated group names', () => {
52
- const fields = (_jsx(ModuleFields, { children: _jsxs(FieldGroup, { name: "mygroup", label: "field group", children: [_jsx(TextField, { name: "testStringField", label: "field", default: 'test' }), _jsx(BooleanField, { name: "testBooleanField", label: "field", default: false })] }) }));
53
- const argTypes = getFieldsArgTypes(renderFieldsToJson(fields));
54
- expect(argTypes).toStrictEqual({
55
- 'mygroup.testStringField': {
56
- control: 'text',
57
- defaultValue: 'test',
58
- },
59
- 'mygroup.testBooleanField': {
60
- control: 'boolean',
61
- defaultValue: false,
62
- },
63
- });
64
- });
65
- it('handles multiple nesting alongside top level values', () => {
66
- const fields = (_jsxs(ModuleFields, { children: [_jsx(TextField, { name: "toplevel", label: "top level text field", default: "defaultvalue" }), _jsxs(FieldGroup, { name: "mygroup", label: "field group", children: [_jsx(TextField, { name: "testStringField", label: "field", default: 'test' }), _jsx(BooleanField, { name: "testBooleanField", label: "field", default: false }), _jsxs(FieldGroup, { name: "nestedgroup", label: "nested group", children: [_jsx(TextField, { name: "testStringField", label: "field", default: 'test' }), _jsx(BooleanField, { name: "testBooleanField", label: "field", default: false })] })] })] }));
67
- const argTypes = getFieldsArgTypes(renderFieldsToJson(fields));
68
- expect(argTypes).toStrictEqual({
69
- toplevel: {
70
- control: 'text',
71
- defaultValue: 'defaultvalue',
72
- },
73
- 'mygroup.testStringField': {
74
- control: 'text',
75
- defaultValue: 'test',
76
- },
77
- 'mygroup.testBooleanField': {
78
- control: 'boolean',
79
- defaultValue: false,
80
- },
81
- 'mygroup.nestedgroup.testStringField': {
82
- control: 'text',
83
- defaultValue: 'test',
84
- },
85
- 'mygroup.nestedgroup.testBooleanField': {
86
- control: 'boolean',
87
- defaultValue: false,
88
- },
89
- });
90
- });
91
- });
@@ -1,22 +0,0 @@
1
- // default values come through via `defaultValue` in the story's argTypes, we
2
- // need to re-nest them to match the field structure
3
- export default function getNestedFieldObjectForArgs(_args) {
4
- const result = {};
5
- for (const argPath in _args) {
6
- if (Object.prototype.hasOwnProperty.call(_args, argPath)) {
7
- const argPathSegments = argPath.split('.');
8
- const nestedSegments = argPathSegments.slice(0, -1);
9
- const fieldName = argPathSegments[argPathSegments.length - 1];
10
- const fieldValue = _args[argPath];
11
- let currentNest = result;
12
- for (const segment of nestedSegments) {
13
- if (!Object.prototype.hasOwnProperty.call(currentNest, segment)) {
14
- currentNest[segment] = {};
15
- }
16
- currentNest = currentNest[segment];
17
- }
18
- currentNest[fieldName] = fieldValue;
19
- }
20
- }
21
- return result;
22
- }
@@ -1,40 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import getNestedFieldObjectForArgs from './getNestedFieldObjectForArgs.js';
3
- describe('getNestedFieldObjectForArgs', () => {
4
- it('leaves top level args as is', () => {
5
- const argMap = {
6
- testField: 'testValue',
7
- testField2: 'testValue',
8
- };
9
- const result = getNestedFieldObjectForArgs(argMap);
10
- expect(result).toStrictEqual(argMap);
11
- });
12
- it('turns a . separated arg name into a nested field', () => {
13
- const argMap = {
14
- 'group.testField': 'testValue',
15
- topLevelField: 'testValue',
16
- };
17
- const result = getNestedFieldObjectForArgs(argMap);
18
- expect(result).toStrictEqual({
19
- group: {
20
- testField: 'testValue',
21
- },
22
- topLevelField: 'testValue',
23
- });
24
- });
25
- it('keeps nested fields with the same group prefix nested in the same object', () => {
26
- const argMap = {
27
- 'group.testField': 'testValue',
28
- 'group.secondField': 'testValue',
29
- topLevelField: 'testValue',
30
- };
31
- const result = getNestedFieldObjectForArgs(argMap);
32
- expect(result).toStrictEqual({
33
- group: {
34
- testField: 'testValue',
35
- secondField: 'testValue',
36
- },
37
- topLevelField: 'testValue',
38
- });
39
- });
40
- });
@@ -1,61 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import React, { useEffect } from 'react';
3
- import { renderToStaticMarkup } from 'react-dom/server';
4
- import { renderFieldsToJson } from '@hubspot/cms-js-internal';
5
- import getFieldsArgTypes from './getFieldsArgTypes.js';
6
- import getNestedFieldObjectForArgs from './getNestedFieldObjectForArgs.js';
7
- export function moduleFieldsToJson(fields) {
8
- let moduleJson;
9
- const outputCallback = (callbackJson) => {
10
- moduleJson = callbackJson;
11
- };
12
- renderToStaticMarkup(React.cloneElement(fields, {
13
- outputCallback,
14
- }));
15
- if (!moduleJson) {
16
- throw new Error("couldn't render module fields definition to fields.json");
17
- }
18
- return moduleJson;
19
- }
20
- export function moduleStory(ModuleComponent, fields) {
21
- const moduleJson = renderFieldsToJson(fields);
22
- const argTypes = getFieldsArgTypes(moduleJson);
23
- const story = (_args) => _jsx(ModuleComponent, { ..._args });
24
- const storyWithArgs = story.bind({});
25
- storyWithArgs.argTypes = argTypes;
26
- storyWithArgs.args = {};
27
- return storyWithArgs;
28
- }
29
- export function moduleStoryWithIsland(moduleName, fields) {
30
- const moduleJson = moduleFieldsToJson(fields);
31
- const argTypes = getFieldsArgTypes(moduleJson);
32
- const story = (_args) => {
33
- const fieldValues = getNestedFieldObjectForArgs(_args);
34
- const fieldValuesString = JSON.stringify(fieldValues);
35
- const domain = `${window.location.protocol}//${window.location.hostname.replace('storybook.', '')}:3000`;
36
- const fieldValuesJson = encodeURIComponent(fieldValuesString);
37
- const iframeSrc = `${domain}/module/${moduleName}?fields=${fieldValuesJson}`;
38
- useEffect(() => {
39
- const existingElement = document.querySelector('#hs-module-iframe');
40
- if (existingElement) {
41
- existingElement.setAttribute('src', iframeSrc);
42
- return () => {
43
- existingElement.remove();
44
- };
45
- }
46
- const iframeElement = document.createElement('iframe');
47
- iframeElement.setAttribute('src', iframeSrc);
48
- iframeElement.setAttribute('id', 'hs-module-iframe');
49
- iframeElement.setAttribute('style', `border: none;width: 100%;height: 100%;overflow: auto;`);
50
- document.body.appendChild(iframeElement);
51
- return () => {
52
- iframeElement.remove();
53
- };
54
- }, [iframeSrc]);
55
- return _jsx("div", {});
56
- };
57
- const storyWithArgs = story.bind({});
58
- storyWithArgs.argTypes = argTypes;
59
- storyWithArgs.args = {};
60
- return storyWithArgs;
61
- }
@@ -1,9 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ServerRenderContext, createServerRenderContext, ClientRenderContextProvider, } from '@hubspot/cms-components';
3
- export const parameters = {
4
- actions: { argTypesRegex: '^on[A-Z].*' },
5
- };
6
- const contextValue = createServerRenderContext('http://testUrl.com');
7
- export const decorators = [
8
- Story => (_jsx(ClientRenderContextProvider, { pageUrl: "http://test.com", islands: [], children: _jsx(ServerRenderContext.Provider, { value: contextValue, children: _jsx(Story, {}) }) })),
9
- ];
@@ -1 +0,0 @@
1
- export {};