@akinon/next 2.0.0-beta.20 → 2.0.0-beta.21
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 +23 -0
- package/api/auth.ts +292 -60
- package/bin/pz-install-plugins.js +1 -1
- package/package.json +3 -3
- package/types/index.ts +19 -6
- package/types/next-auth.d.ts +1 -1
- package/with-pz-config.js +8 -1
- package/components/theme-editor/blocks/accordion-block.tsx +0 -136
- package/components/theme-editor/blocks/block-renderer-registry.tsx +0 -77
- package/components/theme-editor/blocks/button-block.tsx +0 -593
- package/components/theme-editor/blocks/counter-block.tsx +0 -348
- package/components/theme-editor/blocks/divider-block.tsx +0 -20
- package/components/theme-editor/blocks/embed-block.tsx +0 -208
- package/components/theme-editor/blocks/group-block.tsx +0 -116
- package/components/theme-editor/blocks/hotspot-block.tsx +0 -147
- package/components/theme-editor/blocks/icon-block.tsx +0 -230
- package/components/theme-editor/blocks/image-block.tsx +0 -137
- package/components/theme-editor/blocks/image-gallery-block.tsx +0 -269
- package/components/theme-editor/blocks/input-block.tsx +0 -123
- package/components/theme-editor/blocks/link-block.tsx +0 -216
- package/components/theme-editor/blocks/lottie-block.tsx +0 -325
- package/components/theme-editor/blocks/map-block.tsx +0 -89
- package/components/theme-editor/blocks/slider-block.tsx +0 -595
- package/components/theme-editor/blocks/tab-block.tsx +0 -10
- package/components/theme-editor/blocks/text-block.tsx +0 -52
- package/components/theme-editor/blocks/video-block.tsx +0 -122
- package/components/theme-editor/components/action-toolbar.tsx +0 -305
- package/components/theme-editor/components/designer-overlay.tsx +0 -74
- package/components/theme-editor/components/with-designer-features.tsx +0 -142
- package/components/theme-editor/dynamic-font-loader.tsx +0 -79
- package/components/theme-editor/hooks/use-designer-features.tsx +0 -100
- package/components/theme-editor/hooks/use-external-designer.tsx +0 -95
- package/components/theme-editor/hooks/use-native-widget-data.ts +0 -188
- package/components/theme-editor/hooks/use-visibility-context.ts +0 -27
- package/components/theme-editor/placeholder-registry.ts +0 -31
- package/components/theme-editor/sections/before-after-section.tsx +0 -245
- package/components/theme-editor/sections/contact-form-section.tsx +0 -563
- package/components/theme-editor/sections/countdown-campaign-banner-section.tsx +0 -433
- package/components/theme-editor/sections/coupon-banner-section.tsx +0 -710
- package/components/theme-editor/sections/divider-section.tsx +0 -62
- package/components/theme-editor/sections/featured-product-spotlight-section.tsx +0 -507
- package/components/theme-editor/sections/find-in-store-section.tsx +0 -1995
- package/components/theme-editor/sections/hover-showcase-section.tsx +0 -326
- package/components/theme-editor/sections/image-hotspot-section.tsx +0 -142
- package/components/theme-editor/sections/installment-options-section.tsx +0 -1065
- package/components/theme-editor/sections/notification-banner-section.tsx +0 -173
- package/components/theme-editor/sections/order-tracking-lookup-section.tsx +0 -1379
- package/components/theme-editor/sections/posts-slider-section.tsx +0 -472
- package/components/theme-editor/sections/pre-order-launch-banner-section.tsx +0 -663
- package/components/theme-editor/sections/section-renderer-registry.tsx +0 -89
- package/components/theme-editor/sections/section-wrapper.tsx +0 -135
- package/components/theme-editor/sections/shipping-threshold-progress-section.tsx +0 -586
- package/components/theme-editor/sections/stats-counter-section.tsx +0 -486
- package/components/theme-editor/sections/tabs-section.tsx +0 -578
- package/components/theme-editor/theme-block.tsx +0 -102
- package/components/theme-editor/theme-placeholder-client.tsx +0 -218
- package/components/theme-editor/theme-placeholder-wrapper.tsx +0 -732
- package/components/theme-editor/theme-placeholder.tsx +0 -288
- package/components/theme-editor/theme-section.tsx +0 -1224
- package/components/theme-editor/theme-settings-context.tsx +0 -13
- package/components/theme-editor/utils/index.ts +0 -792
- package/components/theme-editor/utils/iterator-utils.ts +0 -234
- package/components/theme-editor/utils/publish-window.ts +0 -86
- package/components/theme-editor/utils/visibility-rules.ts +0 -188
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { BlockRendererProps } from './block-renderer-registry';
|
|
3
|
-
import ThemeBlock from '../theme-block';
|
|
4
|
-
|
|
5
|
-
const AccordionBlock: React.FC<BlockRendererProps> = ({
|
|
6
|
-
block,
|
|
7
|
-
placeholderId,
|
|
8
|
-
sectionId,
|
|
9
|
-
isDesigner,
|
|
10
|
-
selectedBlockId,
|
|
11
|
-
currentBreakpoint = 'desktop'
|
|
12
|
-
}) => {
|
|
13
|
-
const childBlocks = block.blocks || [];
|
|
14
|
-
|
|
15
|
-
const defaultOpen = block.properties?.defaultOpen === true;
|
|
16
|
-
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
17
|
-
|
|
18
|
-
const headingBlock = childBlocks.find((b) => b.label === 'Accordion Heading');
|
|
19
|
-
const contentBlock = childBlocks.find((b) => b.label === 'Accordion Content');
|
|
20
|
-
|
|
21
|
-
if (!headingBlock && !contentBlock) {
|
|
22
|
-
return (
|
|
23
|
-
<div className="p-4 text-gray-400 border border-dashed border-gray-300 rounded">
|
|
24
|
-
No accordion content
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const renderHeading = () => {
|
|
30
|
-
if (!headingBlock) return null;
|
|
31
|
-
|
|
32
|
-
return headingBlock.blocks
|
|
33
|
-
?.filter((childBlock) => (isDesigner ? true : !childBlock.hidden))
|
|
34
|
-
.sort((a, b) => (a.order || 0) - (b.order || 0))
|
|
35
|
-
.map((childBlock, index) => {
|
|
36
|
-
const modifiedBlock =
|
|
37
|
-
childBlock.type === 'icon'
|
|
38
|
-
? {
|
|
39
|
-
...childBlock,
|
|
40
|
-
styles: {
|
|
41
|
-
...childBlock.styles,
|
|
42
|
-
transform: {
|
|
43
|
-
desktop: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
44
|
-
mobile: isOpen ? 'rotate(180deg)' : 'rotate(0deg)'
|
|
45
|
-
},
|
|
46
|
-
transition: {
|
|
47
|
-
desktop: 'transform 0.3s ease-in-out',
|
|
48
|
-
mobile: 'transform 0.3s ease-in-out'
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
: childBlock;
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<ThemeBlock
|
|
56
|
-
key={childBlock.id || `heading-block-${index}`}
|
|
57
|
-
block={modifiedBlock}
|
|
58
|
-
placeholderId={placeholderId}
|
|
59
|
-
sectionId={sectionId}
|
|
60
|
-
isDesigner={isDesigner}
|
|
61
|
-
isSelected={selectedBlockId === childBlock.id}
|
|
62
|
-
selectedBlockId={selectedBlockId}
|
|
63
|
-
currentBreakpoint={currentBreakpoint}
|
|
64
|
-
onMoveUp={undefined}
|
|
65
|
-
onMoveDown={undefined}
|
|
66
|
-
onDuplicate={undefined}
|
|
67
|
-
onToggleVisibility={undefined}
|
|
68
|
-
onDelete={undefined}
|
|
69
|
-
onRename={undefined}
|
|
70
|
-
/>
|
|
71
|
-
);
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const renderContent = () => {
|
|
76
|
-
if (!contentBlock) return null;
|
|
77
|
-
|
|
78
|
-
return contentBlock.blocks
|
|
79
|
-
?.filter((childBlock) => (isDesigner ? true : !childBlock.hidden))
|
|
80
|
-
.sort((a, b) => (a.order || 0) - (b.order || 0))
|
|
81
|
-
.map((childBlock, index) => {
|
|
82
|
-
return (
|
|
83
|
-
<ThemeBlock
|
|
84
|
-
key={childBlock.id || `content-block-${index}`}
|
|
85
|
-
block={childBlock}
|
|
86
|
-
placeholderId={placeholderId}
|
|
87
|
-
sectionId={sectionId}
|
|
88
|
-
isDesigner={isDesigner}
|
|
89
|
-
isSelected={selectedBlockId === childBlock.id}
|
|
90
|
-
selectedBlockId={selectedBlockId}
|
|
91
|
-
currentBreakpoint={currentBreakpoint}
|
|
92
|
-
onMoveUp={undefined}
|
|
93
|
-
onMoveDown={undefined}
|
|
94
|
-
onDuplicate={undefined}
|
|
95
|
-
onToggleVisibility={undefined}
|
|
96
|
-
onDelete={undefined}
|
|
97
|
-
onRename={undefined}
|
|
98
|
-
/>
|
|
99
|
-
);
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const toggleAccordion = (e: React.MouseEvent) => {
|
|
104
|
-
if (isDesigner) {
|
|
105
|
-
const target = e.target as HTMLElement;
|
|
106
|
-
if (
|
|
107
|
-
target.closest('[data-action-toolbar]') ||
|
|
108
|
-
target.closest('button') ||
|
|
109
|
-
target.closest('input')
|
|
110
|
-
) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
setIsOpen(!isOpen);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
return (
|
|
118
|
-
<>
|
|
119
|
-
<div style={{ cursor: 'pointer' }} onClick={toggleAccordion}>
|
|
120
|
-
{renderHeading()}
|
|
121
|
-
</div>
|
|
122
|
-
|
|
123
|
-
<div
|
|
124
|
-
style={{
|
|
125
|
-
display: 'grid',
|
|
126
|
-
gridTemplateRows: isOpen ? '1fr' : '0fr',
|
|
127
|
-
transition: 'grid-template-rows 0.3s ease-in-out'
|
|
128
|
-
}}
|
|
129
|
-
>
|
|
130
|
-
<div style={{ overflow: 'hidden' }}>{renderContent()}</div>
|
|
131
|
-
</div>
|
|
132
|
-
</>
|
|
133
|
-
);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export default AccordionBlock;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Block } from '../theme-block';
|
|
3
|
-
import TextBlock from './text-block';
|
|
4
|
-
import ImageBlock from './image-block';
|
|
5
|
-
import DividerBlock from './divider-block';
|
|
6
|
-
import GroupBlock from './group-block';
|
|
7
|
-
import ButtonBlock from './button-block';
|
|
8
|
-
import IconBlock from './icon-block';
|
|
9
|
-
import VideoBlock from './video-block';
|
|
10
|
-
import AccordionBlock from './accordion-block';
|
|
11
|
-
import TabBlock from './tab-block';
|
|
12
|
-
import CounterBlock from './counter-block';
|
|
13
|
-
import ImageGalleryBlock from './image-gallery-block';
|
|
14
|
-
import InputBlock from './input-block';
|
|
15
|
-
import SliderBlock from './slider-block';
|
|
16
|
-
import HotspotBlock from './hotspot-block';
|
|
17
|
-
import LinkBlock from './link-block';
|
|
18
|
-
import LottieBlock from './lottie-block';
|
|
19
|
-
import EmbedBlock from './embed-block';
|
|
20
|
-
import MapBlock from './map-block';
|
|
21
|
-
|
|
22
|
-
export interface BlockRendererProps {
|
|
23
|
-
block: Block;
|
|
24
|
-
placeholderId: string;
|
|
25
|
-
sectionId: string;
|
|
26
|
-
isDesigner: boolean;
|
|
27
|
-
isSelected?: boolean;
|
|
28
|
-
selectedBlockId?: string | null;
|
|
29
|
-
currentBreakpoint?: string;
|
|
30
|
-
onMoveUp?: () => void;
|
|
31
|
-
onMoveDown?: () => void;
|
|
32
|
-
onDuplicate?: () => void;
|
|
33
|
-
onToggleVisibility?: () => void;
|
|
34
|
-
onDelete?: () => void;
|
|
35
|
-
onRename?: (newLabel: string) => void;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
type BlockRenderer = React.ComponentType<BlockRendererProps>;
|
|
39
|
-
|
|
40
|
-
class BlockRendererRegistry {
|
|
41
|
-
private renderers: Map<string, BlockRenderer> = new Map();
|
|
42
|
-
|
|
43
|
-
register(type: string, renderer: BlockRenderer) {
|
|
44
|
-
this.renderers.set(type, renderer);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
getRenderer(type: string): BlockRenderer | undefined {
|
|
48
|
-
return this.renderers.get(type);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
hasRenderer(type: string): boolean {
|
|
52
|
-
return this.renderers.has(type);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const blockRendererRegistry = new BlockRendererRegistry();
|
|
57
|
-
|
|
58
|
-
blockRendererRegistry.register('text', TextBlock);
|
|
59
|
-
blockRendererRegistry.register('image', ImageBlock);
|
|
60
|
-
blockRendererRegistry.register('divider', DividerBlock);
|
|
61
|
-
blockRendererRegistry.register('group', GroupBlock);
|
|
62
|
-
blockRendererRegistry.register('button', ButtonBlock);
|
|
63
|
-
blockRendererRegistry.register('icon', IconBlock);
|
|
64
|
-
blockRendererRegistry.register('video', VideoBlock);
|
|
65
|
-
blockRendererRegistry.register('accordion', AccordionBlock);
|
|
66
|
-
blockRendererRegistry.register('tab', TabBlock);
|
|
67
|
-
blockRendererRegistry.register('counter', CounterBlock);
|
|
68
|
-
blockRendererRegistry.register('image-gallery', ImageGalleryBlock);
|
|
69
|
-
blockRendererRegistry.register('input', InputBlock);
|
|
70
|
-
blockRendererRegistry.register('slider', SliderBlock);
|
|
71
|
-
blockRendererRegistry.register('hotspot', HotspotBlock);
|
|
72
|
-
blockRendererRegistry.register('link', LinkBlock);
|
|
73
|
-
blockRendererRegistry.register('lottie', LottieBlock);
|
|
74
|
-
blockRendererRegistry.register('embed', EmbedBlock);
|
|
75
|
-
blockRendererRegistry.register('map', MapBlock);
|
|
76
|
-
|
|
77
|
-
export default blockRendererRegistry;
|