@akinon/projectzero 2.0.35-beta.0 → 2.0.35

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/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # @akinon/projectzero
2
2
 
3
- ## 2.0.35-beta.0
3
+ ## 2.0.35
4
+
5
+ ### Patch Changes
6
+
7
+ - 8dca03f2: ZERO-4663: introduce shared wire contract for theme editor and storefront
8
+
9
+ New `@akinon/theme-contract` package: shared wire types, versioned postMessage envelope (`protocolVersion`), runtime validation (`parseThemeMessage`) and origin helpers. `@akinon/pz-theme` now routes all designer postMessage traffic through an origin-guarded `editor-bridge` — inbound designer messages are validated against the editor-origin allowlist (`NEXT_PUBLIC_THEME_EDITOR_ORIGINS`, localhost auto-trusted outside production) and nothing is posted to `'*'` anymore.
4
10
 
5
11
  ## 2.0.34
6
12
 
@@ -1,37 +1,42 @@
1
1
  # projectzeronext
2
2
 
3
- ## 2.0.35-beta.0
4
-
5
- ### Patch Changes
6
-
7
- - Updated dependencies [cbbbfd75]
8
- - @akinon/next@2.0.35-beta.0
9
- - @akinon/pz-theme@2.0.35-beta.0
10
- - @akinon/pz-virtual-try-on@2.0.35-beta.0
11
- - @akinon/pz-akifast@2.0.35-beta.0
12
- - @akinon/pz-apple-pay@2.0.35-beta.0
13
- - @akinon/pz-b2b@2.0.35-beta.0
14
- - @akinon/pz-basket-gift-pack@2.0.35-beta.0
15
- - @akinon/pz-bkm@2.0.35-beta.0
16
- - @akinon/pz-checkout-gift-pack@2.0.35-beta.0
17
- - @akinon/pz-click-collect@2.0.35-beta.0
18
- - @akinon/pz-credit-payment@2.0.35-beta.0
19
- - @akinon/pz-cybersource-uc@2.0.35-beta.0
20
- - @akinon/pz-flow-payment@2.0.35-beta.0
21
- - @akinon/pz-google-pay@2.0.35-beta.0
22
- - @akinon/pz-gpay@2.0.35-beta.0
23
- - @akinon/pz-haso@2.0.35-beta.0
24
- - @akinon/pz-hepsipay@2.0.35-beta.0
25
- - @akinon/pz-masterpass@2.0.35-beta.0
26
- - @akinon/pz-masterpass-rest@2.0.35-beta.0
27
- - @akinon/pz-multi-basket@2.0.35-beta.0
28
- - @akinon/pz-one-click-checkout@2.0.35-beta.0
29
- - @akinon/pz-otp@2.0.35-beta.0
30
- - @akinon/pz-pay-on-delivery@2.0.35-beta.0
31
- - @akinon/pz-saved-card@2.0.35-beta.0
32
- - @akinon/pz-similar-products@2.0.35-beta.0
33
- - @akinon/pz-tabby-extension@2.0.35-beta.0
34
- - @akinon/pz-tamara-extension@2.0.35-beta.0
3
+ ## 2.0.35
4
+
5
+ ### Patch Changes
6
+
7
+ - 8dca03f2: ZERO-4663: introduce shared wire contract for theme editor and storefront
8
+
9
+ New `@akinon/theme-contract` package: shared wire types, versioned postMessage envelope (`protocolVersion`), runtime validation (`parseThemeMessage`) and origin helpers. `@akinon/pz-theme` now routes all designer postMessage traffic through an origin-guarded `editor-bridge` — inbound designer messages are validated against the editor-origin allowlist (`NEXT_PUBLIC_THEME_EDITOR_ORIGINS`, localhost auto-trusted outside production) and nothing is posted to `'*'` anymore.
10
+
11
+ - Updated dependencies [2f500a32]
12
+ - Updated dependencies [8dca03f2]
13
+ - @akinon/pz-theme@2.0.35
14
+ - @akinon/next@2.0.35
15
+ - @akinon/pz-virtual-try-on@2.0.35
16
+ - @akinon/pz-akifast@2.0.35
17
+ - @akinon/pz-apple-pay@2.0.35
18
+ - @akinon/pz-b2b@2.0.35
19
+ - @akinon/pz-basket-gift-pack@2.0.35
20
+ - @akinon/pz-bkm@2.0.35
21
+ - @akinon/pz-checkout-gift-pack@2.0.35
22
+ - @akinon/pz-click-collect@2.0.35
23
+ - @akinon/pz-credit-payment@2.0.35
24
+ - @akinon/pz-cybersource-uc@2.0.35
25
+ - @akinon/pz-flow-payment@2.0.35
26
+ - @akinon/pz-google-pay@2.0.35
27
+ - @akinon/pz-gpay@2.0.35
28
+ - @akinon/pz-haso@2.0.35
29
+ - @akinon/pz-hepsipay@2.0.35
30
+ - @akinon/pz-masterpass@2.0.35
31
+ - @akinon/pz-masterpass-rest@2.0.35
32
+ - @akinon/pz-multi-basket@2.0.35
33
+ - @akinon/pz-one-click-checkout@2.0.35
34
+ - @akinon/pz-otp@2.0.35
35
+ - @akinon/pz-pay-on-delivery@2.0.35
36
+ - @akinon/pz-saved-card@2.0.35
37
+ - @akinon/pz-similar-products@2.0.35
38
+ - @akinon/pz-tabby-extension@2.0.35
39
+ - @akinon/pz-tamara-extension@2.0.35
35
40
 
