Skip to content
Open
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
6 changes: 5 additions & 1 deletion src/library/zoid/treatments/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ function getTreatmentPayerId() {
return account && !account.startsWith(CLIENT_ID_ACCOUNT_PREFIX) ? account : undefined;
}

function getTreatmentFeatures({ props = {} }) {
return getFeatures(typeof props.features === 'string' ? props.features : undefined);
}

export default createGlobalVariableGetter('__paypal_credit_treatments__', () =>
create({
tag: TAG.TREATEMENTS,
Expand Down Expand Up @@ -86,7 +90,7 @@ export default createGlobalVariableGetter('__paypal_credit_treatments__', () =>
type: 'string',
queryParam: 'features',
required: false,
value: getFeatures
value: getTreatmentFeatures
},
namespace: {
type: 'string',
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/spec/src/zoid/treatments/component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ describe('treatments component', () => {
expect(treatmentsComponent.props.payerId).toBeUndefined();
});

test('does not stringify zoid value options into features', () => {
const treatmentsComponent = getTreatmentsComponent();

expect(treatmentsComponent.props.features).toBe('native-modal');
expect(treatmentsComponent.config.props.features.value({ props: { features: 'test-feature' } })).toBe(
'test-feature,native-modal'
);
});

test('handles treatment data', () => {
const {
props: { onReady }
Expand Down
Loading