@drawbridge/components 0.0.1 → 0.0.2

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.
@@ -53,6 +53,7 @@ var CardAdvertisement = ({
53
53
  onClick = () => {
54
54
  },
55
55
  organization,
56
+ preview = false,
56
57
  product,
57
58
  title,
58
59
  url,
@@ -208,6 +209,7 @@ var CardAdvertisement = ({
208
209
  ...{
209
210
  className: "text-xs px-3 py-1.5 rounded border border-white/30 text-white hover:border-white transition-colors",
210
211
  onClick: () => {
212
+ if (preview) return;
211
213
  const href = variantUrl(variant);
212
214
  if (href) window.open(href, "_blank");
213
215
  },
@@ -237,8 +239,9 @@ var CardAdvertisement = ({
237
239
  {
238
240
  ...{
239
241
  className: classes.button.join(" "),
240
- disabled: !hasVariants && !url,
241
- onClick: hasVariants ? () => setVariantsOpen((v) => !v) : onClick,
242
+ disabled: !preview && !hasVariants && !url,
243
+ onClick: hasVariants ? () => setVariantsOpen((v) => !v) : preview ? () => {
244
+ } : onClick,
242
245
  style: {
243
246
  backgroundColor: (_w = (_v = style == null ? void 0 : style.background) == null ? void 0 : _v.color) == null ? void 0 : _w.hex,
244
247
  color: (_y = (_x = style == null ? void 0 : style.text) == null ? void 0 : _x.color) == null ? void 0 : _y.hex
@@ -30,6 +30,7 @@ var CardAdvertisement = ({
30
30
  onClick = () => {
31
31
  },
32
32
  organization,
33
+ preview = false,
33
34
  product,
34
35
  title,
35
36
  url,
@@ -185,6 +186,7 @@ var CardAdvertisement = ({
185
186
  ...{
186
187
  className: "text-xs px-3 py-1.5 rounded border border-white/30 text-white hover:border-white transition-colors",
187
188
  onClick: () => {
189
+ if (preview) return;
188
190
  const href = variantUrl(variant);
189
191
  if (href) window.open(href, "_blank");
190
192
  },
@@ -214,8 +216,9 @@ var CardAdvertisement = ({
214
216
  {
215
217
  ...{
216
218
  className: classes.button.join(" "),
217
- disabled: !hasVariants && !url,
218
- onClick: hasVariants ? () => setVariantsOpen((v) => !v) : onClick,
219
+ disabled: !preview && !hasVariants && !url,
220
+ onClick: hasVariants ? () => setVariantsOpen((v) => !v) : preview ? () => {
221
+ } : onClick,
219
222
  style: {
220
223
  backgroundColor: (_w = (_v = style == null ? void 0 : style.background) == null ? void 0 : _v.color) == null ? void 0 : _w.hex,
221
224
  color: (_y = (_x = style == null ? void 0 : style.text) == null ? void 0 : _x.color) == null ? void 0 : _y.hex
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@drawbridge/components",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "exports": {
5
- "./card-advertisement": "./dist/card-advertisement.js"
5
+ "./card-advertisement": {
6
+ "types": "./types/card-advertisement.d.ts",
7
+ "default": "./dist/card-advertisement.js"
8
+ }
6
9
  },
7
10
  "files": [
8
- "dist"
11
+ "dist",
12
+ "types"
9
13
  ],
10
14
  "author": "",
11
15
  "license": "ISC",
@@ -0,0 +1,45 @@
1
+ import { ComponentType } from 'react';
2
+
3
+ export interface CardAdvertisementProps {
4
+ asset?: {
5
+ filename?: string;
6
+ frames?: Record<string, { sizes?: Record<string, string> }>;
7
+ id?: string;
8
+ mimetype?: string;
9
+ poster?: string;
10
+ sizes?: Record<string, string>;
11
+ updatedAt?: string;
12
+ };
13
+ brand?: {
14
+ style?: {
15
+ background?: { color?: { hex?: string; rgb?: string } };
16
+ text?: { color?: { hex?: string; rgb?: string } };
17
+ };
18
+ };
19
+ button?: string;
20
+ campaign?: string;
21
+ fonts?: {
22
+ body?: Record<string, unknown>;
23
+ };
24
+ ImageComponent?: ComponentType<any>;
25
+ onClick?: () => void;
26
+ organization?: string;
27
+ preview?: boolean;
28
+ product?: {
29
+ image?: string;
30
+ title?: string;
31
+ url?: string;
32
+ variants?: Array<{
33
+ availableForSale: boolean;
34
+ shopifyId: string;
35
+ title: string;
36
+ }>;
37
+ };
38
+ title?: string;
39
+ url?: string;
40
+ VideoComponent?: ComponentType<any>;
41
+ }
42
+
43
+ declare const CardAdvertisement: ComponentType<CardAdvertisementProps>;
44
+
45
+ export default CardAdvertisement;