zmp-sdk 2.53.3 → 2.53.4
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/apis/apis/openShareSheet.js +1 -1
- package/apis/common/apis/general/getZMPShareInfo.js +1 -1
- package/apis/common/apis/general/openShareSheet.js +1 -1
- package/apis/index.d.ts +3 -16
- package/apis/package.json.js +1 -1
- package/apis/types/enum.js +1 -1
- package/browser.min.js +2 -2
- package/index.d.ts +3 -17
- package/index.es.js +2 -2
- package/index.js +2 -2
- package/index.umd.js +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import t,{object as o,string as n,number as i}from'./../external/zod/lib/index.mjs.js';import r from"../appEnv/index.js";import a from"../common/notFound.js";import{functionHandler as
|
|
1
|
+
import e from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import t,{object as o,string as n,number as i}from'./../external/zod/lib/index.mjs.js';import r from"../appEnv/index.js";import a from"../common/notFound.js";import{functionHandler as p}from"../utils/decorator.js";import l from"../common/apis/general/openShareSheet.js";import{__generator as m}from'./../external/tslib/tslib.es6.js';var s=[t.union([o({type:t.enum(["text"]),data:o({text:n(),description:n().default("").optional(),autoParseLink:t.boolean().default(!1).optional()})}),o({type:t.enum(["image"]),data:o({imageUrl:n().url().optional(),imageUrls:t.array(n().url()).max(10).optional()})}),o({type:t.enum(["link"]),data:o({link:n().url(),chatOnly:t.boolean().optional()})}),o({type:t.enum(["oa"]),data:o({id:n()})}),o({type:t.enum(["gif"]),data:o({gifUrl:n().url(),imageUrl:n().url().optional(),width:i().min(0).optional(),height:i().min(0).optional()})}),o({type:t.enum(["video"]),data:o({videoThumb:n().url(),videoUrl:n().url(),width:i().min(0).optional(),height:i().min(0).optional()})}),o({type:t.enum(["zmp","zmp_deep_link"]),data:o({title:n().max(100),thumbnail:n().url(),path:n().optional(),description:n().max(400).default("").optional()})})])];function u(e){return d.apply(this,arguments)}function d(){return d=e((function(t){return m(this,(function(o){return[2,p("openShareSheet",s,[t],(n=e((function(e){var t,o;return m(this,(function(n){switch(n.label){case 0:return r.isMp?(t="zmp"===e.type?"zmp_deep_link":e.type,o=e.data,[4,l(t,o)]):[3,2];case 1:return[2,n.sent()];case 2:return r.isMpWeb?[2,Promise.resolve({status:2,shareType:0,numberOfUser:0})]:[2,Promise.reject(a("openShareSheet",{}))]}}))})),function(e){return n.apply(this,arguments)}))];var n}))})),d.apply(this,arguments)}export{u as openShareSheet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'./../../../external/@swc/helpers/src/_async_to_generator.mjs.js';import r from'./../../../external/@swc/helpers/src/_object_spread.mjs.js';import
|
|
1
|
+
import e from'./../../../external/@swc/helpers/src/_async_to_generator.mjs.js';import r from'./../../../external/@swc/helpers/src/_object_spread.mjs.js';import{apiResponse as a}from"../../../utils/response.js";import{mpPath as n,MINI_APP_LINK as s,APIS as o}from"../../../constants.js";import{__generator as t}from'./../../../external/tslib/tslib.es6.js';var c,i=(c=e((function(e,c,i,d,h,p){var l,m,u,w,f,P,_,v;return t(this,(function(t){switch(t.label){case 0:return u=new URL(location.href),w=new URLSearchParams,f="".concat(u.pathname.replace(n,"")).concat(u.search),p&&(f="/".concat(e).concat("/"===p[0]?"":"/").concat(p)),!(P=new URL("".concat(s).concat(f))).searchParams.has("env")&&(null===(l=window.APP_ENV)||void 0===l?void 0:l.length)>0&&P.searchParams.set("env",window.APP_ENV),!P.searchParams.has("version")&&(null===(m=window.APP_VERSION)||void 0===m?void 0:m.length)>0&&P.searchParams.set("version",window.APP_VERSION),w.append("title",i),w.append("description",d||""),w.append("thumbnail",h||""),w.append("url",P.href),w.append("accessToken",c||""),_={headers:{"Content-Type":"application/x-www-form-urlencoded"}},[4,fetch(o.CREATE_SHARE_LINK,r({method:"POST",body:w},_))];case 1:return[4,t.sent().json()];case 2:if(!(v=t.sent())||0!==v.err)throw a.error.cannotGetShareInfo();return P.search="".concat(P.search,"&zshareId=").concat(v.data.shareId),[2,{shareableLink:P.href}]}}))})),function(e,r,a,n,s,o){return c.apply(this,arguments)});export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'./../../../external/@swc/helpers/src/_async_to_generator.mjs.js';import r from'./../../../external/@swc/helpers/src/_object_spread.mjs.js';import
|
|
1
|
+
import e from'./../../../external/@swc/helpers/src/_async_to_generator.mjs.js';import r from'./../../../external/@swc/helpers/src/_object_spread.mjs.js';import l from'./../../../external/@swc/helpers/src/_object_spread_props.mjs.js';import t from"../../call/index.js";import i from"../../token.js";import{ZAPP_ID as n,APP_ID as s,ZALO_SUPPORT_SHARE_MULTI_IMAGE_VERSION as o}from"../../../constants.js";import u from"./getZMPShareInfo.js";import{getZaloVersionCode as a}from"../../utils.js";import{__generator as d}from'./../../../external/tslib/tslib.es6.js';import{ShareSheetType as c}from"../../../types/enum.js";import m from"../../../appEnv/getEnv.js";var h,p=(h=e((function(e,h){var p,v,f,g,_,j,U,w,b,k;return d(this,(function(d){switch(d.label){case 0:switch(p={},v=e,e){case"text":return[3,1];case"image":return[3,2];case"gif":return[3,3];case"video":return[3,4];case"link":return[3,5];case"oa":return[3,6];case"zmp_deep_link":return[3,7]}return[3,10];case 1:return p={text:null==h?void 0:h.text,desc:(null==h?void 0:h.desc)||(null==h?void 0:h.description),autoParseLink:(null==h?void 0:h.autoParseLink)?1:0},[3,11];case 2:return _=[],j=a(),U=(null===(g=m())||void 0===g?void 0:g.platformName)||"unknown",Number(j)>=o[U]&&(v="multi_image"),Array.isArray(null==h?void 0:h.imageUrls)&&(null==h?void 0:h.imageUrls.length)>0?_=null==h?void 0:h.imageUrls:_.push(null==h?void 0:h.imageUrl),p={photoUrls:_,photoUrl:null==h?void 0:h.imageUrl,caption:null==h?void 0:h.caption},[3,11];case 3:return p={photoUrl:null==h?void 0:h.imageUrl,gifUrl:null==h?void 0:h.gifUrl,width:null==h?void 0:h.width,height:null==h?void 0:h.height},[3,11];case 4:return p={videoThumb:null==h?void 0:h.videoThumb,videoUrl:null==h?void 0:h.videoUrl,width:null==h?void 0:h.width,height:null==h?void 0:h.height},[3,11];case 5:return p={link:null==h?void 0:h.link,chatOnly:(null==h?void 0:h.chatOnly)?1:0},[3,11];case 6:return p={uid:null==h?void 0:h.id},[3,11];case 7:return[4,i.getAccessToken()];case 8:return f=d.sent(),[4,u(s,f||"",(null==h?void 0:h.title)||"",(null==h?void 0:h.description)||"",(null==h?void 0:h.thumbnail)||"",null==h?void 0:h.path)];case 9:return w=d.sent().shareableLink,b=new URL(w),k=b.searchParams.getAll("zshareId"),b.searchParams.delete("zshareId"),k.length>0&&b.searchParams.append("zshareId",k[0]),p={link:b.href,chatOnly:0},[3,11];case 10:return[3,11];case 11:return[2,new Promise((function(e,i){t("OPEN_SHARESHEET",l(r({type:c[v]},p),{zapp:n}),{success:function(r){e({status:null==r?void 0:r.status,shareType:null==r?void 0:r.share_type,numberOfUser:null==r?void 0:r.uid_to_size})},fail:function(e){i(e)}},{timeout:!1})}))]}}))})),function(e,r){return h.apply(this,arguments)});export{p as default};
|
package/apis/index.d.ts
CHANGED
|
@@ -3438,7 +3438,7 @@ declare const openShareSheetArgs: ZodUnion<[ZodObject<{
|
|
|
3438
3438
|
title: string;
|
|
3439
3439
|
thumbnail: string;
|
|
3440
3440
|
};
|
|
3441
|
-
type: "
|
|
3441
|
+
type: "zmp_deep_link" | "zmp";
|
|
3442
3442
|
}, {
|
|
3443
3443
|
data: {
|
|
3444
3444
|
path?: string | undefined;
|
|
@@ -3446,7 +3446,7 @@ declare const openShareSheetArgs: ZodUnion<[ZodObject<{
|
|
|
3446
3446
|
title: string;
|
|
3447
3447
|
thumbnail: string;
|
|
3448
3448
|
};
|
|
3449
|
-
type: "
|
|
3449
|
+
type: "zmp_deep_link" | "zmp";
|
|
3450
3450
|
}>]>[];
|
|
3451
3451
|
/**
|
|
3452
3452
|
* API cho phép ứng dụng mở giao diện chia sẻ để người dùng chia sẻ thông tin với bạn bè Zalo.
|
|
@@ -3461,7 +3461,7 @@ declare const openShareSheetArgs: ZodUnion<[ZodObject<{
|
|
|
3461
3461
|
* - `oa`: Chia sẻ Official Account.
|
|
3462
3462
|
* - `gif`: Chia sẻ ảnh động.
|
|
3463
3463
|
* - `video`: Chia sẻ video.
|
|
3464
|
-
* - `zmp`:
|
|
3464
|
+
* - `zmp`: Đã ngừng hỗ trợ. SDK tự chuyển sang `zmp_deep_link`, Mini App nên đổi sang dùng `zmp_deep_link`.
|
|
3465
3465
|
* - `zmp_deep_link`: Chia sẻ page hiện tại của Zalo Mini App thông qua deep link (hỗ trợ từ API 2.25.7).
|
|
3466
3466
|
* @param {object} data Nội dung cần chia sẻ, tùy thuộc vào `type`.
|
|
3467
3467
|
*
|
|
@@ -3540,19 +3540,6 @@ declare const openShareSheetArgs: ZodUnion<[ZodObject<{
|
|
|
3540
3540
|
* console.log(data);
|
|
3541
3541
|
* ```
|
|
3542
3542
|
*
|
|
3543
|
-
* @example Chia sẻ page hiện tại của Zalo Mini App:
|
|
3544
|
-
* ```ts
|
|
3545
|
-
* const data = await openShareSheet({
|
|
3546
|
-
* type: "zmp",
|
|
3547
|
-
* data: {
|
|
3548
|
-
* title: "My Zalo Mini App - HomePage",
|
|
3549
|
-
* description: "Home page",
|
|
3550
|
-
* thumbnail: "https://sample-videos.com/img/Sample-jpg-image-50kb.jpg",
|
|
3551
|
-
* },
|
|
3552
|
-
* });
|
|
3553
|
-
* console.log(data);
|
|
3554
|
-
* ```
|
|
3555
|
-
*
|
|
3556
3543
|
* @example Chia sẻ page hiện tại của Zalo Mini App thông qua deep link:
|
|
3557
3544
|
* ```ts
|
|
3558
3545
|
* const data = await openShareSheet({
|
package/apis/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var r="2.53.
|
|
1
|
+
var r="2.53.4";export{r as version};
|
package/apis/types/enum.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,n,o,a,i,t,c,l,u,r,d,p,m,s,f,h,_,w,E;!function(e){e.none="none",e.wifi="wifi",e.cellular="cellular",e.unknown="unknown"}(e||(e={})),function(e){e.wp="wp",e.android="android",e.iOS="iOS",e.unknown="unknown"}(n||(n={})),function(e){e.AppPaused="h5.event.paused",e.AppResumed="h5.event.resumed",e.NetworkChanged="h5.event.connection.changed",e.OnDataCallback="h5.event.webview.result",e.WebviewClosed="h5.event.webview.close",e.OpenApp="h5.event.open.mp",e.AppClose="h5.event.action.close",e.PaymentCallback="payment.callback",e.PaymentResult="action.payment.result",e.PaymentDone="action.payment.done",e.PaymentClose="action.payment.close",e.DownloadProgress="h5.event.webview.download.progress"}(o||(o={})),function(e){e.DOING="doing",e.DONE="done"}(a||(a={})),function(e){e[e.user=1]="user",e[e.oa=0]="oa",e[e.aliasOA=2]="aliasOA"}(i||(i={})),function(e){e[e.user=1]="user",e[e.oa=0]="oa"}(t||(t={})),function(e){e[e.image=1]="image",e[e.multi_image=2]="multi_image",e[e.link=4]="link",e[e.profile=5]="profile"}(c||(c={})),function(e){e[e.cccd=1]="cccd"}(l||(l={})),function(e){e[e.image=1]="image",e[e.gif=11]="gif",e[e.video=12]="video",e[e.link=4]="link",e[e.oa=5]="oa",e[e.
|
|
1
|
+
var e,n,o,a,i,t,c,l,u,r,d,p,m,s,f,h,_,w,E;!function(e){e.none="none",e.wifi="wifi",e.cellular="cellular",e.unknown="unknown"}(e||(e={})),function(e){e.wp="wp",e.android="android",e.iOS="iOS",e.unknown="unknown"}(n||(n={})),function(e){e.AppPaused="h5.event.paused",e.AppResumed="h5.event.resumed",e.NetworkChanged="h5.event.connection.changed",e.OnDataCallback="h5.event.webview.result",e.WebviewClosed="h5.event.webview.close",e.OpenApp="h5.event.open.mp",e.AppClose="h5.event.action.close",e.PaymentCallback="payment.callback",e.PaymentResult="action.payment.result",e.PaymentDone="action.payment.done",e.PaymentClose="action.payment.close",e.DownloadProgress="h5.event.webview.download.progress"}(o||(o={})),function(e){e.DOING="doing",e.DONE="done"}(a||(a={})),function(e){e[e.user=1]="user",e[e.oa=0]="oa",e[e.aliasOA=2]="aliasOA"}(i||(i={})),function(e){e[e.user=1]="user",e[e.oa=0]="oa"}(t||(t={})),function(e){e[e.image=1]="image",e[e.multi_image=2]="multi_image",e[e.link=4]="link",e[e.profile=5]="profile"}(c||(c={})),function(e){e[e.cccd=1]="cccd"}(l||(l={})),function(e){e[e.image=1]="image",e[e.gif=11]="gif",e[e.video=12]="video",e[e.link=4]="link",e[e.oa=5]="oa",e[e.multi_image=21]="multi_image",e[e.zmp_deep_link=4]="zmp_deep_link",e[e.text=22]="text"}(u||(u={})),function(e){e[e.auto=1]="auto",e[e.portrait=2]="portrait",e[e.landscape=3]="landscape"}(r||(r={})),function(e){e[e.oneShot=0]="oneShot"}(d||(d={})),function(e){e[e.zcamera=3]="zcamera",e[e.zcamera_photo=1]="zcamera_photo",e[e.zcamera_video=2]="zcamera_video",e[e.zcamera_scan=7]="zcamera_scan",e[e.photo=4]="photo",e[e.video=5]="video",e[e.file=6]="file"}(p||(p={})),function(e){e.SUBSCRIPTION="SUBSCRIPTION",e.ONETIME="ONETIME"}(m||(m={})),function(e){e[e.UNKNOW=0]="UNKNOW",e[e.DEFERRED=1]="DEFERRED",e[e.IMMEDIATE_AND_CHARGE_FULL_PRICE=2]="IMMEDIATE_AND_CHARGE_FULL_PRICE"}(s||(s={})),function(e){e[e.normal=1]="normal",e[e.hidden=0]="hidden",e[e.transparent=2]="transparent"}(f||(f={})),function(e){e[e.show=1]="show",e[e.hide=0]="hide"}(h||(h={})),function(e){e[e.show=1]="show",e[e.hide=0]="hide"}(_||(_={})),function(e){e[e.left=0]="left",e[e.center=1]="center"}(w||(w={})),function(e){e.TOOL_DEL_FRIEND="tool_del_friend"}(E||(E={}));export{h as AndroidBottomNavigationBarType,t as ChatType,o as Events,m as IAPPayType,_ as IOSSafeAreaBottomType,a as JumpStatus,p as MediaPickerType,e as NetworkType,E as OpenProfilePickerType,r as OrientationType,n as PlatformType,c as PostFeedType,i as ProfileType,s as ProrationMode,l as ScanNFCType,u as ShareSheetType,f as StatusBarType,w as TextAlignType,d as VibrateType};
|