36
41
  ## 2.0.34
37
42
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projectzeronext",
3
- "version": "2.0.35-beta.0",
3
+ "version": "2.0.35",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -24,33 +24,33 @@
24
24
  "test:middleware": "jest middleware-matcher.test.ts --bail"
25
25
  },
26
26
  "dependencies": {
27
- "@akinon/next": "2.0.35-beta.0",
28
- "@akinon/pz-akifast": "2.0.35-beta.0",
29
- "@akinon/pz-apple-pay": "2.0.35-beta.0",
30
- "@akinon/pz-b2b": "2.0.35-beta.0",
31
- "@akinon/pz-basket-gift-pack": "2.0.35-beta.0",
32
- "@akinon/pz-bkm": "2.0.35-beta.0",
33
- "@akinon/pz-checkout-gift-pack": "2.0.35-beta.0",
34
- "@akinon/pz-click-collect": "2.0.35-beta.0",
35
- "@akinon/pz-credit-payment": "2.0.35-beta.0",
36
- "@akinon/pz-cybersource-uc": "2.0.35-beta.0",
37
- "@akinon/pz-flow-payment": "2.0.35-beta.0",
38
- "@akinon/pz-google-pay": "2.0.35-beta.0",
39
- "@akinon/pz-gpay": "2.0.35-beta.0",
40
- "@akinon/pz-haso": "2.0.35-beta.0",
41
- "@akinon/pz-hepsipay": "2.0.35-beta.0",
42
- "@akinon/pz-masterpass": "2.0.35-beta.0",
43
- "@akinon/pz-masterpass-rest": "2.0.35-beta.0",
44
- "@akinon/pz-multi-basket": "2.0.35-beta.0",
45
- "@akinon/pz-one-click-checkout": "2.0.35-beta.0",
46
- "@akinon/pz-otp": "2.0.35-beta.0",
47
- "@akinon/pz-pay-on-delivery": "2.0.35-beta.0",
48
- "@akinon/pz-saved-card": "2.0.35-beta.0",
49
- "@akinon/pz-similar-products": "2.0.35-beta.0",
50
- "@akinon/pz-tabby-extension": "2.0.35-beta.0",
51
- "@akinon/pz-tamara-extension": "2.0.35-beta.0",
52
- "@akinon/pz-theme": "2.0.35-beta.0",
53
- "@akinon/pz-virtual-try-on": "2.0.35-beta.0",
27
+ "@akinon/next": "2.0.35",
28
+ "@akinon/pz-akifast": "2.0.35",
29
+ "@akinon/pz-apple-pay": "2.0.35",
30
+ "@akinon/pz-b2b": "2.0.35",
31
+ "@akinon/pz-basket-gift-pack": "2.0.35",
32
+ "@akinon/pz-bkm": "2.0.35",
33
+ "@akinon/pz-checkout-gift-pack": "2.0.35",
34
+ "@akinon/pz-click-collect": "2.0.35",
35
+ "@akinon/pz-credit-payment": "2.0.35",
36
+ "@akinon/pz-cybersource-uc": "2.0.35",
37
+ "@akinon/pz-flow-payment": "2.0.35",
38
+ "@akinon/pz-google-pay": "2.0.35",
39
+ "@akinon/pz-gpay": "2.0.35",
40
+ "@akinon/pz-haso": "2.0.35",
41
+ "@akinon/pz-hepsipay": "2.0.35",
42
+ "@akinon/pz-masterpass": "2.0.35",
43
+ "@akinon/pz-masterpass-rest": "2.0.35",
44
+ "@akinon/pz-multi-basket": "2.0.35",
45
+ "@akinon/pz-one-click-checkout": "2.0.35",
46
+ "@akinon/pz-otp": "2.0.35",
47
+ "@akinon/pz-pay-on-delivery": "2.0.35",
48
+ "@akinon/pz-saved-card": "2.0.35",
49
+ "@akinon/pz-similar-products": "2.0.35",
50
+ "@akinon/pz-tabby-extension": "2.0.35",
51
+ "@akinon/pz-tamara-extension": "2.0.35",
52
+ "@akinon/pz-theme": "2.0.35",
53
+ "@akinon/pz-virtual-try-on": "2.0.35",
54
54
  "@hookform/resolvers": "2.9.0",
55
55
  "@next/third-parties": "16.2.6",
56
56
  "@react-google-maps/api": "2.17.1",
@@ -74,7 +74,7 @@
74
74
  "yup": "0.32.11"
75
75
  },
