fulldev-ui 0.5.0-beta.5 → 0.5.0-beta.6

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.
@@ -0,0 +1,36 @@
1
+ // import Stripe from 'stripe'
2
+
3
+ // const stripe = new Stripe(import.meta.env.STRIPE_SECRET_KEY)
4
+
5
+ const slugify = (input: string): string => {
6
+ return input
7
+ .toLowerCase()
8
+ .replace(/[^a-z0-9]+/g, '-')
9
+ .replace(/^-+|-+$/g, '')
10
+ }
11
+
12
+ export const generateProductId = (
13
+ slug: string,
14
+ variants?: string[] | undefined
15
+ ): string => {
16
+ const slugified = slugify(slug)
17
+
18
+ if (variants && variants.length > 0)
19
+ return `${slugified}--${variants.map((variant) => slugify(variant)).join('--')}`
20
+
21
+ return slugified
22
+ }
23
+
24
+ export const generateProductName = (
25
+ title: string,
26
+ variants?: string[] | undefined
27
+ ): string => {
28
+ if (variants && variants.length > 0)
29
+ return `${title} / ${variants.join(' / ')}`
30
+
31
+ return title
32
+ }
33
+
34
+ export const formatPrice = (price: number): string => {
35
+ return `€${price?.toFixed(2).replace('.', ',')}`
36
+ }
package/tsconfig.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "extends": "astro/tsconfigs/strictest",
3
+ "include": ["src", "astro.config.ts"],
3
4
  "compilerOptions": {
4
5
  "baseUrl": ".",
5
6
  "paths": {
@@ -8,7 +9,4 @@
8
9
  ]
9
10
  }
10
11
  },
11
- "exclude": [
12
- "dist"
13
- ]
14
12
  }