@akinon/next 2.0.0-beta.20 → 2.0.0-beta.22

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/api/auth.ts +292 -60
  3. package/bin/pz-install-plugins.js +1 -1
  4. package/package.json +3 -3
  5. package/types/index.ts +19 -6
  6. package/types/next-auth.d.ts +1 -1
  7. package/with-pz-config.js +8 -1
  8. package/components/theme-editor/blocks/accordion-block.tsx +0 -136
  9. package/components/theme-editor/blocks/block-renderer-registry.tsx +0 -77
  10. package/components/theme-editor/blocks/button-block.tsx +0 -593
  11. package/components/theme-editor/blocks/counter-block.tsx +0 -348
  12. package/components/theme-editor/blocks/divider-block.tsx +0 -20
  13. package/components/theme-editor/blocks/embed-block.tsx +0 -208
  14. package/components/theme-editor/blocks/group-block.tsx +0 -116
  15. package/components/theme-editor/blocks/hotspot-block.tsx +0 -147
  16. package/components/theme-editor/blocks/icon-block.tsx +0 -230
  17. package/components/theme-editor/blocks/image-block.tsx +0 -137
  18. package/components/theme-editor/blocks/image-gallery-block.tsx +0 -269
  19. package/components/theme-editor/blocks/input-block.tsx +0 -123
  20. package/components/theme-editor/blocks/link-block.tsx +0 -216
  21. package/components/theme-editor/blocks/lottie-block.tsx +0 -325
  22. package/components/theme-editor/blocks/map-block.tsx +0 -89
  23. package/components/theme-editor/blocks/slider-block.tsx +0 -595
  24. package/components/theme-editor/blocks/tab-block.tsx +0 -10
  25. package/components/theme-editor/blocks/text-block.tsx +0 -52
  26. package/components/theme-editor/blocks/video-block.tsx +0 -122
  27. package/components/theme-editor/components/action-toolbar.tsx +0 -305
  28. package/components/theme-editor/components/designer-overlay.tsx +0 -74
  29. package/components/theme-editor/components/with-designer-features.tsx +0 -142
  30. package/components/theme-editor/dynamic-font-loader.tsx +0 -79
  31. package/components/theme-editor/hooks/use-designer-features.tsx +0 -100
  32. package/components/theme-editor/hooks/use-external-designer.tsx +0 -95
  33. package/components/theme-editor/hooks/use-native-widget-data.ts +0 -188
  34. package/components/theme-editor/hooks/use-visibility-context.ts +0 -27
  35. package/components/theme-editor/placeholder-registry.ts +0 -31
  36. package/components/theme-editor/sections/before-after-section.tsx +0 -245
  37. package/components/theme-editor/sections/contact-form-section.tsx +0 -563
  38. package/components/theme-editor/sections/countdown-campaign-banner-section.tsx +0 -433
  39. package/components/theme-editor/sections/coupon-banner-section.tsx +0 -710
  40. package/components/theme-editor/sections/divider-section.tsx +0 -62
  41. package/components/theme-editor/sections/featured-product-spotlight-section.tsx +0 -507
  42. package/components/theme-editor/sections/find-in-store-section.tsx +0 -1995
  43. package/components/theme-editor/sections/hover-showcase-section.tsx +0 -326
  44. package/components/theme-editor/sections/image-hotspot-section.tsx +0 -142
  45. package/components/theme-editor/sections/installment-options-section.tsx +0 -1065
  46. package/components/theme-editor/sections/notification-banner-section.tsx +0 -173
  47. package/components/theme-editor/sections/order-tracking-lookup-section.tsx +0 -1379
  48. package/components/theme-editor/sections/posts-slider-section.tsx +0 -472
  49. package/components/theme-editor/sections/pre-order-launch-banner-section.tsx +0 -663
  50. package/components/theme-editor/sections/section-renderer-registry.tsx +0 -89
  51. package/components/theme-editor/sections/section-wrapper.tsx +0 -135
  52. package/components/theme-editor/sections/shipping-threshold-progress-section.tsx +0 -586
  53. package/components/theme-editor/sections/stats-counter-section.tsx +0 -486
  54. package/components/theme-editor/sections/tabs-section.tsx +0 -578
  55. package/components/theme-editor/theme-block.tsx +0 -102
  56. package/components/theme-editor/theme-placeholder-client.tsx +0 -218
  57. package/components/theme-editor/theme-placeholder-wrapper.tsx +0 -732
  58. package/components/theme-editor/theme-placeholder.tsx +0 -288
  59. package/components/theme-editor/theme-section.tsx +0 -1224
  60. package/components/theme-editor/theme-settings-context.tsx +0 -13
  61. package/components/theme-editor/utils/index.ts +0 -792
  62. package/components/theme-editor/utils/iterator-utils.ts +0 -234
  63. package/components/theme-editor/utils/publish-window.ts +0 -86
  64. package/components/theme-editor/utils/visibility-rules.ts +0 -188
