Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sjcallender authored Feb 28, 2025
2 parents a764e88 + ba80203 commit 372dac9
Show file tree
Hide file tree
Showing 16 changed files with 327 additions and 289 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
push:
branches:
- develop
- main
pull_request:

jobs:
Expand Down
6 changes: 3 additions & 3 deletions src/templates/_components/app/address-fields.twig
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@

<div v-if="regions[countryCode] && !Array.isArray(regions[countryCode])">
<label for="{{ 'administrativeArea'|namespaceInputId(context) }}"
class="block mb-2 font-medium text-gray-500">
class="block mb-2 font-medium text-gray-500">
{{ 'State / Province'|t('foster-checkout') }}*
</label>
<select
Expand All @@ -142,7 +142,7 @@
>
<option value="" disabled>{{ 'Select'|t('foster-checkout') }}</option>
<option v-cloak v-for="(region, key) in regions[countryCode]" :value="key"
:selected="key === administrativeArea">
:selected="key === administrativeArea">
${region}
</option>
</select>
Expand Down Expand Up @@ -188,7 +188,7 @@
{% if customField.multiline %}

<label for="{{ ('custom-field-' ~ customField.handle)|namespaceInputId(context) }}"
class="block text-sm font-medium text-gray-700">
class="block text-sm font-medium text-gray-700">
{{ customField.name }}{% if customField.required %}*{% endif %}
</label>

Expand Down
23 changes: 14 additions & 9 deletions src/templates/_components/app/coupon-code.twig
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{% set couponCodeError = cart.getFirstNotice(null, 'couponCode') ?? null %}
{% set couponCodeError = cart.getFirstNotice(null, 'couponCode') ?? null %}
{% set couponCodeSuccess = craft.app.session.getFlash('success') ?? null %}

{% if couponCodeError %}
{% set couponMessage = couponCodeError.message %}
{% else %}
{% if couponCodeSuccess
and couponCodeSuccess == 'Coupon code added' | t('Foster Checkout')
and cart.couponCode
%}
and cart.couponCode %}
{% set couponMessage = couponCodeSuccess %}
{% else %}
{% set couponMessage = null %}
Expand All @@ -24,11 +23,11 @@
{{ 'Coupon code'|t('foster-checkout') }}{% if cart.couponCode|default %} ({{ cart.couponCode }}){% endif %}
</span>
<svg v-cloak xmlns="http://www.w3.org/2000/svg" width="14" height="9" viewBox="0 0 14 9" class="fill-current"
aria-hidden="true">
aria-hidden="true">
<path v-if="isOpen"
d="M6.99972 0.301388L13.3389 6.64054L11.9247 8.05469L6.99972 3.10469L2.07472 8.02969L0.660568 6.61554L6.99972 0.301388Z"/>
d="M6.99972 0.301388L13.3389 6.64054L11.9247 8.05469L6.99972 3.10469L2.07472 8.02969L0.660568 6.61554L6.99972 0.301388Z"/>
<path v-else
d="M7.00028 8.70057L0.661133 2.36142L2.07528 0.947266L7.00028 5.89727L11.9253 0.972268L13.3394 2.38642L7.00028 8.70057Z"/>
d="M7.00028 8.70057L0.661133 2.36142L2.07528 0.947266L7.00028 5.89727L11.9253 0.972268L13.3394 2.38642L7.00028 8.70057Z"/>
</svg>
</button>

Expand Down Expand Up @@ -74,9 +73,15 @@
class="h-[48px] flex justify-center items-center gap-2 px-4 text-white bg-[var(--brandColor)] rounded-xl"
:disabled="sending"
>
<svg v-show="sending" aria-hidden="true" role="status" class="inline-block w-4 h-4 me-3 text-gray-200 animate-spin dark:text-gray-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="#ffffff"/>
<svg v-show="sending" aria-hidden="true" role="status"
class="inline-block w-4 h-4 me-3 text-gray-200 animate-spin dark:text-gray-600" viewBox="0 0 100 101"
fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="currentColor"/>
<path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="#ffffff"/>
</svg>
<span class="inline-block">{{ 'Submit'|t('foster-checkout') }}</span>
</button>
Expand Down
113 changes: 57 additions & 56 deletions src/templates/_components/app/estimated-shipping.twig
Original file line number Diff line number Diff line change
@@ -1,70 +1,71 @@
{% if cart.shippingMethod != null and cart.shippingMethod.handle != 'freeShipping' %}
{% set postalCode = cart.estimatedShippingAddress.postalCode|default('') %}
{% set postalCode = cart.estimatedShippingAddress.postalCode|default('') %}

