@requiply/nuxt 0.0.0-stage → 0.1.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 +15 -0
- package/LICENSE +21 -0
- package/README.md +644 -2
- package/dist/module.d.mts +16 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +83 -0
- package/dist/runtime/app/components/RequiplyAccountLinks.d.ts +53 -0
- package/dist/runtime/app/components/RequiplyAccountLinks.js +13 -0
- package/dist/runtime/app/components/RequiplyBookButton.d.ts +37 -0
- package/dist/runtime/app/components/RequiplyBookButton.js +6 -0
- package/dist/runtime/app/components/RequiplyBundle.d.ts +21 -0
- package/dist/runtime/app/components/RequiplyBundle.js +4 -0
- package/dist/runtime/app/components/RequiplyCallButton.d.ts +35 -0
- package/dist/runtime/app/components/RequiplyCallButton.js +6 -0
- package/dist/runtime/app/components/RequiplyCartButton.d.ts +24 -0
- package/dist/runtime/app/components/RequiplyCartButton.js +4 -0
- package/dist/runtime/app/components/RequiplyDatePicker.d.ts +12 -0
- package/dist/runtime/app/components/RequiplyDatePicker.js +2 -0
- package/dist/runtime/app/components/RequiplyPortalButton.d.ts +34 -0
- package/dist/runtime/app/components/RequiplyPortalButton.js +6 -0
- package/dist/runtime/app/components/RequiplyPriceTiers.d.ts +21 -0
- package/dist/runtime/app/components/RequiplyPriceTiers.js +4 -0
- package/dist/runtime/app/components/RequiplyProduct.d.ts +37 -0
- package/dist/runtime/app/components/RequiplyProduct.js +26 -0
- package/dist/runtime/app/components/RequiplyProductCard.d.ts +21 -0
- package/dist/runtime/app/components/RequiplyProductCard.js +4 -0
- package/dist/runtime/app/components/RequiplyProductList.d.ts +70 -0
- package/dist/runtime/app/components/RequiplyProductList.js +19 -0
- package/dist/runtime/app/composables/useRequiply.d.ts +12 -0
- package/dist/runtime/app/composables/useRequiply.js +12 -0
- package/dist/runtime/app/composables/useRequiplyEmbed.d.ts +43 -0
- package/dist/runtime/app/composables/useRequiplyEmbed.js +54 -0
- package/dist/runtime/app/composables/useRequiplyProduct.d.ts +40 -0
- package/dist/runtime/app/composables/useRequiplyProduct.js +92 -0
- package/dist/runtime/app/embed.d.ts +79 -0
- package/dist/runtime/app/embed.js +75 -0
- package/dist/runtime/app/placeholder.d.ts +26 -0
- package/dist/runtime/app/placeholder.js +29 -0
- package/dist/runtime/app/plugins/requiply.d.ts +2 -0
- package/dist/runtime/app/plugins/requiply.js +46 -0
- package/dist/runtime/requiply.d.ts +2 -0
- package/dist/runtime/requiply.js +1 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/server/utils/requiply.d.ts +16 -0
- package/dist/runtime/server/utils/requiply.js +22 -0
- package/dist/runtime/types.d.ts +221 -0
- package/dist/runtime/types.js +0 -0
- package/dist/types.d.mts +9 -0
- package/package.json +78 -4
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/** A phone number the call buttons offer, with an optional caption such as a department. */
|
|
2
|
+
export interface RequiplyPhone {
|
|
3
|
+
number: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
}
|
|
6
|
+
/** The icon on the cart and booking buttons. `plus` only suits booking buttons. */
|
|
7
|
+
export type RequiplyButtonIcon = 'cart' | 'calendar' | 'truck' | 'plus' | 'none';
|
|
8
|
+
/**
|
|
9
|
+
* Design tokens of the booking widgets, written to `:root` as `--rq-*` CSS variables
|
|
10
|
+
* (`surface` becomes `--rq-surface`). Any CSS value works; leave a token out to keep the
|
|
11
|
+
* default. Setting them in your own CSS works just as well.
|
|
12
|
+
*/
|
|
13
|
+
export interface RequiplyTheme {
|
|
14
|
+
/** Buttons, links, the selected state. A hex color also derives `onPrimary`, `link` and the shade ramp. */
|
|
15
|
+
primary?: string;
|
|
16
|
+
/** Text on `primary`. */
|
|
17
|
+
onPrimary?: string;
|
|
18
|
+
/** Links and outlined buttons. */
|
|
19
|
+
link?: string;
|
|
20
|
+
/** Font family; defaults to the page's body font. */
|
|
21
|
+
font?: string;
|
|
22
|
+
/** Base font size, e.g. `15px`. */
|
|
23
|
+
fontSize?: string;
|
|
24
|
+
/** Text color. */
|
|
25
|
+
text?: string;
|
|
26
|
+
/** Card, drawer, dialog and field backgrounds. */
|
|
27
|
+
surface?: string;
|
|
28
|
+
/** Image placeholders and quiet panels. */
|
|
29
|
+
mutedBg?: string;
|
|
30
|
+
/** Card and divider borders. */
|
|
31
|
+
border?: string;
|
|
32
|
+
/** Field and quantity stepper borders. */
|
|
33
|
+
inputBorder?: string;
|
|
34
|
+
/** Height of buttons, fields and steppers, e.g. `48px`. */
|
|
35
|
+
controlHeight?: string;
|
|
36
|
+
radiusCard?: string;
|
|
37
|
+
radiusControl?: string;
|
|
38
|
+
radiusPill?: string;
|
|
39
|
+
radiusImage?: string;
|
|
40
|
+
/** "Available", savings. */
|
|
41
|
+
success?: string;
|
|
42
|
+
successBg?: string;
|
|
43
|
+
/** "Not available", errors. */
|
|
44
|
+
danger?: string;
|
|
45
|
+
/** Chosen days and times in the date picker. */
|
|
46
|
+
range?: string;
|
|
47
|
+
rangeSoft?: string;
|
|
48
|
+
onRange?: string;
|
|
49
|
+
/** Backdrop behind the cart and dialogs. */
|
|
50
|
+
overlay?: string;
|
|
51
|
+
/** Any other `--rq-*` variable, by its name without the prefix. */
|
|
52
|
+
[token: string]: string | undefined;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Texts of the widgets to replace, by key: `{ add: 'Rent' }` for every language, or per
|
|
56
|
+
* language code: `{ uk: { add: 'Орендувати' } }`. Keys are the widget string keys, e.g.
|
|
57
|
+
* `add`, `inCart`, `chooseDates`, `checkAvailability`, `availableCount` (`{n} available`).
|
|
58
|
+
*/
|
|
59
|
+
export type RequiplyMessages = Record<string, string | Record<string, string>>;
|
|
60
|
+
/**
|
|
61
|
+
* How the Requiply booking widgets look and behave. Every option is optional: the widgets
|
|
62
|
+
* take the organization's color, corner style, language and currency from Requiply.
|
|
63
|
+
*/
|
|
64
|
+
export interface RequiplyEmbedOptions {
|
|
65
|
+
/** Language of the widgets, e.g. `en` or `uk`. Defaults to the page's `<html lang>`, then the organization's language. */
|
|
66
|
+
locale?: string;
|
|
67
|
+
/** Brand color as a hex value; defaults to the booking page color set in Requiply. */
|
|
68
|
+
color?: string;
|
|
69
|
+
/** Corner style of buttons and cards; defaults to the booking page setting. */
|
|
70
|
+
corners?: 'sharp' | 'soft' | 'rounded';
|
|
71
|
+
/** Shows the floating cart button in a page corner. Off automatically on pages with a `<RequiplyCartButton>`. Default `true`. */
|
|
72
|
+
floatingCart?: boolean;
|
|
73
|
+
/** Page corner of the floating cart. Default `right`. */
|
|
74
|
+
cartPosition?: 'right' | 'left';
|
|
75
|
+
/** Prices with a currency symbol (`₴ 500`) or code (`UAH 500`). Default `symbol`. */
|
|
76
|
+
currencyDisplay?: 'symbol' | 'code';
|
|
77
|
+
/** Whether visitors pick products or dates first; defaults to the organization's booking setting. */
|
|
78
|
+
startFrom?: 'items' | 'dates';
|
|
79
|
+
/** Where the portal's confirmation page sends visitors back to. Defaults to the page they booked from. */
|
|
80
|
+
returnUrl?: string;
|
|
81
|
+
/** The website home the portal header logo leads back to. Defaults to the site origin. */
|
|
82
|
+
siteUrl?: string;
|
|
83
|
+
/** Numbers for the call buttons; the organization's phone when empty. */
|
|
84
|
+
phones?: Array<string | RequiplyPhone>;
|
|
85
|
+
/** Call button next to "Add to booking": hidden, an icon, or icon and "Call". Default `off`. */
|
|
86
|
+
callButton?: 'off' | 'icon' | 'label';
|
|
87
|
+
/** Floating call button: nowhere, on phones and tablets, or on every screen. Default `off`. */
|
|
88
|
+
callFloating?: 'off' | 'mobile' | 'all';
|
|
89
|
+
/** Text in the call window, such as a note that calls are recorded. */
|
|
90
|
+
callNote?: string;
|
|
91
|
+
/** Whether the call window lists working hours. Default `true`. */
|
|
92
|
+
callHours?: boolean;
|
|
93
|
+
/** Icon of the floating cart and `<RequiplyCartButton>`. Default `calendar`. */
|
|
94
|
+
cartIcon?: RequiplyButtonIcon;
|
|
95
|
+
/** Icon of "Add to booking" on buttons and cards. Default `plus`. */
|
|
96
|
+
buttonIcon?: RequiplyButtonIcon;
|
|
97
|
+
/** Line or solid icons. Default `outline`. */
|
|
98
|
+
iconStyle?: 'outline' | 'filled';
|
|
99
|
+
/** Design tokens, see {@link RequiplyTheme}. */
|
|
100
|
+
theme?: RequiplyTheme;
|
|
101
|
+
/** Replacement texts, see {@link RequiplyMessages}. */
|
|
102
|
+
messages?: RequiplyMessages;
|
|
103
|
+
/**
|
|
104
|
+
* CSS added inside every widget after its own styles, the cart and dialogs included.
|
|
105
|
+
* Elements carry `rq-` classes (`.rq-btn`, `.rq-card__name`, `.rq-drawer`); for styling
|
|
106
|
+
* from your own stylesheet use their parts instead: `.requiply-button::part(btn)`.
|
|
107
|
+
*/
|
|
108
|
+
css?: string;
|
|
109
|
+
/** Loads the widget runtime from another address, e.g. a self-hosted copy. Defaults to `<portalUrl>/embed/v1/requiply-embed.js`. */
|
|
110
|
+
scriptUrl?: string;
|
|
111
|
+
}
|
|
112
|
+
/** Options of the `requiply` key in `nuxt.config`. */
|
|
113
|
+
export interface ModuleOptions {
|
|
114
|
+
/**
|
|
115
|
+
* The organization code: the end of your booking page address, e.g. `my-rental` for
|
|
116
|
+
* `portal.requiply.com/my-rental`. Needed by the booking widgets.
|
|
117
|
+
* Env: `NUXT_PUBLIC_REQUIPLY_ORG`.
|
|
118
|
+
*/
|
|
119
|
+
org?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Publishable API key (`rq_pk_...`) for `useRequiply()` in the browser and during SSR.
|
|
122
|
+
* Safe to expose. Env: `NUXT_PUBLIC_REQUIPLY_PUBLISHABLE_KEY`.
|
|
123
|
+
*/
|
|
124
|
+
publishableKey?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Secret API key (`rq_sk_...`) for `useRequiplyServer()` in server routes. Kept in the
|
|
127
|
+
* private runtime config and never sent to the browser. Prefer the env variable
|
|
128
|
+
* `NUXT_REQUIPLY_SECRET_KEY` over writing it into `nuxt.config`.
|
|
129
|
+
*/
|
|
130
|
+
secretKey?: string;
|
|
131
|
+
/** Requiply API address. Default `https://api.requiply.com`. Env: `NUXT_PUBLIC_REQUIPLY_API_URL`. */
|
|
132
|
+
apiUrl?: string;
|
|
133
|
+
/** Booking portal address. Default `https://portal.requiply.com`. Env: `NUXT_PUBLIC_REQUIPLY_PORTAL_URL`. */
|
|
134
|
+
portalUrl?: string;
|
|
135
|
+
/**
|
|
136
|
+
* Loads the booking widgets (buttons, product cards, cart, date picker) on every page.
|
|
137
|
+
* `false` turns them off, e.g. for a site that only uses the API. On by default once `org` is set.
|
|
138
|
+
*/
|
|
139
|
+
embed?: boolean | RequiplyEmbedOptions;
|
|
140
|
+
/** Registers the `<Requiply*>` components. Default `true`. */
|
|
141
|
+
components?: boolean;
|
|
142
|
+
}
|
|
143
|
+
/** What the module puts into `runtimeConfig.public.requiply`. */
|
|
144
|
+
export interface RequiplyPublicRuntimeConfig {
|
|
145
|
+
org: string;
|
|
146
|
+
publishableKey: string;
|
|
147
|
+
apiUrl: string;
|
|
148
|
+
portalUrl: string;
|
|
149
|
+
embed: false | RequiplyEmbedOptions;
|
|
150
|
+
}
|
|
151
|
+
/** What the module puts into the private `runtimeConfig.requiply`. */
|
|
152
|
+
export interface RequiplyPrivateRuntimeConfig {
|
|
153
|
+
secretKey: string;
|
|
154
|
+
}
|
|
155
|
+
/** A product as the booking portal's catalog describes it. */
|
|
156
|
+
export interface RequiplyProduct {
|
|
157
|
+
id: string;
|
|
158
|
+
name: string;
|
|
159
|
+
sku: string;
|
|
160
|
+
/** The name the product goes by on websites. */
|
|
161
|
+
slug: string | null;
|
|
162
|
+
/** `rental` for equipment booked for a period, `sale` for products the customer buys. */
|
|
163
|
+
kind: 'rental' | 'sale';
|
|
164
|
+
/** Base price per `priceType` unit (flat for products for sale). */
|
|
165
|
+
price: number;
|
|
166
|
+
priceType: 'day' | 'hour' | 'month' | 'quote';
|
|
167
|
+
depositAmount: number | null;
|
|
168
|
+
description: string | null;
|
|
169
|
+
categoryId: string | null;
|
|
170
|
+
categoryName: string | null;
|
|
171
|
+
imageUrl: string | null;
|
|
172
|
+
images: string[];
|
|
173
|
+
/** Units the business can supply. */
|
|
174
|
+
totalQuantity: number;
|
|
175
|
+
/** Units free for the chosen dates; null before dates are chosen. */
|
|
176
|
+
availableQuantity: number | null;
|
|
177
|
+
/** A partner product with no cap: any quantity can be booked; do not show the counts. */
|
|
178
|
+
unlimited?: boolean;
|
|
179
|
+
/** Discounts by rental length: from `fromUnit` units on, `amount` percent of the base price (90 is 10% off). */
|
|
180
|
+
pricingTiers: Array<{
|
|
181
|
+
fromUnit: number;
|
|
182
|
+
toUnit: number | null;
|
|
183
|
+
amount: number;
|
|
184
|
+
}>;
|
|
185
|
+
/** Filterable product properties. */
|
|
186
|
+
properties: Array<{
|
|
187
|
+
key: string;
|
|
188
|
+
name: string;
|
|
189
|
+
type: string;
|
|
190
|
+
value: string | number | boolean | string[];
|
|
191
|
+
}>;
|
|
192
|
+
}
|
|
193
|
+
/** A rental product in the cart. */
|
|
194
|
+
export interface RequiplyCartLine {
|
|
195
|
+
/** The product (item group) id. */
|
|
196
|
+
groupId: string;
|
|
197
|
+
quantity: number;
|
|
198
|
+
}
|
|
199
|
+
/** A kit in the cart with the parts chosen for its choice groups. */
|
|
200
|
+
export interface RequiplyCartBundle {
|
|
201
|
+
bundleId: string;
|
|
202
|
+
quantity: number;
|
|
203
|
+
choices?: string[];
|
|
204
|
+
}
|
|
205
|
+
/** The visitor's cart as the booking widgets hold it. */
|
|
206
|
+
export interface RequiplyCart {
|
|
207
|
+
items: RequiplyCartLine[];
|
|
208
|
+
bundles: RequiplyCartBundle[];
|
|
209
|
+
/** Products for sale, which need no dates. */
|
|
210
|
+
saleLines: Array<{
|
|
211
|
+
saleItemId: string;
|
|
212
|
+
quantity: number;
|
|
213
|
+
}>;
|
|
214
|
+
/** Add-on services the visitor selected. */
|
|
215
|
+
serviceIds: string[];
|
|
216
|
+
/** Rental start, ISO date-time in the organization's time zone, or null before dates are chosen. */
|
|
217
|
+
startDate: string | null;
|
|
218
|
+
endDate: string | null;
|
|
219
|
+
/** Number of units in the cart. */
|
|
220
|
+
count: number;
|
|
221
|
+
}
|
|
File without changes
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NuxtModule } from '@nuxt/schema'
|
|
2
|
+
|
|
3
|
+
import type { default as Module } from './module.mjs'
|
|
4
|
+
|
|
5
|
+
export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
|
|
6
|
+
|
|
7
|
+
export { default } from './module.mjs'
|
|
8
|
+
|
|
9
|
+
export * from '../dist/runtime/types.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,80 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@requiply/nuxt",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Requiply for Nuxt: rental booking components, a cart that checks out in the Requiply booking portal, and the Requiply API on the client and the server",
|
|
5
|
+
"author": "Andrian Zafiiovskiy <andrian.zafiiovskiy@gmail.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://requiply.com",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Requiply/RequiplyNPM.git",
|
|
11
|
+
"directory": "packages/nuxt"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/Requiply/RequiplyNPM/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"nuxt",
|
|
18
|
+
"nuxt-module",
|
|
19
|
+
"requiply",
|
|
20
|
+
"rental",
|
|
21
|
+
"equipment rental",
|
|
22
|
+
"rental booking",
|
|
23
|
+
"booking widget",
|
|
24
|
+
"rental website",
|
|
25
|
+
"inventory"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/types.d.mts",
|
|
32
|
+
"import": "./dist/module.mjs"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"main": "./dist/module.mjs",
|
|
36
|
+
"typesVersions": {
|
|
37
|
+
"*": {
|
|
38
|
+
".": [
|
|
39
|
+
"./dist/types.d.mts"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist",
|
|
45
|
+
"README.md",
|
|
46
|
+
"CHANGELOG.md",
|
|
47
|
+
"LICENSE"
|
|
48
|
+
],
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"prepack": "nuxt-module-build build",
|
|
54
|
+
"dev": "npm run dev:prepare && nuxt dev playground --port 3008",
|
|
55
|
+
"dev:build": "nuxt build playground",
|
|
56
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground",
|
|
57
|
+
"lint": "eslint .",
|
|
58
|
+
"test": "vitest run",
|
|
59
|
+
"test:watch": "vitest watch",
|
|
60
|
+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"@nuxt/kit": "^4.7.0",
|
|
64
|
+
"@requiply/api-sdk": "^0.4.0",
|
|
65
|
+
"defu": "^6.1.4"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@nuxt/eslint-config": "^1.17.0",
|
|
69
|
+
"@nuxt/module-builder": "^1.0.4",
|
|
70
|
+
"@nuxt/schema": "^4.7.0",
|
|
71
|
+
"@nuxt/test-utils": "^4.4.0",
|
|
72
|
+
"@types/node": "^24.0.0",
|
|
73
|
+
"eslint": "^10.12.0",
|
|
74
|
+
"nuxt": "^4.7.0",
|
|
75
|
+
"typescript": "^5.9.3",
|
|
76
|
+
"vite": "^8.4.0",
|
|
77
|
+
"vitest": "^5.1.2",
|
|
78
|
+
"vue-tsc": "^3.3.12"
|
|
79
|
+
}
|
|
80
|
+
}
|