@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.
Files changed (49) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE +21 -0
  3. package/README.md +644 -2
  4. package/dist/module.d.mts +16 -0
  5. package/dist/module.json +12 -0
  6. package/dist/module.mjs +83 -0
  7. package/dist/runtime/app/components/RequiplyAccountLinks.d.ts +53 -0
  8. package/dist/runtime/app/components/RequiplyAccountLinks.js +13 -0
  9. package/dist/runtime/app/components/RequiplyBookButton.d.ts +37 -0
  10. package/dist/runtime/app/components/RequiplyBookButton.js +6 -0
  11. package/dist/runtime/app/components/RequiplyBundle.d.ts +21 -0
  12. package/dist/runtime/app/components/RequiplyBundle.js +4 -0
  13. package/dist/runtime/app/components/RequiplyCallButton.d.ts +35 -0
  14. package/dist/runtime/app/components/RequiplyCallButton.js +6 -0
  15. package/dist/runtime/app/components/RequiplyCartButton.d.ts +24 -0
  16. package/dist/runtime/app/components/RequiplyCartButton.js +4 -0
  17. package/dist/runtime/app/components/RequiplyDatePicker.d.ts +12 -0
  18. package/dist/runtime/app/components/RequiplyDatePicker.js +2 -0
  19. package/dist/runtime/app/components/RequiplyPortalButton.d.ts +34 -0
  20. package/dist/runtime/app/components/RequiplyPortalButton.js +6 -0
  21. package/dist/runtime/app/components/RequiplyPriceTiers.d.ts +21 -0
  22. package/dist/runtime/app/components/RequiplyPriceTiers.js +4 -0
  23. package/dist/runtime/app/components/RequiplyProduct.d.ts +37 -0
  24. package/dist/runtime/app/components/RequiplyProduct.js +26 -0
  25. package/dist/runtime/app/components/RequiplyProductCard.d.ts +21 -0
  26. package/dist/runtime/app/components/RequiplyProductCard.js +4 -0
  27. package/dist/runtime/app/components/RequiplyProductList.d.ts +70 -0
  28. package/dist/runtime/app/components/RequiplyProductList.js +19 -0
  29. package/dist/runtime/app/composables/useRequiply.d.ts +12 -0
  30. package/dist/runtime/app/composables/useRequiply.js +12 -0
  31. package/dist/runtime/app/composables/useRequiplyEmbed.d.ts +43 -0
  32. package/dist/runtime/app/composables/useRequiplyEmbed.js +54 -0
  33. package/dist/runtime/app/composables/useRequiplyProduct.d.ts +40 -0
  34. package/dist/runtime/app/composables/useRequiplyProduct.js +92 -0
  35. package/dist/runtime/app/embed.d.ts +79 -0
  36. package/dist/runtime/app/embed.js +75 -0
  37. package/dist/runtime/app/placeholder.d.ts +26 -0
  38. package/dist/runtime/app/placeholder.js +29 -0
  39. package/dist/runtime/app/plugins/requiply.d.ts +2 -0
  40. package/dist/runtime/app/plugins/requiply.js +46 -0
  41. package/dist/runtime/requiply.d.ts +2 -0
  42. package/dist/runtime/requiply.js +1 -0
  43. package/dist/runtime/server/tsconfig.json +3 -0
  44. package/dist/runtime/server/utils/requiply.d.ts +16 -0
  45. package/dist/runtime/server/utils/requiply.js +22 -0
  46. package/dist/runtime/types.d.ts +221 -0
  47. package/dist/runtime/types.js +0 -0
  48. package/dist/types.d.mts +9 -0
  49. package/package.json +78 -4
