Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/free-eggs-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'dropin-template': patch
---

Fixes the Provider to merge user-provided langDefinitions with the drop-in's default definitions, enabling label/placeholder overrides via the initializer API.
1 change: 0 additions & 1 deletion .github/workflows/pr-check-changeset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:

jobs:
check-changeset:
name: Check Changeset
runs-on: ubuntu-latest
if: |
!github.event.pull_request.draft &&
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -43,15 +42,18 @@ jobs:
echo "has_changes=true" >> "$GITHUB_OUTPUT"
fi

- name: Commit and push
- name: Commit
if: steps.check.outputs.has_changes == 'true'
run: |
git add -A
git commit -m "chore: bump version"
git push origin HEAD

- name: Run changeset tag
if: steps.check.outputs.has_changes == 'true'
run: npx changeset tag

- name: Push tags
run: git push --tags
- name: Push commit and tags
if: steps.check.outputs.has_changes == 'true'
run: |
git push origin HEAD
git push --tags
12 changes: 9 additions & 3 deletions src/render/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { useState, useEffect } from 'preact/hooks';
import { UIProvider } from '@adobe-commerce/elsie/components';
import { Lang } from '@adobe-commerce/elsie/i18n';
import { events } from '@adobe-commerce/event-bus';
import { deepmerge } from '@adobe-commerce/elsie/lib';
import { config } from '@/dropin-name/api';

import en_US from '../i18n/en_US.json';

Expand All @@ -11,11 +13,11 @@ const langDefinitions = {
default: en_US,
};

interface CartProviderProps {
interface ProviderProps {
children?: any;
}

export const Provider: FunctionComponent<CartProviderProps> = ({
export const Provider: FunctionComponent<ProviderProps> = ({
children,
}) => {
const [lang, setLang] = useState<Lang>('en_US');
Expand All @@ -34,8 +36,12 @@ export const Provider: FunctionComponent<CartProviderProps> = ({
};
}, []);

const userLangDefinitions = config.getConfig()?.langDefinitions;

const definitions = deepmerge(langDefinitions, userLangDefinitions ?? {});

return (
<UIProvider lang={lang} langDefinitions={langDefinitions}>
<UIProvider lang={lang} langDefinitions={definitions}>
{children}
</UIProvider>
);
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"outDir": "dist",
"baseUrl": ".",
"paths": {
"@adobe-commerce/elsie/*": ["./node_modules/@adobe-commerce/elsie/src/*"]
"@adobe-commerce/elsie/*": ["./node_modules/@adobe-commerce/elsie/src/*"],
"@/dropin-name/*": ["./src/*"]
}
},
"include": ["src"],
Expand Down
Loading