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
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,36 @@ All notable changes to the `stream-connect-sdk` npm package. The
companion React Native hook (`stream-connect-sdk-hook`) is on its own
release line; see [`sdk-hook/docs/README.md`](./sdk-hook/docs/README.md).

## 0.8.3

### Fix: carriers that ask for Date of Birth could never be connected

A member connecting a carrier whose credential form includes a **Date of
Birth** field — Medical Mutual and SimplePay Health — could not complete
enrollment. Whatever they typed was discarded before the request left the
browser, the backend rejected the submission as missing a required field
(HTTP 422), and the form came back with a red validation error. No input
format worked, because the value never reached the server at all.

The credential payload spread the carrier's form values first and then
re-pinned a handful of SDK-controlled fields on top. One of those was
`date_of_birth: values.dateOfBirth || null` — camelCase, which no carrier
schema emits — so it always evaluated to `null` and overwrote the real
value. The line was inherited from 0.7.x, where the spread order was
reversed and the member's value won; 0.8.0 inverted that order (so carrier
schemas can't clobber `payer_id` / `accept` / `tenants_accept`) and turned a
dead line into a data-destroying one. The re-pin is gone; `payer_id` and the
consent fields are still protected.

Date fields also render as a native date input now. Carrier schemas mark
them `{"type": "string", "format": "date"}`, which 0.8.x rendered as a bare
text box with no format hint even though the backend only accepts ISO
`YYYY-MM-DD`. The date input always produces ISO, so there is nothing left
to guess.

The React Native hook (`stream-connect-sdk-hook`) kept the 0.7.x spread
order and was never affected.

## 0.8.2

### Fix: 2FA-required carriers no longer dead-end on a false "Connected"
Expand Down
21 changes: 19 additions & 2 deletions assets/sdk/components/EnterCredentials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ interface FormState {
fields: Array<{
key: string;
title: string;
type: 'text' | 'password' | 'select' | 'checkbox';
type: 'text' | 'password' | 'select' | 'checkbox' | 'date';
options?: string[];
placeholder?: string;
}>;
Expand Down Expand Up @@ -150,6 +150,14 @@ const buildFormFromOnboardSchema = (payer: StreamPayer): FormState => {
type = 'select';
} else if (p?.type === 'boolean') {
type = 'checkbox';
} else if (p?.format === 'date') {
// Carrier schemas emit `{type: 'string', format: 'date'}` for DOB
// fields (Medical Mutual, SimplePay Health). Render a native date
// input so the submitted value is always ISO `YYYY-MM-DD`, which
// is the only format the backend's WTForms DateField parses. As a
// free-text box the member has to guess the format, and every
// guess but ISO is rejected server-side with a 422.
type = 'date';
}

fields.push({
Expand Down Expand Up @@ -344,7 +352,15 @@ export const EnterCredentials = (props: EnterCredentialsProps) => {
...values,
username: values.username,
password: values.password,
date_of_birth: values.dateOfBirth || null,
// NOTE: do not re-pin `date_of_birth` here. Carrier form values are
// keyed by their JSON-schema property name (`date_of_birth`), so
// `...values` already carries it. A trailing
// `date_of_birth: values.dateOfBirth || null` used to sit here —
// camelCase, which no carrier schema ever emits — so it resolved to
// `null` and clobbered whatever the member typed. Harmless in 0.7.x
// (which spread `...formData` LAST so the real value won), it became
// data-destroying when 0.8.0 inverted the spread order, 422ing every
// new Medical Mutual / SimplePay Health enrollment.
payer_id: streamPayer.id,
accept: values.termsAndServices,
tenants_accept: [values.tenantAcknowledgement]
Expand Down Expand Up @@ -495,6 +511,7 @@ export const EnterCredentials = (props: EnterCredentialsProps) => {
<TextInput
key={field.key}
label={field.title}
type={field.type === 'date' ? 'date' : 'text'}
autoComplete={
field.key === 'username' ? 'username' : undefined
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stream-connect-sdk",
"version": "0.8.2",
"version": "0.8.3",
"description": "A JavaScript SDK implementing TPAStream's Connect Platform",
"scripts": {
"build": "webpack --config webpack.prod-sdk.js --mode=production",
Expand Down
Loading