@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,89 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Section } from '../theme-section';
|
|
3
|
-
import DividerSection from './divider-section';
|
|
4
|
-
import PostsSliderSection from './posts-slider-section';
|
|
5
|
-
import BeforeAfterSection from './before-after-section';
|
|
6
|
-
import NotificationBannerSection from './notification-banner-section';
|
|
7
|
-
import TabsSection from './tabs-section';
|
|
8
|
-
import ImageHotspotSection from './image-hotspot-section';
|
|
9
|
-
import CountdownCampaignBannerSection from './countdown-campaign-banner-section';
|
|
10
|
-
import StatsCounterSection from './stats-counter-section';
|
|
11
|
-
import CouponBannerSection from './coupon-banner-section';
|
|
12
|
-
import ShippingThresholdProgressSection from './shipping-threshold-progress-section';
|
|
13
|
-
import HoverShowcaseSection from './hover-showcase-section';
|
|
14
|
-
import ContactFormSection from './contact-form-section';
|
|
15
|
-
import FeaturedProductSpotlightSection from './featured-product-spotlight-section';
|
|
16
|
-
import PreOrderLaunchBannerSection from './pre-order-launch-banner-section';
|
|
17
|
-
import InstallmentOptionsSection from './installment-options-section';
|
|
18
|
-
import FindInStoreSection from './find-in-store-section';
|
|
19
|
-
import OrderTrackingLookupSection from './order-tracking-lookup-section';
|
|
20
|
-
|
|
21
|
-
interface SectionRendererProps {
|
|
22
|
-
section: Section;
|
|
23
|
-
currentBreakpoint?: string;
|
|
24
|
-
placeholderId?: string;
|
|
25
|
-
isDesigner?: boolean;
|
|
26
|
-
selectedBlockId?: string | null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type SectionRenderer = React.ComponentType<SectionRendererProps>;
|
|
30
|
-
|
|
31
|
-
class SectionRendererRegistry {
|
|
32
|
-
private renderers: Map<string, SectionRenderer> = new Map();
|
|
33
|
-
|
|
34
|
-
register(type: string, renderer: SectionRenderer) {
|
|
35
|
-
this.renderers.set(type, renderer);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
getRenderer(type: string): SectionRenderer | undefined {
|
|
39
|
-
return this.renderers.get(type);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
hasCustomRenderer(type: string): boolean {
|
|
43
|
-
return this.renderers.has(type);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const sectionRendererRegistry = new SectionRendererRegistry();
|
|
48
|
-
|
|
49
|
-
sectionRendererRegistry.register('divider', DividerSection);
|
|
50
|
-
sectionRendererRegistry.register('tabs', TabsSection);
|
|
51
|
-
sectionRendererRegistry.register('posts-slider', PostsSliderSection);
|
|
52
|
-
sectionRendererRegistry.register('flash-deals-slider', PostsSliderSection);
|
|
53
|
-
sectionRendererRegistry.register(
|
|
54
|
-
'installment-options',
|
|
55
|
-
InstallmentOptionsSection
|
|
56
|
-
);
|
|
57
|
-
sectionRendererRegistry.register(
|
|
58
|
-
'featured-product-spotlight',
|
|
59
|
-
FeaturedProductSpotlightSection
|
|
60
|
-
);
|
|
61
|
-
sectionRendererRegistry.register(
|
|
62
|
-
'pre-order-launch-banner',
|
|
63
|
-
PreOrderLaunchBannerSection
|
|
64
|
-
);
|
|
65
|
-
sectionRendererRegistry.register('image-hotspot', ImageHotspotSection);
|
|
66
|
-
sectionRendererRegistry.register('before-after', BeforeAfterSection);
|
|
67
|
-
sectionRendererRegistry.register(
|
|
68
|
-
'notification-banner',
|
|
69
|
-
NotificationBannerSection
|
|
70
|
-
);
|
|
71
|
-
sectionRendererRegistry.register(
|
|
72
|
-
'countdown-banner',
|
|
73
|
-
CountdownCampaignBannerSection
|
|
74
|
-
);
|
|
75
|
-
sectionRendererRegistry.register('stats-counter', StatsCounterSection);
|
|
76
|
-
sectionRendererRegistry.register('coupon-banner', CouponBannerSection);
|
|
77
|
-
sectionRendererRegistry.register(
|
|
78
|
-
'shipping-threshold-progress',
|
|
79
|
-
ShippingThresholdProgressSection
|
|
80
|
-
);
|
|
81
|
-
sectionRendererRegistry.register('hover-showcase', HoverShowcaseSection);
|
|
82
|
-
sectionRendererRegistry.register('contact-form', ContactFormSection);
|
|
83
|
-
sectionRendererRegistry.register(
|
|
84
|
-
'order-tracking-lookup',
|
|
85
|
-
OrderTrackingLookupSection
|
|
86
|
-
);
|
|
87
|
-
sectionRendererRegistry.register('find-in-store', FindInStoreSection);
|
|
88
|
-
|
|
89
|
-
export default sectionRendererRegistry;
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import ActionToolbar from '../components/action-toolbar';
|
|
5
|
-
import { twMerge } from 'tailwind-merge';
|
|
6
|
-
import clsx from 'clsx';
|
|
7
|
-
import { Section } from '../theme-section';
|
|
8
|
-
|
|
9
|
-
interface SectionWrapperProps {
|
|
10
|
-
section: Section;
|
|
11
|
-
placeholderId: string;
|
|
12
|
-
isDesigner?: boolean;
|
|
13
|
-
isSelected?: boolean;
|
|
14
|
-
onSelect?: (sectionId: string) => void;
|
|
15
|
-
onMoveUp?: () => void;
|
|
16
|
-
onMoveDown?: () => void;
|
|
17
|
-
onDuplicate?: () => void;
|
|
18
|
-
onToggleVisibility?: () => void;
|
|
19
|
-
onDelete?: () => void;
|
|
20
|
-
onRename?: (newLabel: string) => void;
|
|
21
|
-
children: React.ReactNode;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default function SectionWrapper({
|
|
25
|
-
section,
|
|
26
|
-
placeholderId,
|
|
27
|
-
isDesigner = false,
|
|
28
|
-
isSelected = false,
|
|
29
|
-
onSelect,
|
|
30
|
-
onMoveUp,
|
|
31
|
-
onMoveDown,
|
|
32
|
-
onDuplicate,
|
|
33
|
-
onToggleVisibility,
|
|
34
|
-
onDelete,
|
|
35
|
-
onRename,
|
|
36
|
-
children
|
|
37
|
-
}: SectionWrapperProps) {
|
|
38
|
-
const readSectionString = (value: unknown): string => {
|
|
39
|
-
if (value == null) return '';
|
|
40
|
-
if (typeof value === 'string') return value;
|
|
41
|
-
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
42
|
-
const responsive = value as Record<string, unknown>;
|
|
43
|
-
const picked =
|
|
44
|
-
responsive.desktop ?? responsive.mobile ?? Object.values(responsive)[0];
|
|
45
|
-
return picked == null ? '' : String(picked);
|
|
46
|
-
}
|
|
47
|
-
return String(value);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const isNewsletterSection = section.type === 'newsletter-signup-banner';
|
|
51
|
-
const newsletterEndpoint = readSectionString(
|
|
52
|
-
section.properties?.['api-endpoint']
|
|
53
|
-
).trim();
|
|
54
|
-
const newsletterSuccessMessage = readSectionString(
|
|
55
|
-
section.properties?.['success-message']
|
|
56
|
-
).trim();
|
|
57
|
-
const newsletterErrorMessage = readSectionString(
|
|
58
|
-
section.properties?.['error-message']
|
|
59
|
-
).trim();
|
|
60
|
-
|
|
61
|
-
const handleClick = (e: React.MouseEvent) => {
|
|
62
|
-
if (isDesigner && onSelect) {
|
|
63
|
-
e.stopPropagation();
|
|
64
|
-
onSelect(section.id);
|
|
65
|
-
|
|
66
|
-
if (window.parent) {
|
|
67
|
-
window.parent.postMessage(
|
|
68
|
-
{
|
|
69
|
-
type: 'SELECT_SECTION',
|
|
70
|
-
data: {
|
|
71
|
-
placeholderId,
|
|
72
|
-
sectionId: section.id
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
'*'
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<section
|
|
83
|
-
data-section-id={section.id}
|
|
84
|
-
data-newsletter-signup={isNewsletterSection ? 'true' : undefined}
|
|
85
|
-
data-newsletter-endpoint={
|
|
86
|
-
isNewsletterSection ? newsletterEndpoint : undefined
|
|
87
|
-
}
|
|
88
|
-
data-newsletter-success-message={
|
|
89
|
-
isNewsletterSection && newsletterSuccessMessage
|
|
90
|
-
? newsletterSuccessMessage
|
|
91
|
-
: undefined
|
|
92
|
-
}
|
|
93
|
-
data-newsletter-error-message={
|
|
94
|
-
isNewsletterSection && newsletterErrorMessage
|
|
95
|
-
? newsletterErrorMessage
|
|
96
|
-
: undefined
|
|
97
|
-
}
|
|
98
|
-
style={isDesigner && section.hidden ? { display: 'none' } : undefined}
|
|
99
|
-
className={`theme-section relative ${
|
|
100
|
-
isDesigner ? 'cursor-pointer group/section' : ''
|
|
101
|
-
}`}
|
|
102
|
-
onClick={handleClick}
|
|
103
|
-
>
|
|
104
|
-
{isDesigner && (
|
|
105
|
-
<div
|
|
106
|
-
className={twMerge(
|
|
107
|
-
clsx(
|
|
108
|
-
'absolute inset-0 pointer-events-none z-0 border-2 transition-all',
|
|
109
|
-
section.locked
|
|
110
|
-
? isSelected
|
|
111
|
-
? 'border-dashed border-amber-400 bg-amber-400/[0.12] shadow-[0_0_0_1px_rgba(251,191,36,0.4)]'
|
|
112
|
-
: 'border-dashed border-amber-300/25 bg-amber-400/[0.03] group-hover/section:border-amber-300/55 group-hover/section:bg-amber-400/[0.07]'
|
|
113
|
-
: 'border-transparent group-hover/section:border-[#4482ff] group-hover/section:bg-[#4482ff]/10',
|
|
114
|
-
!section.locked && isSelected && 'border-[#4482ff]'
|
|
115
|
-
)
|
|
116
|
-
)}
|
|
117
|
-
/>
|
|
118
|
-
)}
|
|
119
|
-
{isDesigner && isSelected && (
|
|
120
|
-
<ActionToolbar
|
|
121
|
-
label={section.label}
|
|
122
|
-
isLocked={section.locked === true}
|
|
123
|
-
zIndex={20}
|
|
124
|
-
onMoveUp={onMoveUp}
|
|
125
|
-
onMoveDown={onMoveDown}
|
|
126
|
-
onDuplicate={onDuplicate}
|
|
127
|
-
onToggleVisibility={onToggleVisibility}
|
|
128
|
-
onDelete={onDelete}
|
|
129
|
-
onRename={onRename}
|
|
130
|
-
/>
|
|
131
|
-
)}
|
|
132
|
-
<div className="relative z-10">{children}</div>
|
|
133
|
-
</section>
|
|
134
|
-
);
|
|
135
|
-
}
|