@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,173 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React, { useState } from 'react';
|
|
4
|
-
import { getResponsiveValue, resolveThemeCssVariables } from '../utils';
|
|
5
|
-
import { Section } from '../theme-section';
|
|
6
|
-
import { useThemeSettingsContext } from '../theme-settings-context';
|
|
7
|
-
import { twMerge } from 'tailwind-merge';
|
|
8
|
-
import clsx from 'clsx';
|
|
9
|
-
import ThemeBlock from '../theme-block';
|
|
10
|
-
|
|
11
|
-
interface NotificationBannerSectionProps {
|
|
12
|
-
section: Section;
|
|
13
|
-
currentBreakpoint?: string;
|
|
14
|
-
isDesigner?: boolean;
|
|
15
|
-
placeholderId?: string;
|
|
16
|
-
selectedBlockId?: string | null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default function NotificationBannerSection({
|
|
20
|
-
section,
|
|
21
|
-
currentBreakpoint = 'desktop',
|
|
22
|
-
isDesigner = false,
|
|
23
|
-
placeholderId = '',
|
|
24
|
-
selectedBlockId = null
|
|
25
|
-
}: NotificationBannerSectionProps) {
|
|
26
|
-
const themeSettings = useThemeSettingsContext();
|
|
27
|
-
const [isDismissed, setIsDismissed] = useState(false);
|
|
28
|
-
|
|
29
|
-
const styles = section.styles || {};
|
|
30
|
-
const properties = section.properties || {};
|
|
31
|
-
|
|
32
|
-
const gradientStart = resolveThemeCssVariables(
|
|
33
|
-
getResponsiveValue(styles['background-gradient-start'], currentBreakpoint, '#a8e063') as string,
|
|
34
|
-
themeSettings
|
|
35
|
-
);
|
|
36
|
-
const gradientEnd = resolveThemeCssVariables(
|
|
37
|
-
getResponsiveValue(styles['background-gradient-end'], currentBreakpoint, '#d4fc79') as string,
|
|
38
|
-
themeSettings
|
|
39
|
-
);
|
|
40
|
-
const borderRadius = getResponsiveValue(styles['border-radius'], currentBreakpoint, '16px') as string;
|
|
41
|
-
const paddingTop = getResponsiveValue(styles['padding-top'], currentBreakpoint, 20);
|
|
42
|
-
const paddingRight = getResponsiveValue(styles['padding-right'], currentBreakpoint, 24);
|
|
43
|
-
const paddingBottom = getResponsiveValue(styles['padding-bottom'], currentBreakpoint, 20);
|
|
44
|
-
const paddingLeft = getResponsiveValue(styles['padding-left'], currentBreakpoint, 24);
|
|
45
|
-
const gap = getResponsiveValue(styles.gap, currentBreakpoint, 16);
|
|
46
|
-
const maxWidth = getResponsiveValue(styles['max-width'], currentBreakpoint, 'normal') as string;
|
|
47
|
-
const closeButtonColor = resolveThemeCssVariables(
|
|
48
|
-
getResponsiveValue(styles['close-button-color'], currentBreakpoint, '#33691e') as string,
|
|
49
|
-
themeSettings
|
|
50
|
-
);
|
|
51
|
-
const iconBgColor = resolveThemeCssVariables(
|
|
52
|
-
getResponsiveValue(styles['icon-background-color'], currentBreakpoint, '#ffffff40') as string,
|
|
53
|
-
themeSettings
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const dismissible = getResponsiveValue(properties.dismissible, currentBreakpoint, true);
|
|
57
|
-
|
|
58
|
-
const maxWidthClass =
|
|
59
|
-
maxWidth === 'narrow'
|
|
60
|
-
? 'max-w-4xl'
|
|
61
|
-
: maxWidth === 'normal'
|
|
62
|
-
? 'max-w-7xl'
|
|
63
|
-
: maxWidth === 'full'
|
|
64
|
-
? 'w-full'
|
|
65
|
-
: '';
|
|
66
|
-
|
|
67
|
-
const hasMaxWidth = maxWidth !== 'none' && maxWidth !== 'full';
|
|
68
|
-
|
|
69
|
-
const renderBlock = (block: any) => {
|
|
70
|
-
return (
|
|
71
|
-
<ThemeBlock
|
|
72
|
-
key={block.id}
|
|
73
|
-
block={block}
|
|
74
|
-
placeholderId={placeholderId}
|
|
75
|
-
sectionId={section.id}
|
|
76
|
-
isDesigner={isDesigner}
|
|
77
|
-
isSelected={selectedBlockId === block.id}
|
|
78
|
-
selectedBlockId={selectedBlockId}
|
|
79
|
-
currentBreakpoint={currentBreakpoint}
|
|
80
|
-
onMoveUp={() => {
|
|
81
|
-
if (window.parent) window.parent.postMessage({ type: 'MOVE_BLOCK_UP', data: { placeholderId, sectionId: section.id, blockId: block.id } }, '*');
|
|
82
|
-
}}
|
|
83
|
-
onMoveDown={() => {
|
|
84
|
-
if (window.parent) window.parent.postMessage({ type: 'MOVE_BLOCK_DOWN', data: { placeholderId, sectionId: section.id, blockId: block.id } }, '*');
|
|
85
|
-
}}
|
|
86
|
-
onDuplicate={() => {
|
|
87
|
-
if (window.parent) window.parent.postMessage({ type: 'DUPLICATE_BLOCK', data: { placeholderId, sectionId: section.id, blockId: block.id } }, '*');
|
|
88
|
-
}}
|
|
89
|
-
onToggleVisibility={() => {
|
|
90
|
-
if (window.parent) window.parent.postMessage({ type: 'TOGGLE_BLOCK_VISIBILITY', data: { placeholderId, sectionId: section.id, blockId: block.id } }, '*');
|
|
91
|
-
}}
|
|
92
|
-
onDelete={() => {
|
|
93
|
-
if (window.parent) window.parent.postMessage({ type: 'DELETE_BLOCK', data: { placeholderId, sectionId: section.id, blockId: block.id } }, '*');
|
|
94
|
-
}}
|
|
95
|
-
onRename={(newLabel) => {
|
|
96
|
-
if (window.parent) window.parent.postMessage({ type: 'RENAME_BLOCK', data: { placeholderId, sectionId: section.id, blockId: block.id, label: newLabel } }, '*');
|
|
97
|
-
}}
|
|
98
|
-
/>
|
|
99
|
-
);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
if (isDismissed && !isDesigner) {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const iconBlock = section.blocks?.find(b => b.type === 'icon');
|
|
107
|
-
const contentBlocks = section.blocks?.filter(b => b.type !== 'icon') || [];
|
|
108
|
-
|
|
109
|
-
return (
|
|
110
|
-
<div
|
|
111
|
-
className={twMerge(
|
|
112
|
-
clsx(
|
|
113
|
-
'relative flex items-center transition-all duration-300',
|
|
114
|
-
hasMaxWidth && 'mx-auto',
|
|
115
|
-
maxWidthClass,
|
|
116
|
-
isDismissed && isDesigner && 'opacity-50'
|
|
117
|
-
)
|
|
118
|
-
)}
|
|
119
|
-
style={{
|
|
120
|
-
background: `linear-gradient(135deg, ${gradientStart} 0%, ${gradientEnd} 100%)`,
|
|
121
|
-
borderRadius,
|
|
122
|
-
paddingTop: typeof paddingTop === 'number' ? `${paddingTop}px` : paddingTop as string,
|
|
123
|
-
paddingRight: typeof paddingRight === 'number' ? `${paddingRight}px` : paddingRight as string,
|
|
124
|
-
paddingBottom: typeof paddingBottom === 'number' ? `${paddingBottom}px` : paddingBottom as string,
|
|
125
|
-
paddingLeft: typeof paddingLeft === 'number' ? `${paddingLeft}px` : paddingLeft as string,
|
|
126
|
-
gap: typeof gap === 'number' ? `${gap}px` : gap as string
|
|
127
|
-
}}
|
|
128
|
-
>
|
|
129
|
-
{iconBlock && (
|
|
130
|
-
<div
|
|
131
|
-
className="shrink-0 rounded-xl flex items-center justify-center"
|
|
132
|
-
style={{
|
|
133
|
-
backgroundColor: iconBgColor,
|
|
134
|
-
width: '56px',
|
|
135
|
-
height: '56px'
|
|
136
|
-
}}
|
|
137
|
-
>
|
|
138
|
-
{renderBlock(iconBlock)}
|
|
139
|
-
</div>
|
|
140
|
-
)}
|
|
141
|
-
|
|
142
|
-
<div className="flex-1 min-w-0">
|
|
143
|
-
{contentBlocks.map(block => renderBlock(block))}
|
|
144
|
-
</div>
|
|
145
|
-
|
|
146
|
-
{Boolean(dismissible) && (
|
|
147
|
-
<button
|
|
148
|
-
onClick={() => setIsDismissed(true)}
|
|
149
|
-
className={clsx(
|
|
150
|
-
'shrink-0 flex items-center justify-center rounded-full transition-colors duration-200',
|
|
151
|
-
'hover:bg-white/30 w-8 h-8'
|
|
152
|
-
)}
|
|
153
|
-
style={{ color: closeButtonColor }}
|
|
154
|
-
aria-label="Dismiss notification"
|
|
155
|
-
>
|
|
156
|
-
<svg
|
|
157
|
-
width="18"
|
|
158
|
-
height="18"
|
|
159
|
-
viewBox="0 0 24 24"
|
|
160
|
-
fill="none"
|
|
161
|
-
stroke="currentColor"
|
|
162
|
-
strokeWidth="2"
|
|
163
|
-
strokeLinecap="round"
|
|
164
|
-
strokeLinejoin="round"
|
|
165
|
-
>
|
|
166
|
-
<path d="M18 6L6 18" />
|
|
167
|
-
<path d="M6 6l12 12" />
|
|
168
|
-
</svg>
|
|
169
|
-
</button>
|
|
170
|
-
)}
|
|
171
|
-
</div>
|
|
172
|
-
);
|
|
173
|
-
}
|