@@ -0,0 +1,83 @@
1
+ import { defineNuxtModule, useLogger, createResolver, addPlugin, addImports, addServerImports, addComponent } from '@nuxt/kit';
2
+ import { defu } from 'defu';
3
+
4
+ const DEFAULT_API_URL = "https://api.requiply.com";
5
+ const DEFAULT_PORTAL_URL = "https://portal.requiply.com";
6
+ const COMPONENTS = [
7
+ "RequiplyBookButton",
8
+ "RequiplyProductCard",
9
+ "RequiplyProductList",
10
+ "RequiplyPriceTiers",
11
+ "RequiplyBundle",
12
+ "RequiplyDatePicker",
13
+ "RequiplyCartButton",
14
+ "RequiplyPortalButton",
15
+ "RequiplyAccountLinks",
16
+ "RequiplyCallButton",
17
+ "RequiplyProduct"
18
+ ];
19
+ const module$1 = defineNuxtModule({
20
+ meta: {
21
+ name: "@requiply/nuxt",
22
+ configKey: "requiply",
23
+ compatibility: {
24
+ nuxt: ">=3.13.0"
25
+ }
26
+ },
27
+ defaults: {
28
+ org: "",
29
+ publishableKey: "",
30
+ secretKey: "",
31
+ apiUrl: DEFAULT_API_URL,
32
+ portalUrl: DEFAULT_PORTAL_URL,
33
+ embed: true,
34
+ components: true
35
+ },
36
+ setup(options, nuxt) {
37
+ const logger = useLogger("requiply");
38
+ const resolver = createResolver(import.meta.url);
39
+ if (options.publishableKey?.startsWith("rq_sk_")) {
40
+ throw new Error("[requiply] `publishableKey` holds a secret key (rq_sk_...). Secret keys must stay on the server: set it as `secretKey` or NUXT_REQUIPLY_SECRET_KEY.");
41
+ }
42
+ const embed = options.embed === false ? false : options.embed === true || options.embed === void 0 ? {} : options.embed;
43
+ const publicConfig = {
44
+ org: options.org ?? "",
45
+ publishableKey: options.publishableKey ?? "",
46
+ apiUrl: options.apiUrl || DEFAULT_API_URL,
47
+ portalUrl: options.portalUrl || DEFAULT_PORTAL_URL,
48
+ embed
49
+ };
50
+ const privateConfig = {
51
+ secretKey: options.secretKey ?? ""
52
+ };
53
+ nuxt.options.runtimeConfig.public.requiply = defu(
54
+ nuxt.options.runtimeConfig.public.requiply,
55
+ publicConfig
56
+ );
57
+ nuxt.options.runtimeConfig.requiply = defu(
58
+ nuxt.options.runtimeConfig.requiply,
59
+ privateConfig
60
+ );
61
+ if (!publicConfig.org && embed && !nuxt.options._prepare) {
62
+ logger.info("Set `requiply.org` (or NUXT_PUBLIC_REQUIPLY_ORG) to your booking page code to load the booking widgets.");
63
+ }
64
+ addPlugin(resolver.resolve("./runtime/app/plugins/requiply"));
65
+ addImports([
66
+ { name: "useRequiply", from: resolver.resolve("./runtime/app/composables/useRequiply") },
67
+ { name: "useRequiplyEmbed", from: resolver.resolve("./runtime/app/composables/useRequiplyEmbed") },
68
+ { name: "useRequiplyProduct", from: resolver.resolve("./runtime/app/composables/useRequiplyProduct") }
69
+ ]);
70
+ addServerImports([
71
+ { name: "useRequiplyServer", from: resolver.resolve("./runtime/server/utils/requiply") },
72
+ { name: "RequiplyError", from: "@requiply/api-sdk" }
73
+ ]);
74
+ if (options.components !== false) {
75
+ for (const name of COMPONENTS) {
76
+ addComponent({ name, filePath: resolver.resolve(`./runtime/app/components/${name}`) });
77
+ }
78
+ }
79
+ nuxt.options.alias["#requiply"] = resolver.resolve("./runtime/requiply");
80
+ }
81
+ });
82
+
83
+ export { module$1 as default };
@@ -0,0 +1,53 @@
1
+ /**
2
+ * "Sign in" and "Register" links to the customer's booking portal account; once signed in,
3
+ * their initials linking to the account.
4
+ *
5
+ * @example <RequiplyAccountLinks hide-register />
6
+ */
7
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
+ loginLabel: {
9
+ type: StringConstructor;
10
+ default: undefined;
11
+ };
12
+ registerLabel: {
13
+ type: StringConstructor;
14
+ default: undefined;
15
+ };
16
+ hideRegister: {
17
+ type: BooleanConstructor;
18
+ default: boolean;
19
+ };
20
+ /** Shows the customer's first name next to the initials. */
21
+ showName: {
22
+ type: BooleanConstructor;
23
+ default: boolean;
24
+ };
25
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
26
+ [key: string]: any;
27
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
28
+ loginLabel: {
29
+ type: StringConstructor;
30
+ default: undefined;
31
+ };
32
+ registerLabel: {
33
+ type: StringConstructor;
34
+ default: undefined;
35
+ };
36
+ hideRegister: {
37
+ type: BooleanConstructor;
38
+ default: boolean;
39
+ };
40
+ /** Shows the customer's first name next to the initials. */
41
+ showName: {
42
+ type: BooleanConstructor;
43
+ default: boolean;
44
+ };
45
+ }>> & Readonly<{}>, {
46
+ loginLabel: string;
47
+ registerLabel: string;
48
+ hideRegister: boolean;
49
+ showName: boolean;
50
+ }, import("vue").SlotsType<{
51
+ default?: (() => import("vue").VNode[]) | undefined;
52
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
53
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import { definePlaceholder } from "../placeholder.js";
2
+ export default definePlaceholder("RequiplyAccountLinks", "requiply-account-links", {
3
+ loginLabel: { type: String, default: void 0 },
4
+ registerLabel: { type: String, default: void 0 },
5
+ hideRegister: { type: Boolean, default: false },
6
+ /** Shows the customer's first name next to the initials. */
7
+ showName: { type: Boolean, default: false }
8
+ }, (props) => ({
9
+ loginLabel: props.loginLabel,
10
+ registerLabel: props.registerLabel,
11
+ hideRegister: props.hideRegister ? "true" : void 0,
12
+ showName: props.showName ? "true" : void 0
13
+ }), "span");
@@ -0,0 +1,37 @@
1
+ import type { PropType } from 'vue';
2
+ /**
3
+ * "Add to booking" for one product: price, quantity, availability for the chosen dates and
4
+ * the button. `item` is the product slug
5
+ * (`slug` in `useRequiply().inventory.list()` results, or the slug lookup in Requiply under
6
+ * Settings > Integrations > Website embed).
7
+ *
8
+ * @example <RequiplyBookButton item="festival-tent-6x12" />
9
+ */
10
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
11
+ item: {
12
+ type: StringConstructor;
13
+ required: true;
14
+ };
15
+ /** Call button next to it: `false`/`off`, `true`/`icon`, or `label`. Defaults to the module's `embed.callButton`. */
16
+ call: {
17
+ type: PropType<boolean | "off" | "icon" | "label">;
18
+ default: undefined;
19
+ };
20
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
21
+ [key: string]: any;
22
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
23
+ item: {
24
+ type: StringConstructor;
25
+ required: true;
26
+ };
27
+ /** Call button next to it: `false`/`off`, `true`/`icon`, or `label`. Defaults to the module's `embed.callButton`. */
28
+ call: {
29
+ type: PropType<boolean | "off" | "icon" | "label">;
30
+ default: undefined;
31
+ };
32
+ }>> & Readonly<{}>, {
33
+ call: boolean | "off" | "icon" | "label";
34
+ }, import("vue").SlotsType<{
35
+ default?: (() => import("vue").VNode[]) | undefined;
36
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
37
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { callAttr, definePlaceholder } from "../placeholder.js";
2
+ export default definePlaceholder("RequiplyBookButton", "requiply-button", {
3
+ item: { type: String, required: true },
4
+ /** Call button next to it: `false`/`off`, `true`/`icon`, or `label`. Defaults to the module's `embed.callButton`. */
5
+ call: { type: [Boolean, String], default: void 0 }
6
+ }, (props) => ({ item: props.item, call: callAttr(props.call) }));
@@ -0,0 +1,21 @@
1
+ /**
2
+ * A kit (bundle) card with its parts, price and "Add to booking". `bundle` is the bundle id.
3
+ *
4
+ * @example <RequiplyBundle bundle="6b1f..." />
5
+ */
6
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
7
+ bundle: {
8
+ type: StringConstructor;
9
+ required: true;
10
+ };
11
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
12
+ [key: string]: any;
13
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
14
+ bundle: {
15
+ type: StringConstructor;
16
+ required: true;
17
+ };
18
+ }>> & Readonly<{}>, {}, import("vue").SlotsType<{
19
+ default?: (() => import("vue").VNode[]) | undefined;
20
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
21
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { definePlaceholder } from "../placeholder.js";
2
+ export default definePlaceholder("RequiplyBundle", "requiply-bundle", {
3
+ bundle: { type: String, required: true }
4
+ }, (props) => ({ bundle: props.bundle }));
@@ -0,0 +1,35 @@
1
+ /**
2
+ * A call button that opens the call window with the phone numbers (`embed.phones`, else the
3
+ * organization's phone) and, optionally, working hours.
4
+ *
5
+ * @example <RequiplyCallButton icon-only />
6
+ */
7
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
+ label: {
9
+ type: StringConstructor;
10
+ default: undefined;
11
+ };
12
+ /** The phone icon alone. */
13
+ iconOnly: {
14
+ type: BooleanConstructor;
15
+ default: boolean;
16
+ };
17
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
18
+ [key: string]: any;
19
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
20
+ label: {
21
+ type: StringConstructor;
22
+ default: undefined;
23
+ };
24
+ /** The phone icon alone. */
25
+ iconOnly: {
26
+ type: BooleanConstructor;
27
+ default: boolean;
28
+ };
29
+ }>> & Readonly<{}>, {
30
+ label: string;
31
+ iconOnly: boolean;
32
+ }, import("vue").SlotsType<{
33
+ default?: (() => import("vue").VNode[]) | undefined;
34
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
35
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { definePlaceholder } from "../placeholder.js";
2
+ export default definePlaceholder("RequiplyCallButton", "requiply-call-button", {
3
+ label: { type: String, default: void 0 },
4
+ /** The phone icon alone. */
5
+ iconOnly: { type: Boolean, default: false }
6
+ }, (props) => ({ label: props.label, style: props.iconOnly ? "icon" : void 0 }), "span");
@@ -0,0 +1,24 @@
1
+ /**
2
+ * A cart button with the unit count that opens the cart drawer. Placing one hides the
3
+ * floating cart button.
4
+ *
5
+ * @example <RequiplyCartButton label="Booking" />
6
+ */
7
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
+ label: {
9
+ type: StringConstructor;
10
+ default: undefined;
11
+ };
12
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
13
+ [key: string]: any;
14
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ label: {
16
+ type: StringConstructor;
17
+ default: undefined;
18
+ };
19
+ }>> & Readonly<{}>, {
20
+ label: string;
21
+ }, import("vue").SlotsType<{
22
+ default?: (() => import("vue").VNode[]) | undefined;
23
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
24
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { definePlaceholder } from "../placeholder.js";
2
+ export default definePlaceholder("RequiplyCartButton", "requiply-cart-button", {
3
+ label: { type: String, default: void 0 }
4
+ }, (props) => ({ label: props.label }), "span");
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The rental period field: shows the chosen dates and opens the date picker, which follows
3
+ * the organization's working hours, buffers and availability.
4
+ *
5
+ * @example <RequiplyDatePicker />
6
+ */
7
+ declare const _default: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
8
+ [key: string]: any;
9
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, import("vue").SlotsType<{
10
+ default?: (() => import("vue").VNode[]) | undefined;
11
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
12
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { definePlaceholder } from "../placeholder.js";
2
+ export default definePlaceholder("RequiplyDatePicker", "requiply-datepicker", {}, () => ({}));
@@ -0,0 +1,34 @@
1
+ /**
2
+ * "Book online": takes the visitor to checkout with the cart, or to the booking page.
3
+ *
4
+ * @example <RequiplyPortalButton label="Book now" ghost />
5
+ */
6
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
7
+ label: {
8
+ type: StringConstructor;
9
+ default: undefined;
10
+ };
11
+ /** Outlined instead of filled. */
12
+ ghost: {
13
+ type: BooleanConstructor;
14
+ default: boolean;
15
+ };
16
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
17
+ [key: string]: any;
18
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ label: {
20
+ type: StringConstructor;
21
+ default: undefined;
22
+ };
23
+ /** Outlined instead of filled. */
24
+ ghost: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ }>> & Readonly<{}>, {
29
+ label: string;
30
+ ghost: boolean;
31
+ }, import("vue").SlotsType<{
32
+ default?: (() => import("vue").VNode[]) | undefined;
33
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
34
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { definePlaceholder } from "../placeholder.js";
2
+ export default definePlaceholder("RequiplyPortalButton", "requiply-portal-button", {
3
+ label: { type: String, default: void 0 },
4
+ /** Outlined instead of filled. */
5
+ ghost: { type: Boolean, default: false }
6
+ }, (props) => ({ label: props.label, style: props.ghost ? "ghost" : void 0 }), "span");
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The product's price per rental length (pricing tiers), as a small table.
3
+ *
4
+ * @example <RequiplyPriceTiers item="festival-tent-6x12" />
5
+ */
6
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
7
+ item: {
8
+ type: StringConstructor;
9
+ required: true;
10
+ };
11
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
12
+ [key: string]: any;
13
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
14
+ item: {
15
+ type: StringConstructor;
16
+ required: true;
17
+ };
18
+ }>> & Readonly<{}>, {}, import("vue").SlotsType<{
19
+ default?: (() => import("vue").VNode[]) | undefined;
20
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
21
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { definePlaceholder } from "../placeholder.js";
2
+ export default definePlaceholder("RequiplyPriceTiers", "requiply-tiers", {
3
+ item: { type: String, required: true }
4
+ }, (props) => ({ item: props.item }));
@@ -0,0 +1,37 @@
1
+ import { type SlotsType, type VNode } from 'vue';
2
+ import { type UseRequiplyProduct } from '../composables/useRequiplyProduct.js';
3
+ type Unwrapped = {
4
+ [K in keyof UseRequiplyProduct]: UseRequiplyProduct[K] extends {
5
+ value: infer V;
6
+ } ? V : UseRequiplyProduct[K];
7
+ };
8
+ /**
9
+ * Renders nothing of its own: it hands its slot the product and the cart actions, for a card
10
+ * or product page in your own markup. Server-rendered from the public catalog; availability
11
+ * for the chosen dates, the formatted price and the cart quantity arrive once the widgets load.
12
+ *
13
+ * @example
14
+ * <RequiplyProduct item="festival-tent" v-slot="{ product, price, available, inCart, add }">
15
+ * <h3>{{ product?.name }}</h3>
16
+ * <p>{{ price ?? product?.price }}</p>
17
+ * <button :disabled="available === 0" @click="add()">Rent ({{ inCart }})</button>
18
+ * </RequiplyProduct>
19
+ */
20
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
21
+ /** The product slug or id. */
22
+ item: {
23
+ type: StringConstructor;
24
+ required: true;
25
+ };
26
+ }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
27
+ [key: string]: any;
28
+ }>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
29
+ /** The product slug or id. */
30
+ item: {
31
+ type: StringConstructor;
32
+ required: true;
33
+ };
34
+ }>> & Readonly<{}>, {}, SlotsType<{
35
+ default: (state: Unwrapped) => VNode[];
36
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
37
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import { defineComponent } from "vue";
2
+ import { useRequiplyProduct } from "../composables/useRequiplyProduct.js";
3
+ export default defineComponent({
4
+ name: "RequiplyProduct",
5
+ props: {
6
+ /** The product slug or id. */
7
+ item: { type: String, required: true }
8
+ },
9
+ slots: Object,
10
+ setup(props, { slots }) {
11
+ const state = useRequiplyProduct(() => props.item);
12
+ return () => slots.default?.({
13
+ product: state.product.value,
14
+ pending: state.pending.value,
15
+ ready: state.ready.value,
16
+ price: state.price.value,
17
+ hasDates: state.hasDates.value,
18
+ available: state.available.value,
19
+ soldOut: state.soldOut.value,
20
+ inCart: state.inCart.value,
21
+ add: state.add,
22
+ setQuantity: state.setQuantity,
23
+ remove: state.remove
24
+ });
25
+ }
26
+ });
@@ -0,0 +1,21 @@
1
+ /**
2
+ * A product card: photo, name, price and "Add to booking". `item` is the product slug.
3
+ *
4
+ * @example <RequiplyProductCard item="festival-tent-6x12" />
5
+ */
6
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
7
+ item: {
8
+ type: StringConstructor;
9
+ required: true;
10
+ };
11
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
12
+ [key: string]: any;
13
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
14
+ item: {
15
+ type: StringConstructor;
16
+ required: true;
17
+ };
18
+ }>> & Readonly<{}>, {}, import("vue").SlotsType<{
19
+ default?: (() => import("vue").VNode[]) | undefined;
20
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
21
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { definePlaceholder } from "../placeholder.js";
2
+ export default definePlaceholder("RequiplyProductCard", "requiply-card", {
3
+ item: { type: String, required: true }
4
+ }, (props) => ({ item: props.item }));
@@ -0,0 +1,70 @@
1
+ import type { PropType } from 'vue';
2
+ /**
3
+ * A grid of product cards, optionally one category, with an optional search field.
4
+ *
5
+ * @example <RequiplyProductList category="7c0e2c4e-..." :limit="12" show-search />
6
+ */
7
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
+ /** Category id (`categories.list()`); its subcategories are included. */
9
+ category: {
10
+ type: StringConstructor;
11
+ default: undefined;
12
+ };
13
+ /** Most products to show; all when unset. */
14
+ limit: {
15
+ type: NumberConstructor;
16
+ default: undefined;
17
+ };
18
+ /** Initial search text. */
19
+ search: {
20
+ type: StringConstructor;
21
+ default: undefined;
22
+ };
23
+ /** Shows a search field above the grid. */
24
+ showSearch: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ /** Rentals (default), products for sale, or both. */
29
+ kind: {
30
+ type: PropType<"rental" | "sale" | "all">;
31
+ default: undefined;
32
+ };
33
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
34
+ [key: string]: any;
35
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
36
+ /** Category id (`categories.list()`); its subcategories are included. */
37
+ category: {
38
+ type: StringConstructor;
39
+ default: undefined;
40
+ };
41
+ /** Most products to show; all when unset. */
42
+ limit: {
43
+ type: NumberConstructor;
44
+ default: undefined;
45
+ };
46
+ /** Initial search text. */
47
+ search: {
48
+ type: StringConstructor;
49
+ default: undefined;
50
+ };
51
+ /** Shows a search field above the grid. */
52
+ showSearch: {
53
+ type: BooleanConstructor;
54
+ default: boolean;
55
+ };
56
+ /** Rentals (default), products for sale, or both. */
57
+ kind: {
58
+ type: PropType<"rental" | "sale" | "all">;
59
+ default: undefined;
60
+ };
61
+ }>> & Readonly<{}>, {
62
+ search: string;
63
+ kind: "all" | "rental" | "sale";
64
+ category: string;
65
+ limit: number;
66
+ showSearch: boolean;
67
+ }, import("vue").SlotsType<{
68
+ default?: (() => import("vue").VNode[]) | undefined;
69
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
70
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import { definePlaceholder } from "../placeholder.js";
2
+ export default definePlaceholder("RequiplyProductList", "requiply-list", {
3
+ /** Category id (`categories.list()`); its subcategories are included. */
4
+ category: { type: String, default: void 0 },
5
+ /** Most products to show; all when unset. */
6
+ limit: { type: Number, default: void 0 },
7
+ /** Initial search text. */
8
+ search: { type: String, default: void 0 },
9
+ /** Shows a search field above the grid. */
10
+ showSearch: { type: Boolean, default: false },
11
+ /** Rentals (default), products for sale, or both. */
12
+ kind: { type: String, default: void 0 }
13
+ }, (props) => ({
14
+ category: props.category,
15
+ limit: props.limit,
16
+ search: props.search,
17
+ showSearch: props.showSearch ? "true" : void 0,
18
+ kind: props.kind
19
+ }));
@@ -0,0 +1,12 @@
1
+ import { RequiplyClient } from '@requiply/api-sdk';
2
+ /**
3
+ * The Requiply API client with the publishable key, for pages and components. It works in
4
+ * the browser and during server rendering, and reaches what a publishable key may read:
5
+ * the organization, catalog, availability, prices and booking requests. Use
6
+ * `useRequiplyServer()` in server routes for everything else.
7
+ *
8
+ * @example
9
+ * const requiply = useRequiply()
10
+ * const { data } = await useAsyncData('tents', () => requiply.inventory.list({ search: 'tent' }))
11
+ */
12
+ export declare function useRequiply(): RequiplyClient;
@@ -0,0 +1,12 @@
1
+ import { RequiplyClient } from "@requiply/api-sdk";
2
+ import { useNuxtApp, useRuntimeConfig } from "#app";
3
+ export function useRequiply() {
4
+ const nuxtApp = useNuxtApp();
5
+ if (nuxtApp._requiplyClient) return nuxtApp._requiplyClient;
6
+ const config = useRuntimeConfig().public.requiply;
7
+ if (!config.publishableKey) {
8
+ throw new Error("[requiply] useRequiply() needs a publishable key: set `requiply.publishableKey` in nuxt.config or NUXT_PUBLIC_REQUIPLY_PUBLISHABLE_KEY. Create one in Requiply under Settings > API keys.");
9
+ }
10
+ nuxtApp._requiplyClient = new RequiplyClient({ apiKey: config.publishableKey, baseUrl: config.apiUrl });
11
+ return nuxtApp._requiplyClient;
12
+ }
@@ -0,0 +1,43 @@
1
+ import { type ComputedRef, type Ref } from 'vue';
2
+ import type { RequiplyCart } from '../../types.js';
3
+ import { type EmbedRuntime } from '../embed.js';
4
+ export interface UseRequiplyEmbed {
5
+ /** True once the booking widgets have loaded the organization and restored the cart. */
6
+ ready: Readonly<Ref<boolean>>;
7
+ /** The visitor's cart, kept in sync with the widgets. Empty on the server. */
8
+ cart: Readonly<Ref<RequiplyCart>>;
9
+ /** Number of units in the cart, for a badge on your own cart button. */
10
+ count: ComputedRef<number>;
11
+ /**
12
+ * Adds a product by its slug or id, the same way "Add to booking" does: it asks for dates
13
+ * first when the organization starts bookings from dates, and opens the cart afterwards.
14
+ * @returns False when the widgets have not loaded or the product is unknown or hidden.
15
+ */
16
+ addToCart(item: string, quantity?: number): Promise<boolean>;
17
+ /** Sets a product's quantity by its id; 0 removes it. */
18
+ setQuantity(groupId: string, quantity: number): void;
19
+ /** Removes a product by its id. */
20
+ remove(groupId: string): void;
21
+ /** Empties the cart. */
22
+ clear(): void;
23
+ /** Sets the rental period (ISO date-times in the organization's time zone), or clears it with nulls. */
24
+ setDates(startDate: string | null, endDate: string | null): void;
25
+ /** Opens the cart drawer. */
26
+ openCart(): void;
27
+ /** Opens the rental period picker. */
28
+ openDatePicker(): void;
29
+ /** Opens the call window with the organization's phone numbers. */
30
+ openCall(): void;
31
+ /** Takes the visitor to checkout in the booking portal with the cart, or to the booking page when it is empty. */
32
+ checkout(): Promise<void>;
33
+ /** Resolves with the widget runtime once it has loaded, for anything this composable does not cover. */
34
+ whenReady(): Promise<EmbedRuntime>;
35
+ /** Mounts widgets placed by hand, e.g. through `v-html`; the components do this on their own. */
36
+ rescan(): void;
37
+ }
38
+ /**
39
+ * Drives the booking widgets from your own UI: a cart badge in the site header, "Book" on
40
+ * a custom product card, a dates field in a hero section. Needs `requiply.org` and the
41
+ * widgets on (the default). Actions do nothing on the server and before the widgets load.
42
+ */
43
+ export declare function useRequiplyEmbed(): UseRequiplyEmbed;