76
76
  "devDependencies": {
77
- "@akinon/eslint-plugin-projectzero": "2.0.35-beta.0",
77
+ "@akinon/eslint-plugin-projectzero": "2.0.35",
78
78
  "@semantic-release/changelog": "6.0.2",
79
79
  "@semantic-release/exec": "6.0.3",
80
80
  "@semantic-release/git": "10.0.1",
@@ -4,6 +4,10 @@ import { useLocalization } from '@akinon/next/hooks';
4
4
  import { useEffect, useRef } from 'react';
5
5
  import { Select } from './select';
6
6
 
7
+ import {
8
+ isTrustedEditorEvent,
9
+ postToEditor
10
+ } from '@akinon/pz-theme/src/editor-bridge';
7
11
  interface LanguageSelectProps {
8
12
  className?: string;
9
13
  showIcon?: boolean;
@@ -20,24 +24,22 @@ export const LanguageSelect = (props: LanguageSelectProps) => {
20
24
 
21
25
  useEffect(() => {
22
26
  if (window.parent !== window && !isUpdatingFromParent.current) {
23
- window.parent.postMessage(
24
- {
25
- type: 'LOCALE_UPDATE',
26
- data: {
27
- locale,
28
- locales: locales.map((lang) => ({
29
- value: lang.value,
30
- label: lang.label
31
- }))
32
- }
33
- },
34
- '*'
35
- );
27
+ postToEditor({
28
+ type: 'LOCALE_UPDATE',
29
+ data: {
30
+ locale,
31
+ locales: locales.map((lang) => ({
32
+ value: lang.value,
33
+ label: lang.label
34
+ }))
35
+ }
36
+ });
36
37
  }
37
38
  }, [locale, locales]);
38
39
 
39
40
  useEffect(() => {
40
41
  const handleMessage = (event: MessageEvent) => {
42
+ if (!isTrustedEditorEvent(event)) return;
41
43
  if (event.data?.type === 'LOCALE_UPDATE') {
42
44
  const { locale: newLocale } = event.data.data;
43
45
 
@@ -61,19 +63,16 @@ export const LanguageSelect = (props: LanguageSelectProps) => {
61
63
  setLocale(selectedLanguage);
62
64
 
63
65
  if (window.parent !== window) {
64
- window.parent.postMessage(
65
- {
66
- type: 'LOCALE_UPDATE',
67
- data: {
68
- locale: selectedLanguage,
69
- locales: locales.map((lang) => ({
70
- value: lang.value,
71
- label: lang.label
72
- }))
73
- }
74
- },
75
- '*'
76
- );
66
+ postToEditor({
67
+ type: 'LOCALE_UPDATE',
68
+ data: {
69
+ locale: selectedLanguage,
70
+ locales: locales.map((lang) => ({
71
+ value: lang.value,
72
+ label: lang.label
73
+ }))
74
+ }
75
+ });
77
76
  }
78
77
  };
79
78
 
@@ -7,20 +7,18 @@ import {
7
7
  useSelectedLayoutSegment
8
8
  } from 'next/navigation';
9
9
 
10
+ import { postToEditor } from '@akinon/pz-theme/src/editor-bridge';
10
11
  const RouteHandler = () => {
11
12
  const pathname = usePathname();
12
13
  const searchParams = useSearchParams();
13
14
  const layoutSegment = useSelectedLayoutSegment();
14
15
 
15
16
  useEffect(() => {
16
- window.parent.postMessage(
17
- {
18
- type: 'ROUTE_CHANGE_COMPLETE',
19
- url: `${pathname}?${searchParams}`,
20
- layoutSegment: layoutSegment === null ? 'home' : layoutSegment
21
- },
22
- '*'
23
- );
17
+ postToEditor({
18
+ type: 'ROUTE_CHANGE_COMPLETE',
19
+ url: `${pathname}?${searchParams}`,
20
+ layoutSegment: layoutSegment === null ? 'home' : layoutSegment
21
+ });
24
22
  }, [pathname, searchParams]);
25
23
 
26
24
  useEffect(() => {
@@ -32,10 +30,10 @@ const RouteHandler = () => {
32
30
  const isMenuToggle =
33
31
  anchor.getAttribute('data-is-menu-toggle') === 'true';
34
32
  if (!isMenuToggle) {
35
- window.parent.postMessage(
36
- { type: 'ROUTE_CHANGE_START', url: anchor.getAttribute('href') },
37
- '*'
38
- );
33
+ postToEditor({
34
+ type: 'ROUTE_CHANGE_START',
35
+ url: anchor.getAttribute('href')
36
+ });
39
37
  }
40
38
  }
41
39
  };
@@ -33,11 +33,12 @@ describe('theme-page-context utils', () => {
33
33
  variants: []
34
34
  } as never);
35
35
 
36
- expect(productPageContext.product.title).toBe('Spring Sneaker');
37
- expect(productPageContext.product.url).toBe('/products/spring-sneaker');
38
- expect(productPageContext.product.images[0].url).toBe(
39
- 'https://cdn.example.com/image.jpg'
40
- );
36
+ // The normalized aliases (title/url/images) are added dynamically and
37
+ // are not part of the declared product type.
38
+ const product = productPageContext.product as Record<string, any>;
39
+ expect(product.title).toBe('Spring Sneaker');
40
+ expect(product.url).toBe('/products/spring-sneaker');
41
+ expect(product.images[0].url).toBe('https://cdn.example.com/image.jpg');
41
42
  });
42
43
 
43
44
  it('builds listing context aliases for category/search/plp style pages', () => {
@@ -71,7 +72,9 @@ describe('theme-page-context utils', () => {
71
72
  sorters: [{ label: 'Newest', value: 'newest' }],
72
73
  search_text: 'sneaker'
73
74
  } as never,
74
- breadcrumbData: [{ label: 'Sneakers', path: '/category/sneakers' }] as never,
75
+ breadcrumbData: [
76
+ { label: 'Sneakers', path: '/category/sneakers' }
77
+ ] as never,
75
78
  pageType: 'search',
76
79
  path: '/list'
77
80
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/projectzero",
3
- "version": "2.0.35-beta.0",
3
+ "version": "2.0.35",
4
4
  "private": false,
5
5
  "description": "CLI tool to manage your Project Zero Next project",
6
6
  "bin": {