@paypay/mini-app-js-sdk 1.48.0 → 1.49.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/mini-app-js-sdk.browser.js +1 -1
- package/dist/mini-app-js-sdk.es.js +1167 -91
- package/dist/mini-app-js-sdk.min.css +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +3 -3
|
@@ -85,8 +85,8 @@ function normalizeNativeResponseData(data2) {
|
|
|
85
85
|
}
|
|
86
86
|
class JsBridge {
|
|
87
87
|
constructor(global2) {
|
|
88
|
-
this.version = "1.
|
|
89
|
-
this.revision = "
|
|
88
|
+
this.version = "1.49.0";
|
|
89
|
+
this.revision = "3c10381";
|
|
90
90
|
this.messageHandlers = new Map();
|
|
91
91
|
this.responseCallbacks = new Map();
|
|
92
92
|
this.global = global2;
|
|
@@ -1956,7 +1956,7 @@ const opaUrl = () => {
|
|
|
1956
1956
|
const createHeaderMiniAppApi = (urlEndpoint, customHeaders) => {
|
|
1957
1957
|
let headers = new Headers(__spreadValues({
|
|
1958
1958
|
"Content-Type": "application/json",
|
|
1959
|
-
"Client-Version": "1.
|
|
1959
|
+
"Client-Version": "1.49.0",
|
|
1960
1960
|
"Client-OS-Type": getRuntime()
|
|
1961
1961
|
}, customHeaders));
|
|
1962
1962
|
if (urlEndpoint === "web-api/app/v2/payment/methods" || urlEndpoint === "web-api/app/v2/payment/consult" || urlEndpoint === "web-api/app/v1/payment/cashbackDetail" || urlEndpoint === "web-api/app/v1/confirmAgeForCashback" || urlEndpoint === "web-api/app/v1/internal/request" || urlEndpoint === "web-api/app/v1/addressbyzip" || urlEndpoint === "/web-api/app/platform/v1/balance" || urlEndpoint === "web-api/app/v1/users/autoTopupConfiguration" || urlEndpoint === "web-api/app/v1/users/preTransactionAutoTopupConfiguration") {
|
|
@@ -2772,7 +2772,7 @@ function createGetter(isReadonly2 = false, shallow = false) {
|
|
|
2772
2772
|
return res;
|
|
2773
2773
|
};
|
|
2774
2774
|
}
|
|
2775
|
-
const set = /* @__PURE__ */ createSetter();
|
|
2775
|
+
const set$1 = /* @__PURE__ */ createSetter();
|
|
2776
2776
|
const shallowSet = /* @__PURE__ */ createSetter(true);
|
|
2777
2777
|
function createSetter(shallow = false) {
|
|
2778
2778
|
return function set2(target, key2, value2, receiver2) {
|
|
@@ -2824,7 +2824,7 @@ function ownKeys(target) {
|
|
|
2824
2824
|
}
|
|
2825
2825
|
const mutableHandlers = {
|
|
2826
2826
|
get,
|
|
2827
|
-
set,
|
|
2827
|
+
set: set$1,
|
|
2828
2828
|
deleteProperty,
|
|
2829
2829
|
has,
|
|
2830
2830
|
ownKeys
|
|
@@ -2892,7 +2892,7 @@ function add(value2) {
|
|
|
2892
2892
|
}
|
|
2893
2893
|
return this;
|
|
2894
2894
|
}
|
|
2895
|
-
function set$1(key2, value2) {
|
|
2895
|
+
function set$1$1(key2, value2) {
|
|
2896
2896
|
value2 = toRaw(value2);
|
|
2897
2897
|
const target = toRaw(this);
|
|
2898
2898
|
const { has: has2, get: get2 } = getProto(target);
|
|
@@ -2985,7 +2985,7 @@ function createInstrumentations() {
|
|
|
2985
2985
|
},
|
|
2986
2986
|
has: has$1,
|
|
2987
2987
|
add,
|
|
2988
|
-
set: set$1,
|
|
2988
|
+
set: set$1$1,
|
|
2989
2989
|
delete: deleteEntry,
|
|
2990
2990
|
clear,
|
|
2991
2991
|
forEach: createForEach(false, false)
|
|
@@ -2999,7 +2999,7 @@ function createInstrumentations() {
|
|
|
2999
2999
|
},
|
|
3000
3000
|
has: has$1,
|
|
3001
3001
|
add,
|
|
3002
|
-
set: set$1,
|
|
3002
|
+
set: set$1$1,
|
|
3003
3003
|
delete: deleteEntry,
|
|
3004
3004
|
clear,
|
|
3005
3005
|
forEach: createForEach(false, true)
|
|
@@ -14364,7 +14364,7 @@ var lottie_svg = { exports: {} };
|
|
|
14364
14364
|
lottie.useWebWorker = setWebWorker;
|
|
14365
14365
|
lottie.setIDPrefix = setPrefix;
|
|
14366
14366
|
lottie.__getFactory = getFactory;
|
|
14367
|
-
lottie.version = "5.9.
|
|
14367
|
+
lottie.version = "5.9.6";
|
|
14368
14368
|
function checkReady() {
|
|
14369
14369
|
if (document.readyState === "complete") {
|
|
14370
14370
|
clearInterval(readyStateCheckInterval);
|
|
@@ -22638,11 +22638,12 @@ var lottie_svg = { exports: {} };
|
|
|
22638
22638
|
}
|
|
22639
22639
|
};
|
|
22640
22640
|
function SVGDropShadowEffect(filter, filterManager, elem2, id, source) {
|
|
22641
|
-
var
|
|
22642
|
-
|
|
22643
|
-
filter.setAttribute("
|
|
22644
|
-
filter.setAttribute("
|
|
22645
|
-
filter.setAttribute("
|
|
22641
|
+
var globalFilterSize = filterManager.container.globalData.renderConfig.filterSize;
|
|
22642
|
+
var filterSize = filterManager.data.fs || globalFilterSize;
|
|
22643
|
+
filter.setAttribute("x", filterSize.x || globalFilterSize.x);
|
|
22644
|
+
filter.setAttribute("y", filterSize.y || globalFilterSize.y);
|
|
22645
|
+
filter.setAttribute("width", filterSize.width || globalFilterSize.width);
|
|
22646
|
+
filter.setAttribute("height", filterSize.height || globalFilterSize.height);
|
|
22646
22647
|
this.filterManager = filterManager;
|
|
22647
22648
|
var feGaussianBlur = createNS("feGaussianBlur");
|
|
22648
22649
|
feGaussianBlur.setAttribute("in", "SourceAlpha");
|
|
@@ -23092,31 +23093,31 @@ function _sfc_render$1r(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
23092
23093
|
const cssModules$1g = {};
|
|
23093
23094
|
cssModules$1g["$style"] = style0$1g;
|
|
23094
23095
|
var Wallet = /* @__PURE__ */ _export_sfc(_sfc_main$1r, [["render", _sfc_render$1r], ["__cssModules", cssModules$1g]]);
|
|
23095
|
-
const wrapperClass$h = "
|
|
23096
|
-
const paymentMethodContainer$3 = "
|
|
23097
|
-
const imageWrapper$2 = "
|
|
23098
|
-
const imageContainer$3 = "
|
|
23099
|
-
const roundStylePaymentMethod$2 = "
|
|
23100
|
-
const label$6 = "
|
|
23101
|
-
const mainLabel$3 = "
|
|
23102
|
-
const subLabel$3 = "
|
|
23103
|
-
const invalid$4 = "
|
|
23104
|
-
const rightAlign$4 = "
|
|
23105
|
-
const paymentMethodDisabled$3 = "
|
|
23106
|
-
const img$7 = "
|
|
23107
|
-
const round$1 = "
|
|
23108
|
-
const creditCardLabel = "
|
|
23109
|
-
const authenticateStatusContainer = "
|
|
23110
|
-
const unAuthorizedImg = "
|
|
23111
|
-
const unAuthorized = "
|
|
23112
|
-
const authorized = "
|
|
23113
|
-
const authorizedImg = "
|
|
23114
|
-
const creditCard = "
|
|
23115
|
-
const maintainanceInfo$3 = "
|
|
23116
|
-
const paymentInfo$3 = "
|
|
23117
|
-
const fullWidth$1 = "
|
|
23118
|
-
const cardInfo = "
|
|
23119
|
-
const additionDescription = "
|
|
23096
|
+
const wrapperClass$h = "_wrapperClass_mf296_1";
|
|
23097
|
+
const paymentMethodContainer$3 = "_paymentMethodContainer_mf296_1";
|
|
23098
|
+
const imageWrapper$2 = "_imageWrapper_mf296_6";
|
|
23099
|
+
const imageContainer$3 = "_imageContainer_mf296_10";
|
|
23100
|
+
const roundStylePaymentMethod$2 = "_roundStylePaymentMethod_mf296_19";
|
|
23101
|
+
const label$6 = "_label_mf296_23";
|
|
23102
|
+
const mainLabel$3 = "_mainLabel_mf296_30";
|
|
23103
|
+
const subLabel$3 = "_subLabel_mf296_37";
|
|
23104
|
+
const invalid$4 = "_invalid_mf296_46";
|
|
23105
|
+
const rightAlign$4 = "_rightAlign_mf296_58";
|
|
23106
|
+
const paymentMethodDisabled$3 = "_paymentMethodDisabled_mf296_63";
|
|
23107
|
+
const img$7 = "_img_mf296_68";
|
|
23108
|
+
const round$1 = "_round_mf296_19";
|
|
23109
|
+
const creditCardLabel = "_creditCardLabel_mf296_75";
|
|
23110
|
+
const authenticateStatusContainer = "_authenticateStatusContainer_mf296_80";
|
|
23111
|
+
const unAuthorizedImg = "_unAuthorizedImg_mf296_87";
|
|
23112
|
+
const unAuthorized = "_unAuthorized_mf296_87";
|
|
23113
|
+
const authorized = "_authorized_mf296_93";
|
|
23114
|
+
const authorizedImg = "_authorizedImg_mf296_96";
|
|
23115
|
+
const creditCard = "_creditCard_mf296_75";
|
|
23116
|
+
const maintainanceInfo$3 = "_maintainanceInfo_mf296_103";
|
|
23117
|
+
const paymentInfo$3 = "_paymentInfo_mf296_110";
|
|
23118
|
+
const fullWidth$1 = "_fullWidth_mf296_113";
|
|
23119
|
+
const cardInfo = "_cardInfo_mf296_117";
|
|
23120
|
+
const additionDescription = "_additionDescription_mf296_123";
|
|
23120
23121
|
var style0$1f = {
|
|
23121
23122
|
wrapperClass: wrapperClass$h,
|
|
23122
23123
|
paymentMethodContainer: paymentMethodContainer$3,
|
|
@@ -26306,8 +26307,8 @@ const _sfc_main$1a = defineComponent({
|
|
|
26306
26307
|
buttonDisabled.value = !editOK;
|
|
26307
26308
|
}
|
|
26308
26309
|
});
|
|
26309
|
-
const
|
|
26310
|
-
watch(
|
|
26310
|
+
const open2 = computed(() => props.open);
|
|
26311
|
+
watch(open2, (newOpen, prevOpen) => {
|
|
26311
26312
|
if (newOpen === false && prevOpen === true) {
|
|
26312
26313
|
Object.assign(state, createInitialState$1());
|
|
26313
26314
|
} else {
|
|
@@ -26511,12 +26512,12 @@ const _sfc_main$19 = defineComponent({
|
|
|
26511
26512
|
const lg2 = getLanguage();
|
|
26512
26513
|
const style = useCssModule();
|
|
26513
26514
|
const close2 = () => emit("close");
|
|
26514
|
-
const
|
|
26515
|
+
const del2 = () => emit("del");
|
|
26515
26516
|
const img2 = getImages();
|
|
26516
26517
|
return {
|
|
26517
26518
|
style,
|
|
26518
26519
|
close: close2,
|
|
26519
|
-
del,
|
|
26520
|
+
del: del2,
|
|
26520
26521
|
lg: lg2,
|
|
26521
26522
|
img: img2
|
|
26522
26523
|
};
|
|
@@ -26891,7 +26892,7 @@ const _sfc_main$17 = defineComponent({
|
|
|
26891
26892
|
return handleError2();
|
|
26892
26893
|
}
|
|
26893
26894
|
};
|
|
26894
|
-
const
|
|
26895
|
+
const del2 = async () => {
|
|
26895
26896
|
var _a, _b, _c;
|
|
26896
26897
|
const addressListResponse = await getAddressList();
|
|
26897
26898
|
if ((addressListResponse == null ? void 0 : addressListResponse.ppFetchResult) === "success") {
|
|
@@ -26926,7 +26927,7 @@ const _sfc_main$17 = defineComponent({
|
|
|
26926
26927
|
addAddress: addAddress2,
|
|
26927
26928
|
addSheetLoading: computed(() => state.addSheetLoading),
|
|
26928
26929
|
addressList: computed(() => state.addressList),
|
|
26929
|
-
del,
|
|
26930
|
+
del: del2,
|
|
26930
26931
|
isDesktopPay,
|
|
26931
26932
|
addOrEdit,
|
|
26932
26933
|
triggerLayoutUpdate,
|
|
@@ -28033,7 +28034,7 @@ const _sfc_main$11 = defineComponent({
|
|
|
28033
28034
|
},
|
|
28034
28035
|
setup(props, { emit }) {
|
|
28035
28036
|
const images2 = getImages();
|
|
28036
|
-
const
|
|
28037
|
+
const click2 = () => emit("click");
|
|
28037
28038
|
const style = useCssModule();
|
|
28038
28039
|
const cashBackInfo2 = computed(() => {
|
|
28039
28040
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -28056,7 +28057,7 @@ const _sfc_main$11 = defineComponent({
|
|
|
28056
28057
|
return cashBackInfo2.value.cashBackAmount;
|
|
28057
28058
|
});
|
|
28058
28059
|
return {
|
|
28059
|
-
click,
|
|
28060
|
+
click: click2,
|
|
28060
28061
|
style,
|
|
28061
28062
|
cashBackInfo: cashBackInfo2,
|
|
28062
28063
|
images: images2,
|
|
@@ -28425,7 +28426,7 @@ const _sfc_main$10 = defineComponent({
|
|
|
28425
28426
|
millisecond: true,
|
|
28426
28427
|
onFinish: () => {
|
|
28427
28428
|
isCountDown.value = false;
|
|
28428
|
-
|
|
28429
|
+
click2();
|
|
28429
28430
|
countDown.reset();
|
|
28430
28431
|
}
|
|
28431
28432
|
});
|
|
@@ -28448,7 +28449,7 @@ const _sfc_main$10 = defineComponent({
|
|
|
28448
28449
|
state.showShrinkAnimation = false;
|
|
28449
28450
|
}, timeout);
|
|
28450
28451
|
};
|
|
28451
|
-
const
|
|
28452
|
+
const click2 = () => {
|
|
28452
28453
|
if (state.showCashBackDetailList || props.hasCashBackAnimation && isMobile.value || props.hasCashBackAnimation && !props.hasConfirmAge && isDesktop.value)
|
|
28453
28454
|
return;
|
|
28454
28455
|
context.emit("success");
|
|
@@ -28481,7 +28482,7 @@ const _sfc_main$10 = defineComponent({
|
|
|
28481
28482
|
}),
|
|
28482
28483
|
statusLabelColor: computed(() => props.paymentResult.statusLabelColor.toLowerCase()),
|
|
28483
28484
|
labelText: computed(() => props.paymentResult.statusLabelString),
|
|
28484
|
-
click,
|
|
28485
|
+
click: click2,
|
|
28485
28486
|
copy,
|
|
28486
28487
|
showCashBackDetailList: computed(() => state.showCashBackDetailList),
|
|
28487
28488
|
openCashBackDetailList,
|
|
@@ -29026,6 +29027,7 @@ function _sfc_render$Y(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
29026
29027
|
return openBlock(), createBlock(_component_ActionSheet, { show: _ctx.show }, {
|
|
29027
29028
|
default: withCtx(() => [
|
|
29028
29029
|
createBaseVNode("div", {
|
|
29030
|
+
"data-testid": "birthday-picker",
|
|
29029
29031
|
class: normalizeClass(_ctx.$style.birthdayPicker)
|
|
29030
29032
|
}, [
|
|
29031
29033
|
createBaseVNode("div", {
|
|
@@ -29039,14 +29041,16 @@ function _sfc_render$Y(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
29039
29041
|
class: normalizeClass(_ctx.$style.content)
|
|
29040
29042
|
}, [
|
|
29041
29043
|
createBaseVNode("p", {
|
|
29042
|
-
class: normalizeClass(_ctx.$style.title)
|
|
29044
|
+
class: normalizeClass(_ctx.$style.title),
|
|
29045
|
+
"data-testid": "birthday-confirm-title"
|
|
29043
29046
|
}, [
|
|
29044
29047
|
createTextVNode(toDisplayString(_ctx.lg.birthdayConfirm.title), 1),
|
|
29045
29048
|
_hoisted_2$g,
|
|
29046
29049
|
createTextVNode(toDisplayString(_ctx.lg.birthdayConfirm.title2), 1)
|
|
29047
29050
|
], 2),
|
|
29048
29051
|
createBaseVNode("p", {
|
|
29049
|
-
class: normalizeClass(_ctx.$style.description)
|
|
29052
|
+
class: normalizeClass(_ctx.$style.description),
|
|
29053
|
+
"data-testid": "birthday-confirm-description"
|
|
29050
29054
|
}, [
|
|
29051
29055
|
createTextVNode(toDisplayString(_ctx.lg.birthdayConfirm.desc), 1),
|
|
29052
29056
|
_hoisted_3$c,
|
|
@@ -29059,7 +29063,10 @@ function _sfc_render$Y(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
29059
29063
|
createBaseVNode("div", {
|
|
29060
29064
|
class: normalizeClass(_ctx.$style.dateContainer)
|
|
29061
29065
|
}, [
|
|
29062
|
-
createVNode(_component_DateButton, {
|
|
29066
|
+
createVNode(_component_DateButton, {
|
|
29067
|
+
"data-testid": "birthday-date",
|
|
29068
|
+
onSelected: _ctx.select
|
|
29069
|
+
}, {
|
|
29063
29070
|
default: withCtx(() => [
|
|
29064
29071
|
createTextVNode(toDisplayString(_ctx.lg.birthdayConfirm.date), 1)
|
|
29065
29072
|
]),
|
|
@@ -29074,7 +29081,7 @@ function _sfc_render$Y(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
29074
29081
|
type: "primary",
|
|
29075
29082
|
block: "",
|
|
29076
29083
|
disabled: !_ctx.hasInputted,
|
|
29077
|
-
"data-
|
|
29084
|
+
"data-testid": "birthday-confirm-complete",
|
|
29078
29085
|
onClick: _ctx.complete
|
|
29079
29086
|
}, {
|
|
29080
29087
|
default: withCtx(() => [
|
|
@@ -29084,7 +29091,7 @@ function _sfc_render$Y(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
29084
29091
|
}, 8, ["disabled", "onClick"]),
|
|
29085
29092
|
createVNode(_component_Button, {
|
|
29086
29093
|
type: "link",
|
|
29087
|
-
"data-
|
|
29094
|
+
"data-testid": "birthday-confirm-help",
|
|
29088
29095
|
block: "",
|
|
29089
29096
|
onClick: _ctx.helpPageClick
|
|
29090
29097
|
}, {
|
|
@@ -29163,7 +29170,8 @@ function _sfc_render$X(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
29163
29170
|
return openBlock(), createBlock(_component_ActionSheet, { show: _ctx.show }, {
|
|
29164
29171
|
default: withCtx(() => [
|
|
29165
29172
|
createBaseVNode("div", {
|
|
29166
|
-
class: normalizeClass(_ctx.$style.birthdayPicker)
|
|
29173
|
+
class: normalizeClass(_ctx.$style.birthdayPicker),
|
|
29174
|
+
"data-testid": "birthday-confirm-error"
|
|
29167
29175
|
}, [
|
|
29168
29176
|
createBaseVNode("div", {
|
|
29169
29177
|
class: normalizeClass(_ctx.$style.header)
|
|
@@ -29177,14 +29185,16 @@ function _sfc_render$X(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
29177
29185
|
class: normalizeClass(_ctx.$style.content)
|
|
29178
29186
|
}, [
|
|
29179
29187
|
createBaseVNode("p", {
|
|
29180
|
-
class: normalizeClass(_ctx.$style.title)
|
|
29188
|
+
class: normalizeClass(_ctx.$style.title),
|
|
29189
|
+
"data-testid": "birthday-error-title"
|
|
29181
29190
|
}, [
|
|
29182
29191
|
createTextVNode(toDisplayString(_ctx.lg.birthdayConfirmError.title), 1),
|
|
29183
29192
|
_hoisted_2$f,
|
|
29184
29193
|
createTextVNode(" " + toDisplayString(_ctx.lg.birthdayConfirmError.title2), 1)
|
|
29185
29194
|
], 2),
|
|
29186
29195
|
createBaseVNode("p", {
|
|
29187
|
-
class: normalizeClass(_ctx.$style.description)
|
|
29196
|
+
class: normalizeClass(_ctx.$style.description),
|
|
29197
|
+
"data-testid": "birthday-error-description"
|
|
29188
29198
|
}, [
|
|
29189
29199
|
createTextVNode(toDisplayString(_ctx.lg.birthdayConfirmError.desc), 1),
|
|
29190
29200
|
_hoisted_3$b,
|
|
@@ -29197,7 +29207,7 @@ function _sfc_render$X(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
29197
29207
|
createVNode(_component_Button, {
|
|
29198
29208
|
type: "primary",
|
|
29199
29209
|
block: "",
|
|
29200
|
-
"data-
|
|
29210
|
+
"data-testid": "birthday-confirm-error-check-help",
|
|
29201
29211
|
onClick: _ctx.helpPageClick
|
|
29202
29212
|
}, {
|
|
29203
29213
|
default: withCtx(() => [
|
|
@@ -29208,7 +29218,7 @@ function _sfc_render$X(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
29208
29218
|
createVNode(_component_Button, {
|
|
29209
29219
|
type: "link",
|
|
29210
29220
|
block: "",
|
|
29211
|
-
"data-
|
|
29221
|
+
"data-testid": "birthday-confirm-error-close-button",
|
|
29212
29222
|
onClick: _ctx.close
|
|
29213
29223
|
}, {
|
|
29214
29224
|
default: withCtx(() => [
|
|
@@ -29356,6 +29366,8 @@ function makeSound(url) {
|
|
|
29356
29366
|
setTimeout(() => {
|
|
29357
29367
|
if (audio) {
|
|
29358
29368
|
try {
|
|
29369
|
+
if (void 0)
|
|
29370
|
+
;
|
|
29359
29371
|
audio.play().catch((e) => {
|
|
29360
29372
|
console.warn(e);
|
|
29361
29373
|
});
|
|
@@ -29591,7 +29603,7 @@ function _sfc_render$V(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
29591
29603
|
class: normalizeClass(_ctx.style.closeImage),
|
|
29592
29604
|
src: _ctx.images.whiteIconClose,
|
|
29593
29605
|
style: normalizeStyle([_ctx.isMobile ? _ctx.headerFix : {}]),
|
|
29594
|
-
"data-
|
|
29606
|
+
"data-testid": "cash-back-detail-close-button",
|
|
29595
29607
|
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.close && _ctx.close(...args))
|
|
29596
29608
|
}, null, 14, _hoisted_1$u)) : createCommentVNode("", true),
|
|
29597
29609
|
_ctx.showFullScreenContent ? (openBlock(), createElementBlock("div", {
|
|
@@ -29599,14 +29611,15 @@ function _sfc_render$V(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
29599
29611
|
class: normalizeClass(_ctx.style.campaignContainer)
|
|
29600
29612
|
}, [
|
|
29601
29613
|
createBaseVNode("p", {
|
|
29602
|
-
class: normalizeClass(_ctx.style.optionalText)
|
|
29614
|
+
class: normalizeClass(_ctx.style.optionalText),
|
|
29615
|
+
"data-testid": "cashback-optional-text"
|
|
29603
29616
|
}, toDisplayString(_ctx.animation.optionalText), 3),
|
|
29604
29617
|
createBaseVNode("div", {
|
|
29605
29618
|
class: normalizeClass(_ctx.style.actionsButtonContainer)
|
|
29606
29619
|
}, [
|
|
29607
29620
|
_ctx.showCampaignDetail ? (openBlock(), createBlock(_component_FloatingButton, {
|
|
29608
29621
|
key: 0,
|
|
29609
|
-
"data-
|
|
29622
|
+
"data-testid": "cash-back-detail-detail-button",
|
|
29610
29623
|
"image-url": _ctx.images.myOffer,
|
|
29611
29624
|
onClick: _ctx.openCampaignDetail
|
|
29612
29625
|
}, {
|
|
@@ -29617,7 +29630,7 @@ function _sfc_render$V(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
29617
29630
|
}, 8, ["image-url", "onClick"])) : createCommentVNode("", true),
|
|
29618
29631
|
_ctx.showCampaignHome ? (openBlock(), createBlock(_component_FloatingButton, {
|
|
29619
29632
|
key: 1,
|
|
29620
|
-
"data-
|
|
29633
|
+
"data-testid": "cash-back-detail-home-button",
|
|
29621
29634
|
"image-url": _ctx.images.myOffer,
|
|
29622
29635
|
onClick: _ctx.openCampaignHome
|
|
29623
29636
|
}, {
|
|
@@ -29628,7 +29641,7 @@ function _sfc_render$V(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
29628
29641
|
}, 8, ["image-url", "onClick"])) : createCommentVNode("", true),
|
|
29629
29642
|
_ctx.showShare ? (openBlock(), createBlock(_component_FloatingButton, {
|
|
29630
29643
|
key: 2,
|
|
29631
|
-
"data-
|
|
29644
|
+
"data-testid": "cash-back-detail-share-button",
|
|
29632
29645
|
"image-url": _ctx.images.share,
|
|
29633
29646
|
"button-class": _ctx.style.shareButton,
|
|
29634
29647
|
onClick: _ctx.openShare
|
|
@@ -29678,13 +29691,13 @@ const _sfc_main$U = defineComponent({
|
|
|
29678
29691
|
},
|
|
29679
29692
|
setup(props, { emit }) {
|
|
29680
29693
|
const style = useCssModule();
|
|
29681
|
-
const
|
|
29694
|
+
const click2 = (price2) => {
|
|
29682
29695
|
emit("click", price2);
|
|
29683
29696
|
};
|
|
29684
29697
|
return {
|
|
29685
29698
|
style,
|
|
29686
29699
|
numberWithCommas,
|
|
29687
|
-
click
|
|
29700
|
+
click: click2
|
|
29688
29701
|
};
|
|
29689
29702
|
}
|
|
29690
29703
|
});
|
|
@@ -32196,13 +32209,17 @@ const _sfc_main$M = defineComponent({
|
|
|
32196
32209
|
const address2 = (selectedAddress == null ? void 0 : selectedAddress.value) ? __spreadValues({}, selectedAddress.value) : null;
|
|
32197
32210
|
paymentSuccess(res, address2);
|
|
32198
32211
|
watch(() => paymentHandler.value, async () => {
|
|
32199
|
-
var _a2, _b;
|
|
32212
|
+
var _a2, _b, _c;
|
|
32200
32213
|
if (!(paymentHandler == null ? void 0 : paymentHandler.value))
|
|
32201
32214
|
return;
|
|
32215
|
+
if ((_a2 = props == null ? void 0 : props.paymentParams) == null ? void 0 : _a2.alwaysHideCompletionScreen) {
|
|
32216
|
+
endApplication();
|
|
32217
|
+
return;
|
|
32218
|
+
}
|
|
32202
32219
|
const cashBack2 = getCashBackDetail({
|
|
32203
32220
|
paymentId: res.unsigned.data.paymentId
|
|
32204
32221
|
});
|
|
32205
|
-
const alwaysDisplay = ((
|
|
32222
|
+
const alwaysDisplay = ((_b = props == null ? void 0 : props.paymentParams) == null ? void 0 : _b.alwaysDisplayCompletionScreen) || ((_c = props == null ? void 0 : props.paymentParams) == null ? void 0 : _c.isAuthorization);
|
|
32206
32223
|
endPayment();
|
|
32207
32224
|
if (alwaysDisplay) {
|
|
32208
32225
|
showPaymentResult(res.unsigned.data);
|
|
@@ -32833,14 +32850,20 @@ function createWrapComplete(fn) {
|
|
|
32833
32850
|
};
|
|
32834
32851
|
}
|
|
32835
32852
|
const makePayment = async (params) => {
|
|
32836
|
-
var _a, _b, _c, _d;
|
|
32837
|
-
if ((
|
|
32853
|
+
var _a, _b, _c, _d, _e, _f;
|
|
32854
|
+
if ((params == null ? void 0 : params.alwaysDisplayCompletionScreen) && (params == null ? void 0 : params.alwaysHideCompletionScreen)) {
|
|
32855
|
+
(_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, {
|
|
32856
|
+
errorCode: MiniAppErrorType.badRequest
|
|
32857
|
+
});
|
|
32858
|
+
return (_b = params == null ? void 0 : params.complete) == null ? void 0 : _b.call(params);
|
|
32859
|
+
}
|
|
32860
|
+
if ((_d = (_c = params == null ? void 0 : params.additionalUserInfo) == null ? void 0 : _c.userAddress) == null ? void 0 : _d.visible) {
|
|
32838
32861
|
const grantStatus = await checkPermission(PermissionName.mini_app_user_address);
|
|
32839
32862
|
if (grantStatus !== PermissionStatus.granted) {
|
|
32840
|
-
(
|
|
32863
|
+
(_e = params == null ? void 0 : params.fail) == null ? void 0 : _e.call(params, {
|
|
32841
32864
|
errorCode: MiniAppErrorType.insufficientScope
|
|
32842
32865
|
});
|
|
32843
|
-
return (
|
|
32866
|
+
return (_f = params == null ? void 0 : params.complete) == null ? void 0 : _f.call(params);
|
|
32844
32867
|
}
|
|
32845
32868
|
}
|
|
32846
32869
|
const success2 = params.success;
|
|
@@ -33010,7 +33033,7 @@ const _sfc_main$K = defineComponent({
|
|
|
33010
33033
|
},
|
|
33011
33034
|
setup(props, { emit }) {
|
|
33012
33035
|
const style = useCssModule();
|
|
33013
|
-
const
|
|
33036
|
+
const click2 = (item2, index2) => {
|
|
33014
33037
|
emit("click", item2, index2);
|
|
33015
33038
|
};
|
|
33016
33039
|
return {
|
|
@@ -33030,7 +33053,7 @@ const _sfc_main$K = defineComponent({
|
|
|
33030
33053
|
var _a, _b, _c;
|
|
33031
33054
|
return (_c = (_b = (_a = props == null ? void 0 : props.selectedPaymentMethod) == null ? void 0 : _a.descriptionBannerInfo) == null ? void 0 : _b.displayResponse) == null ? void 0 : _c.buttonList;
|
|
33032
33055
|
}),
|
|
33033
|
-
click,
|
|
33056
|
+
click: click2,
|
|
33034
33057
|
style
|
|
33035
33058
|
};
|
|
33036
33059
|
}
|
|
@@ -35234,7 +35257,7 @@ function debug(params) {
|
|
|
35234
35257
|
function execute$5(params) {
|
|
35235
35258
|
var _a;
|
|
35236
35259
|
(_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params, {
|
|
35237
|
-
v: "1.
|
|
35260
|
+
v: "1.49.0"
|
|
35238
35261
|
});
|
|
35239
35262
|
}
|
|
35240
35263
|
function useCallBack(props, ctx) {
|
|
@@ -37260,14 +37283,177 @@ function callbackHandler(params, callback) {
|
|
|
37260
37283
|
}
|
|
37261
37284
|
}
|
|
37262
37285
|
var isVue2 = false;
|
|
37286
|
+
function set(target, key2, val2) {
|
|
37287
|
+
if (Array.isArray(target)) {
|
|
37288
|
+
target.length = Math.max(target.length, key2);
|
|
37289
|
+
target.splice(key2, 1, val2);
|
|
37290
|
+
return val2;
|
|
37291
|
+
}
|
|
37292
|
+
target[key2] = val2;
|
|
37293
|
+
return val2;
|
|
37294
|
+
}
|
|
37295
|
+
function del(target, key2) {
|
|
37296
|
+
if (Array.isArray(target)) {
|
|
37297
|
+
target.splice(key2, 1);
|
|
37298
|
+
return;
|
|
37299
|
+
}
|
|
37300
|
+
delete target[key2];
|
|
37301
|
+
}
|
|
37302
|
+
function getDevtoolsGlobalHook() {
|
|
37303
|
+
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
37304
|
+
}
|
|
37305
|
+
function getTarget() {
|
|
37306
|
+
return typeof navigator !== "undefined" && typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
|
37307
|
+
}
|
|
37308
|
+
const isProxyAvailable = typeof Proxy === "function";
|
|
37309
|
+
const HOOK_SETUP = "devtools-plugin:setup";
|
|
37310
|
+
const HOOK_PLUGIN_SETTINGS_SET = "plugin:settings:set";
|
|
37311
|
+
let supported;
|
|
37312
|
+
let perf;
|
|
37313
|
+
function isPerformanceSupported() {
|
|
37314
|
+
var _a;
|
|
37315
|
+
if (supported !== void 0) {
|
|
37316
|
+
return supported;
|
|
37317
|
+
}
|
|
37318
|
+
if (typeof window !== "undefined" && window.performance) {
|
|
37319
|
+
supported = true;
|
|
37320
|
+
perf = window.performance;
|
|
37321
|
+
} else if (typeof global !== "undefined" && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
|
|
37322
|
+
supported = true;
|
|
37323
|
+
perf = global.perf_hooks.performance;
|
|
37324
|
+
} else {
|
|
37325
|
+
supported = false;
|
|
37326
|
+
}
|
|
37327
|
+
return supported;
|
|
37328
|
+
}
|
|
37329
|
+
function now() {
|
|
37330
|
+
return isPerformanceSupported() ? perf.now() : Date.now();
|
|
37331
|
+
}
|
|
37332
|
+
class ApiProxy {
|
|
37333
|
+
constructor(plugin, hook) {
|
|
37334
|
+
this.target = null;
|
|
37335
|
+
this.targetQueue = [];
|
|
37336
|
+
this.onQueue = [];
|
|
37337
|
+
this.plugin = plugin;
|
|
37338
|
+
this.hook = hook;
|
|
37339
|
+
const defaultSettings = {};
|
|
37340
|
+
if (plugin.settings) {
|
|
37341
|
+
for (const id in plugin.settings) {
|
|
37342
|
+
const item2 = plugin.settings[id];
|
|
37343
|
+
defaultSettings[id] = item2.defaultValue;
|
|
37344
|
+
}
|
|
37345
|
+
}
|
|
37346
|
+
const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
|
|
37347
|
+
let currentSettings = Object.assign({}, defaultSettings);
|
|
37348
|
+
try {
|
|
37349
|
+
const raw = localStorage.getItem(localSettingsSaveId);
|
|
37350
|
+
const data2 = JSON.parse(raw);
|
|
37351
|
+
Object.assign(currentSettings, data2);
|
|
37352
|
+
} catch (e) {
|
|
37353
|
+
}
|
|
37354
|
+
this.fallbacks = {
|
|
37355
|
+
getSettings() {
|
|
37356
|
+
return currentSettings;
|
|
37357
|
+
},
|
|
37358
|
+
setSettings(value2) {
|
|
37359
|
+
try {
|
|
37360
|
+
localStorage.setItem(localSettingsSaveId, JSON.stringify(value2));
|
|
37361
|
+
} catch (e) {
|
|
37362
|
+
}
|
|
37363
|
+
currentSettings = value2;
|
|
37364
|
+
},
|
|
37365
|
+
now() {
|
|
37366
|
+
return now();
|
|
37367
|
+
}
|
|
37368
|
+
};
|
|
37369
|
+
if (hook) {
|
|
37370
|
+
hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value2) => {
|
|
37371
|
+
if (pluginId === this.plugin.id) {
|
|
37372
|
+
this.fallbacks.setSettings(value2);
|
|
37373
|
+
}
|
|
37374
|
+
});
|
|
37375
|
+
}
|
|
37376
|
+
this.proxiedOn = new Proxy({}, {
|
|
37377
|
+
get: (_target, prop) => {
|
|
37378
|
+
if (this.target) {
|
|
37379
|
+
return this.target.on[prop];
|
|
37380
|
+
} else {
|
|
37381
|
+
return (...args) => {
|
|
37382
|
+
this.onQueue.push({
|
|
37383
|
+
method: prop,
|
|
37384
|
+
args
|
|
37385
|
+
});
|
|
37386
|
+
};
|
|
37387
|
+
}
|
|
37388
|
+
}
|
|
37389
|
+
});
|
|
37390
|
+
this.proxiedTarget = new Proxy({}, {
|
|
37391
|
+
get: (_target, prop) => {
|
|
37392
|
+
if (this.target) {
|
|
37393
|
+
return this.target[prop];
|
|
37394
|
+
} else if (prop === "on") {
|
|
37395
|
+
return this.proxiedOn;
|
|
37396
|
+
} else if (Object.keys(this.fallbacks).includes(prop)) {
|
|
37397
|
+
return (...args) => {
|
|
37398
|
+
this.targetQueue.push({
|
|
37399
|
+
method: prop,
|
|
37400
|
+
args,
|
|
37401
|
+
resolve: () => {
|
|
37402
|
+
}
|
|
37403
|
+
});
|
|
37404
|
+
return this.fallbacks[prop](...args);
|
|
37405
|
+
};
|
|
37406
|
+
} else {
|
|
37407
|
+
return (...args) => {
|
|
37408
|
+
return new Promise((resolve2) => {
|
|
37409
|
+
this.targetQueue.push({
|
|
37410
|
+
method: prop,
|
|
37411
|
+
args,
|
|
37412
|
+
resolve: resolve2
|
|
37413
|
+
});
|
|
37414
|
+
});
|
|
37415
|
+
};
|
|
37416
|
+
}
|
|
37417
|
+
}
|
|
37418
|
+
});
|
|
37419
|
+
}
|
|
37420
|
+
async setRealTarget(target) {
|
|
37421
|
+
this.target = target;
|
|
37422
|
+
for (const item2 of this.onQueue) {
|
|
37423
|
+
this.target.on[item2.method](...item2.args);
|
|
37424
|
+
}
|
|
37425
|
+
for (const item2 of this.targetQueue) {
|
|
37426
|
+
item2.resolve(await this.target[item2.method](...item2.args));
|
|
37427
|
+
}
|
|
37428
|
+
}
|
|
37429
|
+
}
|
|
37430
|
+
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
|
|
37431
|
+
const descriptor = pluginDescriptor;
|
|
37432
|
+
const target = getTarget();
|
|
37433
|
+
const hook = getDevtoolsGlobalHook();
|
|
37434
|
+
const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy;
|
|
37435
|
+
if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
|
|
37436
|
+
hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
|
|
37437
|
+
} else {
|
|
37438
|
+
const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null;
|
|
37439
|
+
const list2 = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
|
|
37440
|
+
list2.push({
|
|
37441
|
+
pluginDescriptor: descriptor,
|
|
37442
|
+
setupFn,
|
|
37443
|
+
proxy
|
|
37444
|
+
});
|
|
37445
|
+
if (proxy)
|
|
37446
|
+
setupFn(proxy.proxiedTarget);
|
|
37447
|
+
}
|
|
37448
|
+
}
|
|
37263
37449
|
/*!
|
|
37264
|
-
* pinia v2.0.
|
|
37450
|
+
* pinia v2.0.18
|
|
37265
37451
|
* (c) 2022 Eduardo San Martin Morote
|
|
37266
37452
|
* @license MIT
|
|
37267
37453
|
*/
|
|
37268
37454
|
let activePinia;
|
|
37269
37455
|
const setActivePinia = (pinia) => activePinia = pinia;
|
|
37270
|
-
const piniaSymbol = Symbol();
|
|
37456
|
+
const piniaSymbol = Symbol("pinia");
|
|
37271
37457
|
function isPlainObject(o) {
|
|
37272
37458
|
return o && typeof o === "object" && Object.prototype.toString.call(o) === "[object Object]" && typeof o.toJSON !== "function";
|
|
37273
37459
|
}
|
|
@@ -37277,6 +37463,721 @@ var MutationType;
|
|
|
37277
37463
|
MutationType2["patchObject"] = "patch object";
|
|
37278
37464
|
MutationType2["patchFunction"] = "patch function";
|
|
37279
37465
|
})(MutationType || (MutationType = {}));
|
|
37466
|
+
const IS_CLIENT = typeof window !== "undefined";
|
|
37467
|
+
const _global = /* @__PURE__ */ (() => typeof window === "object" && window.window === window ? window : typeof self === "object" && self.self === self ? self : typeof global === "object" && global.global === global ? global : typeof globalThis === "object" ? globalThis : { HTMLElement: null })();
|
|
37468
|
+
function bom(blob, { autoBom = false } = {}) {
|
|
37469
|
+
if (autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
|
|
37470
|
+
return new Blob([String.fromCharCode(65279), blob], { type: blob.type });
|
|
37471
|
+
}
|
|
37472
|
+
return blob;
|
|
37473
|
+
}
|
|
37474
|
+
function download(url, name2, opts) {
|
|
37475
|
+
const xhr = new XMLHttpRequest();
|
|
37476
|
+
xhr.open("GET", url);
|
|
37477
|
+
xhr.responseType = "blob";
|
|
37478
|
+
xhr.onload = function() {
|
|
37479
|
+
saveAs(xhr.response, name2, opts);
|
|
37480
|
+
};
|
|
37481
|
+
xhr.onerror = function() {
|
|
37482
|
+
console.error("could not download file");
|
|
37483
|
+
};
|
|
37484
|
+
xhr.send();
|
|
37485
|
+
}
|
|
37486
|
+
function corsEnabled(url) {
|
|
37487
|
+
const xhr = new XMLHttpRequest();
|
|
37488
|
+
xhr.open("HEAD", url, false);
|
|
37489
|
+
try {
|
|
37490
|
+
xhr.send();
|
|
37491
|
+
} catch (e) {
|
|
37492
|
+
}
|
|
37493
|
+
return xhr.status >= 200 && xhr.status <= 299;
|
|
37494
|
+
}
|
|
37495
|
+
function click(node) {
|
|
37496
|
+
try {
|
|
37497
|
+
node.dispatchEvent(new MouseEvent("click"));
|
|
37498
|
+
} catch (e) {
|
|
37499
|
+
const evt = document.createEvent("MouseEvents");
|
|
37500
|
+
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);
|
|
37501
|
+
node.dispatchEvent(evt);
|
|
37502
|
+
}
|
|
37503
|
+
}
|
|
37504
|
+
const _navigator = typeof navigator === "object" ? navigator : { userAgent: "" };
|
|
37505
|
+
const isMacOSWebView = /* @__PURE__ */ (() => /Macintosh/.test(_navigator.userAgent) && /AppleWebKit/.test(_navigator.userAgent) && !/Safari/.test(_navigator.userAgent))();
|
|
37506
|
+
const saveAs = !IS_CLIENT ? () => {
|
|
37507
|
+
} : typeof HTMLAnchorElement !== "undefined" && "download" in HTMLAnchorElement.prototype && !isMacOSWebView ? downloadSaveAs : "msSaveOrOpenBlob" in _navigator ? msSaveAs : fileSaverSaveAs;
|
|
37508
|
+
function downloadSaveAs(blob, name2 = "download", opts) {
|
|
37509
|
+
const a = document.createElement("a");
|
|
37510
|
+
a.download = name2;
|
|
37511
|
+
a.rel = "noopener";
|
|
37512
|
+
if (typeof blob === "string") {
|
|
37513
|
+
a.href = blob;
|
|
37514
|
+
if (a.origin !== location.origin) {
|
|
37515
|
+
if (corsEnabled(a.href)) {
|
|
37516
|
+
download(blob, name2, opts);
|
|
37517
|
+
} else {
|
|
37518
|
+
a.target = "_blank";
|
|
37519
|
+
click(a);
|
|
37520
|
+
}
|
|
37521
|
+
} else {
|
|
37522
|
+
click(a);
|
|
37523
|
+
}
|
|
37524
|
+
} else {
|
|
37525
|
+
a.href = URL.createObjectURL(blob);
|
|
37526
|
+
setTimeout(function() {
|
|
37527
|
+
URL.revokeObjectURL(a.href);
|
|
37528
|
+
}, 4e4);
|
|
37529
|
+
setTimeout(function() {
|
|
37530
|
+
click(a);
|
|
37531
|
+
}, 0);
|
|
37532
|
+
}
|
|
37533
|
+
}
|
|
37534
|
+
function msSaveAs(blob, name2 = "download", opts) {
|
|
37535
|
+
if (typeof blob === "string") {
|
|
37536
|
+
if (corsEnabled(blob)) {
|
|
37537
|
+
download(blob, name2, opts);
|
|
37538
|
+
} else {
|
|
37539
|
+
const a = document.createElement("a");
|
|
37540
|
+
a.href = blob;
|
|
37541
|
+
a.target = "_blank";
|
|
37542
|
+
setTimeout(function() {
|
|
37543
|
+
click(a);
|
|
37544
|
+
});
|
|
37545
|
+
}
|
|
37546
|
+
} else {
|
|
37547
|
+
navigator.msSaveOrOpenBlob(bom(blob, opts), name2);
|
|
37548
|
+
}
|
|
37549
|
+
}
|
|
37550
|
+
function fileSaverSaveAs(blob, name2, opts, popup) {
|
|
37551
|
+
popup = popup || open("", "_blank");
|
|
37552
|
+
if (popup) {
|
|
37553
|
+
popup.document.title = popup.document.body.innerText = "downloading...";
|
|
37554
|
+
}
|
|
37555
|
+
if (typeof blob === "string")
|
|
37556
|
+
return download(blob, name2, opts);
|
|
37557
|
+
const force = blob.type === "application/octet-stream";
|
|
37558
|
+
const isSafari2 = /constructor/i.test(String(_global.HTMLElement)) || "safari" in _global;
|
|
37559
|
+
const isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent);
|
|
37560
|
+
if ((isChromeIOS || force && isSafari2 || isMacOSWebView) && typeof FileReader !== "undefined") {
|
|
37561
|
+
const reader = new FileReader();
|
|
37562
|
+
reader.onloadend = function() {
|
|
37563
|
+
let url = reader.result;
|
|
37564
|
+
if (typeof url !== "string") {
|
|
37565
|
+
popup = null;
|
|
37566
|
+
throw new Error("Wrong reader.result type");
|
|
37567
|
+
}
|
|
37568
|
+
url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, "data:attachment/file;");
|
|
37569
|
+
if (popup) {
|
|
37570
|
+
popup.location.href = url;
|
|
37571
|
+
} else {
|
|
37572
|
+
location.assign(url);
|
|
37573
|
+
}
|
|
37574
|
+
popup = null;
|
|
37575
|
+
};
|
|
37576
|
+
reader.readAsDataURL(blob);
|
|
37577
|
+
} else {
|
|
37578
|
+
const url = URL.createObjectURL(blob);
|
|
37579
|
+
if (popup)
|
|
37580
|
+
popup.location.assign(url);
|
|
37581
|
+
else
|
|
37582
|
+
location.href = url;
|
|
37583
|
+
popup = null;
|
|
37584
|
+
setTimeout(function() {
|
|
37585
|
+
URL.revokeObjectURL(url);
|
|
37586
|
+
}, 4e4);
|
|
37587
|
+
}
|
|
37588
|
+
}
|
|
37589
|
+
function toastMessage(message, type) {
|
|
37590
|
+
const piniaMessage = "\u{1F34D} " + message;
|
|
37591
|
+
if (typeof __VUE_DEVTOOLS_TOAST__ === "function") {
|
|
37592
|
+
__VUE_DEVTOOLS_TOAST__(piniaMessage, type);
|
|
37593
|
+
} else if (type === "error") {
|
|
37594
|
+
console.error(piniaMessage);
|
|
37595
|
+
} else if (type === "warn") {
|
|
37596
|
+
console.warn(piniaMessage);
|
|
37597
|
+
} else {
|
|
37598
|
+
console.log(piniaMessage);
|
|
37599
|
+
}
|
|
37600
|
+
}
|
|
37601
|
+
function isPinia(o) {
|
|
37602
|
+
return "_a" in o && "install" in o;
|
|
37603
|
+
}
|
|
37604
|
+
function checkClipboardAccess() {
|
|
37605
|
+
if (!("clipboard" in navigator)) {
|
|
37606
|
+
toastMessage(`Your browser doesn't support the Clipboard API`, "error");
|
|
37607
|
+
return true;
|
|
37608
|
+
}
|
|
37609
|
+
}
|
|
37610
|
+
function checkNotFocusedError(error2) {
|
|
37611
|
+
if (error2 instanceof Error && error2.message.toLowerCase().includes("document is not focused")) {
|
|
37612
|
+
toastMessage('You need to activate the "Emulate a focused page" setting in the "Rendering" panel of devtools.', "warn");
|
|
37613
|
+
return true;
|
|
37614
|
+
}
|
|
37615
|
+
return false;
|
|
37616
|
+
}
|
|
37617
|
+
async function actionGlobalCopyState(pinia) {
|
|
37618
|
+
if (checkClipboardAccess())
|
|
37619
|
+
return;
|
|
37620
|
+
try {
|
|
37621
|
+
await navigator.clipboard.writeText(JSON.stringify(pinia.state.value));
|
|
37622
|
+
toastMessage("Global state copied to clipboard.");
|
|
37623
|
+
} catch (error2) {
|
|
37624
|
+
if (checkNotFocusedError(error2))
|
|
37625
|
+
return;
|
|
37626
|
+
toastMessage(`Failed to serialize the state. Check the console for more details.`, "error");
|
|
37627
|
+
console.error(error2);
|
|
37628
|
+
}
|
|
37629
|
+
}
|
|
37630
|
+
async function actionGlobalPasteState(pinia) {
|
|
37631
|
+
if (checkClipboardAccess())
|
|
37632
|
+
return;
|
|
37633
|
+
try {
|
|
37634
|
+
pinia.state.value = JSON.parse(await navigator.clipboard.readText());
|
|
37635
|
+
toastMessage("Global state pasted from clipboard.");
|
|
37636
|
+
} catch (error2) {
|
|
37637
|
+
if (checkNotFocusedError(error2))
|
|
37638
|
+
return;
|
|
37639
|
+
toastMessage(`Failed to deserialize the state from clipboard. Check the console for more details.`, "error");
|
|
37640
|
+
console.error(error2);
|
|
37641
|
+
}
|
|
37642
|
+
}
|
|
37643
|
+
async function actionGlobalSaveState(pinia) {
|
|
37644
|
+
try {
|
|
37645
|
+
saveAs(new Blob([JSON.stringify(pinia.state.value)], {
|
|
37646
|
+
type: "text/plain;charset=utf-8"
|
|
37647
|
+
}), "pinia-state.json");
|
|
37648
|
+
} catch (error2) {
|
|
37649
|
+
toastMessage(`Failed to export the state as JSON. Check the console for more details.`, "error");
|
|
37650
|
+
console.error(error2);
|
|
37651
|
+
}
|
|
37652
|
+
}
|
|
37653
|
+
let fileInput;
|
|
37654
|
+
function getFileOpener() {
|
|
37655
|
+
if (!fileInput) {
|
|
37656
|
+
fileInput = document.createElement("input");
|
|
37657
|
+
fileInput.type = "file";
|
|
37658
|
+
fileInput.accept = ".json";
|
|
37659
|
+
}
|
|
37660
|
+
function openFile() {
|
|
37661
|
+
return new Promise((resolve2, reject) => {
|
|
37662
|
+
fileInput.onchange = async () => {
|
|
37663
|
+
const files = fileInput.files;
|
|
37664
|
+
if (!files)
|
|
37665
|
+
return resolve2(null);
|
|
37666
|
+
const file = files.item(0);
|
|
37667
|
+
if (!file)
|
|
37668
|
+
return resolve2(null);
|
|
37669
|
+
return resolve2({ text: await file.text(), file });
|
|
37670
|
+
};
|
|
37671
|
+
fileInput.oncancel = () => resolve2(null);
|
|
37672
|
+
fileInput.onerror = reject;
|
|
37673
|
+
fileInput.click();
|
|
37674
|
+
});
|
|
37675
|
+
}
|
|
37676
|
+
return openFile;
|
|
37677
|
+
}
|
|
37678
|
+
async function actionGlobalOpenStateFile(pinia) {
|
|
37679
|
+
try {
|
|
37680
|
+
const open2 = await getFileOpener();
|
|
37681
|
+
const result2 = await open2();
|
|
37682
|
+
if (!result2)
|
|
37683
|
+
return;
|
|
37684
|
+
const { text: text2, file } = result2;
|
|
37685
|
+
pinia.state.value = JSON.parse(text2);
|
|
37686
|
+
toastMessage(`Global state imported from "${file.name}".`);
|
|
37687
|
+
} catch (error2) {
|
|
37688
|
+
toastMessage(`Failed to export the state as JSON. Check the console for more details.`, "error");
|
|
37689
|
+
console.error(error2);
|
|
37690
|
+
}
|
|
37691
|
+
}
|
|
37692
|
+
function formatDisplay(display) {
|
|
37693
|
+
return {
|
|
37694
|
+
_custom: {
|
|
37695
|
+
display
|
|
37696
|
+
}
|
|
37697
|
+
};
|
|
37698
|
+
}
|
|
37699
|
+
const PINIA_ROOT_LABEL = "\u{1F34D} Pinia (root)";
|
|
37700
|
+
const PINIA_ROOT_ID = "_root";
|
|
37701
|
+
function formatStoreForInspectorTree(store) {
|
|
37702
|
+
return isPinia(store) ? {
|
|
37703
|
+
id: PINIA_ROOT_ID,
|
|
37704
|
+
label: PINIA_ROOT_LABEL
|
|
37705
|
+
} : {
|
|
37706
|
+
id: store.$id,
|
|
37707
|
+
label: store.$id
|
|
37708
|
+
};
|
|
37709
|
+
}
|
|
37710
|
+
function formatStoreForInspectorState(store) {
|
|
37711
|
+
if (isPinia(store)) {
|
|
37712
|
+
const storeNames = Array.from(store._s.keys());
|
|
37713
|
+
const storeMap = store._s;
|
|
37714
|
+
const state2 = {
|
|
37715
|
+
state: storeNames.map((storeId) => ({
|
|
37716
|
+
editable: true,
|
|
37717
|
+
key: storeId,
|
|
37718
|
+
value: store.state.value[storeId]
|
|
37719
|
+
})),
|
|
37720
|
+
getters: storeNames.filter((id) => storeMap.get(id)._getters).map((id) => {
|
|
37721
|
+
const store2 = storeMap.get(id);
|
|
37722
|
+
return {
|
|
37723
|
+
editable: false,
|
|
37724
|
+
key: id,
|
|
37725
|
+
value: store2._getters.reduce((getters, key2) => {
|
|
37726
|
+
getters[key2] = store2[key2];
|
|
37727
|
+
return getters;
|
|
37728
|
+
}, {})
|
|
37729
|
+
};
|
|
37730
|
+
})
|
|
37731
|
+
};
|
|
37732
|
+
return state2;
|
|
37733
|
+
}
|
|
37734
|
+
const state = {
|
|
37735
|
+
state: Object.keys(store.$state).map((key2) => ({
|
|
37736
|
+
editable: true,
|
|
37737
|
+
key: key2,
|
|
37738
|
+
value: store.$state[key2]
|
|
37739
|
+
}))
|
|
37740
|
+
};
|
|
37741
|
+
if (store._getters && store._getters.length) {
|
|
37742
|
+
state.getters = store._getters.map((getterName) => ({
|
|
37743
|
+
editable: false,
|
|
37744
|
+
key: getterName,
|
|
37745
|
+
value: store[getterName]
|
|
37746
|
+
}));
|
|
37747
|
+
}
|
|
37748
|
+
if (store._customProperties.size) {
|
|
37749
|
+
state.customProperties = Array.from(store._customProperties).map((key2) => ({
|
|
37750
|
+
editable: true,
|
|
37751
|
+
key: key2,
|
|
37752
|
+
value: store[key2]
|
|
37753
|
+
}));
|
|
37754
|
+
}
|
|
37755
|
+
return state;
|
|
37756
|
+
}
|
|
37757
|
+
function formatEventData(events) {
|
|
37758
|
+
if (!events)
|
|
37759
|
+
return {};
|
|
37760
|
+
if (Array.isArray(events)) {
|
|
37761
|
+
return events.reduce((data2, event) => {
|
|
37762
|
+
data2.keys.push(event.key);
|
|
37763
|
+
data2.operations.push(event.type);
|
|
37764
|
+
data2.oldValue[event.key] = event.oldValue;
|
|
37765
|
+
data2.newValue[event.key] = event.newValue;
|
|
37766
|
+
return data2;
|
|
37767
|
+
}, {
|
|
37768
|
+
oldValue: {},
|
|
37769
|
+
keys: [],
|
|
37770
|
+
operations: [],
|
|
37771
|
+
newValue: {}
|
|
37772
|
+
});
|
|
37773
|
+
} else {
|
|
37774
|
+
return {
|
|
37775
|
+
operation: formatDisplay(events.type),
|
|
37776
|
+
key: formatDisplay(events.key),
|
|
37777
|
+
oldValue: events.oldValue,
|
|
37778
|
+
newValue: events.newValue
|
|
37779
|
+
};
|
|
37780
|
+
}
|
|
37781
|
+
}
|
|
37782
|
+
function formatMutationType(type) {
|
|
37783
|
+
switch (type) {
|
|
37784
|
+
case MutationType.direct:
|
|
37785
|
+
return "mutation";
|
|
37786
|
+
case MutationType.patchFunction:
|
|
37787
|
+
return "$patch";
|
|
37788
|
+
case MutationType.patchObject:
|
|
37789
|
+
return "$patch";
|
|
37790
|
+
default:
|
|
37791
|
+
return "unknown";
|
|
37792
|
+
}
|
|
37793
|
+
}
|
|
37794
|
+
let isTimelineActive = true;
|
|
37795
|
+
const componentStateTypes = [];
|
|
37796
|
+
const MUTATIONS_LAYER_ID = "pinia:mutations";
|
|
37797
|
+
const INSPECTOR_ID = "pinia";
|
|
37798
|
+
const getStoreType = (id) => "\u{1F34D} " + id;
|
|
37799
|
+
function registerPiniaDevtools(app, pinia) {
|
|
37800
|
+
setupDevtoolsPlugin({
|
|
37801
|
+
id: "dev.esm.pinia",
|
|
37802
|
+
label: "Pinia \u{1F34D}",
|
|
37803
|
+
logo: "https://pinia.vuejs.org/logo.svg",
|
|
37804
|
+
packageName: "pinia",
|
|
37805
|
+
homepage: "https://pinia.vuejs.org",
|
|
37806
|
+
componentStateTypes,
|
|
37807
|
+
app
|
|
37808
|
+
}, (api2) => {
|
|
37809
|
+
if (typeof api2.now !== "function") {
|
|
37810
|
+
toastMessage("You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.");
|
|
37811
|
+
}
|
|
37812
|
+
api2.addTimelineLayer({
|
|
37813
|
+
id: MUTATIONS_LAYER_ID,
|
|
37814
|
+
label: `Pinia \u{1F34D}`,
|
|
37815
|
+
color: 15064968
|
|
37816
|
+
});
|
|
37817
|
+
api2.addInspector({
|
|
37818
|
+
id: INSPECTOR_ID,
|
|
37819
|
+
label: "Pinia \u{1F34D}",
|
|
37820
|
+
icon: "storage",
|
|
37821
|
+
treeFilterPlaceholder: "Search stores",
|
|
37822
|
+
actions: [
|
|
37823
|
+
{
|
|
37824
|
+
icon: "content_copy",
|
|
37825
|
+
action: () => {
|
|
37826
|
+
actionGlobalCopyState(pinia);
|
|
37827
|
+
},
|
|
37828
|
+
tooltip: "Serialize and copy the state"
|
|
37829
|
+
},
|
|
37830
|
+
{
|
|
37831
|
+
icon: "content_paste",
|
|
37832
|
+
action: async () => {
|
|
37833
|
+
await actionGlobalPasteState(pinia);
|
|
37834
|
+
api2.sendInspectorTree(INSPECTOR_ID);
|
|
37835
|
+
api2.sendInspectorState(INSPECTOR_ID);
|
|
37836
|
+
},
|
|
37837
|
+
tooltip: "Replace the state with the content of your clipboard"
|
|
37838
|
+
},
|
|
37839
|
+
{
|
|
37840
|
+
icon: "save",
|
|
37841
|
+
action: () => {
|
|
37842
|
+
actionGlobalSaveState(pinia);
|
|
37843
|
+
},
|
|
37844
|
+
tooltip: "Save the state as a JSON file"
|
|
37845
|
+
},
|
|
37846
|
+
{
|
|
37847
|
+
icon: "folder_open",
|
|
37848
|
+
action: async () => {
|
|
37849
|
+
await actionGlobalOpenStateFile(pinia);
|
|
37850
|
+
api2.sendInspectorTree(INSPECTOR_ID);
|
|
37851
|
+
api2.sendInspectorState(INSPECTOR_ID);
|
|
37852
|
+
},
|
|
37853
|
+
tooltip: "Import the state from a JSON file"
|
|
37854
|
+
}
|
|
37855
|
+
],
|
|
37856
|
+
nodeActions: [
|
|
37857
|
+
{
|
|
37858
|
+
icon: "restore",
|
|
37859
|
+
tooltip: "Reset the state (option store only)",
|
|
37860
|
+
action: (nodeId) => {
|
|
37861
|
+
const store = pinia._s.get(nodeId);
|
|
37862
|
+
if (!store) {
|
|
37863
|
+
toastMessage(`Cannot reset "${nodeId}" store because it wasn't found.`, "warn");
|
|
37864
|
+
} else if (!store._isOptionsAPI) {
|
|
37865
|
+
toastMessage(`Cannot reset "${nodeId}" store because it's a setup store.`, "warn");
|
|
37866
|
+
} else {
|
|
37867
|
+
store.$reset();
|
|
37868
|
+
toastMessage(`Store "${nodeId}" reset.`);
|
|
37869
|
+
}
|
|
37870
|
+
}
|
|
37871
|
+
}
|
|
37872
|
+
]
|
|
37873
|
+
});
|
|
37874
|
+
api2.on.inspectComponent((payload, ctx) => {
|
|
37875
|
+
const proxy = payload.componentInstance && payload.componentInstance.proxy;
|
|
37876
|
+
if (proxy && proxy._pStores) {
|
|
37877
|
+
const piniaStores = payload.componentInstance.proxy._pStores;
|
|
37878
|
+
Object.values(piniaStores).forEach((store) => {
|
|
37879
|
+
payload.instanceData.state.push({
|
|
37880
|
+
type: getStoreType(store.$id),
|
|
37881
|
+
key: "state",
|
|
37882
|
+
editable: true,
|
|
37883
|
+
value: store._isOptionsAPI ? {
|
|
37884
|
+
_custom: {
|
|
37885
|
+
value: toRaw(store.$state),
|
|
37886
|
+
actions: [
|
|
37887
|
+
{
|
|
37888
|
+
icon: "restore",
|
|
37889
|
+
tooltip: "Reset the state of this store",
|
|
37890
|
+
action: () => store.$reset()
|
|
37891
|
+
}
|
|
37892
|
+
]
|
|
37893
|
+
}
|
|
37894
|
+
} : Object.keys(store.$state).reduce((state, key2) => {
|
|
37895
|
+
state[key2] = store.$state[key2];
|
|
37896
|
+
return state;
|
|
37897
|
+
}, {})
|
|
37898
|
+
});
|
|
37899
|
+
if (store._getters && store._getters.length) {
|
|
37900
|
+
payload.instanceData.state.push({
|
|
37901
|
+
type: getStoreType(store.$id),
|
|
37902
|
+
key: "getters",
|
|
37903
|
+
editable: false,
|
|
37904
|
+
value: store._getters.reduce((getters, key2) => {
|
|
37905
|
+
try {
|
|
37906
|
+
getters[key2] = store[key2];
|
|
37907
|
+
} catch (error2) {
|
|
37908
|
+
getters[key2] = error2;
|
|
37909
|
+
}
|
|
37910
|
+
return getters;
|
|
37911
|
+
}, {})
|
|
37912
|
+
});
|
|
37913
|
+
}
|
|
37914
|
+
});
|
|
37915
|
+
}
|
|
37916
|
+
});
|
|
37917
|
+
api2.on.getInspectorTree((payload) => {
|
|
37918
|
+
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
|
|
37919
|
+
let stores = [pinia];
|
|
37920
|
+
stores = stores.concat(Array.from(pinia._s.values()));
|
|
37921
|
+
payload.rootNodes = (payload.filter ? stores.filter((store) => "$id" in store ? store.$id.toLowerCase().includes(payload.filter.toLowerCase()) : PINIA_ROOT_LABEL.toLowerCase().includes(payload.filter.toLowerCase())) : stores).map(formatStoreForInspectorTree);
|
|
37922
|
+
}
|
|
37923
|
+
});
|
|
37924
|
+
api2.on.getInspectorState((payload) => {
|
|
37925
|
+
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
|
|
37926
|
+
const inspectedStore = payload.nodeId === PINIA_ROOT_ID ? pinia : pinia._s.get(payload.nodeId);
|
|
37927
|
+
if (!inspectedStore) {
|
|
37928
|
+
return;
|
|
37929
|
+
}
|
|
37930
|
+
if (inspectedStore) {
|
|
37931
|
+
payload.state = formatStoreForInspectorState(inspectedStore);
|
|
37932
|
+
}
|
|
37933
|
+
}
|
|
37934
|
+
});
|
|
37935
|
+
api2.on.editInspectorState((payload, ctx) => {
|
|
37936
|
+
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
|
|
37937
|
+
const inspectedStore = payload.nodeId === PINIA_ROOT_ID ? pinia : pinia._s.get(payload.nodeId);
|
|
37938
|
+
if (!inspectedStore) {
|
|
37939
|
+
return toastMessage(`store "${payload.nodeId}" not found`, "error");
|
|
37940
|
+
}
|
|
37941
|
+
const { path } = payload;
|
|
37942
|
+
if (!isPinia(inspectedStore)) {
|
|
37943
|
+
if (path.length !== 1 || !inspectedStore._customProperties.has(path[0]) || path[0] in inspectedStore.$state) {
|
|
37944
|
+
path.unshift("$state");
|
|
37945
|
+
}
|
|
37946
|
+
} else {
|
|
37947
|
+
path.unshift("state");
|
|
37948
|
+
}
|
|
37949
|
+
isTimelineActive = false;
|
|
37950
|
+
payload.set(inspectedStore, path, payload.state.value);
|
|
37951
|
+
isTimelineActive = true;
|
|
37952
|
+
}
|
|
37953
|
+
});
|
|
37954
|
+
api2.on.editComponentState((payload) => {
|
|
37955
|
+
if (payload.type.startsWith("\u{1F34D}")) {
|
|
37956
|
+
const storeId = payload.type.replace(/^🍍\s*/, "");
|
|
37957
|
+
const store = pinia._s.get(storeId);
|
|
37958
|
+
if (!store) {
|
|
37959
|
+
return toastMessage(`store "${storeId}" not found`, "error");
|
|
37960
|
+
}
|
|
37961
|
+
const { path } = payload;
|
|
37962
|
+
if (path[0] !== "state") {
|
|
37963
|
+
return toastMessage(`Invalid path for store "${storeId}":
|
|
37964
|
+
${path}
|
|
37965
|
+
Only state can be modified.`);
|
|
37966
|
+
}
|
|
37967
|
+
path[0] = "$state";
|
|
37968
|
+
isTimelineActive = false;
|
|
37969
|
+
payload.set(store, path, payload.state.value);
|
|
37970
|
+
isTimelineActive = true;
|
|
37971
|
+
}
|
|
37972
|
+
});
|
|
37973
|
+
});
|
|
37974
|
+
}
|
|
37975
|
+
function addStoreToDevtools(app, store) {
|
|
37976
|
+
if (!componentStateTypes.includes(getStoreType(store.$id))) {
|
|
37977
|
+
componentStateTypes.push(getStoreType(store.$id));
|
|
37978
|
+
}
|
|
37979
|
+
setupDevtoolsPlugin({
|
|
37980
|
+
id: "dev.esm.pinia",
|
|
37981
|
+
label: "Pinia \u{1F34D}",
|
|
37982
|
+
logo: "https://pinia.vuejs.org/logo.svg",
|
|
37983
|
+
packageName: "pinia",
|
|
37984
|
+
homepage: "https://pinia.vuejs.org",
|
|
37985
|
+
componentStateTypes,
|
|
37986
|
+
app,
|
|
37987
|
+
settings: {
|
|
37988
|
+
logStoreChanges: {
|
|
37989
|
+
label: "Notify about new/deleted stores",
|
|
37990
|
+
type: "boolean",
|
|
37991
|
+
defaultValue: true
|
|
37992
|
+
}
|
|
37993
|
+
}
|
|
37994
|
+
}, (api2) => {
|
|
37995
|
+
const now2 = typeof api2.now === "function" ? api2.now.bind(api2) : Date.now;
|
|
37996
|
+
store.$onAction(({ after, onError, name: name2, args }) => {
|
|
37997
|
+
const groupId = runningActionId++;
|
|
37998
|
+
api2.addTimelineEvent({
|
|
37999
|
+
layerId: MUTATIONS_LAYER_ID,
|
|
38000
|
+
event: {
|
|
38001
|
+
time: now2(),
|
|
38002
|
+
title: "\u{1F6EB} " + name2,
|
|
38003
|
+
subtitle: "start",
|
|
38004
|
+
data: {
|
|
38005
|
+
store: formatDisplay(store.$id),
|
|
38006
|
+
action: formatDisplay(name2),
|
|
38007
|
+
args
|
|
38008
|
+
},
|
|
38009
|
+
groupId
|
|
38010
|
+
}
|
|
38011
|
+
});
|
|
38012
|
+
after((result2) => {
|
|
38013
|
+
activeAction = void 0;
|
|
38014
|
+
api2.addTimelineEvent({
|
|
38015
|
+
layerId: MUTATIONS_LAYER_ID,
|
|
38016
|
+
event: {
|
|
38017
|
+
time: now2(),
|
|
38018
|
+
title: "\u{1F6EC} " + name2,
|
|
38019
|
+
subtitle: "end",
|
|
38020
|
+
data: {
|
|
38021
|
+
store: formatDisplay(store.$id),
|
|
38022
|
+
action: formatDisplay(name2),
|
|
38023
|
+
args,
|
|
38024
|
+
result: result2
|
|
38025
|
+
},
|
|
38026
|
+
groupId
|
|
38027
|
+
}
|
|
38028
|
+
});
|
|
38029
|
+
});
|
|
38030
|
+
onError((error2) => {
|
|
38031
|
+
activeAction = void 0;
|
|
38032
|
+
api2.addTimelineEvent({
|
|
38033
|
+
layerId: MUTATIONS_LAYER_ID,
|
|
38034
|
+
event: {
|
|
38035
|
+
time: now2(),
|
|
38036
|
+
logType: "error",
|
|
38037
|
+
title: "\u{1F4A5} " + name2,
|
|
38038
|
+
subtitle: "end",
|
|
38039
|
+
data: {
|
|
38040
|
+
store: formatDisplay(store.$id),
|
|
38041
|
+
action: formatDisplay(name2),
|
|
38042
|
+
args,
|
|
38043
|
+
error: error2
|
|
38044
|
+
},
|
|
38045
|
+
groupId
|
|
38046
|
+
}
|
|
38047
|
+
});
|
|
38048
|
+
});
|
|
38049
|
+
}, true);
|
|
38050
|
+
store._customProperties.forEach((name2) => {
|
|
38051
|
+
watch(() => unref(store[name2]), (newValue, oldValue) => {
|
|
38052
|
+
api2.notifyComponentUpdate();
|
|
38053
|
+
api2.sendInspectorState(INSPECTOR_ID);
|
|
38054
|
+
if (isTimelineActive) {
|
|
38055
|
+
api2.addTimelineEvent({
|
|
38056
|
+
layerId: MUTATIONS_LAYER_ID,
|
|
38057
|
+
event: {
|
|
38058
|
+
time: now2(),
|
|
38059
|
+
title: "Change",
|
|
38060
|
+
subtitle: name2,
|
|
38061
|
+
data: {
|
|
38062
|
+
newValue,
|
|
38063
|
+
oldValue
|
|
38064
|
+
},
|
|
38065
|
+
groupId: activeAction
|
|
38066
|
+
}
|
|
38067
|
+
});
|
|
38068
|
+
}
|
|
38069
|
+
}, { deep: true });
|
|
38070
|
+
});
|
|
38071
|
+
store.$subscribe(({ events, type }, state) => {
|
|
38072
|
+
api2.notifyComponentUpdate();
|
|
38073
|
+
api2.sendInspectorState(INSPECTOR_ID);
|
|
38074
|
+
if (!isTimelineActive)
|
|
38075
|
+
return;
|
|
38076
|
+
const eventData = {
|
|
38077
|
+
time: now2(),
|
|
38078
|
+
title: formatMutationType(type),
|
|
38079
|
+
data: __spreadValues({
|
|
38080
|
+
store: formatDisplay(store.$id)
|
|
38081
|
+
}, formatEventData(events)),
|
|
38082
|
+
groupId: activeAction
|
|
38083
|
+
};
|
|
38084
|
+
activeAction = void 0;
|
|
38085
|
+
if (type === MutationType.patchFunction) {
|
|
38086
|
+
eventData.subtitle = "\u2935\uFE0F";
|
|
38087
|
+
} else if (type === MutationType.patchObject) {
|
|
38088
|
+
eventData.subtitle = "\u{1F9E9}";
|
|
38089
|
+
} else if (events && !Array.isArray(events)) {
|
|
38090
|
+
eventData.subtitle = events.type;
|
|
38091
|
+
}
|
|
38092
|
+
if (events) {
|
|
38093
|
+
eventData.data["rawEvent(s)"] = {
|
|
38094
|
+
_custom: {
|
|
38095
|
+
display: "DebuggerEvent",
|
|
38096
|
+
type: "object",
|
|
38097
|
+
tooltip: "raw DebuggerEvent[]",
|
|
38098
|
+
value: events
|
|
38099
|
+
}
|
|
38100
|
+
};
|
|
38101
|
+
}
|
|
38102
|
+
api2.addTimelineEvent({
|
|
38103
|
+
layerId: MUTATIONS_LAYER_ID,
|
|
38104
|
+
event: eventData
|
|
38105
|
+
});
|
|
38106
|
+
}, { detached: true, flush: "sync" });
|
|
38107
|
+
const hotUpdate = store._hotUpdate;
|
|
38108
|
+
store._hotUpdate = markRaw((newStore) => {
|
|
38109
|
+
hotUpdate(newStore);
|
|
38110
|
+
api2.addTimelineEvent({
|
|
38111
|
+
layerId: MUTATIONS_LAYER_ID,
|
|
38112
|
+
event: {
|
|
38113
|
+
time: now2(),
|
|
38114
|
+
title: "\u{1F525} " + store.$id,
|
|
38115
|
+
subtitle: "HMR update",
|
|
38116
|
+
data: {
|
|
38117
|
+
store: formatDisplay(store.$id),
|
|
38118
|
+
info: formatDisplay(`HMR update`)
|
|
38119
|
+
}
|
|
38120
|
+
}
|
|
38121
|
+
});
|
|
38122
|
+
api2.notifyComponentUpdate();
|
|
38123
|
+
api2.sendInspectorTree(INSPECTOR_ID);
|
|
38124
|
+
api2.sendInspectorState(INSPECTOR_ID);
|
|
38125
|
+
});
|
|
38126
|
+
const { $dispose } = store;
|
|
38127
|
+
store.$dispose = () => {
|
|
38128
|
+
$dispose();
|
|
38129
|
+
api2.notifyComponentUpdate();
|
|
38130
|
+
api2.sendInspectorTree(INSPECTOR_ID);
|
|
38131
|
+
api2.sendInspectorState(INSPECTOR_ID);
|
|
38132
|
+
api2.getSettings().logStoreChanges && toastMessage(`Disposed "${store.$id}" store \u{1F5D1}`);
|
|
38133
|
+
};
|
|
38134
|
+
api2.notifyComponentUpdate();
|
|
38135
|
+
api2.sendInspectorTree(INSPECTOR_ID);
|
|
38136
|
+
api2.sendInspectorState(INSPECTOR_ID);
|
|
38137
|
+
api2.getSettings().logStoreChanges && toastMessage(`"${store.$id}" store installed \u{1F195}`);
|
|
38138
|
+
});
|
|
38139
|
+
}
|
|
38140
|
+
let runningActionId = 0;
|
|
38141
|
+
let activeAction;
|
|
38142
|
+
function patchActionForGrouping(store, actionNames) {
|
|
38143
|
+
const actions = actionNames.reduce((storeActions, actionName) => {
|
|
38144
|
+
storeActions[actionName] = toRaw(store)[actionName];
|
|
38145
|
+
return storeActions;
|
|
38146
|
+
}, {});
|
|
38147
|
+
for (const actionName in actions) {
|
|
38148
|
+
store[actionName] = function() {
|
|
38149
|
+
const _actionId = runningActionId;
|
|
38150
|
+
const trackedStore = new Proxy(store, {
|
|
38151
|
+
get(...args) {
|
|
38152
|
+
activeAction = _actionId;
|
|
38153
|
+
return Reflect.get(...args);
|
|
38154
|
+
},
|
|
38155
|
+
set(...args) {
|
|
38156
|
+
activeAction = _actionId;
|
|
38157
|
+
return Reflect.set(...args);
|
|
38158
|
+
}
|
|
38159
|
+
});
|
|
38160
|
+
return actions[actionName].apply(trackedStore, arguments);
|
|
38161
|
+
};
|
|
38162
|
+
}
|
|
38163
|
+
}
|
|
38164
|
+
function devtoolsPlugin({ app, store, options }) {
|
|
38165
|
+
if (store.$id.startsWith("__hot:")) {
|
|
38166
|
+
return;
|
|
38167
|
+
}
|
|
38168
|
+
if (options.state) {
|
|
38169
|
+
store._isOptionsAPI = true;
|
|
38170
|
+
}
|
|
38171
|
+
if (typeof options.state === "function") {
|
|
38172
|
+
patchActionForGrouping(store, Object.keys(options.actions));
|
|
38173
|
+
const originalHotUpdate = store._hotUpdate;
|
|
38174
|
+
toRaw(store)._hotUpdate = function(newStore) {
|
|
38175
|
+
originalHotUpdate.apply(this, arguments);
|
|
38176
|
+
patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions));
|
|
38177
|
+
};
|
|
38178
|
+
}
|
|
38179
|
+
addStoreToDevtools(app, store);
|
|
38180
|
+
}
|
|
37280
38181
|
function createPinia() {
|
|
37281
38182
|
const scope = effectScope(true);
|
|
37282
38183
|
const state = scope.run(() => ref({}));
|
|
@@ -37289,6 +38190,9 @@ function createPinia() {
|
|
|
37289
38190
|
pinia._a = app;
|
|
37290
38191
|
app.provide(piniaSymbol, pinia);
|
|
37291
38192
|
app.config.globalProperties.$pinia = pinia;
|
|
38193
|
+
if (IS_CLIENT) {
|
|
38194
|
+
registerPiniaDevtools(app, pinia);
|
|
38195
|
+
}
|
|
37292
38196
|
toBeInstalled.forEach((plugin) => _p.push(plugin));
|
|
37293
38197
|
toBeInstalled = [];
|
|
37294
38198
|
}
|
|
@@ -37307,8 +38211,28 @@ function createPinia() {
|
|
|
37307
38211
|
_s: new Map(),
|
|
37308
38212
|
state
|
|
37309
38213
|
});
|
|
38214
|
+
if (IS_CLIENT && true && typeof Proxy !== "undefined") {
|
|
38215
|
+
pinia.use(devtoolsPlugin);
|
|
38216
|
+
}
|
|
37310
38217
|
return pinia;
|
|
37311
38218
|
}
|
|
38219
|
+
function patchObject(newState, oldState) {
|
|
38220
|
+
for (const key2 in oldState) {
|
|
38221
|
+
const subPatch = oldState[key2];
|
|
38222
|
+
if (!(key2 in newState)) {
|
|
38223
|
+
continue;
|
|
38224
|
+
}
|
|
38225
|
+
const targetValue = newState[key2];
|
|
38226
|
+
if (isPlainObject(targetValue) && isPlainObject(subPatch) && !isRef(subPatch) && !isReactive(subPatch)) {
|
|
38227
|
+
newState[key2] = patchObject(targetValue, subPatch);
|
|
38228
|
+
} else {
|
|
38229
|
+
{
|
|
38230
|
+
newState[key2] = subPatch;
|
|
38231
|
+
}
|
|
38232
|
+
}
|
|
38233
|
+
}
|
|
38234
|
+
return newState;
|
|
38235
|
+
}
|
|
37312
38236
|
const noop = () => {
|
|
37313
38237
|
};
|
|
37314
38238
|
function addSubscription(subscriptions, callback, detached, onCleanup = noop) {
|
|
@@ -37344,7 +38268,7 @@ function mergeReactiveObjects(target, patchToApply) {
|
|
|
37344
38268
|
}
|
|
37345
38269
|
return target;
|
|
37346
38270
|
}
|
|
37347
|
-
const skipHydrateSymbol = Symbol();
|
|
38271
|
+
const skipHydrateSymbol = Symbol("pinia:skipHydration");
|
|
37348
38272
|
function shouldHydrate(obj) {
|
|
37349
38273
|
return !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);
|
|
37350
38274
|
}
|
|
@@ -37357,13 +38281,16 @@ function createOptionsStore(id, options, pinia, hot) {
|
|
|
37357
38281
|
const initialState2 = pinia.state.value[id];
|
|
37358
38282
|
let store;
|
|
37359
38283
|
function setup() {
|
|
37360
|
-
if (!initialState2 &&
|
|
38284
|
+
if (!initialState2 && !hot) {
|
|
37361
38285
|
{
|
|
37362
38286
|
pinia.state.value[id] = state ? state() : {};
|
|
37363
38287
|
}
|
|
37364
38288
|
}
|
|
37365
|
-
const localState = toRefs(pinia.state.value[id]);
|
|
38289
|
+
const localState = hot ? toRefs(ref(state ? state() : {}).value) : toRefs(pinia.state.value[id]);
|
|
37366
38290
|
return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name2) => {
|
|
38291
|
+
if (name2 in localState) {
|
|
38292
|
+
console.warn(`[\u{1F34D}]: A getter cannot have the same name as another state property. Rename one of them. Found with "${name2}" in store "${id}".`);
|
|
38293
|
+
}
|
|
37367
38294
|
computedGetters[name2] = markRaw(computed(() => {
|
|
37368
38295
|
setActivePinia(pinia);
|
|
37369
38296
|
const store2 = pinia._s.get(id);
|
|
@@ -37384,25 +38311,44 @@ function createOptionsStore(id, options, pinia, hot) {
|
|
|
37384
38311
|
function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {
|
|
37385
38312
|
let scope;
|
|
37386
38313
|
const optionsForPlugin = assign({ actions: {} }, options);
|
|
38314
|
+
if (!pinia._e.active) {
|
|
38315
|
+
throw new Error("Pinia destroyed");
|
|
38316
|
+
}
|
|
37387
38317
|
const $subscribeOptions = {
|
|
37388
38318
|
deep: true
|
|
37389
38319
|
};
|
|
38320
|
+
{
|
|
38321
|
+
$subscribeOptions.onTrigger = (event) => {
|
|
38322
|
+
if (isListening) {
|
|
38323
|
+
debuggerEvents = event;
|
|
38324
|
+
} else if (isListening == false && !store._hotUpdating) {
|
|
38325
|
+
if (Array.isArray(debuggerEvents)) {
|
|
38326
|
+
debuggerEvents.push(event);
|
|
38327
|
+
} else {
|
|
38328
|
+
console.error("\u{1F34D} debuggerEvents should be an array. This is most likely an internal Pinia bug.");
|
|
38329
|
+
}
|
|
38330
|
+
}
|
|
38331
|
+
};
|
|
38332
|
+
}
|
|
37390
38333
|
let isListening;
|
|
37391
38334
|
let isSyncListening;
|
|
37392
38335
|
let subscriptions = markRaw([]);
|
|
37393
38336
|
let actionSubscriptions = markRaw([]);
|
|
37394
38337
|
let debuggerEvents;
|
|
37395
38338
|
const initialState2 = pinia.state.value[$id];
|
|
37396
|
-
if (!isOptionsStore && !initialState2 &&
|
|
38339
|
+
if (!isOptionsStore && !initialState2 && !hot) {
|
|
37397
38340
|
{
|
|
37398
38341
|
pinia.state.value[$id] = {};
|
|
37399
38342
|
}
|
|
37400
38343
|
}
|
|
37401
|
-
ref({});
|
|
38344
|
+
const hotState = ref({});
|
|
37402
38345
|
let activeListener;
|
|
37403
38346
|
function $patch(partialStateOrMutator) {
|
|
37404
38347
|
let subscriptionMutation;
|
|
37405
38348
|
isListening = isSyncListening = false;
|
|
38349
|
+
{
|
|
38350
|
+
debuggerEvents = [];
|
|
38351
|
+
}
|
|
37406
38352
|
if (typeof partialStateOrMutator === "function") {
|
|
37407
38353
|
partialStateOrMutator(pinia.state.value[$id]);
|
|
37408
38354
|
subscriptionMutation = {
|
|
@@ -37428,7 +38374,9 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
|
|
|
37428
38374
|
isSyncListening = true;
|
|
37429
38375
|
triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);
|
|
37430
38376
|
}
|
|
37431
|
-
const $reset =
|
|
38377
|
+
const $reset = () => {
|
|
38378
|
+
throw new Error(`\u{1F34D}: Store "${$id}" is built using the setup syntax and does not implement $reset().`);
|
|
38379
|
+
};
|
|
37432
38380
|
function $dispose() {
|
|
37433
38381
|
scope.stop();
|
|
37434
38382
|
subscriptions = [];
|
|
@@ -37474,6 +38422,12 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
|
|
|
37474
38422
|
return ret;
|
|
37475
38423
|
};
|
|
37476
38424
|
}
|
|
38425
|
+
const _hmrPayload = /* @__PURE__ */ markRaw({
|
|
38426
|
+
actions: {},
|
|
38427
|
+
getters: {},
|
|
38428
|
+
state: [],
|
|
38429
|
+
hotState
|
|
38430
|
+
});
|
|
37477
38431
|
const partialStore = {
|
|
37478
38432
|
_p: pinia,
|
|
37479
38433
|
$id,
|
|
@@ -37495,7 +38449,10 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
|
|
|
37495
38449
|
},
|
|
37496
38450
|
$dispose
|
|
37497
38451
|
};
|
|
37498
|
-
const store = reactive(assign({
|
|
38452
|
+
const store = reactive(assign(IS_CLIENT ? {
|
|
38453
|
+
_customProperties: markRaw(new Set()),
|
|
38454
|
+
_hmrPayload
|
|
38455
|
+
} : {}, partialStore));
|
|
37499
38456
|
pinia._s.set($id, store);
|
|
37500
38457
|
const setupStore = pinia._e.run(() => {
|
|
37501
38458
|
scope = effectScope();
|
|
@@ -37504,7 +38461,9 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
|
|
|
37504
38461
|
for (const key2 in setupStore) {
|
|
37505
38462
|
const prop = setupStore[key2];
|
|
37506
38463
|
if (isRef(prop) && !isComputed(prop) || isReactive(prop)) {
|
|
37507
|
-
if (
|
|
38464
|
+
if (hot) {
|
|
38465
|
+
set(hotState.value, key2, toRef(setupStore, key2));
|
|
38466
|
+
} else if (!isOptionsStore) {
|
|
37508
38467
|
if (initialState2 && shouldHydrate(prop)) {
|
|
37509
38468
|
if (isRef(prop)) {
|
|
37510
38469
|
prop.value = initialState2[key2];
|
|
@@ -37516,29 +38475,120 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
|
|
|
37516
38475
|
pinia.state.value[$id][key2] = prop;
|
|
37517
38476
|
}
|
|
37518
38477
|
}
|
|
38478
|
+
{
|
|
38479
|
+
_hmrPayload.state.push(key2);
|
|
38480
|
+
}
|
|
37519
38481
|
} else if (typeof prop === "function") {
|
|
37520
|
-
const actionValue = wrapAction(key2, prop);
|
|
38482
|
+
const actionValue = hot ? prop : wrapAction(key2, prop);
|
|
37521
38483
|
{
|
|
37522
38484
|
setupStore[key2] = actionValue;
|
|
37523
38485
|
}
|
|
38486
|
+
{
|
|
38487
|
+
_hmrPayload.actions[key2] = prop;
|
|
38488
|
+
}
|
|
37524
38489
|
optionsForPlugin.actions[key2] = prop;
|
|
37525
|
-
} else
|
|
37526
|
-
|
|
38490
|
+
} else {
|
|
38491
|
+
if (isComputed(prop)) {
|
|
38492
|
+
_hmrPayload.getters[key2] = isOptionsStore ? options.getters[key2] : prop;
|
|
38493
|
+
if (IS_CLIENT) {
|
|
38494
|
+
const getters = setupStore._getters || (setupStore._getters = markRaw([]));
|
|
38495
|
+
getters.push(key2);
|
|
38496
|
+
}
|
|
38497
|
+
}
|
|
38498
|
+
}
|
|
37527
38499
|
}
|
|
37528
38500
|
{
|
|
37529
38501
|
assign(store, setupStore);
|
|
37530
38502
|
assign(toRaw(store), setupStore);
|
|
37531
38503
|
}
|
|
37532
38504
|
Object.defineProperty(store, "$state", {
|
|
37533
|
-
get: () => pinia.state.value[$id],
|
|
38505
|
+
get: () => hot ? hotState.value : pinia.state.value[$id],
|
|
37534
38506
|
set: (state) => {
|
|
38507
|
+
if (hot) {
|
|
38508
|
+
throw new Error("cannot set hotState");
|
|
38509
|
+
}
|
|
37535
38510
|
$patch(($state) => {
|
|
37536
38511
|
assign($state, state);
|
|
37537
38512
|
});
|
|
37538
38513
|
}
|
|
37539
38514
|
});
|
|
38515
|
+
{
|
|
38516
|
+
store._hotUpdate = markRaw((newStore) => {
|
|
38517
|
+
store._hotUpdating = true;
|
|
38518
|
+
newStore._hmrPayload.state.forEach((stateKey) => {
|
|
38519
|
+
if (stateKey in store.$state) {
|
|
38520
|
+
const newStateTarget = newStore.$state[stateKey];
|
|
38521
|
+
const oldStateSource = store.$state[stateKey];
|
|
38522
|
+
if (typeof newStateTarget === "object" && isPlainObject(newStateTarget) && isPlainObject(oldStateSource)) {
|
|
38523
|
+
patchObject(newStateTarget, oldStateSource);
|
|
38524
|
+
} else {
|
|
38525
|
+
newStore.$state[stateKey] = oldStateSource;
|
|
38526
|
+
}
|
|
38527
|
+
}
|
|
38528
|
+
set(store, stateKey, toRef(newStore.$state, stateKey));
|
|
38529
|
+
});
|
|
38530
|
+
Object.keys(store.$state).forEach((stateKey) => {
|
|
38531
|
+
if (!(stateKey in newStore.$state)) {
|
|
38532
|
+
del(store, stateKey);
|
|
38533
|
+
}
|
|
38534
|
+
});
|
|
38535
|
+
isListening = false;
|
|
38536
|
+
isSyncListening = false;
|
|
38537
|
+
pinia.state.value[$id] = toRef(newStore._hmrPayload, "hotState");
|
|
38538
|
+
isSyncListening = true;
|
|
38539
|
+
nextTick().then(() => {
|
|
38540
|
+
isListening = true;
|
|
38541
|
+
});
|
|
38542
|
+
for (const actionName in newStore._hmrPayload.actions) {
|
|
38543
|
+
const action = newStore[actionName];
|
|
38544
|
+
set(store, actionName, wrapAction(actionName, action));
|
|
38545
|
+
}
|
|
38546
|
+
for (const getterName in newStore._hmrPayload.getters) {
|
|
38547
|
+
const getter = newStore._hmrPayload.getters[getterName];
|
|
38548
|
+
const getterValue = isOptionsStore ? computed(() => {
|
|
38549
|
+
setActivePinia(pinia);
|
|
38550
|
+
return getter.call(store, store);
|
|
38551
|
+
}) : getter;
|
|
38552
|
+
set(store, getterName, getterValue);
|
|
38553
|
+
}
|
|
38554
|
+
Object.keys(store._hmrPayload.getters).forEach((key2) => {
|
|
38555
|
+
if (!(key2 in newStore._hmrPayload.getters)) {
|
|
38556
|
+
del(store, key2);
|
|
38557
|
+
}
|
|
38558
|
+
});
|
|
38559
|
+
Object.keys(store._hmrPayload.actions).forEach((key2) => {
|
|
38560
|
+
if (!(key2 in newStore._hmrPayload.actions)) {
|
|
38561
|
+
del(store, key2);
|
|
38562
|
+
}
|
|
38563
|
+
});
|
|
38564
|
+
store._hmrPayload = newStore._hmrPayload;
|
|
38565
|
+
store._getters = newStore._getters;
|
|
38566
|
+
store._hotUpdating = false;
|
|
38567
|
+
});
|
|
38568
|
+
const nonEnumerable = {
|
|
38569
|
+
writable: true,
|
|
38570
|
+
configurable: true,
|
|
38571
|
+
enumerable: false
|
|
38572
|
+
};
|
|
38573
|
+
if (IS_CLIENT) {
|
|
38574
|
+
["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((p2) => {
|
|
38575
|
+
Object.defineProperty(store, p2, __spreadValues({
|
|
38576
|
+
value: store[p2]
|
|
38577
|
+
}, nonEnumerable));
|
|
38578
|
+
});
|
|
38579
|
+
}
|
|
38580
|
+
}
|
|
37540
38581
|
pinia._p.forEach((extender) => {
|
|
37541
|
-
{
|
|
38582
|
+
if (IS_CLIENT) {
|
|
38583
|
+
const extensions = scope.run(() => extender({
|
|
38584
|
+
store,
|
|
38585
|
+
app: pinia._a,
|
|
38586
|
+
pinia,
|
|
38587
|
+
options: optionsForPlugin
|
|
38588
|
+
}));
|
|
38589
|
+
Object.keys(extensions || {}).forEach((key2) => store._customProperties.add(key2));
|
|
38590
|
+
assign(store, extensions);
|
|
38591
|
+
} else {
|
|
37542
38592
|
assign(store, scope.run(() => extender({
|
|
37543
38593
|
store,
|
|
37544
38594
|
app: pinia._a,
|
|
@@ -37547,6 +38597,11 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
|
|
|
37547
38597
|
})));
|
|
37548
38598
|
}
|
|
37549
38599
|
});
|
|
38600
|
+
if (store.$state && typeof store.$state === "object" && typeof store.$state.constructor === "function" && !store.$state.constructor.toString().includes("[native code]")) {
|
|
38601
|
+
console.warn(`[\u{1F34D}]: The "state" must be a plain object. It cannot be
|
|
38602
|
+
state: () => new MyClass()
|
|
38603
|
+
Found in store "${store.$id}".`);
|
|
38604
|
+
}
|
|
37550
38605
|
if (initialState2 && isOptionsStore && options.hydrate) {
|
|
37551
38606
|
options.hydrate(store.$state, initialState2);
|
|
37552
38607
|
}
|
|
@@ -37570,6 +38625,12 @@ function defineStore(idOrOptions, setup, setupOptions) {
|
|
|
37570
38625
|
pinia = pinia || currentInstance2 && inject(piniaSymbol);
|
|
37571
38626
|
if (pinia)
|
|
37572
38627
|
setActivePinia(pinia);
|
|
38628
|
+
if (!activePinia) {
|
|
38629
|
+
throw new Error(`[\u{1F34D}]: getActivePinia was called with no active Pinia. Did you forget to install pinia?
|
|
38630
|
+
const pinia = createPinia()
|
|
38631
|
+
app.use(pinia)
|
|
38632
|
+
This will fail in production.`);
|
|
38633
|
+
}
|
|
37573
38634
|
pinia = activePinia;
|
|
37574
38635
|
if (!pinia._s.has(id)) {
|
|
37575
38636
|
if (isSetupStore) {
|
|
@@ -37577,8 +38638,23 @@ function defineStore(idOrOptions, setup, setupOptions) {
|
|
|
37577
38638
|
} else {
|
|
37578
38639
|
createOptionsStore(id, options, pinia);
|
|
37579
38640
|
}
|
|
38641
|
+
{
|
|
38642
|
+
useStore._pinia = pinia;
|
|
38643
|
+
}
|
|
37580
38644
|
}
|
|
37581
38645
|
const store = pinia._s.get(id);
|
|
38646
|
+
if (hot) {
|
|
38647
|
+
const hotId = "__hot:" + id;
|
|
38648
|
+
const newStore = isSetupStore ? createSetupStore(hotId, setup, options, pinia, true) : createOptionsStore(hotId, assign({}, options), pinia, true);
|
|
38649
|
+
hot._hotUpdate(newStore);
|
|
38650
|
+
delete pinia.state.value[hotId];
|
|
38651
|
+
pinia._s.delete(hotId);
|
|
38652
|
+
}
|
|
38653
|
+
if (IS_CLIENT && currentInstance2 && currentInstance2.proxy && !hot) {
|
|
38654
|
+
const vm = currentInstance2.proxy;
|
|
38655
|
+
const cache = "_pStores" in vm ? vm._pStores : vm._pStores = {};
|
|
38656
|
+
cache[id] = store;
|
|
38657
|
+
}
|
|
37582
38658
|
return store;
|
|
37583
38659
|
}
|
|
37584
38660
|
useStore.$id = id;
|