5 Commits

18 changed files with 331 additions and 56 deletions

View File

@@ -33,6 +33,7 @@
}, },
"require": { "require": {
"axepress/wp-graphql-rank-math": "*", "axepress/wp-graphql-rank-math": "*",
"lewebsimple/acf-phone": "*",
"lewebsimple/advanced-custom-fields-pro": "*", "lewebsimple/advanced-custom-fields-pro": "*",
"lewebsimple/kaliroots": "*", "lewebsimple/kaliroots": "*",
"lewebsimple/wp-graphql-headless-login": "*", "lewebsimple/wp-graphql-headless-login": "*",

39
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "f563233465b6f95dac3c6b33962f6aed", "content-hash": "e3ce417e8c09ed84502559af141f6530",
"packages": [ "packages": [
{ {
"name": "axepress/wp-graphql-plugin-boilerplate", "name": "axepress/wp-graphql-plugin-boilerplate",
@@ -313,6 +313,43 @@
], ],
"time": "2024-06-24T20:46:46+00:00" "time": "2024-06-24T20:46:46+00:00"
}, },
{
"name": "lewebsimple/acf-phone",
"version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/lewebsimple/acf-phone.git",
"reference": "cf4c6440e0c2cdf7e422423bb629014204e721bf"
},
"dist": {
"type": "zip",
"url": "https://satis.ledevsimple.ca/dist/lewebsimple/acf-phone/lewebsimple-acf-phone-cf4c6440e0c2cdf7e422423bb629014204e721bf-zip-439080.zip",
"reference": "cf4c6440e0c2cdf7e422423bb629014204e721bf",
"shasum": "f9d7cbcf27985656245285e5bc035578621f1a69"
},
"require-dev": {
"lewebsimple/wp-phpcs-ruleset": "*",
"php-stubs/acf-pro-stubs": "*",
"squizlabs/php_codesniffer": "*"
},
"type": "wordpress-plugin",
"scripts": {
"post-create-project-cmd": [
"./scripts/post-create.sh"
],
"lint": [
"vendor/bin/phpcs"
],
"lintfix": [
"vendor/bin/phpcbf"
]
},
"support": {
"source": "https://github.com/lewebsimple/acf-phone/tree/v3.1.0",
"issues": "https://github.com/lewebsimple/acf-phone/issues"
},
"time": "2026-01-30T15:01:34+00:00"
},
{ {
"name": "lewebsimple/advanced-custom-fields-pro", "name": "lewebsimple/advanced-custom-fields-pro",
"version": "v6.7.0.2", "version": "v6.7.0.2",

View File

@@ -1,5 +1,19 @@
# Changelog # Changelog
## v0.1.10
[compare changes](https://gitea.websimple.com/templates/wp-headless/compare/v0.1.9...v0.1.10)
### 🚀 Enhancements
- GroupSiteOptions.phoneNumber (ad3c53c)
- AcfPhone component (6b17201)
- AcfLink / AcfLinkButton components (115a5d2)
### 💅 Refactors
- OptionsSite => SiteOptions for clearer naming (fefa980)
## v0.1.9 ## v0.1.9
[compare changes](https://gitea.websimple.com/templates/wp-headless/compare/v0.1.8...v0.1.9) [compare changes](https://gitea.websimple.com/templates/wp-headless/compare/v0.1.8...v0.1.9)

View File

@@ -25,6 +25,76 @@
"graphql_description": "", "graphql_description": "",
"graphql_field_name": "email", "graphql_field_name": "email",
"graphql_non_null": 1 "graphql_non_null": 1
},
{
"key": "field_697cbf414fdd5",
"label": "Phone number",
"name": "phone_number",
"aria-label": "",
"type": "phone",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"initial_country": "CA",
"return_format": "national",
"allow_in_bindings": 0,
"show_in_graphql": 1,
"graphql_description": "",
"graphql_field_name": "phoneNumber",
"graphql_non_null": 1
},
{
"key": "field_697cc921234cc",
"label": "Liens globaux",
"name": "links",
"aria-label": "",
"type": "group",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"layout": "row",
"acfe_seamless_style": 0,
"acfe_group_modal": 0,
"show_in_graphql": 1,
"graphql_description": "",
"graphql_field_name": "links",
"graphql_non_null": 0,
"sub_fields": [
{
"key": "field_697cc93e234cd",
"label": "Contact",
"name": "contact",
"aria-label": "",
"type": "link",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"return_format": "array",
"allow_in_bindings": 0,
"show_in_graphql": 1,
"graphql_description": "",
"graphql_field_name": "contact",
"graphql_non_null": 1
}
],
"acfe_group_modal_close": 0,
"acfe_group_modal_button": "",
"acfe_group_modal_size": "large"
} }
], ],
"location": [ "location": [
@@ -51,10 +121,10 @@
], ],
"acfe_form": 0, "acfe_form": 0,
"show_in_graphql": 1, "show_in_graphql": 1,
"graphql_field_name": "GroupSite", "graphql_field_name": "GroupSiteOptions",
"map_graphql_types_from_location_rules": 0, "map_graphql_types_from_location_rules": 0,
"graphql_types": "", "graphql_types": "",
"acfe_meta": "", "acfe_meta": "",
"acfe_note": "", "acfe_note": "",
"modified": 1769087407 "modified": 1769785750
} }

