Skip to content

Commit

Permalink
feat(option-labels): add custom option labels (#188)
Browse files Browse the repository at this point in the history
* feat(option-labels): add custom option labels

* chore: update trivy package
  • Loading branch information
douglaseggleton authored Jan 17, 2024
1 parent 64f18a3 commit 68d8d46
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
3 changes: 2 additions & 1 deletion packages/embed-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ The options for this integration are as follows.
| `onBeforeTransaction` | `null` | An optional callback hook is called right before a transaction is created. It allows you to change the `metadata`, `externalIdentifier` and `shippingDetailsId` right before a transaction request. This callback should return a promise. |
| `showDeleteButton` | `false` | An optional boolean which controls the display of the delete button on stored payment methods, so that buyers can delete them. |
| `merchantAccountId` | `default` | An optional merchant account ID. |
| `excludedMethods` | `null` | An optional list of methods to be excluded. |
| `excludedMethods` | `null` | An optional list of methods to be excluded. |
| `optionLabels` | `Object` | An optional object map of payment option labels |

### Events

Expand Down
3 changes: 2 additions & 1 deletion packages/embed/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ The options for this integration are as follows.
| `antiFraudFingerprint` | `string` | An optional string to use as the device fingerprint. Leave unset to opt-in to Gr4vy's automatic anti-fraud functionality. |
| `enableAnimations` | `false` | An optional boolean to turn on animations. |
| `separatePaymentOptions` | `false` | An optional boolean to separate payment options. |
| `excludedMethods` | `null` | An optional list of methods to be excluded. |
| `excludedMethods` | `null` | An optional list of methods to be excluded. |
| `optionLabels` | `Object` | An optional object map of payment option labels |

### Theming

Expand Down
1 change: 1 addition & 0 deletions packages/embed/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const optionKeys = [
'enableAnimations',
'separatePaymentOptions',
'excludedMethods',
'optionLabels',
]

// Map of cleanup callbacks
Expand Down
1 change: 1 addition & 0 deletions packages/embed/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export type Config = {
enableAnimations?: boolean
separatePaymentOptions?: boolean
excludedMethods?: Array<string>
optionLabels?: Record<string, string>
}

export type BillingAddressFields = {
Expand Down
7 changes: 7 additions & 0 deletions packages/embed/src/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,4 +476,11 @@ export const validate = (options: SetupConfig) =>
message: 'must be a array',
required: false,
type: 'object',
}) &&
validateType({
argument: 'optionLabels',
value: options.optionLabels,
type: 'object',
message: 'must be an object',
required: false,
})
13 changes: 4 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8249,15 +8249,10 @@ flow-parser@0.*:
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.221.0.tgz#e11d7b7d19fb4ce08c3e54461476af4111a62fd0"
integrity sha512-i+GzdLcKYy5bxhx1N+FIcR1bTqssuVWTJcuytMhwqLAxifz46g4BSNicWXGrtzT0HibJUBIzZOYA3FveJucTPg==

follow-redirects@^1.0.0:
version "1.14.9"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7"
integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==

follow-redirects@^1.15.0:
version "1.15.3"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.3.tgz#fe2f3ef2690afce7e82ed0b44db08165b207123a"
integrity sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==
follow-redirects@^1.0.0, follow-redirects@^1.15.0:
version "1.15.5"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.5.tgz#54d4d6d062c0fa7d9d17feb008461550e3ba8020"
integrity sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==

for-each@^0.3.3:
version "0.3.3"
Expand Down

0 comments on commit 68d8d46

Please sign in to comment.