@scayle/storefront-nuxt 7.85.15 → 7.86.0
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @scayle/storefront-nuxt
|
|
2
2
|
|
|
3
|
+
## 7.86.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add `formatPercentage` to `useFormatHelpers.ts`
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
**Dependencies**
|
|
12
|
+
|
|
13
|
+
- Updated dependency to @scayle/storefront-core@7.65.9
|
|
14
|
+
|
|
15
|
+
## 7.85.16
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
**Dependencies**
|
|
20
|
+
|
|
21
|
+
- Updated dependency to @scayle/storefront-core@7.65.8
|
|
22
|
+
|
|
3
23
|
## 7.85.15
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -135,28 +155,28 @@ For example:
|
|
|
135
155
|
```ts
|
|
136
156
|
useBrand({
|
|
137
157
|
params: { brandId: 1 },
|
|
138
|
-
}).data satisfies Ref<Brand
|
|
158
|
+
}).data satisfies Ref<Brand>
|
|
139
159
|
|
|
140
160
|
useBrand({
|
|
141
161
|
params: { brandId: 1 },
|
|
142
162
|
options: {
|
|
143
|
-
pick: [
|
|
163
|
+
pick: ['id', 'isActive'],
|
|
144
164
|
},
|
|
145
|
-
}).data satisfies Ref<Brand
|
|
165
|
+
}).data satisfies Ref<Brand>
|
|
146
166
|
|
|
147
167
|
useBrand({
|
|
148
168
|
params: { brandId: 1 },
|
|
149
169
|
options: {
|
|
150
170
|
transform: (brand) => brand.slug,
|
|
151
171
|
},
|
|
152
|
-
}).data satisfies Ref<Brand
|
|
172
|
+
}).data satisfies Ref<Brand>
|
|
153
173
|
|
|
154
174
|
useBrand({
|
|
155
175
|
params: { brandId: 1 },
|
|
156
176
|
options: {
|
|
157
|
-
default: () =>
|
|
177
|
+
default: () => 'Brand not found',
|
|
158
178
|
},
|
|
159
|
-
}).data satisfies Ref<Brand
|
|
179
|
+
}).data satisfies Ref<Brand>
|
|
160
180
|
```
|
|
161
181
|
|
|
162
182
|
**In 7.85.0**
|
|
@@ -164,28 +184,28 @@ useBrand({
|
|
|
164
184
|
```ts
|
|
165
185
|
useBrand({
|
|
166
186
|
params: { brandId: 1 },
|
|
167
|
-
}).data satisfies Ref<Brand | null
|
|
187
|
+
}).data satisfies Ref<Brand | null>
|
|
168
188
|
|
|
169
189
|
useBrand({
|
|
170
190
|
params: { brandId: 1 },
|
|
171
191
|
options: {
|
|
172
|
-
pick: [
|
|
192
|
+
pick: ['id', 'isActive'],
|
|
173
193
|
},
|
|
174
|
-
}).data satisfies Ref<Pick<Brand,
|
|
194
|
+
}).data satisfies Ref<Pick<Brand, 'id' | 'isActive'> | null>
|
|
175
195
|
|
|
176
196
|
useBrand({
|
|
177
197
|
params: { brandId: 1 },
|
|
178
198
|
options: {
|
|
179
199
|
transform: (brand) => brand.slug,
|
|
180
200
|
},
|
|
181
|
-
}).data satisfies Ref<string | null
|
|
201
|
+
}).data satisfies Ref<string | null>
|
|
182
202
|
|
|
183
203
|
useBrand({
|
|
184
204
|
params: { brandId: 1 },
|
|
185
205
|
options: {
|
|
186
|
-
default: () =>
|
|
206
|
+
default: () => 'Brand not found',
|
|
187
207
|
},
|
|
188
|
-
}).data satisfies Ref<Brand | string
|
|
208
|
+
}).data satisfies Ref<Brand | string>
|
|
189
209
|
```
|
|
190
210
|
|
|
191
211
|
For more details on `useAsyncData` usage check out the [Nuxt Docs](https://nuxt.com/docs/api/composables/use-async-data)
|
|
@@ -219,7 +239,8 @@ For more details on `useAsyncData` usage check out the [Nuxt Docs](https://nuxt.
|
|
|
219
239
|
|
|
220
240
|
### Patch Changes
|
|
221
241
|
|
|
222
|
-
-
|
|
242
|
+
-
|
|
243
|
+
- Updated dependencies
|
|
223
244
|
- @scayle/storefront-core@7.64.0
|
|
224
245
|
|
|
225
246
|
## 7.84.2
|
|
@@ -344,27 +365,27 @@ For more details on `useAsyncData` usage check out the [Nuxt Docs](https://nuxt.
|
|
|
344
365
|
Hooks can be registered by adding a nitro plugin inside ´server/plugins/´:
|
|
345
366
|
|
|
346
367
|
```ts
|
|
347
|
-
import { defineNitroPlugin } from
|
|
368
|
+
import { defineNitroPlugin } from '#imports'
|
|
348
369
|
|
|
349
370
|
export default defineNitroPlugin((nitroApp) => {
|
|
350
|
-
nitroApp.hooks.hook(
|
|
351
|
-
rpcContext.log.debug(`Before: ${rpcName}`)
|
|
352
|
-
})
|
|
371
|
+
nitroApp.hooks.hook('storefront:rpc:before', (rpcName, rpcContext) => {
|
|
372
|
+
rpcContext.log.debug(`Before: ${rpcName}`)
|
|
373
|
+
})
|
|
353
374
|
|
|
354
375
|
nitroApp.hooks.hook(
|
|
355
|
-
|
|
376
|
+
'storefront:rpc:after',
|
|
356
377
|
(rpcName, rpcContext, result) => {
|
|
357
|
-
rpcContext.log.debug(`After: ${rpcName} returned ${result}`)
|
|
358
|
-
}
|
|
359
|
-
)
|
|
378
|
+
rpcContext.log.debug(`After: ${rpcName} returned ${result}`)
|
|
379
|
+
},
|
|
380
|
+
)
|
|
360
381
|
|
|
361
382
|
nitroApp.hooks.hook(
|
|
362
|
-
|
|
383
|
+
'storefront:rpc:error',
|
|
363
384
|
(rpcName, rpcContext, error) => {
|
|
364
|
-
rpcContext.log.error(`ERROR: ${rpcName} did throw ${error}`)
|
|
365
|
-
}
|
|
366
|
-
)
|
|
367
|
-
})
|
|
385
|
+
rpcContext.log.error(`ERROR: ${rpcName} did throw ${error}`)
|
|
386
|
+
},
|
|
387
|
+
)
|
|
388
|
+
})
|
|
368
389
|
```
|
|
369
390
|
|
|
370
391
|
Added [`callHook`](https://github.com/unjs/hookable?tab=readme-ov-file#async-callhook-name-args), `callHookParallel` and [`callHookWith`](https://github.com/unjs/hookable?tab=readme-ov-file#callhookwith-name-callerfn) to `RpcContext` to allow triggering hooks within RPCs
|
|
@@ -632,20 +653,20 @@ For more details on `useAsyncData` usage check out the [Nuxt Docs](https://nuxt.
|
|
|
632
653
|
- It is now also possible to extend the RPCContext using the `storefront:context:created` nitro runtime hook.
|
|
633
654
|
|
|
634
655
|
```ts
|
|
635
|
-
import { defineNitroPlugin } from
|
|
656
|
+
import { defineNitroPlugin } from 'nitropack/runtime/plugin'
|
|
636
657
|
// Augment RpxContext type
|
|
637
|
-
declare module
|
|
658
|
+
declare module '@scayle/storefront-nuxt' {
|
|
638
659
|
interface AdditionalRpcContext {
|
|
639
|
-
myNewProp: string
|
|
660
|
+
myNewProp: string
|
|
640
661
|
}
|
|
641
662
|
}
|
|
642
663
|
|
|
643
664
|
// Set new value on rpcContext
|
|
644
665
|
export default defineNitroPlugin((nitroApp) => {
|
|
645
|
-
nitroApp.hooks.hook(
|
|
646
|
-
rpcContext.myNewProp =
|
|
647
|
-
})
|
|
648
|
-
})
|
|
666
|
+
nitroApp.hooks.hook('storefront:context:created', (rpcContext) => {
|
|
667
|
+
rpcContext.myNewProp = 'My campaign key'
|
|
668
|
+
})
|
|
669
|
+
})
|
|
649
670
|
```
|
|
650
671
|
|
|
651
672
|
### Patch Changes
|
|
@@ -848,8 +869,8 @@ For more details on `useAsyncData` usage check out the [Nuxt Docs](https://nuxt.
|
|
|
848
869
|
|
|
849
870
|
```ts
|
|
850
871
|
const { data: externalIDPRedirects } = await useIDP({
|
|
851
|
-
queryParams: { redirectTo:
|
|
852
|
-
})
|
|
872
|
+
queryParams: { redirectTo: '/account' },
|
|
873
|
+
})
|
|
853
874
|
```
|
|
854
875
|
|
|
855
876
|
Please note that `code` and `state` are not supported as these are used by the SCAYLE Authentication API.
|
|
@@ -1268,16 +1289,16 @@ There is an `unwrap` function exported by this package (>=7.55.0) that can be us
|
|
|
1268
1289
|
Before:
|
|
1269
1290
|
|
|
1270
1291
|
```typescript
|
|
1271
|
-
toCurrency(100, { currency:
|
|
1272
|
-
formatPrice(100, { currencyFractionDigits: 2 })
|
|
1292
|
+
toCurrency(100, { currency: 'EUR' })
|
|
1293
|
+
formatPrice(100, { currencyFractionDigits: 2 })
|
|
1273
1294
|
```
|
|
1274
1295
|
|
|
1275
1296
|
After:
|
|
1276
1297
|
|
|
1277
1298
|
```typescript
|
|
1278
|
-
const { formatCurrency } = useFormatHelpers()
|
|
1279
|
-
formatCurrency(100, { currency:
|
|
1280
|
-
formatCurrency(100, { style:
|
|
1299
|
+
const { formatCurrency } = useFormatHelpers()
|
|
1300
|
+
formatCurrency(100, { currency: 'EUR' })
|
|
1301
|
+
formatCurrency(100, { style: 'decimal', currencyFractionDigits: 2 })
|
|
1281
1302
|
```
|
|
1282
1303
|
|
|
1283
1304
|
## 7.44.1
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -10,5 +10,11 @@ type FormatCurrencyOptions = {
|
|
|
10
10
|
};
|
|
11
11
|
export declare function useFormatHelpers(): {
|
|
12
12
|
formatCurrency: (value: number, options?: FormatCurrencyOptions) => string;
|
|
13
|
+
formatPercentage: (value: number, options?: {
|
|
14
|
+
locale?: string;
|
|
15
|
+
minimumFractionDigits?: number;
|
|
16
|
+
maximumFractionDigits?: number;
|
|
17
|
+
signDisplay?: Intl.NumberFormatOptions["signDisplay"];
|
|
18
|
+
}) => string;
|
|
13
19
|
};
|
|
14
20
|
export {};
|
|
@@ -19,7 +19,19 @@ export function useFormatHelpers() {
|
|
|
19
19
|
currency
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
|
+
const formatPercentage = (value, options) => {
|
|
23
|
+
const locale = options?.locale ?? currentShop.value.locale;
|
|
24
|
+
const minimumFractionDigits = options?.minimumFractionDigits ?? 0;
|
|
25
|
+
const maximumFractionDigits = options?.maximumFractionDigits ?? 2;
|
|
26
|
+
return value.toLocaleString(locale, {
|
|
27
|
+
style: "percent",
|
|
28
|
+
minimumFractionDigits,
|
|
29
|
+
maximumFractionDigits,
|
|
30
|
+
signDisplay: options?.signDisplay
|
|
31
|
+
});
|
|
32
|
+
};
|
|
22
33
|
return {
|
|
23
|
-
formatCurrency
|
|
34
|
+
formatCurrency,
|
|
35
|
+
formatPercentage
|
|
24
36
|
};
|
|
25
37
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.86.0",
|
|
5
5
|
"description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
|
|
6
6
|
"author": "SCAYLE Commerce Engine",
|
|
7
7
|
"license": "MIT",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@nuxt/kit": "^3.12.2",
|
|
62
62
|
"@opentelemetry/api": "^1.9.0",
|
|
63
63
|
"@scayle/h3-session": "^0.4.1",
|
|
64
|
-
"@scayle/storefront-core": "7.65.
|
|
64
|
+
"@scayle/storefront-core": "7.65.9",
|
|
65
65
|
"@scayle/unstorage-compression-driver": "^0.1.4",
|
|
66
66
|
"@vueuse/core": "11.1.0",
|
|
67
67
|
"consola": "^3.2.3",
|
|
@@ -82,17 +82,17 @@
|
|
|
82
82
|
"@nuxt/eslint": "0.6.0",
|
|
83
83
|
"@nuxt/module-builder": "0.8.4",
|
|
84
84
|
"@nuxt/schema": "3.13.2",
|
|
85
|
-
"@nuxt/test-utils": "3.14.
|
|
85
|
+
"@nuxt/test-utils": "3.14.4",
|
|
86
86
|
"@scayle/eslint-config-storefront": "4.3.2",
|
|
87
87
|
"@scayle/eslint-plugin-vue-composable": "0.2.1",
|
|
88
|
-
"@types/node": "20.
|
|
89
|
-
"dprint": "0.47.
|
|
90
|
-
"eslint": "9.
|
|
88
|
+
"@types/node": "20.17.0",
|
|
89
|
+
"dprint": "0.47.4",
|
|
90
|
+
"eslint": "9.13.0",
|
|
91
91
|
"eslint-formatter-gitlab": "5.1.0",
|
|
92
92
|
"fishery": "2.2.2",
|
|
93
93
|
"h3": "1.13.0",
|
|
94
94
|
"node-mocks-http": "1.16.1",
|
|
95
|
-
"nuxi": "3.
|
|
95
|
+
"nuxi": "3.15.0",
|
|
96
96
|
"nuxt": "3.13.2",
|
|
97
97
|
"publint": "0.2.11",
|
|
98
98
|
"vitest": "2.1.3",
|