View File

@@ -20,6 +20,6 @@
"post_id": "", "post_id": "",
"autoload": 0, "autoload": 0,
"show_in_graphql": 1, "show_in_graphql": 1,
"graphql_type_name": "OptionsSite", "graphql_type_name": "SiteOptions",
"modified": 1769086997 "modified": 1769693948
} }

View File

@@ -0,0 +1,5 @@
fragment AcfLink on AcfLink {
title
url
target
}

View File

@@ -0,0 +1,23 @@
<script setup lang="ts">
import type { AcfLinkFragment } from "#graphql/operations";
import type { LinkProps } from "@nuxt/ui";
type AcfLinkProps = Omit<LinkProps, "to" | "target" | "href"> & {
link?: AcfLinkFragment;
};
const { link, ...linkProps } = defineProps<AcfLinkProps>();
</script>
<template>
<ULink
v-if="link?.url && link?.title"
v-bind="linkProps"
:to="link.url"
:target="link.target"
:external="link.target === '_blank'"
:rel="link.target === '_blank' ? 'noopener noreferrer' : undefined"
>
<slot>{{ link.title }}</slot>
</ULink>
</template>

View File

@@ -0,0 +1,23 @@
<script setup lang="ts">
import type { AcfLinkFragment } from "#graphql/operations";
import type { ButtonProps } from "@nuxt/ui";
type AcfLinkButtonProps = & Omit<ButtonProps, "to" | "target" | "href"> & {
link?: AcfLinkFragment;
};
const { link, ...buttonProps } = defineProps<AcfLinkButtonProps>();
</script>
<template>
<UButton
v-if="link?.url && link?.title"
v-bind="buttonProps"
:to="link.url"
:target="link.target"
:external="link.target === '_blank'"
:rel="link.target === '_blank' ? 'noopener noreferrer' : undefined"
>
<slot>{{ link.title }}</slot>
</UButton>
</template>

View File

@@ -0,0 +1,5 @@
fragment AcfPhone on AcfPhone {
national
e164
extension
}

View File

@@ -0,0 +1,14 @@
<script setup lang="ts">
import type { AcfPhoneFragment } from "#graphql/operations";
defineProps<{
phone?: AcfPhoneFragment;
link?: boolean;
}>();
</script>
<template>
<Component :is="link ? 'a' : 'span'" v-if="phone" :href="link ? `tel:${phone.e164}` : undefined">
{{ phone.national }}{{ phone.extension ? ` ext. ${phone.extension}` : "" }}
</Component>
</template>

View File

@@ -1,10 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
const { data } = await useAsyncGraphQLQuery("GeneralSettings", undefined, { cache: { ttl: 0 } }); const { data: generalSettings } = await useGeneralSettings();
</script> </script>
<template> <template>
<div> <div>
© {{ new Date().getFullYear() }} © {{ new Date().getFullYear() }}
<span v-if="data.generalSettings?.title">{{ data.generalSettings.title }}</span> <span v-if="generalSettings?.title">{{ generalSettings.title }}</span>
</div> </div>
</template> </template>

View File

@@ -0,0 +1,3 @@
export const useGeneralSettings = () => useAsyncGraphQLQuery("GeneralSettings", {}, {
transform: ({ generalSettings }) => generalSettings,
});

View File

@@ -0,0 +1,3 @@
export const useSiteOptions = () => useAsyncGraphQLQuery("SiteOptions", {}, {
transform: ({ siteOptions }) => siteOptions?.groupSiteOptions,
});

View File

@@ -1,11 +0,0 @@
fragment SiteOptions on GroupSite_Fields {
email
}
query OptionsSite {
optionsSite {
groupSite {
... SiteOptions
}
}
}

View File

@@ -0,0 +1,15 @@
fragment SiteOptions on GroupSiteOptions {
email
phoneNumber { ... AcfPhone }
links {
contact { ... AcfLink}
}
}
query SiteOptions {
siteOptions {
groupSiteOptions {
... SiteOptions
}
}
}

View File

