@lasterp/shared 1.0.0-beta.20 → 1.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.
- package/dist/index.cjs +48 -38
- package/dist/index.d.cts +76 -16
- package/dist/index.d.ts +76 -16
- package/dist/index.js +18 -29
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -5,38 +5,59 @@ var __defProp = Object.defineProperty;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
function __accessProp(key) {
|
|
9
|
+
return this[key];
|
|
10
|
+
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
8
13
|
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
9
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
22
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
23
|
for (let key of __getOwnPropNames(mod))
|
|
12
24
|
if (!__hasOwnProp.call(to, key))
|
|
13
25
|
__defProp(to, key, {
|
|
14
|
-
get: (
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
15
27
|
enumerable: true
|
|
16
28
|
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
17
31
|
return to;
|
|
18
32
|
};
|
|
19
|
-
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
20
33
|
var __toCommonJS = (from) => {
|
|
21
|
-
var entry = __moduleCache.get(from), desc;
|
|
34
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
22
35
|
if (entry)
|
|
23
36
|
return entry;
|
|
24
37
|
entry = __defProp({}, "__esModule", { value: true });
|
|
25
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
39
|
+
for (var key of __getOwnPropNames(from))
|
|
40
|
+
if (!__hasOwnProp.call(entry, key))
|
|
41
|
+
__defProp(entry, key, {
|
|
42
|
+
get: __accessProp.bind(from, key),
|
|
43
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
44
|
+
});
|
|
45
|
+
}
|
|
30
46
|
__moduleCache.set(from, entry);
|
|
31
47
|
return entry;
|
|
32
48
|
};
|
|
49
|
+
var __moduleCache;
|
|
50
|
+
var __returnValue = (v) => v;
|
|
51
|
+
function __exportSetter(name, newValue) {
|
|
52
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
53
|
+
}
|
|
33
54
|
var __export = (target, all) => {
|
|
34
55
|
for (var name in all)
|
|
35
56
|
__defProp(target, name, {
|
|
36
57
|
get: all[name],
|
|
37
58
|
enumerable: true,
|
|
38
59
|
configurable: true,
|
|
39
|
-
set: (
|
|
60
|
+
set: __exportSetter.bind(all, name)
|
|
40
61
|
});
|
|
41
62
|
};
|
|
42
63
|
|
|
@@ -73,35 +94,20 @@ __export(exports_src, {
|
|
|
73
94
|
camelizeKeys: () => import_humps.camelizeKeys,
|
|
74
95
|
camelize: () => import_humps.camelize,
|
|
75
96
|
LocaleProvider: () => LocaleProvider,
|
|
97
|
+
ItemAttrs: () => ItemAttrs,
|
|
76
98
|
FrappeProvider: () => FrappeProvider,
|
|
77
|
-
FrappeContext: () => FrappeContext
|
|
78
|
-
COLOR_SYSTEMS: () => COLOR_SYSTEMS,
|
|
79
|
-
ATTRIBUTES: () => ATTRIBUTES
|
|
99
|
+
FrappeContext: () => FrappeContext
|
|
80
100
|
});
|
|
81
101
|
module.exports = __toCommonJS(exports_src);
|
|
82
102
|
// src/catalog/schema.ts
|
|
83
103
|
var import_zod = require("zod");
|
|
84
|
-
var
|
|
85
|
-
var COLOR_SYSTEMS = [
|
|
86
|
-
"White",
|
|
87
|
-
"Black",
|
|
88
|
-
"Yellow",
|
|
89
|
-
"Red",
|
|
90
|
-
"Green",
|
|
91
|
-
"Blue",
|
|
92
|
-
"Purple",
|
|
93
|
-
"Orange",
|
|
94
|
-
"Pink",
|
|
95
|
-
"Brown",
|
|
96
|
-
"Gray",
|
|
97
|
-
"Silver",
|
|
98
|
-
"Gold"
|
|
99
|
-
];
|
|
104
|
+
var ItemAttrs = ["Colour", "Storage", "Memory", "Screen"];
|
|
100
105
|
var colourFormSchema = import_zod.z.object({
|
|
101
106
|
color: import_zod.z.string().min(1, "Color is required"),
|
|
102
107
|
color_hex: import_zod.z.string().optional(),
|
|
103
|
-
color_system: import_zod.z.
|
|
104
|
-
|
|
108
|
+
color_system: import_zod.z.string().optional(),
|
|
109
|
+
color_system_hex: import_zod.z.string().optional(),
|
|
110
|
+
images: import_zod.z.array(import_zod.z.string()).default([]).optional()
|
|
105
111
|
});
|
|
106
112
|
var screenFormSchema = import_zod.z.object({
|
|
107
113
|
screen: import_zod.z.string().min(1, "Screen is required"),
|
|
@@ -112,20 +118,24 @@ var screenFormSchema = import_zod.z.object({
|
|
|
112
118
|
var modelFormSchema = import_zod.z.object({
|
|
113
119
|
model: import_zod.z.string().min(1, "Model is required"),
|
|
114
120
|
sim_card_type: import_zod.z.string().optional(),
|
|
115
|
-
connectivity: import_zod.z.
|
|
121
|
+
connectivity: import_zod.z.string().optional()
|
|
116
122
|
});
|
|
117
123
|
var itemFormSchema = import_zod.z.object({
|
|
124
|
+
image: import_zod.z.string().optional(),
|
|
118
125
|
item_code: import_zod.z.string().min(1, "Item is required"),
|
|
119
126
|
item_group: import_zod.z.string().optional(),
|
|
120
127
|
brand: import_zod.z.string().optional(),
|
|
121
128
|
os: import_zod.z.string().optional(),
|
|
122
|
-
release_year: import_zod.z.
|
|
123
|
-
attributes: import_zod.z.array(import_zod.z.enum(
|
|
124
|
-
|
|
125
|
-
storages: import_zod.z.array(import_zod.z.string()),
|
|
126
|
-
memories: import_zod.z.array(import_zod.z.string()),
|
|
127
|
-
screens: import_zod.z.array(screenFormSchema),
|
|
128
|
-
models: import_zod.z.array(modelFormSchema)
|
|
129
|
+
release_year: import_zod.z.string().optional(),
|
|
130
|
+
attributes: import_zod.z.array(import_zod.z.enum(ItemAttrs)).default([]).optional(),
|
|
131
|
+
colors: import_zod.z.array(colourFormSchema).default([]).optional(),
|
|
132
|
+
storages: import_zod.z.array(import_zod.z.string()).default([]).optional(),
|
|
133
|
+
memories: import_zod.z.array(import_zod.z.string()).default([]).optional(),
|
|
134
|
+
screens: import_zod.z.array(screenFormSchema).default([]).optional(),
|
|
135
|
+
models: import_zod.z.array(modelFormSchema).default([]).optional(),
|
|
136
|
+
width: import_zod.z.number().positive().optional(),
|
|
137
|
+
height: import_zod.z.number().positive().optional(),
|
|
138
|
+
weight: import_zod.z.number().positive().optional()
|
|
129
139
|
});
|
|
130
140
|
// src/frappe/provider.tsx
|
|
131
141
|
var import_react = require("react");
|
package/dist/index.d.cts
CHANGED
|
@@ -7,24 +7,34 @@ interface Item {
|
|
|
7
7
|
brand: string;
|
|
8
8
|
os: string;
|
|
9
9
|
release_year: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
colors: Colour[];
|
|
10
|
+
attributes: Attribute[];
|
|
11
|
+
storages: Storage[];
|
|
12
|
+
memories: Memory2[];
|
|
13
|
+
colors: Colour2[];
|
|
15
14
|
screens: ScreenSpec[];
|
|
15
|
+
models: Model[];
|
|
16
16
|
images: Image[];
|
|
17
17
|
height: number;
|
|
18
18
|
width: number;
|
|
19
19
|
weight: number;
|
|
20
20
|
}
|
|
21
|
-
interface
|
|
21
|
+
interface Attribute {
|
|
22
|
+
attribute: string;
|
|
23
|
+
}
|
|
24
|
+
interface Storgae {
|
|
25
|
+
storage: string;
|
|
26
|
+
}
|
|
27
|
+
interface Memory2 {
|
|
28
|
+
memory: string;
|
|
29
|
+
}
|
|
30
|
+
interface Colour2 {
|
|
22
31
|
color: string;
|
|
23
|
-
|
|
32
|
+
color_hex: string;
|
|
24
33
|
color_system: string;
|
|
34
|
+
color_system_hex: string;
|
|
25
35
|
}
|
|
26
36
|
interface Model {
|
|
27
|
-
|
|
37
|
+
model: string;
|
|
28
38
|
sim_card_type: string;
|
|
29
39
|
connectivity: string;
|
|
30
40
|
}
|
|
@@ -39,12 +49,62 @@ interface Image {
|
|
|
39
49
|
color: string;
|
|
40
50
|
}
|
|
41
51
|
import { z } from "zod";
|
|
42
|
-
declare const
|
|
43
|
-
declare const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
declare const ItemAttrs: readonly ["Colour", "Storage", "Memory", "Screen"];
|
|
53
|
+
declare const colourFormSchema: z.ZodObject<{
|
|
54
|
+
color: z.ZodString;
|
|
55
|
+
color_hex: z.ZodOptional<z.ZodString>;
|
|
56
|
+
color_system: z.ZodOptional<z.ZodString>;
|
|
57
|
+
color_system_hex: z.ZodOptional<z.ZodString>;
|
|
58
|
+
images: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
59
|
+
}>;
|
|
60
|
+
declare const screenFormSchema: z.ZodObject<{
|
|
61
|
+
screen: z.ZodString;
|
|
62
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
}>;
|
|
66
|
+
declare const modelFormSchema: z.ZodObject<{
|
|
67
|
+
model: z.ZodString;
|
|
68
|
+
sim_card_type: z.ZodOptional<z.ZodString>;
|
|
69
|
+
connectivity: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}>;
|
|
71
|
+
declare const itemFormSchema: z.ZodObject<{
|
|
72
|
+
image: z.ZodOptional<z.ZodString>;
|
|
73
|
+
item_code: z.ZodString;
|
|
74
|
+
item_group: z.ZodOptional<z.ZodString>;
|
|
75
|
+
brand: z.ZodOptional<z.ZodString>;
|
|
76
|
+
os: z.ZodOptional<z.ZodString>;
|
|
77
|
+
release_year: z.ZodOptional<z.ZodString>;
|
|
78
|
+
attributes: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
79
|
+
Colour: "Colour";
|
|
80
|
+
Storage: "Storage";
|
|
81
|
+
Memory: "Memory";
|
|
82
|
+
Screen: "Screen";
|
|
83
|
+
}>>>>;
|
|
84
|
+
colors: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
85
|
+
color: z.ZodString;
|
|
86
|
+
color_hex: z.ZodOptional<z.ZodString>;
|
|
87
|
+
color_system: z.ZodOptional<z.ZodString>;
|
|
88
|
+
color_system_hex: z.ZodOptional<z.ZodString>;
|
|
89
|
+
images: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
90
|
+
}, z.core.$strip>>>>;
|
|
91
|
+
storages: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
92
|
+
memories: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
93
|
+
screens: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
94
|
+
screen: z.ZodString;
|
|
95
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
}, z.core.$strip>>>>;
|
|
99
|
+
models: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
100
|
+
model: z.ZodString;
|
|
101
|
+
sim_card_type: z.ZodOptional<z.ZodString>;
|
|
102
|
+
connectivity: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.core.$strip>>>>;
|
|
104
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
105
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
}>;
|
|
48
108
|
type ColourForm = z.infer<typeof colourFormSchema>;
|
|
49
109
|
type ScreenForm = z.infer<typeof screenFormSchema>;
|
|
50
110
|
type ModelForm = z.infer<typeof modelFormSchema>;
|
|
@@ -718,8 +778,8 @@ interface ProductContext {
|
|
|
718
778
|
specs: Record<string, string[]>;
|
|
719
779
|
variants: ProductVariant[];
|
|
720
780
|
models: Record<string, Model>;
|
|
721
|
-
colors: Record<string,
|
|
781
|
+
colors: Record<string, Colour2>;
|
|
722
782
|
}
|
|
723
783
|
import { camelize, decamelize, camelizeKeys, decamelizeKeys } from "humps";
|
|
724
784
|
declare function equalsIgnoreCase(str1: string, str2: string): boolean;
|
|
725
|
-
export { useVariantSelector, useSearch, useLocale, useFrappeUpdateDoc, useFrappePutCall, useFrappePrefetchDoc, useFrappePostCall, useFrappeGetMeta, useFrappeGetDocList, useFrappeGetDocCount, useFrappeGetDoc, useFrappeGetCall, useFrappeFileUpload, useFrappeEventListener, useFrappeDocumentEventListener, useFrappeDocTypeEventListener, useFrappeDeleteDoc, useFrappeDeleteCall, useFrappeCreateDoc, useFrappeAuth, screenFormSchema, modelFormSchema, itemFormSchema, equalsIgnoreCase, decamelizeKeys, decamelize, colourFormSchema, camelizeKeys, camelize, WorkspaceSidebarItem, WorkspaceSidebar, ViewerEventData, VariantSelectorResult, VariantSelectorProps, VariantSelectorOption, UseFrappeFileUploadReturnType, TopbarItem, Topbar, TokenParams, ShopContext, SearchResult, ScreenSpec, ScreenForm, ProductVariant, ProductContext, Product, Page, NavbarSubItemGroup, NavbarSubItem, NavbarItem, ModelForm, Model, LocaleProvider, ItemForm, Item, Image, Hero, Header, Globals, FrappeResult, FrappeProviderProps, FrappeProvider, FrappeMutationResult, FrappeMetaField, FrappeMeta, FrappeFileUploadResponse, FrappeError, FrappeContext, FrappeConfig, FooterItemGroup, FooterItem, Footer, DocumentUpdateEventData, DocTypeListUpdateEventData, ColourForm, Colour, Category,
|
|
785
|
+
export { useVariantSelector, useSearch, useLocale, useFrappeUpdateDoc, useFrappePutCall, useFrappePrefetchDoc, useFrappePostCall, useFrappeGetMeta, useFrappeGetDocList, useFrappeGetDocCount, useFrappeGetDoc, useFrappeGetCall, useFrappeFileUpload, useFrappeEventListener, useFrappeDocumentEventListener, useFrappeDocTypeEventListener, useFrappeDeleteDoc, useFrappeDeleteCall, useFrappeCreateDoc, useFrappeAuth, screenFormSchema, modelFormSchema, itemFormSchema, equalsIgnoreCase, decamelizeKeys, decamelize, colourFormSchema, camelizeKeys, camelize, WorkspaceSidebarItem, WorkspaceSidebar, ViewerEventData, VariantSelectorResult, VariantSelectorProps, VariantSelectorOption, UseFrappeFileUploadReturnType, TopbarItem, Topbar, TokenParams, Storgae, ShopContext, SearchResult, ScreenSpec, ScreenForm, ProductVariant, ProductContext, Product, Page, NavbarSubItemGroup, NavbarSubItem, NavbarItem, ModelForm, Model, Memory2 as Memory, LocaleProvider, ItemForm, ItemAttrs, Item, Image, Hero, Header, Globals, FrappeResult, FrappeProviderProps, FrappeProvider, FrappeMutationResult, FrappeMetaField, FrappeMeta, FrappeFileUploadResponse, FrappeError, FrappeContext, FrappeConfig, FooterItemGroup, FooterItem, Footer, DocumentUpdateEventData, DocTypeListUpdateEventData, ColourForm, Colour2 as Colour, Category, Brand, Block, Attribute };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,24 +7,34 @@ interface Item {
|
|
|
7
7
|
brand: string;
|
|
8
8
|
os: string;
|
|
9
9
|
release_year: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
colors: Colour[];
|
|
10
|
+
attributes: Attribute[];
|
|
11
|
+
storages: Storage[];
|
|
12
|
+
memories: Memory2[];
|
|
13
|
+
colors: Colour2[];
|
|
15
14
|
screens: ScreenSpec[];
|
|
15
|
+
models: Model[];
|
|
16
16
|
images: Image[];
|
|
17
17
|
height: number;
|
|
18
18
|
width: number;
|
|
19
19
|
weight: number;
|
|
20
20
|
}
|
|
21
|
-
interface
|
|
21
|
+
interface Attribute {
|
|
22
|
+
attribute: string;
|
|
23
|
+
}
|
|
24
|
+
interface Storgae {
|
|
25
|
+
storage: string;
|
|
26
|
+
}
|
|
27
|
+
interface Memory2 {
|
|
28
|
+
memory: string;
|
|
29
|
+
}
|
|
30
|
+
interface Colour2 {
|
|
22
31
|
color: string;
|
|
23
|
-
|
|
32
|
+
color_hex: string;
|
|
24
33
|
color_system: string;
|
|
34
|
+
color_system_hex: string;
|
|
25
35
|
}
|
|
26
36
|
interface Model {
|
|
27
|
-
|
|
37
|
+
model: string;
|
|
28
38
|
sim_card_type: string;
|
|
29
39
|
connectivity: string;
|
|
30
40
|
}
|
|
@@ -39,12 +49,62 @@ interface Image {
|
|
|
39
49
|
color: string;
|
|
40
50
|
}
|
|
41
51
|
import { z } from "zod";
|
|
42
|
-
declare const
|
|
43
|
-
declare const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
declare const ItemAttrs: readonly ["Colour", "Storage", "Memory", "Screen"];
|
|
53
|
+
declare const colourFormSchema: z.ZodObject<{
|
|
54
|
+
color: z.ZodString;
|
|
55
|
+
color_hex: z.ZodOptional<z.ZodString>;
|
|
56
|
+
color_system: z.ZodOptional<z.ZodString>;
|
|
57
|
+
color_system_hex: z.ZodOptional<z.ZodString>;
|
|
58
|
+
images: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
59
|
+
}>;
|
|
60
|
+
declare const screenFormSchema: z.ZodObject<{
|
|
61
|
+
screen: z.ZodString;
|
|
62
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
}>;
|
|
66
|
+
declare const modelFormSchema: z.ZodObject<{
|
|
67
|
+
model: z.ZodString;
|
|
68
|
+
sim_card_type: z.ZodOptional<z.ZodString>;
|
|
69
|
+
connectivity: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}>;
|
|
71
|
+
declare const itemFormSchema: z.ZodObject<{
|
|
72
|
+
image: z.ZodOptional<z.ZodString>;
|
|
73
|
+
item_code: z.ZodString;
|
|
74
|
+
item_group: z.ZodOptional<z.ZodString>;
|
|
75
|
+
brand: z.ZodOptional<z.ZodString>;
|
|
76
|
+
os: z.ZodOptional<z.ZodString>;
|
|
77
|
+
release_year: z.ZodOptional<z.ZodString>;
|
|
78
|
+
attributes: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
79
|
+
Colour: "Colour";
|
|
80
|
+
Storage: "Storage";
|
|
81
|
+
Memory: "Memory";
|
|
82
|
+
Screen: "Screen";
|
|
83
|
+
}>>>>;
|
|
84
|
+
colors: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
85
|
+
color: z.ZodString;
|
|
86
|
+
color_hex: z.ZodOptional<z.ZodString>;
|
|
87
|
+
color_system: z.ZodOptional<z.ZodString>;
|
|
88
|
+
color_system_hex: z.ZodOptional<z.ZodString>;
|
|
89
|
+
images: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
90
|
+
}, z.core.$strip>>>>;
|
|
91
|
+
storages: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
92
|
+
memories: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
93
|
+
screens: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
94
|
+
screen: z.ZodString;
|
|
95
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
}, z.core.$strip>>>>;
|
|
99
|
+
models: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
100
|
+
model: z.ZodString;
|
|
101
|
+
sim_card_type: z.ZodOptional<z.ZodString>;
|
|
102
|
+
connectivity: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.core.$strip>>>>;
|
|
104
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
105
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
}>;
|
|
48
108
|
type ColourForm = z.infer<typeof colourFormSchema>;
|
|
49
109
|
type ScreenForm = z.infer<typeof screenFormSchema>;
|
|
50
110
|
type ModelForm = z.infer<typeof modelFormSchema>;
|
|
@@ -718,8 +778,8 @@ interface ProductContext {
|
|
|
718
778
|
specs: Record<string, string[]>;
|
|
719
779
|
variants: ProductVariant[];
|
|
720
780
|
models: Record<string, Model>;
|
|
721
|
-
colors: Record<string,
|
|
781
|
+
colors: Record<string, Colour2>;
|
|
722
782
|
}
|
|
723
783
|
import { camelize, decamelize, camelizeKeys, decamelizeKeys } from "humps";
|
|
724
784
|
declare function equalsIgnoreCase(str1: string, str2: string): boolean;
|
|
725
|
-
export { useVariantSelector, useSearch, useLocale, useFrappeUpdateDoc, useFrappePutCall, useFrappePrefetchDoc, useFrappePostCall, useFrappeGetMeta, useFrappeGetDocList, useFrappeGetDocCount, useFrappeGetDoc, useFrappeGetCall, useFrappeFileUpload, useFrappeEventListener, useFrappeDocumentEventListener, useFrappeDocTypeEventListener, useFrappeDeleteDoc, useFrappeDeleteCall, useFrappeCreateDoc, useFrappeAuth, screenFormSchema, modelFormSchema, itemFormSchema, equalsIgnoreCase, decamelizeKeys, decamelize, colourFormSchema, camelizeKeys, camelize, WorkspaceSidebarItem, WorkspaceSidebar, ViewerEventData, VariantSelectorResult, VariantSelectorProps, VariantSelectorOption, UseFrappeFileUploadReturnType, TopbarItem, Topbar, TokenParams, ShopContext, SearchResult, ScreenSpec, ScreenForm, ProductVariant, ProductContext, Product, Page, NavbarSubItemGroup, NavbarSubItem, NavbarItem, ModelForm, Model, LocaleProvider, ItemForm, Item, Image, Hero, Header, Globals, FrappeResult, FrappeProviderProps, FrappeProvider, FrappeMutationResult, FrappeMetaField, FrappeMeta, FrappeFileUploadResponse, FrappeError, FrappeContext, FrappeConfig, FooterItemGroup, FooterItem, Footer, DocumentUpdateEventData, DocTypeListUpdateEventData, ColourForm, Colour, Category,
|
|
785
|
+
export { useVariantSelector, useSearch, useLocale, useFrappeUpdateDoc, useFrappePutCall, useFrappePrefetchDoc, useFrappePostCall, useFrappeGetMeta, useFrappeGetDocList, useFrappeGetDocCount, useFrappeGetDoc, useFrappeGetCall, useFrappeFileUpload, useFrappeEventListener, useFrappeDocumentEventListener, useFrappeDocTypeEventListener, useFrappeDeleteDoc, useFrappeDeleteCall, useFrappeCreateDoc, useFrappeAuth, screenFormSchema, modelFormSchema, itemFormSchema, equalsIgnoreCase, decamelizeKeys, decamelize, colourFormSchema, camelizeKeys, camelize, WorkspaceSidebarItem, WorkspaceSidebar, ViewerEventData, VariantSelectorResult, VariantSelectorProps, VariantSelectorOption, UseFrappeFileUploadReturnType, TopbarItem, Topbar, TokenParams, Storgae, ShopContext, SearchResult, ScreenSpec, ScreenForm, ProductVariant, ProductContext, Product, Page, NavbarSubItemGroup, NavbarSubItem, NavbarItem, ModelForm, Model, Memory2 as Memory, LocaleProvider, ItemForm, ItemAttrs, Item, Image, Hero, Header, Globals, FrappeResult, FrappeProviderProps, FrappeProvider, FrappeMutationResult, FrappeMetaField, FrappeMeta, FrappeFileUploadResponse, FrappeError, FrappeContext, FrappeConfig, FooterItemGroup, FooterItem, Footer, DocumentUpdateEventData, DocTypeListUpdateEventData, ColourForm, Colour2 as Colour, Category, Brand, Block, Attribute };
|
package/dist/index.js
CHANGED
|
@@ -1,27 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
// src/catalog/schema.ts
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
var
|
|
5
|
-
var COLOR_SYSTEMS = [
|
|
6
|
-
"White",
|
|
7
|
-
"Black",
|
|
8
|
-
"Yellow",
|
|
9
|
-
"Red",
|
|
10
|
-
"Green",
|
|
11
|
-
"Blue",
|
|
12
|
-
"Purple",
|
|
13
|
-
"Orange",
|
|
14
|
-
"Pink",
|
|
15
|
-
"Brown",
|
|
16
|
-
"Gray",
|
|
17
|
-
"Silver",
|
|
18
|
-
"Gold"
|
|
19
|
-
];
|
|
4
|
+
var ItemAttrs = ["Colour", "Storage", "Memory", "Screen"];
|
|
20
5
|
var colourFormSchema = z.object({
|
|
21
6
|
color: z.string().min(1, "Color is required"),
|
|
22
7
|
color_hex: z.string().optional(),
|
|
23
|
-
color_system: z.
|
|
24
|
-
|
|
8
|
+
color_system: z.string().optional(),
|
|
9
|
+
color_system_hex: z.string().optional(),
|
|
10
|
+
images: z.array(z.string()).default([]).optional()
|
|
25
11
|
});
|
|
26
12
|
var screenFormSchema = z.object({
|
|
27
13
|
screen: z.string().min(1, "Screen is required"),
|
|
@@ -32,20 +18,24 @@ var screenFormSchema = z.object({
|
|
|
32
18
|
var modelFormSchema = z.object({
|
|
33
19
|
model: z.string().min(1, "Model is required"),
|
|
34
20
|
sim_card_type: z.string().optional(),
|
|
35
|
-
connectivity: z.
|
|
21
|
+
connectivity: z.string().optional()
|
|
36
22
|
});
|
|
37
23
|
var itemFormSchema = z.object({
|
|
24
|
+
image: z.string().optional(),
|
|
38
25
|
item_code: z.string().min(1, "Item is required"),
|
|
39
26
|
item_group: z.string().optional(),
|
|
40
27
|
brand: z.string().optional(),
|
|
41
28
|
os: z.string().optional(),
|
|
42
|
-
release_year: z.
|
|
43
|
-
attributes: z.array(z.enum(
|
|
44
|
-
|
|
45
|
-
storages: z.array(z.string()),
|
|
46
|
-
memories: z.array(z.string()),
|
|
47
|
-
screens: z.array(screenFormSchema),
|
|
48
|
-
models: z.array(modelFormSchema)
|
|
29
|
+
release_year: z.string().optional(),
|
|
30
|
+
attributes: z.array(z.enum(ItemAttrs)).default([]).optional(),
|
|
31
|
+
colors: z.array(colourFormSchema).default([]).optional(),
|
|
32
|
+
storages: z.array(z.string()).default([]).optional(),
|
|
33
|
+
memories: z.array(z.string()).default([]).optional(),
|
|
34
|
+
screens: z.array(screenFormSchema).default([]).optional(),
|
|
35
|
+
models: z.array(modelFormSchema).default([]).optional(),
|
|
36
|
+
width: z.number().positive().optional(),
|
|
37
|
+
height: z.number().positive().optional(),
|
|
38
|
+
weight: z.number().positive().optional()
|
|
49
39
|
});
|
|
50
40
|
// src/frappe/provider.tsx
|
|
51
41
|
import { useMemo, createContext } from "react";
|
|
@@ -737,8 +727,7 @@ export {
|
|
|
737
727
|
camelizeKeys,
|
|
738
728
|
camelize,
|
|
739
729
|
LocaleProvider,
|
|
730
|
+
ItemAttrs,
|
|
740
731
|
FrappeProvider,
|
|
741
|
-
FrappeContext
|
|
742
|
-
COLOR_SYSTEMS,
|
|
743
|
-
ATTRIBUTES
|
|
732
|
+
FrappeContext
|
|
744
733
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lasterp/shared",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.22",
|
|
4
4
|
"description": "Shared repo for webapp and native app",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"@tanstack/react-query": "^5.90.21",
|
|
24
24
|
"react": ">=18.0.0",
|
|
25
25
|
"react-dom": ">=18.0.0",
|
|
26
|
-
"typescript": ">=4.5.0"
|
|
26
|
+
"typescript": ">=4.5.0",
|
|
27
|
+
"zod": "^4.3.6"
|
|
27
28
|
},
|
|
28
29
|
"peerDependenciesMeta": {
|
|
29
30
|
"typescript": {
|