@@ -1,245 +0,0 @@
1
- 'use client';
2
-
3
- import React, { useState, useRef, useEffect, useCallback } 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 BeforeAfterSectionProps {
12
- section: Section;
13
- currentBreakpoint?: string;
14
- isDesigner?: boolean;
15
- placeholderId?: string;
16
- selectedBlockId?: string | null;
17
- }
18
-
19
- export default function BeforeAfterSection({
20
- section,
21
- currentBreakpoint = 'desktop',
22
- isDesigner = false,
23
- placeholderId = '',
24
- selectedBlockId = null
25
- }: BeforeAfterSectionProps) {
26
- const themeSettings = useThemeSettingsContext();
27
- const [sliderPosition, setSliderPosition] = useState(50);
28
- const [isResizing, setIsResizing] = useState(false);
29
- const containerRef = useRef<HTMLDivElement>(null);
30
- const [containerWidth, setContainerWidth] = useState(0);
31
-
32
- const styles = section.styles || {};
33
- const properties = section.properties || {};
34
-
35
- const beforeBlock = section.blocks?.find(b => b.label === 'Before Image');
36
- const afterBlock = section.blocks?.find(b => b.label === 'After Image');
37
-
38
- const height = getResponsiveValue(styles.height, currentBreakpoint, '500px') as string | number;
39
- const width = getResponsiveValue(styles.width, currentBreakpoint, '100%') as string;
40
- const maxWidth = getResponsiveValue(styles['max-width'], currentBreakpoint, 'normal') as string;
41
-
42
- const sliderColor = resolveThemeCssVariables(
43
- getResponsiveValue(styles['slider-color'], currentBreakpoint, '#ffffff') as string,
44
- themeSettings
45
- );
46
-
47
- const renderBlock = (block: any) => {
48
- return (
49
- <ThemeBlock
50
- key={block.id}
51
- block={block}
52
- placeholderId={placeholderId}
53
- sectionId={section.id}
54
- isDesigner={isDesigner}
55
- isSelected={selectedBlockId === block.id}
56
- selectedBlockId={selectedBlockId}
57
- currentBreakpoint={currentBreakpoint}
58
- onMoveUp={() => {
59
- if (window.parent) window.parent.postMessage({ type: 'MOVE_BLOCK_UP', data: { placeholderId, sectionId: section.id, blockId: block.id } }, '*');
60
- }}
61
- onMoveDown={() => {
62
- if (window.parent) window.parent.postMessage({ type: 'MOVE_BLOCK_DOWN', data: { placeholderId, sectionId: section.id, blockId: block.id } }, '*');
63
- }}
64
- onDuplicate={() => {
65
- if (window.parent) window.parent.postMessage({ type: 'DUPLICATE_BLOCK', data: { placeholderId, sectionId: section.id, blockId: block.id } }, '*');
66
- }}
67
- onToggleVisibility={() => {
68
- if (window.parent) window.parent.postMessage({ type: 'TOGGLE_BLOCK_VISIBILITY', data: { placeholderId, sectionId: section.id, blockId: block.id } }, '*');
69
- }}
70
- onDelete={() => {
71
- if (window.parent) window.parent.postMessage({ type: 'DELETE_BLOCK', data: { placeholderId, sectionId: section.id, blockId: block.id } }, '*');
72
- }}
73
- onRename={(newLabel) => {
74
- if (window.parent) window.parent.postMessage({ type: 'RENAME_BLOCK', data: { placeholderId, sectionId: section.id, blockId: block.id, label: newLabel } }, '*');
75
- }}
76
- />
77
- );
78
- };
79
-
80
- useEffect(() => {
81
- if (!containerRef.current) return;
82
-
83
- setContainerWidth(containerRef.current.offsetWidth);
84
-
85
- const observer = new ResizeObserver((entries) => {
86
- for (const entry of entries) {
87
- setContainerWidth(entry.contentRect.width);
88
- }
89
- });
90
-
91
- observer.observe(containerRef.current);
92
-
93
- return () => observer.disconnect();
94
- }, []);
95
-
96
- const handleStart = (clientX: number) => {
97
- setIsResizing(true);
98
- if (containerRef.current) {
99
- const rect = containerRef.current.getBoundingClientRect();
100
- const x = Math.max(0, Math.min(clientX - rect.left, rect.width));
101
- setSliderPosition((x / rect.width) * 100);
102
- }
103
- };
104
-
105
- const handleMouseDown = (e: React.MouseEvent) => handleStart(e.clientX);
106
- const handleTouchStart = (e: React.TouchEvent) => handleStart(e.touches[0].clientX);
107
-
108
- const handleMove = useCallback(
109
- (clientX: number) => {
110
- if (!isResizing || !containerRef.current) return;
111
-
112
- const rect = containerRef.current.getBoundingClientRect();
113
- const x = Math.max(0, Math.min(clientX - rect.left, rect.width));
114
- const percentage = (x / rect.width) * 100;
115
-
116
- setSliderPosition(percentage);
117
- },
118
- [isResizing]
119
- );
120
-
121
- const handleMouseMove = (e: React.MouseEvent) => {
122
- if (isResizing) handleMove(e.clientX);
123
- };
124
-
125
- const handleTouchMove = (e: React.TouchEvent) => {
126
- if (isResizing) handleMove(e.touches[0].clientX);
127
- };
128
-
129
- useEffect(() => {
130
- const handleGlobalEnd = () => setIsResizing(false);
131
- const handleGlobalMove = (e: MouseEvent) => {
132
- if (isResizing) {
133
- e.preventDefault();
134
- handleMove(e.clientX);
135
- }
136
- };
137
-
138
- const handleGlobalTouchMove = (e: TouchEvent) => {
139
- if (isResizing) {
140
- handleMove(e.touches[0].clientX);
141
- }
142
- }
143
-
144
- if (isResizing) {
145
- window.addEventListener('mouseup', handleGlobalEnd);
146
- window.addEventListener('touchend', handleGlobalEnd);
147
- window.addEventListener('mousemove', handleGlobalMove);
148
- window.addEventListener('touchmove', handleGlobalTouchMove, { passive: false });
149
- }
150
-
151
- return () => {
152
- window.removeEventListener('mouseup', handleGlobalEnd);
153
- window.removeEventListener('touchend', handleGlobalEnd);
154
- window.removeEventListener('mousemove', handleGlobalMove);
155
- window.removeEventListener('touchmove', handleGlobalTouchMove);
156
- };
157
- }, [isResizing, handleMove]);
158
-
159
-
160
- const maxWidthClass =
161
- maxWidth === 'narrow'
162
- ? 'max-w-4xl'
163
- : maxWidth === 'normal'
164
- ? 'max-w-7xl'
165
- : maxWidth === 'full'
166
- ? 'w-full'
167
- : '';
168
-
169
- const hasMaxWidth = maxWidth !== 'none' && maxWidth !== 'full';
170
-
171
- return (
172
- <div
173
- className={twMerge(
174
- clsx(
175
- 'relative mx-auto select-none overflow-hidden group/before-after',
176
- hasMaxWidth && 'mx-auto',
177
- maxWidthClass
178
- )
179
- )}
180
- style={{
181
- height: typeof height === 'number' ? `${height}px` : height,
182
- width: width === 'fill' ? '100%' : width,
183
- maxWidth: maxWidth === 'none' ? 'none' : undefined
184
- }}
185
- ref={containerRef}
186
- onMouseDown={handleMouseDown}
187
- onTouchStart={handleTouchStart}
188
- onMouseMove={handleMouseMove}
189
- onTouchMove={handleTouchMove}
190
- >
191
- <div className="absolute inset-0 w-full h-full">
192
- {afterBlock ? (
193
- <div className="w-full h-full pointer-events-none">
194
- {renderBlock(afterBlock)}
195
- </div>
196
- ) : (
197
- <div className="w-full h-full bg-gray-200 flex items-center justify-center text-gray-400 select-none pointer-events-none">
198
- No After Image
199
- </div>
200
- )}
201
- </div>
202
-
203
- <div
204
- className="absolute top-0 left-0 h-full overflow-hidden border-r"
205
- style={{
206
- width: `${sliderPosition}%`,
207
- borderColor: sliderColor
208
- }}
209
- >
210
- <div
211
- className="relative h-full"
212
- style={{ width: containerWidth ? `${containerWidth}px` : '100%' }}
213
- >
214
- {beforeBlock ? (
215
- <div className="absolute top-0 left-0 w-full h-full pointer-events-none">
216
- {renderBlock(beforeBlock)}
217
- </div>
218
- ) : (
219
- <div className="absolute top-0 left-0 w-full h-full bg-gray-300 flex items-center justify-center text-gray-500 select-none pointer-events-none">
220
- No Before Image
221
- </div>
222
- )}
223
- </div>
224
- </div>
225
-
226
- <div
227
- className={clsx(
228
- "absolute top-0 bottom-0 w-1 z-20 cursor-ew-resize"
229
- )}
230
- style={{
231
- left: `${sliderPosition}%`,
232
- backgroundColor: sliderColor,
233
- transform: 'translateX(-50%)'
234
- }}
235
- >
236
- <div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-8 h-8 bg-white rounded-full shadow-lg flex items-center justify-center text-gray-800 pointer-events-none">
237
- <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
238
- <path d="M10 15l-3-3 3-3" />
239
- <path d="M14 15l3-3-3-3" />
240
- </svg>
241
- </div>
242
- </div>
243
- </div>
244
- );
245
- }