<div v-scope="FocusModal({ isOpen: false })" class="relative" @vue:mounted="mounted">
<div v-scope="FocusModal({ isOpen: false })" class="relative" @vue:mounted="mounted">

<div class="flex justify-between items-center gap-4">
<dt class="text-gray-500">
{% if postalCode %}{{ 'Estimated shipping to'|t('foster-checkout') }}{% endif %}
<button id="estimatedShippingLabel" class="text-[var(--brandColor)] underline" @click="toggleModal">
{{ postalCode ? postalCode : 'Get estimated shipping'|t('foster-checkout') }}
</button>
</dt>
<dd class="text-right text-black">{{ cart.totalShippingCostAsCurrency }}</dd>
</div>
<div class="flex justify-between items-center gap-4">
<dt class="text-gray-500">
{% if postalCode %}{{ 'Estimated shipping to'|t('foster-checkout') }}{% endif %}
<button id="estimatedShippingLabel" class="text-[var(--brandColor)] underline" @click="toggleModal">
{{ postalCode ? postalCode : 'Get estimated shipping'|t('foster-checkout') }}
</button>
</dt>
<dd class="text-right text-black">{{ cart.totalShippingCostAsCurrency }}</dd>
</div>

<div
v-cloak
v-show="isOpen"
role="dialog"
ref="modal"
:aria-hidden="!isOpen"
aria-labelledby="estimatedShippingLabel"
aria-describedby="estimatedShippingDesc"
class="absolute top-10 z-20 inset-x-0 p-4 bg-gray-100 rounded-xl shadow-[0_5px_40px_0_rgba(0,0,0,0.2)]"
>
<div
v-cloak
v-show="isOpen"
role="dialog"
ref="modal"
:aria-hidden="!isOpen"
aria-labelledby="estimatedShippingLabel"
aria-describedby="estimatedShippingDesc"
class="absolute top-10 z-20 inset-x-0 p-4 bg-gray-100 rounded-xl shadow-[0_5px_40px_0_rgba(0,0,0,0.2)]"
>

<header class="flex justify-between items-center gap-4 -mt-[8px]">
<h4 class="font-semibold text-black">{{ 'Delivery Postal Code'|t('foster-checkout') }}</h4>
<button class="w-[48px] h-[48px] -mt-[6px] -mr-[17px] flex justify-center items-center"
@click="toggleModal">
<span class="sr-only">{{ 'Close'|t('foster-checkout') }}</span>
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" class="fill-current">
<path d="M1.4 14L0 12.6L5.6 7L0 1.4L1.4 0L7 5.6L12.6 0L14 1.4L8.4 7L14 12.6L12.6 14L7 8.4L1.4 14Z"/>
</svg>
</button>
</header>
<header class="flex justify-between items-center gap-4 -mt-[8px]">
<h4 class="font-semibold text-black">{{ 'Delivery Postal Code'|t('foster-checkout') }}</h4>
<button class="w-[48px] h-[48px] -mt-[6px] -mr-[17px] flex justify-center items-center"
@click="toggleModal">
<span class="sr-only">{{ 'Close'|t('foster-checkout') }}</span>
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" class="fill-current">
<path d="M1.4 14L0 12.6L5.6 7L0 1.4L1.4 0L7 5.6L12.6 0L14 1.4L8.4 7L14 12.6L12.6 14L7 8.4L1.4 14Z"/>
</svg>
</button>
</header>

<div class="mt-4">
<div class="mt-4">

<form class="grid grid-cols-[1fr,_90px] gap-4">
{% include 'foster-checkout/_components/base/input-text-clearable' with {
label: 'Postal Code'|t('foster-checkout'),
hideLabel: true,
id: 'postalCode',
name: 'postalCode',
type: 'text',
autocomplete: 'postal-code',
placeholder: 'postalCodeFormat'|t('foster-checkout'),
value: postalCode,
action: 'if (isOpen) $el.focus()'
} %}
<button type="submit"
class="text-white bg-[var(--brandColor)] rounded-xl">{{ 'Update'|t('foster-checkout') }}</button>
</form>
<form class="grid grid-cols-[1fr,_90px] gap-4">
{% include 'foster-checkout/_components/base/input-text-clearable' with {
label: 'Postal Code'|t('foster-checkout'),
hideLabel: true,
id: 'postalCode',
name: 'postalCode',
type: 'text',
autocomplete: 'postal-code',
placeholder: 'postalCodeFormat'|t('foster-checkout'),
value: postalCode,
action: 'if (isOpen) $el.focus()'
} %}
<button type="submit"
class="text-white bg-[var(--brandColor)] rounded-xl">{{ 'Update'|t('foster-checkout') }}</button>
</form>

