@wix/ditto-codegen-public 1.0.217 → 1.0.219
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/dist/examples-apps/react-builder/component.tsx +117 -0
- package/dist/examples-apps/react-builder/components/Badge.tsx +14 -0
- package/dist/examples-apps/react-builder/components/Button.tsx +31 -0
- package/dist/examples-apps/react-builder/components/Counter.tsx +14 -0
- package/dist/examples-apps/react-builder/components/FeaturedImage.tsx +31 -0
- package/dist/examples-apps/react-builder/components/SocialLinks.tsx +61 -0
- package/dist/examples-apps/react-builder/components/Subtitle.tsx +11 -0
- package/dist/examples-apps/react-builder/components/Tags.tsx +25 -0
- package/dist/examples-apps/react-builder/components/Title.tsx +11 -0
- package/dist/examples-apps/react-builder/components/index.ts +8 -0
- package/dist/examples-apps/react-builder/manifest.json +325 -0
- package/dist/examples-apps/react-builder/style.css +197 -0
- package/dist/examples-apps/react-builder/types.ts +68 -0
- package/dist/out.js +615 -61
- package/dist/wix-cli-templates/src/site/components/my-component/component.tsx +8 -5
- package/dist/wix-cli-templates/src/site/components/my-component/manifest.json +14 -0
- package/dist/wix-cli-templates/src/site/components/my-component/{styles.module.css → style.css} +1 -1
- package/package.json +2 -2
- package/dist/examples-apps/inventory-countdown/.nvmrc +0 -1
- package/dist/examples-apps/inventory-countdown/README.md +0 -21
- package/dist/examples-apps/inventory-countdown/package-lock.json +0 -7457
- package/dist/examples-apps/inventory-countdown/package.json +0 -33
- package/dist/examples-apps/inventory-countdown/src/assets/stock-counter/site-plugin-logo.svg +0 -27
- package/dist/examples-apps/inventory-countdown/src/env.d.ts +0 -4
- package/dist/examples-apps/inventory-countdown/src/site/plugins/custom-elements/stock-counter/consts.ts +0 -1
- package/dist/examples-apps/inventory-countdown/src/site/plugins/custom-elements/stock-counter/panel.tsx +0 -81
- package/dist/examples-apps/inventory-countdown/src/site/plugins/custom-elements/stock-counter/plugin.json +0 -24
- package/dist/examples-apps/inventory-countdown/src/site/plugins/custom-elements/stock-counter/plugin.module.css +0 -4
- package/dist/examples-apps/inventory-countdown/src/site/plugins/custom-elements/stock-counter/plugin.tsx +0 -132
- package/dist/examples-apps/inventory-countdown/tsconfig.json +0 -8
- package/dist/examples-apps/inventory-countdown/wix.config.json +0 -5
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "inventory-countdown",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"dependencies": {
|
|
5
|
-
"@wix/dashboard": "^1.3.21",
|
|
6
|
-
"@wix/design-system": "^1.0.0",
|
|
7
|
-
"@wix/editor": "^1.308.0",
|
|
8
|
-
"@wix/site-window": "^1.19.0",
|
|
9
|
-
"@wix/stores": "^1.0.239",
|
|
10
|
-
"@wix/wix-ui-icons-common": "^3.0.0",
|
|
11
|
-
"react-to-webcomponent": "^2.0.0"
|
|
12
|
-
},
|
|
13
|
-
"devDependencies": {
|
|
14
|
-
"@types/react": "^16.0.0",
|
|
15
|
-
"@types/react-dom": "^16.0.0",
|
|
16
|
-
"@wix/sdk-types": "^1.0.0",
|
|
17
|
-
"@wix/cli": "^1.0.0",
|
|
18
|
-
"@wix/cli-app": "^1.0.0",
|
|
19
|
-
"react": "16.14.0",
|
|
20
|
-
"react-dom": "16.14.0",
|
|
21
|
-
"typescript": "^5.4.0"
|
|
22
|
-
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"wix": "wix",
|
|
25
|
-
"build": "wix app build",
|
|
26
|
-
"release": "wix app release",
|
|
27
|
-
"dev": "wix app dev",
|
|
28
|
-
"preview": "wix app preview",
|
|
29
|
-
"generate": "wix app generate",
|
|
30
|
-
"logs": "wix app logs",
|
|
31
|
-
"typecheck": "tsc --noEmit"
|
|
32
|
-
}
|
|
33
|
-
}
|
package/dist/examples-apps/inventory-countdown/src/assets/stock-counter/site-plugin-logo.svg
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="1000.000000pt" fill="#333853" height="1000.000000pt" viewBox="0 0 1000.000000 1000.000000" preserveAspectRatio="xMidYMid meet">
|
|
2
|
-
<rect width="100%" height="100%" fill="#333853"/>
|
|
3
|
-
<g transform="translate(0.000000,1000.000000) scale(0.100000,-0.100000)" fill="#333853">
|
|
4
|
-
<path fill="#dae9ff" d="M0 5000 l0 -5000 5000 0 5000 0 0 5000 0 5000 -5000 0 -5000 0 0
|
|
5
|
-
-5000z m7694 2520 c220 -56 389 -218 458 -440 l23 -75 0 -2010 0 -2010 -29
|
|
6
|
-
-89 c-71 -216 -235 -371 -452 -426 -76 -20 -122 -20 -2699 -20 -2577 0 -2623
|
|
7
|
-
0 -2699 20 -220 56 -389 218 -458 440 l-23 75 0 2010 0 2010 29 89 c70 214
|
|
8
|
-
234 370 448 426 71 18 148 19 2699 19 2582 1 2627 1 2703 -19z"/>
|
|
9
|
-
<path fill="#dae9ff" d="M2450 4995 l0 -1905 1115 0 1115 0 0 1905 0 1905 -1115 0 -1115 0 0
|
|
10
|
-
-1905z m1558 1133 c19 -19 17 -2381 -2 -2397 -9 -8 -81 -11 -237 -9 l-224 3
|
|
11
|
-
-3 910 c-1 508 -6 913 -11 918 -5 5 -119 -26 -270 -73 -144 -45 -269 -80 -279
|
|
12
|
-
-78 -15 3 -17 23 -20 185 -2 171 -1 183 17 195 28 17 972 356 997 357 11 1 25
|
|
13
|
-
-4 32 -11z"/>
|
|
14
|
-
<path fill="#dae9ff" d="M5310 4995 l0 -1905 410 0 410 0 0 134 0 134 168 4 c166 3 168 3 234
|
|
15
|
-
36 86 42 161 123 183 194 34 115 11 259 -52 329 -57 63 -103 82 -209 87 -132
|
|
16
|
-
6 -227 -24 -299 -95 -35 -35 -64 -98 -65 -140 l0 -33 -245 0 c-165 0 -245 3
|
|
17
|
-
-245 11 0 43 39 170 77 249 86 179 243 303 458 362 70 19 106 22 290 23 189 0
|
|
18
|
-
218 -2 294 -23 201 -55 347 -164 421 -316 93 -187 92 -391 -2 -584 -41 -85
|
|
19
|
-
-141 -188 -222 -229 l-59 -30 81 -56 80 -57 261 0 261 0 0 1905 0 1905 -196 0
|
|
20
|
-
c-183 0 -196 -1 -189 -17 31 -71 48 -166 48 -278 1 -106 -2 -129 -26 -198 -31
|
|
21
|
-
-89 -99 -228 -154 -315 -21 -32 -204 -241 -407 -463 l-369 -404 526 -3 527 -2
|
|
22
|
-
0 -190 0 -190 -825 0 c-652 0 -826 3 -830 13 -2 6 -6 80 -9 162 l-6 150 146
|
|
23
|
-
155 c217 230 659 710 764 830 108 124 124 152 156 278 62 243 5 412 -152 458
|
|
24
|
-
-74 21 -199 15 -265 -14 -122 -53 -198 -182 -199 -334 l0 -48 -246 0 -247 0 7
|
|
25
|
-
61 c9 79 48 213 85 289 l28 60 -198 0 -199 0 0 -1905z"/>
|
|
26
|
-
</g>
|
|
27
|
-
</svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const CALL_TO_ACTION = "Don't miss your chance";
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import React, { type FC, useState, useEffect } from 'react';
|
|
2
|
-
import { widget } from '@wix/editor';
|
|
3
|
-
import {
|
|
4
|
-
SidePanel,
|
|
5
|
-
WixDesignSystemProvider,
|
|
6
|
-
Input,
|
|
7
|
-
FieldSet,
|
|
8
|
-
Slider,
|
|
9
|
-
ToggleSwitch,
|
|
10
|
-
FormField,
|
|
11
|
-
} from '@wix/design-system';
|
|
12
|
-
import '@wix/design-system/styles.global.css';
|
|
13
|
-
import { CALL_TO_ACTION } from './consts.js';
|
|
14
|
-
|
|
15
|
-
const Panel: FC = () => {
|
|
16
|
-
const [threshold, setThreshold] = useState<number>(3);
|
|
17
|
-
const [callToAction, setCallToAction] = useState<string>();
|
|
18
|
-
const [showBadge, setShowBadge] = useState<string>();
|
|
19
|
-
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
widget
|
|
22
|
-
.getProp('threshold')
|
|
23
|
-
.then((threshold) => setThreshold(threshold ? Number(threshold) : 3));
|
|
24
|
-
widget.getProp('call-to-action').then(setCallToAction);
|
|
25
|
-
widget.getProp('show-badge').then(setShowBadge);
|
|
26
|
-
}, []);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<WixDesignSystemProvider features={{ newColorsBranding: true }}>
|
|
30
|
-
<SidePanel.Field>
|
|
31
|
-
<FieldSet gap="medium" legend="Threshold" columns="auto 60px">
|
|
32
|
-
<Slider
|
|
33
|
-
onChange={(value) => {
|
|
34
|
-
setThreshold(value as number);
|
|
35
|
-
widget.setProp('threshold', value.toString());
|
|
36
|
-
}}
|
|
37
|
-
min={0}
|
|
38
|
-
max={25}
|
|
39
|
-
value={threshold}
|
|
40
|
-
displayMarks={false}
|
|
41
|
-
/>
|
|
42
|
-
<Input
|
|
43
|
-
value={threshold}
|
|
44
|
-
size="small"
|
|
45
|
-
onChange={(event) => {
|
|
46
|
-
setThreshold(Number(event.target.value));
|
|
47
|
-
widget.setProp('threshold', event.target.value);
|
|
48
|
-
}}
|
|
49
|
-
/>
|
|
50
|
-
</FieldSet>
|
|
51
|
-
</SidePanel.Field>
|
|
52
|
-
<SidePanel.Field>
|
|
53
|
-
<FormField label="Show Badge" labelPlacement="left" labelWidth="1fr">
|
|
54
|
-
<ToggleSwitch
|
|
55
|
-
size="small"
|
|
56
|
-
checked={showBadge === 'true'}
|
|
57
|
-
onChange={(event) => {
|
|
58
|
-
setShowBadge(event.target.checked.toString());
|
|
59
|
-
widget.setProp('show-badge', event.target.checked.toString());
|
|
60
|
-
}}
|
|
61
|
-
/>
|
|
62
|
-
</FormField>
|
|
63
|
-
</SidePanel.Field>
|
|
64
|
-
<SidePanel.Field>
|
|
65
|
-
<FieldSet legend="Call to Action">
|
|
66
|
-
<Input
|
|
67
|
-
value={callToAction}
|
|
68
|
-
placeholder={CALL_TO_ACTION}
|
|
69
|
-
size="small"
|
|
70
|
-
onChange={(event) => {
|
|
71
|
-
setCallToAction(event.target.value);
|
|
72
|
-
widget.setProp('call-to-action', event.target.value || CALL_TO_ACTION);
|
|
73
|
-
}}
|
|
74
|
-
/>
|
|
75
|
-
</FieldSet>
|
|
76
|
-
</SidePanel.Field>
|
|
77
|
-
</WixDesignSystemProvider>
|
|
78
|
-
);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export default Panel;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://dev.wix.com/wix-cli/schemas/site-plugin.json",
|
|
3
|
-
"id": "c9e8841d-41ca-4f96-b2ce-b5216ab106f3",
|
|
4
|
-
"referenceComponentId": "6e531d9f-b44e-4a3d-bdbc-67a511be5238",
|
|
5
|
-
"marketData": {
|
|
6
|
-
"name": "Stock Countdown",
|
|
7
|
-
"logoUrl": "../../../../assets/stock-counter/site-plugin-logo.svg"
|
|
8
|
-
},
|
|
9
|
-
"placements": [
|
|
10
|
-
{
|
|
11
|
-
"appDefinitionId": "1380b703-ce81-ff05-f115-39571d94dfcd",
|
|
12
|
-
"widgetId": "13a94f09-2766-3c40-4a32-8edb5acdd8bc",
|
|
13
|
-
"slotId": "product-page-details-5"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"appDefinitionId": "a0c68605-c2e7-4c8d-9ea1-767f9770e087",
|
|
17
|
-
"widgetId": "6a25b678-53ec-4b37-a190-65fcd1ca1a63",
|
|
18
|
-
"slotId": "product-page-details-5"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"installation": {
|
|
22
|
-
"autoAddToSite": true
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState, type FC } from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
|
-
import reactToWebComponent from 'react-to-webcomponent';
|
|
4
|
-
import { Badge, Box, Text, WixDesignSystemProvider } from '@wix/design-system';
|
|
5
|
-
import { Tag as TagIcon } from '@wix/wix-ui-icons-common';
|
|
6
|
-
import { inventory } from '@wix/stores';
|
|
7
|
-
import { window as siteWindow } from '@wix/site-window';
|
|
8
|
-
import styles from './plugin.module.css';
|
|
9
|
-
import '@wix/design-system/styles.global.css';
|
|
10
|
-
import { CALL_TO_ACTION } from './consts.js';
|
|
11
|
-
|
|
12
|
-
type Props = {
|
|
13
|
-
productId: string;
|
|
14
|
-
threshold: number;
|
|
15
|
-
callToAction: string;
|
|
16
|
-
showBadge: boolean;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const IN_STOCK = 'In Stock';
|
|
20
|
-
|
|
21
|
-
type InventoryStock = typeof IN_STOCK | number;
|
|
22
|
-
|
|
23
|
-
function getInventoryStock(productId: string): Promise<InventoryStock> {
|
|
24
|
-
return (
|
|
25
|
-
// For more information about the Inventory API, see https://dev.wix.com/docs/sdk/backend-modules/stores/inventory/query-inventory.
|
|
26
|
-
inventory
|
|
27
|
-
.queryInventory({
|
|
28
|
-
query: {
|
|
29
|
-
// For more information about query filters, see https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section.
|
|
30
|
-
filter: JSON.stringify({ productId: { ['$eq']: productId } }),
|
|
31
|
-
},
|
|
32
|
-
})
|
|
33
|
-
.then((result) => {
|
|
34
|
-
const productInventory = result?.inventoryItems && result.inventoryItems[0];
|
|
35
|
-
|
|
36
|
-
if (!productInventory) {
|
|
37
|
-
return 0;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const shouldShowInStock = productInventory.variants?.some(
|
|
41
|
-
(variant) => variant.inStock && variant.quantity === undefined
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
if (shouldShowInStock) {
|
|
45
|
-
return IN_STOCK;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return productInventory.variants?.reduce((inStockCount, variant) => {
|
|
49
|
-
inStockCount += variant.quantity || 0;
|
|
50
|
-
return inStockCount;
|
|
51
|
-
}, 0) || 0;
|
|
52
|
-
})
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Customize this component to implement custom logic, change the functionality, and customize the appearance.
|
|
57
|
-
const CustomElement: FC<Props> = ({ threshold = 3, productId, showBadge, callToAction }) => {
|
|
58
|
-
const [inventoryStock, setInventoryStock] = useState<InventoryStock>();
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
siteWindow.viewMode().then((mode) => {
|
|
62
|
-
if (mode === 'Site') {
|
|
63
|
-
getInventoryStock(productId).then(setInventoryStock);
|
|
64
|
-
} else {
|
|
65
|
-
setInventoryStock(threshold >= 1 ? threshold - 1 : IN_STOCK);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}, [productId, threshold]);
|
|
69
|
-
|
|
70
|
-
if (inventoryStock === undefined) {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<WixDesignSystemProvider features={{ newColorsBranding: true }}>
|
|
76
|
-
<Box
|
|
77
|
-
align="left"
|
|
78
|
-
direction="vertical"
|
|
79
|
-
gap="1"
|
|
80
|
-
paddingTop={2}
|
|
81
|
-
className={styles.root}
|
|
82
|
-
>
|
|
83
|
-
{inventoryStock === IN_STOCK || threshold < inventoryStock ? (
|
|
84
|
-
<Box>
|
|
85
|
-
{showBadge && (
|
|
86
|
-
<Badge prefixIcon={<TagIcon />} skin="neutralSuccess">
|
|
87
|
-
{IN_STOCK}
|
|
88
|
-
</Badge>
|
|
89
|
-
)}
|
|
90
|
-
</Box>
|
|
91
|
-
) : (
|
|
92
|
-
<>
|
|
93
|
-
{showBadge && (
|
|
94
|
-
<Box>
|
|
95
|
-
<Badge
|
|
96
|
-
prefixIcon={<TagIcon />}
|
|
97
|
-
skin="standard"
|
|
98
|
-
uppercase={false}
|
|
99
|
-
>
|
|
100
|
-
Selling fast
|
|
101
|
-
</Badge>
|
|
102
|
-
</Box>
|
|
103
|
-
)}
|
|
104
|
-
<Box direction="vertical">
|
|
105
|
-
<Text>{`Only ${inventoryStock} items left in stock`}</Text>
|
|
106
|
-
<Text size="tiny" light secondary>
|
|
107
|
-
{callToAction || CALL_TO_ACTION}
|
|
108
|
-
</Text>
|
|
109
|
-
</Box>
|
|
110
|
-
</>
|
|
111
|
-
)}
|
|
112
|
-
</Box>
|
|
113
|
-
</WixDesignSystemProvider>
|
|
114
|
-
);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const customElement = reactToWebComponent(
|
|
118
|
-
CustomElement,
|
|
119
|
-
React,
|
|
120
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
121
|
-
ReactDOM as any,
|
|
122
|
-
{
|
|
123
|
-
props: {
|
|
124
|
-
productId: 'string',
|
|
125
|
-
threshold: 'number',
|
|
126
|
-
callToAction: 'string',
|
|
127
|
-
showBadge: 'boolean',
|
|
128
|
-
},
|
|
129
|
-
}
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
export default customElement;
|