@oneblink/apps-react 6.7.0-beta.2 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,9 @@
|
|
1
1
|
import { SubmissionTypes } from '@oneblink/types';
|
2
2
|
import React from 'react';
|
3
|
-
|
3
|
+
import { CaptchaType } from '../../types/form';
|
4
|
+
declare function PaymentForm({ captchaSiteKey, captchaType, onCompleted, onCancelled, appImageUrl, title, }: {
|
4
5
|
captchaSiteKey: string;
|
6
|
+
captchaType?: CaptchaType;
|
5
7
|
onCompleted: (result: {
|
6
8
|
formSubmissionPayment: SubmissionTypes.FormSubmissionPayment;
|
7
9
|
paymentReceiptUrl: string;
|
@@ -5,7 +5,7 @@ import useQuery from '../../hooks/useQuery';
|
|
5
5
|
import useLoadDataState from '../../hooks/useLoadDataState';
|
6
6
|
import OnLoading from '../renderer/OnLoading';
|
7
7
|
import MaterialIcon from '../MaterialIcon';
|
8
|
-
function PaymentForm({ captchaSiteKey, onCompleted, onCancelled, appImageUrl, title, }) {
|
8
|
+
function PaymentForm({ captchaSiteKey, captchaType, onCompleted, onCancelled, appImageUrl, title, }) {
|
9
9
|
const query = useQuery();
|
10
10
|
const loadPaymentFormConfiguration = React.useCallback(async (abortSignal) => {
|
11
11
|
const formSubmissionPaymentId = query.formSubmissionPaymentId;
|
@@ -22,7 +22,7 @@ function PaymentForm({ captchaSiteKey, onCompleted, onCancelled, appImageUrl, ti
|
|
22
22
|
abortSignal,
|
23
23
|
});
|
24
24
|
return {
|
25
|
-
renderPaymentForm: () => (React.createElement(WestpacQuickStreamPaymentForm, { formSubmissionResult: formSubmissionResult, paymentSubmissionEvent: paymentSubmissionEvent, formSubmissionPaymentId: formSubmissionPaymentId, supplierBusinessCode: supplierBusinessCode, publishableApiKey: publishableApiKey, isTestMode: isTestMode, captchaSiteKey: captchaSiteKey, onCompleted: onCompleted, onCancelled: onCancelled, appImageUrl: appImageUrl, title: title })),
|
25
|
+
renderPaymentForm: () => (React.createElement(WestpacQuickStreamPaymentForm, { formSubmissionResult: formSubmissionResult, paymentSubmissionEvent: paymentSubmissionEvent, formSubmissionPaymentId: formSubmissionPaymentId, supplierBusinessCode: supplierBusinessCode, publishableApiKey: publishableApiKey, isTestMode: isTestMode, captchaSiteKey: captchaSiteKey, captchaType: captchaType, onCompleted: onCompleted, onCancelled: onCancelled, appImageUrl: appImageUrl, title: title })),
|
26
26
|
};
|
27
27
|
}
|
28
28
|
default: {
|
@@ -32,6 +32,7 @@ function PaymentForm({ captchaSiteKey, onCompleted, onCancelled, appImageUrl, ti
|
|
32
32
|
}, [
|
33
33
|
appImageUrl,
|
34
34
|
captchaSiteKey,
|
35
|
+
captchaType,
|
35
36
|
onCancelled,
|
36
37
|
onCompleted,
|
37
38
|
query.formSubmissionPaymentId,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PaymentForm.js","sourceRoot":"","sources":["../../../src/components/payments/PaymentForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,6BAA6B,MAAM,iCAAiC,CAAA;AAC3E,OAAO,QAAQ,MAAM,sBAAsB,CAAA;AAC3C,OAAO,gBAAgB,MAAM,8BAA8B,CAAA;AAC3D,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,YAAY,MAAM,iBAAiB,CAAA;
|
1
|
+
{"version":3,"file":"PaymentForm.js","sourceRoot":"","sources":["../../../src/components/payments/PaymentForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,6BAA6B,MAAM,iCAAiC,CAAA;AAC3E,OAAO,QAAQ,MAAM,sBAAsB,CAAA;AAC3C,OAAO,gBAAgB,MAAM,8BAA8B,CAAA;AAC3D,OAAO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AC,CAAC;gBACP,MAAM,IAAI,KAAK,CACb,IAAI,sBAAsB,CAAC,IAAI,wDAAwD,CACxF,CAAA;aACF;SACF;IACH,CAAC,EACD;QACE,WAAW;QACX,cAAc;QACd,WAAW;QACX,WAAW;QACX,WAAW;QACX,KAAK,CAAC,uBAAuB;QAC7B,KAAK;KACN,CACF,CAAA;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,gBAAgB,CAAC,4BAA4B,CAAC,CAAA;IAE9D,QAAQ,KAAK,CAAC,MAAM,EAAE;QACpB,KAAK,SAAS,CAAC,CAAC;YACd,OAAO,CACL;gBACE,6BAAK,SAAS,EAAC,mCAAmC;oBAChD,oBAAC,SAAS,IAAC,SAAS,EAAC,mBAAmB,GAAa;oBACrD,qEAA6C,CACzC,CACE,CACX,CAAA;SACF;QACD,KAAK,OAAO,CAAC,CAAC;YACZ,OAAO,CACL,iCACE,SAAS,EAAC,4CAA4C,EACtD,IAAI,EAAC,OAAO;gBAEZ,6BAAK,SAAS,EAAC,6EAA6E;oBAC1F,oBAAC,YAAY,IAAC,SAAS,EAAC,0DAA0D,YAEnE,CACX;gBACN,2BAAG,SAAS,EAAC,sEAAsE,IAChF,KAAK,CAAC,KAAK,CAAC,OAAO,CAClB,CACI,CACX,CAAA;SACF;QACD,KAAK,SAAS,CAAC,CAAC;YACd,OAAO,KAAK,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAA;SACxC;KACF;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA","sourcesContent":["import { paymentService } from '@oneblink/apps'\nimport { SubmissionTypes } from '@oneblink/types'\nimport React from 'react'\nimport WestpacQuickStreamPaymentForm from './WestpacQuickStreamPaymentForm'\nimport useQuery from '../../hooks/useQuery'\nimport useLoadDataState from '../../hooks/useLoadDataState'\nimport OnLoading from '../renderer/OnLoading'\nimport MaterialIcon from '../MaterialIcon'\nimport { CaptchaType } from '../../types/form'\n\nfunction PaymentForm({\n captchaSiteKey,\n captchaType,\n onCompleted,\n onCancelled,\n appImageUrl,\n title,\n}: {\n captchaSiteKey: string\n captchaType?: CaptchaType\n onCompleted: (result: {\n formSubmissionPayment: SubmissionTypes.FormSubmissionPayment\n paymentReceiptUrl: string\n }) => void\n onCancelled: (result: { paymentReceiptUrl: string }) => void\n appImageUrl?: string\n title?: string\n}) {\n const query = useQuery()\n\n const loadPaymentFormConfiguration = React.useCallback(\n async (abortSignal: AbortSignal) => {\n const formSubmissionPaymentId = query.formSubmissionPaymentId\n if (typeof formSubmissionPaymentId !== 'string') {\n throw new Error(\n 'It looks like you are attempting to make an unknown payment.',\n )\n }\n\n const { formSubmissionResult, paymentSubmissionEvent } =\n await paymentService.getFormSubmissionResultPayment()\n switch (paymentSubmissionEvent.type) {\n case 'WESTPAC_QUICK_STREAM': {\n const { supplierBusinessCode, publishableApiKey, isTestMode } =\n await paymentService.westpacQuickStream.getPaymentFormConfiguration(\n {\n formSubmissionPaymentId,\n formSubmissionResult,\n paymentSubmissionEvent,\n abortSignal,\n },\n )\n return {\n renderPaymentForm: () => (\n <WestpacQuickStreamPaymentForm\n formSubmissionResult={formSubmissionResult}\n paymentSubmissionEvent={paymentSubmissionEvent}\n formSubmissionPaymentId={formSubmissionPaymentId}\n supplierBusinessCode={supplierBusinessCode}\n publishableApiKey={publishableApiKey}\n isTestMode={isTestMode}\n captchaSiteKey={captchaSiteKey}\n captchaType={captchaType}\n onCompleted={onCompleted}\n onCancelled={onCancelled}\n appImageUrl={appImageUrl}\n title={title}\n />\n ),\n }\n }\n default: {\n throw new Error(\n `\"${paymentSubmissionEvent.type}\" payment events do not support a custom payment form.`,\n )\n }\n }\n },\n [\n appImageUrl,\n captchaSiteKey,\n captchaType,\n onCancelled,\n onCompleted,\n query.formSubmissionPaymentId,\n title,\n ],\n )\n\n const [state] = useLoadDataState(loadPaymentFormConfiguration)\n\n switch (state.status) {\n case 'LOADING': {\n return (\n <section>\n <div className=\"cypress-loading has-text-centered\">\n <OnLoading className=\"has-text-centered\"></OnLoading>\n <span>Loading payment configuration...</span>\n </div>\n </section>\n )\n }\n case 'ERROR': {\n return (\n <section\n className=\"cypress-payment-form-loading-error-message\"\n role=\"alert\"\n >\n <div className=\"ob-payment-form__error-icon-container has-text-centered has-margin-bottom-8\">\n <MaterialIcon className=\"ob-payment-form__error-icon has-text-danger icon-x-large\">\n error\n </MaterialIcon>\n </div>\n <p className=\"ob-payment-form__error-message has-text-centered has-margin-bottom-4\">\n {state.error.message}\n </p>\n </section>\n )\n }\n case 'SUCCESS': {\n return state.result.renderPaymentForm()\n }\n }\n}\n\nexport default React.memo(PaymentForm)\n"]}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@oneblink/apps-react",
|
3
3
|
"description": "Helper functions for OneBlink apps in ReactJS.",
|
4
|
-
"version": "6.7.0
|
4
|
+
"version": "6.7.0",
|
5
5
|
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
|
6
6
|
"bugs": {
|
7
7
|
"url": "https://github.com/oneblink/apps-react/issues"
|