@@ -1,7 +1,7 @@
{ {
"name": "@lewebsimple/moonshine", "name": "@lewebsimple/moonshine",
"description": "Headless WordPress theme based on Nuxt.", "description": "Headless WordPress theme based on Nuxt.",
"version": "0.1.9", "version": "0.1.10",
"type": "module", "type": "module",
"private": true, "private": true,
"scripts": { "scripts": {

View File

@@ -7376,7 +7376,7 @@ snapshots:
'@whatwg-node/promise-helpers': 1.3.2 '@whatwg-node/promise-helpers': 1.3.2
cross-inspect: 1.0.1 cross-inspect: 1.0.1
graphql: 16.12.0 graphql: 16.12.0
tslib: 2.6.3 tslib: 2.8.1
'@graphql-tools/utils@11.0.0(graphql@16.12.0)': '@graphql-tools/utils@11.0.0(graphql@16.12.0)':
dependencies: dependencies:
@@ -11514,7 +11514,7 @@ snapshots:
lower-case@2.0.2: lower-case@2.0.2:
dependencies: dependencies:
tslib: 2.8.1 tslib: 2.6.3
lru-cache@10.4.3: {} lru-cache@10.4.3: {}
@@ -13461,7 +13461,7 @@ snapshots:
upper-case@2.0.2: upper-case@2.0.2:
dependencies: dependencies:
tslib: 2.8.1 tslib: 2.6.3
uqr@0.1.2: {} uqr@0.1.2: {}

View File

@@ -51,6 +51,18 @@ interface AcfFieldGroupFields {
fieldGroupName: String @deprecated(reason: "Use __typename instead") fieldGroupName: String @deprecated(reason: "Use __typename instead")
} }
"""ACF Link field"""
type AcfLink {
"""The target of the link (_blank, etc)"""
target: String
"""The title of the link"""
title: String
"""The url of the link"""
url: String
}
""" """
Connection between the GroupAbstractBuilderSectionsHeroSplitLayout_Fields type and the MediaItem type Connection between the GroupAbstractBuilderSectionsHeroSplitLayout_Fields type and the MediaItem type
""" """
@@ -79,6 +91,21 @@ interface AcfOptionsPage implements Node {
parentId: String parentId: String
} }
"""ACF Phone field"""
type AcfPhone {
"""The country code associated with the phone number"""
country: String!
"""The phone number in E.164 format"""
e164: String!
"""The phone number extension, if any"""
extension: String
"""The phone number in national format"""
national: String!
}
"""The Headless Login authentication data.""" """The Headless Login authentication data."""
type AuthenticationData { type AuthenticationData {
"""A new authentication token to use in future requests.""" """A new authentication token to use in future requests."""
@@ -3685,29 +3712,75 @@ interface GroupPostPage_Fields implements AcfFieldGroup & AcfFieldGroupFields &
} }
""" """
The &quot;GroupSite&quot; Field Group. Added to the Schema by &quot;WPGraphQL for ACF&quot;. The &quot;GroupSiteOptions&quot; Field Group. Added to the Schema by &quot;WPGraphQL for ACF&quot;.
""" """
type GroupSite implements AcfFieldGroup & AcfFieldGroupFields & GroupSite_Fields { type GroupSiteOptions implements AcfFieldGroup & AcfFieldGroupFields & GroupSiteOptions_Fields {
""" """
Field of the &quot;email&quot; Field Type added to the schema as part of the &quot;GroupSite&quot; Field Group Field of the &quot;email&quot; Field Type added to the schema as part of the &quot;GroupSiteOptions&quot; Field Group
""" """
email: String! email: String!
"""The name of the field group""" """The name of the field group"""
fieldGroupName: String @deprecated(reason: "Use __typename instead") fieldGroupName: String @deprecated(reason: "Use __typename instead")
"""
Field of the &quot;group&quot; Field Type added to the schema as part of the &quot;GroupSiteOptions&quot; Field Group
"""
links: GroupSiteOptionsLinks
"""
Field of the &quot;phone&quot; Field Type added to the schema as part of the &quot;GroupSiteOptions&quot; Field Group
"""
phoneNumber: AcfPhone!
}
"""
The &quot;GroupSiteOptionsLinks&quot; Field Group. Added to the Schema by &quot;WPGraphQL for ACF&quot;.
"""
type GroupSiteOptionsLinks implements AcfFieldGroup & AcfFieldGroupFields & GroupSiteOptionsLinks_Fields {
"""
Field of the &quot;link&quot; Field Type added to the schema as part of the &quot;GroupSiteOptionsLinks&quot; Field Group
"""
contact: AcfLink!
"""The name of the field group"""
fieldGroupName: String @deprecated(reason: "Use __typename instead")
} }
""" """
Interface representing fields of the ACF &quot;GroupSite&quot; Field Group Interface representing fields of the ACF &quot;GroupSiteOptionsLinks&quot; Field Group
""" """
interface GroupSite_Fields implements AcfFieldGroup & AcfFieldGroupFields { interface GroupSiteOptionsLinks_Fields implements AcfFieldGroup & AcfFieldGroupFields {
""" """
Field of the &quot;email&quot; Field Type added to the schema as part of the &quot;GroupSite&quot; Field Group Field of the &quot;link&quot; Field Type added to the schema as part of the &quot;GroupSiteOptionsLinks&quot; Field Group
"""
contact: AcfLink!
"""The name of the field group"""
fieldGroupName: String @deprecated(reason: "Use __typename instead")
}
"""
Interface representing fields of the ACF &quot;GroupSiteOptions&quot; Field Group
"""
interface GroupSiteOptions_Fields implements AcfFieldGroup & AcfFieldGroupFields {
"""
Field of the &quot;email&quot; Field Type added to the schema as part of the &quot;GroupSiteOptions&quot; Field Group
""" """
email: String! email: String!
"""The name of the field group""" """The name of the field group"""
fieldGroupName: String @deprecated(reason: "Use __typename instead") fieldGroupName: String @deprecated(reason: "Use __typename instead")
"""
Field of the &quot;group&quot; Field Type added to the schema as part of the &quot;GroupSiteOptions&quot; Field Group
"""
links: GroupSiteOptionsLinks
"""
Field of the &quot;phone&quot; Field Type added to the schema as part of the &quot;GroupSiteOptions&quot; Field Group
"""
phoneNumber: AcfPhone!
} }
""" """
@@ -6177,23 +6250,6 @@ interface OneToOneConnection implements Edge {
node: Node! node: Node!
} }
type OptionsSite implements AcfOptionsPage & Node & WithAcfGroupSite {
"""Fields of the GroupSite ACF Field Group"""
groupSite: GroupSite
"""The globally unique ID for the object"""
id: ID!
""""""
menuTitle: String
""""""
pageTitle: String
""""""
parentId: String
}
""" """
Sort direction for ordered results. Determines whether items are returned in ascending or descending order. Sort direction for ordered results. Determines whether items are returned in ascending or descending order.
""" """
@@ -8860,7 +8916,7 @@ interface Previewable {
} }
"""The root entry point into the Graph""" """The root entry point into the Graph"""
type Query implements WithAcfOptionsPageOptionsSite { type Query implements WithAcfOptionsPageSiteOptions {
"""Entry point to get all settings for the site""" """Entry point to get all settings for the site"""
allSettings: Settings allSettings: Settings
@@ -9145,9 +9201,6 @@ type Query implements WithAcfOptionsPageOptionsSite {
uri: String! uri: String!
): UniformResourceIdentifiable ): UniformResourceIdentifiable
""""""
optionsSite: OptionsSite
"""An object of the page Type. """ """An object of the page Type. """
page( page(
""" """
@@ -9372,6 +9425,9 @@ type Query implements WithAcfOptionsPageOptionsSite {
where: RootQueryToRevisionsConnectionWhereArgs where: RootQueryToRevisionsConnectionWhereArgs
): RootQueryToRevisionsConnection ): RootQueryToRevisionsConnection
""""""
siteOptions: SiteOptions
"""A 0bject""" """A 0bject"""
tag( tag(
"""The globally unique identifier of the object.""" """The globally unique identifier of the object."""
@@ -13608,6 +13664,23 @@ type Settings {
writingSettingsUseSmilies: Boolean writingSettingsUseSmilies: Boolean
} }
type SiteOptions implements AcfOptionsPage & Node & WithAcfGroupSiteOptions {
"""Fields of the GroupSiteOptions ACF Field Group"""
groupSiteOptions: GroupSiteOptions
"""The globally unique ID for the object"""
id: ID!
""""""
menuTitle: String
""""""
pageTitle: String
""""""
parentId: String
}
"""The Login client options for the siteToken provider.""" """The Login client options for the siteToken provider."""
type SiteTokenClientOptions implements LoginClientOptions { type SiteTokenClientOptions implements LoginClientOptions {
""" """
@@ -16559,17 +16632,17 @@ interface WithAcfGroupPostPage {
} }
""" """
Provides access to fields of the &quot;GroupSite&quot; ACF Field Group via the &quot;groupSite&quot; field Provides access to fields of the &quot;GroupSiteOptions&quot; ACF Field Group via the &quot;groupSiteOptions&quot; field
""" """
interface WithAcfGroupSite { interface WithAcfGroupSiteOptions {
"""Fields of the GroupSite ACF Field Group""" """Fields of the GroupSiteOptions ACF Field Group"""
groupSite: GroupSite groupSiteOptions: GroupSiteOptions
} }
"""Access point for the &quot;OptionsSite&quot; ACF Options Page""" """Access point for the &quot;SiteOptions&quot; ACF Options Page"""
interface WithAcfOptionsPageOptionsSite { interface WithAcfOptionsPageSiteOptions {
"""""" """"""
optionsSite: OptionsSite siteOptions: SiteOptions
} }
"""The writing setting type""" """The writing setting type"""