<div class="flex justify-start items-start gap-4 mt-4 pt-4 text-gray-500 border-t border-gray-300">
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="16" viewBox="0 0 22 16"
class="mt-1 fill-current flex-shrink-0" aria-hidden="true">
<path
d="M5 16C4.16667 16 3.45833 15.7083 2.875 15.125C2.29167 14.5417 2 13.8333 2 13H0V2C0 1.45 0.195833 0.979167 0.5875 0.5875C0.979167 0.195833 1.45 0 2 0H16V4H19L22 8V13H20C20 13.8333 19.7083 14.5417 19.125 15.125C18.5417 15.7083 17.8333 16 17 16C16.1667 16 15.4583 15.7083 14.875 15.125C14.2917 14.5417 14 13.8333 14 13H8C8 13.8333 7.70833 14.5417 7.125 15.125C6.54167 15.7083 5.83333 16 5 16ZM5 14C5.28333 14 5.52083 13.9042 5.7125 13.7125C5.90417 13.5208 6 13.2833 6 13C6 12.7167 5.90417 12.4792 5.7125 12.2875C5.52083 12.0958 5.28333 12 5 12C4.71667 12 4.47917 12.0958 4.2875 12.2875C4.09583 12.4792 4 12.7167 4 13C4 13.2833 4.09583 13.5208 4.2875 13.7125C4.47917 13.9042 4.71667 14 5 14ZM17 14C17.2833 14 17.5208 13.9042 17.7125 13.7125C17.9042 13.5208 18 13.2833 18 13C18 12.7167 17.9042 12.4792 17.7125 12.2875C17.5208 12.0958 17.2833 12 17 12C16.7167 12 16.4792 12.0958 16.2875 12.2875C16.0958 12.4792 16 12.7167 16 13C16 13.2833 16.0958 13.5208 16.2875 13.7125C16.4792 13.9042 16.7167 14 17 14ZM16 9H20.25L18 6H16V9Z"/>
</svg>
<p
id="estimatedShippingDesc">{{ 'Your postal code helps us provide the most accurate delivery information.'|t('foster-checkout') }}</p>
</div>

<div class="flex justify-start items-start gap-4 mt-4 pt-4 text-gray-500 border-t border-gray-300">
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="16" viewBox="0 0 22 16"
class="mt-1 fill-current flex-shrink-0" aria-hidden="true">
<path
d="M5 16C4.16667 16 3.45833 15.7083 2.875 15.125C2.29167 14.5417 2 13.8333 2 13H0V2C0 1.45 0.195833 0.979167 0.5875 0.5875C0.979167 0.195833 1.45 0 2 0H16V4H19L22 8V13H20C20 13.8333 19.7083 14.5417 19.125 15.125C18.5417 15.7083 17.8333 16 17 16C16.1667 16 15.4583 15.7083 14.875 15.125C14.2917 14.5417 14 13.8333 14 13H8C8 13.8333 7.70833 14.5417 7.125 15.125C6.54167 15.7083 5.83333 16 5 16ZM5 14C5.28333 14 5.52083 13.9042 5.7125 13.7125C5.90417 13.5208 6 13.2833 6 13C6 12.7167 5.90417 12.4792 5.7125 12.2875C5.52083 12.0958 5.28333 12 5 12C4.71667 12 4.47917 12.0958 4.2875 12.2875C4.09583 12.4792 4 12.7167 4 13C4 13.2833 4.09583 13.5208 4.2875 13.7125C4.47917 13.9042 4.71667 14 5 14ZM17 14C17.2833 14 17.5208 13.9042 17.7125 13.7125C17.9042 13.5208 18 13.2833 18 13C18 12.7167 17.9042 12.4792 17.7125 12.2875C17.5208 12.0958 17.2833 12 17 12C16.7167 12 16.4792 12.0958 16.2875 12.2875C16.0958 12.4792 16 12.7167 16 13C16 13.2833 16.0958 13.5208 16.2875 13.7125C16.4792 13.9042 16.7167 14 17 14ZM16 9H20.25L18 6H16V9Z"/>
</svg>
<p id="estimatedShippingDesc">{{ 'Your postal code helps us provide the most accurate delivery information.'|t('foster-checkout') }}</p>
</div>

</div>

</div>

</div>
{% endif %}
Loading

0 comments on commit 372dac9

Please sign in to comment.