Commit Graph
32 Commits
Author SHA1 Message Date
Ivan Starkov 6a930b1c0c feat: Compare server and client versions and prompt for reload. (#3833)
## Description

Reload if server and client versions do not match on patch

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
2024-07-30 20:10:22 +03:00
Bogdan Chadkin 13b6d79c3f refactor: drop theme switcher (#3110)
Theme switcher is very complicated and we may not introduce dark theme
for a while. Easier to drop it for now and reintroduce with brand new
solution.
2024-04-07 03:12:22 +07:00
Bogdan Chadkin 7c0db06c77 refactor: move publisher host into loader (#3102)
Here refactored ours envs.

- deleted BUILDER_HOST as unused
- moved PUBLISHER_HOST into loader and shared in UI with atom
2024-04-06 22:09:27 +07:00
f66a6bee31 experimental: Marketplace settings (#2949)
## Description

- split project settings
- add marketplace settings

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory

---------

Co-authored-by: Bogdan Chadkin <trysound@yandex.ru>
Co-authored-by: istarkov <istarkov@gmail.com>
2024-03-04 13:06:49 +01:00
Oleg Isonen f3c815d524 fix: Fix clone from builder when shared link is used (#2883)
## Description

Clone had no authToken provided via shared url

## Steps for reproduction

1. create a shared url with view permission
2. open it from a different account
3. clone from menu should work

## Code Review

- [ ] hi @istarkov , I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2024-02-08 20:51:56 +01:00
Oleg Isonen d1dba475c5 feat: Clonable project (#2871)
## Description

Every project is now clonable if you have a shared link with at least
view permission or higher.

## Steps for reproduction

1. get a link with view permission from another owner
2. clone it
3. repeat the same from your own project

## Code Review

- [ ] hi @istarkov , I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2024-02-07 15:46:22 +01:00
Bogdan Chadkin 11b799d4f7 feat: load resources in builder (#2714)
Ref https://github.com/webstudio-is/webstudio/issues/2532

Here improved resource management to load defined resources and store in
variable values to allow preview data. Builder requests data from proxy
route every time resources or their variables are changed.

<img width="1449" alt="Screenshot 2023-12-25 at 01 09 58"
src="https://github.com/webstudio-is/webstudio/assets/5635476/6614a356-0170-4606-9b60-d39b1bc09837">

Data to test is here
https://gist.githubusercontent.com/TrySound/56507c301ec85669db5f1541406a9259/raw/a49548730ab592c86b9e7781f5b29beec4765494/collection.json
2023-12-27 23:54:09 +07:00
Ivan Starkov a87789f261 feat: Add fields to transaction log, add userPlanSettings (#2633)
## Description

Add additional fields to transaction log, so we can create billing
portal for users to unsubscribe/change etc of subscriptions

Plus:
- [x] Allow unlimited domains to all "pro" users
- [x] Add subscriptions link to users with subscriptions (created by n8n
schema on click)
<img width="213" alt="image"
src="https://github.com/webstudio-is/webstudio/assets/5077042/08d40835-3273-4ca9-a0e3-8a4f7614da93">

- [x] Allow admin link sharing

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-11-19 22:43:31 +02:00
Ivan Starkov 09fe7f2222 feat: Remove useless variables and logic (#2589)
## Description

Removed `process.env.BUILD_ORIGIN`,
`process.env.BUILD_REQUIRE_SUBDOMAIN`
And highly simplified corresponding logic

Next PR:
Removal of `DEPLOYMENT_URL`

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-11-09 18:20:00 +02:00
Ivan Starkov efb0425e9a fix: Page Setting URL Misformatted (#2567)
## Description

https://discord.com/channels/955905230107738152/1170434939318182020

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-11-05 19:37:06 +02:00
Giuseppe ec15ed4cd9 fix: AI fixes and improvements (#2451) 2023-10-11 14:05:26 +02:00
Giuseppe dda50628a6 refactor: Split AI commands detection and execution (#2444)
As per title the PR splits command detection and execution in two
endpoints.

We will first make a request to the /rest/ai/detect endpoint which will
return an array with one or multiple detected commands for the prompt.
Once we have that we execute them in parallel.

Rewrote the temporary UI completion handler to do all the above. Error
handling will still have to be polished to account for special cases
like rate limiting etc.
2023-10-10 17:53:12 +02:00
Giuseppe 43b2e7e23c feat: Merge copywriter with commands (#2419)
Unifies the operations AI endpoint with the copywriter feature. Introducing a chain to do feature-detection on user prompts.
2023-10-09 10:43:14 +02:00
Giuseppe b3dd7f18c4 feat: AI Operations (#2391)
Implements an operation-based system to accomplish a number of edit
tasks on a JSX+CSS representation of a selected Webstudio tree.

Every JSX element has the instance id as data-ws-id and therefore the
LLM knows what to edit.

The idea is to create a number of operations (aiOperations)
specs/schemas with Zod describing unique edit tasks, make a
discriminated union, convert them to JSON Schema. We then inject this
information and the current JSX+CSS in the LLM prompt asking the model
to generate an array of operations.

The LLM responds with an array of operations (aiOperations) to fulfill
the user request. We then process these doing the necessary
transformations to convert these to a Webstudio-friendly format
(wsOperations) and send them to the client where we apply them (see
applyOperations).

Some of these operations are going to be "intermediate" operations for
now.

Generating quality user interfaces might be challenging with LLMs.

Having to do so within a generic operations framework like the one
described above makes it even more challenging.

For this reason when it comes to generating user interfaces, the
Operation chain instead offers an operation called
generateTemplatePrompt that provides information about insertion point
in the existing UI and a prompt, possibly enhanced.

Another chain can use these information and a more sophisticated prompt
and model to then generate the user interface and return a
generateInsertTemplate wsOperation. Webstudio does exactly this in a
rest endpoint, using the template-generator chain with gpt4 instead of
gpt-3.5-turbo.
2023-10-06 09:07:59 +02:00
Bogdan Chadkin 4928661d9a refactor: drop react wrappers from auth stores (#2366)
Similar to https://github.com/webstudio-is/webstudio/pull/2365

Here migrated auth permit and auth token to direct access and renamed
them according to new convention.
2023-09-25 18:12:11 +04:00
Giuseppe 61c7960d3c feat: AI Package (#2307)
This PR introduces the baseline `@webstudio-is/ai` package which
includes:

1. A LLM Abstraction (types) for messages format to make requests to a
model
2. An implementation of the above that uses the OpenAI chat completion
endpoint
3. A common interface for chains. Chains are regular async functions
that can execute an arbitrary number of steps, including calling a LLM
via a model client.

The idea is that a builder API route can use any of these chains to
perform a task that requires AI. For example generate text copy, images,
a theme etc.
2023-09-25 10:59:44 +02:00
Ivan Starkov f3f7f88df3 Add admin (publish) permissions to tokens (#2221)
## Description

Add admin permissions to shared links

<img width="328" alt="image"
src="https://github.com/webstudio-is/webstudio/assets/5077042/972a46b9-154b-4426-9d8c-ab62ebf9a9e3">

<img width="283" alt="image"
src="https://github.com/webstudio-is/webstudio/assets/5077042/d187da84-4d49-4308-b6ea-f09cb7a09e8c">


Share links for now disabled for admin role. Will do in the next
iteration after releasing above.


## Steps for reproduction

Create admin token link.
Open in incognito, see Publish is working.

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-09-04 12:10:29 +03:00
Ivan Starkov 1a21c4d3c3 Fix preview mode toggle and sync (#1865)
## Description

closes #1841

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-06-28 10:05:07 +04:00
Ivan Starkov cba00105db Sync pages change (#1856)
## Description

Changed pages synchronisation.

We had following path on link click in canvas:

- We intercept it in handleLinkClick and do publish('switchPage', {});
- We subscribe on 'switchPage' at builder and do navigate(builderPath, {
pageId});
- We subscribe on useSearchParams extract from there pageId and do
selectedPageIdStore.set(pageId)
- On Canvas we subscribe on selectedPageStore and finally render the
page

Now we just change
`selectedPageHashStore`, `selectedPageIdStore` in a single function
`switchPage`
`location.searchParams` used only for initial and popstate
synchronisation.


pageHashStore added for future use, no logic now.



## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-06-26 10:22:13 +04:00
Ivan Starkov 37c8608eae Custom Domains (#1564)
## Description

How it looks. (Not everything aligned or have features like in design)


https://github.com/webstudio-is/webstudio-builder/assets/5077042/349c7fae-afd8-478d-9eba-701b002f0fd4

Most API methods return `{ success: true } | {success: false, error:
string}` because in the future they need to be moved into server
workflows, and do not exist or return anything.

## Steps for reproduction

Run locally, at localhost I've created a fake domain creation API, to be
able to test UI.

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-05-25 19:11:54 +04:00
Bogdan Chadkin 25c1fb3706 Drop css endpoint (#1656)
See https://github.com/webstudio-is/webstudio-builder/pull/1565

We don't use it anymore and it's conflicts with vanilla-extract
integration in remix.
2023-05-20 14:27:43 +07:00
Bogdan Chadkin 7f0e1bb2f3 Upload files by url (#1547)
Here splitted asset upload into 2 phases

1. initial upload creates asset in db with uploading state and generates
unique name (POST /rest/assets endpoint)

2. use unique name to upload file, extract meta and mark asset as
uploaded (POST /rest/assets/$name endpoint)

This give us more straightforward data flow without creating temporary
asssets with fake id which are changed later.

And also unlock splitting files into separate table to allow securely
copy paste assets between projects (still wip).

Fixed persistent fetcher to support sequential submits.
2023-05-03 01:08:07 +08:00
Ivan Starkov 2328f37fd2 Fix Escape and Enter issues (#1374)
## Description

closes #1359

The only Esc event that needed to be passed into Canvas from the builder
is cancelCurrentDrag (don't know why)

- [x] - Todo reset/notshow outline on canvas Escape click too to have
visual response
- [x] - Fix Enter to work only in Navigator

## Steps for reproduction

See corresponding issue #1359 . 

## Code Review
- [x] hi @kof , I need you to do
  - test it on preview

- [x] hi @TrySound , I need you to do
  - detailed review (read every line)

## Before requesting a review

- [x] made a self-review
- [x] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [x] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-04-05 23:38:07 +04:00
Bogdan Chadkin 3edd4ea3cc Optimize canvas loading (#1310)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1044
https://github.com/webstudio-is/webstudio-builder/issues/360

Canvas no longer need to load any data. No longer need pages. No longer
need auth token. No longer need static css.

Here I cleaned all unnecessary logic to load canvas. It may load much
faster now.
2023-03-28 19:02:02 +07:00
Bogdan Chadkin 919d560396 Delete pages with stores (#1289)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1084

Now whole pages management is managed by immerhin patches. Got rid of
pages/$projectId endpoint and no longer used form utils.
2023-03-25 18:56:24 +07:00
Roman Pominov 4b1a6847a4 Refactor link behaviour in preview (#1237)
## Description

- Removed Link wrapper that used to apply `preserveBuildParams` (part 1
of #1120)
- Removed `preserveBuildParams` completely, because we no longer need it
as we request page switch instead of letting link to navigate
- Removed `mode` parameter from BuildParams, because it's always "edit"
now
- Fixes #1231

## Steps for reproduction

1. Open preview mode
2. Click on some links
2023-03-14 18:06:24 +03:00
Ivan Starkov af6337c227 Fix wrong or absense of canvas css on production, probably fix collapse (#1184)
## Description

closes #1159
with hight probablity closes #1183

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-03-07 11:58:29 +01:00
Ivan Starkov e799dcb28e To reduce size of published apps pass getComponent to InstanceRoot, add size limit (#1098)
## Description

Now published apps during build can pregenerate imports of used
components

https://github.com/webstudio-is/webstudio-builder/blob/89688ee837b45f0877ebe32d3aefb1869a97c0a1/packages/sdk-size-test/app/page-components/page-main.ts#L1-L3

And pas getComponent to InstanceRoot
https://github.com/webstudio-is/webstudio-builder/blob/89688ee837b45f0877ebe32d3aefb1869a97c0a1/packages/sdk-size-test/app/routes/$.tsx#L23

Also size-limit is added
https://github.com/webstudio-is/webstudio-builder/blob/89688ee837b45f0877ebe32d3aefb1869a97c0a1/packages/sdk-size-test/package.json#L10-L19


## Steps for reproduction

### What I did

Create sample remix app with sdk
Build: 256K

Increase size of sup component
Build now 564K

After changes build now 256kB

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-02-22 18:31:48 +03:00
Ivan Starkov 7e76a1d408 Fix build permission not work on page change inside builder (#1064)
## Description

1. What is this PR about (link the issue and add a short description)

closes #1063


## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-02-18 00:25:07 +04:00
Ivan Starkov d76c598090 Switch on link and generate css for all pages on server (#1041)
## Description

We are going to render CSS for all pages in production mode.
That allows us to switch on native remix links i.e. `export const links`

Also now for `published` pages we use same data as SaaS will. 
That would allow for investigating SaaS issues faster.

[x] - Also now check does ssr css is needed at all at "edit" mode.
_Checked, as of now we don't render `style` tags serverside and that
cause FOUC in designer on page switch,
cc @TrySound probably in Canvas we can render styles serverside too that
would allow us to not use /s/css path for canvas inside designer_


closes #929
closes https://github.com/webstudio-is/webstudio-saas/issues/51
closes #606

## Steps for reproduction

In local dev mode, create 2 pages in a project, and add cross-links on
both pages.
Do publish.
Go to the published page, see no fouc on link clicks.




## Code Review
- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)

- [ ] hi @TrySound , I need you to do
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-02-16 14:24:04 +03:00
Bogdan Chadkin 7bd744c7d9 Move pages schema to project-build (#1040)
We are moving all build related code from project to project-build. Here
moved pages schema and Build type.
2023-02-15 22:46:57 +03:00
Andras Bacsai ac413cdd5f rename designer to builder 2023-02-14 11:15:24 +01:00