@codecademy/codebytes 0.7.2 → 0.7.3
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/dist/MonacoEditor/index.js +36 -21
- package/dist/MonacoEditor/types.js +1 -0
- package/dist/__tests__/codebyte.test.tsx +179 -0
- package/dist/__tests__/editor.test.tsx +108 -0
- package/dist/__tests__/{helpers-test.js → helpers.test.tsx} +19 -16
- package/dist/__tests__/language-selection.test.tsx +14 -0
- package/dist/api.js +5 -7
- package/dist/codeByteEditor.js +81 -73
- package/dist/consts.js +3 -0
- package/dist/drawers.js +124 -81
- package/dist/editor.js +107 -66
- package/dist/helpers/index.js +2 -7
- package/dist/languageSelection.js +30 -12
- package/dist/libs/eventTracking.js +1 -1
- package/dist/theme.d.js +1 -0
- package/dist/types.js +1 -0
- package/package.json +22 -48
- package/CHANGELOG.md +0 -227
- package/dist/MonacoEditor/colorsDark.d.ts +0 -32
- package/dist/MonacoEditor/index.d.ts +0 -7
- package/dist/MonacoEditor/theme.d.ts +0 -2
- package/dist/MonacoEditor/types.d.ts +0 -1
- package/dist/__tests__/codebyte-test.d.ts +0 -1
- package/dist/__tests__/codebyte-test.js +0 -155
- package/dist/__tests__/editor-test.d.ts +0 -1
- package/dist/__tests__/editor-test.js +0 -133
- package/dist/__tests__/helpers-test.d.ts +0 -1
- package/dist/__tests__/language-selection-test.d.ts +0 -1
- package/dist/__tests__/language-selection-test.js +0 -15
- package/dist/__tests__/mocks.d.ts +0 -0
- package/dist/__tests__/mocks.js +0 -13
- package/dist/api.d.ts +0 -12
- package/dist/codeByteEditor.d.ts +0 -4
- package/dist/consts.d.ts +0 -23
- package/dist/drawers.d.ts +0 -6
- package/dist/editor.d.ts +0 -15
- package/dist/helpers/index.d.ts +0 -2
- package/dist/index.d.ts +0 -3
- package/dist/languageSelection.d.ts +0 -6
- package/dist/libs/eventTracking.d.ts +0 -1
- package/dist/theme.d.ts +0 -4
- package/dist/types.d.ts +0 -22
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
var _jsxFileName = "/home/runner/work/mono/mono/libs/codebytes/src/MonacoEditor/index.tsx",
|
|
2
|
+
_this = this;
|
|
3
|
+
|
|
1
4
|
// DO NOT CHANGE ANYTHING HERE
|
|
2
5
|
// This component is part of the Codebytes MVP and only includes basic configuration around theming
|
|
3
6
|
// We are working on a monaco package in client-modules that has more configuration around themes and languages
|
|
@@ -6,6 +9,8 @@ import ReactMonacoEditor from '@monaco-editor/react';
|
|
|
6
9
|
import React, { useCallback, useRef } from 'react';
|
|
7
10
|
import ResizeObserver from 'react-resize-observer';
|
|
8
11
|
import { dark } from './theme';
|
|
12
|
+
import { jsxDEV as _jsxDEV } from "@emotion/react/jsx-dev-runtime";
|
|
13
|
+
import { Fragment as _Fragment } from "@emotion/react/jsx-dev-runtime";
|
|
9
14
|
export var SimpleMonacoEditor = function SimpleMonacoEditor(_ref) {
|
|
10
15
|
var value = _ref.value,
|
|
11
16
|
language = _ref.language,
|
|
@@ -16,27 +21,37 @@ export var SimpleMonacoEditor = function SimpleMonacoEditor(_ref) {
|
|
|
16
21
|
monaco.editor.defineTheme('dark', dark);
|
|
17
22
|
monaco.editor.setTheme('dark');
|
|
18
23
|
}, []);
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
return _jsxDEV(_Fragment, {
|
|
25
|
+
children: [_jsxDEV(ResizeObserver, {
|
|
26
|
+
onResize: function onResize(_ref2) {
|
|
27
|
+
var _editorRef$current;
|
|
22
28
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}), /*#__PURE__*/React.createElement(ReactMonacoEditor, {
|
|
31
|
-
onMount: editorWillMount,
|
|
32
|
-
onChange: onChange,
|
|
33
|
-
options: {
|
|
34
|
-
minimap: {
|
|
35
|
-
enabled: false
|
|
29
|
+
var height = _ref2.height,
|
|
30
|
+
width = _ref2.width;
|
|
31
|
+
(_editorRef$current = editorRef.current) == null ? void 0 : _editorRef$current.layout({
|
|
32
|
+
height: height,
|
|
33
|
+
width: width
|
|
34
|
+
});
|
|
36
35
|
}
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
}, void 0, false, {
|
|
37
|
+
fileName: _jsxFileName,
|
|
38
|
+
lineNumber: 38,
|
|
39
|
+
columnNumber: 7
|
|
40
|
+
}, _this), _jsxDEV(ReactMonacoEditor, {
|
|
41
|
+
onMount: editorWillMount,
|
|
42
|
+
onChange: onChange,
|
|
43
|
+
options: {
|
|
44
|
+
minimap: {
|
|
45
|
+
enabled: false
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
theme: "vs-dark",
|
|
49
|
+
value: value,
|
|
50
|
+
language: language
|
|
51
|
+
}, void 0, false, {
|
|
52
|
+
fileName: _jsxFileName,
|
|
53
|
+
lineNumber: 46,
|
|
54
|
+
columnNumber: 7
|
|
55
|
+
}, _this)]
|
|
56
|
+
}, void 0, true);
|
|
42
57
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { setupRtl } from '@codecademy/gamut-tests';
|
|
2
|
+
import { act } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
|
|
5
|
+
import { CodeByteEditor } from '..';
|
|
6
|
+
import { helloWorld, validLanguages } from '../consts';
|
|
7
|
+
import { trackClick } from '../helpers';
|
|
8
|
+
import { trackUserImpression } from '../libs/eventTracking';
|
|
9
|
+
|
|
10
|
+
const mockEditorTestId = 'mock-editor-test-id';
|
|
11
|
+
|
|
12
|
+
jest.mock('react-resize-observer');
|
|
13
|
+
jest.mock('../libs/eventTracking');
|
|
14
|
+
jest.mock('../helpers', () => ({
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
...jest.requireActual('../helpers'),
|
|
18
|
+
trackClick: jest.fn(),
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
// This is a super simplified mock capable of render value and trigger onChange.
|
|
22
|
+
jest.mock('../MonacoEditor', () => ({
|
|
23
|
+
SimpleMonacoEditor: ({
|
|
24
|
+
value,
|
|
25
|
+
onChange,
|
|
26
|
+
}: {
|
|
27
|
+
value: string;
|
|
28
|
+
onChange?: (value: string) => void;
|
|
29
|
+
}) => (
|
|
30
|
+
<>
|
|
31
|
+
{value}
|
|
32
|
+
<input
|
|
33
|
+
data-testid={mockEditorTestId}
|
|
34
|
+
type="text"
|
|
35
|
+
onChange={(e) => {
|
|
36
|
+
onChange?.(e.target.value);
|
|
37
|
+
}}
|
|
38
|
+
value={value}
|
|
39
|
+
/>
|
|
40
|
+
</>
|
|
41
|
+
),
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
const renderWrapper = setupRtl(CodeByteEditor, {});
|
|
45
|
+
|
|
46
|
+
describe('CodeBytes', () => {
|
|
47
|
+
const initialUrl = window.location.href;
|
|
48
|
+
|
|
49
|
+
afterEach(() => {
|
|
50
|
+
window.history.replaceState(null, '', initialUrl);
|
|
51
|
+
(trackClick as any).mockReset();
|
|
52
|
+
(trackUserImpression as any).mockReset();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('has a language-specific "hello world" program defined for each language', () => {
|
|
56
|
+
validLanguages.forEach((language) => {
|
|
57
|
+
expect(helloWorld[language]).toBeDefined();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('initializes with a language-specific "hello world" program when there is no language prop', async () => {
|
|
62
|
+
const { view } = renderWrapper();
|
|
63
|
+
const selectedLanguage = view.getByRole('combobox') as Element;
|
|
64
|
+
await act(async () => {
|
|
65
|
+
userEvent.selectOptions(selectedLanguage, ['javascript']);
|
|
66
|
+
});
|
|
67
|
+
view.getByText(helloWorld.javascript);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('initializes with a language-specific "hello world" program when there is a language prop but no text prop', () => {
|
|
71
|
+
const { view } = renderWrapper({ language: 'javascript' });
|
|
72
|
+
view.getByText(helloWorld.javascript);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('initializes with deserialized text when there is a text prop but no language prop', async () => {
|
|
76
|
+
const testString = 'yes hello';
|
|
77
|
+
const { view } = renderWrapper({ text: testString });
|
|
78
|
+
const selectedLanguage = view.getByRole('combobox') as Element;
|
|
79
|
+
await act(async () => {
|
|
80
|
+
userEvent.selectOptions(selectedLanguage, ['javascript']);
|
|
81
|
+
});
|
|
82
|
+
view.getByText(testString);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('initializes with deserialized text when there is both a language and text prop', () => {
|
|
86
|
+
const testString = 'yes hello';
|
|
87
|
+
const { view } = renderWrapper({
|
|
88
|
+
text: testString,
|
|
89
|
+
language: 'javascript',
|
|
90
|
+
});
|
|
91
|
+
view.getByText(testString);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('Change Handlers', () => {
|
|
95
|
+
it('triggers onEdit on text edit', async () => {
|
|
96
|
+
const onEdit = jest.fn();
|
|
97
|
+
const { view } = renderWrapper({
|
|
98
|
+
text: '',
|
|
99
|
+
language: 'javascript',
|
|
100
|
+
onEdit,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const editor = view.getByTestId(mockEditorTestId);
|
|
104
|
+
await act(async () => {
|
|
105
|
+
userEvent.type(editor, 'dog');
|
|
106
|
+
});
|
|
107
|
+
expect(onEdit).toHaveBeenCalledTimes(3);
|
|
108
|
+
expect(onEdit).toHaveBeenLastCalledWith('dog', 'javascript');
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('triggers onLanguageChange on language selection', async () => {
|
|
112
|
+
const onLanguageChange = jest.fn();
|
|
113
|
+
const { view } = renderWrapper({
|
|
114
|
+
onLanguageChange,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const selectedLanguage = view.getByRole('combobox') as Element;
|
|
118
|
+
await act(async () => {
|
|
119
|
+
userEvent.selectOptions(selectedLanguage, ['javascript']);
|
|
120
|
+
});
|
|
121
|
+
expect(onLanguageChange).toHaveBeenCalledWith(
|
|
122
|
+
"console.log('Hello world!');",
|
|
123
|
+
'javascript'
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
describe('Tracking', () => {
|
|
129
|
+
it('triggers trackClick on clicking the logo', async () => {
|
|
130
|
+
const { view } = renderWrapper({});
|
|
131
|
+
const logo = view.getByLabelText('visit codecademy.com');
|
|
132
|
+
await act(async () => {
|
|
133
|
+
userEvent.click(logo);
|
|
134
|
+
});
|
|
135
|
+
expect(trackClick).toHaveBeenCalledWith('logo', undefined);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('triggers trackClick on language selection', async () => {
|
|
139
|
+
const { view } = renderWrapper();
|
|
140
|
+
const selectedLanguage = view.getByRole('combobox') as Element;
|
|
141
|
+
await act(async () => {
|
|
142
|
+
userEvent.selectOptions(selectedLanguage, ['javascript']);
|
|
143
|
+
});
|
|
144
|
+
expect(trackClick).toHaveBeenCalledWith('lang_select', undefined);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it('triggers trackClick for the first edit', async () => {
|
|
148
|
+
const testString = 'original-value';
|
|
149
|
+
const { view } = renderWrapper({
|
|
150
|
+
text: testString,
|
|
151
|
+
language: 'javascript',
|
|
152
|
+
trackFirstEdit: true,
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
const editor = view.getByTestId(mockEditorTestId);
|
|
156
|
+
await act(async () => {
|
|
157
|
+
userEvent.type(editor, 'd');
|
|
158
|
+
});
|
|
159
|
+
expect(trackClick).toHaveBeenCalledWith('edit', undefined);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('triggers trackUserImpression', () => {
|
|
163
|
+
renderWrapper({
|
|
164
|
+
text: 'some-value',
|
|
165
|
+
language: 'javascript',
|
|
166
|
+
trackingData: {
|
|
167
|
+
page_name: 'forum_compose',
|
|
168
|
+
context: 'https://discuss.codecademy.com/some-interesting/post',
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
expect(trackUserImpression).toHaveBeenCalledWith({
|
|
173
|
+
page_name: 'forum_compose',
|
|
174
|
+
context: 'https://discuss.codecademy.com/some-interesting/post',
|
|
175
|
+
target: 'codebyte',
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { setupRtl } from '@codecademy/gamut-tests';
|
|
2
|
+
import { act } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
|
|
5
|
+
import { Editor } from '../editor';
|
|
6
|
+
import { trackClick } from '../helpers';
|
|
7
|
+
|
|
8
|
+
jest.mock('react-resize-observer');
|
|
9
|
+
jest.mock('../libs/eventTracking');
|
|
10
|
+
jest.mock('../helpers', () => ({
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
...jest.requireActual('../helpers'),
|
|
14
|
+
trackClick: jest.fn(),
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
jest.mock('../MonacoEditor', () => ({
|
|
18
|
+
SimpleMonacoEditor: ({ value }: { value: string }) => value,
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
const renderWrapper = setupRtl(Editor, {
|
|
22
|
+
hideCopyButton: false,
|
|
23
|
+
language: 'javascript',
|
|
24
|
+
text: 'hello world',
|
|
25
|
+
onChange: jest.fn(),
|
|
26
|
+
snippetsBaseUrl: '',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
Object.defineProperty(navigator, 'clipboard', {
|
|
30
|
+
value: {
|
|
31
|
+
writeText: jest.fn().mockImplementation(() => Promise.resolve()),
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('Editor', () => {
|
|
36
|
+
(global as any).fetch = jest.fn();
|
|
37
|
+
afterEach(() => {
|
|
38
|
+
(global as any).fetch.mockClear();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('shows a prompt tooltip when the CodeByte has __not__ been copied via the button', () => {
|
|
42
|
+
const { view } = renderWrapper();
|
|
43
|
+
expect(view.queryByTestId('copy-confirmation-tooltip')).toBeFalsy();
|
|
44
|
+
view.getByTestId('copy-prompt-tooltip');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('shows a confirmation tooltip when the CodeByte has been copied via the button', async () => {
|
|
48
|
+
const { view } = renderWrapper();
|
|
49
|
+
const copyBtn = view.getByTestId('copy-codebyte-btn');
|
|
50
|
+
await act(async () => {
|
|
51
|
+
userEvent.click(copyBtn as HTMLButtonElement);
|
|
52
|
+
});
|
|
53
|
+
expect(view.queryByTestId('copy-prompt-tooltip')).toBeFalsy();
|
|
54
|
+
view.getByTestId('copy-confirmation-tooltip');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('hides the copy codebyte button if hideCopyButton prop is true"', () => {
|
|
58
|
+
const { view } = renderWrapper({
|
|
59
|
+
hideCopyButton: true,
|
|
60
|
+
});
|
|
61
|
+
expect(view.queryByTestId('copy-codebyte-btn')).toBeNull();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('shows the copy codebyte button if hideCopyButton prop is not set', () => {
|
|
65
|
+
const { view } = renderWrapper();
|
|
66
|
+
|
|
67
|
+
view.getByTestId('copy-codebyte-btn');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('Tracking', () => {
|
|
71
|
+
it('tracks clicks on the run button', async () => {
|
|
72
|
+
(global as any).fetch.mockResolvedValue({
|
|
73
|
+
json: () =>
|
|
74
|
+
Promise.resolve({
|
|
75
|
+
stderr: [],
|
|
76
|
+
exit_code: 0,
|
|
77
|
+
stdout: '',
|
|
78
|
+
}),
|
|
79
|
+
});
|
|
80
|
+
const { view } = renderWrapper({
|
|
81
|
+
onChange: jest.fn(),
|
|
82
|
+
text: 'test',
|
|
83
|
+
language: 'javascript',
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const runButton = view.getByText('Run');
|
|
87
|
+
await act(async () => {
|
|
88
|
+
userEvent.click(runButton);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
expect(trackClick).toHaveBeenCalledWith('run', undefined);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('tracks clicks on the copy codebyte button', async () => {
|
|
95
|
+
const { view } = renderWrapper({
|
|
96
|
+
onChange: jest.fn(),
|
|
97
|
+
text: 'test',
|
|
98
|
+
language: 'javascript',
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const copyButton = view.getByTestId('copy-codebyte-btn');
|
|
102
|
+
await act(async () => {
|
|
103
|
+
userEvent.click(copyButton);
|
|
104
|
+
});
|
|
105
|
+
expect(trackClick).toHaveBeenCalledWith('copy', undefined);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
|
@@ -1,36 +1,39 @@
|
|
|
1
1
|
import { trackClick } from '../helpers';
|
|
2
2
|
import { trackUserClick } from '../libs/eventTracking';
|
|
3
|
+
|
|
3
4
|
jest.mock('../libs/eventTracking');
|
|
4
|
-
var initialUrl = window.location.href;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const initialUrl = window.location.href;
|
|
7
|
+
const resetCodebytesParams = () =>
|
|
8
|
+
window.history.replaceState(null, '', initialUrl);
|
|
9
9
|
|
|
10
|
-
describe('trackClick',
|
|
11
|
-
afterEach(
|
|
10
|
+
describe('trackClick', () => {
|
|
11
|
+
afterEach(() => {
|
|
12
12
|
resetCodebytesParams();
|
|
13
|
-
trackUserClick.mockReset();
|
|
13
|
+
(trackUserClick as any).mockReset();
|
|
14
14
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
|
|
16
|
+
it('tracks user click when tracking data is provided', () => {
|
|
17
|
+
const target = 'foobar';
|
|
18
|
+
const trackingData = {
|
|
18
19
|
page_name: 'forum',
|
|
19
20
|
context: 'https://discuss.codecademy.com/some-interesting/post',
|
|
20
|
-
target
|
|
21
|
+
target,
|
|
21
22
|
};
|
|
23
|
+
|
|
22
24
|
trackClick(target, trackingData);
|
|
23
25
|
expect(trackUserClick).toHaveBeenCalledWith({
|
|
24
26
|
page_name: 'forum',
|
|
25
27
|
context: 'https://discuss.codecademy.com/some-interesting/post',
|
|
26
|
-
target
|
|
28
|
+
target,
|
|
27
29
|
});
|
|
28
30
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
it('tracks user click when tracking data is not provided', () => {
|
|
33
|
+
const target = 'foobar';
|
|
31
34
|
trackClick(target);
|
|
32
35
|
expect(trackUserClick).toHaveBeenCalledWith({
|
|
33
|
-
target
|
|
36
|
+
target,
|
|
34
37
|
});
|
|
35
38
|
});
|
|
36
|
-
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { setupRtl } from '@codecademy/gamut-tests';
|
|
2
|
+
|
|
3
|
+
import { LanguageSelection } from '../languageSelection';
|
|
4
|
+
|
|
5
|
+
const renderWrapper = setupRtl(LanguageSelection, {
|
|
6
|
+
onChange: () => null,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('LanguageSelection', () => {
|
|
10
|
+
it('has placeholder text', () => {
|
|
11
|
+
const { view } = renderWrapper();
|
|
12
|
+
view.getByText('Which language do you want to code in?');
|
|
13
|
+
});
|
|
14
|
+
});
|
package/dist/api.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6
|
-
|
|
1
|
+
import _asyncToGenerator from "/home/runner/work/mono/mono/node_modules/@babel/runtime/helpers/asyncToGenerator.js";
|
|
2
|
+
import _regeneratorRuntime from "/home/runner/work/mono/mono/node_modules/@babel/runtime/regenerator/index.js";
|
|
3
|
+
import "core-js/modules/es.object.to-string.js";
|
|
4
|
+
import "core-js/modules/es.promise.js";
|
|
7
5
|
export var postSnippet = /*#__PURE__*/function () {
|
|
8
6
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data, snippetsBaseUrl) {
|
|
9
7
|
var snippetsEndpoint, response;
|
|
@@ -11,7 +9,7 @@ export var postSnippet = /*#__PURE__*/function () {
|
|
|
11
9
|
while (1) {
|
|
12
10
|
switch (_context.prev = _context.next) {
|
|
13
11
|
case 0:
|
|
14
|
-
snippetsEndpoint = "https://"
|
|
12
|
+
snippetsEndpoint = "https://" + snippetsBaseUrl + "/snippets";
|
|
15
13
|
_context.next = 3;
|
|
16
14
|
return fetch(snippetsEndpoint, {
|
|
17
15
|
method: 'POST',
|