@flowselections/floriday-voorraad 1.0.0 → 1.0.4

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.
@@ -1,8 +1,9 @@
1
+ import { type FloridayConnection } from "@/lib/floriday-client";
1
2
  export declare function useFloridayConnection(): {
2
3
  connections: FloridayConnection[];
3
4
  activeId: string | null;
4
5
  setActiveId: (id: string) => void;
5
- activeConnection: any;
6
+ activeConnection: FloridayConnection | null;
6
7
  loading: boolean;
7
8
  error: string | null;
8
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useFloridayConnection.d.ts","sourceRoot":"","sources":["../../src/hooks/useFloridayConnection.ts"],"names":[],"mappings":"AAKA,wBAAgB,qBAAqB;;;sBAyBV,MAAM;;;;EAahC"}
1
+ {"version":3,"file":"useFloridayConnection.d.ts","sourceRoot":"","sources":["../../src/hooks/useFloridayConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAI1E,wBAAgB,qBAAqB;;;sBAyBV,MAAM;;;;EAahC"}
@@ -1,3 +1,4 @@
1
+ import { type TradeItem } from "@/lib/floriday-client";
1
2
  export declare function useVoorraadData(connectionId: string | null): {
2
3
  items: TradeItem[];
3
4
  loading: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"useVoorraadData.d.ts","sourceRoot":"","sources":["../../src/hooks/useVoorraadData.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;;;;;EA4B1D"}
1
+ {"version":3,"file":"useVoorraadData.d.ts","sourceRoot":"","sources":["../../src/hooks/useVoorraadData.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEjE,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;;;;;EA4B1D"}
@@ -0,0 +1,5 @@
1
+ export declare const COUNTRIES: {
2
+ code: string;
3
+ name: string;
4
+ }[];
5
+ //# sourceMappingURL=countries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"countries.d.ts","sourceRoot":"","sources":["../../src/lib/countries.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAwPF,CAAC"}
@@ -0,0 +1,251 @@
1
+ // ISO 3166-1 alpha-2 landenlijst met Nederlandse namen.
2
+ // Gebruikt voor het Plantenpaspoort (Floriday accepteert ISO-2 codes).
3
+ export const COUNTRIES = [
4
+ { code: "AF", name: "Afghanistan" },
5
+ { code: "AL", name: "Albanië" },
6
+ { code: "DZ", name: "Algerije" },
7
+ { code: "AS", name: "Amerikaans-Samoa" },
8
+ { code: "VI", name: "Amerikaanse Maagdeneilanden" },
9
+ { code: "AD", name: "Andorra" },
10
+ { code: "AO", name: "Angola" },
11
+ { code: "AI", name: "Anguilla" },
12
+ { code: "AQ", name: "Antarctica" },
13
+ { code: "AG", name: "Antigua en Barbuda" },
14
+ { code: "AR", name: "Argentinië" },
15
+ { code: "AM", name: "Armenië" },
16
+ { code: "AW", name: "Aruba" },
17
+ { code: "AU", name: "Australië" },
18
+ { code: "AZ", name: "Azerbeidzjan" },
19
+ { code: "BS", name: "Bahama's" },
20
+ { code: "BH", name: "Bahrein" },
21
+ { code: "BD", name: "Bangladesh" },
22
+ { code: "BB", name: "Barbados" },
23
+ { code: "BE", name: "België" },
24
+ { code: "BZ", name: "Belize" },
25
+ { code: "BJ", name: "Benin" },
26
+ { code: "BM", name: "Bermuda" },
27
+ { code: "BT", name: "Bhutan" },
28
+ { code: "BO", name: "Bolivia" },
29
+ { code: "BQ", name: "Bonaire, Sint Eustatius en Saba" },
30
+ { code: "BA", name: "Bosnië en Herzegovina" },
31
+ { code: "BW", name: "Botswana" },
32
+ { code: "BV", name: "Bouveteiland" },
33
+ { code: "BR", name: "Brazilië" },
34
+ { code: "VG", name: "Britse Maagdeneilanden" },
35
+ { code: "IO", name: "Brits Indische Oceaanterritorium" },
36
+ { code: "BN", name: "Brunei" },
37
+ { code: "BG", name: "Bulgarije" },
38
+ { code: "BF", name: "Burkina Faso" },
39
+ { code: "BI", name: "Burundi" },
40
+ { code: "KH", name: "Cambodja" },
41
+ { code: "CA", name: "Canada" },
42
+ { code: "CF", name: "Centraal-Afrikaanse Republiek" },
43
+ { code: "CL", name: "Chili" },
44
+ { code: "CN", name: "China" },
45
+ { code: "CX", name: "Christmaseiland" },
46
+ { code: "CC", name: "Cocoseilanden" },
47
+ { code: "CO", name: "Colombia" },
48
+ { code: "KM", name: "Comoren" },
49
+ { code: "CG", name: "Congo-Brazzaville" },
50
+ { code: "CD", name: "Congo-Kinshasa" },
51
+ { code: "CK", name: "Cookeilanden" },
52
+ { code: "CR", name: "Costa Rica" },
53
+ { code: "CU", name: "Cuba" },
54
+ { code: "CW", name: "Curaçao" },
55
+ { code: "CY", name: "Cyprus" },
56
+ { code: "DK", name: "Denemarken" },
57
+ { code: "DJ", name: "Djibouti" },
58
+ { code: "DM", name: "Dominica" },
59
+ { code: "DO", name: "Dominicaanse Republiek" },
60
+ { code: "DE", name: "Duitsland" },
61
+ { code: "EC", name: "Ecuador" },
62
+ { code: "EG", name: "Egypte" },
63
+ { code: "SV", name: "El Salvador" },
64
+ { code: "GQ", name: "Equatoriaal-Guinea" },
65
+ { code: "ER", name: "Eritrea" },
66
+ { code: "EE", name: "Estland" },
67
+ { code: "ET", name: "Ethiopië" },
68
+ { code: "FO", name: "Faeröer" },
69
+ { code: "FK", name: "Falklandeilanden" },
70
+ { code: "FJ", name: "Fiji" },
71
+ { code: "PH", name: "Filipijnen" },
72
+ { code: "FI", name: "Finland" },
73
+ { code: "FR", name: "Frankrijk" },
74
+ { code: "TF", name: "Franse Zuidelijke en Antarctische Gebieden" },
75
+ { code: "GF", name: "Frans-Guyana" },
76
+ { code: "PF", name: "Frans-Polynesië" },
77
+ { code: "GA", name: "Gabon" },
78
+ { code: "GM", name: "Gambia" },
79
+ { code: "GE", name: "Georgië" },
80
+ { code: "GH", name: "Ghana" },
81
+ { code: "GI", name: "Gibraltar" },
82
+ { code: "GD", name: "Grenada" },
83
+ { code: "GR", name: "Griekenland" },
84
+ { code: "GL", name: "Groenland" },
85
+ { code: "GP", name: "Guadeloupe" },
86
+ { code: "GU", name: "Guam" },
87
+ { code: "GT", name: "Guatemala" },
88
+ { code: "GG", name: "Guernsey" },
89
+ { code: "GN", name: "Guinee" },
90
+ { code: "GW", name: "Guinee-Bissau" },
91
+ { code: "GY", name: "Guyana" },
92
+ { code: "HT", name: "Haïti" },
93
+ { code: "HM", name: "Heard en McDonaldeilanden" },
94
+ { code: "HN", name: "Honduras" },
95
+ { code: "HU", name: "Hongarije" },
96
+ { code: "HK", name: "Hongkong" },
97
+ { code: "IE", name: "Ierland" },
98
+ { code: "IS", name: "IJsland" },
99
+ { code: "IN", name: "India" },
100
+ { code: "ID", name: "Indonesië" },
101
+ { code: "IQ", name: "Irak" },
102
+ { code: "IR", name: "Iran" },
103
+ { code: "IL", name: "Israël" },
104
+ { code: "IT", name: "Italië" },
105
+ { code: "CI", name: "Ivoorkust" },
106
+ { code: "JM", name: "Jamaica" },
107
+ { code: "JP", name: "Japan" },
108
+ { code: "YE", name: "Jemen" },
109
+ { code: "JE", name: "Jersey" },
110
+ { code: "JO", name: "Jordanië" },
111
+ { code: "CV", name: "Kaapverdië" },
112
+ { code: "CM", name: "Kameroen" },
113
+ { code: "KZ", name: "Kazachstan" },
114
+ { code: "KE", name: "Kenia" },
115
+ { code: "KG", name: "Kirgizië" },
116
+ { code: "KI", name: "Kiribati" },
117
+ { code: "UM", name: "Kleine afgelegen eilanden van de Verenigde Staten" },
118
+ { code: "KW", name: "Koeweit" },
119
+ { code: "HR", name: "Kroatië" },
120
+ { code: "LA", name: "Laos" },
121
+ { code: "LS", name: "Lesotho" },
122
+ { code: "LV", name: "Letland" },
123
+ { code: "LB", name: "Libanon" },
124
+ { code: "LR", name: "Liberia" },
125
+ { code: "LY", name: "Libië" },
126
+ { code: "LI", name: "Liechtenstein" },
127
+ { code: "LT", name: "Litouwen" },
128
+ { code: "LU", name: "Luxemburg" },
129
+ { code: "MO", name: "Macau" },
130
+ { code: "MG", name: "Madagaskar" },
131
+ { code: "MW", name: "Malawi" },
132
+ { code: "MV", name: "Maldiven" },
133
+ { code: "MY", name: "Maleisië" },
134
+ { code: "ML", name: "Mali" },
135
+ { code: "MT", name: "Malta" },
136
+ { code: "IM", name: "Man" },
137
+ { code: "MA", name: "Marokko" },
138
+ { code: "MH", name: "Marshalleilanden" },
139
+ { code: "MQ", name: "Martinique" },
140
+ { code: "MR", name: "Mauritanië" },
141
+ { code: "MU", name: "Mauritius" },
142
+ { code: "YT", name: "Mayotte" },
143
+ { code: "MX", name: "Mexico" },
144
+ { code: "FM", name: "Micronesia" },
145
+ { code: "MD", name: "Moldavië" },
146
+ { code: "MC", name: "Monaco" },
147
+ { code: "MN", name: "Mongolië" },
148
+ { code: "ME", name: "Montenegro" },
149
+ { code: "MS", name: "Montserrat" },
150
+ { code: "MZ", name: "Mozambique" },
151
+ { code: "MM", name: "Myanmar" },
152
+ { code: "NA", name: "Namibië" },
153
+ { code: "NR", name: "Nauru" },
154
+ { code: "NL", name: "Nederland" },
155
+ { code: "NP", name: "Nepal" },
156
+ { code: "NI", name: "Nicaragua" },
157
+ { code: "NC", name: "Nieuw-Caledonië" },
158
+ { code: "NZ", name: "Nieuw-Zeeland" },
159
+ { code: "NE", name: "Niger" },
160
+ { code: "NG", name: "Nigeria" },
161
+ { code: "NU", name: "Niue" },
162
+ { code: "MP", name: "Noordelijke Marianen" },
163
+ { code: "KP", name: "Noord-Korea" },
164
+ { code: "MK", name: "Noord-Macedonië" },
165
+ { code: "NO", name: "Noorwegen" },
166
+ { code: "NF", name: "Norfolk" },
167
+ { code: "UG", name: "Oeganda" },
168
+ { code: "UA", name: "Oekraïne" },
169
+ { code: "UZ", name: "Oezbekistan" },
170
+ { code: "OM", name: "Oman" },
171
+ { code: "AT", name: "Oostenrijk" },
172
+ { code: "TL", name: "Oost-Timor" },
173
+ { code: "PK", name: "Pakistan" },
174
+ { code: "PW", name: "Palau" },
175
+ { code: "PS", name: "Palestina" },
176
+ { code: "PA", name: "Panama" },
177
+ { code: "PG", name: "Papoea-Nieuw-Guinea" },
178
+ { code: "PY", name: "Paraguay" },
179
+ { code: "PE", name: "Peru" },
180
+ { code: "PN", name: "Pitcairneilanden" },
181
+ { code: "PL", name: "Polen" },
182
+ { code: "PT", name: "Portugal" },
183
+ { code: "PR", name: "Puerto Rico" },
184
+ { code: "QA", name: "Qatar" },
185
+ { code: "RE", name: "Réunion" },
186
+ { code: "RO", name: "Roemenië" },
187
+ { code: "RU", name: "Rusland" },
188
+ { code: "RW", name: "Rwanda" },
189
+ { code: "KN", name: "Saint Kitts en Nevis" },
190
+ { code: "LC", name: "Saint Lucia" },
191
+ { code: "VC", name: "Saint Vincent en de Grenadines" },
192
+ { code: "BL", name: "Saint-Barthélemy" },
193
+ { code: "MF", name: "Saint-Martin" },
194
+ { code: "PM", name: "Saint-Pierre en Miquelon" },
195
+ { code: "SB", name: "Salomonseilanden" },
196
+ { code: "WS", name: "Samoa" },
197
+ { code: "SM", name: "San Marino" },
198
+ { code: "SA", name: "Saoedi-Arabië" },
199
+ { code: "ST", name: "Sao Tomé en Principe" },
200
+ { code: "SN", name: "Senegal" },
201
+ { code: "RS", name: "Servië" },
202
+ { code: "SC", name: "Seychellen" },
203
+ { code: "SL", name: "Sierra Leone" },
204
+ { code: "SG", name: "Singapore" },
205
+ { code: "SH", name: "Sint-Helena" },
206
+ { code: "SX", name: "Sint Maarten" },
207
+ { code: "SI", name: "Slovenië" },
208
+ { code: "SK", name: "Slowakije" },
209
+ { code: "SD", name: "Soedan" },
210
+ { code: "SO", name: "Somalië" },
211
+ { code: "ES", name: "Spanje" },
212
+ { code: "SJ", name: "Spitsbergen en Jan Mayen" },
213
+ { code: "LK", name: "Sri Lanka" },
214
+ { code: "SR", name: "Suriname" },
215
+ { code: "SZ", name: "Swaziland" },
216
+ { code: "SY", name: "Syrië" },
217
+ { code: "TJ", name: "Tadzjikistan" },
218
+ { code: "TW", name: "Taiwan" },
219
+ { code: "TZ", name: "Tanzania" },
220
+ { code: "TH", name: "Thailand" },
221
+ { code: "TG", name: "Togo" },
222
+ { code: "TK", name: "Tokelau" },
223
+ { code: "TO", name: "Tonga" },
224
+ { code: "TT", name: "Trinidad en Tobago" },
225
+ { code: "TD", name: "Tsjaad" },
226
+ { code: "CZ", name: "Tsjechië" },
227
+ { code: "TN", name: "Tunesië" },
228
+ { code: "TR", name: "Turkije" },
229
+ { code: "TM", name: "Turkmenistan" },
230
+ { code: "TC", name: "Turks- en Caicoseilanden" },
231
+ { code: "TV", name: "Tuvalu" },
232
+ { code: "UY", name: "Uruguay" },
233
+ { code: "VU", name: "Vanuatu" },
234
+ { code: "VA", name: "Vaticaanstad" },
235
+ { code: "VE", name: "Venezuela" },
236
+ { code: "GB", name: "Verenigd Koninkrijk" },
237
+ { code: "AE", name: "Verenigde Arabische Emiraten" },
238
+ { code: "US", name: "Verenigde Staten" },
239
+ { code: "VN", name: "Vietnam" },
240
+ { code: "WF", name: "Wallis en Futuna" },
241
+ { code: "EH", name: "Westelijke Sahara" },
242
+ { code: "BY", name: "Wit-Rusland" },
243
+ { code: "ZM", name: "Zambia" },
244
+ { code: "ZW", name: "Zimbabwe" },
245
+ { code: "ZA", name: "Zuid-Afrika" },
246
+ { code: "GS", name: "Zuid-Georgia en de Zuidelijke Sandwicheilanden" },
247
+ { code: "KR", name: "Zuid-Korea" },
248
+ { code: "SS", name: "Zuid-Soedan" },
249
+ { code: "SE", name: "Zweden" },
250
+ { code: "CH", name: "Zwitserland" },
251
+ ].sort((a, b) => a.name.localeCompare(b.name, "nl"));
@@ -3,13 +3,20 @@ export interface FloricodeRecord {
3
3
  resource: string;
4
4
  data: Record<string, any>;
5
5
  }
6
+ export interface ListFloricodeOpts {
7
+ /** Optional jsonb field to filter with a LIKE-prefix (e.g. `product_group_id`). */
8
+ prefixField?: string;
9
+ prefix?: string;
10
+ /** Optional sort field — either a table column (e.g. `record_id`) or `data->>field` for jsonb. */
11
+ sortField?: string;
12
+ sortAscending?: boolean;
13
+ }
6
14
  /**
7
15
  * List records from floricode_records.
8
- * Search filters across both `data->>name` and `data->>description`
9
- * (VbnProduct gebruikt `name`, FeatureType / FeatureValue / LoadCarrier /
10
- * PackagingType gebruiken `description`).
16
+ * Search filters across both `data->>name` and `data->>description`.
17
+ * Optional prefix-filter on any jsonb text field via opts.prefixField + opts.prefix.
11
18
  */
12
- export declare function listFloricode(resource: string, search?: string, limit?: number): Promise<FloricodeRecord[]>;
19
+ export declare function listFloricode(resource: string, search?: string, limit?: number, opts?: ListFloricodeOpts): Promise<FloricodeRecord[]>;
13
20
  /** Exact-match lookup op een veld binnen data (jsonb). */
14
21
  export declare function listFloricodeByField(resource: string, field: string, value: string | number, limit?: number): Promise<FloricodeRecord[]>;
15
22
  //# sourceMappingURL=floricode-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"floricode-client.d.ts","sourceRoot":"","sources":["../../src/lib/floricode-client.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,SAAK,GACT,OAAO,CAAC,eAAe,EAAE,CAAC,CAe5B;AAED,0DAA0D;AAC1D,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,KAAK,SAAM,GACV,OAAO,CAAC,eAAe,EAAE,CAAC,CAS5B"}
1
+ {"version":3,"file":"floricode-client.d.ts","sourceRoot":"","sources":["../../src/lib/floricode-client.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,SAAK,EACV,IAAI,GAAE,iBAAsB,GAC3B,OAAO,CAAC,eAAe,EAAE,CAAC,CA0B5B;AAED,0DAA0D;AAC1D,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,KAAK,SAAM,GACV,OAAO,CAAC,eAAe,EAAE,CAAC,CAS5B"}
@@ -1,20 +1,26 @@
1
1
  import { supabase } from "@/integrations/supabase/client";
2
2
  /**
3
3
  * List records from floricode_records.
4
- * Search filters across both `data->>name` and `data->>description`
5
- * (VbnProduct gebruikt `name`, FeatureType / FeatureValue / LoadCarrier /
6
- * PackagingType gebruiken `description`).
4
+ * Search filters across both `data->>name` and `data->>description`.
5
+ * Optional prefix-filter on any jsonb text field via opts.prefixField + opts.prefix.
7
6
  */
8
- export async function listFloricode(resource, search, limit = 50) {
7
+ export async function listFloricode(resource, search, limit = 50, opts = {}) {
9
8
  let q = supabase
10
9
  .from("floricode_records")
11
10
  .select("record_id,resource,data")
12
11
  .eq("resource", resource)
13
12
  .limit(limit);
13
+ if (opts.prefixField && opts.prefix) {
14
+ q = q.like(`data->>${opts.prefixField}`, `${opts.prefix}%`);
15
+ }
14
16
  if (search && search.trim()) {
15
17
  const s = search.trim().replace(/[(),]/g, " ");
16
18
  q = q.or(`data->>name.ilike.%${s}%,data->>description.ilike.%${s}%`);
17
19
  }
20
+ if (opts.sortField) {
21
+ const ascending = opts.sortAscending ?? true;
22
+ q = q.order(opts.sortField, { ascending });
23
+ }
18
24
  const { data, error } = await q;
19
25
  if (error)
20
26
  throw error;
@@ -25,10 +25,6 @@ export declare const floriday: {
25
25
  ok: boolean;
26
26
  data: any;
27
27
  }>;
28
- listPackingConfigurations: (connectionId: string) => Promise<{
29
- ok: boolean;
30
- data: any;
31
- }>;
32
28
  listCustomerOrganizations: (connectionId: string) => Promise<{
33
29
  ok: boolean;
34
30
  data: any;
@@ -37,14 +33,15 @@ export declare const floriday: {
37
33
  ok: boolean;
38
34
  data: any;
39
35
  }>;
40
- createPackingConfiguration: (connectionId: string, payload: unknown) => Promise<{
36
+ createTradeItem: (connectionId: string, payload: unknown) => Promise<{
41
37
  ok: boolean;
42
38
  data?: any;
43
39
  error?: string;
44
40
  }>;
45
- createTradeItem: (connectionId: string, payload: unknown) => Promise<{
41
+ uploadImage: (connectionId: string, fileBase64: string, contentType: string, filename: string) => Promise<{
46
42
  ok: boolean;
47
- data?: any;
43
+ mediaId?: string;
44
+ url?: string;
48
45
  error?: string;
49
46
  }>;
50
47
  };
@@ -1 +1 @@
1
- {"version":3,"file":"floriday-client.d.ts","sourceRoot":"","sources":["../../src/lib/floriday-client.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,SA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ACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,GAAG,EAAE,OAAO,CAAC;CACd;AAWD,eAAO,MAAM,QAAQ;;mCAKY,MAAM;wCAOD,MAAM;YAC7B,OAAO;cAAQ,GAAG;;8CAIW,MAAM;YACnC,OAAO;cAAQ,GAAG;;2CAIQ,MAAM;YAChC,OAAO;cAAQ,GAAG;;oCAIC,MAAM,WAAW,OAAO;YAC3C,OAAO;eAAS,GAAG;gBAAU,MAAM;;gCAMhC,MAAM,cACR,MAAM,eACL,MAAM,YACT,MAAM;YAEL,OAAO;kBAAY,MAAM;cAAQ,MAAM;gBAAU,MAAM;;CAOrE,CAAC"}
@@ -20,10 +20,6 @@ export const floriday = {
20
20
  action: "listClassifications",
21
21
  connectionId,
22
22
  }),
23
- listPackingConfigurations: (connectionId) => call({
24
- action: "listPackingConfigurations",
25
- connectionId,
26
- }),
27
23
  listCustomerOrganizations: (connectionId) => call({
28
24
  action: "listCustomerOrganizations",
29
25
  connectionId,
@@ -32,14 +28,16 @@ export const floriday = {
32
28
  action: "listAdditionalServices",
33
29
  connectionId,
34
30
  }),
35
- createPackingConfiguration: (connectionId, payload) => call({
36
- action: "createPackingConfiguration",
37
- connectionId,
38
- payload,
39
- }),
40
31
  createTradeItem: (connectionId, payload) => call({
41
32
  action: "createTradeItem",
42
33
  connectionId,
43
34
  payload,
44
35
  }),
36
+ uploadImage: (connectionId, fileBase64, contentType, filename) => call({
37
+ action: "uploadImage",
38
+ connectionId,
39
+ fileBase64,
40
+ contentType,
41
+ filename,
42
+ }),
45
43
  };
@@ -68,7 +68,7 @@ export declare const stepSchemas: {
68
68
  paspoort: z.ZodObject<{
69
69
  botanicalName: z.ZodString;
70
70
  countryOfOrigin: z.ZodString;
71
- producerCode: z.ZodString;
71
+ producerCode: z.ZodDefault<z.ZodOptional<z.ZodString>>;
72
72
  }, z.core.$strip>;
73
73
  klanten: z.ZodObject<{
74
74
  customerOrganizationIds: z.ZodArray<z.ZodString>;
@@ -99,54 +99,48 @@ export declare function validateStep(key: StepKey, data: WizardData): {
99
99
  ok: false;
100
100
  errors: string[];
101
101
  };
102
+ export type LoadCarrierEnum = "NONE" | "AUCTION_TROLLEY" | "DANISH_TROLLEY" | "EURO_TROLLEY" | "PALLET" | "EURO_PALLET";
103
+ export type PhotoTypeEnum = "UNKNOWN" | "PIECE" | "TRAY" | "DETAIL" | "RULER" | "WEBSHOPFRIENDLY" | "SCENE" | "SEASON" | "STEM" | "BUNCH" | "CONTAINER" | "CLOCK";
104
+ export interface AddPackingConfigPayload {
105
+ primary: boolean;
106
+ piecesPerPackage: number;
107
+ package: {
108
+ vbnPackageCode: number;
109
+ };
110
+ packagesPerLayer: number;
111
+ layersPerLoadCarrier: number;
112
+ loadCarrier: LoadCarrierEnum;
113
+ isHiddenForDirectSales: boolean;
114
+ }
115
+ export declare function buildPackingConfigPayload(p: PackingConfigurationInput, primary?: boolean): AddPackingConfigPayload;
102
116
  export interface AddTradeItemPayload {
103
- productGroup: ProductGroup;
104
- vbnProductCode: string;
117
+ tradeItemId: string;
105
118
  supplierArticleCode: string;
119
+ articleGtin?: string;
120
+ vbnProductCode: number;
106
121
  tradeItemName: {
107
122
  nl: string;
108
- en: string;
109
123
  };
110
- gtin?: string;
111
- collectionIds: string[];
112
- tradeItemType: ArticleType;
113
- visibleInExplorer: boolean;
114
- customerOrganizationIds: string[];
115
- plantPassport?: {
116
- botanicalName: string;
117
- countryOfOriginCode: string;
118
- producerCode: string;
119
- lotNumber?: string;
120
- };
121
- featureValues: {
122
- featureType: string;
123
- value: string;
124
+ characteristics: {
125
+ vbnCode: string;
126
+ vbnValueCode: string;
127
+ }[];
128
+ customerOrganizationIds?: string[];
129
+ seasonalPeriods?: {
130
+ startWeek: number;
131
+ endWeek: number;
124
132
  }[];
125
133
  photos: {
126
- url: string;
127
134
  primary: boolean;
128
- sortOrder: number;
129
- }[];
130
- packingConfigurationIds: string[];
131
- additionalPackagingMaterials: {
132
- code: string;
133
- description?: string;
134
- quantity: number;
135
+ url: string;
136
+ type: PhotoTypeEnum;
137
+ sortIndex: number;
135
138
  }[];
136
- expectedAvailability: {
137
- yearRound: boolean;
138
- weeks: number[];
139
- };
139
+ packingConfigurations: AddPackingConfigPayload[];
140
+ botanicalNames?: string[];
141
+ countryOfOriginIsoCodes?: string[];
142
+ isHiddenInCatalog: boolean;
140
143
  }
141
144
  export declare function buildAddTradeItemPayload(d: WizardData): AddTradeItemPayload;
142
- export interface AddPackingConfigPayload {
143
- packagingType: string;
144
- loadCarrier: string;
145
- unitsPerPackage: number;
146
- packagesPerLayer: number;
147
- layersPerLoadCarrier: number;
148
- stackingHeightCm?: number;
149
- }
150
- export declare function buildPackingConfigPayload(p: PackingConfigurationInput): AddPackingConfigPayload;
151
145
  export declare const emptyWizardData: WizardData;
152
146
  //# sourceMappingURL=floriday-payload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"floriday-payload.d.ts","sourceRoot":"","sources":["../../src/lib/floriday-payload.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,CAAC;AACvE,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,mBAAmB,CAAC;AAE1D,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CA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QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3D,MAAM,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,aAAa,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACpF,qBAAqB,EAAE,uBAAuB,EAAE,CAAC;IACjD,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;IACnC,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAoBD,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,UAAU,GAAG,mBAAmB,CAmD3E;AAED,eAAO,MAAM,eAAe,EAAE,UAsB7B,CAAC"}
@@ -42,9 +42,8 @@ export const stepSchemas = {
42
42
  botanicalName: z.string().min(2, "Botanische naam verplicht"),
43
43
  countryOfOrigin: z
44
44
  .string()
45
- .min(2, "Land van oorsprong verplicht")
46
- .max(3, "Gebruik de ISO-landcode (bv. NL)"),
47
- producerCode: z.string().min(1, "Producer code verplicht"),
45
+ .min(2, "Selecteer minstens één land van oorsprong"),
46
+ producerCode: z.string().optional().default(""),
48
47
  }),
49
48
  klanten: z.object({
50
49
  customerOrganizationIds: z
@@ -131,62 +130,99 @@ export function validateStep(key, data) {
131
130
  return { ok: true };
132
131
  }
133
132
  }
133
+ const LOAD_CARRIER_VALUES = [
134
+ "NONE", "AUCTION_TROLLEY", "DANISH_TROLLEY",
135
+ "EURO_TROLLEY", "PALLET", "EURO_PALLET",
136
+ ];
137
+ function normaliseLoadCarrier(input) {
138
+ const v = (input ?? "").trim().toUpperCase().replace(/[\s-]+/g, "_");
139
+ return (LOAD_CARRIER_VALUES.includes(v)
140
+ ? v : "NONE");
141
+ }
142
+ function toIntOrUndefined(v) {
143
+ if (v === undefined || v === null || v === "")
144
+ return undefined;
145
+ const n = typeof v === "number" ? v : parseInt(String(v).trim(), 10);
146
+ return Number.isFinite(n) ? n : undefined;
147
+ }
148
+ export function buildPackingConfigPayload(p, primary = false) {
149
+ const vbnPackageCode = toIntOrUndefined(p.packagingType);
150
+ if (!vbnPackageCode) {
151
+ throw new Error(`Fusttype (VBN package code) ontbreekt of is geen getal voor configuratie "${p.id}"`);
152
+ }
153
+ return {
154
+ primary,
155
+ piecesPerPackage: Math.max(1, Math.min(9999, Number(p.unitsPerPackage) || 1)),
156
+ package: { vbnPackageCode },
157
+ packagesPerLayer: Math.max(1, Math.min(9999, Number(p.packagesPerLayer) || 1)),
158
+ layersPerLoadCarrier: Math.max(1, Math.min(9999, Number(p.layersPerLoadCarrier) || 1)),
159
+ loadCarrier: normaliseLoadCarrier(p.loadCarrier),
160
+ isHiddenForDirectSales: false,
161
+ };
162
+ }
163
+ function weeksToSeasonalPeriods(weeks) {
164
+ const sorted = [...new Set(weeks.filter((w) => w >= 1 && w <= 53))]
165
+ .sort((a, b) => a - b);
166
+ const periods = [];
167
+ let start = -1;
168
+ let prev = -1;
169
+ for (const w of sorted) {
170
+ if (start === -1) {
171
+ start = w;
172
+ prev = w;
173
+ continue;
174
+ }
175
+ if (w === prev + 1) {
176
+ prev = w;
177
+ continue;
178
+ }
179
+ periods.push({ startWeek: start, endWeek: prev });
180
+ start = w;
181
+ prev = w;
182
+ }
183
+ if (start !== -1)
184
+ periods.push({ startWeek: start, endWeek: prev });
185
+ return periods;
186
+ }
134
187
  export function buildAddTradeItemPayload(d) {
135
- if (!d.productGroup) {
188
+ if (!d.productGroup)
136
189
  throw new Error("productGroup ontbreekt");
190
+ const vbnProductCode = toIntOrUndefined(d.vbnCode);
191
+ if (!vbnProductCode) {
192
+ throw new Error("vbnProductCode moet een geheel getal zijn");
137
193
  }
138
- const nl = d.name.trim();
139
- const en = (d.nameEn || d.name).trim();
140
- const needsPassport = d.productGroup !== "CUT_FLOWER";
194
+ const characteristics = Object.entries(d.features)
195
+ .filter(([code, value]) => code && value && String(value).trim().length > 0)
196
+ .map(([vbnCode, vbnValueCode]) => ({
197
+ vbnCode: String(vbnCode).trim().slice(0, 3),
198
+ vbnValueCode: String(vbnValueCode).trim().slice(0, 3),
199
+ }));
200
+ const botanicalNames = (d.botanicalName || "")
201
+ .split(/[;,\n]/).map((s) => s.trim()).filter(Boolean);
202
+ const countryOfOriginIsoCodes = (d.countryOfOrigin || "")
203
+ .split(/[,;\s]+/).map((s) => s.trim().toUpperCase()).filter(Boolean);
204
+ const photos = d.images.map((img, i) => ({
205
+ primary: i === 0,
206
+ url: img.url,
207
+ type: "WEBSHOPFRIENDLY",
208
+ sortIndex: i,
209
+ }));
210
+ const packingConfigurations = d.packingConfigurations.map((p, i) => buildPackingConfigPayload(p, i === 0));
141
211
  const isCustomerSpecific = d.articleType === "CUSTOMER_SPECIFIC";
142
212
  return {
143
- productGroup: d.productGroup,
144
- vbnProductCode: d.vbnCode,
145
- supplierArticleCode: d.articleCode.trim(),
146
- tradeItemName: { nl, en },
147
- gtin: d.gtin?.trim() || undefined,
148
- collectionIds: d.collections,
149
- tradeItemType: d.articleType,
150
- visibleInExplorer: isCustomerSpecific ? false : d.visibleInExplorer,
213
+ tradeItemId: crypto.randomUUID(),
214
+ supplierArticleCode: d.articleCode.trim().slice(0, 13),
215
+ articleGtin: d.gtin && d.gtin.trim().length === 13 ? d.gtin.trim() : undefined,
216
+ vbnProductCode,
217
+ tradeItemName: { nl: d.name.trim().slice(0, 120) },
218
+ characteristics,
151
219
  customerOrganizationIds: isCustomerSpecific ? d.customerOrganizationIds : [],
152
- plantPassport: needsPassport
153
- ? {
154
- botanicalName: d.botanicalName.trim(),
155
- countryOfOriginCode: d.countryOfOrigin.trim().toUpperCase(),
156
- producerCode: d.producerCode.trim(),
157
- lotNumber: d.lotNumber?.trim() || undefined,
158
- }
159
- : undefined,
160
- featureValues: Object.entries(d.features)
161
- .filter(([, v]) => v && v.length > 0)
162
- .map(([featureType, value]) => ({ featureType, value })),
163
- photos: d.images.map((img, i) => ({
164
- url: img.url,
165
- primary: i === 0,
166
- sortOrder: i,
167
- })),
168
- packingConfigurationIds: d.packingConfigurations
169
- .map((p) => p.floridayId)
170
- .filter((id) => !!id),
171
- additionalPackagingMaterials: d.additionalPackaging.map((p) => ({
172
- code: p.code,
173
- description: p.description,
174
- quantity: p.quantity,
175
- })),
176
- expectedAvailability: {
177
- yearRound: d.yearRound,
178
- weeks: d.yearRound ? [] : d.weeks,
179
- },
180
- };
181
- }
182
- export function buildPackingConfigPayload(p) {
183
- return {
184
- packagingType: p.packagingType,
185
- loadCarrier: p.loadCarrier,
186
- unitsPerPackage: p.unitsPerPackage,
187
- packagesPerLayer: p.packagesPerLayer,
188
- layersPerLoadCarrier: p.layersPerLoadCarrier,
189
- stackingHeightCm: p.stackingHeightCm,
220
+ seasonalPeriods: d.yearRound ? [] : weeksToSeasonalPeriods(d.weeks),
221
+ photos,
222
+ packingConfigurations,
223
+ botanicalNames: botanicalNames.length ? botanicalNames : undefined,
224
+ countryOfOriginIsoCodes: countryOfOriginIsoCodes.length ? countryOfOriginIsoCodes : undefined,
225
+ isHiddenInCatalog: isCustomerSpecific ? true : !d.visibleInExplorer,
190
226
  };
191
227
  }
192
228
  export const emptyWizardData = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowselections/floriday-voorraad",
3
- "version": "1.0.0",
3
+ "version": "1.0.4",
4
4
  "sideEffects": false,
5
5
  "type": "module",
6
6
  "main": "./dist-lib/index.js",
@@ -28,32 +28,18 @@
28
28
  },
29
29
  "peerDependencies": {
30
30
  "react": "^18 || ^19",
31
- "react-dom": "^18",
31
+ "react-dom": "^18 || ^19",
32
32
  "@flowselections/core": "*"
33
33
  },
34
34
  "dependencies": {
35
- "@cloudflare/vite-plugin": "^1.25.5",
36
35
  "@hookform/resolvers": "^5.4.0",
37
- "@rsbuild/core": "^1.0.0",
38
36
  "@supabase/supabase-js": "^2.103.0",
39
- "@tailwindcss/vite": "^4.2.1",
40
- "@tanstack/react-query": "^5.83.0",
41
- "@tanstack/react-router": "^1.168.0",
42
- "@tanstack/react-start": "^1.167.14",
43
- "@tanstack/router-plugin": "^1.167.10",
44
- "lucide-react": "^0.575.0",
45
- "react": "^19.2.0",
46
- "react-dom": "^19.2.0",
47
37
  "react-hook-form": "^7.76.0",
48
- "sonner": "^2.0.7",
49
- "tailwindcss": "^4.2.1",
50
- "tw-animate-css": "^1.3.4",
51
- "vite-tsconfig-paths": "^6.0.2",
52
38
  "xlsx": "^0.18.5",
53
39
  "zod": "^4.4.3"
54
40
  },
55
41
  "devDependencies": {
56
- "@flowselections/core": "npm:@flowselections/core@^1.0.10",
42
+ "@flowselections/core": "^1.0.10",
57
43
  "@eslint/js": "^9.32.0",
58
44
  "@lovable.dev/vite-tanstack-config": "^1.2.0",
59
45
  "@types/node": "^22.16.5",
@@ -66,6 +52,16 @@
66
52
  "globals": "^15.15.0",
67
53
  "typescript": "^5.8.3",
68
54
  "typescript-eslint": "^8.56.1",
69
- "vite": "^7.3.1"
70
- }
55
+ "vite": "^7.3.1",
56
+ "react": "^19.2.0",
57
+ "react-dom": "^19.2.0",
58
+ "@cloudflare/vite-plugin": "^1.25.5",
59
+ "@rsbuild/core": "^1.0.0",
60
+ "@tailwindcss/vite": "^4.2.1",
61
+ "@tanstack/router-plugin": "^1.167.10",
62
+ "tailwindcss": "^4.2.1",
63
+ "tw-animate-css": "^1.3.4",
64
+ "vite-tsconfig-paths": "^6.0.2"
65
+ },
66
+ "private": false
71
67
  }