Skip to content

Commit

Permalink
feat: remove locale (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuentesloic authored Jun 20, 2023
1 parent ba858e7 commit 96956a3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export default defineNuxtConfig({
stripe: {
publishableKey: 'pk_test_123', // required
apiKey: 'sk_test_123' // required,
locale: string,
apiVersion: string, // default 2022-11-15
}
})
Expand Down
20 changes: 10 additions & 10 deletions src/module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineNuxtModule, addPlugin, createResolver, addTemplate, resolveModule } from '@nuxt/kit'
import defu from "defu"
import defu from 'defu'
import { fileURLToPath } from 'url'

export interface ModuleOptions {
Expand All @@ -15,15 +15,17 @@ export interface ModuleOptions {
* Stripe private key for server side only
* @example 'pk_test_yOipfsEBmvrjWhSJFMCMX0yf'
* @type string | null
* @docs https://...
* @docs https://stripe.com/docs/api/authentication
*/
apiKey: string | null,

// TODO: add more options
locale: string,

// TODO: add more options
apiVersion: string | "2022-11-15"
/**
* Stripe api version for server side only
* @example '2022-11-15'
* @type string | '2022-11-15'
* @docs https://stripe.com/docs/api/versioning
*/
apiVersion: string | '2022-11-15'
}

export default defineNuxtModule<ModuleOptions>({
Expand All @@ -37,8 +39,7 @@ export default defineNuxtModule<ModuleOptions>({
defaults: {
publishableKey: null,
apiKey: null,
locale: 'en',
apiVersion: "2022-11-15"
apiVersion: '2022-11-15'
},
setup (options, nuxt) {
const { resolve } = createResolver(import.meta.url)
Expand All @@ -57,7 +58,6 @@ export default defineNuxtModule<ModuleOptions>({
// Public runtimeConfig
nuxt.options.runtimeConfig.public.stripe = defu(nuxt.options.runtimeConfig.public.stripe, {
publishableKey: options.publishableKey,
locale: options.locale,
apiVersion: options.apiVersion
})

Expand Down
1 change: 0 additions & 1 deletion test/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ describe('ssr', async () => {
const html = await $fetch('/')
expect(html).toContain('publishableKey:"pk_test_123"')
expect(html).toContain('apiVersion:"2021-01-01"')
expect(html).toContain('locale:"fr"')
})

it.todo("validate ssr config")
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/basic/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ export default defineNuxtConfig({
publishableKey: "pk_test_123",
apiKey: "sk_test_123",
apiVersion: "2021-01-01",
locale: "fr"
}
})

0 comments on commit 96956a3

Please sign in to comment.