@paypay/mini-app-js-sdk 2.31.0 → 2.37.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.
- package/dist/client/index.d.ts +6 -4
- package/dist/client/supportedFunctionsList.d.ts +1 -1
- package/dist/client/types.d.ts +2 -2
- package/dist/composition-api/useHeightProperties.d.ts +7 -7
- package/dist/core/clientState.d.ts +4 -1
- package/dist/core/coreFunctions/getLoginUrl.d.ts +14 -3
- package/dist/core/coreFunctions/logEvent.d.ts +3 -1
- package/dist/core/coreUtils.d.ts +1 -2
- package/dist/core/index.d.ts +0 -1
- package/dist/jsbridge-core/jsbridge.d.ts +1 -6
- package/dist/jsbridge-core/namespace.d.ts +0 -1
- package/dist/mini-app-api.d.ts +7 -3
- package/dist/mini-app-js-sdk.browser.js +1 -1
- package/dist/mini-app-js-sdk.es.js +281 -147
- package/dist/model/makePayment.d.ts +17 -5
- package/dist/model/miniAppError.d.ts +2 -1
- package/dist/resources/images.d.ts +5 -0
- package/dist/resources/locales/smartPayment/en.d.ts +11 -1
- package/dist/resources/locales/smartPayment/ja.d.ts +11 -1
- package/dist/types/init.d.ts +2 -0
- package/dist/types/makePayment.d.ts +10 -0
- package/dist/types.d.ts +10 -4
- package/dist/utils/analytics.d.ts +4 -1
- package/dist/utils/fetch.d.ts +1 -0
- package/dist/utils/getAppDetail.d.ts +6 -0
- package/dist/utils/helper.d.ts +21 -3
- package/dist/utils/minimumJSSDKVersion.d.ts +3 -0
- package/dist/utils/storage.d.ts +14 -3
- package/dist/utils/uiConstants.d.ts +1 -0
- package/package.json +2 -2
- package/dist/index.d.ts +0 -3
- package/dist/jsbridge-core/lib/browser.d.ts +0 -3
- package/dist/jsbridge-core/module.d.ts +0 -13
- package/dist/jsbridge-core/paypay-jsbridge.d.ts +0 -16
- package/dist/mini-app-js-sdk.d.ts +0 -10
- package/dist/model/bridge/getAppDetail.d.ts +0 -3
- package/dist/package/button/index.d.ts +0 -93
|
@@ -218,6 +218,11 @@ const PPUtilFunctionName = {
|
|
|
218
218
|
consoleDebugInfo: "consoleDebugInfo",
|
|
219
219
|
clientPopState: "clientPopState"
|
|
220
220
|
};
|
|
221
|
+
var SdkType = /* @__PURE__ */ ((SdkType2) => {
|
|
222
|
+
SdkType2["MiniApp"] = "MiniApp";
|
|
223
|
+
SdkType2["SmartPayment"] = "SmartPayment";
|
|
224
|
+
return SdkType2;
|
|
225
|
+
})(SdkType || {});
|
|
221
226
|
const jsBridgeNamespace = "_PayPayJsBridge";
|
|
222
227
|
const miniAppSupportedFunctions = [
|
|
223
228
|
"init",
|
|
@@ -277,84 +282,70 @@ const miniAppSupportedFunctions = [
|
|
|
277
282
|
"getTransactions",
|
|
278
283
|
"getPayPayCardInfo",
|
|
279
284
|
"getExternalLinkageInformation",
|
|
280
|
-
"markAsReady"
|
|
285
|
+
"markAsReady",
|
|
286
|
+
"renderCoupons"
|
|
287
|
+
];
|
|
288
|
+
const smartPaymentSupportedFunctions = [
|
|
289
|
+
"init",
|
|
290
|
+
"createOrder",
|
|
291
|
+
"makePayment",
|
|
292
|
+
"render",
|
|
293
|
+
"logout",
|
|
294
|
+
"getAuthStatus",
|
|
295
|
+
"getUserProfile",
|
|
296
|
+
"getBalance",
|
|
297
|
+
"getUserAddress",
|
|
298
|
+
"getUAID",
|
|
299
|
+
"getCashbackInformation",
|
|
300
|
+
"renderCoupons",
|
|
301
|
+
"getLoginUrl"
|
|
281
302
|
];
|
|
282
303
|
function url(path) {
|
|
283
304
|
return "https://image.paypay.ne.jp/miniapps/mini-app-sdk/" + path;
|
|
284
305
|
}
|
|
285
306
|
const img_paypayRec = url("icon-paypay-rec.svg");
|
|
286
307
|
const img_paypayRecWhite = url("icon-paypay-rec-white.svg");
|
|
287
|
-
var
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
MiniAppErrorType2["sdkNotInitialized"] = "SDK_NOT_INITIALIZED";
|
|
329
|
-
MiniAppErrorType2["tokenNotFound"] = "TOKEN_NOT_FOUND";
|
|
330
|
-
MiniAppErrorType2["tokenExpired"] = "TOKEN_EXPIRED";
|
|
331
|
-
MiniAppErrorType2["activeRequestExists"] = "ACTIVE_REQUEST_EXISTS";
|
|
332
|
-
MiniAppErrorType2["invalidType"] = "INVALID_TYPE";
|
|
333
|
-
MiniAppErrorType2["sessionNotFound"] = "SESSION_NOT_FOUND";
|
|
334
|
-
MiniAppErrorType2["cookieError"] = "COOKIE_ERROR";
|
|
335
|
-
MiniAppErrorType2["notAuthorized"] = "NOT_AUTHORIZED";
|
|
336
|
-
MiniAppErrorType2["permissionRequired"] = "PERMISSION_REQUIRED";
|
|
337
|
-
MiniAppErrorType2["deeplinkUnavailable"] = "DEEPLINK_UNAVAILABLE";
|
|
338
|
-
MiniAppErrorType2["kycIncompleted"] = "KYC_INCOMPLETED";
|
|
339
|
-
MiniAppErrorType2["noBankAccount"] = "NO_BANK_ACCOUNT";
|
|
340
|
-
MiniAppErrorType2["invalidPaymentIdentifier"] = "INVALID_PAYMENT_IDENTIFIER";
|
|
341
|
-
MiniAppErrorType2["otpSendTooShort"] = "OTP_SEND_TOO_SHORT";
|
|
342
|
-
MiniAppErrorType2["otpSendOverLimit"] = "OTP_SEND_OVER_LIMIT";
|
|
343
|
-
MiniAppErrorType2["userVerificationFailure"] = "USER_VERIFICATION_FAILURE";
|
|
344
|
-
MiniAppErrorType2["unacceptableOp"] = "UNACCEPTABLE_OP";
|
|
345
|
-
MiniAppErrorType2["kycUpdateRequired"] = "KYC_UPDATE_REQUIRED";
|
|
346
|
-
MiniAppErrorType2["notCompleted"] = "NOT_COMPLETED";
|
|
347
|
-
MiniAppErrorType2["kycValidationInProcess"] = "KYC_VALIDATION_IN_PROCESS";
|
|
348
|
-
MiniAppErrorType2["noLocationData"] = "NO_LOCATION_DATA";
|
|
349
|
-
MiniAppErrorType2["functionNotFound"] = "FUNCTION_NOT_FOUND";
|
|
350
|
-
MiniAppErrorType2["originNotAllowed"] = "ORIGIN_NOT_ALLOWED";
|
|
351
|
-
MiniAppErrorType2["messageSendingFailed"] = "MESSAGE_SENDING_FAILED";
|
|
352
|
-
MiniAppErrorType2["transactionNotFound"] = "TRANSACTION_NOT_FOUND";
|
|
353
|
-
MiniAppErrorType2["unexpectedOperation"] = "UNEXPECTED_OP";
|
|
354
|
-
MiniAppErrorType2["merchantTimeout"] = "MERCHANT_TIMEOUT";
|
|
355
|
-
MiniAppErrorType2["rateLimitExceeded"] = "RATE_LIMIT_EXCEEDED";
|
|
356
|
-
return MiniAppErrorType2;
|
|
357
|
-
})(MiniAppErrorType || {});
|
|
308
|
+
var getRandomValues;
|
|
309
|
+
var rnds8 = new Uint8Array(16);
|
|
310
|
+
function rng() {
|
|
311
|
+
if (!getRandomValues) {
|
|
312
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== "undefined" && typeof msCrypto.getRandomValues === "function" && msCrypto.getRandomValues.bind(msCrypto);
|
|
313
|
+
if (!getRandomValues) {
|
|
314
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return getRandomValues(rnds8);
|
|
318
|
+
}
|
|
319
|
+
const REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
320
|
+
function validate(uuid) {
|
|
321
|
+
return typeof uuid === "string" && REGEX.test(uuid);
|
|
322
|
+
}
|
|
323
|
+
var byteToHex = [];
|
|
324
|
+
for (var i = 0; i < 256; ++i) {
|
|
325
|
+
byteToHex.push((i + 256).toString(16).substr(1));
|
|
326
|
+
}
|
|
327
|
+
function stringify(arr) {
|
|
328
|
+
var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
329
|
+
var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
330
|
+
if (!validate(uuid)) {
|
|
331
|
+
throw TypeError("Stringified UUID is invalid");
|
|
332
|
+
}
|
|
333
|
+
return uuid;
|
|
334
|
+
}
|
|
335
|
+
function v4(options, buf, offset) {
|
|
336
|
+
options = options || {};
|
|
337
|
+
var rnds = options.random || (options.rng || rng)();
|
|
338
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
339
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
340
|
+
if (buf) {
|
|
341
|
+
offset = offset || 0;
|
|
342
|
+
for (var i = 0; i < 16; ++i) {
|
|
343
|
+
buf[offset + i] = rnds[i];
|
|
344
|
+
}
|
|
345
|
+
return buf;
|
|
346
|
+
}
|
|
347
|
+
return stringify(rnds);
|
|
348
|
+
}
|
|
358
349
|
function isIP(hostName) {
|
|
359
350
|
return isIPv4(hostName) || isIPv6(hostName);
|
|
360
351
|
}
|
|
@@ -706,8 +697,8 @@ function parseDomain(domain) {
|
|
|
706
697
|
function getDomain(subdomainCookieSharing, hostname) {
|
|
707
698
|
return subdomainCookieSharing ? parseDomain(hostname) : hostname;
|
|
708
699
|
}
|
|
709
|
-
const JS_SDK_VERSION = "2.
|
|
710
|
-
const REVISION = "
|
|
700
|
+
const JS_SDK_VERSION = "2.37.0";
|
|
701
|
+
const REVISION = "1b5c920";
|
|
711
702
|
const coreBaseUrl = new URL("https://mini-app-sdk-core.paypay.ne.jp/");
|
|
712
703
|
const CORE_IFRAME_ORIGIN = coreBaseUrl.origin;
|
|
713
704
|
const CORE_IFRAME_URL = new URL(
|
|
@@ -719,6 +710,80 @@ const COUPON_IFRAME_URL = new URL(
|
|
|
719
710
|
coreBaseUrl
|
|
720
711
|
).href;
|
|
721
712
|
const SENTRY_DSN = "https://377b45f154b1fb17d8e98a6ffb67030a@o4505819519320064.ingest.sentry.io/4506579323453440";
|
|
713
|
+
const GA_API_SECRET = "fgPKRkdQQvq7XbV4qw3MOQ";
|
|
714
|
+
const GA_MEASUREMENT_ID = "G-M64Q2828RR";
|
|
715
|
+
var MiniAppErrorType = /* @__PURE__ */ ((MiniAppErrorType2) => {
|
|
716
|
+
MiniAppErrorType2["success"] = "SUCCESS";
|
|
717
|
+
MiniAppErrorType2["invalidUrl"] = "INVALID_URL";
|
|
718
|
+
MiniAppErrorType2["invalidData"] = "INVALID_DATA";
|
|
719
|
+
MiniAppErrorType2["invalidHeader"] = "INVALID_HEADER";
|
|
720
|
+
MiniAppErrorType2["invalidMethod"] = "INVALID_METHOD";
|
|
721
|
+
MiniAppErrorType2["invalidPath"] = "INVALID_PATH";
|
|
722
|
+
MiniAppErrorType2["notReachable"] = "NOT_REACHABLE";
|
|
723
|
+
MiniAppErrorType2["notAvailable"] = "NOT_AVAILABLE";
|
|
724
|
+
MiniAppErrorType2["timeOut"] = "TIME_OUT";
|
|
725
|
+
MiniAppErrorType2["whiteListError"] = "NONE_WHITELIST_DOMAIN";
|
|
726
|
+
MiniAppErrorType2["statusCodeError"] = "STATUS_CODE_ERROR";
|
|
727
|
+
MiniAppErrorType2["invalidResponse"] = "INVALID_RESPONSE";
|
|
728
|
+
MiniAppErrorType2["noLocationPermission"] = "NO_USER_LOCATION_PERMISSION";
|
|
729
|
+
MiniAppErrorType2["noPermissionListAvailable"] = "NO_PERMISSION_LIST_AVAILABLE";
|
|
730
|
+
MiniAppErrorType2["other"] = "other";
|
|
731
|
+
MiniAppErrorType2["serverError"] = "SERVER_ERROR";
|
|
732
|
+
MiniAppErrorType2["noCameraPermission"] = "HOST_APP_CAMERA_DENIED";
|
|
733
|
+
MiniAppErrorType2["noAlbumPermission"] = "HOST_APP_ALBUM_DENIED";
|
|
734
|
+
MiniAppErrorType2["insufficientScope"] = "INSUFFICIENT_SCOPE";
|
|
735
|
+
MiniAppErrorType2["userCanceled"] = "USER_CANCELED";
|
|
736
|
+
MiniAppErrorType2["invalidJSAPIParams"] = "INVALID_JS_API_PARAMS";
|
|
737
|
+
MiniAppErrorType2["hostAppLocationDenied"] = "HOST_APP_LOCATION_DENIED";
|
|
738
|
+
MiniAppErrorType2["hostAppContactsDenied"] = "HOST_APP_READING_CONTACT_DENIED";
|
|
739
|
+
MiniAppErrorType2["badRequestInsufficientParameter"] = "BAD_REQUEST_INSUFFICIENT_PARAMETER";
|
|
740
|
+
MiniAppErrorType2["badRequest"] = "BAD_REQUEST";
|
|
741
|
+
MiniAppErrorType2["paymentFail"] = "PAYMENT_FAIL";
|
|
742
|
+
MiniAppErrorType2["topupFail"] = "TOPUP_FAIL";
|
|
743
|
+
MiniAppErrorType2["topupSuccessButNotAddToBalance"] = "TOPUP_SUCCESS_BUT_NOT_ADD_TO_BALANCE";
|
|
744
|
+
MiniAppErrorType2["userCanceledSimilarTxn"] = "USER_CANCELED_SIMILAR_TRANSACTION";
|
|
745
|
+
MiniAppErrorType2["mapAppNotFound"] = "MAP_APP_NOT_FOUND";
|
|
746
|
+
MiniAppErrorType2["invalidAppSchemeURL"] = "INVALID_APP_SCHEME_URL";
|
|
747
|
+
MiniAppErrorType2["noValueFound"] = "NO_VALUE_FOUND";
|
|
748
|
+
MiniAppErrorType2["securityNotSetup"] = "SECURITY_NOT_SETUP";
|
|
749
|
+
MiniAppErrorType2["userDenied"] = "USER_DENIED";
|
|
750
|
+
MiniAppErrorType2["securityTemporaryLocked"] = "SECURITY_TEMPORARY_LOCKED";
|
|
751
|
+
MiniAppErrorType2["couldNotGenerateBarcode"] = "COULD_NOT_GENERATE_BARCODE";
|
|
752
|
+
MiniAppErrorType2["cannotDetectAvailability"] = "CAN_NOT_DETECT_AVAILABILITY";
|
|
753
|
+
MiniAppErrorType2["suspectedDuplicatePayment"] = "SUSPECTED_DUPLICATE_PAYMENT";
|
|
754
|
+
MiniAppErrorType2["noSufficientFund"] = "NO_SUFFICIENT_FUND";
|
|
755
|
+
MiniAppErrorType2["unknown"] = "UNKNOWN";
|
|
756
|
+
MiniAppErrorType2["sdkNotInitialized"] = "SDK_NOT_INITIALIZED";
|
|
757
|
+
MiniAppErrorType2["tokenNotFound"] = "TOKEN_NOT_FOUND";
|
|
758
|
+
MiniAppErrorType2["tokenExpired"] = "TOKEN_EXPIRED";
|
|
759
|
+
MiniAppErrorType2["activeRequestExists"] = "ACTIVE_REQUEST_EXISTS";
|
|
760
|
+
MiniAppErrorType2["invalidType"] = "INVALID_TYPE";
|
|
761
|
+
MiniAppErrorType2["sessionNotFound"] = "SESSION_NOT_FOUND";
|
|
762
|
+
MiniAppErrorType2["cookieError"] = "COOKIE_ERROR";
|
|
763
|
+
MiniAppErrorType2["notAuthorized"] = "NOT_AUTHORIZED";
|
|
764
|
+
MiniAppErrorType2["permissionRequired"] = "PERMISSION_REQUIRED";
|
|
765
|
+
MiniAppErrorType2["deeplinkUnavailable"] = "DEEPLINK_UNAVAILABLE";
|
|
766
|
+
MiniAppErrorType2["kycIncompleted"] = "KYC_INCOMPLETED";
|
|
767
|
+
MiniAppErrorType2["noBankAccount"] = "NO_BANK_ACCOUNT";
|
|
768
|
+
MiniAppErrorType2["invalidPaymentIdentifier"] = "INVALID_PAYMENT_IDENTIFIER";
|
|
769
|
+
MiniAppErrorType2["otpSendTooShort"] = "OTP_SEND_TOO_SHORT";
|
|
770
|
+
MiniAppErrorType2["otpSendOverLimit"] = "OTP_SEND_OVER_LIMIT";
|
|
771
|
+
MiniAppErrorType2["userVerificationFailure"] = "USER_VERIFICATION_FAILURE";
|
|
772
|
+
MiniAppErrorType2["unacceptableOp"] = "UNACCEPTABLE_OP";
|
|
773
|
+
MiniAppErrorType2["kycUpdateRequired"] = "KYC_UPDATE_REQUIRED";
|
|
774
|
+
MiniAppErrorType2["notCompleted"] = "NOT_COMPLETED";
|
|
775
|
+
MiniAppErrorType2["kycValidationInProcess"] = "KYC_VALIDATION_IN_PROCESS";
|
|
776
|
+
MiniAppErrorType2["noLocationData"] = "NO_LOCATION_DATA";
|
|
777
|
+
MiniAppErrorType2["functionNotFound"] = "FUNCTION_NOT_FOUND";
|
|
778
|
+
MiniAppErrorType2["originNotAllowed"] = "ORIGIN_NOT_ALLOWED";
|
|
779
|
+
MiniAppErrorType2["messageSendingFailed"] = "MESSAGE_SENDING_FAILED";
|
|
780
|
+
MiniAppErrorType2["transactionNotFound"] = "TRANSACTION_NOT_FOUND";
|
|
781
|
+
MiniAppErrorType2["unexpectedOperation"] = "UNEXPECTED_OP";
|
|
782
|
+
MiniAppErrorType2["merchantTimeout"] = "MERCHANT_TIMEOUT";
|
|
783
|
+
MiniAppErrorType2["rateLimitExceeded"] = "RATE_LIMIT_EXCEEDED";
|
|
784
|
+
MiniAppErrorType2["sdkUpgradeRequired"] = "SDK_UPGRADE_REQUIRED";
|
|
785
|
+
return MiniAppErrorType2;
|
|
786
|
+
})(MiniAppErrorType || {});
|
|
722
787
|
const objectToString = Object.prototype.toString;
|
|
723
788
|
function isBuiltin(wat, className) {
|
|
724
789
|
return objectToString.call(wat) === `[object ${className}]`;
|
|
@@ -832,14 +897,14 @@ function _dropUndefinedKeys(inputValue, memoizationMap) {
|
|
|
832
897
|
}
|
|
833
898
|
function uuid4() {
|
|
834
899
|
const gbl = GLOBAL_OBJ;
|
|
835
|
-
const
|
|
900
|
+
const crypto2 = gbl.crypto || gbl.msCrypto;
|
|
836
901
|
let getRandomByte = () => Math.random() * 16;
|
|
837
902
|
try {
|
|
838
|
-
if (
|
|
839
|
-
return
|
|
903
|
+
if (crypto2 && crypto2.randomUUID) {
|
|
904
|
+
return crypto2.randomUUID().replace(/-/g, "");
|
|
840
905
|
}
|
|
841
|
-
if (
|
|
842
|
-
getRandomByte = () =>
|
|
906
|
+
if (crypto2 && crypto2.getRandomValues) {
|
|
907
|
+
getRandomByte = () => crypto2.getRandomValues(new Uint8Array(1))[0];
|
|
843
908
|
}
|
|
844
909
|
} catch (_) {
|
|
845
910
|
}
|
|
@@ -2040,13 +2105,6 @@ function addBreadcrumbToSentry(breadcrumb) {
|
|
|
2040
2105
|
addBreadcrumb(breadcrumb);
|
|
2041
2106
|
}
|
|
2042
2107
|
}
|
|
2043
|
-
({
|
|
2044
|
-
UNAUTHORIZED: MiniAppErrorType.notAuthorized,
|
|
2045
|
-
BAD_REQUEST: MiniAppErrorType.badRequest,
|
|
2046
|
-
MISSING_REQUEST_PARAMS: MiniAppErrorType.badRequestInsufficientParameter,
|
|
2047
|
-
OP_OUT_OF_SCOPE: MiniAppErrorType.insufficientScope,
|
|
2048
|
-
MINI_APP_SCOPE_NOT_FOUND: MiniAppErrorType.insufficientScope
|
|
2049
|
-
});
|
|
2050
2108
|
let clientId = "";
|
|
2051
2109
|
function getCurrentClientId() {
|
|
2052
2110
|
return clientId;
|
|
@@ -2109,10 +2167,74 @@ class LocalStorageProxy {
|
|
|
2109
2167
|
this.memoryStorage = {};
|
|
2110
2168
|
}
|
|
2111
2169
|
}
|
|
2112
|
-
new LocalStorageProxy();
|
|
2113
|
-
function
|
|
2114
|
-
return
|
|
2170
|
+
const storage = new LocalStorageProxy();
|
|
2171
|
+
function getKeyWithClientId(baseKey, clientId2) {
|
|
2172
|
+
return `${baseKey}.${clientId2 != null ? clientId2 : getCurrentClientId()}`;
|
|
2173
|
+
}
|
|
2174
|
+
function saveLocalStorage(key, value) {
|
|
2175
|
+
removeLocalStorage(key);
|
|
2176
|
+
if (value) {
|
|
2177
|
+
return storage.setItem(key, value);
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
function removeLocalStorage(key) {
|
|
2181
|
+
storage.removeItem(key);
|
|
2182
|
+
}
|
|
2183
|
+
function saveClientUUID(uuid) {
|
|
2184
|
+
saveLocalStorage(getKeyWithClientId(PpLocalStorageKey.clientUUID), uuid);
|
|
2185
|
+
}
|
|
2186
|
+
function getClientUUID() {
|
|
2187
|
+
let uuid = storage.getItem(getKeyWithClientId(PpLocalStorageKey.clientUUID)) || "";
|
|
2188
|
+
if (!validate(uuid)) {
|
|
2189
|
+
uuid = v4();
|
|
2190
|
+
saveClientUUID(uuid);
|
|
2191
|
+
}
|
|
2192
|
+
return uuid;
|
|
2193
|
+
}
|
|
2194
|
+
function getAppDetail(clientId2) {
|
|
2195
|
+
const val = storage.getItem(
|
|
2196
|
+
getKeyWithClientId(PpLocalStorageKey.appDetail, clientId2)
|
|
2197
|
+
);
|
|
2198
|
+
if (val == null) {
|
|
2199
|
+
return null;
|
|
2200
|
+
}
|
|
2201
|
+
return JSON.parse(val);
|
|
2202
|
+
}
|
|
2203
|
+
let timeoutId = null;
|
|
2204
|
+
let eventsQueue = [];
|
|
2205
|
+
function sendEvents() {
|
|
2206
|
+
var _a;
|
|
2207
|
+
const events = eventsQueue;
|
|
2208
|
+
eventsQueue = [];
|
|
2209
|
+
timeoutId = null;
|
|
2210
|
+
navigator.sendBeacon(
|
|
2211
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
2212
|
+
`https://www.google-analytics.com/mp/collect?api_secret=${GA_API_SECRET}&measurement_id=${GA_MEASUREMENT_ID}`,
|
|
2213
|
+
JSON.stringify({
|
|
2214
|
+
client_id: getClientUUID(),
|
|
2215
|
+
events,
|
|
2216
|
+
user_id: (_a = getAppDetail()) == null ? void 0 : _a.externalUserId
|
|
2217
|
+
})
|
|
2218
|
+
);
|
|
2115
2219
|
}
|
|
2220
|
+
getRandomString();
|
|
2221
|
+
document.addEventListener("visibilitychange", () => {
|
|
2222
|
+
if (document.visibilityState === "hidden") {
|
|
2223
|
+
if (eventsQueue.length > 0) {
|
|
2224
|
+
if (timeoutId) {
|
|
2225
|
+
clearTimeout(timeoutId);
|
|
2226
|
+
}
|
|
2227
|
+
sendEvents();
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
});
|
|
2231
|
+
({
|
|
2232
|
+
UNAUTHORIZED: MiniAppErrorType.notAuthorized,
|
|
2233
|
+
BAD_REQUEST: MiniAppErrorType.badRequest,
|
|
2234
|
+
MISSING_REQUEST_PARAMS: MiniAppErrorType.badRequestInsufficientParameter,
|
|
2235
|
+
OP_OUT_OF_SCOPE: MiniAppErrorType.insufficientScope,
|
|
2236
|
+
MINI_APP_SCOPE_NOT_FOUND: MiniAppErrorType.insufficientScope
|
|
2237
|
+
});
|
|
2116
2238
|
function getAppVersion() {
|
|
2117
2239
|
var _a, _b, _c, _d;
|
|
2118
2240
|
let appVersion = null;
|
|
@@ -2148,13 +2270,6 @@ function checkVersion(minVersion) {
|
|
|
2148
2270
|
function getRandomString() {
|
|
2149
2271
|
return Math.random().toString(36).substring(7);
|
|
2150
2272
|
}
|
|
2151
|
-
function getEventCategory(params) {
|
|
2152
|
-
var _a;
|
|
2153
|
-
const clientId2 = (_a = params == null ? void 0 : params.clientId) != null ? _a : getCurrentClientId();
|
|
2154
|
-
const featureName = (params == null ? void 0 : params.featureName) ? `_${params == null ? void 0 : params.featureName}` : "";
|
|
2155
|
-
const sdkType = (params == null ? void 0 : params.sdkType) ? params.sdkType : isPayPayMiniApp() ? "miniapp" : "smartpayment";
|
|
2156
|
-
return `${sdkType}_${clientId2}${featureName}`;
|
|
2157
|
-
}
|
|
2158
2273
|
function checkIFrameOrigin(origin) {
|
|
2159
2274
|
return origin === CORE_IFRAME_ORIGIN;
|
|
2160
2275
|
}
|
|
@@ -2191,15 +2306,10 @@ function getCodeVerifier() {
|
|
|
2191
2306
|
return api.get(PpLocalStorageKey.codeVerifier) || "";
|
|
2192
2307
|
}
|
|
2193
2308
|
function exposeClientJsBridge(jsBridge) {
|
|
2194
|
-
|
|
2195
|
-
if (
|
|
2196
|
-
// eslint-disable-next-line no-prototype-builtins, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
2197
|
-
global2.hasOwnProperty(jsBridgeNamespace) && // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2198
|
-
global2[jsBridgeNamespace] === jsBridge
|
|
2199
|
-
) {
|
|
2309
|
+
if (window.hasOwnProperty(jsBridgeNamespace) && window[jsBridgeNamespace] === jsBridge) {
|
|
2200
2310
|
return false;
|
|
2201
2311
|
}
|
|
2202
|
-
|
|
2312
|
+
window[jsBridgeNamespace] = jsBridge;
|
|
2203
2313
|
return true;
|
|
2204
2314
|
}
|
|
2205
2315
|
function consoleDebugInfo(params) {
|
|
@@ -2208,6 +2318,11 @@ function consoleDebugInfo(params) {
|
|
|
2208
2318
|
function isSupportedMiniapp(functionName) {
|
|
2209
2319
|
return miniAppSupportedFunctions.includes(functionName);
|
|
2210
2320
|
}
|
|
2321
|
+
function isSupportedSmartpayment(functionName) {
|
|
2322
|
+
return smartPaymentSupportedFunctions.includes(
|
|
2323
|
+
functionName
|
|
2324
|
+
);
|
|
2325
|
+
}
|
|
2211
2326
|
let runningFunctions = [];
|
|
2212
2327
|
function isFunctionRunning() {
|
|
2213
2328
|
return runningFunctions.length > 0;
|
|
@@ -2228,13 +2343,13 @@ function promiseToCallback(functionName, target, getCore2, getLoggingParams) {
|
|
|
2228
2343
|
const loggingParams = getLoggingParams == null ? void 0 : getLoggingParams(params);
|
|
2229
2344
|
void core2.logEvent(__spreadValues({
|
|
2230
2345
|
event_action: `pp_${functionName}_called`,
|
|
2231
|
-
|
|
2346
|
+
event_category_suffix: functionName
|
|
2232
2347
|
}, loggingParams));
|
|
2233
2348
|
target(params).then((result) => {
|
|
2234
2349
|
var _a;
|
|
2235
2350
|
void core2.logEvent(__spreadValues({
|
|
2236
2351
|
event_action: `pp_${functionName}_success`,
|
|
2237
|
-
|
|
2352
|
+
event_category_suffix: functionName
|
|
2238
2353
|
}, loggingParams));
|
|
2239
2354
|
(_a = params.success) == null ? void 0 : _a.call(params, result);
|
|
2240
2355
|
}).catch((error) => {
|
|
@@ -2242,7 +2357,7 @@ function promiseToCallback(functionName, target, getCore2, getLoggingParams) {
|
|
|
2242
2357
|
console.error(error.message);
|
|
2243
2358
|
void core2.logEvent(__spreadValues({
|
|
2244
2359
|
event_action: `pp_${functionName}_fail`,
|
|
2245
|
-
|
|
2360
|
+
event_category_suffix: functionName,
|
|
2246
2361
|
error_value: error.errorCode
|
|
2247
2362
|
}, loggingParams));
|
|
2248
2363
|
(_a = params.fail) == null ? void 0 : _a.call(params, { errorCode: error.errorCode });
|
|
@@ -2574,6 +2689,7 @@ function createIframe() {
|
|
|
2574
2689
|
});
|
|
2575
2690
|
}
|
|
2576
2691
|
let useAllFunctions = false;
|
|
2692
|
+
let clientSdkType;
|
|
2577
2693
|
let initDonePromise;
|
|
2578
2694
|
WindowBridge.init({});
|
|
2579
2695
|
void getCoreIframe();
|
|
@@ -2640,7 +2756,7 @@ function init(params) {
|
|
|
2640
2756
|
const ott = url2.searchParams.get("one_time_token");
|
|
2641
2757
|
const refreshToken = getRefreshToken();
|
|
2642
2758
|
const codeVerifier = getCodeVerifier();
|
|
2643
|
-
const clientVersion = "2.
|
|
2759
|
+
const clientVersion = "2.37.0";
|
|
2644
2760
|
useAllFunctions = !!params.useAllFunctions;
|
|
2645
2761
|
if (token || ott) {
|
|
2646
2762
|
removeTokenFromUrl(url2);
|
|
@@ -2654,7 +2770,8 @@ function init(params) {
|
|
|
2654
2770
|
ott,
|
|
2655
2771
|
refreshToken,
|
|
2656
2772
|
clientVersion,
|
|
2657
|
-
codeVerifier
|
|
2773
|
+
codeVerifier,
|
|
2774
|
+
clientSdkType
|
|
2658
2775
|
};
|
|
2659
2776
|
let initDonePromiseResolve;
|
|
2660
2777
|
const nextInitDonePromise = new Promise(
|
|
@@ -2730,7 +2847,7 @@ function render(params) {
|
|
|
2730
2847
|
}
|
|
2731
2848
|
const messageId = functionStart();
|
|
2732
2849
|
const getRenderMessageHandler = (e) => {
|
|
2733
|
-
var _a2, _b;
|
|
2850
|
+
var _a2, _b, _c;
|
|
2734
2851
|
if (!checkIFrameOrigin(e.origin) || e.data.name !== PPFunctionName.render || e.data.messageId !== messageId) {
|
|
2735
2852
|
return;
|
|
2736
2853
|
}
|
|
@@ -2742,6 +2859,9 @@ function render(params) {
|
|
|
2742
2859
|
triggerPostMessageToCore(PPFunctionName.makePayment, true, params, __spreadValues({}, params.orderInfo));
|
|
2743
2860
|
}
|
|
2744
2861
|
}
|
|
2862
|
+
if (e.data.result === PPFunctionResult.fail) {
|
|
2863
|
+
(_c = params == null ? void 0 : params.fail) == null ? void 0 : _c.call(params, e.data.data);
|
|
2864
|
+
}
|
|
2745
2865
|
if (e.data.result === PPFunctionResult.complete) {
|
|
2746
2866
|
functionEnd(e.data.messageId);
|
|
2747
2867
|
removeEventListener("message", getRenderMessageHandler);
|
|
@@ -3098,52 +3218,66 @@ const initExemptedFunctions = [
|
|
|
3098
3218
|
"getLoginUrl"
|
|
3099
3219
|
];
|
|
3100
3220
|
const autoInitFunctions = ["renderCoupons"];
|
|
3101
|
-
|
|
3102
|
-
get(target, prop) {
|
|
3103
|
-
const functionName = prop;
|
|
3104
|
-
if (!useAllFunctions) {
|
|
3105
|
-
if (!isSupportedMiniapp(functionName)) {
|
|
3106
|
-
throw new Error(`${functionName} is not supported by Mini Apps JS SDK`);
|
|
3107
|
-
}
|
|
3108
|
-
}
|
|
3109
|
-
return (params) => __async(this, null, function* () {
|
|
3110
|
-
var _a, _b;
|
|
3111
|
-
if (!initExemptedFunctions.includes(functionName) && !(yield initDonePromise)) {
|
|
3112
|
-
if (autoInitFunctions.includes(functionName) && params.clientId) {
|
|
3113
|
-
init({ clientId: params.clientId, env: params.env });
|
|
3114
|
-
yield initDonePromise;
|
|
3115
|
-
} else {
|
|
3116
|
-
(_a = params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.sdkNotInitialized });
|
|
3117
|
-
(_b = params.complete) == null ? void 0 : _b.call(params);
|
|
3118
|
-
return;
|
|
3119
|
-
}
|
|
3120
|
-
}
|
|
3121
|
-
if (Object.prototype.hasOwnProperty.call(target, functionName)) {
|
|
3122
|
-
return target[functionName](params);
|
|
3123
|
-
}
|
|
3124
|
-
triggerPostMessageToCore(
|
|
3125
|
-
prop,
|
|
3126
|
-
false,
|
|
3127
|
-
params,
|
|
3128
|
-
params
|
|
3129
|
-
);
|
|
3130
|
-
});
|
|
3131
|
-
}
|
|
3132
|
-
});
|
|
3133
|
-
function executePendingFunctionCalls() {
|
|
3221
|
+
function executePendingFunctionCalls(client2) {
|
|
3134
3222
|
const pendingFunctionCalls = window._ppcs;
|
|
3135
3223
|
if (!pendingFunctionCalls) {
|
|
3136
3224
|
return;
|
|
3137
3225
|
}
|
|
3138
3226
|
window._ppcs = void 0;
|
|
3139
3227
|
for (const [functionName, params] of pendingFunctionCalls) {
|
|
3140
|
-
|
|
3228
|
+
client2[functionName](params);
|
|
3141
3229
|
}
|
|
3142
3230
|
}
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3231
|
+
const clientProperties = {
|
|
3232
|
+
version: "2.37.0",
|
|
3233
|
+
revision: "1b5c920"
|
|
3234
|
+
};
|
|
3235
|
+
function getClient({ sdkType }) {
|
|
3236
|
+
clientSdkType = sdkType;
|
|
3237
|
+
const isSupportedFunction = sdkType === SdkType.MiniApp ? isSupportedMiniapp : isSupportedSmartpayment;
|
|
3238
|
+
const proxy = new Proxy(clientFunctions, {
|
|
3239
|
+
get(target, prop) {
|
|
3240
|
+
if (prop in clientProperties) {
|
|
3241
|
+
return clientProperties[prop];
|
|
3242
|
+
}
|
|
3243
|
+
const functionName = prop;
|
|
3244
|
+
if (!useAllFunctions) {
|
|
3245
|
+
if (!isSupportedFunction(functionName)) {
|
|
3246
|
+
throw new Error(
|
|
3247
|
+
`${functionName} is not supported by ${sdkType} JS SDK`
|
|
3248
|
+
);
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
return (params) => __async(this, null, function* () {
|
|
3252
|
+
var _a, _b;
|
|
3253
|
+
if (!initExemptedFunctions.includes(functionName) && !(yield initDonePromise)) {
|
|
3254
|
+
if (autoInitFunctions.includes(functionName) && params.clientId) {
|
|
3255
|
+
init({ clientId: params.clientId, env: params.env });
|
|
3256
|
+
yield initDonePromise;
|
|
3257
|
+
} else {
|
|
3258
|
+
(_a = params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.sdkNotInitialized });
|
|
3259
|
+
(_b = params.complete) == null ? void 0 : _b.call(params);
|
|
3260
|
+
return;
|
|
3261
|
+
}
|
|
3262
|
+
}
|
|
3263
|
+
if (Object.prototype.hasOwnProperty.call(target, functionName)) {
|
|
3264
|
+
return target[functionName](params);
|
|
3265
|
+
}
|
|
3266
|
+
triggerPostMessageToCore(
|
|
3267
|
+
prop,
|
|
3268
|
+
false,
|
|
3269
|
+
params,
|
|
3270
|
+
params
|
|
3271
|
+
);
|
|
3272
|
+
});
|
|
3273
|
+
}
|
|
3274
|
+
});
|
|
3275
|
+
const client2 = proxy;
|
|
3276
|
+
window._pp = client2;
|
|
3277
|
+
executePendingFunctionCalls(client2);
|
|
3278
|
+
return client2;
|
|
3279
|
+
}
|
|
3280
|
+
const client = getClient({ sdkType: SdkType.MiniApp });
|
|
3147
3281
|
const miniAppSdk = client;
|
|
3148
3282
|
export {
|
|
3149
3283
|
miniAppSdk as default
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PPFetchResult } from '../utils/fetch';
|
|
2
2
|
import { MiniAppErrorType } from './miniAppError';
|
|
3
3
|
import { UIComponentsError } from './uiComponents';
|
|
4
|
-
import { Amount, OrderItem } from '../types/makePayment';
|
|
4
|
+
import { Amount, OrderItem, OrderType } from '../types/makePayment';
|
|
5
5
|
export interface PaymentIdQuery {
|
|
6
6
|
merchant?: string;
|
|
7
7
|
sourceInfoApp?: string;
|
|
@@ -126,6 +126,10 @@ export declare enum PaymentMethodStatus {
|
|
|
126
126
|
BUSY = "BUSY",
|
|
127
127
|
SUSPENDED = "SUSPENDED"
|
|
128
128
|
}
|
|
129
|
+
export declare enum PayPayCardType {
|
|
130
|
+
GOLD = "GOLD",
|
|
131
|
+
REGULAR = "REGULAR"
|
|
132
|
+
}
|
|
129
133
|
export declare type CreditCardInfo = {
|
|
130
134
|
brand?: CreditTypes;
|
|
131
135
|
isAuthenticated?: boolean;
|
|
@@ -191,11 +195,18 @@ export declare type SbidBankInfo = {
|
|
|
191
195
|
paymentMethodStatus?: PaymentMethodStatus;
|
|
192
196
|
paymentMethodStatusLabel?: string;
|
|
193
197
|
};
|
|
194
|
-
|
|
198
|
+
declare type PayLaterCCMethodAdditionalInfo = {
|
|
199
|
+
showCardDetails?: boolean;
|
|
200
|
+
};
|
|
201
|
+
export declare type PayLaterCCMethod = MethodBase & PayLaterCCMethodAdditionalInfo & {
|
|
195
202
|
paymentMethodType: 'PAY_LATER_CC';
|
|
196
203
|
payLaterCcInfo?: PayLaterCCInfo;
|
|
197
204
|
};
|
|
198
205
|
export declare type PayLaterCCInfo = {
|
|
206
|
+
cardName?: string;
|
|
207
|
+
last4digits?: string;
|
|
208
|
+
linkedCardBrand?: Exclude<CreditTypes, CreditTypes.AMEX | CreditTypes.DINERS | CreditTypes.OTHER>;
|
|
209
|
+
linkedCardType?: PayPayCardType;
|
|
199
210
|
availableAmount?: number;
|
|
200
211
|
paymentMethodStatus?: PaymentMethodStatus;
|
|
201
212
|
paymentMethodStatusLabel?: string;
|
|
@@ -233,7 +244,7 @@ export declare type GetPaymentMethodsResponse = ResponseBase & {
|
|
|
233
244
|
payload: {
|
|
234
245
|
paymentMethodList: PaymentMethod[];
|
|
235
246
|
appealDescription: AppealDescription | null;
|
|
236
|
-
paymentMethodPreference: PaymentMethodPreference;
|
|
247
|
+
paymentMethodPreference: PaymentMethodPreference | null;
|
|
237
248
|
};
|
|
238
249
|
};
|
|
239
250
|
};
|
|
@@ -305,11 +316,12 @@ export declare type ConsultResponse = ResponseBase & {
|
|
|
305
316
|
};
|
|
306
317
|
};
|
|
307
318
|
};
|
|
308
|
-
export declare const getConsult: ({ merchant, amount, productType, metaData, }: {
|
|
319
|
+
export declare const getConsult: ({ merchant, amount, productType, metaData, orderType, }: {
|
|
309
320
|
merchant: string;
|
|
310
321
|
amount: number;
|
|
311
322
|
productType: string;
|
|
312
323
|
metaData: unknown;
|
|
324
|
+
orderType: string;
|
|
313
325
|
}) => Promise<PPFetchResult<ConsultResponse, ConsultResponse>>;
|
|
314
326
|
interface CashBackDetailHelpLink {
|
|
315
327
|
label: string;
|
|
@@ -385,7 +397,7 @@ export declare type CashBackDetailResponse = ResponseBase & {
|
|
|
385
397
|
};
|
|
386
398
|
};
|
|
387
399
|
};
|
|
388
|
-
export declare const getCashBackDetails: (paymentId: string) => Promise<PPFetchResult<CashBackDetailResponse, Record<string, unknown>>>;
|
|
400
|
+
export declare const getCashBackDetails: (paymentId: string, orderType?: OrderType) => Promise<PPFetchResult<CashBackDetailResponse, Record<string, unknown>>>;
|
|
389
401
|
export declare type SendAgePayload = {
|
|
390
402
|
month: number;
|
|
391
403
|
orderId: string;
|
|
@@ -66,7 +66,8 @@ export declare enum MiniAppErrorType {
|
|
|
66
66
|
transactionNotFound = "TRANSACTION_NOT_FOUND",
|
|
67
67
|
unexpectedOperation = "UNEXPECTED_OP",
|
|
68
68
|
merchantTimeout = "MERCHANT_TIMEOUT",
|
|
69
|
-
rateLimitExceeded = "RATE_LIMIT_EXCEEDED"
|
|
69
|
+
rateLimitExceeded = "RATE_LIMIT_EXCEEDED",
|
|
70
|
+
sdkUpgradeRequired = "SDK_UPGRADE_REQUIRED"
|
|
70
71
|
}
|
|
71
72
|
export declare class MiniAppError extends Error {
|
|
72
73
|
constructor(type: MiniAppErrorType);
|
|
@@ -49,3 +49,8 @@ export declare const img_iconInfo: string;
|
|
|
49
49
|
export declare const img_paypayMulti: string;
|
|
50
50
|
export declare const img_mobileIcon: string;
|
|
51
51
|
export declare const img_exclaimIcon: string;
|
|
52
|
+
export declare const img_iconPpcdGold: string;
|
|
53
|
+
export declare const img_iconPpcd: string;
|
|
54
|
+
export declare const img_kyc: string;
|
|
55
|
+
export declare const qr_kyc: string;
|
|
56
|
+
export declare const qr_topup: string;
|