Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weaverse SDKs v3.3.0 #373

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @weaverse/core

## 3.3.0

## 3.2.9

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@weaverse/core",
"author": "Weaverse Team",
"description": "Weaverse Core",
"version": "3.2.9",
"version": "3.3.0",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
10 changes: 10 additions & 0 deletions packages/hydrogen/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @weaverse/hydrogen

## 3.3.0

### Minor Changes

- Fix Hydrogen Component loader data

### Patch Changes

- @weaverse/react@3.3.0

## 3.2.9

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/hydrogen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@weaverse/hydrogen",
"author": "Weaverse Team",
"description": "Components, hooks, and utilities for building Shopify Hydrogen websites with Weaverse",
"version": "3.2.9",
"version": "3.3.0",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -41,7 +41,7 @@
]
},
"dependencies": {
"@weaverse/react": "3.2.9",
"@weaverse/react": "3.3.0",
"react-error-boundary": "^4.0.13"
},
"peerDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/hydrogen/src/WeaverseHydrogenRoot.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Await, useLoaderData } from '@remix-run/react'
import { WeaverseRoot } from '@weaverse/react'
import { Suspense, memo } from 'react'
import { type ComponentType, type JSX, Suspense, memo } from 'react'
import { ErrorBoundary } from 'react-error-boundary'

import { WeaverseEffect } from '~/Effect'
Expand Down Expand Up @@ -62,8 +62,8 @@ function RenderRoot(props: {
)
}

export function withWeaverse(Component: React.ComponentType<any>) {
return (props: React.JSX.IntrinsicAttributes) => {
export function withWeaverse(Component: ComponentType<any>) {
return (props: JSX.IntrinsicAttributes) => {
let { settings } = useThemeSettingsStore()
return (
<ThemeSettingsProvider.Provider value={settings}>
Expand Down
22 changes: 11 additions & 11 deletions packages/hydrogen/src/weaverse-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ export class WeaverseClient {
throw new Error('Missing Weaverse projectId!')
}
let url = `${weaverseHost}/${API}/project_configs`
// biome-ignore lint/suspicious/noImplicitAnyLet: <explanation>
let res
let res: any
let body = JSON.stringify({ isDesignMode, projectId })
if (isDesignMode) {
res = await fetch(url, { method: 'POST', body }).then((res) =>
Expand Down Expand Up @@ -217,7 +216,7 @@ export class WeaverseClient {
let items = page.items
page.items = await Promise.all(items.map(this.execComponentLoader))
}
let data: WeaverseLoaderData = {
return {
page,
project,
pageAssignment,
Expand All @@ -232,7 +231,6 @@ export class WeaverseClient {
},
},
}
return data
} catch (e) {
// biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
console.error(`❌ Page load failed.`, e)
Expand All @@ -242,16 +240,18 @@ export class WeaverseClient {

execComponentLoader = async (item: HydrogenComponentData) => {
let { data = {}, type, id } = item
let schema = this.components.find(({ schema }) => schema?.type === type)
let loader = schema?.loader
if (loader && typeof loader === 'function') {
let component = this.components.find(({ schema }) => schema?.type === type)
let loader = component?.loader
if (typeof loader === 'function') {
try {
return {
...item,
loaderData: await loader({
data,
weaverse: this,
}),
loaderData: await Promise.resolve(
loader({
data: { ...generateDataFromSchema(component.schema), ...data },
weaverse: this,
}),
),
}
} catch (e) {
console.warn('❌ Item loader run failed.', type, id, e)
Expand Down
6 changes: 6 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @weaverse/react

## 3.3.0

### Patch Changes

- @weaverse/core@3.3.0

## 3.2.9

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@weaverse/react",
"author": "Weaverse Team",
"description": "React bindings for Weaverse",
"version": "3.2.9",
"version": "3.3.0",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -39,7 +39,7 @@
"react-dom": ">=18"
},
"dependencies": {
"@weaverse/core": "3.2.9",
"@weaverse/core": "3.3.0",
"clsx": "^2.1.1"
}
}
6 changes: 6 additions & 0 deletions packages/shopify/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @weaverse/shopify

## 3.3.0

### Patch Changes

- @weaverse/react@3.3.0

## 3.2.9

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/shopify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@weaverse/shopify",
"author": "Weaverse Team",
"description": "Weaverse Components for Shopify Online Store 2.0 Section builder",
"version": "3.2.9",
"version": "3.3.0",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -47,7 +47,7 @@
"dependencies": {
"@radix-ui/react-dialog": "^1.1.1",
"@stitches/react": "^1.2.8",
"@weaverse/react": "3.2.9",
"@weaverse/react": "3.3.0",
"keen-slider": "^6.8.6"
}
}
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion templates/pilot
Submodule pilot updated from ab356e to 5e4df0
Loading